@vertebr/admin 0.4.0 → 0.5.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/api/catalog.d.ts +59 -0
- package/dist/api/catalog.d.ts.map +1 -0
- package/dist/api/catalog.js +85 -0
- package/dist/api/catalog.js.map +1 -0
- package/dist/api/configs.d.ts +15 -0
- package/dist/api/configs.d.ts.map +1 -0
- package/dist/api/configs.js +43 -0
- package/dist/api/configs.js.map +1 -0
- package/dist/api/emails.d.ts +85 -0
- package/dist/api/emails.d.ts.map +1 -0
- package/dist/api/emails.js +520 -0
- package/dist/api/emails.js.map +1 -0
- package/dist/api/gallery.d.ts +28 -0
- package/dist/api/gallery.d.ts.map +1 -0
- package/dist/api/gallery.js +91 -0
- package/dist/api/gallery.js.map +1 -0
- package/dist/api/metrics.d.ts +22 -0
- package/dist/api/metrics.d.ts.map +1 -0
- package/dist/api/metrics.js +38 -0
- package/dist/api/metrics.js.map +1 -0
- package/dist/api/public.d.ts +22 -0
- package/dist/api/public.d.ts.map +1 -0
- package/dist/api/public.js +69 -0
- package/dist/api/public.js.map +1 -0
- package/dist/api/request.d.ts +26 -0
- package/dist/api/request.d.ts.map +1 -0
- package/dist/api/request.js +38 -0
- package/dist/api/request.js.map +1 -0
- package/dist/api/resources.d.ts +85 -0
- package/dist/api/resources.d.ts.map +1 -0
- package/dist/api/resources.js +263 -0
- package/dist/api/resources.js.map +1 -0
- package/dist/api/routes.d.ts +8 -0
- package/dist/api/routes.d.ts.map +1 -0
- package/dist/api/routes.js +202 -0
- package/dist/api/routes.js.map +1 -0
- package/dist/api/spa.d.ts +2 -0
- package/dist/api/spa.d.ts.map +1 -0
- package/dist/api/spa.js +34 -0
- package/dist/api/spa.js.map +1 -0
- package/dist/connectors/payments/connector.d.ts +30 -0
- package/dist/connectors/payments/connector.d.ts.map +1 -0
- package/dist/connectors/payments/connector.js +226 -0
- package/dist/connectors/payments/connector.js.map +1 -0
- package/dist/connectors/payments/index.d.ts +4 -0
- package/dist/connectors/payments/index.d.ts.map +1 -0
- package/dist/connectors/payments/index.js +10 -0
- package/dist/connectors/payments/index.js.map +1 -0
- package/dist/connectors/payments/stripe.d.ts +99 -0
- package/dist/connectors/payments/stripe.d.ts.map +1 -0
- package/dist/connectors/payments/stripe.js +189 -0
- package/dist/connectors/payments/stripe.js.map +1 -0
- package/dist/connectors/payments/types.d.ts +67 -0
- package/dist/connectors/payments/types.d.ts.map +1 -0
- package/dist/connectors/payments/types.js +16 -0
- package/dist/connectors/payments/types.js.map +1 -0
- package/dist/connectors/stripe.d.ts +19 -0
- package/dist/connectors/stripe.d.ts.map +1 -0
- package/dist/connectors/stripe.js +26 -0
- package/dist/connectors/stripe.js.map +1 -0
- package/dist/constants.d.ts +5 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +8 -0
- package/dist/constants.js.map +1 -0
- package/dist/createAdmin.d.ts +3 -0
- package/dist/createAdmin.d.ts.map +1 -0
- package/dist/createAdmin.js +152 -0
- package/dist/createAdmin.js.map +1 -0
- package/dist/database/connector.d.ts +1 -1
- package/dist/database/connector.d.ts.map +1 -1
- package/dist/database/connector.js +42 -6
- package/dist/database/connector.js.map +1 -1
- package/dist/database/types.d.ts +20 -5
- package/dist/database/types.d.ts.map +1 -1
- package/dist/errors.d.ts +17 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +36 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +9 -264
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -957
- package/dist/index.js.map +1 -1
- package/dist/mail.d.ts +23 -0
- package/dist/mail.d.ts.map +1 -0
- package/dist/mail.js +248 -0
- package/dist/mail.js.map +1 -0
- package/dist/schema.d.ts +6 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/services/environment.d.ts +8 -0
- package/dist/services/environment.d.ts.map +1 -0
- package/dist/services/environment.js +78 -0
- package/dist/services/environment.js.map +1 -0
- package/dist/services/registry.d.ts +6 -0
- package/dist/services/registry.d.ts.map +1 -0
- package/dist/services/registry.js +32 -0
- package/dist/services/registry.js.map +1 -0
- package/dist/services/state.d.ts +25 -0
- package/dist/services/state.d.ts.map +1 -0
- package/dist/services/state.js +3 -0
- package/dist/services/state.js.map +1 -0
- package/dist/types/actions.d.ts +15 -0
- package/dist/types/actions.d.ts.map +1 -0
- package/dist/types/actions.js +3 -0
- package/dist/types/actions.js.map +1 -0
- package/dist/types/admin.d.ts +83 -0
- package/dist/types/admin.d.ts.map +1 -0
- package/dist/types/admin.js +3 -0
- package/dist/types/admin.js.map +1 -0
- package/dist/types/auth.d.ts +67 -0
- package/dist/types/auth.d.ts.map +1 -0
- package/dist/types/auth.js +3 -0
- package/dist/types/auth.js.map +1 -0
- package/dist/types/config.d.ts +39 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +3 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/index.d.ts +15 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +7 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/layout.d.ts +29 -0
- package/dist/types/layout.d.ts.map +1 -0
- package/dist/types/layout.js +3 -0
- package/dist/types/layout.js.map +1 -0
- package/dist/types/mail/catalog.d.ts +104 -0
- package/dist/types/mail/catalog.d.ts.map +1 -0
- package/dist/types/mail/catalog.js +3 -0
- package/dist/types/mail/catalog.js.map +1 -0
- package/dist/types/mail/definition.d.ts +68 -0
- package/dist/types/mail/definition.d.ts.map +1 -0
- package/dist/types/mail/definition.js +3 -0
- package/dist/types/mail/definition.js.map +1 -0
- package/dist/types/mail/index.d.ts +4 -0
- package/dist/types/mail/index.d.ts.map +1 -0
- package/dist/types/mail/index.js +3 -0
- package/dist/types/mail/index.js.map +1 -0
- package/dist/types/mail/message.d.ts +45 -0
- package/dist/types/mail/message.d.ts.map +1 -0
- package/dist/types/mail/message.js +3 -0
- package/dist/types/mail/message.js.map +1 -0
- package/dist/types/metrics.d.ts +46 -0
- package/dist/types/metrics.d.ts.map +1 -0
- package/dist/types/metrics.js +3 -0
- package/dist/types/metrics.js.map +1 -0
- package/dist/types/resource.d.ts +41 -0
- package/dist/types/resource.d.ts.map +1 -0
- package/dist/types/resource.js +3 -0
- package/dist/types/resource.js.map +1 -0
- package/dist/utils/auth.d.ts +4 -0
- package/dist/utils/auth.d.ts.map +1 -0
- package/dist/utils/auth.js +29 -0
- package/dist/utils/auth.js.map +1 -0
- package/dist/utils/config.d.ts +4 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +14 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/http.d.ts +7 -0
- package/dist/utils/http.d.ts.map +1 -0
- package/dist/utils/http.js +61 -0
- package/dist/utils/http.js.map +1 -0
- package/dist/utils/metricsRange.d.ts +34 -0
- package/dist/utils/metricsRange.d.ts.map +1 -0
- package/dist/utils/metricsRange.js +121 -0
- package/dist/utils/metricsRange.js.map +1 -0
- package/dist/utils/sidebar.d.ts +2 -0
- package/dist/utils/sidebar.d.ts.map +1 -0
- package/dist/utils/sidebar.js +8 -0
- package/dist/utils/sidebar.js.map +1 -0
- package/dist/utils/staticDir.d.ts +2 -0
- package/dist/utils/staticDir.d.ts.map +1 -0
- package/dist/utils/staticDir.js +16 -0
- package/dist/utils/staticDir.js.map +1 -0
- package/dist/utils/uploads.d.ts +6 -0
- package/dist/utils/uploads.d.ts.map +1 -0
- package/dist/utils/uploads.js +66 -0
- package/dist/utils/uploads.js.map +1 -0
- package/package.json +1 -1
- package/static/assets/index-DKyVvFeT.js +332 -0
- package/static/assets/index-DUwFg1bw.css +1 -0
- package/static/index.html +2 -2
- package/static/assets/index-CZ7lykOe.css +0 -1
- package/static/assets/index-DvZiFDex.js +0 -329
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
var bE=t=>{throw TypeError(t)};var SE=(t,e,n)=>e.has(t)||bE("Cannot "+n);var Ln=(t,e,n)=>(SE(t,e,"read from private field"),n?n.call(t):e.get(t)),wE=(t,e,n)=>e.has(t)?bE("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),yv=(t,e,n,r)=>(SE(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);function jz(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 PR(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var vv={exports:{}},pu={};var xE;function Bz(){if(xE)return pu;xE=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 c in i)c!=="key"&&(s[c]=i[c])}else s=i;return i=s.ref,{$$typeof:t,type:r,key:o,ref:i!==void 0?i:null,props:s}}return pu.Fragment=e,pu.jsx=n,pu.jsxs=n,pu}var kE;function $z(){return kE||(kE=1,vv.exports=Bz()),vv.exports}var C=$z(),bv={exports:{}},qe={};var CE;function Vz(){if(CE)return qe;CE=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"),c=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(P){return P===null||typeof P!="object"?null:(P=g&&P[g]||P["@@iterator"],typeof P=="function"?P:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,x={};function k(P,W,ce){this.props=P,this.context=W,this.refs=x,this.updater=ce||S}k.prototype.isReactComponent={},k.prototype.setState=function(P,W){if(typeof P!="object"&&typeof P!="function"&&P!=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,P,W,"setState")},k.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function T(){}T.prototype=k.prototype;function A(P,W,ce){this.props=P,this.context=W,this.refs=x,this.updater=ce||S}var _=A.prototype=new T;_.constructor=A,w(_,k.prototype),_.isPureReactComponent=!0;var O=Array.isArray;function N(){}var I={H:null,A:null,T:null,S:null},z=Object.prototype.hasOwnProperty;function q(P,W,ce){var me=ce.ref;return{$$typeof:t,type:P,key:W,ref:me!==void 0?me:null,props:ce}}function Z(P,W){return q(P.type,W,P.props)}function ae(P){return typeof P=="object"&&P!==null&&P.$$typeof===t}function X(P){var W={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(ce){return W[ce]})}var te=/\/+/g;function ie(P,W){return typeof P=="object"&&P!==null&&P.key!=null?X(""+P.key):W.toString(36)}function de(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(N,N):(P.status="pending",P.then(function(W){P.status==="pending"&&(P.status="fulfilled",P.value=W)},function(W){P.status==="pending"&&(P.status="rejected",P.reason=W)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function B(P,W,ce,me,Ae){var Le=typeof P;(Le==="undefined"||Le==="boolean")&&(P=null);var He=!1;if(P===null)He=!0;else switch(Le){case"bigint":case"string":case"number":He=!0;break;case"object":switch(P.$$typeof){case t:case e:He=!0;break;case h:return He=P._init,B(He(P._payload),W,ce,me,Ae)}}if(He)return Ae=Ae(P),He=me===""?"."+ie(P,0):me,O(Ae)?(ce="",He!=null&&(ce=He.replace(te,"$&/")+"/"),B(Ae,W,ce,"",function(ct){return ct})):Ae!=null&&(ae(Ae)&&(Ae=Z(Ae,ce+(Ae.key==null||P&&P.key===Ae.key?"":(""+Ae.key).replace(te,"$&/")+"/")+He)),W.push(Ae)),1;He=0;var Ce=me===""?".":me+":";if(O(P))for(var Ie=0;Ie<P.length;Ie++)me=P[Ie],Le=Ce+ie(me,Ie),He+=B(me,W,ce,Le,Ae);else if(Ie=y(P),typeof Ie=="function")for(P=Ie.call(P),Ie=0;!(me=P.next()).done;)me=me.value,Le=Ce+ie(me,Ie++),He+=B(me,W,ce,Le,Ae);else if(Le==="object"){if(typeof P.then=="function")return B(de(P),W,ce,me,Ae);throw W=String(P),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return He}function Y(P,W,ce){if(P==null)return P;var me=[],Ae=0;return B(P,me,"","",function(Le){return W.call(ce,Le,Ae++)}),me}function oe(P){if(P._status===-1){var W=P._result;W=W(),W.then(function(ce){(P._status===0||P._status===-1)&&(P._status=1,P._result=ce)},function(ce){(P._status===0||P._status===-1)&&(P._status=2,P._result=ce)}),P._status===-1&&(P._status=0,P._result=W)}if(P._status===1)return P._result.default;throw P._result}var ye=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},ke={map:Y,forEach:function(P,W,ce){Y(P,function(){W.apply(this,arguments)},ce)},count:function(P){var W=0;return Y(P,function(){W++}),W},toArray:function(P){return Y(P,function(W){return W})||[]},only:function(P){if(!ae(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return qe.Activity=m,qe.Children=ke,qe.Component=k,qe.Fragment=n,qe.Profiler=i,qe.PureComponent=A,qe.StrictMode=r,qe.Suspense=u,qe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,qe.__COMPILER_RUNTIME={__proto__:null,c:function(P){return I.H.useMemoCache(P)}},qe.cache=function(P){return function(){return P.apply(null,arguments)}},qe.cacheSignal=function(){return null},qe.cloneElement=function(P,W,ce){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var me=w({},P.props),Ae=P.key;if(W!=null)for(Le in W.key!==void 0&&(Ae=""+W.key),W)!z.call(W,Le)||Le==="key"||Le==="__self"||Le==="__source"||Le==="ref"&&W.ref===void 0||(me[Le]=W[Le]);var Le=arguments.length-2;if(Le===1)me.children=ce;else if(1<Le){for(var He=Array(Le),Ce=0;Ce<Le;Ce++)He[Ce]=arguments[Ce+2];me.children=He}return q(P.type,Ae,me)},qe.createContext=function(P){return P={$$typeof:o,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:s,_context:P},P},qe.createElement=function(P,W,ce){var me,Ae={},Le=null;if(W!=null)for(me in W.key!==void 0&&(Le=""+W.key),W)z.call(W,me)&&me!=="key"&&me!=="__self"&&me!=="__source"&&(Ae[me]=W[me]);var He=arguments.length-2;if(He===1)Ae.children=ce;else if(1<He){for(var Ce=Array(He),Ie=0;Ie<He;Ie++)Ce[Ie]=arguments[Ie+2];Ae.children=Ce}if(P&&P.defaultProps)for(me in He=P.defaultProps,He)Ae[me]===void 0&&(Ae[me]=He[me]);return q(P,Le,Ae)},qe.createRef=function(){return{current:null}},qe.forwardRef=function(P){return{$$typeof:c,render:P}},qe.isValidElement=ae,qe.lazy=function(P){return{$$typeof:h,_payload:{_status:-1,_result:P},_init:oe}},qe.memo=function(P,W){return{$$typeof:f,type:P,compare:W===void 0?null:W}},qe.startTransition=function(P){var W=I.T,ce={};I.T=ce;try{var me=P(),Ae=I.S;Ae!==null&&Ae(ce,me),typeof me=="object"&&me!==null&&typeof me.then=="function"&&me.then(N,ye)}catch(Le){ye(Le)}finally{W!==null&&ce.types!==null&&(W.types=ce.types),I.T=W}},qe.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()},qe.use=function(P){return I.H.use(P)},qe.useActionState=function(P,W,ce){return I.H.useActionState(P,W,ce)},qe.useCallback=function(P,W){return I.H.useCallback(P,W)},qe.useContext=function(P){return I.H.useContext(P)},qe.useDebugValue=function(){},qe.useDeferredValue=function(P,W){return I.H.useDeferredValue(P,W)},qe.useEffect=function(P,W){return I.H.useEffect(P,W)},qe.useEffectEvent=function(P){return I.H.useEffectEvent(P)},qe.useId=function(){return I.H.useId()},qe.useImperativeHandle=function(P,W,ce){return I.H.useImperativeHandle(P,W,ce)},qe.useInsertionEffect=function(P,W){return I.H.useInsertionEffect(P,W)},qe.useLayoutEffect=function(P,W){return I.H.useLayoutEffect(P,W)},qe.useMemo=function(P,W){return I.H.useMemo(P,W)},qe.useOptimistic=function(P,W){return I.H.useOptimistic(P,W)},qe.useReducer=function(P,W,ce){return I.H.useReducer(P,W,ce)},qe.useRef=function(P){return I.H.useRef(P)},qe.useState=function(P){return I.H.useState(P)},qe.useSyncExternalStore=function(P,W,ce){return I.H.useSyncExternalStore(P,W,ce)},qe.useTransition=function(){return I.H.useTransition()},qe.version="19.2.8",qe}var EE;function kd(){return EE||(EE=1,bv.exports=Vz()),bv.exports}var R=kd();const Be=PR(R),Cd=jz({__proto__:null,default:Be},[R]);var Sv={exports:{}},mu={},wv={exports:{}},xv={};var TE;function Hz(){return TE||(TE=1,(function(t){function e(B,Y){var oe=B.length;B.push(Y);e:for(;0<oe;){var ye=oe-1>>>1,ke=B[ye];if(0<i(ke,Y))B[ye]=Y,B[oe]=ke,oe=ye;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var Y=B[0],oe=B.pop();if(oe!==Y){B[0]=oe;e:for(var ye=0,ke=B.length,P=ke>>>1;ye<P;){var W=2*(ye+1)-1,ce=B[W],me=W+1,Ae=B[me];if(0>i(ce,oe))me<ke&&0>i(Ae,ce)?(B[ye]=Ae,B[me]=oe,ye=me):(B[ye]=ce,B[W]=oe,ye=W);else if(me<ke&&0>i(Ae,oe))B[ye]=Ae,B[me]=oe,ye=me;else break e}}return Y}function i(B,Y){var oe=B.sortIndex-Y.sortIndex;return oe!==0?oe:B.id-Y.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,c=o.now();t.unstable_now=function(){return o.now()-c}}var u=[],f=[],h=1,m=null,g=3,y=!1,S=!1,w=!1,x=!1,k=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function _(B){for(var Y=n(f);Y!==null;){if(Y.callback===null)r(f);else if(Y.startTime<=B)r(f),Y.sortIndex=Y.expirationTime,e(u,Y);else break;Y=n(f)}}function O(B){if(w=!1,_(B),!S)if(n(u)!==null)S=!0,N||(N=!0,X());else{var Y=n(f);Y!==null&&de(O,Y.startTime-B)}}var N=!1,I=-1,z=5,q=-1;function Z(){return x?!0:!(t.unstable_now()-q<z)}function ae(){if(x=!1,N){var B=t.unstable_now();q=B;var Y=!0;try{e:{S=!1,w&&(w=!1,T(I),I=-1),y=!0;var oe=g;try{t:{for(_(B),m=n(u);m!==null&&!(m.expirationTime>B&&Z());){var ye=m.callback;if(typeof ye=="function"){m.callback=null,g=m.priorityLevel;var ke=ye(m.expirationTime<=B);if(B=t.unstable_now(),typeof ke=="function"){m.callback=ke,_(B),Y=!0;break t}m===n(u)&&r(u),_(B)}else r(u);m=n(u)}if(m!==null)Y=!0;else{var P=n(f);P!==null&&de(O,P.startTime-B),Y=!1}}break e}finally{m=null,g=oe,y=!1}Y=void 0}}finally{Y?X():N=!1}}}var X;if(typeof A=="function")X=function(){A(ae)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,ie=te.port2;te.port1.onmessage=ae,X=function(){ie.postMessage(null)}}else X=function(){k(ae,0)};function de(B,Y){I=k(function(){B(t.unstable_now())},Y)}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"):z=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 Y=3;break;default:Y=g}var oe=g;g=Y;try{return B()}finally{g=oe}},t.unstable_requestPaint=function(){x=!0},t.unstable_runWithPriority=function(B,Y){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var oe=g;g=B;try{return Y()}finally{g=oe}},t.unstable_scheduleCallback=function(B,Y,oe){var ye=t.unstable_now();switch(typeof oe=="object"&&oe!==null?(oe=oe.delay,oe=typeof oe=="number"&&0<oe?ye+oe:ye):oe=ye,B){case 1:var ke=-1;break;case 2:ke=250;break;case 5:ke=1073741823;break;case 4:ke=1e4;break;default:ke=5e3}return ke=oe+ke,B={id:h++,callback:Y,priorityLevel:B,startTime:oe,expirationTime:ke,sortIndex:-1},oe>ye?(B.sortIndex=oe,e(f,B),n(u)===null&&B===n(f)&&(w?(T(I),I=-1):w=!0,de(O,oe-ye))):(B.sortIndex=ke,e(u,B),S||y||(S=!0,N||(N=!0,X()))),B},t.unstable_shouldYield=Z,t.unstable_wrapCallback=function(B){var Y=g;return function(){var oe=g;g=Y;try{return B.apply(this,arguments)}finally{g=oe}}}})(xv)),xv}var _E;function Uz(){return _E||(_E=1,wv.exports=Hz()),wv.exports}var kv={exports:{}},Pn={};var AE;function Fz(){if(AE)return Pn;AE=1;var t=kd();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 c(u,f){if(u==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return Pn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Pn.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)},Pn.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()}},Pn.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))},Pn.prefetchDNS=function(u){typeof u=="string"&&r.d.D(u)},Pn.preinit=function(u,f){if(typeof u=="string"&&f&&typeof f.as=="string"){var h=f.as,m=c(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})}},Pn.preinitModule=function(u,f){if(typeof u=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var h=c(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)},Pn.preload=function(u,f){if(typeof u=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var h=f.as,m=c(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})}},Pn.preloadModule=function(u,f){if(typeof u=="string")if(f){var h=c(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)},Pn.requestFormReset=function(u){r.d.r(u)},Pn.unstable_batchedUpdates=function(u,f){return u(f)},Pn.useFormState=function(u,f,h){return o.H.useFormState(u,f,h)},Pn.useFormStatus=function(){return o.H.useHostTransitionStatus()},Pn.version="19.2.8",Pn}var RE;function zR(){if(RE)return kv.exports;RE=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(),kv.exports=Fz(),kv.exports}var ME;function qz(){if(ME)return mu;ME=1;var t=Uz(),e=kd(),n=zR();function r(a){var l="https://react.dev/errors/"+a;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)l+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+a+"; visit "+l+" 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 l=a,d=a;if(a.alternate)for(;l.return;)l=l.return;else{a=l;do l=a,(l.flags&4098)!==0&&(d=l.return),a=l.return;while(a)}return l.tag===3?d:null}function o(a){if(a.tag===13){var l=a.memoizedState;if(l===null&&(a=a.alternate,a!==null&&(l=a.memoizedState)),l!==null)return l.dehydrated}return null}function c(a){if(a.tag===31){var l=a.memoizedState;if(l===null&&(a=a.alternate,a!==null&&(l=a.memoizedState)),l!==null)return l.dehydrated}return null}function u(a){if(s(a)!==a)throw Error(r(188))}function f(a){var l=a.alternate;if(!l){if(l=s(a),l===null)throw Error(r(188));return l!==a?null:a}for(var d=a,p=l;;){var v=d.return;if(v===null)break;var b=v.alternate;if(b===null){if(p=v.return,p!==null){d=p;continue}break}if(v.child===b.child){for(b=v.child;b;){if(b===d)return u(v),a;if(b===p)return u(v),l;b=b.sibling}throw Error(r(188))}if(d.return!==p.return)d=v,p=b;else{for(var E=!1,M=v.child;M;){if(M===d){E=!0,d=v,p=b;break}if(M===p){E=!0,p=v,d=b;break}M=M.sibling}if(!E){for(M=b.child;M;){if(M===d){E=!0,d=b,p=v;break}if(M===p){E=!0,p=b,d=v;break}M=M.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:l}function h(a){var l=a.tag;if(l===5||l===26||l===27||l===6)return a;for(a=a.child;a!==null;){if(l=h(a),l!==null)return l;a=a.sibling}return null}var m=Object.assign,g=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),A=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),q=Symbol.for("react.activity"),Z=Symbol.for("react.memo_cache_sentinel"),ae=Symbol.iterator;function X(a){return a===null||typeof a!="object"?null:(a=ae&&a[ae]||a["@@iterator"],typeof a=="function"?a:null)}var te=Symbol.for("react.client.reference");function ie(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===te?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case w:return"Fragment";case k:return"Profiler";case x:return"StrictMode";case O:return"Suspense";case N:return"SuspenseList";case q:return"Activity"}if(typeof a=="object")switch(a.$$typeof){case S:return"Portal";case A:return a.displayName||"Context";case T:return(a._context.displayName||"Context")+".Consumer";case _:var l=a.render;return a=a.displayName,a||(a=l.displayName||l.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case I:return l=a.displayName||null,l!==null?l:ie(a.type)||"Memo";case z:l=a._payload,a=a._init;try{return ie(a(l))}catch{}}return null}var de=Array.isArray,B=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe={pending:!1,data:null,method:null,action:null},ye=[],ke=-1;function P(a){return{current:a}}function W(a){0>ke||(a.current=ye[ke],ye[ke]=null,ke--)}function ce(a,l){ke++,ye[ke]=a.current,a.current=l}var me=P(null),Ae=P(null),Le=P(null),He=P(null);function Ce(a,l){switch(ce(Le,l),ce(Ae,a),ce(me,null),l.nodeType){case 9:case 11:a=(a=l.documentElement)&&(a=a.namespaceURI)?H1(a):0;break;default:if(a=l.tagName,l=l.namespaceURI)l=H1(l),a=U1(l,a);else switch(a){case"svg":a=1;break;case"math":a=2;break;default:a=0}}W(me),ce(me,a)}function Ie(){W(me),W(Ae),W(Le)}function ct(a){a.memoizedState!==null&&ce(He,a);var l=me.current,d=U1(l,a.type);l!==d&&(ce(Ae,a),ce(me,d))}function Ke(a){Ae.current===a&&(W(me),W(Ae)),He.current===a&&(W(He),uu._currentValue=oe)}var Xe,ut;function xe(a){if(Xe===void 0)try{throw Error()}catch(d){var l=d.stack.trim().match(/\n( *(at )?)/);Xe=l&&l[1]||"",ut=-1<d.stack.indexOf(`
|
|
2
|
-
at`)?" (<anonymous>)":-1<d.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
-
`+Xe+a+ut}var be=!1;function nt(a,l){if(!a||be)return"";be=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var p={DetermineComponentFrameRoot:function(){try{if(l){var ee=function(){throw Error()};if(Object.defineProperty(ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ee,[])}catch(K){var G=K}Reflect.construct(a,[],ee)}else{try{ee.call()}catch(K){G=K}a.call(ee.prototype)}}else{try{throw Error()}catch(K){G=K}(ee=a())&&typeof ee.catch=="function"&&ee.catch(function(){})}}catch(K){if(K&&G&&typeof K.stack=="string")return[K.stack,G.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 b=p.DetermineComponentFrameRoot(),E=b[0],M=b[1];if(E&&M){var L=E.split(`
|
|
4
|
-
`),F=M.split(`
|
|
5
|
-
`);for(v=p=0;p<L.length&&!L[p].includes("DetermineComponentFrameRoot");)p++;for(;v<F.length&&!F[v].includes("DetermineComponentFrameRoot");)v++;if(p===L.length||v===F.length)for(p=L.length-1,v=F.length-1;1<=p&&0<=v&&L[p]!==F[v];)v--;for(;1<=p&&0<=v;p--,v--)if(L[p]!==F[v]){if(p!==1||v!==1)do if(p--,v--,0>v||L[p]!==F[v]){var J=`
|
|
6
|
-
`+L[p].replace(" at new "," at ");return a.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",a.displayName)),J}while(1<=p&&0<=v);break}}}finally{be=!1,Error.prepareStackTrace=d}return(d=a?a.displayName||a.name:"")?xe(d):""}function Dt(a,l){switch(a.tag){case 26:case 27:case 5:return xe(a.type);case 16:return xe("Lazy");case 13:return a.child!==l&&l!==null?xe("Suspense Fallback"):xe("Suspense");case 19:return xe("SuspenseList");case 0:case 15:return nt(a.type,!1);case 11:return nt(a.type.render,!1);case 1:return nt(a.type,!0);case 31:return xe("Activity");default:return""}}function Un(a){try{var l="",d=null;do l+=Dt(a,d),d=a,a=a.return;while(a);return l}catch(p){return`
|
|
7
|
-
Error generating stack: `+p.message+`
|
|
8
|
-
`+p.stack}}var le=Object.prototype.hasOwnProperty,Pe=t.unstable_scheduleCallback,jt=t.unstable_cancelCallback,Qn=t.unstable_shouldYield,ks=t.unstable_requestPaint,en=t.unstable_now,qd=t.unstable_getCurrentPriorityLevel,Gd=t.unstable_ImmediatePriority,Wd=t.unstable_UserBlockingPriority,xc=t.unstable_NormalPriority,kx=t.unstable_LowPriority,kc=t.unstable_IdlePriority,D=t.log,V=t.unstable_setDisableYieldValue,H=null,re=null;function se(a){if(typeof D=="function"&&V(a),re&&typeof re.setStrictMode=="function")try{re.setStrictMode(H,a)}catch{}}var he=Math.clz32?Math.clz32:ze,ge=Math.log,Se=Math.LN2;function ze(a){return a>>>=0,a===0?32:31-(ge(a)/Se|0)|0}var at=256,Vt=262144,er=4194304;function xn(a){var l=a&42;if(l!==0)return l;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 ci(a,l,d){var p=a.pendingLanes;if(p===0)return 0;var v=0,b=a.suspendedLanes,E=a.pingedLanes;a=a.warmLanes;var M=p&134217727;return M!==0?(p=M&~b,p!==0?v=xn(p):(E&=M,E!==0?v=xn(E):d||(d=M&~a,d!==0&&(v=xn(d))))):(M=p&~b,M!==0?v=xn(M):E!==0?v=xn(E):d||(d=p&~a,d!==0&&(v=xn(d)))),v===0?0:l!==0&&l!==v&&(l&b)===0&&(b=v&-v,d=l&-l,b>=d||b===32&&(d&4194048)!==0)?l:v}function Bo(a,l){return(a.pendingLanes&~(a.suspendedLanes&~a.pingedLanes)&l)===0}function $o(a,l){switch(a){case 1:case 2:case 4:case 8:case 64:return l+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 l+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 Kd(){var a=er;return er<<=1,(er&62914560)===0&&(er=4194304),a}function Fa(a){for(var l=[],d=0;31>d;d++)l.push(a);return l}function Cc(a,l){a.pendingLanes|=l,l!==268435456&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function T2(a,l,d,p,v,b){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 M=a.entanglements,L=a.expirationTimes,F=a.hiddenUpdates;for(d=E&~d;0<d;){var J=31-he(d),ee=1<<J;M[J]=0,L[J]=-1;var G=F[J];if(G!==null)for(F[J]=null,J=0;J<G.length;J++){var K=G[J];K!==null&&(K.lane&=-536870913)}d&=~ee}p!==0&&Cx(a,p,0),b!==0&&v===0&&a.tag!==0&&(a.suspendedLanes|=b&~(E&~l))}function Cx(a,l,d){a.pendingLanes|=l,a.suspendedLanes&=~l;var p=31-he(l);a.entangledLanes|=l,a.entanglements[p]=a.entanglements[p]|1073741824|d&261930}function Ex(a,l){var d=a.entangledLanes|=l;for(a=a.entanglements;d;){var p=31-he(d),v=1<<p;v&l|a[p]&l&&(a[p]|=l),d&=~v}}function Tx(a,l){var d=l&-l;return d=(d&42)!==0?1:og(d),(d&(a.suspendedLanes|l))!==0?0:d}function og(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 _x(){var a=Y.p;return a!==0?a:(a=window.event,a===void 0?32:fE(a.type))}function Ax(a,l){var d=Y.p;try{return Y.p=a,l()}finally{Y.p=d}}var Cs=Math.random().toString(36).slice(2),kn="__reactFiber$"+Cs,tr="__reactProps$"+Cs,qa="__reactContainer$"+Cs,lg="__reactEvents$"+Cs,_2="__reactListeners$"+Cs,A2="__reactHandles$"+Cs,Rx="__reactResources$"+Cs,Ec="__reactMarker$"+Cs;function cg(a){delete a[kn],delete a[tr],delete a[lg],delete a[_2],delete a[A2]}function Ga(a){var l=a[kn];if(l)return l;for(var d=a.parentNode;d;){if(l=d[qa]||d[kn]){if(d=l.alternate,l.child!==null||d!==null&&d.child!==null)for(a=Y1(a);a!==null;){if(d=a[kn])return d;a=Y1(a)}return l}a=d,d=a.parentNode}return null}function Wa(a){if(a=a[kn]||a[qa]){var l=a.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return a}return null}function Tc(a){var l=a.tag;if(l===5||l===26||l===27||l===6)return a.stateNode;throw Error(r(33))}function Ka(a){var l=a[Rx];return l||(l=a[Rx]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function hn(a){a[Ec]=!0}var Mx=new Set,Ox={};function Vo(a,l){Za(a,l),Za(a+"Capture",l)}function Za(a,l){for(Ox[a]=l,a=0;a<l.length;a++)Mx.add(l[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]*$"),Nx={},Dx={};function M2(a){return le.call(Dx,a)?!0:le.call(Nx,a)?!1:R2.test(a)?Dx[a]=!0:(Nx[a]=!0,!1)}function Zd(a,l,d){if(M2(l))if(d===null)a.removeAttribute(l);else{switch(typeof d){case"undefined":case"function":case"symbol":a.removeAttribute(l);return;case"boolean":var p=l.toLowerCase().slice(0,5);if(p!=="data-"&&p!=="aria-"){a.removeAttribute(l);return}}a.setAttribute(l,""+d)}}function Yd(a,l,d){if(d===null)a.removeAttribute(l);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(l);return}a.setAttribute(l,""+d)}}function Ai(a,l,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(l,d,""+p)}}function Tr(a){switch(typeof a){case"bigint":case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function Ix(a){var l=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function O2(a,l,d){var p=Object.getOwnPropertyDescriptor(a.constructor.prototype,l);if(!a.hasOwnProperty(l)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var v=p.get,b=p.set;return Object.defineProperty(a,l,{configurable:!0,get:function(){return v.call(this)},set:function(E){d=""+E,b.call(this,E)}}),Object.defineProperty(a,l,{enumerable:p.enumerable}),{getValue:function(){return d},setValue:function(E){d=""+E},stopTracking:function(){a._valueTracker=null,delete a[l]}}}}function ug(a){if(!a._valueTracker){var l=Ix(a)?"checked":"value";a._valueTracker=O2(a,l,""+a[l])}}function Lx(a){if(!a)return!1;var l=a._valueTracker;if(!l)return!0;var d=l.getValue(),p="";return a&&(p=Ix(a)?a.checked?"true":"false":a.value),a=p,a!==d?(l.setValue(a),!0):!1}function Xd(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 N2=/[\n"\\]/g;function _r(a){return a.replace(N2,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function dg(a,l,d,p,v,b,E,M){a.name="",E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?a.type=E:a.removeAttribute("type"),l!=null?E==="number"?(l===0&&a.value===""||a.value!=l)&&(a.value=""+Tr(l)):a.value!==""+Tr(l)&&(a.value=""+Tr(l)):E!=="submit"&&E!=="reset"||a.removeAttribute("value"),l!=null?fg(a,E,Tr(l)):d!=null?fg(a,E,Tr(d)):p!=null&&a.removeAttribute("value"),v==null&&b!=null&&(a.defaultChecked=!!b),v!=null&&(a.checked=v&&typeof v!="function"&&typeof v!="symbol"),M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?a.name=""+Tr(M):a.removeAttribute("name")}function Px(a,l,d,p,v,b,E,M){if(b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(a.type=b),l!=null||d!=null){if(!(b!=="submit"&&b!=="reset"||l!=null)){ug(a);return}d=d!=null?""+Tr(d):"",l=l!=null?""+Tr(l):d,M||l===a.value||(a.value=l),a.defaultValue=l}p=p??v,p=typeof p!="function"&&typeof p!="symbol"&&!!p,a.checked=M?a.checked:!!p,a.defaultChecked=!!p,E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(a.name=E),ug(a)}function fg(a,l,d){l==="number"&&Xd(a.ownerDocument)===a||a.defaultValue===""+d||(a.defaultValue=""+d)}function Ya(a,l,d,p){if(a=a.options,l){l={};for(var v=0;v<d.length;v++)l["$"+d[v]]=!0;for(d=0;d<a.length;d++)v=l.hasOwnProperty("$"+a[d].value),a[d].selected!==v&&(a[d].selected=v),v&&p&&(a[d].defaultSelected=!0)}else{for(d=""+Tr(d),l=null,v=0;v<a.length;v++){if(a[v].value===d){a[v].selected=!0,p&&(a[v].defaultSelected=!0);return}l!==null||a[v].disabled||(l=a[v])}l!==null&&(l.selected=!0)}}function zx(a,l,d){if(l!=null&&(l=""+Tr(l),l!==a.value&&(a.value=l),d==null)){a.defaultValue!==l&&(a.defaultValue=l);return}a.defaultValue=d!=null?""+Tr(d):""}function jx(a,l,d,p){if(l==null){if(p!=null){if(d!=null)throw Error(r(92));if(de(p)){if(1<p.length)throw Error(r(93));p=p[0]}d=p}d==null&&(d=""),l=d}d=Tr(l),a.defaultValue=d,p=a.textContent,p===d&&p!==""&&p!==null&&(a.value=p),ug(a)}function Xa(a,l){if(l){var d=a.firstChild;if(d&&d===a.lastChild&&d.nodeType===3){d.nodeValue=l;return}}a.textContent=l}var D2=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 Bx(a,l,d){var p=l.indexOf("--")===0;d==null||typeof d=="boolean"||d===""?p?a.setProperty(l,""):l==="float"?a.cssFloat="":a[l]="":p?a.setProperty(l,d):typeof d!="number"||d===0||D2.has(l)?l==="float"?a.cssFloat=d:a[l]=(""+d).trim():a[l]=d+"px"}function $x(a,l,d){if(l!=null&&typeof l!="object")throw Error(r(62));if(a=a.style,d!=null){for(var p in d)!d.hasOwnProperty(p)||l!=null&&l.hasOwnProperty(p)||(p.indexOf("--")===0?a.setProperty(p,""):p==="float"?a.cssFloat="":a[p]="");for(var v in l)p=l[v],l.hasOwnProperty(v)&&d[v]!==p&&Bx(a,v,p)}else for(var b in l)l.hasOwnProperty(b)&&Bx(a,b,l[b])}function hg(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 I2=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"]]),L2=/^[\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 Jd(a){return L2.test(""+a)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":a}function Ri(){}var pg=null;function mg(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var Ja=null,Qa=null;function Vx(a){var l=Wa(a);if(l&&(a=l.stateNode)){var d=a[tr]||null;e:switch(a=l.stateNode,l.type){case"input":if(dg(a,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name),l=d.name,d.type==="radio"&&l!=null){for(d=a;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll('input[name="'+_r(""+l)+'"][type="radio"]'),l=0;l<d.length;l++){var p=d[l];if(p!==a&&p.form===a.form){var v=p[tr]||null;if(!v)throw Error(r(90));dg(p,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name)}}for(l=0;l<d.length;l++)p=d[l],p.form===a.form&&Lx(p)}break e;case"textarea":zx(a,d.value,d.defaultValue);break e;case"select":l=d.value,l!=null&&Ya(a,!!d.multiple,l,!1)}}}var gg=!1;function Hx(a,l,d){if(gg)return a(l,d);gg=!0;try{var p=a(l);return p}finally{if(gg=!1,(Ja!==null||Qa!==null)&&($f(),Ja&&(l=Ja,a=Qa,Qa=Ja=null,Vx(l),a)))for(l=0;l<a.length;l++)Vx(a[l])}}function _c(a,l){var d=a.stateNode;if(d===null)return null;var p=d[tr]||null;if(p===null)return null;d=p[l];e:switch(l){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,l,typeof d));return d}var Mi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),yg=!1;if(Mi)try{var Ac={};Object.defineProperty(Ac,"passive",{get:function(){yg=!0}}),window.addEventListener("test",Ac,Ac),window.removeEventListener("test",Ac,Ac)}catch{yg=!1}var Es=null,vg=null,Qd=null;function Ux(){if(Qd)return Qd;var a,l=vg,d=l.length,p,v="value"in Es?Es.value:Es.textContent,b=v.length;for(a=0;a<d&&l[a]===v[a];a++);var E=d-a;for(p=1;p<=E&&l[d-p]===v[b-p];p++);return Qd=v.slice(a,1<p?1-p:void 0)}function ef(a){var l=a.keyCode;return"charCode"in a?(a=a.charCode,a===0&&l===13&&(a=13)):a=l,a===10&&(a=13),32<=a||a===13?a:0}function tf(){return!0}function Fx(){return!1}function nr(a){function l(d,p,v,b,E){this._reactName=d,this._targetInst=v,this.type=p,this.nativeEvent=b,this.target=E,this.currentTarget=null;for(var M in a)a.hasOwnProperty(M)&&(d=a[M],this[M]=d?d(b):b[M]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?tf:Fx,this.isPropagationStopped=Fx,this}return m(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=tf)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=tf)},persist:function(){},isPersistent:tf}),l}var Ho={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},nf=nr(Ho),Rc=m({},Ho,{view:0,detail:0}),P2=nr(Rc),bg,Sg,Mc,rf=m({},Rc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:xg,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!==Mc&&(Mc&&a.type==="mousemove"?(bg=a.screenX-Mc.screenX,Sg=a.screenY-Mc.screenY):Sg=bg=0,Mc=a),bg)},movementY:function(a){return"movementY"in a?a.movementY:Sg}}),qx=nr(rf),z2=m({},rf,{dataTransfer:0}),j2=nr(z2),B2=m({},Rc,{relatedTarget:0}),wg=nr(B2),$2=m({},Ho,{animationName:0,elapsedTime:0,pseudoElement:0}),V2=nr($2),H2=m({},Ho,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),U2=nr(H2),F2=m({},Ho,{data:0}),Gx=nr(F2),q2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},G2={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 K2(a){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(a):(a=W2[a])?!!l[a]:!1}function xg(){return K2}var Z2=m({},Rc,{key:function(a){if(a.key){var l=q2[a.key]||a.key;if(l!=="Unidentified")return l}return a.type==="keypress"?(a=ef(a),a===13?"Enter":String.fromCharCode(a)):a.type==="keydown"||a.type==="keyup"?G2[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:xg,charCode:function(a){return a.type==="keypress"?ef(a):0},keyCode:function(a){return a.type==="keydown"||a.type==="keyup"?a.keyCode:0},which:function(a){return a.type==="keypress"?ef(a):a.type==="keydown"||a.type==="keyup"?a.keyCode:0}}),Y2=nr(Z2),X2=m({},rf,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Wx=nr(X2),J2=m({},Rc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:xg}),Q2=nr(J2),eP=m({},Ho,{propertyName:0,elapsedTime:0,pseudoElement:0}),tP=nr(eP),nP=m({},rf,{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}),rP=nr(nP),iP=m({},Ho,{newState:0,oldState:0}),sP=nr(iP),oP=[9,13,27,32],kg=Mi&&"CompositionEvent"in window,Oc=null;Mi&&"documentMode"in document&&(Oc=document.documentMode);var aP=Mi&&"TextEvent"in window&&!Oc,Kx=Mi&&(!kg||Oc&&8<Oc&&11>=Oc),Zx=" ",Yx=!1;function Xx(a,l){switch(a){case"keyup":return oP.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Jx(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var el=!1;function lP(a,l){switch(a){case"compositionend":return Jx(l);case"keypress":return l.which!==32?null:(Yx=!0,Zx);case"textInput":return a=l.data,a===Zx&&Yx?null:a;default:return null}}function cP(a,l){if(el)return a==="compositionend"||!kg&&Xx(a,l)?(a=Ux(),Qd=vg=Es=null,el=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return Kx&&l.locale!=="ko"?null:l.data;default:return null}}var uP={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 Qx(a){var l=a&&a.nodeName&&a.nodeName.toLowerCase();return l==="input"?!!uP[a.type]:l==="textarea"}function ek(a,l,d,p){Ja?Qa?Qa.push(p):Qa=[p]:Ja=p,l=Wf(l,"onChange"),0<l.length&&(d=new nf("onChange","change",null,d,p),a.push({event:d,listeners:l}))}var Nc=null,Dc=null;function dP(a){P1(a,0)}function sf(a){var l=Tc(a);if(Lx(l))return a}function tk(a,l){if(a==="change")return l}var nk=!1;if(Mi){var Cg;if(Mi){var Eg="oninput"in document;if(!Eg){var rk=document.createElement("div");rk.setAttribute("oninput","return;"),Eg=typeof rk.oninput=="function"}Cg=Eg}else Cg=!1;nk=Cg&&(!document.documentMode||9<document.documentMode)}function ik(){Nc&&(Nc.detachEvent("onpropertychange",sk),Dc=Nc=null)}function sk(a){if(a.propertyName==="value"&&sf(Dc)){var l=[];ek(l,Dc,a,mg(a)),Hx(dP,l)}}function fP(a,l,d){a==="focusin"?(ik(),Nc=l,Dc=d,Nc.attachEvent("onpropertychange",sk)):a==="focusout"&&ik()}function hP(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return sf(Dc)}function pP(a,l){if(a==="click")return sf(l)}function mP(a,l){if(a==="input"||a==="change")return sf(l)}function gP(a,l){return a===l&&(a!==0||1/a===1/l)||a!==a&&l!==l}var dr=typeof Object.is=="function"?Object.is:gP;function Ic(a,l){if(dr(a,l))return!0;if(typeof a!="object"||a===null||typeof l!="object"||l===null)return!1;var d=Object.keys(a),p=Object.keys(l);if(d.length!==p.length)return!1;for(p=0;p<d.length;p++){var v=d[p];if(!le.call(l,v)||!dr(a[v],l[v]))return!1}return!0}function ok(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function ak(a,l){var d=ok(a);a=0;for(var p;d;){if(d.nodeType===3){if(p=a+d.textContent.length,a<=l&&p>=l)return{node:d,offset:l-a};a=p}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=ok(d)}}function lk(a,l){return a&&l?a===l?!0:a&&a.nodeType===3?!1:l&&l.nodeType===3?lk(a,l.parentNode):"contains"in a?a.contains(l):a.compareDocumentPosition?!!(a.compareDocumentPosition(l)&16):!1:!1}function ck(a){a=a!=null&&a.ownerDocument!=null&&a.ownerDocument.defaultView!=null?a.ownerDocument.defaultView:window;for(var l=Xd(a.document);l instanceof a.HTMLIFrameElement;){try{var d=typeof l.contentWindow.location.href=="string"}catch{d=!1}if(d)a=l.contentWindow;else break;l=Xd(a.document)}return l}function Tg(a){var l=a&&a.nodeName&&a.nodeName.toLowerCase();return l&&(l==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||l==="textarea"||a.contentEditable==="true")}var yP=Mi&&"documentMode"in document&&11>=document.documentMode,tl=null,_g=null,Lc=null,Ag=!1;function uk(a,l,d){var p=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;Ag||tl==null||tl!==Xd(p)||(p=tl,"selectionStart"in p&&Tg(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}),Lc&&Ic(Lc,p)||(Lc=p,p=Wf(_g,"onSelect"),0<p.length&&(l=new nf("onSelect","select",null,l,d),a.push({event:l,listeners:p}),l.target=tl)))}function Uo(a,l){var d={};return d[a.toLowerCase()]=l.toLowerCase(),d["Webkit"+a]="webkit"+l,d["Moz"+a]="moz"+l,d}var nl={animationend:Uo("Animation","AnimationEnd"),animationiteration:Uo("Animation","AnimationIteration"),animationstart:Uo("Animation","AnimationStart"),transitionrun:Uo("Transition","TransitionRun"),transitionstart:Uo("Transition","TransitionStart"),transitioncancel:Uo("Transition","TransitionCancel"),transitionend:Uo("Transition","TransitionEnd")},Rg={},dk={};Mi&&(dk=document.createElement("div").style,"AnimationEvent"in window||(delete nl.animationend.animation,delete nl.animationiteration.animation,delete nl.animationstart.animation),"TransitionEvent"in window||delete nl.transitionend.transition);function Fo(a){if(Rg[a])return Rg[a];if(!nl[a])return a;var l=nl[a],d;for(d in l)if(l.hasOwnProperty(d)&&d in dk)return Rg[a]=l[d];return a}var fk=Fo("animationend"),hk=Fo("animationiteration"),pk=Fo("animationstart"),vP=Fo("transitionrun"),bP=Fo("transitionstart"),SP=Fo("transitioncancel"),mk=Fo("transitionend"),gk=new Map,Mg="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(" ");Mg.push("scrollEnd");function qr(a,l){gk.set(a,l),Vo(l,[a])}var of=typeof reportError=="function"?reportError:function(a){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=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(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",a);return}console.error(a)},Ar=[],rl=0,Og=0;function af(){for(var a=rl,l=Og=rl=0;l<a;){var d=Ar[l];Ar[l++]=null;var p=Ar[l];Ar[l++]=null;var v=Ar[l];Ar[l++]=null;var b=Ar[l];if(Ar[l++]=null,p!==null&&v!==null){var E=p.pending;E===null?v.next=v:(v.next=E.next,E.next=v),p.pending=v}b!==0&&yk(d,v,b)}}function lf(a,l,d,p){Ar[rl++]=a,Ar[rl++]=l,Ar[rl++]=d,Ar[rl++]=p,Og|=p,a.lanes|=p,a=a.alternate,a!==null&&(a.lanes|=p)}function Ng(a,l,d,p){return lf(a,l,d,p),cf(a)}function qo(a,l){return lf(a,null,null,l),cf(a)}function yk(a,l,d){a.lanes|=d;var p=a.alternate;p!==null&&(p.lanes|=d);for(var v=!1,b=a.return;b!==null;)b.childLanes|=d,p=b.alternate,p!==null&&(p.childLanes|=d),b.tag===22&&(a=b.stateNode,a===null||a._visibility&1||(v=!0)),a=b,b=b.return;return a.tag===3?(b=a.stateNode,v&&l!==null&&(v=31-he(d),a=b.hiddenUpdates,p=a[v],p===null?a[v]=[l]:p.push(l),l.lane=d|536870912),b):null}function cf(a){if(50<ru)throw ru=0,Vy=null,Error(r(185));for(var l=a.return;l!==null;)a=l,l=a.return;return a.tag===3?a.stateNode:null}var il={};function wP(a,l,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=l,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 fr(a,l,d,p){return new wP(a,l,d,p)}function Dg(a){return a=a.prototype,!(!a||!a.isReactComponent)}function Oi(a,l){var d=a.alternate;return d===null?(d=fr(a.tag,l,a.key,a.mode),d.elementType=a.elementType,d.type=a.type,d.stateNode=a.stateNode,d.alternate=a,a.alternate=d):(d.pendingProps=l,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,l=a.dependencies,d.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},d.sibling=a.sibling,d.index=a.index,d.ref=a.ref,d.refCleanup=a.refCleanup,d}function vk(a,l){a.flags&=65011714;var d=a.alternate;return d===null?(a.childLanes=0,a.lanes=l,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,l=d.dependencies,a.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),a}function uf(a,l,d,p,v,b){var E=0;if(p=a,typeof a=="function")Dg(a)&&(E=1);else if(typeof a=="string")E=Tz(a,d,me.current)?26:a==="html"||a==="head"||a==="body"?27:5;else e:switch(a){case q:return a=fr(31,d,l,v),a.elementType=q,a.lanes=b,a;case w:return Go(d.children,v,b,l);case x:E=8,v|=24;break;case k:return a=fr(12,d,l,v|2),a.elementType=k,a.lanes=b,a;case O:return a=fr(13,d,l,v),a.elementType=O,a.lanes=b,a;case N:return a=fr(19,d,l,v),a.elementType=N,a.lanes=b,a;default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case A:E=10;break e;case T:E=9;break e;case _:E=11;break e;case I:E=14;break e;case z:E=16,p=null;break e}E=29,d=Error(r(130,a===null?"null":typeof a,"")),p=null}return l=fr(E,d,l,v),l.elementType=a,l.type=p,l.lanes=b,l}function Go(a,l,d,p){return a=fr(7,a,p,l),a.lanes=d,a}function Ig(a,l,d){return a=fr(6,a,null,l),a.lanes=d,a}function bk(a){var l=fr(18,null,null,0);return l.stateNode=a,l}function Lg(a,l,d){return l=fr(4,a.children!==null?a.children:[],a.key,l),l.lanes=d,l.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},l}var Sk=new WeakMap;function Rr(a,l){if(typeof a=="object"&&a!==null){var d=Sk.get(a);return d!==void 0?d:(l={value:a,source:l,stack:Un(l)},Sk.set(a,l),l)}return{value:a,source:l,stack:Un(l)}}var sl=[],ol=0,df=null,Pc=0,Mr=[],Or=0,Ts=null,ui=1,di="";function Ni(a,l){sl[ol++]=Pc,sl[ol++]=df,df=a,Pc=l}function wk(a,l,d){Mr[Or++]=ui,Mr[Or++]=di,Mr[Or++]=Ts,Ts=a;var p=ui;a=di;var v=32-he(p)-1;p&=~(1<<v),d+=1;var b=32-he(l)+v;if(30<b){var E=v-v%5;b=(p&(1<<E)-1).toString(32),p>>=E,v-=E,ui=1<<32-he(l)+v|d<<v|p,di=b+a}else ui=1<<b|d<<v|p,di=a}function Pg(a){a.return!==null&&(Ni(a,1),wk(a,1,0))}function zg(a){for(;a===df;)df=sl[--ol],sl[ol]=null,Pc=sl[--ol],sl[ol]=null;for(;a===Ts;)Ts=Mr[--Or],Mr[Or]=null,di=Mr[--Or],Mr[Or]=null,ui=Mr[--Or],Mr[Or]=null}function xk(a,l){Mr[Or++]=ui,Mr[Or++]=di,Mr[Or++]=Ts,ui=l.id,di=l.overflow,Ts=a}var Cn=null,It=null,st=!1,_s=null,Nr=!1,jg=Error(r(519));function As(a){var l=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw zc(Rr(l,a)),jg}function kk(a){var l=a.stateNode,d=a.type,p=a.memoizedProps;switch(l[kn]=a,l[tr]=p,d){case"dialog":tt("cancel",l),tt("close",l);break;case"iframe":case"object":case"embed":tt("load",l);break;case"video":case"audio":for(d=0;d<su.length;d++)tt(su[d],l);break;case"source":tt("error",l);break;case"img":case"image":case"link":tt("error",l),tt("load",l);break;case"details":tt("toggle",l);break;case"input":tt("invalid",l),Px(l,p.value,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name,!0);break;case"select":tt("invalid",l);break;case"textarea":tt("invalid",l),jx(l,p.value,p.defaultValue,p.children)}d=p.children,typeof d!="string"&&typeof d!="number"&&typeof d!="bigint"||l.textContent===""+d||p.suppressHydrationWarning===!0||$1(l.textContent,d)?(p.popover!=null&&(tt("beforetoggle",l),tt("toggle",l)),p.onScroll!=null&&tt("scroll",l),p.onScrollEnd!=null&&tt("scrollend",l),p.onClick!=null&&(l.onclick=Ri),l=!0):l=!1,l||As(a,!0)}function Ck(a){for(Cn=a.return;Cn;)switch(Cn.tag){case 5:case 31:case 13:Nr=!1;return;case 27:case 3:Nr=!0;return;default:Cn=Cn.return}}function al(a){if(a!==Cn)return!1;if(!st)return Ck(a),st=!0,!1;var l=a.tag,d;if((d=l!==3&&l!==27)&&((d=l===5)&&(d=a.type,d=!(d!=="form"&&d!=="button")||nv(a.type,a.memoizedProps)),d=!d),d&&It&&As(a),Ck(a),l===13){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));It=Z1(a)}else if(l===31){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));It=Z1(a)}else l===27?(l=It,Hs(a.type)?(a=av,av=null,It=a):It=l):It=Cn?Ir(a.stateNode.nextSibling):null;return!0}function Wo(){It=Cn=null,st=!1}function Bg(){var a=_s;return a!==null&&(or===null?or=a:or.push.apply(or,a),_s=null),a}function zc(a){_s===null?_s=[a]:_s.push(a)}var $g=P(null),Ko=null,Di=null;function Rs(a,l,d){ce($g,l._currentValue),l._currentValue=d}function Ii(a){a._currentValue=$g.current,W($g)}function Vg(a,l,d){for(;a!==null;){var p=a.alternate;if((a.childLanes&l)!==l?(a.childLanes|=l,p!==null&&(p.childLanes|=l)):p!==null&&(p.childLanes&l)!==l&&(p.childLanes|=l),a===d)break;a=a.return}}function Hg(a,l,d,p){var v=a.child;for(v!==null&&(v.return=a);v!==null;){var b=v.dependencies;if(b!==null){var E=v.child;b=b.firstContext;e:for(;b!==null;){var M=b;b=v;for(var L=0;L<l.length;L++)if(M.context===l[L]){b.lanes|=d,M=b.alternate,M!==null&&(M.lanes|=d),Vg(b.return,d,a),p||(E=null);break e}b=M.next}}else if(v.tag===18){if(E=v.return,E===null)throw Error(r(341));E.lanes|=d,b=E.alternate,b!==null&&(b.lanes|=d),Vg(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 ll(a,l,d,p){a=null;for(var v=l,b=!1;v!==null;){if(!b){if((v.flags&524288)!==0)b=!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 M=v.type;dr(v.pendingProps.value,E.value)||(a!==null?a.push(M):a=[M])}}else if(v===He.current){if(E=v.alternate,E===null)throw Error(r(387));E.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(a!==null?a.push(uu):a=[uu])}v=v.return}a!==null&&Hg(l,a,d,p),l.flags|=262144}function ff(a){for(a=a.firstContext;a!==null;){if(!dr(a.context._currentValue,a.memoizedValue))return!0;a=a.next}return!1}function Zo(a){Ko=a,Di=null,a=a.dependencies,a!==null&&(a.firstContext=null)}function En(a){return Ek(Ko,a)}function hf(a,l){return Ko===null&&Zo(a),Ek(a,l)}function Ek(a,l){var d=l._currentValue;if(l={context:l,memoizedValue:d,next:null},Di===null){if(a===null)throw Error(r(308));Di=l,a.dependencies={lanes:0,firstContext:l},a.flags|=524288}else Di=Di.next=l;return d}var xP=typeof AbortController<"u"?AbortController:function(){var a=[],l=this.signal={aborted:!1,addEventListener:function(d,p){a.push(p)}};this.abort=function(){l.aborted=!0,a.forEach(function(d){return d()})}},kP=t.unstable_scheduleCallback,CP=t.unstable_NormalPriority,tn={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ug(){return{controller:new xP,data:new Map,refCount:0}}function jc(a){a.refCount--,a.refCount===0&&kP(CP,function(){a.controller.abort()})}var Bc=null,Fg=0,cl=0,ul=null;function EP(a,l){if(Bc===null){var d=Bc=[];Fg=0,cl=Wy(),ul={status:"pending",value:void 0,then:function(p){d.push(p)}}}return Fg++,l.then(Tk,Tk),l}function Tk(){if(--Fg===0&&Bc!==null){ul!==null&&(ul.status="fulfilled");var a=Bc;Bc=null,cl=0,ul=null;for(var l=0;l<a.length;l++)(0,a[l])()}}function TP(a,l){var d=[],p={status:"pending",value:null,reason:null,then:function(v){d.push(v)}};return a.then(function(){p.status="fulfilled",p.value=l;for(var v=0;v<d.length;v++)(0,d[v])(l)},function(v){for(p.status="rejected",p.reason=v,v=0;v<d.length;v++)(0,d[v])(void 0)}),p}var _k=B.S;B.S=function(a,l){u1=en(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&EP(a,l),_k!==null&&_k(a,l)};var Yo=P(null);function qg(){var a=Yo.current;return a!==null?a:_t.pooledCache}function pf(a,l){l===null?ce(Yo,Yo.current):ce(Yo,l.pool)}function Ak(){var a=qg();return a===null?null:{parent:tn._currentValue,pool:a}}var dl=Error(r(460)),Gg=Error(r(474)),mf=Error(r(542)),gf={then:function(){}};function Rk(a){return a=a.status,a==="fulfilled"||a==="rejected"}function Mk(a,l,d){switch(d=a[d],d===void 0?a.push(l):d!==l&&(l.then(Ri,Ri),l=d),l.status){case"fulfilled":return l.value;case"rejected":throw a=l.reason,Nk(a),a;default:if(typeof l.status=="string")l.then(Ri,Ri);else{if(a=_t,a!==null&&100<a.shellSuspendCounter)throw Error(r(482));a=l,a.status="pending",a.then(function(p){if(l.status==="pending"){var v=l;v.status="fulfilled",v.value=p}},function(p){if(l.status==="pending"){var v=l;v.status="rejected",v.reason=p}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw a=l.reason,Nk(a),a}throw Jo=l,dl}}function Xo(a){try{var l=a._init;return l(a._payload)}catch(d){throw d!==null&&typeof d=="object"&&typeof d.then=="function"?(Jo=d,dl):d}}var Jo=null;function Ok(){if(Jo===null)throw Error(r(459));var a=Jo;return Jo=null,a}function Nk(a){if(a===dl||a===mf)throw Error(r(483))}var fl=null,$c=0;function yf(a){var l=$c;return $c+=1,fl===null&&(fl=[]),Mk(fl,a,l)}function Vc(a,l){l=l.props.ref,a.ref=l!==void 0?l:null}function vf(a,l){throw l.$$typeof===g?Error(r(525)):(a=Object.prototype.toString.call(l),Error(r(31,a==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":a)))}function Dk(a){function l($,j){if(a){var U=$.deletions;U===null?($.deletions=[j],$.flags|=16):U.push(j)}}function d($,j){if(!a)return null;for(;j!==null;)l($,j),j=j.sibling;return null}function p($){for(var j=new Map;$!==null;)$.key!==null?j.set($.key,$):j.set($.index,$),$=$.sibling;return j}function v($,j){return $=Oi($,j),$.index=0,$.sibling=null,$}function b($,j,U){return $.index=U,a?(U=$.alternate,U!==null?(U=U.index,U<j?($.flags|=67108866,j):U):($.flags|=67108866,j)):($.flags|=1048576,j)}function E($){return a&&$.alternate===null&&($.flags|=67108866),$}function M($,j,U,Q){return j===null||j.tag!==6?(j=Ig(U,$.mode,Q),j.return=$,j):(j=v(j,U),j.return=$,j)}function L($,j,U,Q){var Ne=U.type;return Ne===w?J($,j,U.props.children,Q,U.key):j!==null&&(j.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===z&&Xo(Ne)===j.type)?(j=v(j,U.props),Vc(j,U),j.return=$,j):(j=uf(U.type,U.key,U.props,null,$.mode,Q),Vc(j,U),j.return=$,j)}function F($,j,U,Q){return j===null||j.tag!==4||j.stateNode.containerInfo!==U.containerInfo||j.stateNode.implementation!==U.implementation?(j=Lg(U,$.mode,Q),j.return=$,j):(j=v(j,U.children||[]),j.return=$,j)}function J($,j,U,Q,Ne){return j===null||j.tag!==7?(j=Go(U,$.mode,Q,Ne),j.return=$,j):(j=v(j,U),j.return=$,j)}function ee($,j,U){if(typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint")return j=Ig(""+j,$.mode,U),j.return=$,j;if(typeof j=="object"&&j!==null){switch(j.$$typeof){case y:return U=uf(j.type,j.key,j.props,null,$.mode,U),Vc(U,j),U.return=$,U;case S:return j=Lg(j,$.mode,U),j.return=$,j;case z:return j=Xo(j),ee($,j,U)}if(de(j)||X(j))return j=Go(j,$.mode,U,null),j.return=$,j;if(typeof j.then=="function")return ee($,yf(j),U);if(j.$$typeof===A)return ee($,hf($,j),U);vf($,j)}return null}function G($,j,U,Q){var Ne=j!==null?j.key:null;if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return Ne!==null?null:M($,j,""+U,Q);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case y:return U.key===Ne?L($,j,U,Q):null;case S:return U.key===Ne?F($,j,U,Q):null;case z:return U=Xo(U),G($,j,U,Q)}if(de(U)||X(U))return Ne!==null?null:J($,j,U,Q,null);if(typeof U.then=="function")return G($,j,yf(U),Q);if(U.$$typeof===A)return G($,j,hf($,U),Q);vf($,U)}return null}function K($,j,U,Q,Ne){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return $=$.get(U)||null,M(j,$,""+Q,Ne);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case y:return $=$.get(Q.key===null?U:Q.key)||null,L(j,$,Q,Ne);case S:return $=$.get(Q.key===null?U:Q.key)||null,F(j,$,Q,Ne);case z:return Q=Xo(Q),K($,j,U,Q,Ne)}if(de(Q)||X(Q))return $=$.get(U)||null,J(j,$,Q,Ne,null);if(typeof Q.then=="function")return K($,j,U,yf(Q),Ne);if(Q.$$typeof===A)return K($,j,U,hf(j,Q),Ne);vf(j,Q)}return null}function Ee($,j,U,Q){for(var Ne=null,dt=null,Re=j,Ye=j=0,it=null;Re!==null&&Ye<U.length;Ye++){Re.index>Ye?(it=Re,Re=null):it=Re.sibling;var ft=G($,Re,U[Ye],Q);if(ft===null){Re===null&&(Re=it);break}a&&Re&&ft.alternate===null&&l($,Re),j=b(ft,j,Ye),dt===null?Ne=ft:dt.sibling=ft,dt=ft,Re=it}if(Ye===U.length)return d($,Re),st&&Ni($,Ye),Ne;if(Re===null){for(;Ye<U.length;Ye++)Re=ee($,U[Ye],Q),Re!==null&&(j=b(Re,j,Ye),dt===null?Ne=Re:dt.sibling=Re,dt=Re);return st&&Ni($,Ye),Ne}for(Re=p(Re);Ye<U.length;Ye++)it=K(Re,$,Ye,U[Ye],Q),it!==null&&(a&&it.alternate!==null&&Re.delete(it.key===null?Ye:it.key),j=b(it,j,Ye),dt===null?Ne=it:dt.sibling=it,dt=it);return a&&Re.forEach(function(Ws){return l($,Ws)}),st&&Ni($,Ye),Ne}function je($,j,U,Q){if(U==null)throw Error(r(151));for(var Ne=null,dt=null,Re=j,Ye=j=0,it=null,ft=U.next();Re!==null&&!ft.done;Ye++,ft=U.next()){Re.index>Ye?(it=Re,Re=null):it=Re.sibling;var Ws=G($,Re,ft.value,Q);if(Ws===null){Re===null&&(Re=it);break}a&&Re&&Ws.alternate===null&&l($,Re),j=b(Ws,j,Ye),dt===null?Ne=Ws:dt.sibling=Ws,dt=Ws,Re=it}if(ft.done)return d($,Re),st&&Ni($,Ye),Ne;if(Re===null){for(;!ft.done;Ye++,ft=U.next())ft=ee($,ft.value,Q),ft!==null&&(j=b(ft,j,Ye),dt===null?Ne=ft:dt.sibling=ft,dt=ft);return st&&Ni($,Ye),Ne}for(Re=p(Re);!ft.done;Ye++,ft=U.next())ft=K(Re,$,Ye,ft.value,Q),ft!==null&&(a&&ft.alternate!==null&&Re.delete(ft.key===null?Ye:ft.key),j=b(ft,j,Ye),dt===null?Ne=ft:dt.sibling=ft,dt=ft);return a&&Re.forEach(function(zz){return l($,zz)}),st&&Ni($,Ye),Ne}function Ct($,j,U,Q){if(typeof U=="object"&&U!==null&&U.type===w&&U.key===null&&(U=U.props.children),typeof U=="object"&&U!==null){switch(U.$$typeof){case y:e:{for(var Ne=U.key;j!==null;){if(j.key===Ne){if(Ne=U.type,Ne===w){if(j.tag===7){d($,j.sibling),Q=v(j,U.props.children),Q.return=$,$=Q;break e}}else if(j.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===z&&Xo(Ne)===j.type){d($,j.sibling),Q=v(j,U.props),Vc(Q,U),Q.return=$,$=Q;break e}d($,j);break}else l($,j);j=j.sibling}U.type===w?(Q=Go(U.props.children,$.mode,Q,U.key),Q.return=$,$=Q):(Q=uf(U.type,U.key,U.props,null,$.mode,Q),Vc(Q,U),Q.return=$,$=Q)}return E($);case S:e:{for(Ne=U.key;j!==null;){if(j.key===Ne)if(j.tag===4&&j.stateNode.containerInfo===U.containerInfo&&j.stateNode.implementation===U.implementation){d($,j.sibling),Q=v(j,U.children||[]),Q.return=$,$=Q;break e}else{d($,j);break}else l($,j);j=j.sibling}Q=Lg(U,$.mode,Q),Q.return=$,$=Q}return E($);case z:return U=Xo(U),Ct($,j,U,Q)}if(de(U))return Ee($,j,U,Q);if(X(U)){if(Ne=X(U),typeof Ne!="function")throw Error(r(150));return U=Ne.call(U),je($,j,U,Q)}if(typeof U.then=="function")return Ct($,j,yf(U),Q);if(U.$$typeof===A)return Ct($,j,hf($,U),Q);vf($,U)}return typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint"?(U=""+U,j!==null&&j.tag===6?(d($,j.sibling),Q=v(j,U),Q.return=$,$=Q):(d($,j),Q=Ig(U,$.mode,Q),Q.return=$,$=Q),E($)):d($,j)}return function($,j,U,Q){try{$c=0;var Ne=Ct($,j,U,Q);return fl=null,Ne}catch(Re){if(Re===dl||Re===mf)throw Re;var dt=fr(29,Re,null,$.mode);return dt.lanes=Q,dt.return=$,dt}}}var Qo=Dk(!0),Ik=Dk(!1),Ms=!1;function Wg(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Kg(a,l){a=a.updateQueue,l.updateQueue===a&&(l.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,callbacks:null})}function Os(a){return{lane:a,tag:0,payload:null,callback:null,next:null}}function Ns(a,l,d){var p=a.updateQueue;if(p===null)return null;if(p=p.shared,(mt&2)!==0){var v=p.pending;return v===null?l.next=l:(l.next=v.next,v.next=l),p.pending=l,l=cf(a),yk(a,null,d),l}return lf(a,p,l,d),cf(a)}function Hc(a,l,d){if(l=l.updateQueue,l!==null&&(l=l.shared,(d&4194048)!==0)){var p=l.lanes;p&=a.pendingLanes,d|=p,l.lanes=d,Ex(a,d)}}function Zg(a,l){var d=a.updateQueue,p=a.alternate;if(p!==null&&(p=p.updateQueue,d===p)){var v=null,b=null;if(d=d.firstBaseUpdate,d!==null){do{var E={lane:d.lane,tag:d.tag,payload:d.payload,callback:null,next:null};b===null?v=b=E:b=b.next=E,d=d.next}while(d!==null);b===null?v=b=l:b=b.next=l}else v=b=l;d={baseState:p.baseState,firstBaseUpdate:v,lastBaseUpdate:b,shared:p.shared,callbacks:p.callbacks},a.updateQueue=d;return}a=d.lastBaseUpdate,a===null?d.firstBaseUpdate=l:a.next=l,d.lastBaseUpdate=l}var Yg=!1;function Uc(){if(Yg){var a=ul;if(a!==null)throw a}}function Fc(a,l,d,p){Yg=!1;var v=a.updateQueue;Ms=!1;var b=v.firstBaseUpdate,E=v.lastBaseUpdate,M=v.shared.pending;if(M!==null){v.shared.pending=null;var L=M,F=L.next;L.next=null,E===null?b=F:E.next=F,E=L;var J=a.alternate;J!==null&&(J=J.updateQueue,M=J.lastBaseUpdate,M!==E&&(M===null?J.firstBaseUpdate=F:M.next=F,J.lastBaseUpdate=L))}if(b!==null){var ee=v.baseState;E=0,J=F=L=null,M=b;do{var G=M.lane&-536870913,K=G!==M.lane;if(K?(rt&G)===G:(p&G)===G){G!==0&&G===cl&&(Yg=!0),J!==null&&(J=J.next={lane:0,tag:M.tag,payload:M.payload,callback:null,next:null});e:{var Ee=a,je=M;G=l;var Ct=d;switch(je.tag){case 1:if(Ee=je.payload,typeof Ee=="function"){ee=Ee.call(Ct,ee,G);break e}ee=Ee;break e;case 3:Ee.flags=Ee.flags&-65537|128;case 0:if(Ee=je.payload,G=typeof Ee=="function"?Ee.call(Ct,ee,G):Ee,G==null)break e;ee=m({},ee,G);break e;case 2:Ms=!0}}G=M.callback,G!==null&&(a.flags|=64,K&&(a.flags|=8192),K=v.callbacks,K===null?v.callbacks=[G]:K.push(G))}else K={lane:G,tag:M.tag,payload:M.payload,callback:M.callback,next:null},J===null?(F=J=K,L=ee):J=J.next=K,E|=G;if(M=M.next,M===null){if(M=v.shared.pending,M===null)break;K=M,M=K.next,K.next=null,v.lastBaseUpdate=K,v.shared.pending=null}}while(!0);J===null&&(L=ee),v.baseState=L,v.firstBaseUpdate=F,v.lastBaseUpdate=J,b===null&&(v.shared.lanes=0),zs|=E,a.lanes=E,a.memoizedState=ee}}function Lk(a,l){if(typeof a!="function")throw Error(r(191,a));a.call(l)}function Pk(a,l){var d=a.callbacks;if(d!==null)for(a.callbacks=null,a=0;a<d.length;a++)Lk(d[a],l)}var hl=P(null),bf=P(0);function zk(a,l){a=Ui,ce(bf,a),ce(hl,l),Ui=a|l.baseLanes}function Xg(){ce(bf,Ui),ce(hl,hl.current)}function Jg(){Ui=bf.current,W(hl),W(bf)}var hr=P(null),Dr=null;function Ds(a){var l=a.alternate;ce(Yt,Yt.current&1),ce(hr,a),Dr===null&&(l===null||hl.current!==null||l.memoizedState!==null)&&(Dr=a)}function Qg(a){ce(Yt,Yt.current),ce(hr,a),Dr===null&&(Dr=a)}function jk(a){a.tag===22?(ce(Yt,Yt.current),ce(hr,a),Dr===null&&(Dr=a)):Is()}function Is(){ce(Yt,Yt.current),ce(hr,hr.current)}function pr(a){W(hr),Dr===a&&(Dr=null),W(Yt)}var Yt=P(0);function Sf(a){for(var l=a;l!==null;){if(l.tag===13){var d=l.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||sv(d)||ov(d)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===a)break;for(;l.sibling===null;){if(l.return===null||l.return===a)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var Li=0,Ze=null,xt=null,nn=null,wf=!1,pl=!1,ea=!1,xf=0,qc=0,ml=null,_P=0;function Ft(){throw Error(r(321))}function ey(a,l){if(l===null)return!1;for(var d=0;d<l.length&&d<a.length;d++)if(!dr(a[d],l[d]))return!1;return!0}function ty(a,l,d,p,v,b){return Li=b,Ze=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,B.H=a===null||a.memoizedState===null?wC:gy,ea=!1,b=d(p,v),ea=!1,pl&&(b=$k(l,d,p,v)),Bk(a),b}function Bk(a){B.H=Kc;var l=xt!==null&&xt.next!==null;if(Li=0,nn=xt=Ze=null,wf=!1,qc=0,ml=null,l)throw Error(r(300));a===null||rn||(a=a.dependencies,a!==null&&ff(a)&&(rn=!0))}function $k(a,l,d,p){Ze=a;var v=0;do{if(pl&&(ml=null),qc=0,pl=!1,25<=v)throw Error(r(301));if(v+=1,nn=xt=null,a.updateQueue!=null){var b=a.updateQueue;b.lastEffect=null,b.events=null,b.stores=null,b.memoCache!=null&&(b.memoCache.index=0)}B.H=xC,b=l(d,p)}while(pl);return b}function AP(){var a=B.H,l=a.useState()[0];return l=typeof l.then=="function"?Gc(l):l,a=a.useState()[0],(xt!==null?xt.memoizedState:null)!==a&&(Ze.flags|=1024),l}function ny(){var a=xf!==0;return xf=0,a}function ry(a,l,d){l.updateQueue=a.updateQueue,l.flags&=-2053,a.lanes&=~d}function iy(a){if(wf){for(a=a.memoizedState;a!==null;){var l=a.queue;l!==null&&(l.pending=null),a=a.next}wf=!1}Li=0,nn=xt=Ze=null,pl=!1,qc=xf=0,ml=null}function Fn(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return nn===null?Ze.memoizedState=nn=a:nn=nn.next=a,nn}function Xt(){if(xt===null){var a=Ze.alternate;a=a!==null?a.memoizedState:null}else a=xt.next;var l=nn===null?Ze.memoizedState:nn.next;if(l!==null)nn=l,xt=a;else{if(a===null)throw Ze.alternate===null?Error(r(467)):Error(r(310));xt=a,a={memoizedState:xt.memoizedState,baseState:xt.baseState,baseQueue:xt.baseQueue,queue:xt.queue,next:null},nn===null?Ze.memoizedState=nn=a:nn=nn.next=a}return nn}function kf(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Gc(a){var l=qc;return qc+=1,ml===null&&(ml=[]),a=Mk(ml,a,l),l=Ze,(nn===null?l.memoizedState:nn.next)===null&&(l=l.alternate,B.H=l===null||l.memoizedState===null?wC:gy),a}function Cf(a){if(a!==null&&typeof a=="object"){if(typeof a.then=="function")return Gc(a);if(a.$$typeof===A)return En(a)}throw Error(r(438,String(a)))}function sy(a){var l=null,d=Ze.updateQueue;if(d!==null&&(l=d.memoCache),l==null){var p=Ze.alternate;p!==null&&(p=p.updateQueue,p!==null&&(p=p.memoCache,p!=null&&(l={data:p.data.map(function(v){return v.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),d===null&&(d=kf(),Ze.updateQueue=d),d.memoCache=l,d=l.data[l.index],d===void 0)for(d=l.data[l.index]=Array(a),p=0;p<a;p++)d[p]=Z;return l.index++,d}function Pi(a,l){return typeof l=="function"?l(a):l}function Ef(a){var l=Xt();return oy(l,xt,a)}function oy(a,l,d){var p=a.queue;if(p===null)throw Error(r(311));p.lastRenderedReducer=d;var v=a.baseQueue,b=p.pending;if(b!==null){if(v!==null){var E=v.next;v.next=b.next,b.next=E}l.baseQueue=v=b,p.pending=null}if(b=a.baseState,v===null)a.memoizedState=b;else{l=v.next;var M=E=null,L=null,F=l,J=!1;do{var ee=F.lane&-536870913;if(ee!==F.lane?(rt&ee)===ee:(Li&ee)===ee){var G=F.revertLane;if(G===0)L!==null&&(L=L.next={lane:0,revertLane:0,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null}),ee===cl&&(J=!0);else if((Li&G)===G){F=F.next,G===cl&&(J=!0);continue}else ee={lane:0,revertLane:F.revertLane,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},L===null?(M=L=ee,E=b):L=L.next=ee,Ze.lanes|=G,zs|=G;ee=F.action,ea&&d(b,ee),b=F.hasEagerState?F.eagerState:d(b,ee)}else G={lane:ee,revertLane:F.revertLane,gesture:F.gesture,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},L===null?(M=L=G,E=b):L=L.next=G,Ze.lanes|=ee,zs|=ee;F=F.next}while(F!==null&&F!==l);if(L===null?E=b:L.next=M,!dr(b,a.memoizedState)&&(rn=!0,J&&(d=ul,d!==null)))throw d;a.memoizedState=b,a.baseState=E,a.baseQueue=L,p.lastRenderedState=b}return v===null&&(p.lanes=0),[a.memoizedState,p.dispatch]}function ay(a){var l=Xt(),d=l.queue;if(d===null)throw Error(r(311));d.lastRenderedReducer=a;var p=d.dispatch,v=d.pending,b=l.memoizedState;if(v!==null){d.pending=null;var E=v=v.next;do b=a(b,E.action),E=E.next;while(E!==v);dr(b,l.memoizedState)||(rn=!0),l.memoizedState=b,l.baseQueue===null&&(l.baseState=b),d.lastRenderedState=b}return[b,p]}function Vk(a,l,d){var p=Ze,v=Xt(),b=st;if(b){if(d===void 0)throw Error(r(407));d=d()}else d=l();var E=!dr((xt||v).memoizedState,d);if(E&&(v.memoizedState=d,rn=!0),v=v.queue,uy(Fk.bind(null,p,v,a),[a]),v.getSnapshot!==l||E||nn!==null&&nn.memoizedState.tag&1){if(p.flags|=2048,gl(9,{destroy:void 0},Uk.bind(null,p,v,d,l),null),_t===null)throw Error(r(349));b||(Li&127)!==0||Hk(p,l,d)}return d}function Hk(a,l,d){a.flags|=16384,a={getSnapshot:l,value:d},l=Ze.updateQueue,l===null?(l=kf(),Ze.updateQueue=l,l.stores=[a]):(d=l.stores,d===null?l.stores=[a]:d.push(a))}function Uk(a,l,d,p){l.value=d,l.getSnapshot=p,qk(l)&&Gk(a)}function Fk(a,l,d){return d(function(){qk(l)&&Gk(a)})}function qk(a){var l=a.getSnapshot;a=a.value;try{var d=l();return!dr(a,d)}catch{return!0}}function Gk(a){var l=qo(a,2);l!==null&&ar(l,a,2)}function ly(a){var l=Fn();if(typeof a=="function"){var d=a;if(a=d(),ea){se(!0);try{d()}finally{se(!1)}}}return l.memoizedState=l.baseState=a,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pi,lastRenderedState:a},l}function Wk(a,l,d,p){return a.baseState=d,oy(a,xt,typeof p=="function"?p:Pi)}function RP(a,l,d,p,v){if(Af(a))throw Error(r(485));if(a=l.action,a!==null){var b={payload:v,action:a,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(E){b.listeners.push(E)}};B.T!==null?d(!0):b.isTransition=!1,p(b),d=l.pending,d===null?(b.next=l.pending=b,Kk(l,b)):(b.next=d.next,l.pending=d.next=b)}}function Kk(a,l){var d=l.action,p=l.payload,v=a.state;if(l.isTransition){var b=B.T,E={};B.T=E;try{var M=d(v,p),L=B.S;L!==null&&L(E,M),Zk(a,l,M)}catch(F){cy(a,l,F)}finally{b!==null&&E.types!==null&&(b.types=E.types),B.T=b}}else try{b=d(v,p),Zk(a,l,b)}catch(F){cy(a,l,F)}}function Zk(a,l,d){d!==null&&typeof d=="object"&&typeof d.then=="function"?d.then(function(p){Yk(a,l,p)},function(p){return cy(a,l,p)}):Yk(a,l,d)}function Yk(a,l,d){l.status="fulfilled",l.value=d,Xk(l),a.state=d,l=a.pending,l!==null&&(d=l.next,d===l?a.pending=null:(d=d.next,l.next=d,Kk(a,d)))}function cy(a,l,d){var p=a.pending;if(a.pending=null,p!==null){p=p.next;do l.status="rejected",l.reason=d,Xk(l),l=l.next;while(l!==p)}a.action=null}function Xk(a){a=a.listeners;for(var l=0;l<a.length;l++)(0,a[l])()}function Jk(a,l){return l}function Qk(a,l){if(st){var d=_t.formState;if(d!==null){e:{var p=Ze;if(st){if(It){t:{for(var v=It,b=Nr;v.nodeType!==8;){if(!b){v=null;break t}if(v=Ir(v.nextSibling),v===null){v=null;break t}}b=v.data,v=b==="F!"||b==="F"?v:null}if(v){It=Ir(v.nextSibling),p=v.data==="F!";break e}}As(p)}p=!1}p&&(l=d[0])}}return d=Fn(),d.memoizedState=d.baseState=l,p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jk,lastRenderedState:l},d.queue=p,d=vC.bind(null,Ze,p),p.dispatch=d,p=ly(!1),b=my.bind(null,Ze,!1,p.queue),p=Fn(),v={state:l,dispatch:null,action:a,pending:null},p.queue=v,d=RP.bind(null,Ze,v,b,d),v.dispatch=d,p.memoizedState=a,[l,d,!1]}function eC(a){var l=Xt();return tC(l,xt,a)}function tC(a,l,d){if(l=oy(a,l,Jk)[0],a=Ef(Pi)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var p=Gc(l)}catch(E){throw E===dl?mf:E}else p=l;l=Xt();var v=l.queue,b=v.dispatch;return d!==l.memoizedState&&(Ze.flags|=2048,gl(9,{destroy:void 0},MP.bind(null,v,d),null)),[p,b,a]}function MP(a,l){a.action=l}function nC(a){var l=Xt(),d=xt;if(d!==null)return tC(l,d,a);Xt(),l=l.memoizedState,d=Xt();var p=d.queue.dispatch;return d.memoizedState=a,[l,p,!1]}function gl(a,l,d,p){return a={tag:a,create:d,deps:p,inst:l,next:null},l=Ze.updateQueue,l===null&&(l=kf(),Ze.updateQueue=l),d=l.lastEffect,d===null?l.lastEffect=a.next=a:(p=d.next,d.next=a,a.next=p,l.lastEffect=a),a}function rC(){return Xt().memoizedState}function Tf(a,l,d,p){var v=Fn();Ze.flags|=a,v.memoizedState=gl(1|l,{destroy:void 0},d,p===void 0?null:p)}function _f(a,l,d,p){var v=Xt();p=p===void 0?null:p;var b=v.memoizedState.inst;xt!==null&&p!==null&&ey(p,xt.memoizedState.deps)?v.memoizedState=gl(l,b,d,p):(Ze.flags|=a,v.memoizedState=gl(1|l,b,d,p))}function iC(a,l){Tf(8390656,8,a,l)}function uy(a,l){_f(2048,8,a,l)}function OP(a){Ze.flags|=4;var l=Ze.updateQueue;if(l===null)l=kf(),Ze.updateQueue=l,l.events=[a];else{var d=l.events;d===null?l.events=[a]:d.push(a)}}function sC(a){var l=Xt().memoizedState;return OP({ref:l,nextImpl:a}),function(){if((mt&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}function oC(a,l){return _f(4,2,a,l)}function aC(a,l){return _f(4,4,a,l)}function lC(a,l){if(typeof l=="function"){a=a();var d=l(a);return function(){typeof d=="function"?d():l(null)}}if(l!=null)return a=a(),l.current=a,function(){l.current=null}}function cC(a,l,d){d=d!=null?d.concat([a]):null,_f(4,4,lC.bind(null,l,a),d)}function dy(){}function uC(a,l){var d=Xt();l=l===void 0?null:l;var p=d.memoizedState;return l!==null&&ey(l,p[1])?p[0]:(d.memoizedState=[a,l],a)}function dC(a,l){var d=Xt();l=l===void 0?null:l;var p=d.memoizedState;if(l!==null&&ey(l,p[1]))return p[0];if(p=a(),ea){se(!0);try{a()}finally{se(!1)}}return d.memoizedState=[p,l],p}function fy(a,l,d){return d===void 0||(Li&1073741824)!==0&&(rt&261930)===0?a.memoizedState=l:(a.memoizedState=d,a=f1(),Ze.lanes|=a,zs|=a,d)}function fC(a,l,d,p){return dr(d,l)?d:hl.current!==null?(a=fy(a,d,p),dr(a,l)||(rn=!0),a):(Li&42)===0||(Li&1073741824)!==0&&(rt&261930)===0?(rn=!0,a.memoizedState=d):(a=f1(),Ze.lanes|=a,zs|=a,l)}function hC(a,l,d,p,v){var b=Y.p;Y.p=b!==0&&8>b?b:8;var E=B.T,M={};B.T=M,my(a,!1,l,d);try{var L=v(),F=B.S;if(F!==null&&F(M,L),L!==null&&typeof L=="object"&&typeof L.then=="function"){var J=TP(L,p);Wc(a,l,J,yr(a))}else Wc(a,l,p,yr(a))}catch(ee){Wc(a,l,{then:function(){},status:"rejected",reason:ee},yr())}finally{Y.p=b,E!==null&&M.types!==null&&(E.types=M.types),B.T=E}}function NP(){}function hy(a,l,d,p){if(a.tag!==5)throw Error(r(476));var v=pC(a).queue;hC(a,v,l,oe,d===null?NP:function(){return mC(a),d(p)})}function pC(a){var l=a.memoizedState;if(l!==null)return l;l={memoizedState:oe,baseState:oe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pi,lastRenderedState:oe},next:null};var d={};return l.next={memoizedState:d,baseState:d,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pi,lastRenderedState:d},next:null},a.memoizedState=l,a=a.alternate,a!==null&&(a.memoizedState=l),l}function mC(a){var l=pC(a);l.next===null&&(l=a.alternate.memoizedState),Wc(a,l.next.queue,{},yr())}function py(){return En(uu)}function gC(){return Xt().memoizedState}function yC(){return Xt().memoizedState}function DP(a){for(var l=a.return;l!==null;){switch(l.tag){case 24:case 3:var d=yr();a=Os(d);var p=Ns(l,a,d);p!==null&&(ar(p,l,d),Hc(p,l,d)),l={cache:Ug()},a.payload=l;return}l=l.return}}function IP(a,l,d){var p=yr();d={lane:p,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Af(a)?bC(l,d):(d=Ng(a,l,d,p),d!==null&&(ar(d,a,p),SC(d,l,p)))}function vC(a,l,d){var p=yr();Wc(a,l,d,p)}function Wc(a,l,d,p){var v={lane:p,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null};if(Af(a))bC(l,v);else{var b=a.alternate;if(a.lanes===0&&(b===null||b.lanes===0)&&(b=l.lastRenderedReducer,b!==null))try{var E=l.lastRenderedState,M=b(E,d);if(v.hasEagerState=!0,v.eagerState=M,dr(M,E))return lf(a,l,v,0),_t===null&&af(),!1}catch{}if(d=Ng(a,l,v,p),d!==null)return ar(d,a,p),SC(d,l,p),!0}return!1}function my(a,l,d,p){if(p={lane:2,revertLane:Wy(),gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},Af(a)){if(l)throw Error(r(479))}else l=Ng(a,d,p,2),l!==null&&ar(l,a,2)}function Af(a){var l=a.alternate;return a===Ze||l!==null&&l===Ze}function bC(a,l){pl=wf=!0;var d=a.pending;d===null?l.next=l:(l.next=d.next,d.next=l),a.pending=l}function SC(a,l,d){if((d&4194048)!==0){var p=l.lanes;p&=a.pendingLanes,d|=p,l.lanes=d,Ex(a,d)}}var Kc={readContext:En,use:Cf,useCallback:Ft,useContext:Ft,useEffect:Ft,useImperativeHandle:Ft,useLayoutEffect:Ft,useInsertionEffect:Ft,useMemo:Ft,useReducer:Ft,useRef:Ft,useState:Ft,useDebugValue:Ft,useDeferredValue:Ft,useTransition:Ft,useSyncExternalStore:Ft,useId:Ft,useHostTransitionStatus:Ft,useFormState:Ft,useActionState:Ft,useOptimistic:Ft,useMemoCache:Ft,useCacheRefresh:Ft};Kc.useEffectEvent=Ft;var wC={readContext:En,use:Cf,useCallback:function(a,l){return Fn().memoizedState=[a,l===void 0?null:l],a},useContext:En,useEffect:iC,useImperativeHandle:function(a,l,d){d=d!=null?d.concat([a]):null,Tf(4194308,4,lC.bind(null,l,a),d)},useLayoutEffect:function(a,l){return Tf(4194308,4,a,l)},useInsertionEffect:function(a,l){Tf(4,2,a,l)},useMemo:function(a,l){var d=Fn();l=l===void 0?null:l;var p=a();if(ea){se(!0);try{a()}finally{se(!1)}}return d.memoizedState=[p,l],p},useReducer:function(a,l,d){var p=Fn();if(d!==void 0){var v=d(l);if(ea){se(!0);try{d(l)}finally{se(!1)}}}else v=l;return p.memoizedState=p.baseState=v,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:v},p.queue=a,a=a.dispatch=IP.bind(null,Ze,a),[p.memoizedState,a]},useRef:function(a){var l=Fn();return a={current:a},l.memoizedState=a},useState:function(a){a=ly(a);var l=a.queue,d=vC.bind(null,Ze,l);return l.dispatch=d,[a.memoizedState,d]},useDebugValue:dy,useDeferredValue:function(a,l){var d=Fn();return fy(d,a,l)},useTransition:function(){var a=ly(!1);return a=hC.bind(null,Ze,a.queue,!0,!1),Fn().memoizedState=a,[!1,a]},useSyncExternalStore:function(a,l,d){var p=Ze,v=Fn();if(st){if(d===void 0)throw Error(r(407));d=d()}else{if(d=l(),_t===null)throw Error(r(349));(rt&127)!==0||Hk(p,l,d)}v.memoizedState=d;var b={value:d,getSnapshot:l};return v.queue=b,iC(Fk.bind(null,p,b,a),[a]),p.flags|=2048,gl(9,{destroy:void 0},Uk.bind(null,p,b,d,l),null),d},useId:function(){var a=Fn(),l=_t.identifierPrefix;if(st){var d=di,p=ui;d=(p&~(1<<32-he(p)-1)).toString(32)+d,l="_"+l+"R_"+d,d=xf++,0<d&&(l+="H"+d.toString(32)),l+="_"}else d=_P++,l="_"+l+"r_"+d.toString(32)+"_";return a.memoizedState=l},useHostTransitionStatus:py,useFormState:Qk,useActionState:Qk,useOptimistic:function(a){var l=Fn();l.memoizedState=l.baseState=a;var d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=d,l=my.bind(null,Ze,!0,d),d.dispatch=l,[a,l]},useMemoCache:sy,useCacheRefresh:function(){return Fn().memoizedState=DP.bind(null,Ze)},useEffectEvent:function(a){var l=Fn(),d={impl:a};return l.memoizedState=d,function(){if((mt&2)!==0)throw Error(r(440));return d.impl.apply(void 0,arguments)}}},gy={readContext:En,use:Cf,useCallback:uC,useContext:En,useEffect:uy,useImperativeHandle:cC,useInsertionEffect:oC,useLayoutEffect:aC,useMemo:dC,useReducer:Ef,useRef:rC,useState:function(){return Ef(Pi)},useDebugValue:dy,useDeferredValue:function(a,l){var d=Xt();return fC(d,xt.memoizedState,a,l)},useTransition:function(){var a=Ef(Pi)[0],l=Xt().memoizedState;return[typeof a=="boolean"?a:Gc(a),l]},useSyncExternalStore:Vk,useId:gC,useHostTransitionStatus:py,useFormState:eC,useActionState:eC,useOptimistic:function(a,l){var d=Xt();return Wk(d,xt,a,l)},useMemoCache:sy,useCacheRefresh:yC};gy.useEffectEvent=sC;var xC={readContext:En,use:Cf,useCallback:uC,useContext:En,useEffect:uy,useImperativeHandle:cC,useInsertionEffect:oC,useLayoutEffect:aC,useMemo:dC,useReducer:ay,useRef:rC,useState:function(){return ay(Pi)},useDebugValue:dy,useDeferredValue:function(a,l){var d=Xt();return xt===null?fy(d,a,l):fC(d,xt.memoizedState,a,l)},useTransition:function(){var a=ay(Pi)[0],l=Xt().memoizedState;return[typeof a=="boolean"?a:Gc(a),l]},useSyncExternalStore:Vk,useId:gC,useHostTransitionStatus:py,useFormState:nC,useActionState:nC,useOptimistic:function(a,l){var d=Xt();return xt!==null?Wk(d,xt,a,l):(d.baseState=a,[a,d.queue.dispatch])},useMemoCache:sy,useCacheRefresh:yC};xC.useEffectEvent=sC;function yy(a,l,d,p){l=a.memoizedState,d=d(p,l),d=d==null?l:m({},l,d),a.memoizedState=d,a.lanes===0&&(a.updateQueue.baseState=d)}var vy={enqueueSetState:function(a,l,d){a=a._reactInternals;var p=yr(),v=Os(p);v.payload=l,d!=null&&(v.callback=d),l=Ns(a,v,p),l!==null&&(ar(l,a,p),Hc(l,a,p))},enqueueReplaceState:function(a,l,d){a=a._reactInternals;var p=yr(),v=Os(p);v.tag=1,v.payload=l,d!=null&&(v.callback=d),l=Ns(a,v,p),l!==null&&(ar(l,a,p),Hc(l,a,p))},enqueueForceUpdate:function(a,l){a=a._reactInternals;var d=yr(),p=Os(d);p.tag=2,l!=null&&(p.callback=l),l=Ns(a,p,d),l!==null&&(ar(l,a,d),Hc(l,a,d))}};function kC(a,l,d,p,v,b,E){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(p,b,E):l.prototype&&l.prototype.isPureReactComponent?!Ic(d,p)||!Ic(v,b):!0}function CC(a,l,d,p){a=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(d,p),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(d,p),l.state!==a&&vy.enqueueReplaceState(l,l.state,null)}function ta(a,l){var d=l;if("ref"in l){d={};for(var p in l)p!=="ref"&&(d[p]=l[p])}if(a=a.defaultProps){d===l&&(d=m({},d));for(var v in a)d[v]===void 0&&(d[v]=a[v])}return d}function EC(a){of(a)}function TC(a){console.error(a)}function _C(a){of(a)}function Rf(a,l){try{var d=a.onUncaughtError;d(l.value,{componentStack:l.stack})}catch(p){setTimeout(function(){throw p})}}function AC(a,l,d){try{var p=a.onCaughtError;p(d.value,{componentStack:d.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function by(a,l,d){return d=Os(d),d.tag=3,d.payload={element:null},d.callback=function(){Rf(a,l)},d}function RC(a){return a=Os(a),a.tag=3,a}function MC(a,l,d,p){var v=d.type.getDerivedStateFromError;if(typeof v=="function"){var b=p.value;a.payload=function(){return v(b)},a.callback=function(){AC(l,d,p)}}var E=d.stateNode;E!==null&&typeof E.componentDidCatch=="function"&&(a.callback=function(){AC(l,d,p),typeof v!="function"&&(js===null?js=new Set([this]):js.add(this));var M=p.stack;this.componentDidCatch(p.value,{componentStack:M!==null?M:""})})}function LP(a,l,d,p,v){if(d.flags|=32768,p!==null&&typeof p=="object"&&typeof p.then=="function"){if(l=d.alternate,l!==null&&ll(l,d,v,!0),d=hr.current,d!==null){switch(d.tag){case 31:case 13:return Dr===null?Vf():d.alternate===null&&qt===0&&(qt=3),d.flags&=-257,d.flags|=65536,d.lanes=v,p===gf?d.flags|=16384:(l=d.updateQueue,l===null?d.updateQueue=new Set([p]):l.add(p),Fy(a,p,v)),!1;case 22:return d.flags|=65536,p===gf?d.flags|=16384:(l=d.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([p])},d.updateQueue=l):(d=l.retryQueue,d===null?l.retryQueue=new Set([p]):d.add(p)),Fy(a,p,v)),!1}throw Error(r(435,d.tag))}return Fy(a,p,v),Vf(),!1}if(st)return l=hr.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=v,p!==jg&&(a=Error(r(422),{cause:p}),zc(Rr(a,d)))):(p!==jg&&(l=Error(r(423),{cause:p}),zc(Rr(l,d))),a=a.current.alternate,a.flags|=65536,v&=-v,a.lanes|=v,p=Rr(p,d),v=by(a.stateNode,p,v),Zg(a,v),qt!==4&&(qt=2)),!1;var b=Error(r(520),{cause:p});if(b=Rr(b,d),nu===null?nu=[b]:nu.push(b),qt!==4&&(qt=2),l===null)return!0;p=Rr(p,d),d=l;do{switch(d.tag){case 3:return d.flags|=65536,a=v&-v,d.lanes|=a,a=by(d.stateNode,p,a),Zg(d,a),!1;case 1:if(l=d.type,b=d.stateNode,(d.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(js===null||!js.has(b))))return d.flags|=65536,v&=-v,d.lanes|=v,v=RC(v),MC(v,a,d,p),Zg(d,v),!1}d=d.return}while(d!==null);return!1}var Sy=Error(r(461)),rn=!1;function Tn(a,l,d,p){l.child=a===null?Ik(l,null,d,p):Qo(l,a.child,d,p)}function OC(a,l,d,p,v){d=d.render;var b=l.ref;if("ref"in p){var E={};for(var M in p)M!=="ref"&&(E[M]=p[M])}else E=p;return Zo(l),p=ty(a,l,d,E,b,v),M=ny(),a!==null&&!rn?(ry(a,l,v),zi(a,l,v)):(st&&M&&Pg(l),l.flags|=1,Tn(a,l,p,v),l.child)}function NC(a,l,d,p,v){if(a===null){var b=d.type;return typeof b=="function"&&!Dg(b)&&b.defaultProps===void 0&&d.compare===null?(l.tag=15,l.type=b,DC(a,l,b,p,v)):(a=uf(d.type,null,p,l,l.mode,v),a.ref=l.ref,a.return=l,l.child=a)}if(b=a.child,!Ay(a,v)){var E=b.memoizedProps;if(d=d.compare,d=d!==null?d:Ic,d(E,p)&&a.ref===l.ref)return zi(a,l,v)}return l.flags|=1,a=Oi(b,p),a.ref=l.ref,a.return=l,l.child=a}function DC(a,l,d,p,v){if(a!==null){var b=a.memoizedProps;if(Ic(b,p)&&a.ref===l.ref)if(rn=!1,l.pendingProps=p=b,Ay(a,v))(a.flags&131072)!==0&&(rn=!0);else return l.lanes=a.lanes,zi(a,l,v)}return wy(a,l,d,p,v)}function IC(a,l,d,p){var v=p.children,b=a!==null?a.memoizedState:null;if(a===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),p.mode==="hidden"){if((l.flags&128)!==0){if(b=b!==null?b.baseLanes|d:d,a!==null){for(p=l.child=a.child,v=0;p!==null;)v=v|p.lanes|p.childLanes,p=p.sibling;p=v&~b}else p=0,l.child=null;return LC(a,l,b,d,p)}if((d&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},a!==null&&pf(l,b!==null?b.cachePool:null),b!==null?zk(l,b):Xg(),jk(l);else return p=l.lanes=536870912,LC(a,l,b!==null?b.baseLanes|d:d,d,p)}else b!==null?(pf(l,b.cachePool),zk(l,b),Is(),l.memoizedState=null):(a!==null&&pf(l,null),Xg(),Is());return Tn(a,l,v,d),l.child}function Zc(a,l){return a!==null&&a.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function LC(a,l,d,p,v){var b=qg();return b=b===null?null:{parent:tn._currentValue,pool:b},l.memoizedState={baseLanes:d,cachePool:b},a!==null&&pf(l,null),Xg(),jk(l),a!==null&&ll(a,l,p,!0),l.childLanes=v,null}function Mf(a,l){return l=Nf({mode:l.mode,children:l.children},a.mode),l.ref=a.ref,a.child=l,l.return=a,l}function PC(a,l,d){return Qo(l,a.child,null,d),a=Mf(l,l.pendingProps),a.flags|=2,pr(l),l.memoizedState=null,a}function PP(a,l,d){var p=l.pendingProps,v=(l.flags&128)!==0;if(l.flags&=-129,a===null){if(st){if(p.mode==="hidden")return a=Mf(l,p),l.lanes=536870912,Zc(null,a);if(Qg(l),(a=It)?(a=K1(a,Nr),a=a!==null&&a.data==="&"?a:null,a!==null&&(l.memoizedState={dehydrated:a,treeContext:Ts!==null?{id:ui,overflow:di}:null,retryLane:536870912,hydrationErrors:null},d=bk(a),d.return=l,l.child=d,Cn=l,It=null)):a=null,a===null)throw As(l);return l.lanes=536870912,null}return Mf(l,p)}var b=a.memoizedState;if(b!==null){var E=b.dehydrated;if(Qg(l),v)if(l.flags&256)l.flags&=-257,l=PC(a,l,d);else if(l.memoizedState!==null)l.child=a.child,l.flags|=128,l=null;else throw Error(r(558));else if(rn||ll(a,l,d,!1),v=(d&a.childLanes)!==0,rn||v){if(p=_t,p!==null&&(E=Tx(p,d),E!==0&&E!==b.retryLane))throw b.retryLane=E,qo(a,E),ar(p,a,E),Sy;Vf(),l=PC(a,l,d)}else a=b.treeContext,It=Ir(E.nextSibling),Cn=l,st=!0,_s=null,Nr=!1,a!==null&&xk(l,a),l=Mf(l,p),l.flags|=4096;return l}return a=Oi(a.child,{mode:p.mode,children:p.children}),a.ref=l.ref,l.child=a,a.return=l,a}function Of(a,l){var d=l.ref;if(d===null)a!==null&&a.ref!==null&&(l.flags|=4194816);else{if(typeof d!="function"&&typeof d!="object")throw Error(r(284));(a===null||a.ref!==d)&&(l.flags|=4194816)}}function wy(a,l,d,p,v){return Zo(l),d=ty(a,l,d,p,void 0,v),p=ny(),a!==null&&!rn?(ry(a,l,v),zi(a,l,v)):(st&&p&&Pg(l),l.flags|=1,Tn(a,l,d,v),l.child)}function zC(a,l,d,p,v,b){return Zo(l),l.updateQueue=null,d=$k(l,p,d,v),Bk(a),p=ny(),a!==null&&!rn?(ry(a,l,b),zi(a,l,b)):(st&&p&&Pg(l),l.flags|=1,Tn(a,l,d,b),l.child)}function jC(a,l,d,p,v){if(Zo(l),l.stateNode===null){var b=il,E=d.contextType;typeof E=="object"&&E!==null&&(b=En(E)),b=new d(p,b),l.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,b.updater=vy,l.stateNode=b,b._reactInternals=l,b=l.stateNode,b.props=p,b.state=l.memoizedState,b.refs={},Wg(l),E=d.contextType,b.context=typeof E=="object"&&E!==null?En(E):il,b.state=l.memoizedState,E=d.getDerivedStateFromProps,typeof E=="function"&&(yy(l,d,E,p),b.state=l.memoizedState),typeof d.getDerivedStateFromProps=="function"||typeof b.getSnapshotBeforeUpdate=="function"||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(E=b.state,typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount(),E!==b.state&&vy.enqueueReplaceState(b,b.state,null),Fc(l,p,b,v),Uc(),b.state=l.memoizedState),typeof b.componentDidMount=="function"&&(l.flags|=4194308),p=!0}else if(a===null){b=l.stateNode;var M=l.memoizedProps,L=ta(d,M);b.props=L;var F=b.context,J=d.contextType;E=il,typeof J=="object"&&J!==null&&(E=En(J));var ee=d.getDerivedStateFromProps;J=typeof ee=="function"||typeof b.getSnapshotBeforeUpdate=="function",M=l.pendingProps!==M,J||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(M||F!==E)&&CC(l,b,p,E),Ms=!1;var G=l.memoizedState;b.state=G,Fc(l,p,b,v),Uc(),F=l.memoizedState,M||G!==F||Ms?(typeof ee=="function"&&(yy(l,d,ee,p),F=l.memoizedState),(L=Ms||kC(l,d,L,p,G,F,E))?(J||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount()),typeof b.componentDidMount=="function"&&(l.flags|=4194308)):(typeof b.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=p,l.memoizedState=F),b.props=p,b.state=F,b.context=E,p=L):(typeof b.componentDidMount=="function"&&(l.flags|=4194308),p=!1)}else{b=l.stateNode,Kg(a,l),E=l.memoizedProps,J=ta(d,E),b.props=J,ee=l.pendingProps,G=b.context,F=d.contextType,L=il,typeof F=="object"&&F!==null&&(L=En(F)),M=d.getDerivedStateFromProps,(F=typeof M=="function"||typeof b.getSnapshotBeforeUpdate=="function")||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(E!==ee||G!==L)&&CC(l,b,p,L),Ms=!1,G=l.memoizedState,b.state=G,Fc(l,p,b,v),Uc();var K=l.memoizedState;E!==ee||G!==K||Ms||a!==null&&a.dependencies!==null&&ff(a.dependencies)?(typeof M=="function"&&(yy(l,d,M,p),K=l.memoizedState),(J=Ms||kC(l,d,J,p,G,K,L)||a!==null&&a.dependencies!==null&&ff(a.dependencies))?(F||typeof b.UNSAFE_componentWillUpdate!="function"&&typeof b.componentWillUpdate!="function"||(typeof b.componentWillUpdate=="function"&&b.componentWillUpdate(p,K,L),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(p,K,L)),typeof b.componentDidUpdate=="function"&&(l.flags|=4),typeof b.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof b.componentDidUpdate!="function"||E===a.memoizedProps&&G===a.memoizedState||(l.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||E===a.memoizedProps&&G===a.memoizedState||(l.flags|=1024),l.memoizedProps=p,l.memoizedState=K),b.props=p,b.state=K,b.context=L,p=J):(typeof b.componentDidUpdate!="function"||E===a.memoizedProps&&G===a.memoizedState||(l.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||E===a.memoizedProps&&G===a.memoizedState||(l.flags|=1024),p=!1)}return b=p,Of(a,l),p=(l.flags&128)!==0,b||p?(b=l.stateNode,d=p&&typeof d.getDerivedStateFromError!="function"?null:b.render(),l.flags|=1,a!==null&&p?(l.child=Qo(l,a.child,null,v),l.child=Qo(l,null,d,v)):Tn(a,l,d,v),l.memoizedState=b.state,a=l.child):a=zi(a,l,v),a}function BC(a,l,d,p){return Wo(),l.flags|=256,Tn(a,l,d,p),l.child}var xy={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ky(a){return{baseLanes:a,cachePool:Ak()}}function Cy(a,l,d){return a=a!==null?a.childLanes&~d:0,l&&(a|=gr),a}function $C(a,l,d){var p=l.pendingProps,v=!1,b=(l.flags&128)!==0,E;if((E=b)||(E=a!==null&&a.memoizedState===null?!1:(Yt.current&2)!==0),E&&(v=!0,l.flags&=-129),E=(l.flags&32)!==0,l.flags&=-33,a===null){if(st){if(v?Ds(l):Is(),(a=It)?(a=K1(a,Nr),a=a!==null&&a.data!=="&"?a:null,a!==null&&(l.memoizedState={dehydrated:a,treeContext:Ts!==null?{id:ui,overflow:di}:null,retryLane:536870912,hydrationErrors:null},d=bk(a),d.return=l,l.child=d,Cn=l,It=null)):a=null,a===null)throw As(l);return ov(a)?l.lanes=32:l.lanes=536870912,null}var M=p.children;return p=p.fallback,v?(Is(),v=l.mode,M=Nf({mode:"hidden",children:M},v),p=Go(p,v,d,null),M.return=l,p.return=l,M.sibling=p,l.child=M,p=l.child,p.memoizedState=ky(d),p.childLanes=Cy(a,E,d),l.memoizedState=xy,Zc(null,p)):(Ds(l),Ey(l,M))}var L=a.memoizedState;if(L!==null&&(M=L.dehydrated,M!==null)){if(b)l.flags&256?(Ds(l),l.flags&=-257,l=Ty(a,l,d)):l.memoizedState!==null?(Is(),l.child=a.child,l.flags|=128,l=null):(Is(),M=p.fallback,v=l.mode,p=Nf({mode:"visible",children:p.children},v),M=Go(M,v,d,null),M.flags|=2,p.return=l,M.return=l,p.sibling=M,l.child=p,Qo(l,a.child,null,d),p=l.child,p.memoizedState=ky(d),p.childLanes=Cy(a,E,d),l.memoizedState=xy,l=Zc(null,p));else if(Ds(l),ov(M)){if(E=M.nextSibling&&M.nextSibling.dataset,E)var F=E.dgst;E=F,p=Error(r(419)),p.stack="",p.digest=E,zc({value:p,source:null,stack:null}),l=Ty(a,l,d)}else if(rn||ll(a,l,d,!1),E=(d&a.childLanes)!==0,rn||E){if(E=_t,E!==null&&(p=Tx(E,d),p!==0&&p!==L.retryLane))throw L.retryLane=p,qo(a,p),ar(E,a,p),Sy;sv(M)||Vf(),l=Ty(a,l,d)}else sv(M)?(l.flags|=192,l.child=a.child,l=null):(a=L.treeContext,It=Ir(M.nextSibling),Cn=l,st=!0,_s=null,Nr=!1,a!==null&&xk(l,a),l=Ey(l,p.children),l.flags|=4096);return l}return v?(Is(),M=p.fallback,v=l.mode,L=a.child,F=L.sibling,p=Oi(L,{mode:"hidden",children:p.children}),p.subtreeFlags=L.subtreeFlags&65011712,F!==null?M=Oi(F,M):(M=Go(M,v,d,null),M.flags|=2),M.return=l,p.return=l,p.sibling=M,l.child=p,Zc(null,p),p=l.child,M=a.child.memoizedState,M===null?M=ky(d):(v=M.cachePool,v!==null?(L=tn._currentValue,v=v.parent!==L?{parent:L,pool:L}:v):v=Ak(),M={baseLanes:M.baseLanes|d,cachePool:v}),p.memoizedState=M,p.childLanes=Cy(a,E,d),l.memoizedState=xy,Zc(a.child,p)):(Ds(l),d=a.child,a=d.sibling,d=Oi(d,{mode:"visible",children:p.children}),d.return=l,d.sibling=null,a!==null&&(E=l.deletions,E===null?(l.deletions=[a],l.flags|=16):E.push(a)),l.child=d,l.memoizedState=null,d)}function Ey(a,l){return l=Nf({mode:"visible",children:l},a.mode),l.return=a,a.child=l}function Nf(a,l){return a=fr(22,a,null,l),a.lanes=0,a}function Ty(a,l,d){return Qo(l,a.child,null,d),a=Ey(l,l.pendingProps.children),a.flags|=2,l.memoizedState=null,a}function VC(a,l,d){a.lanes|=l;var p=a.alternate;p!==null&&(p.lanes|=l),Vg(a.return,l,d)}function _y(a,l,d,p,v,b){var E=a.memoizedState;E===null?a.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:p,tail:d,tailMode:v,treeForkCount:b}:(E.isBackwards=l,E.rendering=null,E.renderingStartTime=0,E.last=p,E.tail=d,E.tailMode=v,E.treeForkCount=b)}function HC(a,l,d){var p=l.pendingProps,v=p.revealOrder,b=p.tail;p=p.children;var E=Yt.current,M=(E&2)!==0;if(M?(E=E&1|2,l.flags|=128):E&=1,ce(Yt,E),Tn(a,l,p,d),p=st?Pc:0,!M&&a!==null&&(a.flags&128)!==0)e:for(a=l.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&VC(a,d,l);else if(a.tag===19)VC(a,d,l);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===l)break e;for(;a.sibling===null;){if(a.return===null||a.return===l)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}switch(v){case"forwards":for(d=l.child,v=null;d!==null;)a=d.alternate,a!==null&&Sf(a)===null&&(v=d),d=d.sibling;d=v,d===null?(v=l.child,l.child=null):(v=d.sibling,d.sibling=null),_y(l,!1,v,d,b,p);break;case"backwards":case"unstable_legacy-backwards":for(d=null,v=l.child,l.child=null;v!==null;){if(a=v.alternate,a!==null&&Sf(a)===null){l.child=v;break}a=v.sibling,v.sibling=d,d=v,v=a}_y(l,!0,d,null,b,p);break;case"together":_y(l,!1,null,null,void 0,p);break;default:l.memoizedState=null}return l.child}function zi(a,l,d){if(a!==null&&(l.dependencies=a.dependencies),zs|=l.lanes,(d&l.childLanes)===0)if(a!==null){if(ll(a,l,d,!1),(d&l.childLanes)===0)return null}else return null;if(a!==null&&l.child!==a.child)throw Error(r(153));if(l.child!==null){for(a=l.child,d=Oi(a,a.pendingProps),l.child=d,d.return=l;a.sibling!==null;)a=a.sibling,d=d.sibling=Oi(a,a.pendingProps),d.return=l;d.sibling=null}return l.child}function Ay(a,l){return(a.lanes&l)!==0?!0:(a=a.dependencies,!!(a!==null&&ff(a)))}function zP(a,l,d){switch(l.tag){case 3:Ce(l,l.stateNode.containerInfo),Rs(l,tn,a.memoizedState.cache),Wo();break;case 27:case 5:ct(l);break;case 4:Ce(l,l.stateNode.containerInfo);break;case 10:Rs(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,Qg(l),null;break;case 13:var p=l.memoizedState;if(p!==null)return p.dehydrated!==null?(Ds(l),l.flags|=128,null):(d&l.child.childLanes)!==0?$C(a,l,d):(Ds(l),a=zi(a,l,d),a!==null?a.sibling:null);Ds(l);break;case 19:var v=(a.flags&128)!==0;if(p=(d&l.childLanes)!==0,p||(ll(a,l,d,!1),p=(d&l.childLanes)!==0),v){if(p)return HC(a,l,d);l.flags|=128}if(v=l.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),ce(Yt,Yt.current),p)break;return null;case 22:return l.lanes=0,IC(a,l,d,l.pendingProps);case 24:Rs(l,tn,a.memoizedState.cache)}return zi(a,l,d)}function UC(a,l,d){if(a!==null)if(a.memoizedProps!==l.pendingProps)rn=!0;else{if(!Ay(a,d)&&(l.flags&128)===0)return rn=!1,zP(a,l,d);rn=(a.flags&131072)!==0}else rn=!1,st&&(l.flags&1048576)!==0&&wk(l,Pc,l.index);switch(l.lanes=0,l.tag){case 16:e:{var p=l.pendingProps;if(a=Xo(l.elementType),l.type=a,typeof a=="function")Dg(a)?(p=ta(a,p),l.tag=1,l=jC(null,l,a,p,d)):(l.tag=0,l=wy(null,l,a,p,d));else{if(a!=null){var v=a.$$typeof;if(v===_){l.tag=11,l=OC(null,l,a,p,d);break e}else if(v===I){l.tag=14,l=NC(null,l,a,p,d);break e}}throw l=ie(a)||a,Error(r(306,l,""))}}return l;case 0:return wy(a,l,l.type,l.pendingProps,d);case 1:return p=l.type,v=ta(p,l.pendingProps),jC(a,l,p,v,d);case 3:e:{if(Ce(l,l.stateNode.containerInfo),a===null)throw Error(r(387));p=l.pendingProps;var b=l.memoizedState;v=b.element,Kg(a,l),Fc(l,p,null,d);var E=l.memoizedState;if(p=E.cache,Rs(l,tn,p),p!==b.cache&&Hg(l,[tn],d,!0),Uc(),p=E.element,b.isDehydrated)if(b={element:p,isDehydrated:!1,cache:E.cache},l.updateQueue.baseState=b,l.memoizedState=b,l.flags&256){l=BC(a,l,p,d);break e}else if(p!==v){v=Rr(Error(r(424)),l),zc(v),l=BC(a,l,p,d);break e}else for(a=l.stateNode.containerInfo,a.nodeType===9?a=a.body:a=a.nodeName==="HTML"?a.ownerDocument.body:a,It=Ir(a.firstChild),Cn=l,st=!0,_s=null,Nr=!0,d=Ik(l,null,p,d),l.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(Wo(),p===v){l=zi(a,l,d);break e}Tn(a,l,p,d)}l=l.child}return l;case 26:return Of(a,l),a===null?(d=eE(l.type,null,l.pendingProps,null))?l.memoizedState=d:st||(d=l.type,a=l.pendingProps,p=Kf(Le.current).createElement(d),p[kn]=l,p[tr]=a,_n(p,d,a),hn(p),l.stateNode=p):l.memoizedState=eE(l.type,a.memoizedProps,l.pendingProps,a.memoizedState),null;case 27:return ct(l),a===null&&st&&(p=l.stateNode=X1(l.type,l.pendingProps,Le.current),Cn=l,Nr=!0,v=It,Hs(l.type)?(av=v,It=Ir(p.firstChild)):It=v),Tn(a,l,l.pendingProps.children,d),Of(a,l),a===null&&(l.flags|=4194304),l.child;case 5:return a===null&&st&&((v=p=It)&&(p=hz(p,l.type,l.pendingProps,Nr),p!==null?(l.stateNode=p,Cn=l,It=Ir(p.firstChild),Nr=!1,v=!0):v=!1),v||As(l)),ct(l),v=l.type,b=l.pendingProps,E=a!==null?a.memoizedProps:null,p=b.children,nv(v,b)?p=null:E!==null&&nv(v,E)&&(l.flags|=32),l.memoizedState!==null&&(v=ty(a,l,AP,null,null,d),uu._currentValue=v),Of(a,l),Tn(a,l,p,d),l.child;case 6:return a===null&&st&&((a=d=It)&&(d=pz(d,l.pendingProps,Nr),d!==null?(l.stateNode=d,Cn=l,It=null,a=!0):a=!1),a||As(l)),null;case 13:return $C(a,l,d);case 4:return Ce(l,l.stateNode.containerInfo),p=l.pendingProps,a===null?l.child=Qo(l,null,p,d):Tn(a,l,p,d),l.child;case 11:return OC(a,l,l.type,l.pendingProps,d);case 7:return Tn(a,l,l.pendingProps,d),l.child;case 8:return Tn(a,l,l.pendingProps.children,d),l.child;case 12:return Tn(a,l,l.pendingProps.children,d),l.child;case 10:return p=l.pendingProps,Rs(l,l.type,p.value),Tn(a,l,p.children,d),l.child;case 9:return v=l.type._context,p=l.pendingProps.children,Zo(l),v=En(v),p=p(v),l.flags|=1,Tn(a,l,p,d),l.child;case 14:return NC(a,l,l.type,l.pendingProps,d);case 15:return DC(a,l,l.type,l.pendingProps,d);case 19:return HC(a,l,d);case 31:return PP(a,l,d);case 22:return IC(a,l,d,l.pendingProps);case 24:return Zo(l),p=En(tn),a===null?(v=qg(),v===null&&(v=_t,b=Ug(),v.pooledCache=b,b.refCount++,b!==null&&(v.pooledCacheLanes|=d),v=b),l.memoizedState={parent:p,cache:v},Wg(l),Rs(l,tn,v)):((a.lanes&d)!==0&&(Kg(a,l),Fc(l,null,null,d),Uc()),v=a.memoizedState,b=l.memoizedState,v.parent!==p?(v={parent:p,cache:p},l.memoizedState=v,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=v),Rs(l,tn,p)):(p=b.cache,Rs(l,tn,p),p!==v.cache&&Hg(l,[tn],d,!0))),Tn(a,l,l.pendingProps.children,d),l.child;case 29:throw l.pendingProps}throw Error(r(156,l.tag))}function ji(a){a.flags|=4}function Ry(a,l,d,p,v){if((l=(a.mode&32)!==0)&&(l=!1),l){if(a.flags|=16777216,(v&335544128)===v)if(a.stateNode.complete)a.flags|=8192;else if(g1())a.flags|=8192;else throw Jo=gf,Gg}else a.flags&=-16777217}function FC(a,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)a.flags&=-16777217;else if(a.flags|=16777216,!sE(l))if(g1())a.flags|=8192;else throw Jo=gf,Gg}function Df(a,l){l!==null&&(a.flags|=4),a.flags&16384&&(l=a.tag!==22?Kd():536870912,a.lanes|=l,Sl|=l)}function Yc(a,l){if(!st)switch(a.tailMode){case"hidden":l=a.tail;for(var d=null;l!==null;)l.alternate!==null&&(d=l),l=l.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?l||a.tail===null?a.tail=null:a.tail.sibling=null:p.sibling=null}}function Lt(a){var l=a.alternate!==null&&a.alternate.child===a.child,d=0,p=0;if(l)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,l}function jP(a,l,d){var p=l.pendingProps;switch(zg(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Lt(l),null;case 1:return Lt(l),null;case 3:return d=l.stateNode,p=null,a!==null&&(p=a.memoizedState.cache),l.memoizedState.cache!==p&&(l.flags|=2048),Ii(tn),Ie(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(a===null||a.child===null)&&(al(l)?ji(l):a===null||a.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Bg())),Lt(l),null;case 26:var v=l.type,b=l.memoizedState;return a===null?(ji(l),b!==null?(Lt(l),FC(l,b)):(Lt(l),Ry(l,v,null,p,d))):b?b!==a.memoizedState?(ji(l),Lt(l),FC(l,b)):(Lt(l),l.flags&=-16777217):(a=a.memoizedProps,a!==p&&ji(l),Lt(l),Ry(l,v,a,p,d)),null;case 27:if(Ke(l),d=Le.current,v=l.type,a!==null&&l.stateNode!=null)a.memoizedProps!==p&&ji(l);else{if(!p){if(l.stateNode===null)throw Error(r(166));return Lt(l),null}a=me.current,al(l)?kk(l):(a=X1(v,p,d),l.stateNode=a,ji(l))}return Lt(l),null;case 5:if(Ke(l),v=l.type,a!==null&&l.stateNode!=null)a.memoizedProps!==p&&ji(l);else{if(!p){if(l.stateNode===null)throw Error(r(166));return Lt(l),null}if(b=me.current,al(l))kk(l);else{var E=Kf(Le.current);switch(b){case 1:b=E.createElementNS("http://www.w3.org/2000/svg",v);break;case 2:b=E.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;default:switch(v){case"svg":b=E.createElementNS("http://www.w3.org/2000/svg",v);break;case"math":b=E.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;case"script":b=E.createElement("div"),b.innerHTML="<script><\/script>",b=b.removeChild(b.firstChild);break;case"select":b=typeof p.is=="string"?E.createElement("select",{is:p.is}):E.createElement("select"),p.multiple?b.multiple=!0:p.size&&(b.size=p.size);break;default:b=typeof p.is=="string"?E.createElement(v,{is:p.is}):E.createElement(v)}}b[kn]=l,b[tr]=p;e:for(E=l.child;E!==null;){if(E.tag===5||E.tag===6)b.appendChild(E.stateNode);else if(E.tag!==4&&E.tag!==27&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===l)break e;for(;E.sibling===null;){if(E.return===null||E.return===l)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}l.stateNode=b;e:switch(_n(b,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&&ji(l)}}return Lt(l),Ry(l,l.type,a===null?null:a.memoizedProps,l.pendingProps,d),null;case 6:if(a&&l.stateNode!=null)a.memoizedProps!==p&&ji(l);else{if(typeof p!="string"&&l.stateNode===null)throw Error(r(166));if(a=Le.current,al(l)){if(a=l.stateNode,d=l.memoizedProps,p=null,v=Cn,v!==null)switch(v.tag){case 27:case 5:p=v.memoizedProps}a[kn]=l,a=!!(a.nodeValue===d||p!==null&&p.suppressHydrationWarning===!0||$1(a.nodeValue,d)),a||As(l,!0)}else a=Kf(a).createTextNode(p),a[kn]=l,l.stateNode=a}return Lt(l),null;case 31:if(d=l.memoizedState,a===null||a.memoizedState!==null){if(p=al(l),d!==null){if(a===null){if(!p)throw Error(r(318));if(a=l.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(557));a[kn]=l}else Wo(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Lt(l),a=!1}else d=Bg(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=d),a=!0;if(!a)return l.flags&256?(pr(l),l):(pr(l),null);if((l.flags&128)!==0)throw Error(r(558))}return Lt(l),null;case 13:if(p=l.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(v=al(l),p!==null&&p.dehydrated!==null){if(a===null){if(!v)throw Error(r(318));if(v=l.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(r(317));v[kn]=l}else Wo(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Lt(l),v=!1}else v=Bg(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=v),v=!0;if(!v)return l.flags&256?(pr(l),l):(pr(l),null)}return pr(l),(l.flags&128)!==0?(l.lanes=d,l):(d=p!==null,a=a!==null&&a.memoizedState!==null,d&&(p=l.child,v=null,p.alternate!==null&&p.alternate.memoizedState!==null&&p.alternate.memoizedState.cachePool!==null&&(v=p.alternate.memoizedState.cachePool.pool),b=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(b=p.memoizedState.cachePool.pool),b!==v&&(p.flags|=2048)),d!==a&&d&&(l.child.flags|=8192),Df(l,l.updateQueue),Lt(l),null);case 4:return Ie(),a===null&&Xy(l.stateNode.containerInfo),Lt(l),null;case 10:return Ii(l.type),Lt(l),null;case 19:if(W(Yt),p=l.memoizedState,p===null)return Lt(l),null;if(v=(l.flags&128)!==0,b=p.rendering,b===null)if(v)Yc(p,!1);else{if(qt!==0||a!==null&&(a.flags&128)!==0)for(a=l.child;a!==null;){if(b=Sf(a),b!==null){for(l.flags|=128,Yc(p,!1),a=b.updateQueue,l.updateQueue=a,Df(l,a),l.subtreeFlags=0,a=d,d=l.child;d!==null;)vk(d,a),d=d.sibling;return ce(Yt,Yt.current&1|2),st&&Ni(l,p.treeForkCount),l.child}a=a.sibling}p.tail!==null&&en()>jf&&(l.flags|=128,v=!0,Yc(p,!1),l.lanes=4194304)}else{if(!v)if(a=Sf(b),a!==null){if(l.flags|=128,v=!0,a=a.updateQueue,l.updateQueue=a,Df(l,a),Yc(p,!0),p.tail===null&&p.tailMode==="hidden"&&!b.alternate&&!st)return Lt(l),null}else 2*en()-p.renderingStartTime>jf&&d!==536870912&&(l.flags|=128,v=!0,Yc(p,!1),l.lanes=4194304);p.isBackwards?(b.sibling=l.child,l.child=b):(a=p.last,a!==null?a.sibling=b:l.child=b,p.last=b)}return p.tail!==null?(a=p.tail,p.rendering=a,p.tail=a.sibling,p.renderingStartTime=en(),a.sibling=null,d=Yt.current,ce(Yt,v?d&1|2:d&1),st&&Ni(l,p.treeForkCount),a):(Lt(l),null);case 22:case 23:return pr(l),Jg(),p=l.memoizedState!==null,a!==null?a.memoizedState!==null!==p&&(l.flags|=8192):p&&(l.flags|=8192),p?(d&536870912)!==0&&(l.flags&128)===0&&(Lt(l),l.subtreeFlags&6&&(l.flags|=8192)):Lt(l),d=l.updateQueue,d!==null&&Df(l,d.retryQueue),d=null,a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(d=a.memoizedState.cachePool.pool),p=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(p=l.memoizedState.cachePool.pool),p!==d&&(l.flags|=2048),a!==null&&W(Yo),null;case 24:return d=null,a!==null&&(d=a.memoizedState.cache),l.memoizedState.cache!==d&&(l.flags|=2048),Ii(tn),Lt(l),null;case 25:return null;case 30:return null}throw Error(r(156,l.tag))}function BP(a,l){switch(zg(l),l.tag){case 1:return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 3:return Ii(tn),Ie(),a=l.flags,(a&65536)!==0&&(a&128)===0?(l.flags=a&-65537|128,l):null;case 26:case 27:case 5:return Ke(l),null;case 31:if(l.memoizedState!==null){if(pr(l),l.alternate===null)throw Error(r(340));Wo()}return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 13:if(pr(l),a=l.memoizedState,a!==null&&a.dehydrated!==null){if(l.alternate===null)throw Error(r(340));Wo()}return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 19:return W(Yt),null;case 4:return Ie(),null;case 10:return Ii(l.type),null;case 22:case 23:return pr(l),Jg(),a!==null&&W(Yo),a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 24:return Ii(tn),null;case 25:return null;default:return null}}function qC(a,l){switch(zg(l),l.tag){case 3:Ii(tn),Ie();break;case 26:case 27:case 5:Ke(l);break;case 4:Ie();break;case 31:l.memoizedState!==null&&pr(l);break;case 13:pr(l);break;case 19:W(Yt);break;case 10:Ii(l.type);break;case 22:case 23:pr(l),Jg(),a!==null&&W(Yo);break;case 24:Ii(tn)}}function Xc(a,l){try{var d=l.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 b=d.create,E=d.inst;p=b(),E.destroy=p}d=d.next}while(d!==v)}}catch(M){bt(l,l.return,M)}}function Ls(a,l,d){try{var p=l.updateQueue,v=p!==null?p.lastEffect:null;if(v!==null){var b=v.next;p=b;do{if((p.tag&a)===a){var E=p.inst,M=E.destroy;if(M!==void 0){E.destroy=void 0,v=l;var L=d,F=M;try{F()}catch(J){bt(v,L,J)}}}p=p.next}while(p!==b)}}catch(J){bt(l,l.return,J)}}function GC(a){var l=a.updateQueue;if(l!==null){var d=a.stateNode;try{Pk(l,d)}catch(p){bt(a,a.return,p)}}}function WC(a,l,d){d.props=ta(a.type,a.memoizedProps),d.state=a.memoizedState;try{d.componentWillUnmount()}catch(p){bt(a,l,p)}}function Jc(a,l){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){bt(a,l,v)}}function fi(a,l){var d=a.ref,p=a.refCleanup;if(d!==null)if(typeof p=="function")try{p()}catch(v){bt(a,l,v)}finally{a.refCleanup=null,a=a.alternate,a!=null&&(a.refCleanup=null)}else if(typeof d=="function")try{d(null)}catch(v){bt(a,l,v)}else d.current=null}function KC(a){var l=a.type,d=a.memoizedProps,p=a.stateNode;try{e:switch(l){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){bt(a,a.return,v)}}function My(a,l,d){try{var p=a.stateNode;az(p,a.type,d,l),p[tr]=l}catch(v){bt(a,a.return,v)}}function ZC(a){return a.tag===5||a.tag===3||a.tag===26||a.tag===27&&Hs(a.type)||a.tag===4}function Oy(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||ZC(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&&Hs(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 Ny(a,l,d){var p=a.tag;if(p===5||p===6)a=a.stateNode,l?(d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d).insertBefore(a,l):(l=d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d,l.appendChild(a),d=d._reactRootContainer,d!=null||l.onclick!==null||(l.onclick=Ri));else if(p!==4&&(p===27&&Hs(a.type)&&(d=a.stateNode,l=null),a=a.child,a!==null))for(Ny(a,l,d),a=a.sibling;a!==null;)Ny(a,l,d),a=a.sibling}function If(a,l,d){var p=a.tag;if(p===5||p===6)a=a.stateNode,l?d.insertBefore(a,l):d.appendChild(a);else if(p!==4&&(p===27&&Hs(a.type)&&(d=a.stateNode),a=a.child,a!==null))for(If(a,l,d),a=a.sibling;a!==null;)If(a,l,d),a=a.sibling}function YC(a){var l=a.stateNode,d=a.memoizedProps;try{for(var p=a.type,v=l.attributes;v.length;)l.removeAttributeNode(v[0]);_n(l,p,d),l[kn]=a,l[tr]=d}catch(b){bt(a,a.return,b)}}var Bi=!1,sn=!1,Dy=!1,XC=typeof WeakSet=="function"?WeakSet:Set,pn=null;function $P(a,l){if(a=a.containerInfo,ev=th,a=ck(a),Tg(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,b=p.focusNode;p=p.focusOffset;try{d.nodeType,b.nodeType}catch{d=null;break e}var E=0,M=-1,L=-1,F=0,J=0,ee=a,G=null;t:for(;;){for(var K;ee!==d||v!==0&&ee.nodeType!==3||(M=E+v),ee!==b||p!==0&&ee.nodeType!==3||(L=E+p),ee.nodeType===3&&(E+=ee.nodeValue.length),(K=ee.firstChild)!==null;)G=ee,ee=K;for(;;){if(ee===a)break t;if(G===d&&++F===v&&(M=E),G===b&&++J===p&&(L=E),(K=ee.nextSibling)!==null)break;ee=G,G=ee.parentNode}ee=K}d=M===-1||L===-1?null:{start:M,end:L}}else d=null}d=d||{start:0,end:0}}else d=null;for(tv={focusedElem:a,selectionRange:d},th=!1,pn=l;pn!==null;)if(l=pn,a=l.child,(l.subtreeFlags&1028)!==0&&a!==null)a.return=l,pn=a;else for(;pn!==null;){switch(l=pn,b=l.alternate,a=l.flags,l.tag){case 0:if((a&4)!==0&&(a=l.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&&b!==null){a=void 0,d=l,v=b.memoizedProps,b=b.memoizedState,p=d.stateNode;try{var Ee=ta(d.type,v);a=p.getSnapshotBeforeUpdate(Ee,b),p.__reactInternalSnapshotBeforeUpdate=a}catch(je){bt(d,d.return,je)}}break;case 3:if((a&1024)!==0){if(a=l.stateNode.containerInfo,d=a.nodeType,d===9)iv(a);else if(d===1)switch(a.nodeName){case"HEAD":case"HTML":case"BODY":iv(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=l.sibling,a!==null){a.return=l.return,pn=a;break}pn=l.return}}function JC(a,l,d){var p=d.flags;switch(d.tag){case 0:case 11:case 15:Vi(a,d),p&4&&Xc(5,d);break;case 1:if(Vi(a,d),p&4)if(a=d.stateNode,l===null)try{a.componentDidMount()}catch(E){bt(d,d.return,E)}else{var v=ta(d.type,l.memoizedProps);l=l.memoizedState;try{a.componentDidUpdate(v,l,a.__reactInternalSnapshotBeforeUpdate)}catch(E){bt(d,d.return,E)}}p&64&&GC(d),p&512&&Jc(d,d.return);break;case 3:if(Vi(a,d),p&64&&(a=d.updateQueue,a!==null)){if(l=null,d.child!==null)switch(d.child.tag){case 27:case 5:l=d.child.stateNode;break;case 1:l=d.child.stateNode}try{Pk(a,l)}catch(E){bt(d,d.return,E)}}break;case 27:l===null&&p&4&&YC(d);case 26:case 5:Vi(a,d),l===null&&p&4&&KC(d),p&512&&Jc(d,d.return);break;case 12:Vi(a,d);break;case 31:Vi(a,d),p&4&&t1(a,d);break;case 13:Vi(a,d),p&4&&n1(a,d),p&64&&(a=d.memoizedState,a!==null&&(a=a.dehydrated,a!==null&&(d=ZP.bind(null,d),mz(a,d))));break;case 22:if(p=d.memoizedState!==null||Bi,!p){l=l!==null&&l.memoizedState!==null||sn,v=Bi;var b=sn;Bi=p,(sn=l)&&!b?Hi(a,d,(d.subtreeFlags&8772)!==0):Vi(a,d),Bi=v,sn=b}break;case 30:break;default:Vi(a,d)}}function QC(a){var l=a.alternate;l!==null&&(a.alternate=null,QC(l)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(l=a.stateNode,l!==null&&cg(l)),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 Bt=null,rr=!1;function $i(a,l,d){for(d=d.child;d!==null;)e1(a,l,d),d=d.sibling}function e1(a,l,d){if(re&&typeof re.onCommitFiberUnmount=="function")try{re.onCommitFiberUnmount(H,d)}catch{}switch(d.tag){case 26:sn||fi(d,l),$i(a,l,d),d.memoizedState?d.memoizedState.count--:d.stateNode&&(d=d.stateNode,d.parentNode.removeChild(d));break;case 27:sn||fi(d,l);var p=Bt,v=rr;Hs(d.type)&&(Bt=d.stateNode,rr=!1),$i(a,l,d),au(d.stateNode),Bt=p,rr=v;break;case 5:sn||fi(d,l);case 6:if(p=Bt,v=rr,Bt=null,$i(a,l,d),Bt=p,rr=v,Bt!==null)if(rr)try{(Bt.nodeType===9?Bt.body:Bt.nodeName==="HTML"?Bt.ownerDocument.body:Bt).removeChild(d.stateNode)}catch(b){bt(d,l,b)}else try{Bt.removeChild(d.stateNode)}catch(b){bt(d,l,b)}break;case 18:Bt!==null&&(rr?(a=Bt,G1(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,d.stateNode),Al(a)):G1(Bt,d.stateNode));break;case 4:p=Bt,v=rr,Bt=d.stateNode.containerInfo,rr=!0,$i(a,l,d),Bt=p,rr=v;break;case 0:case 11:case 14:case 15:Ls(2,d,l),sn||Ls(4,d,l),$i(a,l,d);break;case 1:sn||(fi(d,l),p=d.stateNode,typeof p.componentWillUnmount=="function"&&WC(d,l,p)),$i(a,l,d);break;case 21:$i(a,l,d);break;case 22:sn=(p=sn)||d.memoizedState!==null,$i(a,l,d),sn=p;break;default:$i(a,l,d)}}function t1(a,l){if(l.memoizedState===null&&(a=l.alternate,a!==null&&(a=a.memoizedState,a!==null))){a=a.dehydrated;try{Al(a)}catch(d){bt(l,l.return,d)}}}function n1(a,l){if(l.memoizedState===null&&(a=l.alternate,a!==null&&(a=a.memoizedState,a!==null&&(a=a.dehydrated,a!==null))))try{Al(a)}catch(d){bt(l,l.return,d)}}function VP(a){switch(a.tag){case 31:case 13:case 19:var l=a.stateNode;return l===null&&(l=a.stateNode=new XC),l;case 22:return a=a.stateNode,l=a._retryCache,l===null&&(l=a._retryCache=new XC),l;default:throw Error(r(435,a.tag))}}function Lf(a,l){var d=VP(a);l.forEach(function(p){if(!d.has(p)){d.add(p);var v=YP.bind(null,a,p);p.then(v,v)}})}function ir(a,l){var d=l.deletions;if(d!==null)for(var p=0;p<d.length;p++){var v=d[p],b=a,E=l,M=E;e:for(;M!==null;){switch(M.tag){case 27:if(Hs(M.type)){Bt=M.stateNode,rr=!1;break e}break;case 5:Bt=M.stateNode,rr=!1;break e;case 3:case 4:Bt=M.stateNode.containerInfo,rr=!0;break e}M=M.return}if(Bt===null)throw Error(r(160));e1(b,E,v),Bt=null,rr=!1,b=v.alternate,b!==null&&(b.return=null),v.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)r1(l,a),l=l.sibling}var Gr=null;function r1(a,l){var d=a.alternate,p=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:ir(l,a),sr(a),p&4&&(Ls(3,a,a.return),Xc(3,a),Ls(5,a,a.return));break;case 1:ir(l,a),sr(a),p&512&&(sn||d===null||fi(d,d.return)),p&64&&Bi&&(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=Gr;if(ir(l,a),sr(a),p&512&&(sn||d===null||fi(d,d.return)),p&4){var b=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":b=v.getElementsByTagName("title")[0],(!b||b[Ec]||b[kn]||b.namespaceURI==="http://www.w3.org/2000/svg"||b.hasAttribute("itemprop"))&&(b=v.createElement(p),v.head.insertBefore(b,v.querySelector("head > title"))),_n(b,p,d),b[kn]=a,hn(b),p=b;break e;case"link":var E=rE("link","href",v).get(p+(d.href||""));if(E){for(var M=0;M<E.length;M++)if(b=E[M],b.getAttribute("href")===(d.href==null||d.href===""?null:d.href)&&b.getAttribute("rel")===(d.rel==null?null:d.rel)&&b.getAttribute("title")===(d.title==null?null:d.title)&&b.getAttribute("crossorigin")===(d.crossOrigin==null?null:d.crossOrigin)){E.splice(M,1);break t}}b=v.createElement(p),_n(b,p,d),v.head.appendChild(b);break;case"meta":if(E=rE("meta","content",v).get(p+(d.content||""))){for(M=0;M<E.length;M++)if(b=E[M],b.getAttribute("content")===(d.content==null?null:""+d.content)&&b.getAttribute("name")===(d.name==null?null:d.name)&&b.getAttribute("property")===(d.property==null?null:d.property)&&b.getAttribute("http-equiv")===(d.httpEquiv==null?null:d.httpEquiv)&&b.getAttribute("charset")===(d.charSet==null?null:d.charSet)){E.splice(M,1);break t}}b=v.createElement(p),_n(b,p,d),v.head.appendChild(b);break;default:throw Error(r(468,p))}b[kn]=a,hn(b),p=b}a.stateNode=p}else iE(v,a.type,a.stateNode);else a.stateNode=nE(v,p,a.memoizedProps);else b!==p?(b===null?d.stateNode!==null&&(d=d.stateNode,d.parentNode.removeChild(d)):b.count--,p===null?iE(v,a.type,a.stateNode):nE(v,p,a.memoizedProps)):p===null&&a.stateNode!==null&&My(a,a.memoizedProps,d.memoizedProps)}break;case 27:ir(l,a),sr(a),p&512&&(sn||d===null||fi(d,d.return)),d!==null&&p&4&&My(a,a.memoizedProps,d.memoizedProps);break;case 5:if(ir(l,a),sr(a),p&512&&(sn||d===null||fi(d,d.return)),a.flags&32){v=a.stateNode;try{Xa(v,"")}catch(Ee){bt(a,a.return,Ee)}}p&4&&a.stateNode!=null&&(v=a.memoizedProps,My(a,v,d!==null?d.memoizedProps:v)),p&1024&&(Dy=!0);break;case 6:if(ir(l,a),sr(a),p&4){if(a.stateNode===null)throw Error(r(162));p=a.memoizedProps,d=a.stateNode;try{d.nodeValue=p}catch(Ee){bt(a,a.return,Ee)}}break;case 3:if(Xf=null,v=Gr,Gr=Zf(l.containerInfo),ir(l,a),Gr=v,sr(a),p&4&&d!==null&&d.memoizedState.isDehydrated)try{Al(l.containerInfo)}catch(Ee){bt(a,a.return,Ee)}Dy&&(Dy=!1,i1(a));break;case 4:p=Gr,Gr=Zf(a.stateNode.containerInfo),ir(l,a),sr(a),Gr=p;break;case 12:ir(l,a),sr(a);break;case 31:ir(l,a),sr(a),p&4&&(p=a.updateQueue,p!==null&&(a.updateQueue=null,Lf(a,p)));break;case 13:ir(l,a),sr(a),a.child.flags&8192&&a.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&(zf=en()),p&4&&(p=a.updateQueue,p!==null&&(a.updateQueue=null,Lf(a,p)));break;case 22:v=a.memoizedState!==null;var L=d!==null&&d.memoizedState!==null,F=Bi,J=sn;if(Bi=F||v,sn=J||L,ir(l,a),sn=J,Bi=F,sr(a),p&8192)e:for(l=a.stateNode,l._visibility=v?l._visibility&-2:l._visibility|1,v&&(d===null||L||Bi||sn||na(a)),d=null,l=a;;){if(l.tag===5||l.tag===26){if(d===null){L=d=l;try{if(b=L.stateNode,v)E=b.style,typeof E.setProperty=="function"?E.setProperty("display","none","important"):E.display="none";else{M=L.stateNode;var ee=L.memoizedProps.style,G=ee!=null&&ee.hasOwnProperty("display")?ee.display:null;M.style.display=G==null||typeof G=="boolean"?"":(""+G).trim()}}catch(Ee){bt(L,L.return,Ee)}}}else if(l.tag===6){if(d===null){L=l;try{L.stateNode.nodeValue=v?"":L.memoizedProps}catch(Ee){bt(L,L.return,Ee)}}}else if(l.tag===18){if(d===null){L=l;try{var K=L.stateNode;v?W1(K,!0):W1(L.stateNode,!1)}catch(Ee){bt(L,L.return,Ee)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===a)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===a)break e;for(;l.sibling===null;){if(l.return===null||l.return===a)break e;d===l&&(d=null),l=l.return}d===l&&(d=null),l.sibling.return=l.return,l=l.sibling}p&4&&(p=a.updateQueue,p!==null&&(d=p.retryQueue,d!==null&&(p.retryQueue=null,Lf(a,d))));break;case 19:ir(l,a),sr(a),p&4&&(p=a.updateQueue,p!==null&&(a.updateQueue=null,Lf(a,p)));break;case 30:break;case 21:break;default:ir(l,a),sr(a)}}function sr(a){var l=a.flags;if(l&2){try{for(var d,p=a.return;p!==null;){if(ZC(p)){d=p;break}p=p.return}if(d==null)throw Error(r(160));switch(d.tag){case 27:var v=d.stateNode,b=Oy(a);If(a,b,v);break;case 5:var E=d.stateNode;d.flags&32&&(Xa(E,""),d.flags&=-33);var M=Oy(a);If(a,M,E);break;case 3:case 4:var L=d.stateNode.containerInfo,F=Oy(a);Ny(a,F,L);break;default:throw Error(r(161))}}catch(J){bt(a,a.return,J)}a.flags&=-3}l&4096&&(a.flags&=-4097)}function i1(a){if(a.subtreeFlags&1024)for(a=a.child;a!==null;){var l=a;i1(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),a=a.sibling}}function Vi(a,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)JC(a,l.alternate,l),l=l.sibling}function na(a){for(a=a.child;a!==null;){var l=a;switch(l.tag){case 0:case 11:case 14:case 15:Ls(4,l,l.return),na(l);break;case 1:fi(l,l.return);var d=l.stateNode;typeof d.componentWillUnmount=="function"&&WC(l,l.return,d),na(l);break;case 27:au(l.stateNode);case 26:case 5:fi(l,l.return),na(l);break;case 22:l.memoizedState===null&&na(l);break;case 30:na(l);break;default:na(l)}a=a.sibling}}function Hi(a,l,d){for(d=d&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var p=l.alternate,v=a,b=l,E=b.flags;switch(b.tag){case 0:case 11:case 15:Hi(v,b,d),Xc(4,b);break;case 1:if(Hi(v,b,d),p=b,v=p.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(F){bt(p,p.return,F)}if(p=b,v=p.updateQueue,v!==null){var M=p.stateNode;try{var L=v.shared.hiddenCallbacks;if(L!==null)for(v.shared.hiddenCallbacks=null,v=0;v<L.length;v++)Lk(L[v],M)}catch(F){bt(p,p.return,F)}}d&&E&64&&GC(b),Jc(b,b.return);break;case 27:YC(b);case 26:case 5:Hi(v,b,d),d&&p===null&&E&4&&KC(b),Jc(b,b.return);break;case 12:Hi(v,b,d);break;case 31:Hi(v,b,d),d&&E&4&&t1(v,b);break;case 13:Hi(v,b,d),d&&E&4&&n1(v,b);break;case 22:b.memoizedState===null&&Hi(v,b,d),Jc(b,b.return);break;case 30:break;default:Hi(v,b,d)}l=l.sibling}}function Iy(a,l){var d=null;a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(d=a.memoizedState.cachePool.pool),a=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(a=l.memoizedState.cachePool.pool),a!==d&&(a!=null&&a.refCount++,d!=null&&jc(d))}function Ly(a,l){a=null,l.alternate!==null&&(a=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==a&&(l.refCount++,a!=null&&jc(a))}function Wr(a,l,d,p){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)s1(a,l,d,p),l=l.sibling}function s1(a,l,d,p){var v=l.flags;switch(l.tag){case 0:case 11:case 15:Wr(a,l,d,p),v&2048&&Xc(9,l);break;case 1:Wr(a,l,d,p);break;case 3:Wr(a,l,d,p),v&2048&&(a=null,l.alternate!==null&&(a=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==a&&(l.refCount++,a!=null&&jc(a)));break;case 12:if(v&2048){Wr(a,l,d,p),a=l.stateNode;try{var b=l.memoizedProps,E=b.id,M=b.onPostCommit;typeof M=="function"&&M(E,l.alternate===null?"mount":"update",a.passiveEffectDuration,-0)}catch(L){bt(l,l.return,L)}}else Wr(a,l,d,p);break;case 31:Wr(a,l,d,p);break;case 13:Wr(a,l,d,p);break;case 23:break;case 22:b=l.stateNode,E=l.alternate,l.memoizedState!==null?b._visibility&2?Wr(a,l,d,p):Qc(a,l):b._visibility&2?Wr(a,l,d,p):(b._visibility|=2,yl(a,l,d,p,(l.subtreeFlags&10256)!==0||!1)),v&2048&&Iy(E,l);break;case 24:Wr(a,l,d,p),v&2048&&Ly(l.alternate,l);break;default:Wr(a,l,d,p)}}function yl(a,l,d,p,v){for(v=v&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var b=a,E=l,M=d,L=p,F=E.flags;switch(E.tag){case 0:case 11:case 15:yl(b,E,M,L,v),Xc(8,E);break;case 23:break;case 22:var J=E.stateNode;E.memoizedState!==null?J._visibility&2?yl(b,E,M,L,v):Qc(b,E):(J._visibility|=2,yl(b,E,M,L,v)),v&&F&2048&&Iy(E.alternate,E);break;case 24:yl(b,E,M,L,v),v&&F&2048&&Ly(E.alternate,E);break;default:yl(b,E,M,L,v)}l=l.sibling}}function Qc(a,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var d=a,p=l,v=p.flags;switch(p.tag){case 22:Qc(d,p),v&2048&&Iy(p.alternate,p);break;case 24:Qc(d,p),v&2048&&Ly(p.alternate,p);break;default:Qc(d,p)}l=l.sibling}}var eu=8192;function vl(a,l,d){if(a.subtreeFlags&eu)for(a=a.child;a!==null;)o1(a,l,d),a=a.sibling}function o1(a,l,d){switch(a.tag){case 26:vl(a,l,d),a.flags&eu&&a.memoizedState!==null&&_z(d,Gr,a.memoizedState,a.memoizedProps);break;case 5:vl(a,l,d);break;case 3:case 4:var p=Gr;Gr=Zf(a.stateNode.containerInfo),vl(a,l,d),Gr=p;break;case 22:a.memoizedState===null&&(p=a.alternate,p!==null&&p.memoizedState!==null?(p=eu,eu=16777216,vl(a,l,d),eu=p):vl(a,l,d));break;default:vl(a,l,d)}}function a1(a){var l=a.alternate;if(l!==null&&(a=l.child,a!==null)){l.child=null;do l=a.sibling,a.sibling=null,a=l;while(a!==null)}}function tu(a){var l=a.deletions;if((a.flags&16)!==0){if(l!==null)for(var d=0;d<l.length;d++){var p=l[d];pn=p,c1(p,a)}a1(a)}if(a.subtreeFlags&10256)for(a=a.child;a!==null;)l1(a),a=a.sibling}function l1(a){switch(a.tag){case 0:case 11:case 15:tu(a),a.flags&2048&&Ls(9,a,a.return);break;case 3:tu(a);break;case 12:tu(a);break;case 22:var l=a.stateNode;a.memoizedState!==null&&l._visibility&2&&(a.return===null||a.return.tag!==13)?(l._visibility&=-3,Pf(a)):tu(a);break;default:tu(a)}}function Pf(a){var l=a.deletions;if((a.flags&16)!==0){if(l!==null)for(var d=0;d<l.length;d++){var p=l[d];pn=p,c1(p,a)}a1(a)}for(a=a.child;a!==null;){switch(l=a,l.tag){case 0:case 11:case 15:Ls(8,l,l.return),Pf(l);break;case 22:d=l.stateNode,d._visibility&2&&(d._visibility&=-3,Pf(l));break;default:Pf(l)}a=a.sibling}}function c1(a,l){for(;pn!==null;){var d=pn;switch(d.tag){case 0:case 11:case 15:Ls(8,d,l);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:jc(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,b=p.return;if(QC(p),p===d){pn=null;break e}if(v!==null){v.return=b,pn=v;break e}pn=b}}}var HP={getCacheForType:function(a){var l=En(tn),d=l.data.get(a);return d===void 0&&(d=a(),l.data.set(a,d)),d},cacheSignal:function(){return En(tn).controller.signal}},UP=typeof WeakMap=="function"?WeakMap:Map,mt=0,_t=null,et=null,rt=0,vt=0,mr=null,Ps=!1,bl=!1,Py=!1,Ui=0,qt=0,zs=0,ra=0,zy=0,gr=0,Sl=0,nu=null,or=null,jy=!1,zf=0,u1=0,jf=1/0,Bf=null,js=null,fn=0,Bs=null,wl=null,Fi=0,By=0,$y=null,d1=null,ru=0,Vy=null;function yr(){return(mt&2)!==0&&rt!==0?rt&-rt:B.T!==null?Wy():_x()}function f1(){if(gr===0)if((rt&536870912)===0||st){var a=Vt;Vt<<=1,(Vt&3932160)===0&&(Vt=262144),gr=a}else gr=536870912;return a=hr.current,a!==null&&(a.flags|=32),gr}function ar(a,l,d){(a===_t&&(vt===2||vt===9)||a.cancelPendingCommit!==null)&&(xl(a,0),$s(a,rt,gr,!1)),Cc(a,d),((mt&2)===0||a!==_t)&&(a===_t&&((mt&2)===0&&(ra|=d),qt===4&&$s(a,rt,gr,!1)),hi(a))}function h1(a,l,d){if((mt&6)!==0)throw Error(r(327));var p=!d&&(l&127)===0&&(l&a.expiredLanes)===0||Bo(a,l),v=p?GP(a,l):Uy(a,l,!0),b=p;do{if(v===0){bl&&!p&&$s(a,l,0,!1);break}else{if(d=a.current.alternate,b&&!FP(d)){v=Uy(a,l,!1),b=!1;continue}if(v===2){if(b=l,a.errorRecoveryDisabledLanes&b)var E=0;else E=a.pendingLanes&-536870913,E=E!==0?E:E&536870912?536870912:0;if(E!==0){l=E;e:{var M=a;v=nu;var L=M.current.memoizedState.isDehydrated;if(L&&(xl(M,E).flags|=256),E=Uy(M,E,!1),E!==2){if(Py&&!L){M.errorRecoveryDisabledLanes|=b,ra|=b,v=4;break e}b=or,or=v,b!==null&&(or===null?or=b:or.push.apply(or,b))}v=E}if(b=!1,v!==2)continue}}if(v===1){xl(a,0),$s(a,l,0,!0);break}e:{switch(p=a,b=v,b){case 0:case 1:throw Error(r(345));case 4:if((l&4194048)!==l)break;case 6:$s(p,l,gr,!Ps);break e;case 2:or=null;break;case 3:case 5:break;default:throw Error(r(329))}if((l&62914560)===l&&(v=zf+300-en(),10<v)){if($s(p,l,gr,!Ps),ci(p,0,!0)!==0)break e;Fi=l,p.timeoutHandle=F1(p1.bind(null,p,d,or,Bf,jy,l,gr,ra,Sl,Ps,b,"Throttled",-0,0),v);break e}p1(p,d,or,Bf,jy,l,gr,ra,Sl,Ps,b,null,-0,0)}}break}while(!0);hi(a)}function p1(a,l,d,p,v,b,E,M,L,F,J,ee,G,K){if(a.timeoutHandle=-1,ee=l.subtreeFlags,ee&8192||(ee&16785408)===16785408){ee={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ri},o1(l,b,ee);var Ee=(b&62914560)===b?zf-en():(b&4194048)===b?u1-en():0;if(Ee=Az(ee,Ee),Ee!==null){Fi=b,a.cancelPendingCommit=Ee(x1.bind(null,a,l,b,d,p,v,E,M,L,J,ee,null,G,K)),$s(a,b,E,!F);return}}x1(a,l,b,d,p,v,E,M,L)}function FP(a){for(var l=a;;){var d=l.tag;if((d===0||d===11||d===15)&&l.flags&16384&&(d=l.updateQueue,d!==null&&(d=d.stores,d!==null)))for(var p=0;p<d.length;p++){var v=d[p],b=v.getSnapshot;v=v.value;try{if(!dr(b(),v))return!1}catch{return!1}}if(d=l.child,l.subtreeFlags&16384&&d!==null)d.return=l,l=d;else{if(l===a)break;for(;l.sibling===null;){if(l.return===null||l.return===a)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function $s(a,l,d,p){l&=~zy,l&=~ra,a.suspendedLanes|=l,a.pingedLanes&=~l,p&&(a.warmLanes|=l),p=a.expirationTimes;for(var v=l;0<v;){var b=31-he(v),E=1<<b;p[b]=-1,v&=~E}d!==0&&Cx(a,d,l)}function $f(){return(mt&6)===0?(iu(0),!1):!0}function Hy(){if(et!==null){if(vt===0)var a=et.return;else a=et,Di=Ko=null,iy(a),fl=null,$c=0,a=et;for(;a!==null;)qC(a.alternate,a),a=a.return;et=null}}function xl(a,l){var d=a.timeoutHandle;d!==-1&&(a.timeoutHandle=-1,uz(d)),d=a.cancelPendingCommit,d!==null&&(a.cancelPendingCommit=null,d()),Fi=0,Hy(),_t=a,et=d=Oi(a.current,null),rt=l,vt=0,mr=null,Ps=!1,bl=Bo(a,l),Py=!1,Sl=gr=zy=ra=zs=qt=0,or=nu=null,jy=!1,(l&8)!==0&&(l|=l&32);var p=a.entangledLanes;if(p!==0)for(a=a.entanglements,p&=l;0<p;){var v=31-he(p),b=1<<v;l|=a[v],p&=~b}return Ui=l,af(),d}function m1(a,l){Ze=null,B.H=Kc,l===dl||l===mf?(l=Ok(),vt=3):l===Gg?(l=Ok(),vt=4):vt=l===Sy?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,mr=l,et===null&&(qt=1,Rf(a,Rr(l,a.current)))}function g1(){var a=hr.current;return a===null?!0:(rt&4194048)===rt?Dr===null:(rt&62914560)===rt||(rt&536870912)!==0?a===Dr:!1}function y1(){var a=B.H;return B.H=Kc,a===null?Kc:a}function v1(){var a=B.A;return B.A=HP,a}function Vf(){qt=4,Ps||(rt&4194048)!==rt&&hr.current!==null||(bl=!0),(zs&134217727)===0&&(ra&134217727)===0||_t===null||$s(_t,rt,gr,!1)}function Uy(a,l,d){var p=mt;mt|=2;var v=y1(),b=v1();(_t!==a||rt!==l)&&(Bf=null,xl(a,l)),l=!1;var E=qt;e:do try{if(vt!==0&&et!==null){var M=et,L=mr;switch(vt){case 8:Hy(),E=6;break e;case 3:case 2:case 9:case 6:hr.current===null&&(l=!0);var F=vt;if(vt=0,mr=null,kl(a,M,L,F),d&&bl){E=0;break e}break;default:F=vt,vt=0,mr=null,kl(a,M,L,F)}}qP(),E=qt;break}catch(J){m1(a,J)}while(!0);return l&&a.shellSuspendCounter++,Di=Ko=null,mt=p,B.H=v,B.A=b,et===null&&(_t=null,rt=0,af()),E}function qP(){for(;et!==null;)b1(et)}function GP(a,l){var d=mt;mt|=2;var p=y1(),v=v1();_t!==a||rt!==l?(Bf=null,jf=en()+500,xl(a,l)):bl=Bo(a,l);e:do try{if(vt!==0&&et!==null){l=et;var b=mr;t:switch(vt){case 1:vt=0,mr=null,kl(a,l,b,1);break;case 2:case 9:if(Rk(b)){vt=0,mr=null,S1(l);break}l=function(){vt!==2&&vt!==9||_t!==a||(vt=7),hi(a)},b.then(l,l);break e;case 3:vt=7;break e;case 4:vt=5;break e;case 7:Rk(b)?(vt=0,mr=null,S1(l)):(vt=0,mr=null,kl(a,l,b,7));break;case 5:var E=null;switch(et.tag){case 26:E=et.memoizedState;case 5:case 27:var M=et;if(E?sE(E):M.stateNode.complete){vt=0,mr=null;var L=M.sibling;if(L!==null)et=L;else{var F=M.return;F!==null?(et=F,Hf(F)):et=null}break t}}vt=0,mr=null,kl(a,l,b,5);break;case 6:vt=0,mr=null,kl(a,l,b,6);break;case 8:Hy(),qt=6;break e;default:throw Error(r(462))}}WP();break}catch(J){m1(a,J)}while(!0);return Di=Ko=null,B.H=p,B.A=v,mt=d,et!==null?0:(_t=null,rt=0,af(),qt)}function WP(){for(;et!==null&&!Qn();)b1(et)}function b1(a){var l=UC(a.alternate,a,Ui);a.memoizedProps=a.pendingProps,l===null?Hf(a):et=l}function S1(a){var l=a,d=l.alternate;switch(l.tag){case 15:case 0:l=zC(d,l,l.pendingProps,l.type,void 0,rt);break;case 11:l=zC(d,l,l.pendingProps,l.type.render,l.ref,rt);break;case 5:iy(l);default:qC(d,l),l=et=vk(l,Ui),l=UC(d,l,Ui)}a.memoizedProps=a.pendingProps,l===null?Hf(a):et=l}function kl(a,l,d,p){Di=Ko=null,iy(l),fl=null,$c=0;var v=l.return;try{if(LP(a,v,l,d,rt)){qt=1,Rf(a,Rr(d,a.current)),et=null;return}}catch(b){if(v!==null)throw et=v,b;qt=1,Rf(a,Rr(d,a.current)),et=null;return}l.flags&32768?(st||p===1?a=!0:bl||(rt&536870912)!==0?a=!1:(Ps=a=!0,(p===2||p===9||p===3||p===6)&&(p=hr.current,p!==null&&p.tag===13&&(p.flags|=16384))),w1(l,a)):Hf(l)}function Hf(a){var l=a;do{if((l.flags&32768)!==0){w1(l,Ps);return}a=l.return;var d=jP(l.alternate,l,Ui);if(d!==null){et=d;return}if(l=l.sibling,l!==null){et=l;return}et=l=a}while(l!==null);qt===0&&(qt=5)}function w1(a,l){do{var d=BP(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),!l&&(a=a.sibling,a!==null)){et=a;return}et=a=d}while(a!==null);qt=6,et=null}function x1(a,l,d,p,v,b,E,M,L){a.cancelPendingCommit=null;do Uf();while(fn!==0);if((mt&6)!==0)throw Error(r(327));if(l!==null){if(l===a.current)throw Error(r(177));if(b=l.lanes|l.childLanes,b|=Og,T2(a,d,b,E,M,L),a===_t&&(et=_t=null,rt=0),wl=l,Bs=a,Fi=d,By=b,$y=v,d1=p,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(a.callbackNode=null,a.callbackPriority=0,XP(xc,function(){return _1(),null})):(a.callbackNode=null,a.callbackPriority=0),p=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||p){p=B.T,B.T=null,v=Y.p,Y.p=2,E=mt,mt|=4;try{$P(a,l,d)}finally{mt=E,Y.p=v,B.T=p}}fn=1,k1(),C1(),E1()}}function k1(){if(fn===1){fn=0;var a=Bs,l=wl,d=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||d){d=B.T,B.T=null;var p=Y.p;Y.p=2;var v=mt;mt|=4;try{r1(l,a);var b=tv,E=ck(a.containerInfo),M=b.focusedElem,L=b.selectionRange;if(E!==M&&M&&M.ownerDocument&&lk(M.ownerDocument.documentElement,M)){if(L!==null&&Tg(M)){var F=L.start,J=L.end;if(J===void 0&&(J=F),"selectionStart"in M)M.selectionStart=F,M.selectionEnd=Math.min(J,M.value.length);else{var ee=M.ownerDocument||document,G=ee&&ee.defaultView||window;if(G.getSelection){var K=G.getSelection(),Ee=M.textContent.length,je=Math.min(L.start,Ee),Ct=L.end===void 0?je:Math.min(L.end,Ee);!K.extend&&je>Ct&&(E=Ct,Ct=je,je=E);var $=ak(M,je),j=ak(M,Ct);if($&&j&&(K.rangeCount!==1||K.anchorNode!==$.node||K.anchorOffset!==$.offset||K.focusNode!==j.node||K.focusOffset!==j.offset)){var U=ee.createRange();U.setStart($.node,$.offset),K.removeAllRanges(),je>Ct?(K.addRange(U),K.extend(j.node,j.offset)):(U.setEnd(j.node,j.offset),K.addRange(U))}}}}for(ee=[],K=M;K=K.parentNode;)K.nodeType===1&&ee.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof M.focus=="function"&&M.focus(),M=0;M<ee.length;M++){var Q=ee[M];Q.element.scrollLeft=Q.left,Q.element.scrollTop=Q.top}}th=!!ev,tv=ev=null}finally{mt=v,Y.p=p,B.T=d}}a.current=l,fn=2}}function C1(){if(fn===2){fn=0;var a=Bs,l=wl,d=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||d){d=B.T,B.T=null;var p=Y.p;Y.p=2;var v=mt;mt|=4;try{JC(a,l.alternate,l)}finally{mt=v,Y.p=p,B.T=d}}fn=3}}function E1(){if(fn===4||fn===3){fn=0,ks();var a=Bs,l=wl,d=Fi,p=d1;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?fn=5:(fn=0,wl=Bs=null,T1(a,a.pendingLanes));var v=a.pendingLanes;if(v===0&&(js=null),ag(d),l=l.stateNode,re&&typeof re.onCommitFiberRoot=="function")try{re.onCommitFiberRoot(H,l,void 0,(l.current.flags&128)===128)}catch{}if(p!==null){l=B.T,v=Y.p,Y.p=2,B.T=null;try{for(var b=a.onRecoverableError,E=0;E<p.length;E++){var M=p[E];b(M.value,{componentStack:M.stack})}}finally{B.T=l,Y.p=v}}(Fi&3)!==0&&Uf(),hi(a),v=a.pendingLanes,(d&261930)!==0&&(v&42)!==0?a===Vy?ru++:(ru=0,Vy=a):ru=0,iu(0)}}function T1(a,l){(a.pooledCacheLanes&=l)===0&&(l=a.pooledCache,l!=null&&(a.pooledCache=null,jc(l)))}function Uf(){return k1(),C1(),E1(),_1()}function _1(){if(fn!==5)return!1;var a=Bs,l=By;By=0;var d=ag(Fi),p=B.T,v=Y.p;try{Y.p=32>d?32:d,B.T=null,d=$y,$y=null;var b=Bs,E=Fi;if(fn=0,wl=Bs=null,Fi=0,(mt&6)!==0)throw Error(r(331));var M=mt;if(mt|=4,l1(b.current),s1(b,b.current,E,d),mt=M,iu(0,!1),re&&typeof re.onPostCommitFiberRoot=="function")try{re.onPostCommitFiberRoot(H,b)}catch{}return!0}finally{Y.p=v,B.T=p,T1(a,l)}}function A1(a,l,d){l=Rr(d,l),l=by(a.stateNode,l,2),a=Ns(a,l,2),a!==null&&(Cc(a,2),hi(a))}function bt(a,l,d){if(a.tag===3)A1(a,a,d);else for(;l!==null;){if(l.tag===3){A1(l,a,d);break}else if(l.tag===1){var p=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(js===null||!js.has(p))){a=Rr(d,a),d=RC(2),p=Ns(l,d,2),p!==null&&(MC(d,p,l,a),Cc(p,2),hi(p));break}}l=l.return}}function Fy(a,l,d){var p=a.pingCache;if(p===null){p=a.pingCache=new UP;var v=new Set;p.set(l,v)}else v=p.get(l),v===void 0&&(v=new Set,p.set(l,v));v.has(d)||(Py=!0,v.add(d),a=KP.bind(null,a,l,d),l.then(a,a))}function KP(a,l,d){var p=a.pingCache;p!==null&&p.delete(l),a.pingedLanes|=a.suspendedLanes&d,a.warmLanes&=~d,_t===a&&(rt&d)===d&&(qt===4||qt===3&&(rt&62914560)===rt&&300>en()-zf?(mt&2)===0&&xl(a,0):zy|=d,Sl===rt&&(Sl=0)),hi(a)}function R1(a,l){l===0&&(l=Kd()),a=qo(a,l),a!==null&&(Cc(a,l),hi(a))}function ZP(a){var l=a.memoizedState,d=0;l!==null&&(d=l.retryLane),R1(a,d)}function YP(a,l){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(l),R1(a,d)}function XP(a,l){return Pe(a,l)}var Ff=null,Cl=null,qy=!1,qf=!1,Gy=!1,Vs=0;function hi(a){a!==Cl&&a.next===null&&(Cl===null?Ff=Cl=a:Cl=Cl.next=a),qf=!0,qy||(qy=!0,QP())}function iu(a,l){if(!Gy&&qf){Gy=!0;do for(var d=!1,p=Ff;p!==null;){if(a!==0){var v=p.pendingLanes;if(v===0)var b=0;else{var E=p.suspendedLanes,M=p.pingedLanes;b=(1<<31-he(42|a)+1)-1,b&=v&~(E&~M),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(d=!0,D1(p,b))}else b=rt,b=ci(p,p===_t?b:0,p.cancelPendingCommit!==null||p.timeoutHandle!==-1),(b&3)===0||Bo(p,b)||(d=!0,D1(p,b));p=p.next}while(d);Gy=!1}}function JP(){M1()}function M1(){qf=qy=!1;var a=0;Vs!==0&&cz()&&(a=Vs);for(var l=en(),d=null,p=Ff;p!==null;){var v=p.next,b=O1(p,l);b===0?(p.next=null,d===null?Ff=v:d.next=v,v===null&&(Cl=d)):(d=p,(a!==0||(b&3)!==0)&&(qf=!0)),p=v}fn!==0&&fn!==5||iu(a),Vs!==0&&(Vs=0)}function O1(a,l){for(var d=a.suspendedLanes,p=a.pingedLanes,v=a.expirationTimes,b=a.pendingLanes&-62914561;0<b;){var E=31-he(b),M=1<<E,L=v[E];L===-1?((M&d)===0||(M&p)!==0)&&(v[E]=$o(M,l)):L<=l&&(a.expiredLanes|=M),b&=~M}if(l=_t,d=rt,d=ci(a,a===l?d:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),p=a.callbackNode,d===0||a===l&&(vt===2||vt===9)||a.cancelPendingCommit!==null)return p!==null&&p!==null&&jt(p),a.callbackNode=null,a.callbackPriority=0;if((d&3)===0||Bo(a,d)){if(l=d&-d,l===a.callbackPriority)return l;switch(p!==null&&jt(p),ag(d)){case 2:case 8:d=Wd;break;case 32:d=xc;break;case 268435456:d=kc;break;default:d=xc}return p=N1.bind(null,a),d=Pe(d,p),a.callbackPriority=l,a.callbackNode=d,l}return p!==null&&p!==null&&jt(p),a.callbackPriority=2,a.callbackNode=null,2}function N1(a,l){if(fn!==0&&fn!==5)return a.callbackNode=null,a.callbackPriority=0,null;var d=a.callbackNode;if(Uf()&&a.callbackNode!==d)return null;var p=rt;return p=ci(a,a===_t?p:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),p===0?null:(h1(a,p,l),O1(a,en()),a.callbackNode!=null&&a.callbackNode===d?N1.bind(null,a):null)}function D1(a,l){if(Uf())return null;h1(a,l,!0)}function QP(){dz(function(){(mt&6)!==0?Pe(Gd,JP):M1()})}function Wy(){if(Vs===0){var a=cl;a===0&&(a=at,at<<=1,(at&261888)===0&&(at=256)),Vs=a}return Vs}function I1(a){return a==null||typeof a=="symbol"||typeof a=="boolean"?null:typeof a=="function"?a:Jd(""+a)}function L1(a,l){var d=l.ownerDocument.createElement("input");return d.name=l.name,d.value=l.value,a.id&&d.setAttribute("form",a.id),l.parentNode.insertBefore(d,l),a=new FormData(a),d.parentNode.removeChild(d),a}function ez(a,l,d,p,v){if(l==="submit"&&d&&d.stateNode===v){var b=I1((v[tr]||null).action),E=p.submitter;E&&(l=(l=E[tr]||null)?I1(l.formAction):E.getAttribute("formAction"),l!==null&&(b=l,E=null));var M=new nf("action","action",null,p,v);a.push({event:M,listeners:[{instance:null,listener:function(){if(p.defaultPrevented){if(Vs!==0){var L=E?L1(v,E):new FormData(v);hy(d,{pending:!0,data:L,method:v.method,action:b},null,L)}}else typeof b=="function"&&(M.preventDefault(),L=E?L1(v,E):new FormData(v),hy(d,{pending:!0,data:L,method:v.method,action:b},b,L))},currentTarget:v}]})}}for(var Ky=0;Ky<Mg.length;Ky++){var Zy=Mg[Ky],tz=Zy.toLowerCase(),nz=Zy[0].toUpperCase()+Zy.slice(1);qr(tz,"on"+nz)}qr(fk,"onAnimationEnd"),qr(hk,"onAnimationIteration"),qr(pk,"onAnimationStart"),qr("dblclick","onDoubleClick"),qr("focusin","onFocus"),qr("focusout","onBlur"),qr(vP,"onTransitionRun"),qr(bP,"onTransitionStart"),qr(SP,"onTransitionCancel"),qr(mk,"onTransitionEnd"),Za("onMouseEnter",["mouseout","mouseover"]),Za("onMouseLeave",["mouseout","mouseover"]),Za("onPointerEnter",["pointerout","pointerover"]),Za("onPointerLeave",["pointerout","pointerover"]),Vo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Vo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Vo("onBeforeInput",["compositionend","keypress","textInput","paste"]),Vo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Vo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Vo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var su="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(" "),rz=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(su));function P1(a,l){l=(l&4)!==0;for(var d=0;d<a.length;d++){var p=a[d],v=p.event;p=p.listeners;e:{var b=void 0;if(l)for(var E=p.length-1;0<=E;E--){var M=p[E],L=M.instance,F=M.currentTarget;if(M=M.listener,L!==b&&v.isPropagationStopped())break e;b=M,v.currentTarget=F;try{b(v)}catch(J){of(J)}v.currentTarget=null,b=L}else for(E=0;E<p.length;E++){if(M=p[E],L=M.instance,F=M.currentTarget,M=M.listener,L!==b&&v.isPropagationStopped())break e;b=M,v.currentTarget=F;try{b(v)}catch(J){of(J)}v.currentTarget=null,b=L}}}}function tt(a,l){var d=l[lg];d===void 0&&(d=l[lg]=new Set);var p=a+"__bubble";d.has(p)||(z1(l,a,2,!1),d.add(p))}function Yy(a,l,d){var p=0;l&&(p|=4),z1(d,a,p,l)}var Gf="_reactListening"+Math.random().toString(36).slice(2);function Xy(a){if(!a[Gf]){a[Gf]=!0,Mx.forEach(function(d){d!=="selectionchange"&&(rz.has(d)||Yy(d,!1,a),Yy(d,!0,a))});var l=a.nodeType===9?a:a.ownerDocument;l===null||l[Gf]||(l[Gf]=!0,Yy("selectionchange",!1,l))}}function z1(a,l,d,p){switch(fE(l)){case 2:var v=Oz;break;case 8:v=Nz;break;default:v=fv}d=v.bind(null,l,d,a),v=void 0,!yg||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(v=!0),p?v!==void 0?a.addEventListener(l,d,{capture:!0,passive:v}):a.addEventListener(l,d,!0):v!==void 0?a.addEventListener(l,d,{passive:v}):a.addEventListener(l,d,!1)}function Jy(a,l,d,p,v){var b=p;if((l&1)===0&&(l&2)===0&&p!==null)e:for(;;){if(p===null)return;var E=p.tag;if(E===3||E===4){var M=p.stateNode.containerInfo;if(M===v)break;if(E===4)for(E=p.return;E!==null;){var L=E.tag;if((L===3||L===4)&&E.stateNode.containerInfo===v)return;E=E.return}for(;M!==null;){if(E=Ga(M),E===null)return;if(L=E.tag,L===5||L===6||L===26||L===27){p=b=E;continue e}M=M.parentNode}}p=p.return}Hx(function(){var F=b,J=mg(d),ee=[];e:{var G=gk.get(a);if(G!==void 0){var K=nf,Ee=a;switch(a){case"keypress":if(ef(d)===0)break e;case"keydown":case"keyup":K=Y2;break;case"focusin":Ee="focus",K=wg;break;case"focusout":Ee="blur",K=wg;break;case"beforeblur":case"afterblur":K=wg;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":K=qx;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":K=j2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":K=Q2;break;case fk:case hk:case pk:K=V2;break;case mk:K=tP;break;case"scroll":case"scrollend":K=P2;break;case"wheel":K=rP;break;case"copy":case"cut":case"paste":K=U2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":K=Wx;break;case"toggle":case"beforetoggle":K=sP}var je=(l&4)!==0,Ct=!je&&(a==="scroll"||a==="scrollend"),$=je?G!==null?G+"Capture":null:G;je=[];for(var j=F,U;j!==null;){var Q=j;if(U=Q.stateNode,Q=Q.tag,Q!==5&&Q!==26&&Q!==27||U===null||$===null||(Q=_c(j,$),Q!=null&&je.push(ou(j,Q,U))),Ct)break;j=j.return}0<je.length&&(G=new K(G,Ee,null,d,J),ee.push({event:G,listeners:je}))}}if((l&7)===0){e:{if(G=a==="mouseover"||a==="pointerover",K=a==="mouseout"||a==="pointerout",G&&d!==pg&&(Ee=d.relatedTarget||d.fromElement)&&(Ga(Ee)||Ee[qa]))break e;if((K||G)&&(G=J.window===J?J:(G=J.ownerDocument)?G.defaultView||G.parentWindow:window,K?(Ee=d.relatedTarget||d.toElement,K=F,Ee=Ee?Ga(Ee):null,Ee!==null&&(Ct=s(Ee),je=Ee.tag,Ee!==Ct||je!==5&&je!==27&&je!==6)&&(Ee=null)):(K=null,Ee=F),K!==Ee)){if(je=qx,Q="onMouseLeave",$="onMouseEnter",j="mouse",(a==="pointerout"||a==="pointerover")&&(je=Wx,Q="onPointerLeave",$="onPointerEnter",j="pointer"),Ct=K==null?G:Tc(K),U=Ee==null?G:Tc(Ee),G=new je(Q,j+"leave",K,d,J),G.target=Ct,G.relatedTarget=U,Q=null,Ga(J)===F&&(je=new je($,j+"enter",Ee,d,J),je.target=U,je.relatedTarget=Ct,Q=je),Ct=Q,K&&Ee)t:{for(je=iz,$=K,j=Ee,U=0,Q=$;Q;Q=je(Q))U++;Q=0;for(var Ne=j;Ne;Ne=je(Ne))Q++;for(;0<U-Q;)$=je($),U--;for(;0<Q-U;)j=je(j),Q--;for(;U--;){if($===j||j!==null&&$===j.alternate){je=$;break t}$=je($),j=je(j)}je=null}else je=null;K!==null&&j1(ee,G,K,je,!1),Ee!==null&&Ct!==null&&j1(ee,Ct,Ee,je,!0)}}e:{if(G=F?Tc(F):window,K=G.nodeName&&G.nodeName.toLowerCase(),K==="select"||K==="input"&&G.type==="file")var dt=tk;else if(Qx(G))if(nk)dt=mP;else{dt=hP;var Re=fP}else K=G.nodeName,!K||K.toLowerCase()!=="input"||G.type!=="checkbox"&&G.type!=="radio"?F&&hg(F.elementType)&&(dt=tk):dt=pP;if(dt&&(dt=dt(a,F))){ek(ee,dt,d,J);break e}Re&&Re(a,G,F),a==="focusout"&&F&&G.type==="number"&&F.memoizedProps.value!=null&&fg(G,"number",G.value)}switch(Re=F?Tc(F):window,a){case"focusin":(Qx(Re)||Re.contentEditable==="true")&&(tl=Re,_g=F,Lc=null);break;case"focusout":Lc=_g=tl=null;break;case"mousedown":Ag=!0;break;case"contextmenu":case"mouseup":case"dragend":Ag=!1,uk(ee,d,J);break;case"selectionchange":if(yP)break;case"keydown":case"keyup":uk(ee,d,J)}var Ye;if(kg)e:{switch(a){case"compositionstart":var it="onCompositionStart";break e;case"compositionend":it="onCompositionEnd";break e;case"compositionupdate":it="onCompositionUpdate";break e}it=void 0}else el?Xx(a,d)&&(it="onCompositionEnd"):a==="keydown"&&d.keyCode===229&&(it="onCompositionStart");it&&(Kx&&d.locale!=="ko"&&(el||it!=="onCompositionStart"?it==="onCompositionEnd"&&el&&(Ye=Ux()):(Es=J,vg="value"in Es?Es.value:Es.textContent,el=!0)),Re=Wf(F,it),0<Re.length&&(it=new Gx(it,a,null,d,J),ee.push({event:it,listeners:Re}),Ye?it.data=Ye:(Ye=Jx(d),Ye!==null&&(it.data=Ye)))),(Ye=aP?lP(a,d):cP(a,d))&&(it=Wf(F,"onBeforeInput"),0<it.length&&(Re=new Gx("onBeforeInput","beforeinput",null,d,J),ee.push({event:Re,listeners:it}),Re.data=Ye)),ez(ee,a,F,d,J)}P1(ee,l)})}function ou(a,l,d){return{instance:a,listener:l,currentTarget:d}}function Wf(a,l){for(var d=l+"Capture",p=[];a!==null;){var v=a,b=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||b===null||(v=_c(a,d),v!=null&&p.unshift(ou(a,v,b)),v=_c(a,l),v!=null&&p.push(ou(a,v,b))),a.tag===3)return p;a=a.return}return[]}function iz(a){if(a===null)return null;do a=a.return;while(a&&a.tag!==5&&a.tag!==27);return a||null}function j1(a,l,d,p,v){for(var b=l._reactName,E=[];d!==null&&d!==p;){var M=d,L=M.alternate,F=M.stateNode;if(M=M.tag,L!==null&&L===p)break;M!==5&&M!==26&&M!==27||F===null||(L=F,v?(F=_c(d,b),F!=null&&E.unshift(ou(d,F,L))):v||(F=_c(d,b),F!=null&&E.push(ou(d,F,L)))),d=d.return}E.length!==0&&a.push({event:l,listeners:E})}var sz=/\r\n?/g,oz=/\u0000|\uFFFD/g;function B1(a){return(typeof a=="string"?a:""+a).replace(sz,`
|
|
9
|
-
`).replace(oz,"")}function $1(a,l){return l=B1(l),B1(a)===l}function kt(a,l,d,p,v,b){switch(d){case"children":typeof p=="string"?l==="body"||l==="textarea"&&p===""||Xa(a,p):(typeof p=="number"||typeof p=="bigint")&&l!=="body"&&Xa(a,""+p);break;case"className":Yd(a,"class",p);break;case"tabIndex":Yd(a,"tabindex",p);break;case"dir":case"role":case"viewBox":case"width":case"height":Yd(a,d,p);break;case"style":$x(a,p,b);break;case"data":if(l!=="object"){Yd(a,"data",p);break}case"src":case"href":if(p===""&&(l!=="a"||d!=="href")){a.removeAttribute(d);break}if(p==null||typeof p=="function"||typeof p=="symbol"||typeof p=="boolean"){a.removeAttribute(d);break}p=Jd(""+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 b=="function"&&(d==="formAction"?(l!=="input"&&kt(a,l,"name",v.name,v,null),kt(a,l,"formEncType",v.formEncType,v,null),kt(a,l,"formMethod",v.formMethod,v,null),kt(a,l,"formTarget",v.formTarget,v,null)):(kt(a,l,"encType",v.encType,v,null),kt(a,l,"method",v.method,v,null),kt(a,l,"target",v.target,v,null)));if(p==null||typeof p=="symbol"||typeof p=="boolean"){a.removeAttribute(d);break}p=Jd(""+p),a.setAttribute(d,p);break;case"onClick":p!=null&&(a.onclick=Ri);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=Jd(""+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),Zd(a,"popover",p);break;case"xlinkActuate":Ai(a,"http://www.w3.org/1999/xlink","xlink:actuate",p);break;case"xlinkArcrole":Ai(a,"http://www.w3.org/1999/xlink","xlink:arcrole",p);break;case"xlinkRole":Ai(a,"http://www.w3.org/1999/xlink","xlink:role",p);break;case"xlinkShow":Ai(a,"http://www.w3.org/1999/xlink","xlink:show",p);break;case"xlinkTitle":Ai(a,"http://www.w3.org/1999/xlink","xlink:title",p);break;case"xlinkType":Ai(a,"http://www.w3.org/1999/xlink","xlink:type",p);break;case"xmlBase":Ai(a,"http://www.w3.org/XML/1998/namespace","xml:base",p);break;case"xmlLang":Ai(a,"http://www.w3.org/XML/1998/namespace","xml:lang",p);break;case"xmlSpace":Ai(a,"http://www.w3.org/XML/1998/namespace","xml:space",p);break;case"is":Zd(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=I2.get(d)||d,Zd(a,d,p))}}function Qy(a,l,d,p,v,b){switch(d){case"style":$x(a,p,b);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"?Xa(a,p):(typeof p=="number"||typeof p=="bigint")&&Xa(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=Ri);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ox.hasOwnProperty(d))e:{if(d[0]==="o"&&d[1]==="n"&&(v=d.endsWith("Capture"),l=d.slice(2,v?d.length-7:void 0),b=a[tr]||null,b=b!=null?b[d]:null,typeof b=="function"&&a.removeEventListener(l,b,v),typeof p=="function")){typeof b!="function"&&b!==null&&(d in a?a[d]=null:a.hasAttribute(d)&&a.removeAttribute(d)),a.addEventListener(l,p,v);break e}d in a?a[d]=p:p===!0?a.setAttribute(d,""):Zd(a,d,p)}}}function _n(a,l,d){switch(l){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,b;for(b in d)if(d.hasOwnProperty(b)){var E=d[b];if(E!=null)switch(b){case"src":p=!0;break;case"srcSet":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:kt(a,l,b,E,d,null)}}v&&kt(a,l,"srcSet",d.srcSet,d,null),p&&kt(a,l,"src",d.src,d,null);return;case"input":tt("invalid",a);var M=b=E=v=null,L=null,F=null;for(p in d)if(d.hasOwnProperty(p)){var J=d[p];if(J!=null)switch(p){case"name":v=J;break;case"type":E=J;break;case"checked":L=J;break;case"defaultChecked":F=J;break;case"value":b=J;break;case"defaultValue":M=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(r(137,l));break;default:kt(a,l,p,J,d,null)}}Px(a,b,M,L,F,E,v,!1);return;case"select":tt("invalid",a),p=E=b=null;for(v in d)if(d.hasOwnProperty(v)&&(M=d[v],M!=null))switch(v){case"value":b=M;break;case"defaultValue":E=M;break;case"multiple":p=M;default:kt(a,l,v,M,d,null)}l=b,d=E,a.multiple=!!p,l!=null?Ya(a,!!p,l,!1):d!=null&&Ya(a,!!p,d,!0);return;case"textarea":tt("invalid",a),b=v=p=null;for(E in d)if(d.hasOwnProperty(E)&&(M=d[E],M!=null))switch(E){case"value":p=M;break;case"defaultValue":v=M;break;case"children":b=M;break;case"dangerouslySetInnerHTML":if(M!=null)throw Error(r(91));break;default:kt(a,l,E,M,d,null)}jx(a,p,v,b);return;case"option":for(L in d)d.hasOwnProperty(L)&&(p=d[L],p!=null)&&(L==="selected"?a.selected=p&&typeof p!="function"&&typeof p!="symbol":kt(a,l,L,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<su.length;p++)tt(su[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(F in d)if(d.hasOwnProperty(F)&&(p=d[F],p!=null))switch(F){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:kt(a,l,F,p,d,null)}return;default:if(hg(l)){for(J in d)d.hasOwnProperty(J)&&(p=d[J],p!==void 0&&Qy(a,l,J,p,d,void 0));return}}for(M in d)d.hasOwnProperty(M)&&(p=d[M],p!=null&&kt(a,l,M,p,d,null))}function az(a,l,d,p){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var v=null,b=null,E=null,M=null,L=null,F=null,J=null;for(K in d){var ee=d[K];if(d.hasOwnProperty(K)&&ee!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":L=ee;default:p.hasOwnProperty(K)||kt(a,l,K,null,p,ee)}}for(var G in p){var K=p[G];if(ee=d[G],p.hasOwnProperty(G)&&(K!=null||ee!=null))switch(G){case"type":b=K;break;case"name":v=K;break;case"checked":F=K;break;case"defaultChecked":J=K;break;case"value":E=K;break;case"defaultValue":M=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(137,l));break;default:K!==ee&&kt(a,l,G,K,p,ee)}}dg(a,E,M,L,F,J,b,v);return;case"select":K=E=M=G=null;for(b in d)if(L=d[b],d.hasOwnProperty(b)&&L!=null)switch(b){case"value":break;case"multiple":K=L;default:p.hasOwnProperty(b)||kt(a,l,b,null,p,L)}for(v in p)if(b=p[v],L=d[v],p.hasOwnProperty(v)&&(b!=null||L!=null))switch(v){case"value":G=b;break;case"defaultValue":M=b;break;case"multiple":E=b;default:b!==L&&kt(a,l,v,b,p,L)}l=M,d=E,p=K,G!=null?Ya(a,!!d,G,!1):!!p!=!!d&&(l!=null?Ya(a,!!d,l,!0):Ya(a,!!d,d?[]:"",!1));return;case"textarea":K=G=null;for(M in d)if(v=d[M],d.hasOwnProperty(M)&&v!=null&&!p.hasOwnProperty(M))switch(M){case"value":break;case"children":break;default:kt(a,l,M,null,p,v)}for(E in p)if(v=p[E],b=d[E],p.hasOwnProperty(E)&&(v!=null||b!=null))switch(E){case"value":G=v;break;case"defaultValue":K=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(r(91));break;default:v!==b&&kt(a,l,E,v,p,b)}zx(a,G,K);return;case"option":for(var Ee in d)G=d[Ee],d.hasOwnProperty(Ee)&&G!=null&&!p.hasOwnProperty(Ee)&&(Ee==="selected"?a.selected=!1:kt(a,l,Ee,null,p,G));for(L in p)G=p[L],K=d[L],p.hasOwnProperty(L)&&G!==K&&(G!=null||K!=null)&&(L==="selected"?a.selected=G&&typeof G!="function"&&typeof G!="symbol":kt(a,l,L,G,p,K));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 je in d)G=d[je],d.hasOwnProperty(je)&&G!=null&&!p.hasOwnProperty(je)&&kt(a,l,je,null,p,G);for(F in p)if(G=p[F],K=d[F],p.hasOwnProperty(F)&&G!==K&&(G!=null||K!=null))switch(F){case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(r(137,l));break;default:kt(a,l,F,G,p,K)}return;default:if(hg(l)){for(var Ct in d)G=d[Ct],d.hasOwnProperty(Ct)&&G!==void 0&&!p.hasOwnProperty(Ct)&&Qy(a,l,Ct,void 0,p,G);for(J in p)G=p[J],K=d[J],!p.hasOwnProperty(J)||G===K||G===void 0&&K===void 0||Qy(a,l,J,G,p,K);return}}for(var $ in d)G=d[$],d.hasOwnProperty($)&&G!=null&&!p.hasOwnProperty($)&&kt(a,l,$,null,p,G);for(ee in p)G=p[ee],K=d[ee],!p.hasOwnProperty(ee)||G===K||G==null&&K==null||kt(a,l,ee,G,p,K)}function V1(a){switch(a){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function lz(){if(typeof performance.getEntriesByType=="function"){for(var a=0,l=0,d=performance.getEntriesByType("resource"),p=0;p<d.length;p++){var v=d[p],b=v.transferSize,E=v.initiatorType,M=v.duration;if(b&&M&&V1(E)){for(E=0,M=v.responseEnd,p+=1;p<d.length;p++){var L=d[p],F=L.startTime;if(F>M)break;var J=L.transferSize,ee=L.initiatorType;J&&V1(ee)&&(L=L.responseEnd,E+=J*(L<M?1:(M-F)/(L-F)))}if(--p,l+=8*(b+E)/(v.duration/1e3),a++,10<a)break}}if(0<a)return l/a/1e6}return navigator.connection&&(a=navigator.connection.downlink,typeof a=="number")?a:5}var ev=null,tv=null;function Kf(a){return a.nodeType===9?a:a.ownerDocument}function H1(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 U1(a,l){if(a===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return a===1&&l==="foreignObject"?0:a}function nv(a,l){return a==="textarea"||a==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var rv=null;function cz(){var a=window.event;return a&&a.type==="popstate"?a===rv?!1:(rv=a,!0):(rv=null,!1)}var F1=typeof setTimeout=="function"?setTimeout:void 0,uz=typeof clearTimeout=="function"?clearTimeout:void 0,q1=typeof Promise=="function"?Promise:void 0,dz=typeof queueMicrotask=="function"?queueMicrotask:typeof q1<"u"?function(a){return q1.resolve(null).then(a).catch(fz)}:F1;function fz(a){setTimeout(function(){throw a})}function Hs(a){return a==="head"}function G1(a,l){var d=l,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),Al(l);return}p--}else if(d==="$"||d==="$?"||d==="$~"||d==="$!"||d==="&")p++;else if(d==="html")au(a.ownerDocument.documentElement);else if(d==="head"){d=a.ownerDocument.head,au(d);for(var b=d.firstChild;b;){var E=b.nextSibling,M=b.nodeName;b[Ec]||M==="SCRIPT"||M==="STYLE"||M==="LINK"&&b.rel.toLowerCase()==="stylesheet"||d.removeChild(b),b=E}}else d==="body"&&au(a.ownerDocument.body);d=v}while(d);Al(l)}function W1(a,l){var d=a;a=0;do{var p=d.nextSibling;if(d.nodeType===1?l?(d._stashedDisplay=d.style.display,d.style.display="none"):(d.style.display=d._stashedDisplay||"",d.getAttribute("style")===""&&d.removeAttribute("style")):d.nodeType===3&&(l?(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 iv(a){var l=a.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var d=l;switch(l=l.nextSibling,d.nodeName){case"HTML":case"HEAD":case"BODY":iv(d),cg(d);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(d.rel.toLowerCase()==="stylesheet")continue}a.removeChild(d)}}function hz(a,l,d,p){for(;a.nodeType===1;){var v=d;if(a.nodeName.toLowerCase()!==l.toLowerCase()){if(!p&&(a.nodeName!=="INPUT"||a.type!=="hidden"))break}else if(p){if(!a[Ec])switch(l){case"meta":if(!a.hasAttribute("itemprop"))break;return a;case"link":if(b=a.getAttribute("rel"),b==="stylesheet"&&a.hasAttribute("data-precedence"))break;if(b!==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(b=a.getAttribute("src"),(b!==(v.src==null?null:v.src)||a.getAttribute("type")!==(v.type==null?null:v.type)||a.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&b&&a.hasAttribute("async")&&!a.hasAttribute("itemprop"))break;return a;default:return a}}else if(l==="input"&&a.type==="hidden"){var b=v.name==null?null:""+v.name;if(v.type==="hidden"&&a.getAttribute("name")===b)return a}else return a;if(a=Ir(a.nextSibling),a===null)break}return null}function pz(a,l,d){if(l==="")return null;for(;a.nodeType!==3;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!d||(a=Ir(a.nextSibling),a===null))return null;return a}function K1(a,l){for(;a.nodeType!==8;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!l||(a=Ir(a.nextSibling),a===null))return null;return a}function sv(a){return a.data==="$?"||a.data==="$~"}function ov(a){return a.data==="$!"||a.data==="$?"&&a.ownerDocument.readyState!=="loading"}function mz(a,l){var d=a.ownerDocument;if(a.data==="$~")a._reactRetry=l;else if(a.data!=="$?"||d.readyState!=="loading")l();else{var p=function(){l(),d.removeEventListener("DOMContentLoaded",p)};d.addEventListener("DOMContentLoaded",p),a._reactRetry=p}}function Ir(a){for(;a!=null;a=a.nextSibling){var l=a.nodeType;if(l===1||l===3)break;if(l===8){if(l=a.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return a}var av=null;function Z1(a){a=a.nextSibling;for(var l=0;a;){if(a.nodeType===8){var d=a.data;if(d==="/$"||d==="/&"){if(l===0)return Ir(a.nextSibling);l--}else d!=="$"&&d!=="$!"&&d!=="$?"&&d!=="$~"&&d!=="&"||l++}a=a.nextSibling}return null}function Y1(a){a=a.previousSibling;for(var l=0;a;){if(a.nodeType===8){var d=a.data;if(d==="$"||d==="$!"||d==="$?"||d==="$~"||d==="&"){if(l===0)return a;l--}else d!=="/$"&&d!=="/&"||l++}a=a.previousSibling}return null}function X1(a,l,d){switch(l=Kf(d),a){case"html":if(a=l.documentElement,!a)throw Error(r(452));return a;case"head":if(a=l.head,!a)throw Error(r(453));return a;case"body":if(a=l.body,!a)throw Error(r(454));return a;default:throw Error(r(451))}}function au(a){for(var l=a.attributes;l.length;)a.removeAttributeNode(l[0]);cg(a)}var Lr=new Map,J1=new Set;function Zf(a){return typeof a.getRootNode=="function"?a.getRootNode():a.nodeType===9?a:a.ownerDocument}var qi=Y.d;Y.d={f:gz,r:yz,D:vz,C:bz,L:Sz,m:wz,X:kz,S:xz,M:Cz};function gz(){var a=qi.f(),l=$f();return a||l}function yz(a){var l=Wa(a);l!==null&&l.tag===5&&l.type==="form"?mC(l):qi.r(a)}var El=typeof document>"u"?null:document;function Q1(a,l,d){var p=El;if(p&&typeof l=="string"&&l){var v=_r(l);v='link[rel="'+a+'"][href="'+v+'"]',typeof d=="string"&&(v+='[crossorigin="'+d+'"]'),J1.has(v)||(J1.add(v),a={rel:a,crossOrigin:d,href:l},p.querySelector(v)===null&&(l=p.createElement("link"),_n(l,"link",a),hn(l),p.head.appendChild(l)))}}function vz(a){qi.D(a),Q1("dns-prefetch",a,null)}function bz(a,l){qi.C(a,l),Q1("preconnect",a,l)}function Sz(a,l,d){qi.L(a,l,d);var p=El;if(p&&a&&l){var v='link[rel="preload"][as="'+_r(l)+'"]';l==="image"&&d&&d.imageSrcSet?(v+='[imagesrcset="'+_r(d.imageSrcSet)+'"]',typeof d.imageSizes=="string"&&(v+='[imagesizes="'+_r(d.imageSizes)+'"]')):v+='[href="'+_r(a)+'"]';var b=v;switch(l){case"style":b=Tl(a);break;case"script":b=_l(a)}Lr.has(b)||(a=m({rel:"preload",href:l==="image"&&d&&d.imageSrcSet?void 0:a,as:l},d),Lr.set(b,a),p.querySelector(v)!==null||l==="style"&&p.querySelector(lu(b))||l==="script"&&p.querySelector(cu(b))||(l=p.createElement("link"),_n(l,"link",a),hn(l),p.head.appendChild(l)))}}function wz(a,l){qi.m(a,l);var d=El;if(d&&a){var p=l&&typeof l.as=="string"?l.as:"script",v='link[rel="modulepreload"][as="'+_r(p)+'"][href="'+_r(a)+'"]',b=v;switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":b=_l(a)}if(!Lr.has(b)&&(a=m({rel:"modulepreload",href:a},l),Lr.set(b,a),d.querySelector(v)===null)){switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(d.querySelector(cu(b)))return}p=d.createElement("link"),_n(p,"link",a),hn(p),d.head.appendChild(p)}}}function xz(a,l,d){qi.S(a,l,d);var p=El;if(p&&a){var v=Ka(p).hoistableStyles,b=Tl(a);l=l||"default";var E=v.get(b);if(!E){var M={loading:0,preload:null};if(E=p.querySelector(lu(b)))M.loading=5;else{a=m({rel:"stylesheet",href:a,"data-precedence":l},d),(d=Lr.get(b))&&lv(a,d);var L=E=p.createElement("link");hn(L),_n(L,"link",a),L._p=new Promise(function(F,J){L.onload=F,L.onerror=J}),L.addEventListener("load",function(){M.loading|=1}),L.addEventListener("error",function(){M.loading|=2}),M.loading|=4,Yf(E,l,p)}E={type:"stylesheet",instance:E,count:1,state:M},v.set(b,E)}}}function kz(a,l){qi.X(a,l);var d=El;if(d&&a){var p=Ka(d).hoistableScripts,v=_l(a),b=p.get(v);b||(b=d.querySelector(cu(v)),b||(a=m({src:a,async:!0},l),(l=Lr.get(v))&&cv(a,l),b=d.createElement("script"),hn(b),_n(b,"link",a),d.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},p.set(v,b))}}function Cz(a,l){qi.M(a,l);var d=El;if(d&&a){var p=Ka(d).hoistableScripts,v=_l(a),b=p.get(v);b||(b=d.querySelector(cu(v)),b||(a=m({src:a,async:!0,type:"module"},l),(l=Lr.get(v))&&cv(a,l),b=d.createElement("script"),hn(b),_n(b,"link",a),d.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},p.set(v,b))}}function eE(a,l,d,p){var v=(v=Le.current)?Zf(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"?(l=Tl(d.href),d=Ka(v).hoistableStyles,p=d.get(l),p||(p={type:"style",instance:null,count:0,state:null},d.set(l,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=Tl(d.href);var b=Ka(v).hoistableStyles,E=b.get(a);if(E||(v=v.ownerDocument||v,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},b.set(a,E),(b=v.querySelector(lu(a)))&&!b._p&&(E.instance=b,E.state.loading=5),Lr.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},Lr.set(a,d),b||Ez(v,a,d,E.state))),l&&p===null)throw Error(r(528,""));return E}if(l&&p!==null)throw Error(r(529,""));return null;case"script":return l=d.async,d=d.src,typeof d=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=_l(d),d=Ka(v).hoistableScripts,p=d.get(l),p||(p={type:"script",instance:null,count:0,state:null},d.set(l,p)),p):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,a))}}function Tl(a){return'href="'+_r(a)+'"'}function lu(a){return'link[rel="stylesheet"]['+a+"]"}function tE(a){return m({},a,{"data-precedence":a.precedence,precedence:null})}function Ez(a,l,d,p){a.querySelector('link[rel="preload"][as="style"]['+l+"]")?p.loading=1:(l=a.createElement("link"),p.preload=l,l.addEventListener("load",function(){return p.loading|=1}),l.addEventListener("error",function(){return p.loading|=2}),_n(l,"link",d),hn(l),a.head.appendChild(l))}function _l(a){return'[src="'+_r(a)+'"]'}function cu(a){return"script[async]"+a}function nE(a,l,d){if(l.count++,l.instance===null)switch(l.type){case"style":var p=a.querySelector('style[data-href~="'+_r(d.href)+'"]');if(p)return l.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),_n(p,"style",v),Yf(p,d.precedence,a),l.instance=p;case"stylesheet":v=Tl(d.href);var b=a.querySelector(lu(v));if(b)return l.state.loading|=4,l.instance=b,hn(b),b;p=tE(d),(v=Lr.get(v))&&lv(p,v),b=(a.ownerDocument||a).createElement("link"),hn(b);var E=b;return E._p=new Promise(function(M,L){E.onload=M,E.onerror=L}),_n(b,"link",p),l.state.loading|=4,Yf(b,d.precedence,a),l.instance=b;case"script":return b=_l(d.src),(v=a.querySelector(cu(b)))?(l.instance=v,hn(v),v):(p=d,(v=Lr.get(b))&&(p=m({},d),cv(p,v)),a=a.ownerDocument||a,v=a.createElement("script"),hn(v),_n(v,"link",p),a.head.appendChild(v),l.instance=v);case"void":return null;default:throw Error(r(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(p=l.instance,l.state.loading|=4,Yf(p,d.precedence,a));return l.instance}function Yf(a,l,d){for(var p=d.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),v=p.length?p[p.length-1]:null,b=v,E=0;E<p.length;E++){var M=p[E];if(M.dataset.precedence===l)b=M;else if(b!==v)break}b?b.parentNode.insertBefore(a,b.nextSibling):(l=d.nodeType===9?d.head:d,l.insertBefore(a,l.firstChild))}function lv(a,l){a.crossOrigin==null&&(a.crossOrigin=l.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=l.referrerPolicy),a.title==null&&(a.title=l.title)}function cv(a,l){a.crossOrigin==null&&(a.crossOrigin=l.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=l.referrerPolicy),a.integrity==null&&(a.integrity=l.integrity)}var Xf=null;function rE(a,l,d){if(Xf===null){var p=new Map,v=Xf=new Map;v.set(d,p)}else v=Xf,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 b=d[v];if(!(b[Ec]||b[kn]||a==="link"&&b.getAttribute("rel")==="stylesheet")&&b.namespaceURI!=="http://www.w3.org/2000/svg"){var E=b.getAttribute(l)||"";E=a+E;var M=p.get(E);M?M.push(b):p.set(E,[b])}}return p}function iE(a,l,d){a=a.ownerDocument||a,a.head.insertBefore(d,l==="title"?a.querySelector("head > title"):null)}function Tz(a,l,d){if(d===1||l.itemProp!=null)return!1;switch(a){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;return l.rel==="stylesheet"?(a=l.disabled,typeof l.precedence=="string"&&a==null):!0;case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function sE(a){return!(a.type==="stylesheet"&&(a.state.loading&3)===0)}function _z(a,l,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=Tl(p.href),b=l.querySelector(lu(v));if(b){l=b._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(a.count++,a=Jf.bind(a),l.then(a,a)),d.state.loading|=4,d.instance=b,hn(b);return}b=l.ownerDocument||l,p=tE(p),(v=Lr.get(v))&&lv(p,v),b=b.createElement("link"),hn(b);var E=b;E._p=new Promise(function(M,L){E.onload=M,E.onerror=L}),_n(b,"link",p),d.instance=b}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(d,l),(l=d.state.preload)&&(d.state.loading&3)===0&&(a.count++,d=Jf.bind(a),l.addEventListener("load",d),l.addEventListener("error",d))}}var uv=0;function Az(a,l){return a.stylesheets&&a.count===0&&eh(a,a.stylesheets),0<a.count||0<a.imgCount?function(d){var p=setTimeout(function(){if(a.stylesheets&&eh(a,a.stylesheets),a.unsuspend){var b=a.unsuspend;a.unsuspend=null,b()}},6e4+l);0<a.imgBytes&&uv===0&&(uv=62500*lz());var v=setTimeout(function(){if(a.waitingForImages=!1,a.count===0&&(a.stylesheets&&eh(a,a.stylesheets),a.unsuspend)){var b=a.unsuspend;a.unsuspend=null,b()}},(a.imgBytes>uv?50:800)+l);return a.unsuspend=d,function(){a.unsuspend=null,clearTimeout(p),clearTimeout(v)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)eh(this,this.stylesheets);else if(this.unsuspend){var a=this.unsuspend;this.unsuspend=null,a()}}}var Qf=null;function eh(a,l){a.stylesheets=null,a.unsuspend!==null&&(a.count++,Qf=new Map,l.forEach(Rz,a),Qf=null,Jf.call(a))}function Rz(a,l){if(!(l.state.loading&4)){var d=Qf.get(a);if(d)var p=d.get(null);else{d=new Map,Qf.set(a,d);for(var v=a.querySelectorAll("link[data-precedence],style[data-precedence]"),b=0;b<v.length;b++){var E=v[b];(E.nodeName==="LINK"||E.getAttribute("media")!=="not all")&&(d.set(E.dataset.precedence,E),p=E)}p&&d.set(null,p)}v=l.instance,E=v.getAttribute("data-precedence"),b=d.get(E)||p,b===p&&d.set(null,v),d.set(E,v),this.count++,p=Jf.bind(this),v.addEventListener("load",p),v.addEventListener("error",p),b?b.parentNode.insertBefore(v,b.nextSibling):(a=a.nodeType===9?a.head:a,a.insertBefore(v,a.firstChild)),l.state.loading|=4}}var uu={$$typeof:A,Provider:null,Consumer:null,_currentValue:oe,_currentValue2:oe,_threadCount:0};function Mz(a,l,d,p,v,b,E,M,L){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=Fa(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Fa(0),this.hiddenUpdates=Fa(null),this.identifierPrefix=p,this.onUncaughtError=v,this.onCaughtError=b,this.onRecoverableError=E,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=L,this.incompleteTransitions=new Map}function oE(a,l,d,p,v,b,E,M,L,F,J,ee){return a=new Mz(a,l,d,E,L,F,J,ee,M),l=1,b===!0&&(l|=24),b=fr(3,null,null,l),a.current=b,b.stateNode=a,l=Ug(),l.refCount++,a.pooledCache=l,l.refCount++,b.memoizedState={element:p,isDehydrated:d,cache:l},Wg(b),a}function aE(a){return a?(a=il,a):il}function lE(a,l,d,p,v,b){v=aE(v),p.context===null?p.context=v:p.pendingContext=v,p=Os(l),p.payload={element:d},b=b===void 0?null:b,b!==null&&(p.callback=b),d=Ns(a,p,l),d!==null&&(ar(d,a,l),Hc(d,a,l))}function cE(a,l){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var d=a.retryLane;a.retryLane=d!==0&&d<l?d:l}}function dv(a,l){cE(a,l),(a=a.alternate)&&cE(a,l)}function uE(a){if(a.tag===13||a.tag===31){var l=qo(a,67108864);l!==null&&ar(l,a,67108864),dv(a,67108864)}}function dE(a){if(a.tag===13||a.tag===31){var l=yr();l=og(l);var d=qo(a,l);d!==null&&ar(d,a,l),dv(a,l)}}var th=!0;function Oz(a,l,d,p){var v=B.T;B.T=null;var b=Y.p;try{Y.p=2,fv(a,l,d,p)}finally{Y.p=b,B.T=v}}function Nz(a,l,d,p){var v=B.T;B.T=null;var b=Y.p;try{Y.p=8,fv(a,l,d,p)}finally{Y.p=b,B.T=v}}function fv(a,l,d,p){if(th){var v=hv(p);if(v===null)Jy(a,l,p,nh,d),hE(a,p);else if(Iz(v,a,l,d,p))p.stopPropagation();else if(hE(a,p),l&4&&-1<Dz.indexOf(a)){for(;v!==null;){var b=Wa(v);if(b!==null)switch(b.tag){case 3:if(b=b.stateNode,b.current.memoizedState.isDehydrated){var E=xn(b.pendingLanes);if(E!==0){var M=b;for(M.pendingLanes|=2,M.entangledLanes|=2;E;){var L=1<<31-he(E);M.entanglements[1]|=L,E&=~L}hi(b),(mt&6)===0&&(jf=en()+500,iu(0))}}break;case 31:case 13:M=qo(b,2),M!==null&&ar(M,b,2),$f(),dv(b,2)}if(b=hv(p),b===null&&Jy(a,l,p,nh,d),b===v)break;v=b}v!==null&&p.stopPropagation()}else Jy(a,l,p,null,d)}}function hv(a){return a=mg(a),pv(a)}var nh=null;function pv(a){if(nh=null,a=Ga(a),a!==null){var l=s(a);if(l===null)a=null;else{var d=l.tag;if(d===13){if(a=o(l),a!==null)return a;a=null}else if(d===31){if(a=c(l),a!==null)return a;a=null}else if(d===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;a=null}else l!==a&&(a=null)}}return nh=a,null}function fE(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(qd()){case Gd:return 2;case Wd:return 8;case xc:case kx:return 32;case kc:return 268435456;default:return 32}default:return 32}}var mv=!1,Us=null,Fs=null,qs=null,du=new Map,fu=new Map,Gs=[],Dz="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 hE(a,l){switch(a){case"focusin":case"focusout":Us=null;break;case"dragenter":case"dragleave":Fs=null;break;case"mouseover":case"mouseout":qs=null;break;case"pointerover":case"pointerout":du.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":fu.delete(l.pointerId)}}function hu(a,l,d,p,v,b){return a===null||a.nativeEvent!==b?(a={blockedOn:l,domEventName:d,eventSystemFlags:p,nativeEvent:b,targetContainers:[v]},l!==null&&(l=Wa(l),l!==null&&uE(l)),a):(a.eventSystemFlags|=p,l=a.targetContainers,v!==null&&l.indexOf(v)===-1&&l.push(v),a)}function Iz(a,l,d,p,v){switch(l){case"focusin":return Us=hu(Us,a,l,d,p,v),!0;case"dragenter":return Fs=hu(Fs,a,l,d,p,v),!0;case"mouseover":return qs=hu(qs,a,l,d,p,v),!0;case"pointerover":var b=v.pointerId;return du.set(b,hu(du.get(b)||null,a,l,d,p,v)),!0;case"gotpointercapture":return b=v.pointerId,fu.set(b,hu(fu.get(b)||null,a,l,d,p,v)),!0}return!1}function pE(a){var l=Ga(a.target);if(l!==null){var d=s(l);if(d!==null){if(l=d.tag,l===13){if(l=o(d),l!==null){a.blockedOn=l,Ax(a.priority,function(){dE(d)});return}}else if(l===31){if(l=c(d),l!==null){a.blockedOn=l,Ax(a.priority,function(){dE(d)});return}}else if(l===3&&d.stateNode.current.memoizedState.isDehydrated){a.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}a.blockedOn=null}function rh(a){if(a.blockedOn!==null)return!1;for(var l=a.targetContainers;0<l.length;){var d=hv(a.nativeEvent);if(d===null){d=a.nativeEvent;var p=new d.constructor(d.type,d);pg=p,d.target.dispatchEvent(p),pg=null}else return l=Wa(d),l!==null&&uE(l),a.blockedOn=d,!1;l.shift()}return!0}function mE(a,l,d){rh(a)&&d.delete(l)}function Lz(){mv=!1,Us!==null&&rh(Us)&&(Us=null),Fs!==null&&rh(Fs)&&(Fs=null),qs!==null&&rh(qs)&&(qs=null),du.forEach(mE),fu.forEach(mE)}function ih(a,l){a.blockedOn===l&&(a.blockedOn=null,mv||(mv=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Lz)))}var sh=null;function gE(a){sh!==a&&(sh=a,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){sh===a&&(sh=null);for(var l=0;l<a.length;l+=3){var d=a[l],p=a[l+1],v=a[l+2];if(typeof p!="function"){if(pv(p||d)===null)continue;break}var b=Wa(d);b!==null&&(a.splice(l,3),l-=3,hy(b,{pending:!0,data:v,method:d.method,action:p},p,v))}}))}function Al(a){function l(L){return ih(L,a)}Us!==null&&ih(Us,a),Fs!==null&&ih(Fs,a),qs!==null&&ih(qs,a),du.forEach(l),fu.forEach(l);for(var d=0;d<Gs.length;d++){var p=Gs[d];p.blockedOn===a&&(p.blockedOn=null)}for(;0<Gs.length&&(d=Gs[0],d.blockedOn===null);)pE(d),d.blockedOn===null&&Gs.shift();if(d=(a.ownerDocument||a).$$reactFormReplay,d!=null)for(p=0;p<d.length;p+=3){var v=d[p],b=d[p+1],E=v[tr]||null;if(typeof b=="function")E||gE(d);else if(E){var M=null;if(b&&b.hasAttribute("formAction")){if(v=b,E=b[tr]||null)M=E.formAction;else if(pv(v)!==null)continue}else M=E.action;typeof M=="function"?d[p+1]=M:(d.splice(p,3),p-=3),gE(d)}}}function yE(){function a(b){b.canIntercept&&b.info==="react-transition"&&b.intercept({handler:function(){return new Promise(function(E){return v=E})},focusReset:"manual",scroll:"manual"})}function l(){v!==null&&(v(),v=null),p||setTimeout(d,20)}function d(){if(!p&&!navigation.transition){var b=navigation.currentEntry;b&&b.url!=null&&navigation.navigate(b.url,{state:b.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var p=!1,v=null;return navigation.addEventListener("navigate",a),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(d,100),function(){p=!0,navigation.removeEventListener("navigate",a),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),v!==null&&(v(),v=null)}}}function gv(a){this._internalRoot=a}oh.prototype.render=gv.prototype.render=function(a){var l=this._internalRoot;if(l===null)throw Error(r(409));var d=l.current,p=yr();lE(d,p,a,l,null,null)},oh.prototype.unmount=gv.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var l=a.containerInfo;lE(a.current,2,null,a,null,null),$f(),l[qa]=null}};function oh(a){this._internalRoot=a}oh.prototype.unstable_scheduleHydration=function(a){if(a){var l=_x();a={blockedOn:null,target:a,priority:l};for(var d=0;d<Gs.length&&l!==0&&l<Gs[d].priority;d++);Gs.splice(d,0,a),d===0&&pE(a)}};var vE=e.version;if(vE!=="19.2.8")throw Error(r(527,vE,"19.2.8"));Y.findDOMNode=function(a){var l=a._reactInternals;if(l===void 0)throw typeof a.render=="function"?Error(r(188)):(a=Object.keys(a).join(","),Error(r(268,a)));return a=f(l),a=a!==null?h(a):null,a=a===null?null:a.stateNode,a};var Pz={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ah=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ah.isDisabled&&ah.supportsFiber)try{H=ah.inject(Pz),re=ah}catch{}}return mu.createRoot=function(a,l){if(!i(a))throw Error(r(299));var d=!1,p="",v=EC,b=TC,E=_C;return l!=null&&(l.unstable_strictMode===!0&&(d=!0),l.identifierPrefix!==void 0&&(p=l.identifierPrefix),l.onUncaughtError!==void 0&&(v=l.onUncaughtError),l.onCaughtError!==void 0&&(b=l.onCaughtError),l.onRecoverableError!==void 0&&(E=l.onRecoverableError)),l=oE(a,1,!1,null,null,d,p,null,v,b,E,yE),a[qa]=l.current,Xy(a),new gv(l)},mu.hydrateRoot=function(a,l,d){if(!i(a))throw Error(r(299));var p=!1,v="",b=EC,E=TC,M=_C,L=null;return d!=null&&(d.unstable_strictMode===!0&&(p=!0),d.identifierPrefix!==void 0&&(v=d.identifierPrefix),d.onUncaughtError!==void 0&&(b=d.onUncaughtError),d.onCaughtError!==void 0&&(E=d.onCaughtError),d.onRecoverableError!==void 0&&(M=d.onRecoverableError),d.formState!==void 0&&(L=d.formState)),l=oE(a,1,!0,l,d??null,p,v,L,b,E,M,yE),l.context=aE(null),d=l.current,p=yr(),p=og(p),v=Os(p),v.callback=null,Ns(d,v,p),d=p,l.current.lanes=d,Cc(l,d),hi(l),a[qa]=l.current,Xy(a),new oh(l)},mu.version="19.2.8",mu}var OE;function Gz(){if(OE)return Sv.exports;OE=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(),Sv.exports=qz(),Sv.exports}var Wz=Gz();const Kz=()=>{};var NE={};const jR=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},Zz=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++],c=t[n++],u=((i&7)<<18|(s&63)<<12|(o&63)<<6|c&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("")},BR={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,c=o?t[i+1]:0,u=i+2<t.length,f=u?t[i+2]:0,h=s>>2,m=(s&3)<<4|c>>4;let g=(c&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(jR(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):Zz(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++)],c=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||c==null||f==null||m==null)throw new Yz;const g=s<<2|c>>4;if(r.push(g),f!==64){const y=c<<4&240|f>>2;if(r.push(y),m!==64){const S=f<<6&192|m;r.push(S)}}}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 Yz extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const Xz=function(t){const e=jR(t);return BR.encodeByteArray(e,!0)},$R=function(t){return Xz(t).replace(/\./g,"")},VR=function(t){try{return BR.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Jz(){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 Qz=()=>Jz().__FIREBASE_DEFAULTS__,ej=()=>{if(typeof process>"u"||typeof NE>"u")return;const t=NE.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},tj=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=t&&VR(t[1]);return e&&JSON.parse(e)},SS=()=>{try{return Kz()||Qz()||ej()||tj()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},nj=t=>SS()?.emulatorHosts?.[t],HR=()=>SS()?.config,UR=t=>SS()?.[`_${t}`];class FR{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 Yn(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function rj(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Yn())}function ij(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function sj(){const t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function oj(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function aj(){const t=Yn();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function lj(){try{return typeof indexedDB=="object"}catch{return!1}}function cj(){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 uj="FirebaseError";class No extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=uj,Object.setPrototypeOf(this,No.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Ed.prototype.create)}}class Ed{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?dj(s,r):"Error",c=`${this.serviceName}: ${o} (${i}).`;return new No(i,c,r)}}function dj(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),c=e[o];r+=t.substring(n,i)+(c!=null?String(c):`<${o}?>`),n=s+1}return r}catch{return t}}function fj(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function Zl(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(DE(s)&&DE(o)){if(!Zl(s,o))return!1}else if(s!==o)return!1}for(const i of r)if(!n.includes(i))return!1;return!0}function DE(t){return t!==null&&typeof t=="object"}function Td(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 _u(t){const e={};return t.replace(/^\?/,"").split("&").forEach(r=>{if(r){const[i,s]=r.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Au(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}function hj(t,e){const n=new pj(t,e);return n.subscribe.bind(n)}class pj{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.");mj(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:r},i.next===void 0&&(i.next=Cv),i.error===void 0&&(i.error=Cv),i.complete===void 0&&(i.complete=Cv);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 mj(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 Cv(){}function Ss(t){return t&&t._delegate?t._delegate:t}function wS(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function gj(t){return(await fetch(t,{credentials:"include"})).ok}class Yl{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 oa="[DEFAULT]";class yj{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 FR;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(bj(e))try{this.getOrInitializeService({instanceIdentifier:oa})}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=oa){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=oa){return this.instances.has(e)}getOptions(e=oa){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 c=this.normalizeInstanceIdentifier(s);r===c&&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:vj(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=oa){return this.component?this.component.multipleInstances?e:oa:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function vj(t){return t===oa?void 0:t}function bj(t){return t.instantiationMode==="EAGER"}class Sj{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 yj(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}var At;(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"})(At||(At={}));const wj={debug:At.DEBUG,verbose:At.VERBOSE,info:At.INFO,warn:At.WARN,error:At.ERROR,silent:At.SILENT},xj=At.INFO,kj={[At.DEBUG]:"log",[At.VERBOSE]:"log",[At.INFO]:"info",[At.WARN]:"warn",[At.ERROR]:"error"},Cj=(t,e,...n)=>{if(e<t.logLevel)return;const r=new Date().toISOString(),i=kj[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 qR{constructor(e){this.name=e,this._logLevel=xj,this._logHandler=Cj,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in At))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?wj[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,At.DEBUG,...e),this._logHandler(this,At.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,At.VERBOSE,...e),this._logHandler(this,At.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,At.INFO,...e),this._logHandler(this,At.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,At.WARN,...e),this._logHandler(this,At.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,At.ERROR,...e),this._logHandler(this,At.ERROR,...e)}}const Ej=(t,e)=>e.some(n=>t instanceof n);let IE,LE;function Tj(){return IE||(IE=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function _j(){return LE||(LE=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const GR=new WeakMap,Pb=new WeakMap,WR=new WeakMap,Ev=new WeakMap,xS=new WeakMap;function Aj(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(po(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&GR.set(n,t)}).catch(()=>{}),xS.set(e,t),e}function Rj(t){if(Pb.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)});Pb.set(t,e)}let zb={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return Pb.get(t);if(e==="objectStoreNames")return t.objectStoreNames||WR.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return po(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 Mj(t){zb=t(zb)}function Oj(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){const r=t.call(Tv(this),e,...n);return WR.set(r,e.sort?e.sort():[e]),po(r)}:_j().includes(t)?function(...e){return t.apply(Tv(this),e),po(GR.get(this))}:function(...e){return po(t.apply(Tv(this),e))}}function Nj(t){return typeof t=="function"?Oj(t):(t instanceof IDBTransaction&&Rj(t),Ej(t,Tj())?new Proxy(t,zb):t)}function po(t){if(t instanceof IDBRequest)return Aj(t);if(Ev.has(t))return Ev.get(t);const e=Nj(t);return e!==t&&(Ev.set(t,e),xS.set(e,t)),e}const Tv=t=>xS.get(t);function Dj(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),c=po(o);return r&&o.addEventListener("upgradeneeded",u=>{r(po(o.result),u.oldVersion,u.newVersion,po(o.transaction),u)}),n&&o.addEventListener("blocked",u=>n(u.oldVersion,u.newVersion,u)),c.then(u=>{s&&u.addEventListener("close",()=>s()),i&&u.addEventListener("versionchange",f=>i(f.oldVersion,f.newVersion,f))}).catch(()=>{}),c}const Ij=["get","getKey","getAll","getAllKeys","count"],Lj=["put","add","delete","clear"],_v=new Map;function PE(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(_v.get(e))return _v.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=Lj.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||Ij.includes(n)))return;const s=async function(o,...c){const u=this.transaction(o,i?"readwrite":"readonly");let f=u.store;return r&&(f=f.index(c.shift())),(await Promise.all([f[n](...c),i&&u.done]))[0]};return _v.set(e,s),s}Mj(t=>({...t,get:(e,n,r)=>PE(e,n)||t.get(e,n,r),has:(e,n)=>!!PE(e,n)||t.has(e,n)}));class Pj{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(zj(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function zj(t){return t.getComponent()?.type==="VERSION"}const jb="@firebase/app",zE="0.16.0";const ms=new qR("@firebase/app"),jj="@firebase/app-compat",Bj="@firebase/analytics-compat",$j="@firebase/analytics",Vj="@firebase/app-check-compat",Hj="@firebase/app-check",Uj="@firebase/auth",Fj="@firebase/auth-compat",qj="@firebase/database",Gj="@firebase/data-connect",Wj="@firebase/database-compat",Kj="@firebase/functions",Zj="@firebase/functions-compat",Yj="@firebase/installations",Xj="@firebase/installations-compat",Jj="@firebase/messaging",Qj="@firebase/messaging-compat",eB="@firebase/performance",tB="@firebase/performance-compat",nB="@firebase/remote-config",rB="@firebase/remote-config-compat",iB="@firebase/storage",sB="@firebase/storage-compat",oB="@firebase/firestore",aB="@firebase/ai",lB="@firebase/firestore-compat",cB="firebase",uB="12.17.0";const Bb="[DEFAULT]",dB={[jb]:"fire-core",[jj]:"fire-core-compat",[$j]:"fire-analytics",[Bj]:"fire-analytics-compat",[Hj]:"fire-app-check",[Vj]:"fire-app-check-compat",[Uj]:"fire-auth",[Fj]:"fire-auth-compat",[qj]:"fire-rtdb",[Gj]:"fire-data-connect",[Wj]:"fire-rtdb-compat",[Kj]:"fire-fn",[Zj]:"fire-fn-compat",[Yj]:"fire-iid",[Xj]:"fire-iid-compat",[Jj]:"fire-fcm",[Qj]:"fire-fcm-compat",[eB]:"fire-perf",[tB]:"fire-perf-compat",[nB]:"fire-rc",[rB]:"fire-rc-compat",[iB]:"fire-gcs",[sB]:"fire-gcs-compat",[oB]:"fire-fst",[lB]:"fire-fst-compat",[aB]:"fire-vertex","fire-js":"fire-js",[cB]:"fire-js-all"};const td=new Map,fB=new Map,$b=new Map;function jE(t,e){try{t.container.addComponent(e)}catch(n){ms.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function nd(t){const e=t.name;if($b.has(e))return ms.debug(`There were multiple attempts to register component ${e}.`),!1;$b.set(e,t);for(const n of td.values())jE(n,t);for(const n of fB.values())jE(n,t);return!0}function KR(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function Qr(t){return t==null?!1:t.settings!==void 0}const hB={"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."},ns=new Ed("app","Firebase",hB);class pB{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 Yl("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 ns.create("app-deleted",{appName:this._name})}}const _d=uB;function ZR(t,e={}){let n=t;typeof e!="object"&&(e={name:e});const r={name:Bb,automaticDataCollectionEnabled:!0,...e},i=r.name;if(typeof i!="string"||!i)throw ns.create("bad-app-name",{appName:String(i)});if(n||(n=HR()),!n)throw ns.create("no-options");const s=td.get(i);if(s)if(Zl(n,s.options)){if(Zl(r,s.config))return s;throw ns.create("duplicate-app",{appName:i,mismatchedParam:"config",oldValue:JSON.stringify(s.config),newValue:JSON.stringify(r)})}else throw ns.create("duplicate-app",{appName:i,mismatchedParam:"options",oldValue:JSON.stringify(s.options),newValue:JSON.stringify(n)});const o=new Sj(i);for(const u of $b.values())o.addComponent(u);const c=new pB(n,r,o);return td.set(i,c),c}function YR(t=Bb){const e=td.get(t);if(!e&&t===Bb&&HR())return ZR();if(!e)throw ns.create("no-app",{appName:t});return e}function mB(){return Array.from(td.values())}function Vl(t,e,n){let r=dB[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 "/")`),ms.warn(o.join(" "));return}nd(new Yl(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}const gB="firebase-heartbeat-database",yB=1,rd="firebase-heartbeat-store";let Av=null;function XR(){return Av||(Av=Dj(gB,yB,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(rd)}catch(n){console.warn(n)}}}}).catch(t=>{throw ns.create("idb-open",{originalErrorMessage:t.message})})),Av}async function vB(t){try{const n=(await XR()).transaction(rd),r=await n.objectStore(rd).get(JR(t));return await n.done,r}catch(e){if(e instanceof No)ms.warn(e.message);else{const n=ns.create("idb-get",{originalErrorMessage:e?.message});ms.warn(n.message)}}}async function BE(t,e){try{const r=(await XR()).transaction(rd,"readwrite");await r.objectStore(rd).put(e,JR(t)),await r.done}catch(n){if(n instanceof No)ms.warn(n.message);else{const r=ns.create("idb-set",{originalErrorMessage:n?.message});ms.warn(r.message)}}}function JR(t){return`${t.name}!${t.options.appId}`}const bB=1024,SB=30;class wB{constructor(e){this.container=e,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new kB(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=$E();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>SB){const i=CB(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){ms.warn(e)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";const e=$E(),{heartbeatsToSend:n,unsentEntries:r}=xB(this._heartbeatsCache.heartbeats),i=$R(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 ms.warn(e),""}}}function $E(){return new Date().toISOString().substring(0,10)}function xB(t,e=bB){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),VE(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),VE(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class kB{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return lj()?cj().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await vB(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return BE(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 BE(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}}function VE(t){return $R(JSON.stringify({version:2,heartbeats:t})).length}function CB(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 EB(t){nd(new Yl("platform-logger",e=>new Pj(e),"PRIVATE")),nd(new Yl("heartbeat",e=>new wB(e),"PRIVATE")),Vl(jb,zE,t),Vl(jb,zE,"esm2020"),Vl("fire-js","")}EB("");var TB="firebase",_B="12.17.1";Vl(TB,_B,"app");function QR(){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 AB=QR,eM=new Ed("auth","Firebase",QR());const op=new qR("@firebase/auth");function tM(t,...e){op.logLevel<=At.WARN&&op.warn(`Auth (${_d}): ${t}`,...e)}function Uh(t,...e){op.logLevel<=At.ERROR&&op.error(`Auth (${_d}): ${t}`,...e)}function Ur(t,...e){throw CS(t,...e)}function ii(t,...e){return CS(t,...e)}function kS(t,e,n){const r={...AB(),[e]:n};return new Ed("auth","Firebase",r).create(e,{appName:t.name})}function mo(t){return kS(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&&Ur(t,"argument-error"),kS(t,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function CS(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 eM.create(t,...e)}function $e(t,e,...n){if(!t)throw CS(e,...n)}function rs(t){const e="INTERNAL ASSERTION FAILED: "+t;throw Uh(e),new Error(e)}function gs(t,e){t||rs(e)}function Vb(){return typeof self<"u"&&self.location?.href||""}function MB(){return HE()==="http:"||HE()==="https:"}function HE(){return typeof self<"u"&&self.location?.protocol||null}function OB(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(MB()||sj()||"connection"in navigator)?navigator.onLine:!0}function NB(){if(typeof navigator>"u")return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}class Ad{constructor(e,n){this.shortDelay=e,this.longDelay=n,gs(n>e,"Short delay should be less than long delay!"),this.isMobile=rj()||oj()}get(){return OB()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function ES(t,e){gs(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}class nM{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;rs("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;rs("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;rs("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const DB={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 IB=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],LB=new Ad(3e4,6e4);function Pa(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function Do(t,e,n,r,i={}){return rM(t,i,async()=>{let s={},o={};r&&(e==="GET"?o=r:s={body:JSON.stringify(r)});const c=Td({...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 ij()||(f.referrerPolicy="strict-origin-when-cross-origin"),t.emulatorConfig&&wS(t.emulatorConfig.host)&&(f.credentials="include"),nM.fetch()(await iM(t,t.config.apiHost,n,c),f)})}async function rM(t,e,n){t._canInitEmulator=!1;const r={...DB,...e};try{const i=new zB(t),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();const o=await s.json();if("needConfirmation"in o)throw lh(t,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{const c=s.ok?o.errorMessage:o.error.message,[u,f]=c.split(" : ");if(u==="FEDERATED_USER_ID_ALREADY_LINKED")throw lh(t,"credential-already-in-use",o);if(u==="EMAIL_EXISTS")throw lh(t,"email-already-in-use",o);if(u==="USER_DISABLED")throw lh(t,"user-disabled",o);const h=r[u]||u.toLowerCase().replace(/[_\s]+/g,"-");if(f)throw kS(t,h,f);Ur(t,h)}}catch(i){if(i instanceof No)throw i;Ur(t,"network-request-failed",{message:String(i)})}}async function Sm(t,e,n,r,i={}){const s=await Do(t,e,n,r,i);return"mfaPendingCredential"in s&&Ur(t,"multi-factor-auth-required",{_serverResponse:s}),s}async function iM(t,e,n,r){const i=`${e}${n}?${r}`,s=t,o=s.config.emulator?ES(t.config,i):`${t.config.apiScheme}://${i}`;return IB.includes(n)&&(await s._persistenceManagerAvailable,s._getPersistenceType()==="COOKIE")?s._getPersistence()._getFinalTarget(o).toString():o}function PB(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class zB{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(ii(this.auth,"network-request-failed")),LB.get())})}}function lh(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const i=ii(t,e,r);return i.customData._tokenResponse=n,i}function UE(t){return t!==void 0&&t.enterprise!==void 0}class jB{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 PB(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 BB(t,e){return Do(t,"GET","/v2/recaptchaConfig",Pa(t,e))}async function $B(t,e){return Do(t,"POST","/v1/accounts:delete",e)}async function ap(t,e){return Do(t,"POST","/v1/accounts:lookup",e)}function ju(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function VB(t,e=!1){const n=Ss(t),r=await n.getIdToken(e),i=TS(r);$e(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:ju(Rv(i.auth_time)),issuedAtTime:ju(Rv(i.iat)),expirationTime:ju(Rv(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function Rv(t){return Number(t)*1e3}function TS(t){const[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return Uh("JWT malformed, contained fewer than 3 sections"),null;try{const i=VR(n);return i?JSON.parse(i):(Uh("Failed to decode base64 JWT payload"),null)}catch(i){return Uh("Caught error parsing JWT payload as JSON",i?.toString()),null}}function FE(t){const e=TS(t);return $e(e,"internal-error"),$e(typeof e.exp<"u","internal-error"),$e(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function id(t,e,n=!1){if(n)return e;try{return await e}catch(r){throw r instanceof No&&HB(r)&&t.auth.currentUser===t&&await t.auth.signOut(),r}}function HB({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}class UB{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 Hb{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ju(this.lastLoginAt),this.creationTime=ju(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function lp(t){const e=t.auth,n=await t.getIdToken(),r=await id(t,ap(e,{idToken:n}));$e(r?.users.length,e,"internal-error");const i=r.users[0];t._notifyReloadListener(i);const s=i.providerUserInfo?.length?sM(i.providerUserInfo):[],o=qB(t.providerData,s),c=t.isAnonymous,u=!(t.email&&i.passwordHash)&&!o?.length,f=c?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 Hb(i.createdAt,i.lastLoginAt),isAnonymous:f};Object.assign(t,h)}async function FB(t){const e=Ss(t);await lp(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function qB(t,e){return[...t.filter(r=>!e.some(i=>i.providerId===r.providerId)),...e]}function sM(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 GB(t,e){const n=await rM(t,{},async()=>{const r=Td({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=t.config,o=await iM(t,i,"/v1/token",`key=${s}`),c=await t._getAdditionalHeaders();c["Content-Type"]="application/x-www-form-urlencoded";const u={method:"POST",headers:c,body:r};return t.emulatorConfig&&wS(t.emulatorConfig.host)&&(u.credentials="include"),nM.fetch()(o,u)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function WB(t,e){return Do(t,"POST","/v2/accounts:revokeToken",Pa(t,e))}class Hl{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){$e(e.idToken,"internal-error"),$e(typeof e.idToken<"u","internal-error"),$e(typeof e.refreshToken<"u","internal-error");const n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):FE(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){$e(e.length!==0,"internal-error");const n=FE(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:($e(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 GB(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 Hl;return r&&($e(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),i&&($e(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&($e(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 Hl,this.toJSON())}_performRefresh(){return rs("not implemented")}}function Ks(t,e){$e(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}class ni{constructor({uid:e,auth:n,stsTokenManager:r,...i}){this.providerId="firebase",this.proactiveRefresh=new UB(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 Hb(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){const n=await id(this,this.stsTokenManager.getToken(this.auth,e));return $e(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return VB(this,e)}reload(){return FB(this)}_assign(e){this!==e&&($e(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 ni({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(e){$e(!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 lp(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Qr(this.auth.app))return Promise.reject(mo(this.auth));const e=await this.getIdToken();return await id(this,$B(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,c=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:S,stsTokenManager:w}=n;$e(m&&w,e,"internal-error");const x=Hl.fromJSON(this.name,w);$e(typeof m=="string",e,"internal-error"),Ks(r,e.name),Ks(i,e.name),$e(typeof g=="boolean",e,"internal-error"),$e(typeof y=="boolean",e,"internal-error"),Ks(s,e.name),Ks(o,e.name),Ks(c,e.name),Ks(u,e.name),Ks(f,e.name),Ks(h,e.name);const k=new ni({uid:m,auth:e,email:i,emailVerified:g,displayName:r,isAnonymous:y,photoURL:o,phoneNumber:s,tenantId:c,stsTokenManager:x,createdAt:f,lastLoginAt:h});return S&&Array.isArray(S)&&(k.providerData=S.map(T=>({...T}))),u&&(k._redirectEventId=u),k}static async _fromIdTokenResponse(e,n,r=!1){const i=new Hl;i.updateFromServerResponse(n);const s=new ni({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:r});return await lp(s),s}static async _fromGetAccountInfoResponse(e,n,r){const i=n.users[0];$e(i.localId!==void 0,"internal-error");const s=i.providerUserInfo!==void 0?sM(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,c=new Hl;c.updateFromIdToken(r);const u=new ni({uid:i.localId,auth:e,stsTokenManager:c,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 Hb(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(u,f),u}}const qE=new Map;function is(t){gs(t instanceof Function,"Expected a class definition");let e=qE.get(t);return e?(gs(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,qE.set(t,e),e)}class oM{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){}}oM.type="NONE";const GE=oM;function Fh(t,e,n){return`firebase:${t}:${e}:${n}`}class Ul{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;const{config:i,name:s}=this.auth;this.fullUserKey=Fh(this.userKey,i.apiKey,s),this.fullPersistenceKey=Fh("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 ap(this.auth,{idToken:e}).catch(()=>{});return n?ni._fromGetAccountInfoResponse(this.auth,n,e):null}return ni._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 Ul(is(GE),e,r);const i=(await Promise.all(n.map(async f=>{if(await f._isAvailable())return f}))).filter(f=>f);let s=i[0]||is(GE);const o=Fh(r,e.config.apiKey,e.name);let c=null;for(const f of n)try{const h=await f._get(o);if(h){let m;if(typeof h=="string"){const g=await ap(e,{idToken:h}).catch(()=>{});if(!g)break;m=await ni._fromGetAccountInfoResponse(e,g,h)}else m=ni._fromJSON(e,h);f!==s&&(c=m),s=f;break}}catch{}const u=i.filter(f=>f._shouldAllowMigration);return!s._shouldAllowMigration||!u.length?new Ul(s,e,r):(s=u[0],c&&await s._set(o,c.toJSON()),await Promise.all(n.map(async f=>{if(f!==s)try{await f._remove(o)}catch{}})),new Ul(s,e,r))}}function WE(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(uM(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(aM(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(fM(e))return"Blackberry";if(hM(e))return"Webos";if(lM(e))return"Safari";if((e.includes("chrome/")||cM(e))&&!e.includes("edge/"))return"Chrome";if(dM(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 aM(t=Yn()){return/firefox\//i.test(t)}function lM(t=Yn()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function cM(t=Yn()){return/crios\//i.test(t)}function uM(t=Yn()){return/iemobile/i.test(t)}function dM(t=Yn()){return/android/i.test(t)}function fM(t=Yn()){return/blackberry/i.test(t)}function hM(t=Yn()){return/webos/i.test(t)}function _S(t=Yn()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function KB(t=Yn()){return _S(t)&&!!window.navigator?.standalone}function ZB(){return aj()&&document.documentMode===10}function pM(t=Yn()){return _S(t)||dM(t)||hM(t)||fM(t)||/windows phone/i.test(t)||uM(t)}function mM(t,e=[]){let n;switch(t){case"Browser":n=WE(Yn());break;case"Worker":n=`${WE(Yn())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${_d}/${r}`}class YB{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){const r=s=>new Promise((o,c)=>{try{const u=e(s);o(u)}catch(u){c(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 XB(t,e={}){return Do(t,"GET","/v2/passwordPolicy",Pa(t,e))}const JB=6;class QB{constructor(e){const n=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??JB,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 e${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 KE(this),this.idTokenSubscription=new KE(this),this.beforeStateQueue=new YB(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=eM,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=is(n)),this._initializationPromise=this.queue(async()=>{if(!this._deleted&&(this.persistenceManager=await Ul.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 ap(this,{idToken:e}),r=await ni._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(Qr(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,c=await this.tryRedirectSignIn(e);(!s||s===o)&&c?.user&&(r=c.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 $e(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 lp(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=NB()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(Qr(this.app))return Promise.reject(mo(this));const n=e?Ss(e):null;return n&&$e(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&&$e(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 Qr(this.app)?Promise.reject(mo(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return Qr(this.app)?Promise.reject(mo(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(is(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 XB(this),n=new QB(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 Ed("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&&is(e)||this._popupRedirectResolver;$e(n,this,"argument-error"),this.redirectPersistenceManager=await Ul.create(this,[is(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 c=this._isInitialized?Promise.resolve():this._initializationPromise;if($e(c,this,"internal-error"),c.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 $e(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=mM(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(Qr(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&tM(`Error while retrieving App Check token: ${e.error}`),e?.token}}function za(t){return Ss(t)}class KE{constructor(e){this.auth=e,this.observer=null,this.addObserver=hj(n=>this.observer=n)}get next(){return $e(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let wm={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function t$(t){wm=t}function gM(t){return wm.loadJS(t)}function n$(){return wm.recaptchaEnterpriseScript}function r$(){return wm.gapiScript}function i$(t){return`__${t}${Math.floor(Math.random()*1e6)}`}class s${constructor(){this.enterprise=new o$}ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}}class o${ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}}const a$="recaptcha-enterprise",yM="NO_RECAPTCHA",ZE="onFirebaseAuthREInstanceReady";class no{constructor(e){this.type=a$,this.auth=za(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,c)=>{BB(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(u=>{if(u.recaptchaKey===void 0)c(new Error("recaptcha Enterprise site key undefined"));else{const f=new jB(u);return s.tenantId==null?s._agentRecaptchaConfig=f:s._tenantRecaptchaConfigs[s.tenantId]=f,o(f.siteKey)}}).catch(u=>{c(u)})})}function i(s,o,c){const u=window.grecaptcha;UE(u)?u.enterprise.ready(()=>{u.enterprise.execute(s,{action:e}).then(f=>{o(f)}).catch(()=>{o(yM)})}):c(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new s$().execute("siteKey",{action:"verify"}):new Promise((s,o)=>{r(this.auth).then(async c=>{if(!n&&UE(window.grecaptcha)&&no.scriptInjectionDeferred)await no.scriptInjectionDeferred.promise,i(c,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let u=n$();u.length!==0&&(u+=c+`&onload=${ZE}`),no.scriptInjectionDeferred=new FR,window[ZE]=()=>{no.scriptInjectionDeferred?.resolve()},gM(u).then(()=>no.scriptInjectionDeferred?.promise).then(()=>{i(c,s,o)}).catch(f=>{o(f)})}}).catch(c=>{o(c)})})}}no.scriptInjectionDeferred=null;async function YE(t,e,n,r=!1,i=!1){const s=new no(t);let o;if(i)o=yM;else try{o=await s.verify(n)}catch{o=await s.verify(n,!0)}const c={...e};if(n==="mfaSmsEnrollment"||n==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in c){const u=c.phoneEnrollmentInfo.phoneNumber,f=c.phoneEnrollmentInfo.recaptchaToken;Object.assign(c,{phoneEnrollmentInfo:{phoneNumber:u,recaptchaToken:f,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in c){const u=c.phoneSignInInfo.recaptchaToken;Object.assign(c,{phoneSignInInfo:{recaptchaToken:u,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return c}return r?Object.assign(c,{captchaResp:o}):Object.assign(c,{captchaResponse:o}),Object.assign(c,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(c,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),c}async function XE(t,e,n,r,i){if(t._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const s=await YE(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 YE(t,e,n,n==="getOobCode");return r(t,o)}else return Promise.reject(s)})}function l$(t,e){const n=KR(t,"auth");if(n.isInitialized()){const i=n.getImmediate(),s=n.getOptions();if(Zl(s,e??{}))return i;Ur(i,"already-initialized")}return n.initialize({options:e})}function c$(t,e){const n=e?.persistence||[],r=(Array.isArray(n)?n:[n]).map(is);e?.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e?.popupRedirectResolver)}function u$(t,e,n){const r=za(t);$e(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const i=!1,s=vM(e),{host:o,port:c}=d$(e),u=c===null?"":`:${c}`,f={url:`${s}//${o}${u}/`},h=Object.freeze({host:o,port:c,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})});if(!r._canInitEmulator){$e(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),$e(Zl(f,r.config.emulator)&&Zl(h,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=f,r.emulatorConfig=h,r.settings.appVerificationDisabledForTesting=!0,wS(o)?gj(`${s}//${o}${u}`):f$()}function vM(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function d$(t){const e=vM(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:JE(r.substr(s.length+1))}}else{const[s,o]=r.split(":");return{host:s,port:JE(o)}}}function JE(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}function f$(){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 AS{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return rs("not implemented")}_getIdTokenResponse(e){return rs("not implemented")}_linkToIdToken(e,n){return rs("not implemented")}_getReauthenticationResolver(e){return rs("not implemented")}}async function h$(t,e){return Do(t,"POST","/v1/accounts:signUp",e)}async function p$(t,e){return Sm(t,"POST","/v1/accounts:signInWithPassword",Pa(t,e))}async function m$(t,e){return Sm(t,"POST","/v1/accounts:signInWithEmailLink",Pa(t,e))}async function g$(t,e){return Sm(t,"POST","/v1/accounts:signInWithEmailLink",Pa(t,e))}class sd extends AS{constructor(e,n,r,i=null){super("password",r),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new sd(e,n,"password")}static _fromEmailAndCode(e,n,r=null){return new sd(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 XE(e,n,"signInWithPassword",p$);case"emailLink":return m$(e,{email:this._email,oobCode:this._password});default:Ur(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 XE(e,r,"signUpPassword",h$);case"emailLink":return g$(e,{idToken:n,email:this._email,oobCode:this._password});default:Ur(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function Fl(t,e){return Sm(t,"POST","/v1/accounts:signInWithIdp",Pa(t,e))}const y$="http://localhost";class xa extends AS{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const n=new xa(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):Ur("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 xa(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 Fl(e,n)}_linkToIdToken(e,n){const r=this.buildRequest();return r.idToken=n,Fl(e,r)}_getReauthenticationResolver(e){const n=this.buildRequest();return n.autoCreate=!1,Fl(e,n)}buildRequest(){const e={requestUri:y$,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=Td(n)}return e}}function v$(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 b$(t){const e=_u(Au(t)).link,n=e?_u(Au(e)).deep_link_id:null,r=_u(Au(t)).deep_link_id;return(r?_u(Au(r)).link:null)||r||n||e||t}class RS{constructor(e){const n=_u(Au(e)),r=n.apiKey??null,i=n.oobCode??null,s=v$(n.mode??null);$e(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=b$(e);try{return new RS(n)}catch{return null}}}class pc{constructor(){this.providerId=pc.PROVIDER_ID}static credential(e,n){return sd._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){const r=RS.parseLink(n);return $e(r,"argument-error"),sd._fromEmailAndCode(e,r.code,r.tenantId)}}pc.PROVIDER_ID="password";pc.EMAIL_PASSWORD_SIGN_IN_METHOD="password";pc.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class MS{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 Rd extends MS{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class ro extends Rd{constructor(){super("facebook.com")}static credential(e){return xa._fromParams({providerId:ro.PROVIDER_ID,signInMethod:ro.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return ro.credentialFromTaggedObject(e)}static credentialFromError(e){return ro.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return ro.credential(e.oauthAccessToken)}catch{return null}}}ro.FACEBOOK_SIGN_IN_METHOD="facebook.com";ro.PROVIDER_ID="facebook.com";class ts extends Rd{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return xa._fromParams({providerId:ts.PROVIDER_ID,signInMethod:ts.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return ts.credentialFromTaggedObject(e)}static credentialFromError(e){return ts.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:n,oauthAccessToken:r}=e;if(!n&&!r)return null;try{return ts.credential(n,r)}catch{return null}}}ts.GOOGLE_SIGN_IN_METHOD="google.com";ts.PROVIDER_ID="google.com";class io extends Rd{constructor(){super("github.com")}static credential(e){return xa._fromParams({providerId:io.PROVIDER_ID,signInMethod:io.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return io.credentialFromTaggedObject(e)}static credentialFromError(e){return io.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return io.credential(e.oauthAccessToken)}catch{return null}}}io.GITHUB_SIGN_IN_METHOD="github.com";io.PROVIDER_ID="github.com";class so extends Rd{constructor(){super("twitter.com")}static credential(e,n){return xa._fromParams({providerId:so.PROVIDER_ID,signInMethod:so.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return so.credentialFromTaggedObject(e)}static credentialFromError(e){return so.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=e;if(!n||!r)return null;try{return so.credential(n,r)}catch{return null}}}so.TWITTER_SIGN_IN_METHOD="twitter.com";so.PROVIDER_ID="twitter.com";class Xl{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 ni._fromIdTokenResponse(e,r,i),o=QE(r);return new Xl({user:s,providerId:o,_tokenResponse:r,operationType:n})}static async _forOperation(e,n,r){await e._updateTokensIfNecessary(r,!0);const i=QE(r);return new Xl({user:e,providerId:i,_tokenResponse:r,operationType:n})}}function QE(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}class cp extends No{constructor(e,n,r,i){super(n.code,n.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,cp.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 cp(e,n,r,i)}}function bM(t,e,n,r){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?cp._fromErrorAndOperation(t,s,e,r):s})}async function S$(t,e,n=!1){const r=await id(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return Xl._forOperation(t,"link",r)}async function w$(t,e,n=!1){const{auth:r}=t;if(Qr(r.app))return Promise.reject(mo(r));const i="reauthenticate";try{const s=await id(t,bM(r,i,e,t),n);$e(s.idToken,r,"internal-error");const o=TS(s.idToken);$e(o,r,"internal-error");const{sub:c}=o;return $e(t.uid===c,r,"user-mismatch"),Xl._forOperation(t,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&Ur(r,"user-mismatch"),s}}async function SM(t,e,n=!1){if(Qr(t.app))return Promise.reject(mo(t));const r="signIn",i=await bM(t,r,e),s=await Xl._fromIdTokenResponse(t,r,i);return n||await t._updateCurrentUser(s.user),s}async function x$(t,e){return SM(za(t),e)}async function k$(t){const e=za(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}function C$(t,e,n){return Qr(t.app)?Promise.reject(mo(t)):x$(Ss(t),pc.credential(e,n)).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&k$(t),r})}function E$(t,e,n,r){return Ss(t).onIdTokenChanged(e,n,r)}function T$(t,e,n){return Ss(t).beforeAuthStateChanged(e,n)}function _$(t,e,n,r){return Ss(t).onAuthStateChanged(e,n,r)}function eT(t){return Ss(t).signOut()}const up="__sak";class wM{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(up,"1"),this.storage.removeItem(up),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 A$=1e3,R$=10;class xM extends wM{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=pM(),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,c,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);ZB()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,R$):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)})},A$)}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]}}xM.type="LOCAL";const M$=xM;class kM extends wM{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}}kM.type="SESSION";const CM=kM;function O$(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}class xm{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 xm(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 c=Array.from(o).map(async f=>f(n.origin,s)),u=await O$(c);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)}}xm.receivers=[];function OS(t="",e=10){let n="";for(let r=0;r<e;r++)n+=Math.floor(Math.random()*10);return t+n}class N${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((c,u)=>{const f=OS("",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),c(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 wi(){return window}function D$(t){wi().location.href=t}function EM(){return typeof wi().WorkerGlobalScope<"u"&&typeof wi().importScripts=="function"}async function I$(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function L$(){return navigator?.serviceWorker?.controller||null}function P$(){return EM()?self:null}const TM="firebaseLocalStorageDb",z$=1,dp="firebaseLocalStorage",_M="fbase_key";class Md{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 km(t,e){return t.transaction([dp],e?"readwrite":"readonly").objectStore(dp)}function j$(){const t=indexedDB.deleteDatabase(TM);return new Md(t).toPromise()}function AM(){const t=indexedDB.open(TM,z$);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{const r=t.result;try{r.createObjectStore(dp,{keyPath:_M})}catch(i){n(i)}}),t.addEventListener("success",async()=>{const r=t.result;r.objectStoreNames.contains(dp)?e(r):(r.close(),await j$(),e(await AM()))})})}async function tT(t,e,n){const r=km(t,!0).put({[_M]:e,value:n});return new Md(r).toPromise()}async function B$(t,e){const n=km(t,!1).get(e),r=await new Md(n).toPromise();return r===void 0?null:r.value}function nT(t,e){const n=km(t,!0).delete(e);return new Md(n).toPromise()}const $$=800,V$=3;class RM{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=AM(),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++>V$)throw r;this.dbPromise&&((await this.dbPromise).close(),this.dbPromise=null)}}async initializeServiceWorkerMessaging(){return EM()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=xm._getInstance(P$()),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 I$(),!this.activeServiceWorker)return;this.sender=new N$(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||L$()!==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 tT(e,up,"1"),await nT(e,up)}),!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=>tT(r,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){const n=await this._withRetries(r=>B$(r,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>nT(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){if(this.isHiding)return[];try{const e=await this._withRetries(i=>{const s=km(i,!1).getAll();return new Md(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||tM(`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(),$$)}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())}}RM.type="LOCAL";const H$=RM;new Ad(3e4,6e4);function MM(t,e){return e?is(e):($e(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}class NS extends AS{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Fl(e,this._buildIdpRequest())}_linkToIdToken(e,n){return Fl(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return Fl(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 U$(t){return SM(t.auth,new NS(t),t.bypassAuthState)}function F$(t){const{auth:e,user:n}=t;return $e(n,e,"internal-error"),w$(n,new NS(t),t.bypassAuthState)}async function q$(t){const{auth:e,user:n}=t;return $e(n,e,"internal-error"),S$(n,new NS(t),t.bypassAuthState)}class OM{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:c}=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(c)(u))}catch(f){this.reject(f)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return U$;case"linkViaPopup":case"linkViaRedirect":return q$;case"reauthViaPopup":case"reauthViaRedirect":return F$;default:Ur(this.auth,"internal-error")}}resolve(e){gs(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){gs(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 G$=new Ad(2e3,1e4);async function W$(t,e,n){if(Qr(t.app))return Promise.reject(ii(t,"operation-not-supported-in-this-environment"));const r=za(t);RB(t,e,MS);const i=MM(r,n);return new ua(r,"signInViaPopup",e,i).executeNotNull()}class ua extends OM{constructor(e,n,r,i,s){super(e,n,i,s),this.provider=r,this.authWindow=null,this.pollId=null,ua.currentPopupAction&&ua.currentPopupAction.cancel(),ua.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return $e(e,this.auth,"internal-error"),e}async onExecution(){gs(this.filter.length===1,"Popup operations only handle one event");const e=OS();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(ii(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(ii(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,ua.currentPopupAction=null}pollUserCancellation(){const e=()=>{if(this.authWindow?.window?.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(ii(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,G$.get())};e()}}ua.currentPopupAction=null;const K$="pendingRedirect",qh=new Map;class Z$ extends OM{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 Y$(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 Y$(t,e){const n=Q$(e),r=J$(t);if(!await r._isAvailable())return!1;const i=await r._get(n)==="true";return await r._remove(n),i}function X$(t,e){qh.set(t._key(),e)}function J$(t){return is(t._redirectPersistence)}function Q$(t){return Fh(K$,t.config.apiKey,t.name)}async function e3(t,e,n=!1){if(Qr(t.app))return Promise.reject(mo(t));const r=za(t),i=MM(r,e),o=await new Z$(r,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}const t3=600*1e3;class n3{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||!r3(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){if(e.error&&!NM(e)){const r=e.error.code?.split("auth/")[1]||"internal-error";n.onError(ii(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>=t3&&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 NM({type:t,error:e}){return t==="unknown"&&e?.code==="auth/no-auth-event"}function r3(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return NM(t);default:return!1}}async function i3(t,e={}){return Do(t,"GET","/v1/projects",e)}const s3=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,o3=/^https?/;async function a3(t){if(t.config.emulator)return;const{authorizedDomains:e}=await i3(t);for(const n of e)try{if(l3(n))return}catch{}Ur(t,"unauthorized-domain")}function l3(t){const e=Vb(),{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(!o3.test(n))return!1;if(s3.test(t))return r===t;const i=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}const c3=new Ad(3e4,6e4);function iT(){const t=wi().___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 u3(t){return new Promise((e,n)=>{function r(){iT(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{iT(),n(ii(t,"network-request-failed"))},timeout:c3.get()})}if(wi().gapi?.iframes?.Iframe)e(gapi.iframes.getContext());else if(wi().gapi?.load)r();else{const i=i$("iframefcb");return wi()[i]=()=>{gapi.load?r():n(ii(t,"network-request-failed"))},gM(`${r$()}?onload=${i}`).catch(s=>n(s))}}).catch(e=>{throw Gh=null,e})}let Gh=null;function d3(t){return Gh=Gh||u3(t),Gh}const f3=new Ad(5e3,15e3),h3="__/auth/iframe",p3="emulator/auth/iframe",m3={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},g3=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function y3(t){const e=t.config;$e(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?ES(e,p3):`https://${t.config.authDomain}/${h3}`,r={apiKey:e.apiKey,appName:t.name,v:_d},i=g3.get(t.config.apiHost);i&&(r.eid=i);const s=t._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${Td(r).slice(1)}`}async function v3(t){const e=await d3(t),n=wi().gapi;return $e(n,t,"internal-error"),e.open({where:document.body,url:y3(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:m3,dontclear:!0},r=>new Promise(async(i,s)=>{await r.restyle({setHideOnLeave:!1});const o=ii(t,"network-request-failed"),c=wi().setTimeout(()=>{s(o)},f3.get());function u(){wi().clearTimeout(c),i(r)}r.ping(u).then(u,()=>{s(o)})}))}const b3={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},S3=500,w3=600,x3="_blank",k3="http://localhost";class sT{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function C3(t,e,n,r=S3,i=w3){const s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let c="";const u={...b3,width:r.toString(),height:i.toString(),top:s,left:o},f=Yn().toLowerCase();n&&(c=cM(f)?x3:n),aM(f)&&(e=e||k3,u.scrollbars="yes");const h=Object.entries(u).reduce((g,[y,S])=>`${g}${y}=${S},`,"");if(KB(f)&&c!=="_self")return E3(e||"",c),new sT(null);const m=window.open(e||"",c,h);$e(m,t,"popup-blocked");try{m.focus()}catch{}return new sT(m)}function E3(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 T3="__/auth/handler",_3="emulator/auth/handler",A3=encodeURIComponent("fac");async function oT(t,e,n,r,i,s){$e(t.config.authDomain,t,"auth-domain-config-required"),$e(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:_d,eventId:i};if(e instanceof MS){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",fj(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[h,m]of Object.entries({}))o[h]=m}if(e instanceof Rd){const h=e.getScopes().filter(m=>m!=="");h.length>0&&(o.scopes=h.join(","))}t.tenantId&&(o.tid=t.tenantId);const c=o;for(const h of Object.keys(c))c[h]===void 0&&delete c[h];const u=await t._getAppCheckToken(),f=u?`#${A3}=${encodeURIComponent(u)}`:"";return`${R3(t)}?${Td(c).slice(1)}${f}`}function R3({config:t}){return t.emulator?ES(t,_3):`https://${t.authDomain}/${T3}`}const Mv="webStorageSupport";class M3{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=CM,this._completeRedirectFn=e3,this._overrideRedirectResult=X$}async _openPopup(e,n,r,i){gs(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");const s=await oT(e,n,r,Vb(),i);return C3(e,s,OS())}async _openRedirect(e,n,r,i){await this._originValidation(e);const s=await oT(e,n,r,Vb(),i);return D$(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):(gs(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 v3(e),r=new n3(e);return n.register("authEvent",i=>($e(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(Mv,{type:Mv},i=>{const s=i?.[0]?.[Mv];s!==void 0&&n(!!s),Ur(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=a3(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return pM()||lM()||_S()}}const O3=M3;var aT="@firebase/auth",lT="1.13.4";class N3{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(){$e(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}function D3(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 I3(t){nd(new Yl("auth",(e,{options:n})=>{const r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:c}=r.options;$e(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});const u={apiKey:o,authDomain:c,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:mM(t)},f=new e$(r,i,s,u);return c$(f,n),f},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),nd(new Yl("auth-internal",e=>{const n=za(e.getProvider("auth").getImmediate());return(r=>new N3(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),Vl(aT,lT,D3(t)),Vl(aT,lT,"esm2020")}const L3=300,P3=UR("authIdTokenMaxAge")||L3;let cT=null;const z3=t=>async e=>{const n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>P3)return;const i=n?.token;cT!==i&&(cT=i,await fetch(t,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function j3(t=YR()){const e=KR(t,"auth");if(e.isInitialized())return e.getImmediate();const n=l$(t,{popupRedirectResolver:O3,persistence:[H$,M$,CM]}),r=UR("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const s=new URL(r,location.origin);if(location.origin===s.origin){const o=z3(s.toString());T$(n,o,()=>o(n.currentUser)),E$(n,c=>o(c))}}const i=nj("auth");return i&&u$(n,`http://${i}`),n}function B3(){return document.getElementsByTagName("head")?.[0]??document}t$({loadJS(t){return new Promise((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=i=>{const s=ii("internal-error");s.customData=i,n(s)},r.type="text/javascript",r.charset="UTF-8",B3().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="});I3("Browser");function $3(t=6e4){const e=new Map,n=new Map;function r(o,c,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=c().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,c){e.set(o,{value:c,at:Date.now()})}function s(o){if(!o){e.clear(),n.clear();return}for(const c of[...e.keys()])(c===o||c.startsWith(`${o}:`))&&e.delete(c);for(const c of[...n.keys()])(c===o||c.startsWith(`${o}:`))&&n.delete(c)}return{get:r,set:i,invalidate:s}}const V3="x-vertebr-env";async function ch(t,e){const n=await t.arrayBuffer(),r=new Uint8Array(n);let i="";const s=32768;for(let c=0;c<r.length;c+=s)i+=String.fromCharCode(...r.subarray(c,c+s));return{name:e||typeof File<"u"&&t instanceof File&&t.name||"upload",type:t.type||"application/octet-stream",data:btoa(i)}}function Ub(t,e){const n=typeof t=="string"?{apiBase:t,getEnvironment:(()=>"")}:t,r=n.apiBase.replace(/\/$/,""),i=$3(n.cacheTtlMs??6e4);async function s(o,c,u){const f=n.getEnvironment().trim(),m=(await n.getAccessToken?.())?.trim(),g=await fetch(`${r}${o}`,{...c,headers:{Accept:"application/json","Content-Type":"application/json",...f?{[V3]:f}:{},...u?.auth!==!1&&m?{Authorization:`Bearer ${m}`}:{},...c?.headers??{}}});if(!g.ok){const y=await g.text();throw new Error(y||`Request failed (${g.status})`)}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=>i.get("metrics",()=>s("/metrics"),o),getPublicControls:o=>i.get("controls",async()=>(await s("/public/controls",void 0,{auth:!1})).configs??{},o),getPublicResource:(o,c)=>i.get(`public-resource:${o}`,()=>s(`/public/resources/${encodeURIComponent(o)}`,void 0,{auth:!1}),c),listResource:(o,c)=>i.get(`resource:${o}`,()=>s(`/resources/${encodeURIComponent(o)}`),c),createResource:async(o,c)=>{const u=await s(`/resources/${encodeURIComponent(o)}`,{method:"POST",body:JSON.stringify(c)});return i.invalidate(`resource:${o}`),i.invalidate(`public-resource:${o}`),u},updateResource:async(o,c,u)=>{const f=await s(`/resources/${encodeURIComponent(o)}/${encodeURIComponent(c)}`,{method:"PUT",body:JSON.stringify(u)});return i.invalidate(`resource:${o}`),i.invalidate(`public-resource:${o}`),f},deleteResource:async(o,c)=>{const u=await s(`/resources/${encodeURIComponent(o)}/${encodeURIComponent(c)}`,{method:"DELETE"});return i.invalidate(`resource:${o}`),i.invalidate(`public-resource:${o}`),u},runResourceAction:async(o,c,u,f)=>{const h=await s(`/resources/${encodeURIComponent(o)}/${encodeURIComponent(c)}/actions/${encodeURIComponent(u)}`,{method:"POST",body:JSON.stringify(f??{})});return i.invalidate(`resource:${o}`),i.invalidate(`public-resource:${o}`),h},uploadResourceFile:async(o,c,u,f)=>{const h=await ch(u,f);return s(`/resources/${encodeURIComponent(o)}/uploads/${encodeURIComponent(c)}`,{method:"POST",body:JSON.stringify(h)})},uploadResourceFiles:async(o,c,u)=>{const f={files:await Promise.all(u.map(h=>ch(h)))};return s(`/resources/${encodeURIComponent(o)}/uploads/${encodeURIComponent(c)}/bulk`,{method:"POST",body:JSON.stringify(f)})},getGallery:o=>i.get("gallery",()=>s("/gallery"),o),uploadGalleryFile:async(o,c)=>{const u=await ch(o,c),f=await s("/gallery/upload",{method:"POST",body:JSON.stringify(u)});return i.invalidate("gallery"),f},uploadGalleryFiles:async o=>{const c={files:await Promise.all(o.map(f=>ch(f)))},u=await s("/gallery/upload/bulk",{method:"POST",body:JSON.stringify(c)});return i.invalidate("gallery"),u},deleteGalleryItem:async o=>{const c=await s(`/gallery/${encodeURIComponent(o)}`,{method:"DELETE"});return i.invalidate("gallery"),c},getConfig:(o,c)=>i.get(`config:${o}`,()=>s(`/configs/${encodeURIComponent(o)}`),c),setConfig:async(o,c)=>{const u=await s(`/configs/${encodeURIComponent(o)}`,{method:"PUT",body:JSON.stringify(c)}),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 DS(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ja=DS();function DM(t){ja=t}var Bu={exec:()=>null};function yt(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(Gn.caret,"$1"),n=n.replace(i,o),r},getRegex:()=>new RegExp(n,e)};return r}var Gn={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")},H3=/^(?:[ \t]*(?:\n|$))+/,U3=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,F3=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Od=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,q3=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,IS=/(?:[*+-]|\d{1,9}[.)])/,IM=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,LM=yt(IM).replace(/bull/g,IS).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(),G3=yt(IM).replace(/bull/g,IS).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(),LS=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,W3=/^[^\n]+/,PS=/(?!\s*\])(?:\\.|[^\[\]\\])+/,K3=yt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",PS).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Z3=yt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,IS).getRegex(),Cm="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",zS=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Y3=yt("^ {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",zS).replace("tag",Cm).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),PM=yt(LS).replace("hr",Od).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",Cm).getRegex(),X3=yt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",PM).getRegex(),jS={blockquote:X3,code:U3,def:K3,fences:F3,heading:q3,hr:Od,html:Y3,lheading:LM,list:Z3,newline:H3,paragraph:PM,table:Bu,text:W3},uT=yt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Od).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",Cm).getRegex(),J3={...jS,lheading:G3,table:uT,paragraph:yt(LS).replace("hr",Od).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",uT).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",Cm).getRegex()},Q3={...jS,html:yt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",zS).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:Bu,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:yt(LS).replace("hr",Od).replace("heading",` *#{1,6} *[^
|
|
10
|
-
]`).replace("lheading",LM).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},eV=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,tV=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,zM=/^( {2,}|\\)\n(?!\s*$)/,nV=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Em=/[\p{P}\p{S}]/u,BS=/[\s\p{P}\p{S}]/u,jM=/[^\s\p{P}\p{S}]/u,rV=yt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,BS).getRegex(),BM=/(?!~)[\p{P}\p{S}]/u,iV=/(?!~)[\s\p{P}\p{S}]/u,sV=/(?:[^\s\p{P}\p{S}]|~)/u,oV=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,$M=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,aV=yt($M,"u").replace(/punct/g,Em).getRegex(),lV=yt($M,"u").replace(/punct/g,BM).getRegex(),VM="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",cV=yt(VM,"gu").replace(/notPunctSpace/g,jM).replace(/punctSpace/g,BS).replace(/punct/g,Em).getRegex(),uV=yt(VM,"gu").replace(/notPunctSpace/g,sV).replace(/punctSpace/g,iV).replace(/punct/g,BM).getRegex(),dV=yt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,jM).replace(/punctSpace/g,BS).replace(/punct/g,Em).getRegex(),fV=yt(/\\(punct)/,"gu").replace(/punct/g,Em).getRegex(),hV=yt(/^<(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(),pV=yt(zS).replace("(?:-->|$)","-->").getRegex(),mV=yt("^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",pV).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),fp=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,gV=yt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",fp).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),HM=yt(/^!?\[(label)\]\[(ref)\]/).replace("label",fp).replace("ref",PS).getRegex(),UM=yt(/^!?\[(ref)\](?:\[\])?/).replace("ref",PS).getRegex(),yV=yt("reflink|nolink(?!\\()","g").replace("reflink",HM).replace("nolink",UM).getRegex(),$S={_backpedal:Bu,anyPunctuation:fV,autolink:hV,blockSkip:oV,br:zM,code:tV,del:Bu,emStrongLDelim:aV,emStrongRDelimAst:cV,emStrongRDelimUnd:dV,escape:eV,link:gV,nolink:UM,punctuation:rV,reflink:HM,reflinkSearch:yV,tag:mV,text:nV,url:Bu},vV={...$S,link:yt(/^!?\[(label)\]\((.*?)\)/).replace("label",fp).getRegex(),reflink:yt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",fp).getRegex()},Fb={...$S,emStrongRDelimAst:uV,emStrongLDelim:lV,url:yt(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},bV={...Fb,br:yt(zM).replace("{2,}","*").getRegex(),text:yt(Fb.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},uh={normal:jS,gfm:J3,pedantic:Q3},gu={normal:$S,gfm:Fb,breaks:bV,pedantic:vV},SV={"&":"&","<":"<",">":">",'"':""","'":"'"},dT=t=>SV[t];function pi(t,e){if(e){if(Gn.escapeTest.test(t))return t.replace(Gn.escapeReplace,dT)}else if(Gn.escapeTestNoEncode.test(t))return t.replace(Gn.escapeReplaceNoEncode,dT);return t}function fT(t){try{t=encodeURI(t).replace(Gn.percentDecode,"%")}catch{return null}return t}function hT(t,e){const n=t.replace(Gn.findPipe,(s,o,c)=>{let u=!1,f=o;for(;--f>=0&&c[f]==="\\";)u=!u;return u?"|":" |"}),r=n.split(Gn.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(Gn.slashPipe,"|");return r}function yu(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 wV(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 pT(t,e,n,r,i){const s=e.href,o=e.title||null,c=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:c,tokens:r.inlineTokens(c)};return r.state.inLink=!1,u}function xV(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[c]=o;return c.length>=i.length?s.slice(i.length):s}).join(`
|
|
12
|
-
`)}var hp=class{options;rules;lexer;constructor(t){this.options=t||ja}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:yu(n,`
|
|
13
|
-
`)}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const n=e[0],r=xV(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=yu(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:yu(e[0],`
|
|
14
|
-
`)}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){let n=yu(e[0],`
|
|
15
|
-
`).split(`
|
|
16
|
-
`),r="",i="";const s=[];for(;n.length>0;){let o=!1;const c=[];let u;for(u=0;u<n.length;u++)if(this.rules.other.blockquoteStart.test(n[u]))c.push(n[u]),o=!0;else if(!o)c.push(n[u]);else break;n=n.slice(u);const f=c.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,S=y.raw+`
|
|
21
|
-
`+n.join(`
|
|
22
|
-
`),w=this.blockquote(S);s[s.length-1]=w,r=r.substring(0,r.length-y.raw.length)+w.raw,i=i.substring(0,i.length-y.text.length)+w.text;break}else if(g?.type==="list"){const y=g,S=y.raw+`
|
|
23
|
-
`+n.join(`
|
|
24
|
-
`),w=this.list(S);s[s.length-1]=w,r=r.substring(0,r.length-g.raw.length)+w.raw,i=i.substring(0,i.length-y.raw.length)+w.raw,n=S.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,k=>" ".repeat(3*k.length)),g=t.split(`
|
|
27
|
-
`,1)[0],y=!m.trim(),S=0;if(this.options.pedantic?(S=2,h=m.trimStart()):y?S=e[1].length+1:(S=e[2].search(this.rules.other.nonSpaceChar),S=S>4?1:S,h=m.slice(S),S+=e[1].length),y&&this.rules.other.blankLine.test(g)&&(f+=g+`
|
|
28
|
-
`,t=t.substring(g.length+1),u=!0),!u){const k=this.rules.other.nextBulletRegex(S),T=this.rules.other.hrRegex(S),A=this.rules.other.fencesBeginRegex(S),_=this.rules.other.headingBeginRegex(S),O=this.rules.other.htmlBeginRegex(S);for(;t;){const N=t.split(`
|
|
29
|
-
`,1)[0];let I;if(g=N,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),I=g):I=g.replace(this.rules.other.tabCharGlobal," "),A.test(g)||_.test(g)||O.test(g)||k.test(g)||T.test(g))break;if(I.search(this.rules.other.nonSpaceChar)>=S||!g.trim())h+=`
|
|
30
|
-
`+I.slice(S);else{if(y||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||A.test(m)||_.test(m)||T.test(m))break;h+=`
|
|
31
|
-
`+g}!y&&!g.trim()&&(y=!0),f+=N+`
|
|
32
|
-
`,t=t.substring(N.length+1),m=I.slice(S)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(o=!0));let w=null,x;this.options.gfm&&(w=this.rules.other.listIsTask.exec(h),w&&(x=w[0]!=="[ ] ",h=h.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:f,task:!!w,checked:x,loose:!1,text:h,tokens:[]}),i.raw+=f}const c=i.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.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=hT(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(hT(o,s.header.length).map((c,u)=>({text:c,tokens:this.lexer.inline(c),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=yu(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{const s=wV(e[2],"()");if(s===-2)return;if(s>-1){const c=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,c).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)),pT(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 pT(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,c,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(c=[...o].length,r[3]||r[4]){u+=c;continue}else if((r[5]||r[6])&&s%3&&!((s+c)%3)){f+=c;continue}if(u-=c,u>0)continue;c=Math.min(c,c+u+f);const m=[...r[0]][0].length,g=t.slice(0,s+r.index+m+c);if(Math.min(s,c)%2){const S=g.slice(1,-1);return{type:"em",raw:g,text:S,tokens:this.lexer.inlineTokens(S)}}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}}}},ss=class qb{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||ja,this.options.tokenizer=this.options.tokenizer||new hp,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:Gn,block:uh.normal,inline:gu.normal};this.options.pedantic?(n.block=uh.pedantic,n.inline=gu.pedantic):this.options.gfm&&(n.block=uh.gfm,this.options.breaks?n.inline=gu.breaks:n.inline=gu.gfm),this.tokenizer.rules=n}static get rules(){return{block:uh,inline:gu}}static lex(e,n){return new qb(n).lex(e)}static lexInline(e,n){return new qb(n).inlineTokens(e)}lex(e){e=e.replace(Gn.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(Gn.tabCharGlobal," ").replace(Gn.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 c=e.slice(1);let u;this.options.extensions.startBlock.forEach(f=>{u=f.call({lexer:this},c),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 c=Object.keys(this.tokens.links);if(c.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)c.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 c;if(this.options.extensions?.inline?.some(f=>(c=f.call({lexer:this},e,n))?(e=e.substring(c.raw.length),n.push(c),!0):!1))continue;if(c=this.tokenizer.escape(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.tag(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.link(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(c.raw.length);const f=n.at(-1);c.type==="text"&&f?.type==="text"?(f.raw+=c.raw,f.text+=c.text):n.push(c);continue}if(c=this.tokenizer.emStrong(e,r,o)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.codespan(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.br(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.del(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.autolink(e)){e=e.substring(c.raw.length),n.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(e))){e=e.substring(c.raw.length),n.push(c);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(c=this.tokenizer.inlineText(u)){e=e.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(o=c.raw.slice(-1)),s=!0;const f=n.at(-1);f?.type==="text"?(f.raw+=c.raw,f.text+=c.text):n.push(c);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}},od=class{options;parser;constructor(t){this.options=t||ja}space(t){return""}code({text:t,lang:e,escaped:n}){const r=(e||"").match(Gn.notSpaceStart)?.[0],i=t.replace(Gn.endingNewline,"")+`
|
|
45
|
-
`;return r?'<pre><code class="language-'+pi(r)+'">'+(n?i:pi(i,!0))+`</code></pre>
|
|
46
|
-
`:"<pre><code>"+(n?i:pi(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 c=t.items[o];r+=this.listitem(c)}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+" "+pi(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>${pi(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=fT(t);if(i===null)return r;t=i;let s='<a href="'+t+'"';return e&&(s+=' title="'+pi(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=fT(t);if(i===null)return pi(n);t=i;let s=`<img src="${t}" alt="${n}"`;return e&&(s+=` title="${pi(e)}"`),s+=">",s}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:pi(t.text)}},VS=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""}},as=class Gb{options;renderer;textRenderer;constructor(e){this.options=e||ja,this.options.renderer=this.options.renderer||new od,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new VS}static parse(e,n){return new Gb(n).parse(e)}static parseInline(e,n){return new Gb(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 c=s,u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(c.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 c=o,u=this.renderer.text(c);for(;i+1<e.length&&e[i+1].type==="text";)c=e[++i],u+=`
|
|
63
|
-
`+this.renderer.text(c);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 c='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}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 c=this.options.extensions.renderers[s.type].call({parser:this},s);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){r+=c||"";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 c='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}},Wh=class{options;block;constructor(t){this.options=t||ja}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?ss.lex:ss.lexInline}provideParser(){return this.block?as.parse:as.parseInline}},FM=class{defaults=DS();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=as;Renderer=od;TextRenderer=VS;Lexer=ss;Tokenizer=hp;Hooks=Wh;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 c=i.renderer.apply(this,o);return c===!1&&(c=s.apply(this,o)),c}: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 od(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,c=n.renderer[o],u=i[o];i[o]=(...f)=>{let h=c.apply(i,f);return h===!1&&(h=u.apply(i,f)),h||""}}r.renderer=i}if(n.tokenizer){const i=this.defaults.tokenizer||new hp(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,c=n.tokenizer[o],u=i[o];i[o]=(...f)=>{let h=c.apply(i,f);return h===!1&&(h=u.apply(i,f)),h}}r.tokenizer=i}if(n.hooks){const i=this.defaults.hooks||new Wh;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,c=n.hooks[o],u=i[o];Wh.passThroughHooks.has(s)?i[o]=f=>{if(this.defaults.async)return Promise.resolve(c.call(i,f)).then(m=>u.call(i,m));const h=c.call(i,f);return u.call(i,h)}:i[o]=(...f)=>{let h=c.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 c=[];return c.push(s.call(this,o)),i&&(c=c.concat(i.call(this,o))),c}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return ss.lex(t,e??this.defaults)}parser(t,e){return as.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 c=s.hooks?s.hooks.provideLexer():t?ss.lex:ss.lexInline,u=s.hooks?s.hooks.provideParser():t?as.parse:as.parseInline;if(s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(n):n).then(f=>c(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=c(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>"+pi(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},ka=new FM;function Et(t,e){return ka.parse(t,e)}Et.options=Et.setOptions=function(t){return ka.setOptions(t),Et.defaults=ka.defaults,DM(Et.defaults),Et};Et.getDefaults=DS;Et.defaults=ja;Et.use=function(...t){return ka.use(...t),Et.defaults=ka.defaults,DM(Et.defaults),Et};Et.walkTokens=function(t,e){return ka.walkTokens(t,e)};Et.parseInline=ka.parseInline;Et.Parser=as;Et.parser=as.parse;Et.Renderer=od;Et.TextRenderer=VS;Et.Lexer=ss;Et.lexer=ss.lex;Et.Tokenizer=hp;Et.Hooks=Wh;Et.parse=Et;Et.options;Et.setOptions;Et.use;Et.walkTokens;Et.parseInline;as.parse;ss.lex;function vu(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function mT(t){const e=t.trim();return e?e.startsWith("//")?`https:${e}`:/^(https?:|mailto:|\/|#)/i.test(e)?e:null:null}class kV extends od{html(){return""}link({href:e,title:n,tokens:r}){const i=this.parser.parseInline(r),s=mT(e);if(!s)return i;const o=n?` title="${vu(n)}"`:"";return`<a href="${vu(s)}"${o} rel="noopener noreferrer">${i}</a>`}image({href:e,title:n,text:r}){const i=mT(e);if(!i)return"";const s=n?` title="${vu(n)}"`:"";return`<img src="${vu(i)}" alt="${vu(r)}"${s} loading="lazy" />`}}new FM({gfm:!0,breaks:!1,renderer:new kV});var Nd=t=>t.type==="checkbox",Tm=t=>t.type==="file",lo=t=>t instanceof Date,Mn=t=>t==null;const HS=t=>typeof t=="object";var Ut=t=>!Mn(t)&&!Array.isArray(t)&&HS(t)&&!lo(t),Wb=t=>Ut(t)&&t.target?Nd(t.target)?t.target.checked:Tm(t.target)?t.target.files:t.target.value:t,qM=(t,e)=>e.split(".").some((n,r,i)=>!isNaN(Number(n))&&t.has(i.slice(0,r).join("."))),GM=t=>{const e=t.constructor&&t.constructor.prototype;return Ut(e)&&e.hasOwnProperty("isPrototypeOf")},_m=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ht(t){if(t instanceof Date)return new Date(t);const e=typeof FileList<"u"&&t instanceof FileList;if(_m&&(t instanceof Blob||e))return t;const n=Array.isArray(t);if(!n&&!(Ut(t)&&GM(t)))return t;const r=n?[]:Object.create(Object.getPrototypeOf(t));for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=Ht(t[i]));return r}const Xs={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},ei={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Kr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},WM="root",US=["__proto__","constructor","prototype"],CV=/^\w*$/;var Dd=t=>CV.test(t),zt=t=>t===void 0;const EV=/[.[\]'"]/;var Am=t=>t.split(EV).filter(Boolean),pe=(t,e,n)=>{if(!e||!Ut(t))return n;const r=Dd(e)?[e]:Am(e);if(r.some(s=>US.includes(s)))return n;const i=r.reduce((s,o)=>Mn(s)?void 0:s[o],t);return zt(i)||i===t?zt(t[e])?n:t[e]:i},br=t=>typeof t=="boolean",Bn=t=>typeof t=="function",gt=(t,e,n)=>{let r=-1;const i=Dd(e)?[e]:Am(e),s=i.length,o=s-1;for(;++r<s;){const c=i[r];let u=n;if(r!==o){const f=t[c];u=Ut(f)||Array.isArray(f)?f:isNaN(+i[r+1])?{}:[]}if(US.includes(c))return;t[c]=u,t=t[c]}};const KM=Be.createContext(null);KM.displayName="HookFormControlContext";const FS=()=>Be.useContext(KM);var ZM=(t,e,n,r=!0)=>{const i={};for(const s in t)Object.defineProperty(i,s,{get:()=>{const o=s;return e._proxyFormState[o]!==ei.all&&(e._proxyFormState[o]=!r||ei.all),n&&(n[o]=!0),t[o]}});return i};const qS=_m?Be.useLayoutEffect:Be.useEffect;function TV(t){const e=FS(),{control:n=e,disabled:r,name:i,exact:s}=t||{},[o,c]=Be.useState(()=>({...n._formState,defaultValues:n._defaultValues})),u=Be.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return qS(()=>n._subscribe({name:i,formState:u.current,exact:s,callback:f=>{!r&&c({...n._formState,...f,defaultValues:n._defaultValues})}}),[i,r,s]),Be.useEffect(()=>{u.current.isValid&&n._setValid(!0)},[n]),Be.useMemo(()=>ZM(o,n,u.current,!1),[o,n])}var On=t=>typeof t=="string",Kb=(t,e,n,r,i)=>On(t)?(r&&e.watch.add(t),pe(n,t,i)):Array.isArray(t)?t.map(s=>(r&&e.watch.add(s),pe(n,s))):(r&&(e.watchAll=!0),n),Zb=t=>Mn(t)||!HS(t);const gT=(t,e)=>e.length===0&&!Array.isArray(t)&&!GM(t);function Sr(t,e,n=new WeakMap){if(t===e)return!0;if(Zb(t)||Zb(e))return Object.is(t,e);if(lo(t)&&lo(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(gT(t,r)||gT(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 c=t[o];if(!(o in e))return!1;if(o!=="ref"){const u=e[o];if(lo(c)&&lo(u)||(Ut(c)||Array.isArray(c))&&(Ut(u)||Array.isArray(u))?!Sr(c,u,n):!Object.is(c,u))return!1}}return!0}function YM(t){const e=FS(),{control:n=e,name:r,defaultValue:i,disabled:s,exact:o,compute:c}=t||{},u=Be.useRef(i),f=Be.useRef(c),h=Be.useRef(void 0),m=Be.useRef(n),g=Be.useRef(r);f.current=c;const[y,S]=Be.useState(()=>{const _=n._getWatch(r,u.current);return f.current?f.current(_):_}),w=Be.useCallback(_=>{const O=Kb(r,n._names,_||n._formValues,!1,u.current);return f.current?f.current(O):O},[n._formValues,n._names,r]),x=Be.useCallback(_=>{if(!s){const O=Kb(r,n._names,_||n._formValues,!1,u.current);if(f.current){const N=f.current(O);Sr(N,h.current)||(S(N),h.current=N)}else S(O)}},[n._formValues,n._names,s,r]);qS(()=>((m.current!==n||!Sr(g.current,r))&&(m.current=n,g.current=r,x()),n._subscribe({name:r,formState:{values:!0},exact:o,callback:_=>{x(_.values)}})),[n,o,r,x]),Be.useEffect(()=>n._removeUnmounted());const k=m.current!==n,T=g.current,A=Be.useMemo(()=>{if(s)return null;const _=!k&&!Sr(T,r);return k||_?w():null},[s,k,r,T,w]);return A!==null?A:y}function _V(t){const e=FS(),{name:n,disabled:r,control:i=e,shouldUnregister:s,defaultValue:o,exact:c=!0}=t,u=qM(i._names.array,n),f=Be.useMemo(()=>pe(i._formValues,n,pe(i._defaultValues,n,o)),[i,n,o]),h=YM({control:i,name:n,defaultValue:f,exact:c}),m=TV({control:i,name:n,exact:c}),g=Be.useRef(t),y=Be.useRef(null),S=Be.useRef(i.register(n,{...t.rules,value:h,...br(t.disabled)?{disabled:t.disabled}:{}}));g.current=t;const w=Be.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!pe(m.errors,n)},isDirty:{enumerable:!0,get:()=>!!pe(m.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!pe(m.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!pe(m.validatingFields,n)},error:{enumerable:!0,get:()=>pe(m.errors,n)}}),[m,n]),x=Be.useCallback(_=>{const O=Wb(_);return pe(i._fields,n)||(S.current=i.register(n,{...g.current.rules,value:O})),S.current.onChange({target:{value:Wb(_),name:n},type:Xs.CHANGE})},[n,i]),k=Be.useCallback(()=>S.current.onBlur({target:{value:pe(i._formValues,n),name:n},type:Xs.BLUR}),[n,i._formValues]),T=Be.useCallback(_=>{_&&(y.current={focus:()=>Bn(_.focus)&&_.focus(),select:()=>Bn(_.select)&&_.select(),setCustomValidity:N=>Bn(_.setCustomValidity)&&_.setCustomValidity(N),reportValidity:()=>Bn(_.reportValidity)&&_.reportValidity()});const O=pe(i._fields,n);O&&O._f&&_&&(O._f.ref=y.current)},[i._fields,n]),A=Be.useMemo(()=>({name:n,value:h,...br(r)||m.disabled?{disabled:m.disabled||r}:{},onChange:x,onBlur:k,ref:T}),[n,r,m.disabled,x,k,T,h]);return Be.useEffect(()=>{const _=i._options.shouldUnregister||s;S.current=i.register(n,{...g.current.rules,...br(g.current.disabled)?{disabled:g.current.disabled}:{}});const O=(N,I)=>{const z=pe(i._fields,N);z&&z._f&&(z._f.mount=I)};if(O(n,!0),_){const N=Ht(pe(s?i._defaultValues:i._options.values||i._defaultValues,n,pe(i._options.defaultValues,n,g.current.defaultValue)));gt(i._defaultValues,n,N),zt(pe(i._formValues,n))&>(i._formValues,n,N)}if(!u&&i.register(n),y.current){const N=pe(i._fields,n);N&&N._f&&(N._f.ref=y.current)}return()=>{(u?_&&!i._state.action:_)?i.unregister(n):O(n,!1)}},[n,i,u,s]),Be.useEffect(()=>{i._setDisabledField({disabled:r,name:n})},[r,n,i]),Be.useMemo(()=>({field:A,formState:m,fieldState:w}),[A,m,w])}const ia=t=>t.render(_V(t));var dh=t=>({isOnSubmit:!t||t===ei.onSubmit,isOnBlur:t===ei.onBlur,isOnChange:t===ei.onChange,isOnAll:t===ei.all,isOnTouch:t===ei.onTouched}),Ov=(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 $u=(t,e,n,r)=>{for(const i of n||Object.keys(t)){if(i==="_f")continue;const s=n?pe(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($u(s,e))break}else if((Ut(s)||Array.isArray(s))&&$u(s,e))break}}};var yT=(t,e,n)=>{const r=pe(t,n),i=Array.isArray(r)?r:[];return gt(i,WM,e[n]),gt(t,n,i),t},An=t=>Ut(t)&&!Object.keys(t).length,pp=t=>{if(!_m)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},GS=t=>t.type==="radio",mp=t=>t instanceof RegExp,WS=(t,e,n,r,i)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:i||!0}}:{};const vT={value:!1,isValid:!1},bT={value:!0,isValid:!0};var XM=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&&!zt(t[0].attributes.value)?zt(t[0].value)||t[0].value===""?bT:{value:t[0].value,isValid:!0}:bT:vT}return vT};const ST={isValid:!1,value:null};var JM=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,ST):ST;function wT(t,e,n="validate"){if(On(t)||Array.isArray(t)&&t.every(On)||br(t)&&!t)return{type:n,message:On(t)?t:"",ref:e}}var Rl=t=>Ut(t)&&!mp(t)?t:{value:t,message:""},xT=async(t,e,n,r,i,s)=>{const{ref:o,refs:c,required:u,maxLength:f,minLength:h,min:m,max:g,pattern:y,validate:S,name:w,valueAsNumber:x,mount:k}=t._f,T=pe(n,w);if(!k||e.has(w))return{};const A=c?c[0]:o,_=X=>{if(i&&A.reportValidity){const te=br(X)?"":X||"";c?c.forEach(ie=>ie.setCustomValidity(te)):A.setCustomValidity(te),A.reportValidity()}},O={},N=GS(o),I=Nd(o),z=N||I,q=(x||Tm(o))&&zt(o.value)&&zt(T)||pp(o)&&o.value===""||T===""||Array.isArray(T)&&!T.length,Z=WS.bind(null,w,r,O),ae=(X,te,ie,de=Kr.maxLength,B=Kr.minLength)=>{const Y=X?te:ie;O[w]={type:X?de:B,message:Y,ref:o,...Z(X?de:B,Y)}};if(s?!Array.isArray(T)||!T.length:u&&(!z&&(q||Mn(T))||br(T)&&!T||I&&!XM(c).isValid||N&&!JM(c).isValid)){const{value:X,message:te}=On(u)?{value:!!u,message:u}:Rl(u);if(X&&(O[w]={type:Kr.required,message:te,ref:A,...Z(Kr.required,te)},!r))return _(te),O}if(!q&&(!Mn(m)||!Mn(g))){let X,te;const ie=Rl(g),de=Rl(m);if(!Mn(T)&&!isNaN(T)){const B=o.valueAsNumber||T&&+T;Mn(ie.value)||(X=B>ie.value),Mn(de.value)||(te=B<de.value)}else{const B=o.valueAsDate||new Date(T),Y=ke=>new Date(new Date().toDateString()+" "+ke),oe=o.type=="time",ye=o.type=="week";On(ie.value)&&T&&(X=oe?Y(T)>Y(ie.value):ye?T>ie.value:B>new Date(ie.value)),On(de.value)&&T&&(te=oe?Y(T)<Y(de.value):ye?T<de.value:B<new Date(de.value))}if((X||te)&&(ae(!!X,ie.message,de.message,Kr.max,Kr.min),!r))return _(O[w].message),O}if((f||h)&&!q&&(On(T)||s&&Array.isArray(T))){const X=Rl(f),te=Rl(h),ie=!Mn(X.value)&&T.length>+X.value,de=!Mn(te.value)&&T.length<+te.value;if((ie||de)&&(ae(ie,X.message,te.message),!r))return _(O[w].message),O}if(y&&!q&&On(T)){const{value:X,message:te}=Rl(y);if(mp(X)&&!T.match(X)&&(O[w]={type:Kr.pattern,message:te,ref:o,...Z(Kr.pattern,te)},!r))return _(te),O}if(S){if(Bn(S)){const X=await S(T,n),te=wT(X,A);if(te&&(O[w]={...te,...Z(Kr.validate,te.message)},!r))return _(te.message),O}else if(Ut(S)){let X={};for(const te in S){if(!An(X)&&!r)break;const ie=wT(await S[te](T,n),A,te);ie&&(X={...ie,...Z(te,ie.message)},_(ie.message),r&&(O[w]=X))}if(!An(X)&&(O[w]={ref:A,...X},!r))return O}}return _(!0),O},Kh=t=>Array.isArray(t)?t:[t],QM=t=>Array.isArray(t)?t.filter(Boolean):[];function AV(t,e){const n=e.length-1;let r=0;for(;r<n;){if(Mn(t)){t=void 0;break}t=t[e[r]],r++}return t}function RV(t){for(const e in t)if(t.hasOwnProperty(e)&&!zt(t[e]))return!1;return!0}function Jt(t,e){if(On(e)&&Object.prototype.hasOwnProperty.call(t,e))return delete t[e],t;const n=Array.isArray(e)?e:Dd(e)?[e]:Am(e);if(n.some(o=>US.includes(String(o))))return t;const r=n.length===1?t:AV(t,n),i=n.length-1,s=n[i];return r&&delete r[s],i!==0&&(Ut(r)&&An(r)||Array.isArray(r)&&RV(r))&&Jt(t,n.slice(0,-1)),t}const eO=t=>{const e={};for(const n of Object.keys(t))if(HS(t[n])&&t[n]!==null&&!lo(t[n])){const r=eO(t[n]);for(const i of Object.keys(r))e[`${n}.${i}`]=r[i]}else e[n]=t[n];return e},MV=Be.createContext(null);MV.displayName="HookFormContext";var kT=()=>{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 tO(t,e){const n={};for(const r in t)if(t.hasOwnProperty(r)){const i=t[r],s=e[r];if(i&&Ut(i)&&s){const o=tO(i,s);Ut(o)&&(n[r]=o)}else t[r]&&(n[r]=s)}return n}var nO=t=>t.type==="select-multiple",OV=t=>GS(t)||Nd(t),Nv=t=>pp(t)&&t.isConnected;function CT(t){return Array.isArray(t)||Ut(t)}function rO(t,e,n="",r=[]){for(const i in t){const s=n?`${n}.${i}`:i,o=t[i];CT(o)&&CT(pe(e,s))?rO(o,e,s,r):r.push(s)}return r}var NV=t=>{for(const e in t)if(Bn(t[e]))return!0;return!1};function iO(t){return Array.isArray(t)||Ut(t)&&!NV(t)}function sO(t){return!!(t&&"_f"in t)}function oO(t){return Array.isArray(t)?!t.some(e=>!zt(e)):!Object.keys(t).length}function Yb(t,e){Array.isArray(t)?t[e]=void 0:delete t[e]}function Xb(t,e={},n){for(const r in t){const i=t[r],s=n&&n[r];iO(i)&&(!Array.isArray(i)||!sO(s))?(e[r]=Array.isArray(i)?[]:{},Xb(i,e[r],s),oO(e[r])&&Yb(e,r)):zt(i)||(e[r]=!0)}return e}function aa(t,e,n,r){n||(n=Xb(e,{},r));for(const i in t){const s=t[i],o=r&&r[i];iO(s)&&(!Array.isArray(s)||!sO(o))?(zt(e)||Zb(n[i])?n[i]=Xb(s,Array.isArray(s)?[]:{},o):aa(s,Mn(e)?{}:e[i],n[i],o),oO(n[i])&&Yb(n,i)):Sr(s,e[i])?Yb(n,i):n[i]=!0}return n}var aO=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>zt(t)?t:e?t===""?NaN:t&&+t:n&&On(t)?new Date(t):r?r(t):t;function ET(t){const e=t.ref;return Tm(e)?e.files:GS(e)?JM(t.refs).value:nO(e)?[...e.selectedOptions].map(({value:n})=>n):Nd(e)?XM(t.refs).value:aO(e.value,t)}var DV=(t,e,n,r)=>{const i={};for(const s of t){const o=pe(e,s);o&>(i,s,o._f)}return{criteriaMode:n,names:[...t],fields:i,shouldUseNativeValidation:r}},bu=t=>zt(t)?t:mp(t)?t.source:Ut(t)?mp(t.value)?t.value.source:t.value:t;const TT="AsyncFunction";var IV=t=>{if(!t||!t.validate)return!1;if(Bn(t.validate))return t.validate.constructor.name===TT;if(Ut(t.validate)){for(const e in t.validate)if(t.validate[e].constructor.name===TT)return!0}return!1},LV=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate);function _T(t,e,n){const r=pe(t,n);if(r||Dd(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const s=i.join("."),o=pe(e,s),c=pe(t,s);if(o&&!Array.isArray(o)&&n!==s)return{name:n};if(c&&c.type)return{name:s,error:c};if(c&&c.root&&c.root.type)return{name:`${s}.root`,error:c.root};i.pop()}return{name:n}}var PV=(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||ei.all))},zV=(t,e,n)=>!t||!e||t===e||Kh(t).some(r=>r&&(n?r===e||r.startsWith(e+"."):r.startsWith(e)||e.startsWith(r))),jV=(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,BV=(t,e)=>!QM(pe(t,e)).length&&Jt(t,e);const $V={mode:ei.onSubmit,reValidateMode:ei.onChange,shouldFocusError:!0},Dv="form",VV=(t,e)=>{for(const n in t)n in e||delete t[n];Object.assign(t,e)},lO={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function HV(t={}){let e={...$V,...t},n={...Ht(lO),isLoading:Bn(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1},r={},i=Ut(e.defaultValues)||Ut(e.values)?Ht(e.defaultValues||e.values)||{}:{},s=e.shouldUnregister?{}:Ht(i),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},c={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=dh(e.mode),g=dh(e.reValidateMode);const y={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},S={...y};let w={...S};const x={array:kT(),state:kT()};let k=0;const T=e.criteriaMode===ei.all,A=(D,V)=>H=>{clearTimeout(f[D]),f[D]=setTimeout(V,H)},_=async D=>{if(!o.keepIsValid&&!e.disabled&&(S.isValid||w.isValid||D)){const V=++k;let H;e.resolver?(H=An((await ie()).errors),V===k&&O()):H=await Y({fields:r,onlyCheckValid:!0,eventType:Xs.VALID}),V===k&&H!==n.isValid&&x.state.next({isValid:H})}},O=(D,V)=>{!e.disabled&&(S.isValidating||S.validatingFields||w.isValidating||w.validatingFields)&&((D||Array.from(c.mount)).forEach(H=>{H&&(V?gt(n.validatingFields,H,V):Jt(n.validatingFields,H))}),x.state.next({validatingFields:n.validatingFields,isValidating:!An(n.validatingFields)}))},N=()=>{n.dirtyFields=aa(i,s,void 0,r)},I=(D,V=[],H,re,se=!0,he=!0)=>{if(re&&H&&!e.disabled){if(o.action=!0,he&&Array.isArray(pe(r,D))){const ge=H(pe(r,D),re.argA,re.argB);se&>(r,D,ge)}if(he&&Array.isArray(pe(n.errors,D))){const ge=H(pe(n.errors,D),re.argA,re.argB);se&>(n.errors,D,ge),BV(n.errors,D)}if((S.touchedFields||w.touchedFields)&&he&&Array.isArray(pe(n.touchedFields,D))){const ge=H(pe(n.touchedFields,D),re.argA,re.argB);se&>(n.touchedFields,D,ge)}(S.dirtyFields||w.dirtyFields)&&N(),x.state.next({name:D,isDirty:ye(D,V),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else gt(s,D,V)},z=(D,V)=>{gt(n.errors,D,V),n.errors={...n.errors},x.state.next({errors:n.errors})},q=D=>{n.errors=D,x.state.next({errors:n.errors,isValid:!1})},Z=D=>{const V=Dd(D)?[D]:Am(D);let H=s,re=i;for(let se=0;se<V.length-1;se++){const he=V[se];if(H=Mn(H)?H:H[he],re=Mn(re)?re:re[he],H===null&&re!==null)return!0}return!1},ae=(D,V,H,re)=>{const se=pe(r,D);if(se){if(Z(D))return;const he=zt(pe(s,D)),ge=pe(s,D,zt(H)?pe(i,D):H);zt(ge)||re&&re.defaultChecked||V?gt(s,D,V?ge:ET(se._f)):W(D,ge),o.mount&&!o.action&&(_(),he&&n.isDirty&&(S.isDirty||w.isDirty)&&(ye()||(n.isDirty=!1,x.state.next({...n}))),t.shouldUnregister&&he&&!zt(pe(s,D))&&Ov(D,c)&&(o.watch=!0))}},X=(D,V,H,re,se)=>{let he=!1,ge=!1;const Se={name:D};if(!e.disabled||re===!0){if(!H||re){const ze=Sr(pe(i,D),V);(S.isDirty||w.isDirty)&&(ge=n.isDirty,n.isDirty=Se.isDirty=!ze||ye(),he=ge!==Se.isDirty),ge=!!pe(n.dirtyFields,D),ze!==n.isDirty?VV(n.dirtyFields,aa(i,s,void 0,r)):ze?Jt(n.dirtyFields,D):gt(n.dirtyFields,D,!0),Se.dirtyFields=n.dirtyFields,he=he||(S.dirtyFields||w.dirtyFields)&&ge!==!ze}if(H){const ze=pe(n.touchedFields,D);ze||(gt(n.touchedFields,D,H),Se.touchedFields=n.touchedFields,he=he||(S.touchedFields||w.touchedFields)&&ze!==H)}he&&se&&x.state.next(Se)}return he?Se:{}},te=(D,V,H,re)=>{const se=pe(n.errors,D),he=(S.isValid||w.isValid)&&br(V)&&n.isValid!==V;if(e.delayError&&H?(u[D]=A(D,()=>z(D,H)),u[D](e.delayError)):(clearTimeout(f[D]),delete u[D],H?gt(n.errors,D,H):Jt(n.errors,D),n.errors={...n.errors}),(H?!Sr(se,H):se)||!An(re)||he){const ge={...re,...he&&br(V)?{isValid:V}:{},errors:n.errors,name:D};n={...n,...ge},x.state.next(ge)}},ie=async D=>(O(D,!0),await e.resolver(s,e.context,DV(D||c.mount,r,e.criteriaMode,e.shouldUseNativeValidation))),de=async D=>{const{errors:V}=await ie(D);if(O(D),D){for(const H of D){const re=pe(V,H);re?c.array.has(H)&&Ut(re)&&!Object.keys(re).some(se=>!Number.isNaN(Number(se)))?yT(n.errors,{[H]:re},H):gt(n.errors,H,re):Jt(n.errors,H)}n.errors={...n.errors}}else n.errors=V;return V},B=async({name:D,eventType:V})=>{if(t.validate){const H=await t.validate({formValues:s,formState:n,name:D,eventType:V});if(Ut(H))for(const re in H){const se=H[re];se&&ut(`${Dv}.${re}`,{message:On(se.message)?se.message:"",type:se.type||Kr.validate})}else On(H)||!H?ut(Dv,{message:H||"",type:Kr.validate}):Xe(Dv);return H}return!0},Y=async({fields:D,onlyCheckValid:V,name:H,eventType:re,context:se={valid:!0,runRootValidation:!1}})=>{if(t.validate&&(se.runRootValidation=!0,!await B({name:H,eventType:re})&&(se.valid=!1,V)))return se.valid;for(const he in D){const ge=D[he];if(ge){const{_f:Se,...ze}=ge;if(Se){const at=c.array.has(Se.name),Vt=ge._f&&IV(ge._f),er=S.validatingFields||S.isValidating||w.validatingFields||w.isValidating;Vt&&er&&O([Se.name],!0);const xn=await xT(ge,c.disabled,s,T,e.shouldUseNativeValidation&&!V,at);if(Vt&&er&&O([Se.name]),xn[Se.name]&&(se.valid=!1,V)||(!V&&(pe(xn,Se.name)?at?yT(n.errors,xn,Se.name):gt(n.errors,Se.name,xn[Se.name]):Jt(n.errors,Se.name)),t.shouldUseNativeValidation&&xn[Se.name]))break}!An(ze)&&await Y({context:se,onlyCheckValid:V,fields:ze,name:he,eventType:re})}}return se.valid},oe=()=>{for(const D of c.unMount){const V=pe(r,D);V&&(V._f.refs?V._f.refs.every(H=>!Nv(H)):!Nv(V._f.ref))&&Dt(D)}c.unMount=new Set},ye=(D,V)=>(D&&V&>(s,D,V),!Sr(o.mount?s:i,i)),ke=(D,V,H)=>Kb(D,c,{...o.mount?s:zt(V)?i:On(D)?{[D]:V}:V},H,V),P=D=>QM(pe(o.mount?s:i,D,e.shouldUnregister?pe(i,D,[]):[])),W=(D,V,H={},re=!1,se=!1)=>{const he=pe(r,D);let ge=V;if(he){const Se=he._f;Se&&(!Se.disabled&>(s,D,aO(V,Se)),ge=pp(Se.ref)&&Mn(V)?"":V,nO(Se.ref)?[...Se.ref.options].forEach(ze=>ze.selected=ge.includes(ze.value)):Se.refs?Nd(Se.ref)?Se.refs.forEach(ze=>{(!ze.defaultChecked||!ze.disabled)&&(Array.isArray(ge)?ze.checked=!!ge.find(at=>at===ze.value):ze.checked=ge===ze.value||!!ge)}):Se.refs.forEach(ze=>ze.checked=ze.value===ge):Tm(Se.ref)?Se.ref.value="":(Se.ref.value=ge,!Se.ref.type&&!se&&x.state.next({name:D,values:re?s:Ht(s)})))}(H.shouldDirty||H.shouldTouch)&&X(D,ge,H.shouldTouch,H.shouldDirty,!se),H.shouldValidate&&Ie(D,{delayError:H.delayError})},ce=(D,V,H,re=!1,se=!1)=>{c.array.has(D)&&x.array.next({name:D,values:re?s:Ht(s)});for(const he in V){if(!V.hasOwnProperty(he))return;const ge=V[he],Se=D+"."+he,ze=pe(r,Se);(c.array.has(D)||Ut(ge)||ze&&!ze._f)&&!lo(ge)?ce(Se,ge,H,re,se):W(Se,ge,H,re,se)}},me=(D,V,H,re,se=!1)=>{const he=pe(r,D),ge=c.array.has(D),Se=re?V:Ht(V),ze=pe(s,D),at=Sr(ze,Se);if(at||gt(s,D,Se),ge)x.array.next({name:D,values:re?s:Ht(s)}),(S.isDirty||S.dirtyFields||w.isDirty||w.dirtyFields)&&H.shouldDirty&&(N(),se||x.state.next({name:D,dirtyFields:n.dirtyFields,isDirty:ye(D,Se)}));else{const Vt=Array.isArray(Se)&&!Se.length||An(Se);!he||he._f||Mn(Se)||Vt?W(D,Se,H,re,se):ce(D,Se,H,re,se)}if(!at&&!se){const Vt=Ov(D,c),er=re?s:Ht(s);x.state.next({...Vt&&n,name:o.mount||Vt?D:void 0,values:er})}},Ae=(D,V,H={})=>me(D,V,H,!1),Le=(D,V={})=>{const H=Bn(D)?D(s):D;if(!Sr(s,H)){s={...s,...H};const re=eO(H);for(const se of c.mount)se in re&&me(se,re[se],V,!0,!0);x.state.next({...n,name:void 0,type:void 0,...h?{values:s}:{}}),V.shouldValidate&&_()}},He=async D=>{o.mount=!0;const V=D.target;let H=V.name,re=!0;const se=pe(r,H),he=ge=>{re=Number.isNaN(ge)||lo(ge)&&isNaN(ge.getTime())||Sr(ge,pe(s,H,ge))};if(se){let ge,Se;const ze=V.type?ET(se._f):Wb(D),at=D.type===Xs.BLUR||D.type===Xs.FOCUS_OUT,Vt=!LV(se._f)&&!t.validate&&!e.resolver&&!pe(n.errors,H)&&!se._f.deps,er=Vt||jV(at,pe(n.touchedFields,H),n.isSubmitted,g,m),xn=Ov(H,c,at);if(gt(s,H,ze),at){if(!V||!V.readOnly){se._f.onBlur&&se._f.onBlur(D);const $o=u[H];$o&&$o(0)}}else se._f.onChange&&se._f.onChange(D);const ci=X(H,ze,at),Bo=!An(ci)||xn;if(!at&&x.state.next({name:H,type:D.type,...h?{values:Ht(s)}:{}}),er)return(!Vt||!n.isValid)&&(S.isValid||w.isValid)&&(e.mode==="onBlur"?at&&_():at||_()),Bo&&x.state.next({name:H,...xn?{}:ci});if(!e.resolver&&t.validate&&await B({name:H,eventType:D.type}),!at&&xn&&x.state.next({...n}),e.resolver){const{errors:$o}=await ie([H]);if(O([H]),he(ze),!re){!An(ci)&&x.state.next(ci);return}const Kd=_T(n.errors,r,H),Fa=_T($o,r,Kd.name||H);ge=Fa.error,H=Fa.name,Se=An($o)}else O([H],!0),ge=(await xT(se,c.disabled,s,T,e.shouldUseNativeValidation))[H],O([H]),he(ze),re&&(ge?Se=!1:(S.isValid||w.isValid)&&(Se=await Y({fields:r,onlyCheckValid:!0,name:H,eventType:D.type})));re&&(se._f.deps&&(!Array.isArray(se._f.deps)||se._f.deps.length>0)&&Ie(se._f.deps),te(H,Se,ge,ci))}},Ce=(D,V)=>{if(pe(n.errors,V)&&D.focus)return D.focus(),1},Ie=async(D,V={})=>{let H,re;const se=Kh(D);if(e.resolver){const he=await de(zt(D)?D:se);H=An(he),re=D?!se.some(ge=>pe(he,ge)):H}else D?(re=(await Promise.all(se.map(async he=>{const ge=pe(r,he);return await Y({fields:ge&&ge._f?{[he]:ge}:ge,eventType:Xs.TRIGGER})}))).every(Boolean),!(!re&&!n.isValid)&&_()):re=H=await Y({fields:r,name:D,eventType:Xs.TRIGGER});if(V.delayError&&e.delayError&&On(D)){const he=pe(n.errors,D);he?(Jt(n.errors,D),u[D]=A(D,()=>z(D,he)),u[D](e.delayError)):(clearTimeout(f[D]),delete u[D])}return x.state.next({...!On(D)||(S.isValid||w.isValid)&&H!==n.isValid?{}:{name:D},...e.resolver||!D?{isValid:H}:{},errors:n.errors}),V.shouldFocus&&!re&&$u(r,Ce,D?se:c.mount),re},ct=(D,V)=>{let H={...o.mount?s:i};return V&&(H=tO(V.dirtyFields?n.dirtyFields:n.touchedFields,H)),zt(D)?H:On(D)?pe(H,D):D.map(re=>pe(H,re))},Ke=(D,V)=>({invalid:!!pe((V||n).errors,D),isDirty:!!pe((V||n).dirtyFields,D),error:pe((V||n).errors,D),isValidating:!!pe(n.validatingFields,D),isTouched:!!pe((V||n).touchedFields,D)}),Xe=D=>{const V=D?Kh(D):void 0;V?.forEach(H=>Jt(n.errors,H)),V?V.forEach(H=>{x.state.next({name:H,errors:n.errors})}):(n.errors={},x.state.next({errors:n.errors}))},ut=(D,V,H)=>{const re=(pe(r,D,{_f:{}})._f||{}).ref,se=pe(n.errors,D)||{},{ref:he,message:ge,type:Se,...ze}=se;gt(n.errors,D,{...ze,...V,ref:re}),x.state.next({name:D,errors:n.errors,isValid:!1}),H&&H.shouldFocus&&re&&re.focus&&re.focus()},xe=(D,V)=>{if(Bn(D)){h++;const{unsubscribe:H}=x.state.subscribe({next:se=>"values"in se&&D(se.values||ke(void 0,V),se)});let re=!1;return{unsubscribe:()=>{re||(re=!0,h--,H())}}}return ke(D,V,!0)},be=D=>{var V;const H=!!(!((V=D.formState)===null||V===void 0)&&V.values);H&&h++;const{unsubscribe:re}=x.state.subscribe({next:he=>{if(zV(D.name,he.name,D.exact)&&PV(he,D.formState||S,Wd,D.reRenderRoot)){const ge={...s};D.callback({values:ge,...n,...he,defaultValues:i})}}});if(!H)return re;let se=!1;return()=>{se||(se=!0,h--,re())}},nt=D=>(o.mount=!0,w={...w,...D.formState},be({...D,formState:{...y,...D.formState}})),Dt=(D,V={})=>{for(const H of D?Kh(D):c.mount)c.mount.delete(H),c.array.delete(H),V.keepValue||(Jt(r,H),Jt(s,H)),!V.keepError&&Jt(n.errors,H),!V.keepDirty&&Jt(n.dirtyFields,H),!V.keepTouched&&Jt(n.touchedFields,H),!V.keepIsValidating&&Jt(n.validatingFields,H),!e.shouldUnregister&&!V.keepDefaultValue&&Jt(i,H);x.state.next({values:Ht(s)}),x.state.next({...n,...V.keepDirty?{isDirty:ye()}:{}}),!V.keepIsValid&&_()},Un=({disabled:D,name:V})=>{if(br(D)&&o.mount||D||c.disabled.has(V)){const se=c.disabled.has(V)!==!!D;D?c.disabled.add(V):c.disabled.delete(V),se&&o.mount&&!o.action&&_()}},le=(D,V={})=>{let H=pe(r,D);const re=br(V.disabled)||br(e.disabled),se=!c.registerName.has(D)&&H&&H._f&&!H._f.mount;return gt(r,D,{...H||{},_f:{...H&&H._f?H._f:{ref:{name:D}},name:D,mount:!0,...V}}),c.mount.add(D),H&&!se?Un({disabled:br(V.disabled)?V.disabled:e.disabled,name:D}):ae(D,!0,V.value),{...re?{disabled:V.disabled||e.disabled}:{},...e.progressive?{required:!!V.required,min:bu(V.min),max:bu(V.max),minLength:bu(V.minLength),maxLength:bu(V.maxLength),pattern:bu(V.pattern)}:{},name:D,onChange:He,onBlur:He,ref:he=>{if(he){c.registerName.add(D),le(D,V),c.registerName.delete(D),H=pe(r,D);const ge=zt(he.value)&&he.querySelectorAll&&he.querySelectorAll("input,select,textarea")[0]||he,Se=OV(ge),ze=H._f.refs||[];if(Se?ze.find(Vt=>Vt===ge):ge===H._f.ref)return;const at={...H._f};Se?(at.refs=[...ze.filter(Nv),ge,...Array.isArray(pe(i,D))?[{}]:[]],at.ref={type:ge.type,name:D}):(at.ref=ge,delete at.refs),gt(r,D,{_f:at}),ae(D,!1,void 0,ge)}else H=pe(r,D,{}),H._f&&(H._f.mount=!1),(e.shouldUnregister||V.shouldUnregister)&&!(qM(c.array,D)&&o.action)&&c.unMount.add(D)}}},Pe=()=>e.shouldFocusError&&!e.shouldUseNativeValidation&&$u(r,Ce,c.mount),jt=D=>{br(D)&&(x.state.next({disabled:D}),$u(r,(V,H)=>{const re=pe(r,H);re&&(V.disabled=re._f.disabled||D,Array.isArray(re._f.refs)&&re._f.refs.forEach(se=>{se.disabled=re._f.disabled||D}))},0,!1))},Qn=(D,V)=>async H=>{let re,se;H&&(H.preventDefault&&H.preventDefault(),H.persist&&H.persist());let he=Ht(s);if(x.state.next({isSubmitting:!0}),e.resolver){const{errors:ge,values:Se}=await ie();O(),n.errors=ge,he=Ht(Se)}else await Y({fields:r,eventType:Xs.SUBMIT});if(c.disabled.size)for(const ge of c.disabled)Jt(he,ge);if(Jt(n.errors,WM),An(n.errors)){x.state.next({errors:{}});try{re=await D(he,H)}catch(ge){se=ge}}else V&&await V({...n.errors},H),Pe(),setTimeout(Pe);if(x.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:An(n.errors)&&!se,submitCount:n.submitCount+1,errors:n.errors}),se)throw se;return re},ks=(D,V={})=>{pe(r,D)&&(zt(V.defaultValue)?Ae(D,Ht(pe(i,D))):(Ae(D,V.defaultValue),gt(i,D,Ht(V.defaultValue))),V.keepTouched||Jt(n.touchedFields,D),V.keepDirty||(Jt(n.dirtyFields,D),n.isDirty=V.defaultValue?ye(D,Ht(pe(i,D))):ye()),V.keepError||(Jt(n.errors,D),S.isValid&&_()),x.state.next({...n}))},en=(D,V={})=>{const H=D?Ht(D):i,re=Ht(H),se=An(D),he=re,ge=r;if(V.keepDefaultValues||(i=H),!V.keepValues){if(V.keepDirtyValues){const Se=new Set([...c.mount,...rO(aa(i,s,void 0,ge),n.dirtyFields)]);for(const ze of Array.from(Se)){const at=pe(n.dirtyFields,ze),Vt=pe(s,ze),er=pe(he,ze);at&&!zt(Vt)?gt(he,ze,Vt):!at&&!zt(er)&&Ae(ze,er)}}else{if(_m&&zt(D))for(const Se of c.mount){const ze=pe(r,Se);if(ze&&ze._f){const at=Array.isArray(ze._f.refs)?ze._f.refs[0]:ze._f.ref;if(pp(at)){const Vt=at.closest("form");if(Vt){Vt.reset();break}}}}if(V.keepFieldsRef)for(const Se of c.mount)Ae(Se,pe(he,Se));else r={}}if(e.shouldUnregister){if(s=V.keepDefaultValues?Ht(i):{},V.keepFieldsRef)for(const Se of c.mount)gt(s,Se,pe(he,Se))}else s=Ht(he);x.array.next({values:{...he}}),x.state.next({name:void 0,type:void 0,values:{...he}})}c={mount:V.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!S.isValid||!!V.keepIsValid||!!V.keepDirtyValues||!e.shouldUnregister&&!An(he),o.watch=!!e.shouldUnregister,o.keepIsValid=!!V.keepIsValid,o.action=!1,V.keepErrors||(n.errors={}),x.state.next({submitCount:V.keepSubmitCount?n.submitCount:0,isDirty:se?!1:V.keepDirty?n.isDirty:V.keepValues?ye():!!(V.keepDefaultValues&&!Sr(D,i)),isSubmitted:V.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:se?{}:V.keepDirtyValues?V.keepDefaultValues&&s?aa(i,s,void 0,ge):n.dirtyFields:V.keepDefaultValues&&D?aa(i,D,void 0,ge):V.keepDirty?n.dirtyFields:{},touchedFields:V.keepTouched?n.touchedFields:{},errors:V.keepErrors?n.errors:{},isSubmitSuccessful:V.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},qd=(D,V)=>en(Bn(D)?D(s):D,{...e.resetOptions,...V}),Gd=(D,V={})=>{const H=pe(r,D),re=H&&H._f;if(re){const se=re.refs?re.refs[0]:re.ref;se.focus&&setTimeout(()=>{se.focus(),V.shouldSelect&&Bn(se.select)&&se.select()})}},Wd=D=>{const{name:V,type:H,values:re,...se}=D;n={...n,...se}},kc={control:{register:le,unregister:Dt,getFieldState:Ke,handleSubmit:Qn,setError:ut,_subscribe:be,_runSchema:ie,_updateIsValidating:O,_focusError:Pe,_getWatch:ke,_getDirty:ye,_setValid:_,_setFieldArray:I,_setDisabledField:Un,_setErrors:q,_getFieldArray:P,_reset:en,_resetDefaultValues:()=>Bn(e.defaultValues)&&e.defaultValues().then(D=>{qd(D,e.resetOptions),x.state.next({isLoading:!1})}),_removeUnmounted:oe,_disableForm:jt,_subjects:x,_proxyFormState:S,get _fields(){return r},get _formValues(){return s},get _state(){return o},set _state(D){o=D},get _defaultValues(){return i},get _names(){return c},set _names(D){c=D},get _formState(){return n},get _options(){return e},set _options(D){e={...e,...D},m=dh(e.mode),g=dh(e.reValidateMode)}},subscribe:nt,trigger:Ie,register:le,handleSubmit:Qn,watch:xe,setValue:Ae,setValues:Le,getValues:ct,reset:qd,resetField:ks,resetDefaultValues:(D,V={})=>{if(i=Ht(D),!V.keepDirty){const H=aa(i,s,void 0,r);n.dirtyFields=H,n.isDirty=!An(H)}V.keepIsValid||_(),x.state.next({...n,defaultValues:i})},clearErrors:Xe,unregister:Dt,setError:ut,setFocus:Gd,getFieldState:Ke};return{...kc,formControl:kc}}function UV(t={}){const e=Be.useRef(void 0),n=Be.useRef(void 0),r=Be.useRef(t.formControl),[i,s]=Be.useState(()=>({...Ht(lO),isLoading:Bn(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1,defaultValues:Bn(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&&!Bn(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:c,...u}=HV(t);e.current={...u,formState:i}}const o=e.current.control;return o._options=t,qS(()=>{const c=o._subscribe({formState:o._proxyFormState,callback:()=>s({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return s(u=>({...u,isReady:!0})),o._formState.isReady=!0,c},[o]),Be.useEffect(()=>o._disableForm(t.disabled),[o,t.disabled]),Be.useEffect(()=>{t.mode&&(o._options.mode=t.mode),t.reValidateMode&&(o._options.reValidateMode=t.reValidateMode)},[o,t.mode,t.reValidateMode]),Be.useEffect(()=>{t.errors&&(o._setErrors(t.errors),o._focusError())},[o,t.errors]),Be.useEffect(()=>{t.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,t.shouldUnregister]),Be.useEffect(()=>{if(o._proxyFormState.isDirty){const c=o._getDirty();c!==i.isDirty&&o._subjects.state.next({isDirty:c})}},[o,i.isDirty]),Be.useEffect(()=>{var c;t.values&&!Sr(t.values,n.current)?(o._reset(t.values,{keepFieldsRef:!0,...o._options.resetOptions}),!((c=o._options.resetOptions)===null||c===void 0)&&c.keepIsValid||o._setValid(),n.current=t.values,s(u=>({...u}))):o._resetDefaultValues()},[o,t.values]),Be.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=Be.useMemo(()=>ZM(i,o),[o,i]),e.current}const AT=(t,e,n)=>{if(t&&"reportValidity"in t){const r=pe(n,e);t.setCustomValidity(r&&r.message||""),t.reportValidity()}},Jb=(t,e)=>{for(const n in e.fields){const r=e.fields[n];r&&r.ref&&"reportValidity"in r.ref?AT(r.ref,n,t):r&&r.refs&&r.refs.forEach(i=>AT(i,n,t))}},RT=(t,e)=>{e.shouldUseNativeValidation&&Jb(t,e);const n={};for(const r in t){const i=pe(e.fields,r),s=Object.assign(t[r]||{},{ref:i&&i.refs?i.refs[0]:i&&i.ref});if(FV(e.names||Object.keys(t),r)){const o=Object.assign({},pe(n,r));gt(o,"root",s),gt(n,r,o)}else gt(n,r,s)}return n},FV=(t,e)=>{const n=MT(e).replace(/[.*+?^${}()|\\]/g,"\\$&");return t.some(r=>MT(r).match(`^${n}\\.\\d+`))};function MT(t){return t.replace(/[\[\]]/g,"")}function Qb(){return Qb=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},Qb.apply(null,arguments)}function OT(t,e){try{var n=t()}catch(r){return e(r)}return n&&n.then?n.then(void 0,e):n}function qV(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 c,u,f=r.unionErrors.reduce(function(g,y){return y.errors.length<g.errors.length?y:g}).errors[0];n[o]={message:(c=f?.message)!=null?c: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]=WS(o,e,n,i,m?[].concat(m,r.message):r.message)}t.shift()}return n}function GV(t,e){for(var n=Object.create(null),r=function(){var i=t[0],s=i.code,o=i.message,c=i.path.join(".");if(!n[c])if(i.code==="invalid_union"&&i.errors.length>0){var u,f,h=i.errors.reduce(function(y,S){return S.length<y.length?S:y})[0];n[c]={message:(u=h?.message)!=null?u:o,type:(f=h?.code)!=null?f:s}}else n[c]={message:o,type:s};if(i.code==="invalid_union"&&i.errors.forEach(function(y){return y.forEach(function(S){return t.push(Qb({},S,{path:[].concat(i.path,S.path)}))})}),e){var m=n[c].types,g=m&&m[i.code];n[c]=WS(c,e,n,s,g?[].concat(g,i.message):i.message)}t.shift()};t.length;)r();return n}function WV(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(OT(function(){function o(u){return s.shouldUseNativeValidation&&Jb({},s),{errors:{},values:n.raw?Object.assign({},r):u}}var c=t;return n.mode==="sync"?o(c.parse(r,e)):Promise.resolve(c.parseAsync(r,e)).then(o)},function(o){if((function(c){var u;return!(c==null||(u=c._zod)==null||(u=u.traits)==null||!u.has("$ZodError"))})(o))return{values:{},errors:RT(GV(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(OT(function(){return Promise.resolve(t[n.mode==="sync"?"parse":"parseAsync"](r,e)).then(function(o){return s.shouldUseNativeValidation&&Jb({},s),{errors:{},values:n.raw?Object.assign({},r):o}})},function(o){if((function(c){return Array.isArray(c?.issues)})(o))return{values:{},errors:RT(qV(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 pt;(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(c=>typeof i[i[c]]!="number"),o={};for(const c of s)o[c]=i[c];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})(pt||(pt={}));var NT;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(NT||(NT={}));const _e=pt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Js=t=>{switch(typeof t){case"undefined":return _e.undefined;case"string":return _e.string;case"number":return Number.isNaN(t)?_e.nan:_e.number;case"boolean":return _e.boolean;case"function":return _e.function;case"bigint":return _e.bigint;case"symbol":return _e.symbol;case"object":return Array.isArray(t)?_e.array:t===null?_e.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?_e.promise:typeof Map<"u"&&t instanceof Map?_e.map:typeof Set<"u"&&t instanceof Set?_e.set:typeof Date<"u"&&t instanceof Date?_e.date:_e.object;default:return _e.unknown}},fe=pt.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 ys 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 c=r,u=0;for(;u<o.path.length;){const f=o.path[u];u===o.path.length-1?(c[f]=c[f]||{_errors:[]},c[f]._errors.push(n(o))):c[f]=c[f]||{_errors:[]},c=c[f],u++}}};return i(this),r}static assert(e){if(!(e instanceof ys))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,pt.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()}}ys.create=t=>new ys(t);const e0=(t,e)=>{let n;switch(t.code){case fe.invalid_type:t.received===_e.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case fe.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,pt.jsonStringifyReplacer)}`;break;case fe.unrecognized_keys:n=`Unrecognized key(s) in object: ${pt.joinValues(t.keys,", ")}`;break;case fe.invalid_union:n="Invalid input";break;case fe.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${pt.joinValues(t.options)}`;break;case fe.invalid_enum_value:n=`Invalid enum value. Expected ${pt.joinValues(t.options)}, received '${t.received}'`;break;case fe.invalid_arguments:n="Invalid function arguments";break;case fe.invalid_return_type:n="Invalid function return type";break;case fe.invalid_date:n="Invalid date";break;case fe.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}"`:pt.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case fe.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 fe.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 fe.custom:n="Invalid input";break;case fe.invalid_intersection_types:n="Intersection results could not be merged";break;case fe.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case fe.not_finite:n="Number must be finite";break;default:n=e.defaultError,pt.assertNever(t)}return{message:n}};let KV=e0;function ZV(){return KV}const YV=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 c="";const u=r.filter(f=>!!f).slice().reverse();for(const f of u)c=f(o,{data:e,defaultError:c}).message;return{...i,path:s,message:c}};function we(t,e){const n=ZV(),r=YV({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===e0?void 0:e0].filter(i=>!!i)});t.common.issues.push(r)}class Cr{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 Ge;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 Cr.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 Ge;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 Ge=Object.freeze({status:"aborted"}),Ru=t=>({status:"dirty",value:t}),Fr=t=>({status:"valid",value:t}),DT=t=>t.status==="aborted",IT=t=>t.status==="dirty",Jl=t=>t.status==="valid",gp=t=>typeof Promise<"u"&&t instanceof Promise;var Me;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Me||(Me={}));class ko{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 LT=(t,e)=>{if(Jl(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 ys(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,c)=>{const{message:u}=t;return o.code==="invalid_enum_value"?{message:u??c.defaultError}:typeof c.data>"u"?{message:u??r??c.defaultError}:o.code!=="invalid_type"?{message:c.defaultError}:{message:u??n??c.defaultError}},description:i}}class lt{get description(){return this._def.description}_getType(e){return Js(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Js(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Cr,ctx:{common:e.parent.common,data:e.data,parsedType:Js(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(gp(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:Js(e)},i=this._parseSync({data:e,path:r.path,parent:r});return LT(r,i)}"~validate"(e){const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Js(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:n});return Jl(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=>Jl(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:Js(e)},i=this._parse({data:e,path:r.path,parent:r}),s=await(gp(i)?i:Promise.resolve(i));return LT(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),c=()=>s.addIssue({code:fe.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(u=>u?!0:(c(),!1)):o?!0:(c(),!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 tc({schema:this,typeName:We.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 go.create(this,this._def)}nullable(){return nc.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return xi.create(this)}promise(){return Sp.create(this,this._def)}or(e){return vp.create([this,e],this._def)}and(e){return bp.create(this,e,this._def)}transform(e){return new tc({...Qe(this._def),schema:this,typeName:We.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new r0({...Qe(this._def),innerType:this,defaultValue:n,typeName:We.ZodDefault})}brand(){return new bH({typeName:We.ZodBranded,type:this,...Qe(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new i0({...Qe(this._def),innerType:this,catchValue:n,typeName:We.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return KS.create(this,e)}readonly(){return s0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const XV=/^c[^\s-]{8,}$/i,JV=/^[0-9a-z]+$/,QV=/^[0-9A-HJKMNP-TV-Z]{26}$/i,eH=/^[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,tH=/^[a-z0-9_-]{21}$/i,nH=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,rH=/^[-+]?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)?)??$/,iH=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,sH="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Iv;const oH=/^(?:(?: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])$/,aH=/^(?:(?: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])$/,lH=/^(([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]))$/,cH=/^(([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])$/,uH=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dH=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,cO="((\\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])))",fH=new RegExp(`^${cO}$`);function uO(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 hH(t){return new RegExp(`^${uO(t)}$`)}function pH(t){let e=`${cO}T${uO(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 mH(t,e){return!!((e==="v4"||!e)&&oH.test(t)||(e==="v6"||!e)&&lH.test(t))}function gH(t,e){if(!nH.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 yH(t,e){return!!((e==="v4"||!e)&&aH.test(t)||(e==="v6"||!e)&&cH.test(t))}class co extends lt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==_e.string){const s=this._getOrReturnCtx(e);return we(s,{code:fe.invalid_type,expected:_e.string,received:s.parsedType}),Ge}const r=new Cr;let i;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),we(i,{code:fe.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),we(i,{code:fe.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,c=e.data.length<s.value;(o||c)&&(i=this._getOrReturnCtx(e,i),o?we(i,{code:fe.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&we(i,{code:fe.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")iH.test(e.data)||(i=this._getOrReturnCtx(e,i),we(i,{validation:"email",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Iv||(Iv=new RegExp(sH,"u")),Iv.test(e.data)||(i=this._getOrReturnCtx(e,i),we(i,{validation:"emoji",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")eH.test(e.data)||(i=this._getOrReturnCtx(e,i),we(i,{validation:"uuid",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")tH.test(e.data)||(i=this._getOrReturnCtx(e,i),we(i,{validation:"nanoid",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")XV.test(e.data)||(i=this._getOrReturnCtx(e,i),we(i,{validation:"cuid",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")JV.test(e.data)||(i=this._getOrReturnCtx(e,i),we(i,{validation:"cuid2",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")QV.test(e.data)||(i=this._getOrReturnCtx(e,i),we(i,{validation:"ulid",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),we(i,{validation:"url",code:fe.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),we(i,{validation:"regex",code:fe.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),we(i,{code:fe.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),we(i,{code:fe.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),we(i,{code:fe.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?pH(s).test(e.data)||(i=this._getOrReturnCtx(e,i),we(i,{code:fe.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?fH.test(e.data)||(i=this._getOrReturnCtx(e,i),we(i,{code:fe.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?hH(s).test(e.data)||(i=this._getOrReturnCtx(e,i),we(i,{code:fe.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?rH.test(e.data)||(i=this._getOrReturnCtx(e,i),we(i,{validation:"duration",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?mH(e.data,s.version)||(i=this._getOrReturnCtx(e,i),we(i,{validation:"ip",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?gH(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),we(i,{validation:"jwt",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?yH(e.data,s.version)||(i=this._getOrReturnCtx(e,i),we(i,{validation:"cidr",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?uH.test(e.data)||(i=this._getOrReturnCtx(e,i),we(i,{validation:"base64",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?dH.test(e.data)||(i=this._getOrReturnCtx(e,i),we(i,{validation:"base64url",code:fe.invalid_string,message:s.message}),r.dirty()):pt.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(i=>e.test(i),{validation:n,code:fe.invalid_string,...Me.errToObj(r)})}_addCheck(e){return new co({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Me.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Me.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Me.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Me.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Me.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Me.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Me.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Me.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Me.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Me.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Me.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Me.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Me.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,...Me.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,...Me.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Me.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Me.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...Me.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Me.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Me.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Me.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Me.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Me.errToObj(n)})}nonempty(e){return this.min(1,Me.errToObj(e))}trim(){return new co({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new co({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new co({...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}}co.create=t=>new co({checks:[],typeName:We.ZodString,coerce:t?.coerce??!1,...Qe(t)});function vH(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 Ql extends lt{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)!==_e.number){const s=this._getOrReturnCtx(e);return we(s,{code:fe.invalid_type,expected:_e.number,received:s.parsedType}),Ge}let r;const i=new Cr;for(const s of this._def.checks)s.kind==="int"?pt.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),we(r,{code:fe.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),we(r,{code:fe.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),we(r,{code:fe.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?vH(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),we(r,{code:fe.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),we(r,{code:fe.not_finite,message:s.message}),i.dirty()):pt.assertNever(s);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Me.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Me.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Me.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Me.toString(n))}setLimit(e,n,r,i){return new Ql({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Me.toString(i)}]})}_addCheck(e){return new Ql({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Me.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Me.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Me.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Me.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Me.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Me.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Me.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Me.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Me.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"&&pt.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)}}Ql.create=t=>new Ql({checks:[],typeName:We.ZodNumber,coerce:t?.coerce||!1,...Qe(t)});class ad extends lt{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)!==_e.bigint)return this._getInvalidInput(e);let r;const i=new Cr;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),we(r,{code:fe.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),we(r,{code:fe.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),we(r,{code:fe.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):pt.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return we(n,{code:fe.invalid_type,expected:_e.bigint,received:n.parsedType}),Ge}gte(e,n){return this.setLimit("min",e,!0,Me.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Me.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Me.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Me.toString(n))}setLimit(e,n,r,i){return new ad({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Me.toString(i)}]})}_addCheck(e){return new ad({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Me.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Me.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Me.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Me.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Me.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}}ad.create=t=>new ad({checks:[],typeName:We.ZodBigInt,coerce:t?.coerce??!1,...Qe(t)});class t0 extends lt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==_e.boolean){const r=this._getOrReturnCtx(e);return we(r,{code:fe.invalid_type,expected:_e.boolean,received:r.parsedType}),Ge}return Fr(e.data)}}t0.create=t=>new t0({typeName:We.ZodBoolean,coerce:t?.coerce||!1,...Qe(t)});class yp extends lt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==_e.date){const s=this._getOrReturnCtx(e);return we(s,{code:fe.invalid_type,expected:_e.date,received:s.parsedType}),Ge}if(Number.isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return we(s,{code:fe.invalid_date}),Ge}const r=new Cr;let i;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),we(i,{code:fe.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),we(i,{code:fe.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):pt.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new yp({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Me.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Me.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}}yp.create=t=>new yp({checks:[],coerce:t?.coerce||!1,typeName:We.ZodDate,...Qe(t)});class PT extends lt{_parse(e){if(this._getType(e)!==_e.symbol){const r=this._getOrReturnCtx(e);return we(r,{code:fe.invalid_type,expected:_e.symbol,received:r.parsedType}),Ge}return Fr(e.data)}}PT.create=t=>new PT({typeName:We.ZodSymbol,...Qe(t)});class zT extends lt{_parse(e){if(this._getType(e)!==_e.undefined){const r=this._getOrReturnCtx(e);return we(r,{code:fe.invalid_type,expected:_e.undefined,received:r.parsedType}),Ge}return Fr(e.data)}}zT.create=t=>new zT({typeName:We.ZodUndefined,...Qe(t)});class jT extends lt{_parse(e){if(this._getType(e)!==_e.null){const r=this._getOrReturnCtx(e);return we(r,{code:fe.invalid_type,expected:_e.null,received:r.parsedType}),Ge}return Fr(e.data)}}jT.create=t=>new jT({typeName:We.ZodNull,...Qe(t)});class BT extends lt{constructor(){super(...arguments),this._any=!0}_parse(e){return Fr(e.data)}}BT.create=t=>new BT({typeName:We.ZodAny,...Qe(t)});class $T extends lt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Fr(e.data)}}$T.create=t=>new $T({typeName:We.ZodUnknown,...Qe(t)});class Co extends lt{_parse(e){const n=this._getOrReturnCtx(e);return we(n,{code:fe.invalid_type,expected:_e.never,received:n.parsedType}),Ge}}Co.create=t=>new Co({typeName:We.ZodNever,...Qe(t)});class VT extends lt{_parse(e){if(this._getType(e)!==_e.undefined){const r=this._getOrReturnCtx(e);return we(r,{code:fe.invalid_type,expected:_e.void,received:r.parsedType}),Ge}return Fr(e.data)}}VT.create=t=>new VT({typeName:We.ZodVoid,...Qe(t)});class xi extends lt{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==_e.array)return we(n,{code:fe.invalid_type,expected:_e.array,received:n.parsedType}),Ge;if(i.exactLength!==null){const o=n.data.length>i.exactLength.value,c=n.data.length<i.exactLength.value;(o||c)&&(we(n,{code:o?fe.too_big:fe.too_small,minimum:c?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&&(we(n,{code:fe.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&&(we(n,{code:fe.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,c)=>i.type._parseAsync(new ko(n,o,n.path,c)))).then(o=>Cr.mergeArray(r,o));const s=[...n.data].map((o,c)=>i.type._parseSync(new ko(n,o,n.path,c)));return Cr.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new xi({...this._def,minLength:{value:e,message:Me.toString(n)}})}max(e,n){return new xi({...this._def,maxLength:{value:e,message:Me.toString(n)}})}length(e,n){return new xi({...this._def,exactLength:{value:e,message:Me.toString(n)}})}nonempty(e){return this.min(1,e)}}xi.create=(t,e)=>new xi({type:t,minLength:null,maxLength:null,exactLength:null,typeName:We.ZodArray,...Qe(e)});function Pl(t){if(t instanceof an){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=go.create(Pl(r))}return new an({...t._def,shape:()=>e})}else return t instanceof xi?new xi({...t._def,type:Pl(t.element)}):t instanceof go?go.create(Pl(t.unwrap())):t instanceof nc?nc.create(Pl(t.unwrap())):t instanceof Ca?Ca.create(t.items.map(e=>Pl(e))):t}class an extends lt{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=pt.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==_e.object){const f=this._getOrReturnCtx(e);return we(f,{code:fe.invalid_type,expected:_e.object,received:f.parsedType}),Ge}const{status:r,ctx:i}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),c=[];if(!(this._def.catchall instanceof Co&&this._def.unknownKeys==="strip"))for(const f in i.data)o.includes(f)||c.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 ko(i,m,i.path,f)),alwaysSet:f in i.data})}if(this._def.catchall instanceof Co){const f=this._def.unknownKeys;if(f==="passthrough")for(const h of c)u.push({key:{status:"valid",value:h},value:{status:"valid",value:i.data[h]}});else if(f==="strict")c.length>0&&(we(i,{code:fe.unrecognized_keys,keys:c}),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 c){const m=i.data[h];u.push({key:{status:"valid",value:h},value:f._parse(new ko(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=>Cr.mergeObjectSync(r,f)):Cr.mergeObjectSync(r,u)}get shape(){return this._def.shape()}strict(e){return Me.errToObj,new an({...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:Me.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new an({...this._def,unknownKeys:"strip"})}passthrough(){return new an({...this._def,unknownKeys:"passthrough"})}extend(e){return new an({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new an({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:We.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new an({...this._def,catchall:e})}pick(e){const n={};for(const r of pt.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new an({...this._def,shape:()=>n})}omit(e){const n={};for(const r of pt.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new an({...this._def,shape:()=>n})}deepPartial(){return Pl(this)}partial(e){const n={};for(const r of pt.objectKeys(this.shape)){const i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}return new an({...this._def,shape:()=>n})}required(e){const n={};for(const r of pt.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof go;)s=s._def.innerType;n[r]=s}return new an({...this._def,shape:()=>n})}keyof(){return dO(pt.objectKeys(this.shape))}}an.create=(t,e)=>new an({shape:()=>t,unknownKeys:"strip",catchall:Co.create(),typeName:We.ZodObject,...Qe(e)});an.strictCreate=(t,e)=>new an({shape:()=>t,unknownKeys:"strict",catchall:Co.create(),typeName:We.ZodObject,...Qe(e)});an.lazycreate=(t,e)=>new an({shape:t,unknownKeys:"strip",catchall:Co.create(),typeName:We.ZodObject,...Qe(e)});class vp extends lt{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function i(s){for(const c of s)if(c.result.status==="valid")return c.result;for(const c of s)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;const o=s.map(c=>new ys(c.ctx.common.issues));return we(n,{code:fe.invalid_union,unionErrors:o}),Ge}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 c=o.map(u=>new ys(u));return we(n,{code:fe.invalid_union,unionErrors:c}),Ge}}get options(){return this._def.options}}vp.create=(t,e)=>new vp({options:t,typeName:We.ZodUnion,...Qe(e)});function n0(t,e){const n=Js(t),r=Js(e);if(t===e)return{valid:!0,data:t};if(n===_e.object&&r===_e.object){const i=pt.objectKeys(e),s=pt.objectKeys(t).filter(c=>i.indexOf(c)!==-1),o={...t,...e};for(const c of s){const u=n0(t[c],e[c]);if(!u.valid)return{valid:!1};o[c]=u.data}return{valid:!0,data:o}}else if(n===_e.array&&r===_e.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let s=0;s<t.length;s++){const o=t[s],c=e[s],u=n0(o,c);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return n===_e.date&&r===_e.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class bp extends lt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=(s,o)=>{if(DT(s)||DT(o))return Ge;const c=n0(s.value,o.value);return c.valid?((IT(s)||IT(o))&&n.dirty(),{status:n.value,value:c.data}):(we(r,{code:fe.invalid_intersection_types}),Ge)};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}))}}bp.create=(t,e,n)=>new bp({left:t,right:e,typeName:We.ZodIntersection,...Qe(n)});class Ca extends lt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_e.array)return we(r,{code:fe.invalid_type,expected:_e.array,received:r.parsedType}),Ge;if(r.data.length<this._def.items.length)return we(r,{code:fe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ge;!this._def.rest&&r.data.length>this._def.items.length&&(we(r,{code:fe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((o,c)=>{const u=this._def.items[c]||this._def.rest;return u?u._parse(new ko(r,o,r.path,c)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>Cr.mergeArray(n,o)):Cr.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new Ca({...this._def,rest:e})}}Ca.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ca({items:t,typeName:We.ZodTuple,rest:null,...Qe(e)})};class HT extends lt{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!==_e.map)return we(r,{code:fe.invalid_type,expected:_e.map,received:r.parsedType}),Ge;const i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([c,u],f)=>({key:i._parse(new ko(r,c,r.path,[f,"key"])),value:s._parse(new ko(r,u,r.path,[f,"value"]))}));if(r.common.async){const c=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 Ge;(f.status==="dirty"||h.status==="dirty")&&n.dirty(),c.set(f.value,h.value)}return{status:n.value,value:c}})}else{const c=new Map;for(const u of o){const f=u.key,h=u.value;if(f.status==="aborted"||h.status==="aborted")return Ge;(f.status==="dirty"||h.status==="dirty")&&n.dirty(),c.set(f.value,h.value)}return{status:n.value,value:c}}}}HT.create=(t,e,n)=>new HT({valueType:e,keyType:t,typeName:We.ZodMap,...Qe(n)});class ld extends lt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_e.set)return we(r,{code:fe.invalid_type,expected:_e.set,received:r.parsedType}),Ge;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(we(r,{code:fe.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&&(we(r,{code:fe.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 Ge;h.status==="dirty"&&n.dirty(),f.add(h.value)}return{status:n.value,value:f}}const c=[...r.data.values()].map((u,f)=>s._parse(new ko(r,u,r.path,f)));return r.common.async?Promise.all(c).then(u=>o(u)):o(c)}min(e,n){return new ld({...this._def,minSize:{value:e,message:Me.toString(n)}})}max(e,n){return new ld({...this._def,maxSize:{value:e,message:Me.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}ld.create=(t,e)=>new ld({valueType:t,minSize:null,maxSize:null,typeName:We.ZodSet,...Qe(e)});class UT extends lt{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})}}UT.create=(t,e)=>new UT({getter:t,typeName:We.ZodLazy,...Qe(e)});class FT extends lt{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return we(n,{received:n.data,code:fe.invalid_literal,expected:this._def.value}),Ge}return{status:"valid",value:e.data}}get value(){return this._def.value}}FT.create=(t,e)=>new FT({value:t,typeName:We.ZodLiteral,...Qe(e)});function dO(t,e){return new ec({values:t,typeName:We.ZodEnum,...Qe(e)})}class ec extends lt{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return we(n,{expected:pt.joinValues(r),received:n.parsedType,code:fe.invalid_type}),Ge}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 we(n,{received:n.data,code:fe.invalid_enum_value,options:r}),Ge}return Fr(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 ec.create(e,{...this._def,...n})}exclude(e,n=this._def){return ec.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}ec.create=dO;class qT extends lt{_parse(e){const n=pt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==_e.string&&r.parsedType!==_e.number){const i=pt.objectValues(n);return we(r,{expected:pt.joinValues(i),received:r.parsedType,code:fe.invalid_type}),Ge}if(this._cache||(this._cache=new Set(pt.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=pt.objectValues(n);return we(r,{received:r.data,code:fe.invalid_enum_value,options:i}),Ge}return Fr(e.data)}get enum(){return this._def.values}}qT.create=(t,e)=>new qT({values:t,typeName:We.ZodNativeEnum,...Qe(e)});class Sp extends lt{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==_e.promise&&n.common.async===!1)return we(n,{code:fe.invalid_type,expected:_e.promise,received:n.parsedType}),Ge;const r=n.parsedType===_e.promise?n.data:Promise.resolve(n.data);return Fr(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Sp.create=(t,e)=>new Sp({type:t,typeName:We.ZodPromise,...Qe(e)});class tc extends lt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===We.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=>{we(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 c=>{if(n.value==="aborted")return Ge;const u=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return u.status==="aborted"?Ge:u.status==="dirty"||n.value==="dirty"?Ru(u.value):u});{if(n.value==="aborted")return Ge;const c=this._def.schema._parseSync({data:o,path:r.path,parent:r});return c.status==="aborted"?Ge:c.status==="dirty"||n.value==="dirty"?Ru(c.value):c}}if(i.type==="refinement"){const o=c=>{const u=i.refinement(c,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 c};if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?Ge:(c.status==="dirty"&&n.dirty(),o(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?Ge:(c.status==="dirty"&&n.dirty(),o(c.value).then(()=>({status:n.value,value:c.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(!Jl(o))return Ge;const c=i.transform(o.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Jl(o)?Promise.resolve(i.transform(o.value,s)).then(c=>({status:n.value,value:c})):Ge);pt.assertNever(i)}}tc.create=(t,e,n)=>new tc({schema:t,typeName:We.ZodEffects,effect:e,...Qe(n)});tc.createWithPreprocess=(t,e,n)=>new tc({schema:e,effect:{type:"preprocess",transform:t},typeName:We.ZodEffects,...Qe(n)});class go extends lt{_parse(e){return this._getType(e)===_e.undefined?Fr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}go.create=(t,e)=>new go({innerType:t,typeName:We.ZodOptional,...Qe(e)});class nc extends lt{_parse(e){return this._getType(e)===_e.null?Fr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}nc.create=(t,e)=>new nc({innerType:t,typeName:We.ZodNullable,...Qe(e)});class r0 extends lt{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===_e.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}r0.create=(t,e)=>new r0({innerType:t,typeName:We.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Qe(e)});class i0 extends lt{_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 gp(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ys(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ys(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}i0.create=(t,e)=>new i0({innerType:t,typeName:We.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Qe(e)});class GT extends lt{_parse(e){if(this._getType(e)!==_e.nan){const r=this._getOrReturnCtx(e);return we(r,{code:fe.invalid_type,expected:_e.nan,received:r.parsedType}),Ge}return{status:"valid",value:e.data}}}GT.create=t=>new GT({typeName:We.ZodNaN,...Qe(t)});class bH extends lt{_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 KS extends lt{_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"?Ge:s.status==="dirty"?(n.dirty(),Ru(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"?Ge: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 KS({in:e,out:n,typeName:We.ZodPipeline})}}class s0 extends lt{_parse(e){const n=this._def.innerType._parse(e),r=i=>(Jl(i)&&(i.value=Object.freeze(i.value)),i);return gp(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}s0.create=(t,e)=>new s0({innerType:t,typeName:We.ZodReadonly,...Qe(e)});var We;(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"})(We||(We={}));const WT=co.create,SH=Ql.create,wH=t0.create;Co.create;const xH=xi.create,kH=an.create;vp.create;bp.create;Ca.create;ec.create;Sp.create;go.create;nc.create;function CH(t){const e={};for(const[n,r]of Object.entries(t)){let i;switch(r.type){case"number":i=SH(),r.min!=null&&(i=i.min(r.min)),r.max!=null&&(i=i.max(r.max));break;case"boolean":i=wH();break;case"file[]":case"enum[]":i=xH(WT());break;default:i=WT()}r.required||(i=i.optional()),e[n]=i}return kH(e)}function Rm(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim()}function Vu(t,e){const n=e?.optionLabels?.[t]?.trim();return n||Rm(t)}function EH(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function TH(t,e,n){const r=e.label?.trim()||Rm(t),i=r.replace(new RegExp(`^${EH(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 _H=/(description|body|content|summary|bio|copy|caption|details)/i;function fO(t,e){if(e?.type==="richtext")return!0;const n=`${t} ${e?.label??""}`;return _H.test(n)}function KT(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 cd(t){return/^https?:\/\//i.test(t)||t.startsWith("//")}function rc(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 hO(t){if(typeof t=="string"&&cd(t))return{url:t};if(t&&typeof t=="object"&&"url"in t){const e=t.url,n=t.name;if(typeof e=="string"&&cd(e))return{url:e,name:typeof n=="string"?n:void 0}}return null}function AH(t,e){const n=[];for(const[r,i]of Object.entries(t)){if(!rc(r,i))continue;const s=i.label?.trim()||r,o=e?.[r],c=Array.isArray(o)?o:[o];c.forEach((u,f)=>{const h=hO(u);h&&n.push({id:`${r}:${f}`,url:h.url,name:h.name||(c.length>1?`${s} ${f+1}`:s),field:r})})}return n}function ZT(t){const e=Array.isArray(t)?t:t==null||t===""?[]:[t],n=[];for(const r of e){const i=hO(r);i&&n.push(i.url)}return n}function RH(t,e){const n=`${t} ${e?.label??""}`;return/(stock|inventory|qty|quantity)/i.test(n)}function Mm(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 pO(t,e){const n=`${t} ${e?.label??""}`;return/(detail|notes|bio|bullets)/i.test(n)}function MH(t,e,n){if(e.type==="boolean"||e.type==="enum[]"||e.type==="richtext"||fO(t,e)||pO(t,e)||n==="record"&&rc(t,e))return"full"}function ZS(t){return`show${t.charAt(0).toUpperCase()}${t.slice(1)}`}function OH(t){const e={...t};for(const[n,r]of Object.entries(t)){if(r.type==="boolean"||!Mm(n,r))continue;const i=ZS(n);e[i]||(e[i]={type:"boolean",default:!0,label:`Show ${r.label??Rm(n)}`})}return e}function NH(t,e){const n={...e};for(const[r,i]of Object.entries(t)){if(i.type==="boolean"||!Mm(r,i))continue;const s=ZS(r);!(s in n)||n[s]==null?n[s]=!0:n[s]=n[s]!==!1}return n}function DH(t){return t.charAt(0).toLowerCase()+t.slice(1)}function IH(t,e){const n=ZS(t),r=[n];t==="priceCents"&&r.push("showPrice");for(const i of r)if(e[i]?.type==="boolean")return i;return Mm(t,e[t])?n:null}const o0={Pricing:"showPrice",Inventory:"showStock",Content:"showDescription"};function LH(t){return Object.keys(o0).find(e=>o0[e]===t)}function PH(t,e){if(!/^show[A-Z]/.test(t)||e[t]?.type!=="boolean")return!1;if(LH(t))return!0;const n=DH(t.slice(4));return e[n]?!0:t==="showPrice"&&!!e.priceCents}function YS(t,e){const n=o0[t];return n&&e[n]?.type==="boolean"?n:null}function zH(t,e,n){const r=IH(t,e);return!r||n&&YS(n,e)===r?null:r}const YT=["Details","Content","Specs","Pricing","Inventory","Media","Display","Status"];function jH(t,e){if(e.group?.trim())return e.group.trim();const r=(e.label?.trim()||Rm(t)).split(/\s+/).filter(Boolean);return r.length>=2?r[0]:"General"}function BH(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":Mm(t,e)?"Specs":"Details"}function $H(t,e){if(e!=="record")return t;const n=r=>{const i=YT.indexOf(r);return i===-1?YT.length+1:i};return[...t].sort((r,i)=>n(r.id)-n(i.id))}function VH(t,e){const n=[],r=new Map,i=new Set;for(const o of Object.entries(t)){const[c,u]=o;if(PH(c,t))continue;const f=e==="record"?BH(c,u):jH(c,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,c]of[...r.entries()]){if(c.length>1||i.has(o)||o==="General")continue;r.has("General")||(r.set("General",[]),n.unshift("General")),r.get("General").push(...c),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 $H(s,e)}function wp(t){const e=Array.isArray(t)?t:[t];for(const n of e){if(typeof n=="string"&&cd(n))return n;if(n&&typeof n=="object"&&"url"in n){const r=n.url;if(typeof r=="string"&&cd(r))return r}}return null}function HH(t,e){for(const[n,r]of Object.entries(t))if(rc(n,r)&&wp(e?.[n]))return n;for(const[n,r]of Object.entries(t))if(rc(n,r))return n;return null}function UH(t){return t.join(",")}function Id({meta:t,disabled:e,multiple:n=!1,label:r,onUpload:i}){const s=R.useRef(null),[o,c]=R.useState(!1),[u,f]=R.useState(null),[h,m]=R.useState(!1),g=async y=>{if(!y||e||o)return;const S=Array.from(y);if(S.length){c(!0),f(null);try{await i(n?S:S.slice(0,1))}catch(w){f(w instanceof Error?w.message:"Upload failed")}finally{c(!1),s.current&&(s.current.value="")}}};return C.jsxs("div",{className:"vertebr-upload",children:[C.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:[C.jsx("p",{className:"vertebr-upload-copy",children:o?"Uploading…":r??(n?"Drop images here or browse":"Drop an image here or browse")}),C.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:e||o,onClick:()=>s.current?.click(),children:n?"Choose images":"Choose image"}),C.jsx("input",{ref:s,type:"file",accept:UH(t.accept),multiple:n,hidden:!0,onChange:y=>{g(y.target.files)}})]}),u?C.jsx("p",{className:"vertebr-upload-error",role:"alert",children:u}):null]})}var mc=zR();const FH=PR(mc);var qH=Object.defineProperty,XS=(t,e)=>qH(t,"name",{value:e,configurable:!0});function a0(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}XS(a0,"setRef");function mO(...t){return e=>{let n=!1;const r=t.map(i=>{const s=a0(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():a0(t[i],null)}}}}XS(mO,"composeRefs");function Qt(...t){return R.useCallback(mO(...t),t)}XS(Qt,"useComposedRefs");var GH=Object.defineProperty,ai=(t,e)=>GH(t,"name",{value:e,configurable:!0});function Ea(t){const e=R.forwardRef((n,r)=>{let{children:i,...s}=n,o=null,c=!1;const u=[];l0(i)&&typeof fh=="function"&&(i=fh(i._payload)),R.Children.forEach(i,g=>{if(bO(g)){c=!0;const y=g;let S="child"in y.props?y.props.child:y.props.children;l0(S)&&typeof fh=="function"&&(S=fh(S._payload)),o=KH(y,S),u.push(o?.props?.children)}else u.push(g)}),o?o=R.cloneElement(o,void 0,u):!c&&R.Children.count(i)===1&&R.isValidElement(i)&&(o=i);const f=o?vO(o):void 0,h=Qt(r,f);if(!o){if(i||i===0)throw new Error(c?XH(t):YH(t));return i}const m=yO(s,o.props??{});return o.type!==R.Fragment&&(m.ref=r?h:f),R.cloneElement(o,m)});return e.displayName=`${t}.Slot`,e}ai(Ea,"createSlot");var gO=Symbol.for("radix.slottable");function WH(t){const e=ai(n=>"child"in n?n.children(n.child):n.children,"Slottable");return e.displayName=`${t}.Slottable`,e.__radixId=gO,e}ai(WH,"createSlottable");var KH=ai((t,e)=>{if("child"in t.props){const n=t.props.child;return R.isValidElement(n)?R.cloneElement(n,void 0,t.props.children(n.props.children)):null}return R.isValidElement(e)?e:null},"getSlottableElementFromSlottable");function yO(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]=(...c)=>{const u=s(...c);return i(...c),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}ai(yO,"mergeProps");function vO(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)}ai(vO,"getElementRef");function bO(t){return R.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===gO}ai(bO,"isSlottable");var ZH=Symbol.for("react.lazy");function l0(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===ZH&&"_payload"in t&&SO(t._payload)}ai(l0,"isLazyComponent");function SO(t){return typeof t=="object"&&t!==null&&"then"in t}ai(SO,"isPromiseLike");var YH=ai(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),XH=ai(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),fh=Cd[" use ".trim().toString()],JH=Object.defineProperty,QH=(t,e)=>JH(t,"name",{value:e,configurable:!0}),eU=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Sn=eU.reduce((t,e)=>{const n=Ea(`Primitive.${e}`),r=R.forwardRef((i,s)=>{const{asChild:o,...c}=i,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),C.jsx(u,{...c,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function wO(t,e){t&&mc.flushSync(()=>t.dispatchEvent(e))}QH(wO,"dispatchDiscreteCustomEvent");var tU=Object.defineProperty,nU=(t,e)=>tU(t,"name",{value:e,configurable:!0}),rU=R.forwardRef(nU(function(e,n){return C.jsx(Sn.label,{...e,ref:n,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}})},"Label")),XT=rU,iU=Object.defineProperty,gc=(t,e)=>iU(t,"name",{value:e,configurable:!0}),xO=!!(typeof window<"u"&&window.document&&window.document.createElement);function ln(t,e,{checkForDefaultPrevented:n=!0}={}){return gc(function(i){if(t?.(i),n===!1||!i||!i.defaultPrevented)return e?.(i)},"handleEvent")}gc(ln,"composeEventHandlers");function sU(t){if(!xO)throw new Error("Cannot access window outside of the DOM");return t?.ownerDocument?.defaultView??window}gc(sU,"getOwnerWindow");function c0(t){if(!xO)throw new Error("Cannot access document outside of the DOM");return t?.ownerDocument??document}gc(c0,"getOwnerDocument");function kO(t,e=!1){const{activeElement:n}=c0(t);if(!n?.nodeName)return null;if(CO(n)&&n.contentDocument)return kO(n.contentDocument.body,e);if(e){const r=n.getAttribute("aria-activedescendant");if(r){const i=c0(n).getElementById(r);if(i)return i}}return n}gc(kO,"getActiveElement");function CO(t){return t.tagName==="IFRAME"}gc(CO,"isFrame");var oU=Object.defineProperty,Br=(t,e)=>oU(t,"name",{value:e,configurable:!0});function aU(t,e){const n=R.createContext(e);n.displayName=t+"Context";const r=Br(s=>{const{children:o,...c}=s,u=R.useMemo(()=>c,Object.values(c));return C.jsx(n.Provider,{value:u,children:o})},"Provider");r.displayName=t+"Provider";function i(s,o={}){const{optional:c=!1}=o,u=R.useContext(n);if(u)return u;if(e!==void 0)return e;if(!c)throw new Error(`\`${s}\` must be used within \`${t}\``)}return Br(i,"useContext"),[r,i]}Br(aU,"createContext");function yc(t,e=[]){let n=[];function r(s,o){const c=R.createContext(o);c.displayName=s+"Context";const u=n.length;n=[...n,o];const f=Br(m=>{const{scope:g,children:y,...S}=m,w=g?.[t]?.[u]||c,x=R.useMemo(()=>S,Object.values(S));return C.jsx(w.Provider,{value:x,children:y})},"Provider");f.displayName=s+"Provider";function h(m,g,y={}){const{optional:S=!1}=y,w=g?.[t]?.[u]||c,x=R.useContext(w);if(x)return x;if(o!==void 0)return o;if(!S)throw new Error(`\`${m}\` must be used within \`${s}\``)}return Br(h,"useContext"),[f,h]}Br(r,"createContext");const i=Br(()=>{const s=n.map(o=>R.createContext(o));return Br(function(c){const u=c?.[t]||s;return R.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])},"useScope")},"createScope");return i.scopeName=t,[r,EO(i,...e)]}Br(yc,"createContextScope");function EO(...t){const e=t[0];if(t.length===1)return e;const n=Br(()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return Br(function(s){const o=r.reduce((c,{useScope:u,scopeName:f})=>{const m=u(s)[`__scope${f}`];return{...c,...m}},{});return R.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])},"useComposedScopes")},"createScope");return n.scopeName=e.scopeName,n}Br(EO,"composeContextScopes");var Zn=globalThis?.document?R.useLayoutEffect:()=>{},lU=Object.defineProperty,cU=(t,e)=>lU(t,"name",{value:e,configurable:!0}),JT=Cd[" useEffectEvent ".trim().toString()],QT=Cd[" useInsertionEffect ".trim().toString()];function TO(t){if(typeof JT=="function")return JT(t);const e=R.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof QT=="function"?QT(()=>{e.current=t}):Zn(()=>{e.current=t}),R.useMemo(()=>((...n)=>e.current?.(...n)),[])}cU(TO,"useEffectEvent");var uU=Object.defineProperty,Ld=(t,e)=>uU(t,"name",{value:e,configurable:!0}),dU=Cd[" useInsertionEffect ".trim().toString()]||Zn;function xp({prop:t,defaultProp:e,onChange:n=Ld(()=>{},"onChange"),caller:r}){const[i,s,o]=_O({defaultProp:e,onChange:n}),c=t!==void 0,u=c?t:i,f=R.useCallback(h=>{if(c){const m=AO(h)?h(t):h;m!==t&&o.current?.(m)}else s(h)},[c,t,s,o]);return[u,f]}Ld(xp,"useControllableState");function _O({defaultProp:t,onChange:e}){const[n,r]=R.useState(t),i=R.useRef(n),s=R.useRef(e);return dU(()=>{s.current=e},[e]),R.useEffect(()=>{i.current!==n&&(s.current?.(n),i.current=n)},[n,i]),[n,r,s]}Ld(_O,"useUncontrolledState");function AO(t){return typeof t=="function"}Ld(AO,"isFunction");var e_=Symbol("RADIX:SYNC_STATE");function fU(t,e,n,r){const{prop:i,defaultProp:s,onChange:o,caller:c}=e,u=i!==void 0,f=TO(o),h=[{...n,state:s}];r&&h.push(r);const[m,g]=R.useReducer((x,k)=>{if(k.type===e_)return{...x,state:k.state};const T=t(x,k);return u&&!Object.is(T.state,x.state)&&f(T.state),T},...h),y=m.state,S=R.useRef(y);R.useEffect(()=>{S.current!==y&&(S.current=y,u||f(y))},[y,S,u]);const w=R.useMemo(()=>i!==void 0?{...m,state:i}:m,[m,i]);return R.useEffect(()=>{u&&!Object.is(i,m.state)&&g({type:e_,state:i})},[i,m.state,u]),[w,g]}Ld(fU,"useControllableStateReducer");var hU=Object.defineProperty,pU=(t,e)=>hU(t,"name",{value:e,configurable:!0});function JS(t){const[e,n]=R.useState(void 0);return Zn(()=>{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,c;if("borderBoxSize"in s){const u=s.borderBoxSize,f=Array.isArray(u)?u[0]:u;o=f.inlineSize,c=f.blockSize}else o=t.offsetWidth,c=t.offsetHeight;n({width:o,height:c})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}pU(JS,"useSize");var mU=Object.defineProperty,Eo=(t,e)=>mU(t,"name",{value:e,configurable:!0}),QS="Switch",[gU,gQ]=yc(QS),[yU,ew]=gU(QS);function RO(t){const{__scopeSwitch:e,checked:n,children:r,defaultChecked:i,disabled:s,form:o,name:c,onCheckedChange:u,required:f,value:h="on",internal_do_not_use_render:m}=t,[g,y]=xp({prop:n,defaultProp:i??!1,onChange:u,caller:QS}),[S,w]=R.useState(null),[x,k]=R.useState(null),T=R.useRef(!1),[A,_]=R.useReducer(I=>I+1,0),O=S?!!o||!!S.closest("form"):!0,N={checked:g,setChecked:y,disabled:s,control:S,setControl:w,name:c,form:o,value:h,hasConsumerStoppedPropagationRef:T,userInteractionCount:A,onUserInteraction:_,required:f,defaultChecked:i,isFormControl:O,bubbleInput:x,setBubbleInput:k};return C.jsx(yU,{scope:e,...N,children:MO(m)?m(N):r})}Eo(RO,"SwitchProvider");var vU="SwitchTrigger",bU=R.forwardRef(Eo(function({__scopeSwitch:e,onClick:n,...r},i){const{control:s,form:o,value:c,disabled:u,checked:f,required:h,setControl:m,setChecked:g,hasConsumerStoppedPropagationRef:y,onUserInteraction:S,isFormControl:w,bubbleInput:x}=ew(vU,e),k=Qt(i,m),T=R.useRef(f);return R.useEffect(()=>{const A=o?s?.ownerDocument.getElementById(o):s?.form;if(A instanceof HTMLFormElement){const _=Eo(()=>g(T.current),"reset");return A.addEventListener("reset",_),()=>A.removeEventListener("reset",_)}},[s,o,g]),C.jsx(Sn.button,{type:"button",role:"switch","aria-checked":f,"aria-required":h,"data-state":tw(f),"data-disabled":u?"":void 0,disabled:u,value:c,...r,ref:k,onClick:ln(n,A=>{S(),g(_=>!_),x&&w&&(y.current=A.isPropagationStopped(),y.current||A.stopPropagation())})})},"SwitchTrigger")),SU=R.forwardRef(Eo(function(e,n){const{__scopeSwitch:r,name:i,checked:s,defaultChecked:o,required:c,disabled:u,value:f,onCheckedChange:h,form:m,...g}=e;return C.jsx(RO,{__scopeSwitch:r,checked:s,defaultChecked:o,disabled:u,required:c,onCheckedChange:h,name:i,form:m,value:f,internal_do_not_use_render:({isFormControl:y})=>C.jsxs(C.Fragment,{children:[C.jsx(bU,{...g,ref:n,__scopeSwitch:r}),y&&C.jsx(CU,{__scopeSwitch:r})]})})},"Switch")),wU="SwitchThumb",xU=R.forwardRef(Eo(function(e,n){const{__scopeSwitch:r,...i}=e,s=ew(wU,r);return C.jsx(Sn.span,{"data-state":tw(s.checked),"data-disabled":s.disabled?"":void 0,...i,ref:n})},"SwitchThumb")),kU="SwitchBubbleInput",CU=R.forwardRef(Eo(function({__scopeSwitch:e,onClick:n,...r},i){const{control:s,hasConsumerStoppedPropagationRef:o,userInteractionCount:c,checked:u,defaultChecked:f,required:h,disabled:m,name:g,value:y,form:S,bubbleInput:w,setBubbleInput:x}=ew(kU,e),k=Qt(i,x),T=JS(s),A=R.useRef(!1),_=R.useRef(u),O=R.useRef(c);R.useEffect(()=>{const I=w;if(!I)return;const z=window.HTMLInputElement.prototype,Z=Object.getOwnPropertyDescriptor(z,"checked").set,ae=c!==O.current;O.current=c;const X=_.current!==u;_.current=u;const te=!(ae&&o.current);if(X&&Z){A.current=!ae;const ie=new Event("click",{bubbles:te});Z.call(I,u),I.dispatchEvent(ie),A.current=!1}},[w,u,o,c]);const N=R.useRef(u);return C.jsx(Sn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??N.current,required:h,disabled:m,name:g,value:y,form:S,...r,tabIndex:-1,ref:k,onClick:ln(n,I=>{A.current&&I.stopPropagation()}),style:{...r.style,...T,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function MO(t){return typeof t=="function"}Eo(MO,"isFunction");function tw(t){return t?"checked":"unchecked"}Eo(tw,"getState");function OO({name:t,label:e,form:n}){const r=n.watch(t)!==!1;return R.useEffect(()=>{n.register(t)},[n,t]),C.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?C.jsx(EU,{}):C.jsx(TU,{})})}function EU(){return C.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:[C.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"}),C.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function TU(){return C.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:[C.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"}),C.jsx("path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}),C.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"}),C.jsx("path",{d:"m2 2 20 20"})]})}const _U=/(cents|priceCents|amountCents)/i,t_=/(price|amount|cost|total|msrp)/i;function nw(t,e){return _U.test(t)||/cents/i.test(e?.label??"")}function NO(t,e){return nw(t,e)?!0:t_.test(t)||t_.test(e?.label??"")}function DO(t,e){return e?t/100:t}function AU(t,e){return e?Math.round(t*100):t}function u0(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 Lv(t,e=!0){return typeof t!="number"||!Number.isFinite(t)?"":DO(t,e).toFixed(2)}function RU(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 AU(r,e)}var Pv={exports:{}},zv={};var n_;function MU(){if(n_)return zv;n_=1;var t=kd();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 c(m,g){var y=g(),S=r({inst:{value:y,getSnapshot:g}}),w=S[0].inst,x=S[1];return s(function(){w.value=y,w.getSnapshot=g,u(w)&&x({inst:w})},[m,y,g]),i(function(){return u(w)&&x({inst:w}),m(function(){u(w)&&x({inst:w})})},[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:c;return zv.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:h,zv}var r_;function IO(){return r_||(r_=1,Pv.exports=MU()),Pv.exports}var LO=IO();function Rn(t){this.content=t}Rn.prototype={constructor:Rn,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 Rn(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 Rn(n)},addToStart:function(t,e){return new Rn([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Rn(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 Rn(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=Rn.from(t),t.size?new Rn(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Rn.from(t),t.size?new Rn(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Rn.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}};Rn.from=function(t){if(t instanceof Rn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Rn(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,c=s.text,u=0;for(;o[u]==c[u];u++)n++;return u&&u<o.length&&u<c.length&&BO(o.charCodeAt(u-1))&&jO(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 zO(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),c=e.child(--s),u=o.nodeSize;if(o==c){n-=u,r-=u;continue}if(!o.sameMarkup(c))return{a:n,b:r};if(o.isText&&o.text!=c.text){let f=o.text,h=c.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&&BO(f.charCodeAt(m-1))&&jO(f.charCodeAt(m))&&(n++,r++),{a:n,b:r}}if(o.content.size||c.content.size){let f=zO(o.content,c.content,n-1,r-1);if(f)return f}n-=u,r-=u}}function jO(t){return t>=56320&&t<57344}function BO(t){return t>=55296&&t<56320}class ne{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,c=0;c<n;o++){let u=this.content[o],f=c+u.nodeSize;if(f>e&&r(u,i+c,s||null,o)!==!1&&u.content.size){let h=c+1;u.nodesBetween(Math.max(0,e-h),Math.min(u.content.size,n-h),r,i+h)}c=f}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(c,u)=>{let f=c.isText?c.text.slice(Math.max(e,u)-u,n-u):c.isLeaf?i?typeof i=="function"?i(c):i:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&f||c.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 ne(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 c=this.content[s],u=o+c.nodeSize;u>e&&((o<e||u>n)&&(c.isText?c=c.cut(Math.max(0,e-o),Math.min(c.text.length,n-o)):c=c.cut(Math.max(0,e-o-1),Math.min(c.content.size,n-o-1))),r.push(c),i+=c.nodeSize),o=u}return new ne(r,i)}cutByIndex(e,n){return e==n?ne.empty:e==0&&n==this.content.length?this:new ne(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 ne(i,s)}addToStart(e){return new ne([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ne(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 zO(this,e,n,r)}findIndex(e){if(e==0)return hh(0,e);if(e==this.size)return hh(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?hh(n+1,s):hh(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 ne.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return ne.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ne.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 ne(n||e,r)}static from(e){if(!e)return ne.empty;if(e instanceof ne)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new ne([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}ne.empty=new ne([],0);const jv={index:0,offset:0};function hh(t,e){return jv.index=t,jv.offset=e,jv}function kp(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(!kp(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!kp(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Rt=class d0{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&&kp(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 d0.none;if(e instanceof d0)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};Rt.none=[];class ud extends Error{}class ve{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=VO(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new ve(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ve($O(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 ve.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 ve(ne.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 ve(e,r,i)}}ve.empty=new ve(ne.empty,0,0);function $O(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:c}=t.findIndex(n);if(i==e||s.isText){if(c!=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($O(s.content,e-i-1,n-i-1)))}function VO(t,e,n,r,i,s){let{index:o,offset:c}=t.findIndex(e),u=t.maybeChild(o);if(c==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=VO(u.content,e-c-1,n,o==0?r-1:0,o==t.childCount-1?i-1:0,u);return f&&t.replaceChild(o,u.copy(f))}function OU(t,e,n){if(n.openStart>t.depth)throw new ud("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new ud("Inconsistent open depths");return HO(t,e,n,0)}function HO(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=HO(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,c=o.content;return va(o,c.cut(0,t.parentOffset).append(n.content).append(c.cut(e.parentOffset)))}else{let{start:o,end:c}=NU(n,t);return va(s,FO(t,o,c,e,r))}else return va(s,Cp(t,e,r))}function UO(t,e){if(!e.type.compatibleContent(t.type))throw new ud("Cannot join "+e.type.name+" onto "+t.type.name)}function f0(t,e,n){let r=t.node(n);return UO(r,e.node(n)),r}function ya(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 Hu(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&&(ya(t.nodeAfter,r),s++));for(let c=s;c<o;c++)ya(i.child(c),r);e&&e.depth==n&&e.textOffset&&ya(e.nodeBefore,r)}function va(t,e){if(!t.type.validContent(e))throw new ud("Invalid content for node "+t.type.name);return t.copy(e)}function FO(t,e,n,r,i){let s=t.depth>i&&f0(t,e,i+1),o=r.depth>i&&f0(n,r,i+1),c=[];return Hu(null,t,i,c),s&&o&&e.index(i)==n.index(i)?(UO(s,o),ya(va(s,FO(t,e,n,r,i+1)),c)):(s&&ya(va(s,Cp(t,e,i+1)),c),Hu(e,n,i,c),o&&ya(va(o,Cp(n,r,i+1)),c)),Hu(r,null,i,c),new ne(c)}function Cp(t,e,n){let r=[];if(Hu(null,t,n,r),t.depth>n){let i=f0(t,e,n+1);ya(va(i,Cp(t,e,n+1)),r)}return Hu(e,null,n,r),new ne(r)}function NU(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(ne.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class dd{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 Rt.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let c=r;r=i,i=c}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 Ep(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:c,offset:u}=o.content.findIndex(s),f=s-u;if(r.push(o,c,i+u),!f||(o=o.child(c),o.isText))break;s=f-1,i+=u+1}return new dd(n,r,s)}static resolveCached(e,n){let r=i_.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 i_.set(e,r=new DU);let i=r.elts[r.i]=dd.resolve(e,n);return r.i=(r.i+1)%IU,i}}class DU{constructor(){this.elts=[],this.i=0}}const IU=12,i_=new WeakMap;class Ep{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 LU=Object.create(null);let yo=class h0{constructor(e,n,r,i=Rt.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||ne.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&&kp(this.attrs,n||e.defaultAttrs||LU)&&Rt.sameSet(this.marks,r||Rt.none)}copy(e=null){return e==this.content?this:new h0(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new h0(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 ve.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),c=i.start(o),f=i.node(o).content.cut(i.pos-c,s.pos-c);return new ve(f,i.depth-o,s.depth-o)}replace(e,n,r){return OU(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 dd.resolveCached(this,e)}resolveNoCache(e){return dd.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()+")"),qO(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=ne.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),c=o&&o.matchFragment(this.content,n);if(!c||!c.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=Rt.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(!Rt.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=ne.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};yo.prototype.text=void 0;class Tp extends yo{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):qO(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 Tp(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Tp(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 qO(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Ta{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new PU(e,n);if(r.next==null)return Ta.empty;let i=GO(r);r.next&&r.err("Unexpected trailing text");let s=UU(HU(i));return FU(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,c){let u=o.matchFragment(e,r);if(u&&(!n||u.validEnd))return ne.from(c.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,c.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 c=i;c.type;c=c.via)o.push(c.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:c,next:u}=s.next[o];!c.isLeaf&&!c.hasRequiredAttrs()&&!(c.name in n)&&(!i.type||u.validEnd)&&(r.push({match:c.contentMatch,type:c,via:i}),n[c.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
|
-
`)}}Ta.empty=new Ta(!0);class PU{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 GO(t){let e=[];do e.push(zU(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function zU(t){let e=[];do e.push(jU(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function jU(t){let e=VU(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=BU(t,e);else break;return e}function s_(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function BU(t,e){let n=s_(t),r=n;return t.eat(",")&&(t.next!="}"?r=s_(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function $U(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 VU(t){if(t.eat("(")){let e=GO(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=$U(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 HU(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,c,u){let f={term:u,to:c};return e[o].push(f),f}function i(o,c){o.forEach(u=>u.to=c)}function s(o,c){if(o.type=="choice")return o.exprs.reduce((u,f)=>u.concat(s(f,c)),[]);if(o.type=="seq")for(let u=0;;u++){let f=s(o.exprs[u],c);if(u==o.exprs.length-1)return f;i(f,c=n())}else if(o.type=="star"){let u=n();return r(c,u),i(s(o.expr,u),u),[r(u)]}else if(o.type=="plus"){let u=n();return i(s(o.expr,c),u),i(s(o.expr,u),u),[r(u)]}else{if(o.type=="opt")return[r(c)].concat(s(o.expr,c));if(o.type=="range"){let u=c;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(c,void 0,o.value)];throw new Error("Unknown expr type")}}}}function WO(t,e){return e-t}function o_(t,e){let n=[];return r(e),n.sort(WO);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:c,to:u}=s[o];!c&&n.indexOf(u)==-1&&r(u)}}}function UU(t){let e=Object.create(null);return n(o_(t,0));function n(r){let i=[];r.forEach(o=>{t[o].forEach(({term:c,to:u})=>{if(!c)return;let f;for(let h=0;h<i.length;h++)i[h][0]==c&&(f=i[h][1]);o_(t,u).forEach(h=>{f||i.push([c,f=[]]),f.indexOf(h)==-1&&f.push(h)})})});let s=e[r.join(",")]=new Ta(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let c=i[o][1].sort(WO);s.next.push({type:i[o][0],next:e[c.join(",")]||n(c)})}return s}}function FU(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let c=0;c<i.next.length;c++){let{type:u,next:f}=i.next[c];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 KO(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 ZO(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 YO(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 XO(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new GU(t,r,e[r]);return n}let a_=class JO{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=XO(e,r.attrs),this.defaultAttrs=KO(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==Ta.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:ZO(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new yo(this,this.computeAttrs(e),ne.from(n),Rt.setFrom(r))}createChecked(e=null,n,r){return n=ne.from(n),this.checkContent(n),new yo(this,this.computeAttrs(e),n,Rt.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=ne.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(ne.empty,!0);return s?new yo(this,e,n.append(s),Rt.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){YO(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:Rt.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new JO(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 qU(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 GU{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?qU(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Om{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=XO(e,i.attrs),this.excluded=null;let s=KO(this.attrs);this.instance=s?new Rt(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Rt(this,ZO(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new Om(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){YO(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class QO{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=Rn.from(e.nodes),n.marks=Rn.from(e.marks||{}),this.nodes=a_.compile(this.spec.nodes,this),this.marks=Om.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||"",c=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=Ta.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=c=="_"?null:c?l_(this,c.split(" ")):c==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:l_(this,o.split(" "))}this.nodeFromJSON=i=>yo.fromJSON(this,i),this.markFromJSON=i=>Rt.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 a_){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 Tp(r,r.defaultAttrs,e,Rt.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 l_(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 c in t.marks){let u=t.marks[c];(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 WU(t){return t.tag!=null}function KU(t){return t.style!=null}class us{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(WU(i))this.tags.push(i);else if(KU(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 u_(this,n,!1);return r.addAll(e,Rt.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new u_(this,n,!0);return r.addAll(e,Rt.none,n.from,n.to),ve.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(XU(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],c=o.style;if(!(c.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||c.length>e.length&&(c.charCodeAt(e.length)!=61||c.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 c=n[o];if((c.priority==null?50:c.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=d_(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=d_(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new us(e,us.schemaRules(e)))}}const eN={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},ZU={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},tN={ol:!0,ul:!0},fd=1,p0=2,Uu=4;function c_(t,e,n){return e!=null?(e?fd:0)|(e==="full"?p0:0):t&&t.whitespace=="pre"?fd|p0:n&~Uu}class ph{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=Rt.none,this.match=s||(o&Uu?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ne.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&fd)){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=ne.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(ne.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&&!eN.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class u_{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=c_(null,n.preserveWhitespace,0)|(r?Uu:0);i?s=new ph(i.type,i.attrs,Rt.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new ph(null,null,Rt.none,!0,null,o):s=new ph(e.schema.topNodeType,null,Rt.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&p0?"full":this.localPreserveWS||(i.options&fd)>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 c=r.split(/\r?\n|\r/);for(let u=0;u<c.length;u++)u&&this.insertNode(o.linebreakReplacement.create(),n,!0),c[u]&&this.insertNode(o.text(c[u]),n,!/\S/.test(c[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 c=i.content[i.content.length-1],u=e.previousSibling;(!c||u&&u.nodeName=="BR"||c.isText&&/[ \t\r\n\u000c]$/.test(c.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(),c;tN.hasOwnProperty(o)&&this.parser.normalizeLists&&YU(e);let u=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(c=this.parser.matchTag(e,this,r));e:if(u?u.ignore:ZU.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(eN.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?c: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 c=void 0;;){let u=this.parser.matchStyle(s,o,this,c);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)c=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 c=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(c)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,c=i==null?null:e.childNodes[i];o!=c;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,c=0;o>=0;o--){let u=this.nodes[o],f=u.findWrapping(e);if(f&&(!i||i.length>f.length+c)&&(i=f,s=u,!f.length))break;if(u.solid){if(r)break;c+=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=Rt.none;for(let c of i.concat(e.marks))(s.type?s.type.allowsMarkType(c.type):f_(c.type,e.type))&&(o=c.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 c=c_(e,s,o.options);o.options&Uu&&o.content.length==0&&(c|=Uu);let u=Rt.none;return r=r.filter(f=>(o.type?o.type.allowsMarkType(f.type):f_(f.type,e))?(u=f.addToSet(u),!1):!0),this.nodes.push(new ph(e,n,u,i,null,c)),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|=fd)}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=(c,u)=>{for(;c>=0;c--){let f=n[c];if(f==""){if(c==n.length-1||c==0)continue;for(;u>=s;u--)if(o(c-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 YU(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&tN.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function XU(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function d_(t){let e={};for(let n in t)e[n]=t[n];return e}function f_(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=c=>{s.push(c);for(let u=0;u<c.edgeCount;u++){let{type:f,next:h}=c.edge(u);if(f==e||s.indexOf(h)<0&&o(h))return!0}};if(o(i.contentMatch))return!0}}class Ba{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=mh(n).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let c=0,u=0;for(;c<s.length&&u<o.marks.length;){let f=o.marks[u];if(!this.marks[f.type.name]){u++;continue}if(!f.eq(s[c][0])||f.type.spec.spanning===!1)break;c++,u++}for(;c<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 mh(n).createTextNode(e.text);let{dom:r,contentDOM:i}=Zh(mh(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&&Zh(mh(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return typeof n=="string"?{dom:e.createTextNode(n)}:Zh(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ba(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=h_(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return h_(e.marks)}}function h_(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function mh(t){return t.document||window.document}const p_=new WeakMap;function JU(t){let e=p_.get(t);return e===void 0&&p_.set(t,e=QU(t)),e}function QU(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 Zh(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=JU(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 c,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:S}=Zh(t,g,n,r);if(u.appendChild(y),S){if(c)throw new RangeError("Multiple content holes");c=S}}}return{dom:u,contentDOM:c}}const nN=65535,rN=Math.pow(2,16);function eF(t,e){return t+e*rN}function m_(t){return t&nN}function tF(t){return(t-(t&nN))/rN}const iN=1,sN=2,Yh=4,oN=8;class m0{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&oN)>0}get deletedBefore(){return(this.delInfo&(iN|Yh))>0}get deletedAfter(){return(this.delInfo&(sN|Yh))>0}get deletedAcross(){return(this.delInfo&Yh)>0}}class wr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&wr.empty)return wr.empty}recover(e){let n=0,r=m_(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+tF(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 c=0;c<this.ranges.length;c+=3){let u=this.ranges[c]-(this.inverted?i:0);if(u>e)break;let f=this.ranges[c+s],h=this.ranges[c+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 S=e==(n<0?u:m)?null:eF(c/3,e-u),w=e==u?sN:e==m?iN:Yh;return(n<0?e!=u:e!=m)&&(w|=oN),new m0(y,w,S)}i+=h-f}return r?e+i:new m0(e+i,0,null)}touches(e,n){let r=0,i=m_(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let u=this.ranges[c]-(this.inverted?r:0);if(u>e)break;let f=this.ranges[c+s],h=u+f;if(e<=h&&c==i*3)return!0;r+=this.ranges[c+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],c=o-(this.inverted?s:0),u=o+(this.inverted?0:s),f=this.ranges[i+n],h=this.ranges[i+r];e(c,c+f,u,u+h),s+=h-f}}invert(){return new wr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?wr.empty:new wr(e<0?[0,-e,0]:[0,0,e])}}wr.empty=new wr([]);class hd{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 hd(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 hd;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],c=o.mapResult(e,n);if(c.recover!=null){let u=this.getMirror(s);if(u!=null&&u>s&&u<this.to){s=u,e=this._maps[u].recover(c.recover);continue}}i|=c.delInfo,e=c.pos}return r?e:new m0(e,i,null)}}const Bv=Object.create(null);class Hn{getMap(){return wr.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Bv[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 Bv)throw new RangeError("Duplicate use of step JSON ID "+e);return Bv[e]=n,n.prototype.jsonID=e,n}}class un{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new un(e,null)}static fail(e){return new un(null,e)}static fromReplace(e,n,r,i){try{return un.ok(e.replace(n,r,i))}catch(s){if(s instanceof ud)return un.fail(s.message);throw s}}}function rw(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(rw(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return ne.fromArray(r)}class uo extends Hn{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 ve(rw(n.content,(o,c)=>!o.isAtom||!c.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return un.fromReplace(e,this.from,this.to,s)}invert(){return new ri(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 uo(n.pos,r.pos,this.mark)}merge(e){return e instanceof uo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new uo(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 uo(n.from,n.to,e.markFromJSON(n.mark))}}Hn.jsonID("addMark",uo);class ri extends Hn{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 ve(rw(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return un.fromReplace(e,this.from,this.to,r)}invert(){return new uo(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 ri(n.pos,r.pos,this.mark)}merge(e){return e instanceof ri&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ri(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 ri(n.from,n.to,e.markFromJSON(n.mark))}}Hn.jsonID("removeMark",ri);class fo extends Hn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return un.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return un.fromReplace(e,this.pos,this.pos+1,new ve(ne.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 fo(this.pos,n.marks[i]);return new fo(this.pos,this.mark)}}return new _a(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new fo(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 fo(n.pos,e.markFromJSON(n.mark))}}Hn.jsonID("addNodeMark",fo);class _a extends Hn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return un.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return un.fromReplace(e,this.pos,this.pos+1,new ve(ne.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new fo(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new _a(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 _a(n.pos,e.markFromJSON(n.mark))}}Hn.jsonID("removeNodeMark",_a);class cn extends Hn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&g0(e,this.from,this.to)?un.fail("Structure replace would overwrite content"):un.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new wr([this.from,this.to-this.from,this.slice.size])}invert(e){return new cn(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&&cn.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new cn(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof cn)||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?ve.empty:new ve(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new cn(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?ve.empty:new ve(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new cn(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 cn(n.from,n.to,ve.fromJSON(e,n.slice),!!n.structure)}}cn.MAP_BIAS=1;Hn.jsonID("replace",cn);class vn extends Hn{constructor(e,n,r,i,s,o,c=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=c}apply(e){if(this.structure&&(g0(e,this.from,this.gapFrom)||g0(e,this.gapTo,this.to)))return un.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return un.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?un.fromReplace(e,this.from,this.to,r):un.fail("Content does not fit in gap")}getMap(){return new wr([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,ve.fromJSON(e,n.slice),n.insert,!!n.structure)}}Hn.jsonID("replaceAround",vn);function g0(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 nF(t,e,n,r){let i=[],s=[],o,c;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),S=r.addToSet(m);for(let w=0;w<m.length;w++)m[w].isInSet(S)||(o&&o.to==g&&o.mark.eq(m[w])?o.to=y:i.push(o=new ri(g,y,m[w])));c&&c.to==g?c.to=y:s.push(c=new uo(g,y,r))}}),i.forEach(u=>t.step(u)),s.forEach(u=>t.step(u))}function rF(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,c)=>{if(!o.isInline)return;s++;let u=null;if(r instanceof Om){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(c+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 S=i[y];S.step==s-1&&m.eq(i[y].style)&&(g=S)}g?(g.to=f,g.step=s):i.push({style:m,from:Math.max(c,e),to:f,step:s})}}}),i.forEach(o=>t.step(new ri(o.from,o.to,o.style)))}function iw(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],c=e+1;for(let u=0;u<s.childCount;u++){let f=s.child(u),h=c+f.nodeSize,m=r.matchType(f.type);if(!m)o.push(new cn(c,h,ve.empty));else{r=m;for(let g=0;g<f.marks.length;g++)n.allowsMarkType(f.marks[g].type)||t.step(new ri(c,h,f.marks[g]));if(i&&f.isText&&n.whitespace!="pre"){let g,y=/\r?\n|\r/g,S;for(;g=y.exec(f.text);)S||(S=new ve(ne.from(n.schema.text(" ",n.allowedMarks(f.marks))),0,0)),o.push(new cn(c+g.index,c+g.index+g[0].length,S))}}c=h}if(!r.validEnd){let u=r.fillBefore(ne.empty,!0);t.replace(c,c,new ve(u,0,0))}for(let u=o.length-1;u>=0;u--)t.step(o[u])}function iF(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function vc(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),c=t.$from.index(r)+i,u=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(c,u,n))return r;if(r==0||o.type.spec.isolating||!iF(o,c,u))break;c&&(i=1),u<o.childCount&&(s=1)}return null}function sF(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),c=i.after(s+1),u=o,f=c,h=ne.empty,m=0;for(let S=s,w=!1;S>n;S--)w||r.index(S)>0?(w=!0,h=ne.from(r.node(S).copy(h)),m++):u--;let g=ne.empty,y=0;for(let S=s,w=!1;S>n;S--)w||i.after(S+1)<i.end(S)?(w=!0,g=ne.from(i.node(S).copy(g)),y++):f++;t.step(new vn(u,f,o,c,new ve(h.append(g),m,y),h.size-m,!0))}function sw(t,e,n=null,r=t){let i=oF(t,e),s=i&&aF(r,e);return s?i.map(g_).concat({type:e,attrs:n}).concat(s.map(g_)):null}function g_(t){return{type:t,attrs:null}}function oF(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 aF(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 lF(t,e,n){let r=ne.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let c=n[o].type.contentMatch.matchFragment(r);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=ne.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 ve(r,0,0),n.length,!0))}function cF(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,c)=>{let u=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,u)&&uF(t.doc,t.mapping.slice(s).map(c),r)){let f=null;if(r.schema.linebreakReplacement){let y=r.whitespace=="pre",S=!!r.contentMatch.matchType(r.schema.linebreakReplacement);y&&!S?f=!1:!y&&S&&(f=!0)}f===!1&&lN(t,o,c,s),iw(t,t.mapping.slice(s).map(c,1),r,void 0,f===null);let h=t.mapping.slice(s),m=h.map(c,1),g=h.map(c+o.nodeSize,1);return t.step(new vn(m,g,m+1,g-1,new ve(ne.from(r.create(u,null,o.marks)),0,0),1,!0)),f===!0&&aN(t,o,c,s),!1}})}function aN(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,c=/\r?\n|\r/g;for(;o=c.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 lN(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 uF(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function dF(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 ve(ne.from(o),0,0),1,!0))}function ds(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),S=r&&r[h+1];S&&(y=y.replaceChild(0,S.type.create(S.attrs)));let w=r&&r[h]||m;if(!m.canReplace(g+1,m.childCount)||!w.type.validContent(y))return!1}let c=i.indexAfter(s),u=r&&r[0];return i.node(s).canReplaceWith(c,c,u?u.type:i.node(s+1).type)}function fF(t,e,n=1,r){let i=t.doc.resolve(e),s=ne.empty,o=ne.empty;for(let c=i.depth,u=i.depth-n,f=n-1;c>u;c--,f--){s=ne.from(i.node(c).copy(s));let h=r&&r[f];o=ne.from(h?h.type.create(h.attrs,o):i.node(c).copy(o))}t.step(new cn(e,e,new ve(s.append(o),n,n),!0))}function Io(t,e){let n=t.resolve(e),r=n.index();return cN(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function hF(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 cN(t,e){return!!(t&&e&&!t.isLeaf&&hF(t,e))}function Nm(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,o,c=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):n>0?(s=r.node(i+1),c++,o=r.node(i).maybeChild(c)):(s=r.node(i).maybeChild(c-1),o=r.node(i+1)),s&&!s.isTextblock&&cN(s,o)&&r.node(i).canReplace(c,c+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function pF(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 c=t.steps.length;if(r===!1){let h=t.doc.resolve(e+n);lN(t,h.node(),h.before(),c)}o.inlineContent&&iw(t,e+n-1,o,s.node().contentMatchAt(s.index()),r==null);let u=t.mapping.slice(c),f=u.map(e-n);if(t.step(new cn(f,u.map(e+n,-1),ve.empty,!0)),r===!0){let h=t.doc.resolve(f);aN(t,h.node(),h.before(),t.steps.length)}return t}function mF(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 uN(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 c=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,u=r.index(o)+(c>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 c==0?r.pos:c<0?r.before(o+1):r.after(o+1)}return null}function Dm(t,e,n=e,r=ve.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return dN(i,s,r)?new cn(e,n,r):new gF(i,s,r).fit()}function dN(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class gF{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=ne.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=ne.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,c=i.depth;for(;o&&c&&s.childCount==1;)s=s.firstChild.content,o--,c--;let u=new ve(s,o,c);return e>-1?new vn(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new cn(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=$v(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let c=this.depth;c>=0;c--){let{type:u,match:f}=this.frontier[c],h,m=null;if(n==1&&(o?f.matchType(o.type)||(m=f.fillBefore(ne.from(o),!1)):s&&u.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:c,parent:s,inject:m};if(n==2&&o&&(h=f.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:c,parent:s,wrap:h};if(s&&f.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=$v(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new ve(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=$v(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new ve(Mu(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new ve(Mu(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 w=0;w<s.length;w++)this.openFrontierNode(s[w]);let o=this.unplaced,c=r?r.content:o.content,u=o.openStart-e,f=0,h=[],{match:m,type:g}=this.frontier[n];if(i){for(let w=0;w<i.childCount;w++)h.push(i.child(w));m=m.matchFragment(i)}let y=c.size+e-(o.content.size-o.openEnd);for(;f<c.childCount;){let w=c.child(f),x=m.matchType(w.type);if(!x)break;f++,(f>1||u==0||w.content.size)&&(m=x,h.push(fN(w.mark(g.allowedMarks(w.marks)),f==1?u:0,f==c.childCount?y:-1)))}let S=f==c.childCount;S||(y=-1),this.placed=Ou(this.placed,n,ne.from(h)),this.frontier[n].match=m,S&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let w=0,x=c;w<y;w++){let k=x.lastChild;this.frontier.push({type:k.type,match:k.contentMatchAt(k.childCount)}),x=k.content}this.unplaced=S?e==0?ve.empty:new ve(Mu(o.content,e-1,1),e-1,y<0?o.openEnd:e-1):new ve(Mu(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||!Vv(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=Vv(e,n,i,r,s);if(o){for(let c=n-1;c>=0;c--){let{match:u,type:f}=this.frontier[c],h=Vv(e,c,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=Ou(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=Ou(this.placed,this.depth,ne.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(ne.empty,!0);n.childCount&&(this.placed=Ou(this.placed,this.frontier.length,n))}}function Mu(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Mu(t.firstChild.content,e-1,n)))}function Ou(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Ou(t.lastChild.content,e-1,n)))}function $v(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function fN(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,fN(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(ne.empty,!0)))),t.copy(r)}function Vv(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 c=r.fillBefore(s.content,!0,o);return c&&!yF(n,s.content,o)?c:null}function yF(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function vF(t){return t.spec.defining||t.spec.definingForContent}function bF(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(dN(i,s,r))return t.step(new cn(e,n,r));let o=pN(i,s);o[o.length-1]==0&&o.pop();let c=-(i.depth+1);o.unshift(c);for(let g=i.depth,y=i.pos-1;g>0;g--,y--){let S=i.node(g).type.spec;if(S.defining||S.definingAsContext||S.isolating)break;o.indexOf(g)>-1?c=g:i.before(g)==y&&o.splice(1,0,-g)}let u=o.indexOf(c),f=[],h=r.openStart;for(let g=r.content,y=0;;y++){let S=g.firstChild;if(f.push(S),y==r.openStart)break;g=S.content}for(let g=h-1;g>=0;g--){let y=f[g],S=vF(y.type);if(S&&!y.sameMarkup(i.node(Math.abs(c)-1)))h=g;else if(S||!y.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let y=(g+h+1)%(r.openStart+1),S=f[y];if(S)for(let w=0;w<o.length;w++){let x=o[(w+u)%o.length],k=!0;x<0&&(k=!1,x=-x);let T=i.node(x-1),A=i.index(x-1);if(T.canReplaceWith(A,A,S.type,S.marks))return t.replace(i.before(x),k?s.after(x):n,new ve(hN(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 hN(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(hN(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(ne.empty,!0))}return t}function SF(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=mF(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new ve(ne.from(r),0,0))}function wF(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),c=!1;for(let u=r.depth;u>o;u--)r.node(u).type.spec.isolating&&(c=!0);for(let u=i.depth;u>o;u--)i.node(u).type.spec.isolating&&(c=!0);if(!c){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=pN(r,i);for(let o=0;o<s.length;o++){let c=s[o],u=o==s.length-1;if(u&&c==0||r.node(c).type.contentMatch.validEnd)return t.delete(r.start(c),i.end(c));if(c>0&&(u||r.node(c-1).canReplace(r.index(c-1),i.indexAfter(c-1))))return t.delete(r.before(c),i.after(c))}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 pN(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 ql extends Hn{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 un.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 un.fromReplace(e,this.pos,this.pos+1,new ve(ne.from(i),0,n.isLeaf?0:1))}getMap(){return wr.empty}invert(e){return new ql(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 ql(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 ql(n.pos,n.attr,n.value)}}Hn.jsonID("attr",ql);class pd extends Hn{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 un.ok(r)}getMap(){return wr.empty}invert(e){return new pd(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 pd(n.attr,n.value)}}Hn.jsonID("docAttr",pd);let ic=class extends Error{};ic=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};ic.prototype=Object.create(Error.prototype);ic.prototype.constructor=ic;ic.prototype.name="TransformError";class ow{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new hd}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new ic(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,c,u)=>{e=Math.min(e,c),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=ve.empty){let i=Dm(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new ve(ne.from(r),0,0))}delete(e,n){return this.replace(e,n,ve.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return bF(this,e,n,r),this}replaceRangeWith(e,n,r){return SF(this,e,n,r),this}deleteRange(e,n){return wF(this,e,n),this}lift(e,n){return sF(this,e,n),this}join(e,n=1){return pF(this,e,n),this}wrap(e,n){return lF(this,e,n),this}setBlockType(e,n=e,r,i=null){return cF(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return dF(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new ql(e,n,r)),this}setDocAttribute(e,n){return this.step(new pd(e,n)),this}addNodeMark(e,n){return this.step(new fo(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 Rt)n.isInSet(r.marks)&&this.step(new _a(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new _a(e,s)),i=s.removeFromSet(i);for(let c=o.length-1;c>=0;c--)this.step(o[c])}return this}split(e,n=1,r){return fF(this,e,n,r),this}addMark(e,n,r){return nF(this,e,n,r),this}removeMark(e,n,r){return rF(this,e,n,r),this}clearIncompatible(e,n,r){return iw(this,e,n,r),this}}const Hv=Object.create(null);class Ve{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new mN(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=ve.empty){let r=n.content.lastChild,i=null;for(let c=0;c<n.openEnd;c++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let c=0;c<o.length;c++){let{$from:u,$to:f}=o[c],h=e.mapping.slice(s);e.replaceRange(h.map(u.pos),h.map(f.pos),c?ve.empty:n),c==0&&b_(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:c}=i[s],u=e.mapping.slice(r),f=u.map(o.pos),h=u.map(c.pos);s?e.deleteRange(f,h):(e.replaceRangeWith(f,h,n),b_(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new Oe(e):zl(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?zl(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):zl(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 kr(e.node(0))}static atStart(e){return zl(e,e,0,0,1)||new kr(e)}static atEnd(e){return zl(e,e,e.content.size,e.childCount,-1)||new kr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Hv[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 Hv)throw new RangeError("Duplicate use of selection JSON ID "+e);return Hv[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Oe.between(this.$anchor,this.$head).getBookmark()}}Ve.prototype.visible=!0;class mN{constructor(e,n){this.$from=e,this.$to=n}}let y_=!1;function v_(t){!y_&&!t.parent.inlineContent&&(y_=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Oe extends Ve{constructor(e,n=e){v_(e),v_(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 Ve.near(r);let i=e.resolve(n.map(this.anchor));return new Oe(i.parent.inlineContent?i:r,r)}replace(e,n=ve.empty){if(super.replace(e,n),n==ve.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Oe&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Im(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 Oe(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=Ve.findFrom(n,r,!0)||Ve.findFrom(n,-r,!0);if(s)n=s.$head;else return Ve.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(Ve.findFrom(e,-r,!0)||Ve.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new Oe(e,n)}}Ve.jsonID("text",Oe);class Im{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Im(e.map(this.anchor),e.map(this.head))}resolve(e){return Oe.between(e.resolve(this.anchor),e.resolve(this.head))}}class De extends Ve{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?Ve.near(s):new De(s)}content(){return new ve(ne.from(this.node),0,0)}eq(e){return e instanceof De&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new aw(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new De(e.resolve(n.anchor))}static create(e,n){return new De(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}De.prototype.visible=!1;Ve.jsonID("node",De);class aw{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Im(r,r):new aw(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&De.isSelectable(r)?new De(n):Ve.near(n)}}class kr extends Ve{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=ve.empty){if(n==ve.empty){e.delete(0,e.doc.content.size);let r=Ve.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new kr(e)}map(e){return new kr(e)}eq(e){return e instanceof kr}getBookmark(){return xF}}Ve.jsonID("all",kr);const xF={map(){return this},resolve(t){return new kr(t)}};function zl(t,e,n,r,i,s=!1){if(e.inlineContent)return Oe.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let c=e.child(o);if(c.isAtom){if(!s&&De.isSelectable(c))return De.create(t,n-(i<0?c.nodeSize:0))}else{let u=zl(t,c,n+i,i<0?c.childCount:0,i,s);if(u)return u}n+=c.nodeSize*i}return null}function b_(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof cn||i instanceof vn))return;let s=t.mapping.maps[r],o;s.forEach((c,u,f,h)=>{o==null&&(o=h)}),t.setSelection(Ve.near(t.doc.resolve(o),n))}const S_=1,gh=2,w_=4;class kF extends ow{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|S_)&~gh,this.storedMarks=null,this}get selectionSet(){return(this.updated&S_)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=gh,this}ensureMarks(e){return Rt.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&gh)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~gh,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)||Rt.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(Ve.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|=w_,this}get scrolledIntoView(){return(this.updated&w_)>0}}function x_(t,e){return!e||!t?t:t.bind(e)}class Nu{constructor(e,n,r){this.name=e,this.init=x_(n.init,r),this.apply=x_(n.apply,r)}}const CF=[new Nu("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Nu("selection",{init(t,e){return t.selection||Ve.atStart(e.doc)},apply(t){return t.selection}}),new Nu("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Nu("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Uv{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=CF.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 Nu(r.key,r.spec.state,r))})}}class da{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 c=this.config.plugins[o];if(c.spec.appendTransaction){let u=i?i[o].n:0,f=i?i[o].state:this,h=u<n.length&&c.spec.appendTransaction.call(c,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 da(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 kF(this)}static create(e){let n=new Uv(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new da(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 Uv(this.schema,e.plugins),r=n.fields,i=new da(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 Uv(e.schema,e.plugins),s=new da(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=yo.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=Ve.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 c in r){let u=r[c],f=u.spec.state;if(u.key==o.name&&f&&f.fromJSON&&Object.prototype.hasOwnProperty.call(n,c)){s[o.name]=f.fromJSON.call(u,e,n[c],s);return}}s[o.name]=o.init(e,s)}}),s}}function gN(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=gN(i,e,{})),n[r]=i}return n}class Nt{constructor(e){this.spec=e,this.props={},e.props&&gN(e.props,this,this.props),this.key=e.key?e.key.key:yN("plugin")}getState(e){return e[this.key]}}const Fv=Object.create(null);function yN(t){return t in Fv?t+"$"+ ++Fv[t]:(Fv[t]=0,t+"$")}class Zt{constructor(e="key"){this.key=yN(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const vN=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function bN(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const SN=(t,e,n)=>{let r=bN(t,n);if(!r)return!1;let i=lw(r);if(!i){let o=r.blockRange(),c=o&&vc(o);return c==null?!1:(e&&e(t.tr.lift(o,c).scrollIntoView()),!0)}let s=i.nodeBefore;if(RN(t,i,e,-1))return!0;if(r.parent.content.size==0&&(sc(s,"end")||De.isSelectable(s)))for(let o=r.depth;;o--){let c=Dm(t.doc,r.before(o),r.after(o),ve.empty);if(c&&c.slice.size<c.to-c.from){if(e){let u=t.tr.step(c);u.setSelection(sc(s,"end")?Ve.findFrom(u.doc.resolve(u.mapping.map(i.pos,-1)),-1):De.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},EF=(t,e,n)=>{let r=bN(t,n);if(!r)return!1;let i=lw(r);return i?wN(t,i,e):!1},TF=(t,e,n)=>{let r=kN(t,n);if(!r)return!1;let i=cw(r);return i?wN(t,i,e):!1};function wN(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,c=o,u=e.pos+1;for(;!c.isTextblock;u++){if(c.type.spec.isolating)return!1;let h=c.firstChild;if(!h)return!1;c=h}let f=Dm(t.doc,s,u,ve.empty);if(!f||f.from!=s||f instanceof cn&&f.slice.size>=u-s)return!1;if(n){let h=t.tr.step(f);h.setSelection(Oe.create(h.doc,s)),n(h.scrollIntoView())}return!0}function sc(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 xN=(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=lw(r)}let o=s&&s.nodeBefore;return!o||!De.isSelectable(o)?!1:(e&&e(t.tr.setSelection(De.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function lw(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 kN(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const CN=(t,e,n)=>{let r=kN(t,n);if(!r)return!1;let i=cw(r);if(!i)return!1;let s=i.nodeAfter;if(RN(t,i,e,1))return!0;if(r.parent.content.size==0&&(sc(s,"start")||De.isSelectable(s))){let o=Dm(t.doc,r.before(),r.after(),ve.empty);if(o&&o.slice.size<o.to-o.from){if(e){let c=t.tr.step(o);c.setSelection(sc(s,"start")?Ve.findFrom(c.doc.resolve(c.mapping.map(i.pos)),1):De.create(c.doc,c.mapping.map(i.pos))),e(c.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},EN=(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=cw(r)}let o=s&&s.nodeAfter;return!o||!De.isSelectable(o)?!1:(e&&e(t.tr.setSelection(De.create(t.doc,s.pos)).scrollIntoView()),!0)};function cw(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 _F=(t,e)=>{let n=t.selection,r=n instanceof De,i;if(r){if(n.node.isTextblock||!Io(t.doc,n.from))return!1;i=n.from}else if(i=Nm(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(De.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},AF=(t,e)=>{let n=t.selection,r;if(n instanceof De){if(n.node.isTextblock||!Io(t.doc,n.to))return!1;r=n.to}else if(r=Nm(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},RF=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&vc(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},TN=(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 uw(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 MF=(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=uw(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let c=n.after(),u=t.tr.replaceWith(c,c,o.createAndFill());u.setSelection(Ve.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},_N=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof kr||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=uw(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,c=t.tr.insert(o,s.createAndFill());c.setSelection(Oe.create(c.doc,o+1)),e(c.scrollIntoView())}return!0},AN=(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(ds(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&vc(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function OF(t){return(e,n)=>{if(e.selection instanceof De&&e.selection.node.isBlock){let{$from:y}=e.selection;return!y.parentOffset||!ds(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 Oe||e.selection instanceof kr)&&r.deleteSelection();let{$from:i}=r.selection,s=r.steps.length,o=[],c,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=uw(i.node(y-1).contentMatchAt(i.indexAfter(y-1))),o.unshift(f&&u?{type:u}:null),c=y;break}else{if(y==1)return!1;o.unshift(null)}let m=i.pos,g=ds(r.doc,m,o.length,o);if(g||(o[0]=u?{type:u}:null,g=ds(r.doc,m,o.length,o)),!g)return!1;if(r.split(m,o.length,o),!f&&h&&i.node(c).type!=u){let y=r.mapping.slice(s),S=y.map(i.before(c)),w=r.doc.resolve(S);u&&i.node(c-1).canReplaceWith(w.index(),w.index()+1,u)&&r.setNodeMarkup(y.map(i.before(c)),u)}return n&&n(r.scrollIntoView()),!0}}const NF=OF(),DF=(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(De.create(t.doc,i))),!0)};function IF(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||Io(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function RN(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,o,c,u=i.type.spec.isolating||s.type.spec.isolating;if(!u&&IF(t,e,n))return!0;let f=!u&&e.parent.canReplace(e.index(),e.index()+1);if(f&&(o=(c=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&c.matchType(o[0]||s.type).validEnd){if(n){let y=e.pos+s.nodeSize,S=ne.empty;for(let k=o.length-1;k>=0;k--)S=ne.from(o[k].create(null,S));S=ne.from(i.copy(S));let w=t.tr.step(new vn(e.pos-1,y,e.pos,y,new ve(S,1,0),o.length,!0)),x=w.doc.resolve(y+2*o.length);x.nodeAfter&&x.nodeAfter.type==i.type&&Io(w.doc,x.pos)&&w.join(x.pos),n(w.scrollIntoView())}return!0}let h=s.type.spec.isolating||r>0&&u?null:Ve.findFrom(e,1),m=h&&h.$from.blockRange(h.$to),g=m&&vc(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(f&&sc(s,"start",!0)&&sc(i,"end")){let y=i,S=[];for(;S.push(y),!y.isTextblock;)y=y.lastChild;let w=s,x=1;for(;!w.isTextblock;w=w.firstChild)x++;if(y.canReplace(y.childCount,y.childCount,w.content)){if(n){let k=ne.empty;for(let A=S.length-1;A>=0;A--)k=ne.from(S[A].copy(k));let T=t.tr.step(new vn(e.pos-S.length,e.pos+s.nodeSize,e.pos+x,e.pos+s.nodeSize-x,new ve(k,S.length,0),0,!0));n(T.scrollIntoView())}return!0}}return!1}function MN(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(Oe.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const LF=MN(-1),PF=MN(1);function zF(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),c=o&&sw(o,t,e);return c?(r&&r(n.tr.wrap(o,c).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:c}}=n.selection.ranges[s];n.doc.nodesBetween(o,c,(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:c},$to:{pos:u}}=n.selection.ranges[o];s.setBlockType(c,u,t,e)}r(s.scrollIntoView())}return!0}}function dw(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}dw(vN,SN,xN);dw(vN,CN,EN);dw(TN,_N,AN,NF);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function jF(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s);if(!o)return!1;let c=r?n.tr:null;return BF(c,o,t,e)?(r&&r(c.scrollIntoView()),!0):!1}}function BF(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 Ep(u,u,e.depth),e.endIndex<e.parent.childCount&&(e=new Ep(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let c=sw(s,n,r,e);return c?(t&&$F(t,e,c,i,n),!0):!1}function $F(t,e,n,r,i){let s=ne.empty;for(let h=n.length-1;h>=0;h--)s=ne.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 ve(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 c=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&&ds(t.doc,u,c)&&(t.split(u,c),u+=2*c),u+=f.child(h).nodeSize;return t}function VF(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?HF(e,n,t,s):UF(e,n,s):!0:!1}}function HF(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 ve(ne.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Ep(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const c=vc(r);if(c==null)return!1;i.lift(r,c);let u=i.doc.resolve(i.mapping.map(s,-1)-1);return Io(i.doc,u.pos)&&u.nodeBefore.type==u.nodeAfter.type&&i.join(u.pos),e(i.scrollIntoView()),!0}function UF(t,e,n){let r=t.tr,i=n.parent;for(let y=n.end,S=n.endIndex-1,w=n.startIndex;S>w;S--)y-=i.child(S).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 c=n.startIndex==0,u=n.endIndex==i.childCount,f=s.node(-1),h=s.index(-1);if(!f.canReplace(h+(c?0:1),h+1,o.content.append(u?ne.empty:ne.from(i))))return!1;let m=s.pos,g=m+o.nodeSize;return r.step(new vn(m-(c?1:0),g+(u?1:0),m+1,g-1,new ve((c?ne.empty:ne.from(i.copy(ne.empty))).append(u?ne.empty:ne.from(i.copy(ne.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function FF(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 c=s.parent,u=c.child(o-1);if(u.type!=t)return!1;if(n){let f=u.lastChild&&u.lastChild.type==c.type,h=ne.from(f?t.create():null),m=new ve(ne.from(t.create(null,ne.from(c.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 Nn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},oc=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let y0=null;const Ji=function(t,e,n){let r=y0||(y0=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},qF=function(){y0=null},Aa=function(t,e,n,r){return n&&(C_(t,e,n,r,-1)||C_(t,e,n,r,1))},GF=/^(img|br|input|textarea|hr)$/i;function C_(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:$r(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Pd(t)||GF.test(t.nodeName)||t.contentEditable=="false")return!1;e=Nn(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?$r(t):0}else return!1}}function $r(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function WF(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=$r(t)}else if(t.parentNode&&!Pd(t))e=Nn(t),t=t.parentNode;else return null}}function KF(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&&!Pd(t))e=Nn(t)+1,t=t.parentNode;else return null}}function ZF(t,e,n){for(let r=e==0,i=e==$r(t);r||i;){if(t==n)return!0;let s=Nn(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==$r(t)}}function Pd(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 Lm=function(t){return t.focusNode&&Aa(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function la(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function YF(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function XF(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min($r(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min($r(r.startContainer),r.startOffset)}}}const ki=typeof navigator<"u"?navigator:null,E_=typeof document<"u"?document:null,Lo=ki&&ki.userAgent||"",v0=/Edge\/(\d+)/.exec(Lo),ON=/MSIE \d/.exec(Lo),b0=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Lo),cr=!!(ON||b0||v0),vo=ON?document.documentMode:b0?+b0[1]:v0?+v0[1]:0,Vr=!cr&&/gecko\/(\d+)/i.test(Lo);Vr&&+(/Firefox\/(\d+)/.exec(Lo)||[0,0])[1];const S0=!cr&&/Chrome\/(\d+)/.exec(Lo),In=!!S0,NN=S0?+S0[1]:0,$n=!cr&&!!ki&&/Apple Computer/.test(ki.vendor),ac=$n&&(/Mobile\/\w+/.test(Lo)||!!ki&&ki.maxTouchPoints>2),jr=ac||(ki?/Mac/.test(ki.platform):!1),DN=ki?/Win/.test(ki.platform):!1,ls=/Android \d/.test(Lo),zd=!!E_&&"webkitFontSmoothing"in E_.documentElement.style,JF=zd?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function QF(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 Gi(t,e){return typeof t=="number"?t:t[e]}function e4(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 T_(t,e,n){if(!w0(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=oc(o);continue}let c=o,u=c==s.body,f=u?QF(s):e4(c),h=0,m=0;if(e.top<f.top+Gi(r,"top")?m=-(f.top-e.top+Gi(i,"top")):e.bottom>f.bottom-Gi(r,"bottom")&&(m=e.bottom-e.top>f.bottom-f.top?e.top+Gi(i,"top")-f.top:e.bottom-f.bottom+Gi(i,"bottom")),e.left<f.left+Gi(r,"left")?h=-(f.left-e.left+Gi(i,"left")):e.right>f.right-Gi(r,"right")&&(h=e.right-f.right+Gi(i,"right")),h||m)if(u)s.defaultView.scrollBy(h,m);else{let y=c.scrollLeft,S=c.scrollTop;m&&(c.scrollTop+=m),h&&(c.scrollLeft+=h);let w=c.scrollLeft-y,x=c.scrollTop-S;e={left:e.left-w,top:e.top-x,right:e.right-w,bottom:e.bottom-x}}let g=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(g))break;o=g=="absolute"?o.offsetParent:oc(o)}}function t4(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 c=t.root.elementFromPoint(s,o);if(!c||c==t.dom||!t.dom.contains(c))continue;let u=c.getBoundingClientRect();if(u.top>=n-20){r=c,i=u.top;break}}return{refDOM:r,refTop:i,stack:IN(t.dom)}}function IN(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=oc(r));return e}function n4({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;LN(n,r==0?0:r-e)}function LN(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 Ml=null;function r4(t){if(t.setActive)return t.setActive();if(Ml)return t.focus(Ml);let e=IN(t);t.focus(Ml==null?{get preventScroll(){return Ml={preventScroll:!0},!0}}:void 0),Ml||(Ml=!1,LN(e,0))}function PN(t,e){let n,r=2e8,i,s=0,o=e.top,c=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=Ji(h).getClientRects();else continue;for(let y=0;y<g.length;y++){let S=g[y];if(S.top<=o&&S.bottom>=c){o=Math.max(S.bottom,o),c=Math.min(S.top,c);let w=S.left>e.left?S.left-e.left:S.right<e.left?e.left-S.right:0;if(w<r){n=h,r=w,i=w&&n.nodeType==3?{left:S.right<e.left?S.right:S.left,top:e.top}:e,h.nodeType==1&&w&&(s=m+(e.left>=(S.left+S.right)/2?1:0));continue}}else S.top>e.top&&!u&&S.left<=e.left&&S.right>=e.left&&(u=h,f={left:Math.max(S.left,Math.min(S.right,e.left)),top:S.top});!n&&(e.left>=S.right&&e.top>=S.top||e.left>=S.left&&e.top>=S.bottom)&&(s=m+1)}}return!n&&u&&(n=u,i=f,r=0),n&&n.nodeType==3?i4(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:PN(n,i)}function i4(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=Ys(r,1);if(o.top!=o.bottom&&fw(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 fw(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function s4(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function o4(t,e,n){let{node:r,offset:i}=PN(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 a4(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let c=t.docView.nearestDesc(s,!0),u;if(!c)return null;if(c.dom.nodeType==1&&(c.node.isBlock&&c.parent||!c.contentDOM)&&((u=c.dom.getBoundingClientRect()).width||u.height)&&(c.node.isBlock&&c.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(c.dom.nodeName)&&(!o&&u.left>r.left||u.top>r.top?i=c.posBefore:(!o&&u.right<r.left||u.bottom<r.top)&&(i=c.posAfter),o=!0),!c.contentDOM&&i<0&&!c.node.isText))return(c.node.isBlock?r.top<(u.top+u.bottom)/2:r.left<(u.left+u.right)/2)?c.posBefore:c.posAfter;s=c.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function zN(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 c=o.getClientRects();for(let u=0;u<c.length;u++){let f=c[u];if(fw(e,f))return zN(o,e,f)}}if((s=(s+1)%r)==i)break}return t}function l4(t,e){let n=t.dom.ownerDocument,r,i=0,s=XF(n,e.left,e.top);s&&({node:r,offset:i}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),c;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let f=t.dom.getBoundingClientRect();if(!fw(e,f)||(o=zN(t.dom,e,f),!o))return null}if($n)for(let f=o;r&&f;f=oc(f))f.draggable&&(r=void 0);if(o=s4(o,e),r){if(Vr&&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;zd&&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?c=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(c=a4(t,r,i,e))}c==null&&(c=o4(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function w0(t){return t.top<t.bottom||t.left<t.right}function Ys(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(w0(r))return r}return Array.prototype.find.call(n,w0)||t.getBoundingClientRect()}const c4=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function jN(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=zd||Vr;if(r.nodeType==3)if(o&&(c4.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let u=Ys(Ji(r,i,i),n);if(Vr&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let f=Ys(Ji(r,i-1,i-1),-1);if(f.top==u.top){let h=Ys(Ji(r,i,i+1),-1);if(h.top!=u.top)return Su(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++,Su(Ys(Ji(r,u,f),h),h<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==$r(r))){let u=r.childNodes[i-1];if(u.nodeType==1)return qv(u.getBoundingClientRect(),!1)}if(s==null&&i<$r(r)){let u=r.childNodes[i];if(u.nodeType==1)return qv(u.getBoundingClientRect(),!0)}return qv(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==$r(r))){let u=r.childNodes[i-1],f=u.nodeType==3?Ji(u,$r(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(f)return Su(Ys(f,1),!1)}if(s==null&&i<$r(r)){let u=r.childNodes[i];for(;u.pmViewDesc&&u.pmViewDesc.ignoreForCoords;)u=u.nextSibling;let f=u?u.nodeType==3?Ji(u,0,o?0:1):u.nodeType==1?u:null:null;if(f)return Su(Ys(f,-1),!0)}return Su(Ys(r.nodeType==3?Ji(r):r,-n),n>=0)}function Su(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 qv(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 BN(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 u4(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return BN(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let c=t.docView.nearestDesc(s,!0);if(!c)break;if(c.node.isBlock){s=c.contentDOM||c.dom;break}s=c.dom.parentNode}let o=jN(t,i.pos,1);for(let c=s.firstChild;c;c=c.nextSibling){let u;if(c.nodeType==1)u=c.getClientRects();else if(c.nodeType==3)u=Ji(c,0,c.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 d4=/[\u0590-\u08ac]/;function f4(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,c=t.domSelection();return c?!d4.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?s:o:BN(t,e,()=>{let{focusNode:u,focusOffset:f,anchorNode:h,anchorOffset:m}=t.domSelectionRange(),g=c.caretBidiLevel;c.modify("move",n,"character");let y=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:S,focusOffset:w}=t.domSelectionRange(),x=S&&!y.contains(S.nodeType==1?S:S.parentNode)||u==S&&f==w;try{c.collapse(h,m),u&&(u!=h||f!=m)&&c.extend&&c.extend(u,f)}catch{}return g!=null&&(c.caretBidiLevel=g),x}):r.pos==r.start()||r.pos==r.end()}let __=null,A_=null,R_=!1;function h4(t,e,n){return __==e&&A_==n?R_:(__=e,A_=n,R_=n=="up"||n=="down"?u4(t,e,n):f4(t,e,n))}const Hr=0,M_=1,fa=2,si=3;class jd{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Hr,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>Nn(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 c=i.children[o];if(c.size){i=c;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],c=s+o.size;if(c>e||o instanceof VN){i=e-s;break}s=c}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 $N&&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?Nn(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?Nn(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,c=0;;c++){let u=this.children[c],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=c;m>0;m--){let g=this.children[m-1];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(1)){i=Nn(g.dom)+1;break}e-=g.size}i==-1&&(i=0)}if(i>-1&&(f>n||c==this.children.length-1)){n=f;for(let h=c+1;h<this.children.length;h++){let m=this.children[h];if(m.size&&m.dom.parentNode==this.contentDOM&&!m.emptyChildAt(-1)){s=Nn(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,S=0;y<this.children.length;y++){let w=this.children[y],x=S+w.size;if(s>S&&o<x)return w.setSelection(e-S-w.border,n-S-w.border,r,i);S=x}let c=this.domFromPos(e,e?-1:1),u=n==e?c:this.domFromPos(n,n?-1:1),f=r.root.getSelection(),h=r.domSelectionRange(),m=!1;if((Vr||$n)&&e==n){let{node:y,offset:S}=c;if(y.nodeType==3){if(m=!!(S&&y.nodeValue[S-1]==`
|
|
70
|
-
`),m&&S==y.nodeValue.length)for(let w=y,x;w;w=w.parentNode){if(x=w.nextSibling){x.nodeName=="BR"&&(c=u={node:x.parentNode,offset:Nn(x)+1});break}let k=w.pmViewDesc;if(k&&k.node&&k.node.isBlock)break}}else{let w=y.childNodes[S-1];m=w&&(w.nodeName=="BR"||w.contentEditable=="false")}}if(Vr&&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&&$n)&&Aa(c.node,c.offset,h.anchorNode,h.anchorOffset)&&Aa(u.node,u.offset,h.focusNode,h.focusOffset))return;let g=!1;if((f.extend||e==n)&&!(m&&Vr)){f.collapse(c.node,c.offset);try{e!=n&&f.extend(u.node,u.offset),g=!0}catch{}}if(!g){if(e>n){let S=c;c=u,u=S}let y=document.createRange();y.setEnd(u.node,u.offset),y.setStart(c.node,c.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 c=r+s.border,u=o-s.border;if(e>=c&&n<=u){this.dirty=e==r||n==o?fa:M_,e==c&&n==u&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=si:s.markDirty(e-c,n-c);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?fa:si}r=o}this.dirty=fa}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?fa:M_;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class $N extends jd{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 c=document.createElement("span");c.appendChild(o),o=c}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==Hr&&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 p4 extends jd{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 bo extends jd{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=Ba.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new bo(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&si||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=si&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Hr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Hr}}slice(e,n,r){let i=bo.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 c=0;c<s.length;c++)s[c].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 So extends jd{constructor(e,n,r,i,s,o,c){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=c}static create(e,n,r,i,s,o){let c=s.nodeViews[n.type.name],u,f=c&&c(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}=Ba.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=FN(h,r,n),f?u=new m4(e,n,r,i,h,m||null,g,f):n.isText?new Pm(e,n,r,i,h,g):new So(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=()=>ne.empty}}return n}matchesNode(e,n,r){return this.dirty==Hr&&e.eq(this.node)&&_p(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,c=s&&s.pos<0,u=new y4(this,o&&o.node,e);S4(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?Rt.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)||c&&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==fa)&&(o&&this.protectLocalComposition(e,o),HN(this.contentDOM,this.children,e),ac&&w4(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof Oe)||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,c=x4(this.node.content,o,r-n,i-n);return c<0?null:{node:s,pos:c,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 p4(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==si||!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=Hr}updateOuterDeco(e){if(_p(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=UN(this.dom,this.nodeDOM,x0(this.outerDeco,this.node,n),x0(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 O_(t,e,n,r,i){FN(r,e,t);let s=new So(void 0,t,e,n,r,r,r);return s.contentDOM&&s.updateChildren(i,0),s}class Pm extends So{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==si||this.dirty!=Hr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Hr||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=Hr,!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 Pm(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=si)}get domAtom(){return!1}isText(e){return this.node.text==e}}class VN extends jd{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Hr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class m4 extends So{constructor(e,n,r,i,s,o,c,u){super(e,n,r,i,s,o,c),this.spec=u}update(e,n,r,i){if(this.dirty==si)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 HN(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],c=o.dom;if(c.parentNode==t){for(;c!=r;)r=N_(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(c,r);if(o instanceof bo){let u=r?r.previousSibling:t.lastChild;HN(o.contentDOM,o.children,n),r=u?u.nextSibling:t.firstChild}}for(;r;)r=N_(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const Fu=function(t){t&&(this.nodeName=t)};Fu.prototype=Object.create(null);const ha=[new Fu];function x0(t,e,n){if(t.length==0)return ha;let r=n?ha[0]:new Fu,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new Fu(o.nodeName));for(let c in o){let u=o[c];u!=null&&(n&&i.length==1&&i.push(r=new Fu(e.isInline?"span":"div")),c=="class"?r.class=(r.class?r.class+" ":"")+u:c=="style"?r.style=(r.style?r.style+";":"")+u:c!="nodeName"&&(r[c]=u))}}}return i}function UN(t,e,n,r){if(n==ha&&r==ha)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],c=n[s];if(s){let u;c&&c.nodeName==o.nodeName&&i!=t&&(u=i.parentNode)&&u.nodeName.toLowerCase()==o.nodeName||(u=document.createElement(o.nodeName),u.pmIsDeco=!0,u.appendChild(i),c=ha[0]),i=u}g4(i,c||ha[0],o)}return i}function g4(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 FN(t,e,n){return UN(t,t,ha,x0(e,n,t.nodeType!=1))}function _p(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 N_(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class y4{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=v4(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,c=Math.min(o,e.length);for(;s<c&&(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=Hr,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 bo&&h.dirty!=si&&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=bo.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 c=this.index,u=Math.min(this.top.children.length,c+5);c<u;c++){let f=this.top.children[c];if(f.matchesNode(e,n,r)&&!this.preMatch.matched.has(f)){s=c;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==si&&o.dom==o.contentDOM&&(o.dirty=fa),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 c=this.index;c<this.top.children.length;c++){let u=this.top.children[c];if(u instanceof So){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!=si&&_p(n,u.outerDeco));if(!g&&u.update(e,n,r,i))return this.destroyBetween(this.index,c),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,c),this.top.children[this.index]=m,m.contentDOM&&(m.dirty=fa,m.updateChildren(i,o+1),m.dirty=Hr),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)||!_p(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let c=So.create(this.top,n,r,i,s,o);if(c.contentDOM){c.children=e.children,e.children=[];for(let u of c.children)u.parent=c}return e.destroy(),c}addNode(e,n,r,i,s){let o=So.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 $N(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 bo;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Pm)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&(($n||In)&&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 VN(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 v4(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];e:for(;i>0;){let c;for(;;)if(r){let f=n.children[r-1];if(f instanceof bo)n=f,r=f.children.length;else{c=f,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=c.node;if(u){if(u!=t.child(i-1))break;--i,s.set(c,i),o.push(c)}}return{index:i,matched:s,matches:o.reverse()}}function b4(t,e){return t.type.side-e.type.side}function S4(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,c=[],u=null;for(let f=0;;){let h,m;for(;o<i.length&&i[o].to==s;){let x=i[o++];x.widget&&(h?(m||(m=[h])).push(x):h=x)}if(h)if(m){m.sort(b4);for(let x=0;x<m.length;x++)n(m[x],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 x=0;x<c.length;x++)c[x].to<=s&&c.splice(x--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)c.push(i[o++]);let S=s+g.nodeSize;if(g.isText){let x=S;o<i.length&&i[o].from<x&&(x=i[o].from);for(let k=0;k<c.length;k++)c[k].to<x&&(x=c[k].to);x<S&&(u=g.cut(x-s),g=g.cut(0,x-s),S=x,y=-1)}else for(;o<i.length&&i[o].to<S;)o++;let w=g.isInline&&!g.isLeaf?c.filter(x=>!x.inline):c.slice();r(g,w,e.forChild(s,g),y),s=S}}function w4(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 x4(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),c=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-c,r-c)==e)return r-e.length;let f=c<r?u.lastIndexOf(e,r-c-1):-1;if(f>=0&&f+e.length+c>=n)return c+f;if(n==r&&u.length>=r+e.length-c&&u.slice(r-c,r-c+e.length)==e)return r}}return-1}function k0(t,e,n,r,i){let s=[];for(let o=0,c=0;o<t.length;o++){let u=t[o],f=c,h=c+=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 hw(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 c=r.resolve(o),u,f;if(Lm(n)){for(u=o;i&&!i.node;)i=i.parent;let m=i.node;if(i&&m.isAtom&&De.isSelectable(m)&&i.parent&&!(m.isInline&&ZF(n.focusNode,n.focusOffset,i.dom))){let g=i.posBefore;f=new De(o==g?c: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 S=n.getRangeAt(y);m=Math.min(m,t.docView.posFromDOM(S.startContainer,S.startOffset,1)),g=Math.max(g,t.docView.posFromDOM(S.endContainer,S.endOffset,-1))}if(m<0)return null;[u,o]=g==t.state.selection.anchor?[g,m]:[m,g],c=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<c.pos&&!s?1:-1;f=pw(t,h,c,m)}return f}function qN(t){return t.editable?t.hasFocus():WN(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function fs(t,e=!1){let n=t.state.selection;if(GN(t,n),!qN(t))return;let r=t.input.mouseDown;if(!e&&In&&r){let i=t.domSelectionRange(),s=t.domObserver.currentSelection;if(i.anchorNode&&s.anchorNode&&Aa(i.anchorNode,i.anchorOffset,s.anchorNode,s.anchorOffset)&&r.delaySelUpdate()){t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)C4(t);else{let{anchor:i,head:s}=n,o,c;D_&&!(n instanceof Oe)&&(n.$from.parent.inlineContent||(o=I_(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(c=I_(t,n.to))),t.docView.setSelection(i,s,t,e),D_&&(o&&L_(o),c&&L_(c)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&k4(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}const D_=$n||In&&NN<63;function I_(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($n&&i&&i.contentEditable=="false")return Gv(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Gv(i);if(s)return Gv(s)}}function Gv(t){return t.contentEditable="true",$n&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function L_(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function k4(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(()=>{(!qN(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function C4(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Nn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&cr&&vo<=11&&(n.disabled=!0,n.disabled=!1)}function GN(t,e){if(e instanceof De){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(P_(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else P_(t)}function P_(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function pw(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||Oe.between(e,n,r)}function z_(t){return t.editable&&!t.hasFocus()?!1:WN(t)}function WN(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 E4(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Aa(e.node,e.offset,n.anchorNode,n.anchorOffset)}function C0(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&&Ve.findFrom(s,e)}function Qs(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function j_(t,e,n){let r=t.state.selection;if(r instanceof Oe)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 Qs(t,new Oe(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=C0(t.state,e);return i&&i instanceof De?Qs(t,i):!1}else if(!(jr&&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 c=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(c))&&!o.contentDOM?De.isSelectable(s)?Qs(t,new De(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):zd?Qs(t,new Oe(t.state.doc.resolve(e<0?c:c+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof De&&r.node.isInline)return Qs(t,new Oe(e>0?r.$to:r.$from));{let i=C0(t.state,e);return i?Qs(t,i):!1}}}function Ap(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function qu(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Ol(t,e){return e<0?T4(t):_4(t)}function T4(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(Vr&&n.nodeType==1&&r<Ap(n)&&qu(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(qu(c,-1))i=n,s=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(KN(n))break;{let c=n.previousSibling;for(;c&&qu(c,-1);)i=n.parentNode,s=Nn(c),c=c.previousSibling;if(c)n=c,r=Ap(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?E0(t,n,r):i&&E0(t,i,s)}function _4(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Ap(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let c=n.childNodes[r];if(qu(c,1))s=n,o=++r;else break}else{if(KN(n))break;{let c=n.nextSibling;for(;c&&qu(c,1);)s=c.parentNode,o=Nn(c)+1,c=c.nextSibling;if(c)n=c,r=0,i=Ap(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&E0(t,s,o)}function KN(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function A4(t,e){for(;t&&e==t.childNodes.length&&!Pd(t);)e=Nn(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 R4(t,e){for(;t&&!e&&!Pd(t);)e=Nn(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 E0(t,e,n){if(e.nodeType!=3){let s,o;(o=A4(e,n))?(e=o,n=0):(s=R4(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Lm(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&&fs(t)},50)}function B_(t,e){let n=t.state.doc.resolve(e);if(!(In||DN)&&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 $_(t,e,n){let r=t.state.selection;if(r instanceof Oe&&!r.empty||n.indexOf("s")>-1||jr&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=C0(t.state,e);if(o&&o instanceof De)return Qs(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,c=r instanceof kr?Ve.near(o,e):Ve.findFrom(o,e);return c?Qs(t,c):!1}return!1}function V_(t,e){if(!(t.state.selection instanceof Oe))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 H_(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function M4(t){if(!$n||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;H_(t,r,"true"),setTimeout(()=>H_(t,r,"false"),20)}return!1}function O4(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function N4(t,e){let n=e.keyCode,r=O4(e);if(n==8||jr&&n==72&&r=="c")return V_(t,-1)||Ol(t,-1);if(n==46&&!e.shiftKey||jr&&n==68&&r=="c")return V_(t,1)||Ol(t,1);if(n==13||n==27)return!0;if(n==37||jr&&n==66&&r=="c"){let i=n==37?B_(t,t.state.selection.from)=="ltr"?-1:1:-1;return j_(t,i,r)||Ol(t,i)}else if(n==39||jr&&n==70&&r=="c"){let i=n==39?B_(t,t.state.selection.from)=="ltr"?1:-1:1;return j_(t,i,r)||Ol(t,i)}else{if(n==38||jr&&n==80&&r=="c")return $_(t,-1,r)||Ol(t,-1);if(n==40||jr&&n==78&&r=="c")return M4(t)||$_(t,1,r)||Ol(t,1);if(r==(jr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function mw(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")||Ba.fromSchema(t.state.schema),c=eD(),u=c.createElement("div");u.appendChild(o.serializeFragment(r,{document:c}));let f=u.firstChild,h,m=0;for(;f&&f.nodeType==1&&(h=QN[f.nodeName.toLowerCase()]);){for(let y=h.length-1;y>=0;y--){let S=c.createElement(h[y]);for(;u.firstChild;)S.appendChild(u.firstChild);u.appendChild(S),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 ZN(t,e,n,r,i){let s=i.parent.type.spec.code,o,c;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 c=new ve(ne.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
73
|
-
`))),0,0),t.someProp("transformPasted",g=>{c=g(c,t,!0)}),c;let m=t.someProp("clipboardTextParser",g=>g(e,i,r,t));if(m)c=m;else{let g=i.marks(),{schema:y}=t.state,S=Ba.fromSchema(y);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(w=>{let x=o.appendChild(document.createElement("p"));w&&x.appendChild(S.serializeNode(y.text(w,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),o=P4(n),zd&&z4(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(c||(c=(t.someProp("clipboardParser")||t.someProp("domParser")||us.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||h),context:i,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!D4.test(g.parentNode.nodeName)?{ignore:!0}:null}})),h)c=j4(U_(c,+h[1],+h[2]),h[4]);else if(c=ve.maxOpen(I4(c.content,i),!0),c.openStart||c.openEnd){let m=0,g=0;for(let y=c.content.firstChild;m<c.openStart&&!y.type.spec.isolating;m++,y=y.firstChild);for(let y=c.content.lastChild;g<c.openEnd&&!y.type.spec.isolating;g++,y=y.lastChild);c=U_(c,m,g)}return t.someProp("transformPasted",m=>{c=m(c,t,u)}),c}const D4=/^(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 I4(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(c=>{if(!o)return;let u=i.findWrapping(c.type),f;if(!u)return o=null;if(f=o.length&&s.length&&XN(u,s,c,o[o.length-1],0))o[o.length-1]=f;else{o.length&&(o[o.length-1]=JN(o[o.length-1],s.length));let h=YN(c,u);o.push(h),i=i.matchType(h.type),s=u}}),o)return ne.from(o)}return t}function YN(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,ne.from(t));return t}function XN(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=XN(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(ne.from(YN(n,t,i+1))))}}function JN(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,JN(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(ne.empty,!0);return t.copy(n.append(r))}function T0(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,c=o.content;return t.childCount>1&&(s=0),i<r-1&&(c=T0(c,e,n,r,i+1,s)),i>=n&&(c=e<0?o.contentMatchAt(0).fillBefore(c,s<=i).append(c):c.append(o.contentMatchAt(o.childCount).fillBefore(ne.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(c))}function U_(t,e,n){return e<t.openStart&&(t=new ve(T0(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new ve(T0(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const QN={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 eD(){return document.implementation.createHTMLDocument("title")}let Wv=null;function L4(t){let e=window.trustedTypes;return e?(Wv||(Wv=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Wv.createHTML(t)):t}function P4(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=eD(),r=n.body,i=/<([a-z][^>\s]+)/i.exec(t),s;if((s=i&&QN[i[1].toLowerCase()])&&(t=s.map(o=>"<"+o+">").join("")+t+s.map(o=>"</"+o+">").reverse().join("")),r.innerHTML=L4(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 c=n.styleSheets[o];for(let u=0;u<c.rules.length;u++){let f=c.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 z4(t){let e=t.querySelectorAll(In?"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 j4(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 c=r.length-2;c>=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;i=ne.from(u.create(r[c+1],i)),s++,o++}return new ve(i,s,o)}const Xn={},Jn={},B4={touchstart:!0,touchmove:!0};class $4{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 V4(t){for(let e in Xn){let n=Xn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{U4(t,r)&&!gw(t,r)&&(t.editable||!(r.type in Jn))&&n(t,r)},B4[e]?{passive:!0}:void 0)}$n&&t.dom.addEventListener("input",()=>null),_0(t)}function cs(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function H4(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 _0(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>gw(t,r))})}function gw(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function U4(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 F4(t,e){!gw(t,e)&&Xn[e.type]&&(t.editable||!(e.type in Jn))&&Xn[e.type](t,e)}Jn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!iD(t)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(ls&&In&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),ac&&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,la(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||N4(t,n)?n.preventDefault():cs(t,"key")};Jn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Jn.keypress=(t,e)=>{let n=e;if(iD(t)||!n.charCode||n.ctrlKey&&!n.altKey||jr&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Oe)||!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 Bd(t){return{left:t.clientX,top:t.clientY}}function q4(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function yw(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,c=>o>s.depth?c(t,n,s.nodeAfter,s.before(o),i,!0):c(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function $d(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 G4(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&De.isSelectable(r)?($d(t,new De(n)),!0):!1}function W4(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof De&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let c=o>s.depth?s.nodeAfter:s.node(o);if(De.isSelectable(c)){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?($d(t,De.create(t.state.doc,i)),!0):!1}function K4(t,e,n,r,i){return yw(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?W4(t,n):G4(t,n))}function Z4(t,e,n,r){return yw(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function Y4(t,e,n,r){return yw(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||X4(t,n,r)}function X4(t,e,n){if(n.button!=0)return!1;let r=tD(t,e,!0),i=t.state.doc;return r?($d(t,r),r instanceof Oe&&i.eq(t.state.doc)&&(t.input.mouseDown=new Q4(t,r)),!0):!1}function tD(t,e,n){let r=t.state.doc;if(e==-1)return r.inlineContent?Oe.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),c=i.before(s);if(o.inlineContent)return Oe.create(r,c+1,c+1+o.content.size);if(n&&De.isSelectable(o))return De.create(r,c)}return null}function vw(t){return Rp(t)}const nD=jr?"metaKey":"ctrlKey";Xn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=vw(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&q4(n,t.input.lastClick)&&!n[nD]&&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(Bd(n));o&&(s=="singleClick"?t.input.mouseDown=new J4(t,o,n,!!r):(s=="doubleClick"?Z4:Y4)(t,o.pos,o.inside,n)?n.preventDefault():cs(t,"pointer"))};class rD{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 J4 extends rD{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[nD],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 c=i?null:r.target,u=c?e.docView.nearestDesc(c,!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 De&&f.from<=o&&f.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Vr&&!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()),cs(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||fs(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(Bd(e))),this.updateAllowDefault(e),this.allowDefault||!n?cs(this.view,"pointer"):K4(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||$n&&this.mightDrag&&!this.mightDrag.node.isAtom||In&&!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)?($d(this.view,Ve.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):cs(this.view,"pointer")}move(e){this.updateAllowDefault(e),cs(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 Q4 extends rD{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(),cs(this.view,"pointer");let n=this.view.posAtCoords(Bd(e)),r=n&&tD(this.view,n.inside,!1);if(!r)return;let{doc:i}=this.view.state,s=this.startSelection,[o,c]=r.from<s.from?[s.to,r.from]:[s.from,r.to];$d(this.view,Oe.create(i,o,c))}}Xn.touchstart=t=>{t.input.lastTouch=Date.now(),vw(t),cs(t,"pointer")};Xn.touchmove=t=>{t.input.lastTouch=Date.now(),cs(t,"pointer")};Xn.contextmenu=t=>vw(t);function iD(t,e){return t.composing?!0:$n&&Math.abs(Date.now()-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const e6=ls?5e3:-1;Jn.compositionstart=Jn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Oe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||In&&DN&&t6(t)))t.markCursor=t.state.storedMarks||n.marks(),Rp(t,!0),t.markCursor=null;else if(Rp(t,!e.selection.empty),Vr&&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 c=t.domSelection();c&&c.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}sD(t,e6)};function t6(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"}Jn.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++,sD(t,20))};function sD(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Rp(t),e))}function oD(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function n6(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=WF(e.focusNode,e.focusOffset),r=KF(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 Rp(t,e=!1){if(!(ls&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),oD(t),e||t.docView&&t.docView.dirty){let n=hw(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 r6(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 md=cr&&vo<15||ac&&JF<604;Xn.copy=Jn.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=md?null:n.clipboardData,o=r.content(),{dom:c,text:u}=mw(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",c.innerHTML),s.setData("text/plain",u)):r6(t,c),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function i6(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function s6(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?gd(t,r.value,null,i,e):gd(t,r.textContent,r.innerHTML,i,e)},50)}function gd(t,e,n,r,i){let s=ZN(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,i,s||ve.empty)))return!0;if(!s)return!1;let o=i6(s),c=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function aD(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," "):""}Jn.paste=(t,e)=>{let n=e;if(t.composing&&!ls)return;let r=md?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&gd(t,aD(r),r.getData("text/html"),i,n)?n.preventDefault():s6(t,n)};class lD{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const o6=jr?"altKey":"ctrlKey";function cD(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[o6]}Xn.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(Bd(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof De?i.to-1:i.to))){if(r&&r.mightDrag)o=De.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=De.create(t.state.doc,m.posBefore))}}let c=(o||t.state.selection).content(),{dom:u,text:f,slice:h}=mw(t,c);(!n.dataTransfer.files.length||!In||NN>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(md?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",md||n.dataTransfer.setData("text/plain",f),t.dragging=new lD(h,cD(t,n),o)};Xn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Jn.dragover=Jn.dragenter=(t,e)=>e.preventDefault();Jn.drop=(t,e)=>{try{a6(t,e,t.dragging)}finally{t.dragging=null}};function a6(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Bd(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=ZN(t,aD(e.dataTransfer),md?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&cD(t,e));if(t.someProp("handleDrop",y=>y(t,e,s||ve.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let c=s?uN(t.state.doc,i.pos,s):i.pos;c==null&&(c=i.pos);let u=t.state.tr;if(o){let{node:y}=n;y?y.replace(u):u.deleteSelection()}let f=u.mapping.map(c),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&&De.isSelectable(s.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(s.content.firstChild))u.setSelection(new De(g));else{let y=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((S,w,x,k)=>y=k),u.setSelection(pw(t,g,u.doc.resolve(y)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}Xn.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())&&fs(t)},20))};Xn.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)};Xn.beforeinput=(t,e)=>{if(ls&&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,la(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 Jn)Xn[t]=Jn[t];function yd(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 Mp{constructor(e,n){this.toDOM=e,this.spec=n||ba,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 Mp&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&yd(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class wo{constructor(e,n){this.attrs=e,this.spec=n||ba}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 wo&&yd(this.attrs,e.attrs)&&yd(this.spec,e.spec)}static is(e){return e.type instanceof wo}destroy(){}}class bw{constructor(e,n){this.attrs=e,this.spec=n||ba}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 bw&&yd(this.attrs,e.attrs)&&yd(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 Mp(n,r))}static inline(e,n,r,i){return new yn(e,n,new wo(r,i))}static node(e,n,r,i){return new yn(e,n,new bw(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof wo}get widget(){return this.type instanceof Mp}}const jl=[],ba={};class St{constructor(e,n){this.local=e.length?e:jl,this.children=n.length?n:jl}static create(e,n){return n.length?Op(n,e,0,ba):jn}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 c=this.local[o];c.from<=n&&c.to>=e&&(!s||s(c.spec))&&r.push(c.copy(c.from+i,c.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let c=this.children[o]+1;this.children[o+2].findInner(e-c,n-c,r,i+c,s)}}map(e,n,r){return this==jn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||ba)}mapInner(e,n,r,i,s){let o;for(let c=0;c<this.local.length;c++){let u=this.local[c].map(e,r,i);u&&u.type.valid(n,u)?(o||(o=[])).push(u):s.onRemove&&s.onRemove(this.local[c].spec)}return this.children.length?l6(this.children,o||[],e,n,r,i,s):o?new St(o.sort(Sa),jl):jn}add(e,n){return n.length?this==jn?St.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((c,u)=>{let f=u+r,h;if(h=dD(n,c,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(c,h,f+1):i.splice(s,0,u,u+c.nodeSize,Op(h,c,f+1,ba)),s+=3}});let o=uD(s?fD(n):n,-r);for(let c=0;c<o.length;c++)o[c].type.valid(e,o[c])||o.splice(c--,1);return new St(o.length?this.local.concat(o).sort(Sa):this.local,i||this.children)}remove(e){return e.length==0||this==jn?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,c=r[s]+n,u=r[s+1]+n;for(let h=0,m;h<e.length;h++)(m=e[h])&&m.from>c&&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,c+1);f!=jn?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 c=0;c<i.length;c++)i[c].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(c--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new St(i,r):jn}forChild(e,n){if(this==jn)return this;if(n.isLeaf)return St.empty;let r,i;for(let c=0;c<this.children.length;c+=3)if(this.children[c]>=e){this.children[c]==e&&(r=this.children[c+2]);break}let s=e+1,o=s+n.content.size;for(let c=0;c<this.local.length;c++){let u=this.local[c];if(u.from<o&&u.to>s&&u.type instanceof wo){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 c=new St(i.sort(Sa),jl);return r?new oo([c,r]):c}return r||jn}eq(e){if(this==e)return!0;if(!(e instanceof St)||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 Sw(this.localsInner(e))}localsInner(e){if(this==jn)return jl;if(e.inlineContent||!this.local.some(wo.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof wo||n.push(this.local[r]);return n}forEachSet(e){e(this)}}St.empty=new St([],[]);St.removeOverlap=Sw;const jn=St.empty;class oo{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,ba));return oo.from(r)}forChild(e,n){if(n.isLeaf)return St.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=jn&&(s instanceof oo?r=r.concat(s.members):r.push(s))}return oo.from(r)}eq(e){if(!(e instanceof oo)||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?Sw(r?n:n.sort(Sa)):jl}static from(e){switch(e.length){case 0:return jn;case 1:return e[0];default:return new oo(e.every(n=>n instanceof St)?e:e.reduce((n,r)=>n.concat(r instanceof St?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function l6(t,e,n,r,i,s,o){let c=t.slice();for(let f=0,h=s;f<n.maps.length;f++){let m=0;n.maps[f].forEach((g,y,S,w)=>{let x=w-S-(y-g);for(let k=0;k<c.length;k+=3){let T=c[k+1];if(T<0||g>T+h-m)continue;let A=c[k]+h-m;y>=A?c[k+1]=g<=A?-2:-1:g>=h&&x&&(c[k]+=x,c[k+1]+=x)}m+=x}),h=n.maps[f].map(h,-1)}let u=!1;for(let f=0;f<c.length;f+=3)if(c[f+1]<0){if(c[f+1]==-2){u=!0,c[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:S,offset:w}=r.content.findIndex(m),x=r.maybeChild(S);if(x&&w==m&&w+x.nodeSize==y){let k=c[f+2].mapInner(n,x,h+1,t[f]+s+1,o);k!=jn?(c[f]=m,c[f+1]=y,c[f+2]=k):(c[f+1]=-2,u=!0)}else u=!0}if(u){let f=c6(c,t,e,n,i,s,o),h=Op(f,r,0,o);e=h.local;for(let m=0;m<c.length;m+=3)c[m+1]<0&&(c.splice(m,3),m-=3);for(let m=0,g=0;m<h.children.length;m+=3){let y=h.children[m];for(;g<c.length&&c[g]<y;)g+=3;c.splice(g,0,h.children[m],h.children[m+1],h.children[m+2])}}return new St(e.sort(Sa),c)}function uD(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 c6(t,e,n,r,i,s,o){function c(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)c(u.children[h+2],u.children[h]+f+1)}for(let u=0;u<t.length;u+=3)t[u+1]==-1&&c(t[u+2],e[u]+s+1);return n}function dD(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 Op(t,e,n,r){let i=[],s=!1;e.forEach((c,u)=>{let f=dD(t,c,u+n);if(f){s=!0;let h=Op(f,c,n+u+1,r);h!=jn&&i.push(u,u+c.nodeSize,h)}});let o=uD(s?fD(t):t,-n).sort(Sa);for(let c=0;c<o.length;c++)o[c].type.valid(e,o[c])||(r.onRemove&&r.onRemove(o[c].spec),o.splice(c--,1));return o.length||i.length?new St(o,i):jn}function Sa(t,e){return t.from-e.from||t.to-e.to}function Sw(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),F_(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),F_(e,i,r.copy(s.from,r.to)));break}}}return e}function F_(t,e,n){for(;e<t.length&&Sa(n,t[e])>0;)e++;t.splice(e,0,n)}function Kv(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=jn&&e.push(r)}),t.cursorWrapper&&e.push(St.create(t.state.doc,[t.cursorWrapper.deco])),oo.from(e)}const u6={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},d6=cr&&vo<=11;class f6{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 h6{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new f6,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]);cr&&vo<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():$n&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),d6&&(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,u6)),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(z_(this.view)){if(this.suppressingSelectionUpdates)return fs(this.view);if(cr&&vo<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Aa(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=oc(s))n.add(s);for(let s=e.anchorNode;s;s=oc(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)&&z_(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,c=!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&&(c=!0))}if(u.some(h=>h.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||In&&(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(Vr&&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||g6(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&&Lm(r)&&(f=hw(e))&&f.eq(Ve.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,fs(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),p6(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,y6(e,u)),this.handleDOMChange(s,o,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||fs(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(cr&&vo<=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?Nn(i)+1:0,c=r.localPosFromDOM(e.target,o,-1),u=s&&s.parentNode==e.target?Nn(s):e.target.childNodes.length,f=r.localPosFromDOM(e.target,u,1);return{from:c,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 q_=new WeakMap,G_=!1;function p6(t){if(!q_.has(t)&&(q_.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Vr,G_)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."),G_=!0}}function W_(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return Aa(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function m6(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return W_(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?W_(t,n):null}function g6(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 y6(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 c=o;for(;;){let u=c.firstChild;if(!u||u.nodeType!=1||u.contentEditable=="false"||/^(BR|IMG)$/.test(u.nodeName))break;c=u}c.insertBefore(s,c.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function v6(t,e,n,r){let{node:i,fromOffset:s,toOffset:o,from:c,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}],Lm(f)||h.push({node:f.focusNode,offset:f.focusOffset})),In&&t.input.lastKeyCode===8)for(let k=o;k>s;k--){let T=i.childNodes[k-1],A=T.pmViewDesc;if(T.nodeName=="BR"&&!A){o=k;break}if(!A||A.size)break}let g=t.state.doc,y=t.someProp("domParser")||us.fromSchema(t.state.schema),S=g.resolve(c),w=null,x=y.parse(i,{topNode:S.parent,topMatch:S.parent.contentMatchAt(S.index()),topOpen:!0,from:s,to:o,preserveWhitespace:S.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:b6(r),context:S});if(h&&h[0].pos!=null){let k=h[0].pos,T=h[1]&&h[1].pos;T==null&&(T=k),w={anchor:k+c,head:T+c}}return{doc:x,sel:w,from:c,to:u}}const b6=t=>e=>{let n=e.pmViewDesc;if(n)return n.parseRule(t);if(e.nodeName=="BR"&&e.parentNode){if($n&&/^(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||$n&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},S6=/^(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 w6(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let I=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,z=hw(t,I);if(z&&!t.state.selection.eq(z)){if(In&&ls&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",Z=>Z(t,la(13,"Enter"))))return;let q=t.state.tr.setSelection(z);I=="pointer"?q.setMeta("pointer",!0):I=="key"&&q.scrollIntoView(),s&&q.setMeta("composition",s),t.dispatch(q)}return}let o=t.state.doc.resolve(e),c=o.sharedDepth(n);e=o.before(c+1),n=t.state.doc.resolve(n).after(c+1);let u=t.state.selection,f=v6(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 S=C6(m.content,f.doc.content,f.from,g,y);if(S&&t.input.domChangeCount++,(ac&&t.input.lastIOSEnter>Date.now()-225||ls)&&i.some(I=>I.nodeType==1&&!S6.test(I.nodeName))&&(!S||S.endA>=S.endB)&&t.someProp("handleKeyDown",I=>I(t,la(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!S)if(r&&u instanceof Oe&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(f.sel&&f.sel.anchor!=f.sel.head))S={start:u.from,endA:u.to,endB:u.to};else{if(f.sel){let I=K_(t,t.state.doc,f.sel);if(I&&!I.eq(t.state.selection)){let z=t.state.tr.setSelection(I);s&&z.setMeta("composition",s),t.dispatch(z)}}return}t.state.selection.from<t.state.selection.to&&S.start==S.endB&&t.state.selection instanceof Oe&&(S.start>t.state.selection.from&&S.start<=t.state.selection.from+2&&t.state.selection.from>=f.from?S.start=t.state.selection.from:S.endA<t.state.selection.to&&S.endA>=t.state.selection.to-2&&t.state.selection.to<=f.to&&(S.endB+=t.state.selection.to-S.endA,S.endA=t.state.selection.to)),cr&&vo<=11&&S.endB==S.start+1&&S.endA==S.start&&S.start>f.from&&f.doc.textBetween(S.start-f.from-1,S.start-f.from+1)==" "&&(S.start--,S.endA--,S.endB--);let w=f.doc.resolveNoCache(S.start-f.from),x=f.doc.resolveNoCache(S.endB-f.from),k=h.resolve(S.start),T=w.sameParent(x)&&w.parent.inlineContent&&k.end()>=S.endA;if((ac&&t.input.lastIOSEnter>Date.now()-225&&(!T||i.some(I=>I.nodeName=="DIV"||I.nodeName=="P"))||!T&&w.pos<f.doc.content.size&&(!w.sameParent(x)||!w.parent.inlineContent)&&w.pos<x.pos&&!/\S/.test(f.doc.textBetween(w.pos,x.pos,"","")))&&t.someProp("handleKeyDown",I=>I(t,la(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>S.start&&k6(h,S.start,S.endA,w,x)&&t.someProp("handleKeyDown",I=>I(t,la(8,"Backspace")))){ls&&In&&t.domObserver.suppressSelectionUpdates();return}In&&S.endB==S.start&&(t.input.lastChromeDelete=Date.now()),ls&&!T&&w.start()!=x.start()&&x.parentOffset==0&&w.depth==x.depth&&f.sel&&f.sel.anchor==f.sel.head&&f.sel.head==S.endA&&(S.endB-=2,x=f.doc.resolveNoCache(S.endB-f.from),setTimeout(()=>{t.someProp("handleKeyDown",function(I){return I(t,la(13,"Enter"))})},20));let A=S.start,_=S.endA,O=I=>{let z=I||t.state.tr.replace(A,_,f.doc.slice(S.start-f.from,S.endB-f.from));if(f.sel){let q=K_(t,z.doc,f.sel);q&&!(In&&t.composing&&q.empty&&(S.start!=S.endB||t.input.lastChromeDelete<Date.now()-100)&&(q.head==A||q.head==z.mapping.map(_)-1)||cr&&q.empty&&q.head==A)&&z.setSelection(q)}return s&&z.setMeta("composition",s),z.scrollIntoView()},N;if(T)if(w.pos==x.pos){cr&&vo<=11&&w.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>fs(t),20));let I=O(t.state.tr.delete(A,_)),z=h.resolve(S.start).marksAcross(h.resolve(S.endA));z&&I.ensureMarks(z),t.dispatch(I)}else if(S.endA==S.endB&&(N=x6(w.parent.content.cut(w.parentOffset,x.parentOffset),k.parent.content.cut(k.parentOffset,S.endA-k.start())))){let I=O(t.state.tr);N.type=="add"?I.addMark(A,_,N.mark):I.removeMark(A,_,N.mark),t.dispatch(I)}else if(w.parent.child(w.index()).isText&&w.index()==x.index()-(x.textOffset?0:1)){let I=w.parent.textBetween(w.parentOffset,x.parentOffset),z=()=>O(t.state.tr.insertText(I,A,_));t.someProp("handleTextInput",q=>q(t,A,_,I,z))||t.dispatch(z())}else t.dispatch(O());else t.dispatch(O())}function K_(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:pw(t,e.resolve(n.anchor),e.resolve(n.head))}function x6(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,c,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)c=i[0],o="add",u=h=>h.mark(c.addToSet(h.marks));else if(i.length==0&&s.length==1)c=s[0],o="remove",u=h=>h.mark(c.removeFromSet(h.marks));else return null;let f=[];for(let h=0;h<e.childCount;h++)f.push(u(e.child(h)));if(ne.from(f).eq(t))return{mark:c,type:o}}function k6(t,e,n,r,i){if(n-e<=i.pos-r.pos||Zv(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let c=s.nodeAfter;return c!=null&&n==e+c.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(Zv(s,!0,!0));return!o.parent.isTextblock||o.pos>n||Zv(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Zv(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 C6(t,e,n,r,i){let s=t.findDiffStart(e,n),o=n+t.size,c=n+e.size;if(s==null)return null;let{a:u,b:f}=t.findDiffEnd(e,o,c);if(i=="end"){let h=Math.max(0,s-Math.min(u,f));r-=u+h-s}if(u<s&&o<c){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 hD{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 $4,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Q_),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=X_(this),Y_(this),this.nodeViews=J_(this),this.docView=O_(this.state.doc,Z_(this),Kv(this),this.dom,this),this.domObserver=new h6(this,(r,i,s,o)=>w6(this,r,i,s,o)),this.domObserver.start(),V4(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&&_0(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Q_),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&&(oD(this),o=!0),this.state=e;let c=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(c||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let y=J_(this);T6(y,this.nodeViews)&&(this.nodeViews=y,s=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&_0(this),this.editable=X_(this),Y_(this);let u=Kv(this),f=Z_(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&&t4(this);if(o){this.domObserver.stop();let y=m&&(cr||In)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&E6(i.selection,e.selection);if(m){let w=In?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=n6(this)),(s||!this.docView.update(e.doc,f,u,this))&&(this.docView.updateOuterDeco(f),this.docView.destroy(),this.docView=O_(e.doc,f,u,this.dom,this)),w&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(y=!0)}let S=this.input.mouseDown;y||!(S&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&E4(this)&&S.delaySelUpdate())?fs(this,y):(GN(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&&n4(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 De){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&T_(this,n.getBoundingClientRect(),e)}else T_(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 lD(e.slice,e.move,i<0?void 0:De.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 c=this.directPlugins[o].props[e];if(c!=null&&(i=n?n(c):c))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let c=s[o].props[e];if(c!=null&&(i=n?n(c):c))return i}}hasFocus(){if(cr){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&&r4(this.dom),fs(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 l4(this,e)}coordsAtPos(e,n=1){return jN(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 h4(this,n||this.state,e)}pasteHTML(e,n){return gd(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return gd(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return mw(this,e)}destroy(){this.docView&&(H4(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Kv(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,qF())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return F4(this,e)}domSelectionRange(){let e=this.domSelection();return e?$n&&this.root.nodeType===11&&YF(this.dom.ownerDocument)==this.dom&&m6(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}hD.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Z_(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 Y_(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 X_(t){return!t.someProp("editable",e=>e(t.state)===!1)}function E6(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 J_(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 T6(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 Q_(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 To={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:"'"},Np={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},_6=typeof navigator<"u"&&/Mac/.test(navigator.platform),A6=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Dn=0;Dn<10;Dn++)To[48+Dn]=To[96+Dn]=String(Dn);for(var Dn=1;Dn<=24;Dn++)To[Dn+111]="F"+Dn;for(var Dn=65;Dn<=90;Dn++)To[Dn]=String.fromCharCode(Dn+32),Np[Dn]=String.fromCharCode(Dn);for(var Yv in To)Np.hasOwnProperty(Yv)||(Np[Yv]=To[Yv]);function R6(t){var e=_6&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||A6&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Np:To)[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 M6=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),O6=typeof navigator<"u"&&/Win/.test(navigator.platform);function N6(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let c=0;c<e.length-1;c++){let u=e[c];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))M6?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 D6(t){let e=Object.create(null);for(let n in t)e[N6(n)]=t[n];return e}function Xv(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 I6(t){return new Nt({props:{handleKeyDown:ww(t)}})}function ww(t){let e=D6(t);return function(n,r){let i=R6(r),s,o=e[Xv(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let c=e[Xv(i,r,!1)];if(c&&c(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(O6&&r.ctrlKey&&r.altKey)&&(s=To[r.keyCode])&&s!=i){let c=e[Xv(s,r)];if(c&&c(n.state,n.dispatch,n))return!0}}return!1}}var L6=Object.defineProperty,xw=(t,e)=>{for(var n in e)L6(t,n,{get:e[n],enumerable:!0})};function zm(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 jm=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,c])=>[o,(...f)=>{const h=c(...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=[],c=!!t,u=t||i.tr,f=()=>(!c&&e&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(u),o.every(m=>m===!0)),h={...Object.fromEntries(Object.entries(n).map(([m,g])=>[m,(...S)=>{const w=this.buildProps(u,e),x=g(...S)(w);return o.push(x),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(([c,u])=>[c,(...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:zm({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(([c,u])=>[c,(...f)=>u(...f)(o)]))}};return o}},Zr={};xw(Zr,{blur:()=>P6,clearContent:()=>z6,clearNodes:()=>j6,command:()=>B6,createParagraphNear:()=>$6,cut:()=>V6,deleteCurrentNode:()=>H6,deleteNode:()=>U6,deleteRange:()=>F6,deleteSelection:()=>W6,enter:()=>K6,exitCode:()=>Z6,extendMarkRange:()=>Y6,first:()=>X6,focus:()=>Q6,forEach:()=>e5,insertContent:()=>t5,insertContentAt:()=>r5,insertDefaultBlock:()=>i5,joinBackward:()=>a5,joinDown:()=>o5,joinForward:()=>l5,joinItemBackward:()=>c5,joinItemForward:()=>u5,joinTextblockBackward:()=>d5,joinTextblockForward:()=>f5,joinUp:()=>s5,keyboardShortcut:()=>p5,lift:()=>m5,liftEmptyBlock:()=>g5,liftListItem:()=>y5,newlineInCode:()=>v5,resetAttributes:()=>b5,scrollIntoView:()=>S5,selectAll:()=>w5,selectNodeBackward:()=>x5,selectNodeForward:()=>k5,selectParentNode:()=>C5,selectTextblockEnd:()=>E5,selectTextblockStart:()=>T5,setContent:()=>_5,setMark:()=>G5,setMeta:()=>W5,setNode:()=>K5,setNodeSelection:()=>Z5,setTextDirection:()=>Y5,setTextSelection:()=>X5,sinkListItem:()=>J5,splitBlock:()=>Q5,splitListItem:()=>eq,toggleList:()=>nq,toggleMark:()=>rq,toggleNode:()=>iq,toggleWrap:()=>sq,undoInputRule:()=>oq,unsetAllMarks:()=>aq,unsetMark:()=>lq,unsetTextDirection:()=>cq,updateAttributes:()=>uq,wrapIn:()=>dq,wrapInList:()=>fq});var P6=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),z6=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),j6=()=>({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,(c,u)=>{if(c.type.isText)return;const{doc:f,mapping:h}=e,m=f.resolve(h.map(u)),g=f.resolve(h.map(u+c.nodeSize)),y=m.blockRange(g);if(!y)return;const S=vc(y);if(c.type.isTextblock){const{defaultType:w}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(y.start,w)}(S||S===0)&&e.lift(y,S)})}),!0},B6=t=>e=>t(e),$6=()=>({state:t,dispatch:e})=>_N(t,e),V6=(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 Oe(r.doc.resolve(Math.max(o-1,0)))),!0},H6=()=>({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 c=i.before(s),u=i.after(s);t.delete(c,u).scrollIntoView()}return!0}return!1};function dn(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 U6=t=>({tr:e,state:n,dispatch:r})=>{const i=dn(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},F6=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},q6=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 q6(r)?n==="left"?t.start()-1:t.end()+1:t.pos},G6=(t,e,n)=>{const r=eA(t,n,"left"),i=eA(e,n,"right");return{from:r,to:i}},W6=()=>({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),c=n.doc.resolve(o.map(s.$from.pos)),u=n.doc.resolve(o.map(s.$to.pos)),{from:f,to:h}=G6(c,u,t.schema);n.deleteRange(f,h)}),n.selection.empty||n.setSelection(Oe.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),e(n)}return!0},K6=()=>({commands:t})=>t.keyboardShortcut("Enter"),Z6=()=>({state:t,dispatch:e})=>MF(t,e);function kw(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Dp(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:kw(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function pD(t,e,n={}){return t.find(r=>r.type===e&&Dp(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function tA(t,e,n={}){return!!pD(t,e,n)}function Cw(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(!pD([...r.node.marks],e,n))return;let s=r.index,o=t.start()+r.offset,c=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(;c<t.parent.childCount&&tA([...t.parent.child(c).marks],e,n);)u+=t.parent.child(c).nodeSize,c+=1;return{from:o,to:u}}function ws(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 Y6=(t,e)=>({tr:n,state:r,dispatch:i})=>{const s=ws(t,r.schema),{doc:o,selection:c}=n,{$from:u,from:f,to:h}=c;if(i){const m=Cw(u,s,e);if(m&&m.from<=f&&m.to>=h){const g=Oe.create(o,m.from,m.to);n.setSelection(g)}}return!0},X6=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 mD(t){return t instanceof Oe}function pa(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function A0(t,e=null){if(!e)return null;const n=Ve.atStart(t),r=Ve.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?Oe.create(t,pa(0,i,s),pa(t.content.size,i,s)):Oe.create(t,pa(e,i,s),pa(e,i,s))}function nA(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function Ip(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function J6(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var Q6=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(Ip()||nA())&&r.dom.focus(),J6()&&!Ip()&&!nA()&&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&&!mD(n.state.selection))return o(),!0;const c=A0(i.doc,t)||n.state.selection,u=n.state.selection.eq(c);return s&&(u||i.setSelection(c),u&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},e5=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),t5=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),gD=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&&gD(r)}return t};function Du(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 gD(n)}function lc(t,e,n){if(t instanceof yo||t instanceof ne)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 ne.fromArray(t.map(c=>e.nodeFromJSON(c)));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),lc("",e,n)}if(i){if(n.errorOnInvalidContent){let o=!1,c="";const u=new QO({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,c=typeof f=="string"?f:f.outerHTML,null)}]}})});if(n.slice?us.fromSchema(u).parseSlice(Du(t),n.parseOptions):us.fromSchema(u).parse(Du(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const s=us.fromSchema(e);return n.slice?s.parseSlice(Du(t),n.parseOptions).content:s.parse(Du(t),n.parseOptions)}return lc("",e,n)}function yD(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof cn||i instanceof vn))return;const s=t.mapping.maps[r];let o=0;s.forEach((c,u,f,h)=>{o===0&&(o=h)}),t.setSelection(Ve.near(t.doc.resolve(o),n))}var n5=t=>!("type"in t),r5=(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 c;const u=x=>{s.emit("contentError",{editor:s,error:x,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{lc(e,s.schema,{parseOptions:f,errorOnInvalidContent:!0})}catch(x){u(x)}try{c=lc(e,s.schema,{parseOptions:f,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(x){return u(x),!1}let{from:h,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,y=!0;if((n5(c)?c:[c]).forEach(x=>{x.check(),g=g?x.isText&&x.marks.length===0:!1,y=y?x.isBlock:!1}),h===m&&y){const{parent:x}=r.doc.resolve(h);x.isTextblock&&!x.type.spec.code&&!x.childCount&&(h-=1,m+=1)}let w;if(g){if(Array.isArray(e))w=e.map(x=>x.text||"").join("");else if(e instanceof ne){let x="";e.forEach(k=>{k.text&&(x+=k.text)}),w=x}else typeof e=="object"&&e&&e.text?w=e.text:w=e;r.insertText(w,h,m)}else{w=c;const x=r.doc.resolve(h),k=x.node(),T=x.parentOffset===0,A=k.isText||k.isTextblock,_=k.content.size>0;T&&A&&_&&y&&(h=Math.max(0,h-1)),r.replaceWith(h,m,w)}n.updateSelection&&yD(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:h,text:w}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:h,text:w})}return!0};function vD(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 i5=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{pos:i,attrs:s,content:o,updateSelection:c=!0}=t;let u;typeof i=="number"?u=e.doc.resolve(i):i?u=i:u=e.selection.$from;const f=vD(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=lc(o,r.schema);g=f.createAndFill(m,y)}else g=f.createAndFill(m);return g?(n&&(e.insert(u.pos,g),c&&yD(e,e.steps.length-1,-1)),!0):!1},s5=()=>({state:t,dispatch:e})=>_F(t,e),o5=()=>({state:t,dispatch:e})=>AF(t,e),a5=()=>({state:t,dispatch:e})=>SN(t,e),l5=()=>({state:t,dispatch:e})=>CN(t,e),c5=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Nm(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},u5=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Nm(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},d5=()=>({state:t,dispatch:e})=>EF(t,e),f5=()=>({state:t,dispatch:e})=>TF(t,e);function bD(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function h5(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,o;for(let c=0;c<e.length-1;c+=1){const u=e[c];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))Ip()||bD()?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 p5=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=h5(t).split(/-(?!$)/),o=s.find(f=>!["Alt","Ctrl","Meta","Shift"].includes(f)),c=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,c))});return u?.steps.forEach(f=>{const h=f.map(r.mapping);h&&i&&r.maybeStep(h)}),!0};function _o(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?dn(e,t.schema):null,c=[];t.doc.nodesBetween(r,i,(m,g)=>{if(m.isText)return;const y=Math.max(r,g),S=Math.min(i,g+m.nodeSize);c.push({node:m,from:y,to:S})});const u=i-r,f=c.filter(m=>o?o.name===m.node.type.name:!0).filter(m=>Dp(m.node.attrs,n,{strict:!1}));return s?!!f.length:f.reduce((m,g)=>m+g.to-g.from,0)>=u}var m5=(t,e={})=>({state:n,dispatch:r})=>{const i=dn(t,n.schema);return _o(n,i,e)?RF(n,r):!1},g5=()=>({state:t,dispatch:e})=>AN(t,e),y5=t=>({state:e,dispatch:n})=>{const r=dn(t,e.schema);return VF(r)(e,n)},v5=()=>({state:t,dispatch:e})=>TN(t,e);function Bm(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function rA(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 b5=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const c=Bm(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(s=dn(t,r.schema)),c==="mark"&&(o=ws(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,rA(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(rA(g.attrs,e))))})})}),u},S5=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),w5=()=>({tr:t,dispatch:e})=>{if(e){const n=new kr(t.doc);t.setSelection(n)}return!0},x5=()=>({state:t,dispatch:e})=>xN(t,e),k5=()=>({state:t,dispatch:e})=>EN(t,e),C5=()=>({state:t,dispatch:e})=>DF(t,e),E5=()=>({state:t,dispatch:e})=>PF(t,e),T5=()=>({state:t,dispatch:e})=>LF(t,e);function R0(t,e,n={},r={}){return lc(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var _5=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:c})=>{const{doc:u}=s;if(r.preserveWhitespace!=="full"){const f=R0(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),c.insertContentAt({from:0,to:u.content.size},t,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function SD(t,e){const n=ws(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 c=o.find(u=>u.type.name===n.name);return c?{...c.attrs}:{}}function wD(t,e){const n=new ow(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function A5(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function xD(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 $m(t){return e=>xD(e.$from,t)}function Te(t,e,n){return t.config[e]===void 0&&t.parent?Te(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?Te(t.parent,e,n):null}):t.config[e]}function Vm(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=Te(e,"addExtensions",n);return r?[e,...Vm(r())]:e}).flat(10)}function Ew(t,e){const n=Ba.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function kD(t){return typeof t=="function"}function ht(t,e=void 0,...n){return kD(t)?e?t.bind(e)(...n):t(...n):t}function R5(t={}){return Object.keys(t).length===0&&t.constructor===Object}function cc(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 CD(t){const e=[],{nodeExtensions:n,markExtensions:r}=cc(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),c=r.map(f=>f.name),u=[...o,...c];return t.forEach(f=>{const h={name:f.name,options:f.options,storage:f.storage,extensions:i},m=Te(f,"addGlobalAttributes",h);if(!m)return;m().forEach(y=>{let S;Array.isArray(y.types)?S=y.types:y.types==="*"?S=u:y.types==="nodes"?S=o:y.types==="marks"?S=c:S=[],S.forEach(w=>{Object.entries(y.attributes).forEach(([x,k])=>{e.push({type:w,name:x,attribute:{...s,...k}})})})})}),i.forEach(f=>{const h={name:f.name,options:f.options,storage:f.storage},m=Te(f,"addAttributes",h);if(!m)return;const g=m();Object.entries(g).forEach(([y,S])=>{const w={...s,...S};typeof w?.default=="function"&&(w.default=w.default()),w?.isRequired&&w?.default===void 0&&delete w.default,e.push({type:f.name,name:y,attribute:w})})}),e}function M5(t){const e=[];let n="",r=!1,i=!1,s=0;const o=t.length;for(let c=0;c<o;c+=1){const u=t[c];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 iA(t){const e=[],n=M5(t||""),r=n.length;for(let i=0;i<r;i+=1){const s=n[i],o=s.indexOf(":");if(o===-1)continue;const c=s.slice(0,o).trim(),u=s.slice(o+1).trim();c&&u&&e.push([c,u])}return e}function Ot(...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 c=s?String(s).split(" "):[],u=r[i]?r[i].split(" "):[],f=c.filter(h=>!u.includes(h));r[i]=[...u,...f].join(" ")}else if(i==="style"){const c=new Map([...iA(r[i]),...iA(s)]);r[i]=Array.from(c.entries()).map(([u,f])=>`${u}: ${f}`).join("; ")}else r[i]=s}),r},{})}function uc(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)=>Ot(n,r),{})}function O5(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function sA(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 c=o.attribute.parseHTML?o.attribute.parseHTML(n):O5(n.getAttribute(o.name));return c==null?s:{...s,[o.name]:c}},{});return{...r,...i}}}}function oA(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&R5(n)?!1:n!=null))}function aA(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 ED(t,e){var n;const r=CD(t),{nodeExtensions:i,markExtensions:s}=cc(t),o=(n=i.find(f=>Te(f,"topNode")))==null?void 0:n.name,c=Object.fromEntries(i.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,T)=>{const A=Te(T,"extendNodeSchema",m);return{...k,...A?A(f):{}}},{}),y=oA({...g,content:ht(Te(f,"content",m)),marks:ht(Te(f,"marks",m)),group:ht(Te(f,"group",m)),inline:ht(Te(f,"inline",m)),atom:ht(Te(f,"atom",m)),selectable:ht(Te(f,"selectable",m)),draggable:ht(Te(f,"draggable",m)),code:ht(Te(f,"code",m)),whitespace:ht(Te(f,"whitespace",m)),linebreakReplacement:ht(Te(f,"linebreakReplacement",m)),defining:ht(Te(f,"defining",m)),isolating:ht(Te(f,"isolating",m)),attrs:Object.fromEntries(h.map(aA))}),S=ht(Te(f,"parseHTML",m));S&&(y.parseDOM=S.map(k=>sA(k,h)));const w=Te(f,"renderHTML",m);w&&(y.toDOM=k=>w({node:k,HTMLAttributes:uc(k,h)}));const x=Te(f,"renderText",m);return x&&(y.toText=x),[f.name,y]})),u=Object.fromEntries(s.map(f=>{const h=r.filter(x=>x.type===f.name),m={name:f.name,options:f.options,storage:f.storage,editor:e},g=t.reduce((x,k)=>{const T=Te(k,"extendMarkSchema",m);return{...x,...T?T(f):{}}},{}),y=oA({...g,inclusive:ht(Te(f,"inclusive",m)),excludes:ht(Te(f,"excludes",m)),group:ht(Te(f,"group",m)),spanning:ht(Te(f,"spanning",m)),code:ht(Te(f,"code",m)),attrs:Object.fromEntries(h.map(aA))}),S=ht(Te(f,"parseHTML",m));S&&(y.parseDOM=S.map(x=>sA(x,h)));const w=Te(f,"renderHTML",m);return w&&(y.toDOM=x=>w({mark:x,HTMLAttributes:uc(x,h)})),[f.name,y]}));return new QO({topNode:o,nodes:c,marks:u})}function N5(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Gl(t){return t.sort((n,r)=>{const i=Te(n,"priority")||100,s=Te(r,"priority")||100;return i>s?-1:i<s?1:0})}function Tw(t){const e=Gl(Vm(t)),n=N5(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 TD(t,e){const n=Tw(t);return ED(n,e)}function D5(t,e){const n=TD(e),r=Du(t);return us.fromSchema(n).parse(r).toJSON()}function _D(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
|
|
74
|
-
|
|
75
|
-
`,textSerializers:o={}}=n||{};let c="";return t.nodesBetween(r,i,(u,f,h,m)=>{var g;u.isBlock&&f>r&&(c+=s);const y=o?.[u.type.name];if(y)return h&&(c+=y({node:u,pos:f,parent:h,index:m,range:e})),!1;u.isText&&(c+=(g=u?.text)==null?void 0:g.slice(Math.max(r,f)-f,i-f))}),c}function I5(t,e){const n={from:0,to:t.content.size};return _D(t,n,e)}function AD(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function L5(t,e){const n=dn(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,c=>{s.push(c)});const o=s.reverse().find(c=>c.type.name===n.name);return o?{...o.attrs}:{}}function RD(t,e){const n=Bm(typeof e=="string"?e:e.name,t.schema);return n==="node"?L5(t,e):n==="mark"?SD(t,e):{}}function P5(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 z5(t){const e=P5(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 _w(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((c,u)=>{o.push({from:c,to:u})});else{const{from:c,to:u}=n[s];if(c===void 0||u===void 0)return;o.push({from:c,to:u})}o.forEach(({from:c,to:u})=>{const f=e.slice(s).map(c,-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}})})}),z5(r)}function Aw(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),o=Cw(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 j5=(t,e,n,r=20)=>{const i=t.doc.resolve(n);let s=r,o=null;for(;s>0&&o===null;){const c=i.node(s);c?.type.name===e?o=c:s-=1}return[o,s]};function wu(t,e){return e.nodes[t]||e.marks[t]||null}function Xh(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 B5=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,c)=>{var u,f;const h=((f=(u=i.type.spec).toText)==null?void 0:f.call(u,{node:i,pos:s,parent:o,index:c}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?h:h.slice(0,Math.max(0,r-s))}),n};function M0(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?ws(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>s?s.name===m.type.name:!0).find(m=>Dp(m.attrs,n,{strict:!1}));let o=0;const c=[];if(i.forEach(({$from:m,$to:g})=>{const y=m.pos,S=g.pos;t.doc.nodesBetween(y,S,(w,x)=>{if(s&&w.inlineContent&&!w.type.allowsMarkType(s))return!1;if(!w.isText&&!w.marks.length)return;const k=Math.max(y,x),T=Math.min(S,x+w.nodeSize),A=T-k;o+=A,c.push(...w.marks.map(_=>({mark:_,from:k,to:T})))})}),o===0)return!1;const u=c.filter(m=>s?s.name===m.mark.type.name:!0).filter(m=>Dp(m.mark.attrs,n,{strict:!1})).reduce((m,g)=>m+g.to-g.from,0),f=c.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 $5(t,e,n={}){if(!e)return _o(t,null,n)||M0(t,null,n);const r=Bm(e,t.schema);return r==="node"?_o(t,e,n):r==="mark"?M0(t,e,n):!1}var V5=(t,e)=>{const{$from:n,$to:r,$anchor:i}=t.selection;if(e){const s=$m(c=>c.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)},H5=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function lA(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Jv(t,e){const{nodeExtensions:n}=cc(e),r=n.find(o=>o.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=ht(Te(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function Vd(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&&(Vd(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function MD(t){return t instanceof De}var OD=class ND{constructor(e){this.position=e}static fromJSON(e){return new ND(e.position)}toJSON(){return{position:this.position}}};function U5(t,e){const n=e.mapping.mapResult(t.position);return{position:new OD(n.pos),mapResult:n}}function F5(t){return new OD(t)}function q5(t,e,n){var r;const{selection:i}=e;let s=null;if(mD(i)&&(s=i.$cursor),s){const c=(r=t.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(n)&&(!!n.isInSet(c)||!c.some(f=>f.type.excludes(n)))}const{ranges:o}=i;return o.some(({$from:c,$to:u})=>{let f=c.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(c.pos,u.pos,(h,m,g)=>{if(f)return!1;if(h.isInline){const y=!g||g.type.allowsMarkType(n),S=!!n.isInSet(h.marks)||!h.marks.some(w=>w.type.excludes(n));f=y&&S}return!f}),f})}var G5=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:c}=s,u=ws(t,r.schema);if(i)if(o){const f=SD(r,u);n.addStoredMark(u.create({...f,...e}))}else c.forEach(f=>{const h=f.$from.pos,m=f.$to.pos;r.doc.nodesBetween(h,m,(g,y)=>{const S=Math.max(y,h),w=Math.min(y+g.nodeSize,m);g.marks.find(k=>k.type===u)?g.marks.forEach(k=>{u===k.type&&n.addMark(S,w,u.create({...k.attrs,...e}))}):n.addMark(S,w,u.create(e))})});return q5(r,n,u)},W5=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),K5=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=dn(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:c})=>k_(s,{...o,...e})(n)?!0:c.clearNodes()).command(({state:c})=>k_(s,{...o,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Z5=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=pa(t,0,r.content.size),s=De.create(r,i);e.setSelection(s)}return!0},Y5=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=r;let o,c;return typeof e=="number"?(o=e,c=e):e&&"from"in e&&"to"in e?(o=e.from,c=e.to):(o=s.from,c=s.to),i&&n.doc.nodesBetween(o,c,(u,f)=>{u.isText||n.setNodeMarkup(f,void 0,{...u.attrs,dir:t})}),!0},X5=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,o=Oe.atStart(r).from,c=Oe.atEnd(r).to,u=pa(i,o,c),f=pa(s,o,c),h=Oe.create(r,u,f);e.setSelection(h)}return!0},J5=t=>({state:e,dispatch:n})=>{const r=dn(t,e.schema);return FF(r)(e,n)};function cA(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 Q5=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:c,$to:u}=s,f=i.extensionManager.attributes,h=Xh(f,c.node().type.name,c.node().attrs);if(s instanceof De&&s.node.isBlock)return!c.parentOffset||!ds(o,c.pos)?!1:(r&&(t&&cA(n,i.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const m=u.parentOffset===u.parent.content.size,g=c.depth===0?void 0:vD(c.node(-1).contentMatchAt(c.indexAfter(-1)));let y=m&&g?[{type:g,attrs:h}]:void 0,S=ds(e.doc,e.mapping.map(c.pos),1,y);if(!y&&!S&&ds(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(S=!0,y=g?[{type:g,attrs:h}]:void 0),r){if(S&&(s instanceof Oe&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,y),g&&!m&&!c.parentOffset&&c.parent.type!==g)){const w=e.mapping.map(c.before()),x=e.doc.resolve(w);c.node(-1).canReplaceWith(x.index(),x.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}t&&cA(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return S},eq=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var o;const c=dn(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!==c)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!==c||u.index(-2)!==u.node(-2).childCount-1)return!1;if(i){let k=ne.empty;const T=u.index(-1)?1:u.index(-2)?2:3;for(let z=u.depth-T;z>=u.depth-3;z-=1)k=ne.from(u.node(z).copy(k));const A=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,_={...Xh(g,u.node().type.name,u.node().attrs),...e},O=((o=c.contentMatch.defaultType)==null?void 0:o.createAndFill(_))||void 0;k=k.append(ne.from(c.createAndFill(null,O)||void 0));const N=u.before(u.depth-(T-1));n.replace(N,u.after(-A),new ve(k,4-T,0));let I=-1;n.doc.nodesBetween(N,n.doc.content.size,(z,q)=>{if(I>-1)return!1;z.isTextblock&&z.content.size===0&&(I=q+1)}),I>-1&&n.setSelection(Oe.near(n.doc.resolve(I))),n.scrollIntoView()}return!0}const y=f.pos===u.end()?m.contentMatchAt(0).defaultType:null,S={...Xh(g,m.type.name,m.attrs),...e},w={...Xh(g,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,f.pos);const x=y?[{type:c,attrs:S},{type:y,attrs:w}]:[{type:c,attrs:S}];if(!ds(n.doc,u.pos,2))return!1;if(i){const{selection:k,storedMarks:T}=r,{splittableMarks:A}=s.extensionManager,_=T||k.$to.parentOffset&&k.$from.marks();if(n.split(u.pos,2,x).scrollIntoView(),!_||!i)return!0;const O=_.filter(N=>A.includes(N.type.name));n.ensureMarks(O)}return!0};function uA(t){return!t||t==="1"?null:t}function DD(t,e){return uA(t)===uA(e)}var Qv=(t,e)=>{const n=$m(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&&Io(t.doc,n.pos))||!DD(n.node.attrs.type,i?.attrs.type)||t.join(n.pos),!0},eb=(t,e)=>{const n=$m(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&&Io(t.doc,r))||!DD(n.node.attrs.type,i?.attrs.type)||t.join(r),!0};function tq(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),i=e.resolve(n.nodeSize-1);return Oe.between(r,i)}var nq=(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:c,chain:u,commands:f,can:h})=>{const{extensions:m,splittableMarks:g}=i.extensionManager,y=dn(t,o.schema),S=dn(e,o.schema),{selection:w,storedMarks:x}=o,{$from:k,$to:T}=w,A=k.blockRange(T),_=x||w.$to.parentOffset&&w.$from.marks();if(!A)return!1;const O=$m(te=>Jv(te.type.name,m))(w),N=w.from===0&&w.to===o.doc.content.size,I=o.doc.content.content,z=I.length===1?I[0]:null,q=N&&z&&Jv(z.type.name,m)?{node:z,pos:0}:null,Z=O??q,ae=!!O&&A.depth>=1&&A.depth-O.depth<=1,X=!!q;if((ae||X)&&Z){if(Z.node.type===y)return N&&X?u().command(({tr:te,dispatch:ie})=>{const de=tq(te);return de?(te.setSelection(de),ie&&ie(te),!0):!1}).liftListItem(S).run():f.liftListItem(S);if(Jv(Z.node.type.name,m)&&y.validContent(Z.node.content))return u().command(()=>(s.setNodeMarkup(Z.pos,y),!0)).command(()=>Qv(s,y)).command(()=>eb(s,y)).run()}return!n||!_||!c?u().command(()=>h().wrapInList(y,r)?!0:f.clearNodes()).wrapInList(y,r).command(()=>Qv(s,y)).command(()=>eb(s,y)).run():u().command(()=>{const te=h().wrapInList(y,r),ie=_.filter(de=>g.includes(de.type.name));return s.ensureMarks(ie),te?!0:f.clearNodes()}).wrapInList(y,r).command(()=>Qv(s,y)).command(()=>eb(s,y)).run()},rq=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=ws(t,r.schema);return M0(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},iq=(t,e,n={})=>({state:r,commands:i})=>{const s=dn(t,r.schema),o=dn(e,r.schema),c=_o(r,s,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),c?i.setNode(o,u):i.setNode(s,{...u,...n})},sq=(t,e={})=>({state:n,commands:r})=>{const i=dn(t,n.schema);return _o(n,i,e)?r.lift(i):r.wrapIn(i,e)},oq=()=>({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,c=s.transform;for(let u=c.steps.length-1;u>=0;u-=1)o.step(c.steps[u].invert(c.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},aq=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{ignoreClearable:i=!1}=t,{selection:s}=e,{empty:o,ranges:c}=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));c.forEach(h=>{for(const m of f)e.removeMark(h.$from.pos,h.$to.pos,m)})}return!0},lq=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:c}=n,u=ws(t,r.schema),{$from:f,empty:h,ranges:m}=c;if(!i)return!0;if(h&&o){let{from:g,to:y}=c;const S=(s=f.marks().find(x=>x.type===u))==null?void 0:s.attrs,w=Cw(f,u,S);w&&(g=w.from,y=w.to),n.removeMark(g,y,u)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,u)});return n.removeStoredMark(u),!0},cq=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,(c,u)=>{if(c.isText)return;const f={...c.attrs};delete f.dir,e.setNodeMarkup(u,void 0,f)}),!0},uq=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const c=Bm(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(s=dn(t,r.schema)),c==="mark"&&(o=ws(t,r.schema));let u=!1;return n.selection.ranges.forEach(f=>{const h=f.$from.pos,m=f.$to.pos;let g,y,S,w;n.selection.empty?r.doc.nodesBetween(h,m,(x,k)=>{s&&s===x.type&&(u=!0,S=Math.max(k,h),w=Math.min(k+x.nodeSize,m),g=k,y=x)}):r.doc.nodesBetween(h,m,(x,k)=>{k<h&&s&&s===x.type&&(u=!0,S=Math.max(k,h),w=Math.min(k+x.nodeSize,m),g=k,y=x),k>=h&&k<=m&&(s&&s===x.type&&(u=!0,i&&n.setNodeMarkup(k,void 0,{...x.attrs,...e})),o&&x.marks.length&&x.marks.forEach(T=>{if(o===T.type&&(u=!0,i)){const A=Math.max(k,h),_=Math.min(k+x.nodeSize,m);n.addMark(A,_,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(x=>{o===x.type&&i&&n.addMark(S,w,o.create({...x.attrs,...e}))}))}),u},dq=(t,e={})=>({state:n,dispatch:r})=>{const i=dn(t,n.schema);return zF(i,e)(n,r)},fq=(t,e={})=>({state:n,dispatch:r})=>{const i=dn(t,n.schema);return jF(i,e)(n,r)},hq=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 dc(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 pq(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof De){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 mq(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 dA(t){return t.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&")}function gq(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function yq(t){return typeof t=="number"}function vq(t){return Object.prototype.toString.call(t).slice(8,-1)}function yh(t){return vq(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}var bq={};xw(bq,{createAtomBlockMarkdownSpec:()=>Sq,createBlockMarkdownSpec:()=>wq,createInlineMarkdownSpec:()=>Cq,parseAttributes:()=>Rw,parseIndentedBlocks:()=>O0,renderNestedMarkdownContent:()=>Ow,serializeAttributes:()=>Mw});function Rw(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 Mw(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 Sq(t){const{nodeName:e,name:n,parseAttributes:r=Rw,serializeAttributes:i=Mw,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:c}=t,u=n||e,f=h=>{if(!c)return h;const m={};return c.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|$)`),S=h.match(y);if(!S)return;const w=S[1]||"",x=r(w);if(!o.find(T=>!(T in x)))return{type:e,raw:S[0],attributes:x}}},renderMarkdown:h=>{const m=f(h.attrs||{}),g=i(m),y=g?` {${g}}`:"";return`:::${u}${y} :::`}}}function wq(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=Rw,serializeAttributes:s=Mw,defaultAttributes:o={},content:c="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 w=r(m);y=typeof w=="string"?[{type:"text",text:w}]:w}else c==="block"?y=g.parseChildren(m.tokens||[]):y=g.parseInline(m.tokens||[]);const S={...o,...m.attributes};return g.createNode(e,S,y)},markdownTokenizer:{name:e,level:"block",start(m){var g;const y=new RegExp(`^:::${f}`,"m"),S=(g=m.match(y))==null?void 0:g.index;return S!==void 0?S:-1},tokenize(m,g,y){var S;const w=new RegExp(`^:::${f}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),x=m.match(w);if(!x)return;const[k,T=""]=x,A=i(T);let _=1;const O=k.length;let N="";const I=/^:::([\w-]*)(\s.*)?/gm,z=m.slice(O);for(I.lastIndex=0;;){const q=I.exec(z);if(q===null)break;const Z=q.index,ae=q[1];if(!((S=q[2])!=null&&S.endsWith(":::"))){if(ae)_+=1;else if(_-=1,_===0){const X=z.slice(0,Z);N=X.trim();const te=m.slice(0,O+Z+q[0].length);let ie=[];if(N)if(c==="block")for(ie=y.blockTokens(X),ie.forEach(de=>{de.text&&(!de.tokens||de.tokens.length===0)&&(de.tokens=y.inlineTokens(de.text))});ie.length>0;){const de=ie[ie.length-1];if(de.type==="paragraph"&&(!de.text||de.text.trim()===""))ie.pop();else break}else ie=y.inlineTokens(N);return{type:e,raw:te,attributes:A,content:N,tokens:ie}}}}}},renderMarkdown:(m,g)=>{const y=h(m.attrs||{}),S=s(y),w=S?` {${S}}`:"",x=g.renderChildren(m.content||[],`
|
|
76
|
-
|
|
77
|
-
`);return`:::${f}${w}
|
|
78
|
-
|
|
79
|
-
${x}
|
|
80
|
-
|
|
81
|
-
:::`}}}function xq(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 kq(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function Cq(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=xq,serializeAttributes:s=kq,defaultAttributes:o={},selfClosing:c=!1,allowedAttributes:u}=t,f=n||e,h=g=>{if(!u)return g;const y={};return u.forEach(S=>{const w=typeof S=="string"?S:S.name,x=typeof S=="string"?void 0:S.skipIfDefault;if(w in g){const k=g[w];if(x!==void 0&&k===x)return;y[w]=k}}),y},m=f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(g,y)=>{const S={...o,...g.attributes};if(c)return y.createNode(e,S);const w=r?r(g):g.content||"";return w?y.createNode(e,S,[y.createTextNode(w)]):y.createNode(e,S,[])},markdownTokenizer:{name:e,level:"inline",start(g){const y=c?new RegExp(`\\[${m}\\s*[^\\]]*\\]`):new RegExp(`\\[${m}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${m}\\]`),S=g.match(y),w=S?.index;return w!==void 0?w:-1},tokenize(g,y,S){const w=c?new RegExp(`^\\[${m}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${m}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${m}\\]`),x=g.match(w);if(!x)return;let k="",T="";if(c){const[,_]=x;T=_}else{const[,_,O]=x;T=_,k=O||""}const A=i(T.trim());return{type:e,raw:x[0],content:k.trim(),attributes:A}}},renderMarkdown:g=>{let y="";r?y=r(g):g.content&&g.content.length>0&&(y=g.content.filter(k=>k.type==="text").map(k=>k.text).join(""));const S=h(g.attrs||{}),w=s(S),x=w?` ${w}`:"";return c?`[${f}${x}]`:`[${f}${x}]${y}[/${f}]`}}}function O0(t,e,n){var r,i,s,o;const c=t.split(`
|
|
82
|
-
`),u=[];let f="",h=0;const m=e.baseIndentSize||2;for(;h<c.length;){const g=c[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 S=e.extractItemData(y),{indentLevel:w,mainContent:x}=S;f=`${f}${g}
|
|
84
|
-
`;const k=[x];for(h+=1;h<c.length;){const O=c[h];if(O.trim()===""){const I=c.slice(h+1).findIndex(Z=>Z.trim()!=="");if(I===-1)break;if((((i=(r=c[h+1+I].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>w){k.push(O),f=`${f}${O}
|
|
85
|
-
`,h+=1;continue}else break}if((((o=(s=O.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:o.length)||0)>w)k.push(O),f=`${f}${O}
|
|
86
|
-
`,h+=1;else break}let T;const A=k.slice(1);if(A.length>0){const O=A.map(N=>N.slice(w+m)).join(`
|
|
87
|
-
`);O.trim()&&(e.customNestedParser?T=e.customNestedParser(O):T=n.blockTokens(O))}const _=e.createToken(S,T);u.push(_)}if(u.length!==0)return{items:u,raw:f}}function Ow(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const i=typeof n=="function"?n(r):n,[s,...o]=t.content,c=e.renderChildren([s]);let u=`${i}${c}`;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 S=y.split(`
|
|
88
|
-
`).map(w=>w?e.indent(w):e.indent("")).join(`
|
|
89
|
-
`);u+=f.type==="paragraph"?`
|
|
90
|
-
|
|
91
|
-
${S}`:`
|
|
92
|
-
${S}`}}),u}function fA(t){return typeof t.type=="string"?t.type:t.type.name}function Eq(t,e){if(t.length!==e.length)return!1;const n=Array.from({length:e.length},()=>!1);return t.every(r=>{const i=fA(r),s=e.findIndex((o,c)=>!n[c]&&i===fA(o)&&dc(r.attrs,o.attrs));return s===-1?!1:(n[s]=!0,!0)})}function ID(t,e){const n={...t};return yh(t)&&yh(e)&&Object.keys(e).forEach(r=>{yh(e[r])&&yh(t[r])?n[r]=ID(t[r],e[r]):n[r]=e[r]}),n}function Tq(t,e,n={}){const{state:r}=e,{doc:i,tr:s}=r,o=t;i.descendants((c,u)=>{const f=s.mapping.map(u),h=s.mapping.map(u)+c.nodeSize;let m=null;if(c.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 Hd=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},_q=(t,e)=>{if(kw(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 vh(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:c}=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=B5(f)+s;return o.forEach(g=>{if(h)return;const y=_q(m,g.find);if(!y)return;const S=y[0].length-s.length;if(S>0){const N=f.parentOffset-S;if(N<0||f.parent.textBetween(N,f.parentOffset)!==y[0].slice(0,S))return}const w=u.state.tr,x=zm({state:u.state,transaction:w}),k={from:r-(y[0].length-s.length),to:i},{commands:T,chain:A,can:_}=new jm({editor:n,state:x});g.handler({state:x,range:k,match:y,commands:T,chain:A,can:_})===null||!w.steps.length||(g.undoable&&w.setMeta(c,{transform:w,from:r,to:i,text:s}),u.dispatch(w),h=!0)}),h}function Aq(t){const{editor:e,rules:n}=t,r=new Nt({state:{init(){return null},apply(i,s,o){const c=i.getMeta(r);if(c)return c;const u=i.getMeta("applyInputRules");return u&&setTimeout(()=>{let{text:h}=u;typeof h=="string"?h=h:h=Ew(ne.from(h),o.schema);const{from:m}=u,g=m+h.length;vh({editor:e,from:m,to:g,text:h,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,c){return vh({editor:e,from:s,to:o,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&vh({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?vh({editor:e,from:o.pos,to:o.pos,text:`
|
|
93
|
-
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var Nw=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{...ht(Te(this,"addOptions",{name:this.name}))}}get storage(){return{...ht(Te(this,"addStorage",{name:this.name,options:this.options}))}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>ID(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}},$a=class LD extends Nw{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new LD(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)}},PD=class{constructor(t){this.find=t.find,this.handler=t.handler}},Rq=(t,e,n)=>{if(kw(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 Mq(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:c}=t,{commands:u,chain:f,can:h}=new jm({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,i,(y,S)=>{var w,x,k,T,A;if((x=(w=y.type)==null?void 0:w.spec)!=null&&x.code||!(y.isText||y.isTextblock||y.isInline))return;const _=(A=(T=(k=y.content)==null?void 0:k.size)!=null?T:y.nodeSize)!=null?A:0,O=Math.max(r,S),N=Math.min(i,S+_);if(O>=N)return;const I=y.isText?y.text||"":y.textBetween(O-S,N-S,void 0,"");Rq(I,s.find,o).forEach(q=>{if(q.index===void 0)return;const Z=O+q.index+1,ae=Z+q[0].length,X={from:n.tr.mapping.map(Z),to:n.tr.mapping.map(ae)},te=s.handler({state:n,range:X,match:q,commands:u,chain:f,can:h,pasteEvent:o,dropEvent:c});m.push(te)})}),m.every(y=>y!==null)}var bh=null,Oq=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function Nq(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const u=({state:h,from:m,to:g,rule:y,pasteEvt:S})=>{const w=h.tr,x=zm({state:h,transaction:w});if(!(!Mq({editor:e,state:x,from:Math.max(m-1,0),to:g.b-1,rule:y,pasteEvent:S,dropEvent:c})||!w.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,w}};return n.map(h=>new Nt({view(m){const g=S=>{var w;r=(w=m.dom.parentElement)!=null&&w.contains(S.target)?m.dom.parentElement:null,r&&(bh=e)},y=()=>{bh&&(bh=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,c=g,!s){const y=bh;y?.isEditable&&setTimeout(()=>{const S=y.state.selection;S&&y.commands.deleteRange({from:S.from,to:S.to})},10)}return!1},paste:(m,g)=>{var y;const S=(y=g.clipboardData)==null?void 0:y.getData("text/html");return o=g,i=!!S?.includes("data-pm-slice"),!1}}},appendTransaction:(m,g,y)=>{const S=m[0],w=S.getMeta("uiEvent")==="paste"&&!i,x=S.getMeta("uiEvent")==="drop"&&!s,k=S.getMeta("applyPasteRules"),T=!!k;if(!w&&!x&&!T)return;if(T){let{text:O}=k;typeof O=="string"?O=O:O=Ew(ne.from(O),y.schema);const{from:N}=k,I=N+O.length,z=Oq(O);return u({rule:h,state:y,from:N,to:{b:I},pasteEvt:z})}const A=g.doc.content.findDiffStart(y.doc.content),_=g.doc.content.findDiffEnd(y.doc.content);if(!(!yq(A)||!_||A===_.b))return u({rule:h,state:y,from:A,to:_,pasteEvt:o})}}))}var Hm=class{constructor(t,e){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=Tw(t),this.schema=ED(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:wu(e.name,this.schema)},r=Te(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return Gl([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:wu(r.name,this.schema)},s=[],o=Te(r,"addKeyboardShortcuts",i);let c={};if(r.type==="mark"&&Te(r,"exitable",i)&&(c.ArrowRight=()=>$a.handleExit({editor:t,mark:r})),o){const g=Object.fromEntries(Object.entries(o()).map(([y,S])=>[y,()=>S({editor:t})]));c={...c,...g}}const u=I6(c);s.push(u);const f=Te(r,"addInputRules",i);if(lA(r,t.options.enableInputRules)&&f){const g=f();if(g&&g.length){const y=Aq({editor:t,rules:g}),S=Array.isArray(y)?y:[y];s.push(...S)}}const h=Te(r,"addPasteRules",i);if(lA(r,t.options.enablePasteRules)&&h){const g=h();if(g&&g.length){const y=Nq({editor:t,rules:g});s.push(...y)}}const m=Te(r,"addProseMirrorPlugins",i);if(m){const g=m();s.push(...g)}return s})}get attributes(){return CD(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=cc(this.extensions);return Object.fromEntries(e.filter(n=>!!Te(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:dn(n.name,this.schema)},s=Te(n,"addNodeView",i);if(!s)return[];const o=s();if(!o)return[];const c=(u,f,h,m,g)=>{const y=uc(u,r);return o({node:u,view:f,getPos:h,decorations:m,innerDecorations:g,editor:t,extension:n,HTMLAttributes:y})};return[n.name,c]}))}dispatchTransaction(t){const{editor:e}=this;return Gl([...this.extensions].reverse()).reduceRight((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:wu(i.name,this.schema)},o=Te(i,"dispatchTransaction",s);return o?c=>{o.call(s,{transaction:c,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return Gl([...this.extensions]).reduce((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:wu(i.name,this.schema)},o=Te(i,"transformPastedHTML",s);return o?(c,u)=>{const f=r(c,u);return o.call(s,f)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=cc(this.extensions);return Object.fromEntries(e.filter(n=>!!Te(n,"addMarkView")).map(n=>{const r=this.attributes.filter(c=>c.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ws(n.name,this.schema)},s=Te(n,"addMarkView",i);if(!s)return[];const o=(c,u,f)=>{const h=uc(c,r);return s()({mark:c,view:u,inline:f,editor:t,extension:n,HTMLAttributes:h,updateAttributes:m=>{Tq(c,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:wu(e.name,this.schema)};e.type==="mark"&&(((n=ht(Te(e,"keepOnSplit",i)))==null||n)&&this.splittableMarks.push(e.name),(r=ht(Te(e,"clearable",i)))==null||r||this.nonClearableMarks.push(e.name));const s=Te(e,"onBeforeCreate",i),o=Te(e,"onCreate",i),c=Te(e,"onUpdate",i),u=Te(e,"onSelectionUpdate",i),f=Te(e,"onTransaction",i),h=Te(e,"onFocus",i),m=Te(e,"onBlur",i),g=Te(e,"onDestroy",i);s&&this.editor.on("beforeCreate",s),o&&this.editor.on("create",o),c&&this.editor.on("update",c),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)})}};Hm.resolve=Tw;Hm.sort=Gl;Hm.flatten=Vm;var Dq={};xw(Dq,{ClipboardTextSerializer:()=>jD,Commands:()=>BD,Delete:()=>$D,Drop:()=>VD,Editable:()=>HD,FocusEvents:()=>FD,Keymap:()=>qD,Paste:()=>GD,Tabindex:()=>WD,TextDirection:()=>KD,focusEventsPluginKey:()=>UD});var $t=class zD extends Nw{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new zD(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},jD=$t.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Nt({key:new Zt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,s=AD(n),{blockSeparator:o}=this.options,c={...o!==void 0?{blockSeparator:o}:{},textSerializers:s};return[...i.ranges].sort((f,h)=>f.$from.pos-h.$from.pos).map(({$from:f,$to:h})=>_D(r,{from:f.pos,to:h.pos},c)).join(o??`
|
|
94
|
-
|
|
95
|
-
`)}}})]}}),BD=$t.create({name:"commands",addCommands(){return{...Zr}}}),$D=$t.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,i;const s=()=>{var o,c,u,f;if((f=(u=(c=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:c.filterTransaction)==null?void 0:u.call(c,t))!=null?f:t.getMeta("y-sync$"))return;const h=wD(t.before,[t,...e]);_w(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,(S,w)=>{const x=w+S.nodeSize-2,k=y.oldRange.from<=w&&x<=y.oldRange.to;this.editor.emit("delete",{type:"node",node:S,from:w,to:x,newFrom:h.mapping.map(w),newTo:h.mapping.map(x),deletedRange:y.oldRange,newRange:y.newRange,partial:!k,editor:this.editor,transaction:t,combinedTransform:h})})});const g=h.mapping;h.steps.forEach((y,S)=>{var w,x;if(y instanceof ri){const k=g.slice(S).map(y.from,-1),T=g.slice(S).map(y.to),A=g.invert().map(k,-1),_=g.invert().map(T),O=k>0?(w=h.doc.nodeAt(k-1))==null?void 0:w.marks.some(I=>I.eq(y.mark)):!1,N=(x=h.doc.nodeAt(T))==null?void 0:x.marks.some(I=>I.eq(y.mark));this.editor.emit("delete",{type:"mark",mark:y.mark,from:y.from,to:y.to,deletedRange:{from:A,to:_},newRange:{from:k,to:T},partial:!!(N||O),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()}}),VD=$t.create({name:"drop",addProseMirrorPlugins(){return[new Nt({key:new Zt("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),HD=$t.create({name:"editable",addProseMirrorPlugins(){return[new Nt({key:new Zt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),UD=new Zt("focusEvents"),FD=$t.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Nt({key:UD,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}}}})]}}),qD=$t.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:c})=>{const{selection:u,doc:f}=c,{empty:h,$anchor:m}=u,{pos:g,parent:y}=m,S=m.parent.isTextblock&&g>0?c.doc.resolve(g-1):m,w=S.parent.type.spec.isolating,x=m.pos-m.parentOffset,k=w&&S.parent.childCount===1?x===m.pos:Ve.atStart(f).from===g;return!h||!y.type.isTextblock||y.textContent.length||!k||k&&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 Ip()||bD()?s:i},addProseMirrorPlugins(){return[new Nt({key:new Zt("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(w=>w.getMeta("composition")))return;const r=t.some(w=>w.docChanged)&&!e.doc.eq(n.doc),i=t.some(w=>w.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:c}=e.selection,u=Ve.atStart(e.doc).from,f=Ve.atEnd(e.doc).to;if(s||!(o===u&&c===f)||!Vd(n.doc))return;const g=n.tr,y=zm({state:n,transaction:g}),{commands:S}=new jm({editor:this.editor,state:y});if(S.clearNodes(),!!g.steps.length)return g}})]}}),GD=$t.create({name:"paste",addProseMirrorPlugins(){return[new Nt({key:new Zt("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),WD=$t.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Nt({key:new Zt("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!=null?t:"0"}}}})]}}),KD=$t.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=cc(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 Zt("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),Iq=class Iu{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 Iu(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 Iu(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 Iu(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,c=this.pos+r+(s?0:1);if(c<0||c>this.resolvedPos.doc.nodeSize-2)return;const u=this.resolvedPos.doc.resolve(c);if(!i&&!o&&u.depth<=this.depth)return;const f=new Iu(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 c=0;c<o.length;c+=1){const u=o[c];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)}},Lq=`.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
|
-
}`,Pq=class extends hq{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:U5,createMappablePosition:F5},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=A0(e,this.options.autofocus);this.editorState=da.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=mq(Lq,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=kD(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?[HD,jD.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),BD,FD,qD,WD.configure({value:(r=(n=this.options.coreExtensionOptions)==null?void 0:n.tabindex)==null?void 0:r.value}),VD,GD,$D,KD.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 Hm(s,this)}createCommandManager(){this.commandManager=new jm({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=R0(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=R0(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=da.create({doc:n,schema:this.schema,selection:A0(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 hD(t,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const c=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(c),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")),c=o?.getMeta("focus"),u=o?.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.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 RD(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return $5(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Ew(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
|
|
166
|
-
|
|
167
|
-
`,textSerializers:n={}}=t||{};return I5(this.state.doc,{blockSeparator:e,textSerializers:{...AD(this.schema),...n}})}get isEmpty(){return Vd(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 Iq(e,this,!1,n)}get $doc(){return this.$pos(0)}};function Ra(t){return new Hd({find:t.find,handler:({state:e,range:n,match:r})=>{const i=ht(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],c=r[0];if(o){const u=c.search(/\S/),f=n.from+c.indexOf(o),h=f+o.length;if(Aw(n.from,n.to,e.doc).filter(y=>y.mark.type.excluded.find(w=>w===t.type&&w!==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 ZD(t){return new Hd({find:t.find,handler:({state:e,range:n,match:r})=>{const i=ht(t.getAttributes,void 0,r)||{},{tr:s}=e,o=n.from;let c=n.to;const u=t.type.create(i);if(r[1]){const f=r[0].lastIndexOf(r[1]);let h=o+f;h>c?h=c:c=h+r[1].length;const m=r[0][r[0].length-1];s.insertText(m,o+r[0].length-1),s.replaceWith(h,c,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(c))}s.scrollIntoView()},undoable:t.undoable})}function N0(t){return new Hd({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=ht(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 fc(t){return new Hd({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=ht(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),u=o.doc.resolve(n.from).blockRange(),f=u&&sw(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,S=g||m.$to.parentOffset&&m.$from.marks();if(S){const w=S.filter(x=>y.includes(x.type.name));o.ensureMarks(w)}}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&&Io(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,h))&&o.join(n.from-1)},undoable:t.undoable})}var zq=t=>"touches"in t,jq=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=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.clientX-this.startX,f=c.clientY-this.startY;this.handleResize(u,f)},this.handleTouchMove=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.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 c=this.element.offsetWidth,u=this.element.offsetHeight;this.onCommit(c,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=c=>{c.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=c=>{c.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,zq(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"),c=t.includes("bottom"),u=t.includes("top");return s?r=this.startWidth+e:o&&(r=this.startWidth-e),c?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+(c?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 c=t,u=e;return c<this.minSize.width&&(c=this.minSize.width,u=c/this.aspectRatio),u<this.minSize.height&&(u=this.minSize.height,c=u*this.aspectRatio),(s=this.maxSize)!=null&&s.width&&c>this.maxSize.width&&(c=this.maxSize.width,u=c/this.aspectRatio),(o=this.maxSize)!=null&&o.height&&u>this.maxSize.height&&(u=this.maxSize.height,c=u*this.aspectRatio),{width:c,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 YD extends Nw{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new YD(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Ao(t){return new PD({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=ht(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,c=r[r.length-1],u=r[0];let f=n.to;if(c){const h=u.search(/\S/),m=n.from+u.indexOf(c),g=m+c.length;if(Aw(n.from,n.to,e.doc).filter(w=>w.mark.type.excluded.find(k=>k===t.type&&k!==w.mark.type)).filter(w=>w.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+c.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:Bq,getOwnPropertySymbols:$q}=Object,{hasOwnProperty:Vq}=Object.prototype;function tb(t,e){return function(r,i,s){return t(r,i,s)&&e(r,i,s)}}function Sh(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),c=s.get(r);if(o&&c)return o===r&&c===n;s.set(n,r),s.set(r,n);const u=t(n,r,i);return s.delete(n),s.delete(r),u}}function Hq(t){return t?.[Symbol.toStringTag]}function hA(t){return Bq(t).concat($q(t))}const Uq=Object.hasOwn||((t,e)=>Vq.call(t,e));function Va(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const Fq="__v",qq="__o",Gq="_owner",{getOwnPropertyDescriptor:pA,keys:mA}=Object;function Wq(t,e){return t.byteLength===e.byteLength&&Lp(new Uint8Array(t),new Uint8Array(e))}function Kq(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 Zq(t,e){return t.byteLength===e.byteLength&&Lp(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function Yq(t,e){return Va(t.getTime(),e.getTime())}function Xq(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function Jq(t,e){return t===e}function gA(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,c,u=0;for(;(o=s.next())&&!o.done;){const f=e.entries();let h=!1,m=0;for(;(c=f.next())&&!c.done;){if(i[m]){m++;continue}const g=o.value,y=c.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 Qq=Va;function e9(t,e,n){const r=mA(t);let i=r.length;if(mA(e).length!==i)return!1;for(;i-- >0;)if(!XD(t,e,n,r[i]))return!1;return!0}function xu(t,e,n){const r=hA(t);let i=r.length;if(hA(e).length!==i)return!1;let s,o,c;for(;i-- >0;)if(s=r[i],!XD(t,e,n,s)||(o=pA(t,s),c=pA(e,s),(o||c)&&(!o||!c||o.configurable!==c.configurable||o.enumerable!==c.enumerable||o.writable!==c.writable)))return!1;return!0}function t9(t,e){return Va(t.valueOf(),e.valueOf())}function n9(t,e){return t.source===e.source&&t.flags===e.flags}function yA(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,c;for(;(o=s.next())&&!o.done;){const u=e.values();let f=!1,h=0;for(;(c=u.next())&&!c.done;){if(!i[h]&&n.equals(o.value,c.value,o.value,c.value,t,e,n)){f=i[h]=!0;break}h++}if(!f)return!1}return!0}function Lp(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 r9(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 XD(t,e,n,r){return(r===Gq||r===qq||r===Fq)&&(t.$$typeof||e.$$typeof)?!0:Uq(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const i9="[object ArrayBuffer]",s9="[object Arguments]",o9="[object Boolean]",a9="[object DataView]",l9="[object Date]",c9="[object Error]",u9="[object Map]",d9="[object Number]",f9="[object Object]",h9="[object RegExp]",p9="[object Set]",m9="[object String]",g9={"[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},y9="[object URL]",v9=Object.prototype.toString;function b9({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:s,areMapsEqual:o,areNumbersEqual:c,areObjectsEqual:u,arePrimitiveWrappersEqual:f,areRegExpsEqual:h,areSetsEqual:m,areTypedArraysEqual:g,areUrlsEqual:y,unknownTagComparators:S}){return function(x,k,T){if(x===k)return!0;if(x==null||k==null)return!1;const A=typeof x;if(A!==typeof k)return!1;if(A!=="object")return A==="number"?c(x,k,T):A==="function"?s(x,k,T):!1;const _=x.constructor;if(_!==k.constructor)return!1;if(_===Object)return u(x,k,T);if(Array.isArray(x))return e(x,k,T);if(_===Date)return r(x,k,T);if(_===RegExp)return h(x,k,T);if(_===Map)return o(x,k,T);if(_===Set)return m(x,k,T);const O=v9.call(x);if(O===l9)return r(x,k,T);if(O===h9)return h(x,k,T);if(O===u9)return o(x,k,T);if(O===p9)return m(x,k,T);if(O===f9)return typeof x.then!="function"&&typeof k.then!="function"&&u(x,k,T);if(O===y9)return y(x,k,T);if(O===c9)return i(x,k,T);if(O===s9)return u(x,k,T);if(g9[O])return g(x,k,T);if(O===i9)return t(x,k,T);if(O===a9)return n(x,k,T);if(O===o9||O===d9||O===m9)return f(x,k,T);if(S){let N=S[O];if(!N){const I=Hq(x);I&&(N=S[I])}if(N)return N(x,k,T)}return!1}}function S9({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:Wq,areArraysEqual:n?xu:Kq,areDataViewsEqual:Zq,areDatesEqual:Yq,areErrorsEqual:Xq,areFunctionsEqual:Jq,areMapsEqual:n?tb(gA,xu):gA,areNumbersEqual:Qq,areObjectsEqual:n?xu:e9,arePrimitiveWrappersEqual:t9,areRegExpsEqual:n9,areSetsEqual:n?tb(yA,xu):yA,areTypedArraysEqual:n?tb(Lp,xu):Lp,areUrlsEqual:r9,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const i=Sh(r.areArraysEqual),s=Sh(r.areMapsEqual),o=Sh(r.areObjectsEqual),c=Sh(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:s,areObjectsEqual:o,areSetsEqual:c})}return r}function w9(t){return function(e,n,r,i,s,o,c){return t(e,n,c)}}function x9({circular:t,comparator:e,createState:n,equals:r,strict:i}){if(n)return function(c,u){const{cache:f=t?new WeakMap:void 0,meta:h}=n();return e(c,u,{cache:f,equals:r,meta:h,strict:i})};if(t)return function(c,u){return e(c,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(c,u){return e(c,u,s)}}const k9=Po();Po({strict:!0});Po({circular:!0});Po({circular:!0,strict:!0});Po({createInternalComparator:()=>Va});Po({strict:!0,createInternalComparator:()=>Va});Po({circular:!0,createInternalComparator:()=>Va});Po({circular:!0,createInternalComparator:()=>Va,strict:!0});function Po(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:i=!1}=t,s=S9(t),o=b9(s),c=n?n(o):w9(o);return x9({circular:e,comparator:o,createState:r,equals:c,strict:i})}var nb={exports:{}},rb={};var vA;function C9(){if(vA)return rb;vA=1;var t=kd(),e=IO();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,c=t.useMemo,u=t.useDebugValue;return rb.useSyncExternalStoreWithSelector=function(f,h,m,g,y){var S=s(null);if(S.current===null){var w={hasValue:!1,value:null};S.current=w}else w=S.current;S=c(function(){function k(N){if(!T){if(T=!0,A=N,N=g(N),y!==void 0&&w.hasValue){var I=w.value;if(y(I,N))return _=I}return _=N}if(I=_,r(A,N))return I;var z=g(N);return y!==void 0&&y(I,z)?(A=N,I):(A=N,_=z)}var T=!1,A,_,O=m===void 0?null:m;return[function(){return k(h())},O===null?void 0:function(){return k(O())}]},[h,m,g,y]);var x=i(f,S[0],S[1]);return o(function(){w.hasValue=!0,w.value=x},[x]),u(x),x},rb}var bA;function E9(){return bA||(bA=1,nb.exports=C9()),nb.exports}var T9=E9(),_9=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},A9=({contentComponent:t})=>{const e=LO.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return C.jsx(C.Fragment,{children:Object.values(e)})};function R9(){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]:FH.createPortal(s.reactElement,s.element,i)},r()},removeRenderer(i){const s={...e};delete s[i],e=s,r()}}}var M9=class extends Be.Component{constructor(t){super(t),this.editorContentRef=Be.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=R9(),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 C.jsxs(C.Fragment,{children:[C.jsx("div",{ref:_9(e,this.editorContentRef),...n}),t?.contentComponent&&C.jsx(A9,{contentComponent:t.contentComponent})]})}},O9=R.forwardRef((t,e)=>{const n=Be.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Be.createElement(M9,{key:n,innerRef:e,...t})}),JD=Be.memo(O9),N9=typeof window<"u"?R.useLayoutEffect:R.useEffect,D9=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 QD(t){var e;const[n]=R.useState(()=>new D9(t.editor)),r=T9.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:k9);return N9(()=>n.watch(t.editor),[t.editor,n]),R.useDebugValue(r),r}var I9=!1,eI=typeof window>"u",L9=eI||!!(typeof window<"u"&&window.next),P9=class tI{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 eI?(n&&I9&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),n=!1):L9&&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 Pq(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?tI.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 z9(t={},e=[]){const n=R.useRef(t);n.current=t;const[r]=R.useState(()=>new P9(n)),i=LO.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return R.useDebugValue(i),R.useEffect(r.onRender(e)),QD({editor:i,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&s===0?0:s+1}),i}var nI=R.createContext({editor:null});nI.Consumer;var j9=R.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),B9=()=>R.useContext(j9);Be.forwardRef((t,e)=>{const{onDragStart:n}=B9(),r=t.as||"div";return C.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});Be.createContext({markViewContentRef:()=>{}});var Dw=R.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Dw.displayName="TiptapContext";var $9=()=>R.useContext(Dw);function rI({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=R.useMemo(()=>({editor:n}),[n]),i=R.useMemo(()=>({editor:n}),[n]);return C.jsx(nI.Provider,{value:i,children:C.jsx(Dw.Provider,{value:r,children:t})})}rI.displayName="Tiptap";function iI({...t}){const{editor:e}=$9();return C.jsx(JD,{editor:e,...t})}iI.displayName="Tiptap.Content";Object.assign(rI,{Content:iI});var Pp=(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]},V9=(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 c=o.depth-1;if(c<0)return!1;const u=o.node(c),f=o.index(c);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:S}=r;return S.delete(m,o.after()).insert(y,o.parent.content),S.setSelection(Oe.create(S.doc,y)),i.dispatch(S.scrollIntoView()),!0},H9=/^\s*>\s$/,U9=wn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Pp("blockquote",{...Ot(this.options.HTMLAttributes,t),children:Pp("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,c;const h=((c=(o=e.renderChild)==null?void 0:o.call(e,i,s))!=null?c: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:()=>V9(this.editor,this.type)}},addInputRules(){return[fc({find:H9,type:this.type})]}}),F9=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,q9=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,G9=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,W9=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,K9=$a.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 Pp("strong",{...Ot(this.options.HTMLAttributes,t),children:Pp("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[Ra({find:F9,type:this.type}),Ra({find:G9,type:this.type})]},addPasteRules(){return[Ao({find:q9,type:this.type}),Ao({find:W9,type:this.type})]}}),Z9=t=>{const e=/`([^`]+)`(?!`)$/.exec(t);return!e||e.index>0&&t[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},Y9=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},X9=$a.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Ot(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[Ra({find:Z9,type:this.type})]},addPasteRules(){return[Ao({find:Y9,type:this.type})]}}),ib=4,J9=/^```([a-z]+)?[\s\n]$/,Q9=/^~~~([a-z]+)?[\s\n]$/,eG=wn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:ib,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",Ot(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:ib,{state:r}=t,{selection:i}=r,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;const c=" ".repeat(n);return o?t.commands.insertContent(c):t.commands.command(({tr:u})=>{const{from:f,to:h}=i,y=r.doc.textBetween(f,h,`
|
|
175
|
-
`,`
|
|
176
|
-
`).split(`
|
|
177
|
-
`).map(S=>c+S).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:ib,{state:r}=t,{selection:i}=r,{$from:s,empty:o}=i;return s.parent.type!==this.type?!1:o?t.commands.command(({tr:c})=>{var u;const{pos:f}=s,h=s.start(),m=s.end(),y=r.doc.textBetween(h,m,`
|
|
179
|
-
`,`
|
|
180
|
-
`).split(`
|
|
181
|
-
`);let S=0,w=0;const x=f-h;for(let N=0;N<y.length;N+=1){if(w+y[N].length>=x){S=N;break}w+=y[N].length+1}const T=((u=y[S].match(/^ */))==null?void 0:u[0])||"",A=Math.min(T.length,n);if(A===0)return!0;let _=h;for(let N=0;N<S;N+=1)_+=y[N].length+1;return c.delete(_,_+A),f-_<=A&&c.setSelection(Oe.create(c.doc,_)),!0}):t.commands.command(({tr:c})=>{const{from:u,to:f}=i,g=r.doc.textBetween(u,f,`
|
|
182
|
-
`,`
|
|
183
|
-
`).split(`
|
|
184
|
-
`).map(y=>{var S;const w=((S=y.match(/^ */))==null?void 0:S[0])||"",x=Math.min(w.length,n);return y.slice(x)}).join(`
|
|
185
|
-
`);return c.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:c})=>(c.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 c=i.after();return c===void 0?!1:r.nodeAt(c)?t.commands.command(({tr:f})=>(f.setSelection(Ve.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[N0({find:J9,type:this.type,getAttributes:t=>({language:t[1]})}),N0({find:Q9,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Nt({key:new Zt("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:c}=t.state,u=c.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(Oe.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),tG=wn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
189
|
-
|
|
190
|
-
`):""}),nG=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",Ot(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:c}=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=>c.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()}}}),rG=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]}`,Ot(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=>N0({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),iG=wn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Ot(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!pq(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,i=t();return MD(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:s,tr:o,dispatch:c})=>{if(c){const{$to:u}=o.selection,f=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?o.setSelection(Oe.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(De.create(o.doc,u.pos)):o.setSelection(Oe.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(Oe.create(o.doc,f+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[ZD({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),sG=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,oG=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,aG=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,lG=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,cG=$a.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",Ot(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[Ra({find:sG,type:this.type}),Ra({find:aG,type:this.type})]},addPasteRules(){return[Ao({find:oG,type:this.type}),Ao({find:lG,type:this.type})]}});const uG="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",dG="ελ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",D0="numeric",I0="ascii",L0="alpha",Gu="asciinumeric",Lu="alphanumeric",P0="domain",sI="emoji",fG="scheme",hG="slashscheme",sb="whitespace";function pG(t,e){return t in e||(e[t]=[]),e[t]}function ma(t,e,n){e[D0]&&(e[Gu]=!0,e[Lu]=!0),e[I0]&&(e[Gu]=!0,e[L0]=!0),e[Gu]&&(e[Lu]=!0),e[L0]&&(e[Lu]=!0),e[Lu]&&(e[P0]=!0),e[sI]&&(e[P0]=!0);for(const r in e){const i=pG(r,n);i.indexOf(t)<0&&i.push(t)}}function mG(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function lr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}lr.groups={};lr.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||lr.groups;let i;return e&&e.j?i=e:(i=new lr(e),n&&r&&ma(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||lr.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const s=e;let o,c=i.go(t);if(c?(o=new lr,Object.assign(o.j,c.j),o.jr.push.apply(o.jr,c.jr),o.jd=c.jd,o.t=c.t):o=new lr,s){if(r)if(o.t&&typeof o.t=="string"){const u=Object.assign(mG(o.t,r),n);ma(s,u,r)}else n&&ma(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),Gt=(t,e,n,r,i)=>t.tr(e,n,r,i),SA=(t,e,n,r,i)=>t.ts(e,n,r,i),ue=(t,e,n,r,i)=>t.tt(e,n,r,i),Yi="WORD",z0="UWORD",oI="ASCIINUMERICAL",aI="ALPHANUMERICAL",vd="LOCALHOST",j0="TLD",B0="UTLD",Jh="SCHEME",Bl="SLASH_SCHEME",Iw="NUM",$0="WS",Lw="NL",Wu="OPENBRACE",Ku="CLOSEBRACE",zp="OPENBRACKET",jp="CLOSEBRACKET",Bp="OPENPAREN",$p="CLOSEPAREN",Vp="OPENANGLEBRACKET",Hp="CLOSEANGLEBRACKET",Up="FULLWIDTHLEFTPAREN",Fp="FULLWIDTHRIGHTPAREN",qp="LEFTCORNERBRACKET",Gp="RIGHTCORNERBRACKET",Wp="LEFTWHITECORNERBRACKET",Kp="RIGHTWHITECORNERBRACKET",Zp="FULLWIDTHLESSTHAN",Yp="FULLWIDTHGREATERTHAN",Xp="AMPERSAND",Jp="APOSTROPHE",Qp="ASTERISK",eo="AT",em="BACKSLASH",tm="BACKTICK",nm="CARET",ga="COLON",Pw="COMMA",rm="DOLLAR",gi="DOT",im="EQUALS",zw="EXCLAMATION",zr="HYPHEN",Zu="PERCENT",sm="PIPE",om="PLUS",am="POUND",Yu="QUERY",jw="QUOTE",lI="FULLWIDTHMIDDLEDOT",Bw="SEMI",yi="SLASH",Xu="TILDE",lm="UNDERSCORE",cI="EMOJI",cm="SYM";var uI=Object.freeze({__proto__:null,ALPHANUMERICAL:aI,AMPERSAND:Xp,APOSTROPHE:Jp,ASCIINUMERICAL:oI,ASTERISK:Qp,AT:eo,BACKSLASH:em,BACKTICK:tm,CARET:nm,CLOSEANGLEBRACKET:Hp,CLOSEBRACE:Ku,CLOSEBRACKET:jp,CLOSEPAREN:$p,COLON:ga,COMMA:Pw,DOLLAR:rm,DOT:gi,EMOJI:cI,EQUALS:im,EXCLAMATION:zw,FULLWIDTHGREATERTHAN:Yp,FULLWIDTHLEFTPAREN:Up,FULLWIDTHLESSTHAN:Zp,FULLWIDTHMIDDLEDOT:lI,FULLWIDTHRIGHTPAREN:Fp,HYPHEN:zr,LEFTCORNERBRACKET:qp,LEFTWHITECORNERBRACKET:Wp,LOCALHOST:vd,NL:Lw,NUM:Iw,OPENANGLEBRACKET:Vp,OPENBRACE:Wu,OPENBRACKET:zp,OPENPAREN:Bp,PERCENT:Zu,PIPE:sm,PLUS:om,POUND:am,QUERY:Yu,QUOTE:jw,RIGHTCORNERBRACKET:Gp,RIGHTWHITECORNERBRACKET:Kp,SCHEME:Jh,SEMI:Bw,SLASH:yi,SLASH_SCHEME:Bl,SYM:cm,TILDE:Xu,TLD:j0,UNDERSCORE:lm,UTLD:B0,UWORD:z0,WORD:Yi,WS:$0});const Wi=/[a-z]/,ku=new RegExp("\\p{L}","u"),ob=new RegExp("\\p{Emoji}","u"),Ki=/\d/,ab=/\s/,wA="\r",lb=`
|
|
193
|
-
`,gG="️",yG="",cb="";let wh=null,xh=null;function vG(t=[]){const e={};lr.groups=e;const n=new lr;wh==null&&(wh=xA(uG)),xh==null&&(xh=xA(dG)),ue(n,"'",Jp),ue(n,"{",Wu),ue(n,"}",Ku),ue(n,"[",zp),ue(n,"]",jp),ue(n,"(",Bp),ue(n,")",$p),ue(n,"<",Vp),ue(n,">",Hp),ue(n,"(",Up),ue(n,")",Fp),ue(n,"「",qp),ue(n,"」",Gp),ue(n,"『",Wp),ue(n,"』",Kp),ue(n,"<",Zp),ue(n,">",Yp),ue(n,"&",Xp),ue(n,"*",Qp),ue(n,"@",eo),ue(n,"`",tm),ue(n,"^",nm),ue(n,":",ga),ue(n,",",Pw),ue(n,"$",rm),ue(n,".",gi),ue(n,"=",im),ue(n,"!",zw),ue(n,"-",zr),ue(n,"%",Zu),ue(n,"|",sm),ue(n,"+",om),ue(n,"#",am),ue(n,"?",Yu),ue(n,'"',jw),ue(n,"/",yi),ue(n,";",Bw),ue(n,"~",Xu),ue(n,"_",lm),ue(n,"\\",em),ue(n,"・",lI);const r=Gt(n,Ki,Iw,{[D0]:!0});Gt(r,Ki,r);const i=Gt(r,Wi,oI,{[Gu]:!0}),s=Gt(r,ku,aI,{[Lu]:!0}),o=Gt(n,Wi,Yi,{[I0]:!0});Gt(o,Ki,i),Gt(o,Wi,o),Gt(i,Ki,i),Gt(i,Wi,i);const c=Gt(n,ku,z0,{[L0]:!0});Gt(c,Wi),Gt(c,Ki,s),Gt(c,ku,c),Gt(s,Ki,s),Gt(s,Wi),Gt(s,ku,s);const u=ue(n,lb,Lw,{[sb]:!0}),f=ue(n,wA,$0,{[sb]:!0}),h=Gt(n,ab,$0,{[sb]:!0});ue(n,cb,h),ue(f,lb,u),ue(f,cb,h),Gt(f,ab,h),ue(h,wA),ue(h,lb),Gt(h,ab,h),ue(h,cb,h);const m=Gt(n,ob,cI,{[sI]:!0});ue(m,"#"),Gt(m,ob,m),ue(m,gG,m);const g=ue(m,yG);ue(g,"#"),Gt(g,ob,m);const y=[[Wi,o],[Ki,i]],S=[[Wi,null],[ku,c],[Ki,s]];for(let w=0;w<wh.length;w++)Zs(n,wh[w],j0,Yi,y);for(let w=0;w<xh.length;w++)Zs(n,xh[w],B0,z0,S);ma(j0,{tld:!0,ascii:!0},e),ma(B0,{utld:!0,alpha:!0},e),Zs(n,"file",Jh,Yi,y),Zs(n,"mailto",Jh,Yi,y),Zs(n,"http",Bl,Yi,y),Zs(n,"https",Bl,Yi,y),Zs(n,"ftp",Bl,Yi,y),Zs(n,"ftps",Bl,Yi,y),ma(Jh,{scheme:!0,ascii:!0},e),ma(Bl,{slashscheme:!0,ascii:!0},e),t=t.sort((w,x)=>w[0]>x[0]?1:-1);for(let w=0;w<t.length;w++){const x=t[w][0],T=t[w][1]?{[fG]:!0}:{[hG]:!0};x.indexOf("-")>=0?T[P0]=!0:Wi.test(x)?Ki.test(x)?T[Gu]=!0:T[I0]=!0:T[D0]=!0,SA(n,x,x,T)}return SA(n,"localhost",vd,{ascii:!0}),n.jd=new lr(cm),{start:n,tokens:Object.assign({groups:e},uI)}}function dI(t,e){const n=bG(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,i=[];let s=0,o=0;for(;o<r;){let c=t,u=null,f=0,h=null,m=-1,g=-1;for(;o<r&&(u=c.go(n[o]));)c=u,c.accepts()?(m=0,g=0,h=c):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 bG(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 Zs(t,e,n,r,i){let s;const o=e.length;for(let c=0;c<o-1;c++){const u=e[c];t.j[u]?s=t.j[u]:(s=new lr(r),s.jr=i.slice(),t.j[u]=s),t=s}return s=new lr(n),s.jr=i.slice(),t.j[e[o-1]]=s,s}function xA(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 bd={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 $w(t,e=null){let n=Object.assign({},bd);t&&(n=Object.assign(n,t instanceof $w?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}$w.prototype={o:bd,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]:bd[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=bd.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={},c=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,c&&(o.class=c),u&&(o.target=u),f&&(o.rel=f),h&&Object.assign(o,h),{tagName:i,attributes:o,content:s,eventListeners:m}}};function Um(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 SG=Um("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),CA=Um("text"),wG=Um("nl"),kh=Um("url",{isLink:!0,toHref(t=bd.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==vd&&t[1].t===ga}}),Pr=t=>new lr(t);function xG({groups:t}){const e=t.domain.concat([Xp,Qp,eo,em,tm,nm,rm,im,zr,Iw,Zu,sm,om,am,yi,cm,Xu,lm]),n=[Jp,ga,Pw,gi,zw,Zu,Yu,jw,Bw,Vp,Hp,Wu,Ku,jp,zp,Bp,$p,Up,Fp,qp,Gp,Wp,Kp,Zp,Yp],r=[Xp,Jp,Qp,em,tm,nm,rm,im,zr,Wu,Ku,Zu,sm,om,am,Yu,yi,cm,Xu,lm],i=Pr(),s=ue(i,Xu);Je(s,r,s),Je(s,t.domain,s);const o=Pr(),c=Pr(),u=Pr();Je(i,t.domain,o),Je(i,t.scheme,c),Je(i,t.slashscheme,u),Je(o,r,s),Je(o,t.domain,o);const f=ue(o,eo);ue(s,eo,f),ue(c,eo,f),ue(u,eo,f);const h=ue(s,gi);Je(h,r,s),Je(h,t.domain,s);const m=Pr();Je(f,t.domain,m),Je(m,t.domain,m);const g=ue(m,gi);Je(g,t.domain,m);const y=Pr(SG);Je(g,t.tld,y),Je(g,t.utld,y),ue(f,vd,y);const S=ue(m,zr);ue(S,zr,S),Je(S,t.domain,m),Je(y,t.domain,m),ue(y,gi,g),ue(y,zr,S);const w=ue(o,zr),x=ue(o,gi);ue(w,zr,w),Je(w,t.domain,o),Je(x,r,s),Je(x,t.domain,o);const k=Pr(kh);Je(x,t.tld,k),Je(x,t.utld,k),Je(k,t.domain,o),Je(k,r,s),ue(k,gi,x),ue(k,zr,w),ue(k,eo,f);const T=ue(k,ga),A=Pr(kh);Je(T,t.numeric,A);const _=Pr(kh),O=Pr();Je(_,e,_),Je(_,n,O),Je(O,e,_),Je(O,n,O),ue(k,yi,_),ue(A,yi,_);const N=ue(c,ga),I=ue(u,ga),z=ue(I,yi),q=ue(z,yi);Je(c,t.domain,o),ue(c,gi,x),ue(c,zr,w),Je(u,t.domain,o),ue(u,gi,x),ue(u,zr,w),Je(N,t.domain,_),ue(N,yi,_),ue(N,Yu,_),Je(q,t.domain,_),Je(q,e,_),ue(q,yi,_);const Z=[[Wu,Ku],[zp,jp],[Bp,$p],[Vp,Hp],[Up,Fp],[qp,Gp],[Wp,Kp],[Zp,Yp]];for(let ae=0;ae<Z.length;ae++){const[X,te]=Z[ae],ie=ue(_,X);ue(O,X,ie);const de=Pr(kh);Je(ie,e,de);const B=Pr();Je(ie,n,B),ue(ie,te,_),Je(de,e,de),Je(de,n,B),Je(B,e,de),Je(B,n,B),ue(de,te,_),ue(B,te,_)}return ue(i,vd,k),ue(i,Lw,wG),{start:i,tokens:uI}}function kG(t,e,n){let r=n.length,i=0,s=[],o=[];for(;i<r;){let c=t,u=null,f=null,h=0,m=null,g=-1;for(;i<r&&!(u=c.go(n[i].t));)o.push(n[i++]);for(;i<r&&(f=u||c.go(n[i].t));)u=null,c=f,c.accepts()?(g=0,m=c):g>=0&&g++,i++,h++;if(g<0)i-=h,i<r&&(o.push(n[i]),i++);else{o.length>0&&(s.push(ub(CA,e,o)),o=[]),i-=g,h-=g;const y=m.t,S=n.slice(i-h,i);s.push(ub(y,e,S))}}return o.length>0&&s.push(ub(CA,e,o)),s}function ub(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 CG=typeof console<"u"&&console&&console.warn||(()=>{}),EG="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Pt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function TG(){return lr.groups={},Pt.scanner=null,Pt.parser=null,Pt.tokenQueue=[],Pt.pluginQueue=[],Pt.customSchemes=[],Pt.initialized=!1,Pt}function EA(t,e=!1){if(Pt.initialized&&CG(`linkifyjs: already initialized - will not register custom scheme "${t}" ${EG}`),!/^[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`);Pt.customSchemes.push([t,e])}function _G(){Pt.scanner=vG(Pt.customSchemes);for(let t=0;t<Pt.tokenQueue.length;t++)Pt.tokenQueue[t][1]({scanner:Pt.scanner});Pt.parser=xG(Pt.scanner.tokens);for(let t=0;t<Pt.pluginQueue.length;t++)Pt.pluginQueue[t][1]({scanner:Pt.scanner,parser:Pt.parser});return Pt.initialized=!0,Pt}function Vw(t){return Pt.initialized||_G(),kG(Pt.parser.start,t,dI(Pt.scanner.start,t))}Vw.scan=dI;function hI(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 $w(n),i=Vw(t),s=[];for(let o=0;o<i.length;o++){const c=i[o];c.isLink&&(!e||c.t===e)&&r.check(c)&&s.push(c.toFormattedObject(r))}return s}var Hw="[\0- -\u2029 ]",AG=new RegExp(Hw),RG=new RegExp(`${Hw}$`),MG=new RegExp(Hw,"g");function OG(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function NG(t){return new Nt({key:new Zt("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,c=wD(n.doc,[...e]);if(_w(c).forEach(({newRange:f})=>{const h=A5(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(!RG.test(y))return;m=h[0],g=r.doc.textBetween(m.pos,f.to,void 0," ")}if(m&&g){const y=g.split(AG).filter(Boolean);if(y.length<=0)return!1;const S=y[y.length-1],w=m.pos+g.lastIndexOf(S);if(!S)return!1;const x=Vw(S).map(k=>k.toObject(t.defaultProtocol));if(!OG(x))return!1;x.filter(k=>k.isLink).map(k=>({...k,from:w+k.start+1,to:w+k.end+1})).filter(k=>r.schema.marks.code?!r.doc.rangeHasMark(k.from,k.to,r.schema.marks.code):!0).filter(k=>t.validate(k.value)).filter(k=>t.shouldAutoLink(k.value)).forEach(k=>{Aw(k.from,k.to,r.doc).some(T=>T.mark.type===t.type)||o.addMark(k.from,k.to,t.type.create({href:k.href}))})}}),!!o.steps.length)return o}})}function DG(t){return new Nt({key:new Zt("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 c=!1;if(t.enableClickSelection&&(c=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const u=RD(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),c=!0)}return c}}})}var IG=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,LG=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function pI(t,e){let n=0;for(let r=e-1;r>=0&&t[r]==="\\";r-=1)n+=1;return n%2===1}function PG(t,e){let n=0,r=0;for(;r<e;){if(t[r]!=="`"){r+=1;continue}if(n===0&&pI(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 mI(t,e,n){var r,i;const[,s,o]=e;return(e.index?t[e.index-1]:void 0)==="!"||pI(t,(r=e.index)!=null?r:0)||PG(t,(i=e.index)!=null?i:0)?!1:!!s.trim()&&n(o)}function gI(t){var e,n;const[r,i,s,,o,c,u]=t,f=(e=o??c)!=null?e:u;return{index:(n=t.index)!=null?n:0,text:r,replaceWith:i,data:{href:s,title:f||null,markdown:!0}}}function zG(t,e){return t.index<e.index+e.text.length&&e.index<t.index+t.text.length}function yI(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 jG(t){const e=Ra({find:n=>{const r=IG.exec(n);return!r||!mI(n,r,t.isAllowedHref)?null:gI(r)},type:t.type,getAttributes:yI});return new Hd({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 BG(t){const e=Ao({find:n=>{var r,i;const s=[];for(const c of n.matchAll(LG))mI(n,c,t.isAllowedHref)&&s.push(gI(c));const o=((i=(r=t.findPlainUrls)==null?void 0:r.call(t,n))!=null?i:[]).filter(c=>!s.some(u=>zG(u,c)));return[...s,...o]},type:t.type,getAttributes:yI});return new PD({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 $G(t){return new Nt({key:new Zt("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:i}=t,{state:s}=e,{selection:o}=s,{empty:c}=o;if(c)return!1;let u="";r.content.forEach(h=>{u+=h.textContent});const f=hI(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 Zi(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(MG,"").match(new RegExp(`^(?:(?:${n.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}var VG=$a.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"){EA(t);return}EA(t.scheme,t.optionalSlashes)})},onDestroy(){TG()},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)=>!!Zi(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=>!!Zi(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=>!!Zi(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ot(this.options.HTMLAttributes,t),0]:["a",Ot(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:"",c=(s=(i=t.attrs)==null?void 0:i.title)!=null?s:"",u=e.renderChildren(t);return c?`[${u}](${o} "${c}")`:`[${u}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Zi(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=>!!Zi(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?[jG({type:this.type,isAllowedHref:t=>this.options.isAllowedUri(t,{defaultValidate:e=>!!Zi(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;hI(e).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:c=>!!Zi(c,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?[BG({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:n=>!!Zi(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:t})]:[Ao({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(NG({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Zi(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(DG({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push($G({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),HG=Object.defineProperty,UG=(t,e)=>{for(var n in e)HG(t,n,{get:e[n],enumerable:!0})},FG="listItem",TA="textStyle",_A=/^\s*([-+*])\s$/,vI=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",Ot(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(FG,this.editor.getAttributes(TA)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=fc({find:_A,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=fc({find:_A,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(TA),editor:this.editor})),[t]}}),qG=(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),c=i.index(s);if(c+1>=o.childCount)return null;const u=o.child(c+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}},GG=(t,e,n,r)=>{const i=qG(t,n,r);if(!i)return!1;const{selection:s}=t,{nestedList:o,nestedListPos:c,insertPos:u,items:f}=i,h=t.tr;h.delete(c,c+o.nodeSize);const m=h.mapping.map(u);return h.insert(m,ne.from(f)),h.setSelection(s.map(h.doc,h.mapping)),e&&e(h),!0},WG=(t,e,n)=>GG(t.state,t.view.dispatch,e,n),bI=(t,e)=>$t.create({name:`${t}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const n=()=>WG(this.editor,t,e);return{Delete:n,"Mod-Delete":n}}}),SI=[[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"]],Ch="abcdefghijklmnopqrstuvwxyz",KG="[a-zA-Z]{1,2}",wI=String.raw`\d+|[ivxlcdmIVXLCDM]+|${KG}`;function Fm(t){let e=t,n="";for(const[r,i]of SI)for(;e>=r;)n+=i,e-=r;return n}function Uw(t){return Fm(t).toUpperCase()}function xI(t){const e=t.toLowerCase();let n=0,r=0;for(;n<e.length;){let i=!1;for(const[s,o]of SI)if(e.startsWith(o,n)){r+=s,n+=o.length,i=!0;break}if(!i)return 0}return r}function ZG(t){if(!/^[ivxlcdmIVXLCDM]+$/.test(t))return!1;const e=xI(t);return e<=0?!1:(t===t.toLowerCase()?Fm(e):Uw(e))===t}function YG(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 um(t){if(t<=26)return Ch[t-1];const e=Math.floor((t-1)/26)-1,n=(t-1)%26;return e<0?Ch[n]:Ch[e]+Ch[n]}function qm(t){if(!(!t||/^\d+$/.test(t))){if(ZG(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 Fw(t){if(/^\d+$/.test(t))return parseInt(t,10);const e=qm(t);if(e==="i"||e==="I")return xI(t);if(e==="a"||e==="A"){const r=YG(t);return r>0?r:1}const n=parseInt(t,10);return Number.isNaN(n)?1:n}function XG(t,e){if(t==="numeric")return String(e);switch(t){case"a":return um(e);case"A":return um(e).toUpperCase();case"i":return Fm(e);case"I":return Uw(e);default:return String(e)}}function JG(t){var e;if(t.length===0)return!1;const n=(e=qm(t[0]))!=null?e:"numeric",r=Fw(t[0]);if(r<1)return!1;for(let i=0;i<t.length;i++){const s=XG(n,r+i);if(t[i]!==s)return!1}return!0}function QG(t){return{type:qm(t),start:Fw(t)}}function e8(t){const{type:e,start:n}=QG(t),r={};return e&&(r.type=e),n!==1&&(r.start=n),r}function t8(t,e,n=". "){const r=e+1;if(!t||t==="1")return`${r}${n}`;switch(t){case"a":return`${um(r)}${n}`;case"A":return`${um(r).toUpperCase()}${n}`;case"i":return`${Fm(r)}${n}`;case"I":return`${Uw(r)}${n}`;default:return`${r}${n}`}}function n8(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 r8(t,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(t)):e.parseInline([{type:"text",raw:t,text:t}])}var kI=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",Ot(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(n8(t))return{type:"listItem",content:[{type:"paragraph",content:r8(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)=>Ow(t,e,r=>{var i,s,o,c;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=(c=(o=r.meta)==null?void 0:o.parentAttrs)==null?void 0:c.type,h=u-1+(r.index||0);return t8(f,h,". ")}return"- "},n),addExtensions(){return[bI(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)}}}),i8={};UG(i8,{findListItemPos:()=>Gm,getNextListDepth:()=>qw,handleBackspace:()=>V0,handleDelete:()=>H0,hasListBefore:()=>CI,hasListItemAfter:()=>s8,hasListItemBefore:()=>o8,listItemHasSubList:()=>a8,nextListIsDeeper:()=>EI,nextListIsHigher:()=>TI});var Gm=(t,e)=>{const{$from:n}=e.selection,r=dn(t,e.schema);let i=null,s=n.depth,o=n.pos,c=null;for(;s>0&&c===null;)i=n.node(s),i.type===r?c=s:(s-=1,o-=1);return c===null?null:{$pos:e.doc.resolve(o),depth:c}},qw=(t,e)=>{const n=Gm(t,e);if(!n)return!1;const[,r]=j5(e,t,n.$pos.pos+4);return r},CI=(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))},V0=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!_o(t.state,e)&&CI(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 c=t.state.doc.resolve(i.start()+o.pos+1);return t.chain().cut({from:r.start()-1,to:r.end()+1},c.end()).joinForward().run()}return!_o(t.state,e)||!H5(t.state)?!1:t.chain().liftListItem(e).run()},EI=(t,e)=>{const n=qw(t,e),r=Gm(t,e);return!r||!n?!1:n>r.depth},TI=(t,e)=>{const n=qw(t,e),r=Gm(t,e);return!r||!n?!1:n<r.depth},H0=(t,e)=>{if(!_o(t.state,e)||!V5(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:EI(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():TI(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},s8=(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)},o8=(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)},a8=(t,e,n)=>{if(!n)return!1;const r=dn(t,e.schema);let i=!1;return n.descendants(s=>{s.type===r&&(i=!0)}),i},_I=$t.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&&H0(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&&H0(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&&V0(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&&V0(t,n,r)&&(e=!0)}),e}}}}),U0=new RegExp(`^(\\s*)(${wI})([.)])\\s+(.*)$`),l8=/^\s/,Pu={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function c8(t){return U0.test(t.trimStart())}function u8(t){const e=t.trimStart();return Pu.bulletItem.test(e)||c8(e)||Pu.heading.test(e)||Pu.thematicBreak.test(e)&&!e.startsWith("-")||/^>\s?/.test(e)||Pu.codeFence.test(e)}function d8(t){return Object.values(Pu).some(e=>e.test(t))}function f8(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&&u8(i)){r=!0,n.push(i);return}e.push(i)}),{paragraphLines:e,blockLines:n}}function h8(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n],s=i.match(U0);if(!s)break;const[,o,c,u,f]=s,h=o.length,m=parseInt(c,10),g=isNaN(m)?qm(c):void 0,y=isNaN(m)?Fw(c):m,S=[f];let w=n+1;const x=[i];let k=!1;for(;w<t.length;){const T=t[w];if(T.match(U0))break;if(T.trim()==="")x.push(T),S.push(""),k=!0,w+=1;else if(T.match(l8)){const _=T.length-T.trimStart().length,O=h+c.length+1;x.push(T),S.push(T.slice(Math.min(_,O))),w+=1}else{if(k||d8(T))break;x.push(T),S.push(T),w+=1}}e.push({indent:h,number:y,type:g,content:S.join(`
|
|
198
|
-
`).trim(),contentLines:S,raw:x.join(`
|
|
199
|
-
`)}),r=w,n=w}return[e,r]}var p8=new RegExp(`^(${wI})([.)])\\s+(.+)$`);function m8(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(p8);if(!o)return null;n.push({marker:o[1],content:o[3]})}const r=n.map(s=>s.marker);return JG(r)?{type:"orderedList",attrs:e8(n[0].marker),content:n.map(s=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:s.content}]}]}))}:null}function AI(t,e,n){const r=[];let i=0;for(;i<t.length;){const s=t[i];if(s.indent===e){const{paragraphLines:o,blockLines:c}=f8(s.contentLines),u=o.join(`
|
|
201
|
-
`).trim(),f=[];u&&f.push({type:"paragraph",raw:u,tokens:n.inlineTokens(u)});const h=c.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(w=>w.indent)),S=AI(g,y,n);f.push({type:"list",ordered:!0,start:g[0].number,typeMarker:g[0].type,items:S,raw:g.map(w=>w.raw).join(`
|
|
203
|
-
`)})}r.push({type:"list_item",raw:s.raw,tokens:f}),i=m}else i+=1}return r}function g8(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 y8="listItem",AA="textStyle",RA=/^(\d+)\.\s$/;function MA(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 RI=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=MA(n);if(i)return i}const r=t.querySelector("li");if(r){const i=r.getAttribute("style");if(i){const s=MA(i);if(s)return s}}return null}}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,type:n,...r}=t,i=Ot(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?g8(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,c]=h8(s);if(o.length===0)return;const u=AI(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,c).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(y8,this.editor.getAttributes(AA)).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=m8(s);if(!o)return!1;try{const c=t.state.schema.nodeFromJSON(o),u=t.state.tr.replaceSelectionWith(c);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=fc({find:RA,type:this.type,getAttributes:n=>({start:+n[1]}),joinPredicate:t});return(this.options.keepMarks||this.options.keepAttributes)&&(e=fc({find:RA,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:n=>({start:+n[1],...this.editor.getAttributes(AA)}),joinPredicate:t,editor:this.editor})),[e]}}),v8=/^\s*(\[([( |x])?\])\s$/,b8=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",Ot(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 Ow(t,e,i)},addExtensions(){return this.options.nested?[bI(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"),c=document.createElement("input"),u=document.createElement("div"),f=m=>{var g,y;c.ariaLabel=((y=(g=this.options.a11y)==null?void 0:g.checkboxLabel)==null?void 0:y.call(g,m,c.checked))||`Task item checkbox for ${m.textContent||"empty task item"}`};f(t),s.contentEditable="false",c.type="checkbox",c.addEventListener("mousedown",m=>m.preventDefault()),c.addEventListener("change",m=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){c.checked=!c.checked;return}const{checked:g}=m.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:y})=>{const S=n();if(typeof S!="number")return!1;const w=y.doc.nodeAt(S);return y.setNodeMarkup(S,void 0,{...w?.attrs,checked:g}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,g)||(c.checked=!c.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([m,g])=>{i.setAttribute(m,g)}),i.dataset.checked=t.attrs.checked,c.checked=t.attrs.checked,s.append(c,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,c.checked=m.attrs.checked,f(m);const g=r.extensionManager.attributes,y=uc(m,g),S=new Set(Object.keys(y)),w=this.options.HTMLAttributes;return h.forEach(x=>{S.has(x)||(x in w?i.setAttribute(x,w[x]):i.removeAttribute(x))}),Object.entries(y).forEach(([x,k])=>{k==null?x in w?i.setAttribute(x,w[x]):i.removeAttribute(x):i.setAttribute(x,k)}),h=S,!0}}}},addInputRules(){return[fc({find:v8,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),S8=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",Ot(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=O0(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:c=>({indentLevel:c[1].length,mainContent:c[4],checked:c[3].toLowerCase()==="x"}),createToken:(c,u)=>({type:"taskItem",raw:"",mainContent:c.mainContent,indentLevel:c.indentLevel,checked:c.checked,text:c.mainContent,tokens:n.inlineTokens(c.mainContent),nestedTokens:u}),customNestedParser:r},n);if(o){const c={type:"taskList",raw:o.raw,items:o.items},u=s.slice(o.raw.length);return u.trim()?[c,...n.blockTokens(u)]:[c]}return n.blockTokens(s)},i=O0(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()}}});$t.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(vI.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(kI.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(_I.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(RI.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(b8.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(S8.configure(this.options.taskList)),t}});var Eh=" ",db=" ",w8=wn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Ot(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===Eh||n[0].text===Eh||n[0].raw===db||n[0].text===db)&&r.length===1&&r[0].type==="text"&&(r[0].text===Eh||r[0].text===db)?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?Eh:""}return e.renderChildren(s)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),x8=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,k8=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,C8=$a.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",Ot(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[Ra({find:x8,type:this.type})]},addPasteRules(){return[Ao({find:k8,type:this.type})]}}),E8=wn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),T8=$a.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",Ot(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 _8(t={}){return new Nt({view(e){return new A8(e,t)}})}class A8{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,c=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 S=y.getBoundingClientRect(),w=m?S.bottom:S.top;m&&g&&(w=(w+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let x=this.width/2*c;r={left:S.left,right:S.right,top:w-x,bottom:w+x}}}}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)/c+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/c+"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 c=uN(this.editorView.state.doc,o,this.editorView.dragging.slice);c!=null&&(o=c)}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 Wt extends Ve{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Wt.valid(r)?new Wt(r):Ve.near(r)}content(){return ve.empty}eq(e){return e instanceof Wt&&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 Wt(e.resolve(n.pos))}getBookmark(){return new Gw(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!R8(e)||!M8(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&&Wt.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let c=e.node(o);if(n>0?e.indexAfter(o)<c.childCount:e.index(o)>0){s=c.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(Wt.valid(u))return u}for(;;){let o=n>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!De.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=o,i+=n;let c=e.doc.resolve(i);if(Wt.valid(c))return c}return null}}}Wt.prototype.visible=!1;Wt.findFrom=Wt.findGapCursorFrom;Ve.jsonID("gapcursor",Wt);class Gw{constructor(e){this.pos=e}map(e){return new Gw(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Wt.valid(n)?new Wt(n):Ve.near(n)}}function MI(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function R8(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||MI(i.type))return!0;if(i.inlineContent)return!1}}return!0}function M8(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||MI(i.type))return!0;if(i.inlineContent)return!1}}return!0}function O8(){return new Nt({props:{decorations:L8,createSelectionBetween(t,e,n){return e.pos==n.pos&&Wt.valid(n)?new Wt(n):null},handleClick:D8,handleKeyDown:N8,handleDOMEvents:{beforeinput:I8}}})}const N8=ww({ArrowLeft:Th("horiz",-1),ArrowRight:Th("horiz",1),ArrowUp:Th("vert",-1),ArrowDown:Th("vert",1)});function Th(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,c=e>0?o.$to:o.$from,u=o.empty;if(o instanceof Oe){if(!s.endOfTextblock(n)||c.depth==0)return!1;u=!1,c=r.doc.resolve(e>0?c.after():c.before())}let f=Wt.findGapCursorFrom(c,e,u);return f?(i&&i(r.tr.setSelection(new Wt(f))),!0):!1}}function D8(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Wt.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&De.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Wt(r))),!0)}function I8(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Wt))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=ne.empty;for(let o=r.length-1;o>=0;o--)i=ne.from(r[o].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new ve(i,0,0));return s.setSelection(Oe.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function L8(t){if(!(t.selection instanceof Wt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",St.create(t.doc,[yn.widget(t.selection.head,e,{key:"gapcursor"})])}var dm=200,bn=function(){};bn.prototype.append=function(e){return e.length?(e=bn.from(e),!this.length&&e||e.length<dm&&this.leafAppend(e)||this.length<dm&&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 P8(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 OI(e):bn.empty};var OI=(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,c){for(var u=s;u<o;u++)if(i(this.values[u],c+u)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,c){for(var u=s-1;u>=o;u--)if(i(this.values[u],c+u)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=dm)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=dm)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 OI([]);var P8=(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 c=this.left.length;if(i<c&&this.left.forEachInner(r,i,Math.min(s,c),o)===!1||s>c&&this.right.forEachInner(r,Math.max(i-c,0),Math.min(this.length,s)-c,o+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var c=this.left.length;if(i>c&&this.right.forEachInvertedInner(r,i-c,Math.max(s,c)-c,o+c)===!1||s<c&&this.left.forEachInvertedInner(r,Math.min(i,c),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 z8=500;class ti{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,c,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 vi(m.map));let y=m.step.map(i.slice(s)),S;y&&o.maybeStep(y).doc&&(S=o.mapping.maps[o.mapping.maps.length-1],f.push(new vi(S,void 0,void 0,f.length+h.length))),s--,S&&i.appendMap(S,s)}else o.maybeStep(m.step);if(m.selection)return c=i?m.selection.map(i.slice(s)):m.selection,u=new ti(this.items.slice(0,r).append(h.reverse().concat(f)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:o,selection:c}}addTransform(e,n,r,i){let s=[],o=this.eventCount,c=this.items,u=!i&&c.length?c.get(c.length-1):null;for(let h=0;h<e.steps.length;h++){let m=e.steps[h].invert(e.docs[h]),g=new vi(e.mapping.maps[h],m,n),y;(y=u&&u.merge(g))&&(g=y,h?s.pop():c=c.slice(0,c.length-1)),s.push(g),n&&(o++,n=void 0),i||(u=g)}let f=o-r.depth;return f>B8&&(c=j8(c,f),o-=f),new ti(c.append(s),o)}remapping(e,n){let r=new hd;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 ti(this.items.append(e.map(n=>new vi(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,c=this.eventCount;this.items.forEach(g=>{g.selection&&c--},i);let u=n;this.items.forEach(g=>{let y=s.getMirror(--u);if(y==null)return;o=Math.min(o,y);let S=s.maps[y];if(g.step){let w=e.steps[y].invert(e.docs[y]),x=g.selection&&g.selection.map(s.slice(u+1,y));x&&c++,r.push(new vi(S,w,x))}else r.push(new vi(S))},i);let f=[];for(let g=n;g<o;g++)f.push(new vi(s.maps[g]));let h=this.items.slice(0,i).append(f).append(r),m=new ti(h,c);return m.emptyItemCount()>z8&&(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,c)=>{if(c>=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 vi(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 ti(bn.from(i.reverse()),s)}}ti.empty=new ti(bn.empty,0);function j8(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class vi{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 vi(n.getMap().invert(),n,this.selection)}}}class to{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const B8=20;function $8(t,e,n,r){let i=n.getMeta(wa),s;if(i)return i.historyState;n.getMeta(U8)&&(t=new to(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(wa))return o.getMeta(wa).redo?new to(t.done.addTransform(n,void 0,r,Qh(e)),t.undone,OA(n.mapping.maps),t.prevTime,t.prevComposition):new to(t.done,t.undone.addTransform(n,void 0,r,Qh(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let c=n.getMeta("composition"),u=t.prevTime==0||!o&&t.prevComposition!=c&&(t.prevTime<(n.time||0)-r.newGroupDelay||!V8(n,t.prevRanges)),f=o?fb(t.prevRanges,n.mapping):OA(n.mapping.maps);return new to(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,Qh(e)),ti.empty,f,n.time,c??t.prevComposition)}else return(s=n.getMeta("rebased"))?new to(t.done.rebased(n,s),t.undone.rebased(n,s),fb(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new to(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),fb(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function V8(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 OA(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 fb(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 H8(t,e,n){let r=Qh(e),i=wa.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),c=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),u=new to(n?c:s.remaining,n?s.remaining:c,null,0,-1);return s.transform.setSelection(o).setMeta(wa,{redo:n,historyState:u})}let hb=!1,NA=null;function Qh(t){let e=t.plugins;if(NA!=e){hb=!1,NA=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){hb=!0;break}}return hb}const wa=new Zt("history"),U8=new Zt("closeHistory");function F8(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Nt({key:wa,state:{init(){return new to(ti.empty,ti.empty,null,0,-1)},apply(e,n,r){return $8(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?DI:r=="historyRedo"?II:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function NI(t,e){return(n,r)=>{let i=wa.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=H8(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const DI=NI(!1,!0),II=NI(!0,!0);$t.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 Zt("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 c=o-i,u=0,f=c;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 c=e.selection.$head.pos,u=s-r,f=c-u,h=c;return e.deleteRange(f,h),!(this.storage.characters({node:e.doc})>r)}})]}});var q8=$t.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[_8(this.options)]}});$t.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Nt({key:new Zt("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!n||!r)return St.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 c=0;return t.descendants((u,f)=>{if(u.isText||!(i>=f&&i<=f+u.nodeSize-1))return!1;if(c+=1,this.options.mode==="deepest"&&o-c>0||this.options.mode==="shallowest"&&c>1)return this.options.mode==="deepest";s.push(yn.node(f,f+u.nodeSize,{class:this.options.className}))}),St.create(t,s)}}})]}});var G8=$t.create({name:"gapCursor",addProseMirrorPlugins(){return[O8()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=ht(Te(t,"allowGapCursor",n)))!=null?e:null}}}),LI="placeholder",DA=new Zt("tiptap__placeholder");function PI(t){const{editor:e,placeholder:n,dataAttribute:r,pos:i,node:s,isEmptyDoc:o,hasAnchor:c,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:c}):n})}function zI(t,e){return typeof t=="function"?t(e):t}function jI({editor:t,options:e,dataAttribute:n,doc:r,selection:i,from:s,to:o}){const{anchor:c}=i,u=[],f=t.isEmpty;return r.nodesBetween(s,o,(h,m)=>{const g=c>=m&&c<=m+h.nodeSize,y=!h.isLeaf&&Vd(h);return h.type.isTextblock&&(g||!e.showOnlyCurrent)&&y&&u.push(PI({editor:t,isEmptyDoc:f,dataAttribute:n,hasAnchor:g,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:zI(e.emptyNodeClass,{editor:t,node:h,pos:m,hasAnchor:g})},node:h,pos:m})),e.includeChildren}),u}function BI({editor:t,options:e,dataAttribute:n,doc:r,selection:i}){if(!(t.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:o}=i,c=[],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&&Vd(m)){const y=o>=g&&o<=g+m.nodeSize;c.push(PI({editor:t,isEmptyDoc:u,dataAttribute:n,hasAnchor:y,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:zI(e.emptyNodeClass,{editor:t,node:m,pos:g,hasAnchor:y})},node:m,pos:g}))}}else c.push(...jI({editor:t,options:e,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return St.create(r,c)}function Ju(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 c=r.nodeAfter?e:e-o.nodeSize;return{from:c,to:c+o.nodeSize}}const i=r.before(1),s=r.node(1);return{from:i,to:i+s.nodeSize}}function Qu(t,e){return{from:Math.max(0,e.from-1),to:Math.min(t.content.size,e.to-1)}}function W8(t,e,n){const r=[];return t.forEach((i,s)=>{const o=s,c=o+i.nodeSize,u=o+1,f=c+1;u<n&&f>e&&r.push({from:o,to:c})}),r}function K8(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 Z8(t,e){const n=W8(t,e.from,e.to);return n.push(Qu(t,Ju(t,e.from))),e.to>e.from?n.push(Qu(t,Ju(t,Math.min(e.to,t.content.size+1)-1))):e.from<t.content.size+1&&n.push(Qu(t,Ju(t,Math.min(e.from+1,t.content.size)))),n}function Y8(t,e,n){const r=[];if(t.docChanged){const i=_w(t);for(const s of i)r.push(...Z8(n.doc,s.newRange))}return t.selectionSet&&(r.push(Qu(n.doc,Ju(n.doc,t.mapping.map(e.selection.anchor)))),r.push(Qu(n.doc,Ju(n.doc,n.selection.anchor)))),K8(r)}function X8(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 J8({decorations:t,ranges:e,editor:n,options:r,dataAttribute:i,doc:s,selection:o}){let c=t;for(const u of e){const{from:f,to:h}=X8(u.from,u.to,s),m=c.find(f,h).filter(y=>y.from>=f&&y.to<=h);m.length&&(c=c.remove(m));const g=jI({editor:n,options:r,dataAttribute:i,doc:s,selection:o,from:f,to:h});g.length&&(c=c.add(s,g))}return c}function Q8({editor:t,options:e,dataAttribute:n}){return{init(r,i){const s=BI({editor:t,options:e,dataAttribute:n,doc:i.doc,selection:i.selection});return s??St.empty},apply(r,i,s,o){if(!r.docChanged&&!r.selectionSet)return i;const c=i.map(r.mapping,r.doc),u=Y8(r,s,o);return J8({decorations:c,ranges:u,editor:t,options:e,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function eW(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function tW({editor:t,options:e}){const n=e.dataAttribute?`data-${eW(e.dataAttribute)}`:`data-${LI}`,r=e.showOnlyCurrent&&!e.includeChildren;return new Nt({key:DA,...r?{}:{state:Q8({editor:t,options:e,dataAttribute:n})},props:{decorations:r?({doc:i,selection:s})=>BI({editor:t,options:e,dataAttribute:n,doc:i,selection:s}):i=>{var s;return e.showOnlyWhenEditable&&!t.isEditable?St.empty:(s=DA.getState(i))!=null?s:St.empty}}})}var nW=$t.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:LI,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[tW({editor:this.editor,options:this.options})]}});function F0(t,e){return!t.selection.empty&&!MD(t.selection)&&e.isEditable}function rW(t,e){return F0(t,e)&&!e.isFocused&&!e.view.dragging}function iW(){var t;(t=window.getSelection())==null||t.removeAllRanges()}function sW(t){t.focus()}$t.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Nt({key:new Zt("selection"),props:{decorations(n){return rW(n,t)?St.create(n.doc,[yn.inline(n.selection.from,n.selection.to,{class:e.className})]):null},handleDOMEvents:{blur(n){return F0(n.state,t)&&iW(),!1},focus(n){return F0(n.state,t)&&requestAnimationFrame(()=>{!t.isDestroyed&&n.hasFocus()&&sW(n)}),!1}}}})]}});var oW="skipTrailingNode";function IA({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var aW=$t.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Zt(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:c,tr:u,schema:f}=o,h=e.getState(o),m=c.content.size,g=f.nodes[n];if(!i.some(y=>y.getMeta(oW))&&h)return u.insert(m,g.create())},state:{init:(i,s)=>{const o=s.tr.doc.lastChild;return!IA({node:o,types:r})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const o=i.doc.lastChild;return!IA({node:o,types:r})}}})]}}),lW=$t.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>DI(t,e),redo:()=>({state:t,dispatch:e})=>II(t,e)}},addProseMirrorPlugins(){return[F8(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()}}}),cW=$t.create({name:"starterKit",addExtensions(){var t,e,n,r;const i=[];return this.options.bold!==!1&&i.push(K9.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(U9.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(vI.configure(this.options.bulletList)),this.options.code!==!1&&i.push(X9.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(eG.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(tG.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(q8.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(G8.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(nG.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(rG.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(lW.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(iG.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(cG.configure(this.options.italic)),this.options.listItem!==!1&&i.push(kI.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(_I.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&i.push(VG.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(RI.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(w8.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(C8.configure(this.options.strike)),this.options.text!==!1&&i.push(E8.configure(this.options.text)),this.options.underline!==!1&&i.push(T8.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&i.push(aW.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),uW=cW;function Ww(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ha=Ww();function $I(t){Ha=t}var ca={exec:()=>null};function ot(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(Wn.caret,"$1"),n=n.replace(i,o),r},getRegex:()=>new RegExp(n,e)};return r}var dW=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Wn={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)}}>`)},fW=/^(?:[ \t]*(?:\n|$))+/,hW=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,pW=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ud=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,mW=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Kw=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,VI=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,HI=ot(VI).replace(/bull/g,Kw).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(),gW=ot(VI).replace(/bull/g,Kw).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(),Zw=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,yW=/^[^\n]+/,Yw=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,vW=ot(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Yw).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),bW=ot(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Kw).getRegex(),Wm="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",Xw=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,SW=ot("^ {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",Xw).replace("tag",Wm).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),UI=ot(Zw).replace("hr",Ud).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",Wm).getRegex(),wW=ot(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",UI).getRegex(),Jw={blockquote:wW,code:hW,def:vW,fences:pW,heading:mW,hr:Ud,html:SW,lheading:HI,list:bW,newline:fW,paragraph:UI,table:ca,text:yW},LA=ot("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ud).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",Wm).getRegex(),xW={...Jw,lheading:gW,table:LA,paragraph:ot(Zw).replace("hr",Ud).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",LA).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",Wm).getRegex()},kW={...Jw,html:ot(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Xw).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:ca,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ot(Zw).replace("hr",Ud).replace("heading",` *#{1,6} *[^
|
|
208
|
-
]`).replace("lheading",HI).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},CW=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,EW=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,FI=/^( {2,}|\\)\n(?!\s*$)/,TW=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,bc=/[\p{P}\p{S}]/u,Km=/[\s\p{P}\p{S}]/u,Qw=/[^\s\p{P}\p{S}]/u,_W=ot(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Km).getRegex(),qI=/(?!~)[\p{P}\p{S}]/u,AW=/(?!~)[\s\p{P}\p{S}]/u,RW=/(?:[^\s\p{P}\p{S}]|~)/u,MW=ot(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",dW?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),GI=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,OW=ot(GI,"u").replace(/punct/g,bc).getRegex(),NW=ot(GI,"u").replace(/punct/g,qI).getRegex(),WI="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",DW=ot(WI,"gu").replace(/notPunctSpace/g,Qw).replace(/punctSpace/g,Km).replace(/punct/g,bc).getRegex(),IW=ot(WI,"gu").replace(/notPunctSpace/g,RW).replace(/punctSpace/g,AW).replace(/punct/g,qI).getRegex(),LW=ot("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Qw).replace(/punctSpace/g,Km).replace(/punct/g,bc).getRegex(),PW=ot(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,bc).getRegex(),zW="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",jW=ot(zW,"gu").replace(/notPunctSpace/g,Qw).replace(/punctSpace/g,Km).replace(/punct/g,bc).getRegex(),BW=ot(/\\(punct)/,"gu").replace(/punct/g,bc).getRegex(),$W=ot(/^<(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(),VW=ot(Xw).replace("(?:-->|$)","-->").getRegex(),HW=ot("^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",VW).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),fm=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,UW=ot(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",fm).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),KI=ot(/^!?\[(label)\]\[(ref)\]/).replace("label",fm).replace("ref",Yw).getRegex(),ZI=ot(/^!?\[(ref)\](?:\[\])?/).replace("ref",Yw).getRegex(),FW=ot("reflink|nolink(?!\\()","g").replace("reflink",KI).replace("nolink",ZI).getRegex(),PA=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ex={_backpedal:ca,anyPunctuation:BW,autolink:$W,blockSkip:MW,br:FI,code:EW,del:ca,delLDelim:ca,delRDelim:ca,emStrongLDelim:OW,emStrongRDelimAst:DW,emStrongRDelimUnd:LW,escape:CW,link:UW,nolink:ZI,punctuation:_W,reflink:KI,reflinkSearch:FW,tag:HW,text:TW,url:ca},qW={...ex,link:ot(/^!?\[(label)\]\((.*?)\)/).replace("label",fm).getRegex(),reflink:ot(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",fm).getRegex()},q0={...ex,emStrongRDelimAst:IW,emStrongLDelim:NW,delLDelim:PW,delRDelim:jW,url:ot(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",PA).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:ot(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",PA).getRegex()},GW={...q0,br:ot(FI).replace("{2,}","*").getRegex(),text:ot(q0.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},_h={normal:Jw,gfm:xW,pedantic:kW},Cu={normal:ex,gfm:q0,breaks:GW,pedantic:qW},WW={"&":"&","<":"<",">":">",'"':""","'":"'"},zA=t=>WW[t];function mi(t,e){if(e){if(Wn.escapeTest.test(t))return t.replace(Wn.escapeReplace,zA)}else if(Wn.escapeTestNoEncode.test(t))return t.replace(Wn.escapeReplaceNoEncode,zA);return t}function jA(t){try{t=encodeURI(t).replace(Wn.percentDecode,"%")}catch{return null}return t}function BA(t,e){let n=t.replace(Wn.findPipe,(s,o,c)=>{let u=!1,f=o;for(;--f>=0&&c[f]==="\\";)u=!u;return u?"|":" |"}),r=n.split(Wn.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(Wn.slashPipe,"|");return r}function Eu(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 KW(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 ZW(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 $A(t,e,n,r,i){let s=e.href,o=e.title||null,c=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:c,tokens:r.inlineTokens(c)};return r.state.inLink=!1,u}function YW(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[c]=o;return c.length>=i.length?s.slice(i.length):s}).join(`
|
|
210
|
-
`)}var hm=class{options;rules;lexer;constructor(t){this.options=t||Ha}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:Eu(n,`
|
|
211
|
-
`)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=YW(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=Eu(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:Eu(e[0],`
|
|
212
|
-
`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=Eu(e[0],`
|
|
213
|
-
`).split(`
|
|
214
|
-
`),r="",i="",s=[];for(;n.length>0;){let o=!1,c=[],u;for(u=0;u<n.length;u++)if(this.rules.other.blockquoteStart.test(n[u]))c.push(n[u]),o=!0;else if(!o)c.push(n[u]);else break;n=n.slice(u);let f=c.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,S=y.raw+`
|
|
219
|
-
`+n.join(`
|
|
220
|
-
`),w=this.blockquote(S);s[s.length-1]=w,r=r.substring(0,r.length-y.raw.length)+w.raw,i=i.substring(0,i.length-y.text.length)+w.text;break}else if(g?.type==="list"){let y=g,S=y.raw+`
|
|
221
|
-
`+n.join(`
|
|
222
|
-
`),w=this.list(S);s[s.length-1]=w,r=r.substring(0,r.length-g.raw.length)+w.raw,i=i.substring(0,i.length-y.raw.length)+w.raw,n=S.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=ZW(e[2].split(`
|
|
224
|
-
`,1)[0],e[1].length),g=t.split(`
|
|
225
|
-
`,1)[0],y=!m.trim(),S=0;if(this.options.pedantic?(S=2,h=m.trimStart()):y?S=e[1].length+1:(S=m.search(this.rules.other.nonSpaceChar),S=S>4?1:S,h=m.slice(S),S+=e[1].length),y&&this.rules.other.blankLine.test(g)&&(f+=g+`
|
|
226
|
-
`,t=t.substring(g.length+1),u=!0),!u){let w=this.rules.other.nextBulletRegex(S),x=this.rules.other.hrRegex(S),k=this.rules.other.fencesBeginRegex(S),T=this.rules.other.headingBeginRegex(S),A=this.rules.other.htmlBeginRegex(S),_=this.rules.other.blockquoteBeginRegex(S);for(;t;){let O=t.split(`
|
|
227
|
-
`,1)[0],N;if(g=O,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),N=g):N=g.replace(this.rules.other.tabCharGlobal," "),k.test(g)||T.test(g)||A.test(g)||_.test(g)||w.test(g)||x.test(g))break;if(N.search(this.rules.other.nonSpaceChar)>=S||!g.trim())h+=`
|
|
228
|
-
`+N.slice(S);else{if(y||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||k.test(m)||T.test(m)||x.test(m))break;h+=`
|
|
229
|
-
`+g}y=!g.trim(),f+=O+`
|
|
230
|
-
`,t=t.substring(O.length+1),m=N.slice(S)}}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 c=i.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.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=BA(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(BA(o,s.header.length).map((c,u)=>({text:c,tokens:this.lexer.inline(c),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=Eu(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{let s=KW(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)),$A(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 $A(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,c=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]){c+=o;continue}else if((r[5]||r[6])&&i%3&&!((i+o)%3)){u+=o;continue}if(c-=o,c>0)continue;o=Math.min(o,o+c+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,c=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]){c+=o;continue}if(c-=o,c>0)continue;o=Math.min(o,o+c);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}}}},Xr=class G0{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ha,this.options.tokenizer=this.options.tokenizer||new hm,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:Wn,block:_h.normal,inline:Cu.normal};this.options.pedantic?(n.block=_h.pedantic,n.inline=Cu.pedantic):this.options.gfm&&(n.block=_h.gfm,this.options.breaks?n.inline=Cu.breaks:n.inline=Cu.gfm),this.tokenizer.rules=n}static get rules(){return{block:_h,inline:Cu}}static lex(e,n){return new G0(n).lex(e)}static lexInline(e,n){return new G0(n).inlineTokens(e)}lex(e){e=e.replace(Wn.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(Wn.tabCharGlobal," ").replace(Wn.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,c=e.slice(1),u;this.options.extensions.startBlock.forEach(f=>{u=f.call({lexer:this},c),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,c="";for(;e;){o||(c=""),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,c)){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,c)){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)!=="_"&&(c=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}},pm=class{options;parser;constructor(t){this.options=t||Ha}space(t){return""}code({text:t,lang:e,escaped:n}){let r=(e||"").match(Wn.notSpaceStart)?.[0],i=t.replace(Wn.endingNewline,"")+`
|
|
247
|
-
`;return r?'<pre><code class="language-'+mi(r)+'">'+(n?i:mi(i,!0))+`</code></pre>
|
|
248
|
-
`:"<pre><code>"+(n?i:mi(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 c=t.items[o];r+=this.listitem(c)}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>${mi(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=jA(t);if(i===null)return r;t=i;let s='<a href="'+t+'"';return e&&(s+=' title="'+mi(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=jA(t);if(i===null)return mi(n);t=i;let s=`<img src="${t}" alt="${mi(n)}"`;return e&&(s+=` title="${mi(e)}"`),s+=">",s}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:mi(t.text)}},tx=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}},Jr=class W0{options;renderer;textRenderer;constructor(e){this.options=e||Ha,this.options.renderer=this.options.renderer||new pm,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new tx}static parse(e,n){return new W0(n).parse(e)}static parseInline(e,n){return new W0(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,c=this.options.extensions.renderers[o.type].call({parser:this},o);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(o.type)){n+=c||"";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 c=this.options.extensions.renderers[s.type].call({parser:this},s);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){r+=c||"";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 c='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}},zu=class{options;block;constructor(t){this.options=t||Ha}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?Xr.lex:Xr.lexInline}provideParser(t=this.block){return t?Jr.parse:Jr.parseInline}},XW=class{defaults=Ww();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Jr;Renderer=pm;TextRenderer=tx;Lexer=Xr;Tokenizer=hm;Hooks=zu;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 c=i.renderer.apply(this,o);return c===!1&&(c=s.apply(this,o)),c}: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 pm(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,c=n.renderer[o],u=i[o];i[o]=(...f)=>{let h=c.apply(i,f);return h===!1&&(h=u.apply(i,f)),h||""}}r.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new hm(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,c=n.tokenizer[o],u=i[o];i[o]=(...f)=>{let h=c.apply(i,f);return h===!1&&(h=u.apply(i,f)),h}}r.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new zu;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,c=n.hooks[o],u=i[o];zu.passThroughHooks.has(s)?i[o]=f=>{if(this.defaults.async&&zu.passThroughHooksRespectAsync.has(s))return(async()=>{let m=await c.call(i,f);return u.call(i,m)})();let h=c.call(i,f);return u.call(i,h)}:i[o]=(...f)=>{if(this.defaults.async)return(async()=>{let m=await c.apply(i,f);return m===!1&&(m=await u.apply(i,f)),m})();let h=c.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 c=[];return c.push(s.call(this,o)),i&&(c=c.concat(i.call(this,o))),c}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return Xr.lex(t,e??this.defaults)}parser(t,e){return Jr.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,c=await(i.hooks?await i.hooks.provideLexer(t):t?Xr.lex:Xr.lexInline)(o,i),u=i.hooks?await i.hooks.processAllTokens(c):c;i.walkTokens&&await Promise.all(this.walkTokens(u,i.walkTokens));let f=await(i.hooks?await i.hooks.provideParser(t):t?Jr.parse:Jr.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?Xr.lex:Xr.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let c=(i.hooks?i.hooks.provideParser(t):t?Jr.parse:Jr.parseInline)(o,i);return i.hooks&&(c=i.hooks.postprocess(c)),c}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>"+mi(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},Ma=new XW;function wt(t,e){return Ma.parse(t,e)}wt.options=wt.setOptions=function(t){return Ma.setOptions(t),wt.defaults=Ma.defaults,$I(wt.defaults),wt};wt.getDefaults=Ww;wt.defaults=Ha;wt.use=function(...t){return Ma.use(...t),wt.defaults=Ma.defaults,$I(wt.defaults),wt};wt.walkTokens=function(t,e){return Ma.walkTokens(t,e)};wt.parseInline=Ma.parseInline;wt.Parser=Jr;wt.parser=Jr.parse;wt.Renderer=pm;wt.TextRenderer=tx;wt.Lexer=Xr;wt.lexer=Xr.lex;wt.Tokenizer=hm;wt.Hooks=zu;wt.parse=wt;wt.options;wt.setOptions;wt.use;wt.walkTokens;wt.parseInline;Jr.parse;Xr.lex;var JW=/\n[^\S\n]*(?:\n[^\S\n]*)+$/;function QW(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(JW);return i?[{...e,raw:(e.raw||"").slice(0,-i[0].length)},{type:"space",raw:i[0]}]:[e]})}function e7(t,e){const r=e.split(`
|
|
266
|
-
`).flatMap(i=>[i,""]).map(i=>`${t}${i}`).join(`
|
|
267
|
-
`);return r.slice(0,r.length-1)}function t7(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&&dc(o.attrs,i.attrs))||n.push(r)}),n}function n7(t,e){const n=[];return Array.from(e.entries()).forEach(([r,i])=>{const s=t.get(r);(!s||!dc(s.attrs,i.attrs))&&n.push({type:r,mark:i})}),n}function r7(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]))),c=[];return(i||s||o)&&(n&&n.marks?Array.from(t.entries()).reverse().forEach(([u,f])=>{n.marks.find(m=>m.type===u&&dc(m.attrs,f.attrs))||c.push(u)}):(i||s)&&c.push(...Array.from(t.keys()).reverse())),c}function i7(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 s7(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 pb(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 Ah(t,e){return typeof t!="string"?"json":e}var o7=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"]),a7=/<\/?([a-zA-Z][\w-]*)/g;function l7(t){const e=[];let n;for(;(n=a7.exec(t))!==null;)e.push(n[1].toLowerCase());return e}function c7(t){const e=t.toLowerCase();return e.includes("-")?!1:!o7.has(e)}function u7(t,e){return l7(t).some(r=>c7(r)?!e.has(r):!1)}var d7=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:wt,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,Gl(Vm(t.extensions)).forEach(c=>this.registerExtension(c)))}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=ht(Te(t,"code")),i=t.name;r&&this.codeTypes.add(i),this.extensionRanks.has(i)||this.extensionRanks.set(i,this.extensionRanks.size);const s=Te(t,"markdownTokenName")||i,o=Te(t,"parseMarkdown"),c=Te(t,"renderMarkdown"),u=Te(t,"markdownTokenizer"),f=(e=Te(t,"markdownOptions"))!=null?e:null,h=(n=f?.indentsContent)!=null?n:!1,m=f?.htmlReopen,g={tokenName:s,nodeName:i,parseMarkdown:o,renderMarkdown:c,isIndenting:h,htmlReopen:m,tokenizer:u};if(s&&o){const y=this.registry.get(s)||[];y.push(g),this.registry.set(s,y)}if(c){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 c;n?c=typeof n=="function"?n:f=>f.indexOf(n):c=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:c,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?QW(t):t,r=n.reduce((o,c,u)=>(c.type!=="space"&&o.push(u),o),[]);let i=-1,s=0;return n.flatMap((o,c)=>{for(var u;s<r.length&&r[s]<c;)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),c=this.normalizeParseResult(o);return c&&(!Array.isArray(c)||c.length>0)?(this.lastParseResult=c,!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(c=>pb(c).isTask),n=t.items.some(c=>!pb(c).isTask);if(!e||!n||this.getHandlersForToken("taskList").length===0)return this.parseTokenWithHandlers(t);const r=[];let i=[],s=null;for(let c=0;c<t.items.length;c+=1){const u=t.items[c],{isTask:f,checked:h,indentLevel:m}=pb(u);let g=u;if(f){const w=(u.raw||u.text||"").split(`
|
|
269
|
-
`),x=w[0].match(/^\s*[-+*]\s+\[([ xX])\]\s+(.*)$/),k=x?x[2]:"";let T=[];if(w.length>1&&w.slice(1).join(`
|
|
270
|
-
`).trim()){const _=w.slice(1),O=_.filter(N=>N.trim());if(O.length>0){const N=Math.min(...O.map(q=>q.length-q.trimStart().length)),z=_.map(q=>q.trim()?q.slice(N):"").join(`
|
|
271
|
-
`).trim();z&&(T=this.markedInstance.lexer(`${z}
|
|
272
|
-
`))}}g={type:"taskItem",raw:"",mainContent:k,indentLevel:m,checked:h??!1,text:k,tokens:this.tokenizeInline(k),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 c=0;c<r.length;c+=1){const u=r[c],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 c=t[o];if(c.type==="text")s.push({type:"text",text:dA(c.text||"")});else if(c.type==="escape")s.push({type:"text",text:c.text||""});else if(c.type==="html"){const u=((n=(e=c.raw)!=null?e:c.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),S=new RegExp(`^<\\/\\s*${y}\\b`,"i");let w=-1;const x=[u];for(let k=o+1;k<t.length;k+=1){const T=t[k],A=((i=(r=T.raw)!=null?r:T.text)!=null?i:"").toString();if(x.push(A),T.type==="html"&&S.test(A)){w=k;break}}if(w!==-1){const k=x.join(""),T={type:"html",raw:k,text:k,block:!1},A=this.parseHTMLToken(T);if(A){const _=this.normalizeParseResult(A);Array.isArray(_)?s.push(..._):_&&s.push(_)}o=w;continue}}const m=this.parseHTMLToken(c);if(m){const g=this.normalizeParseResult(m);Array.isArray(g)?s.push(...g):g&&s.push(g)}}else if(c.type){const u=this.getHandlerForToken(c.type);if(u&&u.parseMarkdown){const f=this.createParseHelpers(),h=u.parseMarkdown(c,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 c.tokens&&s.push(...this.parseInlineTokens(c.tokens))}}for(let o=s.length-1;o>0;o-=1){const c=s[o],u=s[o-1];if(c.type==="text"&&u.type==="text"){const f=c.marks||[],h=u.marks||[];Eq(f,h)&&(u.text=(u.text||"")+(c.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:dA(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=D5(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 u7(t,this.getSchemaParseDomTags())}getSchemaParseDomTags(){if(this.schemaParseDomTagsCache)return this.schemaParseDomTagsCache;const t=new Set;try{const e=TD(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(gq(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 c=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:e7},f={index:n,level:r,parentType:e?.type,previousNode:c,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,c=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(O=>[O.type,O])),y=this.getMarksToOpenForSerialization(s,g,h),S=t7(g,h),w=S.filter(O=>s.has(O)),x=w.length>0&&y.length>0;let k="";if(S.length>0&&!x){const O=m.match(/(\s+)$/);O&&(k=O[1],m=m.slice(0,-k.length))}x||S.slice().reverse().forEach(O=>{if(!s.has(O))return;const N=g.get(O),I=this.getMarkClosing(O,N,c.get(O));I&&(m+=I),s.has(O)&&(s.delete(O),c.delete(O))});let T="";if(y.length>0){const O=m.match(/^(\s+)/);O&&(T=O[1],m=m.slice(T.length))}y.forEach(({type:O,mark:N})=>{const I=o.has(O)?"html":"markdown",z=this.getMarkOpening(O,N,I);z&&(m=z+m),c.set(O,I),o.delete(O)}),x||y.slice().reverse().forEach(({type:O,mark:N})=>{s.set(O,N)}),m=T+m;let A;if(x){const O=new Set((h?.marks||[]).map(z=>z.type));y.forEach(({type:z})=>{O.has(z)&&this.getHtmlReopenTags(z)&&o.add(z)});const N=Array.from(s.keys()),I=w.slice().sort((z,q)=>N.indexOf(q)-N.indexOf(z));A=[...y.map(z=>z.type),...I]}else A=r7(s,g,h,this.markSetsEqual.bind(this));let _="";if(A.length>0){const O=m.match(/(\s+)$/);O&&(_=O[1],m=m.slice(0,-_.length))}A.forEach(O=>{var N;const I=(N=s.get(O))!=null?N:g.get(O),z=this.getMarkClosing(O,I,c.get(O));z&&(m+=z),s.delete(O),c.delete(O)}),m+=_,m+=k,i.push(m)}else{const m=new Set((u.marks||[]).map(k=>k.type)),g=new Map,y=new Map;s.forEach((k,T)=>{var A;m.has(T)&&(g.set(T,k),y.set(T,(A=c.get(T))!=null?A:"markdown"))});const S=i7(s,(k,T)=>this.getMarkClosing(k,T,c.get(k)));c.clear();const w=this.renderNodeToMarkdown(u,e,f,r),x=u.type==="hardBreak"?"":s7(g,s,(k,T)=>{var A;const _=(A=y.get(k))!=null?A:"markdown";return c.set(k,_),this.getMarkOpening(k,T,_)});i.push(S+w+x)}}),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__",c={type:t,attrs:e.attrs||{},content:[{type:"text",text:o}]};try{const u=s.renderMarkdown(c,{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__",c={type:t,attrs:e.attrs||{},content:[{type:"text",text:o}]};try{const u=s.renderMarkdown(c,{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&&dc(r.attrs,i.attrs)})}getMarksToOpenForSerialization(t,e,n){const r=n7(t,e);if(r.length<=1)return r;const i=n?.marks||[],s=(f,h)=>i.some(m=>m.type===f&&dc(m.attrs,h)),o=(f,h)=>{var m,g;const y=(m=this.extensionRanks.get(f.type))!=null?m:Number.MAX_SAFE_INTEGER,S=(g=this.extensionRanks.get(h.type))!=null?g:Number.MAX_SAFE_INTEGER;return y!==S?S-y:f.type.localeCompare(h.type)},c=r.filter(f=>!s(f.type,f.mark.attrs)).sort(o),u=r.filter(f=>s(f.type,f.mark.attrs)).sort(o);return[...c,...u]}},VA=d7,f7=$t.create({name:"markdown",addOptions(){return{indentation:{style:"space",size:2},marked:void 0,markedOptions:{}}},addCommands(){return{setContent:(t,e)=>{if(!e?.contentType||Ah(t,e?.contentType)!=="markdown"||!this.editor.markdown)return Zr.setContent(t,e);const r=this.editor.markdown.parse(t);return Zr.setContent(r,e)},insertContent:(t,e)=>{if(!e?.contentType||Ah(t,e?.contentType)!=="markdown"||!this.editor.markdown)return Zr.insertContent(t,e);const r=this.editor.markdown.parse(t);return Zr.insertContent(r,e)},insertContentAt:(t,e,n)=>{if(!n?.contentType||Ah(e,n?.contentType)!=="markdown"||!this.editor.markdown)return Zr.insertContentAt(t,e,n);const i=this.editor.markdown.parse(e);return Zr.insertContentAt(t,i,n)}}},addStorage(){return{manager:new VA({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 VA({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||Ah(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)}}),h7=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,p7=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",Ot(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 c=(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:c,editor:u})=>{const f=document.createElement("img");f.draggable=!1;const h=Ot(this.options.HTMLAttributes,c);Object.entries(h).forEach(([x,k])=>{if(k!=null)switch(x){case"src":case"width":case"height":break;default:f.setAttribute(x,k);break}}),h.src!==null&&(f.src=h.src);let m={...c};const g=x=>{if(typeof x=="string"&&x!==""){f.getAttribute("src")!==x&&(f.src=x);return}f.hasAttribute("src")&&f.removeAttribute("src"),f.src!==""&&(f.src="")};g(c.src);const y=x=>{if(x.type!==s.type)return!1;const k=u.extensionManager.attributes.filter(A=>A.type===x.type.name),T=uc(x,k);return Object.keys(m).forEach(A=>{!i.has(A)&&!(A in T)&&f.removeAttribute(A)}),Object.entries(T).forEach(([A,_])=>{i.has(A)||(_!=null?f.setAttribute(A,_):f.removeAttribute(A))}),g(T.src),m=T,!0},S=new jq({element:f,editor:u,node:s,getPos:o,onResize:(x,k)=>{f.style.width=`${x}px`,f.style.height=`${k}px`},onCommit:(x,k)=>{const T=o();T!==void 0&&this.editor.chain().setNodeSelection(T).updateAttributes(this.name,{width:x,height:k}).run()},onUpdate:y,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),w=S.dom;return w.style.visibility="hidden",w.style.pointerEvents="none",f.onload=()=>{w.style.visibility="",w.style.pointerEvents=""},S}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[ZD({find:h7,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),m7=p7;let K0,Z0;if(typeof WeakMap<"u"){let t=new WeakMap;K0=e=>t.get(e),Z0=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;K0=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Z0=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var Kt=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 c=1;s<this.width&&this.map[e+c]==n;c++)s++;for(let c=1;o<this.height&&this.map[e+this.width*c]==n;c++)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:c,top:u,bottom:f}=this.findCell(e);return{left:Math.min(n,o),top:Math.min(i,u),right:Math.max(r,c),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 c=(t+1)*this.width;for(;o<c&&this.map[o]<i;)o++;return o==c?s-1:this.map[o]}i=s}}static get(t){return K0(t)||Z0(t,g7(t))}};function g7(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=y7(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 S=0;;S++){for(;i<r.length&&r[i]!=0;)i++;if(S==m.childCount)break;const w=m.child(S),{colspan:x,rowspan:k,colwidth:T}=w.attrs;for(let A=0;A<k;A++){if(A+f>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:h,n:k-A});break}const _=i+A*e;for(let O=0;O<x;O++){r[_+O]==0?r[_+O]=h:(s||(s=[])).push({type:"collision",row:f,pos:h,n:x-O});const N=T&&T[O];if(N){const I=(_+O)%e*2,z=o[I];z==null||z!=N&&o[I+1]==1?(o[I]=N,o[I+1]=1):z==N&&o[I+1]++}}}i+=x,h+=w.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 c=new Kt(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&&v7(c,o,t),c}function y7(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 c=t.child(o);for(let u=0;u<c.childCount;u++){const f=c.child(u);o+f.attrs.rowspan>r&&(s+=f.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const c=i.child(o);s+=c.attrs.colspan,c.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function v7(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 c=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)&&((c||(c=b7(u)))[f]=h)}c&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:c})}}function b7(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Vn(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 ao=new Zt("selectingCells");function Oa(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 S7(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 li(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 Zm(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=Oa(e.$head)||w7(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function w7(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 Y0(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function x7(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function nx(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function YI(t,e,n){const r=t.node(-1),i=Kt.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 Na(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 XI(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 k7(t,e,n){const r=Vn(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 Mt=class Xi extends Ve{constructor(e,n=e){const r=e.node(-1),i=Kt.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,n.pos-s),c=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 mN(c.resolve(g),c.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(Y0(r)&&Y0(i)&&nx(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Xi.rowSelection(r,i):s&&this.isColSelection()?Xi.colSelection(r,i):new Xi(r,i)}return Oe.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=Kt.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 S=e.nodeAt(g);if(!S)throw new RangeError(`No cell with offset ${g} found`);const w=i.left-y.left,x=y.right-i.right;if(w>0||x>0){let k=S.attrs;if(w>0&&(k=Na(k,0,w)),x>0&&(k=Na(k,k.colspan-x,x)),y.left<i.left){if(S=S.type.createAndFill(k),!S)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(k)}`)}else S=S.type.create(k,S.content)}if(y.top<i.top||y.bottom>i.bottom){const k={...S.attrs,rowspan:Math.min(y.bottom,i.bottom)-Math.max(y.top,i.top)};y.top<i.top?S=S.type.createAndFill(k):S=S.type.create(k,S.content)}f.push(S)}o.push(e.child(u).copy(ne.from(f)))}const c=this.isColSelection()&&this.isRowSelection()?e:o;return new ve(ne.from(c),1,1)}replace(e,n=ve.empty){const r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:c,$to:u}=i[o],f=e.mapping.slice(r);e.replace(f.map(c.pos),f.map(u.pos),o?ve.empty:n)}const s=Ve.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new ve(ne.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=Kt.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=Kt.get(r),s=e.start(-1),o=i.findCell(e.pos-s),c=i.findCell(n.pos-s),u=e.node(0);return o.top<=c.top?(o.top>0&&(e=u.resolve(s+i.map[o.left])),c.bottom<i.height&&(n=u.resolve(s+i.map[i.width*(i.height-1)+c.right-1]))):(c.top>0&&(n=u.resolve(s+i.map[c.left])),o.bottom<i.height&&(e=u.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new Xi(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=Kt.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,c=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,c)==n.width}eq(e){return e instanceof Xi&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=Kt.get(r),s=e.start(-1),o=i.findCell(e.pos-s),c=i.findCell(n.pos-s),u=e.node(0);return o.left<=c.left?(o.left>0&&(e=u.resolve(s+i.map[o.top*i.width])),c.right<i.width&&(n=u.resolve(s+i.map[i.width*(c.top+1)-1]))):(c.left>0&&(n=u.resolve(s+i.map[c.top*i.width])),o.right<i.width&&(e=u.resolve(s+i.map[i.width*(o.top+1)-1]))),new Xi(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Xi(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Xi(e.resolve(n),e.resolve(r))}getBookmark(){return new C7(this.$anchorCell.pos,this.$headCell.pos)}};Mt.prototype.visible=!1;Ve.jsonID("cell",Mt);var C7=class JI{constructor(e,n){this.anchor=e,this.head=n}map(e){return new JI(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&&nx(n,r)?new Mt(n,r):Ve.near(r,1)}};function E7(t){if(!(t.selection instanceof Mt))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(yn.node(r,r+n.nodeSize,{class:"selectedCell"}))}),St.create(t.doc,e)}function T7({$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 _7({$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 A7(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,o;if(r instanceof De&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=Mt.create(i,r.from);else if(o=="row"){const c=i.resolve(r.from+1);s=Mt.rowSelection(c,c)}else if(!n){const c=Kt.get(r.node),u=r.from+1,f=u+c.map[c.width*c.height-1];s=Mt.create(i,u+1,f)}}else r instanceof Oe&&T7(r)?s=Oe.create(i,r.from):r instanceof Oe&&_7(r)&&(s=Oe.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const R7=new Zt("fix-tables");function QI(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let o=0,c=0;o<s;o++){const u=e.child(o);for(let f=c,h=Math.min(i,o+3);f<h;f++)if(t.child(f)==u){c=f+1,n+=u.nodeSize;continue e}r(u,n),c<i&&t.child(c).sameMarkup(u)?QI(t.child(c),u,n+1,r):u.nodesBetween(0,u.content.size,r,n+1),n+=u.nodeSize}}function eL(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=M7(t,i,s,n))};return e?e.doc!=t.doc&&QI(e.doc,t.doc,0,r):t.doc.descendants(r),n}function M7(t,e,n,r){const i=Kt.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,Na(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,c;for(let u=0;u<s.length;u++)s[u]&&(o==null&&(o=u),c=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 S=[];for(let x=0;x<g;x++){const k=Vn(t.schema)[y].createAndFill();k&&S.push(k)}const w=(u==0||o==u-1)&&c==u?f+1:m-1;r.insert(r.mapping.map(w),S)}f=m}return r.setMeta(R7,{fixTables:!0})}function _i(t){const e=t.selection,n=Zm(t),r=n.node(-1),i=n.start(-1),s=Kt.get(r);return{...e instanceof Mt?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function tL(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;k7(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let o=0;o<e.height;o++){const c=o*e.width+i;if(i>0&&i<e.width&&e.map[c-1]==e.map[c]){const u=e.map[c],f=r.nodeAt(u);t.setNodeMarkup(t.mapping.map(n+u),null,XI(f.attrs,i-e.colCount(u))),o+=f.attrs.rowspan-1}else{const u=s==null?Vn(r.type.schema).cell:r.nodeAt(e.map[c+s]).type,f=e.positionAt(o,i,r);t.insert(t.mapping.map(n+f),u.createAndFill())}}return t}function O7(t,e){if(!li(t))return!1;if(e){const n=_i(t);e(tL(t.tr,n,n.left))}return!0}function N7(t,e){if(!li(t))return!1;if(e){const n=_i(t);e(tL(t.tr,n,n.right))}return!0}function D7(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let o=0;o<e.height;){const c=o*e.width+i,u=e.map[c],f=n.nodeAt(u),h=f.attrs;if(i>0&&e.map[c-1]==u||i<e.width-1&&e.map[c+1]==u)t.setNodeMarkup(t.mapping.slice(s).map(r+u),null,Na(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 I7(t,e){if(!li(t))return!1;if(e){const n=_i(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;D7(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=Kt.get(s)}e(r)}return!0}function L7(t,e,n){var r;const i=Vn(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 nL(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 c=i>0?-1:0;L7(e,r,i+c)&&(c=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=c==null?Vn(r.type.schema).cell:(u=r.nodeAt(e.map[h+c*e.width]))===null||u===void 0?void 0:u.type,g=m?.createAndFill();g&&o.push(g)}return t.insert(s,Vn(r.type.schema).row.create(null,o)),t}function P7(t,e){if(!li(t))return!1;if(e){const n=_i(t);e(nL(t.tr,n,n.top))}return!0}function z7(t,e){if(!li(t))return!1;if(e){const n=_i(t);e(nL(t.tr,n,n.bottom))}return!0}function j7(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,c=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(c).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,S=g.type.create({...y,rowspan:g.attrs.rowspan-1},g.content),w=e.positionAt(i+1,f,n);t.insert(t.mapping.slice(c).map(r+w),S),f+=y.colspan-1}}}}function B7(t,e){if(!li(t))return!1;if(e){const n=_i(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;j7(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=Kt.get(n.table)}e(r)}return!0}function HA(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function $7({width:t,height:e,map:n},r){let i=r.top*t+r.left,s=i,o=(r.bottom-1)*t+r.left,c=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[c]==n[c+1])return!0;s+=t,c+=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 UA(t,e){const n=t.selection;if(!(n instanceof Mt)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=_i(t),{map:i}=r;if($7(i,r))return!1;if(e){const s=t.tr,o={};let c=ne.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{HA(y)||(c=c.append(y.content));const S=s.mapping.map(g+r.tableStart);s.delete(S,S+y.nodeSize)}}if(u==null||f==null)return!0;if(s.setNodeMarkup(u+r.tableStart,null,{...XI(f.attrs,f.attrs.colspan,r.right-r.left-f.attrs.colspan),rowspan:r.bottom-r.top}),c.size>0){const h=u+1+f.content.size,m=HA(f)?u+1:h;s.replaceWith(m+r.tableStart,h+r.tableStart,c)}s.setSelection(new Mt(s.doc.resolve(u+r.tableStart))),e(s)}return!0}function FA(t,e){const n=Vn(t.schema);return V7(({node:r})=>n[r.type.spec.tableRole])(t,e)}function V7(t){return(e,n)=>{const r=e.selection;let i,s;if(r instanceof Mt){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{var o;if(i=S7(r.$from),!i)return!1;s=(o=Oa(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 c=i.attrs;const u=[],f=c.colwidth;c.rowspan>1&&(c={...c,rowspan:1}),c.colspan>1&&(c={...c,colspan:1});const h=_i(e),m=e.tr;for(let y=0;y<h.right-h.left;y++)u.push(f?{...c,colwidth:f&&f[y]?[f[y]]:null}:c);let g;for(let y=h.top;y<h.bottom;y++){let S=h.map.positionAt(y,h.left,h.table);y==h.top&&(S+=i.nodeSize);for(let w=h.left,x=0;w<h.right;w++,x++)w==h.left&&y==h.top||m.insert(g=m.mapping.map(S+h.tableStart,1),t({node:i,row:y,col:w}).createAndFill(u[x]))}m.setNodeMarkup(s,t({node:i,row:h.top,col:h.left}),u[0]),r instanceof Mt&&m.setSelection(new Mt(m.doc.resolve(r.$anchorCell.pos),g?m.doc.resolve(g):void 0)),n(m)}return!0}}function H7(t,e){return function(n,r){if(!li(n))return!1;const i=Zm(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof Mt?n.selection.forEachCell((o,c)=>{o.attrs[t]!==e&&s.setNodeMarkup(c,null,{...o.attrs,[t]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function U7(t){return function(e,n){if(!li(e))return!1;if(n){const r=Vn(e.schema),i=_i(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),c=o.map(u=>i.table.nodeAt(u));for(let u=0;u<o.length;u++)c[u].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[u],r.cell,c[u].attrs);if(s.steps.length===0)for(let u=0;u<o.length;u++)s.setNodeMarkup(i.tableStart+o[u],r.header_cell,c[u].attrs);n(s)}return!0}}function qA(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 Sd(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?U7(t):function(n,r){if(!li(n))return!1;if(r){const i=Vn(n.schema),s=_i(n),o=n.tr,c=qA("row",s,i),u=qA("column",s,i),f=(t==="column"?c: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"?c?i.cell:i.header_cell:i.cell;s.map.cellsInRect(h).forEach(g=>{const y=g+s.tableStart,S=o.doc.nodeAt(y);S&&o.setNodeMarkup(y,m,S.attrs)}),r(o)}return!0}}Sd("row",{useDeprecatedLogic:!0});Sd("column",{useDeprecatedLogic:!0});const F7=Sd("cell",{useDeprecatedLogic:!0});function q7(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 GA(t){return function(e,n){if(!li(e))return!1;const r=q7(Zm(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(Oe.between(i,x7(i))).scrollIntoView())}return!0}}function G7(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 Rh(t,e){const n=t.selection;if(!(n instanceof Mt))return!1;if(e){const r=t.tr,i=Vn(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 ve(i,0,0))}),r.docChanged&&e(r)}return!0}function W7(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,c=[];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=X0(Vn(o).row,new ve(f,h,m)).content),c.push(f)}else if(s=="cell"||s=="header_cell")c.push(n||r?X0(Vn(o).row,new ve(e,n,r)).content:e);else return null;return K7(o,c)}function K7(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:c,colspan:u}=s.child(o).attrs;for(let f=i;f<i+c;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(ne.empty),n[i]<r){const s=Vn(t).cell.createAndFill(),o=[];for(let c=n[i];c<r;c++)o.push(s);e[i]=e[i].append(ne.from(o))}return{height:e.length,width:r,rows:e}}function X0(t,e){const n=t.createAndFill();return new ow(n).replace(0,n.content.size,e).doc}function Z7({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],o=[];for(let c=0;c<n.length;c++){const u=n[c],f=[];for(let h=s[c]||0,m=0;h<r;m++){let g=u.child(m%u.childCount);h+g.attrs.colspan>r&&(g=g.type.createChecked(Na(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[c+y]=(s[c+y]||0)+g.attrs.colspan}o.push(ne.from(f))}n=o,t=r}if(e!=i){const s=[];for(let o=0,c=0;o<i;o++,c++){const u=[],f=n[c%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(ne.from(u))}n=s,e=i}return{width:t,height:e,rows:n}}function Y7(t,e,n,r,i,s,o){const c=t.doc.type.schema,u=Vn(c);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 S=[];let w;y.lastChild==null||y.lastChild.type==u.cell?w=f||(f=u.cell.createAndFill()):w=h||(h=u.header_cell.createAndFill());for(let x=e.width;x<i;x++)S.push(w);t.insert(t.mapping.slice(o).map(g-1+r),S)}if(s>e.height){const m=[];for(let S=0,w=(e.height-1)*e.width;S<Math.max(e.width,i);S++){const x=S>=e.width?!1:n.nodeAt(e.map[w+S]).type==u.header_cell;m.push(x?h||(h=u.header_cell.createAndFill()):f||(f=u.cell.createAndFill()))}const g=u.row.create(null,ne.from(m)),y=[];for(let S=e.height;S<s;S++)y.push(g);t.insert(t.mapping.slice(o).map(r+n.nodeSize-2),y)}return!!(f||h)}function WA(t,e,n,r,i,s,o,c){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:S}=e.findCell(m);t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...g.attrs,rowspan:o-y}),t.insert(t.mapping.slice(c).map(e.positionAt(o,S,n)),g.type.createAndFill({...g.attrs,rowspan:y+g.attrs.rowspan-o})),f+=g.attrs.colspan-1}}return u}function KA(t,e,n,r,i,s,o,c){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),S=t.mapping.slice(c).map(m+r);t.setNodeMarkup(S,null,Na(g.attrs,o-y,g.attrs.colspan-(o-y))),t.insert(S+g.nodeSize,g.type.createAndFill(Na(g.attrs,0,o-y))),f+=g.attrs.rowspan-1}}return u}function ZA(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=Kt.get(s);const{top:c,left:u}=r,f=u+i.width,h=c+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=Kt.get(s),g=m.mapping.maps.length}Y7(m,o,s,n,f,h,g)&&y(),WA(m,o,s,n,u,f,c,g)&&y(),WA(m,o,s,n,u,f,h,g)&&y(),KA(m,o,s,n,c,h,u,g)&&y(),KA(m,o,s,n,c,h,f,g)&&y();for(let S=c;S<h;S++){const w=o.positionAt(S,u,s),x=o.positionAt(S,f,s);m.replace(m.mapping.slice(g).map(w+n),m.mapping.slice(g).map(x+n),new ve(i.rows[S-c],0,0))}y(),m.setSelection(new Mt(m.doc.resolve(n+o.positionAt(c,u,s)),m.doc.resolve(n+o.positionAt(h-1,f-1,s)))),e(m)}const X7=ww({ArrowLeft:Mh("horiz",-1),ArrowRight:Mh("horiz",1),ArrowUp:Mh("vert",-1),ArrowDown:Mh("vert",1),"Shift-ArrowLeft":Oh("horiz",-1),"Shift-ArrowRight":Oh("horiz",1),"Shift-ArrowUp":Oh("vert",-1),"Shift-ArrowDown":Oh("vert",1),Backspace:Rh,"Mod-Backspace":Rh,Delete:Rh,"Mod-Delete":Rh});function ep(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Mh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof Mt)return ep(n,r,Ve.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const o=rL(i,t,e);if(o==null)return!1;if(t=="horiz")return ep(n,r,Ve.near(n.doc.resolve(s.head+e),e));{const c=n.doc.resolve(o),u=YI(c,t,e);let f;return u?f=Ve.near(u,1):e<0?f=Ve.near(n.doc.resolve(c.before(-1)),-1):f=Ve.near(n.doc.resolve(c.after(-1)),1),ep(n,r,f)}}}function Oh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let o;if(s instanceof Mt)o=s;else{const u=rL(i,t,e);if(u==null)return!1;o=new Mt(n.doc.resolve(u))}const c=YI(o.$headCell,t,e);return c?ep(n,r,new Mt(o.$anchorCell,c)):!1}}function J7(t,e){const n=t.state.doc,r=Oa(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Mt(r))),!0):!1}function Q7(t,e,n){if(!li(t.state))return!1;let r=W7(n);const i=t.state.selection;if(i instanceof Mt){r||(r={width:1,height:1,rows:[ne.from(X0(Vn(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),c=Kt.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=Z7(r,c.right-c.left,c.bottom-c.top),ZA(t.state,t.dispatch,o,c,r),!0}else if(r){const s=Zm(t.state),o=s.start(-1);return ZA(t.state,t.dispatch,o,Kt.get(s.node(-1)).findCell(s.pos-o),r),!0}else return!1}function eK(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=YA(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof Mt)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Oa(t.state.selection.$anchor))!=null&&((n=mb(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=mb(t,f);const m=ao.getState(t.state)==null;if(!h||!nx(u,h))if(m)h=u;else return;const g=new Mt(u,h);if(m||!t.state.selection.eq(g)){const y=t.state.tr.setSelection(g);m&&y.setMeta(ao,u.pos),t.dispatch(y)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",c),ao.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(ao,-1))}function c(u){const f=u,h=ao.getState(t.state);let m;if(h!=null)m=t.state.doc.resolve(h);else if(YA(t,f.target)!=r&&(m=mb(t,e),!m))return o();m&&s(m,f)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",c)}function rL(t,e,n){if(!(t.state.selection instanceof Oe))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),c=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?o:null}}return null}function YA(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function mb(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&&Oa(t.state.doc.resolve(r))||Oa(t.state.doc.resolve(i))}var tK=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")),J0(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,J0(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function J0(t,e,n,r,i,s){let o=0,c=!0,u=e.firstChild;const f=t.firstChild;if(f){for(let m=0,g=0;m<f.childCount;m++){const{colspan:y,colwidth:S}=f.child(m).attrs;for(let w=0;w<y;w++,g++){const x=i==g?s:S&&S[w],k=x?x+"px":"";if(o+=x||r,x||(c=!1),u)u.style.width!=k&&(u.style.width=k),u=u.nextSibling;else{const T=document.createElement("col");T.style.width=k,e.appendChild(T)}}}for(;u;){var h;const m=u.nextSibling;(h=u.parentNode)===null||h===void 0||h.removeChild(u),u=m}c?(n.style.width=o+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=o+"px")}}const xr=new Zt("tableColumnResizing");function nK({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=tK,lastColumnResizable:i=!0}={}){const s=new Nt({key:xr,state:{init(o,c){var u;const f=(u=s.spec)===null||u===void 0||(u=u.props)===null||u===void 0?void 0:u.nodeViews,h=Vn(c.schema).table.name;return r&&f&&(f[h]=(m,g)=>new r(m,n,g)),new rK(-1,!1)},apply(o,c){return c.apply(o)}},props:{attributes:o=>{const c=xr.getState(o);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,c)=>{iK(o,c,t,i)},mouseleave:o=>{sK(o)},mousedown:(o,c)=>{oK(o,c,e,n)}},decorations:o=>{const c=xr.getState(o);if(c&&c.activeHandle>-1)return dK(o,c.activeHandle)},nodeViews:{}}});return s}var rK=class tp{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(xr);if(r&&r.setHandle!=null)return new tp(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new tp(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return Y0(e.doc.resolve(i))||(i=-1),new tp(i,n.dragging)}return n}};function iK(t,e,n,r){if(!t.editable)return;const i=xr.getState(t.state);if(i&&!i.dragging){const s=lK(e.target);let o=-1;if(s){const{left:c,right:u}=s.getBoundingClientRect();e.clientX-c<=n?o=XA(t,e,"left",n):u-e.clientX<=n&&(o=XA(t,e,"right",n))}if(o!=i.activeHandle){if(!r&&o!==-1){const c=t.state.doc.resolve(o),u=c.node(-1),f=Kt.get(u),h=c.start(-1);if(f.colCount(c.pos-h)+c.nodeAfter.attrs.colspan-1==f.width-1)return}iL(t,o)}}}function sK(t){if(!t.editable)return;const e=xr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&iL(t,-1)}function oK(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=xr.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const c=t.state.doc.nodeAt(o.activeHandle),u=aK(t,o.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta(xr,{setDragging:{startX:e.clientX,startWidth:u}}));function f(m){s.removeEventListener("mouseup",f),s.removeEventListener("mousemove",h);const g=xr.getState(t.state);g?.dragging&&(cK(t,g.activeHandle,JA(g.dragging,m,n)),t.dispatch(t.state.tr.setMeta(xr,{setDragging:null})))}function h(m){if(!m.which)return f(m);const g=xr.getState(t.state);if(g&&g.dragging){const y=JA(g.dragging,m,n);QA(t,g.activeHandle,y,r)}}return QA(t,o.activeHandle,u,r),s.addEventListener("mouseup",f),s.addEventListener("mousemove",h),e.preventDefault(),!0}function aK(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,c=n;if(r)for(let u=0;u<n;u++)r[u]&&(o-=r[u],c--);return o/c}function lK(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function XA(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,c=Oa(t.state.doc.resolve(o));if(!c)return-1;if(n=="right")return c.pos;const u=Kt.get(c.node(-1)),f=c.start(-1),h=u.map.indexOf(c.pos-f);return h%u.width==0?-1:f+u.map[h-1]}function JA(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function iL(t,e){t.dispatch(t.state.tr.setMeta(xr,{setHandle:e}))}function cK(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=Kt.get(i),o=r.start(-1),c=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+c;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:c-s.colCount(m);if(g.colwidth&&g.colwidth[y]==n)continue;const S=g.colwidth?g.colwidth.slice():uK(g.colspan);S[y]=n,u.setNodeMarkup(o+m,null,{...g,colwidth:S})}u.docChanged&&t.dispatch(u)}function QA(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),o=i.start(-1),c=Kt.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&&J0(s,u.firstChild,u,r,c,n)}function uK(t){return Array(t).fill(0)}function dK(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return St.empty;const s=Kt.get(i),o=r.start(-1),c=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let f=0;f<s.height;f++){const h=c+f*s.width;if((c==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=xr.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 St.create(t.doc,n)}function fK({allowTableNodeSelection:t=!1}={}){return new Nt({key:ao,state:{init(){return null},apply(e,n){const r=e.getMeta(ao);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:E7,handleDOMEvents:{mousedown:eK},createSelectionBetween(e){return ao.getState(e.state)!=null?e.state.selection:null},handleTripleClick:J7,handleKeyDown:X7,handlePaste:Q7},appendTransaction(e,n,r){return A7(r,eL(r,n),t)}})}function mm(t){return t==="left"||t==="right"||t==="center"?t:null}function hK(t){const e=(t.style.textAlign||"").trim().toLowerCase(),n=(t.getAttribute("align")||"").trim().toLowerCase();return mm(e||n)}function pK(t){return mm(t?.align)}function sL(){return{default:null,parseHTML:t=>hK(t),renderHTML:t=>t.align?{style:`text-align: ${t.align}`}:{}}}function mK(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 oL(t){const e=t.getAttribute("colwidth");return e?e.split(",").map(n=>parseInt(n,10)):mK(t)}var gK=/[ \t\r\n\f]+/g;function aL(t){var e;return t.children.length>0?!1:((e=t.textContent)!=null?e:"").replace(gK,"")===""}function lL(t){const e=t.createAndFill();if(!e)throw new Error(`[tiptap error]: "${t.name}" has no default content to backfill.`);return e.content}var yK=wn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:oL},align:sL()}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td",getAttrs:t=>aL(t)?{}:!1,getContent:(t,e)=>lL(e.nodes[this.name])},{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Ot(this.options.HTMLAttributes,t),0]}}),vK=wn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:oL},align:sL()}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th",getAttrs:t=>aL(t)?{}:!1,getContent:(t,e)=>lL(e.nodes[this.name])},{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",Ot(this.options.HTMLAttributes,t),0]}}),bK=wn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Ot(this.options.HTMLAttributes,t),0]}});function Q0(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 c=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:S,colwidth:w}=h.child(g).attrs;for(let x=0;x<S;x+=1,y+=1){const k=i===y?s:w&&w[x],T=k?`${k}px`:"";if(c+=k||r,k||(u=!1),f){if(f.style.width!==T){const[A,_]=Q0(r,k);f.style.setProperty(A,_)}f=f.nextSibling}else{const A=document.createElement("col"),[_,O]=Q0(r,k);A.style.setProperty(_,O),e.appendChild(A)}}}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=`${c}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${c}px`)}var SK=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 wK(t,e,n,r){let i=0,s=!0;const o=[],c=t.firstChild;if(!c)return{};for(let m=0,g=0;m<c.childCount;m+=1){const{colspan:y,colwidth:S}=c.child(m).attrs;for(let w=0;w<y;w+=1,g+=1){const x=n===g?r:S&&S[w];i+=x||e,x||(s=!1);const[k,T]=Q0(e,x);o.push(["col",{style:`${k}: ${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 xK(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 kK(t,e,n,r,i){const s=xK(t),o=[],c=[];for(let f=0;f<n;f+=1){const h=tR(s.cell);if(h&&c.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:c));return s.table.createChecked(null,u)}function CK(t){return t instanceof Mt}var Nh=({editor:t})=>{const{selection:e}=t.state;if(!CK(e))return!1;let n=0;const r=xD(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},EK="";function TK(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 c=t.slice(n+r,i);e+=t.slice(n,n+r)+c.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 _K(t){return t.split(`
|
|
273
|
-
`).map(e=>!e.includes("|")||!e.includes("`")?e:TK(e)).join(`
|
|
274
|
-
`)}function AK(t){return(t||"").replace(/\s+/g," ").trim()}function RK(t,e,n={}){var r;const i=(r=n.cellLineSeparator)!=null?r:EK;if(!t||!t.content||t.content.length===0)return"";const s=[];t.content.forEach(w=>{const x=[];w.content&&w.content.forEach(k=>{let T="";k.content&&Array.isArray(k.content)&&k.content.length>1?T=k.content.map(I=>e.renderChildren(I)).join(i):T=k.content?e.renderChildren(k.content):"";const A=AK(T.split(i).join(`
|
|
275
|
-
`).replace(/[ \t]*\r?\n[ \t]*/g,"<br>")),_=k.type==="tableHeader",O=pK(k.attrs);x.push({text:A,isHeader:_,align:O})}),s.push(x)});const o=s.reduce((w,x)=>Math.max(w,x.length),0);if(o===0)return"";const c=Array.from({length:o}).fill(0);s.forEach(w=>{var x;for(let k=0;k<o;k+=1){const A=(((x=w[k])==null?void 0:x.text)||"").length;A>c[k]&&(c[k]=A),c[k]<3&&(c[k]=3)}});const u=(w,x)=>w+" ".repeat(Math.max(0,x-w.length)),f=s[0],h=f.some(w=>w.isHeader),m=Array.from({length:o}).fill(null);s.forEach(w=>{var x;for(let k=0;k<o;k+=1)!m[k]&&((x=w[k])!=null&&x.align)&&(m[k]=w[k].align)});let g=`
|
|
276
|
-
`;const y=Array.from({length:o}).map((w,x)=>h&&f[x]&&f[x].text||"");return g+=`| ${y.map((w,x)=>u(w,c[x])).join(" | ")} |
|
|
277
|
-
`,g+=`| ${c.map((w,x)=>{const k=Math.max(3,w),T=m[x];return T==="left"?`:${"-".repeat(k)}`:T==="right"?`${"-".repeat(k)}:`:T==="center"?`:${"-".repeat(k)}:`:"-".repeat(k)}).join(" | ")} |
|
|
278
|
-
`,(h?s.slice(1):s).forEach(w=>{g+=`| ${Array.from({length:o}).fill(0).map((x,k)=>u(w[k]&&w[k].text||"",c[k])).join(" | ")} |
|
|
279
|
-
`}),g}var MK=RK,OK=wn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:SK,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}=wK(t,this.options.cellMinWidth),s=e.style;function o(){return s||(r?`width: ${r}`:`min-width: ${i}`)}const c=["table",Ot(this.options.HTMLAttributes,e,{style:o()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},c]:c},parseMarkdown:(t,e)=>{const n=[],r=Array.isArray(t.align)?t.align:[];if(t.header){const i=[];t.header.forEach((s,o)=>{var c;const u=mm((c=r[o])!=null?c: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,c)=>{var u;const f=mm((u=r[c])!=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)=>MK(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 c=_K(i);if(c===i)return;const f=n.blockTokens(c)[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=kK(s.schema,t,e,n);if(i){const c=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(Oe.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>O7(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>N7(t,e),deleteColumn:()=>({state:t,dispatch:e})=>I7(t,e),addRowBefore:()=>({state:t,dispatch:e})=>P7(t,e),addRowAfter:()=>({state:t,dispatch:e})=>z7(t,e),deleteRow:()=>({state:t,dispatch:e})=>B7(t,e),deleteTable:()=>({state:t,dispatch:e})=>G7(t,e),mergeCells:()=>({state:t,dispatch:e})=>UA(t,e),splitCell:()=>({state:t,dispatch:e})=>FA(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Sd("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Sd("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>F7(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>UA(t,e)?!0:FA(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>H7(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>GA(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>GA(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&eL(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=Mt.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:Nh,"Mod-Backspace":Nh,Delete:Nh,"Mod-Delete":Nh}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[nK({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],fK({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=Ot(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:ht(Te(t,"tableRole",e))}}}),NK=$t.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(OK.configure(this.options.table)),this.options.tableCell!==!1&&t.push(yK.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(vK.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(bK.configure(this.options.tableRow)),t}});function DK({recordImages:t=[],galleryUpload:e,onListGallery:n,onUploadGallery:r,onClose:i,onInsert:s}){const o=!!n,[c,u]=R.useState(t.length?"record":"gallery"),[f,h]=R.useState([]),[m,g]=R.useState(!1),[y,S]=R.useState(null),[w,x]=R.useState({}),[k,T]=R.useState("");R.useEffect(()=>{const Z=X=>{X.key==="Escape"&&i()};window.addEventListener("keydown",Z);const ae=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",Z),document.body.style.overflow=ae}},[i]),R.useEffect(()=>{if(!o)return;let Z=!1;return g(!0),S(null),n().then(ae=>{Z||h(ae)}).catch(ae=>{Z||S(ae instanceof Error?ae.message:"Could not load gallery")}).finally(()=>{Z||g(!1)}),()=>{Z=!0}},[o,n]);const A=R.useMemo(()=>t.map(Z=>({id:`record:${Z.id}`,url:Z.url,name:Z.name,source:"record"})),[t]),_=R.useMemo(()=>f.map(Z=>({id:`gallery:${Z.id}`,url:Z.url,name:Z.name??Z.id,source:"gallery"})),[f]),O=c==="record"?A:_,N=Object.values(w),I=!!(e&&r),z=Z=>{x(ae=>{const X={...ae};return X[Z.id]?delete X[Z.id]:X[Z.id]=Z,X})},q=()=>{const Z=k.trim();if(!Z)return;const ae={id:`url:${Z}`,url:Z,name:"Image",source:"url"};x(X=>({...X,[ae.id]:ae})),T("")};return C.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:i,children:C.jsxs("div",{className:"vertebr-modal",role:"dialog","aria-modal":"true","aria-label":"Insert images",onClick:Z=>Z.stopPropagation(),children:[C.jsxs("header",{className:"vertebr-modal-head",children:[C.jsxs("div",{className:"vertebr-modal-heading",children:[C.jsx("p",{className:"vertebr-modal-eyebrow",children:"Media"}),C.jsx("h2",{children:"Insert images"})]}),C.jsx("button",{type:"button",className:"vertebr-btn",onClick:i,children:"Close"})]}),C.jsxs("div",{className:"vertebr-modal-body vertebr-picker-body",children:[t.length>0&&o?C.jsxs("div",{className:"vertebr-picker-tabs",role:"tablist",children:[C.jsxs("button",{type:"button",role:"tab","aria-selected":c==="record","data-active":c==="record"||void 0,onClick:()=>u("record"),children:["Product photos",C.jsx("span",{children:A.length})]}),C.jsxs("button",{type:"button",role:"tab","aria-selected":c==="gallery","data-active":c==="gallery"||void 0,onClick:()=>u("gallery"),children:["Gallery",C.jsx("span",{children:m?"…":_.length})]})]}):null,c==="gallery"&&I?C.jsx(Id,{meta:{field:"gallery",accept:e.accept,maxBytes:e.maxBytes},multiple:!0,label:"Drop images to add them to the gallery",onUpload:async Z=>{const ae=await r(Z);h(X=>[...ae,...X]),x(X=>{const te={...X};for(const ie of ae){const de={id:`gallery:${ie.id}`,url:ie.url,name:ie.name??ie.id,source:"gallery"};te[de.id]=de}return te})}}):null,C.jsxs("label",{className:"vertebr-field",children:[C.jsx("span",{children:"Or paste an image URL"}),C.jsxs("div",{className:"vertebr-picker-url",children:[C.jsx("input",{type:"url",value:k,placeholder:"https://",onChange:Z=>T(Z.target.value),onKeyDown:Z=>{Z.key==="Enter"&&(Z.preventDefault(),q())}}),C.jsx("button",{type:"button",className:"vertebr-btn",disabled:!k.trim(),onClick:q,children:"Add"})]})]}),y?C.jsx("p",{className:"vertebr-status","data-tone":"danger",children:y}):null,m&&c==="gallery"?C.jsx("div",{className:"vertebr-empty",children:"Loading gallery…"}):O.length===0?C.jsx("div",{className:"vertebr-empty",children:c==="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."}):C.jsx("div",{className:"vertebr-picker-grid",children:O.map(Z=>{const ae=!!w[Z.id];return C.jsxs("button",{type:"button",className:"vertebr-picker-tile","data-selected":ae||void 0,onClick:()=>z(Z),children:[C.jsx("span",{className:"vertebr-picker-thumb",children:C.jsx("img",{src:Z.url,alt:""})}),C.jsx("span",{className:"vertebr-picker-name",children:Z.name})]},Z.id)})})]}),C.jsxs("footer",{className:"vertebr-picker-foot",children:[C.jsxs("span",{className:"vertebr-picker-count",children:[N.length," selected"]}),C.jsxs("button",{type:"button",className:"vertebr-btn vertebr-btn-primary",disabled:N.length===0,onClick:()=>s(N),children:["Insert ",N.length||"",N.length===1?" image":" images"]})]})]})})}function nR(t,e){t&&(typeof t=="function"?t(e):t.current=e)}function qn({active:t,disabled:e,title:n,onClick:r,children:i}){return C.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 IK({id:t,name:e,value:n,readOnly:r,placeholder:i="Write a description…",recordImages:s,galleryUpload:o,onListGallery:c,onUploadGallery:u,onBlur:f,onChange:h,inputRef:m}){const g=typeof n=="string"?n:"",y=R.useRef(h),S=R.useRef(f),w=R.useRef(g),[x,k]=R.useState(!1);y.current=h,S.current=f;const T=z9({immediatelyRender:!1,shouldRerenderOnTransaction:!1,content:g,contentType:"markdown",editable:!r,extensions:[uW.configure({heading:{levels:[2,3]},underline:!1,link:{openOnClick:!1,defaultProtocol:"https"}}),m7.configure({inline:!1,allowBase64:!1}),NK.configure({table:{resizable:!1}}),nW.configure({placeholder:i}),f7.configure({markedOptions:{gfm:!0}})],editorProps:{attributes:{id:t,class:"vertebr-md-content"}},onUpdate:({editor:z})=>{const q=z.getMarkdown();w.current=q,y.current(q)},onBlur:()=>{S.current?.()}});R.useEffect(()=>{if(T)return nR(m,T.view.dom),()=>nR(m,null)},[T,m]),R.useEffect(()=>{T&&T.setEditable(!r)},[T,r]),R.useEffect(()=>{if(T&&g!==w.current){if(g===T.getMarkdown()){w.current=g;return}T.commands.setContent(g,{contentType:"markdown",emitUpdate:!1}),w.current=g}},[T,g]);const A=QD({editor:T,selector:({editor:z})=>({bold:z?.isActive("bold")??!1,italic:z?.isActive("italic")??!1,strike:z?.isActive("strike")??!1,code:z?.isActive("code")??!1,codeBlock:z?.isActive("codeBlock")??!1,heading:z?.isActive("heading")??!1,quote:z?.isActive("blockquote")??!1,bullet:z?.isActive("bulletList")??!1,ordered:z?.isActive("orderedList")??!1,table:z?.isActive("table")??!1,link:z?.isActive("link")??!1,stats:KT(z?.getText()??g)})}),_=A?.stats??KT(g),O=r||!T,N=()=>{if(!T||r)return;const z=T.getAttributes("link").href,q=window.prompt("Link URL",typeof z=="string"&&z?z:"https://");if(q!==null){if(!q.trim()){T.chain().focus().extendMarkRange("link").unsetLink().run();return}T.chain().focus().extendMarkRange("link").setLink({href:q.trim()}).run()}},I=z=>{!T||z.length===0||(T.chain().focus().insertContent(z.map(q=>({type:"image",attrs:{src:q.url,alt:q.name}}))).run(),k(!1))};return C.jsxs("div",{className:"vertebr-field-prose",onKeyDown:z=>{(z.metaKey||z.ctrlKey)&&z.key.toLowerCase()==="k"&&(z.preventDefault(),N())},children:[e?C.jsx("input",{type:"hidden",name:e,value:g,readOnly:!0}):null,C.jsxs("div",{className:"vertebr-md-toolbar",role:"toolbar","aria-label":"Format",children:[C.jsx(qn,{active:A?.bold,disabled:O,title:"Bold",onClick:()=>T?.chain().focus().toggleBold().run(),children:C.jsx("span",{className:"vertebr-md-glyph",children:"B"})}),C.jsx(qn,{active:A?.italic,disabled:O,title:"Italic",onClick:()=>T?.chain().focus().toggleItalic().run(),children:C.jsx("span",{className:"vertebr-md-glyph vertebr-md-italic",children:"I"})}),C.jsx(qn,{active:A?.strike,disabled:O,title:"Strikethrough",onClick:()=>T?.chain().focus().toggleStrike().run(),children:C.jsx("span",{className:"vertebr-md-glyph vertebr-md-strike",children:"S"})}),C.jsx(qn,{active:A?.code,disabled:O,title:"Inline code",onClick:()=>T?.chain().focus().toggleCode().run(),children:"</>"}),C.jsx(qn,{active:A?.codeBlock,disabled:O,title:"Code block",onClick:()=>T?.chain().focus().toggleCodeBlock().run(),children:"{ }"}),C.jsx("span",{className:"vertebr-md-sep","aria-hidden":"true"}),C.jsx(qn,{active:A?.heading,disabled:O,title:"Heading",onClick:()=>T?.chain().focus().toggleHeading({level:2}).run(),children:"H"}),C.jsx(qn,{active:A?.quote,disabled:O,title:"Quote",onClick:()=>T?.chain().focus().toggleBlockquote().run(),children:"“"}),C.jsx(qn,{active:A?.bullet,disabled:O,title:"Bulleted list",onClick:()=>T?.chain().focus().toggleBulletList().run(),children:"•"}),C.jsx(qn,{active:A?.ordered,disabled:O,title:"Numbered list",onClick:()=>T?.chain().focus().toggleOrderedList().run(),children:"1."}),C.jsx("span",{className:"vertebr-md-sep","aria-hidden":"true"}),C.jsx(qn,{active:A?.table,disabled:O,title:"Table",onClick:()=>T?.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),children:"Table"}),A?.table?C.jsxs(C.Fragment,{children:[C.jsx(qn,{disabled:O,title:"Add column",onClick:()=>T?.chain().focus().addColumnAfter().run(),children:"+Col"}),C.jsx(qn,{disabled:O,title:"Add row",onClick:()=>T?.chain().focus().addRowAfter().run(),children:"+Row"}),C.jsx(qn,{disabled:O,title:"Delete table",onClick:()=>T?.chain().focus().deleteTable().run(),children:"Del"})]}):null,C.jsx(qn,{active:A?.link,disabled:O,title:"Link",onClick:N,children:"Link"}),C.jsx(qn,{disabled:O,title:"Insert images",onClick:()=>k(!0),children:"Image"})]}),C.jsx(JD,{editor:T}),C.jsxs("p",{className:"vertebr-field-prose-meta",children:["Markdown",C.jsx("span",{"aria-hidden":"true",children:" · "}),_.words," ",_.words===1?"word":"words",C.jsx("span",{"aria-hidden":"true",children:" · "}),_.characters," ",_.characters===1?"character":"characters"]}),x?C.jsx(DK,{recordImages:s,galleryUpload:o,onListGallery:c,onUploadGallery:u,onClose:()=>k(!1),onInsert:I}):null]})}var LK=Object.defineProperty,PK=(t,e)=>LK(t,"name",{value:e,configurable:!0});function eS(t,[e,n]){return Math.min(n,Math.max(e,t))}PK(eS,"clamp");var zK=Object.defineProperty,gn=(t,e)=>zK(t,"name",{value:e,configurable:!0});function cL(t){const e=t+"CollectionProvider",[n,r]=yc(e),[i,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=gn(w=>{const{scope:x,children:k}=w,T=R.useRef(null),A=R.useRef(new Map).current;return C.jsx(i,{scope:x,itemMap:A,collectionRef:T,children:k})},"CollectionProvider");o.displayName=e;const c=t+"CollectionSlot",u=Ea(c),f=R.forwardRef((w,x)=>{const{scope:k,children:T}=w,A=s(c,k),_=Qt(x,A.collectionRef);return C.jsx(u,{ref:_,children:T})});f.displayName=c;const h=t+"CollectionItemSlot",m="data-radix-collection-item",g=Ea(h),y=R.forwardRef((w,x)=>{const{scope:k,children:T,...A}=w,_=R.useRef(null),O=Qt(x,_),N=s(h,k);return R.useEffect(()=>(N.itemMap.set(_,{ref:_,...A}),()=>{N.itemMap.delete(_)})),C.jsx(g,{[m]:"",ref:O,children:T})});y.displayName=h;function S(w){const x=s(t+"CollectionConsumer",w);return R.useCallback(()=>{const T=x.collectionRef.current;if(!T)return[];const A=Array.from(T.querySelectorAll(`[${m}]`));return Array.from(x.itemMap.values()).sort((N,I)=>A.indexOf(N.ref.current)-A.indexOf(I.ref.current))},[x.collectionRef,x.itemMap])}return gn(S,"useCollection"),[{Provider:o,Slot:f,ItemSlot:y},S,r]}gn(cL,"createCollection");var rR=new WeakMap,on,vr,gb=(vr=class extends Map{constructor(n){super(n);wE(this,on);yv(this,on,[...super.keys()]),rR.set(this,!0)}set(n,r){return rR.get(this)&&(this.has(n)?Ln(this,on)[Ln(this,on).indexOf(n)]=n:Ln(this,on).push(n)),super.set(n,r),this}insert(n,r,i){const s=this.has(r),o=Ln(this,on).length,c=rx(n);let u=c>=0?c:o+c;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);c<0&&u++;const m=[...Ln(this,on)];let g,y=!1;for(let S=u;S<h;S++)if(u===S){let w=m[S];m[S]===r&&(w=m[S+1]),s&&this.delete(r),g=this.get(w),this.set(r,i)}else{!y&&m[S-1]===r&&(y=!0);const w=m[y?S:S-1],x=g;g=this.get(w),this.delete(w),this.set(w,x)}return this}with(n,r,i){const s=new vr(this);return s.insert(n,r,i),s}before(n){const r=Ln(this,on).indexOf(n)-1;if(!(r<0))return this.entryAt(r)}setBefore(n,r,i){const s=Ln(this,on).indexOf(n);return s===-1?this:this.insert(s,r,i)}after(n){let r=Ln(this,on).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=Ln(this,on).indexOf(n);return s===-1?this:this.insert(s+1,r,i)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return yv(this,on,[]),super.clear()}delete(n){const r=super.delete(n);return r&&Ln(this,on).splice(Ln(this,on).indexOf(n),1),r}deleteAt(n){const r=this.keyAt(n);return r!==void 0?this.delete(r):!1}at(n){const r=np(Ln(this,on),n);if(r!==void 0)return this.get(r)}entryAt(n){const r=np(Ln(this,on),n);if(r!==void 0)return[r,this.get(r)]}indexOf(n){return Ln(this,on).indexOf(n)}keyAt(n){return np(Ln(this,on),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 vr(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 vr(i)}reduce(...n){const[r,i]=n;let s=0,o=i??this.at(0);for(const c of this)s===0&&n.length===1?o=c:o=Reflect.apply(r,this,[o,c,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 c=this.at(o);o===this.size-1&&n.length===1?s=c:s=Reflect.apply(r,this,[s,c,o,this])}return s}toSorted(n){const r=[...this.entries()].sort(n);return new vr(r)}toReversed(){const n=new vr;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 vr(r)}slice(n,r){const i=new vr;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 c=this.keyAt(o),u=this.get(c);i.set(c,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}},on=new WeakMap,gn(vr,"OrderedDict"),vr);function np(t,e){if("at"in Array.prototype)return Array.prototype.at.call(t,e);const n=uL(t,e);return n===-1?void 0:t[n]}gn(np,"at");function uL(t,e){const n=t.length,r=rx(e),i=r>=0?r:n+r;return i<0||i>=n?-1:i}gn(uL,"toSafeIndex");function rx(t){return t!==t||t===0?0:Math.trunc(t)}gn(rx,"toSafeInteger");function jK(t){const e=t+"CollectionProvider",[n,r]=yc(e),[i,s]=n(e,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new gb,setItemMap:gn(()=>{},"setItemMap")}),o=gn(({state:A,..._})=>A?C.jsx(u,{..._,state:A}):C.jsx(c,{..._}),"CollectionProvider");o.displayName=e;const c=gn(A=>{const _=x();return C.jsx(u,{...A,state:_})},"CollectionInit");c.displayName=e+"Init";const u=gn(A=>{const{scope:_,children:O,state:N}=A,I=R.useRef(null),[z,q]=R.useState(null),Z=Qt(I,q),[ae,X]=N;return R.useEffect(()=>{if(!z)return;const te=hL(()=>{});return te.observe(z,{childList:!0,subtree:!0}),()=>{te.disconnect()}},[z]),C.jsx(i,{scope:_,itemMap:ae,setItemMap:X,collectionRef:Z,collectionRefObject:I,collectionElement:z,children:O})},"CollectionProviderImpl");u.displayName=e+"Impl";const f=t+"CollectionSlot",h=Ea(f),m=R.forwardRef((A,_)=>{const{scope:O,children:N}=A,I=s(f,O),z=Qt(_,I.collectionRef);return C.jsx(h,{ref:z,children:N})});m.displayName=f;const g=t+"CollectionItemSlot",y="data-radix-collection-item",S=Ea(g),w=R.forwardRef((A,_)=>{const{scope:O,children:N,...I}=A,z=R.useRef(null),[q,Z]=R.useState(null),ae=Qt(_,z,Z),X=s(g,O),{setItemMap:te}=X,ie=R.useRef(I);dL(ie.current,I)||(ie.current=I);const de=ie.current;return R.useEffect(()=>{const B=de;return te(Y=>q?Y.has(q)?Y.set(q,{...B,element:q}).toSorted(tS):(Y.set(q,{...B,element:q}),Y.toSorted(tS)):Y),()=>{te(Y=>!q||!Y.has(q)?Y:(Y.delete(q),new gb(Y)))}},[q,de,te]),C.jsx(S,{[y]:"",ref:ae,children:N})});w.displayName=g;function x(){return R.useState(new gb)}gn(x,"useInitCollection");function k(A){const{itemMap:_}=s(t+"CollectionConsumer",A);return _}return gn(k,"useCollection"),[{Provider:o,Slot:m,ItemSlot:w},{createCollectionScope:r,useCollection:k,useInitCollection:x}]}gn(jK,"createCollection");function dL(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(dL,"shallowEqual");function fL(t,e){return!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}gn(fL,"isElementPreceding");function tS(t,e){return!t[1].element||!e[1].element?0:fL(t[1].element,e[1].element)?-1:1}gn(tS,"sortByDocumentPosition");function hL(t){return new MutationObserver(n=>{for(const r of n)if(r.type==="childList"){t();return}})}gn(hL,"getChildListObserver");var BK=Object.defineProperty,$K=(t,e)=>BK(t,"name",{value:e,configurable:!0}),VK=R.createContext(void 0);function pL(t){const e=R.useContext(VK);return t||e||"ltr"}$K(pL,"useDirection");var HK=Object.defineProperty,UK=(t,e)=>HK(t,"name",{value:e,configurable:!0});function Ci(t){const e=R.useRef(t);return R.useEffect(()=>{e.current=t}),R.useMemo(()=>((...n)=>e.current?.(...n)),[])}UK(Ci,"useCallbackRef");var FK=Object.defineProperty,mn=(t,e)=>FK(t,"name",{value:e,configurable:!0}),nS="dismissableLayer.update",qK="dismissableLayer.pointerDownOutside",GK="dismissableLayer.focusOutside",iR,mL=R.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),WK=R.forwardRef(mn(function(e,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:c,onInteractOutside:u,onDismiss:f,...h}=e,m=R.useContext(mL),[g,y]=R.useState(null),S=g?.ownerDocument??globalThis?.document,[,w]=R.useState({}),x=Qt(n,y),k=Array.from(m.layers),[T]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),A=T?k.indexOf(T):-1,_=g?k.indexOf(g):-1,O=m.layersWithOutsidePointerEventsDisabled.size>0,N=_>=A,I=R.useRef(!1),z=gL(X=>{o?.(X),u?.(X),X.defaultPrevented||f?.()},{ownerDocument:S,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:I,dismissableSurfaces:m.dismissableSurfaces,shouldHandlePointerDownOutside:R.useCallback(X=>{if(!(X instanceof Node))return!1;const te=[...m.branches].some(ie=>ie.contains(X));return N&&!te},[m.branches,N])}),q=yL(X=>{if(i&&I.current)return;const te=X.target;[...m.branches].some(de=>de.contains(te))||(c?.(X),u?.(X),X.defaultPrevented||f?.())},S),Z=g?_===k.length-1:!1,ae=Ci(X=>{X.key==="Escape"&&(s?.(X),!X.defaultPrevented&&f&&(X.preventDefault(),f()))});return R.useEffect(()=>{if(Z)return S.addEventListener("keydown",ae,{capture:!0}),()=>S.removeEventListener("keydown",ae,{capture:!0})},[S,Z,ae]),R.useEffect(()=>{if(g)return r&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(iR=S.body.style.pointerEvents,S.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(g)),m.layers.add(g),rS(),()=>{r&&(m.layersWithOutsidePointerEventsDisabled.delete(g),m.layersWithOutsidePointerEventsDisabled.size===0&&(S.body.style.pointerEvents=iR))}},[g,S,r,m]),R.useEffect(()=>()=>{g&&(m.layers.delete(g),m.layersWithOutsidePointerEventsDisabled.delete(g),rS())},[g,m]),R.useEffect(()=>{const X=mn(()=>w({}),"handleUpdate");return document.addEventListener(nS,X),()=>document.removeEventListener(nS,X)},[]),C.jsx(Sn.div,{...h,ref:x,style:{pointerEvents:O?N?"auto":"none":void 0,...e.style},onFocusCapture:ln(e.onFocusCapture,q.onFocusCapture),onBlurCapture:ln(e.onBlurCapture,q.onBlurCapture),onPointerDownCapture:ln(e.onPointerDownCapture,z.onPointerDownCapture)})},"DismissableLayer"));function KK(){const t=R.useContext(mL),[e,n]=R.useState(null);return R.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}mn(KK,"useDismissableLayerSurface");var ZK=mn(()=>!0,"IS_TRUE");function gL(t,e){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s,shouldHandlePointerDownOutside:o=ZK}=e,c=Ci(t),u=R.useRef(!1),f=R.useRef(!1),h=R.useRef(new Map),m=R.useRef(()=>{});return R.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 S(A){if(!f.current)return;const _=A.target;_ instanceof Node&&[...s].some(N=>N.contains(_))||h.current.set(A.type,!0),A.type==="click"&&window.setTimeout(()=>{f.current&&m.current()},0)}mn(S,"handleInteractionCapture");function w(A){f.current&&h.current.set(A.type,!1)}mn(w,"handleInteractionBubble");const x=mn(A=>{if(A.target&&!u.current){let _=function(){n.removeEventListener("click",m.current);const N=y();g(),N||ix(qK,c,O,{discrete:!0})};if(mn(_,"handleAndDispatchPointerDownOutsideEvent"),!o(A.target)){n.removeEventListener("click",m.current),g(),u.current=!1;return}const O={originalEvent:A};f.current=!0,i.current=r&&A.button===0,h.current.clear(),!r||A.button!==0?_():(n.removeEventListener("click",m.current),m.current=_,n.addEventListener("click",m.current,{once:!0}))}else n.removeEventListener("click",m.current),g();u.current=!1},"handlePointerDown"),k=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const A of k)n.addEventListener(A,S,!0),n.addEventListener(A,w);const T=window.setTimeout(()=>{n.addEventListener("pointerdown",x)},0);return()=>{window.clearTimeout(T),n.removeEventListener("pointerdown",x),n.removeEventListener("click",m.current);for(const A of k)n.removeEventListener(A,S,!0),n.removeEventListener(A,w)}},[n,c,r,i,s,o]),{onPointerDownCapture:mn(()=>u.current=!0,"onPointerDownCapture")}}mn(gL,"usePointerDownOutside");function yL(t,e=globalThis?.document){const n=Ci(t),r=R.useRef(!1);return R.useEffect(()=>{const i=mn(s=>{s.target&&!r.current&&ix(GK,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(yL,"useFocusOutside");function rS(){const t=new CustomEvent(nS);document.dispatchEvent(t)}mn(rS,"dispatchUpdate");function ix(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?wO(i,s):i.dispatchEvent(s)}mn(ix,"handleAndDispatchCustomEvent");var YK=Object.defineProperty,sx=(t,e)=>YK(t,"name",{value:e,configurable:!0}),Dh=0,Nl=null;function XK(t){return ox(),t.children}sx(XK,"FocusGuards");function ox(){R.useEffect(()=>{Nl||(Nl={start:iS(),end:iS()});const{start:t,end:e}=Nl;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),Dh++,()=>{Dh===1&&(Nl?.start.remove(),Nl?.end.remove(),Nl=null),Dh=Math.max(0,Dh-1)}},[])}sx(ox,"useFocusGuards");function iS(){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}sx(iS,"createFocusGuard");var JK=Object.defineProperty,Kn=(t,e)=>JK(t,"name",{value:e,configurable:!0}),yb="focusScope.autoFocusOnMount",vb="focusScope.autoFocusOnUnmount",sR={bubbles:!1,cancelable:!0},QK=R.forwardRef(Kn(function(e,n){const{loop:r=!1,trapped:i=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...c}=e,[u,f]=R.useState(null),h=Ci(s),m=Ci(o),g=R.useRef(null),y=Qt(n,f),S=R.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;R.useEffect(()=>{if(i){let x=function(_){if(S.paused||!u)return;const O=_.target;u.contains(O)?g.current=O:Qi(g.current,{select:!0})},k=function(_){if(S.paused||!u)return;const O=_.relatedTarget;O!==null&&(u.contains(O)||Qi(g.current,{select:!0}))},T=function(_){if(document.activeElement===document.body)for(const N of _)N.removedNodes.length>0&&Qi(u)};Kn(x,"handleFocusIn"),Kn(k,"handleFocusOut"),Kn(T,"handleMutations"),document.addEventListener("focusin",x),document.addEventListener("focusout",k);const A=new MutationObserver(T);return u&&A.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",x),document.removeEventListener("focusout",k),A.disconnect()}}},[i,u,S.paused]),R.useEffect(()=>{if(u){oR.add(S);const x=document.activeElement;if(!u.contains(x)){const T=new CustomEvent(yb,sR);u.addEventListener(yb,h),u.dispatchEvent(T),T.defaultPrevented||(vL(kL(ax(u)),{select:!0}),document.activeElement===x&&Qi(u))}return()=>{u.removeEventListener(yb,h),setTimeout(()=>{const T=new CustomEvent(vb,sR);u.addEventListener(vb,m),u.dispatchEvent(T),T.defaultPrevented||Qi(x??document.body,{select:!0}),u.removeEventListener(vb,m),oR.remove(S)},0)}}},[u,h,m,S]);const w=R.useCallback(x=>{if(!r&&!i||S.paused)return;const k=x.key==="Tab"&&!x.altKey&&!x.ctrlKey&&!x.metaKey,T=document.activeElement;if(k&&T){const A=x.currentTarget,[_,O]=bL(A);_&&O?!x.shiftKey&&T===O?(x.preventDefault(),r&&Qi(_,{select:!0})):x.shiftKey&&T===_&&(x.preventDefault(),r&&Qi(O,{select:!0})):T===A&&x.preventDefault()}},[r,i,S.paused]);return C.jsx(Sn.div,{tabIndex:-1,...c,ref:y,onKeyDown:w})},"FocusScope"));function vL(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Qi(r,{select:e}),document.activeElement!==n)return}Kn(vL,"focusFirst");function bL(t){const e=ax(t),n=sS(e,t),r=sS(e.reverse(),t);return[n,r]}Kn(bL,"getTabbableEdges");function ax(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:Kn(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}Kn(ax,"getTabbableCandidates");function sS(t,e){const n=typeof e.checkVisibility=="function"&&e.checkVisibility({checkVisibilityCSS:!0});for(const r of t)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):SL(r,{upTo:e})))return r}Kn(sS,"findVisible");function SL(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}Kn(SL,"isHidden");function wL(t){return t instanceof HTMLInputElement&&"select"in t}Kn(wL,"isSelectableInput");function Qi(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&wL(t)&&e&&t.select()}}Kn(Qi,"focus");var oR=xL();function xL(){let t=[];return{add(e){const n=t[0];e!==n&&n?.pause(),t=oS(t,e),t.unshift(e)},remove(e){t=oS(t,e),t[0]?.resume()}}}Kn(xL,"createFocusScopesStack");function oS(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}Kn(oS,"arrayRemove");function kL(t){return t.filter(e=>e.tagName!=="A")}Kn(kL,"removeLinks");var eZ=Object.defineProperty,tZ=(t,e)=>eZ(t,"name",{value:e,configurable:!0}),nZ=Cd[" useId ".trim().toString()]||(()=>{}),rZ=0;function lx(t){const[e,n]=R.useState(nZ());return Zn(()=>{t||n(r=>r??String(rZ++))},[t]),t||(e?`radix-${e}`:"")}tZ(lx,"useId");const iZ=["top","right","bottom","left"],Ro=Math.min,hs=Math.max,gm=Math.round,Ih=Math.floor,ps=t=>({x:t,y:t}),sZ={left:"right",right:"left",bottom:"top",top:"bottom"};function CL(t,e,n){return hs(t,Ro(e,n))}function vs(t,e){return typeof t=="function"?t(e):t}function Mo(t){return t.split("-")[0]}function Sc(t){return t.split("-")[1]}function cx(t){return t==="x"?"y":"x"}function ux(t){return t==="y"?"height":"width"}function Si(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function dx(t){return cx(Si(t))}function oZ(t,e,n){n===void 0&&(n=!1);const r=Sc(t),i=dx(t),s=ux(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=ym(o)),[o,ym(o)]}function aZ(t){const e=ym(t);return[aS(t),e,aS(e)]}function aS(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const aR=["left","right"],lR=["right","left"],lZ=["top","bottom"],cZ=["bottom","top"];function uZ(t,e,n){switch(t){case"top":case"bottom":return n?e?lR:aR:e?aR:lR;case"left":case"right":return e?lZ:cZ;default:return[]}}function dZ(t,e,n,r){const i=Sc(t);let s=uZ(Mo(t),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(aS)))),s}function ym(t){const e=Mo(t);return sZ[e]+t.slice(e.length)}function fZ(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 EL(t){return typeof t!="number"?fZ(t):{top:t,right:t,bottom:t,left:t}}function vm(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 cR(t,e,n){let{reference:r,floating:i}=t;const s=Si(e),o=dx(e),c=ux(o),u=Mo(e),f=s==="y",h=r.x+r.width/2-i.width/2,m=r.y+r.height/2-i.height/2,g=r[c]/2-i[c]/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 S=Sc(e);return S&&(y[o]+=g*(S==="end"?1:-1)*(n&&f?-1:1)),y}async function hZ(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:c,strategy:u}=t,{boundary:f="clippingAncestors",rootBoundary:h="viewport",elementContext:m="floating",altBoundary:g=!1,padding:y=0}=vs(e,t),S=EL(y),x=c[g?m==="floating"?"reference":"floating":m],k=vm(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(x)))==null||n?x:x.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:f,rootBoundary:h,strategy:u})),T=m==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,A=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),_=await(s.isElement==null?void 0:s.isElement(A))&&await(s.getScale==null?void 0:s.getScale(A))||{x:1,y:1},O=vm(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:T,offsetParent:A,strategy:u}):T);return{top:(k.top-O.top+S.top)/_.y,bottom:(O.bottom-k.bottom+S.bottom)/_.y,left:(k.left-O.left+S.left)/_.x,right:(O.right-k.right+S.right)/_.x}}const pZ=50,mZ=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,c=o.detectOverflow?o:{...o,detectOverflow:hZ},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}=cR(f,r,u),g=r,y=0;const S={};for(let w=0;w<s.length;w++){const x=s[w];if(!x)continue;const{name:k,fn:T}=x,{x:A,y:_,data:O,reset:N}=await T({x:h,y:m,initialPlacement:r,placement:g,strategy:i,middlewareData:S,rects:f,platform:c,elements:{reference:t,floating:e}});h=A??h,m=_??m,S[k]={...S[k],...O},N&&y<pZ&&(y++,typeof N=="object"&&(N.placement&&(g=N.placement),N.rects&&(f=N.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):N.rects),{x:h,y:m}=cR(f,g,u)),w=-1)}return{x:h,y:m,placement:g,strategy:i,middlewareData:S}},gZ=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:s,platform:o,elements:c,middlewareData:u}=e,{element:f,padding:h=0}=vs(t,e)||{};if(f==null)return{};const m=EL(h),g={x:n,y:r},y=dx(i),S=ux(y),w=await o.getDimensions(f),x=y==="y",k=x?"top":"left",T=x?"bottom":"right",A=x?"clientHeight":"clientWidth",_=s.reference[S]+s.reference[y]-g[y]-s.floating[S],O=g[y]-s.reference[y],N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(f));let I=N?N[A]:0;(!I||!await(o.isElement==null?void 0:o.isElement(N)))&&(I=c.floating[A]||s.floating[S]);const z=_/2-O/2,q=I/2-w[S]/2-1,Z=Ro(m[k],q),ae=Ro(m[T],q),X=I-w[S]-ae,te=I/2-w[S]/2+z,ie=CL(Z,te,X),de=!u.arrow&&Sc(i)!=null&&te!==ie&&s.reference[S]/2-(te<Z?Z:ae)-w[S]/2<0,B=de?te<Z?te-Z:te-X:0;return{[y]:g[y]+B,data:{[y]:ie,centerOffset:te-ie-B,...de&&{alignmentOffset:B}},reset:de}}}),yZ=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:c,platform:u,elements:f}=e,{mainAxis:h=!0,crossAxis:m=!0,fallbackPlacements:g,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:S="none",flipAlignment:w=!0,...x}=vs(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const k=Mo(i),T=Si(c),A=Mo(c)===c,_=await(u.isRTL==null?void 0:u.isRTL(f.floating)),O=g||(A||!w?[ym(c)]:aZ(c)),N=S!=="none";!g&&N&&O.push(...dZ(c,w,S,_));const I=[c,...O],z=await u.detectOverflow(e,x),q=[];let Z=((r=s.flip)==null?void 0:r.overflows)||[];if(h&&q.push(z[k]),m){const ie=oZ(i,o,_);q.push(z[ie[0]],z[ie[1]])}if(Z=[...Z,{placement:i,overflows:q}],!q.every(ie=>ie<=0)){var ae,X;const ie=(((ae=s.flip)==null?void 0:ae.index)||0)+1,de=I[ie];if(de&&(!(m==="alignment"?T!==Si(de):!1)||Z.every(oe=>Si(oe.placement)===T?oe.overflows[0]>0:!0)))return{data:{index:ie,overflows:Z},reset:{placement:de}};let B=(X=Z.filter(Y=>Y.overflows[0]<=0).sort((Y,oe)=>Y.overflows[1]-oe.overflows[1])[0])==null?void 0:X.placement;if(!B)switch(y){case"bestFit":{var te;const Y=(te=Z.filter(oe=>{if(N){const ye=Si(oe.placement);return ye===T||ye==="y"}return!0}).map(oe=>[oe.placement,oe.overflows.filter(ye=>ye>0).reduce((ye,ke)=>ye+ke,0)]).sort((oe,ye)=>oe[1]-ye[1])[0])==null?void 0:te[0];Y&&(B=Y);break}case"initialPlacement":B=c;break}if(i!==B)return{reset:{placement:B}}}return{}}}};function uR(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function dR(t){return iZ.some(e=>t[e]>=0)}const vZ=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:i="referenceHidden",...s}=vs(t,e);switch(i){case"referenceHidden":{const o=await r.detectOverflow(e,{...s,elementContext:"reference"}),c=uR(o,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:dR(c)}}}case"escaped":{const o=await r.detectOverflow(e,{...s,altBoundary:!0}),c=uR(o,n.floating);return{data:{escapedOffsets:c,escaped:dR(c)}}}default:return{}}}}},TL=new Set(["left","top"]);async function bZ(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Mo(n),c=Sc(n),u=Si(n)==="y",f=TL.has(o)?-1:1,h=s&&u?-1:1,m=vs(e,t);let{mainAxis:g,crossAxis:y,alignmentAxis:S}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof S=="number"&&(y=c==="end"?S*-1:S),u?{x:y*h,y:g*f}:{x:g*f,y:y*h}}const SZ=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:c}=e,u=await bZ(e,t);return o===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:i+u.x,y:s+u.y,data:{...u,placement:o}}}}},wZ=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:c=!1,limiter:u={fn:T=>{let{x:A,y:_}=T;return{x:A,y:_}}},...f}=vs(t,e),h={x:n,y:r},m=await s.detectOverflow(e,f),g=Si(i),y=cx(g);let S=h[y],w=h[g];const x=(T,A)=>CL(A+m[T==="y"?"top":"left"],A,A-m[T==="y"?"bottom":"right"]);o&&(S=x(y,S)),c&&(w=x(g,w));const k=u.fn({...e,[y]:S,[g]:w});return{...k,data:{x:k.x-n,y:k.y-r,enabled:{[y]:o,[g]:c}}}}}},xZ=function(t){return t===void 0&&(t={}),{options:t,fn(e){var n,r;const{x:i,y:s,placement:o,rects:c,middlewareData:u}=e,{offset:f=0,mainAxis:h=!0,crossAxis:m=!0}=vs(t,e),g={x:i,y:s},y=Si(o),S=cx(y);let w=g[S],x=g[y];const k=vs(f,e),T=typeof k=="number"?{mainAxis:k,crossAxis:0}:{mainAxis:(n=k.mainAxis)!=null?n:0,crossAxis:(r=k.crossAxis)!=null?r:0};if(h){const O=S==="y"?"height":"width",N=c.reference[S]-c.floating[O]+T.mainAxis,I=c.reference[S]+c.reference[O]-T.mainAxis;w<N?w=N:w>I&&(w=I)}if(m){var A,_;const O=S==="y"?"width":"height",N=TL.has(Mo(o)),I=c.reference[y]-c.floating[O]+(N&&((A=u.offset)==null?void 0:A[y])||0)+(N?0:T.crossAxis),z=c.reference[y]+c.reference[O]+(N?0:((_=u.offset)==null?void 0:_[y])||0)-(N?T.crossAxis:0);x<I?x=I:x>z&&(x=z)}return{[S]:w,[y]:x}}}},kZ=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=()=>{},...c}=vs(t,e),u=await i.detectOverflow(e,c),f=Mo(n),h=Sc(n),m=Si(n)==="y",{width:g,height:y}=r.floating;let S,w;f==="top"||f==="bottom"?(S=f,w=h===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(w=f,S=h==="end"?"top":"bottom");const x=y-u.top-u.bottom,k=g-u.left-u.right,T=Ro(y-u[S],x),A=Ro(g-u[w],k),_=e.middlewareData.shift,O=!_;let N=T,I=A;_!=null&&_.enabled.x&&(I=k),_!=null&&_.enabled.y&&(N=x),O&&!h&&(m?I=g-2*hs(u.left,u.right):N=y-2*hs(u.top,u.bottom)),await o({...e,availableWidth:I,availableHeight:N});const z=await i.getDimensions(s.floating);return g!==z.width||y!==z.height?{reset:{rects:!0}}:{}}}};function Ym(){return typeof window<"u"}function wc(t){return _L(t)?(t.nodeName||"").toLowerCase():"#document"}function ur(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function xs(t){var e;return(e=(_L(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function _L(t){return Ym()?t instanceof Node||t instanceof ur(t).Node:!1}function Ei(t){return Ym()?t instanceof Element||t instanceof ur(t).Element:!1}function zo(t){return Ym()?t instanceof HTMLElement||t instanceof ur(t).HTMLElement:!1}function fR(t){return!Ym()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof ur(t).ShadowRoot}function Xm(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=Ti(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&i!=="inline"&&i!=="contents"}function CZ(t){return/^(table|td|th)$/.test(wc(t))}function Jm(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const EZ=/transform|translate|scale|rotate|perspective|filter/,TZ=/paint|layout|strict|content/,sa=t=>!!t&&t!=="none";let bb;function fx(t){const e=Ei(t)?Ti(t):t;return sa(e.transform)||sa(e.translate)||sa(e.scale)||sa(e.rotate)||sa(e.perspective)||!hx()&&(sa(e.backdropFilter)||sa(e.filter))||EZ.test(e.willChange||"")||TZ.test(e.contain||"")}function _Z(t){let e=Da(t);for(;zo(e)&&!wd(e);){if(fx(e))return e;if(Jm(e))return null;e=Da(e)}return null}function hx(){return bb==null&&(bb=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),bb}function wd(t){return/^(html|body|#document)$/.test(wc(t))}function Ti(t){return ur(t).getComputedStyle(t)}function Qm(t){return Ei(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Da(t){if(wc(t)==="html")return t;const e=t.assignedSlot||t.parentNode||fR(t)&&t.host||xs(t);return fR(e)?e.host:e}function AL(t){const e=Da(t);return wd(e)?(t.ownerDocument||t).body:zo(e)&&Xm(e)?e:AL(e)}function xd(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=AL(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),o=ur(i);if(s){const c=lS(o);return e.concat(o,o.visualViewport||[],Xm(i)?i:[],c&&n?xd(c):[])}else return e.concat(i,xd(i,[],n))}function lS(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function RL(t){const e=Ti(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=zo(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r,c=gm(n)!==s||gm(r)!==o;return c&&(n=s,r=o),{width:n,height:r,$:c}}function px(t){return Ei(t)?t:t.contextElement}function Wl(t){const e=px(t);if(!zo(e))return ps(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=RL(e);let o=(s?gm(n.width):n.width)/r,c=(s?gm(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!c||!Number.isFinite(c))&&(c=1),{x:o,y:c}}const AZ=ps(0);function ML(t){const e=ur(t);return!hx()||!e.visualViewport?AZ:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function RZ(t,e,n){return e===void 0&&(e=!1),!!n&&e&&n===ur(t)}function Ia(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=px(t);let o=ps(1);e&&(r?Ei(r)&&(o=Wl(r)):o=Wl(t));const c=RZ(s,n,r)?ML(s):ps(0);let u=(i.left+c.x)/o.x,f=(i.top+c.y)/o.y,h=i.width/o.x,m=i.height/o.y;if(s&&r){const g=ur(s),y=Ei(r)?ur(r):r;let S=g,w=lS(S);for(;w&&y!==S;){const x=Wl(w),k=w.getBoundingClientRect(),T=Ti(w),A=k.left+(w.clientLeft+parseFloat(T.paddingLeft))*x.x,_=k.top+(w.clientTop+parseFloat(T.paddingTop))*x.y;u*=x.x,f*=x.y,h*=x.x,m*=x.y,u+=A,f+=_,S=ur(w),w=lS(S)}}return vm({width:h,height:m,x:u,y:f})}function eg(t,e){const n=Qm(t).scrollLeft;return e?e.left+n:Ia(xs(t)).left+n}function OL(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-eg(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function MZ(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",o=xs(r),c=e?Jm(e.floating):!1;if(r===o||c&&s)return n;let u={scrollLeft:0,scrollTop:0},f=ps(1);const h=ps(0),m=zo(r);if((m||!s)&&((wc(r)!=="body"||Xm(o))&&(u=Qm(r)),m)){const y=Ia(r);f=Wl(r),h.x=y.x+r.clientLeft,h.y=y.y+r.clientTop}const g=o&&!m&&!s?OL(o,u):ps(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 OZ(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function NZ(t){const e=Qm(t),n=t.ownerDocument.body,r=hs(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),i=hs(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let s=-e.scrollLeft+eg(t);const o=-e.scrollTop;return Ti(n).direction==="rtl"&&(s+=hs(t.clientWidth,n.clientWidth)-r),{width:r,height:i,x:s,y:o}}const DZ=25;function IZ(t,e,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",i=ur(t),s=xs(t),o=i.visualViewport;let c=s.clientWidth,u=s.clientHeight,f=0,h=0;if(o){const g=!hx()||e==="fixed";r?g||(f=-o.offsetLeft,h=-o.offsetTop):(c=o.width,u=o.height,g&&(f=o.offsetLeft,h=o.offsetTop))}if(eg(s)<=0){const g=s.ownerDocument,y=g.body,S=getComputedStyle(y),w=g.compatMode==="CSS1Compat"&&parseFloat(S.marginLeft)+parseFloat(S.marginRight)||0,x=Math.abs(s.clientWidth-y.clientWidth-w),k=getComputedStyle(s).scrollbarGutter==="stable both-edges"?x/2:x;k<=DZ&&(c-=k)}return{width:c,height:u,x:f,y:h}}function LZ(t,e){const n=Ia(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=Wl(t),o=t.clientWidth*s.x,c=t.clientHeight*s.y,u=i*s.x,f=r*s.y;return{width:o,height:c,x:u,y:f}}function hR(t,e,n){let r;if(e==="viewport"||e==="layoutViewport")r=IZ(t,n,e);else if(e==="document")r=NZ(xs(t));else if(Ei(e))r=LZ(e,n);else{const i=ML(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return vm(r)}function PZ(t,e){const n=e.get(t);if(n)return n;let r=xd(t,[],!1).filter(c=>Ei(c)&&wc(c)!=="body"),i=null;const s=Ti(t).position==="fixed";let o=s?Da(t):t;for(;Ei(o)&&!wd(o);){const c=Ti(o),u=fx(o),f=i?i.position:s?"fixed":"";!u&&(f==="fixed"||f==="absolute"&&c.position==="static")?r=r.filter(m=>m!==o):i=c,o=Da(o)}return e.set(t,r),r}function zZ(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?Jm(e)?[]:PZ(e,this._c):[].concat(n),r],c=hR(e,o[0],i);let u=c.top,f=c.right,h=c.bottom,m=c.left;for(let g=1;g<o.length;g++){const y=hR(e,o[g],i);u=hs(y.top,u),f=Ro(y.right,f),h=Ro(y.bottom,h),m=hs(y.left,m)}return{width:f-m,height:h-u,x:m,y:u}}function jZ(t){const{width:e,height:n}=RL(t);return{width:e,height:n}}function BZ(t,e,n){const r=zo(e),i=xs(e),s=n==="fixed",o=Ia(t,!0,s,e);let c={scrollLeft:0,scrollTop:0};const u=ps(0);if((r||!s)&&((wc(e)!=="body"||Xm(i))&&(c=Qm(e)),r)){const g=Ia(e,!0,s,e);u.x=g.x+e.clientLeft,u.y=g.y+e.clientTop}!r&&i&&(u.x=eg(i));const f=i&&!r&&!s?OL(i,c):ps(0),h=o.left+c.scrollLeft-u.x-f.x,m=o.top+c.scrollTop-u.y-f.y;return{x:h,y:m,width:o.width,height:o.height}}function Sb(t){return Ti(t).position==="static"}function pR(t,e){if(!zo(t)||Ti(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return xs(t)===n&&(n=n.ownerDocument.body),n}function NL(t,e){const n=ur(t);if(Jm(t))return n;if(!zo(t)){let i=Da(t);for(;i&&!wd(i);){if(Ei(i)&&!Sb(i))return i;i=Da(i)}return n}let r=pR(t,e);for(;r&&CZ(r)&&Sb(r);)r=pR(r,e);return r&&wd(r)&&Sb(r)&&!fx(r)?n:r||_Z(t)||n}const $Z=async function(t){const e=this.getOffsetParent||NL,n=this.getDimensions,r=await n(t.floating);return{reference:BZ(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function VZ(t){return Ti(t).direction==="rtl"}const HZ={convertOffsetParentRelativeRectToViewportRelativeRect:MZ,getDocumentElement:xs,getClippingRect:zZ,getOffsetParent:NL,getElementRects:$Z,getClientRects:OZ,getDimensions:jZ,getScale:Wl,isElement:Ei,isRTL:VZ};function DL(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function UZ(t,e,n){let r=null,i;const s=xs(t);function o(){var h;clearTimeout(i),(h=r)==null||h.disconnect(),r=null}function c(h,m){h===void 0&&(h=!1),m===void 0&&(m=1),o();const g=t.getBoundingClientRect(),{left:y,top:S,width:w,height:x}=g;if(h||e(),!w||!x)return;const k=Ih(S),T=Ih(s.clientWidth-(y+w)),A=Ih(s.clientHeight-(S+x)),_=Ih(y),N={rootMargin:-k+"px "+-T+"px "+-A+"px "+-_+"px",threshold:hs(0,Ro(1,m))||1};let I=!0;function z(q){const Z=q[0].intersectionRatio;if(!DL(g,t.getBoundingClientRect()))return c();if(Z!==m){if(!I)return c();Z?c(!1,Z):i=setTimeout(()=>{c(!1,1e-7)},1e3)}I=!1}try{r=new IntersectionObserver(z,{...N,root:s.ownerDocument})}catch{r=new IntersectionObserver(z,N)}r.observe(t)}const u=ur(t),f=()=>c(n);return u.addEventListener("resize",f),c(!0),()=>{u.removeEventListener("resize",f),o()}}function FZ(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,f=px(t),h=i||s?[...f?xd(f):[],...e?xd(e):[]]:[];h.forEach(k=>{i&&k.addEventListener("scroll",n),s&&k.addEventListener("resize",n)});const m=f&&c?UZ(f,n,s):null;let g=-1,y=null;o&&(y=new ResizeObserver(k=>{let[T]=k;T&&T.target===f&&y&&e&&(y.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var A;(A=y)==null||A.observe(e)})),n()}),f&&!u&&y.observe(f),e&&y.observe(e));let S,w=u?Ia(t):null;u&&x();function x(){const k=Ia(t);w&&!DL(w,k)&&n(),w=k,S=requestAnimationFrame(x)}return n(),()=>{var k;h.forEach(T=>{i&&T.removeEventListener("scroll",n),s&&T.removeEventListener("resize",n)}),m?.(),(k=y)==null||k.disconnect(),y=null,u&&cancelAnimationFrame(S)}}const qZ=SZ,GZ=wZ,WZ=yZ,KZ=kZ,ZZ=vZ,mR=gZ,YZ=xZ,XZ=(t,e,n)=>{const r=new Map,i=n??{},s={...HZ,...i.platform,_c:r};return mZ(t,e,{...i,platform:s})};var JZ=typeof document<"u",QZ=function(){},rp=JZ?R.useLayoutEffect:QZ;function bm(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(!bm(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)&&!bm(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function IL(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function gR(t,e){const n=IL(t);return Math.round(e*n)/n}function wb(t){const e=R.useRef(t);return rp(()=>{e.current=t}),e}function eY(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:c=!0,whileElementsMounted:u,open:f}=t,[h,m]=R.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[g,y]=R.useState(r);bm(g,r)||y(r);const[S,w]=R.useState(null),[x,k]=R.useState(null),T=R.useCallback(oe=>{oe!==N.current&&(N.current=oe,w(oe))},[]),A=R.useCallback(oe=>{oe!==I.current&&(I.current=oe,k(oe))},[]),_=s||S,O=o||x,N=R.useRef(null),I=R.useRef(null),z=R.useRef(h),q=u!=null,Z=wb(u),ae=wb(i),X=wb(f),te=R.useCallback(()=>{if(!N.current||!I.current)return;const oe={placement:e,strategy:n,middleware:g};ae.current&&(oe.platform=ae.current),XZ(N.current,I.current,oe).then(ye=>{const ke={...ye,isPositioned:X.current!==!1};ie.current&&!bm(z.current,ke)&&(z.current=ke,mc.flushSync(()=>{m(ke)}))})},[g,e,n,ae,X]);rp(()=>{f===!1&&z.current.isPositioned&&(z.current.isPositioned=!1,m(oe=>({...oe,isPositioned:!1})))},[f]);const ie=R.useRef(!1);rp(()=>(ie.current=!0,()=>{ie.current=!1}),[]),rp(()=>{if(_&&(N.current=_),O&&(I.current=O),_&&O){if(Z.current)return Z.current(_,O,te);te()}},[_,O,te,Z,q]);const de=R.useMemo(()=>({reference:N,floating:I,setReference:T,setFloating:A}),[T,A]),B=R.useMemo(()=>({reference:_,floating:O}),[_,O]),Y=R.useMemo(()=>{const oe={position:n,left:0,top:0};if(!B.floating)return oe;const ye=gR(B.floating,h.x),ke=gR(B.floating,h.y);return c?{...oe,transform:"translate("+ye+"px, "+ke+"px)",...IL(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ye,top:ke}},[n,c,B.floating,h.x,h.y]);return R.useMemo(()=>({...h,update:te,refs:de,elements:B,floatingStyles:Y}),[h,te,de,B,Y])}const tY=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?mR({element:r.current,padding:i}).fn(n):{}:r?mR({element:r,padding:i}).fn(n):{}}}},nY=(t,e)=>{const n=qZ(t);return{name:n.name,fn:n.fn,options:[t,e]}},rY=(t,e)=>{const n=GZ(t);return{name:n.name,fn:n.fn,options:[t,e]}},iY=(t,e)=>({fn:YZ(t).fn,options:[t,e]}),sY=(t,e)=>{const n=WZ(t);return{name:n.name,fn:n.fn,options:[t,e]}},oY=(t,e)=>{const n=KZ(t);return{name:n.name,fn:n.fn,options:[t,e]}},aY=(t,e)=>{const n=ZZ(t);return{name:n.name,fn:n.fn,options:[t,e]}},lY=(t,e)=>{const n=tY(t);return{name:n.name,fn:n.fn,options:[t,e]}};var cY=Object.defineProperty,xo=(t,e)=>cY(t,"name",{value:e,configurable:!0}),LL="Popper",[PL,zL]=yc(LL),[uY,jL]=PL(LL),dY=xo(t=>{const{__scopePopper:e,children:n}=t,[r,i]=R.useState(null),[s,o]=R.useState(void 0);return C.jsx(uY,{scope:e,anchor:r,onAnchorChange:i,placementState:s,setPlacementState:o,children:n})},"Popper"),fY="PopperAnchor",hY=R.forwardRef(xo(function(e,n){const{__scopePopper:r,virtualRef:i,...s}=e,o=jL(fY,r),c=R.useRef(null),u=o.onAnchorChange,f=R.useCallback(w=>{c.current=w,w&&u(w)},[u]),h=Qt(n,f),m=R.useRef(null);R.useEffect(()=>{if(!i)return;const w=m.current;m.current=i.current,w!==m.current&&u(m.current)});const g=o.placementState&&tg(o.placementState),y=g?.[0],S=g?.[1];return i?null:C.jsx(Sn.div,{"data-radix-popper-side":y,"data-radix-popper-align":S,...s,ref:h})},"PopperAnchor")),BL="PopperContent",[pY,vQ]=PL(BL),mY=R.forwardRef(xo(function(e,n){const{__scopePopper:r,side:i="bottom",sideOffset:s=0,align:o="center",alignOffset:c=0,arrowPadding:u=0,avoidCollisions:f=!0,collisionBoundary:h=[],collisionPadding:m=0,sticky:g="partial",hideWhenDetached:y=!1,updatePositionStrategy:S="optimized",onPlaced:w,...x}=e,k=jL(BL,r),[T,A]=R.useState(null),_=Qt(n,A),[O,N]=R.useState(null),I=JS(O),z=I?.width??0,q=I?.height??0,Z=i+(o!=="center"?"-"+o:""),ae=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},X=Array.isArray(h)?h:[h],te=X.length>0,ie={padding:ae,boundary:X.filter($L),altBoundary:te},{refs:de,floatingStyles:B,placement:Y,isPositioned:oe,middlewareData:ye}=eY({strategy:"fixed",placement:Z,whileElementsMounted:xo((...Ie)=>FZ(...Ie,{animationFrame:S==="always"}),"whileElementsMounted"),elements:{reference:k.anchor},middleware:[nY({mainAxis:s+q,alignmentAxis:c}),f&&rY({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?iY():void 0,...ie}),f&&sY({...ie}),oY({...ie,apply:xo(({elements:Ie,rects:ct,availableWidth:Ke,availableHeight:Xe})=>{const{width:ut,height:xe}=ct.reference,be=Ie.floating.style;be.setProperty("--radix-popper-available-width",`${Ke}px`),be.setProperty("--radix-popper-available-height",`${Xe}px`),be.setProperty("--radix-popper-anchor-width",`${ut}px`),be.setProperty("--radix-popper-anchor-height",`${xe}px`)},"apply")}),O&&lY({element:O,padding:u}),gY({arrowWidth:z,arrowHeight:q}),y&&aY({strategy:"referenceHidden",...ie,boundary:te?ie.boundary:void 0})]}),ke=k.setPlacementState;Zn(()=>(ke(Y),()=>{ke(void 0)}),[Y,ke]);const[P,W]=tg(Y),ce=Ci(w);Zn(()=>{oe&&ce?.()},[oe,ce]);const me=ye.arrow?.x,Ae=ye.arrow?.y,Le=ye.arrow?.centerOffset!==0,[He,Ce]=R.useState();return Zn(()=>{T&&Ce(window.getComputedStyle(T).zIndex)},[T]),C.jsx("div",{ref:de.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:oe?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:He,"--radix-popper-transform-origin":[ye.transformOrigin?.x,ye.transformOrigin?.y].join(" "),...ye.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:C.jsx(pY,{scope:r,placedSide:P,placedAlign:W,onArrowChange:N,arrowX:me,arrowY:Ae,shouldHideArrow:Le,children:C.jsx(Sn.div,{"data-side":P,"data-align":W,...x,ref:_,style:{...x.style,animation:oe?x.style?.animation:"none"}})})})},"PopperContent"));function $L(t){return t!==null}xo($L,"isNotNull");var gY=xo(t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:r,middlewareData:i}=e,o=i.arrow?.centerOffset!==0,c=o?0:t.arrowWidth,u=o?0:t.arrowHeight,[f,h]=tg(n),m={start:"0%",center:"50%",end:"100%"}[h],g=(i.arrow?.x??0)+c/2,y=(i.arrow?.y??0)+u/2;let S="",w="";return f==="bottom"?(S=o?m:`${g}px`,w=`${-u}px`):f==="top"?(S=o?m:`${g}px`,w=`${r.floating.height+u}px`):f==="right"?(S=`${-u}px`,w=o?m:`${y}px`):f==="left"&&(S=`${r.floating.width+u}px`,w=o?m:`${y}px`),{data:{x:S,y:w}}}}),"transformOrigin");function tg(t){const[e,n="center"]=t.split("-");return[e,n]}xo(tg,"getSideAndAlignFromPlacement");var yY=dY,vY=hY,bY=mY,SY=Object.defineProperty,wY=(t,e)=>SY(t,"name",{value:e,configurable:!0}),xY=R.forwardRef(wY(function(e,n){const{container:r,...i}=e,[s,o]=R.useState(!1);Zn(()=>o(!0),[]);const c=r||s&&globalThis?.document?.body;return c?mc.createPortal(C.jsx(Sn.div,{...i,ref:n}),c):null},"Portal")),kY=Object.defineProperty,bs=(t,e)=>kY(t,"name",{value:e,configurable:!0});function VL(t,e){return R.useReducer((n,r)=>e[n][r]??n,t)}bs(VL,"useStateMachine");var CY=bs(t=>{const{present:e,children:n}=t,r=HL(e),i=typeof n=="function"?n({present:r.isPresent}):R.Children.only(n),s=UL(r.ref,FL(i));return typeof n=="function"||r.isPresent?R.cloneElement(i,{ref:s}):null},"Presence");function HL(t){const[e,n]=R.useState(),r=R.useRef(null),i=R.useRef(t),s=R.useRef("none"),o=R.useRef(void 0),c=t?"mounted":"unmounted",[u,f]=VL(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return R.useEffect(()=>{u==="mounted"?(s.current=o.current??$l(r.current),o.current=void 0):s.current="none"},[u]),Zn(()=>{const h=r.current,m=i.current;if(m!==t){const y=s.current,S=$l(h);t?(o.current=S,f("MOUNT")):S==="none"||h?.display==="none"?f("UNMOUNT"):f(m&&y!==S?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,f]),Zn(()=>{if(e){let h;const m=e.ownerDocument.defaultView??window,g=bs(S=>{const x=$l(r.current).includes(CSS.escape(S.animationName));if(S.target===e&&x&&(f("ANIMATION_END"),!i.current)){const k=e.style.animationFillMode;e.style.animationFillMode="forwards",h=m.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=k)})}},"handleAnimationEnd"),y=bs(S=>{S.target===e&&(s.current=$l(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:R.useCallback(h=>{if(h){const m=getComputedStyle(h);r.current=m,o.current=$l(m)}else r.current=null;n(h)},[])}}bs(HL,"usePresence");function cS(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}bs(cS,"setRef");function UL(...t){const e=R.useRef(t);return e.current=t,R.useCallback(n=>{const r=e.current;let i=!1;const s=r.map(o=>{const c=cS(o,n);return!i&&typeof c=="function"&&(i=!0),c});if(i)return()=>{for(let o=0;o<s.length;o++){const c=s[o];typeof c=="function"?c():cS(r[o],null)}}},[])}bs(UL,"useStableComposedRefs");function $l(t){return t?.animationName||"none"}bs($l,"getAnimationName");function FL(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)}bs(FL,"getElementRef");var EY=Object.defineProperty,TY=(t,e)=>EY(t,"name",{value:e,configurable:!0});function qL(t){const e=R.useRef({value:t,previous:t});return R.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}TY(qL,"usePrevious");var _Y=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"}),AY=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Dl=new WeakMap,Lh=new WeakMap,Ph={},xb=0,GL=function(t){return t&&(t.host||GL(t.parentNode))},RY=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=GL(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})},MY=function(t,e,n,r){var i=RY(e,Array.isArray(t)?t:[t]);Ph[n]||(Ph[n]=new WeakMap);var s=Ph[n],o=[],c=new Set,u=new Set(i),f=function(m){!m||c.has(m)||(c.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(c.has(g))h(g);else try{var y=g.getAttribute(r),S=y!==null&&y!=="false",w=(Dl.get(g)||0)+1,x=(s.get(g)||0)+1;Dl.set(g,w),s.set(g,x),o.push(g),w===1&&S&&Lh.set(g,!0),x===1&&g.setAttribute(n,"true"),S||g.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",g,k)}})};return h(e),c.clear(),xb++,function(){o.forEach(function(m){var g=Dl.get(m)-1,y=s.get(m)-1;Dl.set(m,g),s.set(m,y),g||(Lh.has(m)||m.removeAttribute(r),Lh.delete(m)),y||m.removeAttribute(n)}),xb--,xb||(Dl=new WeakMap,Dl=new WeakMap,Lh=new WeakMap,Ph={})}},OY=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=AY(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),MY(r,i,n,"aria-hidden")):function(){return null}},bi=function(){return bi=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},bi.apply(this,arguments)};function WL(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 NY(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 ip="right-scroll-bar-position",sp="width-before-scroll-bar",DY="with-scroll-bars-hidden",IY="--removed-body-scroll-bar-size";function kb(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function LY(t,e){var n=R.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 PY=typeof window<"u"?R.useLayoutEffect:R.useEffect,yR=new WeakMap;function zY(t,e){var n=LY(null,function(r){return t.forEach(function(i){return kb(i,r)})});return PY(function(){var r=yR.get(n);if(r){var i=new Set(r),s=new Set(t),o=n.current;i.forEach(function(c){s.has(c)||kb(c,null)}),s.forEach(function(c){i.has(c)||kb(c,o)})}yR.set(n,t)},[t]),n}function jY(t){return t}function BY(t,e){e===void 0&&(e=jY);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(c){return c!==o})}},assignSyncMedium:function(s){for(r=!0;n.length;){var o=n;n=[],o.forEach(s)}n={push:function(c){return s(c)},filter:function(){return n}}},assignMedium:function(s){r=!0;var o=[];if(n.length){var c=n;n=[],c.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 $Y(t){t===void 0&&(t={});var e=BY(null);return e.options=bi({async:!0,ssr:!1},t),e}var KL=function(t){var e=t.sideCar,n=WL(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 R.createElement(r,bi({},n))};KL.isSideCarExport=!0;function VY(t,e){return t.useMedium(e),KL}var ZL=$Y(),Cb=function(){},ng=R.forwardRef(function(t,e){var n=R.useRef(null),r=R.useState({onScrollCapture:Cb,onWheelCapture:Cb,onTouchMoveCapture:Cb}),i=r[0],s=r[1],o=t.forwardProps,c=t.children,u=t.className,f=t.removeScrollBar,h=t.enabled,m=t.shards,g=t.sideCar,y=t.noRelative,S=t.noIsolation,w=t.inert,x=t.allowPinchZoom,k=t.as,T=k===void 0?"div":k,A=t.gapMode,_=WL(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=g,N=zY([n,e]),I=bi(bi({},_),i);return R.createElement(R.Fragment,null,h&&R.createElement(O,{sideCar:ZL,removeScrollBar:f,shards:m,noRelative:y,noIsolation:S,inert:w,setCallbacks:s,allowPinchZoom:!!x,lockRef:n,gapMode:A}),o?R.cloneElement(R.Children.only(c),bi(bi({},I),{ref:N})):R.createElement(T,bi({},I,{className:u,ref:N}),c))});ng.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ng.classNames={fullWidth:sp,zeroRight:ip};var HY=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function UY(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=HY();return e&&t.setAttribute("nonce",e),t}function FY(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function qY(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var GY=function(){var t=0,e=null;return{add:function(n){t==0&&(e=UY())&&(FY(e,n),qY(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},WY=function(){var t=GY();return function(e,n){R.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},YL=function(){var t=WY(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},KY={left:0,top:0,right:0,gap:0},Eb=function(t){return parseInt(t||"",10)||0},ZY=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[Eb(n),Eb(r),Eb(i)]},YY=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return KY;var e=ZY(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])}},XY=YL(),Kl="data-scroll-locked",JY=function(t,e,n,r){var i=t.left,s=t.top,o=t.right,c=t.gap;return n===void 0&&(n="margin"),`
|
|
287
|
-
.`.concat(DY,` {
|
|
288
|
-
overflow: hidden `).concat(r,`;
|
|
289
|
-
padding-right: `).concat(c,"px ").concat(r,`;
|
|
290
|
-
}
|
|
291
|
-
body[`).concat(Kl,`] {
|
|
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(c,"px ").concat(r,`;
|
|
301
|
-
`),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
.`).concat(ip,` {
|
|
305
|
-
right: `).concat(c,"px ").concat(r,`;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
.`).concat(sp,` {
|
|
309
|
-
margin-right: `).concat(c,"px ").concat(r,`;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
.`).concat(ip," .").concat(ip,` {
|
|
313
|
-
right: 0 `).concat(r,`;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
.`).concat(sp," .").concat(sp,` {
|
|
317
|
-
margin-right: 0 `).concat(r,`;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
body[`).concat(Kl,`] {
|
|
321
|
-
`).concat(IY,": ").concat(c,`px;
|
|
322
|
-
}
|
|
323
|
-
`)},vR=function(){var t=parseInt(document.body.getAttribute(Kl)||"0",10);return isFinite(t)?t:0},QY=function(){R.useEffect(function(){return document.body.setAttribute(Kl,(vR()+1).toString()),function(){var t=vR()-1;t<=0?document.body.removeAttribute(Kl):document.body.setAttribute(Kl,t.toString())}},[])},eX=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;QY();var s=R.useMemo(function(){return YY(i)},[i]);return R.createElement(XY,{styles:JY(s,!e,i,n?"":"!important")})},uS=!1;if(typeof window<"u")try{var zh=Object.defineProperty({},"passive",{get:function(){return uS=!0,!0}});window.addEventListener("test",zh,zh),window.removeEventListener("test",zh,zh)}catch{uS=!1}var Il=uS?{passive:!1}:!1,tX=function(t){return t.tagName==="TEXTAREA"},XL=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!tX(t)&&n[e]==="visible")},nX=function(t){return XL(t,"overflowY")},rX=function(t){return XL(t,"overflowX")},bR=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=JL(t,r);if(i){var s=QL(t,r),o=s[1],c=s[2];if(o>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},iX=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},sX=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},JL=function(t,e){return t==="v"?nX(e):rX(e)},QL=function(t,e){return t==="v"?iX(e):sX(e)},oX=function(t,e){return t==="h"&&e==="rtl"?-1:1},aX=function(t,e,n,r,i){var s=oX(t,window.getComputedStyle(e).direction),o=s*r,c=n.target,u=e.contains(c),f=!1,h=o>0,m=0,g=0;do{if(!c)break;var y=QL(t,c),S=y[0],w=y[1],x=y[2],k=w-x-s*S;(S||k)&&JL(t,c)&&(m+=k,g+=S);var T=c.parentNode;c=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!u&&c!==document.body||u&&(e.contains(c)||e===c));return(h&&Math.abs(m)<1||!h&&Math.abs(g)<1)&&(f=!0),f},jh=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},SR=function(t){return[t.deltaX,t.deltaY]},wR=function(t){return t&&"current"in t?t.current:t},lX=function(t,e){return t[0]===e[0]&&t[1]===e[1]},cX=function(t){return`
|
|
324
|
-
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
|
325
|
-
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
|
326
|
-
`)},uX=0,Ll=[];function dX(t){var e=R.useRef([]),n=R.useRef([0,0]),r=R.useRef(),i=R.useState(uX++)[0],s=R.useState(YL)[0],o=R.useRef(t);R.useEffect(function(){o.current=t},[t]),R.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var w=NY([t.lockRef.current],(t.shards||[]).map(wR),!0).filter(Boolean);return w.forEach(function(x){return x.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),w.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var c=R.useCallback(function(w,x){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!o.current.allowPinchZoom;var k=jh(w),T=n.current,A="deltaX"in w?w.deltaX:T[0]-k[0],_="deltaY"in w?w.deltaY:T[1]-k[1],O,N=w.target,I=Math.abs(A)>Math.abs(_)?"h":"v";if("touches"in w&&I==="h"&&N.type==="range")return!1;var z=window.getSelection(),q=z&&z.anchorNode,Z=q?q===N||q.contains(N):!1;if(Z)return!1;var ae=bR(I,N);if(!ae)return!0;if(ae?O=I:(O=I==="v"?"h":"v",ae=bR(I,N)),!ae)return!1;if(!r.current&&"changedTouches"in w&&(A||_)&&(r.current=O),!O)return!0;var X=r.current||O;return aX(X,x,w,X==="h"?A:_)},[]),u=R.useCallback(function(w){var x=w;if(!(!Ll.length||Ll[Ll.length-1]!==s)){var k="deltaY"in x?SR(x):jh(x),T=e.current.filter(function(O){return O.name===x.type&&(O.target===x.target||x.target===O.shadowParent)&&lX(O.delta,k)})[0];if(T&&T.should){x.cancelable&&x.preventDefault();return}if(!T){var A=(o.current.shards||[]).map(wR).filter(Boolean).filter(function(O){return O.contains(x.target)}),_=A.length>0?c(x,A[0]):!o.current.noIsolation;_&&x.cancelable&&x.preventDefault()}}},[]),f=R.useCallback(function(w,x,k,T){var A={name:w,delta:x,target:k,should:T,shadowParent:fX(k)};e.current.push(A),setTimeout(function(){e.current=e.current.filter(function(_){return _!==A})},1)},[]),h=R.useCallback(function(w){n.current=jh(w),r.current=void 0},[]),m=R.useCallback(function(w){f(w.type,SR(w),w.target,c(w,t.lockRef.current))},[]),g=R.useCallback(function(w){f(w.type,jh(w),w.target,c(w,t.lockRef.current))},[]);R.useEffect(function(){return Ll.push(s),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",u,Il),document.addEventListener("touchmove",u,Il),document.addEventListener("touchstart",h,Il),function(){Ll=Ll.filter(function(w){return w!==s}),document.removeEventListener("wheel",u,Il),document.removeEventListener("touchmove",u,Il),document.removeEventListener("touchstart",h,Il)}},[]);var y=t.removeScrollBar,S=t.inert;return R.createElement(R.Fragment,null,S?R.createElement(s,{styles:cX(i)}):null,y?R.createElement(eX,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function fX(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const hX=VY(ZL,dX);var e2=R.forwardRef(function(t,e){return R.createElement(ng,bi({},t,{ref:e,sideCar:hX}))});e2.classNames=ng.classNames;var pX=Object.defineProperty,Tt=(t,e)=>pX(t,"name",{value:e,configurable:!0}),mX=[" ","Enter","ArrowUp","ArrowDown"],gX=[" ","Enter"],hc="Select",[rg,mx,yX]=cL(hc),[Ua,bQ]=yc(hc,[yX,zL]),gx=zL(),[vX,jo]=Ua(hc),[bX,SX]=Ua(hc);function t2(t){const{__scopeSelect:e,children:n,open:r,defaultOpen:i,onOpenChange:s,value:o,defaultValue:c,onValueChange:u,dir:f,name:h,autoComplete:m,disabled:g,required:y,form:S,internal_do_not_use_render:w}=t,x=gx(e),[k,T]=R.useState(null),[A,_]=R.useState(null),[O,N]=R.useState(!1),I=pL(f),[z,q]=xp({prop:r,defaultProp:i??!1,onChange:s,caller:hc}),[Z,ae]=xp({prop:o,defaultProp:c,onChange:u,caller:hc}),X=R.useRef(null),te=R.useRef(Z);R.useEffect(()=>{const W=S?k?.ownerDocument.getElementById(S):k?.form;if(W instanceof HTMLFormElement){const ce=Tt(()=>ae(te.current),"reset");return W.addEventListener("reset",ce),()=>W.removeEventListener("reset",ce)}},[S,k,ae]);const ie=k?!!S||!!k.closest("form"):!0,[de,B]=R.useState(new Set),Y=lx(),oe=Array.from(de).map(W=>W.props.value).join(";"),ye=R.useCallback(W=>{B(ce=>new Set(ce).add(W))},[]),ke=R.useCallback(W=>{B(ce=>{const me=new Set(ce);return me.delete(W),me})},[]),P={required:y,trigger:k,onTriggerChange:T,valueNode:A,onValueNodeChange:_,valueNodeHasChildren:O,onValueNodeHasChildrenChange:N,contentId:Y,value:Z,onValueChange:ae,open:z,onOpenChange:q,dir:I,triggerPointerDownPosRef:X,disabled:g,name:h,autoComplete:m,form:S,nativeOptions:de,nativeSelectKey:oe,isFormControl:ie};return C.jsx(yY,{...x,children:C.jsx(vX,{scope:e,...P,children:C.jsx(rg.Provider,{scope:e,children:C.jsx(bX,{scope:e,onNativeOptionAdd:ye,onNativeOptionRemove:ke,children:p2(w)?w(P):n})})})})}Tt(t2,"SelectProvider");var n2=Tt(t=>{const{__scopeSelect:e,children:n,...r}=t;return C.jsx(t2,{__scopeSelect:e,...r,internal_do_not_use_render:({isFormControl:i})=>C.jsxs(C.Fragment,{children:[n,i?C.jsx(PX,{__scopeSelect:e}):null]})})},"Select"),wX="SelectTrigger",r2=R.forwardRef(Tt(function(e,n){const{__scopeSelect:r,disabled:i=!1,...s}=e,o=gx(r),c=jo(wX,r),u=c.disabled||i,f=Qt(n,c.onTriggerChange),h=mx(r),m=R.useRef("touch"),[g,y,S]=yx(x=>{const k=h().filter(_=>!_.disabled),T=k.find(_=>_.value===c.value),A=vx(k,x,T);A!==void 0&&c.onValueChange(A.value)}),w=Tt(x=>{u||(c.onOpenChange(!0),S()),x&&(c.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)})},"handleOpen");return C.jsx(vY,{asChild:!0,...o,children:C.jsx(Sn.button,{type:"button",role:"combobox","aria-controls":c.open?c.contentId:void 0,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":"none",dir:c.dir,"data-state":c.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":Fd(c.value)?"":void 0,...s,ref:f,onClick:ln(s.onClick,x=>{x.currentTarget.focus(),m.current!=="mouse"&&w(x)}),onPointerDown:ln(s.onPointerDown,x=>{m.current=x.pointerType;const k=x.target;k.hasPointerCapture(x.pointerId)&&k.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&x.pointerType==="mouse"&&(w(x),x.preventDefault())}),onKeyDown:ln(s.onKeyDown,x=>{const k=g.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&y(x.key),!(k&&x.key===" ")&&mX.includes(x.key)&&(w(),x.preventDefault())})})})},"SelectTrigger")),xX="SelectValue",i2=R.forwardRef(Tt(function(e,n){const{__scopeSelect:r,className:i,style:s,children:o,placeholder:c="",...u}=e,f=jo(xX,r),{onValueNodeHasChildrenChange:h}=f,m=o!==void 0,g=Qt(n,f.onValueNodeChange);Zn(()=>{h(m)},[h,m]);const y=Fd(f.value);return C.jsx(Sn.span,{...u,asChild:y?!1:u.asChild,ref:g,style:{pointerEvents:"none"},children:C.jsx(R.Fragment,{children:y?c:o},y?"placeholder":"value")})},"SelectValue")),s2=R.forwardRef(Tt(function(e,n){const{__scopeSelect:r,children:i,...s}=e;return C.jsx(Sn.span,{"aria-hidden":!0,...s,ref:n,children:i||"▼"})},"SelectIcon")),kX="SelectPortal",[CX,EX]=Ua(kX,{forceMount:void 0}),o2=Tt(t=>{const{__scopeSelect:e,forceMount:n,...r}=t;return C.jsx(CX,{scope:t.__scopeSelect,forceMount:n,children:C.jsx(xY,{asChild:!0,...r})})},"SelectPortal"),La="SelectContent",a2=R.forwardRef(Tt(function(e,n){const r=EX(La,e.__scopeSelect),{forceMount:i=r.forceMount,...s}=e,o=jo(La,e.__scopeSelect),[c,u]=R.useState();return Zn(()=>{u(new DocumentFragment)},[]),C.jsx(CY,{present:i||o.open,children:({present:f})=>f?C.jsx(AX,{...s,ref:n}):C.jsx(TX,{...s,fragment:c})})},"SelectContent")),TX=R.forwardRef(Tt(function(e,n){const{__scopeSelect:r,children:i,fragment:s}=e;return s?mc.createPortal(C.jsx(l2,{scope:r,children:C.jsx(rg.Slot,{scope:r,children:C.jsx("div",{ref:n,children:i})})}),s):null},"SelectContentFragment")),Yr=10,[l2,ig]=Ua(La),_X=Ea("SelectContent.RemoveScroll"),AX=R.forwardRef(Tt(function(e,n){const{__scopeSelect:r}=e,{position:i="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:c,side:u,sideOffset:f,align:h,alignOffset:m,arrowPadding:g,collisionBoundary:y,collisionPadding:S,sticky:w,hideWhenDetached:x,avoidCollisions:k,...T}=e,A=jo(La,r),[_,O]=R.useState(null),[N,I]=R.useState(null),z=Qt(n,O),[q,Z]=R.useState(null),[ae,X]=R.useState(null),te=mx(r),[ie,de]=R.useState(!1),B=R.useRef(!1);R.useEffect(()=>{if(_)return OY(_)},[_]),ox();const Y=R.useCallback(Ce=>{const[Ie,...ct]=te().map(ut=>ut.ref.current),[Ke]=ct.slice(-1),Xe=document.activeElement;for(const ut of Ce)if(ut===Xe||(ut?.scrollIntoView({block:"nearest"}),ut===Ie&&N&&(N.scrollTop=0),ut===Ke&&N&&(N.scrollTop=N.scrollHeight),ut?.focus(),document.activeElement!==Xe))return},[te,N]),oe=R.useCallback(()=>Y([q,_]),[Y,q,_]);R.useEffect(()=>{ie&&oe()},[ie,oe]);const{onOpenChange:ye,triggerPointerDownPosRef:ke}=A;R.useEffect(()=>{if(_){let Ce={x:0,y:0};const Ie=Tt(Ke=>{Ce={x:Math.abs(Math.round(Ke.pageX)-(ke.current?.x??0)),y:Math.abs(Math.round(Ke.pageY)-(ke.current?.y??0))}},"handlePointerMove"),ct=Tt(Ke=>{Ce.x<=10&&Ce.y<=10?Ke.preventDefault():Ke.composedPath().includes(_)||ye(!1),document.removeEventListener("pointermove",Ie),ke.current=null},"handlePointerUp");return ke.current!==null&&(document.addEventListener("pointermove",Ie),document.addEventListener("pointerup",ct,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Ie),document.removeEventListener("pointerup",ct,{capture:!0})}}},[_,ye,ke]),R.useEffect(()=>{const Ce=Tt(()=>ye(!1),"close");return window.addEventListener("blur",Ce),window.addEventListener("resize",Ce),()=>{window.removeEventListener("blur",Ce),window.removeEventListener("resize",Ce)}},[ye]);const[P,W]=yx(Ce=>{const Ie=te().filter(Xe=>!Xe.disabled),ct=Ie.find(Xe=>Xe.ref.current===document.activeElement),Ke=vx(Ie,Ce,ct);Ke&&setTimeout(()=>Ke.ref.current?.focus())}),ce=R.useCallback((Ce,Ie,ct)=>{const Ke=!B.current&&!ct;(A.value!==void 0&&A.value===Ie||Ke)&&(Z(Ce),Ke&&(B.current=!0))},[A.value]),me=R.useCallback(()=>_?.focus(),[_]),Ae=R.useCallback((Ce,Ie,ct)=>{const Ke=!B.current&&!ct;(A.value!==void 0&&A.value===Ie||Ke)&&X(Ce)},[A.value]),Le=i==="popper"?xR:RX,He=Le===xR?{side:u,sideOffset:f,align:h,alignOffset:m,arrowPadding:g,collisionBoundary:y,collisionPadding:S,sticky:w,hideWhenDetached:x,avoidCollisions:k}:{};return C.jsx(l2,{scope:r,content:_,viewport:N,onViewportChange:I,itemRefCallback:ce,selectedItem:q,onItemLeave:me,itemTextRefCallback:Ae,focusSelectedItem:oe,selectedItemText:ae,position:i,isPositioned:ie,searchRef:P,children:C.jsx(e2,{as:_X,allowPinchZoom:!0,children:C.jsx(QK,{asChild:!0,trapped:A.open,onMountAutoFocus:Ce=>{Ce.preventDefault()},onUnmountAutoFocus:ln(s,Ce=>{A.trigger?.focus({preventScroll:!0}),Ce.preventDefault()}),children:C.jsx(WK,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:Ce=>Ce.preventDefault(),onDismiss:()=>A.onOpenChange(!1),children:C.jsx(Le,{role:"listbox",id:A.contentId,"data-state":A.open?"open":"closed",dir:A.dir,onContextMenu:Ce=>Ce.preventDefault(),...T,...He,onPlaced:()=>de(!0),ref:z,style:{display:"flex",flexDirection:"column",outline:"none",...T.style},onKeyDown:ln(T.onKeyDown,Ce=>{const Ie=Ce.ctrlKey||Ce.altKey||Ce.metaKey;if(Ce.key==="Tab"&&Ce.preventDefault(),!Ie&&Ce.key.length===1&&W(Ce.key),["ArrowUp","ArrowDown","Home","End"].includes(Ce.key)){let Ke=te().filter(Xe=>!Xe.disabled).map(Xe=>Xe.ref.current);if(["ArrowUp","End"].includes(Ce.key)&&(Ke=Ke.slice().reverse()),["ArrowUp","ArrowDown"].includes(Ce.key)){const Xe=Ce.target,ut=Ke.indexOf(Xe);Ke=Ke.slice(ut+1)}setTimeout(()=>Y(Ke)),Ce.preventDefault()}})})})})})})},"SelectContentImpl")),RX=R.forwardRef(Tt(function(e,n){const{__scopeSelect:r,onPlaced:i,...s}=e,o=jo(La,r),c=ig(La,r),[u,f]=R.useState(null),[h,m]=R.useState(null),g=Qt(n,m),y=mx(r),S=R.useRef(!1),w=R.useRef(!0),{viewport:x,selectedItem:k,selectedItemText:T,focusSelectedItem:A}=c,_=R.useCallback(()=>{if(o.trigger&&o.valueNode&&u&&h&&x&&k&&T){const z=o.trigger.getBoundingClientRect(),q=h.getBoundingClientRect(),Z=o.valueNode.getBoundingClientRect(),ae=T.getBoundingClientRect();if(o.dir!=="rtl"){const Xe=ae.left-q.left,ut=Z.left-Xe,xe=z.left-ut,be=z.width+xe,nt=Math.max(be,q.width),Dt=window.innerWidth-Yr,Un=eS(ut,[Yr,Math.max(Yr,Dt-nt)]);u.style.minWidth=be+"px",u.style.left=Un+"px"}else{const Xe=q.right-ae.right,ut=window.innerWidth-Z.right-Xe,xe=window.innerWidth-z.right-ut,be=z.width+xe,nt=Math.max(be,q.width),Dt=window.innerWidth-Yr,Un=eS(ut,[Yr,Math.max(Yr,Dt-nt)]);u.style.minWidth=be+"px",u.style.right=Un+"px"}const X=y(),te=window.innerHeight-Yr*2,ie=x.scrollHeight,de=window.getComputedStyle(h),B=parseInt(de.borderTopWidth,10),Y=parseInt(de.paddingTop,10),oe=parseInt(de.borderBottomWidth,10),ye=parseInt(de.paddingBottom,10),ke=B+Y+ie+ye+oe,P=Math.min(k.offsetHeight*5,ke),W=window.getComputedStyle(x),ce=parseInt(W.paddingTop,10),me=parseInt(W.paddingBottom,10),Ae=z.top+z.height/2-Yr,Le=te-Ae,He=k.offsetHeight/2,Ce=k.offsetTop+He,Ie=B+Y+Ce,ct=ke-Ie;if(Ie<=Ae){const Xe=X.length>0&&k===X[X.length-1].ref.current;u.style.bottom="0px";const ut=h.clientHeight-x.offsetTop-x.offsetHeight,xe=Math.max(Le,He+(Xe?me:0)+ut+oe),be=Ie+xe;u.style.height=be+"px"}else{const Xe=X.length>0&&k===X[0].ref.current;u.style.top="0px";const xe=Math.max(Ae,B+x.offsetTop+(Xe?ce:0)+He)+ct;u.style.height=xe+"px",x.scrollTop=Ie-Ae+x.offsetTop}u.style.margin=`${Yr}px 0`,u.style.minHeight=P+"px",u.style.maxHeight=te+"px",i?.(),requestAnimationFrame(()=>S.current=!0)}},[y,o.trigger,o.valueNode,u,h,x,k,T,o.dir,i]);Zn(()=>_(),[_]);const[O,N]=R.useState();Zn(()=>{h&&N(window.getComputedStyle(h).zIndex)},[h]);const I=R.useCallback(z=>{z&&w.current===!0&&(_(),A?.(),w.current=!1)},[_,A]);return C.jsx(MX,{scope:r,contentWrapper:u,shouldExpandOnScrollRef:S,onScrollButtonChange:I,children:C.jsx("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:O},children:C.jsx(Sn.div,{...s,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})},"SelectItemAlignedPosition")),xR=R.forwardRef(Tt(function(e,n){const{__scopeSelect:r,align:i="start",collisionPadding:s=Yr,...o}=e,c=gx(r);return C.jsx(bY,{...c,...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")),[MX,OX]=Ua(La,{}),kR="SelectViewport",c2=R.forwardRef(Tt(function(e,n){const{__scopeSelect:r,nonce:i,...s}=e,o=ig(kR,r),c=OX(kR,r),u=Qt(n,o.onViewportChange),f=R.useRef(0);return C.jsxs(C.Fragment,{children:[C.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}),C.jsx(rg.Slot,{scope:r,children:C.jsx(Sn.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:ln(s.onScroll,h=>{const m=h.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:y}=c;if(y?.current&&g){const S=Math.abs(f.current-m.scrollTop);if(S>0){const w=window.innerHeight-Yr*2,x=parseFloat(g.style.minHeight),k=parseFloat(g.style.height),T=Math.max(x,k);if(T<w){const A=T+S,_=Math.min(w,A),O=A-_;g.style.height=_+"px",g.style.bottom==="0px"&&(m.scrollTop=O>0?O:0,g.style.justifyContent="flex-end")}}}f.current=m.scrollTop})})})]})},"SelectViewport")),NX="SelectGroup",[SQ,wQ]=Ua(NX),dS="SelectItem",[DX,u2]=Ua(dS),d2=R.forwardRef(Tt(function(e,n){const{__scopeSelect:r,value:i,disabled:s=!1,textValue:o,...c}=e,u=jo(dS,r),f=ig(dS,r),h=u.value===i,[m,g]=R.useState(o??""),[y,S]=R.useState(!1),w=Ci(_=>f.itemRefCallback?.(_,i,s)),x=Qt(n,w),k=lx(),T=R.useRef("touch"),A=Tt(()=>{s||(u.onValueChange(i),u.onOpenChange(!1))},"handleSelect");return C.jsx(DX,{scope:r,value:i,disabled:s,textId:k,isSelected:h,onItemTextChange:R.useCallback(_=>{g(O=>O||(_?.textContent??"").trim())},[]),children:C.jsx(rg.ItemSlot,{scope:r,value:i,disabled:s,textValue:m,children:C.jsx(Sn.div,{role:"option","aria-labelledby":k,"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,...c,ref:x,onFocus:ln(c.onFocus,()=>S(!0)),onBlur:ln(c.onBlur,()=>S(!1)),onClick:ln(c.onClick,()=>{T.current!=="mouse"&&A()}),onPointerUp:ln(c.onPointerUp,()=>{T.current==="mouse"&&A()}),onPointerDown:ln(c.onPointerDown,_=>{T.current=_.pointerType}),onPointerMove:ln(c.onPointerMove,_=>{T.current=_.pointerType,s?f.onItemLeave?.():T.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ln(c.onPointerLeave,_=>{_.currentTarget===document.activeElement&&f.onItemLeave?.()}),onKeyDown:ln(c.onKeyDown,_=>{s||_.target!==_.currentTarget||f.searchRef?.current!==""&&_.key===" "||(gX.includes(_.key)&&A(),_.key===" "&&_.preventDefault())})})})})},"SelectItem")),Bh="SelectItemText",f2=R.forwardRef(Tt(function(e,n){const{__scopeSelect:r,className:i,style:s,...o}=e,c=jo(Bh,r),u=ig(Bh,r),f=u2(Bh,r),h=SX(Bh,r),[m,g]=R.useState(null),y=Ci(A=>u.itemTextRefCallback?.(A,f.value,f.disabled)),S=Qt(n,g,f.onItemTextChange,y),w=m?.textContent,x=R.useMemo(()=>C.jsx("option",{value:f.value,disabled:f.disabled,children:w},f.value),[f.disabled,f.value,w]),{onNativeOptionAdd:k,onNativeOptionRemove:T}=h;return Zn(()=>(k(x),()=>T(x)),[k,T,x]),C.jsxs(C.Fragment,{children:[C.jsx(Sn.span,{id:f.textId,...o,ref:S}),f.isSelected&&c.valueNode&&!c.valueNodeHasChildren&&!Fd(c.value)?mc.createPortal(o.children,c.valueNode):null]})},"SelectItemText")),IX="SelectItemIndicator",h2=R.forwardRef(Tt(function(e,n){const{__scopeSelect:r,...i}=e;return u2(IX,r).isSelected?C.jsx(Sn.span,{"aria-hidden":!0,...i,ref:n}):null},"SelectItemIndicator")),LX="SelectBubbleInput",PX=R.forwardRef(Tt(function({__scopeSelect:e,...n},r){const i=jo(LX,e),{value:s,onValueChange:o,required:c,disabled:u,name:f,autoComplete:h,form:m}=i,{nativeOptions:g,nativeSelectKey:y}=i,S=R.useRef(null),w=Qt(r,S),x=s??"",k=qL(x),T=Array.from(g).some(A=>(A.props.value??"")==="");return R.useEffect(()=>{const A=S.current;if(!A)return;const _=window.HTMLSelectElement.prototype,N=Object.getOwnPropertyDescriptor(_,"value").set;if(k!==x&&N){const I=new Event("change",{bubbles:!0});N.call(A,x),A.dispatchEvent(I)}},[k,x]),C.jsxs(Sn.select,{"aria-hidden":!0,required:c,tabIndex:-1,name:f,autoComplete:h,disabled:u,form:m,onChange:A=>o(A.target.value),...n,style:{..._Y,...n.style},ref:w,defaultValue:x,children:[Fd(s)&&!T?C.jsx("option",{value:""}):null,Array.from(g)]},y)},"SelectBubbleInput"));function p2(t){return typeof t=="function"}Tt(p2,"isFunction");function Fd(t){return t===""||t===void 0}Tt(Fd,"shouldShowPlaceholder");function yx(t){const e=Ci(t),n=R.useRef(""),r=R.useRef(0),i=R.useCallback(o=>{const c=n.current+o;e(c),Tt((function u(f){n.current=f,window.clearTimeout(r.current),f!==""&&(r.current=window.setTimeout(()=>u(""),1e3))}),"updateSearch")(c)},[e]),s=R.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return R.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,s]}Tt(yx,"useTypeaheadSearch");function vx(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=m2(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}Tt(vx,"findNextItem");function m2(t,e){return t.map((n,r)=>t[(e+r)%t.length])}Tt(m2,"wrapArray");function zX({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?C.jsx("input",{id:t,type:"text",readOnly:r,value:o,disabled:!0}):C.jsxs(n2,{value:o,onValueChange:i,disabled:r,children:[C.jsxs(r2,{id:t,className:"vertebr-select-trigger",children:[C.jsx("span",{className:"vertebr-select-value",children:C.jsx(i2,{children:Vu(o,n)})}),C.jsx(s2,{className:"vertebr-select-icon",children:C.jsx(jX,{})})]}),C.jsx(o2,{children:C.jsx(a2,{className:"vertebr-select-content",position:"popper",sideOffset:6,children:C.jsx(c2,{className:"vertebr-select-viewport",children:s.map(c=>C.jsxs(d2,{value:c,className:"vertebr-select-item",children:[C.jsx(f2,{children:Vu(c,n)}),C.jsx(h2,{className:"vertebr-select-check",children:C.jsx(BX,{})})]},c))})})})]})}function jX(){return C.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:C.jsx("path",{d:"M2.5 4.5 6 8l3.5-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function BX(){return C.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:C.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 $X(t){return Array.isArray(t)?t.map(e=>String(e).trim()).filter(Boolean):[]}function VX(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 HX({id:t,value:e,field:n,readOnly:r,onChange:i}){const s=n.options?.filter(Boolean)??[],o=$X(e),c=VX(s,o),u=f=>{i(f.filter(h=>h.on).map(h=>h.id))};return C.jsx("ul",{id:t,className:"vertebr-enum-list",children:c.map((f,h)=>C.jsxs("li",{className:"vertebr-enum-list-row","data-on":f.on,children:[C.jsxs("label",{className:"vertebr-enum-list-label",children:[C.jsx("input",{type:"checkbox",checked:f.on,disabled:r,onChange:m=>{const g=c.map(y=>y.id===f.id?{...y,on:m.target.checked}:y);u(g)}}),C.jsx("span",{children:Vu(f.id,n)})]}),C.jsxs("div",{className:"vertebr-enum-list-move",children:[C.jsx("button",{type:"button","aria-label":`Move ${Vu(f.id,n)} up`,disabled:r||h===0,onClick:()=>{if(h===0)return;const m=[...c],g=m[h];m[h]=m[h-1],m[h-1]=g,u(m)},children:"↑"}),C.jsx("button",{type:"button","aria-label":`Move ${Vu(f.id,n)} down`,disabled:r||h===c.length-1,onClick:()=>{if(h>=c.length-1)return;const m=[...c],g=m[h];m[h]=m[h+1],m[h+1]=g,u(m)},children:"↓"})]})]},f.id))})}function UX({id:t,name:e,value:n,asCents:r=!0,readOnly:i,onBlur:s,onChange:o,inputRef:c}){const[u,f]=R.useState(()=>Lv(n,r));R.useEffect(()=>{f(Lv(n,r))},[n,r]);const h=typeof n=="number"&&Number.isFinite(n)?u0(n,{asCents:r}):null;return C.jsxs("div",{className:"vertebr-field-money",children:[C.jsx("span",{className:"vertebr-field-money-prefix","aria-hidden":"true",children:"$"}),C.jsx("input",{id:t,name:e,ref:c,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(RU(g,r))},onBlur:()=>{f(Lv(n,r)),s?.()}})]})}function fS({fieldKey:t,field:e,groupLabel:n,variant:r,schema:i,watched:s,form:o,uploads:c,onUpload:u,galleryUpload:f,onListGallery:h,onUploadGallery:m,hideImagePreview:g,hideUpload:y,visibilityGroup:S}){const w=TH(t,e,n),x=zH(t,i,S??n),k=!x||s?.[x]!==!1,T=!g&&e.type!=="file[]"&&rc(t,e)&&!!wp(s?.[t]);return e.type==="boolean"?C.jsxs("div",{className:"vertebr-switch-row",children:[C.jsx(XT,{htmlFor:t,children:w}),C.jsx(ia,{control:o.control,name:t,render:({field:A})=>C.jsx(SU,{className:"vertebr-switch",id:t,checked:!!A.value,onCheckedChange:A.onChange,children:C.jsx(xU,{className:"vertebr-switch-thumb"})})})]}):C.jsxs("div",{className:"vertebr-field","data-span":MH(t,e,r),"data-kind":rc(t,e)?"image":void 0,"data-storefront":x?k?"on":"off":void 0,children:[C.jsxs("div",{className:"vertebr-field-head",children:[C.jsx(XT,{htmlFor:t,children:w}),x?C.jsx(OO,{name:x,label:w,form:o}):null]}),T?C.jsxs("div",{className:"vertebr-field-media",children:[C.jsx("img",{src:wp(s[t])??"",alt:""}),C.jsx("input",{id:t,type:"text",readOnly:e.readOnly,...o.register(t)})]}):e.type==="richtext"||fO(t,e)?C.jsx(ia,{control:o.control,name:t,render:({field:A})=>C.jsx(IK,{id:t,name:A.name,inputRef:A.ref,value:typeof A.value=="string"?A.value:"",readOnly:e.readOnly,recordImages:AH(i,s),galleryUpload:f,onListGallery:h,onUploadGallery:m,onBlur:A.onBlur,onChange:A.onChange})}):e.type==="file[]"?C.jsx(ia,{control:o.control,name:t,render:({field:A})=>{const _=ZT(A.value);return C.jsx("div",{className:"vertebr-field-files",children:_.length>0?C.jsx("ul",{className:"vertebr-field-files-list",children:_.map(O=>C.jsxs("li",{children:[C.jsx("img",{src:O,alt:""}),C.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>A.onChange(_.filter(N=>N!==O)),children:"Remove"})]},O))}):C.jsx("p",{className:"vertebr-field-files-empty",children:"No photos yet"})})}}):e.type==="number"&&NO(t,e)?C.jsx(ia,{control:o.control,name:t,render:({field:A})=>C.jsx(UX,{id:t,name:A.name,inputRef:A.ref,value:A.value,asCents:nw(t,e)||/^pricing$/i.test(n),readOnly:e.readOnly,onBlur:A.onBlur,onChange:A.onChange})}):e.type==="number"?C.jsx(ia,{control:o.control,name:t,render:({field:A})=>C.jsx("input",{id:t,type:"number",readOnly:e.readOnly,value:typeof A.value=="number"&&Number.isFinite(A.value)?A.value:"",onBlur:A.onBlur,onChange:_=>{const O=_.target.value;A.onChange(O===""?void 0:Number(O))},name:A.name,ref:A.ref})}):e.type==="enum"?C.jsx(ia,{control:o.control,name:t,render:({field:A})=>C.jsx(zX,{id:t,value:A.value,field:e,readOnly:e.readOnly,onChange:A.onChange})}):e.type==="enum[]"?C.jsx(ia,{control:o.control,name:t,render:({field:A})=>C.jsx(HX,{id:t,value:A.value,field:e,readOnly:e.readOnly,onChange:A.onChange})}):pO(t,e)?C.jsx("textarea",{id:t,rows:5,readOnly:e.readOnly,...o.register(t)}):C.jsx("input",{id:t,type:"text",readOnly:e.readOnly,...o.register(t)}),!y&&c?.[t]&&u&&!e.readOnly?C.jsx(Id,{meta:c[t],multiple:e.type==="file[]",onUpload:async A=>{const O=(await u(t,A)).map(N=>N.url).filter(Boolean);if(O.length){if(e.type==="file[]"){o.setValue(t,[...ZT(o.getValues(t)),...O],{shouldDirty:!0,shouldTouch:!0});return}o.setValue(t,O[0],{shouldDirty:!0,shouldTouch:!0})}}}):null]})}function g2({form:t,isDirty:e,status:n,tone:r,onDiscard:i,submitLabel:s="Save changes"}){return C.jsxs("div",{className:"vertebr-actions",children:[C.jsx("button",{className:"vertebr-btn vertebr-btn-primary",type:"submit",disabled:t.formState.isSubmitting||!e,children:t.formState.isSubmitting?"Saving…":s}),e?C.jsx("button",{className:"vertebr-btn",type:"button",onClick:i,children:"Discard"}):null,e?C.jsx("span",{className:"vertebr-dirty",children:"Unsaved"}):n?C.jsx("span",{className:"vertebr-status","data-tone":r,children:n}):null,C.jsx("span",{className:"vertebr-actions-spacer"}),C.jsx("span",{className:"vertebr-kbd",children:"⌘S"})]})}function FX({schema:t,groups:e,watched:n,form:r,uploads:i,onUpload:s,galleryUpload:o,onListGallery:c,onUploadGallery:u,onSubmit:f,isDirty:h,status:m,tone:g,onDiscard:y,submitLabel:S}){const w=HH(t,n),x=w?wp(n?.[w])??"":"",k=e.filter(_=>/^(Media|Display|Status)$/i.test(_.id)),T=e.filter(_=>!/^(Media|Display|Status)$/i.test(_.id)),A={variant:"record",schema:t,watched:n,form:r,uploads:i,onUpload:s,galleryUpload:o,onListGallery:c,onUploadGallery:u};return C.jsxs("form",{className:"vertebr-form","data-variant":"record",onSubmit:f,children:[C.jsx("div",{className:"vertebr-form-scroll",children:C.jsxs("div",{className:"vertebr-record-layout",children:[C.jsxs("aside",{className:"vertebr-record-aside",children:[C.jsx("div",{className:"vertebr-record-preview",children:x&&cd(x)?C.jsx("img",{src:x,alt:""}):C.jsx("div",{className:"vertebr-record-preview-empty",children:"No image"})}),w&&i?.[w]&&s?C.jsx(Id,{meta:i[w],label:"Drop a new image or browse",onUpload:async _=>{const[O]=await s(w,_);O?.url&&r.setValue(w,O.url,{shouldDirty:!0,shouldTouch:!0})}}):null,k.map(_=>C.jsxs("div",{className:"vertebr-record-block","data-layout":/^inventory$/i.test(_.id)?"chips":void 0,children:[C.jsx(CR,{groupId:_.id,label:_.label,schema:t,form:r}),C.jsx("div",{className:"vertebr-form-fields","data-layout":RH(_.fields[0]?.[0]??"",_.fields[0]?.[1])?"chips":void 0,children:_.fields.map(([O,N])=>C.jsx(fS,{fieldKey:O,field:N,groupLabel:_.label,visibilityGroup:_.id,hideImagePreview:!0,hideUpload:O===w,...A},O))})]},_.id))]}),C.jsx("div",{className:"vertebr-record-main",children:T.map(_=>{const O=/^inventory$/i.test(_.id),N=/^specs$/i.test(_.id),I=YS(_.id,t),z=!I||n?.[I]!==!1;return C.jsxs("div",{className:"vertebr-record-block","data-layout":O?"chips":N?"specs":void 0,"data-storefront":I?z?"on":"off":void 0,children:[C.jsx(CR,{groupId:_.id,label:_.label,schema:t,form:r}),C.jsx("div",{className:"vertebr-form-fields","data-layout":O?"chips":N?"specs":void 0,children:_.fields.map(([q,Z])=>C.jsx(fS,{fieldKey:q,field:Z,groupLabel:_.label,visibilityGroup:_.id,...A},q))})]},_.id)})})]})}),C.jsx(g2,{form:r,isDirty:h,status:m,tone:g,onDiscard:y,submitLabel:S})]})}function CR({groupId:t,label:e,schema:n,form:r}){const i=YS(t,n);return C.jsxs("div",{className:"vertebr-record-block-label",children:[C.jsx("span",{children:e}),i?C.jsx(OO,{name:i,label:e,form:r}):null]})}function qX({schema:t,groups:e,watched:n,form:r,uploads:i,onUpload:s,galleryUpload:o,onListGallery:c,onUploadGallery:u,onSubmit:f,isDirty:h,status:m,tone:g,onDiscard:y,submitLabel:S}){const w=e.length===1;return C.jsxs("form",{className:"vertebr-form","data-variant":"config",onSubmit:f,children:[C.jsx("div",{className:"vertebr-form-scroll",children:e.map(x=>C.jsxs("div",{className:"vertebr-form-section","data-plain":w?"true":void 0,children:[w?null:C.jsxs("div",{className:"vertebr-form-section-head",children:[C.jsx("h3",{children:x.label}),C.jsx("span",{className:"vertebr-form-section-count",children:x.fields.length})]}),C.jsx("div",{className:"vertebr-form-fields",children:x.fields.map(([k,T])=>C.jsx(fS,{fieldKey:k,field:T,groupLabel:x.label,variant:"config",schema:t,watched:n,form:r,uploads:i,onUpload:s,galleryUpload:o,onListGallery:c,onUploadGallery:u},k))})]},x.id))}),C.jsx(g2,{form:r,isDirty:h,status:m,tone:g,onDiscard:y,submitLabel:S})]})}function bx({schema:t,value:e,onSave:n,submitLabel:r,variant:i="config",uploads:s,onUpload:o,galleryUpload:c,onListGallery:u,onUploadGallery:f}){const h=R.useMemo(()=>i==="record"?OH(t):t,[t,i]),m=R.useMemo(()=>i==="record"?NH(h,e):e,[h,e,i]),g=R.useMemo(()=>CH(h),[h]),y=R.useMemo(()=>VH(h,i),[h,i]),[S,w]=R.useState(null),[x,k]=R.useState(),T=UV({resolver:WV(g),defaultValues:m}),A=YM({control:T.control});R.useEffect(()=>{T.reset(m)},[m,T]);const _=T.handleSubmit(async z=>{w("Saving…"),k(void 0);try{await n(z),w("Saved"),k("ok")}catch(q){w(q instanceof Error?q.message:"Save failed"),k("danger")}}),O=T.formState.isDirty;R.useEffect(()=>{const z=q=>{(q.metaKey||q.ctrlKey)&&q.key.toLowerCase()==="s"&&(q.preventDefault(),_())};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[_]);const I={schema:h,groups:y,watched:A,form:T,uploads:s,onUpload:o,galleryUpload:c,onListGallery:u,onUploadGallery:f,onSubmit:_,isDirty:O,status:S,tone:x,onDiscard:()=>{T.reset(m),w(null),k(void 0)},submitLabel:r};return i==="record"?C.jsx(FX,{...I}):C.jsx(qX,{...I})}function GX({environments:t,value:e,onChange:n}){const r=t.find(i=>i.id===e);return C.jsxs(n2,{value:e,onValueChange:n,children:[C.jsxs(r2,{className:"vertebr-select-trigger","aria-label":"Environment","data-tone":r?.tone??"neutral",children:[C.jsxs("span",{className:"vertebr-select-value",children:[C.jsx("span",{className:"vertebr-select-dot","data-tone":r?.tone??"neutral"}),C.jsx(i2,{placeholder:"Select environment"})]}),C.jsx(s2,{className:"vertebr-select-icon",children:C.jsx(WX,{})})]}),C.jsx(o2,{children:C.jsx(a2,{className:"vertebr-select-content",position:"popper",sideOffset:6,children:C.jsx(c2,{className:"vertebr-select-viewport",children:t.map(i=>C.jsxs(d2,{value:i.id,className:"vertebr-select-item","data-tone":i.tone??"neutral",children:[C.jsxs("span",{className:"vertebr-select-value",children:[C.jsx("span",{className:"vertebr-select-dot","data-tone":i.tone??"neutral"}),C.jsx(f2,{children:i.label})]}),i.auth?.required?C.jsx("span",{className:"vertebr-env-lock",children:"auth"}):null,C.jsx(h2,{className:"vertebr-select-check",children:C.jsx(KX,{})})]},i.id))})})})]})}function WX(){return C.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:C.jsx("path",{d:"M2.5 4.5 6 8l3.5-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function KX(){return C.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:C.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 ZX({label:t="Gallery",items:e,accept:n,maxBytes:r,canDelete:i,loading:s,onRefresh:o,onUpload:c,onDelete:u}){const f={field:"gallery",accept:n,maxBytes:r};return C.jsxs("div",{className:"vertebr-gallery",children:[C.jsxs("div",{className:"vertebr-panel-head",children:[C.jsx("h2",{children:t}),C.jsxs("div",{className:"vertebr-gallery-head-actions",children:[C.jsx("span",{className:"vertebr-count",children:e.length}),o?C.jsx("button",{type:"button",className:"vertebr-btn",onClick:o,disabled:s,children:s?"Refreshing…":"Refresh"}):null]})]}),C.jsxs("div",{className:"vertebr-gallery-body",children:[C.jsx(Id,{meta:f,multiple:!0,label:"Drop images here or browse to add to the gallery",onUpload:c}),e.length===0?C.jsx("div",{className:"vertebr-empty",children:"No images in the gallery yet."}):C.jsx("div",{className:"vertebr-gallery-grid",children:e.map(h=>C.jsxs("article",{className:"vertebr-gallery-card",children:[C.jsx("a",{className:"vertebr-gallery-thumb",href:h.url,target:"_blank",rel:"noreferrer",title:h.name??h.url,children:C.jsx("img",{src:h.url,alt:h.name??"",loading:"lazy"})}),C.jsxs("div",{className:"vertebr-gallery-meta",children:[C.jsx("strong",{title:h.name??h.id,children:h.name??h.id}),C.jsx("a",{href:h.url,target:"_blank",rel:"noreferrer",children:h.url.replace(/^https?:\/\//i,"")})]}),i&&u?C.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))})]})]})}function YX({label:t="Overview",metrics:e,onRefresh:n,loading:r}){return C.jsxs("div",{className:"vertebr-metrics",children:[C.jsxs("div",{className:"vertebr-panel-head",children:[C.jsx("h2",{children:t}),n?C.jsx("button",{type:"button",className:"vertebr-btn",onClick:n,disabled:r,children:r?"Refreshing…":"Refresh"}):null]}),e.length===0?C.jsx("div",{className:"vertebr-empty",children:"No metrics registered yet."}):C.jsx("div",{className:"vertebr-metrics-grid",children:e.map(i=>C.jsxs("article",{className:"vertebr-metric-card","data-tone":i.tone??"neutral",children:[C.jsx("p",{className:"vertebr-metric-label",children:i.label}),C.jsx("p",{className:"vertebr-metric-value",children:i.value}),i.hint?C.jsx("p",{className:"vertebr-metric-hint",children:i.hint}):null]},i.id))})]})}function ho(t,e){return typeof t=="function"?t(e):t}function Er(t,e){return n=>{e.setState(r=>({...r,[t]:ho(n,r[t])}))}}function sg(t){return t instanceof Function}function XX(t){return Array.isArray(t)&&t.every(e=>typeof e=="number")}function JX(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 Ue(t,e,n){let r=[],i;return s=>{let o;n.key&&n.debug&&(o=Date.now());const c=t(s);if(!(c.length!==r.length||c.some((h,m)=>r[m]!==h)))return i;r=c;let f;if(n.key&&n.debug&&(f=Date.now()),i=e(...c),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=(S,w)=>{for(S=String(S);S.length<w;)S=" "+S;return S};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 Fe(t,e,n,r){return{debug:()=>{var i;return(i=t?.debugAll)!=null?i:t[e]},key:!1,onChange:r}}function QX(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:Ue(()=>[t,n,e,s],(o,c,u,f)=>({table:o,column:c,row:u,cell:f,getValue:f.getValue,renderValue:f.renderValue}),Fe(t.options,"debugCells"))};return t._features.forEach(o=>{o.createCell==null||o.createCell(s,n,e,t)},{}),s}function eJ(t,e,n,r){var i,s;const c={...t._getDefaultColumnDef(),...e},u=c.accessorKey;let f=(i=(s=c.id)!=null?s:u?typeof String.prototype.replaceAll=="function"?u.replaceAll(".","_"):u.replace(/\./g,"_"):void 0)!=null?i:typeof c.header=="string"?c.header:void 0,h;if(c.accessorFn?h=c.accessorFn:u&&(u.includes(".")?h=g=>{let y=g;for(const w of u.split(".")){var S;y=(S=y)==null?void 0:S[w]}return y}:h=g=>g[c.accessorKey]),!f)throw new Error;let m={id:`${String(f)}`,accessorFn:h,parent:r,depth:n,columnDef:c,columns:[],getFlatColumns:Ue(()=>[!0],()=>{var g;return[m,...(g=m.columns)==null?void 0:g.flatMap(y=>y.getFlatColumns())]},Fe(t.options,"debugColumns")),getLeafColumns:Ue(()=>[t._getOrderColumnsFn()],g=>{var y;if((y=m.columns)!=null&&y.length){let S=m.columns.flatMap(w=>w.getLeafColumns());return g(S)}return[m]},Fe(t.options,"debugColumns"))};for(const g of t._features)g.createColumn==null||g.createColumn(m,t);return m}const zn="debugHeaders";function ER(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=[],c=u=>{u.subHeaders&&u.subHeaders.length&&u.subHeaders.map(c),o.push(u)};return c(s),o},getContext:()=>({table:t,header:s,column:e})};return t._features.forEach(o=>{o.createHeader==null||o.createHeader(s,t)}),s}const tJ={createTable:t=>{t.getHeaderGroups=Ue(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,n,r,i)=>{var s,o;const c=(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 $h(e,[...c,...f,...u],t)},Fe(t.options,zn)),t.getCenterHeaderGroups=Ue(()=>[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))),$h(e,n,t,"center")),Fe(t.options,zn)),t.getLeftHeaderGroups=Ue(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left],(e,n,r)=>{var i;const s=(i=r?.map(o=>n.find(c=>c.id===o)).filter(Boolean))!=null?i:[];return $h(e,s,t,"left")},Fe(t.options,zn)),t.getRightHeaderGroups=Ue(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.right],(e,n,r)=>{var i;const s=(i=r?.map(o=>n.find(c=>c.id===o)).filter(Boolean))!=null?i:[];return $h(e,s,t,"right")},Fe(t.options,zn)),t.getFooterGroups=Ue(()=>[t.getHeaderGroups()],e=>[...e].reverse(),Fe(t.options,zn)),t.getLeftFooterGroups=Ue(()=>[t.getLeftHeaderGroups()],e=>[...e].reverse(),Fe(t.options,zn)),t.getCenterFooterGroups=Ue(()=>[t.getCenterHeaderGroups()],e=>[...e].reverse(),Fe(t.options,zn)),t.getRightFooterGroups=Ue(()=>[t.getRightHeaderGroups()],e=>[...e].reverse(),Fe(t.options,zn)),t.getFlatHeaders=Ue(()=>[t.getHeaderGroups()],e=>e.map(n=>n.headers).flat(),Fe(t.options,zn)),t.getLeftFlatHeaders=Ue(()=>[t.getLeftHeaderGroups()],e=>e.map(n=>n.headers).flat(),Fe(t.options,zn)),t.getCenterFlatHeaders=Ue(()=>[t.getCenterHeaderGroups()],e=>e.map(n=>n.headers).flat(),Fe(t.options,zn)),t.getRightFlatHeaders=Ue(()=>[t.getRightHeaderGroups()],e=>e.map(n=>n.headers).flat(),Fe(t.options,zn)),t.getCenterLeafHeaders=Ue(()=>[t.getCenterFlatHeaders()],e=>e.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),Fe(t.options,zn)),t.getLeftLeafHeaders=Ue(()=>[t.getLeftFlatHeaders()],e=>e.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),Fe(t.options,zn)),t.getRightLeafHeaders=Ue(()=>[t.getRightFlatHeaders()],e=>e.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),Fe(t.options,zn)),t.getLeafHeaders=Ue(()=>[t.getLeftHeaderGroups(),t.getCenterHeaderGroups(),t.getRightHeaderGroups()],(e,n,r)=>{var i,s,o,c,u,f;return[...(i=(s=e[0])==null?void 0:s.headers)!=null?i:[],...(o=(c=n[0])==null?void 0:c.headers)!=null?o:[],...(u=(f=r[0])==null?void 0:f.headers)!=null?u:[]].map(h=>h.getLeafHeaders()).flat()},Fe(t.options,zn))}};function $h(t,e,n,r){var i,s;let o=0;const c=function(g,y){y===void 0&&(y=1),o=Math.max(o,y),g.filter(S=>S.getIsVisible()).forEach(S=>{var w;(w=S.columns)!=null&&w.length&&c(S.columns,y+1)},0)};c(t);let u=[];const f=(g,y)=>{const S={depth:y,id:[r,`${y}`].filter(Boolean).join("_"),headers:[]},w=[];g.forEach(x=>{const k=[...w].reverse()[0],T=x.column.depth===S.depth;let A,_=!1;if(T&&x.column.parent?A=x.column.parent:(A=x.column,_=!0),k&&k?.column===A)k.subHeaders.push(x);else{const O=ER(n,A,{id:[r,y,A.id,x?.id].filter(Boolean).join("_"),isPlaceholder:_,placeholderId:_?`${w.filter(N=>N.column===A).length}`:void 0,depth:y,index:w.length});O.subHeaders.push(x),w.push(O)}S.headers.push(x),x.headerGroup=S}),u.push(S),y>0&&f(w,y-1)},h=e.map((g,y)=>ER(n,g,{depth:o,index:y}));f(h,o-1),u.reverse();const m=g=>g.filter(S=>S.column.getIsVisible()).map(S=>{let w=0,x=0,k=[0];S.subHeaders&&S.subHeaders.length?(k=[],m(S.subHeaders).forEach(A=>{let{colSpan:_,rowSpan:O}=A;w+=_,k.push(O)})):w=1;const T=Math.min(...k);return x=x+T,S.colSpan=w,S.rowSpan=x,{colSpan:w,rowSpan:x}});return m((i=(s=u[0])==null?void 0:s.headers)!=null?i:[]),u}const nJ=(t,e,n,r,i,s,o)=>{let c={id:e,index:r,original:n,depth:i,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:u=>{if(c._valuesCache.hasOwnProperty(u))return c._valuesCache[u];const f=t.getColumn(u);if(f!=null&&f.accessorFn)return c._valuesCache[u]=f.accessorFn(c.original,r),c._valuesCache[u]},getUniqueValues:u=>{if(c._uniqueValuesCache.hasOwnProperty(u))return c._uniqueValuesCache[u];const f=t.getColumn(u);if(f!=null&&f.accessorFn)return f.columnDef.getUniqueValues?(c._uniqueValuesCache[u]=f.columnDef.getUniqueValues(c.original,r),c._uniqueValuesCache[u]):(c._uniqueValuesCache[u]=[c.getValue(u)],c._uniqueValuesCache[u])},renderValue:u=>{var f;return(f=c.getValue(u))!=null?f:t.options.renderFallbackValue},subRows:[],getLeafRows:()=>JX(c.subRows,u=>u.subRows),getParentRow:()=>c.parentId?t.getRow(c.parentId,!0):void 0,getParentRows:()=>{let u=[],f=c;for(;;){const h=f.getParentRow();if(!h)break;u.push(h),f=h}return u.reverse()},getAllCells:Ue(()=>[t.getAllLeafColumns()],u=>u.map(f=>QX(t,c,f,f.id)),Fe(t.options,"debugRows")),_getAllCellsByColumnId:Ue(()=>[c.getAllCells()],u=>u.reduce((f,h)=>(f[h.column.id]=h,f),{}),Fe(t.options,"debugRows"))};for(let u=0;u<t._features.length;u++){const f=t._features[u];f==null||f.createRow==null||f.createRow(c,t)}return c},rJ={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()}}},y2=(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))};y2.autoRemove=t=>oi(t);const v2=(t,e,n)=>{var r;return!!(!((r=t.getValue(e))==null||(r=r.toString())==null)&&r.includes(n))};v2.autoRemove=t=>oi(t);const b2=(t,e,n)=>{var r;return((r=t.getValue(e))==null||(r=r.toString())==null?void 0:r.toLowerCase())===n?.toLowerCase()};b2.autoRemove=t=>oi(t);const S2=(t,e,n)=>{var r;return(r=t.getValue(e))==null?void 0:r.includes(n)};S2.autoRemove=t=>oi(t);const w2=(t,e,n)=>!n.some(r=>{var i;return!((i=t.getValue(e))!=null&&i.includes(r))});w2.autoRemove=t=>oi(t)||!(t!=null&&t.length);const x2=(t,e,n)=>n.some(r=>{var i;return(i=t.getValue(e))==null?void 0:i.includes(r)});x2.autoRemove=t=>oi(t)||!(t!=null&&t.length);const k2=(t,e,n)=>t.getValue(e)===n;k2.autoRemove=t=>oi(t);const C2=(t,e,n)=>t.getValue(e)==n;C2.autoRemove=t=>oi(t);const Sx=(t,e,n)=>{let[r,i]=n;const s=t.getValue(e);return s>=r&&s<=i};Sx.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 c=s;s=o,o=c}return[s,o]};Sx.autoRemove=t=>oi(t)||oi(t[0])&&oi(t[1]);const es={includesString:y2,includesStringSensitive:v2,equalsString:b2,arrIncludes:S2,arrIncludesAll:w2,arrIncludesSome:x2,equals:k2,weakEquals:C2,inNumberRange:Sx};function oi(t){return t==null||t===""}const iJ={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:t=>({columnFilters:[],...t}),getDefaultOptions:t=>({onColumnFiltersChange:Er("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"?es.includesString:typeof r=="number"?es.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?es.equals:Array.isArray(r)?es.arrIncludes:es.weakEquals},t.getFilterFn=()=>{var n,r;return sg(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:es[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=ho(n,s?s.value:void 0);if(TR(i,o,t)){var c;return(c=r?.filter(h=>h.id!==t.id))!=null?c:[]}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=ho(e,i))==null?void 0:s.filter(o=>{const c=n.find(u=>u.id===o.id);if(c){const u=c.getFilterFn();if(TR(u,o.value,c))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 TR(t,e,n){return(t&&t.autoRemove?t.autoRemove(e,n):!1)||typeof e>"u"||typeof e=="string"&&!e}const sJ=(t,e,n)=>n.reduce((r,i)=>{const s=i.getValue(t);return r+(typeof s=="number"?s:0)},0),oJ=(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},aJ=(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},lJ=(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]},cJ=(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},uJ=(t,e)=>{if(!e.length)return;const n=e.map(s=>s.getValue(t));if(!XX(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},dJ=(t,e)=>Array.from(new Set(e.map(n=>n.getValue(t))).values()),fJ=(t,e)=>new Set(e.map(n=>n.getValue(t))).size,hJ=(t,e)=>e.length,Tb={sum:sJ,min:oJ,max:aJ,extent:lJ,mean:cJ,median:uJ,unique:dJ,uniqueCount:fJ,count:hJ},pJ={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:Er("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 Tb.sum;if(Object.prototype.toString.call(r)==="[object Date]")return Tb.extent},t.getAggregationFn=()=>{var n,r;if(!t)throw new Error;return sg(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:Tb[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 mJ(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 gJ={getInitialState:t=>({columnOrder:[],...t}),getDefaultOptions:t=>({onColumnOrderChange:Er("columnOrder",t)}),createColumn:(t,e)=>{t.getIndex=Ue(n=>[ed(e,n)],n=>n.findIndex(r=>r.id===t.id),Fe(e.options,"debugColumns")),t.getIsFirstColumn=n=>{var r;return((r=ed(e,n)[0])==null?void 0:r.id)===t.id},t.getIsLastColumn=n=>{var r;const i=ed(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=Ue(()=>[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],c=[...i];for(;c.length&&o.length;){const u=o.shift(),f=c.findIndex(h=>h.id===u);f>-1&&s.push(c.splice(f,1)[0])}s=[...s,...c]}return mJ(s,n,r)},Fe(t.options,"debugTable"))}},_b=()=>({left:[],right:[]}),yJ={getInitialState:t=>({columnPinning:_b(),...t}),getDefaultOptions:t=>({onColumnPinningChange:Er("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 c,u;return{left:((c=i?.left)!=null?c:[]).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(c=>c.id),{left:r,right:i}=e.getState().columnPinning,s=n.some(c=>r?.includes(c)),o=n.some(c=>i?.includes(c));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=Ue(()=>[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))},Fe(e.options,"debugRows")),t.getLeftVisibleCells=Ue(()=>[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"})),Fe(e.options,"debugRows")),t.getRightVisibleCells=Ue(()=>[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"})),Fe(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?_b():(n=(r=t.initialState)==null?void 0:r.columnPinning)!=null?n:_b())},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=Ue(()=>[t.getAllLeafColumns(),t.getState().columnPinning.left],(e,n)=>(n??[]).map(r=>e.find(i=>i.id===r)).filter(Boolean),Fe(t.options,"debugColumns")),t.getRightLeafColumns=Ue(()=>[t.getAllLeafColumns(),t.getState().columnPinning.right],(e,n)=>(n??[]).map(r=>e.find(i=>i.id===r)).filter(Boolean),Fe(t.options,"debugColumns")),t.getCenterLeafColumns=Ue(()=>[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))},Fe(t.options,"debugColumns"))}};function vJ(t){return t||(typeof document<"u"?document:null)}const Vh={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Ab=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),bJ={getDefaultColumnDef:()=>Vh,getInitialState:t=>({columnSizing:{},columnSizingInfo:Ab(),...t}),getDefaultOptions:t=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Er("columnSizing",t),onColumnSizingInfoChange:Er("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:Vh.minSize,(r=s??t.columnDef.size)!=null?r:Vh.size),(i=t.columnDef.maxSize)!=null?i:Vh.maxSize)},t.getStart=Ue(n=>[n,ed(e,n),e.getState().columnSizing],(n,r)=>r.slice(0,t.getIndex(n)).reduce((i,s)=>i+s.getSize(),0),Fe(e.options,"debugColumns")),t.getAfter=Ue(n=>[n,ed(e,n),e.getState().columnSizing],(n,r)=>r.slice(t.getIndex(n)+1).reduce((i,s)=>i+s.getSize(),0),Fe(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(),Rb(s)&&s.touches&&s.touches.length>1))return;const o=t.getSize(),c=t?t.getLeafHeaders().map(k=>[k.column.id,k.column.getSize()]):[[r.id,r.getSize()]],u=Rb(s)?Math.round(s.touches[0].clientX):s.clientX,f={},h=(k,T)=>{typeof T=="number"&&(e.setColumnSizingInfo(A=>{var _,O;const N=e.options.columnResizeDirection==="rtl"?-1:1,I=(T-((_=A?.startOffset)!=null?_:0))*N,z=Math.max(I/((O=A?.startSize)!=null?O:0),-.999999);return A.columnSizingStart.forEach(q=>{let[Z,ae]=q;f[Z]=Math.round(Math.max(ae+ae*z,0)*100)/100}),{...A,deltaOffset:I,deltaPercentage:z}}),(e.options.columnResizeMode==="onChange"||k==="end")&&e.setColumnSizing(A=>({...A,...f})))},m=k=>h("move",k),g=k=>{h("end",k),e.setColumnSizingInfo(T=>({...T,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},y=vJ(n),S={moveHandler:k=>m(k.clientX),upHandler:k=>{y?.removeEventListener("mousemove",S.moveHandler),y?.removeEventListener("mouseup",S.upHandler),g(k.clientX)}},w={moveHandler:k=>(k.cancelable&&(k.preventDefault(),k.stopPropagation()),m(k.touches[0].clientX),!1),upHandler:k=>{var T;y?.removeEventListener("touchmove",w.moveHandler),y?.removeEventListener("touchend",w.upHandler),k.cancelable&&(k.preventDefault(),k.stopPropagation()),g((T=k.touches[0])==null?void 0:T.clientX)}},x=SJ()?{passive:!1}:!1;Rb(s)?(y?.addEventListener("touchmove",w.moveHandler,x),y?.addEventListener("touchend",w.upHandler,x)):(y?.addEventListener("mousemove",S.moveHandler,x),y?.addEventListener("mouseup",S.upHandler,x)),e.setColumnSizingInfo(k=>({...k,startOffset:u,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:c,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?Ab():(n=t.initialState.columnSizingInfo)!=null?n:Ab())},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 Hh=null;function SJ(){if(typeof Hh=="boolean")return Hh;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 Hh=t,Hh}function Rb(t){return t.type==="touchstart"}const wJ={getInitialState:t=>({columnVisibility:{},...t}),getDefaultOptions:t=>({onColumnVisibilityChange:Er("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=Ue(()=>[t.getAllCells(),e.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),Fe(e.options,"debugRows")),t.getVisibleCells=Ue(()=>[t.getLeftVisibleCells(),t.getCenterVisibleCells(),t.getRightVisibleCells()],(n,r,i)=>[...n,...r,...i],Fe(e.options,"debugRows"))},createTable:t=>{const e=(n,r)=>Ue(()=>[r(),r().filter(i=>i.getIsVisible()).map(i=>i.id).join("_")],i=>i.filter(s=>s.getIsVisible==null?void 0:s.getIsVisible()),Fe(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 ed(t,e){return e?e==="center"?t.getCenterVisibleLeafColumns():e==="left"?t.getLeftVisibleLeafColumns():t.getRightVisibleLeafColumns():t.getVisibleLeafColumns()}const xJ={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()}}},kJ={getInitialState:t=>({globalFilter:void 0,...t}),getDefaultOptions:t=>({onGlobalFilterChange:Er("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=()=>es.includesString,t.getGlobalFilterFn=()=>{var e,n;const{globalFilterFn:r}=t.options;return sg(r)?r:r==="auto"?t.getGlobalAutoFilterFn():(e=(n=t.options.filterFns)==null?void 0:n[r])!=null?e:es[r]},t.setGlobalFilter=e=>{t.options.onGlobalFilterChange==null||t.options.onGlobalFilterChange(e)},t.resetGlobalFilter=e=>{t.setGlobalFilter(e?void 0:t.initialState.globalFilter)}}},CJ={getInitialState:t=>({expanded:{},...t}),getDefaultOptions:t=>({onExpandedChange:Er("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(c=>{o[c]=!0}):o=r,n=(i=n)!=null?i:!s,!s&&n)return{...o,[t.id]:!0};if(s&&!n){const{[t.id]:c,...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()}}}},hS=0,pS=10,Mb=()=>({pageIndex:hS,pageSize:pS}),EJ={getInitialState:t=>({...t,pagination:{...Mb(),...t?.pagination}}),getDefaultOptions:t=>({onPaginationChange:Er("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=>ho(r,s);return t.options.onPaginationChange==null?void 0:t.options.onPaginationChange(i)},t.resetPagination=r=>{var i;t.setPagination(r?Mb():(i=t.initialState.pagination)!=null?i:Mb())},t.setPageIndex=r=>{t.setPagination(i=>{let s=ho(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?hS:(i=(s=t.initialState)==null||(s=s.pagination)==null?void 0:s.pageIndex)!=null?i:hS)},t.resetPageSize=r=>{var i,s;t.setPageSize(r?pS:(i=(s=t.initialState)==null||(s=s.pagination)==null?void 0:s.pageSize)!=null?i:pS)},t.setPageSize=r=>{t.setPagination(i=>{const s=Math.max(1,ho(r,i.pageSize)),o=i.pageSize*i.pageIndex,c=Math.floor(o/s);return{...i,pageIndex:c,pageSize:s}})},t.setPageCount=r=>t.setPagination(i=>{var s;let o=ho(r,(s=t.options.pageCount)!=null?s:-1);return typeof o=="number"&&(o=Math.max(-1,o)),{...i,pageCount:o}}),t.getPageOptions=Ue(()=>[t.getPageCount()],r=>{let i=[];return r&&r>0&&(i=[...new Array(r)].fill(null).map((s,o)=>o)),i},Fe(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}}},Ob=()=>({top:[],bottom:[]}),TJ={getInitialState:t=>({rowPinning:Ob(),...t}),getDefaultOptions:t=>({onRowPinningChange:Er("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}):[],c=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(w=>!(c!=null&&c.has(w))),bottom:[...((g=u?.bottom)!=null?g:[]).filter(w=>!(c!=null&&c.has(w))),...Array.from(c)]}}if(n==="top"){var y,S;return{top:[...((y=u?.top)!=null?y:[]).filter(w=>!(c!=null&&c.has(w))),...Array.from(c)],bottom:((S=u?.bottom)!=null?S:[]).filter(w=>!(c!=null&&c.has(w)))}}return{top:((f=u?.top)!=null?f:[]).filter(w=>!(c!=null&&c.has(w))),bottom:((h=u?.bottom)!=null?h:[]).filter(w=>!(c!=null&&c.has(w)))}})},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(c=>r?.includes(c)),o=n.some(c=>i?.includes(c));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:c}=o;return c});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?Ob():(n=(r=t.initialState)==null?void 0:r.rowPinning)!=null?n:Ob())},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 c=t.getRow(o,!0);return c.getIsAllParentsExpanded()?c:null}):(n??[]).map(o=>e.find(c=>c.id===o))).filter(Boolean).map(o=>({...o,position:r}))},t.getTopRows=Ue(()=>[t.getRowModel().rows,t.getState().rowPinning.top],(e,n)=>t._getPinnedRows(e,n,"top"),Fe(t.options,"debugRows")),t.getBottomRows=Ue(()=>[t.getRowModel().rows,t.getState().rowPinning.bottom],(e,n)=>t._getPinnedRows(e,n,"bottom"),Fe(t.options,"debugRows")),t.getCenterRows=Ue(()=>[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))},Fe(t.options,"debugRows"))}},_J={getInitialState:t=>({rowSelection:{},...t}),getDefaultOptions:t=>({onRowSelectionChange:Er("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=>{mS(i,s.id,r,!0,t)}),i}),t.getPreSelectedRowModel=()=>t.getCoreRowModel(),t.getSelectedRowModel=Ue(()=>[t.getState().rowSelection,t.getCoreRowModel()],(e,n)=>Object.keys(e).length?Nb(t,n):{rows:[],flatRows:[],rowsById:{}},Fe(t.options,"debugTable")),t.getFilteredSelectedRowModel=Ue(()=>[t.getState().rowSelection,t.getFilteredRowModel()],(e,n)=>Object.keys(e).length?Nb(t,n):{rows:[],flatRows:[],rowsById:{}},Fe(t.options,"debugTable")),t.getGroupedSelectedRowModel=Ue(()=>[t.getState().rowSelection,t.getSortedRowModel()],(e,n)=>Object.keys(e).length?Nb(t,n):{rows:[],flatRows:[],rowsById:{}},Fe(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 c={...s};return mS(c,t.id,n,(o=r?.selectChildren)!=null?o:!0,e),c})},t.getIsSelected=()=>{const{rowSelection:n}=e.getState();return wx(t,n)},t.getIsSomeSelected=()=>{const{rowSelection:n}=e.getState();return gS(t,n)==="some"},t.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=e.getState();return gS(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)}}}},mS=(t,e,n,r,i)=>{var s;const o=i.getRow(e,!0);n?(o.getCanMultiSelect()||Object.keys(t).forEach(c=>delete t[c]),o.getCanSelect()&&(t[e]=!0)):delete t[e],r&&(s=o.subRows)!=null&&s.length&&o.getCanSelectSubRows()&&o.subRows.forEach(c=>mS(t,c.id,n,r,i))};function Nb(t,e){const n=t.getState().rowSelection,r=[],i={},s=function(o,c){return o.map(u=>{var f;const h=wx(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 wx(t,e){var n;return(n=e[t.id])!=null?n:!1}function gS(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()&&(wx(o,e)?s=!0:i=!1),o.subRows&&o.subRows.length)){const c=gS(o,e);c==="all"?s=!0:(c==="some"&&(s=!0),i=!1)}}),i?"all":s?"some":!1}const yS=/([0-9]+)/gm,AJ=(t,e,n)=>E2(Oo(t.getValue(n)).toLowerCase(),Oo(e.getValue(n)).toLowerCase()),RJ=(t,e,n)=>E2(Oo(t.getValue(n)),Oo(e.getValue(n))),MJ=(t,e,n)=>xx(Oo(t.getValue(n)).toLowerCase(),Oo(e.getValue(n)).toLowerCase()),OJ=(t,e,n)=>xx(Oo(t.getValue(n)),Oo(e.getValue(n))),NJ=(t,e,n)=>{const r=t.getValue(n),i=e.getValue(n);return r>i?1:r<i?-1:0},DJ=(t,e,n)=>xx(t.getValue(n),e.getValue(n));function xx(t,e){return t===e?0:t>e?1:-1}function Oo(t){return typeof t=="number"?isNaN(t)||t===1/0||t===-1/0?"":String(t):typeof t=="string"?t:""}function E2(t,e){const n=t.split(yS).filter(Boolean),r=e.split(yS).filter(Boolean);for(;n.length&&r.length;){const i=n.shift(),s=r.shift(),o=parseInt(i,10),c=parseInt(s,10),u=[o,c].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>c)return 1;if(c>o)return-1}return n.length-r.length}const Tu={alphanumeric:AJ,alphanumericCaseSensitive:RJ,text:MJ,textCaseSensitive:OJ,datetime:NJ,basic:DJ},IJ={getInitialState:t=>({sorting:[],...t}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:t=>({onSortingChange:Er("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 Tu.datetime;if(typeof s=="string"&&(r=!0,s.split(yS).length>1))return Tu.alphanumeric}return r?Tu.text:Tu.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 sg(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:Tu[t.columnDef.sortingFn]},t.toggleSorting=(n,r)=>{const i=t.getNextSortingOrder(),s=typeof n<"u"&&n!==null;e.setSorting(o=>{const c=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?c?h="toggle":h="add":o!=null&&o.length&&u!==o.length-1?h="replace":c?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())}},LJ=[tJ,wJ,gJ,yJ,rJ,iJ,xJ,kJ,IJ,pJ,CJ,EJ,TJ,_J,bJ];function PJ(t){var e,n;const r=[...LJ,...(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=ho(g,i.options);i.options=o(y)},getState:()=>i.options.state,setState:g=>{i.options.onStateChange==null||i.options.onStateChange(g)},_getRowId:(g,y,S)=>{var w;return(w=i.options.getRowId==null?void 0:i.options.getRowId(g,y,S))!=null?w:`${S?[S.id,y].join("."):y}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(g,y)=>{let S=(y?i.getPrePaginationRowModel():i.getRowModel()).rowsById[g];if(!S&&(S=i.getCoreRowModel().rowsById[g],!S))throw new Error;return S},_getDefaultColumnDef:Ue(()=>[i.options.defaultColumn],g=>{var y;return g=(y=g)!=null?y:{},{header:S=>{const w=S.header.column.columnDef;return w.accessorKey?w.accessorKey:w.accessorFn?w.id:null},cell:S=>{var w,x;return(w=(x=S.renderValue())==null||x.toString==null?void 0:x.toString())!=null?w:null},...i._features.reduce((S,w)=>Object.assign(S,w.getDefaultColumnDef==null?void 0:w.getDefaultColumnDef()),{}),...g}},Fe(t,"debugColumns")),_getColumnDefs:()=>i.options.columns,getAllColumns:Ue(()=>[i._getColumnDefs()],g=>{const y=function(S,w,x){return x===void 0&&(x=0),S.map(k=>{const T=eJ(i,k,x,w),A=k;return T.columns=A.columns?y(A.columns,T,x+1):[],T})};return y(g)},Fe(t,"debugColumns")),getAllFlatColumns:Ue(()=>[i.getAllColumns()],g=>g.flatMap(y=>y.getFlatColumns()),Fe(t,"debugColumns")),_getAllFlatColumnsById:Ue(()=>[i.getAllFlatColumns()],g=>g.reduce((y,S)=>(y[S.id]=S,y),{}),Fe(t,"debugColumns")),getAllLeafColumns:Ue(()=>[i.getAllColumns(),i._getOrderColumnsFn()],(g,y)=>{let S=g.flatMap(w=>w.getLeafColumns());return y(S)},Fe(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 zJ(){return t=>Ue(()=>[t.options.data],e=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(i,s,o){s===void 0&&(s=0);const c=[];for(let f=0;f<i.length;f++){const h=nJ(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,c.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 c};return n.rows=r(e),n},Fe(t.options,"debugTable","getRowModel",()=>t._autoResetPageIndex()))}function _R(t,e){return t?jJ(t)?R.createElement(t,e):t:null}function jJ(t){return BJ(t)||typeof t=="function"||$J(t)}function BJ(t){return typeof t=="function"&&(()=>{const e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}function $J(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}function VJ(t){const e={state:{},onStateChange:()=>{},renderFallbackValue:null,...t},[n]=R.useState(()=>({current:PJ(e)})),[r,i]=R.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 HJ({uploads:t,canCreate:e,fieldLabels:n,onClose:r,onUpload:i,onCreateFromUploads:s}){const o=R.useMemo(()=>Object.keys(t),[t]),[c,u]=R.useState(o[0]??""),[f,h]=R.useState(!!e),[m,g]=R.useState([]),[y,S]=R.useState(null),w=t[c];return R.useEffect(()=>{!o.includes(c)&&o[0]&&u(o[0])},[c,o]),R.useEffect(()=>{const x=T=>{T.key==="Escape"&&r()};window.addEventListener("keydown",x);const k=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",x),document.body.style.overflow=k}},[r]),w?C.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:r,children:C.jsxs("div",{className:"vertebr-modal vertebr-modal-sm",role:"dialog","aria-modal":"true","aria-label":"Bulk image upload",onClick:x=>x.stopPropagation(),children:[C.jsxs("header",{className:"vertebr-modal-head",children:[C.jsxs("div",{className:"vertebr-modal-heading",children:[C.jsx("p",{className:"vertebr-modal-eyebrow",children:"Media"}),C.jsx("h2",{children:"Bulk image upload"})]}),C.jsx("button",{type:"button",className:"vertebr-btn",onClick:r,children:"Close"})]}),C.jsxs("div",{className:"vertebr-modal-body",children:[o.length>1?C.jsxs("label",{className:"vertebr-field",children:[C.jsx("span",{children:"Target field"}),C.jsx("select",{className:"vertebr-native-select",value:c,onChange:x=>{u(x.target.value),g([]),S(null)},children:o.map(x=>C.jsx("option",{value:x,children:n[x]??x},x))})]}):null,e&&s?C.jsxs("label",{className:"vertebr-upload-check",children:[C.jsx("input",{type:"checkbox",checked:f,onChange:x=>h(x.target.checked)}),C.jsx("span",{children:"Create a record for each uploaded image"})]}):null,C.jsx(Id,{meta:w,multiple:!0,onUpload:async x=>{S(`Uploading ${x.length} image${x.length===1?"":"s"}…`);const k=await i(c,x);g(k),f&&s?(S("Creating records…"),await s(c,k),S(`Uploaded ${k.length} and created records.`)):S(`Uploaded ${k.length} image${k.length===1?"":"s"}.`)}}),y?C.jsx("p",{className:"vertebr-upload-status",children:y}):null,m.length>0?C.jsx("ul",{className:"vertebr-upload-results",children:m.map(x=>C.jsxs("li",{children:[C.jsx("img",{src:x.url,alt:""}),C.jsxs("div",{children:[C.jsx("strong",{children:x.name??"Image"}),C.jsx("a",{href:x.url,target:"_blank",rel:"noreferrer",children:x.url})]})]},x.url))}):null]})]})}):null}function UJ({columns:t,visibility:e,onChange:n}){const[r,i]=R.useState(!1),s=R.useRef(null),o=R.useId(),c=t.filter(f=>e[f.id]===!1).length;R.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-c;return C.jsxs("div",{className:"vertebr-col-menu",ref:s,children:[C.jsxs("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet","aria-expanded":r,"aria-controls":o,onClick:()=>i(f=>!f),children:["Columns",c>0?C.jsx("span",{className:"vertebr-col-menu-count",children:u}):null]}),r?C.jsxs("div",{className:"vertebr-col-menu-panel",id:o,role:"menu",children:[C.jsxs("div",{className:"vertebr-col-menu-head",children:[C.jsx("span",{children:"Visible fields"}),C.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"})]}),C.jsx("ul",{className:"vertebr-col-menu-list",children:t.map(f=>{const h=e[f.id]!==!1;return C.jsx("li",{children:C.jsxs("label",{className:"vertebr-col-menu-item",children:[C.jsx("input",{type:"checkbox",checked:h,disabled:h&&u<=1,onChange:()=>{const m={...e,[f.id]:!h};n(m)}}),C.jsx("span",{children:f.label})]})},f.id)})})]}):null]})}const FJ=/(image|img|photo|avatar|thumbnail|thumb|cover)/i,AR=/(url|href|link|src)/i,qJ=/\.(png|jpe?g|gif|webp|svg|avif)(\?|#|$)/i;function vS(t){return/^https?:\/\//i.test(t)||t.startsWith("//")}function RR(t){return vS(t)?qJ.test(t)?!0:/(image|img|media|cdn|photo)/i.test(t):!1}function MR(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 bS({fieldKey:t,field:e,value:n,variant:r="table"}){const i=r==="detail";if(n==null||n==="")return C.jsx("span",{className:"vertebr-cell-empty",children:"—"});const s=e?.type;if(s==="boolean"||typeof n=="boolean"){const c=!!n;return C.jsx("span",{className:"vertebr-badge","data-tone":c?"ok":"neutral",children:c?"Active":"Off"})}if(s==="datetime"){const c=MR(n);if(c)return C.jsx("span",{className:"vertebr-cell-datetime",children:c})}if((s==="number"||typeof n=="number")&&typeof n=="number"&&Number.isFinite(n))return nw(t,e)?C.jsx("span",{className:"vertebr-cell-money",children:u0(n,{asCents:!0})}):NO(t,e)?C.jsx("span",{className:"vertebr-cell-money",children:u0(n,{asCents:!1})}):C.jsx("span",{className:"vertebr-cell-number",children:new Intl.NumberFormat().format(n)});if(Array.isArray(n)){if(n.length===0)return C.jsx("span",{className:"vertebr-cell-empty",children:"—"});if(n.every(c=>typeof c=="string"))return C.jsx("div",{className:"vertebr-chip-row",children:n.map(c=>C.jsx("span",{className:"vertebr-chip",children:c},c))})}if(typeof n=="string")return(FJ.test(t)||AR.test(t)&&RR(n)||RR(n))&&vS(n)?C.jsxs("a",{className:i?"vertebr-cell-media vertebr-cell-media-detail":"vertebr-cell-media",href:n,target:"_blank",rel:"noreferrer",title:n,onClick:u=>u.stopPropagation(),children:[C.jsx("img",{src:n,alt:"",loading:"lazy"}),i?C.jsx("span",{className:"vertebr-cell-link",children:n}):C.jsx("span",{className:"vertebr-cell-truncate",children:n})]}):AR.test(t)||vS(n)?C.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)?C.jsx("span",{className:"vertebr-cell-clamp",title:n,children:n}):i&&(s==="richtext"||n.length>80)?C.jsx("p",{className:"vertebr-cell-prose",children:n}):C.jsx("span",{className:"vertebr-cell-text",children:n});const o=MR(n);return o?C.jsx("span",{className:"vertebr-cell-datetime",children:o}):typeof n=="object"?C.jsx("code",{className:"vertebr-cell-json",title:JSON.stringify(n),children:JSON.stringify(n)}):C.jsx("span",{className:"vertebr-cell-text",children:String(n)})}function GJ({title:t,schema:e,value:n,uploads:r,onUpload:i,galleryUpload:s,onListGallery:o,onUploadGallery:c,onClose:u,onCreate:f}){return R.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]),C.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:u,children:C.jsxs("div",{className:"vertebr-modal vertebr-modal-form",role:"dialog","aria-modal":"true","aria-label":t,onClick:h=>h.stopPropagation(),children:[C.jsxs("header",{className:"vertebr-modal-head",children:[C.jsxs("div",{className:"vertebr-modal-heading",children:[C.jsx("p",{className:"vertebr-modal-eyebrow",children:"New record"}),C.jsx("h2",{children:t})]}),C.jsx("div",{className:"vertebr-modal-actions",children:C.jsx("button",{type:"button",className:"vertebr-btn",onClick:u,"aria-label":"Close",children:"Close"})})]}),C.jsx("div",{className:"vertebr-modal-body",children:C.jsx(bx,{variant:"record",schema:e,value:n,uploads:r,onUpload:i,galleryUpload:s,onListGallery:o,onUploadGallery:c,submitLabel:t,onSave:async h=>{await f(h),u()}})})]})})}function WJ(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\bcents\b/i,"").trim()}function KJ(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 ZJ({schema:t,row:e,title:n,canEdit:r,onClose:i,onEdit:s}){const o=Object.keys(t),c=o.length>0?o.map(f=>[f,e[f]]):Object.entries(e),u=KJ(t,e);return R.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]),C.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:i,children:C.jsxs("div",{className:"vertebr-modal",role:"dialog","aria-modal":"true","aria-label":n,onClick:f=>f.stopPropagation(),children:[C.jsxs("header",{className:"vertebr-modal-head",children:[C.jsxs("div",{className:"vertebr-modal-heading",children:[C.jsx("p",{className:"vertebr-modal-eyebrow",children:"Record"}),C.jsx("h2",{children:n})]}),C.jsxs("div",{className:"vertebr-modal-actions",children:[r&&s?C.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-primary",onClick:s,children:"Edit"}):null,C.jsx("button",{type:"button",className:"vertebr-btn",onClick:i,"aria-label":"Close",children:"Close"})]})]}),C.jsxs("div",{className:"vertebr-modal-body",children:[u?C.jsx("div",{className:"vertebr-modal-hero",children:C.jsx("img",{src:u,alt:""})}):null,C.jsx("dl",{className:"vertebr-modal-fields",children:c.map(([f,h])=>C.jsxs("div",{className:"vertebr-modal-field",children:[C.jsx("dt",{children:t[f]?.label??WJ(f)}),C.jsx("dd",{children:C.jsx(bS,{fieldKey:f,field:t[f],value:h,variant:"detail"})})]},f))})]})]})})}function OR(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 Db(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\bcents\b/i,"").trim()}function NR(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 DR(t){if(!t||typeof localStorage>"u")return{};try{const e=localStorage.getItem(`vertebr:columns:${t}`);if(!e)return{};const n=JSON.parse(e);return!n||typeof n!="object"?{}:n}catch{return{}}}function YJ(t,e){if(!(!t||typeof localStorage>"u"))try{localStorage.setItem(`vertebr:columns:${t}`,JSON.stringify(e))}catch{}}function XJ(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 JJ(t){return t.replace(/\.[^.]+$/,"").replace(/[_-]+/g," ").replace(/\s+/g," ").trim()}function QJ({schema:t,items:e,permissions:n,actions:r={},label:i,uploads:s,rowIdKeys:o=["id","slug","uid","email"],storageKey:c,onUpdate:u,onCreate:f,onDelete:h,onAction:m,onUpload:g,galleryUpload:y,onListGallery:S,onUploadGallery:w}){const[x,k]=R.useState(null),[T,A]=R.useState(!1),[_,O]=R.useState(null),[N,I]=R.useState(!1),[z,q]=R.useState(null),Z=R.useRef(null),[ae,X]=R.useState({overflow:!1,canLeft:!1,canRight:!1}),[te,ie]=R.useState(()=>DR(c)),de=!!(n?.update&&u),B=!!(n?.create&&f),Y=!!(n?.delete&&h),oe=XJ(i),ye=!!(s&&g&&Object.keys(s).length),ke=Object.entries(r),P=Object.keys(t);R.useEffect(()=>{ie(DR(c))},[c]),R.useEffect(()=>{YJ(c,te)},[c,te]);const W=R.useCallback(()=>{const xe=Z.current;if(!xe){X({overflow:!1,canLeft:!1,canRight:!1});return}const be=xe.scrollWidth>xe.clientWidth+2;X({overflow:be,canLeft:be&&xe.scrollLeft>2,canRight:be&&xe.scrollLeft+xe.clientWidth<xe.scrollWidth-2})},[]);R.useEffect(()=>{const xe=Z.current;if(!xe)return;W();const be=()=>W();xe.addEventListener("scroll",be,{passive:!0});const nt=new ResizeObserver(W);return nt.observe(xe),()=>{xe.removeEventListener("scroll",be),nt.disconnect()}},[W,e.length,te]);const ce=xe=>{const be=Z.current;if(!be)return;const nt=Math.max(220,Math.round(be.clientWidth*.55));be.scrollBy({left:xe==="left"?-nt:nt,behavior:"smooth"})},me=R.useMemo(()=>P.map(xe=>({id:xe,label:t[xe]?.label??Db(xe)})),[P,t]),Ae=R.useMemo(()=>{const xe=P.length===0?[{id:"raw",header:"Item",cell:({row:be})=>C.jsx(bS,{fieldKey:"raw",value:be.original})}]:P.map(be=>{const nt=t[be],Dt=/(image|img|photo|avatar|thumbnail|thumb|cover)/i.test(be)||/(image|img|photo)/i.test(nt?.label??"");return{id:be,accessorKey:be,header:nt?.label??Db(be),meta:{fieldKey:be,field:nt},cell:({getValue:Un})=>C.jsx(bS,{fieldKey:be,field:nt,value:Un()}),size:Dt?220:void 0}});return xe.push({id:"_actions",header:()=>C.jsx("span",{className:"vertebr-sr-only",children:"Actions"}),enableHiding:!1,cell:({row:be})=>{const nt=OR(be.original,o);return C.jsxs("div",{className:"vertebr-row-actions",onClick:Dt=>Dt.stopPropagation(),onKeyDown:Dt=>Dt.stopPropagation(),children:[C.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>O(be.original),children:"View"}),de?C.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>k(be.original),children:"Edit"}):null,nt?ke.map(([Dt,Un])=>C.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:z===`${nt}:${Dt}`,onClick:()=>{m&&(q(`${nt}:${Dt}`),m(nt,Dt).finally(()=>q(null)))},children:Un.label},Dt)):null,Y&&nt?C.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?.(nt)},children:"Delete"}):null]})}}),xe},[t,P,de,Y,ke,z,m,h,o]),Le=VJ({data:e,columns:Ae,state:{columnVisibility:te},onColumnVisibilityChange:ie,getCoreRowModel:zJ()}),He=x?OR(x,o):null,Ce=Object.fromEntries(Object.entries(t).filter(([,xe])=>!xe.readOnly||xe.required).map(([xe,be])=>[xe,be.readOnly?{...be,readOnly:!1}:be])),Ie=Object.fromEntries(Object.entries(Ce).map(([xe,be])=>[xe,be.default??(be.type==="boolean"?!1:be.type==="number"?void 0:be.type==="file[]"?[]:"")]));if(x&&He&&u){const xe=Object.fromEntries(Object.entries(t).filter(([,nt])=>!nt.readOnly)),be=NR(x,o);return C.jsxs("div",{className:"vertebr-resource-edit",children:[C.jsxs("div",{className:"vertebr-resource-edit-head",children:[C.jsxs("div",{className:"vertebr-resource-edit-heading",children:[C.jsx("p",{className:"vertebr-resource-edit-eyebrow",children:"Editing record"}),C.jsx("h2",{children:be}),C.jsx("p",{className:"vertebr-resource-edit-id",children:He})]}),C.jsx("button",{type:"button",className:"vertebr-btn",onClick:()=>k(null),children:"Back"})]}),C.jsx(bx,{variant:"record",schema:xe,value:x,uploads:s,onUpload:g,galleryUpload:y,onListGallery:S,onUploadGallery:w,onSave:async nt=>{await u(He,nt),k(null)}})]})}const ct=C.jsxs("div",{className:"vertebr-table-toolbar",children:[C.jsxs("div",{className:"vertebr-table-toolbar-start",children:[me.length>0?C.jsx(UJ,{columns:me,visibility:te,onChange:ie}):null,ye?C.jsxs("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-icon",onClick:()=>I(!0),children:[C.jsx(rQ,{}),"Bulk upload"]}):null]}),ae.overflow?C.jsxs("div",{className:"vertebr-table-scroll-controls",role:"group","aria-label":"Scroll columns",children:[C.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-icon vertebr-table-scroll-btn",disabled:!ae.canLeft,onClick:()=>ce("left"),"aria-label":"Scroll columns left",children:C.jsx(tQ,{})}),C.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-icon vertebr-table-scroll-btn",disabled:!ae.canRight,onClick:()=>ce("right"),"aria-label":"Scroll columns right",children:C.jsx(nQ,{})})]}):null]}),Ke=N&&s&&g?C.jsx(HJ,{uploads:s,canCreate:B,fieldLabels:Object.fromEntries(Object.keys(s).map(xe=>[xe,t[xe]?.label??Db(xe)])),onClose:()=>I(!1),onUpload:g,onCreateFromUploads:B&&f?async(xe,be)=>{for(const nt of be){const Dt=JJ(nt.name??"Image");await f({[xe]:nt.url,name:Dt,title:Dt})}}:void 0}):null,Xe=T&&f?C.jsx(GJ,{title:oe,schema:Ce,value:Ie,uploads:s,onUpload:g,galleryUpload:y,onListGallery:S,onUploadGallery:w,onClose:()=>A(!1),onCreate:f}):null,ut=C.jsxs("div",{className:"vertebr-panel-head",children:[C.jsx("h2",{children:"Records"}),C.jsxs("div",{className:"vertebr-panel-head-actions",children:[B?C.jsxs("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-icon",onClick:()=>A(!0),children:[C.jsx(eQ,{}),oe]}):null,C.jsx("span",{className:"vertebr-count",children:e.length})]})]});return e.length===0?C.jsxs("div",{className:"vertebr-resource-body",children:[ut,ye||me.length>0?ct:null,C.jsx("div",{className:"vertebr-empty",children:"No rows yet."}),Ke,Xe]}):C.jsxs("div",{className:"vertebr-resource-body",children:[ut,ct,C.jsx("div",{className:"vertebr-table-wrap",ref:Z,"data-overflow":ae.overflow?"true":void 0,"data-overflow-left":ae.canLeft?"true":void 0,"data-overflow-right":ae.canRight?"true":void 0,children:C.jsxs("table",{className:"vertebr-table",children:[C.jsx("thead",{children:Le.getHeaderGroups().map(xe=>C.jsx("tr",{children:xe.headers.map(be=>C.jsx("th",{className:be.column.id==="_actions"?"vertebr-col-actions":void 0,children:be.isPlaceholder?null:_R(be.column.columnDef.header,be.getContext())},be.id))},xe.id))}),C.jsx("tbody",{children:Le.getRowModel().rows.map(xe=>C.jsx("tr",{className:"vertebr-table-row-clickable",tabIndex:0,onClick:()=>O(xe.original),onKeyDown:be=>{(be.key==="Enter"||be.key===" ")&&(be.preventDefault(),O(xe.original))},children:xe.getVisibleCells().map(be=>C.jsx("td",{className:be.column.id==="_actions"?"vertebr-col-actions":void 0,children:_R(be.column.columnDef.cell,be.getContext())},be.id))},xe.id))})]})}),_?C.jsx(ZJ,{schema:t,row:_,title:NR(_,o),canEdit:de,onClose:()=>O(null),onEdit:()=>{k(_),O(null)}}):null,Ke,Xe]})}function eQ(){return C.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:[C.jsx("path",{d:"M12 5v14"}),C.jsx("path",{d:"M5 12h14"})]})}function tQ(){return C.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:C.jsx("path",{d:"m15 18-6-6 6-6"})})}function nQ(){return C.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:C.jsx("path",{d:"m9 18 6-6-6-6"})})}function rQ(){return C.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:[C.jsx("path",{d:"M16 5h6"}),C.jsx("path",{d:"M19 2v6"}),C.jsx("rect",{x:"3",y:"7",width:"14",height:"14",rx:"2"}),C.jsx("circle",{cx:"8.5",cy:"12.5",r:"1.5"}),C.jsx("path",{d:"m17 21-4.5-4.5L7 21"})]})}function iQ({theme:t,onChange:e}){return C.jsxs("div",{className:"vertebr-theme",children:[C.jsx("div",{className:"vertebr-nav-label",children:"Appearance"}),C.jsxs("div",{className:"vertebr-theme-toggle",role:"group","aria-label":"Color theme",children:[C.jsxs("button",{type:"button",className:"vertebr-theme-option","data-active":t==="light","aria-pressed":t==="light",onClick:()=>e("light"),children:[C.jsx(sQ,{}),"Light"]}),C.jsxs("button",{type:"button",className:"vertebr-theme-option","data-active":t==="dark","aria-pressed":t==="dark",onClick:()=>e("dark"),children:[C.jsx(oQ,{}),"Dark"]})]})]})}function sQ(){return C.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:[C.jsx("circle",{cx:"12",cy:"12",r:"4"}),C.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 oQ(){return C.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:C.jsx("path",{d:"M21 14.5A8.5 8.5 0 0 1 9.5 3 7 7 0 1 0 21 14.5z"})})}const aQ="vertebr:theme";function lQ(t){try{const e=localStorage.getItem(t);if(e==="light"||e==="dark")return e}catch{}return null}function cQ(t,e){try{localStorage.setItem(t,e)}catch{}}function uQ(t){document.documentElement.setAttribute("data-vb-theme",t)}function dQ(t=aQ){const[e,n]=R.useState(()=>lQ(t)??"dark");R.useEffect(()=>{uQ(e),cQ(t,e)},[e,t]);const r=R.useCallback(s=>{n(s)},[]),i=R.useCallback(()=>{n(s=>s==="dark"?"light":"dark")},[]);return{theme:e,setTheme:r,toggleTheme:i}}function IR(t){try{return localStorage.getItem(t)}catch{return null}}function Ib(t,e){try{localStorage.setItem(t,e)}catch{}}function LR(t){try{localStorage.removeItem(t)}catch{}}function fQ({apiBase:t="/admin/api",title:e="Control plane",envStorageKey:n="vertebr:env",tokenStorageKey:r="vertebr:token",themeStorageKey:i="vertebr:theme",getAccessToken:s,authUserLabel:o,onSignOut:c}){const{theme:u,setTheme:f}=dQ(i),[h,m]=R.useState(()=>IR(n)??""),[g,y]=R.useState(()=>IR(r)??""),[S,w]=R.useState(g),x=R.useCallback(()=>h,[h]),k=R.useMemo(()=>Ub({apiBase:t,getEnvironment:x,getAccessToken:s??(()=>g||null)}),[t,x,s,g]),[T,A]=R.useState(null),[_,O]=R.useState(null),[N,I]=R.useState({kind:"overview"}),[z,q]=R.useState(null),[Z,ae]=R.useState(null),[X,te]=R.useState(null),[ie,de]=R.useState(!1),[B,Y]=R.useState(null),[oe,ye]=R.useState(!1),[ke,P]=R.useState(null),[W,ce]=R.useState(!0);R.useEffect(()=>{let le=!1;return(async()=>{try{const Pe=await k.getBootstrap();if(le)return;A(Pe);const jt=Pe.environments.map(ks=>ks.id),Qn=h&&jt.includes(h)&&h||Pe.defaultEnvironment;Qn!==h&&(m(Qn),Ib(n,Qn))}catch(Pe){le||P(Pe instanceof Error?Pe.message:"Failed to load bootstrap")}})(),()=>{le=!0}},[k,h,n]),R.useEffect(()=>{if(!T||!h)return;let le=!1;return(async()=>{try{ce(!0),P(null);const Pe=await k.getCatalog();if(le)return;O(Pe),I(jt=>{if(jt?.kind==="overview"||jt?.kind==="gallery"&&Pe.gallery||jt?.kind==="resource"&&Pe.resources.some(en=>en.id===jt.id)||jt?.kind==="config"&&Pe.configs.some(en=>en.id===jt.id))return jt;if(Pe.metrics)return{kind:"overview"};const Qn=Pe.resources[0];if(Qn)return{kind:"resource",id:Qn.id};if(Pe.gallery)return{kind:"gallery"};const ks=Pe.configs[0];return ks?{kind:"config",id:ks.id}:{kind:"overview"}})}catch(Pe){le||(O(null),P(Pe instanceof Error?Pe.message:"Failed to load catalog"))}finally{le||ce(!1)}})(),()=>{le=!0}},[k,T,h]),R.useEffect(()=>{if(!N||!_)return;let le=!1;return(async()=>{try{if(P(null),N.kind==="overview"){de(!0);const Pe=await k.getMetrics();le||(te(Pe),q(null),ae(null),Y(null))}else if(N.kind==="gallery"){ye(!0);const Pe=await k.getGallery();le||(Y(Pe),q(null),ae(null),te(null))}else if(N.kind==="resource"){const Pe=await k.listResource(N.id);le||(q(Pe),ae(null),te(null),Y(null))}else{const Pe=await k.getConfig(N.id);le||(ae(Pe),q(null),te(null),Y(null))}}catch(Pe){le||P(Pe instanceof Error?Pe.message:"Failed to load panel")}finally{le||(de(!1),ye(!1))}})(),()=>{le=!0}},[k,N,_,h]);const me=R.useCallback(async()=>{if(N?.kind!=="resource")return;const le=await k.listResource(N.id);q(le)},[k,N]),Ae=R.useCallback(async()=>{de(!0);try{const le=await k.getMetrics();te(le)}finally{de(!1)}},[k]),Le=R.useCallback(async()=>{ye(!0);try{const le=await k.getGallery({fresh:!0});Y(le)}finally{ye(!1)}},[k]),He=R.useCallback(async()=>(await k.getGallery()).items,[k]),Ce=R.useCallback(async le=>{if(le.length===1&&le[0]){const{item:jt}=await k.uploadGalleryFile(le[0]);return[jt]}const{items:Pe}=await k.uploadGalleryFiles(le);return Pe},[k]),Ie=_?.gallery?{galleryUpload:{accept:_.gallery.accept,maxBytes:_.gallery.maxBytes},onListGallery:He,onUploadGallery:Ce}:{},ct=_?.environments??T?.environments??[],Ke=ct.find(le=>le.id===h),Xe=!!Ke?.auth?.required,xe=(N?.kind==="config"?_?.configs.find(le=>le.id===N.id):void 0)?.section==="page",be=le=>{if(le===h)return;const Pe=ct.find(jt=>jt.id===le);Pe?.tone==="danger"&&!window.confirm(`Switch to ${Pe.label}? Writes will affect this environment.`)||(Ib(n,le),m(le),q(null),ae(null),Y(null))},nt=()=>{const le=S.trim();y(le),le?Ib(r,le):LR(r)},Dt=()=>{y(""),w(""),LR(r)};if(!T&&W)return C.jsx("div",{className:"vertebr-loading",children:"Loading Vertebr…"});if(ke&&!T)return C.jsx("div",{className:"vertebr-error",children:ke});const Un=N?.kind==="overview"?_?.metrics?.label??"Overview":N?.kind==="gallery"?_?.gallery?.label??"Gallery":N?.kind==="resource"?_?.resources.find(le=>le.id===N.id)?.label:N?.kind==="config"?_?.configs.find(le=>le.id===N.id)?.label:null;return C.jsxs("div",{className:"vertebr-root","data-env":h,children:[C.jsxs("aside",{className:"vertebr-sidebar",children:[C.jsxs("div",{className:"vertebr-sidebar-top",children:[C.jsxs("div",{className:"vertebr-brand",children:[C.jsx("strong",{children:T?.brand??_?.brand??"Vertebr"}),C.jsx("span",{children:e})]}),ct.length>0?C.jsxs("div",{className:"vertebr-env",children:[C.jsx("div",{className:"vertebr-nav-label",children:"Environment"}),C.jsx(GX,{environments:ct,value:h,onChange:be})]}):null,C.jsxs("nav",{className:"vertebr-nav",children:[_?.metrics?C.jsxs("div",{className:"vertebr-nav-group",children:[C.jsx("div",{className:"vertebr-nav-label",children:"Analytics"}),C.jsx("button",{type:"button","data-active":N?.kind==="overview",onClick:()=>I({kind:"overview"}),children:_.metrics.label})]}):null,_&&(_.resources.length>0||_.gallery)?C.jsxs("div",{className:"vertebr-nav-group",children:[C.jsx("div",{className:"vertebr-nav-label",children:"Resources"}),_.resources.map(le=>C.jsx("button",{type:"button","data-active":N?.kind==="resource"&&N.id===le.id,onClick:()=>I({kind:"resource",id:le.id}),children:le.label},le.id)),_.gallery?C.jsx("button",{type:"button","data-active":N?.kind==="gallery",onClick:()=>I({kind:"gallery"}),children:_.gallery.label}):null]}):null,_&&_.configs.some(le=>(le.section??"config")!=="page")?C.jsxs("div",{className:"vertebr-nav-group",children:[C.jsx("div",{className:"vertebr-nav-label",children:"Config"}),_.configs.filter(le=>(le.section??"config")!=="page").map(le=>C.jsx("button",{type:"button","data-active":N?.kind==="config"&&N.id===le.id,onClick:()=>I({kind:"config",id:le.id}),children:le.label},le.id))]}):null,_&&_.configs.some(le=>le.section==="page")?C.jsxs("div",{className:"vertebr-nav-group",children:[C.jsx("div",{className:"vertebr-nav-label",children:"Pages"}),_.configs.filter(le=>le.section==="page").map(le=>C.jsx("button",{type:"button","data-active":N?.kind==="config"&&N.id===le.id,onClick:()=>I({kind:"config",id:le.id}),children:le.label},le.id))]}):null]})]}),C.jsxs("div",{className:"vertebr-sidebar-bottom",children:[s&&o?C.jsxs("div",{className:"vertebr-auth",children:[C.jsx("div",{className:"vertebr-nav-label",children:"Signed in"}),C.jsx("p",{className:"vertebr-auth-hint",children:o}),c?C.jsx("button",{type:"button",className:"vertebr-btn",onClick:()=>{c()},children:"Sign out"}):null]}):null,!s&&(Xe||g)?C.jsxs("div",{className:"vertebr-auth",children:[C.jsx("div",{className:"vertebr-nav-label",children:"Access"}),C.jsx("p",{className:"vertebr-auth-hint",children:Xe?`This environment requires auth${Ke?.auth?.claimKey?` (${Ke.auth.claimKey})`:""}.`:"Optional access token for protected environments."}),C.jsx("input",{className:"vertebr-auth-input",type:"password",placeholder:"Bearer token",value:S,onChange:le=>w(le.target.value),autoComplete:"off"}),C.jsxs("div",{className:"vertebr-auth-actions",children:[C.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-primary",onClick:nt,children:"Use token"}),g?C.jsx("button",{type:"button",className:"vertebr-btn",onClick:Dt,children:"Clear"}):null]})]}):null,C.jsx(iQ,{theme:u,onChange:f})]})]}),C.jsxs("main",{className:"vertebr-main",children:[C.jsxs("header",{className:"vertebr-header",children:[C.jsxs("div",{children:[C.jsxs("div",{className:"vertebr-heading-row",children:[C.jsx("h1",{children:Un??(_?"Dashboard":"Sign in")}),Ke?C.jsx("span",{className:"vertebr-env-badge","data-tone":Ke.tone??"neutral",children:Ke.label}):null]}),C.jsx("p",{children:!_&&Xe?"Provide an access token to load this environment.":N?.kind==="overview"?"Live metrics for the selected environment.":N?.kind==="gallery"?"Browse and upload shared media assets.":N?.kind==="resource"?"Manage records scoped to the selected environment.":N?.kind==="config"?xe?"Edit content for this page.":"Owner-managed config for this environment.":"Select a panel."})]}),ke?C.jsx("span",{className:"vertebr-status","data-tone":"danger",children:ke}):null]}),C.jsx("div",{className:"vertebr-content",children:_?C.jsxs("section",{className:"vertebr-panel",children:[N?.kind==="overview"?C.jsx(YX,{label:X?.label??_.metrics?.label,metrics:X?.metrics??[],loading:ie,onRefresh:()=>{Ae()}}):null,N?.kind==="gallery"&&B?C.jsx(ZX,{label:B.label,items:B.items,accept:B.accept,maxBytes:B.maxBytes,canDelete:B.canDelete,loading:oe,onRefresh:()=>{Le()},onUpload:async le=>{le.length===1&&le[0]?await k.uploadGalleryFile(le[0]):await k.uploadGalleryFiles(le),await Le()},onDelete:B.canDelete?async le=>{await k.deleteGalleryItem(le),await Le()}:void 0}):null,N?.kind==="resource"&&z?C.jsx(QJ,{schema:z.schema,items:z.items,label:z.label,permissions:z.permissions,actions:z.actions,uploads:z.uploads,storageKey:z.id,onUpdate:z.permissions.update?async(le,Pe)=>{await k.updateResource(z.id,le,Pe),await me()}:void 0,onCreate:z.permissions.create?async le=>{await k.createResource(z.id,le),await me()}:void 0,onDelete:z.permissions.delete?async le=>{await k.deleteResource(z.id,le),await me()}:void 0,onAction:async(le,Pe)=>{await k.runResourceAction(z.id,le,Pe),await me()},onUpload:z.uploads?async(le,Pe)=>{if(Pe.length===1&&Pe[0]){const Qn=await k.uploadResourceFile(z.id,le,Pe[0]);return[{url:Qn.url,name:Qn.name}]}return(await k.uploadResourceFiles(z.id,le,Pe)).files}:void 0,...Ie}):null,N?.kind==="config"&&Z?C.jsxs(C.Fragment,{children:[C.jsxs("div",{className:"vertebr-panel-head",children:[C.jsx("h2",{children:xe?"Page content":"Settings"}),C.jsxs("span",{className:"vertebr-count",children:[Object.keys(Z.schema).length," fields"]})]}),C.jsx(bx,{schema:Z.schema,value:Z.value,onSave:async le=>{const Pe=await k.setConfig(Z.id,le);ae({...Z,value:Pe.value})},...Ie})]}):null]}):C.jsx("section",{className:"vertebr-panel",children:C.jsx("div",{className:"vertebr-empty",children:Xe?"Authenticated access required for this environment.":W?"Loading…":"Unable to load catalog."})})})]})]})}R.createContext(null);R.createContext(null);const Lb="/admin/api";function hQ(t){const e=t.environments.map(r=>r.auth?.client).find(r=>r?.provider==="firebase");if(!e)return null;const n=mB().length?YR():ZR(e.config);return j3(n)}function pQ(){const[t,e]=R.useState(null),[n,r]=R.useState(null),[i,s]=R.useState(null),[o,c]=R.useState(!1),[u,f]=R.useState("idle"),[h,m]=R.useState(""),[g,y]=R.useState(""),[S,w]=R.useState(null),[x,k]=R.useState(!1),T=R.useMemo(()=>Ub({apiBase:Lb,getEnvironment:()=>""}),[]);R.useEffect(()=>{let N=!1;return T.getBootstrap().then(I=>{if(N)return;e(I);const z=hQ(I);r(z),z||c(!0)}).catch(I=>{N||(w(I instanceof Error?I.message:"Could not load auth"),c(!0))}),()=>{N=!0}},[T]),R.useEffect(()=>{if(n)return _$(n,N=>{s(N),f(N?"checking":"idle"),c(!0)})},[n]),R.useEffect(()=>{if(!t||!i)return;let N=!1;return(async()=>{f("checking");const I=localStorage.getItem("vertebr:env"),z=[...I?[I]:[],...t.environments.map(q=>q.id)].filter((q,Z,ae)=>ae.indexOf(q)===Z);for(const q of z)try{await Ub({apiBase:Lb,getEnvironment:()=>q,getAccessToken:()=>i.getIdToken()}).getCatalog(),N||(localStorage.setItem("vertebr:env",q),f("allowed"));return}catch{}N||f("denied")})(),()=>{N=!0}},[t,i]);const A=t?.environments.map(N=>N.auth?.client).find(N=>N?.provider==="firebase")?.methods??["email"],_=async N=>{if(N.preventDefault(),!!n){k(!0),w(null);try{await C$(n,h.trim(),g)}catch(I){w(I instanceof Error?I.message:"Sign-in failed")}finally{k(!1)}}},O=async()=>{if(n){k(!0),w(null);try{await W$(n,new ts)}catch(N){w(N instanceof Error?N.message:"Sign-in failed")}finally{k(!1)}}};return o?!n||!t?C.jsx("div",{className:"vertebr-error",children:S??"No browser auth provider is configured."}):i?u==="checking"||u==="idle"?C.jsx("div",{className:"vertebr-loading",children:"Checking admin access…"}):u==="denied"?C.jsx("main",{className:"vertebr-login",children:C.jsxs("section",{className:"vertebr-login-card",children:[C.jsxs("div",{className:"vertebr-brand",children:[C.jsx("strong",{children:t.brand}),C.jsx("span",{children:"Access denied"})]}),C.jsxs("div",{children:[C.jsx("h1",{children:"Administrator access required"}),C.jsxs("p",{children:["Signed in as ",i.email??i.uid,", but this account is not approved for any Vertebr environment."]})]}),C.jsx("button",{className:"vertebr-btn",type:"button",onClick:()=>{eT(n)},children:"Sign out"})]})}):C.jsx(fQ,{apiBase:Lb,title:"Owner control plane",getAccessToken:()=>i.getIdToken(),authUserLabel:i.email??i.uid,onSignOut:()=>eT(n)}):C.jsx("main",{className:"vertebr-login",children:C.jsxs("section",{className:"vertebr-login-card",children:[C.jsxs("div",{className:"vertebr-brand",children:[C.jsx("strong",{children:t.brand}),C.jsx("span",{children:"Admin access"})]}),C.jsxs("div",{children:[C.jsx("h1",{children:"Sign in"}),C.jsx("p",{children:"Use an approved administrator account. Storefront accounts do not receive dashboard access."})]}),A.includes("email")?C.jsxs("form",{className:"vertebr-login-form",onSubmit:_,children:[C.jsxs("label",{className:"vertebr-field",children:[C.jsx("span",{children:"Email"}),C.jsx("input",{type:"email",autoComplete:"username",required:!0,value:h,onChange:N=>m(N.target.value)})]}),C.jsxs("label",{className:"vertebr-field",children:[C.jsx("span",{children:"Password"}),C.jsx("input",{type:"password",autoComplete:"current-password",required:!0,value:g,onChange:N=>y(N.target.value)})]}),C.jsx("button",{className:"vertebr-btn vertebr-btn-primary",type:"submit",disabled:x,children:x?"Signing in…":"Sign in"})]}):null,A.includes("google")?C.jsx("button",{className:"vertebr-btn",type:"button",disabled:x,onClick:()=>{O()},children:"Continue with Google"}):null,S?C.jsx("p",{className:"vertebr-status","data-tone":"danger",children:S}):null]})}):C.jsx("div",{className:"vertebr-loading",children:"Checking admin session…"})}Wz.createRoot(document.getElementById("root")).render(C.jsx(R.StrictMode,{children:C.jsx(pQ,{})}));
|