explicai 0.0.0-stage → 0.2.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/CHANGELOG.md +72 -0
- package/LICENSE +21 -0
- package/README.md +113 -2
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +51 -0
- package/dist/core/annotations.d.ts +7 -0
- package/dist/core/annotations.js +110 -0
- package/dist/core/assets.d.ts +17 -0
- package/dist/core/assets.js +116 -0
- package/dist/core/errors.d.ts +9 -0
- package/dist/core/errors.js +14 -0
- package/dist/core/export/annotationCss.d.ts +5 -0
- package/dist/core/export/annotationCss.js +26 -0
- package/dist/core/export/annotationShapes.d.ts +37 -0
- package/dist/core/export/annotationShapes.js +38 -0
- package/dist/core/export/callout.d.ts +11 -0
- package/dist/core/export/callout.js +26 -0
- package/dist/core/export/collect.d.ts +27 -0
- package/dist/core/export/collect.js +49 -0
- package/dist/core/export/color.d.ts +11 -0
- package/dist/core/export/color.js +33 -0
- package/dist/core/export/fonts.d.ts +35 -0
- package/dist/core/export/fonts.js +40 -0
- package/dist/core/export/headings.d.ts +7 -0
- package/dist/core/export/headings.js +17 -0
- package/dist/core/export/html.d.ts +4 -0
- package/dist/core/export/html.js +242 -0
- package/dist/core/export/imageSize.d.ts +9 -0
- package/dist/core/export/imageSize.js +72 -0
- package/dist/core/export/index.d.ts +29 -0
- package/dist/core/export/index.js +151 -0
- package/dist/core/export/labels.d.ts +17 -0
- package/dist/core/export/labels.js +31 -0
- package/dist/core/export/logo.d.ts +10 -0
- package/dist/core/export/logo.js +29 -0
- package/dist/core/export/markdown.d.ts +8 -0
- package/dist/core/export/markdown.js +83 -0
- package/dist/core/export/pdf.d.ts +6 -0
- package/dist/core/export/pdf.js +68 -0
- package/dist/core/export/refs.d.ts +24 -0
- package/dist/core/export/refs.js +66 -0
- package/dist/core/export/textColors.d.ts +7 -0
- package/dist/core/export/textColors.js +18 -0
- package/dist/core/export/theme.d.ts +28 -0
- package/dist/core/export/theme.js +140 -0
- package/dist/core/frontmatter.d.ts +5 -0
- package/dist/core/frontmatter.js +17 -0
- package/dist/core/fs.d.ts +13 -0
- package/dist/core/fs.js +45 -0
- package/dist/core/index.d.ts +14 -0
- package/dist/core/index.js +15 -0
- package/dist/core/manuals.d.ts +23 -0
- package/dist/core/manuals.js +86 -0
- package/dist/core/pages.d.ts +43 -0
- package/dist/core/pages.js +179 -0
- package/dist/core/redact.d.ts +9 -0
- package/dist/core/redact.js +107 -0
- package/dist/core/text.d.ts +5 -0
- package/dist/core/text.js +28 -0
- package/dist/core/trash.d.ts +25 -0
- package/dist/core/trash.js +84 -0
- package/dist/core/tree.d.ts +13 -0
- package/dist/core/tree.js +28 -0
- package/dist/core/types.d.ts +111 -0
- package/dist/core/types.js +7 -0
- package/dist/core/versions.d.ts +27 -0
- package/dist/core/versions.js +82 -0
- package/dist/server/errorPage.d.ts +9 -0
- package/dist/server/errorPage.js +122 -0
- package/dist/server/http.d.ts +31 -0
- package/dist/server/http.js +132 -0
- package/dist/server/index.d.ts +4 -0
- package/dist/server/index.js +60 -0
- package/dist/server/router.d.ts +30 -0
- package/dist/server/router.js +28 -0
- package/dist/server/routes/assets.d.ts +2 -0
- package/dist/server/routes/assets.js +63 -0
- package/dist/server/routes/export.d.ts +2 -0
- package/dist/server/routes/export.js +43 -0
- package/dist/server/routes/fonts.d.ts +3 -0
- package/dist/server/routes/fonts.js +24 -0
- package/dist/server/routes/manuals.d.ts +2 -0
- package/dist/server/routes/manuals.js +40 -0
- package/dist/server/routes/pages.d.ts +2 -0
- package/dist/server/routes/pages.js +79 -0
- package/dist/server/routes/versions.d.ts +2 -0
- package/dist/server/routes/versions.js +43 -0
- package/dist/server/routes/web.d.ts +3 -0
- package/dist/server/routes/web.js +29 -0
- package/dist/server/security.d.ts +6 -0
- package/dist/server/security.js +17 -0
- package/dist/server/workspace.d.ts +5 -0
- package/dist/server/workspace.js +17 -0
- package/dist/web/assets/archivo-latin-ext-wdth-normal-7khWdh9v.woff2 +0 -0
- package/dist/web/assets/archivo-latin-wdth-normal-DY7AcnAa.woff2 +0 -0
- package/dist/web/assets/archivo-vietnamese-wdth-normal-rJmnGBSt.woff2 +0 -0
- package/dist/web/assets/atkinson-hyperlegible-next-latin-400-normal-DPp7N0cD.woff +0 -0
- package/dist/web/assets/atkinson-hyperlegible-next-latin-400-normal-FfmJh7DR.woff2 +0 -0
- package/dist/web/assets/atkinson-hyperlegible-next-latin-700-normal-C2qZD_Q9.woff +0 -0
- package/dist/web/assets/atkinson-hyperlegible-next-latin-700-normal-Dpiyiu63.woff2 +0 -0
- package/dist/web/assets/atkinson-hyperlegible-next-latin-ext-400-normal-BalHKn7d.woff2 +0 -0
- package/dist/web/assets/atkinson-hyperlegible-next-latin-ext-400-normal-qxMiU51n.woff +0 -0
- package/dist/web/assets/atkinson-hyperlegible-next-latin-ext-700-normal-292QVhS1.woff +0 -0
- package/dist/web/assets/atkinson-hyperlegible-next-latin-ext-700-normal-CBw-mJf_.woff2 +0 -0
- package/dist/web/assets/index-B7Gr83D6.js +262 -0
- package/dist/web/assets/index-DFBrhkII.css +1 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/web/favicon.svg +1 -0
- package/dist/web/index.html +23 -0
- package/fonts/OFL-archivo.txt +93 -0
- package/fonts/OFL-atkinson-hyperlegible-next.txt +93 -0
- package/fonts/OFL-inter.txt +93 -0
- package/fonts/OFL-jetbrains-mono.txt +93 -0
- package/fonts/OFL-lora.txt +93 -0
- package/fonts/OFL-montserrat.txt +93 -0
- package/fonts/OFL-playfair-display.txt +93 -0
- package/fonts/OFL-source-sans-3.txt +93 -0
- package/fonts/OFL-source-serif-4.txt +93 -0
- package/fonts/archivo-latin-wght-normal.woff2 +0 -0
- package/fonts/atkinson-hyperlegible-next-latin-400-italic.woff2 +0 -0
- package/fonts/atkinson-hyperlegible-next-latin-400-normal.woff2 +0 -0
- package/fonts/atkinson-hyperlegible-next-latin-700-normal.woff2 +0 -0
- package/fonts/inter-latin-wght-italic.woff2 +0 -0
- package/fonts/inter-latin-wght-normal.woff2 +0 -0
- package/fonts/jetbrains-mono-latin-wght-normal.woff2 +0 -0
- package/fonts/lora-latin-wght-italic.woff2 +0 -0
- package/fonts/lora-latin-wght-normal.woff2 +0 -0
- package/fonts/montserrat-latin-wght-normal.woff2 +0 -0
- package/fonts/playfair-display-latin-wght-normal.woff2 +0 -0
- package/fonts/source-sans-3-latin-wght-italic.woff2 +0 -0
- package/fonts/source-sans-3-latin-wght-normal.woff2 +0 -0
- package/fonts/source-serif-4-latin-wght-italic.woff2 +0 -0
- package/fonts/source-serif-4-latin-wght-normal.woff2 +0 -0
- package/package.json +124 -4
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=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,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var C=Array.isArray;function w(){}var T={H:null,A:null,T:null,S:null},E=Object.prototype.hasOwnProperty;function D(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function ee(e,t){return D(e.type,t,e.props)}function te(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function O(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?O(``+e.key):t.toString(36)}function ne(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(w,w):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function re(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,re(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+A(e,0):a,C(o)?(i=``,c!=null&&(i=c.replace(k,`$&/`)+`/`),re(o,r,i,``,function(e){return e})):o!=null&&(te(o)&&(o=ee(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(k,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(C(e))for(var u=0;u<e.length;u++)a=e[u],s=l+A(a,u),c+=re(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+A(a,u++),c+=re(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return re(ne(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function j(e,t,n){if(e==null)return e;var r=[],i=0;return re(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function M(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var ie=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function ae(e){var t=T.T,n={};n.types=t===null?null:t.types,T.T=n;try{var r=e(),i=T.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(w,ie)}catch(e){ie(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),T.T=t}}function oe(e){var t=T.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else ae(oe.bind(null,e))}var se={map:j,forEach:function(e,t,n){j(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return j(e,function(){t++}),t},toArray:function(e){return j(e,function(e){return e})||[]},only:function(e){if(!te(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=se,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=x,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return T.H.useMemoCache(e)}},e.addTransitionType=oe,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!E.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return D(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)E.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return D(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=te,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:M}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=ae,e.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},e.use=function(e){return T.H.use(e)},e.useActionState=function(e,t,n){return T.H.useActionState(e,t,n)},e.useCallback=function(e,t){return T.H.useCallback(e,t)},e.useContext=function(e){return T.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return T.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return T.H.useEffect(e,t)},e.useEffectEvent=function(e){return T.H.useEffectEvent(e)},e.useId=function(){return T.H.useId()},e.useImperativeHandle=function(e,t,n){return T.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return T.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return T.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return T.H.useMemo(e,t)},e.useOptimistic=function(e,t){return T.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return T.H.useReducer(e,t,n)},e.useRef=function(e){return T.H.useRef(e)},e.useState=function(e){return T.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return T.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return T.H.useTransition()},e.version=`19.3.1`})),u=o(((e,t)=>{t.exports=l()})),d=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,ee());else{var t=n(l);t!==null&&k(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&k(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ee():S=!1}}}var ee;if(typeof y==`function`)ee=function(){y(D)};else if(typeof MessageChannel<`u`){var te=new MessageChannel,O=te.port2;te.port1.onmessage=D,ee=function(){O.postMessage(null)}}else ee=function(){_(D,0)};function k(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,k(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,ee()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),f=o(((e,t)=>{t.exports=d()})),p=o((e=>{var t=u();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`),o=Symbol.for(`react.recoverable`),s=Symbol.for(`react.optimistic_key`);function c(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:r===s?s:``+r,children:e,containerInfo:t,implementation:n}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.browser=function(e){return{$$typeof:o,_reason:e}},e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return c(e,t,null,r)},e.flushSync=function(e){var t=l.T,n=i.p;try{if(l.T=null,i.p=2,e)return e()}finally{l.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=d(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=d(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return l.H.useFormState(e,t,n)},e.useFormStatus=function(){return l.H.useHostTransitionStatus()},e.version=`19.3.1`})),m=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=o((e=>{var t=f(),n=u(),r=m();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function d(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}function h(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&h(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function g(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function _(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function v(e){var t=[null,null],n=g(e);return n===null||y(t,e,n.child,{foundSelf:!1}),t}function y(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&y(e,t,n.child,r))return!0;n=n.sibling}return!1}function b(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var x=null,S=null;function C(e,t,n){return e===n||e===t&&(x=e,!0)}function w(e,t,n){return e===n?(S=e,!1):e===t&&(S!==null&&(x=e),!0)}function T(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function E(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var D=Object.assign,ee=Symbol.for(`react.element`),te=Symbol.for(`react.transitional.element`),O=Symbol.for(`react.portal`),k=Symbol.for(`react.fragment`),A=Symbol.for(`react.strict_mode`),ne=Symbol.for(`react.profiler`),re=Symbol.for(`react.consumer`),j=Symbol.for(`react.context`),M=Symbol.for(`react.forward_ref`),ie=Symbol.for(`react.suspense`),ae=Symbol.for(`react.suspense_list`),oe=Symbol.for(`react.memo`),se=Symbol.for(`react.lazy`),ce=Symbol.for(`react.activity`),le=Symbol.for(`react.legacy_hidden`),ue=Symbol.for(`react.memo_cache_sentinel`),de=Symbol.for(`react.view_transition`),fe=Symbol.for(`react.recoverable`),pe=Symbol.iterator;function me(e){return typeof e!=`object`||!e?null:(e=pe&&e[pe]||e[`@@iterator`],typeof e==`function`?e:null)}var he=Symbol.for(`react.client.reference`);function ge(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===he?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case k:return`Fragment`;case ne:return`Profiler`;case A:return`StrictMode`;case ie:return`Suspense`;case ae:return`SuspenseList`;case ce:return`Activity`;case de:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case O:return`Portal`;case j:return e.displayName||`Context`;case re:return(e._context.displayName||`Context`)+`.Consumer`;case M:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case oe:return t=e.displayName||null,t===null?ge(e.type)||`Memo`:t;case se:t=e._payload,e=e._init;try{return ge(e(t))}catch{}}return null}var _e=Array.isArray,N=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ve=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ye={pending:!1,data:null,method:null,action:null},be=[],xe=-1;function Se(e){return{current:e}}function Ce(e){0>xe||(e.current=be[xe],be[xe]=null,xe--)}function we(e,t){xe++,be[xe]=e.current,e.current=t}var Te=Se(null),Ee=Se(null),De=Se(null),Oe=Se(null);function ke(e,t){switch(we(De,t),we(Ee,e),we(Te,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?yp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=yp(t),e=bp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}Ce(Te),we(Te,e)}function Ae(){Ce(Te),Ce(Ee),Ce(De)}function je(e){var t=e.memoizedState;t!==null&&(gh._currentValue=t.memoizedState,we(Oe,e)),t=Te.current;var n=bp(t,e.type);t!==n&&(we(Ee,e),we(Te,n))}function Me(e){Ee.current===e&&(Ce(Te),Ce(Ee)),Oe.current===e&&(Ce(Oe),gh._currentValue=ye)}var P,Ne;function Pe(e){if(P===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);P=t&&t[1]||``,Ne=-1<e.stack.indexOf(`
|
|
2
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
3
|
+
`+P+e+Ne}var Fe=!1;function Ie(e,t){if(!e||Fe)return``;Fe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
4
|
+
`),l=s.split(`
|
|
5
|
+
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
6
|
+
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Fe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Pe(n):``}function Le(e,t){switch(e.tag){case 26:case 27:case 5:return Pe(e.type);case 16:return Pe(`Lazy`);case 13:return e.child!==t&&t!==null?Pe(`Suspense Fallback`):Pe(`Suspense`);case 19:return Pe(`SuspenseList`);case 0:case 15:return Ie(e.type,!1);case 11:return Ie(e.type.render,!1);case 1:return Ie(e.type,!0);case 31:return Pe(`Activity`);case 30:return Pe(`ViewTransition`);default:return``}}function Re(e){try{var t=``,n=null;do t+=Le(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
7
|
+
Error generating stack: `+e.message+`
|
|
8
|
+
`+e.stack}}var ze=Object.prototype.hasOwnProperty,Be=t.unstable_scheduleCallback,Ve=t.unstable_cancelCallback,He=t.unstable_shouldYield,Ue=t.unstable_requestPaint,F=t.unstable_now,We=t.unstable_getCurrentPriorityLevel,Ge=t.unstable_ImmediatePriority,Ke=t.unstable_UserBlockingPriority,qe=t.unstable_NormalPriority,Je=t.unstable_LowPriority,Ye=t.unstable_IdlePriority,Xe=t.log,I=t.unstable_setDisableYieldValue,Ze=null,Qe=null;function $e(e){if(typeof Xe==`function`&&I(e),Qe&&typeof Qe.setStrictMode==`function`)try{Qe.setStrictMode(Ze,e)}catch{}}var et=Math.clz32?Math.clz32:rt,tt=Math.log,nt=Math.LN2;function rt(e){return e>>>=0,e===0?32:31-(tt(e)/nt|0)|0}var it=256,at=262144,ot=4194304;function st(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ct(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=st(n))):i=st(o):i=st(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=st(n))):i=st(o)):i=st(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function lt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function ut(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-et(n),i=1<<r;t|=e[r],n&=~i}return t}function dt(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 ft(){var e=ot;return ot<<=1,!(ot&62914560)&&(ot=4194304),e}function pt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function mt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function L(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-et(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&ht(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function ht(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-et(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function gt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-et(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function _t(e,t){var n=t&-t;return n=n&42?1:vt(n),(n&(e.suspendedLanes|t))===0?n:0}function vt(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function yt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function bt(){var e=ve.p;return e===0?(e=window.event,e===void 0?32:Mh(e.type)):e}function xt(e,t){var n=ve.p;try{return ve.p=e,t()}finally{ve.p=n}}var St=Math.random().toString(36).slice(2),Ct=`__reactFiber$`+St,wt=`__reactProps$`+St,Tt=`__reactContainer$`+St,Et=`__reactEvents$`+St,Dt=`__reactListeners$`+St,Ot=`__reactHandles$`+St,kt=`__reactResources$`+St,At=`__reactMarker$`+St,jt=`__reactLoad$`+St;function Mt(e){delete e[Ct],delete e[wt],delete e[Dt],delete e[Ot]}function Nt(e){var t;if(t=e[Ct])return t;for(var n=e.parentNode;n;){if(t=n[Tt]||n[Ct]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=xm(e);e!==null;){if(n=e[Ct])return n;e=xm(e)}return t}e=n,n=e.parentNode}return null}function Pt(e){if(e=e[Ct]||e[Tt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Ft(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function It(e){var t=e[kt];return t||=e[kt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Lt(e){e[At]=!0}function Rt(e){e[jt]=void 0}var zt=new Set,Bt={};function R(e,t){Vt(e,t),Vt(e+`Capture`,t)}function Vt(e,t){for(Bt[e]=t,e=0;e<t.length;e++)zt.add(t[e])}var Ht=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]*$`),Ut={},Wt={};function Gt(e){return ze.call(Wt,e)?!0:ze.call(Ut,e)?!1:Ht.test(e)?Wt[e]=!0:(Ut[e]=!0,!1)}var Kt=!1;function qt(){var e=Kt;return Kt=!1,e}function Jt(e,t,n){if(Gt(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,n)}}}function Yt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,n)}}function Xt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,r)}}function Zt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Qt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function $t(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function en(e){if(!e._valueTracker){var t=Qt(e)?`checked`:`value`;e._valueTracker=$t(e,t,``+e[t])}}function tn(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Qt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var nn=/[\n"\\]/g;function rn(e){return e.replace(nn,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function an(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Zt(t)):e.value!==``+Zt(t)&&(e.value=``+Zt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):sn(e,Zt(n)):o===`number`&&e.value==t?sn(e,Zt(e.value)):sn(e,Zt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Zt(s):e.removeAttribute(`name`)}function on(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){en(e);return}n=n==null?``:``+Zt(n),t=t==null?n:``+Zt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),en(e)}function sn(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function cn(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Zt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function ln(e,t,n){t!=null&&(t=``+Zt(t),t!==e.value&&(e.value=t),n==null)?e.defaultValue!==t&&(e.defaultValue=t):e.defaultValue=n==null?``:``+Zt(n)}function un(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(_e(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Zt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),en(e)}function dn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var fn=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 pn(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||fn.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function mn(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``,Kt=!0);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&(pn(e,a,r),Kt=!0)}else for(var o in t)t.hasOwnProperty(o)&&pn(e,o,t[o])}function hn(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var gn=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`],[`maskType`,`mask-type`],[`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`]]),_n=/^[\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 vn(e){return _n.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function z(){}var yn=null;function bn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var xn=null,Sn=null;function Cn(e){var t=Pt(e);if(t&&(e=t.stateNode)){var n=e[wt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(an(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+rn(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[wt]||null;if(!a)throw Error(i(90));an(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&tn(r)}break a;case`textarea`:ln(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&cn(e,!!n.multiple,t,!1)}}}var wn=!1;function Tn(e,t,n){if(wn)return e(t,n);wn=!0;try{return e(t)}finally{if(wn=!1,(xn!==null||Sn!==null)&&(Jd(),xn&&(t=xn,e=Sn,Sn=xn=null,Cn(t),e)))for(t=0;t<e.length;t++)Cn(e[t])}}function En(e,t){var n=e.stateNode;if(n===null)return null;var r=n[wt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var Dn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,On=!1;if(Dn)try{var kn={};Object.defineProperty(kn,"passive",{get:function(){On=!0}}),window.addEventListener(`test`,kn,kn),window.removeEventListener(`test`,kn,kn)}catch{On=!1}var An=null,jn=null,Mn=null;function Nn(){if(Mn)return Mn;var e,t=jn,n=t.length,r,i=`value`in An?An.value:An.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return Mn=i.slice(e,1<r?1-r:void 0)}function Pn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Fn(){return!0}function In(){return!1}function Ln(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?Fn:In,this.isPropagationStopped=In,this}return D(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=Fn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Fn)},persist:function(){},isPersistent:Fn}),t}var Rn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zn=Ln(Rn),Bn=D({},Rn,{view:0,detail:0}),Vn=Ln(Bn),Hn,Un,Wn,Gn=D({},Bn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:nr,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Wn&&(Wn&&e.type===`mousemove`?(Hn=e.screenX-Wn.screenX,Un=e.screenY-Wn.screenY):Un=Hn=0,Wn=e),Hn)},movementY:function(e){return`movementY`in e?e.movementY:Un}}),Kn=Ln(Gn),qn=Ln(D({},Gn,{dataTransfer:0})),Jn=Ln(D({},Bn,{relatedTarget:0})),Yn=Ln(D({},Rn,{animationName:0,elapsedTime:0,pseudoElement:0})),Xn=Ln(D({},Rn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Zn=Ln(D({},Rn,{data:0})),Qn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},$n={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`},er={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function tr(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=er[e])?!!t[e]:!1}function nr(){return tr}var rr=Ln(D({},Bn,{key:function(e){if(e.key){var t=Qn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Pn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?$n[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:nr,charCode:function(e){return e.type===`keypress`?Pn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Pn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),ir=Ln(D({},Gn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),ar=Ln(D({},Rn,{submitter:0})),or=Ln(D({},Bn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:nr})),sr=Ln(D({},Rn,{propertyName:0,elapsedTime:0,pseudoElement:0})),cr=Ln(D({},Gn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),lr=Ln(D({},Rn,{newState:0,oldState:0,source:0})),ur=[9,13,27,32],dr=Dn&&`CompositionEvent`in window,fr=null;Dn&&`documentMode`in document&&(fr=document.documentMode);var pr=Dn&&`TextEvent`in window&&!fr,mr=Dn&&(!dr||fr&&8<fr&&11>=fr),hr=` `,gr=!1;function _r(e,t){switch(e){case`keyup`:return ur.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function vr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var yr=!1;function br(e,t){switch(e){case`compositionend`:return vr(t);case`keypress`:return t.which===32?(gr=!0,hr):null;case`textInput`:return e=t.data,e===hr&&gr?null:e;default:return null}}function xr(e,t){if(yr)return e===`compositionend`||!dr&&_r(e,t)?(e=Nn(),Mn=jn=An=null,yr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return mr&&t.locale!==`ko`?null:t.data;default:return null}}var Sr={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 Cr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Sr[e.type]:t===`textarea`}function wr(e,t,n,r){xn?Sn?Sn.push(r):Sn=[r]:xn=r,t=np(t,`onChange`),0<t.length&&(n=new zn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var Tr=null,Er=null;function Dr(e){Jf(e,0)}function Or(e){if(tn(Ft(e)))return e}function kr(e,t){if(e===`change`)return t}var Ar=!1;if(Dn){var jr;if(Dn){var Mr=`oninput`in document;if(!Mr){var Nr=document.createElement(`div`);Nr.setAttribute(`oninput`,`return;`),Mr=typeof Nr.oninput==`function`}jr=Mr}else jr=!1;Ar=jr&&(!document.documentMode||9<document.documentMode)}function Pr(){Tr&&(Tr.detachEvent(`onpropertychange`,Fr),Er=Tr=null)}function Fr(e){if(e.propertyName===`value`&&Or(Er)){var t=[];wr(t,Er,e,bn(e)),Tn(Dr,t)}}function Ir(e,t,n){e===`focusin`?(Pr(),Tr=t,Er=n,Tr.attachEvent(`onpropertychange`,Fr)):e===`focusout`&&Pr()}function Lr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return Or(Er)}function Rr(e,t){if(e===`click`)return Or(t)}function zr(e,t){if(e===`input`||e===`change`)return Or(t)}function Br(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Vr=typeof Object.is==`function`?Object.is:Br;function Hr(e,t){if(Vr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!ze.call(t,i)||!Vr(e[i],t[i]))return!1}return!0}function Ur(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Wr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Gr(e,t){var n=Wr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Wr(n)}}function Kr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Kr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function qr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ur(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ur(e.document)}return t}function Jr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Yr=Dn&&`documentMode`in document&&11>=document.documentMode,Xr=null,Zr=null,Qr=null,$r=!1;function ei(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;$r||Xr==null||Xr!==Ur(r)||(r=Xr,`selectionStart`in r&&Jr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Qr&&Hr(Qr,r)||(Qr=r,r=np(Zr,`onSelect`),0<r.length&&(t=new zn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Xr)))}function ti(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var ni={animationend:ti(`Animation`,`AnimationEnd`),animationiteration:ti(`Animation`,`AnimationIteration`),animationstart:ti(`Animation`,`AnimationStart`),transitionrun:ti(`Transition`,`TransitionRun`),transitionstart:ti(`Transition`,`TransitionStart`),transitioncancel:ti(`Transition`,`TransitionCancel`),transitionend:ti(`Transition`,`TransitionEnd`)},ri={},ii={};Dn&&(ii=document.createElement(`div`).style,`AnimationEvent`in window||(delete ni.animationend.animation,delete ni.animationiteration.animation,delete ni.animationstart.animation),`TransitionEvent`in window||delete ni.transitionend.transition);function ai(e){if(ri[e])return ri[e];if(!ni[e])return e;var t=ni[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in ii)return ri[e]=t[n];return e}var oi=ai(`animationend`),si=ai(`animationiteration`),ci=ai(`animationstart`),li=ai(`transitionrun`),ui=ai(`transitionstart`),di=ai(`transitioncancel`),fi=ai(`transitionend`),pi=new Map,mi=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError 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(` `);mi.push(`scrollEnd`);function hi(e,t){pi.set(e,t),R(t,[e])}var gi=0;function _i(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=kd.identifierPrefix;var n=gi++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function vi(e){if(e==null||typeof e==`string`)return e;var t=null,n=Ld;if(n!==null)for(var r=0;r<n.length;r++){var i=e[n[r]];if(i!=null){if(i===`none`)return`none`;t=t==null?i:t+(` `+i)}}return t??e.default}function yi(e,t){return e=vi(e),t=vi(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var bi=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},xi=[],Si=0,Ci=0;function wi(){for(var e=Si,t=Ci=Si=0;t<e;){var n=xi[t];xi[t++]=null;var r=xi[t];xi[t++]=null;var i=xi[t];xi[t++]=null;var a=xi[t];if(xi[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Oi(n,i,a)}}function Ti(e,t,n,r){xi[Si++]=e,xi[Si++]=t,xi[Si++]=n,xi[Si++]=r,Ci|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Ei(e,t,n,r){return Ti(e,t,n,r),ki(e)}function Di(e,t){return Ti(e,null,null,t),ki(e)}function Oi(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-et(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ki(e){if(50<Rd)throw Rd=0,zd=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ai={};function ji(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Mi(e,t,n,r){return new ji(e,t,n,r)}function Ni(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Pi(e,t){var n=e.alternate;return n===null?(n=Mi(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&1206910976,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Fi(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ii(e,t,n,r,a,o){var s=0;if(r=e,typeof r==`function`)Ni(r)&&(s=1);else if(typeof r==`string`)s=nh(e,n,Te.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case ce:return e=Mi(31,n,t,a),e.elementType=ce,e.lanes=o,e;case k:return Li(n.children,a,o,t);case A:s=8,a|=24;break;case ne:return e=Mi(12,n,t,a|2),e.elementType=ne,e.lanes=o,e;case ie:return e=Mi(13,n,t,a),e.elementType=ie,e.lanes=o,e;case ae:return e=Mi(19,n,t,a),e.elementType=ae,e.lanes=o,e;case le:case de:return e=a|32,e=Mi(30,n,t,e),e.elementType=de,e.lanes=o,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case j:s=10;break a;case re:s=9;break a;case M:s=11;break a;case oe:s=14;break a;case se:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=Mi(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function Li(e,t,n,r){return e=Mi(7,e,r,t),e.lanes=n,e}function Ri(e,t,n){return e=Mi(6,e,null,t),e.lanes=n,e}function zi(e){var t=Mi(18,null,null,0);return t.stateNode=e,t}function Bi(e,t,n){return t=Mi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Vi=new WeakMap;function Hi(e,t){if(typeof e==`object`&&e){var n=Vi.get(e);return n===void 0?(t={value:e,source:t,stack:Re(t)},Vi.set(e,t),t):n}return{value:e,source:t,stack:Re(t)}}var Ui=[],Wi=0,Gi=null,Ki=0,qi=[],Ji=0,Yi=null,Xi=1,Zi=``;function Qi(e,t){Ui[Wi++]=Ki,Ui[Wi++]=Gi,Gi=e,Ki=t}function $i(e,t,n){qi[Ji++]=Xi,qi[Ji++]=Zi,qi[Ji++]=Yi,Yi=e;var r=Xi;e=Zi;var i=32-et(r)-1;r&=~(1<<i),n+=1;var a=32-et(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Xi=1<<32-et(t)+i|n<<i|r,Zi=a+e}else Xi=1<<a|n<<i|r,Zi=e}function ea(e){e.return!==null&&(Qi(e,1),$i(e,1,0))}function ta(e){for(;e===Gi;)Gi=Ui[--Wi],Ui[Wi]=null,Ki=Ui[--Wi],Ui[Wi]=null;for(;e===Yi;)Yi=qi[--Ji],qi[Ji]=null,Zi=qi[--Ji],qi[Ji]=null,Xi=qi[--Ji],qi[Ji]=null}function na(e,t){qi[Ji++]=Xi,qi[Ji++]=Zi,qi[Ji++]=Yi,Xi=t.id,Zi=t.overflow,Yi=e}var ra=null,ia=null,B=!1,aa=null,oa=!1,sa=Error(i(519));function ca(e){throw ma(Hi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),sa}function la(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Ct]=e,t[wt]=r,n){case`dialog`:Yf(`cancel`,t),Yf(`close`,t);break;case`iframe`:case`object`:case`embed`:Yf(`load`,t);break;case`video`:case`audio`:for(n=0;n<Kf.length;n++)Yf(Kf[n],t);break;case`source`:Yf(`error`,t);break;case`img`:case`image`:case`link`:Yf(`error`,t),Yf(`load`,t);break;case`details`:Yf(`toggle`,t);break;case`input`:Yf(`invalid`,t),on(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Yf(`invalid`,t);break;case`textarea`:Yf(`invalid`,t),un(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||cp(t.textContent,n)?(r.popover!=null&&(Yf(`beforetoggle`,t),Yf(`toggle`,t)),r.onScroll!=null&&Yf(`scroll`,t),r.onScrollEnd!=null&&Yf(`scrollend`,t),r.onClick!=null&&(t.onclick=z),t=!0):t=!1,t||ca(e,!0)}function ua(e){for(ra=e.return;ra;)switch(ra.tag){case 5:case 31:case 13:oa=!1;return;case 27:case 3:oa=!0;return;default:ra=ra.return}}function da(e){if(e!==ra)return!1;if(!B)return ua(e),B=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||Sp(e.type,e.memoizedProps)),n=!n),n&&ia&&ca(e),ua(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));ia=bm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));ia=bm(e)}else t===27?(t=ia,jp(e.type)?(e=ym,ym=null,ia=e):ia=t):ia=ra?vm(e.stateNode.nextSibling):null;return!0}function fa(){ia=ra=null,B=!1}function pa(){var e=aa;return e!==null&&(xd===null?xd=e:xd.push.apply(xd,e),aa=null),e}function ma(e){aa===null?aa=[e]:aa.push(e)}var ha=Se(null),ga=null,_a=null;function va(e,t,n){we(ha,t._currentValue),t._currentValue=n}function ya(e){e._currentValue=ha.current,Ce(ha)}function ba(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function xa(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),ba(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),ba(s,n,e),s=null}else a.tag===13&&a.memoizedState!==null&&a.memoizedState.dehydrated===null?(a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),ba(a.return,n,e),s=a.child,s=s===null?null:s.sibling):s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Sa(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;Vr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===Oe.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[gh]:e.push(gh))}a=a.return}return e!==null&&xa(t,e,n,r),t.flags|=262144,e!==null}function Ca(e){for(e=e.firstContext;e!==null;){if(!Vr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function wa(e){ga=e,_a=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ta(e){return Da(ga,e)}function Ea(e,t){return ga===null&&wa(e),Da(e,t)}function Da(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},_a===null){if(e===null)throw Error(i(308));_a=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else _a=_a.next=t;return n}var Oa=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ka=t.unstable_scheduleCallback,Aa=t.unstable_NormalPriority,ja={$$typeof:j,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ma(){return{controller:new Oa,data:new Map,refCount:0}}function Na(e){e.refCount--,e.refCount===0&&ka(Aa,function(){e.controller.abort()})}function Pa(e,t){if(e.pendingLanes&4194048){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var Fa=null;function Ia(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var La=null,Ra=0,za=0,Ba=null;function Va(e,t){if(La===null){var n=La=[];Ra=0,za=G(),Ba={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Ra++,t.then(Ha,Ha),t}function Ha(){if(--Ra===0&&(Fa=null,La!==null)){Ba!==null&&(Ba.status=`fulfilled`);var e=La;La=null,za=0,Ba=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ua(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var Wa=N.S;N.S=function(e,t){if(wd=F(),typeof t==`object`&&t&&typeof t.then==`function`&&Va(e,t),Fa!==null)for(var n=Of;n!==null;)Pa(n,Fa),n=n.next;if(n=e.types,n!==null){for(var r=Of;r!==null;)Pa(r,n),r=r.next;if(za!==0){r=Fa,r===null&&(r=Fa=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}Wa!==null&&Wa(e,t)};var Ga=Se(null);function Ka(){var e=Ga.current;return e===null?ad.pooledCache:e}function qa(e,t){t===null?we(Ga,Ga.current):we(Ga,t.pool)}function Ja(){var e=Ka();return e===null?null:{parent:ja._currentValue,pool:e}}var Ya=Error(i(460)),Xa=Error(i(474)),Za=Error(i(542)),Qa={then:function(){}};function $a(e){return e=e.status,e===`fulfilled`||e===`rejected`}function eo(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(z,z),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,io(e),e===void 0&&!(`reason`in t)?Error(i(600)):e;default:if(typeof t.status==`string`)t.then(z,z);else{if(e=ad,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,io(e),e}throw no=t,Ya}}function to(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(no=e,Ya):e}}var no=null;function ro(){if(no===null)throw Error(i(459));var e=no;return no=null,e}function io(e){if(e===Ya||e===Za)throw Error(i(483))}var ao=null,oo=0;function so(e){var t=oo;return oo+=1,ao===null&&(ao=[]),eo(ao,e,t)}function co(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function lo(e,t){throw t.$$typeof===ee?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function uo(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=Pi(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=134217730,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=134217730),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=Ri(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===k?(e=d(e,t,n.props.children,r,n.key),co(e,n),e):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===se&&to(i)===t.type)?(t=a(t,n.props),co(t,n),t.return=e,t):(t=Ii(n.type,n.key,n.props,null,e.mode,r),co(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=Bi(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=Li(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=Ri(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case te:return n=Ii(t.type,t.key,t.props,null,e.mode,n),co(n,t),n.return=e,n;case O:return t=Bi(t,e.mode,n),t.return=e,t;case se:return t=to(t),f(e,t,n)}if(_e(t)||me(t))return t=Li(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,so(t),n);if(t.$$typeof===j)return f(e,Ea(e,t),n);lo(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case te:return n.key===i?l(e,t,n,r):null;case O:return n.key===i?u(e,t,n,r):null;case se:return n=to(n),p(e,t,n,r)}if(_e(n)||me(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,so(n),r);if(n.$$typeof===j)return p(e,t,Ea(e,n),r);lo(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case te:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case O:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case se:return r=to(r),m(e,t,n,r,i)}if(_e(r)||me(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,so(r),i);if(r.$$typeof===j)return m(e,t,n,Ea(t,r),i);lo(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),B&&Qi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return B&&Qi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&(_=g.alternate,_!==null&&d.delete(_.key===null?h:_.key)),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),B&&Qi(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),B&&Qi(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return B&&Qi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),B&&Qi(a,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===k&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case te:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===k){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),co(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===se&&to(l)===r.type){n(e,r.sibling),c=a(r,o.props),co(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===k?(c=Li(o.props.children,e.mode,c,o.key),co(c,o),c.return=e,e=c):(c=Ii(o.type,o.key,o.props,null,e.mode,c),co(c,o),c.return=e,e=c)}return s(e);case O:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Bi(o,e.mode,c),c.return=e,e=c}return s(e);case se:return o=to(o),_(e,r,o,c)}if(_e(o))return h(e,r,o,c);if(me(o)){if(l=me(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return _(e,r,so(o),c);if(o.$$typeof===j)return _(e,r,Ea(e,o),c);lo(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=Ri(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{oo=0;var i=_(e,t,n,r);return ao=null,i}catch(t){if(t===Ya||t===Za)throw t;var a=Mi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var fo=uo(!0),po=uo(!1),mo=!1;function ho(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function go(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function _o(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function vo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,id&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ki(e),Oi(e,null,n),t}return Ti(e,r,t,n),ki(e)}function yo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,gt(e,n)}}function bo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n}else e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var xo=!1;function So(){if(xo){var e=Ba;if(e!==null)throw e}}function Co(e,t,n,r){xo=!1;var i=e.updateQueue;mo=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(sd&f)===f:(r&f)===f){f!==0&&f===za&&(xo=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=D({},d,f);break a;case 2:mo=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),hd|=o,e.lanes=o,e.memoizedState=d}}function wo(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function To(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)wo(n[e],t)}var Eo=Se(null),Do=Se(0);function Oo(e,t){e=pd,we(Do,e),we(Eo,t),pd=e|t.baseLanes}function ko(){we(Do,pd),we(Eo,Eo.current)}function Ao(){pd=Do.current,Ce(Eo),Ce(Do)}var jo=Se(null),Mo=null;function No(e){var t=e.alternate;we(Ro,Ro.current&1),we(jo,e),Mo===null&&(t===null||Eo.current!==null||t.memoizedState!==null)&&(Mo=e)}function Po(e){we(Ro,Ro.current),we(jo,e),Mo===null&&(Mo=e)}function Fo(e){e.tag===22?(we(Ro,Ro.current),we(jo,e),Mo===null&&(Mo=e)):Io()}function Io(){we(Ro,Ro.current),we(jo,jo.current)}function Lo(e){Ce(jo),Mo===e&&(Mo=null),Ce(Ro)}var Ro=Se(0);function zo(e,t){we(jo,jo.current),we(Ro,t)}function Bo(e){Ce(Ro),Ce(jo),Mo===e&&(Mo=null)}function Vo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||hm(n)||gm(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==`independent`){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ho=0,V=null,Uo=null,Wo=null,Go=!1,Ko=!1,qo=!1,Jo=0,Yo=0,Xo=null,Zo=0;function Qo(){throw Error(i(321))}function $o(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Vr(e[n],t[n]))return!1;return!0}function es(e,t,n,r,i,a){return Ho=a,V=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,N.H=e===null||e.memoizedState===null?vc:yc,qo=!1,a=n(r,i),qo=!1,Ko&&(a=ns(t,n,r,i)),ts(e),a}function ts(e){N.H=_c;var t=Uo!==null&&Uo.next!==null;if(Ho=0,Wo=Uo=V=null,Go=!1,Yo=0,Xo=null,t)throw Error(i(300));e===null||Ic||(e=e.dependencies,e!==null&&Ca(e)&&(Ic=!0))}function ns(e,t,n,r){V=e;var a=0;do{if(Ko&&(Xo=null),Yo=0,Ko=!1,25<=a)throw Error(i(301));if(a+=1,Wo=Uo=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}N.H=bc,o=t(n,r)}while(Ko);return o}function rs(){var e=N.H,t=e.useState()[0];return t=typeof t.then==`function`?ds(t):t,e=e.useState()[0],(Uo===null?null:Uo.memoizedState)!==e&&(V.flags|=1024),t}function is(){var e=Jo!==0;return Jo=0,e}function as(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function ss(e){if(Go){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Go=!1}Ho=0,Wo=Uo=V=null,Ko=!1,Yo=Jo=0,Xo=null}function cs(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Wo===null?V.memoizedState=Wo=e:Wo=Wo.next=e,Wo}function ls(){if(Uo===null){var e=V.alternate;e=e===null?null:e.memoizedState}else e=Uo.next;var t=Wo===null?V.memoizedState:Wo.next;if(t!==null)Wo=t,Uo=e;else{if(e===null)throw V.alternate===null?Error(i(467)):Error(i(310));Uo=e,e={memoizedState:Uo.memoizedState,baseState:Uo.baseState,baseQueue:Uo.baseQueue,queue:Uo.queue,next:null},Wo===null?V.memoizedState=Wo=e:Wo=Wo.next=e}return Wo}function us(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ds(e){var t=Yo;return Yo+=1,Xo===null&&(Xo=[]),e=eo(Xo,e,t),t=V,(Wo===null?t.memoizedState:Wo.next)===null&&(t=t.alternate,N.H=t===null||t.memoizedState===null?vc:yc),e}function fs(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return ds(e);if(e.$$typeof===fe)return;if(e.$$typeof===j)return Ta(e)}throw Error(i(438,String(e)))}function ps(e){var t=null,n=V.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=V.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=us(),V.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=ue;return t.index++,n}function ms(e,t){return typeof t==`function`?t(e):t}function hs(e){return gs(ls(),Uo,e)}function gs(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Ho&f)===f:(sd&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===za&&(d=!0);else if((Ho&p)===p){u=u.next,p===za&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,V.lanes|=p,hd|=p;f=u.action,qo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,V.lanes|=f,hd|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Vr(o,e.memoizedState)&&(Ic=!0,d&&(n=Ba,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function _s(e){var t=ls(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Vr(o,t.memoizedState)||(Ic=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function vs(e,t,n){var r=V,a=ls(),o=B;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Vr((Uo||a).memoizedState,n);if(s&&(a.memoizedState=n,Ic=!0),a=a.queue,Us(xs.bind(null,r,a,e),[e]),e=a.getSnapshot!==t||s||Wo!==null&&!!(Wo.memoizedState.tag&1),Rs(e?9:8,{destroy:void 0},bs.bind(null,r,a,n,t),null),e){if(r.flags|=2048,ad===null)throw Error(i(349));o||Ho&127||ys(r,t,n)}return n}function ys(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=V.updateQueue,t===null?(t=us(),V.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function bs(e,t,n,r){t.value=n,t.getSnapshot=r,Ss(t)&&Cs(e)}function xs(e,t,n){return n(function(){Ss(t)&&Cs(e)})}function Ss(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Vr(e,n)}catch{return!0}}function Cs(e){var t=Di(e,2);t!==null&&Ud(t,e,2)}function ws(e){var t=cs();if(typeof e==`function`){var n=e;if(e=n(),qo){$e(!0);try{n()}finally{$e(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:e},t}function Ts(e,t,n,r){return e.baseState=n,gs(e,Uo,typeof r==`function`?r:ms)}function Es(e,t,n,r,a){if(mc(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};N.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Ds(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Ds(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=N.T,o={};o.types=a===null?null:a.types,N.T=o;try{var s=n(i,r),c=N.S;c!==null&&c(o,s),Os(e,t,s)}catch(n){As(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),N.T=a}}else try{a=n(i,r),Os(e,t,a)}catch(n){As(e,t,n)}}function Os(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){ks(e,t,n)},function(n){return As(e,t,n)}):ks(e,t,n)}function ks(e,t,n){t.status=`fulfilled`,t.value=n,js(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Ds(e,n)))}function As(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,js(t),t=t.next;while(t!==r)}e.action=null}function js(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ms(e,t){return t}function Ns(e,t){if(B){var n=ad.formState;if(n!==null){a:{var r=V;if(B){if(ia){b:{for(var i=ia,a=oa;i.nodeType!==8;)if(!a||(i=vm(i.nextSibling),i===null)){i=null;break b}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){ia=vm(i.nextSibling),r=i.data===`F!`;break a}}ca(r)}r=!1}r&&(t=n[0])}}return n=cs(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ms,lastRenderedState:t},n.queue=r,n=dc.bind(null,V,r),r.dispatch=n,r=ws(!1),a=pc.bind(null,V,!1,r.queue),r=cs(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Es.bind(null,V,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Ps(e){return Fs(ls(),Uo,e)}function Fs(e,t,n){if(t=gs(e,t,Ms)[0],e=hs(ms)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=ds(t)}catch(e){throw e===Ya?Za:e}else r=t;t=ls();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(V.flags|=2048,Rs(9,{destroy:void 0},Is.bind(null,i,n),null)),[r,a,e]}function Is(e,t){e.action=t}function Ls(e){var t=ls(),n=Uo;if(n!==null)return Fs(t,n,e);ls(),t=t.memoizedState,n=ls();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Rs(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=V.updateQueue,t===null&&(t=us(),V.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function zs(){return ls().memoizedState}function Bs(e,t,n,r){var i=cs();V.flags|=e,i.memoizedState=Rs(1|t,{destroy:void 0},n,r===void 0?null:r)}function Vs(e,t,n,r){var i=ls();r=r===void 0?null:r;var a=i.memoizedState.inst;Uo!==null&&r!==null&&$o(r,Uo.memoizedState.deps)?i.memoizedState=Rs(t,a,n,r):(V.flags|=e,i.memoizedState=Rs(1|t,a,n,r))}function Hs(e,t){Bs(8390656,8,e,t)}function Us(e,t){Vs(2048,8,e,t)}function Ws(e){V.flags|=4;var t=V.updateQueue;if(t===null)t=us(),V.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Gs(e){var t=ls().memoizedState;return Ws({ref:t,nextImpl:e}),function(){if(id&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function Ks(e,t){return Vs(4,2,e,t)}function qs(e,t){return Vs(4,4,e,t)}function Js(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Ys(e,t,n){n=n==null?null:n.concat([e]),Vs(4,4,Js.bind(null,t,e),n)}function Xs(){}function Zs(e,t){var n=ls();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&$o(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Qs(e,t){var n=ls();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&$o(t,r[1]))return r[0];if(r=e(),qo){$e(!0);try{e()}finally{$e(!1)}}return n.memoizedState=[r,t],r}function $s(e,t,n){return n===void 0||Ho&1073741824&&!(sd&261930)?e.memoizedState=t:(e.memoizedState=n,e=Vd(),V.lanes|=e,hd|=e,n)}function ec(e,t,n,r){return Vr(n,t)?n:Eo.current===null?!(Ho&106)||Ho&1073741824&&!(sd&261930)?(Ic=!0,e.memoizedState=n):(e=Vd(),V.lanes|=e,hd|=e,t):(e=$s(e,n,r),Vr(e,t)||(Ic=!0),e)}function tc(e,t,n,r,i){var a=ve.p;ve.p=a!==0&&8>a?a:8;var o=N.T,s={};s.types=o===null?null:o.types,N.T=s,pc(e,!1,t,n);try{var c=i(),l=N.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?fc(e,t,Ua(c,r),Bd(e)):fc(e,t,r,Bd(e))}catch(n){fc(e,t,{then:function(){},status:`rejected`,reason:n},Bd())}finally{ve.p=a,o!==null&&s.types!==null&&(o.types=s.types),N.T=o}}function nc(){}function rc(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=ic(e).queue;tc(e,a,t,ye,n===null?nc:function(){return ac(e),n(r)})}function ic(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ye,baseState:ye,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:ye},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ac(e){var t=ic(e);t.next===null&&(t=e.alternate.memoizedState),fc(e,t.next.queue,{},Bd())}function oc(){return Ta(gh)}function sc(){return ls().memoizedState}function cc(){return ls().memoizedState}function lc(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Bd();e=_o(n);var r=vo(t,e,n);r!==null&&(Ud(r,t,n),yo(r,t,n)),t={cache:Ma()},e.payload=t;return}t=t.return}}function uc(e,t,n){var r=Bd();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},mc(e)?hc(t,n):(n=Ei(e,t,n,r),n!==null&&(Ud(n,e,r),gc(n,t,r)))}function dc(e,t,n){fc(e,t,n,Bd())}function fc(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(mc(e))hc(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Vr(s,o))return Ti(e,t,i,0),ad===null&&wi(),!1}catch{}if(n=Ei(e,t,i,r),n!==null)return Ud(n,e,r),gc(n,t,r),!0}return!1}function pc(e,t,n,r){if(r={lane:2,revertLane:G(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},mc(e)){if(t)throw Error(i(479))}else t=Ei(e,n,r,2),t!==null&&Ud(t,e,2)}function mc(e){var t=e.alternate;return e===V||t!==null&&t===V}function hc(e,t){Ko=Go=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function gc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,gt(e,n)}}var _c={readContext:Ta,use:fs,useCallback:Qo,useContext:Qo,useEffect:Qo,useImperativeHandle:Qo,useLayoutEffect:Qo,useInsertionEffect:Qo,useMemo:Qo,useReducer:Qo,useRef:Qo,useState:Qo,useDebugValue:Qo,useDeferredValue:Qo,useTransition:Qo,useSyncExternalStore:Qo,useId:Qo,useHostTransitionStatus:Qo,useFormState:Qo,useActionState:Qo,useOptimistic:Qo,useMemoCache:Qo,useCacheRefresh:Qo,useEffectEvent:Qo},vc={readContext:Ta,use:fs,useCallback:function(e,t){return cs().memoizedState=[e,t===void 0?null:t],e},useContext:Ta,useEffect:Hs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Bs(4194308,4,Js.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Bs(4194308,4,e,t)},useInsertionEffect:function(e,t){Bs(4,2,e,t)},useMemo:function(e,t){var n=cs();t=t===void 0?null:t;var r=e();if(qo){$e(!0);try{e()}finally{$e(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=cs();if(n!==void 0){var i=n(t);if(qo){$e(!0);try{n(t)}finally{$e(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=uc.bind(null,V,e),[r.memoizedState,e]},useRef:function(e){var t=cs();return e={current:e},t.memoizedState=e},useState:function(e){e=ws(e);var t=e.queue,n=dc.bind(null,V,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Xs,useDeferredValue:function(e,t){return $s(cs(),e,t)},useTransition:function(){var e=ws(!1);return e=tc.bind(null,V,e.queue,!0,!1),cs().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=V,a=cs();if(B){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),ad===null)throw Error(i(349));sd&127||ys(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Hs(xs.bind(null,r,o,e),[e]),r.flags|=2048,Rs(9,{destroy:void 0},bs.bind(null,r,o,n,t),null),n},useId:function(){var e=cs(),t=ad.identifierPrefix;if(B){var n=Zi,r=Xi;n=(r&~(1<<32-et(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Jo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Zo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:oc,useFormState:Ns,useActionState:Ns,useOptimistic:function(e){var t=cs();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=pc.bind(null,V,!0,n),n.dispatch=t,[e,t]},useMemoCache:ps,useCacheRefresh:function(){return cs().memoizedState=lc.bind(null,V)},useEffectEvent:function(e){var t=cs(),n={impl:e};return t.memoizedState=n,function(){if(id&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},yc={readContext:Ta,use:fs,useCallback:Zs,useContext:Ta,useEffect:Us,useImperativeHandle:Ys,useInsertionEffect:Ks,useLayoutEffect:qs,useMemo:Qs,useReducer:hs,useRef:zs,useState:function(){return hs(ms)},useDebugValue:Xs,useDeferredValue:function(e,t){return ec(ls(),Uo.memoizedState,e,t)},useTransition:function(){var e=hs(ms)[0],t=ls().memoizedState;return[typeof e==`boolean`?e:ds(e),t]},useSyncExternalStore:vs,useId:sc,useHostTransitionStatus:oc,useFormState:Ps,useActionState:Ps,useOptimistic:function(e,t){return Ts(ls(),Uo,e,t)},useMemoCache:ps,useCacheRefresh:cc,useEffectEvent:Gs},bc={readContext:Ta,use:fs,useCallback:Zs,useContext:Ta,useEffect:Us,useImperativeHandle:Ys,useInsertionEffect:Ks,useLayoutEffect:qs,useMemo:Qs,useReducer:_s,useRef:zs,useState:function(){return _s(ms)},useDebugValue:Xs,useDeferredValue:function(e,t){var n=ls();return Uo===null?$s(n,e,t):ec(n,Uo.memoizedState,e,t)},useTransition:function(){var e=_s(ms)[0],t=ls().memoizedState;return[typeof e==`boolean`?e:ds(e),t]},useSyncExternalStore:vs,useId:sc,useHostTransitionStatus:oc,useFormState:Ls,useActionState:Ls,useOptimistic:function(e,t){var n=ls();return Uo===null?(n.baseState=e,[e,n.queue.dispatch]):Ts(n,Uo,e,t)},useMemoCache:ps,useCacheRefresh:cc,useEffectEvent:Gs};function xc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:D({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Sc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Bd(),i=_o(r);i.payload=t,n!=null&&(i.callback=n),t=vo(e,i,r),t!==null&&(Ud(t,e,r),yo(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Bd(),i=_o(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=vo(e,i,r),t!==null&&(Ud(t,e,r),yo(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Bd(),r=_o(n);r.tag=2,t!=null&&(r.callback=t),t=vo(e,r,n),t!==null&&(Ud(t,e,n),yo(t,e,n))}};function Cc(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Hr(n,r)||!Hr(i,a):!0}function wc(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Sc.enqueueReplaceState(t,t.state,null)}function Tc(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=D({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Ec(e){bi(e)}function Dc(e){console.error(e)}function Oc(e){bi(e)}function kc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ac(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function jc(e,t,n){return n=_o(n),n.tag=3,n.payload={element:null},n.callback=function(){kc(e,t)},n}function Mc(e){return e=_o(e),e.tag=3,e}function Nc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Ac(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ac(t,n,r),typeof i!=`function`&&(Dd===null?Dd=new Set([this]):Dd.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Pc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Sa(t,n,a,!0),n=jo.current,n!==null){switch(n.tag){case 31:case 13:case 19:return Mo===null?tf():n.alternate===null&&md===0&&(md=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Qa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Sf(e,r,a)),!1;case 22:return n.flags|=65536,r===Qa?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Sf(e,r,a)),!1}throw Error(i(435,n.tag))}return Sf(e,r,a),tf(),!1}if(B)return t=jo.current,t===null?(r!==sa&&(t=Error(i(423),{cause:r}),ma(Hi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=Hi(r,n),a=jc(e.stateNode,r,a),bo(e,a),md!==4&&(md=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==sa&&(e=Error(i(422),{cause:r}),ma(Hi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=Hi(o,n),bd===null?bd=[o]:bd.push(o),md!==4&&(md=2),t===null)return!0;r=Hi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=jc(n.stateNode,r,e),bo(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(Dd===null||!Dd.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Mc(a),Nc(a,e,n,r),bo(n,a),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Fc=Error(i(461)),Ic=!1;function Lc(e,t,n,r){t.child=e===null?po(t,null,n,r):fo(t,e.child,n,r)}function Rc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return wa(t),r=es(e,t,n,o,a,i),s=is(),e!==null&&!Ic?(as(e,t,i),H(e,t,i)):(B&&s&&ea(t),t.flags|=1,Lc(e,t,r,i),t.child)}function zc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Ni(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Bc(e,t,a,r,i)):(e=Ii(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!fl(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Hr:n,n(o,r)&&e.ref===t.ref)return H(e,t,i)}return t.flags|=1,e=Pi(a,r),e.ref=t.ref,e.return=t,t.child=e}function Bc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Hr(a,r)&&e.ref===t.ref){if(Ic=!1,t.pendingProps=r=a,fl(e,i))e.flags&131072&&(Ic=!0);else return t.lanes=e.lanes,H(e,t,i)}}return Jc(e,t,n,r,i)}function Vc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return Uc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&qa(t,a===null?null:a.cachePool),a===null?ko():Oo(t,a),Fo(t);else return r=t.lanes=536870912,Uc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&qa(t,null),ko(),Io()):(qa(t,a.cachePool),Oo(t,a),Io(),t.memoizedState=null);return Lc(e,t,i,n),t.child}function Hc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Uc(e,t,n,r,i){var a=Ka();return a=a===null?null:{parent:ja._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&qa(t,null),ko(),Fo(t),e!==null&&Sa(e,t,r,!0),t.childLanes=i,null}function Wc(e,t){return t=rl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Gc(e,t,n){return fo(t,e.child,null,n),e=Wc(t,t.pendingProps),e.flags|=2,Lo(t),t.memoizedState=null,e}function Kc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(B){if(r.mode===`hidden`)return e=Wc(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Hc(null,e);if(Po(t),(e=ia)?(e=mm(e,oa),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Yi===null?null:{id:Xi,overflow:Zi},retryLane:536870912,hydrationErrors:null},n=zi(e),n.return=t,t.child=n,ra=t,ia=null)):e=null,e===null)throw ca(t);return t.lanes=536870912,null}return Wc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Po(t),a){if(t.flags&256)t.flags&=-257,t=Gc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(Ic||Sa(e,t,n,!1),a=(n&e.childLanes)!==0,Ic||a){if(Eo.current===null){if(r=ad,r!==null&&(s=_t(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Di(e,s),Ud(r,e,s),Fc;tf()}t=Gc(e,t,n)}else e=o.treeContext,ia=vm(s.nextSibling),ra=t,B=!0,aa=null,oa=!1,e!==null&&na(t,e),t=Wc(t,r),t.flags|=134221824;return t}return e=Pi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function qc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Jc(e,t,n,r,i){return wa(t),n=es(e,t,n,r,void 0,i),r=is(),e!==null&&!Ic?(as(e,t,i),H(e,t,i)):(B&&r&&ea(t),t.flags|=1,Lc(e,t,n,i),t.child)}function Yc(e,t,n,r,i,a){return wa(t),t.updateQueue=null,n=ns(t,r,n,i),ts(e),r=is(),e!==null&&!Ic?(as(e,t,a),H(e,t,a)):(B&&r&&ea(t),t.flags|=1,Lc(e,t,n,a),t.child)}function Xc(e,t,n,r,i){if(wa(t),t.stateNode===null){var a=Ai,o=n.contextType;typeof o==`object`&&o&&(a=Ta(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Sc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},ho(t),o=n.contextType,a.context=typeof o==`object`&&o?Ta(o):Ai,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(xc(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Sc.enqueueReplaceState(a,a.state,null),Co(t,r,a,i),So(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Tc(n,s);a.props=c;var l=a.context,u=n.contextType;o=Ai,typeof u==`object`&&u&&(o=Ta(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&wc(t,a,r,o),mo=!1;var f=t.memoizedState;a.state=f,Co(t,r,a,i),So(),l=t.memoizedState,s||f!==l||mo?(typeof d==`function`&&(xc(t,n,d,r),l=t.memoizedState),(c=mo||Cc(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,go(e,t),o=t.memoizedProps,u=Tc(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Ai,typeof l==`object`&&l&&(c=Ta(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&wc(t,a,r,c),mo=!1,f=t.memoizedState,a.state=f,Co(t,r,a,i),So();var p=t.memoizedState;o!==d||f!==p||mo||e!==null&&e.dependencies!==null&&Ca(e.dependencies)?(typeof s==`function`&&(xc(t,n,s,r),p=t.memoizedState),(u=mo||Cc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ca(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,qc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=fo(t,e.child,null,i),t.child=fo(t,null,n,i)):Lc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=H(e,t,i),e}function Zc(e,t,n,r){return fa(),t.flags|=256,Lc(e,t,n,r),t.child}var Qc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function $c(e){return{baseLanes:e,cachePool:Ja()}}function el(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=vd),e}function tl(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(Ro.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(B){if(i?No(t):Io(),(e=ia)?(e=mm(e,oa),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Yi===null?null:{id:Xi,overflow:Zi},retryLane:536870912,hydrationErrors:null},n=zi(e),n.return=t,t.child=n,ra=t,ia=null)):e=null,e===null)throw ca(t);return t.lanes=gm(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(Io(),i=t.mode,a=rl({mode:`hidden`,children:a},i),r=Li(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=$c(n),r.childLanes=el(e,o,n),t.memoizedState=Qc,Hc(null,r)):(No(t),nl(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return al(e,t,a,o,r,c,s,n)}return i?(Io(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=Pi(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=Li(i,a,n,null),i.flags|=2):i=Pi(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,Hc(null,r),r=t.child,i=e.child.memoizedState,i===null?i=$c(n):(a=i.cachePool,a===null?a=Ja():(s=ja._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=el(e,o,n),t.memoizedState=Qc,Hc(e.child,r)):(No(t),n=e.child,e=n.sibling,n=Pi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function nl(e,t){return t=rl({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function rl(e,t){return e=Mi(22,e,null,t),e.lanes=0,e}function il(e,t,n){return fo(t,e.child,null,n),e=nl(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function al(e,t,n,r,a,o,s,c){if(n)return t.flags&256?(No(t),t.flags&=-257,il(e,t,c)):t.memoizedState===null?(Io(),o=a.fallback,s=t.mode,a=rl({mode:`visible`,children:a.children},s),o=Li(o,s,c,null),o.flags|=2,a.return=t,o.return=t,a.sibling=o,t.child=a,fo(t,e.child,null,c),a=t.child,a.memoizedState=$c(c),a.childLanes=el(e,r,c),t.memoizedState=Qc,Hc(null,a)):(Io(),t.child=e.child,t.flags|=128,null);if(No(t),gm(o)){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,r!==``&&(a=Error(i(419)),a.stack=``,a.digest=r,ma({value:a,source:null,stack:null})),il(e,t,c)}if(Ic||Sa(e,t,c,!1),r=(c&e.childLanes)!==0,Ic||r){if(Eo.current!==null)return il(e,t,c);if(r=ad,r!==null&&(a=_t(r,c),a!==0&&a!==s.retryLane))throw s.retryLane=a,Di(e,a),Ud(r,e,a),Fc;return hm(o)||tf(),il(e,t,c)}return hm(o)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,ia=vm(o.nextSibling),ra=t,B=!0,aa=null,oa=!1,e!==null&&na(t,e),t=nl(t,a.children),t.flags|=134221824,t)}function ol(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),ba(e.return,t,n)}function sl(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&Vo(n)===null&&(t=e),e=e.sibling}return t}function cl(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function ll(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function ul(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Ro.current;if(t.flags&128)return zo(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,zo(t,o),i===`backwards`&&e!==null?(ll(e),Lc(e,t,r,n),ll(e)):Lc(e,t,r,n),r=B?Ki:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ol(e,n,t);else if(e.tag===19)ol(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`backwards`:n=sl(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,ll(t)),cl(t,!0,i,null,a,r);break;case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Vo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}cl(t,!0,n,null,a,r);break;case`together`:cl(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=sl(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),cl(t,!1,i,n,a,r)}return t.child}function dl(e,t,n){var r=t.pendingProps;return va(t,t.type,r.value),Lc(e,t,r.children,n),t.child}function H(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),hd|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Sa(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=Pi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Pi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function fl(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Ca(e)))}function pl(e,t,n){switch(t.tag){case 3:ke(t,t.stateNode.containerInfo),va(t,ja,e.memoizedState.cache),fa();break;case 27:case 5:je(t);break;case 4:ke(t,t.stateNode.containerInfo);break;case 10:va(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Po(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return No(t),t.flags|=128,null;r=Sa(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?tl(e,t,n):(No(t),e=H(e,t,n),e===null?null:e.sibling)}No(t);break;case 19:if(t.flags&128)return ul(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(Sa(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return ul(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),zo(t,Ro.current),r)break;return null;case 22:return t.lanes=0,Vc(e,t,n,t.pendingProps);case 24:va(t,ja,e.memoizedState.cache)}return H(e,t,n)}function ml(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Ic=!0;else{if(!fl(e,n)&&!(t.flags&128))return Ic=!1,pl(e,t,n);Ic=!!(e.flags&131072)}}else Ic=!1,B&&t.flags&1048576&&$i(t,Ki,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=to(t.elementType),t.type=e,typeof e==`function`)Ni(e)?(r=Tc(e,r),t.tag=1,t=Xc(null,t,e,r,n)):(t.tag=0,t=Jc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===M){t.tag=11,t=Rc(null,t,e,r,n);break a}if(a===oe){t.tag=14,t=zc(null,t,e,r,n);break a}if(a===j){t.tag=10,t.type=e,t=dl(null,t,n);break a}}throw t=ge(e)||e,Error(i(306,t,``))}}return t;case 0:return Jc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Tc(r,t.pendingProps),Xc(e,t,r,a,n);case 3:a:{if(ke(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,go(e,t),Co(t,r,null,n);var s=t.memoizedState;if(r=s.cache,va(t,ja,r),r!==o.cache&&xa(t,[ja],n,!0),So(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Zc(e,t,r,n);break a}if(r!==a){a=Hi(Error(i(424)),t),ma(a),t=Zc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(ia=vm(e.firstChild),ra=t,B=!0,aa=null,oa=!0,n=po(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(fa(),r===a){t=H(e,t,n);break a}Lc(e,t,r,n)}t=t.child}return t;case 26:return qc(e,t),e===null?(n=Hm(t.type,null,t.pendingProps,null))?t.memoizedState=n:B||(t.stateNode=xp(t.type,t.pendingProps,De.current,t)):t.memoizedState=Hm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return je(t),e===null&&B&&(r=t.stateNode=wm(t.type,t.pendingProps,De.current),ra=t,oa=!0,a=ia,jp(t.type)?(ym=a,ia=vm(r.firstChild)):ia=a),Lc(e,t,t.pendingProps.children,n),qc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&B&&((a=r=ia)&&(r=fm(r,t.type,t.pendingProps,oa),r===null?a=!1:(t.stateNode=r,ra=t,ia=vm(r.firstChild),oa=!1,a=!0)),a||ca(t)),je(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Sp(a,o)?r=null:s!==null&&Sp(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=es(e,t,rs,null,null,n),gh._currentValue=a),qc(e,t),Lc(e,t,r,n),t.child;case 6:return e===null&&B&&((e=n=ia)&&(n=pm(n,t.pendingProps,oa),n===null?e=!1:(t.stateNode=n,ra=t,ia=null,e=!0)),e||ca(t)),null;case 13:return tl(e,t,n);case 4:return ke(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=fo(t,null,r,n):Lc(e,t,r,n),t.child;case 11:return Rc(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,qc(e,t),Lc(e,t,r,n),t.child;case 8:return Lc(e,t,t.pendingProps.children,n),t.child;case 12:return Lc(e,t,t.pendingProps.children,n),t.child;case 10:return dl(e,t,n);case 9:return a=t.type._context,r=t.pendingProps.children,wa(t),a=Ta(a),r=r(a),t.flags|=1,Lc(e,t,r,n),t.child;case 14:return zc(e,t,t.type,t.pendingProps,n);case 15:return Bc(e,t,t.type,t.pendingProps,n);case 19:return ul(e,t,n);case 31:return Kc(e,t,n);case 22:return Vc(e,t,n,t.pendingProps);case 24:return wa(t),r=Ta(ja),e===null?(a=Ka(),a===null&&(a=ad,o=Ma(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},ho(t),va(t,ja,a)):((e.lanes&n)!==0&&(go(e,t),Co(t,null,null,n),So()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,va(t,ja,r),r!==a.cache&&xa(t,[ja],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),va(t,ja,r))),Lc(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!==`auto`?t.flags|=e===null?18882560:18874368:B&&ea(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:qc(e,t),Lc(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function hl(e){e.flags|=4}function gl(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?rh(t,r):rh(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),a){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Qd())e.flags|=8192;else throw no=Qa,Xa}}else e.flags&=-16777217}function _l(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!ih(t)){if(Qd())e.flags|=8192;else throw no=Qa,Xa}}function vl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:ft(),e.lanes|=t,yd|=t)}function yl(e,t){if(!B)switch(e.tailMode){case`visible`:break;case`collapsed`:for(var n=e.tail,r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function bl(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&1206910976,r|=i.flags&1206910976,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function xl(e,t,n){var r=t.pendingProps;switch(ta(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return bl(t),null;case 1:return bl(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),ya(ja),Ae(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(da(t)?hl(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,pa())),bl(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(hl(t),o===null?(bl(t),gl(t,a,null,r,n)):(bl(t),_l(t,o))):o?o===e.memoizedState?(bl(t),t.flags&=-16777217):(hl(t),bl(t),_l(t,o)):(e=e.memoizedProps,e!==r&&hl(t),bl(t),gl(t,a,e,r,n)),null;case 27:if(Me(t),n=De.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&hl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return bl(t),t.subtreeFlags&=-33554433,null}e=Te.current,da(t)?la(t,e):(e=wm(a,r,n),t.stateNode=e,hl(t))}return bl(t),t.subtreeFlags&=-33554433,null;case 5:if(Me(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&hl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return bl(t),t.subtreeFlags&=-33554433,null}if(o=Te.current,da(t))la(t,o);else{var s=vp(De.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[Ct]=t,o[wt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(dp(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&hl(t)}}return bl(t),t.subtreeFlags&=-33554433,gl(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&hl(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=De.current,da(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=ra,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[Ct]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||cp(e.nodeValue,n)),e||ca(t,!0)}else e=vp(e).createTextNode(r),e[Ct]=t,t.stateNode=e}return bl(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=da(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[Ct]=t}else fa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;bl(t),e=!1}else n=pa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Lo(t),t):(Lo(t),null);if(t.flags&128)throw Error(i(558))}return bl(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=da(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[Ct]=t}else fa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;bl(t),a=!1}else a=pa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Lo(t),t):(Lo(t),null)}return Lo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),vl(t,t.updateQueue),bl(t),null);case 4:return Ae(),e===null&&Qf(t.stateNode.containerInfo),t.flags|=67108864,bl(t),null;case 10:return ya(t.type),bl(t),null;case 19:if(Bo(t),r=t.memoizedState,r===null)return bl(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)yl(r,!1);else{if(md!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Vo(e),o!==null){for(t.flags|=128,yl(r,!1),e=o.updateQueue,t.updateQueue=e,vl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Fi(n,e),n=n.sibling;return zo(t,Ro.current&1|2),B&&Qi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&F()>Td&&(t.flags|=128,a=!0,yl(r,!1),t.lanes=4194304)}}else{if(!a){if(e=Vo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,vl(t,e),yl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!B)return bl(t),null}else 2*F()-r.renderingStartTime>Td&&n!==536870912&&(t.flags|=128,a=!0,yl(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=F(),e.sibling=null,o=Ro.current,o=a?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||B?zo(t,o):(n=o,we(jo,t),we(Ro,n),Mo===null&&(Mo=t)),B&&Qi(t,r.treeForkCount),e}return bl(t),null;case 22:case 23:return Lo(t),Ao(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(bl(t),t.subtreeFlags&6&&(t.flags|=8192)):bl(t),n=t.updateQueue,n!==null&&vl(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&Ce(Ga),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),ya(ja),bl(t),null;case 25:return null;case 30:return t.flags|=33554432,bl(t),null}throw Error(i(156,t.tag))}function Sl(e,t){switch(ta(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ya(ja),Ae(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Me(t),null;case 31:if(t.memoizedState!==null){if(Lo(t),t.alternate===null)throw Error(i(340));fa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Lo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));fa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Bo(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Ae(),null;case 10:return ya(t.type),null;case 22:case 23:return Lo(t),Ao(),e!==null&&Ce(Ga),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ya(ja),null;case 25:return null;default:return null}}function Cl(e,t){switch(ta(t),t.tag){case 3:ya(ja),Ae();break;case 26:case 27:case 5:Me(t);break;case 4:Ae();break;case 31:t.memoizedState!==null&&Lo(t);break;case 13:Lo(t);break;case 19:Bo(t);break;case 10:ya(t.type);break;case 22:case 23:Lo(t),Ao(),e!==null&&Ce(Ga);break;case 24:ya(ja)}}function wl(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){W(t,t.return,e)}}function Tl(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){W(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){W(t,t.return,e)}}function El(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{To(t,n)}catch(t){W(e,e.return,t)}}}function Dl(e,t,n){n.props=Tc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){W(e,t,n)}}function Ol(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=_i(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Up(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Wp(e);h(e.child,!1,sm,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){W(e,t,n)}}function kl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){W(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){W(e,t,n)}else n.current=null}}function Al(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)lm(e.stateNode,t[n])}function jl(e){for(var t=e.return;t!==null&&(Pl(t)&&lm(e.stateNode,t.stateNode),!Nl(t));)t=t.return}function Ml(e){for(var t=e.return;t!==null&&(Pl(t)&&um(e.stateNode,t.stateNode),!Nl(t));)t=t.return}function Nl(e){return e.tag===5||e.tag===3||e.tag===27}function Pl(e){return e&&e.tag===7&&e.stateNode!==null}function Fl(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){W(e,e.return,t)}}function Il(e,t,n){try{var r=e.stateNode;pp(r,e.type,n,t),r[wt]=t}catch(t){W(e,e.return,t)}}function Ll(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&jp(e.type)||e.tag===4}function Rl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Ll(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&jp(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function zl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=z)),Al(e,r),Kt=!0;else if(i!==4&&(i===27&&(Al(e,r),r=null,jp(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(zl(e,t,n,r),e=e.sibling;e!==null;)zl(e,t,n,r),e=e.sibling}function Bl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),Al(e,r),Kt=!0;else if(i!==4&&(i===27&&(Al(e,r),r=null,jp(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Bl(e,t,n,r),e=e.sibling;e!==null;)Bl(e,t,n,r),e=e.sibling}function Vl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);dp(t,r,n),t[Ct]=e,t[wt]=n}catch(t){W(e,e.return,t)}}var Hl=!1,Ul=null;function Wl(e){(e.tag===30||e.subtreeFlags&33554432)&&(Hl=!0)}var Gl=null;function Kl(){var e=Gl;return Gl=null,e}var ql=0;function Jl(e,t,n,r,i){return ql=0,Yl(e.child,t,n,r,i)}function Yl(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=Lp(o);r.push(s),s.view&&(a=!0)}else a||Lp(o).view&&(a=!0);Hl=!0,Pp(o,ql===0?t:t+`_`+ql,n),ql++}else e.tag===22&&e.memoizedState!==null||e.tag===30&&i||Yl(e.child,t,n,r,i)&&(a=!0);e=e.sibling}return a}function Xl(e,t){for(;e!==null;)e.tag===5?Fp(e.stateNode,e.memoizedProps):e.tag===22&&e.memoizedState!==null||e.tag===30&&t||Xl(e.child,t),e=e.sibling}function Zl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Zl(e),e.tag===30&&e.flags&18874368&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name===`auto`)throw Error(i(544));var n=t.name;t=yi(t.default,t.share),t!==`none`&&(Jl(e,n,t,null,!1)||Xl(e.child,!1))}e=e.sibling}}function Ql(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=_i(r,n),a=yi(r.default,n.paired?r.share:r.enter);a===`none`?Zl(e):Jl(e,i,a,null,!1)?(Zl(e),n.paired||t||Hd(e,r.onEnter)):Xl(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Ql(e,t),e=e.sibling;else Zl(e)}function $l(e){if(Ul!==null&&Ul.size!==0){var t=Ul;if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var n=e.memoizedProps,r=n.name;if(r!=null&&r!==`auto`){var i=t.get(r);if(i!==void 0){var a=yi(n.default,n.share);if(a!==`none`&&(Jl(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,Hd(e,n.onShare)):Xl(e.child,!1)),t.delete(r),t.size===0)break}}}$l(e)}e=e.sibling}}}function eu(e){if(e.tag===30){var t=e.memoizedProps,n=_i(t,e.stateNode),r=Ul===null?void 0:Ul.get(n),i=yi(t.default,r===void 0?t.exit:t.share);i!==`none`&&(Jl(e,n,i,null,!1)?r===void 0?Hd(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Ul.delete(n),Hd(e,t.onShare)):Xl(e.child,!1)),Ul!==null&&$l(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)eu(e),e=e.sibling;else Ul!==null&&$l(e)}function tu(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=_i(t,e.stateNode);t=yi(t.default,t.update),e.flags&=-5,t!==`none`&&Jl(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&tu(e);e=e.sibling}}function nu(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var t=e.stateNode;t.paired!==null&&(t.paired=null,Xl(e.child,!1))}nu(e)}e=e.sibling}}function ru(e){if(e.tag===30)e.stateNode.paired=null,Xl(e.child,!1),nu(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)ru(e),e=e.sibling;else nu(e)}function iu(e){for(e=e.child;e!==null;)e.tag===30?Xl(e.child,!1):e.subtreeFlags&33554432&&iu(e),e=e.sibling}function au(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&ql<a.length){var l=a[ql],u=Lp(c);(l.view||u.view)&&(s=!0);var d;if(d=!(e.flags&4)){if(u.clip)d=!0;else{d=l.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}}d&&(e.flags|=4),u.abs?u=!l.abs:(l=l.rect,u=u.rect,u=l.height!==u.height||l.width!==u.width),u&&(e.flags|=32)}else e.flags|=32;e.flags&4&&Pp(c,ql===0?n:n+`_`+ql,i),s&&e.flags&4||(Gl===null&&(Gl=[]),Gl.push(c,ql===0?r:r+`_`+ql,t.memoizedProps)),ql++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:au(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function ou(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=_i(n,r),a=yi(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(Rp)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;ql=0,i=au(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||Hd(e,n.onUpdate))}else e.subtreeFlags&33554432&&ou(e,t);e=e.sibling}}var su=!1,cu=!1,lu=!1,uu=!1,du=typeof WeakSet==`function`?WeakSet:Set,fu=null,pu=!1,mu=!1,hu=!1,gu=!1;function _u(e,t,n){if(e=e.containerInfo,gp=Th,e=qr(e),Jr(e)){if(`selectionStart`in e)var r={start:e.selectionStart,end:e.selectionEnd};else a:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==r||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===r&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=c===-1||l===-1?null:{start:c,end:l}}else r=null}r||={start:0,end:0}}else r=null;for(_p={focusedElem:e,selectionRange:r},Th=!1,n=(n&335544064)===n,fu=t,t=n?9270:1024;fu!==null;){if(e=fu,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&eu(r[a]);if(e.alternate===null&&e.flags&2)n&&Wl(e),vu(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&eu(r),vu(n);continue}if(r!==null&&r.memoizedState!==null){n&&Wl(e),vu(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,fu=r):(n&&tu(e),vu(n))}}Ul=null}function vu(e){for(;fu!==null;){var t=fu,n=e,r=t.alternate,a=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if(a&1024&&r!==null){n=void 0,a=r.memoizedProps,r=r.memoizedState;var o=t.stateNode;try{var s=Tc(t.type,a);n=o.getSnapshotBeforeUpdate(s,r),o.__reactInternalSnapshotBeforeUpdate=n}catch(e){W(t,t.return,e)}}break;case 3:if(a&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)dm(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:dm(r);break;default:r.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=_i(r.memoizedProps,r.stateNode),a=t.memoizedProps,a=yi(a.default,a.update),a!==`none`&&Jl(r,n,a,r.memoizedState=[],!0));break;default:if(a&1024)throw Error(i(163))}if(r=t.sibling,r!==null){r.return=t.return,fu=r;break}fu=t.return}}function yu(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:zu(e,n),r&4&&wl(5,n);break;case 1:if(zu(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){W(n,n.return,e)}else{var i=Tc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){W(n,n.return,e)}}}r&64&&El(n),r&512&&Ol(n,n.return);break;case 3:if(zu(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{To(e,t)}catch(e){W(n,n.return,e)}}break;case 27:t===null&&r&4&&Vl(n);case 26:case 5:zu(e,n),t===null&&r&4&&Fl(n),r&512&&Ol(n,n.return);break;case 12:zu(e,n);break;case 31:zu(e,n),r&4&&Ou(e,n);break;case 13:zu(e,n),r&4&&ku(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Tf.bind(null,n),_m(e,n))));break;case 22:if(r=n.memoizedState!==null||su,!r){var a=t!==null&&t.memoizedState!==null||cu;t=su,i=cu,su=r,(cu=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),Vu(e,n,r)):zu(e,n),su=t,cu=i}break;case 30:zu(e,n),r&512&&Ol(n,n.return);break;case 7:r&512&&Ol(n,n.return);default:zu(e,n)}}function bu(e,t){for(e=e.child;e!==null;)xu(e,t),e=e.sibling}function xu(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var r=n.style;typeof r.setProperty==`function`?r.setProperty(`display`,`none`,`important`):r.display=`none`}else{var i=e.stateNode,a=e.memoizedProps.style,o=a!=null&&a.hasOwnProperty(`display`)?a.display:null;i.style.display=o==null||typeof o==`boolean`?``:(``+o).trim()}}catch(t){W(e,e.return,t)}Su(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,Kt=!0}catch(t){W(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?Np(s,!0):Np(e.stateNode,!1)}catch(t){W(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&bu(e,t);break;default:bu(e,t)}}function Su(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:xu(n,r);break a;case 22:n.memoizedState===null&&Su(n,r);break a;default:Su(n,r)}}e=e.sibling}}function Cu(e){var t=e.alternate;t!==null&&(e.alternate=null,Cu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Mt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var wu=null,Tu=!1;function Eu(e,t,n){for(n=n.child;n!==null;)Du(e,t,n),n=n.sibling}function Du(e,t,n){if(Qe&&typeof Qe.onCommitFiberUnmount==`function`)try{Qe.onCommitFiberUnmount(Ze,n)}catch{}switch(n.tag){case 26:cu||kl(n,t),Eu(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!cu&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:cu||kl(n,t),Ml(n);var r=wu,i=Tu;jp(n.type)&&(wu=n.stateNode,Tu=!1),Eu(e,t,n),Tm(n.stateNode,n.type,n.memoizedProps),wu=r,Tu=i;break;case 5:cu||kl(n,t),Ml(n);case 6:if(n.tag===6&&Ml(n),r=wu,i=Tu,wu=null,Eu(e,t,n),wu=r,Tu=i,wu!==null){if(Tu)try{(wu.nodeType===9?wu.body:wu.nodeName===`HTML`?wu.ownerDocument.body:wu).removeChild(n.stateNode),Kt=!0}catch(e){W(n,t,e)}else try{wu.removeChild(n.stateNode),Kt=!0}catch(e){W(n,t,e)}}break;case 18:wu!==null&&(Tu?(e=wu,Mp(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Zh(e)):Mp(wu,n.stateNode));break;case 4:r=wu,i=Tu,wu=n.stateNode.containerInfo,Tu=!0,Eu(e,t,n),wu=r,Tu=i;break;case 0:case 11:case 14:case 15:Tl(2,n,t),cu||Tl(4,n,t),Eu(e,t,n);break;case 1:cu||(kl(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Dl(n,t,r)),Eu(e,t,n);break;case 21:Eu(e,t,n);break;case 22:cu=(r=cu)||n.memoizedState!==null,Eu(e,t,n),cu=r;break;case 30:kl(n,t),Eu(e,t,n);break;case 7:cu||kl(n,t),Eu(e,t,n);break;default:Eu(e,t,n)}}function Ou(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Zh(e)}catch(e){W(t,t.return,e)}}}function ku(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Zh(e)}catch(e){W(t,t.return,e)}}function Au(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new du),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new du),t;default:throw Error(i(435,e.tag))}}function ju(e,t){var n=Au(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Ef.bind(null,e,t);t.then(r,r)}})}function Mu(e,t,n){var r=t.deletions;if(r!==null)for(var a=0;a<r.length;a++){var o=r[a],s=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(jp(l.type)){wu=l.stateNode,Tu=!1;break a}break;case 5:wu=l.stateNode,Tu=!1;break a;case 3:case 4:wu=l.stateNode.containerInfo,Tu=!0;break a}l=l.return}if(wu===null)throw Error(i(160));Du(s,c,o),wu=null,Tu=!1,s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Pu(t,e,n),t=t.sibling}var Nu=null;function Pu(e,t,n){var r=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(a&4&&(r=e.updateQueue,r=r===null?null:r.events,r!==null))for(var o=0;o<r.length;o++){var s=r[o];s.ref.impl=s.nextImpl}Mu(t,e,n),Fu(e),a&4&&(Tl(3,e,e.return),wl(3,e),Tl(5,e,e.return));break;case 1:Mu(t,e,n),Fu(e),a&512&&(cu||r===null||kl(r,r.return)),a&64&&su&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(o=Nu,Mu(t,e,n),Fu(e),a&512&&(cu||r===null||kl(r,r.return)),a&4){if(a=r===null?null:r.memoizedState,n=e.memoizedState,r===null){if(n===null){if(e.stateNode===null){if(su)e.stateNode=xp(e.type,e.memoizedProps,t.containerInfo,e);else{a:{t=e.type,n=e.memoizedProps,a=o.ownerDocument||o;b:switch(t){case`title`:r=a.getElementsByTagName(`title`)[0],(!r||r[At]||r[Ct]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=a.createElement(t),a.head.insertBefore(r,a.querySelector(`head > title`))),dp(r,t,n),r[Ct]=e,Lt(r),t=r;break a;case`link`:if(o=eh(`link`,`href`,a).get(t+(n.href||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&r.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&r.getAttribute(`title`)===(n.title==null?null:n.title)&&r.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(s,1);break b}}r=a.createElement(t),dp(r,t,n),a.head.appendChild(r);break;case`meta`:if(o=eh(`meta`,`content`,a).get(t+(n.content||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`content`)===(n.content==null?null:``+n.content)&&r.getAttribute(`name`)===(n.name==null?null:n.name)&&r.getAttribute(`property`)===(n.property==null?null:n.property)&&r.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){o.splice(s,1);break b}}r=a.createElement(t),dp(r,t,n),a.head.appendChild(r);break;default:throw Error(i(468,t))}r[Ct]=e,Lt(r),t=r}e.stateNode=t}}else su||th(o,e.type,e.stateNode)}else e.stateNode=Ym(o,n,e.memoizedProps)}else a===n?n===null&&e.stateNode!==null&&Il(e,e.memoizedProps,r.memoizedProps):(a===null?(t=r.stateNode,t===null||cu||t.parentNode.removeChild(t)):a.count--,n===null?su||th(o,e.type,e.stateNode):Ym(o,n,e.memoizedProps))}break;case 27:Mu(t,e,n),Fu(e),a&512&&(cu||r===null||kl(r,r.return)),r!==null&&a&4&&Il(e,e.memoizedProps,r.memoizedProps);break;case 5:if(o=lu,lu=!1,Mu(t,e,n),lu=o,Fu(e),a&512&&(cu||r===null||kl(r,r.return)),e.flags&32){t=e.stateNode;try{dn(t,``),Kt=!0}catch(t){W(e,e.return,t)}}a&4&&e.stateNode!=null&&(t=e.memoizedProps,Il(e,t,r===null?t:r.memoizedProps)),a&1024&&(uu=!0);break;case 6:if(Mu(t,e,n),Fu(e),a&4){if(e.stateNode===null)throw Error(i(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,Kt=!0}catch(t){W(e,e.return,t)}}break;case 3:if(Kt=!1,$m=null,o=Nu,Nu=km(t.containerInfo),Mu(t,e,n),Nu=o,Fu(e),a&4&&r!==null&&r.memoizedState.isDehydrated)try{Zh(t.containerInfo)}catch(t){W(e,e.return,t)}uu&&(uu=!1,Iu(e)),Kt=!1;break;case 4:a=lu,lu=su,r=qt(),o=Nu,Nu=km(e.stateNode.containerInfo),Mu(t,e,n),Fu(e),Nu=o,Kt&&mu&&(hu=!0),Kt=r,lu=a;break;case 12:Mu(t,e,n),Fu(e);break;case 31:Mu(t,e,n),Fu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,ju(e,t)));break;case 13:Mu(t,e,n),Fu(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(Cd=F()),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,ju(e,t)));break;case 22:o=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=su,l=cu,u=lu;su=c||o,lu=u||o,cu=l||s,Mu(t,e,n),cu=l,lu=u,su=c,Fu(e),a&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,!o||r===null||s||su||cu||(t=s||cu,n=su,r=cu,su=o||su,cu=t,Bu(e,2),su=n,cu=r),!o&&lu||bu(e,o)),a&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,ju(e,n))));break;case 19:Mu(t,e,n),Fu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,ju(e,t)));break;case 30:a&512&&(cu||r===null||kl(r,r.return)),a=qt(),o=mu,s=(n&335544064)===n,c=e.memoizedProps,mu=s&&yi(c.default,c.update)!==`none`,Mu(t,e,n),Fu(e),s&&r!==null&&Kt&&(e.flags|=4),mu=o,Kt=a;break;case 21:break;case 7:a&512&&(cu||r===null||kl(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:Mu(t,e,n),Fu(e)}}function Fu(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Ll(r)){n=r;break}r=r.return}r=null;for(var a=e.return;a!==null;){if(Pl(a)){var o=a.stateNode;r===null?r=[o]:r.push(o)}if(Nl(a))break;a=a.return}var s=r;if(n==null)throw Error(i(160));switch(n.tag){case 27:var c=n.stateNode;Bl(e,Rl(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(dn(l,``),n.flags&=-33),Bl(e,Rl(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;zl(e,Rl(e),u,s);break;default:throw Error(i(161))}}catch(t){W(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Iu(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Iu(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,Th=!0,t.reset(),Th=!1),e=e.sibling}}function Lu(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Ru(t,e),t=t.sibling;else ou(t,!1)}function Ru(e,t){var n=e.alternate;if(n===null)Ql(e,!1);else switch(e.tag){case 3:if(gu=pu=!1,Kl(),Lu(t,e),!pu&&!hu){if(e=Gl,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];Fp(n,e[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(`+i+`)`})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===``&&(e.style.viewTransitionName=`none`,e.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(root)`}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition`})),gu=!0}Gl=null;break;case 5:Lu(t,e);break;case 4:r=pu,pu=!1,Lu(t,e),pu&&(hu=!0),pu=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Lu(t,e):Ql(e,!1));break;case 30:r=pu,i=Kl(),pu=!1,Lu(t,e),pu&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=_i(a,o),o=_i(n.memoizedProps,o);var s=yi(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,ql=0,t=au(e,n,t,o,s,a,!0),ql!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(Hd(e,e.memoizedProps.onUpdate),Gl=i):i!==null&&(i.push.apply(i,Gl),Gl=i),pu=e.flags&32?!0:r;break;default:Lu(t,e)}}function zu(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)yu(e,t.alternate,t),t=t.sibling}function Bu(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:Tl(4,n,n.return),Bu(n,r);break;case 1:kl(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&Dl(n,n.return,i),Bu(n,r);break;case 27:r&2&&Tm(n.stateNode,n.type,n.memoizedProps);case 5:kl(n,n.return),n.tag!==5&&n.tag!==27||Ml(n),Bu(n,r);break;case 6:Ml(n);break;case 26:kl(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||cu||i.parentNode.removeChild(i),Bu(n,r);break;case 22:n.memoizedState===null&&Bu(n,r);break;case 30:kl(n,n.return),Bu(n,r);break;case 7:kl(n,n.return);default:Bu(n,r)}e=e.sibling}}function Vu(e,t,n){for(n=t.subtreeFlags&8772?n:n&-2,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags,s=!!(n&1);switch(a.tag){case 0:case 11:case 15:Vu(i,a,n),wl(4,a);break;case 1:if(Vu(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){W(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var c=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)wo(l[i],c)}catch(e){W(r,r.return,e)}}s&&o&64&&El(a),Ol(a,a.return);break;case 27:n&2&&Vl(a);case 5:a.tag!==5&&a.tag!==27||jl(a),Vu(i,a,n),s&&r===null&&o&4&&Fl(a),Ol(a,a.return);break;case 6:jl(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||su||th(km(c.ownerDocument),a.type,c),Vu(i,a,n),s&&r===null&&o&4&&Fl(a),Ol(a,a.return);break;case 12:Vu(i,a,n);break;case 31:Vu(i,a,n),s&&o&4&&Ou(i,a);break;case 13:Vu(i,a,n),s&&o&4&&ku(i,a);break;case 22:a.memoizedState===null&&Vu(i,a,n),Ol(a,a.return);break;case 30:Vu(i,a,n),Ol(a,a.return);break;case 7:Ol(a,a.return);default:Vu(i,a,n)}t=t.sibling}}function Hu(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Na(n))}function Uu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Na(e))}function Wu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Gu(e,t,n,r),t=t.sibling;else i&&iu(t)}function Gu(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&ru(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Wu(e,t,n,r),a&2048&&wl(9,t);break;case 1:Wu(e,t,n,r);break;case 3:Wu(e,t,n,r),i&&gu&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,e.style.viewTransitionName===`root`&&(e.style.viewTransitionName=``),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===`none`&&(e.style.viewTransitionName=``)),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&Na(a)));break;case 12:if(a&2048){Wu(e,t,n,r),a=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,a.passiveEffectDuration,-0)}catch(e){W(t,t.return,e)}}else Wu(e,t,n,r);break;case 31:Wu(e,t,n,r);break;case 13:Wu(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?(i&&s!==null&&s.memoizedState!==null&&ru(t),o._visibility&2?Wu(e,t,n,r):(o._visibility|=2,Ku(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&ru(s),o._visibility&2?Wu(e,t,n,r):qu(e,t)),a&2048&&Hu(s,t);break;case 24:Wu(e,t,n,r),a&2048&&Uu(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(Xl(a.child,!0),Xl(t.child,!0))),Wu(e,t,n,r);break;default:Wu(e,t,n,r)}}function Ku(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Ku(a,o,s,c,i),wl(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Ku(a,o,s,c,i)):u._visibility&2?Ku(a,o,s,c,i):qu(a,o),i&&l&2048&&Hu(o.alternate,o);break;case 24:Ku(a,o,s,c,i),i&&l&2048&&Uu(o.alternate,o);break;default:Ku(a,o,s,c,i)}t=t.sibling}}function qu(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:qu(n,r),i&2048&&Hu(r.alternate,r);break;case 24:qu(n,r),i&2048&&Uu(r.alternate,r);break;default:qu(n,r)}t=t.sibling}}var Ju=8192;function Yu(e,t,n){if(e.subtreeFlags&Ju)for(e=e.child;e!==null;)Xu(e,t,n),e=e.sibling}function Xu(e,t,n){switch(e.tag){case 26:Yu(e,t,n),e.flags&Ju&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&oh(n,e)):sh(n,Nu,e.memoizedState,e.memoizedProps));break;case 5:Yu(e,t,n),e.flags&Ju&&(e=e.stateNode,(t&335544128)===t&&oh(n,e));break;case 3:case 4:var r=Nu;Nu=km(e.stateNode.containerInfo),Yu(e,t,n),Nu=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Ju,Ju=16777216,Yu(e,t,n),Ju=r):Yu(e,t,n));break;case 30:if((e.flags&Ju)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Ul===null&&(Ul=new Map),Ul.set(r,i)}Yu(e,t,n);break;default:Yu(e,t,n)}}function Zu(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Qu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];fu=r,td(r,e)}Zu(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)$u(e),e=e.sibling}function $u(e){switch(e.tag){case 0:case 11:case 15:Qu(e),e.flags&2048&&Tl(9,e,e.return);break;case 3:Qu(e);break;case 12:Qu(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,ed(e)):Qu(e);break;default:Qu(e)}}function ed(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];fu=r,td(r,e)}Zu(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Tl(8,t,t.return),ed(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,ed(t));break;default:ed(t)}e=e.sibling}}function td(e,t){for(;fu!==null;){var n=fu;switch(n.tag){case 0:case 11:case 15:Tl(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Na(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,fu=r;else a:for(n=e;fu!==null;){r=fu;var i=r.sibling,a=r.return;if(Cu(r),r===n){fu=null;break a}if(i!==null){i.return=a,fu=i;break a}fu=a}}}var nd={getCacheForType:function(e){var t=Ta(ja),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ta(ja).controller.signal}},rd=typeof WeakMap==`function`?WeakMap:Map,id=0,ad=null,od=null,sd=0,cd=0,ld=null,ud=!1,dd=!1,fd=!1,pd=0,md=0,hd=0,gd=0,_d=0,vd=0,yd=0,bd=null,xd=null,Sd=!1,Cd=0,wd=0,Td=1/0,Ed=null,Dd=null,Od=0,kd=null,Ad=null,jd=0,Md=0,Nd=null,Pd=null,Fd=null,Id=null,Ld=null,Rd=0,zd=null;function Bd(){return id&2&&sd!==0?sd&-sd:N.T===null?bt():G()}function Vd(){if(vd===0){if(!(sd&536870912)||B){var e=at;at<<=1,!(at&3932160)&&(at=262144),vd=e}else vd=536870912}return e=jo.current,e!==null&&(e.flags|=32),vd}function Hd(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Up(_i(e.memoizedProps,n))),Id===null&&(Id=[]),Id.push(t.bind(null,r))}}function Ud(e,t,n){(e===ad&&(cd===2||cd===9)||e.cancelPendingCommit!==null)&&(Xd(e,0),qd(e,sd,vd,!1)),mt(e,n),id&2&&e===ad||(e===ad&&(!(id&2)&&(gd|=n),md===4&&qd(e,sd,vd,!1)),Pf(e))}function Wd(e,t,n){if(id&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||lt(e,t),a=r?af(e,t):nf(e,t,!0),o=r;do{if(a===0){dd&&!r&&qd(e,t,0,!1);break}if(n=e.current.alternate,o&&!Kd(n))a=nf(e,t,!1),o=!1;else{if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=bd;var l=c.current.memoizedState.isDehydrated;if(l&&(Xd(c,s).flags|=256),s=nf(c,s,!1),s!==2&&s!==6){if(fd&&!l){c.errorRecoveryDisabledLanes|=o,gd|=o,a=4;break a}o=xd,xd=a,o!==null&&(xd===null?xd=o:xd.push.apply(xd,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Xd(e,0),qd(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:qd(r,t,vd,!ud);break a;case 2:xd=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=Cd+300-F(),10<a)){if(qd(r,t,vd,!ud),ct(r,0,!0)!==0)break a;jd=t,r.timeoutHandle=Tp(Gd.bind(null,r,n,xd,Ed,Sd,t,vd,gd,yd,ud,o,`Throttled`,-0,0),a);break a}Gd(r,n,xd,Ed,Sd,t,vd,gd,yd,ud,o,null,-0,0)}break}}while(1);Pf(e)}function Gd(e,t,n,r,i,a,o,s,c,l,u,d,f,p){e.timeoutHandle=-1;var m=t.subtreeFlags,h=(a&335544064)===a;d=null,(h||m&8192||(m&16785408)==16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:z},Ul=null,Xu(t,a,d),h&&(m=d,h=e.containerInfo,h=(h.nodeType===9?h:h.ownerDocument).__reactViewTransition,h!=null&&(m.count++,m.waitingForViewTransition=!0,m=dh.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?Cd-F():(a&4194048)===a?wd-F():0,m=lh(d,m),m!==null)?(jd=a,e.cancelPendingCommit=m(df.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),qd(e,a,o,!l)):df(e,t,a,n,r,i,o,s,c,l,u,d)}function Kd(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Vr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function qd(e,t,n,r){t=ut(e,t),t&=~_d,t&=~gd,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-et(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&ht(e,n,t)}function Jd(){return id&6?!0:(Ff(0,!1),!1)}function Yd(){if(od!==null){if(cd===0)var e=od.return;else e=od,_a=ga=null,ss(e),ao=null,oo=0,e=od;for(;e!==null;)Cl(e.alternate,e),e=e.return;od=null}}function Xd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,Ep(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),jd=0,Yd(),ad=e,od=n=Pi(e.current,null),sd=t,cd=0,ld=null,ud=!1,dd=lt(e,t),fd=!1,yd=vd=_d=gd=hd=md=0,xd=bd=null,Sd=!1,pd=ut(e,t),wi(),n}function Zd(e,t){V=null,N.H=_c,t===Ya||t===Za?(t=ro(),cd=3):t===Xa?(t=ro(),cd=4):cd=t===Fc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,ld=t,od===null&&(md=1,kc(e,Hi(t,e.current)))}function Qd(){var e=jo.current;return e===null?!0:(sd&4194048)===sd?Mo===null:(sd&62914560)===sd||sd&536870912?e===Mo:!1}function $d(){var e=N.H;return N.H=_c,e===null?_c:e}function ef(){var e=N.A;return N.A=nd,e}function tf(){md=4,ud||(sd&4194048)!==sd&&jo.current!==null||(dd=!0),!(hd&134217727)&&!(gd&134217727)||ad===null||qd(ad,sd,vd,!1)}function nf(e,t,n){var r=id;id|=2;var i=$d(),a=ef();(ad!==e||sd!==t)&&(Ed=null,Xd(e,t)),t=!1;var o=md;a:do try{if(cd!==0&&od!==null){var s=od,c=ld;switch(cd){case 8:Yd(),o=6;break a;case 3:case 2:case 9:case 6:jo.current===null&&(t=!0);var l=cd;if(cd=0,ld=null,U(e,s,c,l),n&&dd){o=0;break a}break;default:l=cd,cd=0,ld=null,U(e,s,c,l)}}rf(),o=md;break}catch(t){Zd(e,t)}while(1);return t&&e.shellSuspendCounter++,_a=ga=null,id=r,N.H=i,N.A=a,od===null&&(ad=null,sd=0,wi()),o}function rf(){for(;od!==null;)sf(od)}function af(e,t){var n=id;id|=2;var r=$d(),a=ef();ad!==e||sd!==t?(Ed=null,Td=F()+500,Xd(e,t)):dd=lt(e,t);a:do try{if(cd!==0&&od!==null){t=od;var o=ld;b:switch(cd){case 1:cd=0,ld=null,U(e,t,o,1);break;case 2:case 9:if($a(o)){cd=0,ld=null,cf(t);break}t=function(){cd!==2&&cd!==9||ad!==e||(cd=7),Pf(e)},o.then(t,t);break a;case 3:cd=7;break a;case 4:cd=5;break a;case 7:$a(o)?(cd=0,ld=null,cf(t)):(cd=0,ld=null,U(e,t,o,7));break;case 5:var s=null;switch(od.tag){case 26:s=od.memoizedState;case 5:case 27:var c=od;if(s?ih(s):c.stateNode.complete){cd=0,ld=null;var l=c.sibling;if(l!==null)od=l;else{var u=c.return;u===null?od=null:(od=u,lf(u))}break b}}cd=0,ld=null,U(e,t,o,5);break;case 6:cd=0,ld=null,U(e,t,o,6);break;case 8:Yd(),md=6;break a;default:throw Error(i(462))}}of();break}catch(t){Zd(e,t)}while(1);return _a=ga=null,N.H=r,N.A=a,id=n,od===null?(ad=null,sd=0,wi(),md):0}function of(){for(;od!==null&&!He();)sf(od)}function sf(e){var t=ml(e.alternate,e,pd);e.memoizedProps=e.pendingProps,t===null?lf(e):od=t}function cf(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Yc(n,t,t.pendingProps,t.type,void 0,sd);break;case 11:t=Yc(n,t,t.pendingProps,t.type.render,t.ref,sd);break;case 5:ss(t);var r=t;r===ra&&(B?(ua(r),r.tag===5&&r.stateNode!=null&&(ia=r.stateNode)):(ua(r),B=!0));default:Cl(n,t),t=od=Fi(t,pd),t=ml(n,t,pd)}e.memoizedProps=e.pendingProps,t===null?lf(e):od=t}function U(e,t,n,r){_a=ga=null,ss(t),ao=null,oo=0;var i=t.return;try{if(Pc(e,i,t,n,sd)){md=1,kc(e,Hi(n,e.current)),od=null;return}}catch(t){if(i!==null)throw od=i,t;md=1,kc(e,Hi(n,e.current)),od=null;return}t.flags&32768?(B||r===1?e=!0:dd||sd&536870912?e=!1:(ud=e=!0,(r===2||r===9||r===3||r===6)&&(r=jo.current,r!==null&&r.tag===13&&(r.flags|=16384))),uf(t,e)):lf(t)}function lf(e){var t=e;do{if(t.flags&32768){uf(t,ud);return}e=t.return;var n=xl(t.alternate,t,pd);if(n!==null){od=n;return}if(t=t.sibling,t!==null){od=t;return}od=t=e}while(t!==null);md===0&&(md=5)}function uf(e,t){do{var n=Sl(e.alternate,e);if(n!==null){n.flags&=32767,od=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){od=e;return}od=e=n}while(e!==null);md=6,od=null}function df(e,t,n,r,a,o,s,c,l,u,d,f){e.cancelPendingCommit=null;do yf();while(Od!==0);if(id&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));e===ad&&(od=ad=null,sd=0),Ad=t,kd=e,jd=n,Nd=a,Pd=r,ff(e,t,n,s,c,l,f)}}function ff(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(Md=s,s|=Ci,L(e,n,s,r,i,a),Id=null,(n&335544064)===n?(Ld=Ia(e),r=10262):(Ld=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,Df(qe,function(){return bf(),null})):(e.callbackNode=null,e.callbackPriority=0),Hl=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=N.T,N.T=null,i=ve.p,ve.p=2,a=id,id|=4;try{_u(e,t,n)}finally{id=a,ve.p=i,N.T=r}}Od=1,Hl?Fd=Vp(o,e.containerInfo,Ld,hf,gf,mf,_f,bf,pf,null,null):(hf(),gf(),_f())}function pf(e){if(Od!==0){var t=kd.onRecoverableError;t(e,{componentStack:null})}}function mf(){Od===3&&(Od=0,Ru(Ad,kd),Od=4)}function hf(){if(Od===1){Od=0;var e=kd,t=Ad,n=jd,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=N.T,N.T=null;var i=ve.p;ve.p=2;var a=id;id|=4;try{mu=hu=!1,Pu(t,e,n),n=_p;var o=qr(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&Kr(s.ownerDocument.documentElement,s)){if(c!==null&&Jr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Gr(s,h),v=Gr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}Th=!!gp,_p=gp=null}finally{id=a,ve.p=i,N.T=r}}e.current=t,Od=2}}function gf(){if(Od===2){Od=0;var e=kd,t=Ad,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=N.T,N.T=null;var r=ve.p;ve.p=2;var i=id;id|=4;try{yu(e,t.alternate,t)}finally{id=i,ve.p=r,N.T=n}}Od=3}}function _f(){if(Od===4||Od===3){Od=0;var e=Fd;Fd=null,Ue();var t=kd,n=Ad,r=jd,i=Pd,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?Od=5:(Od=0,Ad=kd=null,vf(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(Dd=null),yt(r),n=n.stateNode,Qe&&typeof Qe.onCommitFiberRoot==`function`)try{Qe.onCommitFiberRoot(Ze,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=N.T,a=ve.p,ve.p=2,N.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var c=i[s];o(c.value,{componentStack:c.stack})}}finally{N.T=n,ve.p=a}}if(i=Id,o=Ld,Ld=null,i!==null&&(Id=null,o===null&&(o=[]),e!==null))for(c=0;c<i.length;c++)n=(0,i[c])(o),n!==void 0&&e.finished.finally(n);jd&3&&yf(),Pf(t),a=t.pendingLanes,r&261930&&a&42?t===zd?Rd++:(Rd=0,zd=t):(Rd=0,zd=null),Ff(0,!1)}}function vf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Na(t)))}function yf(){return Fd!==null&&(Fd.skipTransition(),Fd=null),hf(),gf(),_f(),bf()}function bf(){if(Od!==5)return!1;var e=kd,t=Md;Md=0;var n=yt(jd),r=N.T,a=ve.p;try{ve.p=32>n?32:n,N.T=null,n=Nd,Nd=null;var o=kd,s=jd;if(Od=0,Ad=kd=null,jd=0,id&6)throw Error(i(331));var c=id;if(id|=4,$u(o.current),Gu(o,o.current,s,n),id=c,Ff(0,!1),Qe&&typeof Qe.onPostCommitFiberRoot==`function`)try{Qe.onPostCommitFiberRoot(Ze,o)}catch{}return!0}finally{ve.p=a,N.T=r,vf(e,t)}}function xf(e,t,n){t=Hi(n,t),t=jc(e.stateNode,t,2),e=vo(e,t,2),e!==null&&(mt(e,2),Pf(e))}function W(e,t,n){if(e.tag===3)xf(e,e,n);else for(;t!==null;){if(t.tag===3){xf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(Dd===null||!Dd.has(r))){e=Hi(n,e),n=Mc(2),r=vo(t,n,2),r!==null&&(Nc(n,r,t,e),mt(r,2),Pf(r));break}}t=t.return}}function Sf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new rd;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(fd=!0,i.add(n),e=Cf.bind(null,e,t,n),t.then(e,e))}function Cf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ad===e&&(sd&n)===n&&(md===4||md===3&&(sd&62914560)===sd&&300>F()-Cd?id&2?_d|=n:Xd(e,0):_d|=n,yd===sd&&(yd=0)),Pf(e)}function wf(e,t){t===0&&(t=ft()),e=Di(e,t),e!==null&&(mt(e,t),Pf(e))}function Tf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),wf(e,n)}function Ef(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),wf(e,n)}function Df(e,t){return Be(e,t)}var Of=null,kf=null,Af=!1,jf=!1,Mf=!1,Nf=0;function Pf(e){e!==kf&&e.next===null&&(kf===null?Of=kf=e:kf=kf.next=e),jf=!0,Af||(Af=!0,Vf())}function Ff(e,t){if(!Mf&&jf){Mf=!0;do for(var n=!1,r=Of;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-et(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Bf(r,a))}else a=sd,a=ct(r,r===ad?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||lt(r,a)||(n=!0,Bf(r,a))}r=r.next}while(n);Mf=!1}}function If(){Lf()}function Lf(){jf=Af=!1;var e=0;Nf!==0&&wp()&&(e=Nf);for(var t=F(),n=null,r=Of;r!==null;){var i=r.next,a=Rf(r,t);a===0?(r.next=null,n===null?Of=i:n.next=i,i===null&&(kf=n)):(n=r,(e!==0||a&3)&&(jf=!0)),r=i}Od!==0&&Od!==5||Ff(e,!1),Nf!==0&&(Nf=0)}function Rf(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-et(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=dt(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=ad,n=sd,n=ct(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(cd===2||cd===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ve(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||lt(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Ve(r),yt(n)){case 2:case 8:n=Ke;break;case 32:n=qe;break;case 268435456:n=Ye;break;default:n=qe}return r=zf.bind(null,e),n=Be(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Ve(r),e.callbackPriority=2,e.callbackNode=null,2}function zf(e,t){if(Od!==0&&Od!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(yf()&&e.callbackNode!==n)return null;var r=sd;return r=ct(e,e===ad?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Wd(e,r,t),Rf(e,F()),e.callbackNode!=null&&e.callbackNode===n?zf.bind(null,e):null)}function Bf(e,t){if(yf())return null;Wd(e,t,!0)}function Vf(){kp(function(){id&6?Be(Ge,If):Lf()})}function G(){if(Nf===0){var e=za;e===0&&(e=it,it<<=1,!(it&261888)&&(it=256)),Nf=e}return Nf}function Hf(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:vn(e)}function Uf(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Hf((i[wt]||null).action),o=r.submitter;o&&(t=(t=o[wt]||null)?Hf(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new zn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Nf!==0){var e=new FormData(i,o);rc(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),rc(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Wf=0;Wf<mi.length;Wf++){var Gf=mi[Wf];hi(Gf.toLowerCase(),`on`+(Gf[0].toUpperCase()+Gf.slice(1)))}hi(oi,`onAnimationEnd`),hi(si,`onAnimationIteration`),hi(ci,`onAnimationStart`),hi(`dblclick`,`onDoubleClick`),hi(`focusin`,`onFocus`),hi(`focusout`,`onBlur`),hi(li,`onTransitionRun`),hi(ui,`onTransitionStart`),hi(di,`onTransitionCancel`),hi(fi,`onTransitionEnd`),Vt(`onMouseEnter`,[`mouseout`,`mouseover`]),Vt(`onMouseLeave`,[`mouseout`,`mouseover`]),Vt(`onPointerEnter`,[`pointerout`,`pointerover`]),Vt(`onPointerLeave`,[`pointerout`,`pointerover`]),R(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),R(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),R(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),R(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),R(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),R(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Kf=`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(` `),qf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Kf));function Jf(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){bi(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){bi(e)}i.currentTarget=null,a=c}}}}function Yf(e,t){var n=t[Et];n===void 0&&(n=t[Et]=new Set);var r=e+`__bubble`;n.has(r)||($f(t,e,2,!1),n.add(r))}function Xf(e,t,n){var r=0;t&&(r|=4),$f(n,e,r,t)}var Zf=`_reactListening`+Math.random().toString(36).slice(2);function Qf(e){if(!e[Zf]){e[Zf]=!0,zt.forEach(function(t){t!==`selectionchange`&&(qf.has(t)||Xf(t,!1,e),Xf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Zf]||(t[Zf]=!0,Xf(`selectionchange`,!1,t))}}function $f(e,t,n,r){switch(Mh(t)){case 2:var i=Eh;break;case 8:i=Dh;break;default:i=Oh}n=i.bind(null,t,n,e),i=void 0,!On||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function ep(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=Nt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}Tn(function(){var r=a,i=bn(n),s=[];a:{var c=pi.get(e);if(c!==void 0){var l=zn,u=e;switch(e){case`keypress`:if(Pn(n)===0)break a;case`keydown`:case`keyup`:l=rr;break;case`focusin`:u=`focus`,l=Jn;break;case`focusout`:u=`blur`,l=Jn;break;case`beforeblur`:case`afterblur`:l=Jn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Kn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=qn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=or;break;case oi:case si:case ci:l=Yn;break;case fi:l=sr;break;case`scroll`:case`scrollend`:l=Vn;break;case`wheel`:l=cr;break;case`copy`:case`cut`:case`paste`:l=Xn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=ir;break;case`submit`:l=ar;break;case`toggle`:case`beforetoggle`:l=lr}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=En(m,p),g!=null&&d.push(tp(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(l=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,l&&n!==yn&&(u=n.relatedTarget||n.fromElement)&&(Nt(u)||u[Tt]))break a;(c||l)&&(u=i.window===i?i:(l=i.ownerDocument)?l.defaultView||l.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Nt(l):null,l!==null&&(f=o(l),d=l.tag,l!==f||d!==5&&d!==27&&d!==6)&&(l=null)):(c=null,l=r),c!==l&&(d=Kn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=ir,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?u:Ft(c),h=l==null?u:Ft(l),u=new d(g,m+`leave`,c,n,i),u.target=f,u.relatedTarget=h,g=null,Nt(i)===r&&(d=new d(p,m+`enter`,l,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=c&&l?E(c,l,rp):null,c!==null&&ip(s,u,c,d,!1),l!==null&&f!==null&&ip(s,f,l,d,!0)))}a:{if(c=r?Ft(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var _=kr;else if(Cr(c)){if(Ar)_=zr;else{_=Lr;var v=Ir}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&hn(r.elementType)&&(_=kr):_=Rr;if(_&&=_(e,r)){wr(s,_,n,i);break a}v&&v(e,c,r)}switch(v=r?Ft(r):window,e){case`focusin`:(Cr(v)||v.contentEditable===`true`)&&(Xr=v,Zr=r,Qr=null);break;case`focusout`:Qr=Zr=Xr=null;break;case`mousedown`:$r=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:$r=!1,ei(s,n,i);break;case`selectionchange`:if(Yr)break;case`keydown`:case`keyup`:ei(s,n,i)}var y;if(dr)b:{switch(e){case`compositionstart`:var b=`onCompositionStart`;break b;case`compositionend`:b=`onCompositionEnd`;break b;case`compositionupdate`:b=`onCompositionUpdate`;break b}b=void 0}else yr?_r(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(mr&&n.locale!==`ko`&&(yr||b!==`onCompositionStart`?b===`onCompositionEnd`&&yr&&(y=Nn()):(An=i,jn=`value`in An?An.value:An.textContent,yr=!0)),v=np(r,b),0<v.length&&(b=new Zn(b,e,null,n,i),s.push({event:b,listeners:v}),y?b.data=y:(y=vr(n),y!==null&&(b.data=y)))),(y=pr?br(e,n):xr(e,n))&&(b=np(r,`onBeforeInput`),0<b.length&&(v=new Zn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:v,listeners:b}),v.data=y)),Uf(s,e,r,n,i)}Jf(s,t)})}function tp(e,t,n){return{instance:e,listener:t,currentTarget:n}}function np(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=En(e,n),i!=null&&r.unshift(tp(e,i,a)),i=En(e,t),i!=null&&r.push(tp(e,i,a))),e.tag===3)return r;e=e.return}return[]}function rp(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function ip(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=En(n,a),l!=null&&o.unshift(tp(n,l,c))):i||(l=En(n,a),l!=null&&o.push(tp(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var ap=/\r\n?/g,op=/\u0000|\uFFFD/g;function sp(e){return(typeof e==`string`?e:``+e).replace(ap,`
|
|
9
|
+
`).replace(op,``)}function cp(e,t){return t=sp(t),sp(e)===t}function lp(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||dn(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&dn(e,``+r);else return;break;case`className`:Yt(e,`class`,r);break;case`tabIndex`:Yt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Yt(e,n,r);break;case`style`:mn(e,r,o);return;case`data`:if(t!==`object`){Yt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=vn(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`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}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&lp(e,t,`name`,a.name,a,null),lp(e,t,`formEncType`,a.formEncType,a,null),lp(e,t,`formMethod`,a.formMethod,a,null),lp(e,t,`formTarget`,a.formTarget,a,null)):(lp(e,t,`encType`,a.encType,a,null),lp(e,t,`method`,a.method,a,null),lp(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=vn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=z);return;case`onScroll`:r!=null&&Yf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Yf(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=vn(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`: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`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Yf(`beforetoggle`,e),Yf(`toggle`,e),Jt(e,`popover`,r);break;case`xlinkActuate`:Xt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Xt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Xt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Xt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Xt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Xt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Xt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Xt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Xt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Jt(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=gn.get(n)||n,Jt(e,n,r);else return}Kt=!0}function up(e,t,n,r,a,o){switch(n){case`style`:mn(e,r,o);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)dn(e,r);else if(typeof r==`number`||typeof r==`bigint`)dn(e,``+r);else return;break;case`onScroll`:r!=null&&Yf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Yf(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=z);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Bt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),o=n.slice(2,a?n.length-7:void 0),t=e[wt]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(o,t,a),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,r,a);break a}Kt=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):Jt(e,n,r)}return}Kt=!0}function dp(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Yf(`error`,e),Yf(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:lp(e,t,o,s,n,null)}}a&&lp(e,t,`srcSet`,n.srcSet,n,null),r&&lp(e,t,`src`,n.src,n,null);return;case`input`:Yf(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:lp(e,t,r,d,n,null)}}on(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Yf(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:lp(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&cn(e,!!r,n,!0):cn(e,!!r,t,!1);return;case`textarea`:for(s in Yf(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:lp(e,t,s,c,n,null)}un(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:lp(e,t,l,r,n,null)}return;case`dialog`:Yf(`beforetoggle`,e),Yf(`toggle`,e),Yf(`cancel`,e),Yf(`close`,e);break;case`iframe`:case`object`:Yf(`load`,e);break;case`video`:case`audio`:for(r=0;r<Kf.length;r++)Yf(Kf[r],e);break;case`image`:Yf(`error`,e),Yf(`load`,e);break;case`details`:Yf(`toggle`,e);break;case`embed`:case`source`:case`link`:Yf(`error`,e),Yf(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:lp(e,t,u,r,n,null)}return;default:if(hn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&up(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&lp(e,t,c,r,n,null))}var fp={};function pp(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||lp(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(Kt=!0),o=m;break;case`name`:m!==f&&(Kt=!0),a=m;break;case`checked`:m!==f&&(Kt=!0),u=m;break;case`defaultChecked`:m!==f&&(Kt=!0),d=m;break;case`value`:m!==f&&(Kt=!0),s=m;break;case`defaultValue`:m!==f&&(Kt=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&lp(e,t,p,m,r,f)}}an(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||lp(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:o!==l&&(Kt=!0),p=o;break;case`defaultValue`:o!==l&&(Kt=!0),c=o;break;case`multiple`:o!==l&&(Kt=!0),s=o;default:o!==l&&lp(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?cn(e,!!n,n?[]:``,!1):cn(e,!!n,t,!0)):cn(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:lp(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:a!==o&&(Kt=!0),p=a;break;case`defaultValue`:a!==o&&(Kt=!0),m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&lp(e,t,s,a,r,o)}ln(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:lp(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(Kt=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:lp(e,t,l,p,r,m)}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 g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&lp(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:lp(e,t,u,p,r,m)}return;default:if(hn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&up(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||up(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&lp(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||lp(e,t,f,p,r,m)}function mp(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function hp(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&mp(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&mp(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var gp=null,_p=null;function vp(e){return e.nodeType===9?e:e.ownerDocument}function yp(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function bp(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function xp(e,t,n,r){return n=vp(n).createElement(e),n[Ct]=r,n[wt]=t,dp(n,e,t),Lt(n),n}function Sp(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Cp=null;function wp(){var e=window.event;return e&&e.type===`popstate`?e!==Cp&&(Cp=e,!0):(Cp=null,!1)}var Tp=typeof setTimeout==`function`?setTimeout:void 0,Ep=typeof clearTimeout==`function`?clearTimeout:void 0,Dp=typeof Promise==`function`?Promise:void 0,Op=typeof requestAnimationFrame==`function`?requestAnimationFrame:Tp,kp=typeof queueMicrotask==`function`?queueMicrotask:Dp===void 0?Tp:function(e){return Dp.resolve(null).then(e).catch(Ap)};function Ap(e){setTimeout(function(){throw e})}function jp(e){return e===`head`}function Mp(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Zh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Em(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Em(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[At]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&Em(e.ownerDocument.body)}n=i}while(n);Zh(t)}function Np(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function Pp(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Fp(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Ip(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function Lp(e){return Ip(e.getBoundingClientRect(),getComputedStyle(e),e)}function Rp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Ip(t,n,e)}function zp(e){return e.documentElement.clientHeight}function Bp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Vp(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(zp(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=ah(f),u>ch){s.length=o;break}f=new Promise(Bp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Hp(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Hp.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:D({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Hp.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Hp.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Up(e){return{name:e,group:new Hp(`group`,e),imagePair:new Hp(`image-pair`,e),old:new Hp(`old`,e),new:new Hp(`new`,e)}}function Wp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Wp.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Yp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=qp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),h(this._fragmentFiber.child,!1,Gp,e,s,r)}this._eventListeners=a}};function Gp(e,t,n,r){return b(e).addEventListener(t,n,r),!1}Wp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Yp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=qp(i.optionsOrUseCapture),h(this._fragmentFiber.child,!1,Kp,e,n,i),r.splice(t,1),a!==null&&a()}};function Kp(e,t,n,r){return b(e).removeEventListener(t,n,r),!1}function qp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Jp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Yp(e,t,n,r){if(e.length===0)return-1;r=Jp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&Jp(a.optionsOrUseCapture)===r)return i}return-1}Wp.prototype.dispatchEvent=function(e){var t=g(this._fragmentFiber);if(t===null)return!0;t=b(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,qp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,qp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Wp.prototype.focus=function(e){h(this._fragmentFiber.child,!0,Xp,e,void 0,void 0)};function Xp(e,t){return e.tag!==6&&(e=b(e),Sm(e,t))}Wp.prototype.focusLast=function(e){var t=[];h(this._fragmentFiber.child,!0,Zp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Xp(t[n],e);n--);};function Zp(e,t){return t.push(e),!1}Wp.prototype.blur=function(){var e=g(this._fragmentFiber);e!==null&&(e=b(e),e=vp(e).activeElement,e!==null&&h(this._fragmentFiber.child,!1,Qp,e,void 0,void 0))};function Qp(e,t){return e.tag!==6&&(e=b(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Wp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),h(this._fragmentFiber.child,!1,$p,e,void 0,void 0)};function $p(e,t){return e.tag===6||(e=b(e),t.observe(e)),!1}Wp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),h(this._fragmentFiber.child,!1,em,e,void 0,void 0);for(var n=t=0;n<tm.length;n++){var r=tm[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):tm[t++]=r}tm.length=t}};function em(e,t){return e.tag===6||(e=b(e),t.unobserve(e)),!1}var tm=[],nm=!1;function rm(e,t,n){tm.push({fragmentInstance:e,observer:t,instance:n}),nm||(nm=!0,Cm(function(){nm=!1;var e=tm;tm=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Wp.prototype.getClientRects=function(){var e=[];return h(this._fragmentFiber.child,!1,im,e,void 0,void 0),e};function im(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=b(e),t.push.apply(t,e.getClientRects());return!1}Wp.prototype.getRootNode=function(e){var t=g(this._fragmentFiber);return t===null?this:b(t).getRootNode(e)},Wp.prototype.compareDocumentPosition=function(e){var t=g(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];h(this._fragmentFiber.child,!1,Zp,n,void 0,void 0);var r=b(t);if(n.length===0){if(n=r,_(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=v(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=b(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=b(n[0]),i=b(n[n.length-1]);var a=_(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||am(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function am(e,t,n,r,i){var a=Nt(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=g(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=E(n,a,T),t===null?t=!1:(h(t,!0,C,a,n),a=x,x=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=E(r,a,T),t===null?t=!1:(h(t,!0,w,a,r),a=x,S=x=null,t=a!==null)),t):!1}function om(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Wp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(i(566));var t=[];h(this._fragmentFiber.child,!1,Zp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=v(this._fragmentFiber);if(r=n?r[1]||r[0]||g(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=b(r),om(e,n);return}if(r=b(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var a=t[r];a.tag===6?(a=b(a),om(a,n)):b(a).scrollIntoView(e),r+=n?-1:1}};function sm(e,t){return e=b(e),cm(e,t),!1}function cm(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function lm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,qp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<tm.length;i++){var a=tm[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(tm[r++]=a)}tm.length=r,n.observe(e)}),cm(e,t))}function um(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,qp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?rm(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function dm(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:dm(n),Mt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function fm(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[At])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=vm(e.nextSibling),e===null)break}return null}function pm(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=vm(e.nextSibling),e===null))return null;return e}function mm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=vm(e.nextSibling),e===null))return null;return e}function hm(e){return e.data===`$?`||e.data===`$~`}function gm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function _m(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function vm(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var ym=null;function bm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return vm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function xm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function Sm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function Cm(e){Op(function(){Op(function(t){return e(t)})})}function wm(e,t,n){switch(t=vp(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function Tm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&lp(e,t,r,null,fp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===z&&(e.onclick=null),Mt(e)}function Em(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Mt(e)}var Dm=new Map,Om=new Set;function km(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var Am=ve.d;ve.d={f:jm,r:Mm,D:Fm,C:Im,L:Lm,m:Rm,X:Bm,S:zm,M:Vm};function jm(){var e=Am.f(),t=Jd();return e||t}function Mm(e){var t=Pt(e);t!==null&&t.tag===5&&t.type===`form`?ac(t):Am.r(e)}var Nm=typeof document>`u`?null:document;function Pm(e,t,n){var r=Nm;if(r&&typeof t==`string`&&t){var i=rn(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Om.has(i)||(Om.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),dp(t,`link`,e),Lt(t),r.head.appendChild(t)))}}function Fm(e){Am.D(e),Pm(`dns-prefetch`,e,null)}function Im(e,t){Am.C(e,t),Pm(`preconnect`,e,t)}function Lm(e,t,n){Am.L(e,t,n);var r=Nm;if(r&&e&&t){var i=`link[rel="preload"][as="`+rn(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+rn(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+rn(n.imageSizes)+`"]`)):i+=`[href="`+rn(e)+`"]`;var a=i;switch(t){case`style`:a=Um(e);break;case`script`:a=qm(e)}if(!(Dm.has(a)||(e=D({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Dm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Wm(a))||t===`script`&&r.querySelector(Jm(a))))){var o=r.createElement(`link`);dp(o,`link`,e),t===`style`&&(o[jt]=!0,o.onload=o.onerror=function(){Rt(o)}),Lt(o),r.head.appendChild(o)}}}function Rm(e,t){Am.m(e,t);var n=Nm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+rn(r)+`"][href="`+rn(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=qm(e)}if(!Dm.has(a)&&(e=D({rel:`modulepreload`,href:e},t),Dm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Jm(a)))return}r=n.createElement(`link`),dp(r,`link`,e),Lt(r),n.head.appendChild(r)}}}function zm(e,t,n){Am.S(e,t,n);var r=Nm;if(r&&e){var i=It(r).hoistableStyles,a=Um(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Wm(a)))s.loading=5;else{e=D({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Dm.get(a))&&Zm(e,n);var c=o=r.createElement(`link`);Lt(c),dp(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Xm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Bm(e,t){Am.X(e,t);var n=Nm;if(n&&e){var r=It(n).hoistableScripts,i=qm(e),a=r.get(i);a||(a=n.querySelector(Jm(i)),a||(e=D({src:e,async:!0},t),(t=Dm.get(i))&&Qm(e,t),a=n.createElement(`script`),Lt(a),dp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Vm(e,t){Am.M(e,t);var n=Nm;if(n&&e){var r=It(n).hoistableScripts,i=qm(e),a=r.get(i);a||(a=n.querySelector(Jm(i)),a||(e=D({src:e,async:!0,type:`module`},t),(t=Dm.get(i))&&Qm(e,t),a=n.createElement(`script`),Lt(a),dp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Hm(e,t,n,r){var a=(a=De.current)?km(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Um(n.href),t=It(a).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Um(n.href);var o=It(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Wm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=Dm.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Dm.set(e,o)),Km(a,e,o,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=qm(n),t=It(a).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Um(e){return`href="`+rn(e)+`"`}function Wm(e){return`link[rel="stylesheet"][`+e+`]`}function Gm(e){return D({},e,{"data-precedence":e.precedence,precedence:null})}function Km(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[jt]){r.loading=1;return}}else t=e.createElement(`link`),t[jt]=!0,t.onload=t.onerror=Rt.bind(null,t),dp(t,`link`,n),Lt(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function qm(e){return`[src="`+rn(e)+`"]`}function Jm(e){return`script[async]`+e}function Ym(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+rn(n.href)+`"]`);if(r)return t.instance=r,Lt(r),r;var a=D({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Lt(r),dp(r,`style`,a),Xm(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Um(n.href);var o=e.querySelector(Wm(a));if(o)return t.state.loading|=4,t.instance=o,Lt(o),o;r=Gm(n),(a=Dm.get(a))&&Zm(r,a),o=(e.ownerDocument||e).createElement(`link`),Lt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),dp(o,`link`,r),t.state.loading|=4,Xm(o,n.precedence,e),t.instance=o;case`script`:return o=qm(n.src),(a=e.querySelector(Jm(o)))?(t.instance=a,Lt(a),a):(r=n,(a=Dm.get(o))&&(r=D({},n),Qm(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Lt(a),dp(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Xm(r,n.precedence,e));return t.instance}function Xm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Zm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Qm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var $m=null;function eh(e,t,n){if($m===null){var r=new Map,i=$m=new Map;i.set(n,r)}else i=$m,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[At]||a[Ct]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function th(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function nh(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function rh(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function ih(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function ah(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function oh(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=ah(t),e.suspenseyImages.push(t)),e=fh.bind(e),t.decode().then(e,e))}function sh(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Um(r.href),a=t.querySelector(Wm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=dh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Lt(a);return}a=t.ownerDocument||t,r=Gm(r),(i=Dm.get(i))&&Zm(r,i),a=a.createElement(`link`),Lt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),dp(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=dh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var ch=0;function lh(e,t){return e.stylesheets&&e.count===0&&mh(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&mh(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&ch===0&&(ch=62500*hp());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&mh(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>ch?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function uh(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)mh(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function dh(){this.count--,uh(this)}function fh(){this.imgCount--,uh(this)}var ph=null;function mh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ph=new Map,t.forEach(hh,e),ph=null,dh.call(e))}function hh(e,t){if(!(t.state.loading&4)){var n=ph.get(e);if(n)var r=n.get(null);else{n=new Map,ph.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=dh.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var gh={$$typeof:j,Provider:null,Consumer:null,_currentValue:ye,_currentValue2:ye,_threadCount:0};function _h(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,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=pt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=pt(0),this.hiddenUpdates=pt(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function vh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new _h(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Mi(3,null,null,t),e.current=a,a.stateNode=e,t=Ma(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},ho(a),e}function yh(e){return e?(e=Ai,e):Ai}function bh(e,t,n,r,i,a){i=yh(i),r.context===null?r.context=i:r.pendingContext=i,r=_o(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=vo(e,r,t),n!==null&&(Ud(n,e,t),yo(n,e,t))}function xh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Sh(e,t){xh(e,t),(e=e.alternate)&&xh(e,t)}function Ch(e){if(e.tag===13||e.tag===31){var t=Di(e,67108864);t!==null&&Ud(t,e,67108864),Sh(e,67108864)}}function wh(e){if(e.tag===13||e.tag===31){var t=Bd();t=vt(t);var n=Di(e,t);n!==null&&Ud(n,e,t),Sh(e,t)}}var Th=!0;function Eh(e,t,n,r){var i=N.T;N.T=null;var a=ve.p;try{ve.p=2,Oh(e,t,n,r)}finally{ve.p=a,N.T=i}}function Dh(e,t,n,r){var i=N.T;N.T=null;var a=ve.p;try{ve.p=8,Oh(e,t,n,r)}finally{ve.p=a,N.T=i}}function Oh(e,t,n,r){if(Th){var i=kh(r);if(i===null)ep(e,t,r,Ah,n),Vh(e,r);else if(Uh(i,e,t,n,r))r.stopPropagation();else if(Vh(e,r),t&4&&-1<Bh.indexOf(e)){for(;i!==null;){var a=Pt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=st(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-et(o);s.entanglements[1]|=c,o&=~c}Pf(a),!(id&6)&&(Td=F()+500,Ff(0,!1))}}break;case 31:case 13:s=Di(a,2),s!==null&&Ud(s,a,2),Jd(),Sh(a,2)}if(a=kh(r),a===null&&ep(e,t,r,Ah,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else ep(e,t,r,null,n)}}function kh(e){return e=bn(e),jh(e)}var Ah=null;function jh(e){if(Ah=null,e=Nt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Ah=e,null}function Mh(e){switch(e){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`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`fullscreenerror`: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`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(We()){case Ge:return 2;case Ke:return 8;case qe:case Je:return 32;case Ye:return 268435456;default:return 32}default:return 32}}var Nh=!1,Ph=null,Fh=null,Ih=null,Lh=new Map,Rh=new Map,zh=[],Bh=`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 Vh(e,t){switch(e){case`focusin`:case`focusout`:Ph=null;break;case`dragenter`:case`dragleave`:Fh=null;break;case`mouseover`:case`mouseout`:Ih=null;break;case`pointerover`:case`pointerout`:Lh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Rh.delete(t.pointerId)}}function Hh(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Pt(t),t!==null&&Ch(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Uh(e,t,n,r,i){switch(t){case`focusin`:return Ph=Hh(Ph,e,t,n,r,i),!0;case`dragenter`:return Fh=Hh(Fh,e,t,n,r,i),!0;case`mouseover`:return Ih=Hh(Ih,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Lh.set(a,Hh(Lh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Rh.set(a,Hh(Rh.get(a)||null,e,t,n,r,i)),!0}return!1}function Wh(e){var t=Nt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,xt(e.priority,function(){wh(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,xt(e.priority,function(){wh(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Gh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=kh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);yn=r,n.target.dispatchEvent(r),yn=null}else return t=Pt(n),t!==null&&Ch(t),e.blockedOn=n,!1;t.shift()}return!0}function Kh(e,t,n){Gh(e)&&n.delete(t)}function qh(){Nh=!1,Ph!==null&&Gh(Ph)&&(Ph=null),Fh!==null&&Gh(Fh)&&(Fh=null),Ih!==null&&Gh(Ih)&&(Ih=null),Lh.forEach(Kh),Rh.forEach(Kh)}function Jh(e,n){e.blockedOn===n&&(e.blockedOn=null,Nh||(Nh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,qh)))}var Yh=null;function Xh(e){Yh!==e&&(Yh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Yh===e&&(Yh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(jh(r||n)===null)continue;break}var a=Pt(n);a!==null&&(e.splice(t,3),t-=3,rc(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Zh(e){function t(t){return Jh(t,e)}Ph!==null&&Jh(Ph,e),Fh!==null&&Jh(Fh,e),Ih!==null&&Jh(Ih,e),Lh.forEach(t),Rh.forEach(t);for(var n=0;n<zh.length;n++){var r=zh[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<zh.length&&(n=zh[0],n.blockedOn===null);)Wh(n),n.blockedOn===null&&zh.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[wt]||null;if(typeof a==`function`)o||Xh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[wt]||null)s=o.formAction;else if(jh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Xh(n)}}}function Qh(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function $h(e){this._internalRoot=e}eg.prototype.render=$h.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;bh(n,Bd(),e,t,null,null)},eg.prototype.unmount=$h.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;bh(e.current,2,null,e,null,null),Jd(),t[Tt]=null}};function eg(e){this._internalRoot=e}eg.prototype.unstable_scheduleHydration=function(e){if(e){var t=bt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<zh.length&&t!==0&&t<zh[n].priority;n++);zh.splice(n,0,e),n===0&&Wh(e)}};var tg=n.version;if(tg!==`19.3.1`)throw Error(i(527,tg,`19.3.1`));ve.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=d(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var ng={bundleType:0,version:`19.3.1`,rendererPackageName:`react-dom`,currentDispatcherRef:N,reconcilerVersion:`19.3.1`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var rg=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!rg.isDisabled&&rg.supportsFiber)try{Ze=rg.inject(ng),Qe=rg}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Ec,s=Dc,c=Oc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=vh(e,1,!1,null,null,n,r,null,o,s,c,Qh),e[Tt]=t.current,Qf(e),new $h(t)}})),g=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=h()})),_=c(u(),1),v=g();function y(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=y(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function b(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=y(e))&&(r&&(r+=` `),r+=t);return r}var x=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,S=b,C=(e,t)=>n=>{if(t?.variants==null)return S(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=x(t)||x(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return S(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},w=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},T=(e,t)=>({classGroupId:e,validator:t}),E=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),D=`-`,ee=[],te=`arbitrary..`,O=e=>{let t=ne(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return A(e);let n=e.split(D);return k(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?w(i,t):t:i||ee}return n[e]||ee}}},k=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=k(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(D):e.slice(t).join(D),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},A=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?te+r:void 0})(),ne=e=>{let{theme:t,classGroups:n}=e;return re(n,t)},re=(e,t)=>{let n=E();for(let r in e){let i=e[r];j(i,n,r,t)}return n},j=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];M(i,t,n,r)}},M=(e,t,n,r)=>{typeof e==`string`?ie(e,t,n):typeof e==`function`?ae(e,t,n,r):oe(e,t,n,r)},ie=(e,t,n)=>{let r=e===``?t:se(t,e);r.classGroupId=n},ae=(e,t,n,r)=>{ce(e)?j(e(r),t,n,r):(t.validators===null&&(t.validators=[]),t.validators.push(T(n,e)))},oe=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];j(o,se(t,a),n,r)}},se=(e,t)=>{let n=e,r=t.split(D),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=E(),n.nextPart.set(t,i)),n=i}return n},ce=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,le=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},ue=`!`,de=`:`,fe=[],pe=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),me=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===de){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(ue)?(c=s.slice(0,-1),l=!0):s.startsWith(ue)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return pe(t,l,c,u)};if(t){let e=t+de,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):pe(fe,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},he=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},ge=e=>({cache:le(e.cacheSize),parseClassName:me(e),sortModifiers:he(e),postfixLookupClassGroupIds:_e(e),...O(e)}),_e=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},N=/\s+/,ve=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(N),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h||(g=r(p),!g)){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+ue:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},ye=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=be(n))&&(i&&(i+=` `),i+=r);return i},be=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=be(e[r]))&&(n&&(n+=` `),n+=t);return n},xe=(e,...t)=>{let n,r,i,a,o=o=>(n=ge(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=ve(e,n);return i(e,a),a};return a=o,(...e)=>a(ye(...e))},Se=[],Ce=e=>{let t=t=>t[e]||Se;return t.isThemeGetter=!0,t.themeKey=e,t},we=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Te=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ee=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,De=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Oe=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ke=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,Ae=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,je=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Me=e=>Ee.test(e),P=e=>!!e&&!Number.isNaN(Number(e)),Ne=e=>!!e&&Number.isInteger(Number(e)),Pe=e=>e.endsWith(`%`)&&P(e.slice(0,-1)),Fe=e=>De.test(e),Ie=()=>!0,Le=e=>Oe.test(e)&&!ke.test(e),Re=()=>!1,ze=e=>Ae.test(e),Be=e=>je.test(e),Ve=e=>!F(e)&&!I(e),He=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),Ue=e=>it(e,ct,Re),F=e=>we.test(e),We=e=>it(e,lt,Le),Ge=e=>it(e,ut,P),Ke=e=>it(e,ft,Ie),qe=e=>it(e,dt,Re),Je=e=>it(e,ot,Re),Ye=e=>it(e,st,Be),Xe=e=>it(e,pt,ze),I=e=>Te.test(e),Ze=e=>at(e,lt),Qe=e=>at(e,dt),$e=e=>at(e,ot),et=e=>at(e,ct),tt=e=>at(e,st),nt=e=>at(e,pt,!0),rt=e=>at(e,ft,!0),it=(e,t,n)=>{let r=we.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},at=(e,t,n=!1)=>{let r=Te.exec(e);return r?r[1]?t(r[1]):n:!1},ot=e=>e===`position`||e===`percentage`,st=e=>e===`image`||e===`url`,ct=e=>e===`length`||e===`size`||e===`bg-size`,lt=e=>e===`length`,ut=e=>e===`number`,dt=e=>e===`family-name`,ft=e=>e===`number`||e===`weight`,pt=e=>e===`shadow`,mt=xe(()=>{let e=Ce(`color`),t=Ce(`font`),n=Ce(`text`),r=Ce(`font-weight`),i=Ce(`tracking`),a=Ce(`leading`),o=Ce(`breakpoint`),s=Ce(`container`),c=Ce(`spacing`),l=Ce(`radius`),u=Ce(`shadow`),d=Ce(`inset-shadow`),f=Ce(`text-shadow`),p=Ce(`drop-shadow`),m=Ce(`blur`),h=Ce(`perspective`),g=Ce(`aspect`),_=Ce(`ease`),v=Ce(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),I,F],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[I,F,c],T=()=>[Me,`full`,`auto`,...w()],E=()=>[Ne,`none`,`subgrid`,I,F],D=()=>[`auto`,{span:[`full`,Ne,I,F]},Ne,I,F],ee=()=>[Ne,`auto`,I,F],te=()=>[`auto`,`min`,`max`,`fr`,I,F],O=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],k=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],A=()=>[`auto`,...w()],ne=()=>[Me,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],re=()=>[s,Me,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],j=()=>[Me,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],M=()=>[e,I,F],ie=()=>[...b(),$e,Je,{position:[I,F]}],ae=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],oe=()=>[`auto`,`cover`,`contain`,et,Ue,{size:[I,F]}],se=()=>[Pe,Ze,We],ce=()=>[``,`none`,`full`,l,I,F],le=()=>[``,P,Ze,We],ue=()=>[`solid`,`dashed`,`dotted`,`double`],de=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],fe=()=>[P,Pe,$e,Je],pe=()=>[``,`none`,m,I,F],me=()=>[`none`,P,I,F],he=()=>[`none`,P,I,F],ge=()=>[P,I,F],_e=()=>[Me,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Fe],breakpoint:[Fe],color:[Ie],container:[Fe],"drop-shadow":[Fe],ease:[`in`,`out`,`in-out`],font:[Ve],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Fe],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Fe],shadow:[Fe],spacing:[`px`,P],text:[Fe],"text-shadow":[Fe],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Me,F,I,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,I,F]}],"container-named":[He],columns:[{columns:[P,`auto`,F,I,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Ne,`auto`,I,F]}],basis:[{basis:[Me,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[P,Me,`auto`,`initial`,`none`,F]}],grow:[{grow:[``,P,I,F]}],shrink:[{shrink:[``,P,I,F]}],order:[{order:[Ne,`first`,`last`,`none`,I,F]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":ee()}],"col-end":[{"col-end":ee()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":ee()}],"row-end":[{"row-end":ee()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":te()}],"auto-rows":[{"auto-rows":te()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...O(),`normal`]}],"justify-items":[{"justify-items":[...k(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...k()]}],"align-content":[{content:[`normal`,...O()]}],"align-items":[{items:[...k(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...k(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":O()}],"place-items":[{"place-items":[...k(),`baseline`]}],"place-self":[{"place-self":[`auto`,...k()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mbs:[{mbs:A()}],mbe:[{mbe:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:ne()}],"inline-size":[{inline:[`auto`,...re()]}],"min-inline-size":[{"min-inline":[`auto`,...re()]}],"max-inline-size":[{"max-inline":[`none`,...re()]}],"block-size":[{block:[`auto`,...j()]}],"min-block-size":[{"min-block":[`auto`,...j()]}],"max-block-size":[{"max-block":[`none`,...j()]}],w:[{w:[s,`screen`,...ne()]}],"min-w":[{"min-w":[s,`screen`,`none`,...ne()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...ne()]}],h:[{h:[`screen`,`lh`,...ne()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...ne()]}],"max-h":[{"max-h":[`screen`,`lh`,`none`,...ne()]}],"font-size":[{text:[`base`,n,Ze,We]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,rt,Ke]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Pe,F]}],"font-family":[{font:[Qe,qe,t]}],"font-features":[{"font-features":[F]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,I,F]}],"line-clamp":[{"line-clamp":[P,`none`,I,Ge]}],leading:[{leading:[`none`,a,...w()]}],"list-image":[{"list-image":[`none`,I,F]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,I,F]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...ue(),`wavy`]}],"text-decoration-thickness":[{decoration:[P,`from-font`,`auto`,I,We]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[P,`auto`,I,F]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[Ne,I,F]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,I,F]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,I,F]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:ie()}],"bg-repeat":[{bg:ae()}],"bg-size":[{bg:oe()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Ne,I,F],radial:[``,I,F],conic:[``,Ne,I,F]},tt,Ye]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:se()}],"gradient-via-pos":[{via:se()}],"gradient-to-pos":[{to:se()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:ce()}],"rounded-s":[{"rounded-s":ce()}],"rounded-e":[{"rounded-e":ce()}],"rounded-t":[{"rounded-t":ce()}],"rounded-r":[{"rounded-r":ce()}],"rounded-b":[{"rounded-b":ce()}],"rounded-l":[{"rounded-l":ce()}],"rounded-ss":[{"rounded-ss":ce()}],"rounded-se":[{"rounded-se":ce()}],"rounded-ee":[{"rounded-ee":ce()}],"rounded-es":[{"rounded-es":ce()}],"rounded-tl":[{"rounded-tl":ce()}],"rounded-tr":[{"rounded-tr":ce()}],"rounded-br":[{"rounded-br":ce()}],"rounded-bl":[{"rounded-bl":ce()}],"border-w":[{border:le()}],"border-w-x":[{"border-x":le()}],"border-w-y":[{"border-y":le()}],"border-w-s":[{"border-s":le()}],"border-w-e":[{"border-e":le()}],"border-w-bs":[{"border-bs":le()}],"border-w-be":[{"border-be":le()}],"border-w-t":[{"border-t":le()}],"border-w-r":[{"border-r":le()}],"border-w-b":[{"border-b":le()}],"border-w-l":[{"border-l":le()}],"divide-x":[{"divide-x":le()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":le()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...ue(),`hidden`,`none`]}],"divide-style":[{divide:[...ue(),`hidden`,`none`]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...ue(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[P,I,F]}],"outline-w":[{outline:[``,P,Ze,We]}],"outline-color":[{outline:M()}],shadow:[{shadow:[``,`inner`,`none`,u,nt,Xe]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":[`none`,d,nt,Xe]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:le()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[P,We]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":le()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":[`none`,f,nt,Xe]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[P,I,F]}],"mix-blend":[{"mix-blend":[...de(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":de()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[P]}],"mask-image-linear-from-pos":[{"mask-linear-from":fe()}],"mask-image-linear-to-pos":[{"mask-linear-to":fe()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":fe()}],"mask-image-t-to-pos":[{"mask-t-to":fe()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":fe()}],"mask-image-r-to-pos":[{"mask-r-to":fe()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":fe()}],"mask-image-b-to-pos":[{"mask-b-to":fe()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":fe()}],"mask-image-l-to-pos":[{"mask-l-to":fe()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":fe()}],"mask-image-x-to-pos":[{"mask-x-to":fe()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":fe()}],"mask-image-y-to-pos":[{"mask-y-to":fe()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[I,F]}],"mask-image-radial-from-pos":[{"mask-radial-from":fe()}],"mask-image-radial-to-pos":[{"mask-radial-to":fe()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[P]}],"mask-image-conic-from-pos":[{"mask-conic-from":fe()}],"mask-image-conic-to-pos":[{"mask-conic-to":fe()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:ie()}],"mask-repeat":[{mask:ae()}],"mask-size":[{mask:oe()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,I,F]}],filter:[{filter:[``,`none`,I,F]}],blur:[{blur:pe()}],brightness:[{brightness:[P,I,F]}],contrast:[{contrast:[P,I,F]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,nt,Xe]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:[``,P,I,F]}],"hue-rotate":[{"hue-rotate":[P,I,F]}],invert:[{invert:[``,P,I,F]}],saturate:[{saturate:[P,I,F]}],sepia:[{sepia:[``,P,I,F]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,I,F]}],"backdrop-blur":[{"backdrop-blur":pe()}],"backdrop-brightness":[{"backdrop-brightness":[P,I,F]}],"backdrop-contrast":[{"backdrop-contrast":[P,I,F]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,P,I,F]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[P,I,F]}],"backdrop-invert":[{"backdrop-invert":[``,P,I,F]}],"backdrop-opacity":[{"backdrop-opacity":[P,I,F]}],"backdrop-saturate":[{"backdrop-saturate":[P,I,F]}],"backdrop-sepia":[{"backdrop-sepia":[``,P,I,F]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,I,F]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[P,`initial`,I,F]}],ease:[{ease:[`linear`,`initial`,_,I,F]}],delay:[{delay:[P,I,F]}],animate:[{animate:[`none`,v,I,F]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,I,F]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:me()}],"rotate-x":[{"rotate-x":me()}],"rotate-y":[{"rotate-y":me()}],"rotate-z":[{"rotate-z":me()}],scale:[{scale:he()}],"scale-x":[{"scale-x":he()}],"scale-y":[{"scale-y":he()}],"scale-z":[{"scale-z":he()}],"scale-3d":[`scale-3d`],skew:[{skew:ge()}],"skew-x":[{"skew-x":ge()}],"skew-y":[{"skew-y":ge()}],transform:[{transform:[I,F,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:_e()}],"translate-x":[{"translate-x":_e()}],"translate-y":[{"translate-y":_e()}],"translate-z":[{"translate-z":_e()}],"translate-none":[`translate-none`],zoom:[{zoom:[Ne,I,F]}],accent:[{accent:M()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:M()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,I,F]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":M()}],"scrollbar-track-color":[{"scrollbar-track":M()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,I,F]}],fill:[{fill:[`none`,...M()]}],"stroke-w":[{stroke:[P,Ze,We,Ge]}],stroke:[{stroke:[`none`,...M()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`start`,`end`,`right`,`left`],"inset-y":[`inset-bs`,`inset-be`,`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`ps`,`pe`,`pr`,`pl`],py:[`pbs`,`pbe`,`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`ms`,`me`,`mr`,`ml`],my:[`mbs`,`mbe`,`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-s`,`border-w-e`,`border-w-r`,`border-w-l`],"border-w-y":[`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-s`,`border-color-e`,`border-color-r`,`border-color-l`],"border-color-y":[`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-ms`,`scroll-me`,`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-ps`,`scroll-pe`,`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function L(...e){return mt(b(e))}var ht=Object.defineProperty,gt=(e,t)=>ht(e,`name`,{value:t,configurable:!0});function _t(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}gt(_t,`setRef`);function vt(...e){return t=>{let n=!1,r=e.map(e=>{let r=_t(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():_t(e[t],null)}}}}gt(vt,`composeRefs`);function yt(...e){return _.useCallback(vt(...e),e)}gt(yt,`useComposedRefs`);var bt=Object.defineProperty,xt=(e,t)=>bt(e,`name`,{value:t,configurable:!0});function St(e){let t=_.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];r=Nt(r),_.Children.forEach(r,e=>{if(kt(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;for(;jt(n)&&typeof Lt==`function`;)n=Lt(n._payload);a=Et(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=_.cloneElement(a,void 0,s):!o&&_.Children.count(r)===1&&_.isValidElement(r)&&(a=r);let c=a?Ot(a):void 0,l=yt(n,c);if(!a){if(r||r===0)throw Error(o?It(e):Ft(e));return r}let u=Dt(i,a.props??{});return a.type!==_.Fragment&&(u.ref=n?l:c),_.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}xt(St,`createSlot`);var Ct=St(`Slot`),wt=Symbol.for(`radix.slottable`);function Tt(e){let t=xt(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=wt,t}xt(Tt,`createSlottable`);var Et=xt((e,t)=>`child`in e.props?_.isValidElement(t)?_.cloneElement(t,void 0,e.props.children(t.props.children)):null:_.isValidElement(t)?t:null,`getSlottableElementFromSlottable`);function Dt(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`?n[r]=[i,a].filter(Boolean).join(` `):r===`aria-describedby`&&(n[r]=Pt(a,i))}return{...e,...n}}xt(Dt,`mergeProps`);function Ot(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}xt(Ot,`getElementRef`);function kt(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===wt}xt(kt,`isSlottable`);var At=Symbol.for(`react.lazy`);function jt(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===At&&`_payload`in e&&Mt(e._payload)}xt(jt,`isLazyComponent`);function Mt(e){return typeof e==`object`&&!!e&&`then`in e}xt(Mt,`isPromiseLike`);function Nt(e){let t=e;for(;jt(t)&&typeof Lt==`function`;)t=Lt(t._payload);return t}xt(Nt,`useUnwrappedLazy`);function Pt(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}xt(Pt,`concatAriaDescribedby`);var Ft=xt(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),It=xt(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),Lt=_.use,Rt=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),zt=o(((e,t)=>{t.exports=Rt()})),Bt=c(m(),1),R=zt(),Vt=Object.defineProperty,Ht=(e,t)=>Vt(e,`name`,{value:t,configurable:!0}),Ut=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=St(`Primitive.${t}`),r=_.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,R.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Wt(e,t){e&&Bt.flushSync(()=>e.dispatchEvent(t))}Ht(Wt,`dispatchDiscreteCustomEvent`);var Gt=Object.defineProperty,Kt=(e,t)=>Gt(e,`name`,{value:t,configurable:!0}),qt=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`}),Jt=_.forwardRef(Kt(function(e,t){return(0,R.jsx)(Ut.span,{...e,ref:t,style:{...qt,...e.style}})},`VisuallyHidden`)),Yt=Object.defineProperty,Xt=(e,t)=>Yt(e,`name`,{value:t,configurable:!0});function Zt(e,t){let n=_.createContext(t);n.displayName=e+`Context`;let r=Xt(e=>{let{children:t,...r}=e,i=_.useMemo(()=>r,Object.values(r));return(0,R.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=_.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return Xt(i,`useContext`),[r,i]}Xt(Zt,`createContext`);function Qt(e,t=[]){let n=[];function r(t,r){let i=_.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=Xt(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=_.useMemo(()=>o,Object.values(o));return(0,R.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=_.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return Xt(s,`useContext`),[o,s]}Xt(r,`createContext`);let i=Xt(()=>{let t=n.map(e=>_.createContext(e));return Xt(function(n){let r=n?.[e]||t;return _.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,$t(i,...t)]}Xt(Qt,`createContextScope`);function $t(...e){let t=e[0];if(e.length===1)return t;let n=Xt(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return Xt(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return _.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}Xt($t,`composeContextScopes`);var en=globalThis?.document?_.useLayoutEffect:()=>{},tn=Object.defineProperty,nn=(e,t)=>tn(e,`name`,{value:t,configurable:!0});function rn(e){let t=e+`CollectionProvider`,[n,r]=Qt(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=nn(e=>{let{scope:t,children:n}=e,r=_.useRef(null),a=_.useRef(new Map).current;return(0,R.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})},`CollectionProvider`);o.displayName=t;let s=e+`CollectionSlot`,c=St(s),l=_.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=yt(t,a(s,n).collectionRef);return(0,R.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=St(u),p=_.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=_.useRef(null),s=yt(t,o),c=a(u,n);return _.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,R.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return _.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return nn(m,`useCollection`),[{Provider:o,Slot:l,ItemSlot:p},m,r]}nn(rn,`createCollection`);var an=new WeakMap,on=class e extends Map{static{nn(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],an.set(this,!0)}set(e,t){return an.get(this)&&!this.has(e)&&this.#e.push(e),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=r?this.size:this.size+1,a=ln(e),o=a>=0?Math.min(a,i-1):Math.max(i+a,0);if(r?this.#e.indexOf(t)===o:o===this.size)return this.set(t,n),this;let s=this.#e.filter(e=>e!==t);s.splice(o,0,t);let c=s.map(e=>[e,e===t?n:this.get(e)]);this.clear();for(let[e,t]of c)this.set(e,t);return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);if(r===-1)return this;let i=this.#e.indexOf(t),a=i!==-1&&i<r?r-1:r;return this.insert(a,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);if(r===-1)return this;let i=this.#e.indexOf(t),a=i!==-1&&i<=r?r:r+1;return this.insert(a,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=sn(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=sn(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return sn(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=e.length>1;if(!r&&this.size===0)throw TypeError(`Reduce of empty OrderedDict with no initial value`);let i=0,a=n;for(let e of this)a=i===0&&!r?e:Reflect.apply(t,this,[a,e,i,this]),i++;return a}reduceRight(...e){let[t,n]=e,r=e.length>1;if(!r&&this.size===0)throw TypeError(`Reduce of empty OrderedDict with no initial value`);let i=n;for(let e=this.size-1;e>=0;e--){let n=this.entryAt(e);i=e===this.size-1&&!r?n:Reflect.apply(t,this,[i,n,e,this])}return i}sort(e){if(typeof e!=`function`)throw TypeError(`OrderedDict.sort requires a compare function`);let t=[...this.entries()].sort(e);this.clear();for(let[e,n]of t)this.set(e,n);return this}toSorted(t){if(typeof t!=`function`)throw TypeError(`OrderedDict.toSorted requires a compare function`);let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e;for(let e of this.#e.slice(t,n))r.set(e,this.get(e));return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function sn(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=cn(e,t);return n===-1?void 0:e[n]}nn(sn,`at`);function cn(e,t){let n=e.length,r=ln(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}nn(cn,`toSafeIndex`);function ln(e){return e!==e||e===0?0:Math.trunc(e)}nn(ln,`toSafeInteger`);function un(e){let t=e+`CollectionProvider`,[n,r]=Qt(t),[i,a]=n(t);i.displayName=e+`CollectionStableContextProvider`;let[o,s]=n(t);o.displayName=e+`CollectionStatefulContextProvider`;let c=nn(({state:e,...t})=>e?(0,R.jsx)(u,{...t,state:e}):(0,R.jsx)(l,{...t}),`CollectionProvider`);c.displayName=t;let l=nn(e=>{let t=v();return(0,R.jsx)(u,{...e,state:t})},`CollectionInit`);l.displayName=e+`CollectionInit`;let u=nn(e=>{let{scope:t,children:n,state:r}=e,a=_.useRef(null),[s,c]=_.useState(null),l=yt(a,c),[u,d]=r,f=_.useRef(new on),p=_.useCallback(()=>{let e=f.current;return pn(e)||e.sort(mn),e},[]);return _.useEffect(()=>{if(!s)return;let e=hn(()=>{d(e=>{let t=e.toSorted(mn);return t.some(([t],n)=>e.keyAt(n)!==t)?t:e})});return e.observe(s,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[s,d]),(0,R.jsx)(i,{scope:t,collectionElementRef:l,collectionElementRefObject:a,getCollection:p,setCollection:d,registryRef:f,children:(0,R.jsx)(o,{scope:t,collectionElement:s,collection:u,children:n})})},`CollectionProviderImpl`);u.displayName=e+`CollectionProviderImpl`;let d=e+`CollectionSlot`,f=St(d),p=_.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=yt(t,a(d,n).collectionElementRef);return(0,R.jsx)(f,{ref:i,children:r})});p.displayName=d;let m=e+`CollectionItemSlot`,h=St(m),g=_.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=_.useRef(null),{setCollection:s,registryRef:c}=a(m,n),l=_.useRef(i);dn(l.current,i)||(l.current=i);let u=l.current,d=yt(t,_.useCallback(e=>{let t=c.current;e?t.set(e,{...l.current,element:e}):o.current&&t.delete(o.current)},[c]),o);en(()=>{let e=o.current,t=c.current;e&&t.has(e)&&t.set(e,{...u,element:e})},[u,c]);let f=_.useRef(null);return _.useEffect(()=>{let e=o.current,t=f.current;((t?.element??null)!==e||e&&t?.itemData!==u)&&(f.current=e?{element:e,itemData:u}:null,s(n=>{let r=new on(n);return t&&t.element!==e&&r.delete(t.element),e&&r.set(e,{...u,element:e}),r.sort(mn)}))}),_.useEffect(()=>()=>{let e=f.current;f.current=null,e&&s(t=>{if(!t.has(e.element))return t;let n=new on(t);return n.delete(e.element),n})},[s]),(0,R.jsx)(h,{"data-radix-collection-item":``,ref:d,children:r})});g.displayName=m;function v(){return _.useState(new on)}nn(v,`useInitCollection`);function y(t){let{collection:n}=s(e+`CollectionConsumer`,t);return n}nn(y,`useCollection`);function b(t){let{getCollection:n}=a(e+`CollectionConsumer`,t);return n}return nn(b,`useGetCollection`),[{Provider:c,Slot:p,ItemSlot:g},{createCollectionScope:r,useCollection:y,useGetCollection:b,useInitCollection:v}]}nn(un,`createCollection`);function dn(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}nn(dn,`shallowEqual`);function fn(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}nn(fn,`isElementPreceding`);function pn(e){let t;for(let n of e.keys()){if(t){let e=t.compareDocumentPosition(n);if(!(e&Node.DOCUMENT_POSITION_DISCONNECTED)&&e&Node.DOCUMENT_POSITION_PRECEDING)return!1}t=n}return!0}nn(pn,`isInDocumentOrder`);function mn(e,t){return!e[1].element||!t[1].element?0:fn(e[1].element,t[1].element)?-1:1}nn(mn,`sortByDocumentPosition`);function hn(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}nn(hn,`getChildListObserver`);var gn=Object.defineProperty,_n=(e,t)=>gn(e,`name`,{value:t,configurable:!0}),vn=!!(typeof window<`u`&&window.document&&window.document.createElement);function z(e,t,{checkForDefaultPrevented:n=!0}={}){return _n(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}_n(z,`composeEventHandlers`);function yn(e){if(!vn)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}_n(yn,`getOwnerWindow`);function bn(e){if(!vn)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}_n(bn,`getOwnerDocument`);function xn(e,t=!1){let{activeElement:n}=bn(e);if(!n?.nodeName)return null;if(Sn(n)&&n.contentDocument)return xn(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=bn(n).getElementById(e);if(t)return t}}return n}_n(xn,`getActiveElement`);function Sn(e){return e.tagName===`IFRAME`}_n(Sn,`isFrame`);var Cn=Object.defineProperty,wn=(e,t)=>Cn(e,`name`,{value:t,configurable:!0}),Tn=_.useEffectEvent,En=_.useInsertionEffect;function Dn(e){if(typeof Tn==`function`)return Tn(e);let t=_.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof En==`function`?En(()=>{t.current=e}):en(()=>{t.current=e}),_.useMemo(()=>((...e)=>t.current?.(...e)),[])}wn(Dn,`useEffectEvent`);var On=Object.defineProperty,kn=(e,t)=>On(e,`name`,{value:t,configurable:!0}),An=_.useInsertionEffect||en;function jn({prop:e,defaultProp:t,onChange:n=kn(()=>{},`onChange`),caller:r}){let[i,a,o]=Mn({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,_.useCallback(t=>{if(s){let n=Nn(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}kn(jn,`useControllableState`);function Mn({defaultProp:e,onChange:t}){let[n,r]=_.useState(e),i=_.useRef(n),a=_.useRef(t);return An(()=>{a.current=t},[t]),_.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}kn(Mn,`useUncontrolledState`);function Nn(e){return typeof e==`function`}kn(Nn,`isFunction`);var Pn=Symbol(`RADIX:SYNC_STATE`);function Fn(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=Dn(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=_.useReducer((t,n)=>{if(n.type===Pn)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,m=_.useRef(p);_.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=_.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return _.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:Pn,state:i})},[i,d.state,c]),[h,f]}kn(Fn,`useControllableStateReducer`);var In=Object.defineProperty,Ln=(e,t)=>In(e,`name`,{value:t,configurable:!0});function Rn(e,t){return _.useReducer((e,n)=>t[e][n]??e,e)}Ln(Rn,`useStateMachine`);var zn=Ln(e=>{let{present:t,children:n}=e,r=Bn(t),i=typeof n==`function`?n({present:r.isPresent}):_.Children.only(n),a=Hn(r.ref,Wn(i));return typeof n==`function`||r.isPresent?_.cloneElement(i,{ref:a}):null},`Presence`);function Bn(e){let[t,n]=_.useState(),r=_.useRef(null),i=_.useRef(e),a=_.useRef(`none`),o=_.useRef(void 0),[s,c]=Rn(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return _.useEffect(()=>{s===`mounted`?(a.current=o.current??Un(r.current),o.current=void 0):a.current=`none`},[s]),en(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=Un(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),en(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=Ln(a=>{let o=Un(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=Ln(e=>{e.target===t&&(a.current=Un(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:_.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=Un(t)}else r.current=null;n(e)},[])}}Ln(Bn,`usePresence`);function Vn(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}Ln(Vn,`setRef`);function Hn(...e){let t=_.useRef(e);return t.current=e,_.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=Vn(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():Vn(n[e],null)}}},[])}Ln(Hn,`useStableComposedRefs`);function Un(e){return e?.animationName||`none`}Ln(Un,`getAnimationName`);function Wn(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Ln(Wn,`getElementRef`);var Gn=Object.defineProperty,Kn=(e,t)=>Gn(e,`name`,{value:t,configurable:!0}),qn=_.useId||(()=>void 0),Jn=0;function Yn(e){let[t,n]=_.useState(qn());return en(()=>{e||n(e=>e??String(Jn++))},[e]),e||(t?`radix-${t}`:``)}Kn(Yn,`useId`);var Xn=Object.defineProperty,Zn=(e,t)=>Xn(e,`name`,{value:t,configurable:!0}),Qn={LTR:`ltr`,RTL:`rtl`},$n=_.createContext(void 0);function er(e){let t=_.useContext($n);return e||t||Qn.LTR}Zn(er,`useDirection`);var tr=Object.defineProperty,nr=(e,t)=>tr(e,`name`,{value:t,configurable:!0}),rr=_.useInsertionEffect;function ir(e){let t=_.useRef(e);return typeof rr==`function`?rr(()=>{t.current=e}):en(()=>{t.current=e}),_.useMemo(()=>((...e)=>t.current?.(...e)),[])}nr(ir,`useCallbackRef`);var ar=Object.defineProperty,or=(e,t)=>ar(e,`name`,{value:t,configurable:!0}),sr=`dismissableLayer.update`,cr=`dismissableLayer.pointerDownOutside`,lr=`dismissableLayer.focusOutside`,ur,dr=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),fr=_.forwardRef(or(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=_.useContext(dr),[d,f]=_.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=_.useState({}),h=yt(t,f),g=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=v?g.indexOf(v):-1,b=d?g.indexOf(d):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,S=b>=y,C=_.useRef(!1),w=hr(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:C,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:_.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return S&&!t},[u.branches,S])}),T=gr(e=>{if(r&&C.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),E=d?b===g.length-1:!1,D=ir(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return _.useEffect(()=>{if(E)return p.addEventListener(`keydown`,D,{capture:!0}),()=>p.removeEventListener(`keydown`,D,{capture:!0})},[p,E,D]),_.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(ur=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),_r(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=ur))}},[d,p,n,u]),_.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),_r())},[d,u]),_.useEffect(()=>{let e=or(()=>m({}),`handleUpdate`);return document.addEventListener(sr,e),()=>document.removeEventListener(sr,e)},[]),(0,R.jsx)(Ut.div,{...l,ref:h,style:{pointerEvents:x?S?`auto`:`none`:void 0,...e.style},onFocusCapture:z(e.onFocusCapture,T.onFocusCapture),onBlurCapture:z(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:z(e.onPointerDownCapture,w.onPointerDownCapture)})},`DismissableLayer`));function pr(){let e=_.useContext(dr),[t,n]=_.useState(null);return _.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}or(pr,`useDismissableLayerSurface`);var mr=or(()=>!0,`IS_TRUE`);function hr(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=mr}=t,s=ir(e),c=_.useRef(!1),l=_.useRef(!1),u=_.useRef(new Map),d=_.useRef(()=>{});return _.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}or(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}or(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}or(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}or(p,`handleInteractionBubble`);let m=or(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||vr(cr,s,p,{discrete:!0})};if(or(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:or(()=>c.current=!0,`onPointerDownCapture`)}}or(hr,`usePointerDownOutside`);function gr(e,t=globalThis?.document){let n=ir(e),r=_.useRef(!1);return _.useEffect(()=>{let e=or(e=>{e.target&&!r.current&&vr(lr,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:or(()=>r.current=!0,`onFocusCapture`),onBlurCapture:or(()=>r.current=!1,`onBlurCapture`)}}or(gr,`useFocusOutside`);function _r(){let e=new CustomEvent(sr);document.dispatchEvent(e)}or(_r,`dispatchUpdate`);function vr(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Wt(i,a):i.dispatchEvent(a)}or(vr,`handleAndDispatchCustomEvent`);var yr=Object.defineProperty,br=(e,t)=>yr(e,`name`,{value:t,configurable:!0}),xr=`focusScope.autoFocusOnMount`,Sr=`focusScope.autoFocusOnUnmount`,Cr={bubbles:!1,cancelable:!0},wr=_.forwardRef(br(function(e,t){let{loop:n=!1,trapped:r=!1,branches:i,onMountAutoFocus:a,onUnmountAutoFocus:o,...s}=e,[c,l]=_.useState(null),u=ir(a),d=ir(o),f=_.useRef(null),p=yt(t,l),m=_.useRef(i);_.useEffect(()=>{m.current=i});let h=_.useCallback(e=>e?c?.contains(e)?!0:!!m.current?.some(t=>t.contains(e)):!1,[c]),g=_.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_.useEffect(()=>{if(r){let e=function(e){if(g.paused||!c)return;let t=e.target;h(t)?f.current=t:Fr(f.current,{select:!0})},t=function(e){if(g.paused||!c)return;let t=e.relatedTarget;t!==null&&(h(t)||Fr(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Fr(c)};br(e,`handleFocusIn`),br(t,`handleFocusOut`),br(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return c&&r.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,c,g.paused,h]),_.useEffect(()=>{if(c){Ir.add(g);let e=document.activeElement;if(!c.contains(e)){let t=new CustomEvent(xr,Cr);c.addEventListener(xr,u),c.dispatchEvent(t),t.defaultPrevented||(kr(zr(jr(c)),{select:!0}),document.activeElement===e&&Fr(c))}return()=>{c.removeEventListener(xr,u);let t=c.ownerDocument,n=CustomEvent;setTimeout(()=>{let r=new n(Sr,Cr);c.addEventListener(Sr,d),c.dispatchEvent(r),r.defaultPrevented||Fr(e??t.body,{select:!0}),c.removeEventListener(Sr,d),Ir.remove(g)},0)}}},[c,u,d,g]);let v=_.useCallback(e=>{if(!n&&!r||g.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Ar(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Fr(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Fr(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,g.paused]);return(0,R.jsx)(Ut.div,{tabIndex:-1,...s,ref:p,onKeyDown:v})},`FocusScope`)),Tr=_.createContext(null);function Er({registry:e,children:t}){return e?(0,R.jsx)(Tr.Provider,{value:e,children:t}):t}br(Er,`FocusScopeBranchProvider`);function Dr(){let[e,t]=_.useState([]);return{nodes:e,registry:_.useMemo(()=>({add:br(e=>t(t=>t.includes(e)?t:[...t,e]),`add`),remove:br(e=>t(t=>t.filter(t=>t!==e)),`remove`)}),[])}}br(Dr,`useFocusScopeBranchRegistry`);function Or(e){let t=_.useContext(Tr);_.useEffect(()=>{if(e&&t)return t.add(e),()=>t.remove(e)},[e,t])}br(Or,`useFocusScopeBranch`);function kr(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Fr(r,{select:t}),document.activeElement!==n)return}br(kr,`focusFirst`);function Ar(e){let t=jr(e);return[Mr(t,e),Mr(t.reverse(),e)]}br(Ar,`getTabbableEdges`);function jr(e){let t=[],n=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:br(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}br(jr,`getTabbableCandidates`);function Mr(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Nr(r,{upTo:t})))return r}br(Mr,`findVisible`);function Nr(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}br(Nr,`isHidden`);function Pr(e){return e.tagName===`INPUT`&&typeof e.select==`function`}br(Pr,`isSelectableInput`);function Fr(e,{select:t=!1}={}){if(e&&e.focus){let n=(e.ownerDocument??document).activeElement;e.focus({preventScroll:!0}),e!==n&&Pr(e)&&t&&e.select()}}br(Fr,`focus`);var Ir=Lr();function Lr(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Rr(e,t),e.unshift(t)},remove(t){e=Rr(e,t),e[0]?.resume()}}}br(Lr,`createFocusScopesStack`);function Rr(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}br(Rr,`arrayRemove`);function zr(e){return e.filter(e=>e.tagName!==`A`)}br(zr,`removeLinks`);var Br=Object.defineProperty,Vr=_.forwardRef(((e,t)=>Br(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=_.useState(!1);en(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Bt.createPortal((0,R.jsx)(Ut.div,{...r,ref:t}),o):null},`Portal`)),Hr=Object.defineProperty,Ur=(e,t)=>Hr(e,`name`,{value:t,configurable:!0}),Wr=0,Gr=null;function Kr(e){return qr(),e.children}Ur(Kr,`FocusGuards`);function qr(){_.useEffect(()=>{Gr||={start:Jr(),end:Jr()};let{start:e,end:t}=Gr;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),Wr++,()=>{Wr===1&&(Gr?.start.remove(),Gr?.end.remove(),Gr=null),Wr=Math.max(0,Wr-1)}},[])}Ur(qr,`useFocusGuards`);function Jr(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}Ur(Jr,`createFocusGuard`);var Yr=function(){return Yr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Yr.apply(this,arguments)};function Xr(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Zr(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var Qr=`right-scroll-bar-position`,$r=`width-before-scroll-bar`,ei=`with-scroll-bars-hidden`,ti=`--removed-body-scroll-bar-size`;function ni(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function ri(e,t){var n=(0,_.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var ii=typeof window<`u`?_.useLayoutEffect:_.useEffect,ai=new WeakMap;function oi(e,t){var n=ri(t||null,function(t){return e.forEach(function(e){return ni(e,t)})});return ii(function(){var t=ai.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||ni(e,null)}),i.forEach(function(e){r.has(e)||ni(e,a)})}ai.set(n,e)},[e]),n}function si(e){return e}function ci(e,t){t===void 0&&(t=si);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function li(e){e===void 0&&(e={});var t=ci(null);return t.options=Yr({async:!0,ssr:!1},e),t}var ui=function(e){var t=e.sideCar,n=Xr(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return _.createElement(r,Yr({},n))};ui.isSideCarExport=!0;function di(e,t){return e.useMedium(t),ui}var fi=li(),pi=function(){},mi=_.forwardRef(function(e,t){var n=_.useRef(null),r=_.useState({onScrollCapture:pi,onWheelCapture:pi,onTouchMoveCapture:pi}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,b=e.gapMode,x=Xr(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=f,C=oi([n,t]),w=Yr(Yr({},x),i);return _.createElement(_.Fragment,null,u&&_.createElement(S,{sideCar:fi,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:b}),o?_.cloneElement(_.Children.only(s),Yr(Yr({},w),{ref:C})):_.createElement(y,Yr({},w,{className:c,ref:C}),s))});mi.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},mi.classNames={fullWidth:$r,zeroRight:Qr};var hi=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function gi(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=hi();return t&&e.setAttribute(`nonce`,t),e}function _i(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function vi(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var yi=function(){var e=0,t=null;return{add:function(n){e==0&&(t=gi())&&(_i(t,n),vi(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},bi=function(){var e=yi();return function(t,n){_.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},xi=function(){var e=bi();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Si={left:0,top:0,right:0,gap:0},Ci=function(e){return parseInt(e||``,10)||0},wi=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Ci(n),Ci(r),Ci(i)]},Ti=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Si;var t=wi(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Ei=xi(),Di=`data-scroll-locked`,Oi=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
10
|
+
.${ei} {
|
|
11
|
+
overflow: hidden ${r};
|
|
12
|
+
padding-right: ${s}px ${r};
|
|
13
|
+
}
|
|
14
|
+
body[${Di}] {
|
|
15
|
+
overflow: hidden ${r};
|
|
16
|
+
overscroll-behavior: contain;
|
|
17
|
+
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
18
|
+
padding-left: ${i}px;
|
|
19
|
+
padding-top: ${a}px;
|
|
20
|
+
padding-right: ${o}px;
|
|
21
|
+
margin-left:0;
|
|
22
|
+
margin-top:0;
|
|
23
|
+
margin-right: ${s}px ${r};
|
|
24
|
+
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.${Qr} {
|
|
28
|
+
right: ${s}px ${r};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.${$r} {
|
|
32
|
+
margin-right: ${s}px ${r};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.${Qr} .${Qr} {
|
|
36
|
+
right: 0 ${r};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.${$r} .${$r} {
|
|
40
|
+
margin-right: 0 ${r};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
body[${Di}] {
|
|
44
|
+
${ti}: ${s}px;
|
|
45
|
+
}
|
|
46
|
+
`},ki=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Ai=function(){_.useEffect(function(){return document.body.setAttribute(Di,(ki()+1).toString()),function(){var e=ki()-1;e<=0?document.body.removeAttribute(Di):document.body.setAttribute(Di,e.toString())}},[])},ji=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Ai();var a=_.useMemo(function(){return Ti(i)},[i]);return _.createElement(Ei,{styles:Oi(a,!t,i,n?``:`!important`)})},Mi=!1;if(typeof window<`u`)try{var Ni=Object.defineProperty({},"passive",{get:function(){return Mi=!0,!0}});window.addEventListener(`test`,Ni,Ni),window.removeEventListener(`test`,Ni,Ni)}catch{Mi=!1}var Pi=Mi?{passive:!1}:!1,Fi=function(e){return e.tagName===`TEXTAREA`},Ii=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Fi(e)&&n[t]===`visible`)},Li=function(e){return Ii(e,`overflowY`)},Ri=function(e){return Ii(e,`overflowX`)},zi=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Hi(e,r)){var i=Ui(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Bi=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Vi=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Hi=function(e,t){return e===`v`?Li(t):Ri(t)},Ui=function(e,t){return e===`v`?Bi(t):Vi(t)},Wi=function(e,t){return e===`h`&&t===`rtl`?-1:1},Gi=function(e,t,n,r,i){var a=Wi(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Ui(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Hi(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Ki=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},qi=function(e){return[e.deltaX,e.deltaY]},Ji=function(e){return e&&`current`in e?e.current:e},Yi=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Xi=function(e){return`
|
|
47
|
+
.block-interactivity-${e} {pointer-events: none;}
|
|
48
|
+
.allow-interactivity-${e} {pointer-events: all;}
|
|
49
|
+
`},Zi=0,Qi=[];function $i(e){var t=_.useRef([]),n=_.useRef([0,0]),r=_.useRef(),i=_.useState(Zi++)[0],a=_.useState(xi)[0],o=_.useRef(e);_.useEffect(function(){o.current=e},[e]),_.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Zr([e.lockRef.current],(e.shards||[]).map(Ji),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=_.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Ki(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=zi(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=zi(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Gi(h,t,e,h===`h`?s:c,!0)},[]),c=_.useCallback(function(e){var n=e;if(Qi.length&&Qi[Qi.length-1]===a){var r=`deltaY`in n?qi(n):Ki(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Yi(e.delta,r)})[0];if(i&&i.should)n.cancelable&&n.preventDefault();else if(!i){var c=(o.current.shards||[]).map(Ji).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=_.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:ea(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=_.useCallback(function(e){n.current=Ki(e),r.current=void 0},[]),d=_.useCallback(function(t){l(t.type,qi(t),t.target,s(t,e.lockRef.current))},[]),f=_.useCallback(function(t){l(t.type,Ki(t),t.target,s(t,e.lockRef.current))},[]);_.useEffect(function(){return Qi.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Pi),document.addEventListener(`touchmove`,c,Pi),document.addEventListener(`touchstart`,u,Pi),function(){Qi=Qi.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Pi),document.removeEventListener(`touchmove`,c,Pi),document.removeEventListener(`touchstart`,u,Pi)}},[]);var p=e.removeScrollBar,m=e.inert;return _.createElement(_.Fragment,null,m?_.createElement(a,{styles:Xi(i)}):null,p?_.createElement(ji,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function ea(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var ta=di(fi,$i),na=_.forwardRef(function(e,t){return _.createElement(mi,Yr({},e,{ref:t,sideCar:ta}))});na.classNames=mi.classNames;var ra=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},ia=new WeakMap,B=new WeakMap,aa={},oa=0,sa=function(e){return e&&(e.host||sa(e.parentNode))},ca=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=sa(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},la=function(e,t,n,r){var i=ca(t,Array.isArray(e)?e:[e]);aa[n]||(aa[n]=new WeakMap);var a=aa[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(ia.get(e)||0)+1,l=(a.get(e)||0)+1;ia.set(e,c),a.set(e,l),o.push(e),c===1&&i&&B.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),oa++,function(){o.forEach(function(e){var t=ia.get(e)-1,i=a.get(e)-1;ia.set(e,t),a.set(e,i),t||(B.has(e)||e.removeAttribute(r),B.delete(e)),i||e.removeAttribute(n)}),oa--,oa||(ia=new WeakMap,ia=new WeakMap,B=new WeakMap,aa={})}},ua=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||ra(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),la(r,i,n,`aria-hidden`)):function(){return null}},da=Object.defineProperty,fa=(e,t)=>da(e,`name`,{value:t,configurable:!0}),pa=`Dialog`,[ma,ha]=Qt(pa),[ga,_a]=ma(pa),va=fa(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=_.useRef(null),c=_.useRef(null),{nodes:l,registry:u}=Dr(),[d,f]=jn({prop:r,defaultProp:i??!1,onChange:a,caller:pa}),[p,m]=_.useState(0),[h,g]=_.useState(0);return(0,R.jsx)(ga,{scope:t,triggerRef:s,contentRef:c,contentId:Yn(),titleId:Yn(),descriptionId:Yn(),titlePresent:p>0,descriptionPresent:h>0,setTitleCount:m,setDescriptionCount:g,open:d,onOpenChange:f,onOpenToggle:_.useCallback(()=>f(e=>!e),[f]),modal:o,branchNodes:l,branchRegistry:u,children:n})},`Dialog`),ya=`DialogTrigger`,ba=_.forwardRef(fa(function(e,t){let{__scopeDialog:n,...r}=e,i=_a(ya,n),a=yt(t,i.triggerRef);return(0,R.jsx)(Ut.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":za(i.open),...r,ref:a,onClick:z(e.onClick,i.onOpenToggle)})},`DialogTrigger`)),xa=`DialogPortal`,[Sa,Ca]=ma(xa,{forceMount:void 0}),wa=fa(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=_a(xa,t);return(0,R.jsx)(Sa,{scope:t,forceMount:n,children:_.Children.map(r,e=>(0,R.jsx)(zn,{present:n||a.open,children:(0,R.jsx)(Vr,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),Ta=`DialogOverlay`,Ea=_.forwardRef(fa(function(e,t){let n=Ca(Ta,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=_a(Ta,e.__scopeDialog);return a.modal?(0,R.jsx)(zn,{present:r||a.open,children:(0,R.jsx)(Oa,{...i,ref:t})}):null},`DialogOverlay`)),Da=St(`DialogOverlay.RemoveScroll`),Oa=_.forwardRef(fa(function(e,t){let{__scopeDialog:n,...r}=e,i=_a(Ta,n),a=yt(t,pr());return(0,R.jsx)(na,{as:Da,allowPinchZoom:!0,shards:_.useMemo(()=>[i.contentRef,...i.branchNodes.map(e=>({current:e}))],[i.contentRef,i.branchNodes]),children:(0,R.jsx)(Ut.div,{"data-state":za(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),ka=`DialogContent`,Aa=_.forwardRef(fa(function(e,t){let n=Ca(ka,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=_a(ka,e.__scopeDialog);return(0,R.jsx)(zn,{present:r||a.open,children:a.modal?(0,R.jsx)(ja,{...i,ref:t}):(0,R.jsx)(Ma,{...i,ref:t})})},`DialogContent`)),ja=_.forwardRef(fa(function(e,t){let n=_a(ka,e.__scopeDialog),r=_.useRef(null),i=yt(t,n.contentRef,r);return _.useEffect(()=>{let e=r.current;if(e)return ua(e)},[]),(0,R.jsx)(Na,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:z(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:z(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:z(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Ma=_.forwardRef(fa(function(e,t){let n=_a(ka,e.__scopeDialog),r=_.useRef(!1),i=_.useRef(!1);return(0,R.jsx)(Na,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),Na=_.forwardRef(fa(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,"aria-describedby":o,children:s,...c}=e,l=_a(ka,n);return qr(),(0,R.jsx)(Er,{registry:l.branchRegistry,children:(0,R.jsx)(wr,{asChild:!0,loop:!0,trapped:r,branches:l.branchNodes,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,R.jsx)(fr,{role:`dialog`,id:l.contentId,"aria-labelledby":l.titlePresent?l.titleId:void 0,"aria-describedby":l.descriptionPresent?Ra(o,l.descriptionId):o,"data-state":za(l.open),...c,ref:t,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1),children:s})})})},`DialogContentImpl`)),Pa=_.forwardRef(fa(function(e,t){let{__scopeDialog:n,...r}=e,i=_a(`DialogTitle`,n),{setTitleCount:a}=i;return en(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,R.jsx)(Ut.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),Fa=_.forwardRef(fa(function(e,t){let{__scopeDialog:n,...r}=e,i=_a(`DialogDescription`,n),{setDescriptionCount:a}=i;return en(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,R.jsx)(Ut.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),Ia=`DialogClose`,La=_.forwardRef(fa(function(e,t){let{__scopeDialog:n,...r}=e,i=_a(Ia,n);return(0,R.jsx)(Ut.button,{type:`button`,...r,ref:t,onClick:z(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function Ra(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}fa(Ra,`concatAriaDescribedby`);function za(e){return e?`open`:`closed`}fa(za,`getState`);var Ba=Object.defineProperty,Va=(e,t)=>Ba(e,`name`,{value:t,configurable:!0});function Ha(e){let[t,n]=_.useState(void 0);return en(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=0,r=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;let i=r[0];window.cancelAnimationFrame(t),t=window.requestAnimationFrame(()=>{let t,r;if(`borderBoxSize`in i){let e=i.borderBoxSize,n=Array.isArray(e)?e[0]:e;t=n.inlineSize,r=n.blockSize}else t=e.offsetWidth,r=e.offsetHeight;n({width:t,height:r})})});return r.observe(e,{box:`border-box`}),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}n(void 0)},[e]),t}Va(Ha,`useSize`);var Ua=[`top`,`right`,`bottom`,`left`],Wa=[`start`,`end`],Ga=Ua.reduce((e,t)=>e.concat(t,t+`-`+Wa[0],t+`-`+Wa[1]),[]),Ka=Math.min,qa=Math.max,Ja=Math.round,Ya=Math.floor,Xa=e=>({x:e,y:e}),Za={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Qa(e,t,n){return qa(e,Ka(t,n))}function $a(e,t){return typeof e==`function`?e(t):e}function eo(e){return e.split(`-`)[0]}function to(e){return e.split(`-`)[1]}function no(e){return e===`x`?`y`:`x`}function ro(e){return e===`y`?`height`:`width`}function io(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function ao(e){return no(io(e))}function oo(e,t,n){n===void 0&&(n=!1);let r=to(e),i=ao(e),a=ro(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=go(o)),[o,go(o)]}function so(e){let t=go(e);return[co(e),t,co(t)]}function co(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var lo=[`left`,`right`],uo=[`right`,`left`],fo=[`top`,`bottom`],po=[`bottom`,`top`];function mo(e,t,n){switch(e){case`top`:case`bottom`:return n?t?uo:lo:t?lo:uo;case`left`:case`right`:return t?fo:po;default:return[]}}function ho(e,t,n,r){let i=to(e),a=mo(eo(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(co)))),a}function go(e){let t=eo(e);return Za[t]+e.slice(t.length)}function _o(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function vo(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:_o(e)}function yo(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function bo(e,t,n){let{reference:r,floating:i}=e,a=io(t),o=ao(t),s=ro(o),c=eo(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=to(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function xo(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=$a(t,e),p=vo(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=yo(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=yo(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var So=50,Co=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:xo},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=bo(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<So&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=bo(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},wo=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=$a(e,t)||{};if(l==null)return{};let d=vo(u),f={x:n,y:r},p=ao(i),m=ro(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;C&&await(o.isElement==null?void 0:o.isElement(S))||(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Ka(d[_],T),D=Ka(d[v],T),ee=C-h[m]-D,te=C/2-h[m]/2+w,O=Qa(E,te,ee),k=!c.arrow&&to(i)!=null&&te!==O&&a.reference[m]/2-(te<E?E:D)-h[m]/2<0,A=k?te<E?te-E:te-ee:0;return{[p]:f[p]+A,data:{[p]:O,centerOffset:te-O-A,...k&&{alignmentOffset:A}},reset:k}}});function To(e,t,n){return(e?[...n.filter(t=>to(t)===e),...n.filter(t=>to(t)!==e)]:n.filter(e=>eo(e)===e)).filter(n=>!e||to(n)===e||(t?co(n)!==n:!1))}var Eo=function(e){return e===void 0&&(e={}),{name:`autoPlacement`,options:e,async fn(t){let{rects:n,middlewareData:r,placement:i,platform:a,elements:o}=t,{crossAxis:s=!1,alignment:c,allowedPlacements:l=Ga,autoAlignment:u=!0,...d}=$a(e,t),f=c!==void 0||l===Ga?To(c||null,u,l):l,p=r.autoPlacement?.index||0,m=f[p];if(m==null)return{};if(i!==m)return{reset:{placement:f[0]}};let h=await a.detectOverflow(t,d),g=oo(m,n,await(a.isRTL==null?void 0:a.isRTL(o.floating))),_=[h[eo(m)],h[g[0]],h[g[1]]],v=[...r.autoPlacement?.overflows||[],{placement:m,overflows:_}],y=f[p+1];if(y)return{data:{index:p+1,overflows:v},reset:{placement:y}};let b=v.map(e=>{let t=to(e.placement);return[e.placement,t&&s?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),x=b.filter(e=>e[2].slice(0,to(e[0])?2:3).every(e=>e<=0))[0]?.[0]||b[0][0];return x===i?{}:{data:{index:p+1,overflows:v},reset:{placement:x}}}}},Do=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=$a(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=eo(r),_=io(o),v=eo(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[go(o)]:so(o)),x=p!==`none`;!d&&x&&b.push(...ho(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=oo(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===io(t)||T.every(e=>io(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=io(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function Oo(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ko(e){return Ua.some(t=>e[t]>=0)}var Ao=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=$a(e,t);switch(i){case`referenceHidden`:{let e=Oo(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ko(e)}}}case`escaped`:{let e=Oo(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:ko(e)}}}default:return{}}}}};function jo(e){let t=Ka(...e.map(e=>e.left)),n=Ka(...e.map(e=>e.top)),r=qa(...e.map(e=>e.right)),i=qa(...e.map(e=>e.bottom));return{x:t,y:n,width:r-t,height:i-n}}function Mo(e){let t=e.slice().sort((e,t)=>e.y-t.y),n=[],r=null;for(let e=0;e<t.length;e++){let i=t[e];!r||i.y-r.y>r.height/2?n.push([i]):n[n.length-1].push(i),r=i}return n.map(e=>yo(jo(e)))}var No=function(e){return e===void 0&&(e={}),{name:`inline`,options:e,async fn(t){let{placement:n,elements:r,rects:i,platform:a,strategy:o}=t,{padding:s=2,x:c,y:l}=$a(e,t),u=Array.from(await(a.getClientRects==null?void 0:a.getClientRects(r.reference))||[]);if(!u.length)return{};let d=Mo(u),f=yo(jo(u)),p=vo(s);function m(){if(d.length===2&&(d[0].left>d[1].right||d[1].left>d[0].right)&&c!=null&&l!=null)return d.find(e=>c>e.left-p.left&&c<e.right+p.right&&l>e.top-p.top&&l<e.bottom+p.bottom)||f;if(d.length>=2){if(io(n)===`y`){let e=d[0],t=d[d.length-1],r=eo(n)===`top`,i=e.top,a=t.bottom,o=r?e.left:t.left;return yo({x:o,y:i,width:(r?e.right:t.right)-o,height:a-i})}let e=eo(n)===`left`,t=qa(...d.map(e=>e.right)),r=Ka(...d.map(e=>e.left)),i=d.filter(n=>e?n.left===r:n.right===t),a=i[0].top,o=i[i.length-1].bottom;return yo({x:r,y:a,width:t-r,height:o-a})}return f}let h=await a.getElementRects({reference:{getBoundingClientRect:m},floating:r.floating,strategy:o});return i.reference.x!==h.reference.x||i.reference.y!==h.reference.y||i.reference.width!==h.reference.width||i.reference.height!==h.reference.height?{reset:{rects:h}}:{}}}},Po=new Set([`left`,`top`]);async function Fo(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=eo(n),s=to(n),c=io(n)===`y`,l=Po.has(o)?-1:1,u=a&&c?-1:1,d=$a(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Io=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Fo(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Lo=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=$a(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=io(i),p=no(f),m=u[p],h=u[f],g=(e,t)=>Qa(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Ro=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=$a(e,t),u={x:n,y:r},d=io(i),f=no(d),p=u[f],m=u[d],h=$a(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Po.has(eo(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},zo=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=$a(e,t),c=await i.detectOverflow(t,s),l=eo(n),u=to(n),d=io(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Ka(p-c[m],g),y=Ka(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*qa(c.left,c.right):S=p-2*qa(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Bo(){return typeof window<`u`}function Vo(e){return Uo(e)?(e.nodeName||``).toLowerCase():`#document`}function Ho(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function V(e){return((Uo(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Uo(e){return Bo()?e instanceof Node||e instanceof Ho(e).Node:!1}function Wo(e){return Bo()?e instanceof Element||e instanceof Ho(e).Element:!1}function Go(e){return Bo()?e instanceof HTMLElement||e instanceof Ho(e).HTMLElement:!1}function Ko(e){return!Bo()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Ho(e).ShadowRoot}function qo(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=is(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Jo(e){return/^(table|td|th)$/.test(Vo(e))}function Yo(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Xo=/transform|translate|scale|rotate|perspective|filter/,Zo=/paint|layout|strict|content/,Qo=e=>!!e&&e!==`none`,$o;function es(e){let t=Wo(e)?is(e):e;return Qo(t.transform)||Qo(t.translate)||Qo(t.scale)||Qo(t.rotate)||Qo(t.perspective)||!ns()&&(Qo(t.backdropFilter)||Qo(t.filter))||Xo.test(t.willChange||``)||Zo.test(t.contain||``)}function ts(e){let t=ss(e);for(;Go(t)&&!rs(t);){if(es(t))return t;if(Yo(t))return null;t=ss(t)}return null}function ns(){return $o??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),$o}function rs(e){return/^(html|body|#document)$/.test(Vo(e))}function is(e){return Ho(e).getComputedStyle(e)}function as(e){return Wo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ss(e){if(Vo(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ko(e)&&e.host||V(e);return Ko(t)?t.host:t}function cs(e){let t=ss(e);return rs(t)?(e.ownerDocument||e).body:Go(t)&&qo(t)?t:cs(t)}function ls(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=cs(e),i=r===e.ownerDocument?.body,a=Ho(r);if(i){let e=us(a);return t.concat(a,a.visualViewport||[],qo(r)?r:[],e&&n?ls(e):[])}return t.concat(r,ls(r,[],n))}function us(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ds(e){let t=is(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Go(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Ja(n)!==a||Ja(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function fs(e){return Wo(e)?e:e.contextElement}function ps(e){let t=fs(e);if(!Go(t))return Xa(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=ds(t),o=(a?Ja(n.width):n.width)/r,s=(a?Ja(n.height):n.height)/i;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}var ms=Xa(0);function hs(e){let t=Ho(e);return!ns()||!t.visualViewport?ms:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function gs(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Ho(e)}function _s(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=fs(e),o=Xa(1);t&&(r?Wo(r)&&(o=ps(r)):o=ps(e));let s=gs(a,n,r)?hs(a):Xa(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Ho(a),t=Wo(r)?Ho(r):r,n=e,i=us(n);for(;i&&t!==n;){let e=ps(i),t=i.getBoundingClientRect(),r=is(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Ho(i),i=us(n)}}return yo({width:u,height:d,x:c,y:l})}function vs(e,t){let n=as(e).scrollLeft;return t?t.left+n:_s(V(e)).left+n}function ys(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-vs(e,n),y:n.top+t.scrollTop}}function bs(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=V(r),s=t?Yo(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Xa(1),u=Xa(0),d=Go(r);if((d||!a)&&((Vo(r)!==`body`||qo(o))&&(c=as(r)),d)){let e=_s(r);l=ps(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?ys(o,c):Xa(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function xs(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Ss(e){let t=as(e),n=e.ownerDocument.body,r=qa(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=qa(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+vs(e),o=-t.scrollTop;return is(n).direction===`rtl`&&(a+=qa(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Cs=25;function ws(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Ho(e),a=V(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!ns()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(vs(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=Cs&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Ts(e,t){let n=_s(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=ps(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Es(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=ws(e,n,t);else if(t===`document`)r=Ss(V(e));else if(Wo(t))r=Ts(t,n);else{let n=hs(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return yo(r)}function Ds(e,t){let n=t.get(e);if(n)return n;let r=ls(e,[],!1).filter(e=>Wo(e)&&Vo(e)!==`body`),i=null,a=is(e).position===`fixed`,o=a?ss(e):e;for(;Wo(o)&&!rs(o);){let e=is(o),t=es(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=ss(o)}return t.set(e,r),r}function Os(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Yo(t)?[]:Ds(t,this._c):[].concat(n),r],o=Es(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Es(t,a[e],i);s=qa(n.top,s),c=Ka(n.right,c),l=Ka(n.bottom,l),u=qa(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function ks(e){let{width:t,height:n}=ds(e);return{width:t,height:n}}function As(e,t,n){let r=Go(t),i=V(t),a=n===`fixed`,o=_s(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Xa(0);if((r||!a)&&((Vo(t)!==`body`||qo(i))&&(s=as(t)),r)){let e=_s(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=vs(i));let l=i&&!r&&!a?ys(i,s):Xa(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function js(e){return is(e).position===`static`}function Ms(e,t){if(!Go(e)||is(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return V(e)===n&&(n=n.ownerDocument.body),n}function Ns(e,t){let n=Ho(e);if(Yo(e))return n;if(!Go(e)){let t=ss(e);for(;t&&!rs(t);){if(Wo(t)&&!js(t))return t;t=ss(t)}return n}let r=Ms(e,t);for(;r&&Jo(r)&&js(r);)r=Ms(r,t);return r&&rs(r)&&js(r)&&!es(r)?n:r||ts(e)||n}var Ps=async function(e){let t=this.getOffsetParent||Ns,n=this.getDimensions,r=await n(e.floating);return{reference:As(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Fs(e){return is(e).direction===`rtl`}var Is={convertOffsetParentRelativeRectToViewportRelativeRect:bs,getDocumentElement:V,getClippingRect:Os,getOffsetParent:Ns,getElementRects:Ps,getClientRects:xs,getDimensions:ks,getScale:ps,isElement:Wo,isRTL:Fs};function Ls(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Rs(e,t,n){let r=null,i,a=V(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=Ya(d),h=Ya(a.clientWidth-(u+f)),g=Ya(a.clientHeight-(d+p)),_=Ya(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:qa(0,Ka(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Ls(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Ho(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function zs(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=fs(e),u=i||a?[...l?ls(l):[],...t?ls(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Rs(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?_s(e):null;c&&g();function g(){let t=_s(e);h&&!Ls(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Bs=Io,Vs=Eo,Hs=Lo,Us=Do,Ws=zo,Gs=Ao,Ks=wo,qs=No,Js=Ro,Ys=(e,t,n)=>{let r=new Map,i=n??{},a={...Is,...i.platform,_c:r};return Co(e,t,{...i,platform:a})},Xs=typeof document<`u`?_.useLayoutEffect:function(){};function Zs(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Zs(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Zs(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Qs(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $s(e,t){let n=Qs(e);return Math.round(t*n)/n}function ec(e){let t=_.useRef(e);return Xs(()=>{t.current=e}),t}function tc(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=_.useState(r);Zs(f,r)||p(r);let[m,h]=_.useState(null),[g,v]=_.useState(null),y=_.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),b=_.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||m,S=o||g,C=_.useRef(null),w=_.useRef(null),T=_.useRef(u),E=c!=null,D=ec(c),ee=ec(i),te=ec(l),O=_.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};ee.current&&(e.platform=ee.current),Ys(C.current,w.current,e).then(e=>{let t={...e,isPositioned:te.current!==!1};k.current&&!Zs(T.current,t)&&(T.current=t,Bt.flushSync(()=>{d(t)}))})},[f,t,n,ee,te]);Xs(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let k=_.useRef(!1);Xs(()=>(k.current=!0,()=>{k.current=!1}),[]),Xs(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,O);O()}},[x,S,O,D,E]);let A=_.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),ne=_.useMemo(()=>({reference:x,floating:S}),[x,S]),re=_.useMemo(()=>{let e={position:n,left:0,top:0};if(!ne.floating)return e;let t=$s(ne.floating,u.x),r=$s(ne.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Qs(ne.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,ne.floating,u.x,u.y]);return _.useMemo(()=>({...u,update:O,refs:A,elements:ne,floatingStyles:re}),[u,O,A,ne,re])}var nc=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Ks({element:r.current,padding:i}).fn(n):r?Ks({element:r,padding:i}).fn(n):{}}}},rc=(e,t)=>{let n=Bs(e);return{name:n.name,fn:n.fn,options:[e,t]}},ic=(e,t)=>{let n=Hs(e);return{name:n.name,fn:n.fn,options:[e,t]}},ac=(e,t)=>({fn:Js(e).fn,options:[e,t]}),oc=(e,t)=>{let n=Us(e);return{name:n.name,fn:n.fn,options:[e,t]}},sc=(e,t)=>{let n=Ws(e);return{name:n.name,fn:n.fn,options:[e,t]}},cc=(e,t)=>{let n=Gs(e);return{name:n.name,fn:n.fn,options:[e,t]}},lc=(e,t)=>{let n=nc(e);return{name:n.name,fn:n.fn,options:[e,t]}},uc=Object.defineProperty,dc=_.forwardRef(((e,t)=>uc(e,`name`,{value:t,configurable:!0}))(function(e,t){let{children:n,width:r=10,height:i=5,...a}=e;return(0,R.jsx)(Ut.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,R.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})},`Arrow`)),fc=Object.defineProperty,pc=(e,t)=>fc(e,`name`,{value:t,configurable:!0}),mc={Partial:`partial`,Always:`always`},hc={Optimized:`optimized`,Always:`always`},gc=`Popper`,[_c,vc]=Qt(gc),[yc,bc]=_c(gc),xc=pc(e=>{let{__scopePopper:t,children:n}=e,[r,i]=_.useState(null),[a,o]=_.useState(void 0);return(0,R.jsx)(yc,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),Sc=`PopperAnchor`,Cc=_.forwardRef(pc(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=bc(Sc,n),o=_.useRef(null),s=a.onAnchorChange,c=yt(t,_.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=_.useRef(null);_.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&Nc(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,R.jsx)(Ut.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),wc=`PopperContent`,[Tc,Ec]=_c(wc),Dc=_.forwardRef(pc(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=mc.Partial,hideWhenDetached:f=!1,updatePositionStrategy:p=hc.Optimized,onPlaced:m,...h}=e,g=bc(wc,n),[v,y]=_.useState(null),b=yt(t,y),[x,S]=_.useState(null),C=Ha(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},ee=Array.isArray(l)?l:[l],te=ee.length>0,O={padding:D,boundary:ee.filter(jc),altBoundary:te},{refs:k,floatingStyles:A,placement:ne,isPositioned:re,middlewareData:j}=tc({strategy:`fixed`,placement:E,whileElementsMounted:pc((...e)=>zs(...e,{animationFrame:p===hc.Always}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[rc({mainAxis:i+T,alignmentAxis:o}),c&&ic({mainAxis:!0,crossAxis:!1,...d===mc.Partial?{limiter:ac()}:{},...O}),c&&oc({...O}),sc({...O,apply:pc(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),x&&lc({element:x,padding:s}),Mc({arrowWidth:w,arrowHeight:T}),f&&cc(te?{strategy:`referenceHidden`,...O}:{strategy:`referenceHidden`,padding:O.padding,altBoundary:O.altBoundary})]}),M=g.setPlacementState;en(()=>(M(ne),()=>{M(void 0)}),[ne,M]);let[ie,ae]=Nc(ne),oe=ir(m);en(()=>{re&&oe?.()},[re,oe]);let se=j.arrow?.x,ce=j.arrow?.y,le=j.arrow?.centerOffset!==0,[ue,de]=_.useState();return en(()=>{v&&de(window.getComputedStyle(v).zIndex)},[v]),(0,R.jsx)(`div`,{ref:k.setFloating,"data-radix-popper-content-wrapper":``,style:{...A,transform:re?A.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ue,"--radix-popper-transform-origin":[j.transformOrigin?.x,j.transformOrigin?.y].join(` `),...j.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,R.jsx)(Tc,{scope:n,placedSide:ie,placedAlign:ae,onArrowChange:S,arrowX:se,arrowY:ce,shouldHideArrow:le,children:(0,R.jsx)(Ut.div,{"data-side":ie,"data-align":ae,...h,ref:b,style:{...h.style,animation:re?h.style?.animation:`none`}})})})},`PopperContent`)),Oc=`PopperArrow`,kc={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Ac=_.forwardRef(pc(function(e,t){let{__scopePopper:n,...r}=e,i=Ec(Oc,n),a=kc[i.placedSide];return(0,R.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,R.jsx)(dc,{...r,ref:t,style:{...r.style,display:`block`}})})},`PopperArrow`));function jc(e){return e!==null}pc(jc,`isNotNull`);var Mc=pc(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Nc(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function Nc(e){let[t,n=`center`]=e.split(`-`);return[t,n]}pc(Nc,`getSideAndAlignFromPlacement`);var Pc=Object.defineProperty,Fc=(e,t)=>Pc(e,`name`,{value:t,configurable:!0}),Ic=!1;function Lc(){let[e,t]=_.useState(Ic);return _.useEffect(()=>{Ic||(Ic=!0,t(!0))},[]),e}Fc(Lc,`useIsHydrated`);var Rc=_.useSyncExternalStore;function zc(){return()=>{}}Fc(zc,`subscribe`);function Bc(){return Rc(zc,()=>!0,()=>!1)}Fc(Bc,`useIsHydratedModern`);var Vc=typeof Rc==`function`?Bc:Lc,Hc=Object.defineProperty,Uc=(e,t)=>Hc(e,`name`,{value:t,configurable:!0}),Wc=`rovingFocusGroup.onEntryFocus`,Gc={bubbles:!1,cancelable:!0},Kc=`RovingFocusGroup`,[qc,Jc,Yc]=rn(Kc),[Xc,Zc]=Qt(Kc,[Yc]),Qc={Vertical:`vertical`,Horizontal:`horizontal`},$c={LTR:`ltr`,RTL:`rtl`},[el,tl]=Xc(Kc),nl=_.forwardRef(Uc(function(e,t){return(0,R.jsx)(qc.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,R.jsx)(qc.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,R.jsx)(rl,{...e,ref:t})})})},`RovingFocusGroup`)),rl=_.forwardRef(Uc(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=_.useRef(null),p=yt(t,f),m=er(a),[h,g]=jn({prop:o,defaultProp:s??null,onChange:c,caller:Kc}),[v,y]=_.useState(!1),b=ir(l),x=Jc(n),S=_.useRef(!1),[C,w]=_.useState(0);return _.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Wc,b),()=>e.removeEventListener(Wc,b)},[b]),(0,R.jsx)(el,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:_.useCallback(e=>g(e),[g]),onItemShiftTab:_.useCallback(()=>y(!0),[]),onFocusableItemAdd:_.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:_.useCallback(()=>w(e=>e-1),[]),children:(0,R.jsx)(Ut.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:z(e.onMouseDown,()=>{S.current=!0}),onFocus:z(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(Wc,Gc);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);ll([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:z(e.onBlur,()=>y(!1))})})},`RovingFocusGroupImpl`)),il=`RovingFocusGroupItem`,al=_.forwardRef(Uc(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Yn(),l=a||c,u=tl(il,n),d=u.currentTabStopId===l,f=Jc(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,g=Vc();return en(()=>{if(g&&r)return p(),()=>m()},[g,r,p,m]),_.useEffect(()=>{if(!g&&r)return p(),()=>m()},[g,r,p,m]),(0,R.jsx)(qc.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,R.jsx)(Ut.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:z(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:z(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:z(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=cl(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?ul(n,r+1):n.slice(r+1)}setTimeout(()=>ll(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})},`RovingFocusGroupItem`)),ol={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function sl(e,t){return t===$c.RTL?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}Uc(sl,`getDirectionAwareKey`);function cl(e,t,n){let r=sl(e.key,n);if(!(t===Qc.Vertical&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===Qc.Horizontal&&[`ArrowUp`,`ArrowDown`].includes(r)))return ol[r]}Uc(cl,`getFocusIntent`);function ll(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}Uc(ll,`focusFirst`);function ul(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Uc(ul,`wrapArray`);var dl=Object.defineProperty,H=(e,t)=>dl(e,`name`,{value:t,configurable:!0}),fl={LTR:`ltr`,RTL:`rtl`},pl=[`Enter`,` `],ml=[`ArrowDown`,`PageUp`,`Home`],hl=[`ArrowUp`,`PageDown`,`End`],gl=[...ml,...hl],_l={ltr:[...pl,`ArrowRight`],rtl:[...pl,`ArrowLeft`]},vl={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},yl=`Menu`,[bl,xl,Sl]=rn(yl),[Cl,wl]=Qt(yl,[Sl,vc,Zc]),Tl=vc(),El=Zc(),[Dl,Ol]=Cl(yl),[kl,Al]=Cl(yl),jl=H(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Tl(t),[c,l]=_.useState(null),u=_.useRef(!1),d=ir(a),f=er(i);return _.useEffect(()=>{let e=H(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=H(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),_.useEffect(()=>{if(!n)return;let e=H(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,R.jsx)(xc,{...s,children:(0,R.jsx)(Dl,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,R.jsx)(kl,{scope:t,onClose:_.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),Ml=_.forwardRef(H(function(e,t){let{__scopeMenu:n,...r}=e,i=Tl(n);return(0,R.jsx)(Cc,{...i,...r,ref:t})},`MenuAnchor`)),Nl=`MenuPortal`,[Pl,Fl]=Cl(Nl,{forceMount:void 0}),Il=H(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Ol(Nl,t);return(0,R.jsx)(Pl,{scope:t,forceMount:n,children:(0,R.jsx)(zn,{present:n||a.open,children:(0,R.jsx)(Vr,{asChild:!0,container:i,children:r})})})},`MenuPortal`),Ll=`MenuContent`,[Rl,zl]=Cl(Ll),Bl=_.forwardRef(H(function(e,t){let n=Fl(Ll,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Ol(Ll,e.__scopeMenu),o=Al(Ll,e.__scopeMenu);return(0,R.jsx)(bl.Provider,{scope:e.__scopeMenu,children:(0,R.jsx)(zn,{present:r||a.open,children:(0,R.jsx)(bl.Slot,{scope:e.__scopeMenu,children:o.modal?(0,R.jsx)(Vl,{...i,ref:t}):(0,R.jsx)(Hl,{...i,ref:t})})})})},`MenuContent`)),Vl=_.forwardRef(H(function(e,t){let n=Ol(Ll,e.__scopeMenu),r=_.useRef(null),i=yt(t,r);return _.useEffect(()=>{let e=r.current;if(e)return ua(e)},[]),(0,R.jsx)(Wl,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:z(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),Hl=_.forwardRef(H(function(e,t){let n=Ol(Ll,e.__scopeMenu);return(0,R.jsx)(Wl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),Ul=St(`MenuContent.ScrollLock`),Wl=_.forwardRef(H(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=Ol(Ll,n),v=Al(Ll,n),y=Tl(n),b=El(n),x=xl(n),[S,C]=_.useState(null),w=_.useRef(null),[T,E]=_.useState(null);Or(T);let{nodes:D,registry:ee}=Dr(),te=!!(i||m),O=yt(t,w,g.onContentChange,E),k=_.useRef(0),A=_.useRef(``),ne=_.useRef(0),re=_.useRef(null),j=_.useRef(`right`),M=_.useRef(0),ie=_.useMemo(()=>m?[w,...D.map(e=>({current:e}))]:[],[w,D,m]),ae=m?na:_.Fragment,oe=m?{as:Ul,allowPinchZoom:!0,shards:ie}:void 0,se=H(e=>{let t=A.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=bu(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;function s(e){A.current=e,window.clearTimeout(k.current),e!==``&&(k.current=window.setTimeout(()=>s(``),1e3))}H(s,`updateSearch`),s(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);_.useEffect(()=>()=>window.clearTimeout(k.current),[]),qr();let ce=_.useCallback(e=>j.current===re.current?.side&&Su(e,re.current?.area),[]);return(0,R.jsx)(Rl,{scope:n,searchRef:A,onItemEnter:_.useCallback(e=>{ce(e)&&e.preventDefault()},[ce]),onItemLeave:_.useCallback(e=>{ce(e)||(w.current?.focus(),C(null))},[ce]),onTriggerLeave:_.useCallback(e=>{ce(e)&&e.preventDefault()},[ce]),pointerGraceTimerRef:ne,onPointerGraceIntentChange:_.useCallback(e=>{re.current=e},[]),children:(0,R.jsx)(Er,{registry:te?ee:null,children:(0,R.jsx)(ae,{...oe,children:(0,R.jsx)(wr,{asChild:!0,trapped:i,branches:D,onMountAutoFocus:z(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,R.jsx)(fr,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,R.jsx)(nl,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:z(c,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,R.jsx)(Dc,{role:`menu`,"aria-orientation":`vertical`,"data-state":hu(g.open),"data-radix-menu-content":``,dir:v.dir,...y,...h,ref:O,style:{outline:`none`,...h.style},onKeyDown:z(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&se(e.key));let i=w.current;if(e.target!==i||!gl.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);hl.includes(e.key)&&a.reverse(),vu(a)}),onBlur:z(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(k.current),A.current=``)}),onPointerMove:z(e.onPointerMove,Cu(e=>{let t=e.target,n=M.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>M.current?`right`:`left`;j.current=t,M.current=e.clientX}}))})})})})})})})},`MenuContentImpl`)),Gl=_.forwardRef(H(function(e,t){let{__scopeMenu:n,...r}=e;return(0,R.jsx)(Ut.div,{role:`group`,...r,ref:t})},`MenuGroup`)),Kl=_.forwardRef(H(function(e,t){let{__scopeMenu:n,...r}=e;return(0,R.jsx)(Ut.div,{...r,ref:t})},`MenuLabel`)),ql=`MenuItem`,Jl=`menu.itemSelect`,Yl=_.forwardRef(H(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=_.useRef(null),o=Al(ql,e.__scopeMenu),s=zl(ql,e.__scopeMenu),c=yt(t,a),l=_.useRef(!1),u=H(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Jl,{bubbles:!0,cancelable:!0});e.addEventListener(Jl,e=>r?.(e),{once:!0}),Wt(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,R.jsx)(Xl,{...i,ref:c,disabled:n,onClick:z(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:z(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:z(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&pl.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),Xl=_.forwardRef(H(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=zl(ql,n),s=El(n),c=_.useRef(null),l=yt(t,c),[u,d]=_.useState(!1),[f,p]=_.useState(``);return _.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,R.jsx)(bl.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,R.jsx)(al,{asChild:!0,...s,focusable:!r,children:(0,R.jsx)(Ut.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:z(e.onPointerMove,Cu(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:z(e.onPointerLeave,Cu(e=>o.onItemLeave(e))),onFocus:z(e.onFocus,()=>d(!0)),onBlur:z(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),[Zl,Ql]=Cl(`MenuRadioGroup`,{value:void 0,onValueChange:H(()=>{},`onValueChange`)}),$l=_.forwardRef(H(function(e,t){let{value:n,onValueChange:r,...i}=e,a=ir(r);return(0,R.jsx)(Zl,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,R.jsx)(Gl,{...i,ref:t})})},`MenuRadioGroup`)),eu=`MenuRadioItem`,tu=_.forwardRef(H(function(e,t){let{value:n,...r}=e,i=Ql(eu,e.__scopeMenu),a=n===i.value;return(0,R.jsx)(ru,{scope:e.__scopeMenu,checked:a,children:(0,R.jsx)(Yl,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":_u(a),onSelect:z(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})},`MenuRadioItem`)),nu=`MenuItemIndicator`,[ru,iu]=Cl(nu,{checked:!1}),au=_.forwardRef(H(function(e,t){let{__scopeMenu:n,forceMount:r,...i}=e,a=iu(nu,n);return(0,R.jsx)(zn,{present:r||gu(a.checked)||a.checked===!0,children:(0,R.jsx)(Ut.span,{...i,ref:t,"data-state":_u(a.checked)})})},`MenuItemIndicator`)),ou=_.forwardRef(H(function(e,t){let{__scopeMenu:n,...r}=e;return(0,R.jsx)(Ut.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),su=`MenuSub`,[cu,lu]=Cl(su),uu=H(e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Ol(su,t),o=Tl(t),[s,c]=_.useState(null),[l,u]=_.useState(null),d=ir(i);return _.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,R.jsx)(xc,{...o,children:(0,R.jsx)(Dl,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,R.jsx)(cu,{scope:t,contentId:Yn(),triggerId:Yn(),trigger:s,onTriggerChange:c,children:n})})})},`MenuSub`),du=`MenuSubTrigger`,fu=_.forwardRef(H(function(e,t){let n=Ol(du,e.__scopeMenu),r=Al(du,e.__scopeMenu),i=lu(du,e.__scopeMenu),a=zl(du,e.__scopeMenu),o=_.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=_.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);_.useEffect(()=>u,[u]),_.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]);let d=yt(t,i.onTriggerChange);return(0,R.jsx)(Ml,{asChild:!0,...l,children:(0,R.jsx)(Xl,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?i.contentId:void 0,"data-state":hu(n.open),...e,ref:d,onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:z(e.onPointerMove,Cu(t=>{a.onItemEnter(t),t.defaultPrevented||e.disabled||n.open||o.current||(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:z(e.onPointerLeave,Cu(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:z(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||(a.searchRef.current===``||t.key!==` `)&&_l[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})},`MenuSubTrigger`)),pu=`MenuSubContent`,mu=_.forwardRef(H(function(e,t){let n=Fl(Ll,e.__scopeMenu),{forceMount:r=n.forceMount,align:i=`start`,...a}=e,o=Ol(Ll,e.__scopeMenu),s=Al(Ll,e.__scopeMenu),c=lu(pu,e.__scopeMenu),l=_.useRef(null),u=yt(t,l);return(0,R.jsx)(bl.Provider,{scope:e.__scopeMenu,children:(0,R.jsx)(zn,{present:r||o.open,children:(0,R.jsx)(bl.Slot,{scope:e.__scopeMenu,children:(0,R.jsx)(Wl,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:u,align:i,side:s.dir===fl.RTL?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:z(e.onFocusOutside,e=>{e.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:z(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:z(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=vl[s.dir].includes(e.key);t&&n&&(o.onOpenChange(!1),c.trigger?.focus(),e.preventDefault())})})})})})},`MenuSubContent`));function hu(e){return e?`open`:`closed`}H(hu,`getOpenState`);function gu(e){return e===`indeterminate`}H(gu,`isIndeterminate`);function _u(e){return gu(e)?`indeterminate`:e?`checked`:`unchecked`}H(_u,`getCheckedState`);function vu(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}H(vu,`focusFirst`);function yu(e,t){return e.map((n,r)=>e[(t+r)%e.length])}H(yu,`wrapArray`);function bu(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=yu(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}H(bu,`getNextMatch`);function xu(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}H(xu,`isPointInPolygon`);function Su(e,t){return t?xu({x:e.clientX,y:e.clientY},t):!1}H(Su,`isPointerInGraceArea`);function Cu(e){return t=>t.pointerType===`mouse`?e(t):void 0}H(Cu,`whenMouse`);var wu=Object.defineProperty,Tu=(e,t)=>wu(e,`name`,{value:t,configurable:!0}),Eu=`DropdownMenu`,[Du,Ou]=Qt(Eu,[wl]),ku=wl(),[Au,ju]=Du(Eu),Mu=Tu(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=ku(t),l=_.useRef(null),[u,d]=jn({prop:i,defaultProp:a??!1,onChange:o,caller:Eu});return(0,R.jsx)(Au,{scope:t,triggerId:Yn(),triggerRef:l,contentId:Yn(),open:u,onOpenChange:d,onOpenToggle:_.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,R.jsx)(jl,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),Nu=`DropdownMenuTrigger`,Pu=_.forwardRef(Tu(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=ju(Nu,n),o=ku(n),s=yt(t,a.triggerRef);return(0,R.jsx)(Ml,{asChild:!0,...o,children:(0,R.jsx)(Ut.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:z(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:z(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),Fu=Tu(e=>{let{__scopeDropdownMenu:t,...n}=e,r=ku(t);return(0,R.jsx)(Il,{...r,...n})},`DropdownMenuPortal`),Iu=`DropdownMenuContent`,Lu=_.forwardRef(Tu(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=ju(Iu,n),a=ku(n),o=_.useRef(!1);return(0,R.jsx)(Bl,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:z(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:z(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),Ru=_.forwardRef(Tu(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=ku(n);return(0,R.jsx)(Kl,{...i,...r,ref:t})},`DropdownMenuLabel`)),zu=_.forwardRef(Tu(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=ku(n);return(0,R.jsx)(Yl,{...i,...r,ref:t})},`DropdownMenuItem`)),Bu=_.forwardRef(Tu(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=ku(n);return(0,R.jsx)($l,{...i,...r,ref:t})},`DropdownMenuRadioGroup`)),Vu=_.forwardRef(Tu(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=ku(n);return(0,R.jsx)(tu,{...i,...r,ref:t})},`DropdownMenuRadioItem`)),Hu=_.forwardRef(Tu(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=ku(n);return(0,R.jsx)(au,{...i,...r,ref:t})},`DropdownMenuItemIndicator`)),Uu=_.forwardRef(Tu(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=ku(n);return(0,R.jsx)(ou,{...i,...r,ref:t})},`DropdownMenuSeparator`)),Wu=Tu(e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=ku(t),[s,c]=jn({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,R.jsx)(uu,{...o,open:s,onOpenChange:c,children:n})},`DropdownMenuSub`),Gu=_.forwardRef(Tu(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=ku(n);return(0,R.jsx)(fu,{...i,...r,ref:t})},`DropdownMenuSubTrigger`)),Ku=_.forwardRef(Tu(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=ku(n);return(0,R.jsx)(mu,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuSubContent`)),qu=Object.defineProperty,Ju=(e,t)=>qu(e,`name`,{value:t,configurable:!0}),Yu=`Popover`,[Xu,Zu]=Qt(Yu,[vc]),Qu=vc(),[$u,ed]=Xu(Yu),td=Ju(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Qu(t),c=_.useRef(null),[l,u]=_.useState(!1),[d,f]=_.useState(0),[p,m]=_.useState(0),[h,g]=jn({prop:r,defaultProp:i??!1,onChange:a,caller:Yu});return(0,R.jsx)(xc,{...s,children:(0,R.jsx)($u,{scope:t,contentId:Yn(),titleId:Yn(),descriptionId:Yn(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,triggerRef:c,open:h,onOpenChange:g,onOpenToggle:_.useCallback(()=>g(e=>!e),[g]),hasCustomAnchor:l,onCustomAnchorAdd:_.useCallback(()=>u(!0),[]),onCustomAnchorRemove:_.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),nd=`PopoverAnchor`,rd=_.forwardRef(Ju(function(e,t){let{__scopePopover:n,...r}=e,i=ed(nd,n),a=Qu(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return _.useEffect(()=>(o(),()=>s()),[o,s]),(0,R.jsx)(Cc,{...a,...r,ref:t})},`PopoverAnchor`)),id=`PopoverTrigger`,ad=_.forwardRef(Ju(function(e,t){let{__scopePopover:n,...r}=e,i=ed(id,n),a=Qu(n),o=yt(t,i.triggerRef),s=(0,R.jsx)(Ut.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":gd(i.open),...r,ref:o,onClick:z(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,R.jsx)(Cc,{asChild:!0,...a,children:s})},`PopoverTrigger`)),od=`PopoverPortal`,[sd,cd]=Xu(od,{forceMount:void 0}),ld=Ju(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=ed(od,t);return(0,R.jsx)(sd,{scope:t,forceMount:n,children:(0,R.jsx)(zn,{present:n||a.open,children:(0,R.jsx)(Vr,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),ud=`PopoverContent`,dd=_.forwardRef(Ju(function(e,t){let n=cd(ud,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=ed(ud,e.__scopePopover);return(0,R.jsx)(zn,{present:r||a.open,children:a.modal?(0,R.jsx)(pd,{...i,ref:t}):(0,R.jsx)(md,{...i,ref:t})})},`PopoverContent`)),fd=St(`PopoverContent.RemoveScroll`),pd=_.forwardRef(Ju(function(e,t){let n=ed(ud,e.__scopePopover),r=_.useRef(null),i=yt(t,r),a=_.useRef(!1),{nodes:o,registry:s}=Dr();return _.useEffect(()=>{let e=r.current;if(e)return ua(e)},[]),(0,R.jsx)(na,{as:fd,allowPinchZoom:!0,shards:_.useMemo(()=>[r,...o.map(e=>({current:e}))],[r,o]),children:(0,R.jsx)(hd,{...e,ref:i,branchNodes:o,branchRegistry:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:z(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:z(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:z(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),md=_.forwardRef(Ju(function(e,t){let n=ed(ud,e.__scopePopover),r=_.useRef(!1),i=_.useRef(!1);return(0,R.jsx)(hd,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),hd=_.forwardRef(Ju(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,"aria-describedby":d,branchNodes:f,branchRegistry:p,...m}=e,h=ed(ud,n),g=Qu(n),[v,y]=_.useState(null),b=yt(t,y);return Or(v),qr(),(0,R.jsx)(Er,{registry:p,children:(0,R.jsx)(wr,{asChild:!0,loop:!0,trapped:r,branches:f,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,R.jsx)(fr,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>h.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,R.jsx)(Dc,{"data-state":gd(h.open),role:`dialog`,id:h.contentId,"aria-labelledby":h.titlePresent?h.titleId:void 0,"aria-describedby":h.descriptionPresent?_d(d,h.descriptionId):d,...g,...m,ref:b,style:{...m.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})})},`PopoverContentImpl`));function gd(e){return e?`open`:`closed`}Ju(gd,`getState`);function _d(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}Ju(_d,`concatAriaDescribedby`);var vd=Object.defineProperty,yd=(e,t)=>vd(e,`name`,{value:t,configurable:!0}),[bd,xd]=Qt(`Tooltip`,[vc]),Sd=vc(),Cd=`TooltipProvider`,wd=700,Td=`tooltip.open`,[Ed,Dd]=bd(Cd),Od=yd(e=>{let{__scopeTooltip:t,delayDuration:n=wd,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=_.useRef(!0),s=_.useRef(!1),c=_.useRef(0);return _.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,R.jsx)(Ed,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:_.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:_.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:_.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})},`TooltipProvider`),kd=`Tooltip`,[Ad,jd]=bd(kd),Md=yd(e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Dd(kd,e.__scopeTooltip),l=Sd(t),[u,d]=_.useState(null),[f,p]=_.useState(void 0),m=Yn(),h=_.useRef(0),g=o??c.disableHoverableContent,v=s??c.delayDuration,y=_.useRef(!1),[b,x]=jn({prop:r,defaultProp:i??!1,onChange:yd(e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Td))):c.onClose(),a?.(e)},`onChange`),caller:kd}),S=_.useMemo(()=>b?y.current?`delayed-open`:`instant-open`:`closed`,[b]),C=_.useCallback(()=>{window.clearTimeout(h.current),h.current=0,y.current=!1,x(!0)},[x]),w=_.useCallback(()=>{window.clearTimeout(h.current),h.current=0,x(!1)},[x]),T=_.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{y.current=!0,x(!0),h.current=0},v)},[v,x]);_.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]);let E=f??m;return(0,R.jsx)(xc,{...l,children:(0,R.jsx)(Ad,{scope:t,contentId:E,setContentId:p,open:b,stateAttribute:S,trigger:u,onTriggerChange:d,onTriggerEnter:_.useCallback(()=>{c.isOpenDelayedRef.current?T():C()},[c.isOpenDelayedRef,T,C]),onTriggerLeave:_.useCallback(()=>{g?w():(window.clearTimeout(h.current),h.current=0)},[w,g]),onOpen:C,onClose:w,disableHoverableContent:g,children:n})})},`Tooltip`),Nd=`TooltipTrigger`,Pd=_.forwardRef(yd(function(e,t){let{__scopeTooltip:n,"aria-describedby":r,...i}=e,a=jd(Nd,n),o=Dd(Nd,n),s=Sd(n),c=yt(t,_.useRef(null),a.onTriggerChange),l=_.useRef(!1),u=_.useRef(!1),d=_.useCallback(()=>l.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener(`pointerup`,d),[d]),(0,R.jsx)(Cc,{asChild:!0,...s,children:(0,R.jsx)(Ut.button,{"aria-describedby":a.open?Zd(r,a.contentId):r,"data-state":a.stateAttribute,...i,ref:c,onPointerMove:z(e.onPointerMove,e=>{e.pointerType!==`touch`&&!u.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),u.current=!0)}),onPointerLeave:z(e.onPointerLeave,()=>{a.onTriggerLeave(),u.current=!1}),onPointerDown:z(e.onPointerDown,()=>{a.open&&a.onClose(),l.current=!0,document.addEventListener(`pointerup`,d,{once:!0})}),onFocus:z(e.onFocus,()=>{l.current||a.onOpen()}),onBlur:z(e.onBlur,a.onClose),onClick:z(e.onClick,a.onClose)})})},`TooltipTrigger`)),Fd=`TooltipPortal`,[Id,Ld]=bd(Fd,{forceMount:void 0}),Rd=yd(e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=jd(Fd,t);return(0,R.jsx)(Id,{scope:t,forceMount:n,children:(0,R.jsx)(zn,{present:n||a.open,children:(0,R.jsx)(Vr,{asChild:!0,container:i,children:r})})})},`TooltipPortal`),zd=`TooltipContent`,Bd=_.forwardRef(yd(function(e,t){let n=Ld(zd,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=jd(zd,e.__scopeTooltip);return(0,R.jsx)(zn,{present:r||o.open,children:o.disableHoverableContent?(0,R.jsx)(Ud,{side:i,...a,ref:t}):(0,R.jsx)(Vd,{side:i,...a,ref:t})})},`TooltipContent`)),Vd=_.forwardRef(yd(function(e,t){let n=jd(zd,e.__scopeTooltip),r=Dd(zd,e.__scopeTooltip),i=_.useRef(null),a=yt(t,i),[o,s]=_.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=_.useCallback(()=>{s(null),d(!1)},[d]),p=_.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Kd(r,Gd(r,n.getBoundingClientRect())),a=qd(t.getBoundingClientRect()),o=Yd([...i,...a]);s(o),d(!0)},[d]);return _.useEffect(()=>()=>f(),[f]),_.useEffect(()=>{if(c&&u){let e=yd(e=>p(e,u),`handleTriggerLeave`),t=yd(e=>p(e,c),`handleContentLeave`);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),_.useEffect(()=>{if(o){let e=yd(e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Jd(n,o);r?f():i&&(f(),l())},`handleTrackPointerGrace`);return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,R.jsx)(Ud,{...e,ref:a})},`TooltipContentHoverable`)),Hd=Tt(`TooltipContent`),Ud=_.forwardRef(yd(function(e,t){let{__scopeTooltip:n,children:r,"aria-label":i,id:a,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=e,l=jd(zd,n),u=Sd(n),{onClose:d}=l,[f,p]=_.useState(null),m=yt(t,p);Or(f),_.useEffect(()=>(document.addEventListener(Td,d),()=>document.removeEventListener(Td,d)),[d]),_.useEffect(()=>{if(l.trigger){let e=yd(e=>{e.target instanceof Node&&e.target.contains(l.trigger)&&d()},`handleScroll`);return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[l.trigger,d]);let{setContentId:h}=l;return en(()=>(h(a),()=>{h(void 0)}),[a,h]),(0,R.jsx)(fr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,R.jsxs)(Dc,{"data-state":l.stateAttribute,role:i?void 0:`tooltip`,id:i?void 0:l.contentId,...u,...c,ref:m,style:{...c.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,R.jsx)(Hd,{children:r}),i?(0,R.jsx)(Jt,{id:l.contentId,role:`tooltip`,children:i}):null]})})},`TooltipContentImpl`)),Wd=_.forwardRef(yd(function(e,t){let{__scopeTooltip:n,...r}=e,i=Sd(n);return(0,R.jsx)(Ac,{...i,...r,ref:t})},`TooltipArrow`));function Gd(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}yd(Gd,`getExitSideFromRect`);function Kd(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return r}yd(Kd,`getPaddedExitPoints`);function qd(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}yd(qd,`getPointsFromRect`);function Jd(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}yd(Jd,`isPointInPolygon`);function Yd(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Xd(t)}yd(Yd,`getHull`);function Xd(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}yd(Xd,`getHullPresorted`);function Zd(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}yd(Zd,`concatAriaDescribedby`);var Qd=C(`inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,destructive:`bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40`,outline:`border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 px-4 py-2 has-[>svg]:px-3`,xs:`h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5`,lg:`h-10 rounded-md px-6 has-[>svg]:px-4`,icon:`size-9`,"icon-xs":`size-6 rounded-md [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-8`,"icon-lg":`size-10`}},defaultVariants:{variant:`default`,size:`default`}});function $d({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){let a=r?Ct:`button`;return(0,R.jsx)(a,{"data-slot":`button`,"data-variant":t,"data-size":n,className:L(Qd({variant:t,size:n,className:e})),...i})}function ef({title:e,children:t,action:n,alert:r,extra:i}){let a=(0,_.useRef)(null);return(0,_.useEffect)(()=>{r&&a.current?.focus()},[r]),(0,R.jsxs)(`div`,{role:r?`alert`:void 0,className:`mx-auto mt-[16vh] grid max-w-lg justify-items-start gap-4 px-6`,children:[(0,R.jsx)(`h1`,{ref:a,tabIndex:r?-1:void 0,className:`font-display text-3xl font-extrabold tracking-tight [font-stretch:108%] text-balance outline-none`,children:e}),(0,R.jsx)(`p`,{className:`text-muted-foreground`,children:t}),n&&(0,R.jsx)($d,{className:`[@media(pointer:coarse)]:min-h-11`,onClick:n.onClick,children:n.label}),i]})}function tf(){return(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 px-1`,role:`img`,"aria-label":`Explicaí Studio`,children:[(0,R.jsx)(`img`,{src:`/favicon.svg`,alt:``,width:`26`,height:`26`}),(0,R.jsxs)(`span`,{className:`wordmark whitespace-nowrap text-[21px]`,"aria-hidden":`true`,children:[`explica`,(0,R.jsx)(`span`,{className:`i`,children:`ı`})]}),(0,R.jsx)(`span`,{className:`hidden font-mono text-xs text-muted-foreground lg:inline`,"aria-hidden":`true`,children:`studio`})]})}var nf={"Nenhuma imagem sem uso.":`No unused images.`,"Imagens que nenhuma página usa, contando versões e lixeira, vão para a lixeira.":`Images that no page uses, counting versions and trash, go to the trash.`,Recortar:`Crop`,"Recortar imagem":`Crop image`,"Ferramenta Recortar":`Crop tool`,"Arraste sobre a parte da imagem que deve ficar":`Drag over the part of the image to keep`,"Arraste sobre a parte que deve ficar.":`Drag over the part to keep.`,"Para ajustar o retângulo, use Selecionar (V). Depois aplique.":`To adjust the rectangle, use Select (V). Then apply.`,"Aplicar recorte":`Apply crop`,"Recortar a imagem?":`Crop the image?`,"Recortando…":`Cropping…`,"Recortar e apagar o original":`Crop and delete the original`,"Isto troca o print pela parte recortada. O original será apagado e não dá para voltar.":`This replaces the screenshot with the cropped part. The original is deleted and cannot be restored.`,"{n} marcação será removida":`{n} annotation will be removed`,"{n} marcações serão removidas":`{n} annotations will be removed`,"{n} marcador":`{n} marker`,"{n} marcadores":`{n} markers`,"{n} destaque":`{n} highlight`,"{n} destaques":`{n} highlights`,"{n} seta":`{n} arrow`,"{n} setas":`{n} arrows`,"{n} área clicável":`{n} clickable area`,"{n} áreas clicáveis":`{n} clickable areas`,"Não dá para recortar SVG ou GIF. Use um print em PNG, JPEG ou WebP.":`SVG and GIF cannot be cropped. Use a PNG, JPEG or WebP screenshot.`,"Aplique ou descarte as áreas a ocultar antes de recortar.":`Apply or discard the areas to hide before cropping.`,"O recorte cobre a imagem inteira. Reduza o retângulo.":`The crop covers the whole image. Make the rectangle smaller.`,"A imagem foi recortada, mas as marcações não foram gravadas. Salve de novo.":`The image was cropped, but the annotations were not saved. Save again.`,"Não foi possível recortar. A imagem não foi alterada.":`Could not crop. The image was not changed.`,"Reduzir imagem":`Reduce image`,Reduzir:`Reduce`,Atual:`Current`,Depois:`After`,"Largura (px)":`Width (px)`,Qualidade:`Quality`,"A largura precisa ser menor que a atual. Nunca amplia.":`The width must be smaller than the current one. It never enlarges.`,"Aplique ou descarte o que está pendente antes de reduzir.":`Apply or discard what is pending before reducing.`,"Reduzir a imagem?":`Reduce the image?`,"Reduzindo…":`Reducing…`,"Reduzir e apagar o original":`Reduce and delete the original`,"Isto troca o print por uma versão com menos pixels. O original será apagado e não dá para voltar. As marcações continuam no mesmo lugar.":`This replaces the screenshot with a version with fewer pixels. The original is deleted and cannot be restored. Annotations stay in place.`,"Não foi possível reduzir. A imagem não foi alterada.":`Could not reduce. The image was not changed.`,Ocultar:`Hide`,"Ocultar dados":`Hide sensitive data`,"Ferramenta Ocultar":`Hide tool`,"Arraste sobre o dado que deve sumir":`Drag over the data that must disappear`,"Arraste sobre o dado que deve sumir.":`Drag over the data that must disappear.`,"{n} área a ocultar":`{n} area to hide`,"{n} áreas a ocultar":`{n} areas to hide`,"Aplicar ocultação":`Apply hiding`,Descartar:`Discard`,Estilo:`Style`,Tarja:`Bar`,Desfoque:`Blur`,"Para senha, CPF e números, prefira a tarja.":`For passwords, ID numbers and digits, prefer the bar.`,"Ocultando…":`Hiding…`,"Ocultar e apagar o original":`Hide and delete the original`,"Ocultar as áreas marcadas?":`Hide the marked areas?`,"Isto troca o print por uma versão com as áreas cobertas. O original será apagado e não dá para voltar.":`This replaces the screenshot with a version that has the areas covered. The original will be deleted and this cannot be undone.`,"Esta pasta está no git: o print original continua no histórico depois de ocultar.":`This folder is in git: the original screenshot stays in the history after hiding.`,"Esta pasta está no git: o original continua no histórico, e limpar o histórico é com você.":`This folder is in git: the original stays in the history, and cleaning the history is up to you.`,"Exportações anteriores ainda têm o original. Exporte de novo e apague os arquivos antigos.":`Earlier exports still contain the original. Export again and delete the old files.`,"Não dá para ocultar dados em SVG ou GIF. Use um print em PNG, JPEG ou WebP.":`Hiding data does not work on SVG or GIF. Use a PNG, JPEG or WebP screenshot.`,"Não foi possível ocultar as áreas. A imagem não foi alterada.":`Could not hide the areas. The image was not changed.`,"Sair sem ocultar?":`Leave without hiding?`,"Sair e descartar":`Leave and discard`,"Continuar editando":`Keep editing`,"As áreas a ocultar ainda não foram aplicadas. Se você sair, elas se perdem e o print continua com os dados à mostra.":`The areas to hide have not been applied yet. If you leave, they are lost and the screenshot still shows the data.`,'"{nome}" e {n} subpágina foram para a lixeira.':`"{nome}" and {n} subpage went to the trash.`,'"{nome}" e {n} subpáginas foram para a lixeira.':`"{nome}" and {n} subpages went to the trash.`,'"{nome}" foi para a lixeira.':`"{nome}" went to the trash.`,"{n} arquivo foi para {pasta}.":`{n} file went to {pasta}.`,"{n} arquivos foram para {pasta}.":`{n} files went to {pasta}.`,"As marcações de {file} estão com erro de sintaxe. Corrija ou apague o arquivo.":`The markup in {file} has a syntax error. Fix or delete the file.`,"Nenhuma página está aprovada ou publicada. Aprove uma página ou exporte todas.":`No page is approved or published. Approve a page or export them all.`,"A cor de {label} tem contraste {ratio}:1 com o branco; o mínimo é {min}:1. Escolha uma cor mais escura.":`The {label} color has a contrast of {ratio}:1 with white; the minimum is {min}:1. Choose a darker color.`,"O texto sobre o realce tem contraste {ratio}:1; o mínimo é {min}:1. Escolha um realce mais claro.":`Text over the highlight has a contrast of {ratio}:1; the minimum is {min}:1. Choose a lighter highlight.`,destaque:`accent`,texto:`text`,"título da capa":`cover title`,"título da página":`page title`,"título de nível 1":`level 1 heading`,"título de nível 2":`level 2 heading`,"título de nível 3":`level 3 heading`,"Nenhuma página está aprovada ou publicada. Aprove uma página para usar esta opção.":`No page is approved or published. Approve a page to use this option.`,"{n} página aprovada ou publicada neste manual. As outras ficam de fora.":`{n} approved or published page in this manual. The others are left out.`,"{n} página":`{n} page`,"{n} páginas":`{n} pages`,"Abrir o PDF":`Open the PDF`,"Abrir o arquivo":`Open the file`,Fechar:`Close`,"{n} páginas aprovadas ou publicadas neste manual. As outras ficam de fora.":`{n} approved or published pages in this manual. The others are left out.`,"3 × 3 com cabeçalho":`3 × 3 with header`,aberta:`open`,"Abra um manual para exportar.":`Open a manual to export.`,"Abrir o menu da página":`Open the page menu`,"Adicionar coluna":`Add column`,"Adicionar linha":`Add row`,"agora há pouco":`just now`,"Ainda sendo escrita":`Still being written`,Ajustes:`Settings`,"Algo deu errado.":`Something went wrong.`,Ameixa:`Plum`,"Andar entre as páginas da árvore":`Move between pages in the tree`,"Antes de restaurar":`Before restoring`,Aparência:`Appearance`,Aplicar:`Apply`,Aprovado:`Approved`,"Área clicável":`Clickable area`,"Áreas clicáveis":`Clickable areas`,"Arraste do início até a ponta da seta":`Drag from the start to the tip of the arrow`,"Arraste sobre a área que leva a outra página":`Drag over the area that leads to another page`,"Arraste sobre o que merece atenção":`Drag over what deserves attention`,"As páginas excluídas ficam na pasta .lixeira do manual até você restaurar ou apagar.":`Deleted pages stay in the manual's .lixeira folder until you restore or delete them.`,Atalhos:`Shortcuts`,"Atalhos de teclado":`Keyboard shortcuts`,"Bloco de código":`Code block`,"Buscar página":`Find page`,"Buscar página pelo título":`Find page by title`,"Buscar página pelo título…":`Find page by title…`,"Cada manual vira uma pasta com uma página em Markdown para cada tela ou tarefa. Dá para versionar no git junto com o código.":`Each manual becomes a folder with one Markdown page per screen or task. You can version it in git next to the code.`,'Cada página entra com a "Versão do manual" ou, sem ela, com o texto atual.':`Each page goes in with the "Manual version" or, without one, with the current text.`,"Caminho da página":`Page path`,Cancelar:`Cancel`,"Carregando as marcações…":`Loading markups…`,"Carregando…":`Loading…`,Citação:`Quote`,Claro:`Light`,"Clique numa marcação para selecionar e arraste para mover; Delete exclui":`Click a markup to select it and drag to move it; Delete removes it`,"Clique onde o número deve ficar":`Click where the number should go`,Cobalto:`Cobalt`,"Código no texto":`Inline code`,"Comandos e trechos de código":`Commands and code snippets`,"Conferida, pode ir para o manual":`Checked, can go into the manual`,"Conteúdo da página":`Page content`,"Criar a primeira página":`Create the first page`,"Criar manual":`Create manual`,"Descrição da imagem":`Image description`,Desfazer:`Undo`,Destaque:`Highlight`,"Destaque {n}":`Highlight {n}`,"Destaques e setas":`Highlights and arrows`,"Destino da área {n}":`Target of area {n}`,"Editar link":`Edit link`,"Em revisão":`In review`,"Endereço da área {n}":`Address of area {n}`,"Endereço inválido. Exemplo: https://exemplo.com.br":`Invalid address. Example: https://example.com`,"Endereço na web…":`Web address…`,"Endereço não pode ter espaços. Para ligar a outra página, escolha na lista.":`An address can't have spaces. To link to another page, pick it from the list.`,"Enter no título":`Enter in the title`,"Erro {status}":`Error {status}`,"Escolha um manual":`Choose a manual`,"Escolha uma ferramenta e clique ou arraste sobre a imagem. Cada marcador numerado ganha uma linha aqui para você escrever o que ele mostra.":`Pick a tool and click or drag over the image. Each numbered marker gets a line here for you to write what it shows.`,"Esconder as páginas ({atalho})":`Hide pages ({atalho})`,"Escreva aqui, ou digite / para inserir um bloco. Cole um print com Ctrl+V.":`Write here, or type / to insert a block. Paste a screenshot with Ctrl+V.`,Escrevendo:`Writing`,Escuro:`Dark`,Esmeralda:`Emerald`,"Esta versão não tem texto.":`This version has no text.`,"Etapa da página":`Page stage`,"Ex.: Manual do Financeiro":`E.g.: Billing manual`,"Ex.: Tela de clientes com o botão Novo cliente":`E.g.: Customers screen with the New customer button`,"excluída {quando}":`deleted {quando}`,"Excluir {nome}":`Delete {nome}`,"Excluir a marcação selecionada":`Delete the selected markup`,"Excluir área {n}":`Delete area {n}`,"Excluir marcador {n}":`Delete marker {n}`,"Excluir página":`Delete page`,"Excluir página e {n} subpágina":`Delete page and {n} subpage`,"Excluir página e {n} subpáginas":`Delete page and {n} subpages`,"Exportando…":`Exporting…`,"Gerando PDF…":`Generating PDF…`,"Pode levar alguns segundos.":`This can take a few seconds.`,"{formato} exportado":`{formato} exported`,"Arquivo, dentro da pasta do manual":`File, inside the manual folder`,"Atenção: {n} aviso":`Warning: {n} notice`,"Atenção: {n} avisos":`Warning: {n} notices`,"Copiar caminho":`Copy path`,"Caminho copiado":`Path copied`,Exportar:`Export`,"Exportar manual":`Export manual`,"Falta o domínio, por exemplo: exemplo.com.br":`The domain is missing, for example: example.com`,"Ferramentas de marcação":`Markup tools`,"Ferramenta Selecionar":`Select tool`,"Ferramenta Marcador":`Marker tool`,"Ferramenta Destaque":`Highlight tool`,"Ferramenta Seta":`Arrow tool`,"Ferramenta Área clicável":`Clickable area tool`,"Ficou de fora: {motivo}":`Left out: {motivo}`,Formatação:`Formatting`,Formato:`Format`,Grafite:`Graphite`,"Guardar versão":`Save version`,'Guarde o texto como está agora para voltar a ele depois. A "Versão do manual" é a que vai para o manual final. Sem ela, vale o texto atual.':`Save the text as it is now to come back to it later. The "Manual version" is the one that goes into the final manual. Without one, the current text is used.`,Idioma:`Language`,"Idioma da interface":`Interface language`,"Muda só o Studio, neste navegador.":`Changes only the Studio, in this browser.`,Imagem:`Image`,"Colar print":`Paste screenshot`,"Inserir bloco":`Insert block`,"Inserir bloco: título, passos, imagem, tabela…":`Insert block: heading, steps, image, table…`,"Ir para o texto da página":`Go to the page text`,Itálico:`Italic`,"Itens sem ordem":`Unordered items`,"Já está no manual entregue":`Already in the delivered manual`,Legenda:`Legend`,"Legenda da imagem":`Image legend`,"Sem descrição":`No description`,Link:`Link`,"Link para outra página ou endereço":`Link to another page or address`,"Link para uma página ou endereço":`Link to a page or address`,Lista:`List`,Lixeira:`Trash`,"Lixeira deste manual":`Trash for this manual`,"Mais ações para {nome}":`More actions for {nome}`,Manual:`Manual`,"Manuais nesta pasta":`Manuals in this folder`,Marcador:`Marker`,"Marcando imagens":`Marking up images`,"Editar imagem":`Edit image`,"Tamanho da imagem":`Image size`,"Não foi possível salvar o tamanho.":`Could not save the size.`,Pequena:`Small`,Média:`Medium`,Larga:`Wide`,"Com {n} marcadores, a imagem pequena pode amontoá-los. Experimente Média.":`With {n} markers, a small image may crowd them. Try Medium.`,"Markdown para IA":`Markdown for AI`,"Mostrar as páginas ({atalho})":`Show pages ({atalho})`,"Mostrar ou esconder as páginas":`Show or hide pages`,Mover:`Move`,"Mover a página para cima ou para baixo":`Move the page up or down`,"Mover para a lixeira":`Move to trash`,"Muda só o Studio, neste navegador. A cor do manual fica em Exportar manual.":`Only changes the Studio, in this browser. The manual color is in Export manual.`,"Não foi possível abrir o Studio.":`Could not open the Studio.`,"Não foi possível enviar a imagem.":`Could not upload the image.`,"Não foi possível exportar o manual.":`Could not export the manual.`,"Não foi possível salvar as marcações.":`Could not save the markups.`,"Não foi possível salvar. O texto continua na tela.":`Could not save. Your text is still on screen.`,"Aguardando sua escolha":`Waiting for your choice`,Negrito:`Bold`,"Nenhum bloco com esse nome.":`No block with that name.`,"Nenhuma página ainda.":`No pages yet.`,"Nenhuma página com esse título.":`No page with that title.`,"Nenhuma página excluída.":`No deleted pages.`,"Há alterações sem salvar. Salve antes de limpar as imagens.":`There are unsaved changes. Save before cleaning up images.`,"Nenhuma versão guardada ainda.":`No saved versions yet.`,"Nesta página":`On this page`,"No Mac, use Cmd no lugar de Ctrl.":`On a Mac, use Cmd instead of Ctrl.`,"Nome da página ou https://…":`Page name or https://…`,"Nome da versão (opcional)":`Version name (optional)`,"Nome da versão (opcional), ex.: Revisada pelo suporte":`Version name (optional), e.g.: Reviewed by support`,"Nome do manual":`Manual name`,"Nova página":`New page`,"Nova subpágina":`New subpage`,"Nova subpágina em {nome}":`New subpage in {nome}`,"Novo manual":`New manual`,"O manual final usa a Versão do manual desta página. O que você escrever aqui só entra nele quando você voltar para o texto atual.":`The final manual uses this page's Manual version. What you write here only goes into it when you switch back to the current text.`,"O que a pessoa vê depois do passo":`What the person sees after the step`,"O que este marcador mostra?":`What does this marker show?`,"O que o marcador {n} mostra":`What marker {n} shows`,"Página: {titulo}":`Page: {titulo}`,Páginas:`Pages`,"Páginas do manual":`Manual pages`,"Páginas encontradas":`Pages found`,"Para baixo":`Down`,"Para cima":`Up`,"Para dentro da anterior":`Into the previous one`,"Para fora":`Out one level`,"Para imprimir ou mandar por e-mail.":`To print or send by email.`,"Parágrafo comum":`Plain paragraph`,"Passos numerados":`Numbered steps`,"Print da tela do sistema":`Screenshot of the system`,"Pronta para alguém conferir":`Ready for someone to check`,Publicado:`Published`,"Qual sistema você vai explicar?":`Which system are you going to explain?`,"Quem usa leitor de tela e a IA que lê o manual entendem a imagem por aqui.":`Screen reader users and the AI reading the manual understand the image through this.`,Rascunho:`Draft`,"Remover link":`Remove link`,"Remover tabela":`Remove table`,"Inserir linha acima":`Insert row above`,"Inserir linha abaixo":`Insert row below`,"Linha de cabeçalho":`Header row`,"Remover linha":`Remove row`,"Inserir coluna à esquerda":`Insert column to the left`,"Inserir coluna à direita":`Insert column to the right`,"Remover coluna":`Remove column`,"Opções da linha":`Row options`,"Opções da coluna":`Column options`,"Opções da tabela":`Table options`,"Adicionar coluna à direita":`Add column to the right`,"Adicionar linha abaixo":`Add row below`,Restaurar:`Restore`,"Restaurar esta":`Restore this one`,"Resultado esperado":`Expected result`,"Salvando…":`Saving…`,"Salvar marcações":`Save markups`,"Salvo às {hora}":`Saved at {hora}`,"Seção principal":`Main section`,Selecionar:`Select`,"sem nome":`unnamed`,"Sem título":`Untitled`,Seta:`Arrow`,"Seta {n}":`Arrow {n}`,Sistema:`System`,"Site (HTML)":`Website (HTML)`,"Só páginas aprovadas":`Approved pages only`,"Status da página: {status}":`Page status: {status}`,Subseção:`Subsection`,Tabela:`Table`,Tema:`Theme`,"Tentar de novo":`Try again`,"Esta página foi alterada fora do Studio depois que você a abriu. Recarregue do disco ou mantenha a sua versão.":`This page was changed outside Studio after you opened it. Reload it from disk or keep your version.`,"Esta página mudou fora do Studio.":`This page changed outside Studio.`,"Manter a minha versão grava o seu texto por cima do arquivo. Recarregar do disco descarta o que você escreveu aqui.":`Keep my version writes your text over the file. Reload from disk discards what you wrote here.`,"Recarregar do disco":`Reload from disk`,"Manter a minha versão":`Keep my version`,Texto:`Text`,"Texto da versão {nome}":`Text of version {nome}`,"Tipo de bloco: {tipo}":`Block type: {tipo}`,"Fonte do manual: {fonte}":`Manual font: {fonte}`,"Fonte do manual inteiro":`Font for the whole manual`,"Tipo de alerta: {tipo}":`Alert type: {tipo}`,Estrutura:`Structure`,"Passo a passo":`Step by step`,Alertas:`Alerts`,Mídia:`Media`,"Alerta: Dica":`Alert: Tip`,"Alerta: Atenção":`Alert: Warning`,"Alerta: Erro":`Alert: Error`,"Alerta: Nota":`Alert: Note`,"Um atalho ou um jeito melhor de fazer":`A shortcut or a better way to do it`,"Algo que exige cuidado":`Something that needs care`,"Um risco que não dá para desfazer":`A risk that cannot be undone`,"Uma informação a mais":`Extra information`,"Tirar do manual":`Remove from manual`,"Título {n}":`Heading {n}`,"Título da página":`Page title`,"Título vazio":`Empty heading`,"Tópico dentro da subseção":`Topic inside the subsection`,"Trecho em destaque ou observação":`Highlighted passage or note`,"Tudo salvo no disco":`All saved to disk`,"Um arquivo para publicar ou abrir no navegador.":`One file to publish or open in the browser.`,"Um arquivo só, com a legenda dos prints em texto.":`A single file, with screenshot legends as text.`,"Um passo por linha, na ordem de uso":`One step per line, in the order of use`,"Uma página por tela ou tarefa do sistema funciona bem. Comece pela que as pessoas mais usam.":`One page per screen or task works well. Start with the one people use most.`,"Usar no manual":`Use in manual`,"Usar o texto atual":`Use the current text`,"Use um endereço http, https ou mailto.":`Use an http, https or mailto address.`,Ver:`View`,"Versão do manual":`Manual version`,"Versão guardada.":`Version saved.`,'Versão restaurada. O texto que estava antes foi guardado como "Antes de restaurar".':`Version restored. The previous text was saved as "Before restoring".`,"Versão sem nome":`Unnamed version`,Versões:`Versions`,"Versões desta página":`Versions of this page`,"Virar subpágina ou subir um nível":`Make it a subpage or move up a level`,"Voltar à lista":`Back to the list`,"Cores do manual":`Manual colors`,"Logo do cliente":`Client logo`,"Aparece na capa e no topo do sumário do HTML e do PDF. PNG, JPG ou SVG, até 1 MB.":`Shown on the cover and at the top of the contents in the HTML and PDF. PNG, JPG or SVG, up to 1 MB.`,"O logo precisa estar na pasta assets/ do manual.":`The logo must be in the manual's assets/ folder.`,"O logo {logo} não está mais no manual. Envie o arquivo de novo.":`The logo {logo} is no longer in the manual. Upload the file again.`,"Enviar logo":`Upload logo`,"Trocar logo":`Replace logo`,"Tirar logo":`Remove logo`,"Logo do manual":`Manual logo`,"Não foi possível enviar o logo.":`Could not upload the logo.`,"O logo precisa ser PNG, JPG ou SVG. Escolha outro arquivo.":`The logo must be PNG, JPG or SVG. Pick another file.`,"O logo passa de {max} MB. Reduza o arquivo e envie de novo.":`The logo is over {max} MB. Shrink the file and upload it again.`,"Cor de realce":`Highlight color`,"Cor de destaque":`Accent color`,"Cor do texto":`Text color`,"Cor padrão":`Default color`,"Formatar seleção":`Format selection`,Azul:`Blue`,Cinza:`Gray`,Laranja:`Orange`,Roxo:`Purple`,Verde:`Green`,Vermelho:`Red`,Padrão:`Default`,"Título da capa":`Cover title`,"Título 1":`Heading 1`,"Título 2":`Heading 2`,"Título 3":`Heading 3`,"Use o formato #2b4fe0.":`Use the format #2b4fe0.`,"Não foi possível salvar a cor.":`Could not save the color.`,"código da cor":`color code`,"Links, números dos passos e marcações dos prints.":`Links, step numbers and markups on screenshots.`,"Capa, “Resultado:” e destaques nas imagens.":`Cover, “Result:” and highlights on images.`,"Texto, títulos e destaque precisam de contraste de 4,5:1 com o branco para a leitura ficar nítida.":`Text, headings and accent need a 4.5:1 contrast with white so reading stays clear.`,"Fonte do texto":`Text font`,"Fonte dos títulos":`Heading font`,padrão:`default`,"A conexão com o Studio voltou.":`The connection to the Studio is back.`,"Não foi possível abrir este manual":`Could not open this manual`,"Criar um manual novo":`Create a new manual`,"Abrir {nome}":`Open {nome}`,"Abrir a primeira página":`Open the first page`,"Abrindo o Studio…":`Opening the Studio…`,"Não foi possível abrir o Studio":`Could not open the Studio`,"O Studio encontrou um erro que não esperava. O texto que já foi salvo continua no disco. Recarregue para continuar; se o erro voltar, copie o código abaixo e conte para quem mantém o projeto.":`The Studio hit an error it did not expect. Text that was already saved is still on disk. Reload to continue; if the error comes back, copy the code below and tell whoever maintains the project.`,"Tentar de novo sem recarregar":`Try again without reloading`,"Recarregar o Studio":`Reload the Studio`,"Algo quebrou *nesta tela*":`Something broke *on this screen*`,"O link pode estar antigo, ou a página foi excluída ou movida para outro lugar do manual.":`The link may be old, or the page was deleted or moved somewhere else in the manual.`,"O link pode estar antigo, ou o manual foi renomeado, movido ou apagado da pasta.":`The link may be old, or the manual was renamed, moved or deleted from the folder.`,"Não achamos *esta página*":`We could not find *this page*`,"Não achamos *este manual*":`We could not find *this manual*`,"O que você escreveu continua nesta tela e será salvo quando o servidor voltar.":`What you wrote is still on this screen and will be saved when the server is back.`,"Sem conexão com o Studio.":`No connection to the Studio.`,"O servidor do Studio foi fechado ou está reiniciando. Quando ele voltar, esta tela abre o Studio sozinha. Se você usa o terminal, confira se o comando explicai ainda está rodando.":`The Studio server was closed or is restarting. When it is back, this screen opens the Studio by itself. If you use the terminal, check that the explicai command is still running.`,"Tentamos de novo sozinhos. Tentativas até agora: {n}.":`We keep trying on our own. Attempts so far: {n}.`,"Tentando de novo…":`Trying again…`,"Tentar agora":`Try now`,"O Studio *não está respondendo*":`The Studio *is not responding*`,"Código copiado.":`Code copied.`,"Copiar código":`Copy code`,Copiado:`Copied`,"Não foi possível falar com o Studio. Ele pode ter sido fechado ou estar reiniciando.":`Could not reach the Studio. It may have been closed or may be restarting.`,"O Studio só aceita pedidos deste computador. Abra-o por localhost ou 127.0.0.1.":`The Studio only accepts requests from this computer. Open it through localhost or 127.0.0.1.`,"O endereço pedido tem um % malformado. Confira o endereço e tente de novo.":`The requested address has a malformed %. Check the address and try again.`,"O Studio recebeu um texto que não está em UTF-8. Salve o conteúdo em UTF-8 e envie de novo.":`The Studio received text that is not UTF-8. Save the content as UTF-8 and send it again.`,"Para gerar o PDF, o Explicaí usa o Chrome, o Edge ou o Chromium da sua máquina, e nenhum foi encontrado. Instale um deles ou informe o caminho na variável EXPLICAI_BROWSER.":`To make the PDF, Explicaí uses Chrome, Edge or Chromium on your computer, and none was found. Install one of them or set its path in the EXPLICAI_BROWSER variable.`,"O Studio só abre *neste computador*":`The Studio only opens *on this computer*`,"O servidor *não conseguiu responder*":`The server *could not respond*`,"Se continuar, feche o comando explicai no terminal e rode de novo.":`If it keeps happening, stop the explicai command in the terminal and run it again.`},rf=`explicai:idioma`;function af(){if(typeof window>`u`)return`pt-BR`;try{let e=localStorage.getItem(rf);if(e===`pt-BR`||e===`en`)return e}catch{}return navigator.language.toLowerCase().startsWith(`pt`)?`pt-BR`:`en`}var of=af(),sf=of===`en`?`en-US`:`pt-BR`;function cf(e){try{localStorage.setItem(rf,e)}catch{}window.location.reload()}function U(e,t){let n=of===`en`?nf[e]??e:e;return t?n.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??``)):n}function lf(e,t,n,r){return U(e===1?t:n,{n:e,...r})}function uf({code:e}){let[t,n]=(0,_.useState)(!1);return(0,R.jsxs)(`div`,{className:`mt-2 flex max-w-full items-center gap-1 rounded-[3px] border border-dashed border-border py-0.5 pr-1 pl-3 text-xs text-muted-foreground`,children:[(0,R.jsx)(`code`,{className:`min-w-0 py-1.5 font-mono break-words`,children:e}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>{navigator.clipboard?.writeText(e).then(()=>n(!0))},className:`[@media(pointer:coarse)]:min-h-11 shrink-0 rounded-md px-2 py-1.5 font-bold text-primary underline-offset-2 hover:underline`,children:U(t?`Copiado`:`Copiar código`)}),(0,R.jsx)(`span`,{role:`status`,className:`sr-only`,children:t?U(`Código copiado.`):``})]})}var df=class extends Error{code;params;status;constructor(e,t,n={},r=0){super(e),this.code=t,this.params=n,this.status=r}},ff=e=>e instanceof df&&e.code===`offline`,pf=[502,503,504];async function mf(e,t){let n;try{n=await fetch(e,t)}catch{throw new df(`Servidor fora.`,`offline`)}let r=await n.json().catch(()=>({}));if(!n.ok){let{error:e,code:t,params:i}=r;throw!t&&pf.includes(n.status)?new df(`Servidor fora.`,`offline`,{},n.status):new df(e??U(`Erro {status}`,{status:n.status}),t,i,n.status)}return r}var hf=(e,t)=>({method:e,headers:{"content-type":`application/json`},body:JSON.stringify(t)}),gf=e=>`/api/manuals/${encodeURIComponent(e)}`,_f=(e,t)=>`${gf(e)}/pages/${encodeURIComponent(t)}`,vf={listManuals:()=>mf(`/api/manuals`),createManual:(e,t)=>mf(`/api/manuals`,hf(`POST`,{title:e,language:t})),getManual:e=>mf(gf(e)),addPage:(e,t,n)=>mf(`${gf(e)}/pages`,hf(`POST`,{title:t,parentId:n})),getPage:(e,t)=>mf(_f(e,t)),updatePage:(e,t,n,r)=>{let i=hf(`PUT`,n);return mf(_f(e,t),r?{...i,headers:{...i.headers,"if-match":r}}:i)},removePage:(e,t)=>mf(_f(e,t),{method:`DELETE`}),listTrash:e=>mf(`${gf(e)}/trash`),restorePage:(e,t)=>mf(`${gf(e)}/trash/${encodeURIComponent(t)}/restore`,{method:`POST`}),movePage:(e,t,n,r)=>mf(`${_f(e,t)}/move`,hf(`POST`,{parentId:n,index:r})),listVersions:(e,t)=>mf(`${_f(e,t)}/versions`),getVersion:(e,t,n)=>mf(`${_f(e,t)}/versions/${encodeURIComponent(n)}`),saveVersion:(e,t,n)=>mf(`${_f(e,t)}/versions`,hf(`POST`,{note:n})),restoreVersion:(e,t,n)=>mf(`${_f(e,t)}/versions/${encodeURIComponent(n)}/restore`,{method:`POST`}),publishVersion:(e,t,n)=>mf(`${_f(e,t)}/published`,hf(`PUT`,{versionId:n})),listFonts:()=>mf(`/api/fonts`),exportManual:(e,t,n)=>mf(`${gf(e)}/export`,hf(`POST`,{format:t,onlyApproved:n})),setTheme:(e,t)=>mf(`${gf(e)}/theme`,hf(`PUT`,t)),uploadLogo:(e,t)=>mf(`${gf(e)}/logo?name=${encodeURIComponent(t.name||`logo.png`)}`,{method:`POST`,body:t}),getAnnotations:(e,t)=>mf(`${gf(e)}/annotations?asset=${encodeURIComponent(t)}`),saveAnnotations:(e,t,n)=>mf(`${gf(e)}/annotations?asset=${encodeURIComponent(t)}`,hf(`PUT`,n)),inGitRepo:e=>mf(`${gf(e)}/git`),redactAsset:(e,t,n)=>mf(`${gf(e)}/assets/redact?asset=${encodeURIComponent(t)}`,{method:`POST`,body:n}),cleanUnusedAssets:e=>mf(`${gf(e)}/assets/clean`,{method:`POST`}),uploadAsset:(e,t)=>mf(`${gf(e)}/assets?name=${encodeURIComponent(t.name||`imagem.png`)}`,{method:`POST`,body:t})},yf=e=>Number(e).toLocaleString(sf,{minimumFractionDigits:1,maximumFractionDigits:1}),bf=()=>U(`O Studio só aceita pedidos deste computador. Abra-o por localhost ou 127.0.0.1.`),xf={offline:()=>U(`Não foi possível falar com o Studio. Ele pode ter sido fechado ou estar reiniciando.`),"forbidden-host":bf,"forbidden-origin":bf,"invalid-utf8":()=>U(`O Studio recebeu um texto que não está em UTF-8. Salve o conteúdo em UTF-8 e envie de novo.`),"malformed-url":()=>U(`O endereço pedido tem um % malformado. Confira o endereço e tente de novo.`),"annotations-invalid":e=>U(`As marcações de {file} estão com erro de sintaxe. Corrija ou apague o arquivo.`,{file:String(e.file)}),"disk-conflict":()=>U(`Esta página foi alterada fora do Studio depois que você a abriu. Recarregue do disco ou mantenha a sua versão.`),"no-browser":()=>U(`Para gerar o PDF, o Explicaí usa o Chrome, o Edge ou o Chromium da sua máquina, e nenhum foi encontrado. Instale um deles ou informe o caminho na variável EXPLICAI_BROWSER.`),"no-approved-pages":()=>U(`Nenhuma página está aprovada ou publicada. Aprove uma página ou exporte todas.`),"logo-type":()=>U(`O logo precisa ser PNG, JPG ou SVG. Escolha outro arquivo.`),"logo-path":()=>U(`O logo precisa estar na pasta assets/ do manual.`),"logo-missing":e=>U(`O logo {logo} não está mais no manual. Envie o arquivo de novo.`,{logo:String(e.logo)}),"logo-size":e=>U(`O logo passa de {max} MB. Reduza o arquivo e envie de novo.`,{max:String(e.max)}),"low-contrast":e=>U(`A cor de {label} tem contraste {ratio}:1 com o branco; o mínimo é {min}:1. Escolha uma cor mais escura.`,{label:U(String(e.label)),ratio:yf(e.ratio),min:yf(e.min)}),"low-contrast-highlight":e=>U(`O texto sobre o realce tem contraste {ratio}:1; o mínimo é {min}:1. Escolha um realce mais claro.`,{ratio:yf(e.ratio),min:yf(e.min)})};function W(e,t=U(`Algo deu errado.`)){return e instanceof df&&e.code?xf[e.code]?.(e.params)??e.message:e instanceof Error?e.message:t}function Sf(e){return e.split(/\*([^*]+)\*/).map((e,t)=>({text:e,mark:t%2==1})).filter(e=>e.text)}var Cf=e=>e.replaceAll(`*`,``);function wf(e){return ff(e)?`offline`:e instanceof df&&e.code?.startsWith(`forbidden`)?`forbidden`:`server`}function Tf(e){return ff(e)&&e instanceof df?e.status?`HTTP ${e.status}`:`fetch failed`:e instanceof df&&e.status?[`HTTP ${e.status}`,e.code].filter(Boolean).join(` `):e instanceof Error?`${e.name}: ${e.message}`:String(e)}function Ef({title:e,children:t,action:n,secondary:r,technical:i,status:a,standalone:o=!0}){let s=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(s.current?.focus(),!o)return;let t=document.title;return document.title=`${Cf(e)} · Explicaí Studio`,()=>{document.title=t}},[o,e]),(0,R.jsxs)(`div`,{className:`flex min-h-full flex-col bg-background`,children:[o&&(0,R.jsx)(`header`,{className:`mx-auto w-full max-w-5xl px-5 py-5 sm:px-9`,children:(0,R.jsx)(tf,{})}),(0,R.jsx)(`div`,{role:`alert`,className:`mx-auto my-auto grid w-full max-w-5xl px-6 py-12 sm:px-10 [@media(max-height:600px)]:py-6`,children:(0,R.jsxs)(`div`,{className:`grid max-w-2xl justify-items-start gap-5`,children:[(0,R.jsx)(`h1`,{ref:s,tabIndex:-1,className:`font-display text-4xl leading-[1.08] font-extrabold tracking-tight [font-stretch:108%] text-balance outline-none sm:text-5xl`,children:Sf(e).map(e=>e.mark?(0,R.jsx)(`mark`,{className:`-mx-1 rounded-[2px] bg-marca-faixa px-1 text-inherit [box-decoration-break:clone]`,children:e.text},e.text):e.text)}),(0,R.jsx)(`p`,{className:`max-w-prose text-lg text-pretty text-muted-foreground`,children:t}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-5 gap-y-2 pt-1`,children:[(0,R.jsx)($d,{size:`lg`,className:`[@media(pointer:coarse)]:min-h-11`,onClick:n.onClick,children:n.label}),r&&(0,R.jsx)(`button`,{type:`button`,onClick:r.onClick,className:`[@media(pointer:coarse)]:min-h-11 rounded-md px-1 font-bold text-primary underline-offset-4 hover:underline`,children:r.label})]}),a&&(0,R.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,R.jsx)(`span`,{"aria-hidden":!0,className:`size-2 shrink-0 rounded-full bg-primary motion-safe:animate-pulse`}),a]}),(0,R.jsx)(uf,{code:i})]})})]})}function Df({error:e,onRetry:t,standalone:n=!1}){return(0,R.jsx)(Ef,{standalone:n,title:U(`Algo quebrou *nesta tela*`),action:{label:U(`Recarregar o Studio`),onClick:()=>window.location.reload()},secondary:t&&{label:U(`Tentar de novo sem recarregar`),onClick:t},technical:`${e.name}: ${e.message}`,children:U(`O Studio encontrou um erro que não esperava. O texto que já foi salvo continua no disco. Recarregue para continuar; se o erro voltar, copie o código abaixo e conte para quem mantém o projeto.`)})}var Of=class extends _.Component{state={error:null,key:this.props.resetKey};static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return e.resetKey===t.key?null:{error:null,key:e.resetKey}}componentDidCatch(e,t){console.error(e,t.componentStack)}render(){let{error:e}=this.state;return e?(0,R.jsx)(Df,{error:e,standalone:this.props.root,onRetry:this.props.root?void 0:()=>this.setState({error:null})}):this.props.children}},kf=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function Af(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:kf(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var jf=e=>{let t=``,n=!1;for(let r of e)r===`-`||r===`_`||r<=` `?n=t.length>0:(t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1);return t},Mf=e=>{let t=jf(e);return t.charAt(0).toUpperCase()+t.slice(1)},Nf=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Pf={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function Ff(e){return e!=null}function If(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??Pf.width,a=e.size??e.height??Pf.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?Nf(...c):Nf(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??Pf[`stroke-width`])*Number(e.size??e.width??Pf.width)/Number(t.size??t.width??Pf.width):t.strokeWidth??Pf[`stroke-width`];return[`svg`,{...Object.entries(Pf).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&Ff(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&Ff(t.width)&&{[r(`width`)]:t.width},...`height`in t&&Ff(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function Lf(e,t={}){return If(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var Rf=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},zf=(0,_.createContext)({}),Bf=()=>(0,_.useContext)(zf),Vf=(0,_.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:v=`currentColor`,className:y=``}=Bf()??{},b=!!c||Rf(d),[x,S,C=[]]=Lf(u,{color:e??v,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:Nf(y,s),hasA11yProp:b,attributes:d});return(0,_.createElement)(x,{ref:f,...S},[...C.map(([e,t])=>(0,_.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function G(e,t=[],n=[]){let r=typeof e==`string`?Af(e,t,n):e,i=(0,_.forwardRef)(({className:e,...t},n)=>(0,_.createElement)(Vf,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=Mf(r.name)),i}var Hf={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};Hf.node;var Uf=G(Hf),Wf={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};Wf.node;var Gf=G(Wf),Kf={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};Kf.node;var qf=G(Kf),Jf={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};Jf.node;var Yf=G(Jf),Xf={name:`between-horizontal-end`,size:24,node:[[`rect`,{width:`13`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`11xb64`}],[`path`,{d:`m22 15-3-3 3-3`,key:`26chmm`}],[`rect`,{width:`13`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`k6ky7n`}]],aliases:[`between-horizonal-end`]};Xf.node;var Zf=G(Xf),Qf={name:`between-vertical-end`,size:24,node:[[`rect`,{width:`7`,height:`13`,x:`3`,y:`3`,rx:`1`,key:`1fdu0f`}],[`path`,{d:`m9 22 3-3 3 3`,key:`17z65a`}],[`rect`,{width:`7`,height:`13`,x:`14`,y:`3`,rx:`1`,key:`1squn4`}]]};Qf.node;var $f=G(Qf),ep={name:`bold`,size:24,node:[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]};ep.node;var tp=G(ep),np={name:`book-check`,size:24,node:[[`path`,{d:`M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20`,key:`k3hazp`}],[`path`,{d:`m9 9.5 2 2 4-4`,key:`1dth82`}]]};np.node;var rp=G(np),ip={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};ip.node;var ap=G(ip),op={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};op.node;var sp=G(op),cp={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};cp.node;var lp=G(cp),up={name:`chevrons-up-down`,size:24,node:[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]};up.node;var dp=G(up),fp={name:`circle-alert`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]],aliases:[`alert-circle`]};fp.node;var pp=G(fp),mp={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};mp.node;var hp=G(mp),gp={name:`circle`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};gp.node;var _p=G(gp),vp={name:`code-xml`,size:24,node:[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]],aliases:[`code-2`]};vp.node;var yp=G(vp),bp={name:`code`,size:24,node:[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]};bp.node;var xp=G(bp),Sp={name:`crop`,size:24,node:[[`path`,{d:`M6 2v14a2 2 0 0 0 2 2h14`,key:`ron5a4`}],[`path`,{d:`M18 22V8a2 2 0 0 0-2-2H2`,key:`7s9ehn`}]]};Sp.node;var Cp=G(Sp),wp={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};wp.node;var Tp=G(wp),Ep={name:`external-link`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]};Ep.node;var Dp=G(Ep),Op={name:`eye-off`,size:24,node:[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};Op.node;var kp=G(Op),Ap={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Ap.node;var jp=G(Ap),Mp={name:`file-text`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]};Mp.node;var Np=G(Mp),Pp={name:`grip-horizontal`,size:24,node:[[`circle`,{cx:`12`,cy:`9`,r:`1`,key:`124mty`}],[`circle`,{cx:`19`,cy:`9`,r:`1`,key:`1ruzo2`}],[`circle`,{cx:`5`,cy:`9`,r:`1`,key:`1a8b28`}],[`circle`,{cx:`12`,cy:`15`,r:`1`,key:`1e56xg`}],[`circle`,{cx:`19`,cy:`15`,r:`1`,key:`1a92ep`}],[`circle`,{cx:`5`,cy:`15`,r:`1`,key:`5r1jwy`}]]};Pp.node;var Fp=G(Pp),Ip={name:`grip-vertical`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]};Ip.node;var Lp=G(Ip),Rp={name:`hash`,size:24,node:[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]};Rp.node;var zp=G(Rp),Bp={name:`heading-1`,size:24,node:[[`path`,{d:`M4 12h8`,key:`17cfdx`}],[`path`,{d:`M4 18V6`,key:`1rz3zl`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}],[`path`,{d:`m17 12 3-2v8`,key:`1hhhft`}]]};Bp.node;var Vp=G(Bp),Hp={name:`heading-3`,size:24,node:[[`path`,{d:`M4 12h8`,key:`17cfdx`}],[`path`,{d:`M4 18V6`,key:`1rz3zl`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}],[`path`,{d:`M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2`,key:`68ncm8`}],[`path`,{d:`M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2`,key:`1ejuhz`}]]};Hp.node;var Up=G(Hp),Wp={name:`heading-2`,size:24,node:[[`path`,{d:`M4 12h8`,key:`17cfdx`}],[`path`,{d:`M4 18V6`,key:`1rz3zl`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}],[`path`,{d:`M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1`,key:`9jr5yi`}]]};Wp.node;var Gp=G(Wp),Kp={name:`highlighter`,size:24,node:[[`path`,{d:`m9 11-6 6v3h9l3-3`,key:`1a3l36`}],[`path`,{d:`m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4`,key:`14a9rk`}]]};Kp.node;var qp=G(Kp),Jp={name:`image-off`,size:24,node:[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]};Jp.node;var Yp=G(Jp),Xp={name:`image`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]};Xp.node;var Zp=G(Xp),Qp={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};Qp.node;var $p=G(Qp),em={name:`italic`,size:24,node:[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]};em.node;var tm=G(em),nm={name:`keyboard`,size:24,node:[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]};nm.node;var rm=G(nm),im={name:`languages`,size:24,node:[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]};im.node;var am=G(im),om={name:`lightbulb`,size:24,node:[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]};om.node;var sm=G(om),cm={name:`link-2`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]};cm.node;var lm=G(cm),um={name:`list-indent-decrease`,size:24,node:[[`path`,{d:`M21 5H11`,key:`us1j55`}],[`path`,{d:`M21 12H11`,key:`wd7e0v`}],[`path`,{d:`M21 19H11`,key:`saa85w`}],[`path`,{d:`m7 8-4 4 4 4`,key:`o5hrat`}]],aliases:[`outdent`,`indent-decrease`]};um.node;var dm=G(um),fm={name:`list-indent-increase`,size:24,node:[[`path`,{d:`M21 5H11`,key:`us1j55`}],[`path`,{d:`M21 12H11`,key:`wd7e0v`}],[`path`,{d:`M21 19H11`,key:`saa85w`}],[`path`,{d:`m3 8 4 4-4 4`,key:`1a3j6y`}]],aliases:[`indent`,`indent-increase`]};fm.node;var pm=G(fm),mm={name:`list-ordered`,size:24,node:[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]};mm.node;var hm=G(mm),gm={name:`list-tree`,size:24,node:[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]};gm.node;var _m=G(gm),vm={name:`list`,size:24,node:[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]};vm.node;var ym=G(vm),bm={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};bm.node;var xm=G(bm),Sm={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};Sm.node;var Cm=G(Sm),wm={name:`moon`,size:24,node:[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]};wm.node;var Tm=G(wm),Em={name:`mouse-pointer-2`,size:24,node:[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]};Em.node;var Dm=G(Em),Om={name:`move`,size:24,node:[[`path`,{d:`M12 2v20`,key:`t6zp3m`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m19 9 3 3-3 3`,key:`1mg7y2`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}],[`path`,{d:`m5 9-3 3 3 3`,key:`j64kie`}],[`path`,{d:`m9 5 3-3 3 3`,key:`l8vdw6`}]]};Om.node;var km=G(Om),Am={name:`octagon-x`,size:24,node:[[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-octagon`]};Am.node;var jm=G(Am),Mm={name:`panel-left-close`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]],aliases:[`sidebar-close`]};Mm.node;var Nm=G(Mm),Pm={name:`panel-left-open`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]],aliases:[`sidebar-open`]};Pm.node;var Fm=G(Pm),Im={name:`pen-line`,size:24,node:[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]],aliases:[`edit-3`]};Im.node;var Lm=G(Im),Rm={name:`pilcrow`,size:24,node:[[`path`,{d:`M13 4v16`,key:`8vvj80`}],[`path`,{d:`M17 4v16`,key:`7dpous`}],[`path`,{d:`M19 4H9.5a4.5 4.5 0 0 0 0 9H13`,key:`sh4n9v`}]]};Rm.node;var zm=G(Rm),Bm={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};Bm.node;var Vm=G(Bm),Hm={name:`quote`,size:24,node:[[`path`,{d:`M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`rib7q0`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`1ymkrd`}]]};Hm.node;var Um=G(Hm),Wm={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};Wm.node;var Gm=G(Wm),Km={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Km.node;var qm=G(Km),Jm={name:`settings-2`,size:24,node:[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]};Jm.node;var Ym=G(Jm),Xm={name:`settings`,size:24,node:[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Xm.node;var Zm=G(Xm),Qm={name:`sun-moon`,size:24,node:[[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M14.837 16.385a6 6 0 1 1-7.223-7.222c.624-.147.97.66.715 1.248a4 4 0 0 0 5.26 5.259c.589-.255 1.396.09 1.248.715`,key:`xlf6rm`}],[`path`,{d:`M16 12a4 4 0 0 0-4-4`,key:`6vsxu`}],[`path`,{d:`m19 5-1.256 1.256`,key:`1yg6a6`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}]]};Qm.node;var $m=G(Qm),eh={name:`sun`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]};eh.node;var th=G(eh),nh={name:`table`,size:24,node:[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}]]};nh.node;var rh=G(nh),ih={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};ih.node;var ah=G(ih),oh={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};oh.node;var sh=G(oh),ch={name:`type`,size:24,node:[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]};ch.node;var lh=G(ch),uh={name:`undo-2`,size:24,node:[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]};uh.node;var dh=G(uh),fh={name:`wifi-off`,size:24,node:[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};fh.node;var ph=G(fh),mh={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};mh.node;var hh=G(mh);function gh(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var _h=e=>{switch(e){case`success`:return bh;case`info`:return Sh;case`warning`:return xh;case`error`:return Ch;default:return null}},vh=Array(12).fill(0),yh=({visible:e,className:t})=>_.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},_.createElement(`div`,{className:`sonner-spinner`},vh.map((e,t)=>_.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),bh=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},_.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),xh=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},_.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),Sh=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},_.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),Ch=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},_.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),wh=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`},_.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),_.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),Th=()=>{let[e,t]=_.useState(document.hidden);return _.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),e},Eh=1,Dh=100,Oh=e=>typeof e?.id==`number`||e?.id?.length>0?e.id:Eh++,kh=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),this.getActiveToasts().forEach(t=>e(t)),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e],this.trimHistory()},this.trimHistory=()=>{let e=this.toasts.length-Dh;e<=0||(this.toasts=this.toasts.filter(t=>e>0&&this.dismissedToasts.has(t.id)?(this.dismissedToasts.delete(t.id),e--,!1):!0))},this.create=e=>{let{message:t,...n}=e,r=Oh(e),i=this.pendingDismissals.get(r);i!==void 0&&(cancelAnimationFrame(i),this.pendingDismissals.delete(r),this.dismissedToasts.delete(r));let a=this.dismissedToasts.has(r),o=e.dismissible===void 0||e.dismissible;return a&&(this.dismissedToasts.delete(r),this.toasts=this.toasts.filter(e=>e.id!==r)),!a&&this.toasts.find(e=>e.id===r)?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:o,title:t}):n):this.addToast({title:t,...n,dismissible:o,id:r}),r},this.dismiss=e=>{if(e==null)return this.getActiveToasts().forEach(e=>{this.dismissedToasts.add(e.id),this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e;this.dismissedToasts.add(e);let t=this.pendingDismissals.get(e);return t!==void 0&&cancelAnimationFrame(t),this.pendingDismissals.set(e,requestAnimationFrame(()=>{this.pendingDismissals.delete(e),this.subscribers.forEach(t=>t({id:e,dismiss:!0}))})),e},this.message=(e,t)=>this.create({...t,message:e,type:void 0}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],_.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(jh(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!_.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!_.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!_.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!_.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=Oh(t);return this.create({...t,jsx:e(n),id:n,type:void 0}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}},Ah=(e,t)=>kh.message(e,t),jh=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,Mh=Object.assign(Ah,{success:kh.success,info:kh.info,warning:kh.warning,error:kh.error,custom:kh.custom,message:kh.message,promise:kh.promise,dismiss:kh.dismiss,loading:kh.loading},{getHistory:()=>kh.toasts,getToasts:()=>kh.getActiveToasts()});gh(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function Nh(e){return e.label!==void 0}var Ph=3,Fh=`24px`,Ih=`16px`,Lh=4e3,Rh=356,zh=14,Bh=45,Vh=200;function Hh(...e){return e.filter(Boolean).join(` `)}function Uh(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var Wh=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:v=``,descriptionClassName:y=``,duration:b,position:x,gap:S,expandByDefault:C,classNames:w,icons:T,closeButtonAriaLabel:E=`Close toast`}=e,[D,ee]=_.useState(null),[te,O]=_.useState(null),[k,A]=_.useState(!1),[ne,re]=_.useState(!1),[j,M]=_.useState(!1),[ie,ae]=_.useState(!1),[oe,se]=_.useState(!1),[ce,le]=_.useState(0),[ue,de]=_.useState(0),fe=_.useRef(n.duration||b||Lh),pe=_.useRef(null),me=_.useRef(null),he=c===0,ge=c+1<=o,_e=n.type,N=_e??`default`,ve=n.dismissible!==!1,ye=n.className||``,be=n.descriptionClassName||``,xe=_.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),Se=_.useMemo(()=>n.closeButton??p,[n.closeButton,p]),Ce=_.useMemo(()=>n.duration||b||Lh,[n.duration,b]),we=_.useRef(0),Te=_.useRef(0),Ee=_.useRef(0),De=_.useRef(null),[Oe,ke]=x.split(`-`),Ae=_.useMemo(()=>s.reduce((e,t,n)=>n>=xe?e:e+t.height,0),[s,xe]),je=Th(),Me=_.useMemo(()=>e.swipeDirections??Uh(x),[e.swipeDirections,x]),P=n.invert||t,Ne=_e===`loading`;Te.current=_.useMemo(()=>xe*S+Ae,[xe,Ae]),_.useEffect(()=>{fe.current=Ce},[Ce]),_.useEffect(()=>{A(!0)},[]),_.useEffect(()=>{let e=me.current;if(e){let t=e.getBoundingClientRect().height;return de(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),_.useLayoutEffect(()=>{if(!k)return;let e=me.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,de(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[k,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let Pe=_.useCallback(()=>{re(!0),le(Te.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},Vh)},[n,d,a,Te]);_.useEffect(()=>{if(n.promise&&_e===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||je?(()=>{if(Ee.current<we.current){let e=new Date().getTime()-we.current;fe.current-=e}Ee.current=new Date().getTime()})():fe.current!==1/0&&(we.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),Pe()},fe.current)),()=>clearTimeout(e)},[u,i,n,_e,je,Pe]),_.useEffect(()=>{n.delete&&(Pe(),n.onDismiss==null||n.onDismiss.call(n,n))},[Pe,n.delete]);function Fe(){return T?.loading?_.createElement(`div`,{className:Hh(w?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":_e===`loading`},T.loading):_.createElement(yh,{className:Hh(w?.loader,n?.classNames?.loader),visible:_e===`loading`})}let Ie=n.icon||T?.[_e]||_h(_e);return _.createElement(`li`,{tabIndex:0,ref:me,className:Hh(v,ye,w?.toast,n?.classNames?.toast,w?.[N],n?.classNames?.[N]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":k,"data-promise":!!n.promise,"data-swiped":oe,"data-removed":ne,"data-visible":ge,"data-y-position":Oe,"data-x-position":ke,"data-index":c,"data-front":he,"data-swiping":j,"data-dismissible":ve,"data-type":_e,"data-invert":P,"data-swipe-out":ie,"data-swipe-direction":te,"data-expanded":!!(u||C&&k),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${ne?ce:Te.current}px`,"--initial-height":C?`auto`:`${ue}px`,...m,...n.style},onDragEnd:()=>{M(!1),ee(null),De.current=null},onPointerDown:e=>{e.button!==2&&!Ne&&ve&&(pe.current=new Date,le(Te.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(M(!0),De.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{if(ie||!ve)return;De.current=null;let e=Number(me.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(me.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-pe.current?.getTime(),i=D===`x`?e:t,a=Math.abs(i)/r;if((D===`x`?Me.includes(e>0?`right`:`left`):Me.includes(t>0?`bottom`:`top`))&&(Math.abs(i)>=Bh||a>.11))le(Te.current),n.onDismiss==null||n.onDismiss.call(n,n),O(D===`x`?e>0?`right`:`left`:t>0?`down`:`up`),Pe(),ae(!0);else{var o,s;(o=me.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=me.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`),se(!1),M(!1),ee(null)}},onPointerMove:e=>{var t,n;if(!De.current||!ve||window.getSelection()?.toString().length>0)return;let r=e.clientY-De.current.y,i=e.clientX-De.current.x;!D&&(Math.abs(i)>1||Math.abs(r)>1)&&ee(Math.abs(i)>Math.abs(r)?`x`:`y`);let a={x:0,y:0},o=e=>1/(1.5+Math.abs(e)/20);if(D===`y`){if(Me.includes(`top`)||Me.includes(`bottom`)){if(Me.includes(`top`)&&r<0||Me.includes(`bottom`)&&r>0)a.y=r;else{let e=r*o(r);a.y=Math.abs(e)<Math.abs(r)?e:r}}}else if(D===`x`&&(Me.includes(`left`)||Me.includes(`right`))){if(Me.includes(`left`)&&i<0||Me.includes(`right`)&&i>0)a.x=i;else{let e=i*o(i);a.x=Math.abs(e)<Math.abs(i)?e:i}}(Math.abs(a.x)>0||Math.abs(a.y)>0)&&se(!0),(t=me.current)==null||t.style.setProperty(`--swipe-amount-x`,`${a.x}px`),(n=me.current)==null||n.style.setProperty(`--swipe-amount-y`,`${a.y}px`)}},Se&&!n.jsx&&_e!==`loading`?_.createElement(`button`,{"aria-label":E,"data-disabled":Ne,"data-close-button":!0,onClick:Ne||!ve?()=>{}:()=>{Pe(),n.onDismiss==null||n.onDismiss.call(n,n)},className:Hh(w?.closeButton,n?.classNames?.closeButton)},T?.close??wh):null,(_e||n.icon||n.promise)&&n.icon!==null&&(T?.[_e]!==null||n.icon)?_.createElement(`div`,{"data-icon":``,className:Hh(w?.icon,n?.classNames?.icon)},_e===`loading`?n.icon||Fe():n.promise?Fe():null,_e===`loading`?null:Ie):null,_.createElement(`div`,{"data-content":``,className:Hh(w?.content,n?.classNames?.content)},_.createElement(`div`,{"data-title":``,className:Hh(w?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?_.createElement(`div`,{"data-description":``,className:Hh(y,be,w?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),_.isValidElement(n.cancel)?n.cancel:n.cancel&&Nh(n.cancel)?_.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{Nh(n.cancel)&&ve&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),Pe())},className:Hh(w?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,_.isValidElement(n.action)?n.action:n.action&&Nh(n.action)?_.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{Nh(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&Pe())},className:Hh(w?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function Gh(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function Kh(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?Ih:Fh;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var qh=_.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:p,style:m,visibleToasts:h=Ph,toastOptions:g,dir:v=Gh(),gap:y=zh,icons:b,customAriaLabel:x,containerAriaLabel:S=`Notifications`}=e,[C,w]=_.useState([]),T=_.useMemo(()=>n?C.filter(e=>e.toasterId===n):C.filter(e=>!e.toasterId),[C,n]),E=_.useMemo(()=>Array.from(new Set([i].concat(T.filter(e=>e.position).map(e=>e.position)))),[T,i]),[D,ee]=_.useState([]),[te,O]=_.useState(!1),[k,A]=_.useState(!1),[ne,re]=_.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),j=_.useRef(null),M=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),ie=_.useRef(null),ae=_.useRef(!1),oe=_.useCallback(e=>{w(t=>(t.find(t=>t.id===e.id)?.delete||kh.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return _.useEffect(()=>kh.subscribe(e=>{e.dismiss?requestAnimationFrame(()=>{w(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))}):setTimeout(()=>{Bt.flushSync(()=>{w(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[]),_.useEffect(()=>{if(d!==`system`){re(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?re(`dark`):re(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{re(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{re(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),_.useEffect(()=>{C.length<=1&&O(!1)},[C]),_.useEffect(()=>{let e=e=>{if(a.length>0&&a.every(t=>e[t]||e.code===t)){var t;O(!0),(t=j.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===j.current||j.current?.contains(document.activeElement))&&O(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),_.useEffect(()=>{if(j.current)return()=>{ie.current&&(ie.current.focus({preventScroll:!0}),ie.current=null,ae.current=!1)}},[j.current]),_.createElement(`section`,{ref:t,"aria-label":x??`${S} ${M}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},E.map((t,n)=>{let[i,a]=t.split(`-`);return T.length?_.createElement(`ol`,{key:t,dir:v===`auto`?Gh():v,tabIndex:-1,ref:j,className:c,"data-sonner-toaster":!0,"data-sonner-theme":ne,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${D[0]?.height||0}px`,"--width":`${Rh}px`,"--gap":`${y}px`,...m,...Kh(l,u)},onBlur:e=>{ae.current&&!e.currentTarget.contains(e.relatedTarget)&&(ae.current=!1,ie.current&&=(ie.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||ae.current||(ae.current=!0,ie.current=e.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{k||O(!1)},onDragEnd:()=>O(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||A(!0)},onPointerUp:()=>A(!1)},T.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>_.createElement(Wh,{key:n.id,icons:b,index:i,toast:n,defaultRichColors:f,duration:g?.duration??p,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:r,visibleToasts:h,closeButton:g?.closeButton??s,interacting:k,position:t,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,closeButtonAriaLabel:g?.closeButtonAriaLabel,removeToast:oe,toasts:T.filter(e=>e.position==n.position),heights:D.filter(e=>e.position==n.position),setHeights:ee,expandByDefault:o,gap:y,expanded:te,swipeDirections:e.swipeDirections}))):null}))}),Jh=({...e})=>(0,R.jsx)(qh,{theme:`system`,className:`toaster group`,icons:{success:(0,R.jsx)(hp,{className:`size-4`}),info:(0,R.jsx)($p,{className:`size-4`}),warning:(0,R.jsx)(sh,{className:`size-4`}),error:(0,R.jsx)(jm,{className:`size-4`}),loading:(0,R.jsx)(xm,{className:`size-4 animate-spin`})},style:{"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius)`},...e});function Yh({delayDuration:e=0,...t}){return(0,R.jsx)(Od,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Xh({...e}){return(0,R.jsx)(Md,{"data-slot":`tooltip`,...e})}function Zh({...e}){return(0,R.jsx)(Pd,{"data-slot":`tooltip-trigger`,...e})}function Qh({className:e,sideOffset:t=0,children:n,...r}){return(0,R.jsx)(Rd,{children:(0,R.jsxs)(Bd,{"data-slot":`tooltip-content`,sideOffset:t,className:L(`z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,e),...r,children:[n,(0,R.jsx)(Wd,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 bg-foreground fill-foreground`})]})})}function $h({checking:e,onRetry:t}){return(0,R.jsxs)(`div`,{role:`alert`,className:`sticky top-0 z-20 flex shrink-0 flex-wrap items-center gap-x-3 gap-y-1 border-b border-destructive/50 bg-[color-mix(in_oklab,var(--destructive)_10%,var(--background))] px-4 py-1 text-sm`,children:[(0,R.jsx)(ph,{className:`size-4 shrink-0 text-destructive`,"aria-hidden":!0}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1 basis-64`,children:[(0,R.jsx)(`strong`,{children:U(`Sem conexão com o Studio.`)}),` `,U(`O que você escreveu continua nesta tela e será salvo quando o servidor voltar.`)]}),(0,R.jsx)(`button`,{type:`button`,onClick:t,disabled:e,className:`[@media(pointer:coarse)]:min-h-11 rounded-md px-2 font-bold text-primary underline-offset-2 hover:underline disabled:opacity-60`,children:U(e?`Tentando de novo…`:`Tentar agora`)})]})}var eg=`min-h-8 rounded-sm border border-border bg-background px-3 text-sm font-bold hover:bg-muted [@media(pointer:coarse)]:min-h-11`;function tg({onReload:e,onKeep:t}){return(0,R.jsxs)(`div`,{role:`alert`,className:`sticky top-0 z-20 flex shrink-0 flex-wrap items-center gap-x-4 gap-y-2 border-b border-destructive/50 bg-background px-4 py-2 text-sm`,children:[(0,R.jsx)(sh,{className:`size-4 shrink-0 text-destructive`,"aria-hidden":!0}),(0,R.jsxs)(`p`,{className:`min-w-0 flex-1 basis-72`,children:[(0,R.jsx)(`strong`,{children:U(`Esta página mudou fora do Studio.`)}),` `,U(`Manter a minha versão grava o seu texto por cima do arquivo. Recarregar do disco descarta o que você escreveu aqui.`)]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:t,className:eg,children:U(`Manter a minha versão`)}),(0,R.jsx)(`button`,{type:`button`,onClick:e,className:eg,children:U(`Recarregar do disco`)})]})]})}function ng({kind:e,address:t,action:n,secondary:r}){return(0,R.jsx)(Ef,{title:U(e===`manual`?`Não achamos *este manual*`:`Não achamos *esta página*`),action:n,secondary:r,technical:`404 ${t}`,children:U(e===`manual`?`O link pode estar antigo, ou o manual foi renomeado, movido ou apagado da pasta.`:`O link pode estar antigo, ou a página foi excluída ou movida para outro lugar do manual.`)})}function rg({error:e,onRetry:t}){let n=wf(e)===`forbidden`;return(0,R.jsx)(Ef,{title:U(n?`O Studio só abre *neste computador*`:`O servidor *não conseguiu responder*`),action:{label:U(`Tentar de novo`),onClick:t},technical:Tf(e),children:n?U(`O Studio só aceita pedidos deste computador. Abra-o por localhost ou 127.0.0.1.`):`${W(e,U(`Algo deu errado.`))} ${U(`Se continuar, feche o comando explicai no terminal e rode de novo.`)}`})}function ig({attempt:e,checking:t,onRetry:n,code:r}){return(0,R.jsx)(Ef,{title:U(`O Studio *não está respondendo*`),action:{label:U(`Tentar agora`),onClick:n},technical:r,status:t?U(`Tentando de novo…`):U(`Tentamos de novo sozinhos. Tentativas até agora: {n}.`,{n:e}),children:U(`O servidor do Studio foi fechado ou está reiniciando. Quando ele voltar, esta tela abre o Studio sozinha. Se você usa o terminal, confira se o comando explicai ainda está rodando.`)})}function ag({className:e,type:t,...n}){return(0,R.jsx)(`input`,{type:t,"data-slot":`input`,className:L(`h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40`,e),...n})}function og({firstRun:e,onCreate:t,onCancel:n}){let[r,i]=(0,_.useState)(``),a=r.trim();return(0,R.jsxs)(`form`,{className:`mx-auto mt-[16vh] grid max-w-lg gap-5 px-6`,onSubmit:e=>{e.preventDefault(),a&&t(a)},children:[(0,R.jsxs)(`div`,{className:`grid gap-2`,children:[(0,R.jsx)(`h1`,{className:`font-display text-3xl font-extrabold tracking-tight [font-stretch:108%] text-balance`,children:U(e?`Qual sistema você vai explicar?`:`Novo manual`)}),(0,R.jsx)(`p`,{className:`text-muted-foreground`,children:U(`Cada manual vira uma pasta com uma página em Markdown para cada tela ou tarefa. Dá para versionar no git junto com o código.`)})]}),(0,R.jsxs)(`div`,{className:`grid gap-2`,children:[(0,R.jsx)(`label`,{htmlFor:`new-manual-title`,className:`text-sm font-bold`,children:U(`Nome do manual`)}),(0,R.jsx)(ag,{id:`new-manual-title`,autoFocus:!0,value:r,onChange:e=>i(e.target.value),placeholder:U(`Ex.: Manual do Financeiro`),className:`h-10 bg-card text-base`})]}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)($d,{type:`submit`,disabled:!a,children:U(`Criar manual`)}),!e&&(0,R.jsx)($d,{type:`button`,variant:`ghost`,onClick:n,children:U(`Cancelar`)})]})]})}function sg({...e}){return(0,R.jsx)(va,{"data-slot":`dialog`,...e})}function cg({...e}){return(0,R.jsx)(ba,{"data-slot":`dialog-trigger`,...e})}function lg({...e}){return(0,R.jsx)(wa,{"data-slot":`dialog-portal`,...e})}function ug({className:e,...t}){return(0,R.jsx)(Ea,{"data-slot":`dialog-overlay`,className:L(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function dg({className:e,children:t,showCloseButton:n=!0,...r}){return(0,R.jsxs)(lg,{"data-slot":`dialog-portal`,children:[(0,R.jsx)(ug,{}),(0,R.jsxs)(Aa,{"data-slot":`dialog-content`,className:L(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...r,children:[t,n&&(0,R.jsxs)(La,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,R.jsx)(hh,{}),(0,R.jsx)(`span`,{className:`sr-only`,children:U(`Fechar`)})]})]})]})}function fg({className:e,...t}){return(0,R.jsx)(`div`,{"data-slot":`dialog-header`,className:L(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function pg({className:e,showCloseButton:t=!1,children:n,...r}){return(0,R.jsxs)(`div`,{"data-slot":`dialog-footer`,className:L(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,R.jsx)(La,{asChild:!0,children:(0,R.jsx)($d,{variant:`outline`,children:`Close`})})]})}function mg({className:e,...t}){return(0,R.jsx)(Pa,{"data-slot":`dialog-title`,className:L(`text-lg leading-none font-semibold`,e),...t})}function hg({className:e,...t}){return(0,R.jsx)(Fa,{"data-slot":`dialog-description`,className:L(`text-sm text-muted-foreground`,e),...t})}function gg(e){return e.normalize(`NFD`).replace(/[̀-ͯ]/g,``).toLowerCase().trim()}function _g(e){try{return decodeURIComponent(e)}catch{return e}}function vg(){let[e,t]=window.location.hash.replace(/^#\/?/,``).split(`/`).map(_g);return{slug:e||null,pageId:t||null}}function yg({slug:e,pageId:t}){let n=e?`#/${encodeURIComponent(e)}${t?`/${encodeURIComponent(t)}`:``}`:`#/`;window.location.hash!==n&&window.history.replaceState(null,``,n)}function bg(e,t){for(let n of e){if(n.id===t)return n;let e=bg(n.children,t);if(e)return e}return null}function xg(e,t,n=null){for(let r of e){if(r.id===t)return{parentId:n,siblings:e};let i=xg(r.children,t,r.id);if(i)return i}return null}function Sg(e,t,n){let r=bg(e,t);return r?bg(r.children,n)!==null:!1}function Cg(e,t,n){return e.map(e=>e.id===t?{...e,title:n}:{...e,children:Cg(e.children,t,n)})}function wg(e,t,n,r){if(t===n||Sg(e,t,n))return null;if(r===`inside`)return{parentId:n,index:2**53-1};let i=xg(e,n);if(!i)return null;let a=i.siblings.filter(e=>e.id!==t).findIndex(e=>e.id===n);return{parentId:i.parentId,index:r===`before`?a:a+1}}function Tg(e,t,n){let r=xg(e,t);if(!r)return null;let i=r.siblings.findIndex(e=>e.id===t);switch(n){case`up`:return i>0?{parentId:r.parentId,index:i-1}:null;case`down`:return i<r.siblings.length-1?{parentId:r.parentId,index:i+1}:null;case`indent`:{let e=r.siblings[i-1];return e?{parentId:e.id,index:2**53-1}:null}case`outdent`:{if(!r.parentId)return null;let t=xg(e,r.parentId);if(!t)return null;let n=t.siblings.findIndex(e=>e.id===r.parentId);return{parentId:t.parentId,index:n+1}}}}function Eg(e,t){for(let n of e){if(n.id===t)return[];let e=Eg(n.children,t);if(e.length>0||bg(n.children,t))return[n,...e]}return[]}function Dg(e){return e.flatMap(e=>[e,...Dg(e.children)])}function Og(e){let t=new Map,n=(e,r,i)=>{for(let a of e){if(a.problem){n(a.children,r,i);continue}i.n+=1;let e=r?`${r}.${i.n}`:String(i.n);t.set(a.id,e),n(a.children,e,{n:0})}};return n(e,``,{n:0}),t}function kg(e,t){let n=gg(t),r=[],i=Og(e),a=(e,t)=>{for(let n of e)r.push({item:n,number:i.get(n.id)??``,path:t}),a(n.children,[...t,n.title||U(`Sem título`)])};if(a(e,[]),!n)return r;let o=r.filter(e=>gg(e.item.title).includes(n));return[...o.filter(e=>gg(e.item.title).startsWith(n)),...o.filter(e=>!gg(e.item.title).startsWith(n))]}function Ag(e,t=600){let[n,r]=(0,_.useState)(`idle`),[i,a]=(0,_.useState)(null),o=(0,_.useRef)(new Map),s=(0,_.useRef)(void 0),c=(0,_.useRef)(e);c.current=e;let l=(0,_.useRef)(null),u=(0,_.useCallback)(async()=>{let e=[...o.current.values()];if(o.current.clear(),e.length===0)return;r(`saving`);let t=!1;for(let n of e)try{await c.current(n),a(new Date)}catch{let e=o.current.get(n.id);o.current.set(n.id,{...n,patch:{...n.patch,...e?.patch}}),t=!0}r(t?`error`:o.current.size>0?`saving`:`saved`)},[]),d=(0,_.useCallback)(()=>{window.clearTimeout(s.current);let e=l.current?l.current.then(u):u();return l.current=e,e.then(()=>{l.current===e&&(l.current=null)}),e.then(()=>o.current.size===0)},[u]),f=(0,_.useCallback)((e,n,i)=>{o.current.set(n,{slug:e,id:n,patch:{...o.current.get(n)?.patch,...i}}),r(`saving`),window.clearTimeout(s.current),s.current=window.setTimeout(()=>void d(),t)},[d,t]),p=(0,_.useCallback)(e=>{o.current.delete(e),o.current.size===0&&r(`idle`)},[]);return(0,_.useEffect)(()=>{let e=e=>{o.current.size!==0&&(d(),e.preventDefault())};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[d]),{state:n,savedAt:i,queue:f,flush:d,retry:d,discard:p}}var jg=e=>Math.min(1e3*2**e,15e3);function Mg({check:e,onBack:t,onChange:n}){let r=0,i,a=!1,o=!1,s=()=>n?.({attempt:r,checking:o}),c=()=>{i=setTimeout(()=>void l(),jg(r))};async function l(){if(a||o)return;clearTimeout(i),o=!0,s();let n=await e().then(()=>!0,()=>!1);if(o=!1,!a){if(n)return t();r++,s(),c()}}return c(),{retryNow:()=>void l(),stop:()=>{a=!0,clearTimeout(i)}}}function Ng(e,t,n){let[r,i]=(0,_.useState)({attempt:0,checking:!1}),a=(0,_.useRef)(null),o=(0,_.useRef)({check:t,onBack:n});return o.current={check:t,onBack:n},(0,_.useEffect)(()=>{if(!e)return;i({attempt:0,checking:!1});let t=Mg({check:()=>o.current.check(),onBack:()=>o.current.onBack(),onChange:i});return a.current=t,()=>{t.stop(),a.current=null}},[e]),{...r,retryNow:()=>a.current?.retryNow()}}var Pg=5e3,Fg=e=>e instanceof df&&e.code===`disk-conflict`;function Ig(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(null),[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)(0),y=(0,_.useRef)(new Map),b=(0,_.useCallback)(e=>{e.version&&y.current.set(e.id,e.version)},[]),x=(0,_.useRef)(null),[S,C]=(0,_.useState)(null),w=(0,_.useRef)(()=>{}),T=(0,_.useCallback)((e,t)=>{x.current={slug:e,id:t},C(t)},[]),E=(0,_.useRef)(new Map),D=(0,_.useRef)(void 0),ee=(0,_.useRef)(async()=>!0),te=(0,_.useCallback)(async()=>{if(window.clearTimeout(D.current),await ee.current())for(let[e,{slug:t,title:n}]of[...E.current]){E.current.delete(e);try{let r=await vf.updatePage(t,e,{title:n,fileName:`sync`},y.current.get(e));b(r),a(e=>e&&e.id===r.id?{...e,file:r.file}:e)}catch(r){E.current.set(e,{slug:t,title:n}),ff(r)?l(!0):Fg(r)&&T(t,e)}}},[b,T]),O=Ag(async e=>{let t=e.patch.title===void 0?e.patch:{...e.patch,fileName:`keep`};if(x.current?.id===e.id)throw T(e.slug,e.id),new df(`disk-conflict`,`disk-conflict`,{},409);let n=await vf.updatePage(e.slug,e.id,t,y.current.get(e.id)).catch(t=>{throw ff(t)?l(!0):Fg(t)&&T(e.slug,e.id),t});b(n),t.fileName&&(E.current.set(e.id,{slug:e.slug,title:n.title}),window.clearTimeout(D.current),D.current=window.setTimeout(()=>void te(),Pg)),a(e=>e&&e.id===n.id?{...e,file:n.file}:e)}),k=O.flush;ee.current=k;let A=(0,_.useCallback)(async()=>{let e=await k();return e&&await te(),e},[k,te]),ne=(0,_.useCallback)(async e=>{try{await e()}catch(e){ff(e)?l(!0):Fg(e)||Mh.error(W(e))}},[]),re=(0,_.useRef)(0),j=(0,_.useCallback)(async(e,t)=>{let n=++re.current,r=t?await vf.getPage(e,t):null;n===re.current&&(r&&b(r),a(r),d(null),yg({slug:e,pageId:t}))},[b]),M=(0,_.useCallback)(async e=>{let t=await vf.getManual(e);return r(t),t},[]),ie=(0,_.useCallback)(async(e,t=null)=>{try{await A(),h(!1),p(null);let n=await M(e),r=t?bg(n.pages,t)?.id:void 0;if(t&&!r){a(null),d({kind:`page`,address:`#/${e}/${t}`});return}await j(e,r??n.pages[0]?.id??null)}catch(t){if(ff(t))return l(!0);r(null),a(null),p({slug:e,error:t})}},[A,M,j]),ae=(0,_.useCallback)(async e=>{let{slug:t,pageId:n}=vg(),i=e.find(e=>e.slug===t);if(t&&!i){r(null),a(null),d({kind:`manual`,address:`#/${t}${n?`/${n}`:``}`});return}let o=i??e[0];o&&await ie(o.slug,i?n:null)},[ie]),oe=(0,_.useCallback)(async()=>{try{let e=await vf.listManuals();t(e),s(null),await ae(e)}catch(e){s(e)}},[ae]);(0,_.useEffect)(()=>{oe()},[oe]);let se=(0,_.useRef)(e);se.current=e,(0,_.useEffect)(()=>{let e=()=>se.current&&void ae(se.current);return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[ae]);let ce=c||e===null&&ff(o),le=Ng(ce,()=>vf.listManuals(),()=>{if(l(!1),e===null)return void oe();n||ae(e),A(),Mh.success(U(`A conexão com o Studio voltou.`))}),ue=e=>ne(async()=>{n&&e!==i?.id&&(await A(),await j(n.slug,e))}),de=e=>ne(async()=>{if(!n)return;await A();let t=await vf.addPage(n.slug,``,e);b(t),re.current++,await M(n.slug),a(t),d(null),yg({slug:n.slug,pageId:t.id})}),fe=(e,t,n)=>ne(async()=>{await vf.restorePage(e,t),await M(e),await j(e,n)});return w.current=e=>ne(async()=>{let t=x.current;t&&(e===`reload`?(await M(t.slug),await j(t.slug,t.id),O.discard(t.id),E.current.delete(t.id),x.current=null,C(null),v(e=>e+1)):(b(await vf.getPage(t.slug,t.id)),x.current=null,C(null),await A()))}),{manuals:e,manual:n,page:i,bootError:o,notFound:u,openError:f,serverDown:ce,reconnect:le,reload:oe,openFromLocation:ae,creatingManual:m,setCreatingManual:h,revision:g,diskConflict:i!==null&&S===i.id,resolveConflict:e=>w.current(e),flush:A,save:{state:S!==null&&O.state===`error`?`conflict`:O.state,savedAt:O.savedAt,retry:O.retry},openManual:ie,selectPage:ue,addPage:de,removePage:e=>ne(async()=>{if(!n)return;let t=n.slug;O.discard(e.id),E.current.delete(e.id);let{trashId:r}=await vf.removePage(t,e.id),a=await M(t);i&&!bg(a.pages,i.id)&&await j(t,a.pages[0]?.id??null);let o=Dg(e.children).length,s=e.title||U(`Sem título`);Mh(o?lf(o,`"{nome}" e {n} subpágina foram para a lixeira.`,`"{nome}" e {n} subpáginas foram para a lixeira.`,{nome:s}):U(`"{nome}" foi para a lixeira.`,{nome:s}),{duration:1e4,action:{label:U(`Desfazer`),onClick:()=>void fe(t,r,e.id)}})}),restorePage:fe,movePage:(e,t,r)=>ne(async()=>{n&&(await vf.movePage(n.slug,e,t,r),await M(n.slug))}),saveVersion:e=>ne(async()=>{n&&i&&(await A(),await vf.saveVersion(n.slug,i.id,e),Mh.success(U(`Versão guardada.`)))}),restoreVersion:e=>ne(async()=>{if(!n||!i)return;await A();let t=await vf.restoreVersion(n.slug,i.id,e);await M(n.slug),b(t),a(t),v(e=>e+1),Mh(U(`Versão restaurada. O texto que estava antes foi guardado como "Antes de restaurar".`))}),publishVersion:e=>ne(async()=>{n&&i&&(await vf.publishVersion(n.slug,i.id,e),await M(n.slug))}),exportManual:async(e,t)=>{if(!n)throw Error(U(`Abra um manual para exportar.`));return await A(),vf.exportManual(n.slug,e,t)},setManualTheme:async e=>{n&&(await vf.setTheme(n.slug,e),await M(n.slug))},uploadManualLogo:async e=>{n&&(await vf.uploadLogo(n.slug,e),await M(n.slug))},setPageStatus:e=>ne(async()=>{if(!n||!i)return;await A();let t;try{t=await vf.updatePage(n.slug,i.id,{status:e},y.current.get(i.id))}catch(t){throw Fg(t)&&O.queue(n.slug,i.id,{status:e}),t}b(t),a(e=>e&&e.id===t.id?{...e,status:t.status}:e),await M(n.slug)}),createManual:e=>ne(async()=>{let n=await vf.createManual(e,sf);t(await vf.listManuals()),await ie(n.slug)}),editPage:e=>{if(n&&i){if(e.title!==void 0){let t=e.title;r(e=>e&&{...e,pages:Cg(e.pages,i.id,t)})}O.queue(n.slug,i.id,e)}},reportError:e=>Mh.error(e)}}var Lg=(0,_.createContext)(null);function Rg({children:e}){return(0,R.jsx)(Lg,{value:Ig(),children:e})}function zg(){let e=(0,_.use)(Lg);if(!e)throw Error(`useStudioContext precisa estar dentro de <StudioProvider>.`);return e}function Bg({...e}){return(0,R.jsx)(Mu,{"data-slot":`dropdown-menu`,...e})}function Vg({...e}){return(0,R.jsx)(Pu,{"data-slot":`dropdown-menu-trigger`,...e})}function Hg({className:e,sideOffset:t=4,...n}){return(0,R.jsx)(Fu,{children:(0,R.jsx)(Lu,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:L(`z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...n})})}function Ug({className:e,inset:t,variant:n=`default`,...r}){return(0,R.jsx)(zu,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:L(`relative flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:cursor-default data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!`,e),...r})}function Wg({...e}){return(0,R.jsx)(Bu,{"data-slot":`dropdown-menu-radio-group`,...e})}function Gg({className:e,children:t,...n}){return(0,R.jsxs)(Vu,{"data-slot":`dropdown-menu-radio-item`,className:L(`relative flex cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:cursor-default data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n,children:[(0,R.jsx)(`span`,{className:`pointer-events-none absolute left-2 flex size-3.5 items-center justify-center`,children:(0,R.jsx)(Hu,{children:(0,R.jsx)(_p,{className:`size-2 fill-current`})})}),t]})}function Kg({className:e,inset:t,...n}){return(0,R.jsx)(Ru,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:L(`px-2 py-1.5 text-sm font-medium data-[inset]:pl-8`,e),...n})}function qg({className:e,...t}){return(0,R.jsx)(Uu,{"data-slot":`dropdown-menu-separator`,className:L(`-mx-1 my-1 h-px bg-border`,e),...t})}function Jg({className:e,...t}){return(0,R.jsx)(`span`,{"data-slot":`dropdown-menu-shortcut`,className:L(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}function Yg({...e}){return(0,R.jsx)(Wu,{"data-slot":`dropdown-menu-sub`,...e})}function Xg({className:e,inset:t,children:n,...r}){return(0,R.jsxs)(Gu,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":t,className:L(`flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,R.jsx)(lp,{className:`ml-auto size-4`})]})}function Zg({className:e,...t}){return(0,R.jsx)(Ku,{"data-slot":`dropdown-menu-sub-content`,className:L(`z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...t})}var Qg={id:`rascunho`,label:U(`Rascunho`),hint:U(`Ainda sendo escrita`),token:`grafite`},$g=[Qg,{id:`revisao`,label:U(`Em revisão`),hint:U(`Pronta para alguém conferir`),token:`cor-orange`},{id:`aprovado`,label:U(`Aprovado`),hint:U(`Conferida, pode ir para o manual`),token:`cor-green`},{id:`publicado`,label:U(`Publicado`),hint:U(`Já está no manual entregue`),token:`cobalto`}],e_=e=>$g.find(t=>t.id===e)??Qg;function t_({status:e,className:t}){return(0,R.jsx)(`span`,{className:L(`inline-block size-2 shrink-0 rounded-full`,e===`rascunho`?`border-[1.5px] border-current`:`bg-current`,t),"aria-hidden":!0})}function n_({status:e,className:t}){let n=e_(e);return(0,R.jsxs)(`span`,{className:L(`inline-flex shrink-0 items-center gap-1.5`,t),style:{color:`var(--${n.token})`},children:[(0,R.jsx)(t_,{status:e}),n.label]})}function r_({status:e,onChange:t}){return(0,R.jsxs)(Bg,{children:[(0,R.jsx)(Vg,{asChild:!0,children:(0,R.jsxs)(`button`,{type:`button`,"aria-label":U(`Status da página: {status}`,{status:e_(e).label}),className:`flex items-center gap-1.5 rounded-md px-2 py-1 text-sm font-medium [@media(pointer:coarse)]:min-h-11 hover:bg-muted data-[state=open]:bg-muted`,children:[(0,R.jsx)(n_,{status:e}),(0,R.jsx)(sp,{className:`size-3 text-muted-foreground`,"aria-hidden":!0})]})}),(0,R.jsxs)(Hg,{align:`end`,className:`w-64`,children:[(0,R.jsx)(Kg,{className:`text-xs text-muted-foreground`,children:U(`Etapa da página`)}),(0,R.jsx)(Wg,{value:e,onValueChange:e=>t(e),children:$g.map(e=>(0,R.jsx)(Gg,{value:e.id,className:`items-start`,children:(0,R.jsxs)(`span`,{className:`grid leading-tight`,children:[(0,R.jsx)(`span`,{className:`flex items-center gap-2`,children:(0,R.jsx)(n_,{status:e.id})}),(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.hint})]})},e.id))})]})]})}function i_({open:e,onOpenChange:t}){let n=zg(),[r,i]=(0,_.useState)(``),[a,o]=(0,_.useState)(0),s=kg(n.manual?.pages??[],r).slice(0,50),c=(0,_.useEffectEvent)(e=>{(e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`p`&&n.manual&&(e.preventDefault(),i(``),o(0),t(!0))});(0,_.useEffect)(()=>(window.addEventListener(`keydown`,c),()=>window.removeEventListener(`keydown`,c)),[]);let l=s[a]?.item.id;(0,_.useEffect)(()=>{l&&document.getElementById(`busca-${l}`)?.scrollIntoView({block:`nearest`})},[l]);let u=e=>{t(!1),n.selectPage(e)};return(0,R.jsx)(sg,{open:e,onOpenChange:t,children:(0,R.jsxs)(dg,{showCloseButton:!1,"aria-describedby":void 0,className:`top-[12vh] translate-y-0 gap-0 overflow-hidden p-0 sm:max-w-lg`,children:[(0,R.jsx)(mg,{className:`sr-only`,children:U(`Buscar página`)}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3`,children:[(0,R.jsx)(qm,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,R.jsx)(`input`,{autoFocus:!0,role:`combobox`,"aria-expanded":`true`,"aria-controls":`busca-resultados`,"aria-activedescendant":s[a]?`busca-${s[a].item.id}`:void 0,"aria-label":U(`Buscar página pelo título`),placeholder:U(`Buscar página pelo título…`),value:r,onChange:e=>{i(e.target.value),o(0)},onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:-1;o(e=>(e+t+s.length)%Math.max(s.length,1))}else if(e.key===`Enter`){e.preventDefault();let t=s[a];t&&u(t.item.id)}},className:`h-12 min-w-0 flex-1 bg-transparent text-[15px] outline-none placeholder:text-muted-foreground`})]}),(0,R.jsxs)(`div`,{id:`busca-resultados`,role:`listbox`,"aria-label":U(`Páginas encontradas`),className:`max-h-[50vh] overflow-y-auto p-1`,children:[s.length===0&&(0,R.jsx)(`p`,{className:`px-3 py-6 text-center text-sm text-muted-foreground`,children:U(`Nenhuma página com esse título.`)}),s.map((e,t)=>(0,R.jsxs)(`div`,{id:`busca-${e.item.id}`,role:`option`,tabIndex:-1,"aria-selected":t===a,onMouseMove:()=>o(t),onClick:()=>u(e.item.id),onKeyDown:()=>{},className:L(`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2`,t===a&&`bg-accent`),children:[e.number&&(0,R.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 font-mono text-xs tabular-nums text-primary`,children:e.number}),(0,R.jsxs)(`span`,{className:`grid min-w-0 flex-1 leading-tight`,children:[(0,R.jsx)(`span`,{className:`truncate text-sm font-bold`,children:e.item.title||U(`Sem título`)}),e.path.length>0&&(0,R.jsx)(`span`,{className:`flex min-w-0 items-center gap-1 truncate text-xs text-muted-foreground`,children:e.path.map((t,n)=>(0,R.jsxs)(`span`,{className:`flex items-center gap-1`,children:[n>0&&(0,R.jsx)(lp,{className:`size-3`,"aria-hidden":!0}),t]},e.path.slice(0,n+1).join(`/`)))})]}),e.item.status!==`rascunho`&&(0,R.jsx)(n_,{status:e.item.status,className:`text-xs font-medium`}),e.item.id===n.page?.id&&(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:U(`aberta`)})]},e.item.id))]})]})})}var a_=`explicai:barra-lateral`,o_=`(min-width: 56.25rem)`;function s_(){try{return localStorage.getItem(a_)===`recolhida`}catch{return!1}}function c_(){let[e,t]=(0,_.useState)(s_),[n,r]=(0,_.useState)(!1),i=e=>{try{localStorage.setItem(a_,e?`recolhida`:`aberta`)}catch{}t(e)},a=()=>window.matchMedia(o_).matches?i(!e):r(!n),o=(0,_.useEffectEvent)(e=>{(e.ctrlKey||e.metaKey)&&e.key===`\\`&&(e.preventDefault(),a())});return(0,_.useEffect)(()=>(window.addEventListener(`keydown`,o),()=>window.removeEventListener(`keydown`,o)),[]),{collapsed:e,drawerOpen:n,toggle:a,collapse:()=>i(!0),expand:()=>i(!1),setDrawerOpen:r}}function l_({manuals:e,current:t,onOpen:n,onCreate:r}){return(0,R.jsxs)(Bg,{children:[(0,R.jsx)(Vg,{asChild:!0,children:(0,R.jsxs)(`button`,{type:`button`,className:`group -mx-1 flex w-[calc(100%+0.5rem)] flex-col items-start gap-0.5 rounded-md px-1 py-1 text-left outline-none hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-muted`,children:[(0,R.jsx)(`span`,{className:`rotulo text-muted-foreground`,children:U(`Manual`)}),(0,R.jsxs)(`span`,{className:`flex w-full items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-display text-lg font-semibold leading-tight [font-stretch:105%]`,children:t?.title??U(`Escolha um manual`)}),(0,R.jsx)(dp,{className:`size-4 shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100 group-data-[state=open]:opacity-100 [@media(hover:none)]:opacity-100`,"aria-hidden":!0})]})]})}),(0,R.jsxs)(Hg,{align:`start`,className:`w-(--radix-dropdown-menu-trigger-width) min-w-56`,children:[(0,R.jsx)(Kg,{className:`text-muted-foreground`,children:U(`Manuais nesta pasta`)}),e.map(e=>(0,R.jsxs)(Ug,{onSelect:()=>n(e.slug),children:[(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),e.slug===t?.slug&&(0,R.jsx)(ap,{className:`text-primary`})]},e.slug)),(0,R.jsx)(qg,{}),(0,R.jsxs)(Ug,{onSelect:r,children:[(0,R.jsx)(Vm,{}),` `,U(`Novo manual`)]})]})]})}var u_=[{shift:`up`,label:U(`Para cima`),keys:`Alt+Shift+↑`,Icon:Yf},{shift:`down`,label:U(`Para baixo`),keys:`Alt+Shift+↓`,Icon:Uf},{shift:`indent`,label:U(`Para dentro da anterior`),keys:`Alt+Shift+→`,Icon:pm},{shift:`outdent`,label:U(`Para fora`),keys:`Alt+Shift+←`,Icon:dm}],d_=`grid size-7 place-items-center rounded-md text-muted-foreground hover:bg-secondary hover:text-foreground data-[state=open]:bg-secondary`;function f_({item:e,pages:t,selected:n,menuOpen:r,onMenuOpenChange:i,onAction:a}){let o=e.title||U(`Sem título`),s=Dg(e.children).length;return(0,R.jsxs)(`span`,{className:L(`flex opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100 has-[[data-state=open]]:opacity-100 pointer-coarse:opacity-100`,n&&`opacity-100`),children:[(0,R.jsxs)(Xh,{children:[(0,R.jsx)(Zh,{asChild:!0,children:(0,R.jsx)(`button`,{type:`button`,tabIndex:-1,className:d_,"aria-label":U(`Nova subpágina em {nome}`,{nome:o}),onClick:()=>a({kind:`addChild`}),children:(0,R.jsx)(Vm,{className:`size-4`})})}),(0,R.jsx)(Qh,{children:U(`Nova subpágina`)})]}),(0,R.jsxs)(Bg,{open:r,onOpenChange:i,children:[(0,R.jsx)(Vg,{asChild:!0,children:(0,R.jsx)(`button`,{type:`button`,tabIndex:-1,className:d_,"aria-label":U(`Mais ações para {nome}`,{nome:o}),children:(0,R.jsx)(Tp,{className:`size-4`})})}),(0,R.jsxs)(Hg,{align:`start`,className:`w-64`,children:[(0,R.jsxs)(Ug,{onSelect:()=>a({kind:`addChild`}),children:[(0,R.jsx)(Vm,{}),` `,U(`Nova subpágina`)]}),(0,R.jsxs)(Yg,{children:[(0,R.jsxs)(Xg,{children:[(0,R.jsx)(km,{className:`size-4 text-muted-foreground`}),` `,U(`Mover`)]}),(0,R.jsx)(Zg,{className:`w-64`,children:u_.map(({shift:n,label:r,keys:i,Icon:o})=>(0,R.jsxs)(Ug,{disabled:!Tg(t,e.id,n),onSelect:()=>a({kind:`shift`,shift:n}),children:[(0,R.jsx)(o,{}),` `,r,(0,R.jsx)(Jg,{children:i})]},n))})]}),(0,R.jsx)(qg,{}),(0,R.jsxs)(Ug,{variant:`destructive`,onSelect:()=>a({kind:`remove`}),children:[(0,R.jsx)(ah,{}),` `,s?lf(s,`Excluir página e {n} subpágina`,`Excluir página e {n} subpáginas`):U(`Excluir página`)]})]})]})]})}var p_={ArrowUp:`up`,ArrowDown:`down`,ArrowRight:`indent`,ArrowLeft:`outdent`};function m_(e,t,n){let r=(0,_.useRef)(null),i=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let t=i.current;t&&e!==void 0&&(i.current=null,r.current?.querySelector(`[data-page-id="${CSS.escape(t)}"]`)?.focus())},[e]),{onKeyDown:e=>{let r=e.target,a=r.dataset.pageId;if(!a)return;let o=p_[e.key];if(e.altKey&&e.shiftKey&&o){e.preventDefault(),i.current=a,t(a,o);return}if(e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`){e.preventDefault(),n(a);return}let s=Array.from(e.currentTarget.querySelectorAll(`[data-page-id]`)),c=s.indexOf(r),l=e.key===`ArrowDown`?c+1:e.key===`ArrowUp`?c-1:e.key===`Home`?0:e.key===`End`?s.length-1:null,u=l===null?void 0:s[l];u&&(e.preventDefault(),u.focus())},root:r}}var h_=`text/x-explicai-page`;function g_(e){let t=e.currentTarget.getBoundingClientRect(),n=(e.clientY-t.top)/t.height;return n<.3?`before`:n>.7?`after`:`inside`}function __({pages:e,selectedId:t,onSelect:n,onAction:r,onMove:i}){let[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(null),{onKeyDown:l,root:u}=m_(e,(t,n)=>{let i=bg(e,t);i&&r(i,{kind:`shift`,shift:n})},c),d=t&&bg(e,t)?t:e[0]?.id,f=Og(e),p=(t,n,r)=>{o(null);let a=wg(e,r,t,n);a&&i(r,a.parentId,a.index)},m=(i,h)=>(0,R.jsx)(`ul`,{ref:h===0?u:void 0,className:L(h>0&&`ml-3 border-l border-border pl-1`),onKeyDown:h===0?l:void 0,children:i.map(i=>{let l=a?.id===i.id?a.zone:null,u=i.id===t;return(0,R.jsxs)(`li`,{children:[(0,R.jsxs)(`div`,{className:L(`group relative flex items-center rounded-md pr-1 transition-colors hover:bg-muted`,l===`inside`&&`outline-2 -outline-offset-2 outline-dashed outline-primary`,l===`before`&&`before:absolute before:inset-x-2 before:-top-px before:h-0.5 before:bg-primary`,l===`after`&&`after:absolute after:inset-x-2 after:-bottom-px after:h-0.5 after:bg-primary`),draggable:!0,onDragStart:e=>{e.dataTransfer.setData(h_,i.id),e.dataTransfer.effectAllowed=`move`},onDragOver:e=>{e.dataTransfer.types.includes(h_)&&(e.preventDefault(),o({id:i.id,zone:g_(e)}))},onDragLeave:()=>o(e=>e?.id===i.id?null:e),onDrop:e=>{e.preventDefault();let t=e.dataTransfer.getData(h_);t&&l&&p(i.id,l,t)},children:[(0,R.jsxs)(`button`,{type:`button`,"data-page-id":i.id,tabIndex:i.id===d?0:-1,"aria-current":u?`page`:void 0,onClick:()=>n(i.id),className:`flex min-w-0 flex-1 items-center py-1.5 pl-2 text-left text-[14.5px]`,children:[f.get(i.id)&&(0,R.jsx)(`span`,{"aria-hidden":!0,className:`mr-1.5 inline-block shrink-0 font-mono text-xs tabular-nums text-primary`,children:f.get(i.id)}),(0,R.jsx)(`span`,{title:i.title||(i.problem?i.file.split(`/`).pop():U(`Sem título`)),className:L(`min-w-0 truncate`,u?`bg-[linear-gradient(transparent_50%,var(--marca-faixa)_50%)] font-bold text-foreground`:`text-foreground/85`,!i.title&&`italic text-muted-foreground`),children:i.title||(i.problem?i.file.split(`/`).pop():U(`Sem título`))}),i.status!==`rascunho`&&(0,R.jsx)(n_,{status:i.status,className:`ml-2 text-xs font-medium`}),i.problem&&(0,R.jsxs)(`span`,{title:i.problem,className:`ml-1.5 inline-flex align-[-2px] text-destructive`,children:[(0,R.jsx)(sh,{className:`size-3.5`,"aria-hidden":!0}),(0,R.jsx)(`span`,{className:`sr-only`,children:i.problem})]})]}),(0,R.jsx)(f_,{item:i,pages:e,selected:u,menuOpen:s===i.id,onMenuOpenChange:e=>c(e?i.id:null),onAction:e=>r(i,e)})]}),i.children.length>0&&m(i.children,h+1)]},i.id)})});return m(e,0)}var v_=[{title:`Escrevendo`,keys:[[`/`,`Inserir bloco: título, passos, imagem, tabela…`],[`Ctrl+B`,`Negrito`],[`Ctrl+I`,`Itálico`],[`Ctrl+E`,`Código no texto`],[`Ctrl+K`,`Link para outra página ou endereço`],[`Ctrl+Z`,`Desfazer`],[`Enter no título`,`Ir para o texto da página`]]},{title:`Páginas`,keys:[[`Ctrl+P`,`Buscar página pelo título`],[`Ctrl+\\`,`Mostrar ou esconder as páginas`],[`↑ ↓`,`Andar entre as páginas da árvore`],[`Alt+Shift+↑ ↓`,`Mover a página para cima ou para baixo`],[`Alt+Shift+→ ←`,`Virar subpágina ou subir um nível`],[`Shift+F10`,`Abrir o menu da página`]]},{title:`Marcando imagens`,keys:[[`V`,`Ferramenta Selecionar`],[`M`,`Ferramenta Marcador`],[`D`,`Ferramenta Destaque`],[`S`,`Ferramenta Seta`],[`A`,`Ferramenta Área clicável`],[`O`,`Ferramenta Ocultar`],[`R`,`Ferramenta Recortar`],[`Delete`,`Excluir a marcação selecionada`]]}];function y_({open:e,onOpenChange:t}){return(0,R.jsx)(sg,{open:e,onOpenChange:t,children:(0,R.jsxs)(dg,{className:`max-h-[90vh] overflow-y-auto sm:max-w-md`,children:[(0,R.jsxs)(fg,{children:[(0,R.jsx)(mg,{className:`font-display text-xl font-extrabold tracking-tight`,children:U(`Atalhos de teclado`)}),(0,R.jsx)(hg,{children:U(`No Mac, use Cmd no lugar de Ctrl.`)})]}),v_.map(e=>(0,R.jsxs)(`section`,{className:`grid gap-1.5`,children:[(0,R.jsx)(`h3`,{className:`rotulo`,children:U(e.title)}),(0,R.jsx)(`dl`,{className:`grid grid-cols-[9.5rem_1fr] gap-x-4 gap-y-1.5 text-sm`,children:e.keys.map(([e,t])=>(0,R.jsxs)(`div`,{className:`contents`,children:[(0,R.jsx)(`dt`,{children:(0,R.jsx)(`kbd`,{className:`rounded-sm border border-border bg-card px-1.5 py-0.5 font-mono text-xs whitespace-nowrap`,children:U(e)})}),(0,R.jsx)(`dd`,{className:`text-muted-foreground`,children:U(t)})]},e))})]},e.title))]})})}var b_=new Intl.RelativeTimeFormat(sf,{numeric:`auto`});function x_(e){let t=Math.round((Date.parse(e)-Date.now())/6e4);if(t===0)return U(`agora há pouco`);if(Math.abs(t)<60)return b_.format(t,`minute`);let n=Math.round(t/60);return Math.abs(n)<24?b_.format(n,`hour`):b_.format(Math.round(n/24),`day`)}function S_({slug:e,open:t,onOpenChange:n,onRestore:r,flush:i}){let[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(null),l=()=>{o(null),c(null),vf.listTrash(e).then(o,e=>c(W(e)))},u=()=>i().then(t=>{if(!t)throw Error(U(`Há alterações sem salvar. Salve antes de limpar as imagens.`));return vf.cleanUnusedAssets(e)}).then(({moved:e,folder:t})=>{Mh(e===0?U(`Nenhuma imagem sem uso.`):lf(e,`{n} arquivo foi para {pasta}.`,`{n} arquivos foram para {pasta}.`,{pasta:t??``}))},e=>c(W(e)));return(0,_.useEffect)(()=>{t&&l()},[t]),(0,R.jsx)(sg,{open:t,onOpenChange:n,children:(0,R.jsxs)(dg,{className:`gap-2 p-4 sm:max-w-sm`,"aria-describedby":void 0,children:[(0,R.jsx)(mg,{className:`px-2 pt-1 pb-2 text-sm font-bold`,children:U(`Lixeira deste manual`)}),s&&(0,R.jsx)(`p`,{className:`px-2 pb-2 text-sm text-destructive`,children:s}),!s&&a===null&&(0,R.jsx)(`p`,{className:`px-2 pb-2 text-sm text-muted-foreground`,children:U(`Carregando…`)}),a?.length===0&&(0,R.jsx)(`p`,{className:`px-2 pb-2 text-sm text-muted-foreground`,children:U(`Nenhuma página excluída.`)}),a&&a.length>0&&(0,R.jsx)(`ul`,{className:`grid gap-0.5`,children:a.map(e=>(0,R.jsxs)(`li`,{className:`flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-muted`,children:[(0,R.jsxs)(`span`,{className:`grid min-w-0 flex-1 leading-tight`,children:[(0,R.jsx)(`span`,{className:`truncate text-sm`,children:e.title||U(`Sem título`)}),(0,R.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[e.pages>1?`${U(`{n} páginas`,{n:e.pages})} · `:``,U(`excluída {quando}`,{quando:x_(e.deletedAt)})]})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void r(e.trashId,e.pageId).then(()=>n(!1)),className:`flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-sm font-bold text-primary hover:bg-accent`,children:[(0,R.jsx)(Gm,{className:`size-3.5`,"aria-hidden":!0}),` `,U(`Restaurar`)]})]},e.trashId))}),(0,R.jsxs)(`div`,{className:`mx-2 mt-2 grid gap-1 rounded-md border border-border p-2 text-sm`,children:[(0,R.jsx)(`p`,{children:U(`Imagens que nenhuma página usa, contando versões e lixeira, vão para a lixeira.`)}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void u(),className:`flex w-fit items-center gap-1 rounded-md px-2 py-1 font-bold text-primary hover:bg-accent`,children:[(0,R.jsx)(Yp,{className:`size-3.5`,"aria-hidden":!0}),` `,U(`Mover para a lixeira`)]})]}),(0,R.jsx)(`p`,{className:`px-2 pt-2 text-xs text-muted-foreground`,children:U(`As páginas excluídas ficam na pasta .lixeira do manual até você restaurar ou apagar.`)})]})})}var C_=`explicai:aparencia`,w_={mode:`system`},T_=()=>window.matchMedia(`(prefers-color-scheme: dark)`).matches;function E_(){try{let e=JSON.parse(localStorage.getItem(C_)??`{}`);return{mode:e.mode===`light`||e.mode===`dark`?e.mode:w_.mode}}catch{return w_}}function D_({mode:e}){let t=document.documentElement;t.dataset.theme=e===`dark`||e===`system`&&T_()?`dark`:`light`}function O_(e){try{localStorage.setItem(C_,JSON.stringify(e))}catch{}D_(e)}function k_(){window.matchMedia(`(prefers-color-scheme: dark)`).addEventListener(`change`,()=>D_(E_()))}function A_(){return(0,_.useSyncExternalStore)(e=>{let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]}),()=>t.disconnect()},()=>document.documentElement.dataset.theme===`dark`?`dark`:`light`)}var j_=[{id:`light`,label:U(`Claro`),Icon:th},{id:`dark`,label:U(`Escuro`),Icon:Tm},{id:`system`,label:U(`Sistema`),Icon:Cm}];function M_({open:e,onOpenChange:t}){let n=(0,_.useRef)(null),[r,i]=(0,_.useState)(E_),a=e=>{let t={...E_(),...e};O_(t),i(t)};return(0,R.jsx)(sg,{open:e,onOpenChange:t,children:(0,R.jsxs)(dg,{className:`gap-4 p-4 sm:max-w-xs`,"aria-describedby":void 0,onOpenAutoFocus:e=>{e.preventDefault(),(n.current?.querySelector(`[aria-pressed=true]`)??n.current?.querySelector(`button`))?.focus()},children:[(0,R.jsx)(mg,{className:`font-display text-lg font-extrabold tracking-tight`,children:U(`Aparência`)}),(0,R.jsxs)(`fieldset`,{children:[(0,R.jsx)(`legend`,{className:`mb-2 rotulo`,children:U(`Tema`)}),(0,R.jsx)(`div`,{ref:n,className:`grid grid-cols-3 gap-1 rounded-md bg-muted p-1`,children:j_.map(({id:e,label:t,Icon:n})=>(0,R.jsxs)(`button`,{type:`button`,"aria-pressed":r.mode===e,onClick:()=>a({mode:e}),className:`flex flex-col items-center gap-1 rounded-sm min-h-11 py-1.5 text-xs text-muted-foreground hover:text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-muted aria-pressed:bg-primary aria-pressed:font-bold aria-pressed:text-primary-foreground`,children:[(0,R.jsx)(n,{className:`size-4`,"aria-hidden":!0}),` `,t]},e))})]}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:U(`Muda só o Studio, neste navegador. A cor do manual fica em Exportar manual.`)})]})})}var N_=[{id:`pt-BR`,label:`Português`},{id:`en`,label:`English`}];function P_({open:e,onOpenChange:t}){return(0,R.jsx)(sg,{open:e,onOpenChange:t,children:(0,R.jsxs)(dg,{className:`gap-4 p-4 sm:max-w-xs`,"aria-describedby":void 0,children:[(0,R.jsx)(mg,{className:`font-display text-lg font-extrabold tracking-tight`,children:U(`Idioma`)}),(0,R.jsx)(`fieldset`,{"aria-label":U(`Idioma da interface`),className:`grid grid-cols-2 gap-1 rounded-md bg-muted p-1`,children:N_.map(({id:e,label:t})=>(0,R.jsx)(`button`,{type:`button`,lang:e,"aria-pressed":of===e,onClick:()=>of!==e&&cf(e),className:`rounded-sm min-h-11 py-1.5 text-xs text-muted-foreground hover:text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-muted aria-pressed:bg-primary aria-pressed:font-bold aria-pressed:text-primary-foreground`,children:t},e))}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:U(`Muda só o Studio, neste navegador.`)})]})})}var F_=`group/item [@media(pointer:coarse)]:min-h-11`,I_=`size-3.5 text-muted-foreground group-data-[highlighted]/item:text-foreground`,L_={light:`Claro`,dark:`Escuro`,system:`Sistema`};function R_(){let{manual:e,restorePage:t,flush:n}=zg(),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(()=>E_().mode),s=e=>({open:r===e,onOpenChange:t=>i(t?e:null)});return(0,R.jsxs)(`div`,{className:`sticky bottom-0 z-10 -mx-3 mt-auto flex h-(--rodape-h) shrink-0 flex-col justify-center border-t border-border bg-card px-3`,children:[(0,R.jsxs)(Bg,{onOpenChange:e=>e&&o(E_().mode),children:[(0,R.jsx)(Vg,{asChild:!0,children:(0,R.jsxs)(`button`,{type:`button`,className:`flex w-full cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-muted-foreground hover:bg-muted hover:text-foreground data-[state=open]:bg-muted [@media(pointer:coarse)]:min-h-11`,children:[(0,R.jsx)(Zm,{className:`size-3.5`,"aria-hidden":!0}),` `,U(`Ajustes`)]})}),(0,R.jsxs)(Hg,{side:`top`,align:`start`,className:`w-(--radix-dropdown-menu-trigger-width)`,children:[e&&(0,R.jsxs)(Ug,{className:F_,onSelect:()=>i(`trash`),children:[(0,R.jsx)(ah,{className:I_,"aria-hidden":!0}),` `,U(`Lixeira`)]}),(0,R.jsxs)(Ug,{className:F_,onSelect:()=>i(`appearance`),children:[(0,R.jsx)($m,{className:I_,"aria-hidden":!0}),` `,U(`Aparência`),(0,R.jsx)(`span`,{className:`ml-auto font-mono text-[11px] text-muted-foreground`,children:U(L_[a])})]}),(0,R.jsxs)(Ug,{className:F_,onSelect:()=>i(`language`),children:[(0,R.jsx)(am,{className:I_,"aria-hidden":!0}),` `,U(`Idioma`),(0,R.jsx)(`span`,{className:`ml-auto font-mono text-[11px] text-muted-foreground`,children:N_.find(e=>e.id===of)?.label})]}),(0,R.jsxs)(Ug,{className:F_,onSelect:()=>i(`shortcuts`),children:[(0,R.jsx)(rm,{className:I_,"aria-hidden":!0}),` `,U(`Atalhos`)]})]})]}),e&&(0,R.jsx)(S_,{slug:e.slug,flush:n,...s(`trash`),onRestore:(n,r)=>t(e.slug,n,r)}),(0,R.jsx)(M_,{...s(`appearance`)}),(0,R.jsx)(P_,{...s(`language`)}),(0,R.jsx)(y_,{...s(`shortcuts`)})]})}function z_({onCollapse:e,onNavigate:t,onSearch:n}){let r=zg(),{manuals:i,manual:a,page:o}=r,s=i?.find(e=>e.slug===a?.slug)??null;return(0,R.jsxs)(`aside`,{className:`flex h-full flex-col gap-5 overflow-y-auto border-r border-border bg-card px-3 pt-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsx)(tf,{}),(0,R.jsx)(`button`,{type:`button`,onClick:e,"aria-label":U(`Esconder as páginas ({atalho})`,{atalho:`Ctrl+\\`}),title:U(`Esconder as páginas ({atalho})`,{atalho:`Ctrl+\\`}),className:`grid size-8 place-items-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,R.jsx)(Nm,{className:`size-4`,"aria-hidden":!0})})]}),i&&i.length>0&&(0,R.jsx)(l_,{manuals:i,current:s,onOpen:e=>void r.openManual(e),onCreate:()=>r.setCreatingManual(!0)}),a&&(0,R.jsxs)(`nav`,{"aria-label":U(`Páginas do manual`),className:`grid grid-cols-1 gap-1`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:n,className:`mb-1 flex items-center gap-2 rounded-md px-2 py-1.5 text-sm text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,R.jsx)(qm,{className:`size-3.5`,"aria-hidden":!0}),` `,U(`Buscar página`),(0,R.jsx)(`kbd`,{className:`ml-auto font-mono text-[11px] text-muted-foreground`,children:`Ctrl+P`})]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between px-2 text-[13px] text-muted-foreground`,children:[(0,R.jsx)(`span`,{className:`rotulo`,children:U(`Páginas`)}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{t?.(),r.addPage(null)},className:`flex items-center gap-1 rounded-md px-1.5 py-1 font-bold text-primary hover:bg-accent`,children:[(0,R.jsx)(Vm,{className:`size-3.5`,"aria-hidden":!0}),` `,U(`Nova página`)]})]}),a.pages.length===0?(0,R.jsx)(`p`,{className:`px-2 text-sm text-muted-foreground`,children:U(`Nenhuma página ainda.`)}):(0,R.jsx)(__,{pages:a.pages,selectedId:o?.id??null,onSelect:e=>{t?.(),r.selectPage(e)},onAction:(e,n)=>{if(n.kind===`addChild`){t?.(),r.addPage(e.id);return}if(n.kind===`remove`)return void r.removePage(e);let i=a&&Tg(a.pages,e.id,n.shift);i&&r.movePage(e.id,i.parentId,i.index)},onMove:(e,t,n)=>void r.movePage(e,t,n)})]}),(0,R.jsx)(R_,{})]})}var B_=`Ctrl+\\`;function V_({sidebar:e,onSearch:t}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`hidden h-full shrink-0 split:block`,children:e.collapsed?(0,R.jsxs)(`div`,{className:`flex h-full w-12 flex-col items-center border-r border-border bg-card pt-4`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:e.expand,"aria-label":U(`Mostrar as páginas ({atalho})`,{atalho:B_}),title:U(`Mostrar as páginas ({atalho})`,{atalho:B_}),className:`grid size-8 place-items-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,R.jsx)(Fm,{className:`size-4`,"aria-hidden":!0})}),(0,R.jsx)(`div`,{"aria-hidden":!0,className:`mt-auto h-(--rodape-h) w-full shrink-0 border-t border-border`})]}):(0,R.jsx)(`div`,{className:`h-full w-56 lg:w-[17.5rem]`,children:(0,R.jsx)(z_,{onCollapse:e.collapse,onSearch:t})})}),(0,R.jsx)(sg,{open:e.drawerOpen,onOpenChange:e.setDrawerOpen,children:(0,R.jsxs)(dg,{showCloseButton:!1,"aria-describedby":void 0,className:`top-0 left-0 h-full w-[min(17.5rem,85vw)] max-w-none translate-x-0 translate-y-0 gap-0 rounded-none border-0 p-0 sm:max-w-none split:hidden data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left`,children:[(0,R.jsx)(mg,{className:`sr-only`,children:U(`Páginas do manual`)}),(0,R.jsx)(z_,{onCollapse:()=>e.setDrawerOpen(!1),onNavigate:()=>e.setDrawerOpen(!1),onSearch:()=>{e.setDrawerOpen(!1),t()}})]})})]})}function H_({title:e,onOpen:t,drawerOpen:n=!1}){return(0,R.jsxs)(`div`,{className:`flex h-12 shrink-0 items-center gap-2 border-b border-border bg-card px-3 split:hidden`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:t,"aria-label":U(`Mostrar as páginas ({atalho})`,{atalho:B_}),className:`flex items-center gap-2 rounded-md px-2 py-1.5 text-sm font-bold hover:bg-muted`,children:[(0,R.jsx)(Fm,{className:`size-4`,"aria-hidden":!0}),` `,U(`Páginas`)]}),(0,R.jsx)(`div`,{"aria-hidden":n||void 0,className:`contents`,children:(0,R.jsx)(tf,{})}),(0,R.jsx)(`span`,{className:`truncate text-sm text-muted-foreground`,children:e})]})}var U_=Object.defineProperty,W_=(e,t)=>{let n={};for(var r in e)U_(n,r,{get:e[r],enumerable:!0});return t||U_(n,Symbol.toStringTag,{value:`Module`}),n};function G_(e){this.content=e}G_.prototype={constructor:G_,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new G_(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new G_(n)},addToStart:function(e,t){return new G_([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new G_(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new G_(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=G_.from(e),e.size?new G_(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=G_.from(e),e.size?new G_(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=G_.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},G_.from=function(e){if(e instanceof G_)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new G_(t)};function K_(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a)n+=i.nodeSize;else{if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&Y_(e.charCodeAt(r-1))&&J_(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=K_(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}}function q_(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s)n-=c,r-=c;else{if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&Y_(e.charCodeAt(i-1))&&J_(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=q_(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}}function J_(e){return e>=56320&&e<57344}function Y_(e){return e>=55296&&e<56320}var K=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))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 t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return K_(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return q_(this,e,t,n)}findIndex(e){if(e==0)return Z_(0,e);if(e==this.size)return Z_(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?Z_(t+1,i):Z_(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};K.empty=new K([],0);var X_={index:0,offset:0};function Z_(e,t){return X_.index=e,X_.offset=t,X_}function Q_(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Q_(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Q_(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var $_=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else!n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Q_(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);return n.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};$_.none=[];var ev=class extends Error{},q=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=nv(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(tv(this.content,t+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(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(K.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};q.empty=new q(K.empty,0,0);function tv(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(tv(a.content,t-i-1,n-i-1)))}function nv(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=nv(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function rv(e,t,n){if(n.openStart>e.depth)throw new ev(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new ev(`Inconsistent open depths`);return iv(e,t,n,0)}function iv(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=iv(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}if(!n.content.size)return lv(a,dv(e,t,r));if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return lv(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}{let{start:i,end:o}=fv(n,e);return lv(a,uv(e,i,o,t,r))}}function av(e,t){if(!t.type.compatibleContent(e.type))throw new ev(`Cannot join `+t.type.name+` onto `+e.type.name)}function ov(e,t,n){let r=e.node(n);return av(r,t.node(n)),r}function sv(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function cv(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(sv(e.nodeAfter,r),a++));for(let e=a;e<o;e++)sv(i.child(e),r);t&&t.depth==n&&t.textOffset&&sv(t.nodeBefore,r)}function lv(e,t){if(!e.type.validContent(t))throw new ev(`Invalid content for node `+e.type.name);return e.copy(t)}function uv(e,t,n,r,i){let a=e.depth>i&&ov(e,t,i+1),o=r.depth>i&&ov(n,r,i+1),s=[];return cv(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(av(a,o),sv(lv(a,uv(e,t,n,r,i+1)),s)):(a&&sv(lv(a,dv(e,t,i+1)),s),cv(t,n,i,s),o&&sv(lv(o,dv(n,r,i+1)),s)),cv(r,null,i,s),new K(s)}function dv(e,t,n){let r=[];return cv(null,e,n,r),e.depth>n&&sv(lv(ov(e,t,n+1),dv(e,t,n+1)),r),cv(t,null,n,r),new K(r)}function fv(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(K.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var pv=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.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 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 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,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return $_.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive!==!1||r&&i[a].isInSet(r.marks)||(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive!==!1||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new _v(this,e,n);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 t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=gv.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else gv.set(t,r=new mv);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%hv,i}},mv=class{constructor(){this.elts=[],this.i=0}},hv=12,gv=new WeakMap,_v=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}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)}},vv=Object.create(null),yv=class e{constructor(e,t,n,r=$_.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||K.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,t,n,r=0){this.content.nodesBetween(e,t,n,r,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,t,n,r){return this.content.textBetween(e,t,n,r)}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,t,n){return this.type==e&&Q_(this.attrs,t||e.defaultAttrs||vv)&&$_.sameSet(this.marks,n||$_.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return q.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new q(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return rv(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return pv.resolveCached(this,e)}resolveNoCache(e){return pv.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}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()+`)`),xv(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=K.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.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),Sv(this.type.attrs,this.attrs,`node`,this.type.name);let e=$_.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];Sv(n.type.attrs,n.attrs,`mark`,n.type.name),e=n.addToSet(e)}if(!$_.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t 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(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=K.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,r,n)}};yv.prototype.text=void 0;var bv=class e extends yv{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):xv(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function xv(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}function Sv(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}var Cv=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new wv(t,n);if(r.next==null)return e.empty;let i=Tv(r);r.next&&r.err(`Unexpected trailing text`);let a=Fv(Mv(i));return Iv(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}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:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return K.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];a.isLeaf||a.hasRequiredAttrs()||a.name in t||r.type&&!o.validEnd||(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
|
|
50
|
+
`)}};Cv.empty=new Cv(!0);var wv=class{constructor(e,t){this.string=e,this.nodeTypes=t,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 SyntaxError(e+` (in content expression '`+this.string+`')`)}};function Tv(e){let t=[];do t.push(Ev(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function Ev(e){let t=[];do t.push(Dv(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function Dv(e){let t=jv(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=kv(e,t);else break;return t}function Ov(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function kv(e,t){let n=Ov(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:Ov(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function Av(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function jv(e){if(e.eat(`(`)){let t=Tv(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=Av(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function Mv(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function Nv(e,t){return t-e}function Pv(e,t){let n=[];return r(t),n.sort(Nv);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function Fv(e){let t=Object.create(null);return n(Pv(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);Pv(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new Cv(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(Nv);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function Iv(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function Lv(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function Rv(e,t){let n=Object.create(null);for(let r in e){let i=e[r],a=t&&t[r];if(a===void 0){if(i.hasDefault)a=i.default;else throw RangeError(`No value supplied for attribute `+r)}else i.validate&&i.validate(a);n[r]=a}return n}function zv(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new Hv(e,r,t[r]);return n}var Bv=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=zv(e,n.attrs),this.defaultAttrs=Lv(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Cv.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:Rv(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new yv(this,this.computeAttrs(e),K.from(t),$_.setFrom(n))}createChecked(e=null,t,n){return t=K.from(t),this.checkContent(t),new yv(this,this.computeAttrs(e),t,$_.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=K.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(K.empty,!0);return i?new yv(this,e,t.append(i),$_.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:$_.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function Vv(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var Hv=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?Vv(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},Uv=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=zv(e,r.attrs),this.excluded=null;let i=Lv(this.attrs);this.instance=i?new $_(this,i):null}create(e=null){return!e&&this.instance?this.instance:new $_(this,Rv(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}excludes(e){return this.excluded.indexOf(e)>-1}},Wv=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=G_.from(e.nodes),t.marks=G_.from(e.marks||{}),this.nodes=Bv.compile(this.spec.nodes,this),this.marks=Uv.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=Cv.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?Gv(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:Gv(this,n.split(` `))}this.nodeFromJSON=e=>yv.fromJSON(this,e),this.markFromJSON=e=>$_.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof Bv))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new bv(n,n.defaultAttrs,e,$_.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function Gv(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function Kv(e){return e.tag!=null}function qv(e){return e.style!=null}var Jv=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(Kv(e))this.tags.push(e);else if(qv(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new ry(this,t,!1);return n.addAll(e,$_.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new ry(this,t,!0);return n.addAll(e,$_.none,t.from,t.to),q.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(ay(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=oy(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=oy(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},Yv={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},Xv={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Zv={ol:!0,ul:!0},Qv=1,$v=2,ey=4;function ty(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?Qv:0)|(t===`full`?$v:0)}var ny=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=$_.none,this.match=i||(a&ey?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(K.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Qv)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=K.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(K.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Yv.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},ry=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=ty(null,t.preserveWhitespace,0)|(n?ey:0);i=r?new ny(r.type,r.attrs,$_.none,!0,t.topMatch||r.type.contentMatch,a):n?new ny(null,null,$_.none,!0,null,a):new ny(e.schema.topNodeType,null,$_.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&$v?`full`:this.localPreserveWS||(r.options&Qv)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
|
|
51
|
+
`);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;Zv.hasOwnProperty(a)&&this.parser.normalizeLists&&iy(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:Xv.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(Yv.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
52
|
+
`),t)}ignoreFallback(e,t){e.nodeName!=`BR`||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node){if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=$_.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):sy(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=ty(e,i,a.options);a.options&ey&&a.content.length==0&&(o|=ey);let s=$_.none;return n=n.filter(t=>!(a.type?a.type.allowsMarkType(t.type):sy(t.type,e))||(s=t.addToSet(s),!1)),this.nodes.push(new ny(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].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 t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=Qv);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function iy(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&Zv.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function ay(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function oy(e){let t={};for(let n in e)t[n]=e[n];return t}function sy(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var cy=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=uy(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name])a++;else{if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return uy(t).createTextNode(e.text);let{dom:n,contentDOM:r}=my(uy(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&my(uy(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t==`string`?{dom:e.createTextNode(t)}:my(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=ly(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return ly(e.marks)}};function ly(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function uy(e){return e.document||window.document}var dy=new WeakMap;function fy(e){let t=dy.get(e);return t===void 0&&dy.set(e,t=py(e)),t}function py(e){let t=null;function n(e){if(e&&typeof e==`object`){if(Array.isArray(e)){if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t])}else for(let t in e)n(e[t])}}return n(e),t}function my(e,t,n,r){if(t.nodeType==1)return{dom:t};if(t.dom&&t.dom.nodeType==1)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=fy(r))&&a.indexOf(t)>-1)throw 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 s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}if(typeof a==`string`)c.appendChild(e.createTextNode(a));else{let{dom:t,contentDOM:i}=my(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var hy=65535,gy=2**16;function _y(e,t){return e+t*gy}function vy(e){return e&hy}function yy(e){return(e-(e&hy))/gy}var by=1,xy=2,Sy=4,Cy=8,wy=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&Cy)>0}get deletedBefore(){return(this.delInfo&5)>0}get deletedAfter(){return(this.delInfo&6)>0}get deletedAcross(){return(this.delInfo&Sy)>0}},Ty=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=vy(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+yy(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:_y(o/3,e-s),f=0;return c&&(f|=e==s?xy:e==u?by:Sy,(t<0?e!=s:e!=u)&&(f|=Cy)),new wy(a,f,d)}r+=l-c}return n?e+r:new wy(e+r,0,null)}touches(e,t){let n=0,r=vy(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};Ty.empty=new Ty([]);var Ey=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||=[],this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new wy(e,r,null)}},Dy=Object.create(null),Oy=class{getMap(){return Ty.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=Dy[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Dy)throw RangeError(`Duplicate use of step JSON ID `+e);return Dy[e]=t,t.prototype.jsonID=e,t}},ky=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof ev)return e.fail(t.message);throw t}}};function Ay(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(Ay(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return K.fromArray(r)}var jy=class e extends Oy{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new q(Ay(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return ky.fromReplace(e,this.from,this.to,i)}invert(t){let n=[];return t.nodesBetween(this.from,this.to,(t,r)=>{if(t.isInline&&t.isAtom){let i=this.mark.addToSet(t.marks);if(!$_.sameSet(i,t.marks)){let a=Math.max(this.from,r),o=Math.min(this.to,r+t.nodeSize);Ny(My,a,o,this.mark,n);for(let r of t.marks)r.isInSet(i)||Ny(e,a,o,r,n)}}}),n.length==1?n[0]:new Py(n)}map(t){let n=t.map(this.from,1),r=t.map(this.to,-1);return n>=r?null:new e(n,r,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};Oy.jsonID(`addMark`,jy);var My=class e extends Oy{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new q(Ay(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return ky.fromReplace(e,this.from,this.to,n)}invert(e){let t=[];return e.nodesBetween(this.from,this.to,(e,n)=>{e.isInline&&e.isAtom&&this.mark.isInSet(e.marks)&&Ny(jy,Math.max(this.from,n),Math.min(this.to,n+e.nodeSize),this.mark,t)}),t.length==1?t[0]:new Py(t)}map(t){let n=t.map(this.from,1),r=t.map(this.to,-1);return n>=r?null:new e(n,r,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};Oy.jsonID(`removeMark`,My);function Ny(e,t,n,r,i){let a=i.length?i[i.length-1]:null;a&&a instanceof e&&a.to==t&&a.mark.eq(r)?i[i.length-1]=new e(a.from,n,r):i.push(new e(t,n,r))}var Py=class e extends Oy{constructor(e){super(),this.steps=e}apply(e){for(let t of this.steps){let n=t.apply(e);if(!n.doc)return n;e=n.doc}return new ky(e,null)}invert(t){return new e(this.steps.map(e=>e.invert(t)))}map(t){let n=[];for(let e of this.steps){let r=e.map(t);r&&n.push(r)}return n.length?new e(n):null}toJSON(){return{stepType:`markSet`,steps:this.steps.map(e=>e.toJSON())}}static fromJSON(t,n){if(!Array.isArray(n.steps)||!n.steps.every(e=>e.stepType==`addMark`||e.stepType==`removeMark`))throw RangeError(`Invalid JSON for MarkSetStep`);return new e(n.steps.map(e=>Oy.fromJSON(t,e)))}};Oy.jsonID(`markSet`,Py);var Fy=class e extends Oy{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ky.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ky.fromReplace(e,this.pos,this.pos+1,new q(K.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new Iy(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};Oy.jsonID(`addNodeMark`,Fy);var Iy=class e extends Oy{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ky.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ky.fromReplace(e,this.pos,this.pos+1,new q(K.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Fy(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};Oy.jsonID(`removeNodeMark`,Iy);var Ly=class e extends Oy{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&zy(e,this.from,this.to)?ky.fail(`Structure replace would overwrite content`):ky.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ty([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?q.empty:new q(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?q.empty:new q(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}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(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,q.fromJSON(t,n.slice),!!n.structure)}};Ly.MAP_BIAS=1,Oy.jsonID(`replace`,Ly);var Ry=class e extends Oy{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(zy(e,this.from,this.gapFrom)||zy(e,this.gapTo,this.to)))return ky.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ky.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?ky.fromReplace(e,this.from,this.to,n):ky.fail(`Content does not fit in gap`)}getMap(){return new Ty([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,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(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,q.fromJSON(t,n.slice),n.insert,!!n.structure)}};Oy.jsonID(`replaceAround`,Ry);function zy(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function By(e,t,n,r){let i=[];e.doc.nodesBetween(t,n,(e,a,o)=>{if(!e.isInline)return;let s=e.marks;!r.isInSet(s)&&o.type.allowsMarkType(r.type)&&Ny(jy,Math.max(a,t),Math.min(a+e.nodeSize,n),r,i)}),i.forEach(t=>e.step(t))}function Vy(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline||!e.isAtom)return;a++;let s=null;if(r instanceof Uv){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new My(t.from,t.to,t.style)))}function Hy(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new Ly(s,l,q.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new My(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new q(K.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new Ly(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(K.empty,!0);e.replace(s,s,new q(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function Uy(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Wy(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!Uy(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function Gy(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=K.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=K.from(r.node(e).copy(u)),d++):c--;let f=K.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=K.from(i.node(e).copy(f)),p++):l++;e.step(new Ry(c,l,o,s,new q(u.append(f),d,p),u.size-d,!0))}function Ky(e,t,n=null,r=e){let i=Jy(e,t),a=i&&Yy(r,t);return a?i.map(qy).concat({type:t,attrs:n}).concat(a.map(qy)):null}function qy(e){return{type:e,attrs:null}}function Jy(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function Yy(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function Xy(e,t,n){let r=K.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=K.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new Ry(i,a,i,a,new q(r,0,0),n.length,!0))}function Zy(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&eb(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&$y(e,t,n,a),Hy(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new Ry(c,l,c+1,l-1,new q(K.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&Qy(e,t,n,a),!1}})}function Qy(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function $y(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
|
|
53
|
+
`))}})}function eb(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function tb(e,t,n,r,i){let a=e.doc.nodeAt(t);if(!a)throw RangeError(`No node at given position`);n||=a.type;let o=n.create(r,null,i||a.marks);if(a.isLeaf)return e.replaceWith(t,t+a.nodeSize,o);if(!n.validContent(a.content))throw RangeError(`Invalid content for node type `+n.name);e.step(new Ry(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new q(K.from(o),0,0),1,!0))}function nb(e,t,n=1,r){let i=e.resolve(t),a=i.depth-n,o=r&&r[r.length-1]||i.parent;if(a<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 e=i.depth-1,t=n-2;e>a;e--,t--){let n=i.node(e),a=i.index(e);if(n.type.spec.isolating)return!1;let o=n.content.cutByIndex(a,n.childCount),s=r&&r[t+1];s&&(o=o.replaceChild(0,s.type.create(s.attrs)));let c=r&&r[t]||n;if(!n.canReplace(a+1,n.childCount)||!c.type.validContent(o))return!1}let s=i.indexAfter(a),c=r&&r[0];return i.node(a).canReplaceWith(s,s,c?c.type:i.node(a+1).type)}function rb(e,t,n=1,r){let i=e.doc.resolve(t),a=K.empty,o=K.empty;for(let e=i.depth,t=i.depth-n,s=n-1;e>t;e--,s--){a=K.from(i.node(e).copy(a));let t=r&&r[s];o=K.from(t?t.type.create(t.attrs,o):i.node(e).copy(o))}e.step(new Ly(t,t,new q(a.append(o),n,n),!0))}function ib(e,t){let n=e.resolve(t),r=n.index();return ob(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function ab(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let a=t.child(i),o=a.type==r?e.type.schema.nodes.text:a.type;if(n=n.matchType(o),!n||!e.type.allowsMarks(a.marks))return!1}return n.validEnd}function ob(e,t){return!!(e&&t&&!e.isLeaf&&ab(e,t))}function sb(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,a,o=r.index(e);if(e==r.depth?(i=r.nodeBefore,a=r.nodeAfter):n>0?(i=r.node(e+1),o++,a=r.node(e).maybeChild(o)):(i=r.node(e).maybeChild(o-1),a=r.node(e+1)),i&&!i.isTextblock&&ob(i,a)&&r.node(e).canReplace(o,o+1))return t;if(e==0)break;t=n<0?r.before(e):r.after(e)}}function cb(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,a=e.doc.resolve(t-n),o=a.node().type;if(i&&o.inlineContent){let e=o.whitespace==`pre`,t=!!o.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let s=e.steps.length;if(r===!1){let r=e.doc.resolve(t+n);$y(e,r.node(),r.before(),s)}o.inlineContent&&Hy(e,t+n-1,o,a.node().contentMatchAt(a.index()),r==null);let c=e.mapping.slice(s),l=c.map(t-n);if(e.step(new Ly(l,c.map(t+n,-1),q.empty,!0)),r===!0){let t=e.doc.resolve(l);Qy(e,t.node(),t.before(),e.steps.length)}return e}function lb(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}function ub(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(n.openStart==0&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,a=r.index(t)+ +(n>0),o=r.node(t),s=!1;if(e==1)s=o.canReplace(a,a,i);else{let e=o.contentMatchAt(a).findWrapping(i.firstChild.type);s=e&&o.canReplaceWith(a,a,e[0])}if(s)return n==0?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function db(e,t,n=t,r=q.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),a=e.resolve(n);return fb(i,a,r)?new Ly(t,n,r):new pb(i,a,r).fit()}function fb(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}var pb=class{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=K.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=K.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,a=n.depth,o=r.depth;for(;a&&o&&i.childCount==1;)i=i.firstChild.content,a--,o--;let s=new q(i,a,o);return e>-1?new Ry(n.pos,e,this.$to.pos,this.$to.end(),s,t):s.size||n.pos!=this.$to.pos?new Ly(n.pos,r.pos,s):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=gb(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let{type:a,match:o}=this.frontier[e],s,c=null;if(t==1&&(i?o.matchType(i.type)||(c=o.fillBefore(K.from(i),!1)):r&&a.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:c};if(t==2&&i&&(s=o.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:s};if(r&&o.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced;return xb(e,-1)<=t?!1:(this.unplaced.size>1&&xb(e,1)>n&&n++,this.unplaced=new q(e,t+1,n),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=gb(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new q(mb(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new q(mb(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let a=this.unplaced,o=n?n.content:a.content,s=a.openStart-e,c=0,l=[],{match:u,type:d}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)l.push(r.child(e));u=u.matchFragment(r)}let f=o.size+e-(a.content.size-a.openEnd);for(;c<o.childCount;){let e=o.child(c),t=u.matchType(e.type);if(!t)break;c++,(c>1||s==0||e.content.size)&&(u=t,l.push(_b(e.mark(d.allowedMarks(e.marks)),c==1?s:0,c==o.childCount?f:-1)))}let p=c==o.childCount;p||(f=-1),this.placed=hb(this.placed,t,K.from(l)),this.frontier[t].match=u,p&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=o;e<f;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=p?e==0?q.empty:new q(mb(a.content,e-1,1),e-1,f<0?a.openEnd:e-1):new q(mb(a.content,e,c),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!vb(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){scan:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=vb(e,t,r,n,i);if(a){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=vb(e,n,r,t,!0);if(!i||i.childCount)continue scan}return{depth:t,fit:a,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=hb(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=hb(this.placed,this.depth,K.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(K.empty,!0);e.childCount&&(this.placed=hb(this.placed,this.frontier.length,e))}};function mb(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(mb(e.firstChild.content,t-1,n)))}function hb(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(hb(e.lastChild.content,t-1,n)))}function gb(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function _b(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,_b(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(K.empty,!0)))),e.copy(r)}function vb(e,t,n,r,i){let a=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==a.childCount&&!n.compatibleContent(a.type))return null;let s=r.fillBefore(a.content,!0,o);return s&&!yb(n,a.content,o)?s:null}function yb(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function bb(e){return e.spec.defining||e.spec.definingForContent}function xb(e,t){for(let n=0;;n++){let r=t<0?e.firstChild:e.lastChild;if(!r||r.isAtom)return n;e=r.content}}function Sb(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),a=e.doc.resolve(n);if(fb(i,a,r))return e.step(new Ly(t,n,r));let o=Eb(i,a);o[o.length-1]==0&&o.pop();let s=-(i.depth+1);o.unshift(s);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;o.indexOf(e)>-1?s=e:i.before(e)==t&&o.splice(1,0,-e)}let c=o.indexOf(s),l=[],u=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(l.push(n),t==r.openStart)break;e=n.content}for(let e=u-1;e>=0;e--){let t=l[e],n=bb(t.type);if(n&&!t.sameMarkup(i.node(Math.abs(s)-1)))u=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let s=(t+u+1)%(r.openStart+1),d=l[s];if(d)for(let t=0;t<o.length;t++){let l=o[(t+c)%o.length],u=!0;l<0&&(u=!1,l=-l);let f=i.node(l-1),p=i.index(l-1);if(f.canReplaceWith(p,p,d.type,d.marks))return e.replace(i.before(l),u?a.after(l):n,new q(Cb(r.content,0,r.openStart,s),s,r.openEnd))}}let d=e.steps.length;for(let s=o.length-1;s>=0&&(e.replace(t,n,r),!(e.steps.length>d));s--){let e=o[s];e<0||(t=i.before(e),n=a.after(e))}}function Cb(e,t,n,r,i){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(Cb(i.content,t+1,n,r,i)))}if(t>r){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(K.empty,!0))}return e}function wb(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=lb(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new q(K.from(r),0,0))}function Tb(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let a=r.sharedDepth(n),o=!1;for(let e=r.depth;e>a;e--)r.node(e).type.spec.isolating&&(o=!0);for(let e=i.depth;e>a;e--)i.node(e).type.spec.isolating&&(o=!0);if(!o){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=i.depth;e>0&&n==i.start(e);e--)n=i.before(e);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let a=Eb(r,i);for(let t=0;t<a.length;t++){let n=a[t],o=t==a.length-1;if(o&&n==0||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(o||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(t-r.start(a)==r.depth-a&&n>r.end(a)&&i.end(a)-n!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return e.delete(r.before(a),n);e.delete(t,n)}function Eb(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}var Db=class e extends Oy{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return ky.fail(`No node at attribute step's position`);let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return ky.fromReplace(e,this.pos,this.pos+1,new q(K.from(r),0,+!t.isLeaf))}getMap(){return Ty.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:`attr`,pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!=`number`||typeof n.attr!=`string`)throw RangeError(`Invalid input for AttrStep.fromJSON`);return new e(n.pos,n.attr,n.value)}};Oy.jsonID(`attr`,Db);var Ob=class e extends Oy{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return ky.ok(n)}getMap(){return Ty.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new e(n.attr,n.value)}};Oy.jsonID(`docAttr`,Ob);var kb=class extends Error{};kb=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},kb.prototype=Object.create(Error.prototype),kb.prototype.constructor=kb,kb.prototype.name=`TransformError`;var Ab=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ey}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new kb(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,i,a)=>{e=Math.min(e,i),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=q.empty){let r=db(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new q(K.from(n),0,0))}delete(e,t){return this.replace(e,t,q.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return Sb(this,e,t,n),this}replaceRangeWith(e,t,n){return wb(this,e,t,n),this}deleteRange(e,t){return Tb(this,e,t),this}lift(e,t){return Gy(this,e,t),this}join(e,t=1){return cb(this,e,t),this}wrap(e,t){return Xy(this,e,t),this}setBlockType(e,t=e,n,r=null){return Zy(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return tb(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new Db(e,t,n)),this}setDocAttribute(e,t){return this.step(new Ob(e,t)),this}addNodeMark(e,t){return this.step(new Fy(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError(`No node at position `+e);if(t instanceof $_)t.isInSet(n.marks)&&this.step(new Iy(e,t));else{let r=n.marks,i,a=[];for(;i=t.isInSet(r);)a.push(new Iy(e,i)),r=i.removeFromSet(r);for(let e=a.length-1;e>=0;e--)this.step(a[e])}return this}split(e,t=1,n){return rb(this,e,t,n),this}addMark(e,t,n){return By(this,e,t,n),this}removeMark(e,t,n){return Vy(this,e,t,n),this}clearIncompatible(e,t,n){return Hy(this,e,t,n),this}},jb=Object.create(null),J=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Mb(e.min(t),e.max(t))]}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 t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=q.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,a=this.ranges;for(let o=0;o<a.length;o++){let{$from:s,$to:c}=a[o],l=e.mapping.slice(i);e.replaceRange(l.map(s.pos),l.map(c.pos),o?q.empty:t),o==0&&Bb(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n),c=s.map(a.pos),l=s.map(o.pos);i?e.deleteRange(c,l):(e.replaceRangeWith(c,l,t),Bb(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new Y(e):zb(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?zb(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):zb(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Lb(e.node(0))}static atStart(e){return zb(e,e,0,0,1)||new Lb(e)}static atEnd(e){return zb(e,e,e.content.size,e.childCount,-1)||new Lb(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=jb[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in jb)throw RangeError(`Duplicate use of selection JSON ID `+e);return jb[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Y.between(this.$anchor,this.$head).getBookmark()}};J.prototype.visible=!0;var Mb=class{constructor(e,t){this.$from=e,this.$to=t}},Nb=!1;function Pb(e){!Nb&&!e.parent.inlineContent&&(Nb=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var Y=class e extends J{constructor(e,t=e){Pb(e),Pb(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return J.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=q.empty){if(super.replace(e,t),t==q.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new Fb(this.anchor,this.head)}toJSON(){return{type:`text`,anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!=`number`||typeof n.head!=`number`)throw RangeError(`Invalid input for TextSelection.fromJSON`);return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let e=J.findFrom(n,r,!0)||J.findFrom(n,-r,!0);if(e)n=e.$head;else return J.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(J.findFrom(t,-r,!0)||J.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};J.jsonID(`text`,Y);var Fb=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return Y.between(e.resolve(this.anchor),e.resolve(this.head))}},X=class e extends J{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),a=t.resolve(i);return r?J.near(a):new e(a)}content(){return new q(K.from(this.node),0,0)}eq(t){return t instanceof e&&t.anchor==this.anchor}toJSON(){return{type:`node`,anchor:this.anchor}}getBookmark(){return new Ib(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!=`number`)throw RangeError(`Invalid input for NodeSelection.fromJSON`);return new e(t.resolve(n.anchor))}static create(t,n){return new e(t.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};X.prototype.visible=!1,J.jsonID(`node`,X);var Ib=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new Fb(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&X.isSelectable(n)?new X(t):J.near(t)}},Lb=class e extends J{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=q.empty){if(t==q.empty){e.delete(0,e.doc.content.size);let t=J.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:`all`}}static fromJSON(t){return new e(t)}map(t){return new e(t)}eq(t){return t instanceof e}getBookmark(){return Rb}};J.jsonID(`all`,Lb);var Rb={map(){return this},resolve(e){return new Lb(e)}};function zb(e,t,n,r,i,a=!1){if(t.inlineContent)return Y.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(!r.isAtom){let t=zb(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&X.isSelectable(r))return X.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function Bb(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof Ly||i instanceof Ry))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(J.near(e.doc.resolve(o),n))}var Vb=1,Hb=2,Ub=4,Wb=class extends Ab{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 RangeError(`Selection passed to setSelection must point at the current document`);return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Vb)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&Vb)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Hb,this}ensureMarks(e){return $_.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&Hb)>0}addStep(e,t){super.addStep(e,t),this.updated&=-3,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||$_.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(n??=t,!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(J.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e==`string`?e:e.key]=t,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|=Ub,this}get scrolledIntoView(){return(this.updated&Ub)>0}};function Gb(e,t){return!t||!e?e:e.bind(t)}var Kb=class{constructor(e,t,n){this.name=e,this.init=Gb(t.init,n),this.apply=Gb(t.apply,n)}},qb=[new Kb(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new Kb(`selection`,{init(e,t){return e.selection||J.atStart(t.doc)},apply(e){return e.selection}}),new Kb(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new Kb(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],Jb=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=qb.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError(`Adding different instances of a keyed plugin (`+e.key+`)`);this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new Kb(e.key,e.spec.state,e))})}},Yb=class e{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,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let a=0;a<this.config.plugins.length;a++){let o=this.config.plugins[a];if(o.spec.appendTransaction){let s=r?r[a].n:0,c=r?r[a].state:this,l=s<t.length&&o.spec.appendTransaction.call(o,s?t.slice(s):t,c,n);if(l&&n.filterTransaction(l,a)){if(l.setMeta(`appendedTransaction`,e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<a?{state:n,n:t.length}:{state:this,n:0})}t.push(l),n=n.applyInner(l),i=!0}r&&(r[a]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(t){if(!t.before.eq(this.doc))throw RangeError(`Applying a mismatched transaction`);let n=new e(this.config),r=this.config.fields;for(let e=0;e<r.length;e++){let i=r[e];n[i.name]=i.apply(t,this[i.name],this,n)}return n}get tr(){return new Wb(this)}static create(t){let n=new Jb(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new e(n);for(let e=0;e<n.fields.length;e++)r[n.fields[e].name]=n.fields[e].init(t,r);return r}reconfigure(t){let n=new Jb(this.schema,t.plugins),r=n.fields,i=new e(n);for(let e=0;e<r.length;e++){let n=r[e].name;i[n]=this.hasOwnProperty(n)?this[n]:r[e].init(t,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&typeof e==`object`)for(let n in e){if(n==`doc`||n==`selection`)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(t,n,r){if(!n)throw RangeError(`Invalid input for EditorState.fromJSON`);if(!t.schema)throw RangeError(`Required config field 'schema' missing`);let i=new Jb(t.schema,t.plugins),a=new e(i);return i.fields.forEach(e=>{if(e.name==`doc`)a.doc=yv.fromJSON(t.schema,n.doc);else if(e.name==`selection`)a.selection=J.fromJSON(a.doc,n.selection);else if(e.name==`storedMarks`)n.storedMarks&&(a.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let i in r){let o=r[i],s=o.spec.state;if(o.key==e.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){a[e.name]=s.fromJSON.call(o,t,n[i],a);return}}a[e.name]=e.init(t,a)}}),a}};function Xb(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r==`handleDOMEvents`&&(i=Xb(i,t,{})),n[r]=i}return n}var Zb=class{constructor(e){this.spec=e,this.props={},e.props&&Xb(e.props,this,this.props),this.key=e.key?e.key.key:$b(`plugin`)}getState(e){return e[this.key]}},Qb=Object.create(null);function $b(e){return e in Qb?e+`$`+ ++Qb[e]:(Qb[e]=0,e+`$`)}var ex=class{constructor(e=`key`){this.key=$b(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}},tx=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function nx(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`backward`,e):n.parentOffset>0)?null:n}var rx=(e,t,n)=>{let r=nx(e,n);if(!r)return!1;let i=lx(r);if(!i){let n=r.blockRange(),i=n&&Wy(n);return i!=null&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let a=i.nodeBefore;if(Dx(e,i,t,-1))return!0;if(r.parent.content.size==0&&(sx(a,`end`)||X.isSelectable(a)))for(let n=r.depth;;n--){let o=db(e.doc,r.before(n),r.after(n),q.empty);if(o&&o.slice.size<o.to-o.from){if(t){let n=e.tr.step(o);n.setSelection(sx(a,`end`)?J.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):X.create(n.doc,i.pos-a.nodeSize)),t(n.scrollIntoView())}return!0}if(n==1||r.node(n-1).childCount>1)break}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},ix=(e,t,n)=>{let r=nx(e,n);if(!r)return!1;let i=lx(r);return i?ox(e,i,t):!1},ax=(e,t,n)=>{let r=ux(e,n);if(!r)return!1;let i=px(r);return i?ox(e,i,t):!1};function ox(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let a=t.nodeAfter,o=t.pos+1;for(;!a.isTextblock;o++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let s=db(e.doc,i,o,q.empty);if(!s||s.from!=i||s instanceof Ly&&s.slice.size>=o-i)return!1;if(n){let t=e.tr.step(s);t.setSelection(Y.create(t.doc,i)),n(t.scrollIntoView())}return!0}function sx(e,t,n=!1){for(let r=e;r;r=t==`start`?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var cx=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`backward`,e):r.parentOffset>0)return!1;a=lx(r)}let o=a&&a.nodeBefore;return!o||!X.isSelectable(o)?!1:(t&&t(e.tr.setSelection(X.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function lx(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function ux(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`forward`,e):n.parentOffset<n.parent.content.size)?null:n}var dx=(e,t,n)=>{let r=ux(e,n);if(!r)return!1;let i=px(r);if(!i)return!1;let a=i.nodeAfter;if(Dx(e,i,t,1))return!0;if(r.parent.content.size==0&&(sx(a,`start`)||X.isSelectable(a))){let n=db(e.doc,r.before(),r.after(),q.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(sx(a,`start`)?J.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):X.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),!0):!1},fx=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`forward`,e):r.parentOffset<r.parent.content.size)return!1;a=px(r)}let o=a&&a.nodeAfter;return!o||!X.isSelectable(o)?!1:(t&&t(e.tr.setSelection(X.create(e.doc,a.pos)).scrollIntoView()),!0)};function px(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}var mx=(e,t)=>{let n=e.selection,r=n instanceof X,i;if(r){if(n.node.isTextblock||!ib(e.doc,n.from))return!1;i=n.from}else if(i=sb(e.doc,n.from,-1),i==null)return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(X.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0},hx=(e,t)=>{let n=e.selection,r;if(n instanceof X){if(n.node.isTextblock||!ib(e.doc,n.to))return!1;r=n.to}else if(r=sb(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},gx=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),a=i&&Wy(i);return a!=null&&(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)},_x=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
|
|
54
|
+
`).scrollIntoView()),!0)};function vx(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var yx=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),a=n.indexAfter(-1),o=vx(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,o.createAndFill());i.setSelection(J.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},bx=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof Lb||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=vx(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,o=e.tr.insert(n,a.createAndFill());o.setSelection(Y.create(o.doc,n+1)),t(o.scrollIntoView())}return!0},xx=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(nb(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Wy(r);return i!=null&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function Sx(e){return(t,n)=>{if(t.selection instanceof X&&t.selection.node.isBlock){let{$from:e}=t.selection;return!e.parentOffset||!nb(t.doc,e.pos)?!1:(n&&n(t.tr.split(e.pos).scrollIntoView()),!0)}if(!t.selection.$from.depth)return!1;let r=t.tr;!t.selection.empty&&(t.selection instanceof Y||t.selection instanceof Lb)&&r.deleteSelection();let{$from:i}=r.selection,a=r.steps.length,o=[],s,c,l=!1,u=!1;for(let t=i.depth;;t--)if(i.node(t).isBlock){l=i.end(t)==i.pos+(i.depth-t),u=i.start(t)==i.pos-(i.depth-t),c=vx(i.node(t-1).contentMatchAt(i.indexAfter(t-1)));let n=e&&e(i.parent,l,i);o.unshift(n||(l&&c?{type:c}:null)),s=t;break}else{if(t==1)return!1;o.unshift(null)}let d=i.pos,f=nb(r.doc,d,o.length,o);if(f||=(o[0]=c?{type:c}:null,nb(r.doc,d,o.length,o)),!f)return!1;if(r.split(d,o.length,o),!l&&u&&i.node(s).type!=c){let e=r.mapping.slice(a),t=e.map(i.before(s)),n=r.doc.resolve(t);c&&i.node(s-1).canReplaceWith(n.index(),n.index()+1,c)&&r.setNodeMarkup(e.map(i.before(s)),c)}return n&&n(r.scrollIntoView()),!0}}var Cx=Sx(),wx=(e,t)=>{let{$from:n,to:r}=e.selection,i,a=n.sharedDepth(r);return a!=0&&(i=n.before(a),t&&t(e.tr.setSelection(X.create(e.doc,i))),!0)},Tx=(e,t)=>(t&&t(e.tr.setSelection(new Lb(e.doc))),!0);function Ex(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,a=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(a,a+1)||!(i.isTextblock||ib(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function Dx(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,c=i.type.spec.isolating||a.type.spec.isolating;if(!c&&Ex(e,t,n))return!0;let l=!c&&t.parent.canReplace(t.index(),t.index()+1);if(l&&(o=(s=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&s.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,s=K.empty;for(let e=o.length-1;e>=0;e--)s=K.from(o[e].create(null,s));s=K.from(i.copy(s));let c=e.tr.step(new Ry(t.pos-1,r,t.pos,r,new q(s,1,0),o.length,!0)),l=c.doc.resolve(r+2*o.length);l.nodeAfter&&l.nodeAfter.type==i.type&&ib(c.doc,l.pos)&&c.join(l.pos),n(c.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&c?null:J.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&Wy(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(l&&sx(a,`start`,!0)&&sx(i,`end`)){let r=i,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let s=a,c=1;for(;!s.isTextblock;s=s.firstChild)c++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=K.empty;for(let e=o.length-1;e>=0;e--)r=K.from(o[e].copy(r));n(e.tr.step(new Ry(t.pos-o.length,t.pos+a.nodeSize,t.pos+c,t.pos+a.nodeSize-c,new q(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Ox(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(n&&n(t.tr.setSelection(Y.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var kx=Ox(-1),Ax=Ox(1);function jx(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),s=o&&Ky(o,e,t);return s?(r&&r(n.tr.wrap(o,s).scrollIntoView()),!0):!1}}function Mx(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];n.doc.nodesBetween(a,o,(r,a)=>{if(i)return!1;if(r.isTextblock&&!r.hasMarkup(e,t)){if(r.type==e)i=!0;else{let t=n.doc.resolve(a),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];i.setBlockType(a,o,e,t)}r(i.scrollIntoView())}return!0}}function Nx(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}var Px=Nx(tx,rx,cx),Fx=Nx(tx,dx,fx),Ix={Enter:Nx(_x,bx,xx,Cx),"Mod-Enter":yx,Backspace:Px,"Mod-Backspace":Px,"Shift-Backspace":Px,Delete:Fx,"Mod-Delete":Fx,"Mod-a":Tx},Lx={"Ctrl-h":Ix.Backspace,"Alt-Backspace":Ix[`Mod-Backspace`],"Ctrl-d":Ix.Delete,"Ctrl-Alt-Backspace":Ix[`Mod-Delete`],"Alt-Delete":Ix[`Mod-Delete`],"Alt-d":Ix[`Mod-Delete`],"Ctrl-a":kx,"Ctrl-e":Ax};for(let e in Ix)Lx[e]=Ix[e];typeof navigator<`u`?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<`u`&&os.platform&&os.platform();function Rx(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a);if(!o)return!1;let s=r?n.tr:null;return zx(s,o,e,t)?(r&&r(s.scrollIntoView()),!0):!1}}function zx(e,t,n,r=null){let i=!1,a=t,o=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let e=o.resolve(t.start-2);a=new _v(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new _v(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let s=Ky(a,n,r,t);return s?(e&&Bx(e,t,s,i,n),!0):!1}function Bx(e,t,n,r,i){let a=K.empty;for(let e=n.length-1;e>=0;e--)a=K.from(n[e].type.create(n[e].attrs,a));e.step(new Ry(t.start-(r?2:0),t.end,t.start,t.end,new q(a,0,0),n.length,!0));let o=0;for(let e=0;e<n.length;e++)n[e].type==i&&(o=e+1);let s=n.length-o,c=t.start+n.length-(r?2:0),l=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&nb(e.doc,c,s)&&(e.split(c,s),c+=2*s),c+=l.child(n).nodeSize;return e}function Vx(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?Hx(t,n,e,a):Ux(t,n,a):!0:!1}}function Hx(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new Ry(a-1,o,a,o,new q(K.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new _v(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let s=Wy(r);if(s==null)return!1;i.lift(r,s);let c=i.doc.resolve(i.mapping.map(a,-1)-1);return ib(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),t(i.scrollIntoView()),!0}function Ux(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,a=n.startIndex;t>a;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,c=n.endIndex==i.childCount,l=a.node(-1),u=a.index(-1);if(!l.canReplace(u+ +!s,u+1,o.content.append(c?K.empty:K.from(i))))return!1;let d=a.pos,f=d+o.nodeSize;return r.step(new Ry(d-+!!s,f+ +!!c,d+1,f-1,new q((s?K.empty:K.from(i.copy(K.empty))).append(c?K.empty:K.from(i.copy(K.empty))),+!s,+!c),+!s)),t(r.scrollIntoView()),!0}function Wx(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,c=s.child(o-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==s.type,i=K.from(r?e.create():null),o=new q(K.from(e.create(null,K.from(s.type.create(null,i)))),r?3:1,0),l=a.start,u=a.end;n(t.tr.step(new Ry(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}var Gx=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Kx=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},qx=null,Jx=function(e,t,n){let r=qx||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},Yx=function(){qx=null},Xx=function(e,t,n,r){return n&&(Qx(e,t,n,r,-1)||Qx(e,t,n,r,1))},Zx=/^(img|br|input|textarea|hr)$/i;function Qx(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:$x(e))){let n=e.parentNode;if(!n||!Z(n)||aS(e)||Zx.test(e.nodeName)||e.contentEditable==`false`)return!1;t=Gx(e)+(i<0?0:1),e=n}else if(Z(e)){let n=e.childNodes[t+(i<0?-1:0)];if(Z(n)&&n.contentEditable==`false`){if(n.pmViewDesc?.ignoreForSelection)t+=i;else return!1}else e=n,t=i<0?$x(e):0}else return!1}}function $x(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Z(e){return e.nodeType==1}function eS(e){return e.nodeType==3}function tS(e,t){return t?e.contains(Z(t)?t:t.parentNode):!1}function nS(e,t){for(;;){if(eS(e)&&t)return e;if(Z(e)&&t>0){if(e.contentEditable==`false`)return null;e=e.childNodes[t-1],t=$x(e)}else if(e.parentNode&&!aS(e))t=Gx(e),e=e.parentNode;else return null}}function rS(e,t){for(;;){if(eS(e)&&t<e.nodeValue.length)return e;if(Z(e)&&t<e.childNodes.length){if(e.contentEditable==`false`)return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!aS(e))t=Gx(e)+1,e=e.parentNode;else return null}}function iS(e,t,n){for(let r=t==0,i=t==$x(e);r||i;){if(e==n)return!0;let t=Gx(e);if(e=e.parentNode,!e)return!1;r&&=t==0,i&&=t==$x(e)}}function aS(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var oS=function(e){return e.focusNode&&Xx(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function sS(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function cS(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function lS(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min($x(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min($x(r.startContainer),r.startOffset)}}}var uS=typeof navigator<`u`?navigator:null,dS=typeof document<`u`?document:null,fS=uS&&uS.userAgent||``,pS=/Edge\/(\d+)/.exec(fS),mS=/MSIE \d/.exec(fS),hS=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(fS),gS=!!(mS||hS||pS),_S=mS?document.documentMode:hS?+hS[1]:pS?+pS[1]:0,vS=!gS&&/gecko\/(\d+)/i.test(fS);vS&&+(/Firefox\/(\d+)/.exec(fS)||[0,0])[1];var yS=!gS&&/Chrome\/(\d+)/.exec(fS),bS=!!yS,xS=yS?+yS[1]:0,SS=!gS&&!!uS&&/Apple Computer/.test(uS.vendor),CS=SS&&(/Mobile\/\w+/.test(fS)||!!uS&&uS.maxTouchPoints>2),wS=CS||(uS?/Mac/.test(uS.platform):!1),TS=uS?/Win/.test(uS.platform):!1,ES=/Android \d/.test(fS),DS=!!dS&&`webkitFontSmoothing`in dS.documentElement.style,OS=DS?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function kS(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function AS(e,t){return typeof e==`number`?e:e[t]}function jS(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function MS(e,t,n){if(!qS(t)&&t.left==0)return;let r=e.someProp(`scrollThreshold`)||0,i=e.someProp(`scrollMargin`)||5,a=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(!Z(o)){o=Kx(o);continue}let e=o==a.body,n=e?kS(a):jS(o),s=0,c=0;if(t.top<n.top+AS(r,`top`)?c=-(n.top-t.top+AS(i,`top`)):t.bottom>n.bottom-AS(r,`bottom`)&&(c=t.bottom-t.top>n.bottom-n.top?t.top+AS(i,`top`)-n.top:t.bottom-n.bottom+AS(i,`bottom`)),t.left<n.left+AS(r,`left`)?s=-(n.left-t.left+AS(i,`left`)):t.right>n.right-AS(r,`right`)&&(s=t.right-n.right+AS(i,`right`)),s||c){if(e)a.defaultView.scrollBy(s,c);else{let e=o.scrollLeft,n=o.scrollTop;c&&(o.scrollTop+=c),s&&(o.scrollLeft+=s);let r=o.scrollLeft-e,i=o.scrollTop-n;t={left:t.left-r,top:t.top-i,right:t.right-r,bottom:t.bottom-i}}}let l=e?`fixed`:getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(l))break;o=l==`absolute`?o.offsetParent:Kx(o)}}function NS(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let a=(t.left+t.right)/2,o=n+1;o<Math.min(innerHeight,t.bottom);o+=5){let t=e.root.elementFromPoint(a,o);if(!t||t==e.dom||!e.dom.contains(t))continue;let s=t.getBoundingClientRect();if(s.top>=n-20){r=t,i=s.top;break}}return{refDOM:r,refTop:i,stack:PS(e.dom)}}function PS(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Kx(r));return t}function FS({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;IS(n,r==0?0:r-t)}function IS(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:a}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=a&&(r.scrollLeft=a)}}var LS=null;function RS(e){if(e.setActive)return e.setActive();if(LS)return e.focus(LS);let t=PS(e);e.focus(LS==null?{get preventScroll(){return LS={preventScroll:!0},!0}}:void 0),LS||(LS=!1,IS(t,0))}function zS(e,t){let n,r=2e8,i,a=0,o=t.top,s=t.top,c,l;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let e;if(Z(u))e=u.getClientRects();else if(eS(u))e=Jx(u).getClientRects();else continue;for(let f=0;f<e.length;f++){let p=e[f];if(p.top<=o&&p.bottom>=s){o=Math.max(p.bottom,o),s=Math.min(p.top,s);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<r){n=u,r=e,i=e&&eS(n)?{left:p.right<t.left?p.right:p.left,top:t.top}:t,Z(u)&&e&&(a=d+ +(t.left>=(p.left+p.right)/2));continue}}else p.top>t.top&&!c&&p.left<=t.left&&p.right>=t.left&&(c=u,l={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&c&&(n=c,i=l,r=0),n&&eS(n)?BS(n,i):!n||r?{node:e,offset:a}:zS(n,i)}function BS(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let a=0;a<n;a++){r.setEnd(e,a+1),r.setStart(e,a);let n=JS(r,1);if(n.top!=n.bottom&&VS(t,n)){i={node:e,offset:a+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}function VS(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function HS(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function US(e,t,n){let{node:r,offset:i}=zS(t,n),a=-1;if(Z(r)&&!r.firstChild){let e=r.getBoundingClientRect();a=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,a)}function WS(e,t,n,r){let i=-1;for(let n=t,a=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),o;if(!t)return null;if(Z(t.dom)&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!a&&o.left>r.left||o.top>r.top?i=t.posBefore:(!a&&o.right<r.left||o.bottom<r.top)&&(i=t.posAfter),a=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(o.top+o.bottom)/2:r.left<(o.left+o.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}function GS(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),a=i;;){let n=e.childNodes[a];if(Z(n)){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(VS(t,i))return GS(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function KS(e,t){let n=e.dom.ownerDocument,r,i=0,a=lS(n,t.left,t.top);a&&({node:r,offset:i}=a);let o=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),s;if(!o||!e.dom.contains(o)){let n=e.dom.getBoundingClientRect();if(!VS(t,n)||(o=GS(e.dom,t,n),!o))return null}if(SS)for(let e=o;r&&e;e=Kx(e))e.draggable&&(r=void 0);if(o=HS(o,t),r){if(vS&&Z(r)&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let e=r.childNodes[i],n;e.nodeName==`IMG`&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&i++}let n;DS&&i&&Z(r)&&Z(n=r.childNodes[i-1])&&n.contentEditable==`false`&&n.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&Z(r.lastChild)&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:i!=0&&Z(r)&&r.childNodes[i-1].nodeName==`BR`||(s=WS(e,r,i,t))}s??=US(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function qS(e){return e.top<e.bottom||e.left<e.right}function JS(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(qS(e))return e}return Array.prototype.find.call(n,qS)||e.getBoundingClientRect()}var YS=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function XS(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=DS||vS;if(eS(r)){if(o&&(YS.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=JS(Jx(r,i,i),n);if(vS&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=JS(Jx(r,i-1,i-1),-1);if(t.top==e.top){let n=JS(Jx(r,i,i+1),-1);if(n.top!=e.top)return ZS(n,n.left<t.left)}}return e}{let e=i,t=i,a=n<0?1:-1;return n<0&&!i?(t++,a=-1):n>=0&&i==r.nodeValue.length?(e--,a=1):n<0?e--:t++,ZS(JS(Jx(r,e,t),a),a<0)}}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==$x(r))){let e=r.childNodes[i-1];if(Z(e))return QS(e.getBoundingClientRect(),!1)}if(a==null&&i<$x(r)){let e=r.childNodes[i];if(Z(e))return QS(e.getBoundingClientRect(),!0)}return QS(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==$x(r))){let e=r.childNodes[i-1],t=eS(e)?Jx(e,$x(e)-+!o):Z(e)&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return ZS(JS(t,1),!1)}if(a==null&&i<$x(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?eS(e)?Jx(e,0,+!o):Z(e)?e:null:null;if(t)return ZS(JS(t,-1),!0)}return ZS(JS(eS(r)?Jx(r):r,-n),n>=0)}function ZS(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function QS(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function $S(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function eC(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return $S(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,n==`up`?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=XS(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(Z(e))t=e.getClientRects();else if(eS(e))t=Jx(e,0,e.nodeValue.length).getClientRects();else continue;for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&(n==`up`?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})}var tC=/[\u0590-\u08ac]/;function nC(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!tC.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:$S(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:a,anchorOffset:o}=e.domSelectionRange(),c=s.caretBidiLevel;s.modify(`move`,n,`character`);let l=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),f=u&&!tS(l,u)||t==u&&i==d;try{s.collapse(a,o),t&&(t!=a||i!=o)&&s.extend&&s.extend(t,i)}catch{}return c!=null&&(s.caretBidiLevel=c),f}):r.pos==r.start()||r.pos==r.end()}var rC=null,iC=null,aC=!1;function oC(e,t,n){return rC==t&&iC==n?aC:(rC=t,iC=n,aC=n==`up`||n==`down`?eC(e,t,n):nC(e,t,n))}var sC=0,cC=1,lC=2,uC=3,dC=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=sC,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].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 t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.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,t,n){if(this.contentDOM&&tS(this.contentDOM,e)){if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(e==this.dom&&this.contentDOM)r=t>Gx(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM)){let n=e.compareDocumentPosition(this.contentDOM);r=n&16?t>Array.from(e.childNodes).findIndex(e=>e.contains(this.contentDOM)):!(n&4)}else if(this.dom.firstChild){if(t==0)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return r??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),a;if(i&&(!t||i.node)){if(n&&(a=i.nodeDOM)&&!(Z(a)?tS(a,e):a==e))n=!1;else return i}}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],a=t+i.size;if(a>e){r=e-t;break}t=a}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(;n>0;n--){let e=this.children[n-1];if(e.size||!(e instanceof vC||e instanceof fC&&e.side>=0))break}if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,e&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?Gx(e.dom)+1:0}}{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,e&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?Gx(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let a=n,o=0;;o++){let n=this.children[o],s=a+n.size;if(r==-1&&e<=s){let i=a+n.border;if(e>=i&&t<=s-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=a;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=Gx(n.dom)+1;break}e-=n.size}r==-1&&(r=0)}if(r>-1&&(s>t||o==this.children.length-1)){t=s;for(let e=o+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=Gx(n.dom);break}t+=n.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=s}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(!Z(t)||n==t.childNodes.length)throw RangeError(`No node after pos `+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),a=Math.max(e,t);for(let o=0,s=0;o<this.children.length;o++){let c=this.children[o],l=s+c.size;if(i>s&&a<l)return c.setSelection(e-s-c.border,t-s-c.border,n,r);s=l}let o=this.domFromPos(e,e?-1:1),s=t==e?o:this.domFromPos(t,t?-1:1),c=n.root.getSelection(),l=n.domSelectionRange(),u=!1;if((vS||SS)&&e==t){let{node:e,offset:t}=o;if(eS(e)){if(u=!!(t&&e.nodeValue[t-1]==`
|
|
55
|
+
`),u&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){n.nodeName==`BR`&&(o=s={node:n.parentNode,offset:Gx(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];u=n&&(n.nodeName==`BR`||n.contentEditable==`false`)}}if(vS&&l.focusNode&&l.focusNode!=s.node&&Z(l.focusNode)){let e=l.focusNode.childNodes[l.focusOffset];e&&e.contentEditable==`false`&&(r=!0)}if(!(r||u&&SS)&&Xx(o.node,o.offset,l.anchorNode,l.anchorOffset)&&Xx(s.node,s.offset,l.focusNode,l.focusOffset))return;let d=!1;if((c.extend||e==t)&&!(u&&vS)){c.collapse(o.node,o.offset);try{e!=t&&c.extend(s.node,s.offset),d=!0}catch{}}if(!d){if(e>t){let e=o;o=s,s=e}let n=document.createRange();n.setEnd(s.node,s.offset),n.setStart(o.node,o.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&e.type!=`selection`}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],a=n+i.size;if(n==a?e<=a&&t>=n:e<a&&t>n){let r=n+i.border,o=a-i.border;if(e>=r&&t<=o){this.dirty=e==n||t==a?lC:cC,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=uC:i.markDirty(e-r,t-r);return}i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?lC:uC}n=a}this.dirty=lC}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?lC:cC;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},fC=class extends dC{constructor(e,t,n,r){let i,a=t.type.toDOM;if(typeof a==`function`&&(a=a(n,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){let e=Z(a)?a:document.createElement(`span`);e!=a&&(e.appendChild(a),a=e),e.hasAttribute(`contenteditable`)||(e.contentEditable=`false`),e.classList.add(`ProseMirror-widget`)}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==sC&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(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}},pC=class extends dC{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e==this.textDOM?this.posAtStart+t:this.posAtStart+(t?this.size:0)}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type===`characterData`&&e.target.nodeValue==e.oldValue}},mC=class e extends dC{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(t,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return o&&o.dom||(o=cy.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new e(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&uC||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=uC&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=sC){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=sC}}slice(t,n,r){let i=e.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;n<o&&(a=FC(a,n,o,r)),t>0&&(a=FC(a,0,t,r));for(let e=0;e<a.length;e++)a[e].parent=i;return i.children=a,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},hC=class e extends dC{constructor(e,t,n,r,i,a,o){super(e,[],i,a),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}static create(t,n,r,i,a,o){let s=a.nodeViews[n.type.name],c,l=s&&s(n,a,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(!eS(u))throw RangeError(`Text must be rendered as a DOM text node`)}else if(!u){let e=cy.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs);({dom:u,contentDOM:d}=e)}!d&&!n.isText&&u.nodeName!=`BR`&&(u.hasAttribute(`contenteditable`)||(u.contentEditable=`false`),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=EC(u,r,n),l?c=new yC(t,n,r,i,u,d||null,f,l):n.isText?new _C(t,n,r,i,u,f):new e(t,n,r,i,u,d||null,f)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace==`pre`&&(t.preserveWhitespace=`full`),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let e=this.children.length-1;e>=0;e--){let n=this.children[e];if(this.dom.contains(n.dom.parentNode)){t.contentElement=n.dom.parentNode;break}}if(!t.contentElement){let n=e&&e.find(t=>Z(t)&&e.indexOf(t.parentNode)<0&&this.dom.contains(t));n?t.contentElement=n:t.getContent=()=>K.empty}}return t}matchesNode(e,t,n){return this.dirty==sC&&e.eq(this.node)&&DC(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new kC(this,a&&a.node,e),c=this.node.inlineContent,l=c&&this.node.isBlock;MC(this.node,this.innerDeco,(t,i,a)=>{t.spec.marks?s.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!a&&s.syncToMarks(i==this.node.childCount?$_.none:this.node.child(i).marks,n,e,i),s.placeWidget(t,e,r)},(t,a,u,d)=>{s.syncToMarks(t.marks,n,e,d),l&&t.isAtom&&!t.isText&&s.addHackNode(`IMG`,s.top);let f;s.findNodeMatch(t,a,u,d)||o&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(f=s.findIndexWithChild(i.node))>-1&&s.updateNodeAt(t,a,u,f,e)||s.updateNextNode(t,a,u,e,d,r)||s.addNode(t,a,u,e,r),r+=t.nodeSize,c&&(l=t.isAtom&&!t.isText)}),s.syncToMarks([],n,e,0),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||this.dirty==lC)&&(a&&this.protectLocalComposition(e,a),bC(this.contentDOM,this.children,e),CS&&NC(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof Y)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,a=PC(this.node.content,e,n-t,r-t);return a<0?null:{node:i,pos:a,text:e}}return{node:i,pos:-1,text:``}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let a=new pC(this,i,t,r);e.input.compositionNodes.push(a),this.children=FC(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==uC||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=sC}updateOuterDeco(e){if(DC(e,this.outerDeco))return;let t=!Z(this.nodeDOM),n=this.dom;this.dom=wC(this.dom,this.nodeDOM,CC(this.outerDeco,this.node,t),CC(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){Z(this.nodeDOM)&&(this.nodeDOM.classList.add(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){Z(this.nodeDOM)&&(this.nodeDOM.classList.remove(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute(`draggable`))}get domAtom(){return this.node.isAtom}};function gC(e,t,n,r,i){EC(r,t,e);let a=new hC(void 0,e,t,n,r,r,r);return a.contentDOM&&a.updateChildren(i,0),a}var _C=class e extends hC{constructor(e,t,n,r,i,a){super(e,t,n,r,i,null,a)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return this.dirty==uC||this.dirty!=sC&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=sC||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=sC,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!=`characterData`&&e.type!=`selection`}slice(t,n,r){let i=this.node.cut(t,n),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=uC)}get domAtom(){return!1}isText(e){return this.node.text==e}},vC=class extends dC{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==sC&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},yC=class extends hC{constructor(e,t,n,r,i,a,o,s){super(e,t,n,r,i,a,o),this.spec=s}update(e,t,n,r){if(this.dirty==uC)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}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 bC(e,t,n){let r=e.firstChild,i=!1;for(let a=0;a<t.length;a++){let o=t[a],s=o.dom;if(s.parentNode==e){for(;s!=r;)r=OC(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof mC){let t=r?r.previousSibling:e.lastChild;bC(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=OC(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var xC=function(e){e&&(this.nodeName=e)};xC.prototype=Object.create(null);var SC=[new xC];function CC(e,t,n){if(e.length==0)return SC;let r=n?SC[0]:new xC,i=[r];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o){o.nodeName&&i.push(r=new xC(o.nodeName));for(let e in o){let a=o[e];a!=null&&(n&&i.length==1&&i.push(r=new xC(t.isInline?`span`:`div`)),e==`class`?r.class=(r.class?r.class+` `:``)+a:e==`style`?r.style=(r.style?r.style+`;`:``)+a:e!=`nodeName`&&(r[e]=a))}}}return i}function wC(e,t,n,r){if(n==SC&&r==SC)return t;let i=t;for(let t=0;t<r.length;t++){let a=r[t],o=n[t];if(t){let t;o&&o.nodeName==a.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==a.nodeName||(t=document.createElement(a.nodeName),t.pmIsDeco=!0,t.appendChild(i),o=SC[0]),i=t}TC(i,o||SC[0],a)}return i}function TC(e,t,n){for(let r in t)r!=`class`&&r!=`style`&&r!=`nodeName`&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!=`class`&&r!=`style`&&r!=`nodeName`&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(` `).filter(Boolean):[],i=n.class?n.class.split(` `).filter(Boolean):[];for(let t=0;t<r.length;t++)i.indexOf(r[t])==-1&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)r.indexOf(i[t])==-1&&e.classList.add(i[t]);e.classList.length==0&&e.removeAttribute(`class`)}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}function EC(e,t,n){return wC(e,e,SC,CC(t,n,!Z(e)))}function DC(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function OC(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var kC=class{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=AC(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,a=this.stack.length>>1,o=Math.min(a,e.length);for(;i<o&&(i==a-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<a;)this.destroyRest(),this.top.dirty=sC,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let i=-1,o=this.top.children.length;r<this.preMatch.index&&(o=Math.min(this.index+3,o));for(let t=this.index;t<o;t++){let n=this.top.children[t];if(n.matchesMark(e[a])&&!this.isLocked(n.dom)){i=t;break}}if(i<0&&this.index<this.top.children.length){let t=this.top.children[this.index];t instanceof mC&&t.dirty!=uC&&t.mark.type==e[a].type&&t.spec.update&&!this.isLocked(t.dom)&&t.spec.update(e[a])&&(t.mark=e[a],i=this.index,this.changed=!0)}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=mC.create(this.top,e[a],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,a++}}findNodeMatch(e,t,n,r){let i=-1,a;if(r>=this.preMatch.index&&(a=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,n))i=this.top.children.indexOf(a,this.index);else for(let r=this.index,a=Math.min(this.top.children.length,r+5);r<a;r++){let a=this.top.children[r];if(a.matchesNode(e,t,n)&&!this.preMatch.matched.has(a)){i=r;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let a=this.top.children[r];return a.dirty==uC&&a.dom==a.contentDOM&&(a.dirty=lC),a.update(e,t,n,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return-1}e=t}}updateNextNode(e,t,n,r,i,a){for(let o=this.index;o<this.top.children.length;o++){let s=this.top.children[o];if(s instanceof hC){let c=this.preMatch.matched.get(s);if(c!=null&&c!=i)return!1;let l=s.dom,u,d=this.isLocked(l)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&s.dirty!=uC&&DC(t,s.outerDeco));if(!d&&s.update(e,t,n,r))return this.destroyBetween(this.index,o),s.dom!=l&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(s,e,t,n,r,a)))return this.destroyBetween(this.index,o),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=lC,u.updateChildren(r,a+1),u.dirty=sC),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!DC(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=hC.create(this.top,t,n,r,i,a);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,t,n,r,i){let a=hC.create(this.top,e,t,n,r,i);a.contentDOM&&a.updateChildren(r,i+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new fC(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof mC;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof _C)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((SS||bS)&&e&&e.dom.contentEditable==`false`&&this.addHackNode(`IMG`,t),this.addHackNode(`BR`,this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e==`IMG`&&(n.className=`ProseMirror-separator`,n.alt=``),e==`BR`&&(n.className=`ProseMirror-trailingBreak`);let r=new vC(this.top,[],n,null);t==this.top?t.children.splice(this.index++,0,r):t.children.push(r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||Z(e)&&e.contains(this.lock.parentNode))}};function AC(e,t){let n=t,r=n.children.length,i=e.childCount,a=new Map,o=[];outer:for(;i>0;){let s;for(;;)if(r){let e=n.children[r-1];if(e instanceof mC)n=e,r=e.children.length;else{s=e,r--;break}}else if(n==t)break outer;else r=n.parent.children.indexOf(n),n=n.parent;let c=s.node;if(c){if(c!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function jC(e,t){return e.type.side-t.type.side}function MC(e,t,n,r){let i=t.locals(e),a=0;if(i.length==0){for(let n=0;n<e.childCount;n++){let o=e.child(n);r(o,i,t.forChild(a,o),n),a+=o.nodeSize}return}let o=0,s=[],c=null;for(let l=0;;){let u,d;for(;o<i.length&&i[o].to==a;){let e=i[o++];e.widget&&(u?(d||=[u]).push(e):u=e)}if(u){if(d){d.sort(jC);for(let e=0;e<d.length;e++)n(d[e],l,!!c)}else n(u,l,!!c)}let f,p;if(c)p=-1,f=c,c=null;else if(l<e.childCount)p=l,f=e.child(l++);else break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1);for(;o<i.length&&i[o].from<=a&&i[o].to>a;)s.push(i[o++]);let m=a+f.nodeSize;if(f.isText){let e=m;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<s.length;t++)s[t].to<e&&(e=s[t].to);e<m&&(c=f.cut(e-a),f=f.cut(0,e-a),m=e,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let h=f.isInline&&!f.isLeaf?s.filter(e=>!e.inline):s.slice();r(f,h,t.forChild(a,f),p),a=m}}function NC(e){if(e.nodeName==`UL`||e.nodeName==`OL`){let t=e.style.cssText;e.style.cssText=t+`; list-style: square !important`,window.getComputedStyle(e).listStyle,e.style.cssText=t}}function PC(e,t,n,r){for(let i=0,a=0;i<e.childCount&&a<=r;){let o=e.child(i++),s=a;if(a+=o.nodeSize,!o.isText)continue;let c=o.text;for(;i<e.childCount;){let t=e.child(i++);if(a+=t.nodeSize,!t.isText)break;c+=t.text}if(a>=n){if(a>=r&&c.slice(r-t.length-s,r-s)==t)return r-t.length;let e=s<r?c.lastIndexOf(t,r-s-1):-1;if(e>=0&&e+t.length+s>=n)return s+e;if(n==r&&c.length>=r+t.length-s&&c.slice(r-s,r-s+t.length)==t)return r}}return-1}function FC(e,t,n,r,i){let a=[];for(let o=0,s=0;o<e.length;o++){let c=e[o],l=s,u=s+=c.size;l>=n||u<=t?a.push(c):(l<t&&a.push(c.slice(0,t-l,r)),i&&=(a.push(i),void 0),u>n&&a.push(c.slice(n-l,c.size,r)))}return a}function IC(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let s=r.resolve(o),c,l;if(oS(n)){for(c=o;i&&!i.node;)i=i.parent;if(i&&i.node.isAtom&&X.isSelectable(i.node)&&i.parent&&!(i.node.isInline&&iS(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new X(o==e?s:r.resolve(e))}else if(vS&&t==`key`&&o>e.state.selection.to&&Z(n.focusNode)&&n.focusOffset==n.focusNode.childNodes.length&&i&&i.posAtStart>e.state.selection.to)for(let e=n.focusNode;;e=e.parentNode){if(getComputedStyle(e).overflow!=`visible`){l=J.findFrom(r.resolve(i.posAtStart),1);break}if(e==i.dom||e.nextSibling||!e.parentNode||!Z(e.parentNode))break}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=o,i=o;for(let r=0;r<n.rangeCount;r++){let a=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(a.startContainer,a.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(a.endContainer,a.endOffset,-1))}if(t<0)return null;[c,o]=i==e.state.selection.anchor?[i,t]:[t,i],s=r.resolve(o)}else c=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!l){let n=t==`pointer`||e.state.selection.head<s.pos&&!a?1:-1;l=qC(e,u,s,n)}return l}function LC(e){return e.editable?e.hasFocus():YC(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function RC(e,t=!1){let n=e.state.selection;if(GC(e,n),!LC(e))return;let r=e.input.mouseDown;if(!t&&bS&&r){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&Xx(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)&&r.delaySelUpdate()){e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)WC(e);else{let{anchor:r,head:i}=n,a,o;zC&&!(n instanceof Y)&&(n.$from.parent.inlineContent||(a=BC(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=BC(e,n.to))),e.docView.setSelection(r,i,e,t),zC&&(a&&HC(a),o&&HC(o)),n.visible?e.dom.classList.remove(`ProseMirror-hideselection`):(e.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&UC(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}var zC=SS||bS&&xS<63;function BC(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,a=r?n.childNodes[r-1]:null;if(SS&&i&&i.contentEditable==`false`)return VC(i);if((!i||i.contentEditable==`false`)&&(!a||a.contentEditable==`false`)){if(i)return VC(i);if(a)return VC(a)}}function VC(e){return e.contentEditable=`true`,SS&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function HC(e){e.contentEditable=`false`,e.wasDraggable&&=(e.draggable=!0,null)}function UC(e){let t=e.dom.ownerDocument;t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener(`selectionchange`,e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard),setTimeout(()=>{(!LC(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function WC(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName==`IMG`;r?t.collapse(n.parentNode,Gx(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&gS&&_S<=11&&(n.disabled=!0,n.disabled=!1)}function GC(e,t){if(t instanceof X){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(KC(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else KC(e)}function KC(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function qC(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||Y.between(t,n,r)}function JC(e){return e.editable&&!e.hasFocus()?!1:YC(e)}function YC(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return tS(e.dom,t.anchorNode)&&(e.editable||tS(e.dom,t.focusNode))}catch{return!1}}function XC(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Xx(t.node,t.offset,n.anchorNode,n.anchorOffset)}function ZC(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&J.findFrom(a,t)}function QC(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function $C(e,t,n){let r=e.state.selection;if(r instanceof Y){if(n.indexOf(`s`)>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let a=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return QC(e,new Y(r.$anchor,a))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=ZC(e.state,t);return n&&n instanceof X?QC(e,n):!1}if(!wS||n.indexOf(`m`)<0){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,a;if(!i||i.isText)return!1;let o=t<0?n.pos-i.nodeSize:n.pos;return i.isAtom||(a=e.docView.descAt(o))&&!a.contentDOM?X.isSelectable(i)?QC(e,new X(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):QC(e,new Y(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1}}else if(r instanceof X&&r.node.isInline)return QC(e,new Y(t>0?r.$to:r.$from));else{let n=ZC(e.state,t);return n?QC(e,n):!1}}function ew(e,t){let n=e.pmViewDesc;return n?n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`):Z(e)&&e.contentEditable==`false`}function tw(e,t){return t<0?nw(e):rw(e)}function nw(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for(vS&&Z(n)&&r<$x(n)&&ew(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(!Z(n))break;let e=n.childNodes[r-1];if(ew(e,-1))i=n,a=--r;else if(eS(e))n=e,r=n.nodeValue.length;else break}else if(iw(n))break;else{let t=n.previousSibling;for(;t&&ew(t,-1);)i=n.parentNode,a=Gx(t),t=t.previousSibling;if(t)n=t,r=$x(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?sw(e,n,r):i&&sw(e,i,a)}function rw(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=$x(n),a,o;for(;;)if(r<i){if(!Z(n))break;let e=n.childNodes[r];if(ew(e,1))a=n,o=++r;else break}else if(iw(n))break;else{let t=n.nextSibling;for(;t&&ew(t,1);)a=t.parentNode,o=Gx(t)+1,t=t.nextSibling;if(t)n=t,r=0,i=$x(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&sw(e,a,o)}function iw(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function aw(e,t){for(;e&&t==e.childNodes.length&&!aS(e);)t=Gx(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(eS(n))return n;if(Z(n)&&n.contentEditable==`false`)break;e=n,t=0}}function ow(e,t){for(;e&&!t&&!aS(e);)t=Gx(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(eS(n))return n;if(Z(n)&&n.contentEditable==`false`)break;e=n,t=e.childNodes.length}}function sw(e,t,n){if(!eS(t)){let e,r;(r=aw(t,n))?(t=r,n=0):(e=ow(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection(),i=e.domSelectionRange();if(!r)return;oS(i)?r.collapse(t,n):r.extend&&(r.collapse(i.anchorNode,i.anchorOffset),r.extend(t,n)),e.domObserver.setCurSelection();let{state:a}=e;setTimeout(()=>{e.state==a&&RC(e)},50)}function cw(e,t){let n=e.state.doc.resolve(t);if(!(bS||TS)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?`ltr`:`rtl`}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?`ltr`:`rtl`}}let r=e.dom;for(let t=n.depth;t>0;t--)if(n.node(t).isBlock){r=e.nodeDOM(n.before(t))||r;break}return getComputedStyle(r).direction==`rtl`?`rtl`:`ltr`}function lw(e,t,n){let r=e.state.selection;if(r instanceof Y&&!r.empty||n.indexOf(`s`)>-1||wS&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=ZC(e.state,t);if(n&&n instanceof X)return QC(e,n)}if(!i.parent.inlineContent){let n=t<0?i:a,o=r instanceof Lb?J.near(n,t):J.findFrom(n,t);return o?QC(e,o):!1}return!1}function uw(e,t){if(!(e.state.selection instanceof Y))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`))return!0;let a=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let r=e.state.tr;return t<0?r.delete(n.pos-a.nodeSize,n.pos):r.delete(n.pos,n.pos+a.nodeSize),e.dispatch(r),!0}return!1}function dw(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function fw(e){if(!SS||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&Z(t)&&n==0&&t.firstChild&&Z(t.firstChild)&&t.firstChild.contentEditable==`false`){let n=t.firstChild;dw(e,n,`true`),setTimeout(()=>dw(e,n,`false`),20)}return!1}function pw(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function mw(e,t){let n=t.keyCode,r=pw(t);if(n==8||wS&&n==72&&r==`c`)return uw(e,-1)||tw(e,-1);if(n==46&&!t.shiftKey||wS&&n==68&&r==`c`)return uw(e,1)||tw(e,1);if(n==13||n==27)return!0;if(n==37||wS&&n==66&&r==`c`){let t=n==37?cw(e,e.state.selection.from)==`ltr`?-1:1:-1;return $C(e,t,r)||tw(e,t)}if(n==39||wS&&n==70&&r==`c`){let t=n==39?cw(e,e.state.selection.from)==`ltr`?1:-1:1;return $C(e,t,r)||tw(e,t)}return n==38||wS&&n==80&&r==`c`?lw(e,-1,r)||tw(e,-1):n==40||wS&&n==78&&r==`c`?fw(e)||lw(e,1,r)||tw(e,1):!(r!=(wS?`m`:`c`)||n!=66&&n!=73&&n!=89&&n!=90)}function hw(e,t){e.someProp(`transformCopied`,n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let e=r.firstChild;n.push(e.type.name,e.attrs==e.type.defaultAttrs?null:e.attrs),r=e.content}let o=e.someProp(`clipboardSerializer`)||cy.fromSchema(e.state.schema),s=Tw(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&Z(l)&&(u=ww[l.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=s.createElement(u[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),d++}l=c.firstChild}return l&&Z(l)&&l.setAttribute(`data-pm-slice`,`${i} ${a}${d?` -${d}`:``} ${JSON.stringify(n)}`),{dom:c,text:e.someProp(`clipboardTextSerializer`,n=>n(t,e))||t.content.textBetween(0,t.content.size,`
|
|
56
|
+
|
|
57
|
+
`),slice:t}}function gw(e,t,n,r,i){let a=i.parent.type.spec.code,o,s;if(!n&&!t)return null;let c=!!t&&(r||a||!n);if(c){if(e.someProp(`transformPastedText`,n=>{t=n(t,a||r,e)}),a)return s=new q(K.from(e.state.schema.text(t.replace(/\r\n?/g,`
|
|
58
|
+
`))),0,0),e.someProp(`transformPasted`,t=>{s=t(s,e,!0)}),s;let n=e.someProp(`clipboardTextParser`,n=>n(t,i,r,e));if(n)s=n;else{let n=i.marks(),{schema:r}=e.state,a=cy.fromSchema(r);o=document.createElement(`div`),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement(`p`));e&&t.appendChild(a.serializeNode(r.text(e,n)))})}}else e.someProp(`transformPastedHTML`,t=>{n=t(n,e)}),o=Ow(n),DS&&kw(o);let l=o&&o.querySelector(`[data-pm-slice]`),u=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute(`data-pm-slice`)||``);if(u&&u[3])for(let e=+u[3];e>0;e--){let e=o.firstChild;for(;e&&!Z(e);)e=e.nextSibling;if(!e)break;o=e}if(s||=(e.someProp(`clipboardParser`)||e.someProp(`domParser`)||Jv.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!_w.test(e.parentNode.nodeName)?{ignore:!0}:null}}),u)s=Aw(Cw(s,+u[1],+u[2]),u[4]);else if(s=q.maxOpen(vw(s.content,i),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=Cw(s,e,t)}return e.someProp(`transformPasted`,t=>{s=t(s,e,c)}),s}var _w=/^(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 vw(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),i,a=[];if(e.forEach(e=>{if(!a)return;let t=r.findWrapping(e.type),n;if(!t)return a=null;if(n=a.length&&i.length&&bw(t,i,e,a[a.length-1],0))a[a.length-1]=n;else{a.length&&(a[a.length-1]=xw(a[a.length-1],i.length));let n=yw(e,t);a.push(n),r=r.matchType(n.type),i=t}}),a)return K.from(a)}return e}function yw(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,K.from(e));return e}function bw(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let a=bw(e,t,n,r.lastChild,i+1);if(a)return r.copy(r.content.replaceChild(r.childCount-1,a));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(K.from(yw(n,e,i+1))))}}function xw(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,xw(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(K.empty,!0);return e.copy(n.append(r))}function Sw(e,t,n,r,i,a){let o=t<0?e.firstChild:e.lastChild,s=o.content;return e.childCount>1&&(a=0),i<r-1&&(s=Sw(s,t,n,r,i+1,a)),i>=n&&(s=t<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(K.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function Cw(e,t,n){return t<e.openStart&&(e=new q(Sw(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new q(Sw(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var ww={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 Tw(){return document.implementation.createHTMLDocument(`title`)}var Ew=null;function Dw(e){let t=window.trustedTypes;if(!t)return e;if(!Ew){if(Ew=t.defaultPolicy)try{return Ew.createHTML(e)}catch{}Ew=t.createPolicy(`ProseMirrorClipboard`,{createHTML:e=>e})}return Ew.createHTML(e)}function Ow(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=Tw(),r=n.body,i=/<([a-z][^>\s]+)/i.exec(e),a;if((a=i&&ww[i[1].toLowerCase()])&&(e=a.map(e=>`<`+e+`>`).join(``)+e+a.map(e=>`</`+e+`>`).reverse().join(``)),r.innerHTML=Dw(e),a)for(let e=0;e<a.length;e++)r=r.querySelector(a[e])||r;for(let e=0;e<n.styleSheets.length;e++){let t=n.styleSheets[e];for(let e=0;e<t.rules.length;e++){let n=t.rules[e];if(n instanceof CSSStyleRule){let e=r.querySelectorAll(n.selectorText);for(let t=0;t<e.length;t++)e[t].style.cssText+=n.style.cssText}}}return r}function kw(e){let t=e.querySelectorAll(bS?`span:not([class]):not([style])`:`span.Apple-converted-space`);for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==`\xA0`&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(` `),r)}}function Aw(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:i,openStart:a,openEnd:o}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;try{i=K.from(t.create(r[e+1],i))}catch{break}a++,o++}return new q(i,a,o)}var jw={},Mw={},Nw={touchstart:!0,touchmove:!0},Pw=class{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 Fw(e){for(let t in jw){let n=jw[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{Bw(e,t)&&!zw(e,t)&&(e.editable||!(t.type in Mw))&&n(e,t)},Nw[t]?{passive:!0}:void 0)}SS&&e.dom.addEventListener(`input`,()=>null),Rw(e)}function Iw(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Lw(e){e.input.mouseDown&&e.input.mouseDown.done(),e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function Rw(e){e.someProp(`handleDOMEvents`,t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>zw(e,t))})}function zw(e,t){return e.someProp(`handleDOMEvents`,n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function Bw(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function Vw(e,t){!zw(e,t)&&jw[t.type]&&(e.editable||!(t.type in Mw))&&jw[t.type](e,t)}Mw.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!iT(e)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(ES&&bS&&n.keyCode==13))){if(n.keyCode!=229&&e.domObserver.forceFlush(),CS&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp(`handleKeyDown`,t=>t(e,sS(13,`Enter`))),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,t=>t(e,n))||mw(e,n)?n.preventDefault():Iw(e,`key`)}},Mw.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},Mw.keypress=(e,t)=>{let n=t;if(iT(e)||!n.charCode||n.ctrlKey&&!n.altKey||wS&&n.metaKey)return;if(e.someProp(`handleKeyPress`,t=>t(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof Y)||!r.$from.sameParent(r.$to)){let t=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(t).scrollIntoView();!/[\r\n]/.test(t)&&!e.someProp(`handleTextInput`,n=>n(e,r.$from.pos,r.$to.pos,t,i))&&e.dispatch(i()),n.preventDefault()}};function Hw(e){return{left:e.clientX,top:e.clientY}}function Uw(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function Ww(e,t,n,r,i){if(r==-1)return!1;let a=e.state.doc.resolve(r);for(let r=a.depth+1;r>0;r--)if(e.someProp(t,t=>r>a.depth?t(e,n,a.nodeAfter,a.before(r),i,!0):t(e,n,a.node(r),a.before(r),i,!1)))return!0;return!1}function Gw(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);r.setMeta(`pointer`,!0),e.dispatch(r)}function Kw(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&X.isSelectable(r)?(Gw(e,new X(n)),!0):!1}function qw(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof X&&(r=n.node);let a=e.state.doc.resolve(t);for(let e=a.depth+1;e>0;e--){let t=e>a.depth?a.nodeAfter:a.node(e);if(X.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?a.before(n.$from.depth):a.before(e);break}}return i!=null&&(Gw(e,X.create(e.state.doc,i)),!0)}function Jw(e,t,n,r,i){return Ww(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,n=>n(e,t,r))||(i?qw(e,n):Kw(e,n))}function Yw(e,t,n,r){return Ww(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,n=>n(e,t,r))}function Xw(e,t,n,r){return Ww(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,n=>n(e,t,r))||Zw(e,n,r)}function Zw(e,t,n){if(n.button!=0)return!1;let r=Qw(e,t,!0),i=e.state.doc;return r?(Gw(e,r),r instanceof Y&&i.eq(e.state.doc)&&(e.input.mouseDown=new rT(e,r)),!0):!1}function Qw(e,t,n){let r=e.state.doc;if(t==-1)return r.inlineContent?Y.create(r,0,r.content.size):null;let i=r.resolve(t);for(let e=i.depth+1;e>0;e--){let t=e>i.depth?i.nodeAfter:i.node(e),a=i.before(e);if(t.inlineContent)return Y.create(r,a+1,a+1+t.content.size);if(n&&X.isSelectable(t))return X.create(r,a)}return null}function $w(e){return uT(e)}var eT=wS?`metaKey`:`ctrlKey`;jw.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=$w(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&Uw(n,e.input.lastClick)&&!n[eT]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type==`singleClick`?a=`doubleClick`:e.input.lastClick.type==`doubleClick`&&(a=`tripleClick`)),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button},e.input.mouseDown&&e.input.mouseDown.done();let o=e.posAtCoords(Hw(n));o&&(a==`singleClick`?e.input.mouseDown=new nT(e,o,n,!!r):(a==`doubleClick`?Yw:Xw)(e,o.pos,o.inside,n)?n.preventDefault():Iw(e,`pointer`))};var tT=class{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}},nT=class extends tT{constructor(e,t,n,r){super(e),this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!n[eT],this.allowDefault=n.shiftKey;let i,a;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,a=n.depth?n.before():0}let o=r?null:n.target,s=o?e.docView.nearestDesc(o,!0):null;this.target=s&&Z(s.nodeDOM)?s.nodeDOM:null;let{selection:c}=e.state;n.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof X&&c.from<=a&&c.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!(!this.target||this.target.draggable),setUneditable:!!(this.target&&vS&&!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()),Iw(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||RC(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Hw(e))),this.updateAllowDefault(e),this.allowDefault||!t?Iw(this.view,`pointer`):Jw(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||SS&&this.mightDrag&&!this.mightDrag.node.isAtom||bS&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Gw(this.view,J.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Iw(this.view,`pointer`)}move(e){this.updateAllowDefault(e),Iw(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}},rT=class extends tT{constructor(e,t){super(e),this.startSelection=t,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(),Iw(this.view,`pointer`);let t=this.view.posAtCoords(Hw(e)),n=t&&Qw(this.view,t.inside,!1);if(!n)return;let{doc:r}=this.view.state,i=this.startSelection,[a,o]=n.from<i.from?[i.to,n.from]:[i.from,n.to];Gw(this.view,Y.create(r,a,o))}};jw.touchstart=e=>{e.input.lastTouch=Date.now(),$w(e),Iw(e,`pointer`)},jw.touchmove=e=>{e.input.lastTouch=Date.now(),Iw(e,`pointer`)},jw.contextmenu=e=>$w(e);function iT(e,t){return e.composing?!0:SS&&Math.abs(Date.now()-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var aT=ES?5e3:-1;Mw.compositionstart=Mw.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Y&&t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>e.type.spec.inclusive===!1)||bS&&TS&&oT(e)))e.markCursor=e.state.storedMarks||n.marks(),uT(e,!0),e.markCursor=null;else if(uT(e,!t.selection.empty),vS&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&Z(n)&&r!=0;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(eS(t)){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}sT(e,aT)};function oT(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||!Z(t)||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return Z(r)&&r.contentEditable==`false`}Mw.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,sT(e,20))};function sT(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>uT(e),t))}function cT(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function lT(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=nS(t.focusNode,t.focusOffset),r=rS(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(e&&e.isText(n.nodeValue))return r}}return n||r}function uT(e,t=!1){if(!(ES&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),cT(e),t||e.docView&&e.docView.dirty){let n=IC(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function dT(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement(`div`));n.appendChild(t),n.style.cssText=`position: fixed; left: -10000px; top: 10px`;let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}var fT=gS&&_S<15||CS&&OS<604;jw.copy=Mw.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type==`cut`;if(r.empty)return;let a=fT?null:n.clipboardData,{dom:o,text:s}=hw(e,r.content());a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,o.innerHTML),a.setData(`text/plain`,s)):dT(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))};function pT(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function mT(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.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=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?hT(e,r.value,null,i,t):hT(e,r.textContent,r.innerHTML,i,t)},50)}function hT(e,t,n,r,i){let a=gw(e,t,n,r,e.state.selection.$from);if(e.someProp(`handlePaste`,t=>t(e,i,a||q.empty)))return!0;if(!a)return!1;let o=pT(a),s=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(a);return e.dispatch(s.scrollIntoView().setMeta(`paste`,!0).setMeta(`uiEvent`,`paste`)),!0}function gT(e){let t=e.getData(`text/plain`)||e.getData(`Text`);if(t)return t;let n=e.getData(`text/uri-list`);return n?n.replace(/\r?\n/g,` `):``}Mw.paste=(e,t)=>{let n=t;if(e.composing&&!ES)return;let r=fT?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&hT(e,gT(r),r.getData(`text/html`),i,n)?n.preventDefault():mT(e,n)};var _T=class{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}},vT=wS?`altKey`:`ctrlKey`;function yT(e,t){let n;return e.someProp(`dragCopies`,e=>{n||=e(t)}),n==null?!t[vT]:!n}jw.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,a=i.empty?null:e.posAtCoords(Hw(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof X?i.to-1:i.to))){if(r&&r.mightDrag)o=X.create(e.state.doc,r.mightDrag.pos);else if(n.target&&Z(n.target)){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=X.create(e.state.doc,t.posBefore))}}let{dom:s,text:c,slice:l}=hw(e,(o||e.state.selection).content());(!n.dataTransfer.files.length||!bS||xS>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(fT?`Text`:`text/html`,s.innerHTML),n.dataTransfer.effectAllowed=`copyMove`,fT||n.dataTransfer.setData(`text/plain`,c),e.dragging=new _T(l,yT(e,n),o)},jw.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},Mw.dragover=Mw.dragenter=(e,t)=>t.preventDefault(),Mw.drop=(e,t)=>{try{bT(e,t,e.dragging)}finally{e.dragging=null}};function bT(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(Hw(t));if(!r)return;let i=e.state.doc.resolve(r.pos),a=n&&n.slice;a?e.someProp(`transformPasted`,t=>{a=t(a,e,!1)}):a=gw(e,gT(t.dataTransfer),fT?null:t.dataTransfer.getData(`text/html`),!1,i);let o=!!(n&&yT(e,t));if(e.someProp(`handleDrop`,n=>n(e,t,a||q.empty,o))){t.preventDefault();return}if(!a)return;t.preventDefault();let s=a?ub(e.state.doc,i.pos,a):i.pos;s??=i.pos;let c=e.state.tr;if(o){let{node:e}=n;e?e.replace(c):c.deleteSelection()}let l=c.mapping.map(s),u=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,d=c.doc;if(u?c.replaceRangeWith(l,l,a.content.firstChild):c.replaceRange(l,l,a),c.doc.eq(d))return;let f=c.doc.resolve(l);if(u&&X.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new X(f));else{let t=c.mapping.map(s);c.mapping.maps[c.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),c.setSelection(qC(e,f,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta(`uiEvent`,`drop`))}jw.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add(`ProseMirror-focused`),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&RC(e)},20))},jw.blur=(e,t)=>{let n=t;e.focused&&=(e.domObserver.stop(),e.dom.classList.remove(`ProseMirror-focused`),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),!1)},jw.beforeinput=(e,t)=>{if(ES&&t.inputType==`deleteContentBackward`){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp(`handleKeyDown`,t=>t(e,sS(8,`Backspace`)))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in Mw)jw[e]=Mw[e];function xT(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}var ST=class{constructor(e){this.frag=e,this.index=0,this.off=0}nodeAt(e){for(;this.off<=e&&this.index<this.frag.childCount;){let t=this.frag.child(this.index);if(this.off==e)return t;this.off+=t.nodeSize,this.index++}return null}},CT=class e{constructor(e,t){this.toDOM=e,this.spec=t||OT,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:a}=e.mapResult(t.from+r,this.side<0?-1:1);return a?null:new ET(i-n,i-n,this)}valid(){return!0}eq(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&xT(this.spec,t.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},wT=class e{constructor(e,t){this.attrs=e,this.spec=t||OT}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,a=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=a?null:new ET(i,a,this)}valid(e,t){return t.from<t.to}eq(t){return this==t||t instanceof e&&xT(this.attrs,t.attrs)&&xT(this.spec,t.spec)}static is(t){return t.type instanceof e}destroy(){}},TT=class e{constructor(e,t){this.attrs=e,this.spec=t||OT}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let a=e.mapResult(t.to+r,-1);return a.deleted||a.pos<=i.pos?null:new ET(i.pos-n,a.pos-n,this)}valid(e,t,n){let r=n.nodeAt(t.from);return!!r&&!r.isText&&t.from+r.nodeSize==t.to}eq(t){return this==t||t instanceof e&&xT(this.attrs,t.attrs)&&xT(this.spec,t.spec)}destroy(){}},ET=class e{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(t,n){return new e(t,n,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(t,n,r){return new e(t,t,new CT(n,r))}static inline(t,n,r,i){return new e(t,n,new wT(r,i))}static node(t,n,r,i){return new e(t,n,new TT(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof wT}get widget(){return this.type instanceof CT}},DT=[],OT={},kT=class e{constructor(e,t){this.local=e.length?e:DT,this.children=t.length?t:DT}static create(e,t){return t.length?LT(t,e,0,OT):AT}find(e,t,n){let r=[];return this.findInner(e??0,t??1e9,r,0,n),r}findInner(e,t,n,r,i){for(let a=0;a<this.local.length;a++){let o=this.local[a];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let o=this.children[a]+1;this.children[a+2].findInner(e-o,t-o,n,r+o,i)}}map(e,t,n){return this==AT||e.maps.length==0?this:this.mapInner(e,t,0,0,n||OT)}mapInner(t,n,r,i,a){let o;if(this.local.length){let e=new ST(n.content);for(let s=0;s<this.local.length;s++){let c=this.local[s].map(t,r,i);c&&c.type.valid(n,c,e)?(o||=[]).push(c):a.onRemove&&a.onRemove(this.local[s].spec)}}return this.children.length?MT(this.children,o||[],t,n,r,i,a):o?new e(o.sort(RT),DT):AT}add(t,n){return n.length?this==AT?e.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let i,a=0;t.forEach((e,t)=>{let o=t+r,s;if(s=FT(n,e,o)){for(i||=this.children.slice();a<i.length&&i[a]<t;)a+=3;i[a]==t?i[a+2]=i[a+2].addInner(e,s,o+1):i.splice(a,0,t,t+e.nodeSize,LT(s,e,o+1,OT)),a+=3}});let o=NT(a?IT(n):n,-r);if(o.length){let e=new ST(t.content);for(let n=0;n<o.length;n++)o[n].type.valid(t,o[n],e)||o.splice(n--,1)}return new e(o.length?this.local.concat(o).sort(RT):this.local,i||this.children)}remove(e){return e.length==0||this==AT?this:this.removeInner(e,0)}removeInner(t,n){let r=this.children,i=this.local;for(let e=0;e<r.length;e+=3){let i,a=r[e]+n,o=r[e+1]+n;for(let e=0,n;e<t.length;e++)(n=t[e])&&n.from>a&&n.to<o&&(t[e]=null,(i||=[]).push(n));if(!i)continue;r==this.children&&(r=this.children.slice());let s=r[e+2].removeInner(i,a+1);s==AT?(r.splice(e,3),e-=3):r[e+2]=s}if(i.length){for(let e=0,r;e<t.length;e++)if(r=t[e])for(let e=0;e<i.length;e++)i[e].eq(r,n)&&(i==this.local&&(i=this.local.slice()),i.splice(e--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new e(i,r):AT}forChild(t,n){if(this==AT)return this;if(n.isLeaf)return e.empty;let r,i;for(let e=0;e<this.children.length;e+=3)if(this.children[e]>=t){this.children[e]==t&&(r=this.children[e+2]);break}let a=t+1,o=a+n.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>a&&t.type instanceof wT){let e=Math.max(a,t.from)-a,n=Math.min(o,t.to)-a;e<n&&(i||=[]).push(t.copy(e,n))}}if(i){let t=new e(i.sort(RT),DT);return r?new jT([t,r]):t}return r||AT}eq(t){if(this==t)return!0;if(!(t instanceof e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(e){return zT(this.localsInner(e))}localsInner(e){if(this==AT)return DT;if(e.inlineContent||!this.local.some(wT.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof wT||t.push(this.local[e]);return t}forEachSet(e){e(this)}};kT.empty=new kT([],[]),kT.removeOverlap=zT;var AT=kT.empty,jT=class e{constructor(e){this.members=e}map(t,n){let r=this.members.map(e=>e.map(t,n,OT));return e.from(r)}forChild(t,n){if(n.isLeaf)return kT.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(t,n);a!=AT&&(a instanceof e?r=r.concat(a.members):r.push(a))}return e.from(r)}eq(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length){if(!t)t=i;else{n&&=(t=t.slice(),!1);for(let e=0;e<i.length;e++)t.push(i[e])}}}return t?zT(n?t:t.sort(RT)):DT}static from(t){switch(t.length){case 0:return AT;case 1:return t[0];default:return new e(t.every(e=>e instanceof kT)?t:t.reduce((e,t)=>e.concat(t instanceof kT?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function MT(e,t,n,r,i,a,o){let s=e.slice();for(let e=0,t=a;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,a)=>{let o=a-i-(n-e);for(let i=0;i<s.length;i+=3){let a=s[i+1];if(a<0||e>a+t-r)continue;let c=s[i]+t-r;n>=c?s[i+1]=e<=c?-2:-1:e>=t&&o&&(s[i]+=o,s[i+1]+=o)}r+=o}),t=n.maps[e].map(t,-1)}let c=!1;for(let t=0;t<s.length;t+=3)if(s[t+1]<0){if(s[t+1]==-2){c=!0,s[t+1]=-1;continue}let l=n.map(e[t]+a),u=l-i;if(u<0||u>=r.content.size){c=!0;continue}let d=n.map(e[t+1]+a,-1)-i,{index:f,offset:p}=r.content.findIndex(u),m=r.maybeChild(f);if(m&&p==u&&p+m.nodeSize==d){let r=s[t+2].mapInner(n,m,l+1,e[t]+a+1,o);r==AT?(s[t+1]=-2,c=!0):(s[t]=u,s[t+1]=d,s[t+2]=r)}else c=!0}if(c){let c=LT(PT(s,e,t,n,i,a,o),r,0,o);t=c.local;for(let e=0;e<s.length;e+=3)s[e+1]<0&&(s.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<s.length&&s[t]<n;)t+=3;s.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new kT(t.sort(RT),s)}function NT(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new ET(i.from+t,i.to+t,i.type))}return n}function PT(e,t,n,r,i,a,o){function s(e,t){for(let a=0;a<e.local.length;a++){let s=e.local[a].map(r,i,t);s?n.push(s):o.onRemove&&o.onRemove(e.local[a].spec)}for(let n=0;n<e.children.length;n+=3)s(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)e[n+1]==-1&&s(e[n+2],t[n]+a+1);return n}function FT(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,a;t<e.length;t++)(a=e[t])&&a.from>n&&a.to<r&&((i||=[]).push(a),e[t]=null);return i}function IT(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function LT(e,t,n,r){let i=[],a=!1;t.forEach((t,o)=>{let s=FT(e,t,o+n);if(s){a=!0;let e=LT(s,t,n+o+1,r);e!=AT&&i.push(o,o+t.nodeSize,e)}});let o=NT(a?IT(e):e,-n).sort(RT);if(o.length){let e=new ST(t.content);for(let n=0;n<o.length;n++)o[n].type.valid(t,o[n],e)||(r.onRemove&&r.onRemove(o[n].spec),o.splice(n--,1))}return o.length||i.length?new kT(o,i):AT}function RT(e,t){return e.from-t.from||e.to-t.to}function zT(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let a=t[i];if(a.from==r.from)a.to!=r.to&&(t==e&&(t=e.slice()),t[i]=a.copy(a.from,r.to),BT(t,i+1,a.copy(r.to,a.to)));else{a.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,a.from),BT(t,i,r.copy(a.from,r.to)));break}}}return t}function BT(e,t,n){for(;t<e.length&&RT(n,e[t])>0;)t++;e.splice(t,0,n)}function VT(e){let t=[];return e.someProp(`decorations`,n=>{let r=n(e.state);r&&r!=AT&&t.push(r)}),e.cursorWrapper&&t.push(kT.create(e.state.doc,[e.cursorWrapper.deco])),jT.from(t)}var HT={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},UT=gS&&_S<=11,WT=class{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}},GT=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new WT,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);gS&&_S<=11&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():SS&&e.composing&&t.some(e=>e.type==`childList`&&e.target.nodeName==`TR`)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),UT&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.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,HT)),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 t=0;t<e.length;t++)this.queue.push(e[t]);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(JC(this.view)){if(this.suppressingSelectionUpdates)return RC(this.view);if(gS&&_S<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Xx(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 t=new Set,n;for(let n=e.focusNode;n;n=Kx(n))t.add(n);for(let r=e.anchorNode;r;r=Kx(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:`selection`,target:eS(n)?n.parentNode:n}))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 t=this.pendingRecords();t.length&&(this.queue=[]);let n,r=!1;!this.suppressingSelectionUpdates&&JC(e)&&(n=e.domSelectionRange(),r=!this.currentSelection.eq(n)&&!this.ignoreSelectionChange(n));let i=-1,a=-1,o=!1,s=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],s);n&&(i=i<0?n.from:Math.min(n.from,i),a=a<0?n.to:Math.max(n.to,a),n.typeOver&&(o=!0))}if(s.some(e=>e.nodeName==`BR`)&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||bS&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&t.some(e=>e.type==`childList`&&e.removedNodes.length))){for(let e of s)if(e.nodeName==`BR`&&e.parentNode){let t=e.nextSibling;for(;t&&Z(t);){if(t.contentEditable==`false`){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(vS&&s.length){let t=s.filter(e=>e.nodeName==`BR`);if(t.length==2){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;t&&t.nodeName==`LI`&&(!n||ZT(e,n)!=t)&&r.remove()}}}let c=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&oS(n)&&(c=IC(e))&&c.eq(J.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,RC(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),JT(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,QT(e,s)),this.handleDOMChange(i,a,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):n&&!this.currentSelection.eq(n)&&RC(e),n&&this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type==`attributes`&&(n==this.view.docView||e.attributeName==`contenteditable`||e.attributeName==`style`&&!e.oldValue&&!e.target.getAttribute(`style`))||!n||n.ignoreMutation(e))return null;if(e.type==`childList`){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),eS(r)&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(gS&&_S<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:a}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!a||Array.prototype.indexOf.call(e.addedNodes,a)<0)&&(i=a)}let a=r&&r.parentNode==e.target?Gx(r)+1:0,o=n.localPosFromDOM(e.target,a,-1),s=i&&i.parentNode==e.target?Gx(i):e.target.childNodes.length;return{from:o,to:n.localPosFromDOM(e.target,s,1)}}return e.type==`attributes`?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}},KT=new WeakMap,qT=!1;function JT(e){if(!KT.has(e)&&(KT.set(e,null),[`normal`,`nowrap`,`pre-line`].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=vS,qT)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.`),qT=!0}}function YT(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return Xx(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function XT(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return YT(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener(`beforeinput`,r,!0),document.execCommand(`indent`),e.dom.removeEventListener(`beforeinput`,r,!0),n?YT(e,n):null}function ZT(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function QT(e,t){let{focusNode:n,focusOffset:r}=e.domSelectionRange();for(let i of t)if(i.parentNode?.nodeName==`TR`){let t=i.nextSibling;for(;t&&t.nodeName!=`TD`&&t.nodeName!=`TH`;)t=t.nextSibling;if(t){let a=t;for(;;){let e=a.firstChild;if(!e||!Z(e)||e.contentEditable==`false`||/^(BR|IMG)$/.test(e.nodeName))break;a=e}a.insertBefore(i,a.firstChild),n==i&&e.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function $T(e,t,n,r){let{node:i,fromOffset:a,toOffset:o,from:s,to:c}=e.docView.parseRange(t,n),l=e.domSelectionRange(),u,d=l.anchorNode;if(d&&tS(e.dom,d)&&(u=[{node:d,offset:l.anchorOffset}],oS(l)||u.push({node:l.focusNode,offset:l.focusOffset})),bS&&e.input.lastKeyCode===8)for(let e=o;e>a;e--){let t=i.childNodes[e-1],n=t.pmViewDesc;if(t.nodeName==`BR`&&!n){o=e;break}if(!n||n.size)break}let f=e.state.doc,p=e.someProp(`domParser`)||Jv.fromSchema(e.state.schema),m=f.resolve(s),h=null,g=p.parse(i,{topNode:m.parent,topMatch:m.parent.contentMatchAt(m.index()),topOpen:!0,from:a,to:o,preserveWhitespace:m.parent.type.whitespace!=`pre`||`full`,findPositions:u,ruleFromNode:eE(r),context:m});if(u&&u[0].pos!=null){let e=u[0].pos,t=u[1]&&u[1].pos;t??=e,h={anchor:e+s,head:t+s}}return{doc:g,sel:h,from:s,to:c}}var eE=e=>t=>{let n=t.pmViewDesc;if(n)return n.parseRule(e);if(t.nodeName==`BR`&&t.parentNode){if(SS&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let e=document.createElement(`div`);return e.appendChild(document.createElement(`li`)),{skip:e}}if(t.parentNode.lastChild==t||SS&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName==`IMG`&&t.getAttribute(`mark-placeholder`))return{ignore:!0};return null},tE=/^(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 nE(e,t,n,r,i){let a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=IC(e,t);if(n&&!e.state.selection.eq(n)){if(bS&&ES&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp(`handleKeyDown`,t=>t(e,sS(13,`Enter`))))return;let r=e.state.tr.setSelection(n);t==`pointer`?r.setMeta(`pointer`,!0):t==`key`&&r.scrollIntoView(),a&&r.setMeta(`composition`,a),e.dispatch(r)}return}let o=e.state.doc.resolve(t),s=o.sharedDepth(n);t=o.before(s+1),n=e.state.doc.resolve(n).after(s+1);let c=e.state.selection,l=$T(e,t,n,i),u=e.state.doc,d=u.slice(l.from,l.to),f,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,p=`end`):(f=e.state.selection.from,p=`start`),e.input.lastKeyCode=null;let m=cE(d.content,l.doc.content,l.from,f,p);if(m&&e.input.domChangeCount++,(CS&&e.input.lastIOSEnter>Date.now()-225||ES)&&i.some(e=>Z(e)&&!tE.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp(`handleKeyDown`,t=>t(e,sS(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(!m){if(r&&c instanceof Y&&!c.empty&&c.$head.sameParent(c.$anchor)&&!e.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(l.sel){let t=rE(e,e.state.doc,l.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);a&&n.setMeta(`composition`,a),e.dispatch(n)}}return}}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof Y&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=l.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=l.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),gS&&_S<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>l.from&&l.doc.textBetween(m.start-l.from-1,m.start-l.from+1)==` \xA0`&&(m.start--,m.endA--,m.endB--);let h=l.doc.resolveNoCache(m.start-l.from),g=l.doc.resolveNoCache(m.endB-l.from),_=u.resolve(m.start),v=h.sameParent(g)&&h.parent.inlineContent&&_.end()>=m.endA;if((CS&&e.input.lastIOSEnter>Date.now()-225&&(!v||i.some(e=>e.nodeName==`DIV`||e.nodeName==`P`))||!v&&oE(l.doc,h.pos,g.pos))&&e.someProp(`handleKeyDown`,t=>t(e,sS(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&(v?m.endA>m.start&&m.endB==m.start:aE(u,m.start,m.endA,h,g))&&e.someProp(`handleKeyDown`,t=>t(e,sS(8,`Backspace`)))){ES&&bS&&e.domObserver.suppressSelectionUpdates();return}bS&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),ES&&!v&&h.start()!=g.start()&&g.parentOffset==0&&h.depth==g.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==m.endA&&(m.endB-=2,g=l.doc.resolveNoCache(m.endB-l.from),setTimeout(()=>{e.someProp(`handleKeyDown`,function(t){return t(e,sS(13,`Enter`))})},20));let y=m.start,b=m.endA,x=t=>{let n=t||e.state.tr.replace(y,b,l.doc.slice(m.start-l.from,m.endB-l.from));if(l.sel){let t=rE(e,n.doc,l.sel);t&&!(bS&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==y||t.head==n.mapping.map(b)-1)||gS&&t.empty&&t.head==y)&&n.setSelection(t)}return a&&n.setMeta(`composition`,a),n.scrollIntoView()},S;if(v){if(h.pos==g.pos){gS&&_S<=11&&h.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>RC(e),20));let t=x(e.state.tr.delete(y,b)),n=u.resolve(m.start).marksAcross(u.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.endB&&(S=iE(h.parent.content.cut(h.parentOffset,g.parentOffset),_.parent.content.cut(_.parentOffset,m.endA-_.start())))){let t=x(e.state.tr);S.type==`add`?t.addMark(y,b,S.mark):t.removeMark(y,b,S.mark),e.dispatch(t)}else if(h.parent.child(h.index()).isText&&h.index()==g.index()-+!g.textOffset){let t=h.parent.textBetween(h.parentOffset,g.parentOffset),n=()=>x(e.state.tr.insertText(t,y,b));e.someProp(`handleTextInput`,r=>r(e,y,b,t,n))||e.dispatch(n())}else e.dispatch(x())}else e.dispatch(x())}function rE(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:qC(e,t.resolve(n.anchor),t.resolve(n.head))}function iE(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,a=r,o,s,c;for(let e=0;e<r.length;e++)i=r[e].removeFromSet(i);for(let e=0;e<n.length;e++)a=n[e].removeFromSet(a);if(i.length==1&&a.length==0)s=i[0],o=`add`,c=e=>e.mark(s.addToSet(e.marks));else if(i.length==0&&a.length==1)s=a[0],o=`remove`,c=e=>e.mark(s.removeFromSet(e.marks));else return null;let l=[];for(let e=0;e<t.childCount;e++)l.push(c(t.child(e)));if(K.from(l).eq(e))return{mark:s,type:o}}function aE(e,t,n,r,i){if(n-t<=i.pos-r.pos||sE(r,!0,!1)<i.pos)return!1;let a=e.resolve(t);if(!r.parent.inlineContent){let e=a.nodeAfter;return e!=null&&n==t+e.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let o=e.resolve(sE(a,!0,!0));return!o.parent.isTextblock||o.pos>n||sE(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function oE(e,t,n){let r=0,i=0;return e.nodesBetween(t,n,(e,a)=>{e.isTextblock&&a>=t&&a<n?r++:(e.isText?/\S/.test(e.text.slice(Math.max(0,t-a),Math.min(e.nodeSize,n-a))):e.isLeaf)&&i++}),i==0&&r==1}function sE(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function cE(e,t,n,r,i){let a=e.findDiffStart(t,n),o=n+e.size,s=n+t.size;if(a==null)return null;let{a:c,b:l}=e.findDiffEnd(t,o,s);if(i==`end`){let e=Math.max(0,a-Math.min(c,l));r-=c+e-a}if(c<a&&o<s){let e=r<=a&&r>=c?a-r:0;a-=e,l=a+(l-c),c=a}else if(l<a){let e=r<=a&&r>=l?a-r:0;a-=e,c=a+(c-l),l=a}return{start:a,endA:c,endB:l}}var lE=class{constructor(e,t){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 Pw,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(gE),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=fE(this),dE(this),this.nodeViews=mE(this),this.docView=gC(this.state.doc,uE(this),VT(this),this.dom,this),this.domObserver=new GT(this,(e,t,n,r)=>nE(this,e,t,n,r)),this.domObserver.start(),Fw(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 t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Rw(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(gE),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){let n=this.state,r=!1,i=!1;e.storedMarks&&this.composing&&(cT(this),i=!0),this.state=e;let a=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=mE(this);hE(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Rw(this),this.editable=fE(this),dE(this);let o=VT(this),s=uE(this),c=n.plugins!=e.plugins&&!n.doc.eq(e.doc)?`reset`:e.scrollToSelection>n.scrollToSelection?`to selection`:`preserve`,l=r||!this.docView.matchesNode(e.doc,s,o);(l||!e.selection.eq(n.selection))&&(i=!0);let u=c==`preserve`&&i&&this.dom.style.overflowAnchor==null&&NS(this);if(i){this.domObserver.stop();let t=l&&(gS||bS)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&pE(n.selection,e.selection);if(l){let n=bS?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=lT(this)),(r||!this.docView.update(e.doc,s,o,this))&&(this.docView.updateOuterDeco(s),this.docView.destroy(),this.docView=gC(e.doc,s,o,this.dom,this)),!n||this.trackWrites&&this.dom.contains(this.trackWrites)||(t=!0)}let i=this.input.mouseDown;t||!(i&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&XC(this)&&i.delaySelUpdate())?RC(this,t):(GC(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),this.dragging?.node&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),c==`reset`?this.dom.scrollTop=0:c==`to selection`?this.scrollToSelection():u&&FS(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&tS(this.dom,e)&&!this.someProp(`handleScrollToSelection`,e=>e(this))){if(this.state.selection instanceof X){let t=this.docView.domAfterPos(this.state.selection.from);Z(t)&&MS(this,t.getBoundingClientRect(),e)}else MS(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 e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new _T(e.slice,e.move,r<0?void 0:X.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(n!=null&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(i!=null&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let a=i[n].props[e];if(a!=null&&(r=t?t(a):a))return r}}hasFocus(){if(gS){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&&RS(this.dom),RC(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let e=this.dom.parentNode;e;e=e.parentNode)if(e.nodeType==9||e.nodeType==11&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return KS(this,e)}coordsAtPos(e,t=1){return XS(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(r==null)throw RangeError(`DOM position not inside the editor`);return r}endOfTextblock(e,t){return oC(this,t||this.state,e)}pasteHTML(e,t){return hT(this,``,e,!1,t||new ClipboardEvent(`paste`))}pasteText(e,t){return hT(this,e,null,!0,t||new ClipboardEvent(`paste`))}serializeForClipboard(e){return hw(this,e)}destroy(){this.docView&&(Lw(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],VT(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Yx())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Vw(this,e)}domSelectionRange(){let e=this.dom.isConnected!==!1&&this.domSelection();return e?SS&&this.root.nodeType===11&&cS(this.dom.ownerDocument)==this.dom&&XT(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};lE.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function uE(e){let t=Object.create(null);return t.class=`ProseMirror`,t.contenteditable=String(e.editable),e.someProp(`attributes`,n=>{if(typeof n==`function`&&(n=n(e.state)),n)for(let e in n)e==`class`?t.class+=` `+n[e]:e==`style`?t.style=(t.style?t.style+`;`:``)+n[e]:!t[e]&&e!=`contenteditable`&&e!=`nodeName`&&(t[e]=String(n[e]))}),t.translate||=`no`,[ET.node(0,e.state.doc.content.size,t)]}function dE(e){if(e.markCursor){let t=document.createElement(`img`);t.className=`ProseMirror-separator`,t.setAttribute(`mark-placeholder`,`true`),t.setAttribute(`alt`,``),e.cursorWrapper={dom:t,deco:ET.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function fE(e){return!e.someProp(`editable`,t=>t(e.state)===!1)}function pE(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function mE(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp(`nodeViews`,n),e.someProp(`markViews`,n),t}function hE(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r}function gE(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError(`Plugins passed directly to the view must not have a state component`)}for(var _E={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:`'`},vE={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},yE=typeof navigator<`u`&&/Mac/.test(navigator.platform),bE=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),xE=0;xE<10;xE++)_E[48+xE]=_E[96+xE]=String(xE);for(var xE=1;xE<=24;xE++)_E[xE+111]=`F`+xE;for(var xE=65;xE<=90;xE++)_E[xE]=String.fromCharCode(xE+32),vE[xE]=String.fromCharCode(xE);for(var SE in _E)vE.hasOwnProperty(SE)||(vE[SE]=_E[SE]);function CE(e){var t=!(yE&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||bE&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?vE:_E)[e.keyCode]||e.key||`Unidentified`;return t==`Esc`&&(t=`Escape`),t==`Del`&&(t=`Delete`),t==`Left`&&(t=`ArrowLeft`),t==`Up`&&(t=`ArrowUp`),t==`Right`&&(t=`ArrowRight`),t==`Down`&&(t=`ArrowDown`),t}var wE=typeof navigator<`u`&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),TE=typeof navigator<`u`&&/Win/.test(navigator.platform);function EE(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n==`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e++){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))wE?o=!0:i=!0;else throw Error(`Unrecognized modifier name: `+n)}return r&&(n=`Alt-`+n),i&&(n=`Ctrl-`+n),o&&(n=`Meta-`+n),a&&(n=`Shift-`+n),n}function DE(e){let t=Object.create(null);for(let n in e)t[EE(n)]=e[n];return t}function OE(e,t,n=!0){return t.altKey&&(e=`Alt-`+e),t.ctrlKey&&(e=`Ctrl-`+e),t.metaKey&&(e=`Meta-`+e),n&&t.shiftKey&&(e=`Shift-`+e),e}function kE(e){return new Zb({props:{handleKeyDown:AE(e)}})}function AE(e){let t=DE(e);return function(e,n){let r=CE(n),i,a=t[OE(r,n)];if(a&&a(e.state,e.dispatch,e))return!0;if(r.length==1&&r!=` `){if(n.shiftKey){let i=t[OE(r,n,!1)];if(i&&i(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(TE&&n.ctrlKey&&n.altKey)&&(i=_E[n.keyCode])&&i!=r){let r=t[OE(i,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}var jE=200,ME=function(){};ME.prototype.append=function(e){return e.length?(e=ME.from(e),!this.length&&e||e.length<jE&&this.leafAppend(e)||this.length<jE&&e.leafPrepend(this)||this.appendInner(e)):this},ME.prototype.prepend=function(e){return e.length?ME.from(e).append(this):this},ME.prototype.appendInner=function(e){return new PE(this,e)},ME.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?ME.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},ME.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},ME.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},ME.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},ME.from=function(e){return e instanceof ME?e:e&&e.length?new NE(e):ME.empty};var NE=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=jE)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=jE)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(ME);ME.empty=new NE([]);var PE=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(ME),FE=500,IE=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,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,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step)i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);else{if(i){u.push(new RE(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new RE(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1}},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new RE(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>BE&&(s=LE(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new Ey;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new RE(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;n=Math.min(this.items.length,n);let r=[],i=this.items.length-n,a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new RE(i,o,l))}else r.push(new RE(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new RE(a.maps[e]));let u=this.items.slice(0,i).append(l).append(r),d=new e(u,s);return d.emptyItemCount()>FE&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new RE(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(ME.from(i.reverse()),a)}};IE.empty=new IE(ME.empty,0);function LE(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var RE=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},zE=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},BE=20;function VE(e,t,n,r){let i=n.getMeta(XE),a;if(i)return i.historyState;n.getMeta(ZE)&&(e=new zE(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(XE))return o.getMeta(XE).redo?new zE(e.done.addTransform(n,void 0,r,JE(t)),e.undone,UE(n.mapping.maps),e.prevTime,e.prevComposition):new zE(e.done,e.undone.addTransform(n,void 0,r,JE(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!HE(n,e.prevRanges)),s=o?WE(e.prevRanges,n.mapping):UE(n.mapping.maps);return new zE(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,JE(t)),IE.empty,s,n.time,i??e.prevComposition)}return(a=n.getMeta(`rebased`))?new zE(e.done.rebased(n,a),e.undone.rebased(n,a),WE(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new zE(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),WE(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function HE(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function UE(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function WE(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function GE(e,t,n){let r=JE(t),i=XE.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new zE(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(XE,{redo:n,historyState:c})}var KE=!1,qE=null;function JE(e){let t=e.plugins;if(qE!=t){KE=!1,qE=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){KE=!0;break}}return KE}function YE(e){return e.setMeta(ZE,!0)}var XE=new ex(`history`),ZE=new ex(`closeHistory`);function QE(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Zb({key:XE,state:{init(){return new zE(IE.empty,IE.empty,null,0,-1)},apply(t,n,r){return VE(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?eD:n==`historyRedo`?tD:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function $E(e,t){return(n,r)=>{let i=XE.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=GE(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var eD=$E(!1,!0),tD=$E(!0,!0);function nD(e){return e.getMeta(XE)!=null}function rD(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:a}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return a},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,a=n.storedMarks,n}}}var iD=class e{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(a);return!i.getMeta(`preventDispatch`)&&!this.hasCustomState&&r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],s=!!e,c=e||i.tr,l=()=>(!s&&t&&!c.getMeta(`preventDispatch`)&&!this.hasCustomState&&a.dispatch(c),o.every(e=>e===!0)),u={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(c,t),i=n(...e)(r);return o.push(i),u}])),run:l};return u}static createFakeChain(){let e=new Proxy({},{get:(t,n)=>{if(n!==`then`)return n===`run`?()=>!1:()=>e}});return e}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}static createFallbackCan(){let t=e.createFakeChain();return new Proxy({chain:()=>t},{get:(e,t)=>{if(t!==`then`)return t===`chain`?e.chain:()=>!1}})}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:e,editor:r,view:a,state:rD({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(o)]))}};return o}},aD=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{if(!e.isDestroyed){var n;t.dom.blur(),(n=window)==null||(n=n.getSelection())==null||n.removeAllRanges()}}),!0),oD=(e=!0)=>({commands:t})=>t.setContent(``,{emitUpdate:e}),sD=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,a=r.resolve(i.map(n)),o=r.resolve(i.map(n+e.nodeSize)),s=a.blockRange(o);if(!s)return;let c=Wy(s);if(e.type.isTextblock){let{defaultType:e}=a.parent.contentMatchAt(a.index());t.setNodeMarkup(s.start,e)}(c||c===0)&&t.lift(s,c)})}),!0},cD=e=>t=>e(t),lD=()=>({state:e,dispatch:t})=>bx(e,t),uD=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,a=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,a.content),r.setSelection(new Y(r.doc.resolve(Math.max(o-1,0)))),!0},dD=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;--n)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function fD(e,t){if(typeof e==`string`){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var pD=e=>({tr:t,state:n,dispatch:r})=>{let i=fD(e,n.schema),a=t.selection.$anchor;for(let e=a.depth;e>0;--e)if(a.node(e).type===i){if(r){let n=a.before(e),r=a.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},mD=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},hD=e=>e.content?/^text(\*|\+)/.test(e.content):!1,gD=(e,t,n)=>{if(!e.parent.isInline||n===`left`&&e.pos>e.start()||n===`right`&&e.pos<e.end())return e.pos;let r=t.nodes[e.parent.type.name].spec;return hD(r)?n===`left`?e.start()-1:e.end()+1:e.pos},_D=(e,t,n)=>({from:gD(e,n,`left`),to:gD(t,n,`right`)}),vD=()=>({state:e,dispatch:t})=>{if(e.selection.empty)return!1;if(t){let n=e.tr,{ranges:r}=e.selection,i=n.steps.length;r.forEach(t=>{let r=n.mapping.slice(i),{from:a,to:o}=_D(n.doc.resolve(r.map(t.$from.pos)),n.doc.resolve(r.map(t.$to.pos)),e.schema);n.deleteRange(a,o)}),n.selection.empty||n.setSelection(Y.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),t(n)}return!0},yD=()=>({commands:e})=>e.keyboardShortcut(`Enter`),bD=()=>({state:e,dispatch:t})=>yx(e,t);function xD(e){return Object.prototype.toString.call(e)===`[object RegExp]`}function SD(e,t,n={strict:!0}){let r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:xD(t[r])?t[r].test(e[r]):t[r]===e[r])}function CD(e,t,n={}){return e.find(e=>e.type===t&&SD(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function wD(e,t,n={}){return!!CD(e,t,n)}function TD(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if(r.node&&r.node.marks.some(e=>e.type===t)||(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!CD([...r.node.marks],t,n))return;let i=r.index,a=e.start()+r.offset,o=i+1,s=a+r.node.nodeSize;for(;i>0&&wD([...e.parent.child(i-1).marks],t,n);)--i,a-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&wD([...e.parent.child(o).marks],t,n);)s+=e.parent.child(o).nodeSize,o+=1;return{from:a,to:s}}function ED(e,t){if(typeof e==`string`){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var DD=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=ED(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=TD(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=Y.create(o,e.from,e.to);n.setSelection(t)}}return!0},OD=e=>t=>{let n=typeof e==`function`?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function kD(e){return e instanceof Y}function AD(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function jD(e,t=null){if(!t)return null;let n=J.atStart(e),r=J.atEnd(e);if(t===`start`||t===!0)return n;if(t===`end`)return r;let i=n.from,a=r.to;return t===`all`?Y.create(e,AD(0,i,a),AD(e.content.size,i,a)):Y.create(e,AD(t,i,a),AD(t,i,a))}function MD(){return[`Android`].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function ND(){return[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`].includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`ontouchend`in document}function PD(){return typeof navigator<`u`&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}var FD=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(ND()||MD())&&r.dom.focus(),PD()&&!ND()&&!MD()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(a&&e===null&&!kD(n.state.selection))return o(),!0;let s=jD(i.doc,e)||n.state.selection,c=n.state.selection.eq(s);return a&&(c||i.setSelection(s),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},ID=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),LD=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),RD=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;--n){let r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&RD(r)}return e};function zD(e){if(typeof window>`u`)throw Error(`[tiptap error]: there is no window object available, so this function cannot be used`);let t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,`text/html`).body;return RD(n)}function BD(e){return typeof e?.nodesBetween==`function`}function VD(e,t,n){if(BD(e))return e;let r=typeof e==`object`&&!!e;n={slice:!0,parseOptions:{},...n};let i=typeof e==`string`;if(r)try{if(Array.isArray(e)&&e.length>0)return K.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error(`[tiptap error]: Invalid JSON content`,{cause:r});return console.warn(`[tiptap warn]: Invalid content.`,`Passed value:`,e,`Error:`,r),VD(``,t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i=``,a=new Wv({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:`inline*`,group:`block`,parseDOM:[{tag:`*`,getAttrs:e=>(r=!0,i=typeof e==`string`?e:e.outerHTML,null)}]}})});if(n.slice?Jv.fromSchema(a).parseSlice(zD(e),n.parseOptions):Jv.fromSchema(a).parse(zD(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error(`[tiptap error]: Invalid HTML content`,{cause:Error(`Invalid element found: ${i}`)})}let r=Jv.fromSchema(t);return n.slice?r.parseSlice(zD(e),n.parseOptions).content:r.parse(zD(e),n.parseOptions)}return VD(``,t,n)}function HD(e){return!(`type`in e)}function UD(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof Ly||i instanceof Ry))return;let a=e.mapping.maps[r],o=0;a.forEach((e,t,n,r)=>{o===0&&(o=r)}),e.setSelection(J.near(e.doc.resolve(o),n))}var WD=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i,o=e=>{a.emit(`contentError`,{editor:a,error:e,disableCollaboration:()=>{`collaboration`in a.storage&&typeof a.storage.collaboration==`object`&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},s={preserveWhitespace:`full`,...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{VD(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=VD(t,a.schema,{parseOptions:s,errorOnInvalidContent:n.errorOnInvalidContent??a.options.enableContentCheck})}catch(e){return o(e),!1}let{from:c,to:l}=typeof e==`number`?{from:e,to:e}:{from:e.from,to:e.to},u=!0,d=!0,f=HD(i)?i.content:[i];if(f.forEach(e=>{e.check(),u=u?e.isText&&e.marks.length===0:!1,d=d?e.isBlock:!1}),c===l&&d){let{parent:e}=r.doc.resolve(c);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(--c,l+=1)}let p;if(u)p=Array.isArray(t)?t.map(e=>e.text||``).join(``):BD(t)?f.map(e=>e.text??``).join(``):typeof t==`object`&&t&&t.text?t.text:t,r.insertText(p,c,l);else{p=K.from(f);let e=r.doc.resolve(c),t=e.node(),n=e.parentOffset===0,i=t.isText||t.isTextblock,a=t.content.size>0;n&&i&&a&&d&&(c=Math.max(0,c-1)),r.replaceWith(c,l,f)}n.updateSelection&&UD(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta(`applyInputRules`,{from:c,text:p}),n.applyPasteRules&&r.setMeta(`applyPasteRules`,{from:c,text:p})}return!0};function GD(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var KD=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{pos:i,attrs:a,content:o,updateSelection:s=!0}=e,c;c=typeof i==`number`?t.doc.resolve(i):i||t.selection.$from;let l=GD(c.parent.contentMatchAt(c.index()));if(!l)return!1;let u=Object.keys(l.spec.attrs||{}),d=a?Object.fromEntries(Object.entries(a).filter(([e])=>u.includes(e))):{},f;if(o){let e=VD(o,r.schema);f=l.createAndFill(d,e)}else f=l.createAndFill(d);return f?(n&&(t.insert(c.pos,f),s&&UD(t,t.steps.length-1,-1)),!0):!1},qD=()=>({state:e,dispatch:t})=>mx(e,t),JD=()=>({state:e,dispatch:t})=>hx(e,t),YD=()=>({state:e,dispatch:t})=>rx(e,t),XD=()=>({state:e,dispatch:t})=>dx(e,t),ZD=(e,t)=>{let n=e.resolve(t),r=n.nodeBefore,i=n.nodeAfter;return!r||!i?!1:!r.type.spec.isolating&&!i.type.spec.isolating},QD=()=>({state:e,dispatch:t,tr:n})=>{try{let r=sb(e.doc,e.selection.$from.pos,-1);return r==null||!ZD(e.doc,r)?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},$D=()=>({state:e,dispatch:t,tr:n})=>{try{let r=sb(e.doc,e.selection.$from.pos,1);return r==null||!ZD(e.doc,r)?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},eO=()=>({state:e,dispatch:t})=>ix(e,t),tO=()=>({state:e,dispatch:t})=>ax(e,t);function nO(){return typeof navigator<`u`&&/Mac/.test(navigator.platform)}function rO(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n===`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e+=1){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))ND()||nO()?o=!0:i=!0;else throw Error(`Unrecognized modifier name: ${n}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),a&&(n=`Shift-${n}`),n}var iO=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=rO(e).split(/-(?!$)/),o=a.find(e=>![`Alt`,`Ctrl`,`Meta`,`Shift`].includes(e)),s=new KeyboardEvent(`keydown`,{key:o===`Space`?` `:o,altKey:a.includes(`Alt`),ctrlKey:a.includes(`Ctrl`),metaKey:a.includes(`Meta`),shiftKey:a.includes(`Shift`),bubbles:!0,cancelable:!0});return t.captureTransaction(()=>{n.someProp(`handleKeyDown`,e=>e(n,s))})?.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function aO(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?fD(t,e.schema):null,s=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);s.push({node:e,from:n,to:a})});let c=i-r,l=s.filter(e=>!o||o.name===e.node.type.name).filter(e=>SD(e.node.attrs,n,{strict:!1}));return a?!!l.length:l.reduce((e,t)=>e+t.to-t.from,0)>=c}var oO=(e,t={})=>({state:n,dispatch:r})=>aO(n,fD(e,n.schema),t)?gx(n,r):!1,sO=()=>({state:e,dispatch:t})=>xx(e,t),cO=e=>({state:t,dispatch:n})=>Vx(fD(e,t.schema))(t,n),lO=()=>({state:e,dispatch:t})=>_x(e,t);function uO(e,t){return t.nodes[e]?`node`:t.marks[e]?`mark`:null}function dO(e,t){let n=typeof t==`string`?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var fO=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=uO(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=fD(e,r.schema)),s===`mark`&&(o=ED(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,dO(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(a=>{o===a.type&&(c=!0,i&&n.addMark(r,r+e.nodeSize,o.create(dO(a.attrs,t))))})})}),c},pO=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),mO=()=>({tr:e,dispatch:t})=>{if(t){let t=new Lb(e.doc);e.setSelection(t)}return!0},hO=()=>({state:e,dispatch:t})=>cx(e,t),gO=()=>({state:e,dispatch:t})=>fx(e,t),_O=()=>({state:e,dispatch:t})=>wx(e,t),vO=()=>({state:e,dispatch:t})=>Ax(e,t),yO=()=>({state:e,dispatch:t})=>kx(e,t);function bO(e,t,n={},r={}){return VD(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var xO=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:c}=a;if(r.preserveWhitespace!==`full`){let s=bO(e,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});if(o){let e=HD(s)?s.content:[s];a.replaceWith(0,c.content.size,e).setMeta(`preventUpdate`,!n)}return!0}return o&&a.setMeta(`preventUpdate`,!n),s.insertContentAt({from:0,to:c.content.size},e,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})};function SO(e,t){let n=ED(t,e.schema),{from:r,to:i,empty:a}=e.selection,o=[];a?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{o.push(...e.marks)});let s=o.find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}function CO(e,t){let n=new Ab(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function wO(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function TO(e,t){for(let n=e.depth;n>0;--n){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function EO(e){return t=>TO(t.$from,e)}function Q(e,t,n){return e.config[t]===void 0&&e.parent?Q(e.parent,t,n):typeof e.config[t]==`function`?e.config[t].bind({...n,parent:e.parent?Q(e.parent,t,n):null}):e.config[t]}function DO(e){return e.map(e=>{let t=Q(e,`addExtensions`,{name:e.name,options:e.options,storage:e.storage});return t?[e,...DO(t())]:e}).flat(10)}function OO(e,t){let n=cy.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement(`div`);return r.appendChild(n),r.innerHTML}function kO(e,t){let n=new Map;for(let t of e){let e=n.get(t.type)??new Map;e.set(t.name,t),n.set(t.type,e)}return[...Object.values(t.nodes),...Object.values(t.marks)].flatMap(e=>Object.entries(e.spec.attrs??{}).map(([t,r])=>{let i=n.get(e.name)?.get(t),a=Object.hasOwn(r,`default`);return{type:e.name,name:t,attribute:{rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,...i?.attribute,default:r.default,isRequired:!a,validate:r.validate}}}))}var AO={content:`string`,marks:`string`,group:`string`,inline:`boolean`,atom:`boolean`,selectable:`boolean`,draggable:`boolean`,code:`boolean`,whitespace:[`pre`,`normal`],definingAsContext:`boolean`,definingForContent:`boolean`,defining:`boolean`,isolating:`boolean`,linebreakReplacement:`boolean`},jO={inclusive:`boolean`,excludes:`string`,group:`string`,spanning:`boolean`,code:`boolean`};function MO(e,t,n){return Object.fromEntries(Object.entries(t).flatMap(([t,r])=>{let i=e[t];if(i===void 0)return[];if(!(typeof r==`string`?typeof i===r:typeof i==`string`&&r.includes(i)))throw RangeError(`Invalid schemaSpec field '${n}.${t}'`);return[[t,i]]}))}function NO(e,t,n,r){return{...Object.fromEntries(Object.entries(t).filter(([e])=>e!==`attrs`&&!Object.hasOwn(r,e))),...MO(n,r,e),attrs:n.attrs}}function PO(e,t,n){for(let r of Object.keys(t))if(!Object.hasOwn(e,r))throw RangeError(`schemaSpec requires a local ${n} extension named '${r}'`);for(let r of Object.keys(e))if(!Object.hasOwn(t,r))throw RangeError(`Local ${n} extension '${r}' is not in schemaSpec`)}function FO(e,t){PO(e.nodes,t.nodes,`node`),PO(e.marks,t.marks,`mark`);let n=t.spec.nodes,r=t.spec.marks;return t.spec.nodes.forEach((t,r)=>{n=n.update(t,NO(t,e.nodes[t],r,AO))}),t.spec.marks.forEach((t,n)=>{r=r.update(t,NO(t,e.marks[t],n,jO))}),{topNode:t.topNodeType.name,nodes:n,marks:r}}function IO(e){let t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}function LO(e){return{baseExtensions:e.filter(e=>e.type===`extension`),nodeExtensions:e.filter(e=>e.type===`node`),markExtensions:e.filter(e=>e.type===`mark`)}}function RO(e){let t=[],{nodeExtensions:n,markExtensions:r}=LO(e),i=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(e=>e.name!==`text`).map(e=>e.name),s=r.map(e=>e.name),c=[...o,...s];return e.forEach(e=>{let n=Q(e,`addGlobalAttributes`,{name:e.name,options:e.options,storage:e.storage,extensions:i});n&&n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:e.types===`*`?c:e.types===`nodes`?o:e.types===`marks`?s:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...a,...r}})})})})}),i.forEach(e=>{let n=Q(e,`addAttributes`,{name:e.name,options:e.options,storage:e.storage});if(!n)return;let r=n();Object.entries(r).forEach(([n,r])=>{let i={...a,...r};typeof i?.default==`function`&&(i.default=i.default()),i?.isRequired&&i?.default===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function zO(e){return typeof e==`function`}function BO(e,t=void 0,...n){return zO(e)?t?e.bind(t)(...n):e(...n):e}function VO(e={}){return Object.keys(e).length===0&&e.constructor===Object}function HO(e){let t=[],n=``,r=!1,i=!1,a=0,o=e.length;for(let s=0;s<o;s+=1){let o=e[s];if(o===`'`&&!i)r=!r,n+=o;else if(o===`"`&&!r)i=!i,n+=o;else{if(!r&&!i){if(o===`(`){a+=1,n+=o;continue}if(o===`)`&&a>0){--a,n+=o;continue}if(o===`;`&&a===0){t.push(n),n=``;continue}}n+=o}}return n&&t.push(n),t}function UO(e){let t=[],n=HO(e||``),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],i=r.indexOf(`:`);if(i===-1)continue;let a=r.slice(0,i).trim(),o=r.slice(i+1).trim();a&&o&&t.push([a,o])}return t}function WO(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(e===`__proto__`)Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0});else if(!n[e])n[e]=t;else if(e===`class`){let r=t?String(t).split(` `):[],i=n[e]?n[e].split(` `):[],a=r.filter(e=>!i.includes(e));n[e]=[...i,...a].join(` `)}else if(e===`style`){let r=new Map([...UO(n[e]),...UO(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join(`; `)}else n[e]=t}),n},{})}function GO(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>WO(e,t),{})}function KO(e){return typeof e==`string`?e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e===`true`||e!==`false`&&e:e}function qO(e,t){return`style`in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;let i=t.reduce((e,t)=>{let r=t.attribute.parseHTML?t.attribute.parseHTML(n):KO(n.getAttribute(t.name));return r==null?e:{...e,[t.name]:r}},{});return{...r,...i}}}}function JO(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>e===`attrs`&&VO(t)?!1:t!=null))}function YO(e){var t,n;let r={};return!(e!=null&&(t=e.attribute)!=null&&t.isRequired)&&`default`in(e?.attribute||{})&&(r.default=e.attribute.default),(e==null||(n=e.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function XO(e,t,n=RO(e)){let{nodeExtensions:r,markExtensions:i}=LO(e);return{topNode:r.find(e=>Q(e,`topNode`))?.name,nodes:Object.fromEntries(r.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=JO({...e.reduce((e,t)=>{let n=Q(t,`extendNodeSchema`,a);return{...e,...n?n(r):{}}},{}),content:BO(Q(r,`content`,a)),marks:BO(Q(r,`marks`,a)),group:BO(Q(r,`group`,a)),inline:BO(Q(r,`inline`,a)),atom:BO(Q(r,`atom`,a)),selectable:BO(Q(r,`selectable`,a)),draggable:BO(Q(r,`draggable`,a)),code:BO(Q(r,`code`,a)),whitespace:BO(Q(r,`whitespace`,a)),linebreakReplacement:BO(Q(r,`linebreakReplacement`,a)),defining:BO(Q(r,`defining`,a)),isolating:BO(Q(r,`isolating`,a)),attrs:Object.fromEntries(i.map(YO))}),s=BO(Q(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>qO(e,i)));let c=Q(r,`renderHTML`,a);c&&(o.toDOM=e=>c({node:e,HTMLAttributes:GO(e,i)}));let l=Q(r,`renderText`,a);return l&&(o.toText=l),[r.name,o]})),marks:Object.fromEntries(i.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=JO({...e.reduce((e,t)=>{let n=Q(t,`extendMarkSchema`,a);return{...e,...n?n(r):{}}},{}),inclusive:BO(Q(r,`inclusive`,a)),excludes:BO(Q(r,`excludes`,a)),group:BO(Q(r,`group`,a)),spanning:BO(Q(r,`spanning`,a)),code:BO(Q(r,`code`,a)),attrs:Object.fromEntries(i.map(YO))}),s=BO(Q(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>qO(e,i)));let c=Q(r,`renderHTML`,a);return c&&(o.toDOM=e=>c({mark:e,HTMLAttributes:GO(e,i)})),[r.name,o]}))}}function ZO(e,t,n){if(n===void 0)return new Wv(XO(e,t));let r=IO(e.filter(e=>e.type!==`extension`).map(e=>e.name));if(r.length)throw RangeError(`Duplicate local schema types: ${r.join(`, `)}`);let i=new Wv(n);return new Wv(FO(XO(e,t,kO(RO(e),i)),i))}function QO(e){return e.sort((e,t)=>{let n=Q(e,`priority`)||100,r=Q(t,`priority`)||100;return n>r?-1:+(n<r)})}function $O(e){let t=QO(DO(e)),n=IO(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(`, `)}]. This can lead to issues.`),t}function ek(e,t){return ZO($O(e),t)}function tk(e,t){let n=ek(t),r=zD(e);return Jv.fromSchema(n).parse(r).toJSON()}function nk(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=`
|
|
59
|
+
|
|
60
|
+
`,textSerializers:o={}}=n||{},s=``;return e.nodesBetween(r,i,(e,n,c,l)=>{e.isBlock&&n>r&&(s+=a);let u=o?.[e.type.name];if(u)return c&&(s+=u({node:e,pos:n,parent:c,index:l,range:t})),!1;if(e.isText){var d;s+=e==null||(d=e.text)==null?void 0:d.slice(Math.max(r,n)-n,i-n)}}),s}function rk(e,t){return nk(e,{from:0,to:e.content.size},t)}function ik(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function ak(e,t){let n=fD(t,e.schema),{from:r,to:i}=e.selection,a=[];e.doc.nodesBetween(r,i,e=>{a.push(e)});let o=a.reverse().find(e=>e.type.name===n.name);return o?{...o.attrs}:{}}function ok(e,t){let n=uO(typeof t==`string`?t:t.name,e.schema);return n===`node`?ak(e,t):n===`mark`?SO(e,t):{}}function sk(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function ck(e){let t=sk(e);return t.length===1?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function lk(e){let{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,i)=>{let a=[];if(e.ranges.length)e.forEach((e,t)=>{a.push({from:e,to:t})});else{let{from:e,to:t}=n[i];if(e===void 0||t===void 0)return;a.push({from:e,to:t})}a.forEach(({from:e,to:n})=>{let a=t.slice(i).map(e,-1),o=t.slice(i).map(n),s=t.invert().map(a,-1),c=t.invert().map(o);r.push({oldRange:{from:s,to:c},newRange:{from:a,to:o}})})}),ck(r)}function uk(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=TD(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{e&&e?.nodeSize!==void 0&&r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}var dk=(e,t,n,r=20)=>{let i=e.doc.resolve(n),a=r,o=null;for(;a>0&&o===null;){let e=i.node(a);e?.type.name===t?o=e:--a}return[o,a]},fk=e=>{let t=e.depth-1;if(t<0)return null;let n=e.index(t);return n===0?null:e.node(t).child(n-1)};function pk(e,t){return t.nodes[e]||t.marks[e]||null}function mk(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return r?r.attribute.keepOnSplit:!1}))}var hk=(e,t=500)=>{let n=``,r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,a)=>{var o;let s=(o=e.type.spec).toText?.call(o,{node:e,pos:t,parent:i,index:a})||e.textContent||`%leaf%`;n+=e.isAtom&&!e.isText?s:s.slice(0,Math.max(0,r-t))}),n};function gk(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?ED(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!a||a.name===e.type.name).find(e=>SD(e.attrs,n,{strict:!1}));let o=0,s=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(a&&e.inlineContent&&!e.type.allowsMarkType(a))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),c=Math.min(i,t+e.nodeSize),l=c-n;o+=l,s.push(...e.marks.map(e=>({mark:e,from:n,to:c})))})}),o===0)return!1;let c=s.filter(e=>!a||a.name===e.mark.type.name).filter(e=>SD(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),l=s.filter(e=>!a||e.mark.type!==a&&e.mark.type.excludes(a)).reduce((e,t)=>e+t.to-t.from,0);return(c>0?c+l:c)>=o}function _k(e,t,n={}){if(!t)return aO(e,null,n)||gk(e,null,n);let r=uO(t,e.schema);return r===`node`?aO(e,t,n):r===`mark`&&gk(e,t,n)}var vk=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=EO(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},yk=e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function bk(e,t){return Array.isArray(t)?t.some(t=>(typeof t==`string`?t:t.name)===e.name):t}function xk(e,t){let{nodeExtensions:n}=LO(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=BO(Q(r,`group`,{name:r.name,options:r.options,storage:r.storage}));return typeof i==`string`&&i.split(` `).includes(`list`)}function Sk(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if(e.type.name===`hardBreak`)return!0;if(e.isText)return!/\S/.test(e.text??``)}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let r=!0;return e.content.forEach(e=>{r!==!1&&(Sk(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function Ck(e){return e instanceof X}function wk(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.apply==`function`&&typeof t.getMap==`function`&&typeof t.invert==`function`&&typeof t.map==`function`&&typeof t.merge==`function`&&typeof t.toJSON==`function`}function Tk(e){if(typeof e!=`object`||!e)return!1;let t=e;if(!wk(t))return!1;let n=t.toJSON();return!(typeof n!=`object`||!n||n.stepType!==`replace`)}var Ek=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function Dk(e,t){let n=t.mapping.mapResult(e.position);return{position:new Ek(n.pos),mapResult:n}}function Ok(e){return new Ek(e)}function kk(e,t,n){let r=e.state.doc.content.size,i=AD(t,0,r),a=AD(n,0,r),o=e.coordsAtPos(i),s=e.coordsAtPos(a,-1),c=Math.min(o.top,s.top),l=Math.max(o.bottom,s.bottom),u=Math.min(o.left,s.left),d=Math.max(o.right,s.right),f={top:c,bottom:l,left:u,right:d,width:d-u,height:l-c,x:u,y:c};return{...f,toJSON:()=>f}}function Ak(e,t,n){let{selection:r}=t,i=null;if(kD(r)&&(i=r.$cursor),i){let t=e.storedMarks??i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:a}=r;return a.some(({$from:t,$to:r})=>{let i=t.depth===0&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),a=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&a}return!i}),i})}var jk=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=ED(e,r.schema);if(i){if(o){let e=SO(r,c);n.addStoredMark(c.create({...e,...t}))}else s.forEach(e=>{let i=e.$from.pos,a=e.$to.pos;r.doc.nodesBetween(i,a,(e,r)=>{let o=Math.max(r,i),s=Math.min(r+e.nodeSize,a);e.marks.find(e=>e.type===c)?e.marks.forEach(e=>{c===e.type&&n.addMark(o,s,c.create({...e.attrs,...t}))}):n.addMark(o,s,c.create(t))})})}return Ak(r,n,c)},Mk=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),Nk=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=fD(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>Mx(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>Mx(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},Pk=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=AD(e,0,n.content.size),i=X.create(n,r);t.setSelection(i)}return!0},Fk=(e,t)=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=r,o,s;return typeof t==`number`?(o=t,s=t):t&&`from`in t&&`to`in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},Ik=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=Y.atStart(n).from,o=Y.atEnd(n).to,s=AD(r,a,o),c=AD(i,a,o),l=Y.create(n,s,c);t.setSelection(l)}return!0},Lk=e=>({state:t,dispatch:n})=>Wx(fD(e,t.schema))(t,n);function Rk(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>t?.includes(e.type.name));e.tr.ensureMarks(r)}}var zk=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:a,doc:o}=t,{$from:s,$to:c}=a,l=i.extensionManager.attributes,u=mk(l,s.node().type.name,s.node().attrs);if(a instanceof X&&a.node.isBlock)return!s.parentOffset||!nb(o,s.pos)?!1:(r&&(e&&Rk(n,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;let d=c.parentOffset===c.parent.content.size,f=s.depth===0?void 0:GD(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,m=a instanceof Y&&!a.empty?Yb.create({doc:t.doc,selection:a}).tr.deleteSelection():null,h=m?m.doc:t.doc,g=m?m.mapping.map(s.pos):s.pos,_=nb(h,g,1,p);if(!p&&!_&&nb(h,g,1,f?[{type:f}]:void 0)&&(_=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(_){let e=t.steps.length;if(a instanceof Y&&t.deleteSelection(),t.split(t.mapping.slice(e).map(s.pos),1,p),f&&!d&&!s.parentOffset&&s.parent.type!==f){let n=t.mapping.slice(e).map(s.before()),r=t.doc.resolve(n);s.node(-1).canReplaceWith(r.index(),r.index()+1,f)&&t.setNodeMarkup(t.mapping.slice(e).map(s.before()),f)}}e&&Rk(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return _},Bk=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{let o=fD(e,r.schema),{$from:s,$to:c}=r.selection,l=r.selection.node;if(l&&l.isBlock||s.depth<2||!s.sameParent(c))return!1;let u=s.node(-1);if(u.type!==o)return!1;let d=a.extensionManager.attributes;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==o||s.index(-2)!==s.node(-2).childCount-1)return!1;if(i){let e=K.empty,r=s.index(-1)?1:s.index(-2)?2:3;for(let t=s.depth-r;t>=s.depth-3;--t)e=K.from(s.node(t).copy(e));let i=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3,a={...mk(d,s.node().type.name,s.node().attrs),...t},c=o.contentMatch.defaultType?.createAndFill(a)||void 0;e=e.append(K.from(o.createAndFill(null,c)||void 0));let l=s.before(s.depth-(r-1));n.replace(l,s.after(-i),new q(e,4-r,0));let u=-1;n.doc.nodesBetween(l,n.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&e.content.size===0&&(u=t+1)}),u>-1&&n.setSelection(Y.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=c.pos===s.end()?u.contentMatchAt(0).defaultType:null,p={...mk(d,u.type.name,u.attrs),...t},m={...mk(d,s.node().type.name,s.node().attrs),...t},h=s.parentOffset===0&&s.index(-1)===0,g=s.before(-1);n.delete(s.pos,c.pos);let _=h?u.attrs:p,v=f?[{type:o,attrs:_},{type:f,attrs:m}]:[{type:o,attrs:_}];if(!nb(n.doc,s.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:o}=a.extensionManager,c=t||e.$to.parentOffset&&e.$from.marks();if(n.split(s.pos,2,v).scrollIntoView(),h&&n.setNodeMarkup(g,void 0,p),!c||!i)return!0;let l=c.filter(e=>o.includes(e.type.name));n.ensureMarks(l)}return!0};function Vk(e,t,n){if(!e.validContent(t))return null;try{return e.create(n,t)}catch{return null}}function Hk(e,t){if(e.pendingContent.length===0)return!0;let n=Vk(t,K.from(e.pendingContent));return n?(e.items.push(n),e.pendingContent=[],!0):!1}function Uk(e,t,n){return n.validContent(K.from([...t.pendingContent,e]))?(t.pendingContent.push(e),!0):!Hk(t,n)||!n.validContent(K.from(e))?!1:(t.pendingContent.push(e),!0)}function Wk(e,t,n,r){let i=r(e,n);if(!i)return!1;let a=Vk(n.listType,K.from(i),e.attrs);return a?n.itemType.validContent(K.from([...t.pendingContent,a]))?(t.pendingContent.push(a),!0):Hk(t,n.itemType)?(t.items.push(...i),!0):!1:!1}function Gk(e,t,n){let r={items:[],pendingContent:[]};for(let i=0;i<e.childCount;i+=1){let a=e.child(i);if(!(t.isListNode(a)?Wk(a,r,t,n):Uk(a,r,t.itemType)))return null}return Hk(r,t.itemType)?r.items:null}function Kk(e,t){let n=[];for(let r=0;r<e.childCount;r+=1){let i=Gk(e.child(r),t,Kk);if(!i)return null;n.push(...i)}return n}function qk(e,t){let n=null;return e.descendants((e,r)=>e!==t||(n=r,!1)),n}function Jk(e){return!e||e===`1`?null:e}function Yk(e,t){return Jk(e)===Jk(t)}var Xk=(e,t)=>{let n=EO(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===i?.type&&ib(e.doc,n.pos))||!Yk(n.node.attrs.type,i?.attrs.type)||e.join(n.pos),!0},Zk=(e,t)=>{let n=EO(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===i?.type&&ib(e.doc,r))||!Yk(n.node.attrs.type,i?.attrs.type)||e.join(r),!0};function Qk(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return Y.between(r,i)}var $k=(e,t,n,r={})=>({editor:i,tr:a,state:o,dispatch:s,chain:c,commands:l,can:u})=>{let{extensions:d,splittableMarks:f}=i.extensionManager,p=fD(e,o.schema),m=fD(t,o.schema),{selection:h,storedMarks:g}=o,{$from:_,$to:v}=h,y=_.blockRange(v),b=g||h.$to.parentOffset&&h.$from.marks();if(!y)return!1;let x=EO(e=>xk(e.type.name,d))(h),S=h.from===0&&h.to===o.doc.content.size,C=o.doc.content.content,w=C.length===1?C[0]:null,T=S&&w&&xk(w.type.name,d)?{node:w,pos:0,depth:0}:null,E=x??T,D=!!x&&y.depth>=1&&y.depth-x.depth<=1,ee=!!T;if((D||ee)&&E){if(E.node.type===p)return S&&ee?c().command(({tr:e,dispatch:t})=>{let n=Qk(e);return n?(e.setSelection(n),t&&t(e),!0):!1}).liftListItem(m).run():l.liftListItem(m);if(xk(E.node.type.name,d)&&p.validContent(E.node.content))return c().command(()=>(a.setNodeMarkup(E.pos,p),!0)).command(()=>Xk(a,p)).command(()=>Zk(a,p)).run();if(xk(E.node.type.name,d)){let e=E.node.firstChild?.type;if(e&&e!==m){let e=Kk(E.node,{listType:p,itemType:m,isListNode:e=>xk(e.type.name,d)}),t=e?K.from(e):null;return!t||!p.validContent(t)?!1:c().command(()=>{let{$anchor:e,$head:n}=a.selection,i=e.parent,o=n.parent,s=e.parentOffset,c=n.parentOffset,l;try{l=p.create(r,t)}catch{return!1}if(a.replaceWith(E.pos,E.pos+E.node.nodeSize,l),i.inlineContent&&o.inlineContent){let e=qk(l,i),t=qk(l,o);if(e!==null&&t!==null){let n=E.pos+e+2+s,r=E.pos+t+2+c;a.setSelection(Y.create(a.doc,n,r))}}return!0}).command(()=>Xk(a,p)).command(()=>Zk(a,p)).run()}}}return!n||!b||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>Xk(a,p)).command(()=>Zk(a,p)).run():c().command(()=>{let e=u().wrapInList(p,r),t=b.filter(e=>f.includes(e.type.name));return a.ensureMarks(t),e?!0:l.clearNodes()}).wrapInList(p,r).command(()=>Xk(a,p)).command(()=>Zk(a,p)).run()},eA=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=ED(e,r.schema);return gk(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},tA=(e,t,n={})=>({state:r,commands:i})=>{let a=fD(e,r.schema),o=fD(t,r.schema),s=aO(r,a,n),c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),s?i.setNode(o,c):i.setNode(a,{...c,...n})},nA=(e,t={})=>({state:n,commands:r})=>{let i=fD(e,n.schema);return aO(n,i,t)?r.lift(i):r.wrapIn(i,t)},rA=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i=n[r],a;if(i.spec.isInputRules&&(a=i.getState(e))){if(t){let t=e.tr,n=a.transform;for(let e=n.steps.length-1;e>=0;--e)t.step(n.steps[e].invert(n.docs[e]));if(a.text){let n=t.doc.resolve(a.from).marks();t.replaceWith(a.from,a.to,e.schema.text(a.text,n))}else t.delete(a.from,a.to)}return!0}}return!1},iA=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{ignoreClearable:i=!1}=e,{selection:a}=t,{empty:o,ranges:s}=a;if(o)return!0;let{nonClearableMarks:c}=r.extensionManager;if(n){let e=Object.values(r.schema.marks).filter(e=>i||!c.includes(e.name));s.forEach(n=>{for(let r of e)t.removeMark(n.$from.pos,n.$to.pos,r)})}return!0},aA=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=ED(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){let{from:e,to:t}=o,r=TD(c,s,c.marks().find(e=>e.type===s)?.attrs);r&&(e=r.from,t=r.to),n.removeMark(e,t,s)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,s)});return n.removeStoredMark(s),!0},oA=e=>({tr:t,state:n,dispatch:r})=>{let{selection:i}=n,a,o;return typeof e==`number`?(a=e,o=e):e&&`from`in e&&`to`in e?(a=e.from,o=e.to):(a=i.from,o=i.to),r&&t.doc.nodesBetween(a,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},sA=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=uO(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=fD(e,r.schema)),s===`mark`&&(o=ED(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{let s=e.$from.pos,l=e.$to.pos,u,d,f,p;n.selection.empty?r.doc.nodesBetween(s,l,(e,t)=>{a&&a===e.type&&(c=!0,f=Math.max(t,s),p=Math.min(t+e.nodeSize,l),u=t,d=e)}):r.doc.nodesBetween(s,l,(e,r)=>{r<s&&a&&a===e.type&&(c=!0,f=Math.max(r,s),p=Math.min(r+e.nodeSize,l),u=r,d=e),r>=s&&r<=l&&(a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),o&&e.marks.length&&e.marks.forEach(a=>{if(o===a.type&&(c=!0,i)){let i=Math.max(r,s),c=Math.min(r+e.nodeSize,l);n.addMark(i,c,o.create({...a.attrs,...t}))}}))}),d&&(u!==void 0&&i&&n.setNodeMarkup(u,void 0,{...d.attrs,...t}),o&&d.marks.length&&d.marks.forEach(e=>{o===e.type&&i&&n.addMark(f,p,o.create({...e.attrs,...t}))}))}),c},cA=new ex(`__tiptap_decorations__`),lA=e=>({tr:t,dispatch:n})=>(n&&t.setMeta(cA,{type:`force`,name:e}),!0),uA=(e,t={})=>({state:n,dispatch:r})=>jx(fD(e,n.schema),t)(n,r),dA=(e,t={})=>({state:n,dispatch:r})=>Rx(fD(e,n.schema),t)(n,r),fA=W_({blur:()=>aD,clearContent:()=>oD,clearNodes:()=>sD,command:()=>cD,createParagraphNear:()=>lD,cut:()=>uD,deleteCurrentNode:()=>dD,deleteNode:()=>pD,deleteRange:()=>mD,deleteSelection:()=>vD,enter:()=>yD,exitCode:()=>bD,extendMarkRange:()=>DD,first:()=>OD,focus:()=>FD,forEach:()=>ID,insertContent:()=>LD,insertContentAt:()=>WD,insertDefaultBlock:()=>KD,joinBackward:()=>YD,joinDown:()=>JD,joinForward:()=>XD,joinItemBackward:()=>QD,joinItemForward:()=>$D,joinTextblockBackward:()=>eO,joinTextblockForward:()=>tO,joinUp:()=>qD,keyboardShortcut:()=>iO,lift:()=>oO,liftEmptyBlock:()=>sO,liftListItem:()=>cO,newlineInCode:()=>lO,resetAttributes:()=>fO,scrollIntoView:()=>pO,selectAll:()=>mO,selectNodeBackward:()=>hO,selectNodeForward:()=>gO,selectParentNode:()=>_O,selectTextblockEnd:()=>vO,selectTextblockStart:()=>yO,setContent:()=>xO,setMark:()=>jk,setMeta:()=>Mk,setNode:()=>Nk,setNodeSelection:()=>Pk,setTextDirection:()=>Fk,setTextSelection:()=>Ik,sinkListItem:()=>Lk,splitBlock:()=>zk,splitListItem:()=>Bk,toggleList:()=>$k,toggleMark:()=>eA,toggleNode:()=>tA,toggleWrap:()=>nA,undoInputRule:()=>rA,unsetAllMarks:()=>iA,unsetMark:()=>aA,unsetTextDirection:()=>oA,updateAttributes:()=>sA,updateDecorations:()=>lA,wrapIn:()=>uA,wrapInList:()=>dA}),pA=new WeakMap;function mA(e,t){pA.set(e,(pA.get(e)??0)+1);try{return t()}finally{let t=(pA.get(e)??1)-1;t>0?pA.set(e,t):pA.delete(e)}}function hA(e){return pA.has(e)}var gA=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},_A=typeof process<`u`&&!1;function vA(e){return e.kind===`widget`}function yA(e,t){let n=[],r=new Set;for(let i of e)i.kind===`widget`&&vA(i)&&r.add(i.key),n.push(i.toPMDecoration(t));return{decorations:n,widgetKeys:r}}function bA(e,t,n){let{decorations:r,widgetKeys:i}=yA(t,n);return{set:kT.create(e,r),widgetKeys:i}}function xA({position:e,from:t,to:n,docSize:r}){return e<t?!1:e<n||e===n&&n===r}function SA({decorations:e,from:t,to:n,docSize:r,extensionName:i,warnedExtensions:a}){return e.filter(e=>xA({position:e.anchor,from:t,to:n,docSize:r})?!0:(e.anchor===n||a.has(i)||(a.add(i),console.warn(`[tiptap warn]: Extension "${i}" returned a decoration outside the requested range [${t}, ${n}). It was ignored.`)),!1))}function CA(e){let t=e.spec?.key;return typeof t==`string`?t:void 0}function wA(e){let t=new Map,n=new Map;for(let r of e.find()){let e=CA(r);if(!e)continue;let i=r.spec.extensionName??`unknown`,a=t.get(e)??new Set;a.add(i),t.set(e,a),n.set(e,(n.get(e)??0)+1)}return Array.from(t,([e,t])=>({key:e,extensions:t})).filter(({key:e})=>(n.get(e)??0)>1)}function TA(e){return e.jsonID===`attr`}function EA(e){let t=!1;if(e.getMap().forEach(()=>{t=!0}),t||TA(e))return!0;let n=e;return typeof n.from==`number`&&typeof n.to==`number`}function DA(e,t){let n=null,r=0,i=0;for(let a=0;a<e.childCount&&!(i>t.to);a+=1){let o=i+e.child(a).nodeSize;o>=t.from&&(n===null&&(n=i),r=o),i=o}return n===null?null:{from:n,to:r}}function OA(e,t){if(e.steps.some(e=>!EA(e)))return{type:`full`};let n=lk(e).map(({newRange:e})=>e);e.steps.forEach((t,r)=>{if(!TA(t))return;let i=e.mapping.slice(r);n.push({from:i.map(t.pos,-1),to:i.map(t.pos+1)})});let r=[];for(let e of n){let n=DA(t,e);n&&r.push(n)}r.sort((e,t)=>e.from-t.from);let i=[];for(let e of r){let t=i[i.length-1];t&&e.from<=t.to?t.to=Math.max(t.to,e.to):i.push({...e})}return{type:`ranges`,ranges:i}}function kA(e,t,n,r){return e.map(t,n,{onRemove:e=>{let t=e?.key;typeof t==`string`&&r.delete(t)}})}function AA(e,t,n){let r=t.decorationSetsByExtension[e]??kT.empty,i=new Set(t.widgetKeysByExtension[e]??[]);return{set:kA(r,n.mapping,n.doc,i),widgetKeys:i}}function jA(e,t){let n=Object.values(t).flatMap(e=>e.find());return kT.create(e,n)}function MA(e){let t=new Set;for(let n of Object.values(e))for(let e of n)t.add(e);return t}function NA(e,t){switch(t.update??`document`){case`document`:if(t.createInRange)throw Error(`[tiptap error]: Extension "${e}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case`changedRanges`:if(!t.createInRange)throw Error(`[tiptap error]: Extension "${e}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case`manual`:if(t.createInRange)throw Error(`[tiptap error]: Extension "${e}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(t.shouldUpdate)throw Error(`[tiptap error]: Extension "${e}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw Error(`[tiptap error]: Extension "${e}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}}function PA(e,t,n){return n?!0:e.update===`manual`?!1:e.shouldUpdate?e.shouldUpdate(t):t.tr.docChanged}var FA=new Set,IA=class{constructor(e){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{let t=cA.getState(e);t&&this.warnDuplicateWidgetKeys(t)},this.editor=e.editor,this.entries=this.resolveEntries(e.entries),this.entries.forEach(({name:e,spec:t})=>NA(e,t)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on(`beforeTransaction`,this.handleBeforeTransaction)}destroy(){this.editor.off(`beforeTransaction`,this.handleBeforeTransaction)}liveWidgetKeys(){return cA.getState(this.editor.state)?.widgetKeys??FA}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(e){let t=[];for(let{name:n,addDecorations:r}of e){let e=r();e&&t.push({name:n,spec:e})}return t}createPlugin(){let{editor:e,entries:t}=this;return new Zb({key:cA,state:{init:(e,n)=>{let r={},i={};for(let{name:e,spec:a}of t){let{set:t,widgetKeys:o}=this.buildFullSet(e,a,n);r[e]=t,i[e]=o}let a={decorationSetsByExtension:r,widgetKeysByExtension:i,mergedDecorationSet:this.buildMergedSet(n.doc,r),widgetKeys:MA(i)};return this.warnDuplicateWidgetKeys(a),a},apply:(n,r,i,a)=>{let o=n.getMeta(cA),s=o?.type===`force`&&!o.name,c=o?.type===`force`?o.name:void 0,l={},u={},d=new Set;return mA(e,()=>{for(let{name:o,spec:f}of t){let t=s||c===o;if(!PA(f,{editor:e,tr:n,oldState:i,newState:a},t)){let e=AA(o,r,n);l[o]=e.set,u[o]=e.widgetKeys}else if(f.update===`changedRanges`&&n.docChanged&&!t){let e=this.applyChangedRangesRecompute(o,f,r,n,a);l[o]=e.set,u[o]=e.widgetKeys,d.add(o)}else{let{set:e,widgetKeys:t}=this.buildFullSet(o,f,a);l[o]=e,u[o]=t,d.add(o)}}}),d.size===0&&!n.docChanged?r:{decorationSetsByExtension:l,widgetKeysByExtension:u,mergedDecorationSet:this.mergeAfterApply({entries:t,previous:r,tr:n,decorationSetsByExtension:l,recomputedNames:d}),widgetKeys:MA(u)}}},props:{decorations(e){return cA.getState(e)?.mergedDecorationSet??kT.empty}}})}applyChangedRangesRecompute(e,t,n,r,i){let a=OA(r,i.doc);return a.type===`full`?this.buildFullSet(e,t,i):this.rebuildRanges(e,t,n,r,i,a.ranges)}rebuildRanges(e,t,n,r,i,a){let o=n.decorationSetsByExtension[e]??kT.empty,s=new Set(n.widgetKeysByExtension[e]??[]),c=kA(o,r.mapping,r.doc,s),l=i.doc.content.size;for(let{from:n,to:r}of a){let a=c.find(n,r).filter(e=>xA({position:e.from,from:n,to:r,docSize:l}));for(let e of a){let t=CA(e);t&&s.delete(t)}c=c.remove(a);let{decorations:o,widgetKeys:u}=yA(SA({decorations:this.runCreate(e,`createInRange`,()=>t.createInRange({editor:this.editor,state:i,view:this.mountedView,from:n,to:r})),from:n,to:r,docSize:l,extensionName:e,warnedExtensions:this.warnedOutOfRangeExtensions}),e);c=c.add(i.doc,o);for(let e of u)s.add(e)}return{set:c,widgetKeys:s}}buildFullSet(e,t,n){let r=this.runCreate(e,`create`,()=>t.create({editor:this.editor,state:n,view:this.mountedView}));return bA(n.doc,r,e)}runCreate(e,t,n){try{return n()}catch(n){return console.error(`[tiptap error]: Extension "${e}" threw in \`addDecorations().${t}()\`. Its decorations were dropped for this update.`,n),[]}}warnDuplicateWidgetKeys(e){if(!_A)return;if(e.widgetKeys.size===0){this.warnedWidgetKeys.clear();return}let t=wA(e.mergedDecorationSet),n=new Set(t.map(({key:e})=>e));for(let{key:e,extensions:n}of t){if(this.warnedWidgetKeys.has(e))continue;let t=Array.from(n).map(e=>`"${e}"`).join(`, `);console.warn(`[tiptap warn]: Duplicate widget decoration key "${e}" in extension${n.size===1?``:`s`} ${t}. Widget decoration keys must be globally unique, otherwise ProseMirror misplaces the widget DOM. Use a stable, unique key (e.g. \`comment-\${id}\`).`)}this.warnedWidgetKeys=n}buildMergedSet(e,t){let n=Object.keys(t);return n.length===1?t[n[0]]:jA(e,t)}mergeAfterApply({entries:e,previous:t,tr:n,decorationSetsByExtension:r,recomputedNames:i}){return e.length===1?r[e[0].name]:i.size===0?t.mergedDecorationSet.map(n.mapping,n.doc):jA(n.doc,r)}};function LA(e,t){if(e===t)return!0;if(!e||!t)return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>Object.prototype.hasOwnProperty.call(t,n)&&Object.is(e[n],t[n]))}function RA(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof X){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;--i}return!1}function zA(e,t,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:``}]`);if(r!==null)return r;let i=document.createElement(`style`);return t&&i.setAttribute(`nonce`,t),i.setAttribute(`data-tiptap-style${n?`-${n}`:``}`,``),i.innerHTML=e,document.getElementsByTagName(`head`)[0].appendChild(i),i}function BA(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)}var VA={lt:`<`,gt:`>`,quot:`"`,amp:`&`};function HA(e){return e.replace(/&(?:#(\d{1,7})|#[xX]([0-9a-fA-F]{1,6})|(lt|gt|quot|amp));/g,(e,t,n,r)=>t===void 0?n===void 0?VA[r]:WA(parseInt(n,16)):WA(Number(t)))}var UA=new Map([[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function WA(e){return e===0||e>1114111||e>=55296&&e<=57343?`�`:String.fromCodePoint(UA.get(e)??e)}function GA(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function KA(e){return typeof e==`number`}function qA(e){return Object.prototype.toString.call(e).slice(8,-1)}function JA(e){return qA(e)===`Object`&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function YA(e){return typeof e==`string`&&e.trim().length>0&&!/[;{}]/.test(e)}function XA(e,t,n){let r=e.split(`
|
|
61
|
+
`),i=[],a=``,o=0,s=t.baseIndentSize||2;for(;o<r.length;){let e=r[o],u=e.match(t.itemPattern);if(!u){if(i.length>0)break;if(e.trim()===``){o+=1,a=`${a}${e}\n`;continue}return}let d=t.extractItemData(u),{indentLevel:f,mainContent:p}=d;a=`${a}${e}\n`;let m=[p];for(o+=1;o<r.length;){var c;let e=r[o];if(e.trim()===``){var l;let t=r.slice(o+1).findIndex(e=>e.trim()!==``);if(t===-1)break;if((((l=r[o+1+t].match(/^(\s*)/))==null||(l=l[1])==null?void 0:l.length)||0)>f){m.push(e),a=`${a}${e}\n`,o+=1;continue}break}if((((c=e.match(/^(\s*)/))==null||(c=c[1])==null?void 0:c.length)||0)>f)m.push(e),a=`${a}${e}\n`,o+=1;else break}let h,g=m.slice(1);if(g.length>0){let e=g.map(e=>e.slice(f+s)).join(`
|
|
62
|
+
`);e.trim()&&(h=t.customNestedParser?t.customNestedParser(e):n.blockTokens(e))}let _=t.createToken(d,h);i.push(_)}if(i.length!==0)return{items:i,raw:a}}var ZA=4;function QA(e){let t=0;for(let n of e)t=n===` `?t+ZA-t%ZA:t+1;return t}function $A(e,t,n,r,i){if(!e||!Array.isArray(e.content))return``;let a=typeof n==`function`?n(r):n,[o,...s]=e.content,c=`${a}${t.renderChildren([o])}`;return s&&s.length>0&&s.forEach((e,n)=>{let r=t.renderChild?.call(t,e,n+1)??t.renderChildren([e]);if(r!=null){let n=e=>{if(!i?.alignNestedToPrefix)return t.indent(e);let n=t.indent(``),r=QA(a);return(QA(n)>=r?n:` `.repeat(r))+e},o=r.split(`
|
|
63
|
+
`).map(e=>n(e||``)).join(`
|
|
64
|
+
`);c+=e.type===`paragraph`?`\n\n${o}`:`\n${o}`}}),c}function ej(e){return typeof e.type==`string`?e.type:e.type.name}function tj(e,t){if(e.length!==t.length)return!1;let n=Array.from({length:t.length},()=>!1);return e.every(e=>{let r=ej(e),i=t.findIndex((t,i)=>!n[i]&&r===ej(t)&&LA(e.attrs,t.attrs));return i!==-1&&(n[i]=!0,!0)})}function nj(e,t){let n={...e};return JA(e)&&JA(t)&&Object.keys(t).forEach(r=>{JA(t[r])&&JA(e[r])?n[r]=nj(e[r],t[r]):n[r]=t[r]}),n}function rj(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants((t,r)=>{let i=a.mapping.map(r),s=a.mapping.map(r)+t.nodeSize,c=null;if(t.marks.forEach(e=>{if(e!==o)return!1;c=e}),!c)return;let l=!1;if(Object.keys(n).forEach(e=>{n[e]!==c.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});a.removeMark(i,s,e.type),a.addMark(i,s,t)}}),a.docChanged&&t.view.dispatch(a)}var ij=class{constructor(e){this.find=e.find,this.handler=e.handler,this.undoable=e.undoable??!0}},aj=(e,t)=>{if(xD(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,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 oj(e){let{editor:t,from:n,to:r,text:i,insertText:a}=e;if(!a)return{inputTransaction:null,tr:t.view.state.tr};let o=t.view.state.tr.insertText(i,n,r);return{inputTransaction:o,tr:Yb.create({doc:o.doc,selection:o.selection,storedMarks:o.storedMarks}).tr}}function sj(e){let{editor:t,from:n,to:r,text:i,rule:a,match:o,plugin:s,insertText:c}=e,{view:l}=t,{inputTransaction:u,tr:d}=oj({editor:t,from:n,to:r,text:i,insertText:c}),f=u?n+i.length:r,p=rD({state:l.state,transaction:d}),m={from:n-(o[0].length-i.length),to:f},{commands:h,chain:g,can:_}=new iD({editor:t,state:p});return a.handler({state:p,range:m,match:o,commands:h,chain:g,can:_})===null||!d.steps.length?!1:(u&&(l.dispatch(u),!l.state.doc.eq(u.doc))||(YE(d),d.setMeta(`inputRule`,!0),a.undoable&&d.setMeta(s,{transform:d,from:n,to:f,text:i}),l.dispatch(d)),!0)}function cj(e,t,n){let r=t[0].length-n.length;if(r<=0)return!0;let i=e.parentOffset-r;return i>=0&&e.parent.textBetween(i,e.parentOffset)===t[0].slice(0,r)}function lj(e){let{editor:t,from:n,to:r,text:i,rules:a,plugin:o,insertText:s}=e,{view:c}=t;if(c.composing)return!1;let l=c.state.doc.resolve(n);if(l.parent.type.spec.code||(l.nodeBefore||l.nodeAfter)?.marks.find(e=>e.type.spec.code))return!1;let u=hk(l)+i;for(let e of a){let a=aj(u,e.find);if(a&&cj(l,a,i)&&sj({editor:t,from:n,to:r,text:i,rule:e,match:a,plugin:o,insertText:s}))return!0}return!1}function uj(e){let{editor:t,rules:n}=e,r=new Zb({state:{init(){return null},apply(e,i,a){let o=e.getMeta(r);if(o)return o;let s=e.getMeta(`applyInputRules`);return s&&setTimeout(()=>{let{text:e}=s;e=typeof e==`string`?e:OO(K.from(e),a.schema);let{from:i}=s,o=i+e.length;lj({editor:t,from:i,to:o,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput(e,i,a,o){return lj({editor:t,from:i,to:a,text:o,rules:n,plugin:r,insertText:!0})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&lj({editor:t,from:i.pos,to:i.pos,text:``,rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if(i.key!==`Enter`)return!1;let{$cursor:a}=e.state.selection;return a?lj({editor:t,from:a.pos,to:a.pos,text:`
|
|
65
|
+
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var dj=class{constructor(e={}){this.type=`extendable`,this.parent=null,this.child=null,this.name=``,this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...BO(Q(this,`addOptions`,{name:this.name}))}}get storage(){return{...BO(Q(this,`addStorage`,{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>nj(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name=`name`in e?e.name:t.parent.name,t}},fj=class e extends dj{constructor(...e){super(...e),this.type=`mark`}static create(t={}){let n=typeof t==`function`?t():t;return new e(n)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>e?.type.name===t.name))return!1;let a=i.find(e=>e?.type.name===t.name);return a&&n.removeStoredMark(a),n.insertText(` `,r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},pj=class{constructor(e){this.find=e.find,this.handler=e.handler}},mj=(e,t,n)=>{if(xD(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn(`[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".`),n.push(t.replaceWith)),n}):[]};function hj(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:c,chain:l,can:u}=new iD({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,i,(e,t)=>{var f;if((f=e.type)!=null&&(f=f.spec)!=null&&f.code||!(e.isText||e.isTextblock||e.isInline))return;let p=e.content?.size??e.nodeSize??0,m=Math.max(r,t),h=Math.min(i,t+p);m>=h||mj(e.isText?e.text||``:e.textBetween(m-t,h-t,void 0,``),a.find,o).forEach(e=>{if(e.index===void 0)return;let t=m+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},f=a.handler({state:n,range:i,match:e,commands:c,chain:l,can:u,pasteEvent:o,dropEvent:s});d.push(f)})}),d.every(e=>e!==null)}var gj=null,_j=e=>{var t;let n=new ClipboardEvent(`paste`,{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData(`text/html`,e),n};function vj(e){let{editor:t,rules:n}=e,r=null,i=!1,a=!1,o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,s;try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}let c=({state:e,from:n,to:r,rule:i,pasteEvt:a})=>{let c=e.tr,l=rD({state:e,transaction:c});if(hj({editor:t,state:l,from:Math.max(n-1,0),to:r.b-1,rule:i,pasteEvent:a,dropEvent:s})&&c.steps.length){try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}return o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,c}};return t.on(`destroy`,()=>{gj===t&&(gj=null)}),n.map(e=>new Zb({view(e){let n=n=>{r=e.dom.parentElement?.contains(n.target)?e.dom.parentElement:null,r&&(gj=t)},i=()=>{gj&&=null};return window.addEventListener(`dragstart`,n),window.addEventListener(`dragend`,i),{destroy(){window.removeEventListener(`dragstart`,n),window.removeEventListener(`dragend`,i)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(a=r===e.dom.parentElement,s=t,!a){let e=gj;e?.isEditable&&setTimeout(()=>{if(e.isDestroyed)return;let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{let n=t.clipboardData?.getData(`text/html`);return o=t,i=!!n?.includes(`data-pm-slice`),!1}}},appendTransaction:(t,n,r)=>{let s=t[0],l=s.getMeta(`uiEvent`)===`paste`&&!i,u=s.getMeta(`uiEvent`)===`drop`&&!a,d=s.getMeta(`applyPasteRules`),f=!!d;if(!l&&!u&&!f)return;if(f){let{text:t}=d;t=typeof t==`string`?t:OO(K.from(t),r.schema);let{from:n}=d,i=n+t.length,a=_j(t);return c({rule:e,state:r,from:n,to:{b:i},pasteEvt:a})}let p=n.doc.content.findDiffStart(r.doc.content),m=n.doc.content.findDiffEnd(r.doc.content);if(KA(p)&&m&&p!==m.b)return c({rule:e,state:r,from:p,to:m,pasteEvt:o})}}))}var yj=class{constructor(e,t){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=t,this.baseExtensions=e,this.extensions=$O(e),this.hasSchemaSpec=t.options.schemaSpec!==void 0,this.schema=ZO(this.extensions,t,t.options.schemaSpec),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n=Q(t,`addCommands`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:pk(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this,t=QO([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:pk(t.name,this.schema)},r=[],i=Q(t,`addKeyboardShortcuts`,n),a={};if(t.type===`mark`&&Q(t,`exitable`,n)&&(a.ArrowRight=()=>fj.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));a={...a,...t}}let o=kE(a);r.push(o);let s=Q(t,`addInputRules`,n);if(bk(t,e.options.enableInputRules)&&s){let t=s();if(t&&t.length){let n=uj({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let c=Q(t,`addPasteRules`,n);if(bk(t,e.options.enablePasteRules)&&c){let t=c();if(t&&t.length){let n=vj({editor:e,rules:t});r.push(...n)}}let l=Q(t,`addProseMirrorPlugins`,n);if(l){let e=l();r.push(...e)}return r}),n=this.createDecorationPlugin();return n&&t.push(n),t}createDecorationPlugin(){var e;let{editor:t}=this;(e=this.decorationManager)==null||e.destroy();let n=[];return this.extensions.forEach(e=>{let r=Q(e,`addDecorations`,{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:pk(e.name,this.schema)});r&&n.push({name:e.name,addDecorations:r})}),this.decorationManager=new IA({editor:t,entries:n}),this.decorationManager.plugin}get attributes(){let e=RO(this.extensions);return this.hasSchemaSpec?kO(e,this.schema):e}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=LO(this.extensions);return Object.fromEntries(t.filter(e=>!!Q(e,`addNodeView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=Q(t,`addNodeView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:fD(t.name,this.schema)});if(!r)return[];let i=r();return i?[t.name,(r,a,o,s,c)=>{let l=GO(r,n);return i({node:r,view:a,getPos:o,decorations:s,innerDecorations:c,editor:e,extension:t,HTMLAttributes:l})}]:[]}))}dispatchTransaction(e){let{editor:t}=this;return QO([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:pk(n.name,this.schema)},i=Q(n,`dispatchTransaction`,r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return QO([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:pk(n.name,this.schema)},i=Q(n,`transformPastedHTML`,r);return i?(t,n)=>{let a=e(t,n);return i.call(r,a)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=LO(this.extensions);return Object.fromEntries(t.filter(e=>!!Q(e,`addMarkView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=Q(t,`addMarkView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:ED(t.name,this.schema)});return r?[t.name,(i,a,o)=>{let s=GO(i,n);return r()({mark:i,view:a,inline:o,editor:e,extension:t,HTMLAttributes:s,updateAttributes:t=>{rj(i,e,t)}})}]:[]}))}destroy(){var e;(e=this.decorationManager)==null||e.destroy(),this.extensions.forEach(e=>{let t=e;for(;t.parent;){let e=t.parent;e.child===t&&(e.child=null),t=e}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{let t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:pk(e.name,this.schema)};e.type===`mark`&&((BO(Q(e,`keepOnSplit`,t))??!0)&&this.splittableMarks.push(e.name),(BO(Q(e,`clearable`,t))??!0)||this.nonClearableMarks.push(e.name));let n=Q(e,`onBeforeCreate`,t),r=Q(e,`onCreate`,t),i=Q(e,`onUpdate`,t),a=Q(e,`onSelectionUpdate`,t),o=Q(e,`onTransaction`,t),s=Q(e,`onFocus`,t),c=Q(e,`onBlur`,t),l=Q(e,`onDestroy`,t);n&&this.editor.on(`beforeCreate`,n),r&&this.editor.on(`create`,r),i&&this.editor.on(`update`,i),a&&this.editor.on(`selectionUpdate`,a),o&&this.editor.on(`transaction`,o),s&&this.editor.on(`focus`,s),c&&this.editor.on(`blur`,c),l&&this.editor.on(`destroy`,l)})}};yj.resolve=$O,yj.sort=QO,yj.flatten=DO;var bj=class e extends dj{constructor(...e){super(...e),this.type=`extension`}static create(t={}){let n=typeof t==`function`?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},xj=bj.create({name:`clipboardTextSerializer`,addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Zb({key:new ex(`clipboardTextSerializer`),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,a=ik(n),{blockSeparator:o}=this.options,s={...o===void 0?{}:{blockSeparator:o},textSerializers:a};return[...i.ranges].sort((e,t)=>e.$from.pos-t.$from.pos).map(({$from:e,$to:t})=>nk(r,{from:e.pos,to:t.pos},s)).join(o??`
|
|
66
|
+
|
|
67
|
+
`)}}})]}}),Sj=bj.create({name:`commands`,addCommands(){return{...fA}}}),Cj=bj.create({name:`delete`,onUpdate({transaction:e,appendedTransactions:t}){var n;let r=()=>{var n,r;if(((n=this.editor.options.coreExtensionOptions)==null||(n=n.delete)==null||(r=n.filterTransaction)==null?void 0:r.call(n,e))??e.getMeta(`y-sync$`))return;let i=CO(e.before,[e,...t]);lk(i).forEach(t=>{i.mapping.mapResult(t.oldRange.from).deletedAfter&&i.mapping.mapResult(t.oldRange.to).deletedBefore&&i.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{let a=r+n.nodeSize-2,o=t.oldRange.from<=r&&a<=t.oldRange.to;this.editor.emit(`delete`,{type:`node`,node:n,from:r,to:a,newFrom:i.mapping.map(r),newTo:i.mapping.map(a),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:i})})});let a=i.mapping;i.steps.forEach((t,n)=>{if(t instanceof My){let r=a.slice(n).map(t.from,-1),o=a.slice(n).map(t.to),s=a.invert().map(r,-1),c=a.invert().map(o),l=r>0&&i.doc.nodeAt(r-1)?.marks.some(e=>e.eq(t.mark)),u=i.doc.nodeAt(o)?.marks.some(e=>e.eq(t.mark));this.editor.emit(`delete`,{type:`mark`,mark:t.mark,from:t.from,to:t.to,deletedRange:{from:s,to:c},newRange:{from:r,to:o},partial:!!(u||l),editor:this.editor,transaction:e,combinedTransform:i})}})};((n=this.editor.options.coreExtensionOptions)==null||(n=n.delete)==null?void 0:n.async)??!0?setTimeout(r,0):r()}}),wj=bj.create({name:`drop`,addProseMirrorPlugins(){return[new Zb({key:new ex(`tiptapDrop`),props:{handleDrop:(e,t,n,r)=>{this.editor.emit(`drop`,{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),Tj=bj.create({name:`editable`,addProseMirrorPlugins(){return[new Zb({key:new ex(`editable`),props:{editable:()=>this.editor.options.editable}})]}}),Ej=new ex(`focusEvents`),Dj=bj.create({name:`focusEvents`,addProseMirrorPlugins(){let{editor:e}=this;return[new Zb({key:Ej,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta(`focus`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta(`blur`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1}}}})]}}),Oj=bj.create({name:`keymap`,addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:a}=n,{pos:o,parent:s}=a,c=a.parent.isTextblock&&o>0?t.doc.resolve(o-1):a,l=c.parent.type.spec.isolating,u=a.pos-a.parentOffset,d=l&&c.parent.childCount===1?u===a.pos:J.atStart(r).from===o;return!i||!s.type.isTextblock||s.textContent.length||!d||d&&a.parent.type.name===`paragraph`?!1:e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ND()||nO()?i:r},addProseMirrorPlugins(){return[new Zb({key:new ex(`clearDocument`),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta(`composition`)))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta(`preventClearDocument`));if(!r||i)return;let{empty:a,from:o,to:s}=t.selection,c=J.atStart(t.doc).from,l=J.atEnd(t.doc).to;if(a||o!==c||s!==l||!Sk(n.doc))return;let u=n.tr,d=rD({state:n,transaction:u}),{commands:f}=new iD({editor:this.editor,state:d});if(f.clearNodes(),u.steps.length)return u}})]}}),kj=bj.create({name:`paste`,addProseMirrorPlugins(){return[new Zb({key:new ex(`tiptapPaste`),props:{handlePaste:(e,t,n)=>{this.editor.emit(`paste`,{editor:this.editor,event:t,slice:n})}}})]}}),Aj=bj.create({name:`tabindex`,addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Zb({key:new ex(`tabindex`),props:{attributes:()=>!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:this.options.value??`0`}}})]}}),jj=bj.create({name:`textDirection`,addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=LO(this.extensions);return[{types:e.filter(e=>e.name!==`text`).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute(`dir`);return t&&(t===`ltr`||t===`rtl`||t===`auto`)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Zb({key:new ex(`textDirection`),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),Mj=!1;function Nj(e){if(Mj)return;Mj=!0;let t;try{let n=Ly.fromJSON(e,{from:0,to:0});if(!Tk(n))return;t=n.slice.content}catch{return}t instanceof K||console.warn(`[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.`)}var Pj=class e{get name(){return this.node.type.name}constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){return this.actualDepth??this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=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}t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},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}get parent(){if(this.depth===0)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new e(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=n.isInline,s=this.pos+r+ +!a;if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;let c=this.resolvedPos.doc.resolve(s);if(!i&&!o&&c.depth<=this.depth)return;let l=new e(c,this.editor,i,i||o?n:null);i&&(l.actualDepth=this.depth+1),t.push(l)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e){if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r}r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||this.children.length===0)return r;let i=Object.keys(t);return this.children.forEach(a=>{n&&r.length>0||(a.node.type.name===e&&i.every(e=>t[e]===a.node.attrs[e])&&r.push(a),!(n&&r.length>0)&&(r=r.concat(a.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},Fj=`.ProseMirror {
|
|
68
|
+
position: relative;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.ProseMirror {
|
|
72
|
+
word-wrap: break-word;
|
|
73
|
+
white-space: pre-wrap;
|
|
74
|
+
white-space: break-spaces;
|
|
75
|
+
-webkit-font-variant-ligatures: none;
|
|
76
|
+
font-variant-ligatures: none;
|
|
77
|
+
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.ProseMirror [contenteditable="false"] {
|
|
81
|
+
white-space: normal;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
85
|
+
white-space: pre-wrap;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.ProseMirror pre {
|
|
89
|
+
white-space: pre-wrap;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
img.ProseMirror-separator {
|
|
93
|
+
display: inline !important;
|
|
94
|
+
border: none !important;
|
|
95
|
+
margin: 0 !important;
|
|
96
|
+
width: 0 !important;
|
|
97
|
+
height: 0 !important;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.ProseMirror-gapcursor {
|
|
101
|
+
display: none;
|
|
102
|
+
pointer-events: none;
|
|
103
|
+
position: absolute;
|
|
104
|
+
margin: 0;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.ProseMirror-gapcursor:after {
|
|
108
|
+
content: "";
|
|
109
|
+
display: block;
|
|
110
|
+
position: absolute;
|
|
111
|
+
top: -2px;
|
|
112
|
+
width: 20px;
|
|
113
|
+
border-top: 1px solid black;
|
|
114
|
+
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@keyframes ProseMirror-cursor-blink {
|
|
118
|
+
to {
|
|
119
|
+
visibility: hidden;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.ProseMirror-hideselection *::selection {
|
|
124
|
+
background: transparent;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
128
|
+
background: transparent;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.ProseMirror-hideselection * {
|
|
132
|
+
caret-color: transparent;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
136
|
+
display: block;
|
|
137
|
+
}`,Ij=class extends gA{constructor(e={}){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.hasWarnedStaleDecorationRead=!1,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:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Dk,createMappablePosition:Ok},this.setOptions(e),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:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on(`paste`,({event:e,slice:t})=>this.options.onPaste(e,t)),this.on(`delete`,this.options.onDelete);let t=this.createDoc();if(!this.editorState){let e=jD(t,this.options.autofocus);this.editorState=Yb.create({doc:t,schema:this.schema,selection:e||void 0})}Nj(this.schema),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>`u`)throw Error(`[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`);this.createView(e),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){this.editorState=this.editorView.state;let e=this.editorView.dom;e?.editor&&delete e.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(e){console.warn(`Failed to remove CSS element:`,e)}this.css=null,this.emit(`unmount`,{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():iD.createFakeChain()}can(){return this.commandManager?this.commandManager.can():iD.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<`u`&&(this.css=zA(Fj,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps({...this.options.editorProps,attributes:this.getEditorViewAttributes()}),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&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:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t===`state`)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return _A&&!this.hasWarnedStaleDecorationRead&&hA(this)&&(this.hasWarnedStaleDecorationRead=!0,console.warn("[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.")),this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=zO(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t=typeof e==`string`?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;let n=[...this.options.enableCoreExtensions?[Tj,xj.configure({blockSeparator:(e=this.options.coreExtensionOptions)==null||(e=e.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Sj,Dj,Oj,Aj.configure({value:(t=this.options.coreExtensionOptions)==null||(t=t.tabindex)==null?void 0:t.value}),wj,kj,Cj,jj.configure({direction:this.options.textDirection})].filter(e=>typeof this.options.enableCoreExtensions!=`object`||this.options.enableCoreExtensions[e.name]!==!1):[],...this.options.extensions].filter(e=>[`extension`,`node`,`mark`].includes(e?.type));this.extensionManager=new yj(n,this)}createCommandManager(){this.commandManager=new iD({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=bO(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;let t=bO(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=Yb.create({doc:t,schema:this.schema,selection:jD(t,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(e=>e.name!==`collaboration`),this.createExtensionManager()}}),this.editorState.doc}return e}getEditorViewAttributes(){let e=this.options.editorProps?.attributes;return zO(e)?t=>({role:`textbox`,...e(t)}):{role:`textbox`,...e}}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,a=t.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new lE(e,{...t,attributes:this.getEditorViewAttributes(),dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();let c=this.view.dom;c.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>this.capturedTransaction?.step(e));return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),a=this.state;if(this.emit(`beforeTransaction`,{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit(`transaction`,{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit(`selectionUpdate`,{editor:this,transaction:e});let o=n.findLast(e=>e.getMeta(`focus`)||e.getMeta(`blur`)),s=o?.getMeta(`focus`),c=o?.getMeta(`blur`);s&&this.emit(`focus`,{editor:this,event:s.event,transaction:o}),c&&this.emit(`blur`,{editor:this,event:c.event,transaction:o}),!(e.getMeta(`preventUpdate`)||!n.some(e=>e.docChanged)||a.doc.eq(t.doc))&&this.emit(`update`,{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return ok(this.state,e)}isActive(e,t){let n=typeof e==`string`?e:null,r=typeof e==`string`?t:e;return _k(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return OO(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=`
|
|
138
|
+
|
|
139
|
+
`,textSerializers:n={}}=e||{};return rk(this.state.doc,{blockSeparator:t,textSerializers:{...ik(this.schema),...n}})}get isEmpty(){return Sk(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(){return this.editorView?.isDestroyed??!0}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText&&t.nodeAfter.isAtom?t.nodeAfter:null;return new Pj(t,this,!1,n)}get $doc(){return this.$pos(0)}};function Lj(e){return new ij({find:e.find,handler:({state:t,range:n,match:r})=>{let i=BO(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if(uk(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;l<n.to&&a.delete(l,n.to),c>n.from&&a.delete(n.from+r,c);let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function Rj(e){return new ij({find:e.find,handler:({state:t,range:n,match:r})=>{let i=BO(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()},undoable:e.undoable})}function zj(e){return new ij({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=BO(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,a)},undoable:e.undoable})}function Bj(e){return new ij({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=BO(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&Ky(s,e.type,a);if(!c)return null;if(o.wrap(s,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,a=r||n.$to.parentOffset&&n.$from.marks();if(a){let e=a.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t=e.type.name===`bulletList`||e.type.name===`orderedList`?`listItem`:`taskList`;i().updateAttributes(t,a).run()}let l=o.doc.resolve(n.from-1).nodeBefore;l&&l.type===e.type&&ib(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)},undoable:e.undoable})}var Vj=e=>`touches`in e,Hj=class{constructor(e){var 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=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.clientX-this.startX,n=e.clientY-this.startY;this.handleResize(t,n)},this.handleTouchMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.touches[0];if(!t)return;let n=t.clientX-this.startX,r=t.clientY-this.startY;this.handleResize(n,r)},this.handleMouseUp=()=>{if(!this.isResizing)return;let e=this.element.offsetWidth,t=this.element.offsetHeight;this.onCommit(e,t),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=e=>{e.key===`Shift`&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=e=>{e.key===`Shift`&&(this.isShiftKeyPressed=!1)},this.node=e.node,this.editor=e.editor,this.element=e.element,this.element.draggable=!1,this.contentElement=e.contentElement,this.getPos=e.getPos,this.onResize=e.onResize,this.onCommit=e.onCommit,this.onUpdate=e.onUpdate,e.options?.min&&(this.minSize={...this.minSize,...e.options.min}),e.options?.max&&(this.maxSize=e.options.max),e!=null&&(t=e.options)!=null&&t.directions&&(this.directions=e.options.directions),e.options?.preserveAspectRatio&&(this.preserveAspectRatio=e.options.preserveAspectRatio),e.options?.className&&(this.classNames={container:e.options.className.container||``,wrapper:e.options.className.wrapper||``,handle:e.options.className.handle||``,resizing:e.options.className.resizing||``}),e.options?.createCustomHandle&&(this.createCustomHandle=e.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(){return this.contentElement??null}handleEditorUpdate(){let e=this.editor.isEditable;e!==this.lastEditableState&&(this.lastEditableState=e,e?e&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(e,t,n){return e.type===this.node.type&&(this.node=e,!this.onUpdate||this.onUpdate(e,t,n))}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(){let e=document.createElement(`div`);return e.dataset.resizeContainer=``,e.dataset.node=this.node.type.name,e.style.display=this.node.type.isInline?`inline-flex`:`flex`,this.classNames.container&&(e.className=this.classNames.container),e.appendChild(this.wrapper),e}createWrapper(){let e=document.createElement(`div`);return e.style.position=`relative`,e.style.display=`block`,e.dataset.resizeWrapper=``,this.classNames.wrapper&&(e.className=this.classNames.wrapper),e.appendChild(this.element),e}createHandle(e){let t=document.createElement(`div`);return t.dataset.resizeHandle=e,t.style.position=`absolute`,this.classNames.handle&&(t.className=this.classNames.handle),t}positionHandle(e,t){let n=t.includes(`top`),r=t.includes(`bottom`),i=t.includes(`left`),a=t.includes(`right`);n&&(e.style.top=`0`),r&&(e.style.bottom=`0`),i&&(e.style.left=`0`),a&&(e.style.right=`0`),(t===`top`||t===`bottom`)&&(e.style.left=`0`,e.style.right=`0`),(t===`left`||t===`right`)&&(e.style.top=`0`,e.style.bottom=`0`)}attachHandles(){this.directions.forEach(e=>{let t;t=this.createCustomHandle?this.createCustomHandle(e):this.createHandle(e),t instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${e}") did not return an HTMLElement. Falling back to default handle.`),t=this.createHandle(e)),this.createCustomHandle||this.positionHandle(t,e),t.addEventListener(`mousedown`,t=>this.handleResizeStart(t,e)),t.addEventListener(`touchstart`,t=>this.handleResizeStart(t,e)),this.handleMap.set(e,t),this.wrapper.appendChild(t)})}removeHandles(){this.handleMap.forEach(e=>e.remove()),this.handleMap.clear()}applyInitialSize(){let e=this.node.attrs.width,t=this.node.attrs.height;e?(this.element.style.width=`${e}px`,this.initialWidth=e):this.initialWidth=this.element.offsetWidth,t?(this.element.style.height=`${t}px`,this.initialHeight=t):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(e,t){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.activeHandle=t,Vj(e)?(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY):(this.startX=e.clientX,this.startY=e.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(e,t){if(!this.activeHandle)return;let n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,e,t),a=this.applyConstraints(r,i,n);this.element.style.width=`${a.width}px`,this.element.style.height=`${a.height}px`,this.onResize&&this.onResize(a.width,a.height)}calculateNewDimensions(e,t,n){let r=this.startWidth,i=this.startHeight,a=e.includes(`right`),o=e.includes(`left`),s=e.includes(`bottom`),c=e.includes(`top`);return a?r=this.startWidth+t:o&&(r=this.startWidth-t),s?i=this.startHeight+n:c&&(i=this.startHeight-n),(e===`right`||e===`left`)&&(r=this.startWidth+(a?t:-t)),(e===`top`||e===`bottom`)&&(i=this.startHeight+(s?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,e):{width:r,height:i}}applyConstraints(e,t,n){if(!n){let n=Math.max(this.minSize.width,e),r=Math.max(this.minSize.height,t);return this.maxSize?.width&&(n=Math.min(this.maxSize.width,n)),this.maxSize?.height&&(r=Math.min(this.maxSize.height,r)),{width:n,height:r}}let r=e,i=t;return r<this.minSize.width&&(r=this.minSize.width,i=r/this.aspectRatio),i<this.minSize.height&&(i=this.minSize.height,r=i*this.aspectRatio),this.maxSize?.width&&r>this.maxSize.width&&(r=this.maxSize.width,i=r/this.aspectRatio),this.maxSize?.height&&i>this.maxSize.height&&(i=this.maxSize.height,r=i*this.aspectRatio),{width:r,height:i}}applyAspectRatio(e,t,n){return n===`left`||n===`right`?{width:e,height:e/this.aspectRatio}:n===`top`||n===`bottom`?{width:t*this.aspectRatio,height:t}:{width:e,height:e/this.aspectRatio}}},Uj=class e extends dj{constructor(...e){super(...e),this.type=`node`}static create(t={}){let n=typeof t==`function`?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},Wj=class{constructor(e,t,n){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=()=>{try{return t.getPos()}catch{return}},this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){let{view:t}=this.editor,n=e.target,r=n.nodeType===3?n.parentElement?.closest(`[data-drag-handle]`):n.closest(`[data-drag-handle]`);if(!this.dom||this.contentDOM?.contains(n)||!r)return;let i=0,a=0;if(this.dom!==r){let t=this.dom.getBoundingClientRect(),n=r.getBoundingClientRect(),o=e.offsetX??e.nativeEvent?.offsetX,s=e.offsetY??e.nativeEvent?.offsetY;i=n.x-t.x+o,a=n.y-t.y+s}let o=this.dom.cloneNode(!0);try{let e=this.dom.getBoundingClientRect();o.style.width=`${Math.round(e.width)}px`,o.style.height=`${Math.round(e.height)}px`,o.style.boxSizing=`border-box`,o.style.pointerEvents=`none`}catch{}let s=null;try{var c;s=document.createElement(`div`),s.style.position=`absolute`,s.style.top=`-9999px`,s.style.left=`-9999px`,s.style.pointerEvents=`none`,s.appendChild(o),document.body.appendChild(s),(c=e.dataTransfer)==null||c.setDragImage(o,i,a)}finally{s&&setTimeout(()=>{try{s?.remove()}catch{}},0)}let l=this.getPos();if(typeof l!=`number`)return;let u=X.create(t.state.doc,l),d=t.state.tr.setSelection(u);t.dispatch(d)}stopEvent(e){if(!this.dom)return!1;if(typeof this.options.stopEvent==`function`)return this.options.stopEvent({event:e});let t=e.target;if(!this.dom.contains(t)||this.contentDOM?.contains(t))return!1;let n=e.type.startsWith(`drag`),r=e.type===`dragover`||e.type===`dragenter`,i=e.type===`drop`;if(([`INPUT`,`BUTTON`,`SELECT`,`TEXTAREA`].includes(t.tagName)||t.isContentEditable)&&!i&&!n)return!0;let{isEditable:a}=this.editor,{isDragging:o}=this,s=!!this.node.type.spec.draggable,c=X.isSelectable(this.node),l=e.type===`copy`,u=e.type===`paste`,d=e.type===`cut`,f=e.type===`mousedown`;if(!s&&c&&n&&e.target===this.dom&&e.preventDefault(),s&&n&&!o&&e.target===this.dom)return e.preventDefault(),!1;if(s&&a&&!o&&f){let e=t.closest(`[data-drag-handle]`);e&&(this.dom===e||this.dom.contains(e))&&(this.isDragging=!0,document.addEventListener(`dragend`,()=>{this.isDragging=!1},{once:!0}),document.addEventListener(`drop`,()=>{this.isDragging=!1},{once:!0}),document.addEventListener(`mouseup`,()=>{this.isDragging=!1},{once:!0}))}return!(o||r||i||l||u||d||f&&c)}ignoreMutation(e){return this.dom?this.contentDOM?typeof this.options.ignoreMutation==`function`?this.options.ignoreMutation({mutation:e}):this.node.isLeaf||this.node.isAtom?!0:e.type===`selection`||this.contentDOM.contains(e.target)&&e.type===`childList`&&(ND()||MD())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable)?!1:this.contentDOM===e.target&&e.type===`attributes`||!this.contentDOM.contains(e.target):e.type!==`selection`:!0}updateAttributes(e){this.editor.commands.command(({tr:t})=>{let n=this.getPos();return typeof n==`number`&&(t.setNodeMarkup(n,void 0,{...this.node.attrs,...e}),!0)})}deleteNode(){let e=this.getPos();if(typeof e!=`number`)return;let t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function Gj(e){return new pj({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=BO(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let i=c.search(/\S/),u=n.from+c.indexOf(s),d=u+s.length;if(uk(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>u).length)return null;d<n.to&&o.delete(d,n.to),u>n.from&&o.delete(n.from+i,u),l=n.from+i+s.length,o.addMark(n.from+i,l,e.type.create(a||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(e.type)}}})}var Kj=({key:e,editor:t,onPaste:n,onDrop:r,allowedMimeTypes:i,consumePasteEvent:a})=>new Zb({key:e||new ex(`fileHandler`),props:{handleDrop(e,n){if(!r||n.dataTransfer?.types.includes(`application/x-prosemirror-slice`)||!n.dataTransfer?.files.length)return!1;let a=e.posAtCoords({left:n.clientX,top:n.clientY}),o=Array.from(n.dataTransfer.files);return i&&(o=o.filter(e=>i.includes(e.type))),o.length!==0&&(n.preventDefault(),n.stopPropagation(),r(t,o,a?.pos||0),!0)},handlePaste(e,r){if(!n||!r.clipboardData?.files.length)return!1;let o=Array.from(r.clipboardData.files),s=r.clipboardData.getData(`text/html`);return i&&(o=o.filter(e=>i.includes(e.type))),!(o.length===0||(r.preventDefault(),r.stopPropagation(),n(t,o,s),s.length>0&&!a))}}}),qj=bj.create({name:`fileHandler`,addOptions(){return{onPaste:void 0,onDrop:void 0,allowedMimeTypes:void 0,consumePasteEvent:!1}},addProseMirrorPlugins(){return[Kj({key:new ex(this.name),editor:this.editor,allowedMimeTypes:this.options.allowedMimeTypes,onDrop:this.options.onDrop,onPaste:this.options.onPaste,consumePasteEvent:this.options.consumePasteEvent})]}}),Jj=o((e=>{var t=u();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Yj=o(((e,t)=>{t.exports=Jj()})),Xj=Yj(),{getOwnPropertyNames:Zj,getOwnPropertySymbols:Qj}=Object,{hasOwnProperty:$j}=Object.prototype;function eM(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function tM(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function nM(e){return e?.[Symbol.toStringTag]}function rM(e){return Zj(e).concat(Qj(e))}var iM=Object.hasOwn||((e,t)=>$j.call(e,t));function aM(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var oM=`__v`,sM=`__o`,cM=`_owner`,lM=64,{getOwnPropertyDescriptor:uM,keys:dM}=Object,{propertyIsEnumerable:fM}=Object.prototype,pM=uM(Object.getPrototypeOf(Int8Array.prototype),Symbol.toStringTag).get;function mM(e,t){return e.byteLength===t.byteLength&&OM(new Uint8Array(e),new Uint8Array(t))}function hM(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-->0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function gM(e,t){return e.byteLength===t.byteLength&&OM(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function _M(e,t){return aM(e.getTime(),t.getTime())}function vM(e,t,n){if(e.name!==t.name||e.message!==t.message||e.stack!==t.stack)return!1;let r=e.cause,i=t.cause;if(r!==i&&!n.equals(r,i,`cause`,`cause`,e,t,n))return!1;let a=e.errors,o=t.errors;if(a!==o&&!n.equals(a,o,`errors`,`errors`,e,t,n))return!1;let s=dM(e),c=dM(t),l=s.length;if(!l&&!c.length)return!0;let u=0,d;for(;l-->0;)if(d=s[l],d!==`cause`&&d!==`errors`){if(d!==c[l]&&!fM.call(t,d)||!n.equals(e[d],t[d],d,d,e,t,n))return!1;++u}let f=c.length-u;return!f||f===+!!fM.call(t,`cause`)+ +!!fM.call(t,`errors`)}function yM(e,t){return e===t}function bM(e,t,n){return e.name===t.name&&e.message===t.message&&e.stack===t.stack&&wM(e,t,n)}function xM(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var SM=aM;function CM(e,t,n){let r=dM(e),i=dM(t),a=r.length;if(i.length!==a)return!1;let o=a<=lM,s;for(;a-->0;)if(s=r[a],!MM(e,t,s)&&(s!==i[a]&&!(o?i.includes(s):fM.call(t,s))||!n.equals(e[s],t[s],s,s,e,t,n)))return!1;return!0}function wM(e,t,n){let r=rM(e),i=r.length;if(rM(t).length!==i)return!1;let a,o,s;for(;i-->0;)if(a=r[i],!MM(e,t,a)&&(!iM(t,a)||!n.equals(e[a],t[a],a,a,e,t,n))||(o=uM(e,a),s=uM(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function TM(e,t){return aM(e.valueOf(),t.valueOf())}function EM(e,t){return e.source===t.source&&e.flags===t.flags}function DM(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function OM(e,t){let n=e.length;if(t.length!==n||e.byteOffset!==t.byteOffset)return!1;let r=pM.call(e);if(r===`Float64Array`||r===`Float32Array`||r===`Float16Array`){for(;n-->0;)if(e[n]!==t[n]&&(e[n]===e[n]||t[n]===t[n]))return!1;return!0}for(;n-->0;)if(e[n]!==t[n])return!1;return!0}function kM(e,t){return e.href===t.href||e.protocol===t.protocol&&e.username===t.username&&e.password===t.password&&e.host===t.host&&e.pathname===t.pathname&&e.hash===t.hash&&AM(e.searchParams,t.searchParams)}function AM(e,t){let n=e.toString(),r=t.toString();return n===r||jM(n)===jM(r)}function jM(e){return e.split(`&`).sort().join(`&`)}function MM(e,t,n){return(n===cM||n===sM||n===oM)&&!!(e.$$typeof||t.$$typeof)}var NM=`[object ArrayBuffer]`,PM=`[object Arguments]`,FM=`[object Boolean]`,IM=`[object DataView]`,LM=`[object Date]`,RM=`[object Error]`,zM=`[object Map]`,BM=`[object Number]`,VM=`[object Object]`,HM=`[object RegExp]`,UM=`[object Set]`,WM=`[object String]`,GM={"[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},KM=`[object URL]`,qM=Object.prototype.toString;function JM({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`&&a(h,g,_);let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);if(y==null)return c(h,g,_);let b=qM.call(h);if(b===LM)return r(h,g,_);if(b===HM)return u(h,g,_);if(b===zM)return o(h,g,_);if(b===UM)return d(h,g,_);if(b===VM)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===KM)return p(h,g,_);if(b===RM)return i(h,g,_);if(b===PM)return c(h,g,_);if(GM[b])return f(h,g,_);if(b===NM)return e(h,g,_);if(b===IM)return n(h,g,_);if(b===FM||b===BM||b===WM)return l(h,g,_);if(m){let e=m[b];if(!e){let t=nM(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function YM({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:mM,areArraysEqual:n?wM:hM,areDataViewsEqual:gM,areDatesEqual:_M,areErrorsEqual:n?bM:vM,areFunctionsEqual:yM,areMapsEqual:n?eM(xM,wM):xM,areNumbersEqual:SM,areObjectsEqual:n?wM:CM,arePrimitiveWrappersEqual:TM,areRegExpsEqual:EM,areSetsEqual:n?eM(DM,wM):DM,areTypedArraysEqual:n?eM(OM,wM):OM,areUrlsEqual:kM,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=tM(r.areArraysEqual),t=tM(r.areErrorsEqual),n=tM(r.areMapsEqual),i=tM(r.areObjectsEqual),a=tM(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areErrorsEqual:t,areMapsEqual:n,areObjectsEqual:i,areSetsEqual:a})}return r}function XM(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function ZM({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}$M(),$M({strict:!0});var QM=$M({circular:!0});$M({circular:!0,strict:!0}),$M({createInternalComparator:()=>aM}),$M({strict:!0,createInternalComparator:()=>aM}),$M({circular:!0,createInternalComparator:()=>aM}),$M({circular:!0,createInternalComparator:()=>aM,strict:!0});function $M(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=JM(YM(e));return ZM({circular:t,comparator:a,createState:r,equals:n?n(a):XM(a),strict:i})}var eN=o((e=>{var t=u(),n=Yj();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),tN=o(((e,t)=>{t.exports=eN()}))();function nN(e,t){if(e.isDestroyed||t.defaultPrevented||!t.cancelable||!e.isEditable||t.inputType!==`insertParagraph`&&t.inputType!==`insertLineBreak`||!ND()&&!MD())return;let n=e.view,r=n.root,i=(r.getSelection?.call(r)??n.dom.ownerDocument.getSelection())?.anchorNode,a=(i?.nodeType===1?i:i?.parentElement)?.closest(`[data-node-view-content-react]`);if(!a||!n.dom.contains(a))return;let o=n.input.lastKeyCode;o===13&&(n.input.lastKeyCode=null),n.domObserver.forceFlush(),n.domObserver.flush();let s=new KeyboardEvent(`keydown`,{key:`Enter`,code:`Enter`,keyCode:13,shiftKey:t.inputType===`insertLineBreak`,bubbles:!0,cancelable:!0});n.someProp(`handleKeyDown`,e=>e(n,s))?(t.preventDefault(),n.input.lastIOSEnter=0,clearTimeout(n.input.lastIOSEnterFallbackTimeout)):o===13&&(n.input.lastKeyCode=o)}var rN=new ex(`reactMobileEnter`),iN=(...e)=>t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})},aN=({contentComponent:e})=>{let t=(0,Xj.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,R.jsx)(R.Fragment,{children:Object.values(t)})};function oN(){let e=new Set,t={},n=!1,r=()=>{!n&&e.size&&(n=!0,queueMicrotask(()=>{n=!1,e.forEach(e=>e())}))};return{subscribe(t){return e.add(t),()=>{e.delete(t)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(e,n){t={...t,[e]:Bt.createPortal(n.reactElement,n.element,e)},r()},removeRenderer(e){let n={...t};delete n[e],t=n,r()}}}var sN=class extends _.Component{constructor(e){super(e),this.editorContentRef=_.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.view.dom?.parentNode){if(e.contentComponent)return;let t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=oN(),e.createNodeViews(),e.registerPlugin(new Zb({key:rN,props:{handleDOMEvents:{beforeinput:(t,n)=>nN(e,n)}}})),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){let e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||(e.unregisterPlugin(rN),e.view.setProps({nodeViews:{}})),e.contentComponent=null;try{if(!e.view.dom?.parentNode)return;let t=document.createElement(`div`);t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{ref:iN(t,this.editorContentRef),...n}),e?.contentComponent&&(0,R.jsx)(aN,{contentComponent:e.contentComponent})]})}},cN=(0,_.forwardRef)((e,t)=>{let n=_.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return _.createElement(sN,{key:n,innerRef:t,...e})}),lN=_.memo(cN),uN=typeof window<`u`?_.useLayoutEffect:_.useEffect,dN=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,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.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber}),this.lastSnapshot}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e,t=t=>{(t?.transaction===void 0||t.transaction!==e)&&(e=t?.transaction,this.transactionNumber+=1,this.subscribers.forEach(e=>e()))},n=this.editor;return n.on(`transaction`,t),n.on(`update`,t),()=>{n.off(`transaction`,t),n.off(`update`,t)}}}};function fN(e){let[t]=(0,_.useState)(()=>new dN(e.editor)),n=(0,tN.useSyncExternalStoreWithSelector)(t.subscribe,t.getSnapshot,t.getServerSnapshot,e.selector,e.equalityFn??QM);return uN(()=>t.watch(e.editor),[e.editor,t]),(0,_.useDebugValue)(n),n}var pN=typeof window>`u`,mN=pN||!!(typeof window<`u`&&window.next),hN=class e{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(e=>e())}getInitialEditor(){let e=this.options.current.immediatelyRender,t=e??!0;return(pN||mN&&e===void 0)&&(t=!1),t?this.createEditor():null}createEditor(){return new Ij({...this.options.current,onBeforeCreate:(...e)=>{var t;return(t=this.options.current).onBeforeCreate?.call(t,...e)},onBlur:(...e)=>{var t;return(t=this.options.current).onBlur?.call(t,...e)},onCreate:(...e)=>{var t;return(t=this.options.current).onCreate?.call(t,...e)},onDestroy:(...e)=>{var t;return(t=this.options.current).onDestroy?.call(t,...e)},onFocus:(...e)=>{var t;return(t=this.options.current).onFocus?.call(t,...e)},onSelectionUpdate:(...e)=>{var t;return(t=this.options.current).onSelectionUpdate?.call(t,...e)},onTransaction:(...e)=>{var t;return(t=this.options.current).onTransaction?.call(t,...e)},onUpdate:(...e)=>{var t;return(t=this.options.current).onUpdate?.call(t,...e)},onContentError:(...e)=>{var t;return(t=this.options.current).onContentError?.call(t,...e)},onDrop:(...e)=>{var t;return(t=this.options.current).onDrop?.call(t,...e)},onPaste:(...e)=>{var t;return(t=this.options.current).onPaste?.call(t,...e)},onDelete:(...e)=>{var t;return(t=this.options.current).onDelete?.call(t,...e)},onMount:(...e)=>{var t;return(t=this.options.current).onMount?.call(t,...e)},onUnmount:(...e)=>{var t;return(t=this.options.current).onUnmount?.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>[`onCreate`,`onBeforeCreate`,`onDestroy`,`onUpdate`,`onTransaction`,`onFocus`,`onBlur`,`onSelectionUpdate`,`onContentError`,`onDrop`,`onPaste`].includes(n)?!0:n===`extensions`&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every((e,n)=>e===t.extensions?.[n]):e[n]===t[n])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{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((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{this.isComponentMounted&&this.instanceId===e?t&&t.setOptions(this.options.current):t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function gN(e={},t=[]){let n=(0,_.useRef)(e);n.current=e;let[r]=(0,_.useState)(()=>new hN(n)),i=(0,Xj.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,_.useDebugValue)(i),(0,_.useEffect)(r.onRender(t)),fN({editor:i,selector:({transactionNumber:t})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&t===0?0:t+1}),i}var _N=(0,_.createContext)({editor:null});_N.Consumer;var vN=()=>(0,_.useContext)(_N),yN=(0,_.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),bN=()=>(0,_.useContext)(yN);function xN({as:e=`div`,...t}){let{nodeViewContentRef:n,nodeViewContentChildren:r}=bN();return(0,R.jsx)(e,{...t,ref:n,"data-node-view-content":``,style:{whiteSpace:`pre-wrap`,...t.style},children:r})}var SN=_.forwardRef((e,t)=>{let{onDragStart:n}=bN(),r=e.as||`div`;return(0,R.jsx)(r,{...e,ref:t,"data-node-view-wrapper":``,onDragStart:n,style:{whiteSpace:`normal`,...e.style}})});function CN(e){return!!(typeof e==`function`&&e.prototype&&e.prototype.isReactComponent)}function wN(e){return!(typeof e!=`object`||!e.$$typeof||e.$$typeof.toString()!==`Symbol(react.forward_ref)`&&e.$$typeof.description!==`react.forward_ref`)}function TN(e){return!(typeof e!=`object`||!e.$$typeof||e.$$typeof.toString()!==`Symbol(react.memo)`&&e.$$typeof.description!==`react.memo`)}function EN(e){if(CN(e)||wN(e))return!0;if(TN(e)){let t=e.type;if(t)return CN(t)||wN(t)}return!1}function DN(){try{if(_.version)return parseInt(_.version.split(`.`)[0],10)>=19}catch{}return!1}var ON=class{constructor(e,{editor:t,props:n={},as:r=`div`,className:i=``}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=n,this.element=document.createElement(r),this.element.classList.add(`react-renderer`),i&&this.element.classList.add(...i.split(` `)),this.editor.isEditorContentInitialized?(0,Bt.flushSync)(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var e;if(this.destroyed)return;let t=this.component,n=this.props,r=this.editor,i=DN(),a=EN(t),o={...n};o.ref&&!(i||a)&&delete o.ref,!o.ref&&(i||a)&&(o.ref=e=>{this.ref=e}),this.reactElement=(0,R.jsx)(t,{...o}),r==null||(e=r.contentComponent)==null||e.setRenderer(this.id,this)}updateProps(e={}){if(this.destroyed)return;let t=!1,n=Object.keys(e);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==this.props[i]){t=!0;break}}t&&(this.props={...this.props,...e},this.render())}destroy(){var e;this.destroyed=!0;let t=this.editor;t==null||(e=t.contentComponent)==null||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}};_.createContext({markViewContentRef:()=>{}});function kN(e){var t;let n=e.getRootNode(),r=typeof n.getSelection==`function`?n.getSelection():(t=e.ownerDocument)==null||(t=t.defaultView)==null?void 0:t.getSelection();if(!r||r.rangeCount===0)return null;let{anchorNode:i,anchorOffset:a,focusNode:o,focusOffset:s}=r;return!i||!o||!e.contains(i)||!e.contains(o)?null:()=>{try{r.setBaseAndExtent(i,a,o,s)}catch{}}}function AN(e,t,n){return e.node(n)===t.node(n)&&e.before(n)===t.before(n)}function jN(e){if(!kD(e))return[];let{$from:t,$to:n}=e,r=[],i=Math.min(t.depth,n.depth);for(let e=1;e<=i&&AN(t,n,e);e+=1)r.push(t.before(e));return r}var MN=class{constructor(e){this.views=new WeakMap,this.viewCount=0,this.insideViews=new Set,this.syncQueued=!1,this.scheduleSync=()=>{this.syncQueued||(this.syncQueued=!0,queueMicrotask(()=>{this.syncQueued=!1,this.sync()}))},this.handleTransaction=()=>this.scheduleSync(),this.editor=e}register(e){this.viewCount===0&&this.editor.on(`transaction`,this.handleTransaction),this.views.set(e.dom,e),this.viewCount+=1,this.scheduleSync()}unregister(e){this.views.delete(e.dom),--this.viewCount,this.insideViews.delete(e),this.viewCount===0&&this.editor.off(`transaction`,this.handleTransaction)}sync(){if(this.viewCount===0||this.editor.isDestroyed)return;let e=this.findInsideViews();this.updateViews(this.insideViews,e,!1),this.updateViews(e,this.insideViews,!0),this.insideViews=e}updateViews(e,t,n){for(let r of e)t.has(r)||r.setSelectionInside(n)}findInsideViews(){let e=new Set;for(let t of jN(this.editor.state.selection)){let n=this.editor.view.nodeDOM(t),r=n?this.views.get(n):void 0;r&&e.add(r)}return e}},NN=new WeakMap;function PN(e){let t=NN.get(e);return t||(t=new MN(e),NN.set(e,t)),t}var FN=class extends Wj{constructor(e,t,n){if(super(e,t,n),this.nodeSelected=!1,this.handlePositionUpdate=()=>{let e=this.getPos();typeof e==`number`&&e!==this.currentPos&&(this.currentPos=e,this.renderer.updateProps({getPos:()=>this.getPos()}),typeof this.options.attrs==`function`&&this.updateElementAttributes())},this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.contentDOMElement=this.options.contentDOMElementTag?document.createElement(this.options.contentDOMElementTag):document.createElement(this.node.isInline?`span`:`div`),this.contentDOMElement.dataset.nodeViewContentReact=``,this.contentDOMElement.dataset.nodeViewWrapper=``,this.contentDOMElement.style.whiteSpace=`inherit`;let e=this.dom.querySelector(`[data-node-view-content]`);e?e.appendChild(this.contentDOMElement):this.dom.appendChild(this.contentDOMElement)}this.options.trackNodeViewPosition&&this.editor.on(`update`,this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){let e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(n,r,i){return r===`storage`?e.storage[t.name]??{}:Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){let e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,selectionInside:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(e={})=>this.updateAttributes(e),deleteNode:()=>this.deleteNode(),ref:(0,_.createRef)()};if(!this.component.displayName){let e=e=>e.charAt(0).toUpperCase()+e.substring(1);this.component.displayName=e(this.extension.name)}let t={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:e=>{if(e&&this.contentDOMElement&&e.firstChild!==this.contentDOMElement){e.hasAttribute(`data-node-view-wrapper`)&&e.removeAttribute(`data-node-view-wrapper`);let t=kN(this.contentDOMElement);e.appendChild(this.contentDOMElement),t?.()}}},n=this.component,r=(0,_.memo)(e=>(0,R.jsx)(yN.Provider,{value:t,children:(0,_.createElement)(n,e)}));r.displayName=`ReactNodeView`;let i=this.node.isInline?`span`:`div`;this.options.as&&(i=this.options.as);let{className:a=``}=this.options;this.renderer=new ON(r,{editor:this.editor,props:e,as:i,className:`node-${this.node.type.name} ${a}`.trim()}),PN(this.editor).register(this),this.updateElementAttributes(),this.currentPos=this.getPos()}get dom(){if(this.renderer.element.firstElementChild&&!this.renderer.element.firstElementChild?.hasAttribute(`data-node-view-wrapper`))throw Error(`Please use the NodeViewWrapper component for your node view.`);return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}update(e,t,n){let r=e=>{this.renderer.updateProps(e),typeof this.options.attrs==`function`&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update==`function`){let i=this.node,a=this.decorations,o=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=this.getPos(),this.options.update({oldNode:i,oldDecorations:a,newNode:e,newDecorations:t,oldInnerDecorations:o,innerDecorations:n,updateProps:()=>r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}if(e===this.node)return this.node=e,this.decorations=t,this.innerDecorations=n,!0;let i=this.getPos();this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=i;let a={node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(a.getPos=()=>this.getPos()),r(a),!0}selectNode(){this.nodeSelected=!0,this.updateSelectedState(!0)}deselectNode(){this.nodeSelected=!1,this.updateSelectedState(this.options.selectedOnTextSelection===!0&&this.isTextSelectionInside())}setSelectionInside(e){let t=this.nodeSelected||this.options.selectedOnTextSelection===!0&&e;this.renderer.updateProps({selectionInside:e,selected:t}),this.renderer.element.classList.toggle(`ProseMirror-selectednode`,t)}updateSelectedState(e){this.renderer.updateProps({selected:e}),this.renderer.element.classList.toggle(`ProseMirror-selectednode`,e)}isTextSelectionInside(){let e=this.getPos();return typeof e==`number`&&jN(this.editor.state.selection).includes(e)}destroy(){this.renderer.destroy(),PN(this.editor).unregister(this),this.options.trackNodeViewPosition&&this.editor.off(`update`,this.handlePositionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs==`function`){let t=this.editor.extensionManager.attributes,n=GO(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:n})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}};function IN(e,t){return n=>n.editor.contentComponent?new FN(e,n,t):{dom:document.createElement(`span`),contentDOM:null,update:()=>!1,destroy:()=>{},selectNode:()=>{},deselectNode:()=>{},stopEvent:()=>!1,ignoreMutation:()=>!0}}var LN=(0,_.createContext)({get editor(){throw Error(`useTiptap must be used within a <Tiptap> provider`)}});LN.displayName=`TiptapContext`;var RN=()=>(0,_.useContext)(LN);function zN({children:e,...t}){let n=`editor`in t?t.editor:t.instance;if(!n)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let r=(0,_.useMemo)(()=>({editor:n}),[n]),i=(0,_.useMemo)(()=>({editor:n}),[n]);return(0,R.jsx)(_N.Provider,{value:i,children:(0,R.jsx)(LN.Provider,{value:r,children:e})})}zN.displayName=`Tiptap`;function BN({...e}){let{editor:t}=RN();return(0,R.jsx)(lN,{editor:t,...e})}BN.displayName=`Tiptap.Content`,Object.assign(zN,{Content:BN});function VN({title:e,children:t,confirmLabel:n,cancelLabel:r,busy:i,onConfirm:a,onCancel:o}){return(0,R.jsx)(sg,{open:!0,onOpenChange:e=>!e&&!i&&o(),children:(0,R.jsxs)(dg,{className:`sm:max-w-md`,children:[(0,R.jsxs)(fg,{children:[(0,R.jsx)(mg,{className:`font-display text-xl font-extrabold tracking-tight`,children:e}),(0,R.jsx)(hg,{asChild:!0,children:(0,R.jsx)(`div`,{className:`grid gap-2`,children:t})})]}),(0,R.jsxs)(pg,{children:[(0,R.jsx)($d,{variant:`ghost`,onClick:o,disabled:i,children:r??U(`Cancelar`)}),(0,R.jsx)($d,{variant:`destructive`,onClick:a,disabled:i,children:n})]})]})})}var HN=new Map,UN=new Set,WN=(e,t)=>`${e}|${t}`;function GN(){for(let e of UN)e()}function KN(e){return UN.add(e),()=>UN.delete(e)}async function qN(e,t){let n=WN(e,t);if(!HN.has(n)){HN.set(n,null);try{HN.set(n,await vf.getAnnotations(e,t))}catch{HN.delete(n)}GN()}}async function JN(e,t,n){HN.set(WN(e,t),await vf.saveAnnotations(e,t,n)),GN()}function YN(e,t){return(0,_.useEffect)(()=>{t&&qN(e,t)},[e,t]),(0,_.useSyncExternalStore)(KN,()=>t?HN.get(WN(e,t))??null:null)}var XN={s:`40%`,m:`70%`,full:`100%`},ZN=e=>e.display===`s`&&e.markers.length>=4,QN=()=>({version:1,markers:[],highlights:[],arrows:[],hotspots:[]});function $N(e){let t=/^\/files\/[^/]+\/(assets\/[^?#]+)$/.exec(e);return t?.[1]?_g(t[1]):null}var eP=e=>Math.min(1,Math.max(0,e));function tP(e){return{x:eP(e.x),y:eP(e.y)}}function nP(e,t){let n=tP(e),r=tP(t);return{x:Math.min(n.x,r.x),y:Math.min(n.y,r.y),w:Math.abs(n.x-r.x),h:Math.abs(n.y-r.y)}}function rP(e,t){return Math.hypot(e.x-t.x,e.y-t.y)<.01}function iP(e){return`${e[0]}${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`}function aP(e){return[...e].sort((e,t)=>e.n-t.n).map((e,t)=>({...e,n:t+1}))}function oP(e,t){let n={id:iP(`marker`),n:e.markers.length+1,...tP(t)};return{...e,markers:[...e.markers,n]}}function sP(e,t){return{...e,markers:aP(e.markers.filter(e=>e.id!==t)),highlights:e.highlights.filter(e=>e.id!==t),arrows:e.arrows.filter(e=>e.id!==t),hotspots:e.hotspots.filter(e=>e.id!==t)}}function cP(e,t,n,r,i){if(t===`marker`)return oP(e,n);if(rP(n,r))return null;let a=iP(t);if(t===`arrow`)return{...e,arrows:[...e.arrows,{id:a,from:tP(n),to:tP(r)}]};let o=nP(n,r);return t===`highlight`?{...e,highlights:[...e.highlights,{id:a,...o}]}:{...e,hotspots:[...e.hotspots,{id:a,...o,target:i}]}}function lP(e,t,n){return{...e,markers:e.markers.map(e=>e.id===t?{...e,label:n}:e)}}function uP(e,t,n){return{...e,hotspots:e.hotspots.map(e=>e.id===t?{...e,target:n}:e)}}var dP=(e,t,n)=>tP({x:e.x+t,y:e.y+n});function fP(e,t,n){return{...e,x:Math.min(1-e.w,Math.max(0,e.x+t)),y:Math.min(1-e.h,Math.max(0,e.y+n))}}function pP(e,t,n,r){let i=t===`nw`||t===`sw`,a=t===`nw`||t===`ne`,o={x:(i?e.x:e.x+e.w)+n,y:(a?e.y:e.y+e.h)+r},s={x:i?e.x+e.w:e.x,y:a?e.y+e.h:e.y};return{...e,...nP(o,s)}}function mP(e,t,n,r,i){let a=e=>n===`move`?fP(e,r,i):pP(e,n,r,i);return{...e,markers:e.markers.map(e=>e.id===t?{...e,...dP(e,r,i)}:e),highlights:e.highlights.map(e=>e.id===t?a(e):e),hotspots:e.hotspots.map(e=>e.id===t?a(e):e),arrows:e.arrows.map(e=>e.id===t?{...e,from:n===`to`?e.from:dP(e.from,r,i),to:n===`from`?e.to:dP(e.to,r,i)}:e)}}var hP=[21,26,51],gP=`rgb(${hP.join(`,`)})`,_P=`explicai:ocultar-estilo`;function vP(){try{return localStorage.getItem(_P)===`blur`?`blur`:`bar`}catch{return`bar`}}function yP(e){try{localStorage.setItem(_P,e)}catch{}}var bP=e=>Math.max(12,Math.ceil(e/4));function xP(e,t,n,r,i){let a=r-t,o=i-n,s=bP(o),c=new Float32Array(a*o*3);for(let r=0;r<o;r+=s)for(let i=0;i<a;i+=s){let l=Math.min(a,i+s),u=Math.min(o,r+s),d=[0,0,0];for(let a=r;a<u;a++)for(let r=i;r<l;r++)for(let i=0;i<3;i++)d[i]+=e.data[((n+a)*e.width+t+r)*4+i];let f=(l-i)*(u-r);for(let e=r;e<u;e++)for(let t=i;t<l;t++)for(let n=0;n<3;n++)c[(e*a+t)*3+n]=d[n]/f}let l=Math.max(1,Math.floor(s/3)),u=(e,t)=>{let n=new Float32Array(e.length);for(let r=0;r<o;r++)for(let i=0;i<a;i++){let[s,c]=t?[i,a]:[r,o],u=Math.max(0,s-l),d=Math.min(c-1,s+l);for(let o=0;o<3;o++){let s=0;for(let n=u;n<=d;n++)s+=e[(t?r*a+n:n*a+i)*3+o];n[(r*a+i)*3+o]=s/(d-u+1)}}return n},d=u(u(c,!0),!1);for(let r=0;r<o;r++)for(let i=0;i<a;i++){let o=((n+r)*e.width+t+i)*4;for(let t=0;t<3;t++)e.data[o+t]=Math.round(d[(r*a+i)*3+t]);e.data[o+3]=255}}function SP(e,t,n=`bar`){for(let r of t){let t=Math.max(0,Math.floor(r.x*e.width)),i=Math.max(0,Math.floor(r.y*e.height)),a=Math.min(e.width,Math.ceil((r.x+r.w)*e.width)),o=Math.min(e.height,Math.ceil((r.y+r.h)*e.height));if(n===`blur`)a>t&&o>i&&xP(e,t,i,a,o);else for(let n=i;n<o;n++)for(let r=t;r<a;r++){let t=(n*e.width+r)*4;e.data.set([...hP,255],t)}}return e}var CP=e=>({...QN(),highlights:e});function wP(e,t,n){return cP(CP(e),`highlight`,t,n,{type:`url`,href:``})?.highlights??null}function TP(e,t,n,r,i){return mP(CP(e),t,n,r,i).highlights}var EP={select:`V`,marker:`M`,highlight:`D`,arrow:`S`,hotspot:`A`,redact:`O`,crop:`R`},DP=`input, textarea, select, [contenteditable]:not([contenteditable=false])`;function OP(e){if(e.ctrlKey||e.altKey||e.metaKey||e.target instanceof Element&&e.target.closest(DP))return null;let t=e.key.toUpperCase();return Object.keys(EP).find(e=>EP[e]===t)??null}function kP(e,t,n){let r=t.x-e.x,i=t.y-e.y,a=Math.hypot(r,i),o=a===0?1:r/a,s=a===0?0:i/a,c=Math.min(n*4.5,a*.7),l=c*.45,u=t.x-o*c,d=t.y-s*c,f=c*.2;return{shaft:{x1:e.x,y1:e.y,x2:u+o*f,y2:d+s*f},head:[t,{x:u-s*l,y:d+o*l},{x:u+s*l,y:d-o*l}]}}function AP(e){let t=[];for(let n of[...e].sort((e,t)=>e.n-t.n)){let e=(n.label??``).trim(),r=t.at(-1);!e&&r&&!r.label?r.numbers.push(n.n):t.push({numbers:[n.n],badges:[],label:e})}for(let e of t){let[t,n]=[e.numbers[0],e.numbers.at(-1)];e.badges=!e.label&&e.numbers.length>=3?[`${t}–${n}`]:e.numbers.map(String)}return t}function jP(){let e=(0,_.useRef)(null),[t,n]=(0,_.useState)({w:0,h:0});return(0,_.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let r=new ResizeObserver(([e])=>{e&&n({w:e.contentRect.width,h:e.contentRect.height})});return r.observe(t),()=>r.disconnect()},[]),{ref:e,size:t}}function MP({annotations:e,redactions:t=[],redactStyle:n=`bar`,crops:r=[],selectedId:i,onGrab:a}){let{ref:o,size:s}=jP(),c=e=>({x:e.x*s.w,y:e.y*s.h}),l=!!a,u=(e,t=`move`)=>n=>{a&&(n.stopPropagation(),a(e,t,n))},d=[...e.highlights,...e.hotspots,...t,...r].find(e=>`id`in e&&e.id===i),f=e.arrows.find(e=>e.id===i),p=(e,t,n)=>(0,R.jsx)(`span`,{onPointerDown:i?u(i,e):void 0,className:`absolute z-10 grid size-6 -translate-x-1/2 -translate-y-1/2 place-items-center before:size-3 before:rounded-sm before:border-2 before:border-primary before:bg-white before:content-['']`,style:{left:`${t.x*100}%`,top:`${t.y*100}%`,cursor:n}},e),m=e=>e===i?`outline-2 outline-offset-2 outline-primary`:``;return(0,R.jsxs)(`span`,{ref:o,className:L(`absolute inset-0 block`,!l&&`pointer-events-none`),"aria-hidden":!0,children:[r.map(e=>{let[t,n,r,i]=[e.x*100,e.y*100,(e.x+e.w)*100,(e.y+e.h)*100];return(0,R.jsxs)(`span`,{className:`absolute inset-0 block`,children:[(0,R.jsx)(`span`,{className:`absolute inset-0 bg-black/55`,style:{clipPath:`polygon(evenodd, 0 0, 100% 0, 100% 100%, 0 100%, 0 0, ${t}% ${n}%, ${t}% ${i}%, ${r}% ${i}%, ${r}% ${n}%, ${t}% ${n}%)`}}),(0,R.jsx)(`span`,{onPointerDown:u(e.id),"data-crop":!0,className:L(`absolute block border-2 border-dashed border-white`,m(e.id),l&&`cursor-move`),style:{left:`${t}%`,top:`${n}%`,width:`${e.w*100}%`,height:`${e.h*100}%`}})]},e.id)}),t.map(e=>(0,R.jsx)(`span`,{onPointerDown:u(e.id),"data-redaction":!0,className:L(`absolute block rounded-[3px] border border-dashed border-white/70`,m(e.id),l&&`cursor-move`),style:{left:`${e.x*100}%`,top:`${e.y*100}%`,width:`${e.w*100}%`,height:`${e.h*100}%`,...n===`blur`?{backdropFilter:`blur(10px)`,background:`rgb(255 255 255 / 0.15)`}:{background:gP}}},e.id)),e.highlights.map(e=>(0,R.jsx)(`span`,{onPointerDown:u(e.id),className:L(`absolute block rounded-[3px] border-2 border-marca before:absolute before:inset-0 before:bg-marca before:mix-blend-multiply before:content-['']`,m(e.id),l&&`cursor-move`),style:{left:`${e.x*100}%`,top:`${e.y*100}%`,width:`${e.w*100}%`,height:`${e.h*100}%`}},e.id)),e.hotspots.map(e=>(0,R.jsx)(`span`,{onPointerDown:u(e.id),className:L(`absolute block rounded-[3px] border-2 border-dashed border-anotacao bg-anotacao/8`,m(e.id),l&&`cursor-move`),style:{left:`${e.x*100}%`,top:`${e.y*100}%`,width:`${e.w*100}%`,height:`${e.h*100}%`},children:(0,R.jsx)(lm,{className:`absolute -top-2.5 -right-2.5 size-5 rounded-full bg-anotacao p-0.5 text-white`})},e.id)),s.w>0&&e.arrows.length>0&&(0,R.jsx)(`svg`,{className:`absolute inset-0 overflow-visible`,width:s.w,height:s.h,role:`presentation`,children:e.arrows.map(e=>{let t=e.id===i?5:3.5,{shaft:n,head:r}=kP(c(e.from),c(e.to),t),a=r.map(e=>`${e.x},${e.y}`).join(` `);return(0,R.jsxs)(`g`,{onPointerDown:u(e.id),className:L(l&&`cursor-move`),children:[(0,R.jsx)(`line`,{x1:c(e.from).x,y1:c(e.from).y,x2:c(e.to).x,y2:c(e.to).y,stroke:`transparent`,strokeWidth:14}),(0,R.jsxs)(`g`,{stroke:`#fff`,strokeOpacity:.9,strokeLinejoin:`round`,strokeLinecap:`round`,children:[(0,R.jsx)(`line`,{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,strokeWidth:t*2.2}),(0,R.jsx)(`polygon`,{points:a,fill:`#fff`,strokeWidth:t*1.2})]}),(0,R.jsx)(`line`,{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,stroke:`var(--anotacao)`,strokeWidth:t,strokeLinecap:`round`}),(0,R.jsx)(`polygon`,{points:a,fill:`var(--anotacao)`})]},e.id)})}),e.markers.map(e=>(0,R.jsx)(`span`,{onPointerDown:u(e.id),className:L(`absolute size-8 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-dashed border-anotacao shadow-[0_0_0_2px_#fff,inset_0_0_0_2px_#fff]`,`before:absolute before:-top-3 before:-left-3 before:grid before:size-5 before:place-items-center before:rounded-full before:bg-anotacao before:font-mono before:text-[11px] before:font-semibold before:text-sobre-anotacao before:shadow-[0_0_0_2px_#fff] before:content-[attr(data-n)]`,m(e.id),l&&`cursor-move`),style:{left:`${e.x*100}%`,top:`${e.y*100}%`},"data-n":e.n},e.id)),l&&d&&[p(`nw`,{x:d.x,y:d.y},`nwse-resize`),p(`ne`,{x:d.x+d.w,y:d.y},`nesw-resize`),p(`sw`,{x:d.x,y:d.y+d.h},`nesw-resize`),p(`se`,{x:d.x+d.w,y:d.y+d.h},`nwse-resize`)],l&&f&&[p(`from`,f.from,`move`),p(`to`,f.to,`move`)]]})}function NP(e,t){let n=e.getBoundingClientRect();return{x:(t.clientX-n.left)/n.width,y:(t.clientY-n.top)/n.height}}var PP=e=>[...e.markers,...e.highlights,...e.arrows,...e.hotspots].map(e=>e.id),FP=e=>[...PP(e.ann),...e.redact.map(e=>e.id),...e.crop.map(e=>e.id)];function IP(e,t,n,r,i){return{ann:mP(e.ann,t,n,r,i),redact:TP(e.redact,t,n,r,i),crop:TP(e.crop,t,n,r,i)}}function LP(e,t,n,r,i){if(t===`redact`){let t=wP(e.redact,n,r);return t&&{...e,redact:t}}if(t===`crop`){let t=wP([],n,r);return t&&{...e,crop:t}}let a=cP(e.ann,t,n,r,i);return a&&{...e,ann:a}}function RP({src:e,alt:t,draft:n,tool:r,selectedId:i,defaultTarget:a,redactStyle:o,onChange:s,onSelect:c}){let l=(0,_.useRef)(null),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(null),m=r!==`select`,h=f?IP(n,f.id,f.handle,f.to.x-f.from.x,f.to.y-f.from.y):u&&r!==`select`&&r!==`marker`?LP(n,r,u.from,u.to,a):null,g=e=>{if(l.current?.hasPointerCapture?.(e.pointerId)===!1)try{l.current.setPointerCapture(e.pointerId)}catch{}},v=e=>{if(f){p(null),rP(f.from,e)||s(IP(n,f.id,f.handle,e.x-f.from.x,e.y-f.from.y),f.id);return}if(!u||r===`select`)return;let t=LP(n,r,u.from,e,a);if(d(null),!t)return;let i=new Set(FP(n));s(t,FP(t).find(e=>!i.has(e))??null)},y=h??n;return(0,R.jsxs)(`div`,{ref:l,className:L(`relative inline-block max-w-full touch-none select-none`,m?`cursor-crosshair`:`cursor-default`),onPointerDown:e=>{if(!l.current)return;if(!m)return c(null);let t=NP(l.current,e);if(r===`marker`){let e=LP(n,`marker`,t,t,a);return e&&s(e,e.ann.markers.at(-1)?.id??null)}g(e),d({from:t,to:t})},onPointerMove:e=>{l.current&&(f?p({...f,to:NP(l.current,e)}):u&&d({...u,to:NP(l.current,e)}))},onPointerUp:e=>l.current&&v(NP(l.current,e)),children:[(0,R.jsx)(`img`,{src:e,alt:t,draggable:!1,className:`block max-h-[70vh] max-w-full rounded-md border border-border`}),(0,R.jsx)(MP,{annotations:y.ann,redactions:y.redact,redactStyle:o,crops:y.crop,selectedId:i,onGrab:m?void 0:(e,t,n)=>{if(!l.current)return;c(e),g(n);let r=NP(l.current,n);p({id:e,handle:t,from:r,to:r})}})]})}var zP=e=>L(`flex items-center gap-2 rounded-md border px-2 py-1.5`,e?`border-primary bg-accent`:`border-transparent`);function BP({label:e,onClick:t}){return(0,R.jsx)(`button`,{type:`button`,"aria-label":e,onClick:t,className:`grid size-7 shrink-0 place-items-center rounded-md text-muted-foreground hover:bg-secondary hover:text-destructive`,children:(0,R.jsx)(hh,{className:`size-4`})})}function VP({annotations:e,pages:t,selectedId:n,onSelect:r,onChange:i}){let a=Dg(t),o=t=>i(sP(e,t)),s=(t,n)=>i(uP(e,t,n));return e.markers.length+e.highlights.length+e.arrows.length+e.hotspots.length===0?(0,R.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:U(`Escolha uma ferramenta e clique ou arraste sobre a imagem. Cada marcador numerado ganha uma linha aqui para você escrever o que ele mostra.`)}):(0,R.jsxs)(`div`,{className:`grid content-start gap-4`,children:[e.markers.length>0&&(0,R.jsxs)(`section`,{className:`grid gap-1.5`,children:[(0,R.jsx)(`h3`,{className:`rotulo`,children:U(`Legenda`)}),[...e.markers].sort((e,t)=>e.n-t.n).map(t=>(0,R.jsxs)(`div`,{className:zP(t.id===n),onPointerDown:()=>r(t.id),children:[(0,R.jsx)(`span`,{className:`grid size-6 shrink-0 place-items-center rounded-full bg-anotacao font-mono text-xs font-semibold text-sobre-anotacao`,children:t.n}),(0,R.jsx)(ag,{"aria-label":U(`O que o marcador {n} mostra`,{n:t.n}),value:t.label??``,placeholder:U(`O que este marcador mostra?`),onFocus:()=>r(t.id),onChange:n=>i(lP(e,t.id,n.target.value)),className:`h-8`}),(0,R.jsx)(BP,{label:U(`Excluir marcador {n}`,{n:t.n}),onClick:()=>o(t.id)})]},t.id))]}),e.hotspots.length>0&&(0,R.jsxs)(`section`,{className:`grid gap-1.5`,children:[(0,R.jsx)(`h3`,{className:`rotulo`,children:U(`Áreas clicáveis`)}),e.hotspots.map((e,t)=>(0,R.jsxs)(`div`,{className:L(zP(e.id===n),`flex-wrap`),onPointerDown:()=>r(e.id),children:[(0,R.jsx)(lm,{className:`size-4 shrink-0 text-primary`,"aria-hidden":!0}),(0,R.jsxs)(`select`,{"aria-label":U(`Destino da área {n}`,{n:t+1}),value:e.target.type===`page`?e.target.pageId:`__url`,onFocus:()=>r(e.id),onChange:t=>s(e.id,t.target.value===`__url`?{type:`url`,href:`https://`}:{type:`page`,pageId:t.target.value}),className:`h-8 min-w-0 flex-1 rounded-md border border-input bg-card px-2 text-sm`,children:[a.map(e=>(0,R.jsx)(`option`,{value:e.id,children:U(`Página: {titulo}`,{titulo:e.title||U(`Sem título`)})},e.id)),(0,R.jsx)(`option`,{value:`__url`,children:U(`Endereço na web…`)})]}),(0,R.jsx)(BP,{label:U(`Excluir área {n}`,{n:t+1}),onClick:()=>o(e.id)}),e.target.type===`url`&&(0,R.jsx)(ag,{"aria-label":U(`Endereço da área {n}`,{n:t+1}),value:e.target.href,onChange:t=>s(e.id,{type:`url`,href:t.target.value}),className:`h-8 basis-full`})]},e.id))]}),e.highlights.length+e.arrows.length>0&&(0,R.jsxs)(`section`,{className:`grid gap-1.5`,children:[(0,R.jsx)(`h3`,{className:`rotulo`,children:U(`Destaques e setas`)}),[...e.highlights.map((e,t)=>({id:e.id,label:U(`Destaque {n}`,{n:t+1}),Icon:qp})),...e.arrows.map((e,t)=>({id:e.id,label:U(`Seta {n}`,{n:t+1}),Icon:qf}))].map(({id:e,label:t,Icon:i})=>(0,R.jsxs)(`div`,{className:zP(e===n),children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r(e),className:`flex flex-1 items-center gap-2 text-left text-sm`,children:[(0,R.jsx)(i,{className:`size-4 text-primary`,"aria-hidden":!0}),` `,t]}),(0,R.jsx)(BP,{label:U(`Excluir {nome}`,{nome:t.toLowerCase()}),onClick:()=>o(e)})]},e))]})]})}var HP=(e,t)=>e.x>=t.x&&e.x<=t.x+t.w&&e.y>=t.y&&e.y<=t.y+t.h,UP=(e,t)=>({...e,x:(e.x-t.x)/t.w,y:(e.y-t.y)/t.h});function WP(e,t){let n=Math.max(e.x,t.x),r=Math.max(e.y,t.y),i=Math.min(e.x+e.w,t.x+t.w),a=Math.min(e.y+e.h,t.y+t.h);return i<=n||a<=r?null:{...e,x:(n-t.x)/t.w,y:(r-t.y)/t.h,w:(i-n)/t.w,h:(a-r)/t.h}}function GP(e,t){let n=[...e.markers].sort((e,t)=>e.n-t.n).filter(e=>HP(e,t)).map((e,n)=>({...UP(e,t),n:n+1})),r=e.highlights.flatMap(e=>WP(e,t)??[]),i=e.hotspots.flatMap(e=>WP(e,t)??[]),a=e.arrows.filter(e=>HP(e.from,t)&&HP(e.to,t)).map(e=>({...e,from:UP(e.from,t),to:UP(e.to,t)}));return{annotations:{...e,markers:n,highlights:r,arrows:a,hotspots:i},removed:{markers:e.markers.length-n.length,highlights:e.highlights.length-r.length,arrows:e.arrows.length-a.length,hotspots:e.hotspots.length-i.length}}}var KP={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,webp:`image/webp`},qP=e=>KP[e.split(`.`).pop()?.toLowerCase()??``]??null,JP=e=>new Promise((t,n)=>{let r=new Image;r.onload=()=>t(r),r.onerror=()=>n(Error(`image`)),r.src=e});async function YP(e,t,n,r,i=`bar`){let a=qP(t);if(!a)throw Error(`type`);let o=await JP(n),s=document.createElement(`canvas`);s.width=o.naturalWidth,s.height=o.naturalHeight;let c=s.getContext(`2d`);if(!c)throw Error(`canvas`);c.drawImage(o,0,0),c.putImageData(SP(c.getImageData(0,0,s.width,s.height),r,i),0,0),await XP(e,t,n,s,a)}async function XP(e,t,n,r,i,a=.95){let o=await new Promise(e=>r.toBlob(e,i,a));if(o?.type!==i)throw Error(`encode`);await vf.redactAsset(e,t,o),await fetch(n,{cache:`reload`});for(let e of document.querySelectorAll(`img`))e.getAttribute(`src`)===n&&(e.src=n)}function ZP(e,t,n){let r=Math.min(t-1,Math.max(0,Math.round(e.x*t))),i=Math.min(n-1,Math.max(0,Math.round(e.y*n))),a=Math.min(t,Math.max(r+1,Math.round((e.x+e.w)*t))),o=Math.min(n,Math.max(i+1,Math.round((e.y+e.h)*n)));return{x:r/t,y:i/n,w:(a-r)/t,h:(o-i)/n}}async function QP(e,t,n,r){let i=qP(t);if(!i)throw Error(`type`);let a=await JP(n),{naturalWidth:o,naturalHeight:s}=a,c=ZP(r,o,s),l=document.createElement(`canvas`);l.width=Math.round(c.w*o),l.height=Math.round(c.h*s);let u=l.getContext(`2d`);if(!u)throw Error(`canvas`);return u.drawImage(a,Math.round(c.x*o),Math.round(c.y*s),l.width,l.height,0,0,l.width,l.height),await XP(e,t,n,l,i),c}function $P({slug:e,asset:t,src:n,annotations:r,crop:i,hasRedactions:a,inGit:o,onDiscard:s,onApplied:c}){let[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(null),h=i[0],[g,v]=(0,_.useState)(null),y=l&&g?g:h?GP(r,h).removed:null,b=y?y.markers+y.highlights+y.arrows+y.hotspots:0,x=y?[y.markers>0&&lf(y.markers,`{n} marcador`,`{n} marcadores`),y.highlights>0&&lf(y.highlights,`{n} destaque`,`{n} destaques`),y.arrows>0&&lf(y.arrows,`{n} seta`,`{n} setas`),y.hotspots>0&&lf(y.hotspots,`{n} área clicável`,`{n} áreas clicáveis`)].filter(Boolean).join(`, `):``,S=lf(b,`{n} marcação será removida`,`{n} marcações serão removidas`),C=async()=>{if(m(null),h){if(!qP(t))m(U(`Não dá para recortar SVG ou GIF. Use um print em PNG, JPEG ou WebP.`));else if(a)m(U(`Aplique ou descarte as áreas a ocultar antes de recortar.`));else try{let e=await JP(n),t=ZP(h,e.naturalWidth,e.naturalHeight);if(t.w===1&&t.h===1){m(U(`O recorte cobre a imagem inteira. Reduza o retângulo.`));return}v(GP(r,t).removed),u(!0)}catch{m(U(`Não foi possível recortar. A imagem não foi alterada.`))}}},w=async()=>{if(h){f(!0);try{let i=GP(r,await QP(e,t,n,h)).annotations;c(i),await JN(e,t,i).catch(()=>m(U(`A imagem foi recortada, mas as marcações não foram gravadas. Salve de novo.`)))}catch{m(U(`Não foi possível recortar. A imagem não foi alterada.`))}finally{u(!1),f(!1)}}};return(0,R.jsxs)(`section`,{className:`grid gap-2 rounded-md border border-border p-3`,"aria-label":U(`Recortar imagem`),children:[(0,R.jsx)(`h3`,{className:`rotulo`,children:U(`Recortar imagem`)}),(0,R.jsx)(`p`,{className:`text-sm`,children:U(h?`Para ajustar o retângulo, use Selecionar (V). Depois aplique.`:`Arraste sobre a parte que deve ficar.`)}),b>0&&(0,R.jsxs)(`p`,{role:`note`,className:`text-sm text-muted-foreground`,children:[S,`: `,x]}),p&&(0,R.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:p}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,R.jsx)($d,{size:`sm`,variant:`outline`,onClick:()=>void C(),disabled:!h,children:U(`Aplicar recorte`)}),(0,R.jsx)($d,{size:`sm`,variant:`ghost`,onClick:s,disabled:!h,children:U(`Descartar`)})]}),l&&(0,R.jsxs)(VN,{title:U(`Recortar a imagem?`),confirmLabel:U(d?`Recortando…`:`Recortar e apagar o original`),busy:d,onConfirm:()=>void w(),onCancel:()=>u(!1),children:[(0,R.jsx)(`p`,{children:U(`Isto troca o print pela parte recortada. O original será apagado e não dá para voltar.`)}),b>0&&(0,R.jsxs)(`p`,{children:[S,`: `,x,`.`]}),o&&(0,R.jsx)(`p`,{children:U(`Esta pasta está no git: o original continua no histórico, e limpar o histórico é com você.`)}),(0,R.jsx)(`p`,{children:U(`Exportações anteriores ainda têm o original. Exporte de novo e apague os arquivos antigos.`)})]})]})}function eF({slug:e,asset:t,src:n,rects:r,inGit:i,style:a,onStyle:o,onDiscard:s,onApplied:c}){let[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(null),h=()=>{m(null),qP(t)?u(!0):m(U(`Não dá para ocultar dados em SVG ou GIF. Use um print em PNG, JPEG ou WebP.`))},g=async()=>{f(!0);try{await YP(e,t,n,r,a),c()}catch{m(U(`Não foi possível ocultar as áreas. A imagem não foi alterada.`))}finally{u(!1),f(!1)}};return(0,R.jsxs)(`section`,{className:`grid gap-2 rounded-md border border-border p-3`,"aria-label":U(`Ocultar dados`),children:[(0,R.jsx)(`h3`,{className:`rotulo`,children:U(`Ocultar dados`)}),(0,R.jsx)(`p`,{className:`text-sm`,children:r.length===0?U(`Arraste sobre o dado que deve sumir.`):lf(r.length,`{n} área a ocultar`,`{n} áreas a ocultar`)}),(0,R.jsx)(`div`,{role:`radiogroup`,"aria-label":U(`Estilo`),className:`flex gap-2`,children:[`bar`,`blur`].map(e=>(0,R.jsx)($d,{size:`sm`,variant:a===e?`default`:`outline`,role:`radio`,"aria-checked":a===e,onClick:()=>o(e),children:U(e===`bar`?`Tarja`:`Desfoque`)},e))}),a===`blur`&&(0,R.jsx)(`p`,{role:`note`,className:`text-sm text-muted-foreground`,children:U(`Para senha, CPF e números, prefira a tarja.`)}),i&&(0,R.jsx)(`p`,{role:`note`,className:`text-sm text-muted-foreground`,children:U(`Esta pasta está no git: o print original continua no histórico depois de ocultar.`)}),p&&(0,R.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:p}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,R.jsx)($d,{size:`sm`,variant:`outline`,onClick:h,disabled:r.length===0,children:U(`Aplicar ocultação`)}),(0,R.jsx)($d,{size:`sm`,variant:`ghost`,onClick:s,disabled:r.length===0,children:U(`Descartar`)})]}),l&&(0,R.jsxs)(VN,{title:U(`Ocultar as áreas marcadas?`),confirmLabel:U(d?`Ocultando…`:`Ocultar e apagar o original`),busy:d,onConfirm:()=>void g(),onCancel:()=>u(!1),children:[(0,R.jsx)(`p`,{children:U(`Isto troca o print por uma versão com as áreas cobertas. O original será apagado e não dá para voltar.`)}),i&&(0,R.jsx)(`p`,{children:U(`Esta pasta está no git: o original continua no histórico, e limpar o histórico é com você.`)}),(0,R.jsx)(`p`,{children:U(`Exportações anteriores ainda têm o original. Exporte de novo e apague os arquivos antigos.`)})]})]})}var tF=1600;function nF(e,t,n){let r=Math.floor(n);return!(r>=1)||r>=e?null:{w:r,h:Math.max(1,Math.round(t*r/e))}}var rF=e=>/^image\/(jpeg|webp)$/.test(qP(e)??``);function iF(e,t){let n=document.createElement(`canvas`);n.width=t.w,n.height=t.h;let r=n.getContext(`2d`);if(!r)throw Error(`canvas`);return r.imageSmoothingQuality=`high`,r.drawImage(e,0,0,t.w,t.h),n}async function aF(e,t,n,r){let i=qP(e);if(!i)return null;let a=await JP(t),o=nF(a.naturalWidth,a.naturalHeight,n);if(!o)return null;let s=iF(a,o),c=await new Promise(e=>s.toBlob(e,i,r));return c?.type===i?c.size:null}async function oF(e,t,n,r,i){let a=qP(t);if(!a)throw Error(`type`);let o=await JP(n),s=nF(o.naturalWidth,o.naturalHeight,r);if(!s)throw Error(`size`);await XP(e,t,n,iF(o,s),a,i)}var sF=e=>`${Math.max(1,Math.round(e/1024))} KB`;function cF({slug:e,asset:t,src:n,pending:r,inGit:i,onApplied:a}){let[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(tF),[u,d]=(0,_.useState)(85),[f,p]=(0,_.useState)(null),[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(0),[x,S]=(0,_.useState)(null),C=qP(t);if((0,_.useEffect)(()=>{if(!C)return;let e=!0;return Promise.all([JP(n),fetch(n).then(e=>e.blob())]).then(([t,n])=>e&&s({w:t.naturalWidth,h:t.naturalHeight,bytes:n.size})).catch(()=>{}),()=>{e=!1}},[n,C,y]),(0,_.useEffect)(()=>{if(!o||!nF(o.w,o.h,c)){p(null);return}let e=!0,r=setTimeout(()=>{aF(t,n,c,u/100).then(t=>e&&p(t)).catch(()=>e&&p(null))},200);return()=>{e=!1,clearTimeout(r)}},[o,t,n,c,u]),!C||!o)return null;let w=nF(o.w,o.h,c);if(o.w<=1600)return null;let T=async()=>{v(!0),S(null);try{await oF(e,t,n,c,u/100),b(e=>e+1),a()}catch{S(U(`Não foi possível reduzir. A imagem não foi alterada.`))}finally{h(!1),v(!1)}};return(0,R.jsxs)(`section`,{className:`grid gap-2 rounded-md border border-border p-3`,"aria-label":U(`Reduzir imagem`),children:[(0,R.jsx)(`h3`,{className:`rotulo`,children:U(`Reduzir imagem`)}),(0,R.jsxs)(`p`,{className:`text-sm`,children:[U(`Atual`),`: `,o.w,` × `,o.h,` px, `,sF(o.bytes)]}),(0,R.jsxs)(`label`,{className:`grid gap-1 text-sm`,children:[U(`Largura (px)`),(0,R.jsx)(`input`,{type:`number`,min:1,max:o.w-1,value:c,onChange:e=>l(Number(e.target.value)),className:`h-9 rounded-md border border-border bg-background px-2`})]}),rF(t)&&(0,R.jsxs)(`label`,{className:`grid gap-1 text-sm`,children:[U(`Qualidade`),`: `,u,(0,R.jsx)(`input`,{type:`range`,min:50,max:100,value:u,onChange:e=>d(Number(e.target.value))})]}),(0,R.jsx)(`p`,{role:`note`,className:`text-sm text-muted-foreground`,children:w?`${U(`Depois`)}: ${w.w} × ${w.h} px${f?`, ~${sF(f)}`:``}`:U(`A largura precisa ser menor que a atual. Nunca amplia.`)}),r&&(0,R.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:U(`Aplique ou descarte o que está pendente antes de reduzir.`)}),x&&(0,R.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:x}),(0,R.jsx)($d,{size:`sm`,variant:`outline`,onClick:()=>h(!0),disabled:!w||r,children:U(`Reduzir`)}),m&&(0,R.jsxs)(VN,{title:U(`Reduzir a imagem?`),confirmLabel:U(g?`Reduzindo…`:`Reduzir e apagar o original`),busy:g,onConfirm:()=>void T(),onCancel:()=>h(!1),children:[(0,R.jsx)(`p`,{children:U(`Isto troca o print por uma versão com menos pixels. O original será apagado e não dá para voltar. As marcações continuam no mesmo lugar.`)}),i&&(0,R.jsx)(`p`,{children:U(`Esta pasta está no git: o original continua no histórico, e limpar o histórico é com você.`)}),(0,R.jsx)(`p`,{children:U(`Exportações anteriores ainda têm o original. Exporte de novo e apague os arquivos antigos.`)})]})]})}var lF=[{tool:`select`,label:U(`Selecionar`),hint:U(`Clique numa marcação para selecionar e arraste para mover; Delete exclui`),Icon:Dm},{tool:`marker`,label:U(`Marcador`),hint:U(`Clique onde o número deve ficar`),Icon:zp},{tool:`highlight`,label:U(`Destaque`),hint:U(`Arraste sobre o que merece atenção`),Icon:qp},{tool:`arrow`,label:U(`Seta`),hint:U(`Arraste do início até a ponta da seta`),Icon:qf},{tool:`hotspot`,label:U(`Área clicável`),hint:U(`Arraste sobre a área que leva a outra página`),Icon:lm},{tool:`redact`,label:U(`Ocultar`),hint:U(`Arraste sobre o dado que deve sumir`),Icon:kp},{tool:`crop`,label:U(`Recortar`),hint:U(`Arraste sobre a parte da imagem que deve ficar`),Icon:Cp}];function uF({slug:e,asset:t,src:n,alt:r,pages:i,onClose:a}){let o=YN(e,t),[s,c]=(0,_.useState)(null),l=s??(o?{ann:o,redact:[],crop:[]}:null),[u,d]=(0,_.useState)([]),f=e=>{l&&d([...u.slice(-49),l]),c(e)},[p,m]=(0,_.useState)(!1),h=()=>l?.redact.length?m(!0):a(),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(vP);(0,_.useEffect)(()=>{vf.inGitRepo(e).then(e=>v(e.git)).catch(()=>{})},[e]);let x=()=>{let e=u.at(-1);e&&(d(u.slice(0,-1)),c(e),T(null))},[S,C]=(0,_.useState)(`marker`),[w,T]=(0,_.useState)(null),[E,D]=(0,_.useState)(!1),[ee,te]=(0,_.useState)(null),O=Dg(i)[0],k=O?{type:`page`,pageId:O.id}:{type:`url`,href:`https://`},A=lF.find(e=>e.tool===S)??lF[0],ne=async()=>{if(l){D(!0),te(null);try{await JN(e,t,l.ann),h()}catch(e){te(W(e,U(`Não foi possível salvar as marcações.`)))}finally{D(!1)}}};return(0,R.jsxs)(sg,{open:!0,onOpenChange:e=>!e&&h(),children:[(0,R.jsxs)(dg,{className:`grid max-h-[94vh] w-[min(96vw,80rem)] p-4 sm:p-6 max-w-none grid-rows-[auto_auto_minmax(0,1fr)_auto] gap-4 sm:max-w-none`,onOpenAutoFocus:e=>{e.preventDefault(),e.currentTarget.querySelector(`[aria-pressed="true"]`)?.focus()},onKeyDown:e=>{let t=e.target,n=OP(e);n?(e.preventDefault(),C(n)):((e.key===`Delete`||e.key===`Backspace`)&&w&&l&&!t.closest(`input, select`)&&(e.preventDefault(),f({ann:sP(l.ann,w),redact:l.redact.filter(e=>e.id!==w),crop:l.crop.filter(e=>e.id!==w)}),T(null)),(e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`z`&&!t.closest(`input, select, textarea`)&&(e.preventDefault(),x()))},children:[(0,R.jsxs)(fg,{children:[(0,R.jsx)(mg,{className:`font-display text-xl font-extrabold tracking-tight`,children:U(`Editar imagem`)}),(0,R.jsx)(hg,{children:A?.hint})]}),(0,R.jsx)(`div`,{role:`toolbar`,"aria-label":U(`Ferramentas de marcação`),className:`flex flex-wrap gap-1`,children:lF.map(({tool:e,label:t,Icon:n})=>(0,R.jsxs)(`button`,{type:`button`,"aria-pressed":S===e,"aria-label":t,"aria-keyshortcuts":EP[e],title:`${t} (${EP[e]})`,onClick:()=>C(e),className:L(`flex h-9 items-center gap-1.5 rounded-md border px-2.5 text-sm [@media(pointer:coarse)]:min-h-11 [@media(pointer:coarse)]:min-w-11`,S===e?`border-primary bg-accent font-bold text-primary`:`border-border hover:bg-muted`),children:[(0,R.jsx)(n,{className:`size-4`,"aria-hidden":!0}),(0,R.jsx)(`span`,{className:`hidden sm:inline [@media(pointer:coarse)]:inline`,"aria-hidden":!0,children:t}),(0,R.jsx)(`kbd`,{className:`font-mono text-xs`,"aria-hidden":!0,children:EP[e]})]},e))}),l?(0,R.jsxs)(`div`,{className:`grid min-h-0 items-start gap-5 overflow-auto md:grid-cols-[minmax(0,1fr)_20rem]`,children:[(0,R.jsx)(`div`,{className:`grid min-w-0 justify-items-center`,children:(0,R.jsx)(RP,{src:n,alt:r,draft:l,tool:S,selectedId:w,defaultTarget:k,redactStyle:y,onSelect:T,onChange:(e,t)=>{f(e),T(t)}})}),(0,R.jsxs)(`div`,{className:`grid content-start gap-4`,children:[(S===`redact`||l.redact.length>0)&&(0,R.jsx)(eF,{slug:e,asset:t,src:n,rects:l.redact,inGit:g,style:y,onStyle:e=>{yP(e),b(e)},onDiscard:()=>{f({...l,redact:[]}),T(null)},onApplied:()=>{d([]),c({...l,redact:[]}),T(null)}}),(S===`crop`||l.crop.length>0)&&(0,R.jsx)($P,{slug:e,asset:t,src:n,annotations:l.ann,crop:l.crop,hasRedactions:l.redact.length>0,inGit:g,onDiscard:()=>{f({...l,crop:[]}),T(null)},onApplied:e=>{d([]),c({ann:e,redact:[],crop:[]}),T(null)}}),(0,R.jsx)(cF,{slug:e,asset:t,src:n,pending:l.redact.length>0||l.crop.length>0,inGit:g,onApplied:()=>d([])}),(0,R.jsx)(VP,{annotations:l.ann,pages:i,selectedId:w,onSelect:T,onChange:e=>f({...l,ann:e})})]})]}):(0,R.jsx)(`p`,{className:`text-muted-foreground`,children:U(`Carregando as marcações…`)}),(0,R.jsxs)(pg,{className:`flex-row flex-wrap items-center justify-end gap-2 sm:gap-3`,children:[(0,R.jsxs)($d,{variant:`ghost`,onClick:x,disabled:u.length===0,className:`mr-auto`,title:`Ctrl+Z`,children:[(0,R.jsx)(dh,{"aria-hidden":!0}),` `,(0,R.jsx)(`span`,{className:`sr-only sm:not-sr-only`,children:U(`Desfazer`)})]}),ee&&(0,R.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:ee}),(0,R.jsx)($d,{variant:`ghost`,onClick:h,children:U(`Cancelar`)}),(0,R.jsx)($d,{onClick:()=>void ne(),disabled:!l||E,children:U(E?`Salvando…`:`Salvar marcações`)})]})]}),p&&(0,R.jsx)(VN,{title:U(`Sair sem ocultar?`),confirmLabel:U(`Sair e descartar`),cancelLabel:U(`Continuar editando`),onConfirm:a,onCancel:()=>m(!1),children:(0,R.jsx)(`p`,{children:U(`As áreas a ocultar ainda não foram aplicadas. Se você sair, elas se perdem e o print continua com os dados à mostra.`)})})]})}var dF=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,fF=Uj.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:e}){return[`img`,WO(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode(`image`,{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{let t=e.attrs?.src??``,n=e.attrs?.alt??``,r=e.attrs?.title??``;return r?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>`u`)return null;let{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize,i=new Set([`src`,`width`,`height`]);return({node:a,getPos:o,HTMLAttributes:s,editor:c})=>{let l=document.createElement(`img`);l.draggable=!1;let u=WO(this.options.HTMLAttributes,s);Object.entries(u).forEach(([e,t])=>{if(t!=null)switch(e){case`src`:case`width`:case`height`:break;default:l.setAttribute(e,t)}}),u.src!==null&&(l.src=u.src);let d={...s},f=e=>{typeof e==`string`&&e!==``?l.getAttribute(`src`)!==e&&(l.src=e):(l.hasAttribute(`src`)&&l.removeAttribute(`src`),l.src!==``&&(l.src=``))};f(s.src);let p=new Hj({element:l,editor:c,node:a,getPos:o,onResize:(e,t)=>{l.style.width=`${e}px`,l.style.height=`${t}px`},onCommit:(e,t)=>{let n=o();n!==void 0&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:e=>{if(e.type!==a.type)return!1;let t=GO(e,c.extensionManager.attributes.filter(t=>t.type===e.type.name));return Object.keys(d).forEach(e=>{!i.has(e)&&!(e in t)&&l.removeAttribute(e)}),Object.entries(t).forEach(([e,t])=>{i.has(e)||(t==null?l.removeAttribute(e):l.setAttribute(e,t))}),f(t.src),d=t,!0},options:{directions:e,min:{width:t,height:n},preserveAspectRatio:r===!0}}),m=p.dom,h=()=>{m.style.visibility=``,m.style.pointerEvents=``};return m.style.visibility=`hidden`,m.style.pointerEvents=`none`,l.complete&&l.naturalWidth>0?h():(l.onload=h,l.onerror=h),p}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[Rj({find:dF,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}});function pF({markers:e}){return e.length===0?null:(0,R.jsx)(`ol`,{className:`mt-3 grid gap-0.5 text-[15px] leading-[1.4]`,"aria-label":U(`Legenda da imagem`),children:AP(e).map(e=>(0,R.jsxs)(`li`,{className:`flex items-center gap-1`,children:[e.badges.map(e=>(0,R.jsx)(`span`,{className:`inline-grid h-5 min-w-5 place-items-center px-1 rounded-full bg-anotacao font-mono text-[11px] font-semibold text-sobre-anotacao`,children:e},e)),(0,R.jsx)(`span`,{className:e.label?`ml-0.5`:`ml-0.5 text-muted-foreground italic`,children:e.label||U(`Sem descrição`)})]},e.numbers[0]))})}function mF({node:e,extension:t,selected:n}){let r=e.attrs.src,i=e.attrs.alt??``,a=t.options.slug,o=YN(a,$N(r));return(0,R.jsxs)(SN,{as:`span`,className:`my-2 block`,"data-drag-handle":!0,children:[(0,R.jsxs)(`span`,{className:`relative isolate inline-block max-w-full align-top`,style:o?.display?{maxWidth:XN[o.display]}:void 0,children:[(0,R.jsx)(`img`,{src:r,alt:i,draggable:!1,className:n?`ProseMirror-selectednode`:void 0}),o&&(0,R.jsx)(MP,{annotations:o})]}),o&&(0,R.jsx)(pF,{markers:o.markers})]})}var hF=fF.extend({addOptions(){return{...this.parent?.(),slug:``}},addNodeView(){return IN(mF)}}),gF=e=>`"Explicaí prévia ${e}"`,_F=e=>`${gF(e.family)}, ${e.kind===`serif`?`serif`:`sans-serif`}`;function vF(e,t){let n=e.find(e=>e.id===t?.fonts?.text&&e.italic),r=e.find(e=>e.id===t?.fonts?.headings);return{...n&&{fontFamily:_F(n)},...r&&{"--fonte-display":_F(r)}}}var yF=null;function bF(){return yF??=vf.listFonts().then(e=>{for(let t of e)for(let e of t.files)new FontFace(gF(t.family).slice(1,-1),`url(/api/fonts/${e.file})`,{weight:e.weight,style:e.style}).load().then(e=>document.fonts.add(e),()=>void 0);return e}).catch(()=>(yF=null,[])),yF}function xF(e){let[t,n]=(0,_.useState)([]);return(0,_.useEffect)(()=>{if(!e||t.length)return;let r=!0;return bF().then(e=>r&&n(e)),()=>{r=!1}},[e,t.length]),t}function SF(e,t){return`/files/${encodeURIComponent(e)}/${t}`}function CF(e,t){return t.replace(/(!\[[^\]]*\]\()\.\.\/assets\//g,`$1/files/${encodeURIComponent(e)}/assets/`)}function wF(e){return e.replace(/(!\[[^\]]*\]\()\/files\/[^/)]+\/assets\//g,`$1../assets/`)}var TF=[`tip`,`warning`,`caution`,`note`],EF={tip:`TIP`,warning:`WARNING`,caution:`CAUTION`,note:`NOTE`},DF={pt:{tip:`Dica`,warning:`Atenção`,caution:`Erro`,note:`Nota`},en:{tip:`Tip`,warning:`Warning`,caution:`Error`,note:`Note`}},OF=(e,t)=>DF[t.toLowerCase().startsWith(`en`)?`en`:`pt`][e],kF=e=>TF.includes(e),AF=e=>TF.find(t=>EF[t]===e.toUpperCase()),jF=/^ {0,3}> ?\[!(TIP|WARNING|CAUTION|NOTE)\][ \t]*(?:\n|$)((?: {0,3}>.*(?:\n|$))*)/i,MF=Uj.create({name:`callout`,group:`block`,content:`block+`,defining:!0,addAttributes(){return{type:{default:`note`,parseHTML:e=>e.getAttribute(`data-callout`),renderHTML:()=>({})}}},parseHTML(){return[{tag:`div[data-callout]`,getAttrs:e=>kF(e.getAttribute(`data-callout`))?null:!1}]},renderHTML({node:e,HTMLAttributes:t}){return[`div`,WO(t,{"data-callout":e.attrs.type}),0]},markdownTokenizer:{name:`callout`,level:`block`,start:e=>e.search(/^ {0,3}> ?\[!(?:TIP|WARNING|CAUTION|NOTE)\]/im),tokenize(e,t,n){let r=jF.exec(e);if(!r)return;let i=(r[2]??``).replace(/^ {0,3}> ?/gm,``).trimEnd();return{type:`callout`,raw:r[0],calloutType:AF(r[1]??``),tokens:n.blockTokens(i)}}},parseMarkdown:(e,t)=>{let n=t.parseChildren(e.tokens??[]);return t.createNode(`callout`,{type:e.calloutType},n.length?n:[t.createNode(`paragraph`)])},renderMarkdown:(e,t)=>{let n=[`> [!${EF[kF(e.attrs?.type)?e.attrs.type:`note`]}]`];return(e.content??[]).forEach((e,r)=>{let i=t.renderChild?.(e,r)??t.renderChildren([e]);r>0&&n.push(`>`);for(let e of i.split(`
|
|
140
|
+
`))n.push(e.trim()===``?`>`:`> ${e}`)}),n.join(`
|
|
141
|
+
`)},addCommands(){return{setCallout:e=>({commands:t,editor:n})=>n.isActive(this.name)?t.updateAttributes(this.name,{type:e}):t.wrapIn(this.name,{type:e}),unsetCallout:()=>({commands:e})=>e.lift(this.name)}}}),NF={tip:sm,warning:sh,caution:jm,note:$p};function PF(){let e=document.querySelector(`[data-editor-toolbar]`)?.getBoundingClientRect(),t=document.querySelector(`footer`)?.getBoundingClientRect();return{top:Math.max(8,(e?.bottom??0)+8),bottom:Math.max(8,t?window.innerHeight-t.top+8:0),left:8,right:8}}function FF({node:e,editor:t,updateAttributes:n}){let r=e.attrs.type,i=t.view.dom.closest(`[lang]`)?.getAttribute(`lang`)??`pt-BR`,a=NF[r];return(0,R.jsxs)(SN,{className:`callout`,"data-callout":r,children:[(0,R.jsx)(`div`,{className:`callout-head`,contentEditable:!1,children:(0,R.jsxs)(Bg,{children:[(0,R.jsx)(Vg,{asChild:!0,children:(0,R.jsxs)(`button`,{type:`button`,className:`callout-type`,"aria-label":U(`Tipo de alerta: {tipo}`,{tipo:OF(r,i)}),onMouseDown:e=>e.preventDefault(),children:[(0,R.jsx)(a,{"aria-hidden":!0}),(0,R.jsx)(`span`,{children:OF(r,i)}),(0,R.jsx)(sp,{"aria-hidden":!0})]})}),(0,R.jsx)(Hg,{align:`start`,collisionPadding:PF(),onCloseAutoFocus:e=>e.preventDefault(),children:TF.map(e=>{let t=NF[e];return(0,R.jsxs)(Ug,{onSelect:()=>n({type:e}),children:[(0,R.jsx)(t,{"aria-hidden":!0,style:{color:`var(--aviso-${e})`}}),` `,OF(e,i)]},e)})})]})}),(0,R.jsx)(xN,{className:`callout-body`})]})}var IF=MF.extend({addNodeView(){return IN(FF)}});function LF(e){let t=window.getSelection(),{view:n}=e;if(!t?.anchorNode||!t.focusNode||!n.dom.contains(t.anchorNode)||!n.dom.contains(t.focusNode))return;let r=n.posAtDOM(t.anchorNode,t.anchorOffset),i=n.posAtDOM(t.focusNode,t.focusOffset);r!==i&&e.commands.setTextSelection({from:Math.min(r,i),to:Math.max(r,i)})}var RF=e=>{let t=/`([^`]+)`(?!`)$/.exec(e);return!t||t.index>0&&e[t.index-1]==="`"?null:{index:t.index,text:t[0],replaceWith:t[1]}},zF=e=>{let t=/`([^`]+)`(?!`)/g,n=[],r;for(;(r=t.exec(e))!==null;)r.index>0&&e[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n};function BF(e){let t=new Set((e.match(/`+/g)||[]).map(e=>e.length)),n=1;for(;t.has(n);)n+=1;return n}var VF=fj.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,WO(this.options.HTMLAttributes,e),0]},markdownTokenName:`codespan`,parseMarkdown:(e,t)=>t.applyMark(`code`,[{type:`text`,text:e.text||``}]),renderMarkdown:(e,t,n)=>{var r;if(!e.content)return``;let i=typeof(n==null||(r=n.meta)==null?void 0:r.markText)==`string`?n.meta.markText:``,a="`".repeat(BF(i)),o=i.startsWith("`")||i.endsWith("`")?` `:``;return`${a}${o}${t.renderChildren(e.content)}${o}${a}`},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Lj({find:RF,type:this.type})]},addPasteRules(){return[Gj({find:zF,type:this.type})]}}),HF=VF,UF=`listItem`,WF=`textStyle`,GF=/^\s*([-+*])\s$/,KF=Uj.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:e}){return[`ul`,WO(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>e.type!==`list`||e.ordered?[]:{type:`bulletList`,content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
142
|
+
`):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(UF,this.editor.getAttributes(WF)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=Bj({find:GF,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Bj({find:GF,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(WF),editor:this.editor})),[e]}}),qF=(e,t,n)=>{let{selection:r}=e;if(!r.empty)return null;let{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let a=-1;for(let e=i.depth;e>0;--e)if(i.node(e).type.name===t){a=e;break}if(a<0)return null;let o=i.node(a),s=i.index(a);if(s+1>=o.childCount)return null;let c=o.child(s+1);if(!n.includes(c.type.name))return null;let l=e.schema.nodes[t],u=!1;if(c.forEach(e=>{e.type===l&&e.childCount>1&&(u=!0)}),!u)return null;let d=e.doc.resolve(i.after()).nodeAfter;if(!d||!n.includes(d.type.name))return null;let f=[];return d.forEach(e=>{f.push(e)}),f.length===0?null:{listItemDepth:a,nestedList:d,nestedListPos:i.after(),insertPos:i.after(a),items:f}},JF=(e,t,n,r)=>{let i=qF(e,n,r);if(!i)return!1;let{selection:a}=e,{nestedList:o,nestedListPos:s,insertPos:c,items:l}=i,u=e.tr;u.delete(s,s+o.nodeSize);let d=u.mapping.map(c);return u.insert(d,K.from(l)),u.setSelection(a.map(u.doc,u.mapping)),t&&t(u),!0},YF=(e,t,n)=>JF(e.state,e.view.dispatch,t,n),XF=(e,t)=>bj.create({name:`${e}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){let n=()=>YF(this.editor,e,t);return{Delete:n,"Mod-Delete":n}}}),ZF=[[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`]],QF=`abcdefghijklmnopqrstuvwxyz`,$F=String.raw`\d+|[ivxlcdmIVXLCDM]+|${`[a-zA-Z]{1,2}`}`;function eI(e){let t=e,n=``;for(let[e,r]of ZF)for(;t>=e;)n+=r,t-=e;return n}function tI(e){return eI(e).toUpperCase()}function nI(e){let t=e.toLowerCase(),n=0,r=0;for(;n<t.length;){let e=!1;for(let[i,a]of ZF)if(t.startsWith(a,n)){r+=i,n+=a.length,e=!0;break}if(!e)return 0}return r}function rI(e){if(!/^[ivxlcdmIVXLCDM]+$/.test(e))return!1;let t=nI(e);return t<=0?!1:(e===e.toLowerCase()?eI(t):tI(t))===e}function iI(e){let t=e.toLowerCase();if(t.length===1)return t.charCodeAt(0)-97+1;if(t.length===2){let e=t.charCodeAt(0)-97,n=t.charCodeAt(1)-97;return(e+1)*26+n+1}return 0}function aI(e){if(e<=26)return QF[e-1];let t=Math.floor((e-1)/26)-1,n=(e-1)%26;return t<0?QF[n]:QF[t]+QF[n]}function oI(e){if(e&&!/^\d+$/.test(e)){if(rI(e))return e===e.toLowerCase()?`i`:`I`;if(/^[a-z]{1,2}$/.test(e))return`a`;if(/^[A-Z]{1,2}$/.test(e))return`A`}}function sI(e){if(/^\d+$/.test(e))return parseInt(e,10);let t=oI(e);if(t===`i`||t===`I`)return nI(e);if(t===`a`||t===`A`){let t=iI(e);return t>0?t:1}let n=parseInt(e,10);return Number.isNaN(n)?1:n}function cI(e,t){if(e===`numeric`)return String(t);switch(e){case`a`:return aI(t);case`A`:return aI(t).toUpperCase();case`i`:return eI(t);case`I`:return tI(t);default:return String(t)}}function lI(e){if(e.length===0)return!1;let t=oI(e[0])??`numeric`,n=sI(e[0]);if(n<1)return!1;for(let r=0;r<e.length;r++){let i=cI(t,n+r);if(e[r]!==i)return!1}return!0}function uI(e){return{type:oI(e),start:sI(e)}}function dI(e){let{type:t,start:n}=uI(e),r={};return t&&(r.type=t),n!==1&&(r.start=n),r}function fI(e,t,n=`. `){let r=t+1;if(!e||e===`1`)return`${r}${n}`;switch(e){case`a`:return`${aI(r)}${n}`;case`A`:return`${aI(r).toUpperCase()}${n}`;case`i`:return`${eI(r)}${n}`;case`I`:return`${tI(r)}${n}`;default:return`${r}${n}`}}function pI(e){let t=e.tokens?.[0];return!!(e.text&&e.tokens?.length===1&&t?.type===`list`&&t.ordered&&t.raw===e.text)}function mI(e,t){return t.tokenizeInline?t.parseInline(t.tokenizeInline(e)):t.parseInline([{type:`text`,raw:e,text:e}])}var hI=Uj.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,WO(this.options.HTMLAttributes,e),0]},markdownTokenName:`list_item`,parseMarkdown:(e,t)=>{if(e.type!==`list_item`)return[];let n=t.parseBlockChildren??t.parseChildren,r=[];if(e.tokens&&e.tokens.length>0){if(pI(e))return{type:`listItem`,content:[{type:`paragraph`,content:mI(e.text||``,t)}]};if(e.tokens.some(e=>e.type===`paragraph`))r=n(e.tokens);else{let i=e.tokens[0];if(i&&i.type===`text`&&i.tokens&&i.tokens.length>0){if(r=[{type:`paragraph`,content:t.parseInline(i.tokens)}],e.tokens.length>1){let t=n(e.tokens.slice(1));r.push(...t)}}else r=n(e.tokens)}}return r.length===0&&(r=[{type:`paragraph`,content:[]}]),{type:`listItem`,content:r}},renderMarkdown:(e,t,n)=>$A(e,t,e=>{if(e.parentType===`bulletList`)return`- `;if(e.parentType===`orderedList`){var t,n;let r=((t=e.meta)==null||(t=t.parentAttrs)==null?void 0:t.start)||1;return fI((n=e.meta)==null||(n=n.parentAttrs)==null?void 0:n.type,r-1+(e.index||0),`. `)}return`- `},n,{alignNestedToPrefix:n?.parentType===`orderedList`}),addExtensions(){return[XF(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)}}}),gI=(e,t)=>{let{$from:n}=t.selection,r=fD(e,t.schema),i=null,a=n.depth,o=n.pos,s=null;for(;a>0&&s===null;)i=n.node(a),i.type===r?s=a:(--a,--o);return s===null?null:{$pos:t.doc.resolve(o),depth:s}},_I=(e,t)=>{let n=gI(e,t);if(!n)return!1;let[,r]=dk(t,e,n.$pos.pos+4);return r},vI=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),a=e.doc.resolve(i).node();return!(!a||!n.includes(a.type.name))},yI=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!aO(e.state,t)&&vI(e.state,t,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let a=i.at(-1);if(!a)return!1;let o=e.state.doc.resolve(r.start()+a.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},o.end()).joinForward().run()}if(!aO(e.state,t)||!yk(e.state))return!1;let{$from:r}=e.state.selection,i=r.depth-1;return r.node(i).type!==e.schema.nodes[t]||r.index(i)!==0?!1:e.chain().liftListItem(t).run()},bI=(e,t)=>{let n=_I(e,t),r=gI(e,t);return!r||!n?!1:n>r.depth},xI=(e,t)=>{let n=_I(e,t),r=gI(e,t);return!r||!n?!1:n<r.depth},SI=(e,t)=>{if(!aO(e.state,t)||!vk(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:bI(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():xI(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},CI=(e,t,n)=>{let{state:r}=e,{selection:i}=r;if(!i.empty)return!1;let{$from:a}=i;if(a.parentOffset!==0||!a.parent.isTextblock||aO(r,t))return!1;let o=fk(a);if(!o||!n.includes(o.type.name))return!1;let s=o.lastChild;if(!s||s.type.name!==t)return!1;let c=a.parent;if(!s.canReplace(s.childCount,s.childCount,K.from(c)))return!1;let l=a.before(),u=a.after(),d=l-2;return e.commands.command(({tr:e,dispatch:t})=>(t&&(e.delete(l,u).insert(d,K.from(c)),e.setSelection(Y.create(e.doc,d+1)),e.scrollIntoView()),!0))},wI=bj.create({name:`listKeymap`,addOptions(){return{listTypes:[{itemName:`listItem`,wrapperNames:[`bulletList`,`orderedList`]},{itemName:`taskItem`,wrapperNames:[`taskList`]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&SI(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&SI(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&yI(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&yI(e,n,r)&&(t=!0)}),t},Tab:({editor:e})=>{for(let{itemName:t,wrapperNames:n}of this.options.listTypes)if(e.state.schema.nodes[t]!==void 0&&CI(e,t,n))return!0;return!1}}}}),TI=RegExp(`^(\\s*)(${$F})([.)])\\s+(.*)$`),EI=/^\s/,DI={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function OI(e){return TI.test(e.trimStart())}function kI(e){let t=e.trimStart();return DI.bulletItem.test(t)||OI(t)||DI.heading.test(t)||DI.thematicBreak.test(t)&&!t.startsWith(`-`)||/^>\s?/.test(t)||DI.codeFence.test(t)||DI.blockMath.test(t)}function AI(e){return Object.values(DI).some(t=>t.test(e))}function jI(e){let t=[],n=[],r=!1;return e.forEach(e=>{r?n.push(e):e.trim()===``||t.length>0&&kI(e)?(r=!0,n.push(e)):t.push(e)}),{paragraphLines:t,blockLines:n}}function MI(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],a=i.match(TI);if(!a)break;let[,o,s,c,l]=a,u=o.length,d=parseInt(s,10),f=isNaN(d)?oI(s):void 0,p=isNaN(d)?sI(s):d,m=[l],h=n+1,g=[i],_=!1;for(;h<e.length;){let t=e[h];if(t.match(TI))break;if(t.trim()===``)g.push(t),m.push(``),_=!0,h+=1;else if(t.match(EI)){let e=t.length-t.trimStart().length,n=u+s.length+1;g.push(t),m.push(t.slice(Math.min(e,n))),h+=1}else{if(_||AI(t))break;g.push(t),m.push(t),h+=1}}t.push({indent:u,number:p,type:f,content:m.join(`
|
|
143
|
+
`).trim(),contentLines:m,raw:g.join(`
|
|
144
|
+
`)}),r=h,n=h}return[t,r]}var NI=RegExp(`^(${$F})([.)])\\s+(.+)$`);function PI(e){let t=e.split(`
|
|
145
|
+
`).filter(e=>e.trim().length>0);if(t.length===0)return null;let n=[];for(let e of t){let t=e.trim().match(NI);if(!t)return null;n.push({marker:t[1],content:t[3]})}return lI(n.map(e=>e.marker))?{type:`orderedList`,attrs:dI(n[0].marker),content:n.map(e=>({type:`listItem`,content:[{type:`paragraph`,content:[{type:`text`,text:e.content}]}]}))}:null}function FI(e,t,n){let r=[],i=0;for(;i<e.length;){let a=e[i];if(a.indent===t){let{paragraphLines:o,blockLines:s}=jI(a.contentLines),c=o.join(`
|
|
146
|
+
`).trim(),l=[];c&&l.push({type:`paragraph`,raw:c,tokens:n.inlineTokens(c)});let u=s.join(`
|
|
147
|
+
`).trim();if(u){let e=n.blockTokens(u);l.push(...e)}let d=i+1,f=[];for(;d<e.length&&e[d].indent>t;)f.push(e[d]),d+=1;if(f.length>0){let e=FI(f,Math.min(...f.map(e=>e.indent)),n);l.push({type:`list`,ordered:!0,start:f[0].number,typeMarker:f[0].type,items:e,raw:f.map(e=>e.raw).join(`
|
|
148
|
+
`)})}r.push({type:`list_item`,raw:a.raw,tokens:l}),i=d}else i+=1}return r}function II(e,t){return e.map(e=>{if(e.type!==`list_item`)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if(e.type===`paragraph`||e.type===`list`||e.type===`blockquote`||e.type===`code`)n.push(...t.parseChildren([e]));else if(e.type===`text`&&e.tokens){let r=t.parseChildren([e]);n.push({type:`paragraph`,content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:`listItem`,content:n}})}var LI=64;function RI(e,t){let n=[],r=0;for(;n.length<t;){let t=e.indexOf(`
|
|
149
|
+
`,r);if(t===-1)return n.push(e.slice(r)),n;n.push(e.slice(r,t)),r=t+1}return n}function zI(e){let t=e.indexOf(`
|
|
150
|
+
`),n=t===-1?e:e.slice(0,t);if(!TI.test(n))return[[],0,[]];let r=LI,i=RI(e,r),a=MI(i);for(;a[1]===i.length&&i.length===r;)r*=2,i=RI(e,r),a=MI(i);return[a[0],a[1],i]}var BI=`listItem`,VI=`textStyle`,HI=/^(\d+)\.\s$/;function UI(e){let t=e.match(/list-style-type\s*:\s*([^;]+)/i);if(!t)return null;switch(t[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 WI=Uj.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:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>{let t=e.getAttribute(`type`);if(t)return t;let n=e.getAttribute(`style`);if(n){let e=UI(n);if(e)return e}let r=e.querySelector(`li`);if(r){let e=r.getAttribute(`style`);if(e){let t=UI(e);if(t)return t}}return null}}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,type:n,...r}=e,i=WO(this.options.HTMLAttributes,r);return t!==1&&(i.start=t),n&&n!==`1`&&(i.type=n),[`ol`,i,0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[];let n=e.start||1,r=e.typeMarker,i=e.items?II(e.items,t):[],a={};return n!==1&&(a.start=n),r&&(a.type=r),Object.keys(a).length>0?{type:`orderedList`,attrs:a,content:i}:{type:`orderedList`,content:i}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
151
|
+
`):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:()=>-1,tokenize:(e,t,n)=>{let[r,i,a]=zI(e);if(r.length===0)return;let o=FI(r,r[0].indent,n);if(o.length!==0)return{type:`list`,ordered:!0,start:r[0]?.number||1,typeMarker:r[0]?.type,items:o,raw:a.slice(0,i).join(`
|
|
152
|
+
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(BI,this.editor.getAttributes(VI)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new Zb({props:{handlePaste:(e,t)=>{if((t.clipboardData?.getData(`text/html`))?.trim())return!1;let n=t.clipboardData?.getData(`text/plain`);if(!n)return!1;let r=PI(n);if(!r)return!1;try{let t=e.state.schema.nodeFromJSON(r),n=e.state.tr.replaceSelectionWith(t);return e.dispatch(n),!0}catch{return!1}}}})]},addInputRules(){let e=(e,t)=>(!t.attrs.type||t.attrs.type===`1`)&&t.childCount+t.attrs.start===+e[1],t=Bj({find:HI,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:e});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Bj({find:HI,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(VI)}),joinPredicate:e,editor:this.editor})),[t]}}),GI=/^\s*(\[([( |x])?\])\s$/,KI=`position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0`,qI=(e,t,n)=>{var r;return(n==null||(r=n.checkboxLabel)==null?void 0:r.call(n,e,t))||`Task item checkbox for ${e.textContent||`empty task item`}`},JI=Uj.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:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:e=>e.querySelector(`div`)??e}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,WO(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>$A(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addExtensions(){return this.options.nested?[XF(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`);o.style.cssText=KI;let l=e=>{let t=qI(e,e.attrs.checked,this.options.a11y);s.setAttribute(`aria-label`,t),o.textContent=t};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=GO(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[Bj({find:GI,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),YI=Uj.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:e}){return[`ul`,WO(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
153
|
+
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=XA(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(t){let r={type:`taskList`,raw:t.raw,items:t.items},i=e.slice(t.raw.length);return i.trim()?[r,...n.blockTokens(i)]:[r]}return n.blockTokens(e)},i=XA(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});bj.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(KF.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(hI.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(wI.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(WI.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(JI.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(YI.configure(this.options.taskList)),e}});var XI=` `,ZI=`\xA0`,QI=Uj.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,WO(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===XI||n[0].text===XI||n[0].raw===ZI||n[0].text===ZI)&&r.length===1&&r[0].type===`text`&&(r[0].text===XI||r[0].text===ZI)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){var i,a;let e=Array.isArray(n==null||(i=n.previousNode)==null?void 0:i.content)?n.previousNode.content:[];return(n==null||(a=n.previousNode)==null?void 0:a.type)===`paragraph`&&e.length===0?XI:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),$I=QI,eL,tL;if(typeof WeakMap<`u`){let e=new WeakMap;eL=t=>e.get(t),tL=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;eL=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},tL=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var nL=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return eL(e)||tL(e,rL(e))}};function rL(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=iL(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new nL(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&aL(s,o,e),s}function iL(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function aL(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r==null||c.colwidth&&c.colwidth[n]==r||((s||=oL(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function oL(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function sL(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}var cL=new ex(`selectingCells`);function lL(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function uL(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if(n===`cell`||n===`header_cell`)return e.node(t)}return null}function dL(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function fL(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=lL(t.$head)||pL(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function pL(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function mL(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function hL(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function gL(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function _L(e,t,n){let r=e.node(-1),i=nL.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function vL(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function yL(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}function bL(e,t,n){let r=sL(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0}var xL=class e extends J{constructor(e,t=e){let n=e.node(-1),r=nL.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new Mb(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(mL(r)&&mL(i)&&gL(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return Y.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=nL.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=vL(e,0,l)),u>0&&(e=vL(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(K.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new q(K.from(o),1,1)}replace(e,t=q.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n);e.replace(s.map(a.pos),s.map(o.pos),i?q.empty:t)}let i=J.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new q(K.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=nL.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=nL.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=nL.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=nL.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new SL(this.$anchorCell.pos,this.$headCell.pos)}};xL.prototype.visible=!1,J.jsonID(`cell`,xL);var SL=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&gL(t,n)?new xL(t,n):J.near(n,1)}};function CL(e){if(!(e.selection instanceof xL))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(ET.node(n,n+e.nodeSize,{class:`selectedCell`}))}),kT.create(e.doc,t)}function wL({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}function TL({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if(r.type.spec.tableRole===`cell`||r.type.spec.tableRole===`header_cell`){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if(n.type.spec.tableRole===`cell`||n.type.spec.tableRole===`header_cell`){r=n;break}}return n!==r&&t.parentOffset===0}function EL(e,t,n){let r=(t||e).selection,i=(t||e).doc,a,o;if(r instanceof X&&(o=r.node.type.spec.tableRole)){if(o==`cell`||o==`header_cell`)a=xL.create(i,r.from);else if(o==`row`){let e=i.resolve(r.from+1);a=xL.rowSelection(e,e)}else if(!n){let e=nL.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];a=xL.create(i,t+1,n)}}else r instanceof Y&&wL(r)?a=Y.create(i,r.from):r instanceof Y&&TL(r)&&(a=Y.create(i,r.$from.start(),r.$from.end()));return a&&(t||=e.tr).setSelection(a),t}var DL=new ex(`fix-tables`);function OL(e,t,n,r){let i=e.childCount,a=t.childCount;outer:for(let o=0,s=0;o<a;o++){let a=t.child(o);for(let t=s,r=Math.min(i,o+3);t<r;t++)if(e.child(t)==a){s=t+1,n+=a.nodeSize;continue outer}r(a,n),s<i&&e.child(s).sameMarkup(a)?OL(e.child(s),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function kL(e,t){let n,r=(t,r)=>{t.type.spec.tableRole==`table`&&(n=AL(e,t,r,n))};return t?t.doc!=e.doc&&OL(t.doc,e.doc,0,r):e.doc.descendants(r),n}function AL(e,t,n,r){let i=nL.get(t);if(!i.problems)return r;r||=e.tr;let a=[];for(let e=0;e<i.height;e++)a.push(0);for(let e=0;e<i.problems.length;e++){let o=i.problems[e];if(o.type==`collision`){let e=t.nodeAt(o.pos);if(!e)continue;let i=e.attrs;for(let e=0;e<i.rowspan;e++)a[o.row+e]+=o.n;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,vL(i,i.colspan-o.n,o.n))}else if(o.type==`missing`)a[o.row]+=o.n;else if(o.type==`overlong_rowspan`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-o.n})}else if(o.type==`colwidth mismatch`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,colwidth:o.colwidth})}else if(o.type==`zero_sized`){let e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}let o,s;for(let e=0;e<a.length;e++)a[e]&&(o??=e,s=e);for(let c=0,l=n+1;c<i.height;c++){let n=t.child(c),i=l+n.nodeSize,u=a[c];if(u>0){let t=`cell`;n.firstChild&&(t=n.firstChild.type.spec.tableRole);let a=[];for(let n=0;n<u;n++){let n=sL(e.schema)[t].createAndFill();n&&a.push(n)}let d=(c==0||o==c-1)&&s==c?l+1:i-1;r.insert(r.mapping.map(d),a)}l=i}return r.setMeta(DL,{fixTables:!0})}function jL(e){let t=e.selection,n=fL(e),r=n.node(-1),i=n.start(-1),a=nL.get(r);return{...t instanceof xL?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function ML(e,{map:t,tableStart:n,table:r},i){let a=i>0?-1:0;bL(t,r,i+a)&&(a=i==0||i==t.width?null:0);for(let o=0;o<t.height;o++){let s=o*t.width+i;if(i>0&&i<t.width&&t.map[s-1]==t.map[s]){let a=t.map[s],c=r.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,yL(c.attrs,i-t.colCount(a))),o+=c.attrs.rowspan-1}else{let c=a==null?sL(r.type.schema).cell:r.nodeAt(t.map[s+a]).type,l=t.positionAt(o,i,r);e.insert(e.mapping.map(n+l),c.createAndFill())}}return e}function NL(e,t){if(!dL(e))return!1;if(t){let n=jL(e);t(ML(e.tr,n,n.left))}return!0}function PL(e,t){if(!dL(e))return!1;if(t){let n=jL(e);t(ML(e.tr,n,n.right))}return!0}function FL(e,{map:t,table:n,tableStart:r},i){let a=e.mapping.maps.length;for(let o=0;o<t.height;){let s=o*t.width+i,c=t.map[s],l=n.nodeAt(c),u=l.attrs;if(i>0&&t.map[s-1]==c||i<t.width-1&&t.map[s+1]==c)e.setNodeMarkup(e.mapping.slice(a).map(r+c),null,vL(u,i-t.colCount(c)));else{let t=e.mapping.slice(a).map(r+c);e.delete(t,t+l.nodeSize)}o+=u.rowspan}}function IL(e,t){if(!dL(e))return!1;if(t){let n=jL(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let e=n.right-1;FL(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=nL.get(e)}t(r)}return!0}function LL(e,t,n){let r=sL(t.type.schema).header_cell;for(let i=0;i<e.width;i++)if(t.nodeAt(e.map[i+n*e.width])?.type!=r)return!1;return!0}function RL(e,{map:t,tableStart:n,table:r},i){let a=n;for(let e=0;e<i;e++)a+=r.child(e).nodeSize;let o=[],s=i>0?-1:0;LL(t,r,i+s)&&(s=i==0||i==t.height?null:0);for(let a=0,c=t.width*i;a<t.width;a++,c++)if(i>0&&i<t.height&&t.map[c]==t.map[c-t.width]){let i=t.map[c],o=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...o,rowspan:o.rowspan+1}),a+=o.colspan-1}else{let e=(s==null?sL(r.type.schema).cell:r.nodeAt(t.map[c+s*t.width])?.type)?.createAndFill();e&&o.push(e)}return e.insert(a,sL(r.type.schema).row.create(null,o)),e}function zL(e,t){if(!dL(e))return!1;if(t){let n=jL(e);t(RL(e.tr,n,n.top))}return!0}function BL(e,t){if(!dL(e))return!1;if(t){let n=jL(e);t(RL(e.tr,n,n.bottom))}return!0}function VL(e,{map:t,table:n,tableStart:r},i){let a=0;for(let e=0;e<i;e++)a+=n.child(e).nodeSize;let o=a+n.child(i).nodeSize,s=e.mapping.maps.length;e.delete(a+r,o+r);let c=new Set;for(let a=0,o=i*t.width;a<t.width;a++,o++){let l=t.map[o];if(!c.has(l)){if(c.add(l),i>0&&l==t.map[o-t.width]){let t=n.nodeAt(l).attrs;e.setNodeMarkup(e.mapping.slice(s).map(l+r),null,{...t,rowspan:t.rowspan-1}),a+=t.colspan-1}else if(i<t.height&&l==t.map[o+t.width]){let o=n.nodeAt(l),c=o.attrs,u=o.type.create({...c,rowspan:o.attrs.rowspan-1},o.content),d=t.positionAt(i+1,a,n);e.insert(e.mapping.slice(s).map(r+d),u),a+=c.colspan-1}}}}function HL(e,t){if(!dL(e))return!1;if(t){let n=jL(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;VL(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=nL.get(n.table)}t(r)}return!0}function UL(e){let t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function WL({width:e,height:t,map:n},r){let i=r.top*e+r.left,a=i,o=(r.bottom-1)*e+r.left,s=i+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[a]==n[a-1]||r.right<e&&n[s]==n[s+1])return!0;a+=e,s+=e}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[o]==n[o+e])return!0;i++,o++}return!1}function GL(e,t){let n=e.selection;if(!(n instanceof xL)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=jL(e),{map:i}=r;if(WL(i,r))return!1;if(t){let n=e.tr,a={},o=K.empty,s,c;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let l=i.map[e*i.width+t],u=r.table.nodeAt(l);if(!a[l]&&u){if(a[l]=!0,s==null)s=l,c=u;else{UL(u)||(o=o.append(u.content));let e=n.mapping.map(l+r.tableStart);n.delete(e,e+u.nodeSize)}}}if(s==null||c==null)return!0;if(n.setNodeMarkup(s+r.tableStart,null,{...yL(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),o.size>0){let e=s+1+c.content.size,t=UL(c)?s+1:e;n.replaceWith(t+r.tableStart,e+r.tableStart,o)}n.setSelection(new xL(n.doc.resolve(s+r.tableStart))),t(n)}return!0}function KL(e,t){let n=sL(e.schema);return qL(({node:e})=>n[e.type.spec.tableRole])(e,t)}function qL(e){return(t,n)=>{let r=t.selection,i,a;if(r instanceof xL){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{if(i=uL(r.$from),!i)return!1;a=lL(r.$from)?.pos}if(i==null||a==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let o=i.attrs,s=[],c=o.colwidth;o.rowspan>1&&(o={...o,rowspan:1}),o.colspan>1&&(o={...o,colspan:1});let l=jL(t),u=t.tr;for(let e=0;e<l.right-l.left;e++)s.push(c?{...o,colwidth:c&&c[e]?[c[e]]:null}:o);let d;for(let t=l.top;t<l.bottom;t++){let n=l.map.positionAt(t,l.left,l.table);t==l.top&&(n+=i.nodeSize);for(let r=l.left,a=0;r<l.right;r++,a++)(r!=l.left||t!=l.top)&&u.insert(d=u.mapping.map(n+l.tableStart,1),e({node:i,row:t,col:r}).createAndFill(s[a]))}u.setNodeMarkup(a,e({node:i,row:l.top,col:l.left}),s[0]),r instanceof xL&&u.setSelection(new xL(u.doc.resolve(r.$anchorCell.pos),d?u.doc.resolve(d):void 0)),n(u)}return!0}}function JL(e,t){return function(n,r){if(!dL(n))return!1;let i=fL(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let a=n.tr;n.selection instanceof xL?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&a.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):a.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(a)}return!0}}function YL(e){return function(t,n){if(!dL(t))return!1;if(n){let r=sL(t.schema),i=jL(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function XL(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function ZL(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?YL(e):function(t,n){if(!dL(t))return!1;if(n){let r=sL(t.schema),i=jL(t),a=t.tr,o=XL(`row`,i,r),s=XL(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}ZL(`row`,{useDeprecatedLogic:!0}),ZL(`column`,{useDeprecatedLogic:!0});var QL=ZL(`cell`,{useDeprecatedLogic:!0});function $L(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}function eR(e){return function(t,n){if(!dL(t))return!1;let r=$L(fL(t),e);if(r==null)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(Y.between(e,hL(e))).scrollIntoView())}return!0}}function tR(e,t){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole==`table`)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function nR(e,t){let n=e.selection;if(!(n instanceof xL))return!1;if(t){let r=e.tr,i=sL(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new q(i,0,0))}),r.docChanged&&t(r)}return!0}function rR(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole==`table`);)n--,r--,t=t.child(0).content;let i=t.child(0),a=i.type.spec.tableRole,o=i.type.schema,s=[];if(a==`row`)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,a=e?0:Math.max(0,n-1),c=e<t.childCount-1?0:Math.max(0,r-1);(a||c)&&(i=aR(sL(o).row,new q(i,a,c)).content),s.push(i)}else if(a==`cell`||a==`header_cell`)s.push(n||r?aR(sL(o).row,new q(t,n,r)).content:t);else return null;return iR(o,s)}function iR(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:a}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+a}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(K.empty),n[i]<r){let a=sL(e).cell.createAndFill(),o=[];for(let e=n[i];e<r;e++)o.push(a);t[i]=t[i].append(K.from(o))}return{height:t.length,width:r,rows:t}}function aR(e,t){let n=e.createAndFill();return new Ab(n).replace(0,n.content.size,t).doc}function oR({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let a=n[e],o=[];for(let n=t[e]||0,i=0;n<r;i++){let s=a.child(i%a.childCount);n+s.attrs.colspan>r&&(s=s.type.createChecked(vL(s.attrs,s.attrs.colspan,n+s.attrs.colspan-r),s.content)),o.push(s),n+=s.attrs.colspan;for(let n=1;n<s.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+s.attrs.colspan}i.push(K.from(o))}n=i,e=r}if(t!=i){let e=[];for(let r=0,a=0;r<i;r++,a++){let o=[],s=n[a%t];for(let e=0;e<s.childCount;e++){let t=s.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),o.push(t)}e.push(K.from(o))}n=e,t=i}return{width:e,height:t,rows:n}}function sR(e,t,n,r,i,a,o){let s=e.doc.type.schema,c=sL(s),l,u;if(i>t.width)for(let a=0,s=0;a<t.height;a++){let d=n.child(a);s+=d.nodeSize;let f=[],p;p=d.lastChild==null||d.lastChild.type==c.cell?l||=c.cell.createAndFill():u||=c.header_cell.createAndFill();for(let e=t.width;e<i;e++)f.push(p);e.insert(e.mapping.slice(o).map(s-1+r),f)}if(a>t.height){let s=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=e>=t.width?!1:n.nodeAt(t.map[r+e]).type==c.header_cell;s.push(i?u||=c.header_cell.createAndFill():l||=c.cell.createAndFill())}let d=c.row.create(null,K.from(s)),f=[];for(let e=t.height;e<a;e++)f.push(d);e.insert(e.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(l||u)}function cR(e,t,n,r,i,a,o,s){if(o==0||o==t.height)return!1;let c=!1;for(let l=i;l<a;l++){let i=o*t.width+l,a=t.map[i];if(t.map[i-t.width]==a){c=!0;let i=n.nodeAt(a),{top:u,left:d}=t.findCell(a);e.setNodeMarkup(e.mapping.slice(s).map(a+r),null,{...i.attrs,rowspan:o-u}),e.insert(e.mapping.slice(s).map(t.positionAt(o,d,n)),i.type.createAndFill({...i.attrs,rowspan:u+i.attrs.rowspan-o})),l+=i.attrs.colspan-1}}return c}function lR(e,t,n,r,i,a,o,s){if(o==0||o==t.width)return!1;let c=!1;for(let l=i;l<a;l++){let i=l*t.width+o,a=t.map[i];if(t.map[i-1]==a){c=!0;let i=n.nodeAt(a),u=t.colCount(a),d=e.mapping.slice(s).map(a+r);e.setNodeMarkup(d,null,vL(i.attrs,o-u,i.attrs.colspan-(o-u))),e.insert(d+i.nodeSize,i.type.createAndFill(vL(i.attrs,0,o-u))),l+=i.attrs.rowspan-1}}return c}function uR(e,t,n,r,i){let a=n?e.doc.nodeAt(n-1):e.doc;if(!a)throw Error(`No table found`);let o=nL.get(a),{top:s,left:c}=r,l=c+i.width,u=s+i.height,d=e.tr,f=0;function p(){if(a=n?d.doc.nodeAt(n-1):d.doc,!a)throw Error(`No table found`);o=nL.get(a),f=d.mapping.maps.length}sR(d,o,a,n,l,u,f)&&p(),cR(d,o,a,n,c,l,s,f)&&p(),cR(d,o,a,n,c,l,u,f)&&p(),lR(d,o,a,n,s,u,c,f)&&p(),lR(d,o,a,n,s,u,l,f)&&p();for(let e=s;e<u;e++){let t=o.positionAt(e,c,a),r=o.positionAt(e,l,a);d.replace(d.mapping.slice(f).map(t+n),d.mapping.slice(f).map(r+n),new q(i.rows[e-s],0,0))}p(),d.setSelection(new xL(d.doc.resolve(n+o.positionAt(s,c,a)),d.doc.resolve(n+o.positionAt(u-1,l-1,a)))),t(d)}var dR=AE({ArrowLeft:pR(`horiz`,-1),ArrowRight:pR(`horiz`,1),ArrowUp:pR(`vert`,-1),ArrowDown:pR(`vert`,1),"Shift-ArrowLeft":mR(`horiz`,-1),"Shift-ArrowRight":mR(`horiz`,1),"Shift-ArrowUp":mR(`vert`,-1),"Shift-ArrowDown":mR(`vert`,1),Backspace:nR,"Mod-Backspace":nR,Delete:nR,"Mod-Delete":nR});function fR(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function pR(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof xL)return fR(n,r,J.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=vR(i,e,t);if(o==null)return!1;if(e==`horiz`)return fR(n,r,J.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=_L(i,e,t),s;return s=a?J.near(a,1):t<0?J.near(n.doc.resolve(i.before(-1)),-1):J.near(n.doc.resolve(i.after(-1)),1),fR(n,r,s)}}}function mR(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof xL)o=a;else{let r=vR(i,e,t);if(r==null)return!1;o=new xL(n.doc.resolve(r))}let s=_L(o.$headCell,e,t);return s?fR(n,r,new xL(o.$anchorCell,s)):!1}}function hR(e,t){let n=e.state.doc,r=lL(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new xL(r))),!0):!1}function gR(e,t,n){if(!dL(e.state))return!1;let r=rR(n),i=e.state.selection;if(i instanceof xL){r||={width:1,height:1,rows:[K.from(aR(sL(e.state.schema).cell,n))]};let t=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),o=nL.get(t).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=oR(r,o.right-o.left,o.bottom-o.top),uR(e.state,e.dispatch,a,o,r),!0}if(r){let t=fL(e.state),n=t.start(-1);return uR(e.state,e.dispatch,n,nL.get(t.node(-1)).findCell(t.pos-n),r),!0}return!1}function _R(e,t){if(t.button!=0||t.ctrlKey||t.metaKey)return;let n=yR(e,t.target),r;if(t.shiftKey&&e.state.selection instanceof xL)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(r=lL(e.state.selection.$anchor))!=null&&bR(e,t)?.pos!=r.pos)i(r,t),t.preventDefault();else if(!n)return;function i(t,n){let r=bR(e,n),i=cL.getState(e.state)==null;if(!r||!gL(t,r)){if(i)r=t;else return}let a=new xL(t,r);if(i||!e.state.selection.eq(a)){let n=e.state.tr.setSelection(a);i&&n.setMeta(cL,t.pos),e.dispatch(n)}}function a(){e.root.removeEventListener(`mouseup`,a),e.root.removeEventListener(`dragstart`,a),e.root.removeEventListener(`mousemove`,o),cL.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(cL,-1))}function o(r){let o=r,s=cL.getState(e.state),c;if(s!=null)c=e.state.doc.resolve(s);else if(yR(e,o.target)!=n&&(c=bR(e,t),!c))return a();c&&i(c,o)}e.root.addEventListener(`mouseup`,a),e.root.addEventListener(`dragstart`,a),e.root.addEventListener(`mousemove`,o)}function vR(e,t,n){if(!(e.state.selection instanceof Y))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}function yR(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName==`TD`||t.nodeName==`TH`)return t;return null}function bR(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&lL(e.state.doc.resolve(r))||lL(e.state.doc.resolve(i))}var xR=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,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`,`${t}px`),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),SR(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type==this.node.type&&(this.node=e,SR(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type==`attributes`&&(e.target==this.table||this.colgroup.contains(e.target))}};function SR(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l){for(let e=0,n=0;e<l.childCount;e++){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e++,n++){let l=i==n?a:d&&d[e],u=l?l+`px`:``;if(o+=l||r,l||(s=!1),c)c.style.width!=u&&(c.style.width=u),c=c.nextSibling;else{let e=document.createElement(`col`);e.style.width=u,t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}s?(n.style.width=o+`px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=o+`px`)}}var CR=new ex(`tableColumnResizing`);function wR({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=xR,lastColumnResizable:i=!0}={}){let a=new Zb({key:CR,state:{init(e,t){var i;let o=(i=a.spec)==null||(i=i.props)==null?void 0:i.nodeViews,s=sL(t.schema).table.name;return r&&o&&(o[s]=(e,t)=>new r(e,n,t)),new TR(-1,!1)},apply(e,t){return t.apply(e)}},props:{attributes:e=>{let t=CR.getState(e);return t&&t.activeHandle>-1?{class:`resize-cursor`}:{}},handleDOMEvents:{mousemove:(t,n)=>{ER(t,n,e,i)},mouseleave:e=>{DR(e)},mousedown:(e,r)=>{OR(e,r,t,n)}},decorations:e=>{let t=CR.getState(e);if(t&&t.activeHandle>-1)return LR(e,t.activeHandle)},nodeViews:{}}});return a}var TR=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=this,r=t.getMeta(CR);if(r&&r.setHandle!=null)return new e(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return mL(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function ER(e,t,n,r){if(!e.editable)return;let i=CR.getState(e.state);if(i&&!i.dragging){let a=AR(t.target),o=-1;if(a){let{left:r,right:i}=a.getBoundingClientRect();t.clientX-r<=n?o=jR(e,t,`left`,n):i-t.clientX<=n&&(o=jR(e,t,`right`,n))}if(o!=i.activeHandle){if(!r&&o!==-1){let t=e.state.doc.resolve(o),n=t.node(-1),r=nL.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}NR(e,o)}}}function DR(e){if(!e.editable)return;let t=CR.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&NR(e,-1)}function OR(e,t,n,r){if(!e.editable)return!1;let i=e.dom.ownerDocument.defaultView??window,a=CR.getState(e.state);if(!a||a.activeHandle==-1||a.dragging)return!1;let o=e.state.doc.nodeAt(a.activeHandle),s=kR(e,a.activeHandle,o.attrs);e.dispatch(e.state.tr.setMeta(CR,{setDragging:{startX:t.clientX,startWidth:s}}));function c(t){i.removeEventListener(`mouseup`,c),i.removeEventListener(`mousemove`,l);let r=CR.getState(e.state);r?.dragging&&(PR(e,r.activeHandle,MR(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(CR,{setDragging:null})))}function l(t){if(!t.which)return c(t);let i=CR.getState(e.state);if(i&&i.dragging){let a=MR(i.dragging,t,n);FR(e,i.activeHandle,a,r)}}return FR(e,a.activeHandle,s,r),i.addEventListener(`mouseup`,c),i.addEventListener(`mousemove`,l),t.preventDefault(),!0}function kR(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let a=e.domAtPos(t),o=a.node.childNodes[a.offset].offsetWidth,s=n;if(r)for(let e=0;e<n;e++)r[e]&&(o-=r[e],s--);return o/s}function AR(e){for(;e&&e.nodeName!=`TD`&&e.nodeName!=`TH`;)e=e.classList&&e.classList.contains(`ProseMirror`)?null:e.parentNode;return e}function jR(e,t,n,r){let i=n==`right`?-r:r,a=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!a)return-1;let{pos:o}=a,s=lL(e.state.doc.resolve(o));if(!s)return-1;if(n==`right`)return s.pos;let c=nL.get(s.node(-1)),l=s.start(-1),u=c.map.indexOf(s.pos-l);return u%c.width==0?-1:l+c.map[u-1]}function MR(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function NR(e,t){e.dispatch(e.state.tr.setMeta(CR,{setHandle:t}))}function PR(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),a=nL.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,c=e.state.tr;for(let e=0;e<a.height;e++){let t=e*a.width+s;if(e&&a.map[t]==a.map[t-a.width])continue;let r=a.map[t],l=i.nodeAt(r).attrs,u=l.colspan==1?0:s-a.colCount(r);if(l.colwidth&&l.colwidth[u]==n)continue;let d=l.colwidth?l.colwidth.slice():IR(l.colspan);d[u]=n,c.setNodeMarkup(o+r,null,{...l,colwidth:d})}c.docChanged&&e.dispatch(c)}function FR(e,t,n,r){let i=e.state.doc.resolve(t),a=i.node(-1),o=i.start(-1),s=nL.get(a).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,c=e.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!=`TABLE`;)c=c.parentNode;c&&SR(a,c.firstChild,c,r,s,n)}function IR(e){return Array(e).fill(0)}function LR(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return kT.empty;let a=nL.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<a.height;t++){let r=s+t*a.width;if((s==a.width-1||a.map[r]!=a.map[r+1])&&(t==0||a.map[r]!=a.map[r-a.width])){let t=a.map[r],s=o+t+i.nodeAt(t).nodeSize-1,c=document.createElement(`div`);c.className=`column-resize-handle`,CR.getState(e)?.dragging&&n.push(ET.node(o+t,o+t+i.nodeAt(t).nodeSize,{class:`column-resize-dragging`})),n.push(ET.widget(s,c))}}return kT.create(e.doc,n)}function RR({allowTableNodeSelection:e=!1}={}){return new Zb({key:cL,state:{init(){return null},apply(e,t){let n=e.getMeta(cL);if(n!=null)return n==-1?null:n;if(t==null||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:CL,handleDOMEvents:{mousedown:_R},createSelectionBetween(e){return cL.getState(e.state)==null?null:e.state.selection},handleTripleClick:hR,handleKeyDown:dR,handlePaste:gR},appendTransaction(t,n,r){return EL(r,kL(r,n),e)}})}function zR(e){return e===`left`||e===`right`||e===`center`?e:null}function BR(e){let t=(e.style.textAlign||``).trim().toLowerCase(),n=(e.getAttribute(`align`)||``).trim().toLowerCase();return zR(t||n)}function VR(e){return zR(e?.align)}function HR(){return{default:null,parseHTML:e=>BR(e),renderHTML:e=>{let t=zR(e.align);return YA(t)?{style:`text-align: ${t}`}:{}}}}function UR(e){let t=e.parentElement,n=e.closest(`table`);if(!t||!n)return null;let r=Array.from(t.children).indexOf(e),i=n.querySelectorAll(`colgroup > col`)[r]?.getAttribute(`width`);return i?[parseInt(i,10)]:null}function WR(e){let t=e.getAttribute(`colwidth`);return t?t.split(`,`).map(e=>parseInt(e,10)):UR(e)}var GR=/[ \t\r\n\f]+/g;function KR(e){return e.children.length>0?!1:(e.textContent??``).replace(GR,``)===``}function qR(e){let t=e.createAndFill();if(!t)throw Error(`[tiptap error]: "${e.name}" has no default content to backfill.`);return t.content}function JR(e,t,n){if(!(n in t))return;let r=t[n];(r===1||r===`1`||r==null)&&delete e[n]}var YR=Uj.create({name:`tableCell`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:WR},align:HR()}},tableRole:`cell`,isolating:!0,parseHTML(){return[{tag:`td`,getAttrs:e=>KR(e)?{}:!1,getContent:(e,t)=>qR(t.nodes[this.name])},{tag:`td`}]},renderHTML({HTMLAttributes:e}){let t=WO(this.options.HTMLAttributes,e);return JR(t,e,`colspan`),JR(t,e,`rowspan`),[`td`,t,0]}}),XR=Uj.create({name:`tableHeader`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:WR},align:HR()}},tableRole:`header_cell`,isolating:!0,parseHTML(){return[{tag:`th`,getAttrs:e=>KR(e)?{}:!1,getContent:(e,t)=>qR(t.nodes[this.name])},{tag:`th`}]},renderHTML({HTMLAttributes:e}){let t=WO(this.options.HTMLAttributes,e);return JR(t,e,`colspan`),JR(t,e,`rowspan`),[`th`,t,0]}}),ZR=Uj.create({name:`tableRow`,addOptions(){return{HTMLAttributes:{}}},content:`(tableCell | tableHeader)*`,tableRole:`row`,parseHTML(){return[{tag:`tr`}]},renderHTML({HTMLAttributes:e}){return[`tr`,WO(this.options.HTMLAttributes,e),0]}});function QR(e,t){return t?[`width`,`${Math.max(t,e)}px`]:[`min-width`,`${e}px`]}function $R(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l!==null)for(let e=0,n=0;e<l.childCount;e+=1){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e+=1,n+=1){let l=i===n?a:d&&d[e],u=l?`${l}px`:``;if(o+=l||r,l||(s=!1),c){if(c.style.width!==u){let[e,t]=QR(r,l);c.style.setProperty(e,t)}c=c.nextSibling}else{let e=document.createElement(`col`),[n,i]=QR(r,l);e.style.setProperty(n,i),t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}let d=e.attrs.style&&typeof e.attrs.style==`string`&&/\bwidth\s*:/i.test(e.attrs.style);s&&!d?(n.style.width=`${o}px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=`${o}px`)}var ez=class{constructor(e,t,n,r={}){this.node=e,this.cellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`));for(let[e,t]of Object.entries(r))t!=null&&(e===`style`?this.table.style.cssText=String(t):this.table.setAttribute(e,String(t)));e.attrs.style&&(this.table.style.cssText=e.attrs.style),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),$R(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type===this.node.type&&(this.node=e,$R(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){let t=e.target,n=this.dom.contains(t),r=this.contentDOM.contains(t);return!(!n||r||e.type!==`attributes`&&e.type!==`childList`&&e.type!==`characterData`)}};function tz(e,t,n,r){let i=0,a=!0,o=[],s=e.firstChild;if(!s)return{};for(let e=0,c=0;e<s.childCount;e+=1){let{colspan:l,colwidth:u}=s.child(e).attrs;for(let e=0;e<l;e+=1,c+=1){let s=n===c?r:u&&u[e];i+=s||t,s||(a=!1);let[l,d]=QR(t,s);o.push([`col`,{style:`${l}: ${d}`}])}}let c=a?`${i}px`:``,l=a?``:`${i}px`;return{colgroup:[`colgroup`,{},...o],tableWidth:c,tableMinWidth:l}}function nz(e,t){return t?e.createChecked(null,t):e.createAndFill()}function rz(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;let t={};return Object.keys(e.nodes).forEach(n=>{let r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}function iz(e,t,n,r,i){let a=rz(e),o=[],s=[];for(let e=0;e<n;e+=1){let e=nz(a.cell,i);if(e&&s.push(e),r){let e=nz(a.header_cell,i);e&&o.push(e)}}let c=[];for(let e=0;e<t;e+=1)c.push(a.row.createChecked(null,r&&e===0?o:s));return a.table.createChecked(null,c)}function az(e){return e instanceof xL}var oz=({editor:e})=>{let{selection:t}=e.state;if(!az(t))return!1;let n=0;return TO(t.ranges[0].$from,e=>e.type.name===`table`)?.node.descendants(e=>{if(e.type.name===`table`)return!1;[`tableCell`,`tableHeader`].includes(e.type.name)&&(n+=1)}),n===t.ranges.length&&(e.commands.deleteTable(),!0)};function sz(e,t){let n=e.mapping.map(t);if(TO(e.selection.$from,e=>e.type.name===`table`)?.pos===n)return;let r=e.doc.nodeAt(n);if(!r)return;let i=n+r.nodeSize-1;e.setSelection(Y.near(e.doc.resolve(i),-1))}function cz(e){let t=``,n=0;for(;n<e.length;){if(e[n]===`\\`&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}if(e[n]!=="`"){t+=e[n++];continue}let r=0;for(;n+r<e.length&&e[n+r]==="`";)r+=1;let i=n+r,a=!1;for(;i<e.length;){if(e[i]!=="`"){i+=1;continue}let o=0;for(;i+o<e.length&&e[i+o]==="`";)o+=1;if(o===r){let o=e.slice(n+r,i);t+=e.slice(n,n+r)+o.replace(/\\\||\|/g,e=>e===`|`?`\\|`:e)+e.slice(i,i+r),n=i+r,a=!0;break}i+=o}a||(t+=e.slice(n,n+r),n+=r)}return t}function lz(e){return e.split(`
|
|
154
|
+
`).map(e=>!e.includes(`|`)||!e.includes("`")?e:cz(e)).join(`
|
|
155
|
+
`)}function uz(e){return(e||``).replaceAll(``,` `).replace(/\s+/g,` `).trim()}function dz(e,t){return t?e.split(t).join(`
|
|
156
|
+
`):e}function fz(e){return e.replace(/\\.|\|/g,e=>e===`|`?`\\|`:e)}function pz(e,t,n={}){if(!e||!e.content||e.content.length===0)return``;let r=[];e.content.forEach(e=>{let i=[];e.content&&e.content.forEach(e=>{let r=``;r=e.content&&Array.isArray(e.content)&&e.content.length>1?e.content.map(e=>dz(t.renderChildren(e),n.cellLineSeparator)).join(`
|
|
157
|
+
`):dz(e.content?t.renderChildren(e.content):``,n.cellLineSeparator);let a=fz(uz(r.replace(/[ \t]*\r?\n[ \t]*/g,`<br>`))),o=e.type===`tableHeader`,s=VR(e.attrs);i.push({text:a,isHeader:o,align:s})}),r.push(i)});let i=r.reduce((e,t)=>Math.max(e,t.length),0);if(i===0)return``;let a=Array.from({length:i}).fill(0);r.forEach(e=>{for(let t=0;t<i;t+=1){let n=(e[t]?.text||``).length;n>a[t]&&(a[t]=n),a[t]<3&&(a[t]=3)}});let o=(e,t)=>e+` `.repeat(Math.max(0,t-e.length)),s=r[0],c=s.some(e=>e.isHeader),l=Array.from({length:i}).fill(null);r.forEach(e=>{for(let t=0;t<i;t+=1)!l[t]&&e[t]?.align&&(l[t]=e[t].align)});let u=`
|
|
158
|
+
`,d=Array.from({length:i}).map((e,t)=>c&&s[t]&&s[t].text||``);return u+=`| ${d.map((e,t)=>o(e,a[t])).join(` | `)} |\n`,u+=`| ${a.map((e,t)=>{let n=Math.max(3,e),r=l[t];return r===`left`?`:${`-`.repeat(n)}`:r===`right`?`${`-`.repeat(n)}:`:r===`center`?`:${`-`.repeat(n)}:`:`-`.repeat(n)}).join(` | `)} |\n`,(c?r.slice(1):r).forEach(e=>{u+=`| ${Array.from({length:i}).fill(0).map((t,n)=>o(e[n]&&e[n].text||``,a[n])).join(` | `)} |\n`}),u}var mz=new ex(`preserveCellSelectionOnContextMenu`);function hz(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(n)return n.pos;if(!(t.target instanceof Node))return null;try{return e.posAtDOM(t.target,0)}catch{return null}}function gz(e,t){let n=!1;return e.forEachCell((e,r)=>{t>=r&&t<r+e.nodeSize&&(n=!0)}),n}function _z(){return new Zb({key:mz,props:{handleDOMEvents:{mousedown(e,t){if(t.button!==2)return!1;let{selection:n}=e.state;if(!az(n)||n.ranges.length<2)return!1;let r=hz(e,t);return r==null||!gz(n,r)?!1:(t.preventDefault(),!0)}}}})}var vz=Uj.create({name:`table`,addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:ez,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:`tableRow+`,tableRole:`table`,isolating:!0,group:`block`,parseHTML(){return[{tag:`table`}]},renderHTML({node:e,HTMLAttributes:t}){let{colgroup:n,tableWidth:r,tableMinWidth:i}=tz(e,this.options.cellMinWidth),a=t.style;function o(){return a||(r?`width: ${r}`:`min-width: ${i}`)}let s=[`table`,WO(this.options.HTMLAttributes,t,{style:o()}),n,[`tbody`,0]];return this.options.renderWrapper?[`div`,{class:`tableWrapper`},s]:s},parseMarkdown:(e,t)=>{let n=[],r=Array.isArray(e.align)?e.align:[];if(e.header){let i=[];e.header.forEach((e,n)=>{let a=zR(r[n]??e.align),o=a?{align:a}:{};i.push(t.createNode(`tableHeader`,o,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),n.push(t.createNode(`tableRow`,{},i))}return e.rows&&e.rows.forEach(e=>{let i=[];e.forEach((e,n)=>{let a=zR(r[n]??e.align),o=a?{align:a}:{};i.push(t.createNode(`tableCell`,o,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),n.push(t.createNode(`tableRow`,{},i))}),t.createNode(`table`,void 0,n)},renderMarkdown:(e,t)=>pz(e,t),markdownTokenizer:{name:`table`,level:`block`,start:e=>{let t=e.split(`
|
|
159
|
+
`);if(t.length<2)return-1;let n=t[1];return!/^[ \t|:]*-[ \t|:-]*$/.test(n)||!n.includes(`|`)?-1:t[0].includes(`|`)?0:-1},tokenize(e,t,n){let r=e.indexOf(`
|
|
160
|
+
|
|
161
|
+
`),i=r>=0?e.slice(0,r):e,a=i.split(`
|
|
162
|
+
`);if(a.length<2)return;let o=a[1];if(!/^[ \t|:]*-[ \t|:-]*$/.test(o)||!o.includes(`|`))return;let s=lz(i);if(s===i)return;let c=n.blockTokens(s)[0];if(c?.type!==`table`||!c.raw)return;let l=c.raw.split(`
|
|
163
|
+
`).length,u=e.split(`
|
|
164
|
+
`).slice(0,l).join(`
|
|
165
|
+
`);return{...c,raw:u}}},addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:a})=>{let o=iz(a.schema,e,t,n);if(i){let e=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(Y.near(r.doc.resolve(e)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>NL(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>PL(e,t),deleteColumn:()=>({state:e,dispatch:t})=>{let n=TO(e.selection.$from,e=>e.type.name===`table`);return IL(e,t&&(e=>{n&&sz(e,n.pos),t(e)}))},addRowBefore:()=>({state:e,dispatch:t})=>zL(e,t),addRowAfter:()=>({state:e,dispatch:t})=>BL(e,t),deleteRow:()=>({state:e,dispatch:t})=>{let n=TO(e.selection.$from,e=>e.type.name===`table`);return HL(e,t&&(e=>{n&&sz(e,n.pos),t(e)}))},deleteTable:()=>({state:e,dispatch:t})=>tR(e,t),mergeCells:()=>({state:e,dispatch:t})=>GL(e,t),splitCell:()=>({state:e,dispatch:t})=>KL(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>ZL(`column`)(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>ZL(`row`)(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>QL(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>GL(e,t)?!0:KL(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>JL(e,t)(n,r),goToNextCell:()=>({state:e,dispatch:t})=>eR(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>eR(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&kL(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){let n=xL.create(t.doc,e.anchorCell,e.headCell);t.setSelection(n)}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:oz,"Mod-Backspace":oz,Delete:oz,"Mod-Delete":oz}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[wR({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],RR({allowTableNodeSelection:this.options.allowTableNodeSelection}),_z()]},addNodeView(){let e=this.options.resizable&&this.editor.isEditable,t=this.options.View;return e||!t?null:({node:e,view:n,HTMLAttributes:r})=>{let i=WO(this.options.HTMLAttributes,r);return new t(e,this.options.cellMinWidth,n,i)}},extendNodeSchema(e){return{tableRole:BO(Q(e,`tableRole`,{name:e.name,options:e.options,storage:e.storage}))}}}),yz=bj.create({name:`tableKit`,addExtensions(){let e=[];return this.options.table!==!1&&e.push(vz.configure(this.options.table)),this.options.tableCell!==!1&&e.push(YR.configure(this.options.tableCell)),this.options.tableHeader!==!1&&e.push(XR.configure(this.options.tableHeader)),this.options.tableRow!==!1&&e.push(ZR.configure(this.options.tableRow)),e}});function bz(e={}){return new Zb({view(t){return new xz(t,e)}})}var xz=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.setCursor(null),this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc){if(this.lastDragEvent){let e=this.computeTarget(this.lastDragEvent);e==this.cursorPos?this.updateOverlay():this.setCursor(e)}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),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.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`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(!t||i)return null;let a=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=ub(this.editorView.state.doc,a,this.editorView.dragging.slice);e!=null&&(a=e)}return a}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},Sz=class e extends J{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):J.near(r)}content(){return q.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new Cz(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!Tz(e)||!Ez(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!X.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};Sz.prototype.visible=!1,Sz.findFrom=Sz.findGapCursorFrom,J.jsonID(`gapcursor`,Sz);var Cz=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Sz.valid(t)?new Sz(t):J.near(t)}};function wz(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function Tz(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0}else for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||wz(e.type))return!0;if(e.inlineContent)return!1}}return!0}function Ez(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0}else for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||wz(e.type))return!0;if(e.inlineContent)return!1}}return!0}function Dz(){return new Zb({props:{decorations:Mz,createSelectionBetween(e,t,n){return t.pos==n.pos&&Sz.valid(n)?new Sz(n):null},handleClick:Az,handleKeyDown:Oz,handleDOMEvents:{beforeinput:jz}}})}var Oz=AE({ArrowLeft:kz(`horiz`,-1),ArrowRight:kz(`horiz`,1),ArrowUp:kz(`vert`,-1),ArrowDown:kz(`vert`,1)});function kz(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof Y){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=Sz.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new Sz(c))),!0):!1}}function Az(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!Sz.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&X.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new Sz(r))),!0)}function jz(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof Sz))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=K.empty;for(let e=r.length-1;e>=0;e--)i=K.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new q(i,0,0));return a.setSelection(Y.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function Mz(e){if(!(e.selection instanceof Sz))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,kT.create(e.doc,[ET.widget(e.selection.head,t,{key:`gapcursor`})])}bj.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new Zb({key:new ex(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var Nz=bj.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[bz(this.options)]}});bj.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new Zb({key:new ex(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return kT.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(ET.node(t,t+e.nodeSize,{class:this.options.className}))}),kT.create(e,a)}}})]}});var Pz=bj.create({name:`gapCursor`,addProseMirrorPlugins(){return[Dz()]},extendNodeSchema(e){return{allowGapCursor:BO(Q(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),Fz=`placeholder`,Iz=new ex(`tiptap__placeholder`);function Lz(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),ET.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function Rz(e,t){return typeof e==`function`?e(t):e}function zz({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:a,to:o}){let{anchor:s}=i,c=[],l=e.isEmpty;return r.nodesBetween(a,o,(r,i)=>{let a=s>=i&&s<=i+r.nodeSize,o=!r.isLeaf&&Sk(r);return r.type.isTextblock&&(a||!t.showOnlyCurrent)&&o&&c.push(Lz({editor:e,isEmptyDoc:l,dataAttribute:n,hasAnchor:a,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:Rz(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:a})},node:r,pos:i})),t.includeChildren}),c}function Bz({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!e.isEditable&&t.showOnlyWhenEditable)return null;let{anchor:a}=i,o=[],s=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),c=i.depth>0?i.node(1):i.nodeAfter,l=i.depth>0?i.before(1):a;if(c&&c.type.isTextblock&&Sk(c)){let r=a>=l&&a<=l+c.nodeSize;o.push(Lz({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:Rz(t.emptyNodeClass,{editor:e,node:c,pos:l,hasAnchor:r})},node:c,pos:l}))}}else o.push(...zz({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return kT.create(r,o)}function Vz(e,t){let n=e.resolve(t);if(n.depth===0){let e=n.nodeAfter??n.nodeBefore;if(!e)return{from:t,to:t};let r=n.nodeAfter?t:t-e.nodeSize;return{from:r,to:r+e.nodeSize}}let r=n.before(1);return{from:r,to:r+n.node(1).nodeSize}}function Hz(e,t){return{from:Math.max(0,t.from-1),to:Math.min(e.content.size,t.to-1)}}function Uz(e,t,n){let r=[];return e.forEach((e,i)=>{let a=i,o=a+e.nodeSize,s=a+1,c=o+1;s<n&&c>t&&r.push({from:a,to:o})}),r}function Wz(e){if(e.length===0)return[];let t=[...e].sort((e,t)=>e.from-t.from),n=[{...t[0]}];for(let e=1;e<t.length;e+=1){let r=n[n.length-1],i=t[e];i.from<=r.to?r.to=Math.max(r.to,i.to):n.push({...i})}return n}function Gz(e,t){let n=Uz(e,t.from,t.to);return n.push(Hz(e,Vz(e,t.from))),t.to>t.from?n.push(Hz(e,Vz(e,Math.min(t.to,e.content.size+1)-1))):t.from<e.content.size+1&&n.push(Hz(e,Vz(e,Math.min(t.from+1,e.content.size)))),n}function Kz(e,t,n){let r=[];if(e.docChanged){let t=lk(e);for(let e of t)r.push(...Gz(n.doc,e.newRange))}return e.selectionSet&&(r.push(Hz(n.doc,Vz(n.doc,e.mapping.map(t.selection.anchor)))),r.push(Hz(n.doc,Vz(n.doc,n.selection.anchor)))),Wz(r)}function qz(e,t,n){let r=Math.max(0,Math.min(e,n.content.size));return{from:r,to:Math.max(r,Math.min(t,n.content.size))}}function Jz({decorations:e,ranges:t,editor:n,options:r,dataAttribute:i,doc:a,selection:o}){let s=e;for(let e of t){let{from:t,to:c}=qz(e.from,e.to,a),l=s.find(t,c).filter(e=>e.from>=t&&e.to<=c);l.length&&(s=s.remove(l));let u=zz({editor:n,options:r,dataAttribute:i,doc:a,selection:o,from:t,to:c});u.length&&(s=s.add(a,u))}return s}function Yz({editor:e,options:t,dataAttribute:n}){return{init(r,i){return Bz({editor:e,options:t,dataAttribute:n,doc:i.doc,selection:i.selection})??kT.empty},apply(r,i,a,o){return!r.docChanged&&!r.selectionSet?i:Jz({decorations:i.map(r.mapping,r.doc),ranges:Kz(r,a,o),editor:e,options:t,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function Xz(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function Zz({editor:e,options:t}){let n=t.dataAttribute?`data-${Xz(t.dataAttribute)}`:`data-${Fz}`,r=t.showOnlyCurrent&&!t.includeChildren;return new Zb({key:Iz,...r?{}:{state:Yz({editor:e,options:t,dataAttribute:n})},props:{decorations:r?({doc:r,selection:i})=>Bz({editor:e,options:t,dataAttribute:n,doc:r,selection:i}):n=>t.showOnlyWhenEditable&&!e.isEditable?kT.empty:Iz.getState(n)??kT.empty}})}var Qz=bj.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:Fz,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[Zz({editor:this.editor,options:this.options})]}});function $z(e,t){return!e.selection.empty&&!Ck(e.selection)&&t.isEditable}function eB(e,t){return $z(e,t)&&!t.isFocused&&!t.view.dragging}function tB(){var e;(e=window.getSelection())==null||e.removeAllRanges()}function nB(e){e.focus()}bj.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new Zb({key:new ex(`selection`),props:{decorations(n){return eB(n,e)?kT.create(n.doc,[ET.inline(n.selection.from,n.selection.to,{class:t.className})]):null},handleDOMEvents:{blur(t){return $z(t.state,e)&&tB(),!1},focus(t){return $z(t.state,e)&&requestAnimationFrame(()=>{!e.isDestroyed&&t.hasFocus()&&nB(t)}),!1}}}})]}});function rB({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var iB=bj.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new ex(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new Zb({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!rB({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!rB({node:r,types:n})}}})]}}),aB=bj.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>eD(e,t),redo:()=>({state:e,dispatch:t})=>tD(e,t)}},addProseMirrorPlugins(){return[QE(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()}}});function oB(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var sB=oB();function cB(e){sB=e}var lB={exec:()=>null};function uB(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(fB.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var dB=(()=>{try{return!0}catch{return!1}})(),fB={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:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`),blockquoteBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}>`)},pB=/^(?:[ \t]*(?:\n|$))+/,mB=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,hB=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,gB=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,_B=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,vB=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,yB=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,bB=uB(yB).replace(/bull/g,vB).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(),xB=uB(yB).replace(/bull/g,vB).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(),SB=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,CB=/^[^\n]+/,wB=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,TB=uB(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,wB).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),EB=uB(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,vB).getRegex(),DB=`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`,OB=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,kB=uB(`^ {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`,OB).replace(`tag`,DB).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),AB=uB(SB).replace(`hr`,gB).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`,DB).getRegex(),jB={blockquote:uB(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,AB).getRegex(),code:mB,def:TB,fences:hB,heading:_B,hr:gB,html:kB,lheading:bB,list:EB,newline:pB,paragraph:AB,table:lB,text:CB},MB=uB(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,gB).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`,DB).getRegex(),NB={...jB,lheading:xB,table:MB,paragraph:uB(SB).replace(`hr`,gB).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,MB).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`,DB).getRegex()},PB={...jB,html:uB(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,OB).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:lB,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:uB(SB).replace(`hr`,gB).replace(`heading`,` *#{1,6} *[^
|
|
166
|
+
]`).replace(`lheading`,bB).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},FB=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,IB=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,LB=/^( {2,}|\\)\n(?!\s*$)/,RB=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,zB=/[\p{P}\p{S}]/u,BB=/[\s\p{P}\p{S}]/u,VB=/[^\s\p{P}\p{S}]/u,HB=uB(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,BB).getRegex(),UB=/(?!~)[\p{P}\p{S}]/u,WB=/(?!~)[\s\p{P}\p{S}]/u,GB=/(?:[^\s\p{P}\p{S}]|~)/u,KB=uB(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,dB?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),qB=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,JB=uB(qB,`u`).replace(/punct/g,zB).getRegex(),YB=uB(qB,`u`).replace(/punct/g,UB).getRegex(),XB=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,ZB=uB(XB,`gu`).replace(/notPunctSpace/g,VB).replace(/punctSpace/g,BB).replace(/punct/g,zB).getRegex(),QB=uB(XB,`gu`).replace(/notPunctSpace/g,GB).replace(/punctSpace/g,WB).replace(/punct/g,UB).getRegex(),$B=uB(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,VB).replace(/punctSpace/g,BB).replace(/punct/g,zB).getRegex(),eV=uB(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,zB).getRegex(),tV=uB(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,VB).replace(/punctSpace/g,BB).replace(/punct/g,zB).getRegex(),nV=uB(/\\(punct)/,`gu`).replace(/punct/g,zB).getRegex(),rV=uB(/^<(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(),iV=uB(OB).replace(`(?:-->|$)`,`-->`).getRegex(),aV=uB(`^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`,iV).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),oV=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,sV=uB(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,oV).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),cV=uB(/^!?\[(label)\]\[(ref)\]/).replace(`label`,oV).replace(`ref`,wB).getRegex(),lV=uB(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,wB).getRegex(),uV=uB(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,cV).replace(`nolink`,lV).getRegex(),dV=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,fV={_backpedal:lB,anyPunctuation:nV,autolink:rV,blockSkip:KB,br:LB,code:IB,del:lB,delLDelim:lB,delRDelim:lB,emStrongLDelim:JB,emStrongRDelimAst:ZB,emStrongRDelimUnd:$B,escape:FB,link:sV,nolink:lV,punctuation:HB,reflink:cV,reflinkSearch:uV,tag:aV,text:RB,url:lB},pV={...fV,link:uB(/^!?\[(label)\]\((.*?)\)/).replace(`label`,oV).getRegex(),reflink:uB(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,oV).getRegex()},mV={...fV,emStrongRDelimAst:QB,emStrongLDelim:YB,delLDelim:eV,delRDelim:tV,url:uB(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,dV).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:uB(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,dV).getRegex()},hV={...mV,br:uB(LB).replace(`{2,}`,`*`).getRegex(),text:uB(mV.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},gV={normal:jB,gfm:NB,pedantic:PB},_V={normal:fV,gfm:mV,breaks:hV,pedantic:pV},vV={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},yV=e=>vV[e];function bV(e,t){if(t){if(fB.escapeTest.test(e))return e.replace(fB.escapeReplace,yV)}else if(fB.escapeTestNoEncode.test(e))return e.replace(fB.escapeReplaceNoEncode,yV);return e}function xV(e){try{e=encodeURI(e).replace(fB.percentDecode,`%`)}catch{return null}return e}function SV(e,t){let n=e.replace(fB.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(fB.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(fB.slashPipe,`|`);return n}function CV(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function wV(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function TV(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function EV(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function DV(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
167
|
+
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
|
|
168
|
+
`)}var OV=class{options;rules;lexer;constructor(e){this.options=e||sB}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:CV(e,`
|
|
169
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=DV(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=CV(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:CV(t[0],`
|
|
170
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=CV(t[0],`
|
|
171
|
+
`).split(`
|
|
172
|
+
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
173
|
+
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
174
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
175
|
+
${s}`:s,r=r?`${r}
|
|
176
|
+
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
|
|
177
|
+
`+e.join(`
|
|
178
|
+
`),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
|
|
179
|
+
`+e.join(`
|
|
180
|
+
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
181
|
+
`)}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[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 a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=TV(t[2].split(`
|
|
182
|
+
`,1)[0],t[1].length),l=e.split(`
|
|
183
|
+
`,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
|
|
184
|
+
`,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
|
|
185
|
+
`,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
|
|
186
|
+
`+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
|
|
187
|
+
`+l}u=!l.trim(),r+=p+`
|
|
188
|
+
`,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),e.task){if(e.text=e.text.replace(this.rules.other.listReplaceTask,``),e.tokens[0]?.type===`text`||e.tokens[0]?.type===`paragraph`){e.tokens[0].raw=e.tokens[0].raw.replace(this.rules.other.listReplaceTask,``),e.tokens[0].text=e.tokens[0].text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}}let t=this.rules.other.listTaskCheckbox.exec(e.raw);if(t){let n={type:`checkbox`,raw:t[0]+` `,checked:t[0]!==`[ ]`};e.checked=n.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=n.raw+e.tokens[0].raw,e.tokens[0].text=n.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(n)):e.tokens.unshift({type:`paragraph`,raw:n.raw,text:n.raw,tokens:[n]}):e.tokens.unshift(n)}}if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=SV(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
189
|
+
`):[],a={type:`table`,raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(SV(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:t[0],depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
190
|
+
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=CV(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=wV(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),EV(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return EV(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);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 n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},kV=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||sB,this.options.tokenizer=this.options.tokenizer||new OV,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 t={other:fB,block:gV.normal,inline:_V.normal};this.options.pedantic?(t.block=gV.pedantic,t.inline=_V.pedantic):this.options.gfm&&(t.block=gV.gfm,t.inline=this.options.breaks?_V.breaks:_V.gfm),this.tokenizer.rules=t}static get rules(){return{block:gV,inline:_V}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(fB.carriageReturn,`
|
|
191
|
+
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(fB.tabCharGlobal,` `).replace(fB.spaceLine,``));e;){let r;if(this.options.extensions?.block?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);r.raw.length===1&&n!==void 0?n.raw+=`
|
|
192
|
+
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
193
|
+
`)?``:`
|
|
194
|
+
`)+r.raw,n.text+=`
|
|
195
|
+
`+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if((r=this.tokenizer.fences(e))||(r=this.tokenizer.heading(e))||(r=this.tokenizer.hr(e))||(r=this.tokenizer.blockquote(e))||(r=this.tokenizer.list(e))||(r=this.tokenizer.html(e))){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
196
|
+
`)?``:`
|
|
197
|
+
`)+r.raw,n.text+=`
|
|
198
|
+
`+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if((r=this.tokenizer.table(e))||(r=this.tokenizer.lheading(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let a=t.at(-1);n&&a?.type===`paragraph`?(a.raw+=(a.raw.endsWith(`
|
|
199
|
+
`)?``:`
|
|
200
|
+
`)+r.raw,a.text+=`
|
|
201
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length)}else if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
202
|
+
`)?``:`
|
|
203
|
+
`)+r.raw,n.text+=`
|
|
204
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r)}else if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``;for(;e;){a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if((r=this.tokenizer.escape(e))||(r=this.tokenizer.tag(e))||(r=this.tokenizer.link(e))){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if((r=this.tokenizer.emStrong(e,n,o))||(r=this.tokenizer.codespan(e))||(r=this.tokenizer.br(e))||(r=this.tokenizer.del(e,n,o))||(r=this.tokenizer.autolink(e))||!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r)}else if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return t}},AV=class{options;parser;constructor(e){this.options=e||sB}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(fB.notSpaceStart)?.[0],i=e.replace(fB.endingNewline,``)+`
|
|
205
|
+
`;return r?`<pre><code class="language-`+bV(r)+`">`+(n?i:bV(i,!0))+`</code></pre>
|
|
206
|
+
`:`<pre><code>`+(n?i:bV(i,!0))+`</code></pre>
|
|
207
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
208
|
+
${this.parser.parse(e)}</blockquote>
|
|
209
|
+
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
210
|
+
`}hr(e){return`<hr>
|
|
211
|
+
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
212
|
+
`+r+`</`+i+`>
|
|
213
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
214
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
215
|
+
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
216
|
+
<thead>
|
|
217
|
+
`+t+`</thead>
|
|
218
|
+
`+r+`</table>
|
|
219
|
+
`}tablerow({text:e}){return`<tr>
|
|
220
|
+
${e}</tr>
|
|
221
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
222
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${bV(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=xV(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+bV(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=xV(e);if(i===null)return bV(n);e=i;let a=`<img src="${e}" alt="${bV(n)}"`;return t&&(a+=` title="${bV(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:bV(e.text)}},jV=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},MV=class e{options;renderer;textRenderer;constructor(e){this.options=e||sB,this.options.renderer=this.options.renderer||new AV,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new jV}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){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 e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},NV=class{options;block;constructor(e){this.options=e||sB}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?kV.lex:kV.lexInline}provideParser(e=this.block){return e?MV.parse:MV.parseInline}},PV=new class{defaults=oB();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=MV;Renderer=AV;TextRenderer=jV;Lexer=kV;Tokenizer=OV;Hooks=NV;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new AV(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new OV(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new NV;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=NV.passThroughHooks.has(n)?e=>{if(this.defaults.async&&NV.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return kV.lex(e,t??this.defaults)}parser(e,t){return MV.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(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 t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?kV.lex:kV.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?MV.parse:MV.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?kV.lex:kV.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?MV.parse:MV.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
223
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+bV(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function FV(e,t){return PV.parse(e,t)}FV.options=FV.setOptions=function(e){return PV.setOptions(e),FV.defaults=PV.defaults,cB(FV.defaults),FV},FV.getDefaults=oB,FV.defaults=sB,FV.use=function(...e){return PV.use(...e),FV.defaults=PV.defaults,cB(FV.defaults),FV},FV.walkTokens=function(e,t){return PV.walkTokens(e,t)},FV.parseInline=PV.parseInline,FV.Parser=MV,FV.parser=MV.parse,FV.Renderer=AV,FV.TextRenderer=jV,FV.Lexer=kV,FV.lexer=kV.lex,FV.Tokenizer=OV,FV.Hooks=NV,FV.parse=FV,FV.options,FV.setOptions,FV.use,FV.walkTokens,FV.parseInline,MV.parse,kV.lex;var IV=/\n[^\S\n]*(?:\n[^\S\n]*)+$/;function LV(e){return e.flatMap((t,n)=>{if(t.type===`space`||e[n+1]?.type===`space`)return[t];let r=(t.raw||``).match(IV);return r?[{...t,raw:(t.raw||``).slice(0,-r[0].length)},{type:`space`,raw:r[0]}]:[t]})}function RV(e,t){let n=t.split(`
|
|
224
|
+
`).flatMap(e=>[e,``]).map(t=>`${e}${t}`).join(`
|
|
225
|
+
`);return n.slice(0,n.length-1)}function zV(e,t){let n=[];return Array.from(e.entries()).forEach(([e,r])=>{t&&(t.marks||[]).find(t=>t.type===e&&LA(t.attrs,r.attrs))||n.push(e)}),n}function BV(e,t){let n=[];return Array.from(t.entries()).forEach(([t,r])=>{let i=e.get(t);i&&LA(i.attrs,r.attrs)||n.push({type:t,mark:r})}),n}function VV(e,t,n,r){let i=!n,a=n&&(!n.marks||n.marks.length===0),o=n&&n.marks&&!r(t,new Map(n.marks.map(e=>[e.type,e]))),s=[];return(i||a||o)&&(n&&n.marks?Array.from(e.entries()).reverse().forEach(([e,t])=>{n.marks.find(n=>n.type===e&&LA(n.attrs,t.attrs))||s.push(e)}):(i||a)&&s.push(...Array.from(e.keys()).reverse())),s}function HV(e,t){let n=``;return Array.from(e.keys()).reverse().forEach(r=>{let i=t(r,e.get(r));i&&(n=i+n)}),e.clear(),n}function UV(e,t,n){let r=``;return Array.from(e.entries()).forEach(([e,i])=>{let a=n(e,i);a&&(r+=a),t.set(e,i)}),r}function WV(e){let t=(e.raw||e.text||``).match(/^(\s*)[-+*]\s+\[([ xX])\]\s+/);return t?{isTask:!0,checked:t[2].toLowerCase()===`x`,indentLevel:t[1].length}:{isTask:!1,indentLevel:0}}function GV(e,t){return typeof e==`string`?t:`json`}function KV(e){let t=e.map(()=>new Map),n=new Map,r=e=>{let r=n.get(e);r&&(r.indexes.forEach(n=>t[n].set(e,r.text)),n.delete(e))};return e.forEach((e,t)=>{if(e.type!==`text`){Array.from(n.keys()).forEach(r);return}let i=new Set((e.marks||[]).map(e=>e.type));Array.from(n.keys()).filter(e=>!i.has(e)).forEach(r),i.forEach(r=>{let i=n.get(r)||{indexes:[],text:``};i.indexes.push(t),i.text+=e.text||``,n.set(r,i)})}),Array.from(n.keys()).forEach(r),t}var qV=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`.split(`.`)),JV=/<\/?([a-zA-Z][\w-]*)/g;function YV(e){let t=[],n;for(;(n=JV.exec(e))!==null;)t.push(n[1].toLowerCase());return t}function XV(e){let t=e.toLowerCase();return!t.includes(`-`)&&!qV.has(t)}function ZV(e,t){return YV(e).some(e=>XV(e)?!t.has(e):!1)}var QV=class{constructor(e){var t,n;this.activeParseLexer=null,this.extensionRanks=new Map,this.baseExtensions=[],this.extensions=[],this.codeTypes=new Set,this.schemaParseDomTagsCache=null,this.inlineNodeTypesCache=null,this.lastParseResult=null,this.markedInstance=e?.marked??FV,this.indentStyle=(e==null||(t=e.indentation)==null?void 0:t.style)??`space`,this.indentSize=(e==null||(n=e.indentation)==null?void 0:n.size)??2,this.baseExtensions=e?.extensions||[],e?.markedOptions&&typeof this.markedInstance.setOptions==`function`&&this.markedInstance.setOptions(e.markedOptions),this.registry=new Map,this.nodeTypeRegistry=new Map,e?.extensions&&(this.baseExtensions=e.extensions,QO(DO(e.extensions)).forEach(e=>this.registerExtension(e)))}get instance(){return this.markedInstance}get indentCharacter(){return this.indentStyle===`space`?` `:` `}get indentString(){return this.indentCharacter.repeat(this.indentSize)}hasMarked(){return!!this.markedInstance}registerExtension(e){this.extensions.push(e);let t=BO(Q(e,`code`)),n=e.name,r={name:n,options:e.options,storage:e.storage};t&&this.codeTypes.add(n),this.extensionRanks.has(n)||this.extensionRanks.set(n,this.extensionRanks.size);let i=Q(e,`markdownTokenName`,r)||n,a=Q(e,`parseMarkdown`,r),o=Q(e,`renderMarkdown`,r),s=Q(e,`markdownTokenizer`,r),c=Q(e,`markdownOptions`,r)??null,l={tokenName:i,nodeName:n,parseMarkdown:a,renderMarkdown:o,isIndenting:c?.indentsContent??!1,htmlReopen:c?.htmlReopen,tokenizer:s};if(i&&a){let e=this.registry.get(i)||[];e.push(l),this.registry.set(i,e)}if(o){let e=this.nodeTypeRegistry.get(n)||[];e.push(l),this.nodeTypeRegistry.set(n,e)}s&&this.hasMarked()&&this.registerTokenizer(s)}createLexer(){return new this.markedInstance.Lexer(this.markedInstance.defaults)}createTokenizerHelpers(e){return{inlineTokens:t=>e.inlineTokens(t),blockTokens:t=>e.blockTokens(t)}}tokenizeInline(e){return(this.activeParseLexer??this.createLexer()).inlineTokens(e)}registerTokenizer(e){if(!this.hasMarked())return;let{name:t,start:n,level:r=`inline`,tokenize:i}=e,a=this.createTokenizerHelpers.bind(this),o=this.createLexer.bind(this),s;s=n?typeof n==`function`?n:e=>e.indexOf(n):e=>{let t=i(e,[],this.createTokenizerHelpers(this.createLexer()));return t&&t.raw?e.indexOf(t.raw):-1};let c={name:t,level:r,start:s,tokenizer(e,n){let r=this.lexer?a(this.lexer):a(o()),s=i(e,n,r);if(s&&s.type)return{...s,type:s.type||t,raw:s.raw||``,tokens:s.tokens||[]}},childTokens:[]};this.markedInstance.use({extensions:[c]})}getHandlersForToken(e){try{return this.registry.get(e)||[]}catch{return[]}}getHandlerForToken(e){let t=this.getHandlersForToken(e);if(t.length>0)return t[0];let n=this.getHandlersForNodeType(e);return n.length>0?n[0]:void 0}getHandlersForNodeType(e){try{return this.nodeTypeRegistry.get(e)||[]}catch{return[]}}serialize(e){if(!e)return``;let t=this.renderNodes(e,e);return this.isEmptyOutput(t)?``:t}isEmptyOutput(e){return!e||e.trim()===``||e.replace(/ /g,``).replace(/\u00A0/g,``).trim()===``}parse(e){if(!this.hasMarked())throw Error(`No marked instance available for parsing`);let t=this.activeParseLexer,n=this.createLexer();this.activeParseLexer=n;try{let t=n.lex(e);return{type:`doc`,content:this.parseTokens(t,!0)}}finally{this.activeParseLexer=t}}parseTokens(e,t=!1){let n=t?LV(e):e,r=n.reduce((e,t,n)=>(t.type!==`space`&&e.push(n),e),[]),i=-1,a=0;return n.flatMap((e,n)=>{for(;a<r.length&&r[a]<n;)i=r[a],a+=1;if(t&&e.type===`space`){let t=r[a]??-1;return this.createImplicitEmptyParagraphsFromSpace(e,i,t)}let o=this.parseToken(e,t);return o===null?[]:Array.isArray(o)?o:[o]})}createImplicitEmptyParagraphsFromSpace(e,t,n){let r=this.countParagraphSeparators(e.raw||``);if(r===0)return[];let i=Math.max(r-(t===-1||n===-1?0:1),0);return Array.from({length:i},()=>({type:`paragraph`,content:[]}))}countParagraphSeparators(e){return(e.replace(/\r\n/g,`
|
|
226
|
+
`).match(/\n\n/g)||[]).length}parseToken(e,t=!1){if(!e.type)return null;if(e.type===`list`)return this.parseListToken(e);let n=this.getHandlersForToken(e.type),r=this.createParseHelpers();if(n.find(t=>{if(!t.parseMarkdown)return!1;let n=t.parseMarkdown(e,r),i=this.normalizeParseResult(n);return i&&(!Array.isArray(i)||i.length>0)?(this.lastParseResult=i,!0):!1})&&this.lastParseResult){let e=this.lastParseResult;return this.lastParseResult=null,e}return this.parseFallbackToken(e,t)}parseListToken(e){if(!e.items||e.items.length===0)return this.parseTokenWithHandlers(e);let t=e.items.some(e=>WV(e).isTask),n=e.items.some(e=>!WV(e).isTask);if(!t||!n||this.getHandlersForToken(`taskList`).length===0)return this.parseTokenWithHandlers(e);let r=[],i=[],a=null;for(let t=0;t<e.items.length;t+=1){let n=e.items[t],{isTask:o,checked:s,indentLevel:c}=WV(n),l=n;if(o){let e=(n.raw||n.text||``).split(`
|
|
227
|
+
`),t=e[0].match(/^\s*[-+*]\s+\[([ xX])\]\s+(.*)$/),r=t?t[2]:``,i=[];if(e.length>1&&e.slice(1).join(`
|
|
228
|
+
`).trim()){let t=e.slice(1),n=t.filter(e=>e.trim());if(n.length>0){let e=Math.min(...n.map(e=>e.length-e.trimStart().length)),r=t.map(t=>t.trim()?t.slice(e):``).join(`
|
|
229
|
+
`).trim();r&&(i=this.markedInstance.lexer(`${r}\n`))}}l={type:`taskItem`,raw:``,mainContent:r,indentLevel:c,checked:s??!1,text:r,tokens:this.tokenizeInline(r),nestedTokens:i}}let u=o?`taskList`:`list`;a===u?i.push(l):(i.length>0&&r.push({type:a,items:i}),i=[l],a=u)}i.length>0&&r.push({type:a,items:i});let o=[];for(let t=0;t<r.length;t+=1){let n=r[t],i={...e,type:n.type,items:n.items},a=this.parseToken(i);a&&(Array.isArray(a)?o.push(...a):o.push(a))}return o.length>0?o:null}parseTokenWithHandlers(e){if(!e.type)return null;let t=this.getHandlersForToken(e.type),n=this.createParseHelpers();if(t.find(t=>{if(!t.parseMarkdown)return!1;let r=t.parseMarkdown(e,n),i=this.normalizeParseResult(r);return i&&(!Array.isArray(i)||i.length>0)?(this.lastParseResult=i,!0):!1})&&this.lastParseResult){let e=this.lastParseResult;return this.lastParseResult=null,e}return this.parseFallbackToken(e)}createParseHelpers(){return{parseInline:e=>this.parseInlineTokens(e),tokenizeInline:e=>this.tokenizeInline(e),parseChildren:e=>this.parseTokens(e),parseBlockChildren:e=>this.parseTokens(e,!0),createTextNode:(e,t)=>({type:`text`,text:e,marks:t||void 0}),createNode:(e,t,n)=>{let r={type:e,attrs:t||void 0,content:n||void 0};return t&&Object.keys(t).length!==0||delete r.attrs,r},applyMark:(e,t,n)=>({mark:e,content:t,attrs:n&&Object.keys(n).length>0?n:void 0})}}escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}parseInlineTokens(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e[n];if(r.type===`text`)t.push({type:`text`,text:HA(r.text||``)});else if(r.type===`escape`)t.push({type:`text`,text:r.text||``});else if(r.type===`html`){let i=(r.raw??r.text??``).toString(),a=/^<\/[\s]*[\w-]+/i.test(i),o=i.match(/^<[\s]*([\w-]+)(\s|>|\/|$)/i);if(!a&&o&&!/\/>$/.test(i)){let r=o[1],a=this.escapeRegex(r),s=RegExp(`^<\\/\\s*${a}\\b`,`i`),c=-1,l=[i];for(let t=n+1;t<e.length;t+=1){let n=e[t],r=(n.raw??n.text??``).toString();if(l.push(r),n.type===`html`&&s.test(r)){c=t;break}}if(c!==-1){let e=l.join(``),r={type:`html`,raw:e,text:e,block:!1},i=this.parseHTMLToken(r);if(i){let e=this.normalizeParseResult(i);Array.isArray(e)?t.push(...e):e&&t.push(e)}n=c;continue}}let s=this.parseHTMLToken(r);if(s){let e=this.normalizeParseResult(s);Array.isArray(e)?t.push(...e):e&&t.push(e)}}else if(r.type){let e=this.getHandlerForToken(r.type);if(e&&e.parseMarkdown){let n=this.createParseHelpers(),i=e.parseMarkdown(r,n);if(this.isMarkResult(i)){let e=this.applyMarkToContent(i.mark,i.content,i.attrs);t.push(...e)}else{let e=this.normalizeParseResult(i);Array.isArray(e)?t.push(...e):e&&t.push(e)}}else r.tokens&&t.push(...this.parseInlineTokens(r.tokens))}}for(let e=t.length-1;e>0;--e){let n=t[e],r=t[e-1];n.type===`text`&&r.type===`text`&&tj(n.marks||[],r.marks||[])&&(r.text=(r.text||``)+(n.text||``),t.splice(e,1))}return t}applyMarkToContent(e,t,n){return t.map(t=>{if(t.type===`text`){let r=t.marks||[],i=n?{type:e,attrs:n}:{type:e};return{...t,marks:[...r,i]}}return{...t,content:t.content?this.applyMarkToContent(e,t.content,n):void 0}})}isMarkResult(e){return e&&typeof e==`object`&&`mark`in e}normalizeParseResult(e){return e?this.isMarkResult(e)?e.content:e:null}parseFallbackToken(e,t=!1){switch(e.type){case`paragraph`:return{type:`paragraph`,content:e.tokens?this.parseInlineTokens(e.tokens):[]};case`heading`:return{type:`heading`,attrs:{level:e.depth||1},content:e.tokens?this.parseInlineTokens(e.tokens):[]};case`text`:return{type:`text`,text:HA(e.text||``)};case`html`:return this.parseHTMLToken(e);case`escape`:return{type:`text`,text:e.text||``};case`space`:return null;default:return e.tokens?this.parseTokens(e.tokens,t):null}}parseHTMLToken(e){let t=e.text||e.raw||``;if(!t.trim())return null;if(this.isUnrecognizedHtml(t)||typeof window>`u`||window.DOMParser===void 0)return this.htmlAsLiteralText(t,!!e.block);try{let n=tk(t,this.baseExtensions);if(n.type===`doc`&&n.content){if(e.block)return n.content;let t=this.toInlineContent(n.content);return t.length>0?t:null}return n}catch(e){throw Error(`Failed to parse HTML in markdown: ${e}`)}}toInlineContent(e){let t=this.getInlineNodeTypes();return e.flatMap(e=>e.type&&t.has(e.type)?[e]:e.content?this.toInlineContent(e.content):[])}getInlineNodeTypes(){if(this.inlineNodeTypesCache)return this.inlineNodeTypesCache;let e=new Set([`text`]);try{let t=ek(this.baseExtensions);Object.values(t.nodes).forEach(t=>{t.isInline&&e.add(t.name)})}catch{}return this.inlineNodeTypesCache=e,e}isUnrecognizedHtml(e){return ZV(e,this.getSchemaParseDomTags())}getSchemaParseDomTags(){if(this.schemaParseDomTagsCache)return this.schemaParseDomTagsCache;let e=new Set;try{let t=ek(this.baseExtensions),n=t=>{let n=t?.parseDOM;Array.isArray(n)&&n.forEach(t=>{if(typeof t?.tag==`string`){let n=t.tag.match(/^[a-zA-Z][\w-]*/);n&&e.add(n[0].toLowerCase())}})};Object.values(t.nodes).forEach(e=>n(e.spec)),Object.values(t.marks).forEach(e=>n(e.spec))}catch{}return this.schemaParseDomTagsCache=e,e}htmlAsLiteralText(e,t){let n=e.replace(/\s+$/,``);return n?t?{type:`paragraph`,content:[{type:`text`,text:n}]}:{type:`text`,text:n}:null}encodeTextForMarkdown(e,t,n){return n?.type!=null&&this.codeTypes.has(n.type)||(t.marks||[]).some(e=>this.codeTypes.has(typeof e==`string`?e:e.type))?e:this.escapeMarkdownSyntax(GA(e))}escapeMarkdownSyntax(e){return e.replace(/([\\`*_[\]~])/g,`\\$1`)}renderNodeToMarkdown(e,t,n=0,r=0,i={}){if(e.type===`text`)return this.encodeTextForMarkdown(e.text||``,e,t);if(!e.type)return``;let a=this.getHandlerForToken(e.type);if(!a)return``;let o=Array.isArray(t?.content)&&n>0?t.content[n-1]:void 0,s={renderChildren:(t,i)=>{let o=a.isIndenting?r+1:r;return!Array.isArray(t)&&t.content?this.renderNodes(t.content,e,i||``,n,o):this.renderNodes(t,e,i||``,n,o)},renderChild:(t,n)=>{let i=a.isIndenting?r+1:r;return this.renderNodeToMarkdown(t,e,n,i)},indent:e=>this.indentString+e,wrapInBlock:RV},c={index:n,level:r,parentType:t?.type,previousNode:o,meta:{parentAttrs:t?.attrs,...i}};return a.renderMarkdown?.call(a,e,s,c)||``}renderNodes(e,t,n=``,r=0,i=0){return Array.isArray(e)?this.renderNodesWithMarkBoundaries(e,t,n,i):e.type?this.renderNodeToMarkdown(e,t,r,i):``}renderNodesWithMarkBoundaries(e,t,n=``,r=0){let i=[],a=new Map,o=new Set,s=new Map,c=KV(e);if(e.forEach((n,l)=>{let u=l<e.length-1?e[l+1]:null;if(n.type){if(n.type===`text`){let e=this.encodeTextForMarkdown(n.text||``,n,t),r=new Map((n.marks||[]).map(e=>[e.type,e])),d=this.getMarksToOpenForSerialization(a,r,u),f=zV(r,u);if(e.length>0&&e.trim().length===0&&r.size>0){let e=new Set(f.filter(e=>!a.has(e)));e.size>0&&(r=new Map(Array.from(r).filter(([t])=>!e.has(t))),d=this.getMarksToOpenForSerialization(a,r,u),f=zV(r,u))}let p=f.filter(e=>a.has(e)),m=p.length>0&&d.length>0,h=``;if(f.length>0&&!m){let t=e.match(/(\s+)$/);t&&(h=t[1],e=e.slice(0,-h.length))}m||f.slice().reverse().forEach(t=>{if(!a.has(t))return;let n=r.get(t),i=this.getMarkClosing(t,n,s.get(t),c[l]?.get(t));i&&(e+=i),a.has(t)&&(a.delete(t),s.delete(t))});let g=``;if(d.length>0){let t=e.match(/^(\s+)/);t&&(g=t[1],e=e.slice(g.length))}d.forEach(({type:t,mark:n})=>{let r=o.has(t)?`html`:`markdown`,i=this.getMarkOpening(t,n,r,c[l]?.get(t));i&&(e=i+e),s.set(t,r),o.delete(t)}),m||d.slice().reverse().forEach(({type:e,mark:t})=>{a.set(e,t)}),e=g+e;let _;if(m){let e=new Set((u?.marks||[]).map(e=>e.type));d.forEach(({type:t})=>{e.has(t)&&this.getHtmlReopenTags(t)&&o.add(t)});let t=Array.from(a.keys()),n=p.slice().sort((e,n)=>t.indexOf(n)-t.indexOf(e));_=[...d.map(e=>e.type),...n]}else _=VV(a,r,u,this.markSetsEqual.bind(this));let v=``;if(_.length>0){let t=e.match(/(\s+)$/);t&&(v=t[1],e=e.slice(0,-v.length))}_.forEach(t=>{let n=a.get(t)??r.get(t),i=this.getMarkClosing(t,n,s.get(t),c[l]?.get(t));i&&(e+=i),a.delete(t),s.delete(t)}),e+=v,e+=h,i.push(e)}else{let e=new Set((n.marks||[]).map(e=>e.type)),o=new Map,u=new Map;a.forEach((t,n)=>{e.has(n)&&(o.set(n,t),u.set(n,s.get(n)??`markdown`))});let d=HV(a,(e,t)=>this.getMarkClosing(e,t,s.get(e),c[l-1]?.get(e)));s.clear();let f=this.renderNodeToMarkdown(n,t,l,r),p=n.type===`hardBreak`?``:UV(o,a,(e,t)=>{let n=u.get(e)??`markdown`;return s.set(e,n),this.getMarkOpening(e,t,n,c[l+1]?.get(e))});i.push(d+f+p)}}}),n===``){let e=-1;i.forEach((t,n)=>{if(t){if(e>=0&&t.startsWith(`[`)){let t=/(\\*)!$/.exec(i[e]);t&&t[1].length%2==0&&(i[e]=`${i[e].slice(0,-1)}\\!`)}e=n}})}return i.join(n)}getMarkOpening(e,t,n=`markdown`,r){if(n===`html`)return this.getHtmlReopenTags(e)?.open||``;let i=this.getHandlersForNodeType(e),a=i.length>0?i[0]:void 0;if(!a||!a.renderMarkdown)return``;let o=`__TIPTAP_MARKDOWN_PLACEHOLDER__`,s={type:e,attrs:t.attrs||{},content:[{type:`text`,text:o}]};try{let e=a.renderMarkdown(s,{renderChildren:()=>o,renderChild:()=>o,indent:e=>e,wrapInBlock:(e,t)=>e+t},{index:0,level:0,parentType:`text`,meta:{markText:r}}),t=e.indexOf(o);return t>=0?e.substring(0,t):``}catch(t){throw Error(`Failed to get mark opening for ${e}: ${t}`)}}getMarkClosing(e,t,n=`markdown`,r){if(n===`html`)return this.getHtmlReopenTags(e)?.close||``;let i=this.getHandlersForNodeType(e),a=i.length>0?i[0]:void 0;if(!a||!a.renderMarkdown)return``;let o=`__TIPTAP_MARKDOWN_PLACEHOLDER__`,s={type:e,attrs:t.attrs||{},content:[{type:`text`,text:o}]};try{let e=a.renderMarkdown(s,{renderChildren:()=>o,renderChild:()=>o,indent:e=>e,wrapInBlock:(e,t)=>e+t},{index:0,level:0,parentType:`text`,meta:{markText:r}}),t=e.indexOf(o),n=t+33;return t>=0?e.substring(n):``}catch(t){throw Error(`Failed to get mark closing for ${e}: ${t}`)}}getHtmlReopenTags(e){let t=this.getHandlersForNodeType(e);return(t.length>0?t[0]:void 0)?.htmlReopen}markSetsEqual(e,t){return e.size===t.size&&Array.from(e.entries()).every(([e,n])=>{let r=t.get(e);return r&&LA(n.attrs,r.attrs)})}getMarksToOpenForSerialization(e,t,n){let r=BV(e,t);if(r.length<=1)return r;let i=n?.marks||[],a=(e,t)=>i.some(n=>n.type===e&&LA(n.attrs,t)),o=(e,t)=>{let n=this.extensionRanks.get(e.type)??2**53-1,r=this.extensionRanks.get(t.type)??2**53-1;return n===r?e.type.localeCompare(t.type):r-n},s=r.filter(e=>!a(e.type,e.mark.attrs)).sort(o),c=r.filter(e=>a(e.type,e.mark.attrs)).sort(o);return[...s,...c]}},$V=bj.create({name:`markdown`,addOptions(){return{indentation:{style:`space`,size:2},marked:void 0,markedOptions:{}}},addCommands(){return{setContent:(e,t)=>{if(!t?.contentType||GV(e,t?.contentType)!==`markdown`||!this.editor.markdown)return fA.setContent(e,t);let n=this.editor.markdown.parse(e);return fA.setContent(n,t)},insertContent:(e,t)=>{if(!t?.contentType||GV(e,t?.contentType)!==`markdown`||!this.editor.markdown)return fA.insertContent(e,t);let n=this.editor.markdown.parse(e);return fA.insertContent(n,t)},insertContentAt:(e,t,n)=>{if(!n?.contentType||GV(t,n?.contentType)!==`markdown`||!this.editor.markdown)return fA.insertContentAt(e,t,n);let r=this.editor.markdown.parse(t);return fA.insertContentAt(e,r,n)}}},addStorage(){return{manager:new QV({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:[]})}},onBeforeCreate(){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 QV({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||GV(this.editor.options.content,this.editor.options.contentType)!==`markdown`)return;if(!this.editor.markdown)throw 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 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.');let e=this.editor.markdown.parse(this.editor.options.content);e.content?.length&&(this.editor.options.content=e)}}),eH=new WeakSet,tH=new WeakSet;function nH(e){let t=e;return eH.add(t),t}function rH(e){return Array.isArray(e)&&eH.has(e)}function iH(e){return e.flatMap(e=>e==null?[]:Array.isArray(e)&&tH.has(e)&&!rH(e)?iH(e):[e])}function aH(e,t){if(e===`slot`)return 0;if(e instanceof Function){let n=e(t);return Array.isArray(n)&&!rH(n)&&!tH.has(n)?nH(n):n}let{children:n,...r}=t??{};if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);if(Array.isArray(n)){if(rH(n))return nH([e,r,n]);if(n.length===0)return nH([e,r]);let t=iH(n);return t.length===0?nH([e,r]):nH([e,r,...t])}return nH(n==null?[e,r]:[e,r,n])}var oH=(e,t)=>aH(e,t),sH=(e,t)=>{let{state:n}=e,{selection:r}=n;if(!r.empty)return!1;let{$from:i}=r;if(i.parentOffset!==0)return!1;let a=i.depth-1;if(a<0)return!1;let o=i.node(a),s=i.index(a);if(s===0)return!1;if(o.type===t)return e.commands.lift(t.name);let c=o.child(s-1);if(c.type!==t||!c.lastChild?.isTextblock)return!1;let l=i.before()-1-1;return e.commands.command(({tr:e,dispatch:t})=>{if(!t)return!0;let n=i.parent.content,r=new q(n,0,0);return e.replace(l,i.after(),r),e.setSelection(Y.create(e.doc,l+n.size)),e.scrollIntoView(),t(e),!0})},cH=/^\s*>\s$/,lH=Uj.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return oH(`blockquote`,{...WO(this.options.HTMLAttributes,e),children:oH(`slot`,{})})},parseMarkdown:(e,t)=>{let n=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach((e,r)=>{let i=(t.renderChild?.call(t,e,r)??t.renderChildren([e])).split(`
|
|
230
|
+
`).map(e=>e.trim()===``?`>`:`> ${e}`);n.push(i.join(`
|
|
231
|
+
`))}),n.join(`
|
|
232
|
+
>
|
|
233
|
+
`)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>sH(this.editor,this.type)}},addInputRules(){return[Bj({find:cH,type:this.type})]}}),uH=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,dH=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,fH=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,pH=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,mH=fj.create({name:`bold`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!==`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name===this.name},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return oH(`strong`,{...WO(this.options.HTMLAttributes,e),children:oH(`slot`,{})})},markdownTokenName:`strong`,parseMarkdown:(e,t)=>t.applyMark(`bold`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<strong>`,close:`</strong>`}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Lj({find:uH,type:this.type}),Lj({find:fH,type:this.type})]},addPasteRules(){return[Gj({find:dH,type:this.type}),Gj({find:pH,type:this.type})]}}),hH=4,gH=/^```([a-z]+)?[\s\n]$/,_H=/^~~~([a-z]+)?[\s\n]$/,vH=Uj.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:hH,HTMLAttributes:{}}},content:`text*`,marks:``,group:`block`,code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{let{languageClassPrefix:t}=this.options;return t&&[...e.firstElementChild?.classList||[]].filter(e=>e.startsWith(t)).map(e=>e.replace(t,``))[0]||null},rendered:!1}}},parseHTML(){return[{tag:`pre`,preserveWhitespace:`full`}]},renderHTML({node:e,HTMLAttributes:t}){return[`pre`,WO(this.options.HTMLAttributes,t),[`code`,{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:`code`,parseMarkdown:(e,t)=>e.raw?.startsWith("```")===!1&&e.raw?.startsWith(`~~~`)===!1&&e.codeBlockStyle!==`indented`?[]:t.createNode(`codeBlock`,{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[]),renderMarkdown:(e,t)=>{let n=``,r=e.attrs?.language||``;return n=e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join(`
|
|
234
|
+
`):`\`\`\`${r}\n\n\`\`\``,n},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,`paragraph`,e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??hH,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;if(i.parent.type!==this.type)return!1;let o=` `.repeat(t);return a?e.commands.insertContent(o):e.commands.command(({tr:e})=>{let{from:t,to:i}=r,a=n.doc.textBetween(t,i,`
|
|
235
|
+
`,`
|
|
236
|
+
`).split(`
|
|
237
|
+
`).map(e=>o+e).join(`
|
|
238
|
+
`);return e.replaceWith(t,i,n.schema.text(a)),!0})},"Shift-Tab":({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??hH,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;return i.parent.type===this.type?a?e.commands.command(({tr:e})=>{let{pos:r}=i,a=i.start(),o=i.end(),s=n.doc.textBetween(a,o,`
|
|
239
|
+
`,`
|
|
240
|
+
`).split(`
|
|
241
|
+
`),c=0,l=0,u=r-a;for(let e=0;e<s.length;e+=1){if(l+s[e].length>=u){c=e;break}l+=s[e].length+1}let d=s[c].match(/^ */)?.[0]||``,f=Math.min(d.length,t);if(f===0)return!0;let p=a;for(let e=0;e<c;e+=1)p+=s[e].length+1;return e.delete(p,p+f),r-p<=f&&e.setSelection(Y.create(e.doc,p)),!0}):e.commands.command(({tr:e})=>{let{from:i,to:a}=r,o=n.doc.textBetween(i,a,`
|
|
242
|
+
`,`
|
|
243
|
+
`).split(`
|
|
244
|
+
`).map(e=>{let n=e.match(/^ */)?.[0]||``,r=Math.min(n.length,t);return e.slice(r)}).join(`
|
|
245
|
+
`);return e.replaceWith(i,a,n.schema.text(o)),!0}):!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let a=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
|
|
246
|
+
|
|
247
|
+
`);return!a||!o?!1:e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowUp:({editor:e})=>{if(!this.options.exitOnArrowUp)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type||r.parentOffset!==0)return!1;let a=r.before();return a>0?!1:e.commands.insertDefaultBlock({pos:a})},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:a}=n;if(!a||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return o===void 0?!1:r.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(J.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[zj({find:gH,type:this.type,getAttributes:e=>({language:e[1]})}),zj({find:_H,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new Zb({key:new ex(`codeBlockVSCodeHandler`),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData(`text/plain`),r=t.clipboardData.getData(`vscode-editor-data`),i=(r?JSON.parse(r):void 0)?.mode;if(!n||!i)return!1;let{tr:a,schema:o}=e.state,s=o.text(n.replace(/\r\n?/g,`
|
|
248
|
+
`));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type&&a.setSelection(Y.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}}),yH=Uj.create({name:`doc`,topNode:!0,content:`block+`,renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
249
|
+
|
|
250
|
+
`):``}),bH=Uj.create({name:`hardBreak`,markdownTokenName:`br`,addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:`inline`,selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:`br`}]},renderHTML({HTMLAttributes:e}){return[`br`,WO(this.options.HTMLAttributes,e)]},renderText(){return`
|
|
251
|
+
`},renderMarkdown:()=>`
|
|
252
|
+
`,parseMarkdown:()=>({type:`hardBreak`}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:a}=this.options,{splittableMarks:o}=r.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&s&&a){let t=s.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),xH=Uj.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(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,WO(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode(`heading`,{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{let n=e.attrs?.level?parseInt(e.attrs.level,10):1,r=`#`.repeat(n);return e.content?`${r} ${t.renderChildren(e.content)}`:``},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,`paragraph`,e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>zj({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),SH=Uj.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,WO(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!RA(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return Ck(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(Y.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(X.create(t.doc,n.pos)):t.setSelection(Y.create(t.doc,n.pos));else{let i=(e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType)?.create();i&&(t.insert(r,i),t.setSelection(Y.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Rj({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),CH=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,wH=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,TH=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,EH=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,DH=fj.create({name:`italic`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`em`},{tag:`i`,getAttrs:e=>e.style.fontStyle!==`normal`&&null},{style:`font-style=normal`,clearMark:e=>e.type.name===this.name},{style:`font-style=italic`}]},renderHTML({HTMLAttributes:e}){return[`em`,WO(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:`em`,parseMarkdown:(e,t)=>t.applyMark(`italic`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<em>`,close:`</em>`}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Lj({find:CH,type:this.type}),Lj({find:TH,type:this.type})]},addPasteRules(){return[Gj({find:wH,type:this.type}),Gj({find:EH,type:this.type})]}}),OH=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos6kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12b0cam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,kH=`ελ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`,AH=`numeric`,jH=`ascii`,MH=`alpha`,NH=`asciinumeric`,PH=`alphanumeric`,FH=`domain`,IH=`emoji`,LH=`scheme`,RH=`slashscheme`,zH=`whitespace`;function BH(e,t){return e in t||(t[e]=[]),t[e]}function VH(e,t,n){t[AH]&&(t[NH]=!0,t[PH]=!0),t[jH]&&(t[NH]=!0,t[MH]=!0),t[NH]&&(t[PH]=!0),t[MH]&&(t[PH]=!0),t[PH]&&(t[FH]=!0),t[IH]&&(t[FH]=!0);for(let r in t){let t=BH(r,n);t.indexOf(e)<0&&t.push(e)}}function HH(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function UH(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}UH.groups={},UH.prototype={accepts(){return!!this.t},go(e){let t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){let r=t.jr[n][0],i=t.jr[n][1];if(i&&r.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){r||=UH.groups;let i;return t&&t.j?i=t:(i=new UH(t),n&&r&&VH(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,a=e.length;if(!a)return i;for(let t=0;t<a-1;t++)i=i.tt(e[t]);return i.tt(e[a-1],t,n,r)},tt(e,t,n,r){r||=UH.groups;let i=this;if(t&&t.j)return i.j[e]=t,t;let a=t,o,s=i.go(e);return s?(o=new UH,Object.assign(o.j,s.j),o.jr.push.apply(o.jr,s.jr),o.jd=s.jd,o.t=s.t):o=new UH,a&&(r&&(o.t&&typeof o.t==`string`?VH(a,Object.assign(HH(o.t,r),n),r):n&&VH(a,n,r)),o.t=a),i.j[e]=o,o}};var WH=(e,t,n,r,i)=>e.ta(t,n,r,i),GH=(e,t,n,r,i)=>e.tr(t,n,r,i),KH=(e,t,n,r,i)=>e.ts(t,n,r,i),$=(e,t,n,r,i)=>e.tt(t,n,r,i),qH=`WORD`,JH=`UWORD`,YH=`ASCIINUMERICAL`,XH=`ALPHANUMERICAL`,ZH=`LOCALHOST`,QH=`TLD`,$H=`UTLD`,eU=`SCHEME`,tU=`SLASH_SCHEME`,nU=`NUM`,rU=`WS`,iU=`NL`,aU=`OPENBRACE`,oU=`CLOSEBRACE`,sU=`OPENBRACKET`,cU=`CLOSEBRACKET`,lU=`OPENPAREN`,uU=`CLOSEPAREN`,dU=`OPENANGLEBRACKET`,fU=`CLOSEANGLEBRACKET`,pU=`FULLWIDTHLEFTPAREN`,mU=`FULLWIDTHRIGHTPAREN`,hU=`LEFTCORNERBRACKET`,gU=`RIGHTCORNERBRACKET`,_U=`LEFTWHITECORNERBRACKET`,vU=`RIGHTWHITECORNERBRACKET`,yU=`FULLWIDTHLESSTHAN`,bU=`FULLWIDTHGREATERTHAN`,xU=`AMPERSAND`,SU=`APOSTROPHE`,CU=`ASTERISK`,wU=`AT`,TU=`BACKSLASH`,EU=`BACKTICK`,DU=`CARET`,OU=`COLON`,kU=`COMMA`,AU=`DOLLAR`,jU=`DOT`,MU=`EQUALS`,NU=`EXCLAMATION`,PU=`HYPHEN`,FU=`PERCENT`,IU=`PIPE`,LU=`PLUS`,RU=`POUND`,zU=`QUERY`,BU=`QUOTE`,VU=`FULLWIDTHMIDDLEDOT`,HU=`SEMI`,UU=`SLASH`,WU=`TILDE`,GU=`UNDERSCORE`,KU=`EMOJI`,qU=`SYM`,JU=Object.freeze({__proto__:null,ALPHANUMERICAL:XH,AMPERSAND:xU,APOSTROPHE:SU,ASCIINUMERICAL:YH,ASTERISK:CU,AT:wU,BACKSLASH:TU,BACKTICK:EU,CARET:DU,CLOSEANGLEBRACKET:fU,CLOSEBRACE:oU,CLOSEBRACKET:cU,CLOSEPAREN:uU,COLON:OU,COMMA:kU,DOLLAR:AU,DOT:jU,EMOJI:KU,EQUALS:MU,EXCLAMATION:NU,FULLWIDTHGREATERTHAN:bU,FULLWIDTHLEFTPAREN:pU,FULLWIDTHLESSTHAN:yU,FULLWIDTHMIDDLEDOT:VU,FULLWIDTHRIGHTPAREN:mU,HYPHEN:PU,LEFTCORNERBRACKET:hU,LEFTWHITECORNERBRACKET:_U,LOCALHOST:ZH,NL:iU,NUM:nU,OPENANGLEBRACKET:dU,OPENBRACE:aU,OPENBRACKET:sU,OPENPAREN:lU,PERCENT:FU,PIPE:IU,PLUS:LU,POUND:RU,QUERY:zU,QUOTE:BU,RIGHTCORNERBRACKET:gU,RIGHTWHITECORNERBRACKET:vU,SCHEME:eU,SEMI:HU,SLASH:UU,SLASH_SCHEME:tU,SYM:qU,TILDE:WU,TLD:QH,UNDERSCORE:GU,UTLD:$H,UWORD:JH,WORD:qH,WS:rU}),YU=/[a-z]/,XU=/[a-z]/i,ZU=/[\u{1F000}-\u{1FAFF}\u{2600}-\u{27BF}]|\u{FE0F}/u;try{XU=RegExp(`\\p{L}`,`u`),ZU=RegExp(`\\p{Emoji}`,`u`)}catch{}var QU=/\d/,$U=/\s/,eW=`\r`,tW=`
|
|
253
|
+
`,nW=`️`,rW=``,iW=``,aW=null,oW=null;function sW(e=[]){let t={};UH.groups=t;let n=new UH;aW??=dW(OH),oW??=dW(kH),$(n,`'`,SU),$(n,`{`,aU),$(n,`}`,oU),$(n,`[`,sU),$(n,`]`,cU),$(n,`(`,lU),$(n,`)`,uU),$(n,`<`,dU),$(n,`>`,fU),$(n,`(`,pU),$(n,`)`,mU),$(n,`「`,hU),$(n,`」`,gU),$(n,`『`,_U),$(n,`』`,vU),$(n,`<`,yU),$(n,`>`,bU),$(n,`&`,xU),$(n,`*`,CU),$(n,`@`,wU),$(n,"`",EU),$(n,`^`,DU),$(n,`:`,OU),$(n,`,`,kU),$(n,`$`,AU),$(n,`.`,jU),$(n,`=`,MU),$(n,`!`,NU),$(n,`-`,PU),$(n,`%`,FU),$(n,`|`,IU),$(n,`+`,LU),$(n,`#`,RU),$(n,`?`,zU),$(n,`"`,BU),$(n,`/`,UU),$(n,`;`,HU),$(n,`~`,WU),$(n,`_`,GU),$(n,`\\`,TU),$(n,`・`,VU);let r=GH(n,QU,nU,{[AH]:!0});GH(r,QU,r);let i=GH(r,YU,YH,{[NH]:!0}),a=GH(r,XU,XH,{[PH]:!0}),o=GH(n,YU,qH,{[jH]:!0});GH(o,QU,i),GH(o,YU,o),GH(i,QU,i),GH(i,YU,i);let s=GH(n,XU,JH,{[MH]:!0});GH(s,YU),GH(s,QU,a),GH(s,XU,s),GH(a,QU,a),GH(a,YU),GH(a,XU,a);let c=$(n,tW,iU,{[zH]:!0}),l=$(n,eW,rU,{[zH]:!0}),u=GH(n,$U,rU,{[zH]:!0});$(n,iW,u),$(l,tW,c),$(l,iW,u),GH(l,$U,u),$(u,eW),$(u,tW),GH(u,$U,u),$(u,iW,u);let d=GH(n,ZU,KU,{[IH]:!0});$(d,`#`),GH(d,ZU,d),$(d,nW,d);let f=$(d,rW);$(f,`#`),GH(f,ZU,d);let p=[[YU,o],[QU,i]],m=[[YU,null],[XU,s],[QU,a]];for(let e=0;e<aW.length;e++)uW(n,aW[e],QH,qH,p);for(let e=0;e<oW.length;e++)uW(n,oW[e],$H,JH,m);VH(QH,{tld:!0,ascii:!0},t),VH($H,{utld:!0,alpha:!0},t),uW(n,`file`,eU,qH,p),uW(n,`mailto`,eU,qH,p),uW(n,`http`,tU,qH,p),uW(n,`https`,tU,qH,p),uW(n,`ftp`,tU,qH,p),uW(n,`ftps`,tU,qH,p),VH(eU,{scheme:!0,ascii:!0},t),VH(tU,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{[LH]:!0}:{[RH]:!0};r.indexOf(`-`)>=0?i[FH]=!0:YU.test(r)?QU.test(r)?i[NH]=!0:i[jH]=!0:i[AH]=!0,KH(n,r,r,i)}return KH(n,`localhost`,ZH,{ascii:!0}),n.jd=new UH(qU),{start:n,tokens:Object.assign({groups:t},JU)}}function cW(e,t){let n=lW(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],a=0,o=0;for(;o<r;){let s=e,c=null,l=0,u=null,d=-1,f=-1;for(;o<r&&(c=s.go(n[o]));)s=c,s.accepts()?(d=0,f=0,u=s):d>=0&&(d+=n[o].length,f++),l+=n[o].length,a+=n[o].length,o++;a-=d,o-=f,l-=d,i.push({t:u.t,v:t.slice(a-l,a),s:a-l,e:a})}return i}function lW(e){let t=[],n=e.length,r=0;for(;r<n;){let i=e.charCodeAt(r),a,o=i<55296||i>56319||r+1===n||(a=e.charCodeAt(r+1))<56320||a>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function uW(e,t,n,r,i){let a,o=t.length;for(let n=0;n<o-1;n++){let o=t[n];e.j[o]?a=e.j[o]:(a=new UH(r),a.jr=i.slice(),e.j[o]=a),e=a}return a=new UH(n),a.jr=i.slice(),e.j[t[o-1]]=a,a}function dW(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;`0123456789`.indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(``));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}var fW={defaultProtocol:`http`,events:null,format:mW,formatHref:mW,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],ignoreClasses:[],render:null};function pW(e,t=null){let n=Object.assign({},fW);e&&(n=Object.assign(n,e instanceof pW?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i,this.ignoreClasses=n.ignoreClasses.slice()}pW.prototype={o:fW,ignoreTags:[],ignoreClasses:[],isIgnoredClass(e){if(typeof e!=`string`||this.ignoreClasses.length===0)return!1;let t=e.split(/\s+/);for(let e=0;e<t.length;e++)if(this.ignoreClasses.indexOf(t[e])>=0)return!0;return!1},defaultRender(e){return e},check(e){return this.get(`validate`,e.toString(),e)},get(e,t,n){let r=t!=null,i=this.o[e];return i&&(typeof i==`object`?(i=n.t in i?i[n.t]:fW[e],typeof i==`function`&&r&&(i=i(t,n))):typeof i==`function`&&r&&(i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r==`function`&&t!=null&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get(`render`,null,e)||this.defaultRender)(t,e.t,e)}};function mW(e){return e}function hW(e,t){this.t=`token`,this.v=e,this.tk=t}hW.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get(`truncate`,t,this),r=e.get(`format`,t,this);return n&&r.length>n?r.substring(0,n)+`…`:r},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=fW.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,n=this.toHref(e.get(`defaultProtocol`)),r=e.get(`formatHref`,n,this),i=e.get(`tagName`,n,t),a=this.toFormattedString(e),o={},s=e.get(`className`,n,t),c=e.get(`target`,n,t),l=e.get(`rel`,n,t),u=e.getObj(`attributes`,n,t),d=e.getObj(`events`,n,t);return o.href=r,s&&(o.class=s),c&&(o.target=c),l&&(o.rel=l),u&&Object.assign(o,u),{tagName:i,attributes:o,content:a,eventListeners:d}}};function gW(e,t){class n extends hW{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}var _W=gW(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),vW=gW(`text`),yW=gW(`nl`),bW=gW(`url`,{isLink:!0,toHref(e=fW.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==ZH&&e[1].t===OU}}),xW=e=>new UH(e);function SW({groups:e}){let t=e.domain.concat([xU,CU,wU,TU,EU,DU,AU,MU,PU,nU,FU,IU,LU,RU,UU,qU,WU,GU]),n=[SU,OU,kU,jU,NU,FU,zU,BU,HU,dU,fU,aU,oU,cU,sU,lU,uU,pU,mU,hU,gU,_U,vU,yU,bU],r=[xU,SU,CU,TU,EU,DU,AU,MU,PU,aU,oU,FU,IU,LU,RU,zU,UU,qU,WU,GU],i=xW(),a=$(i,WU);WH(a,r,a),WH(a,e.domain,a);let o=xW(),s=xW(),c=xW();WH(i,e.domain,o),WH(i,e.scheme,s),WH(i,e.slashscheme,c),WH(o,r,a),WH(o,e.domain,o);let l=$(o,wU);$(a,wU,l),$(s,wU,l),$(c,wU,l);let u=$(a,jU);WH(u,r,a),WH(u,e.domain,a);let d=xW();WH(l,e.domain,d),WH(d,e.domain,d);let f=$(d,jU);WH(f,e.domain,d);let p=xW(_W);WH(f,e.tld,p),WH(f,e.utld,p),$(l,ZH,p);let m=$(d,PU);$(m,PU,m),WH(m,e.domain,d),WH(p,e.domain,d),$(p,jU,f),$(p,PU,m);let h=$(o,PU),g=$(o,jU);$(h,PU,h),WH(h,e.domain,o),WH(g,r,a),WH(g,e.domain,o);let _=xW(bW);WH(g,e.tld,_),WH(g,e.utld,_),WH(_,e.domain,o),WH(_,r,a),$(_,jU,g),$(_,PU,h),$(_,wU,l);let v=$(_,OU),y=xW(bW);WH(v,e.numeric,y);let b=xW(bW),x=xW();WH(b,t,b),WH(b,n,x),WH(x,t,b),WH(x,n,x),$(_,UU,b),$(y,UU,b),$(_,zU,x),$(_,RU,b),$(y,zU,x),$(y,RU,b);let S=$(s,OU),C=$($($(c,OU),UU),UU);WH(s,e.domain,o),$(s,jU,g),$(s,PU,h),WH(c,e.domain,o),$(c,jU,g),$(c,PU,h),WH(S,e.domain,b),$(S,UU,b),$(S,zU,b),WH(C,e.domain,b),WH(C,t,b),$(C,UU,b);let w=[[aU,oU],[sU,cU],[lU,uU],[dU,fU],[pU,mU],[hU,gU],[_U,vU],[yU,bU]];for(let e=0;e<w.length;e++){let[r,i]=w[e],a=$(b,r);$(x,r,a);let o=xW(bW);WH(a,t,o);let s=xW();WH(a,n,s),$(a,i,b),WH(o,t,o),WH(o,n,s),WH(s,t,o),WH(s,n,s),$(o,i,b),$(s,i,b)}return $(i,ZH,_),$(i,iU,yW),{start:i,tokens:JU}}function CW(e,t,n){let r=n.length,i=0,a=[],o=[],s=[];for(;i<r;){let c=e,l=null,u=null,d=0,f=null,p=-1,m=[];for(;i<r&&!(l=c.go(n[i].t));)o.push(n[i++]);for(;i<r&&(u=l||c.go(n[i].t));)if(l=null,c=u,i++,d++,c.accepts())p=0,f=c,m=[];else if(p>=0&&p++,m.push(c),s[i]&&s[i].has(c))break;for(let e=0,t=i-m.length+1;e<m.length;e++,t++)(s[t]||(s[t]=new Set)).add(m[e]);if(p<0)i-=d,i<r&&(o.push(n[i]),i++);else{o.length>0&&(a.push(wW(vW,t,o)),o=[]),i-=p,d-=p;let e=f.t,r=n.slice(i-d,i);a.push(wW(e,t,r))}}return o.length>0&&a.push(wW(vW,t,o)),a}function wW(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}var TW=typeof console<`u`&&console&&console.warn||(()=>{}),EW=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,DW={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function OW(){return UH.groups={},DW.scanner=null,DW.parser=null,DW.tokenQueue=[],DW.pluginQueue=[],DW.customSchemes=[],DW.initialized=!1,DW}function kW(e,t=!1){if(DW.initialized&&TW(`linkifyjs: already initialized - will not register custom scheme "${e}" ${EW}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
|
|
254
|
+
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
255
|
+
2. Cannot start or end with "-"
|
|
256
|
+
3. "-" cannot repeat`);DW.customSchemes.push([e,t])}function AW(){DW.scanner=sW(DW.customSchemes);for(let e=0;e<DW.tokenQueue.length;e++)DW.tokenQueue[e][1]({scanner:DW.scanner});DW.parser=SW(DW.scanner.tokens);for(let e=0;e<DW.pluginQueue.length;e++)DW.pluginQueue[e][1]({scanner:DW.scanner,parser:DW.parser});return DW.initialized=!0,DW}function jW(e){return DW.initialized||AW(),CW(DW.parser.start,e,cW(DW.scanner.start,e))}jW.scan=cW;function MW(e,t=null,n=null){if(t&&typeof t==`object`){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new pW(n),i=jW(e),a=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&a.push(n.toFormattedObject(r))}return a}var NW=`[\0- \xA0 -\u2029 ]`,PW=new RegExp(NW),FW=RegExp(`${NW}$`),IW=RegExp(`${NW}+$`),LW=new RegExp(NW,`g`);function RW(e,t,n){let r=e.doc.resolve(t.to);if(!r.nodeBefore?.isText)return;let i=e.doc.textBetween(t.from,t.to,``,``).match(IW)?.[0];if(!i)return;let a=t.to-i.length,o=uk(a,t.to,e.doc).filter(e=>e.mark.type===n);if(!o.length)return;let{nodeAfter:s}=r;if(s&&o.some(e=>e.mark.isInSet(s.marks)))return;let c=e.storedMarks;e.removeMark(a,t.to,n),e.setStoredMarks(c),e.selection.empty&&e.selection.from===t.to&&e.removeStoredMark(n)}function zW(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function BW(e){return new Zb({key:new ex(`autolink`),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),a=t.some(e=>e.getMeta(`preventAutolink`));if(!i||a)return;let{tr:o}=r,s=CO(n.doc,[...t]);if(!t.some(nD)){let t=[];s.steps.forEach((e,n)=>{if(!(e instanceof Ly)||!e.slice.size)return;let r=s.mapping.slice(n+1),i=r.map(e.from,1),a=r.map(e.from+e.slice.size,-1);i<a&&t.push({from:i,to:a})}),t.sort((e,t)=>t.to-e.to),t.forEach(t=>RW(o,t,e.type))}if(lk(s).forEach(({newRange:t})=>{let n=wO(r.doc,t,e=>e.isTextblock),i,a;if(n.length>1)i=n[0],a=r.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0,` `);else if(n.length){let e=r.doc.textBetween(t.from,t.to,` `,` `);if(!FW.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i&&a){let t=a.split(PW).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],s=i.pos+a.lastIndexOf(n);if(!n)return!1;let c=jW(n).map(t=>t.toObject(e.defaultProtocol));if(!zW(c))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>!r.schema.marks.code||!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code)).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{uk(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}})}function VW(e){return new Zb({key:new ex(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=ok(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r&&(window.open(r,o),a=!0)}return a}}})}var HW=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,UW=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function WW(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;--r)n+=1;return n%2==1}function GW(e,t){let n=0,r=0;for(;r<t;){if(e[r]!=="`"||n===0&&WW(e,r)){r+=1;continue}let i=0;for(;r<t&&e[r]==="`";)i+=1,r+=1;n===0?n=i:i===n&&(n=0)}return n>0}function KW(e,t,n){let[,r,i]=t;return(t.index?e[t.index-1]:void 0)===`!`||WW(e,t.index??0)||GW(e,t.index??0)?!1:!!r.trim()&&n(i)}function qW(e){let[t,n,r,,i,a,o]=e,s=i??a??o;return{index:e.index??0,text:t,replaceWith:n,data:{href:r,title:s||null,markdown:!0}}}function JW(e,t){return e.index<t.index+t.text.length&&t.index<e.index+e.text.length}function YW(e){return{href:e.data?.href,title:e.data?.title??null}}function XW(e){let t=Lj({find:t=>{let n=HW.exec(t);return!n||!KW(t,n,e.isAllowedHref)?null:qW(n)},type:e.type,getAttributes:YW});return new ij({find:t.find,handler:e=>{let n=t.handler(e);return n!==null&&e.state.tr.steps.length&&e.state.tr.setMeta(`preventAutolink`,!0),n}})}function ZW(e){let t=Gj({find:t=>{let n=[];for(let r of t.matchAll(UW))KW(t,r,e.isAllowedHref)&&n.push(qW(r));let r=(e.findPlainUrls?.call(e,t)??[]).filter(e=>!n.some(t=>JW(t,e)));return[...n,...r]},type:e.type,getAttributes:YW});return new pj({find:t.find,handler:e=>{let n=t.handler(e);return n!==null&&e.state.tr.steps.length&&e.match.data?.markdown&&e.state.tr.setMeta(`preventAutolink`,!0),n}})}function QW(e){return new Zb({key:new ex(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=MW(c,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===c);return!c||!l||i!==void 0&&!i(l.value)?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function $W(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(LW,``).match(RegExp(`^(?:(?:${n.map(e=>e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)).join(`|`)}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,`i`))}var eG=fj.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(e=>{typeof e==`string`?kW(e):kW(e.scheme,e.optionalSlashes)})},onDestroy(){OW()},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:(e,t)=>!!$W(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes(`@`))return!0;let r=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute(`href`)}},target:{default:this.options.HTMLAttributes.target??null},rel:{default:this.options.HTMLAttributes.rel??null},class:{default:this.options.HTMLAttributes.class??null},title:{default:null}}},parseHTML(){return[{tag:`a[href]`,getAttrs:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!$W(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!$W(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,WO(this.options.HTMLAttributes,e),0]:[`a`,WO(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{let n=e.attrs?.href??``,r=e.attrs?.title??``,i=t.renderChildren(e);return r?`[${i}](${n} "${r}")`:`[${i}](${n})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!$W(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!$W(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addInputRules(){return this.options.markdownLinks?[XW({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!$W(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){let e=e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options;MW(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!$W(e,n),protocols:n,defaultProtocol:r})).forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t};return this.options.markdownLinks?[ZW({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!$W(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:e})]:[Gj({find:e,type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(BW({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!$W(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(VW({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(QW({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),tG=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,nG=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,rG=fj.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,WO(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Lj({find:tG,type:this.type})]},addPasteRules(){return[Gj({find:nG,type:this.type})]}}),iG=Uj.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),aG=fj.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,WO(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),oG=bj.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(mH.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(lH.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(KF.configure(this.options.bulletList)),this.options.code!==!1&&e.push(VF.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(vH.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(yH.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(Nz.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(Pz.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(bH.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(xH.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(aB.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(SH.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(DH.configure(this.options.italic)),this.options.listItem!==!1&&e.push(hI.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(wI.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(eG.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(WI.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(QI.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(rG.configure(this.options.strike)),this.options.text!==!1&&e.push(iG.configure(this.options.text)),this.options.underline!==!1&&e.push(aG.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(iB.configure(this.options?.trailingNode)),e}}),sG=[`gray`,`red`,`orange`,`green`,`blue`,`purple`],cG={gray:`Cinza`,red:`Vermelho`,orange:`Laranja`,green:`Verde`,blue:`Azul`,purple:`Roxo`},lG=e=>sG.includes(e??``),uG=fj.create({name:`textColor`,addAttributes(){return{color:{default:null,parseHTML:e=>e.getAttribute(`data-color`),renderHTML:e=>({"data-color":e.color})}}},parseHTML(){return[{tag:`span[data-color]`,getAttrs:e=>lG(e.getAttribute(`data-color`))?null:!1}]},renderHTML({HTMLAttributes:e}){return[`span`,e,0]},markdownTokenName:`textColor`,markdownTokenizer:{name:`textColor`,level:`inline`,start:e=>e.indexOf(`<span data-color=`),tokenize(e,t,n){let r=/^<span data-color="([a-z]+)">([\s\S]*?)<\/span>/.exec(e);if(r&&lG(r[1]??null))return{type:`textColor`,raw:r[0],color:r[1],tokens:n.inlineTokens(r[2]??``)}}},parseMarkdown:(e,t)=>t.applyMark(`textColor`,t.parseInline(e.tokens??[]),{color:e.color}),renderMarkdown:(e,t)=>`<span data-color="${e.attrs?.color}">${t.renderChildren(e)}</span>`,addCommands(){return{setTextColor:e=>({commands:t})=>t.setMark(this.name,{color:e}),unsetTextColor:()=>({commands:e})=>e.unsetMark(this.name)}}}),dG=hI.extend({renderMarkdown:(e,t,n)=>{let r=Number(n.meta?.parentAttrs?.start??1),i=n.parentType===`orderedList`?`${r+(n.index??0)}. `:`- `,a=` `.repeat(i.length),[o,...s]=e.content??[],c=i+(o?t.renderChildren([o]):``);return s.forEach((e,n)=>{let r=t.renderChild?.(e,n+1)??t.renderChildren([e]);c+=`\n\n${r.split(`
|
|
257
|
+
`).map(e=>e&&a+e).join(`
|
|
258
|
+
`)}`}),c}}),fG=$I.extend({parseMarkdown(e,t){let n=this.parent?.(e,t);return(Array.isArray(n)?n:n?[n]:[]).map(e=>`type`in e&&e.type===`image`?{type:`paragraph`,content:[e]}:e)}}),pG=HF.extend({excludes:``});function mG(e=fF,t=MF){return[oG.configure({code:!1,link:{openOnClick:!1,autolink:!0},listItem:!1,paragraph:!1}),pG,fG,dG,e.configure({inline:!0,HTMLAttributes:{loading:`lazy`,decoding:`async`}}),yz.configure({table:{resizable:!1}}),t,uG,Qz.configure({placeholder:U(`Escreva aqui, ou digite / para inserir um bloco. Cole um print com Ctrl+V.`)}),$V.configure({markedOptions:{gfm:!0}})]}var hG=[{id:`s`,label:()=>U(`Pequena`)},{id:`m`,label:()=>U(`Média`)},{id:`full`,label:()=>U(`Larga`)}];function gG({slug:e,src:t}){let n=$N(t),r=YN(e,n),[i,a]=(0,_.useState)(!1);if(!n)return null;let o=t=>{a(!1),JN(e,n,{...r??QN(),display:t}).catch(()=>a(!0))};return(0,R.jsxs)(`fieldset`,{className:`grid gap-1.5`,children:[(0,R.jsx)(`legend`,{className:`mb-1 text-sm font-bold`,children:U(`Tamanho da imagem`)}),(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:hG.map(e=>(0,R.jsx)(`button`,{type:`button`,"aria-pressed":r?.display===e.id,disabled:!r,onClick:()=>o(e.id),className:`min-h-11 min-w-11 rounded-md border border-border px-3 py-1 text-sm hover:bg-muted focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-pressed:border-primary aria-pressed:bg-accent aria-pressed:font-bold disabled:opacity-50`,children:e.label()},e.id))}),r&&ZN(r)&&(0,R.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:U(`Com {n} marcadores, a imagem pequena pode amontoá-los. Experimente Média.`,{n:r.markers.length})}),i&&(0,R.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:U(`Não foi possível salvar o tamanho.`)})]})}function _G({...e}){return(0,R.jsx)(td,{"data-slot":`popover`,...e})}function vG({...e}){return(0,R.jsx)(ad,{"data-slot":`popover-trigger`,...e})}function yG({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,R.jsx)(ld,{children:(0,R.jsx)(dd,{"data-slot":`popover-content`,align:t,sideOffset:n,className:L(`z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...r})})}function bG({...e}){return(0,R.jsx)(rd,{"data-slot":`popover-anchor`,...e})}function xG({open:e,onClose:t,getRect:n,label:r,onEscape:i,children:a}){return(0,R.jsxs)(_G,{open:e,onOpenChange:e=>!e&&t(),children:[(0,R.jsx)(bG,{virtualRef:{current:{getBoundingClientRect:n}}}),(0,R.jsx)(yG,{align:`start`,side:`bottom`,sideOffset:8,collisionPadding:PF(),"aria-label":r,className:`max-h-(--radix-popover-content-available-height) w-80 overflow-y-auto p-3 shadow-[0_8px_24px_-12px_rgb(21_26_51/0.35)]`,onEscapeKeyDown:i,onOpenAutoFocus:e=>{e.preventDefault(),e.currentTarget?.querySelector(`input`)?.focus()},children:a})]})}function SG(e){let t=e.state.selection;return!(t instanceof X)||t.node.type.name!==`image`?null:{pos:t.from,alt:t.node.attrs.alt??``,src:t.node.attrs.src}}var CG=330;function wG({editor:e,slug:t,onAnnotate:n}){let r=fN({editor:e,selector:({editor:e})=>SG(e)}),[i,a]=(0,_.useState)(null),o=r!==null&&i!==r.pos;return r===null&&i!==null&&a(null),(0,R.jsx)(xG,{open:o,onClose:()=>a(r?.pos??null),getRect:()=>{let t=r?e.view.nodeDOM(r.pos):null;if(!(t instanceof HTMLElement))return new DOMRect;let n=t.getBoundingClientRect(),i=Math.max(n.top+1,Math.min(n.bottom,window.innerHeight-CG));return new DOMRect(n.x,n.y,n.width,i-n.y)},label:U(`Descrição da imagem`),onEscape:()=>e.commands.focus(),children:r&&(0,R.jsxs)(`div`,{className:`grid gap-2`,children:[(0,R.jsx)(`label`,{htmlFor:`image-alt`,className:`text-sm font-bold`,children:U(`Descrição da imagem`)}),(0,R.jsx)(ag,{id:`image-alt`,defaultValue:r.alt,placeholder:U(`Ex.: Tela de clientes com o botão Novo cliente`),onChange:t=>e.chain().updateAttributes(`image`,{alt:t.target.value}).setNodeSelection(r.pos).run(),onKeyDown:t=>{t.key===`Enter`&&(t.preventDefault(),a(r.pos),e.commands.focus())}},r.pos),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:U(`Quem usa leitor de tela e a IA que lê o manual entendem a imagem por aqui.`)}),$N(r.src)&&(0,R.jsx)(gG,{slug:t,src:r.src}),$N(r.src)&&(0,R.jsxs)($d,{type:`button`,size:`sm`,className:`mt-1 justify-self-start`,onClick:()=>{a(r.pos),n(r.src,r.alt)},children:[(0,R.jsx)(Lm,{}),` `,U(`Editar imagem`)]})]})})}var TG=[`image/png`,`image/jpeg`,`image/gif`,`image/webp`];async function EG(e,t,n,r,i){let a=r;for(let r of n)try{let{path:n}=await vf.uploadAsset(t,r),i=r.name.replace(/\.[^.]+$/,``);e.chain().focus().insertContentAt(a,{type:`image`,attrs:{src:SF(t,n),alt:i}}).run(),a+=1}catch(e){i(W(e,U(`Não foi possível enviar a imagem.`)))}}function DG(e){let t=e.trim();if(!t)return{ok:!0,href:``};if(/\s/.test(t))return{ok:!1,error:U(`Endereço não pode ter espaços. Para ligar a outra página, escolha na lista.`)};if(/^(#|\/|\.\/)/.test(t)||/^mailto:[^@]+@[^@]+$/i.test(t))return{ok:!0,href:t};let n=/^[a-z][a-z0-9+.-]*:/i.test(t)?t:`https://${t}`;try{let e=new URL(n);return[`http:`,`https:`].includes(e.protocol)?!e.hostname.includes(`.`)&&e.hostname!==`localhost`?{ok:!1,error:U(`Falta o domínio, por exemplo: exemplo.com.br`)}:{ok:!0,href:n}:{ok:!1,error:U(`Use um endereço http, https ou mailto.`)}}catch{return{ok:!1,error:U(`Endereço inválido. Exemplo: https://exemplo.com.br`)}}}function OG(e){return`./${e.split(`/`).pop()??e}`}function kG(e){let{from:t,to:n}=e.state.selection,r=e.view.coordsAtPos(t),i=e.view.coordsAtPos(n);return new DOMRect(r.left,r.top,Math.max(i.right-r.left,1),i.bottom-r.top)}function AG({editor:e,open:t,onClose:n,pages:r}){let i=e.getAttributes(`link`).href??``,[a,o]=(0,_.useState)(i),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(!1);t!==l&&(u(t),t&&(o(i),c(null)));let d=gg(a.trim()),f=d&&!/[/:.#]/.test(d)?Dg(r).filter(e=>gg(e.title).includes(d)).slice(0,5):[],p=t=>{let r=e.chain().focus().extendMarkRange(`link`);t?r.setLink({href:t}).run():r.unsetLink().run(),n()},m=()=>{let e=DG(a);e.ok?p(e.href):c(e.error)};return(0,R.jsx)(xG,{open:t,onClose:()=>{n(),e.commands.focus()},getRect:()=>kG(e),label:U(`Editar link`),children:(0,R.jsxs)(`form`,{className:`grid gap-2`,onSubmit:e=>{e.preventDefault();let t=f[0];t&&!s&&f.length===1?p(OG(t.file)):m()},children:[(0,R.jsx)(`label`,{htmlFor:`link-href`,className:`text-sm font-bold`,children:U(`Link para uma página ou endereço`)}),(0,R.jsx)(ag,{id:`link-href`,value:a,"aria-invalid":s!==null,"aria-describedby":s?`link-error`:void 0,onChange:e=>{o(e.target.value),c(null)},placeholder:U(`Nome da página ou https://…`)}),s&&(0,R.jsx)(`p`,{id:`link-error`,role:`alert`,className:`text-xs text-destructive`,children:s}),f.length>0&&(0,R.jsx)(`ul`,{"aria-label":U(`Páginas do manual`),className:`grid gap-0.5`,children:f.map(e=>(0,R.jsx)(`li`,{children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>p(OG(e.file)),className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm hover:bg-accent`,children:[(0,R.jsx)(Np,{className:`size-4 shrink-0 text-primary`,"aria-hidden":!0}),(0,R.jsx)(`span`,{className:`truncate`,children:e.title||U(`Sem título`)})]})},e.id))}),(0,R.jsxs)(`div`,{className:`flex justify-between gap-2 pt-1`,children:[i?(0,R.jsx)($d,{type:`button`,variant:`ghost`,size:`sm`,className:`text-destructive`,onClick:()=>p(``),children:U(`Remover link`)}):(0,R.jsx)(`span`,{}),(0,R.jsx)($d,{type:`submit`,size:`sm`,children:U(`Aplicar`)})]})]})})}function jG(e,t){let n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),a=Math.max(e.right,t.right)-i,o=r-n;return new DOMRect(i,n,a,o)}var MG=class{get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Us(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Hs(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Bs(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Ks(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Ws(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Vs(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Gs(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(qs(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}get virtualElement(){var e;let{selection:t}=this.editor.state,n=this.getReferencedVirtualElement?.call(this);if(n)return n;if(!((e=this.view)!=null&&(e=e.dom)!=null&&e.parentNode))return;let r=kk(this.view,t.from,t.to),i={getBoundingClientRect:()=>r,getClientRects:()=>[r]};if(t instanceof X){let e=this.view.nodeDOM(t.from),n=e.dataset.nodeViewWrapper?e:e.querySelector(`[data-node-view-wrapper]`);n&&(e=n),e&&(i={getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>[e.getBoundingClientRect()]})}if(t instanceof xL){let{$anchorCell:e,$headCell:n}=t,r=e?e.pos:n.pos,a=n?n.pos:e.pos,o=this.view.nodeDOM(r),s=this.view.nodeDOM(a);if(!o||!s)return;let c=o===s?o.getBoundingClientRect():jG(o.getBoundingClientRect(),s.getBoundingClientRect());i={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return i}constructor({editor:e,element:t,view:n,pluginKey:r=`bubbleMenu`,updateDelay:i=250,resizeDelay:a=60,shouldShow:o,appendTo:s,getReferencedVirtualElement:c,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:`absolute`,placement:`top`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&kD(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{this.editor.isDestroyed?this.destroy():this.preventHide?this.preventHide=!1:e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);(n||r)&&(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;i||!t&&!n||(this.getShouldShow(r)?(this.show(),this.updatePosition()):this.hide())},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=l?.scrollTarget??window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener(`dragstart`,this.dragstartHandler),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&Ys(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{this.isVisible&&!this.editor.isDestroyed&&this.element.isConnected&&(r.hide?.referenceHidden||r.hide?.escaped?this.element.style.visibility=`hidden`:(this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()))})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}let i=!t?.selection.eq(e.state.selection),a=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,a,t)}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:e,from:i,to:a})||!1}show(){var e;this.isVisible||=(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener(`dragstart`,this.dragstartHandler),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},NG=e=>new Zb({key:typeof e.pluginKey==`string`?new ex(e.pluginKey):e.pluginKey,view:t=>new MG({view:t,...e})});bj.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[NG({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var PG=class{getTextContent(e){return rk(e,{textSerializers:ik(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Us(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Hs(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Bs(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Ks(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Ws(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Vs(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Gs(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(qs(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}constructor({editor:e,element:t,view:n,pluginKey:r=`floatingMenu`,updateDelay:i=250,resizeDelay:a=60,options:o,appendTo:s,shouldShow:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,a=r.depth===1,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&r.parent.childCount===0&&!this.getTextContent(r.parent);return!(!e.hasFocus()||!i||!a||!o||!this.editor.isEditable)},this.floatingUIOptions={strategy:`absolute`,placement:`right`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;i||!t&&!n||(this.getShouldShow(r)?(this.updatePosition(),this.show()):this.hide())},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{this.preventHide?this.preventHide=!1:e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=o?.scrollTarget??window,this.floatingUIOptions={...this.floatingUIOptions,...o},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,view:this.view,state:t,oldState:e,from:i,to:a})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){var e;if(!((e=this.view)!=null&&(e=e.dom)!=null&&e.parentNode))return;let{selection:t}=this.editor.state,n=kk(this.view,t.from,t.to);Ys({getBoundingClientRect:()=>n,getClientRects:()=>[n]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{r.hide?.referenceHidden||r.hide?.escaped?this.element.style.visibility=`hidden`:(this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate())})}update(e,t){let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,r,t)}show(){var e;this.isVisible||=(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},FG=e=>new Zb({key:typeof e.pluginKey==`string`?new ex(e.pluginKey):e.pluginKey,view:t=>new PG({view:t,...e})});bj.create({name:`floatingMenu`,addOptions(){return{element:null,options:{},pluginKey:`floatingMenu`,updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,`updatePosition`),!0)}},addProseMirrorPlugins(){return this.options.element?[FG({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function IG(e,t){return e??new ex(t)}var LG=typeof window<`u`?_.useLayoutEffect:_.useEffect,RG=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),zG=new Set(`animationIterationCount.aspectRatio.borderImageOutset.borderImageSlice.borderImageWidth.columnCount.columns.fillOpacity.flex.flexGrow.flexShrink.fontWeight.gridArea.gridColumn.gridColumnEnd.gridColumnStart.gridRow.gridRowEnd.gridRowStart.lineClamp.lineHeight.opacity.order.orphans.scale.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth.tabSize.widows.zIndex.zoom`.split(`.`)),BG=new Set([`children`,`className`,`style`]),VG=new Set([`tabIndex`]),HG=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),UG={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function WG(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function GG(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function KG(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||HG.has(e)}function qG(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function JG(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:UG[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function YG(e,t){let n=t.defaultPrevented,r=!1,i=Object.create(t);return Object.defineProperties(i,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>void 0},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>r},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{r=!0,t.stopPropagation()}}}),i}function XG(e){return VG.has(e)}function ZG(e,t,n){t===`tabIndex`?e.tabIndex=Number(n):e[t]=n}function QG(e,t){if(t===`tabIndex`){e.removeAttribute(`tabindex`);return}let n=e[t];e[t]=typeof n==`boolean`?!1:typeof n==`number`?0:``}function $G(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||zG.has(e)?String(t):`${t}px`}function eK(e,t){RG.has(t)||e.style.removeProperty(qG(t))}function tK(e,t,n){RG.has(t)||e.style.setProperty(qG(t),$G(t,n))}function nK(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(BG.has(r)||!KG(r)||WG(r,t[r])||WG(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=GG(r);a==null||a===!1?(XG(r)&&QG(e,r),e.removeAttribute(o)):a===!0?(XG(r)&&ZG(e,r,!0),e.setAttribute(o,``)):XG(r)?ZG(e,r,a):e.setAttribute(o,String(a))})}function rK(e,t,n){t!==n&&(n?e.className=n:e.removeAttribute(`class`))}function iK(e,t,n){let r=t??{},i=n??{};new Set([...Object.keys(r),...Object.keys(i)]).forEach(t=>{let n=r[t],a=i[t];n!==a&&(a==null?eK(e,t):tK(e,t,a))})}function aK(e,t,n){t.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)});let r=[];return Object.entries(n).forEach(([t,n])=>{if(!WG(t,n))return;let{eventName:i,options:a}=JG(t),o=t=>{n(YG(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function oK(e,t){let n=(0,_.useRef)({}),r=(0,_.useRef)([]);LG(()=>{let i=n.current;return rK(e,i.className,t.className),iK(e,i.style,t.style),nK(e,i,t),r.current=aK(e,r.current,t),n.current=t,()=>{r.current.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)}),r.current=[]}},[e,t])}var sK=_.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,getReferencedVirtualElement:o,options:s,children:c,...l},u)=>{let d=(0,_.useRef)(document.createElement(`div`)),f=(0,_.useRef)(IG(e,`bubbleMenu`)).current;oK(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=vN(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,_.useRef)(h);g.current=h;let[v,y]=(0,_.useState)(!1),b=(0,_.useRef)(!0);return(0,_.useEffect)(()=>{if(m?.isDestroyed)return;if(!m){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=d.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=NG({...g.current,editor:m,element:e});m.registerPlugin(t);let n=g.current.pluginKey;return b.current=!0,y(!0),()=>{y(!1),m.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[m]),(0,_.useEffect)(()=>{v&&m&&!m.isDestroyed&&(b.current?b.current=!1:m.view.dispatch(m.state.tr.setMeta(f,{type:`updateOptions`,options:g.current})))},[v,m,n,r,a,s,i,o,f]),(0,Bt.createPortal)(c,d.current)});_.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,options:o,children:s,...c},l)=>{let u=(0,_.useRef)(document.createElement(`div`)),d=(0,_.useRef)(IG(e,`floatingMenu`)).current;oK(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=vN(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,_.useRef)(m);h.current=m;let[g,v]=(0,_.useState)(!1),y=(0,_.useRef)(!0);return(0,_.useEffect)(()=>{if(p?.isDestroyed)return;if(!p){console.warn(`FloatingMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=u.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=FG({...h.current,editor:p,element:e});p.registerPlugin(t);let n=h.current.pluginKey;return y.current=!0,v(!0),()=>{v(!1),p.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[p]),(0,_.useEffect)(()=>{g&&p&&!p.isDestroyed&&(y.current?y.current=!1:p.view.dispatch(p.state.tr.setMeta(d,{type:`updateOptions`,options:h.current})))},[g,p,n,r,a,o,i,d]),(0,Bt.createPortal)(s,u.current)});var cK=[{id:`estrutura`,label:U(`Estrutura`)},{id:`passos`,label:U(`Passo a passo`)},{id:`alertas`,label:U(`Alertas`)},{id:`midia`,label:U(`Mídia`)}],lK=e=>e.chain().focus();function uK(e){return(e.view.dom.closest(`[lang]`)?.getAttribute(`lang`)??`pt-BR`).toLowerCase().startsWith(`pt`)?`Resultado: `:`Result: `}function dK(e){let t=uK(e),{$from:n}=e.state.selection,r=n.parent.content.size===0,i=r?n.before():n.after(),a={type:`blockquote`,content:[{type:`paragraph`,content:[{type:`text`,marks:[{type:`bold`}],text:t.trim()},{type:`text`,text:` `}]}]};lK(e).insertContentAt(r?{from:i,to:n.after()}:i,a).setTextSelection(i+2+t.length).run()}var fK={tip:()=>U(`Alerta: Dica`),warning:()=>U(`Alerta: Atenção`),caution:()=>U(`Alerta: Erro`),note:()=>U(`Alerta: Nota`)},pK={tip:()=>U(`Um atalho ou um jeito melhor de fazer`),warning:()=>U(`Algo que exige cuidado`),caution:()=>U(`Um risco que não dá para desfazer`),note:()=>U(`Uma informação a mais`)},mK={tip:[`dica`,`tip`,`hint`],warning:[`atencao`,`cuidado`,`warning`],caution:[`erro`,`perigo`,`risco`,`caution`,`error`],note:[`nota`,`info`,`informacao`,`note`]},hK=[{id:`paragraph`,group:`estrutura`,label:U(`Texto`),hint:U(`Parágrafo comum`),icon:zm,keywords:[`paragrafo`,`texto`,`comum`,`paragraph`,`text`,`plain`],isTextType:!0,isActive:e=>e.isActive(`paragraph`),run:({editor:e})=>(e.isActive(`callout`)?lK(e).unsetCallout():lK(e).setParagraph()).run()},...[1,2,3].map(e=>({id:`h${e}`,group:`estrutura`,label:U(`Título {n}`,{n:e}),hint:U(e===1?`Seção principal`:e===2?`Subseção`:`Tópico dentro da subseção`),icon:[Vp,Gp,Up][e-1]??Vp,keywords:[`titulo`,`cabecalho`,`secao`,`subsecao`,`topico`,`heading`,`section`,`title`,`h${e}`],isTextType:!0,isActive:t=>t.isActive(`heading`,{level:e}),run:({editor:t})=>lK(t).setHeading({level:e}).run()})),{id:`steps`,group:`passos`,label:U(`Passos numerados`),hint:U(`Um passo por linha, na ordem de uso`),icon:hm,keywords:[`lista`,`numerada`,`passo`,`etapas`,`steps`,`numbered`,`list`],isTextType:!0,isActive:e=>e.isActive(`orderedList`),run:({editor:e})=>lK(e).toggleOrderedList().run()},{id:`result`,group:`passos`,label:U(`Resultado esperado`),hint:U(`O que a pessoa vê depois do passo`),icon:hp,keywords:[`resultado`,`esperado`,`confirmacao`,`passo`,`result`,`expected`],isTextType:!1,run:({editor:e})=>dK(e)},{id:`bullets`,group:`estrutura`,label:U(`Lista`),hint:U(`Itens sem ordem`),icon:ym,keywords:[`lista`,`marcadores`,`itens`,`bullet`,`list`,`unordered`],isTextType:!0,isActive:e=>e.isActive(`bulletList`),run:({editor:e})=>lK(e).toggleBulletList().run()},{id:`quote`,group:`estrutura`,label:U(`Citação`),hint:U(`Trecho em destaque ou observação`),icon:Um,keywords:[`citacao`,`observacao`,`nota`,`quote`,`note`],isTextType:!0,isActive:e=>e.isActive(`blockquote`),run:({editor:e})=>lK(e).toggleBlockquote().run()},...TF.map(e=>({id:`callout-${e}`,group:`alertas`,label:fK[e](),hint:pK[e](),icon:NF[e],keywords:[`alerta`,`aviso`,`destaque`,`alert`,`callout`,`warning`,...mK[e]],isTextType:!0,isActive:t=>t.isActive(`callout`,{type:e}),run:({editor:t})=>lK(t).setCallout(e).run()})),{id:`code`,group:`estrutura`,label:U(`Bloco de código`),hint:U(`Comandos e trechos de código`),icon:yp,keywords:[`codigo`,`comando`,`terminal`,`trecho`,`code`,`command`,`snippet`],isTextType:!0,isActive:e=>e.isActive(`codeBlock`),run:({editor:e})=>lK(e).toggleCodeBlock().run()},{id:`image`,group:`midia`,label:U(`Imagem`),hint:U(`Print da tela do sistema`),icon:Zp,keywords:[`imagem`,`print`,`foto`,`captura`,`tela`,`image`,`screenshot`],isTextType:!1,run:({pickImage:e})=>e()},{id:`table`,group:`midia`,label:U(`Tabela`),hint:U(`3 × 3 com cabeçalho`),icon:rh,keywords:[`tabela`,`colunas`,`campos`,`table`,`columns`,`grid`],isTextType:!1,run:({editor:e})=>lK(e).insertTable({rows:3,cols:3,withHeaderRow:!0}).run()}],gK=e=>cK.findIndex(t=>t.id===e.group);function _K(e){let t=gg(e);return(t?hK.filter(e=>[e.label,e.hint,...e.keywords].some(e=>gg(e).includes(t))):hK).toSorted((e,t)=>gK(e)-gK(t))}function vK(e){return cK.map(t=>({...t,items:e.filter(e=>e.group===t.id)})).filter(e=>e.items.length>0)}var yK=hK.filter(e=>e.isTextType);function bK({editor:e,pickImage:t,className:n}){let r=fN({editor:e,selector:({editor:e})=>[...yK].reverse().find(t=>t.isActive?.(e))?.id??`paragraph`}),i=yK.find(e=>e.id===r)??yK[0];return i?(0,R.jsxs)(Bg,{children:[(0,R.jsx)(Vg,{asChild:!0,children:(0,R.jsxs)(`button`,{type:`button`,"data-roving":!0,tabIndex:0,"aria-label":U(`Tipo de bloco: {tipo}`,{tipo:i.label}),onMouseDown:e=>e.preventDefault(),className:L(`inline-flex h-8 w-52 items-center gap-2 rounded-md px-2.5 text-sm [@media(pointer:coarse)]:h-11 hover:bg-secondary data-[state=open]:bg-secondary`,n),children:[(0,R.jsx)(i.icon,{className:`size-4 text-primary`,"aria-hidden":!0}),(0,R.jsx)(`span`,{className:`flex-1 truncate text-left font-display font-bold`,children:i.label}),(0,R.jsx)(sp,{className:`size-4 text-muted-foreground`,"aria-hidden":!0})]})}),(0,R.jsx)(Hg,{align:`start`,className:`w-56`,onCloseAutoFocus:e=>e.preventDefault(),children:yK.map(n=>(0,R.jsxs)(Ug,{onSelect:()=>n.run({editor:e,pickImage:t}),children:[(0,R.jsx)(n.icon,{className:`text-primary`}),` `,n.label]},n.id))})]}):null}function xK({editor:e,roving:t}){let n=fN({editor:e,selector:({editor:e})=>e.getAttributes(`textColor`).color??null}),r=t=>(t?e.chain().focus().setTextColor(t):e.chain().focus().unsetTextColor()).run(),i=e=>({color:e?`var(--cor-${e})`:void 0});return(0,R.jsxs)(Bg,{children:[(0,R.jsxs)(Xh,{children:[(0,R.jsx)(Zh,{asChild:!0,children:(0,R.jsx)(Vg,{asChild:!0,children:(0,R.jsxs)(`button`,{type:`button`,"data-roving":t?``:void 0,tabIndex:t?-1:void 0,"aria-label":U(`Cor do texto`),onMouseDown:e=>e.preventDefault(),className:`inline-flex h-8 flex-col items-center justify-center rounded-md px-2 [@media(pointer:coarse)]:h-11 [@media(pointer:coarse)]:min-w-11 font-display text-sm font-bold text-muted-foreground hover:bg-secondary hover:text-foreground data-[state=open]:bg-secondary`,children:[(0,R.jsx)(`span`,{"aria-hidden":!0,children:`A`}),(0,R.jsx)(`span`,{"aria-hidden":!0,className:`-mt-0.5 h-[3px] w-4 rounded-full bg-foreground`,style:n?{background:`var(--cor-${n})`}:void 0})]})})}),(0,R.jsx)(Qh,{children:U(`Cor do texto`)})]}),(0,R.jsx)(Hg,{align:`start`,className:`w-44`,onCloseAutoFocus:e=>e.preventDefault(),children:[null,...sG].map(e=>(0,R.jsxs)(Ug,{"aria-current":n===e,onSelect:()=>r(e),children:[(0,R.jsx)(`span`,{"aria-hidden":!0,className:`w-4 text-center font-display font-bold`,style:i(e),children:`A`}),U(e?cG[e]:`Cor padrão`),n===e&&(0,R.jsx)(ap,{className:`ml-auto`,"aria-hidden":!0})]},e??`default`))})]})}function SK({label:e,shortcut:t,icon:n,onClick:r,active:i,showLabel:a,hint:o}){let s=(0,R.jsxs)(`button`,{type:`button`,"data-roving":!0,tabIndex:-1,"aria-pressed":i,"aria-label":e,onMouseDown:e=>e.preventDefault(),onClick:r,className:L(`inline-flex h-8 items-center gap-1.5 rounded-md px-2 text-muted-foreground [@media(pointer:coarse)]:h-11 [@media(pointer:coarse)]:min-w-11 [@media(pointer:coarse)]:justify-center transition-colors hover:bg-secondary hover:text-foreground`,i&&`bg-accent text-primary`,a&&`shrink-0 border border-border px-2.5 text-sm font-bold whitespace-nowrap text-foreground`),children:[(0,R.jsx)(n,{className:`size-4 shrink-0`,"aria-hidden":!0}),a&&(0,R.jsx)(`span`,{children:e})]});return(0,R.jsxs)(Xh,{children:[(0,R.jsx)(Zh,{asChild:!0,children:s}),(0,R.jsxs)(Qh,{children:[o??e,t&&(0,R.jsx)(`kbd`,{className:`ml-2 font-mono text-[11px] opacity-70`,children:t})]})]})}var CK=`selectionMenu`,wK=()=>({boundary:[],padding:{top:document.querySelector(`[data-editor-toolbar]`)?.getBoundingClientRect().bottom??0}}),TK=()=>(0,R.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":!0});function EK({editor:e,pickImage:t,onEditLink:n}){let r=fN({editor:e,selector:({editor:e})=>({bold:e.isActive(`bold`),italic:e.isActive(`italic`),code:e.isActive(`code`),link:e.isActive(`link`)})}),i=()=>e.chain().focus();return(0,R.jsx)(sK,{editor:e,pluginKey:CK,options:{placement:`top-start`,offset:8,flip:wK},shouldShow:({view:t,state:n,from:r,to:i})=>t.hasFocus()&&n.selection instanceof Y&&n.doc.textBetween(r,i).trim().length>0&&!e.isActive(`codeBlock`),className:`z-20 rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md`,children:(0,R.jsxs)(`div`,{role:`toolbar`,"aria-label":U(`Formatar seleção`),className:`flex items-center gap-0.5`,children:[(0,R.jsx)(bK,{editor:e,pickImage:t,className:`w-auto`}),(0,R.jsx)(TK,{}),(0,R.jsx)(SK,{icon:tp,label:U(`Negrito`),shortcut:`Ctrl+B`,active:r.bold,onClick:()=>i().toggleBold().run()}),(0,R.jsx)(SK,{icon:tm,label:U(`Itálico`),shortcut:`Ctrl+I`,active:r.italic,onClick:()=>i().toggleItalic().run()}),(0,R.jsx)(SK,{icon:xp,label:U(`Código no texto`),shortcut:`Ctrl+E`,active:r.code,onClick:()=>i().toggleCode().run()}),(0,R.jsx)(SK,{icon:lm,label:U(`Link`),shortcut:`Ctrl+K`,active:r.link,onClick:n}),(0,R.jsx)(TK,{}),(0,R.jsx)(xK,{editor:e})]})})}function DK(e){let{char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:o}=e,s=n&&!r,c=BA(t),l=RegExp(`\\s${c}$`),u=a?`^`:``,d=r?``:c,f=RegExp(s?`${u}${c}.*?(?=\\s${d}|$)`:`${u}(?:^)?${c}[^\\s${d}]*`,`gm`),p=o.nodeBefore?.isText&&o.nodeBefore.text;if(!p)return null;let m=o.pos-p.length,h=Array.from(p.matchAll(f)).pop();if(!h||h.input===void 0||h.index===void 0)return null;let g=h.input.slice(Math.max(0,h.index-1),h.index),_=RegExp(`^[${i?.join(``)}\0]?$`).test(g);if(i!==null&&!_)return null;let v=m+h.index,y=v+h[0].length;return s&&l.test(p.slice(y-1,y+1))&&(h[0]+=` `,y+=1),v<o.pos&&y>=o.pos?{range:{from:v,to:y},query:h[0].slice(t.length),text:h[0]}:null}function OK(e){return e.docChanged?e.steps.some(e=>{let t=e.slice;if(!t?.content)return!1;let n=t.content.textBetween(0,t.content.size,`
|
|
259
|
+
`);return/\s/.test(n)}):!1}function kK(e){return()=>{let t=e.state.selection.$anchor.pos,{top:n,right:r,bottom:i,left:a}=e.view.coordsAtPos(t);try{return new DOMRect(a,n,r-a,i-n)}catch{return null}}}function AK(e,t,n,r){return n?()=>{let n=r.getState(e.state)?.decorationId;return t.dom.querySelector(`[data-decoration-id="${n}"]`)?.getBoundingClientRect()||null}:kK(e)}function jK({match:e,dismissedRange:t,state:n,transaction:r,editor:i,shouldResetDismissed:a,effectiveAllowSpaces:o}){return a?.({editor:i,state:n,range:t,match:e,transaction:r,allowSpaces:o})?!1:o?e.range.from===t.from:e.range.from===t.from&&!OK(r)}function MK({view:e,pluginKeyRef:t}){let n=e.state.tr.setMeta(t,{exit:!0});e.dispatch(n)}function NK({pluginKey:e,decorationTag:t,decorationClass:n,decorationContent:r,decorationEmptyClass:i,renderer:a,dispatchExit:o}){return{handleKeyDown(t,n){var r;let i=e.getState(t.state);if(!i.active)return!1;if(n.key===`Escape`||n.key===`Esc`){var s;return a==null||(s=a.onKeyDown)==null||s.call(a,{view:t,event:n,range:i.range}),o(t),!0}return(a==null||(r=a.onKeyDown)==null?void 0:r.call(a,{view:t,event:n,range:i.range}))||!1},decorations(a){let{active:o,range:s,decorationId:c,query:l}=e.getState(a);if(!o)return null;let u=!l?.length,d=[n];return u&&d.push(i),kT.create(a.doc,[ET.inline(s.from,s.to,{nodeName:t,class:d.join(` `),"data-decoration-id":c||void 0,"data-decoration-content":r})])}}}function PK({editor:e,char:t,effectiveAllowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,findSuggestionMatch:o,allow:s,shouldShow:c,shouldKeepDismissed:l,pluginKey:u}){return{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(d,f,p,m){let{isEditable:h}=e,{composing:g}=e.view,{selection:_}=d,{empty:v,from:y}=_,b={...f},x=d.getMeta(u);if(x&&x.exit)return b.active=!1,b.decorationId=null,b.range={from:0,to:0},b.query=null,b.text=null,b.dismissedRange=f.active?{...f.range}:f.dismissedRange,b;if(b.composing=g,d.docChanged&&b.dismissedRange!==null&&(b.dismissedRange={from:d.mapping.map(b.dismissedRange.from),to:d.mapping.map(b.dismissedRange.to)}),h&&(v||e.view.composing)){(y<f.range.from||y>f.range.to)&&!g&&!f.composing&&(b.active=!1);let u=o({char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:_.$from}),p=`id_${Math.floor(Math.random()*4294967295)}`;u&&s({editor:e,state:m,range:u.range,isActive:f.active})&&(!c||c({editor:e,range:u.range,query:u.query,text:u.text,transaction:d}))?(b.dismissedRange!==null&&!l({match:u,dismissedRange:b.dismissedRange,state:m,transaction:d})&&(b.dismissedRange=null),b.dismissedRange===null?(b.active=!0,b.decorationId=f.decorationId||p,b.range=u.range,b.query=u.query,b.text=u.text):b.active=!1):(u||(b.dismissedRange=null),b.active=!1)}else b.active=!1;return b.active||(b.decorationId=null,b.range={from:0,to:0},b.query=null,b.text=null),b}}}function FK({editor:e,items:t}){let n=null,r=null,i=null,a=()=>{r!==null&&(clearTimeout(r),r=null),i?.(),i=null},o=e=>new Promise(t=>{i=t,r=setTimeout(()=>{r=null;let e=i;i=null,e?.()},e)}),s=()=>{n?.abort(),a(),n=null};return{abort:s,fetch:async(r,i)=>{s(),n=new AbortController;let a=n;if(i>0&&await o(i),n!==a||a.signal.aborted)return{status:`aborted`};try{let i=await t({editor:e,query:r,signal:a.signal});return n!==a||a.signal.aborted?{status:`aborted`}:{status:`resolved`,items:i}}catch{return n!==a||a.signal.aborted?{status:`aborted`}:{status:`error`}}}}}function IK({placement:e,offset:t,flip:n,floatingUi:r}){var i;let a=[Bs({mainAxis:t.mainAxis??4,crossAxis:t.crossAxis??0})];return n&&a.push(Us()),r!=null&&(i=r.middleware)!=null&&i.length&&a.push(...r.middleware),{placement:e,strategy:r?.strategy??`absolute`,middleware:a}}function LK(e){if(e instanceof HTMLElement)return e;if(typeof e==`string`)try{let t=document.querySelector(e);if(t)return t}catch{return document.body}return document.body}function RK({getReferenceRect:e,contextElement:t,config:n,container:r,dismissOnOutsideClick:i,dismiss:a}){return(o,s={})=>{let c={getBoundingClientRect:()=>e()??new DOMRect,contextElement:t},l=!1,u=!o.isConnected;u&&LK(r).appendChild(o),s.onPosition||(o.style.visibility=`hidden`,o.style.width=`max-content`);let d=zs(c,o,()=>{Ys(c,o,{placement:n.placement,strategy:n.strategy,middleware:n.middleware}).then(({x:e,y:t,placement:n,strategy:r})=>{s.onPosition?s.onPosition({x:e,y:t,placement:n,strategy:r}):(Object.assign(o.style,{position:r,left:`${e}px`,top:`${t}px`}),l||(l=!0,o.style.visibility=``))})},s.autoUpdate),f;return i&&(f=e=>{let n=e.target;!(n instanceof Node)||o.contains(n)||t.contains(n)||a()},document.addEventListener(`pointerdown`,f,!0)),()=>{d(),f&&document.removeEventListener(`pointerdown`,f,!0),u&&o.remove()}}}function zK({editor:e,pluginKey:t,items:n,renderer:r,minQueryLength:i,debounce:a,initialItems:o,placement:s,offset:c,container:l,flip:u,floatingUi:d,dismissOnOutsideClick:f,command:p,clientRectFor:m,dispatchExit:h}){let g,_=FK({editor:e,items:n}),v=IK({placement:s,offset:c,flip:u,floatingUi:d});function y(e,t){switch(e){case`started`:var n;r==null||(n=r.onStart)==null||n.call(r,t);break;case`updated`:var i;r==null||(i=r.onUpdate)==null||i.call(r,t);break;case`stopped`:var a;r==null||(a=r.onExit)==null||a.call(r,t)}}return{update:async(n,d)=>{let b=t.getState(d),x=t.getState(n.state);if(!b||!x)return;let S=null,C=b.query!==x.query,w=b.text!==x.text,T=b.range.from!==x.range.from||b.range.to!==x.range.to,E=C||w||T;if(!b.active&&x.active)S=`started`;else if(b.active&&!x.active)S=`stopped`;else if(x.active&&E)S=`updated`;else return;let D=S===`stopped`?b:x,ee=n.dom.querySelector(`[data-decoration-id="${D.decorationId}"]`),te=m(n,ee),O=i===0||(D.query?D.query.length>=i:!1),k=(S===`started`||S===`updated`)&&O;if(g={editor:e,range:D.range,query:D.query||``,text:D.text||``,items:o??[],command:t=>p({editor:e,range:D.range,props:t}),decorationNode:ee,clientRect:te,loading:k,placement:s,offset:{mainAxis:c.mainAxis??4,crossAxis:c.crossAxis??0},container:l,flip:u,floatingUi:v,mount:RK({getReferenceRect:te,contextElement:n.dom,config:v,container:l,dismissOnOutsideClick:f,dismiss:()=>h(e.view)})},S===`started`){var A;r==null||(A=r.onBeforeStart)==null||A.call(r,g)}if(S===`updated`){var ne;r==null||(ne=r.onBeforeUpdate)==null||ne.call(r,g)}if(S===`started`&&y(S,g),S===`started`||S===`updated`){if(!k)_.abort(),g={...g,items:o??[],loading:!1};else{g={...g,items:o??[],loading:!0},S=`updated`,y(S,g);let e=await _.fetch(D.query||``,a);if(e.status===`aborted`)return;if(!t.getState(n.state)?.active){_.abort();return}g=e.status===`resolved`?{...g,items:e.items,loading:!1}:{...g,loading:!1}}}S===`stopped`?(_.abort(),y(S,g),g=void 0):S===`updated`&&y(S,g)},destroy:()=>{var e;_.abort(),g&&(r==null||(e=r.onExit)==null||e.call(r,g))}}}var BK=new ex(`suggestion`);function VK({pluginKey:e=BK,editor:t,char:n=`@`,allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:a=[` `],startOfLine:o=!1,decorationTag:s=`span`,decorationClass:c=`suggestion`,decorationContent:l=``,decorationEmptyClass:u=`is-empty`,command:d=()=>null,items:f=()=>[],minQueryLength:p=0,debounce:m=0,initialItems:h,placement:g=`bottom-start`,offset:_={},container:v,flip:y=!0,floatingUi:b,dismissOnOutsideClick:x=!0,render:S=()=>({}),allow:C=()=>!0,findSuggestionMatch:w=DK,shouldShow:T,shouldResetDismissed:E}){let D=S?.(),ee=r&&!i,te=(n,r)=>AK(t,n,r,e);function O(e){return jK({...e,editor:t,shouldResetDismissed:E,effectiveAllowSpaces:ee})}let k=t=>MK({view:t,pluginKeyRef:e});return new Zb({key:e,view:()=>zK({editor:t,pluginKey:e,items:f,renderer:D,minQueryLength:p,debounce:m,initialItems:h,placement:g,offset:_,container:v,flip:y,floatingUi:b,dismissOnOutsideClick:x,command:d,clientRectFor:te,dispatchExit:k}),state:PK({editor:t,char:n,effectiveAllowSpaces:ee,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,findSuggestionMatch:w,allow:C,shouldShow:T,shouldKeepDismissed:O,pluginKey:e}),props:NK({pluginKey:e,decorationTag:s,decorationClass:c,decorationContent:l,decorationEmptyClass:u,renderer:D,dispatchExit:k})})}var HK=VK,UK={"callout-tip":`var(--aviso-tip)`,"callout-warning":`var(--aviso-warning)`,"callout-caution":`var(--aviso-caution)`,"callout-note":`var(--aviso-note)`},WK={h1:`text-[22px]`,h2:`text-[18px]`,h3:`text-[15px]`},GK=`font-mono text-[10px] font-bold`;function KK(e){let t=UK[e.id];if(t)return(0,R.jsx)(`span`,{className:`h-6 w-8 rounded-[2px] border-l-4 bg-muted`,style:{borderLeftColor:t}});if(WK[e.id])return(0,R.jsx)(`span`,{className:L(`font-display font-bold leading-none`,WK[e.id]),children:`Aa`});switch(e.id){case`steps`:return(0,R.jsx)(`span`,{className:L(GK,`grid size-6 place-items-center rounded-full bg-anotacao text-[var(--sobre-anotacao)]`),children:`1`});case`result`:return(0,R.jsx)(`span`,{className:L(GK,`bg-[linear-gradient(transparent_50%,var(--marca-faixa)_50%)] uppercase`),children:`OK`});case`quote`:return(0,R.jsx)(`span`,{className:`h-5 border-l-2 border-border pl-1.5 text-base italic leading-5`,children:`“`});case`code`:return(0,R.jsx)(`span`,{className:L(GK,`rounded-[4px] border border-border bg-superficie px-1`),children:`{ }`});case`bullets`:return(0,R.jsx)(`span`,{className:`text-base font-bold leading-none`,children:`•`});case`image`:return(0,R.jsx)(`span`,{className:`h-5 w-7 rounded-[3px] border-2 border-muted-foreground/60`});case`table`:return(0,R.jsx)(`span`,{className:`size-6 border border-muted-foreground/60 bg-[linear-gradient(var(--border),var(--border))_center/1px_100%_no-repeat,linear-gradient(var(--border),var(--border))_center/100%_1px_no-repeat]`});default:return(0,R.jsx)(`span`,{className:`text-base leading-none`,children:`Aa`})}}function qK({block:e}){return(0,R.jsx)(`span`,{"aria-hidden":!0,className:`grid h-8 w-10 shrink-0 place-items-center text-foreground`,children:KK(e)})}function JK({items:e,command:t,ref:n}){let[r,i]=(0,_.useState)(0),[a,o]=(0,_.useState)(e);e!==a&&(o(e),i(0));let s=(0,_.useRef)(null),c=(0,_.useRef)(!1);return(0,_.useEffect)(()=>{c.current&&(c.current=!1,s.current?.querySelector(`[aria-selected="true"]`)?.scrollIntoView({block:`nearest`}))}),(0,_.useImperativeHandle)(n,()=>({onKeyDown:n=>{if(n.key===`ArrowDown`)return c.current=!0,i(t=>(t+1)%Math.max(e.length,1)),!0;if(n.key===`ArrowUp`)return c.current=!0,i(t=>(t-1+e.length)%Math.max(e.length,1)),!0;if(n.key===`Enter`){let n=e[r];return n&&t(n),!0}return!1}})),(0,R.jsx)(`div`,{ref:s,role:`listbox`,"aria-label":U(`Inserir bloco`),className:`z-50 max-h-[min(20rem,var(--slash-max-h,20rem))] w-80 overflow-y-auto rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-[0_8px_24px_-12px_rgb(21_26_51/0.35)]`,children:e.length===0?(0,R.jsx)(`p`,{className:`px-3 py-2 text-sm text-muted-foreground`,children:U(`Nenhum bloco com esse nome.`)}):vK(e).map(n=>(0,R.jsxs)(`div`,{role:`group`,"aria-labelledby":`slash-${n.id}`,children:[(0,R.jsx)(`p`,{id:`slash-${n.id}`,className:`rotulo px-2 pt-2 pb-1`,children:n.label}),n.items.map(n=>{let a=e.indexOf(n);return(0,R.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":a===r,onMouseEnter:()=>i(a),onClick:()=>t(n),className:L(`flex w-full items-center gap-2 rounded-md px-2 py-1 text-left`,a===r&&`bg-accent`),children:[(0,R.jsx)(qK,{block:n}),(0,R.jsxs)(`span`,{className:`grid leading-tight`,children:[(0,R.jsx)(`span`,{className:`text-sm font-bold`,children:n.label}),(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n.hint})]})]},n.id)})]},n.id))})}var YK=bj.create({name:`slashCommand`,addOptions(){return{pickImage:()=>{}}},addProseMirrorPlugins(){let{pickImage:e}=this.options;return[HK({editor:this.editor,char:`/`,startOfLine:!1,flip:!1,floatingUi:{middleware:[Us(()=>({padding:PF()})),Ws(()=>({padding:PF(),apply:({availableHeight:e,elements:t})=>t.floating.style.setProperty(`--slash-max-h`,`${e}px`)}))]},allow:({state:e,range:t})=>{let n=e.doc.textBetween(Math.max(t.from-1,0),t.from,`
|
|
260
|
+
`,`
|
|
261
|
+
`);return n===``||n===` `||n===`
|
|
262
|
+
`},items:({query:e})=>_K(e),command:({editor:t,range:n,props:r})=>{t.chain().focus().deleteRange(n).run(),r.run({editor:t,pickImage:e})},render:()=>{let e=null,t=null;return{onStart:n=>{e=new ON(JK,{props:n,editor:n.editor}),t=n.mount(e.element)},onUpdate:t=>e?.updateProps(t),onKeyDown:({event:t})=>t.key===`Escape`?!1:e?.ref?.onKeyDown(t)??!1,onExit:()=>{t?.(),e?.destroy()}}}})]}}),XK=(e,t)=>{let n=e.chain().focus();return t===void 0?n:n.setTextSelection(t+2)},ZK={id:`row-after`,label:()=>U(`Inserir linha abaixo`),run:(e,t)=>XK(e,t).addRowAfter().run()},QK={id:`col-after`,label:()=>U(`Inserir coluna à direita`),run:(e,t)=>XK(e,t).addColumnAfter().run()},$K=[{id:`row-before`,label:()=>U(`Inserir linha acima`),run:(e,t)=>XK(e,t).addRowBefore().run()},ZK,{id:`row-header`,label:()=>U(`Linha de cabeçalho`),run:(e,t)=>XK(e,t).toggleHeaderRow().run()},{id:`row-delete`,label:()=>U(`Remover linha`),run:(e,t)=>XK(e,t).deleteRow().run(),danger:!0}],eq=[{id:`col-before`,label:()=>U(`Inserir coluna à esquerda`),run:(e,t)=>XK(e,t).addColumnBefore().run()},QK,{id:`col-delete`,label:()=>U(`Remover coluna`),run:(e,t)=>XK(e,t).deleteColumn().run(),danger:!0}],tq={id:`table-delete`,label:()=>U(`Remover tabela`),run:(e,t)=>XK(e,t).deleteTable().run(),danger:!0};function nq({editor:e,actions:t,cellPos:n}){let r=t=>(0,R.jsx)(Ug,{variant:t.danger?`destructive`:`default`,onSelect:()=>t.run(e,n),children:t.label()},t.id);return(0,R.jsxs)(R.Fragment,{children:[t.filter(e=>!e.danger).map(r),(0,R.jsx)(qg,{}),t.filter(e=>e.danger).map(r),r(tq)]})}function rq(e){let{$from:t}=e.state.selection;for(let n=t.depth;n>0;n--)if(t.node(n).type.name===`tableCell`||t.node(n).type.name===`tableHeader`){let r=e.view.nodeDOM(t.before(n));return r instanceof HTMLElement?r:null}return null}function iq(e,t){let[n,r]=(0,_.useState)(null),[,i]=(0,_.useReducer)(e=>e+1,0),a=(0,_.useRef)(!1);(0,_.useEffect)(()=>{let n=t.current;if(!n)return;let o=e=>{let t=e.target;if(a.current||!t||t.closest(`[data-table-controls]`))return;let i=t.closest(`td, th`);r(i&&n.contains(i)?i:null)},s=()=>!a.current&&r(null);n.addEventListener(`mousemove`,o),n.addEventListener(`mouseleave`,s),e.on(`transaction`,i);let c=new ResizeObserver(i);return c.observe(n),()=>{n.removeEventListener(`mousemove`,o),n.removeEventListener(`mouseleave`,s),e.off(`transaction`,i),c.disconnect()}},[e,t]);let o=n?.isConnected?n:rq(e),s=null;if(o)try{s={cell:o,pos:e.view.posAtDOM(o,0)-1}}catch{}return{target:s,pin:e=>{a.current=e}}}var aq=24,oq=`absolute z-[5] grid place-items-center rounded-[3px] border border-border bg-background text-muted-foreground shadow-sm transition-colors hover:border-primary hover:bg-primary hover:text-primary-foreground data-[state=open]:border-primary data-[state=open]:bg-primary data-[state=open]:text-primary-foreground`;function sq({label:e,children:t,...n}){return(0,R.jsxs)(Xh,{children:[(0,R.jsx)(Zh,{asChild:!0,children:(0,R.jsx)(`button`,{type:`button`,"aria-label":e,onMouseDown:e=>e.preventDefault(),...n,children:t})}),(0,R.jsx)(Qh,{children:e})]})}function cq({editor:e,host:t}){let{target:n,pin:r}=iq(e,t),i=t.current?.getBoundingClientRect(),a=n?.cell.closest(`table`),o=a?.parentElement;if(!n||!i||!a||!o)return null;let s=e=>{let t=e.getBoundingClientRect();return{left:t.left-i.left,right:t.right-i.left,top:t.top-i.top,bottom:t.bottom-i.top}},c=s(n.cell),l=s(a),u=s(o),d=(e=>Math.min(Math.max(e,u.left+aq/2),u.right-aq/2))((c.left+c.right)/2),f=(c.top+c.bottom)/2,p=aq/2,m=(t,i,a,o,s)=>(0,R.jsxs)(Bg,{onOpenChange:r,children:[(0,R.jsxs)(Xh,{children:[(0,R.jsx)(Zh,{asChild:!0,children:(0,R.jsx)(Vg,{asChild:!0,children:(0,R.jsx)(`button`,{type:`button`,"aria-label":t,onMouseDown:e=>e.preventDefault(),style:a,className:L(oq,s),children:o})})}),(0,R.jsx)(Qh,{children:t})]}),(0,R.jsx)(Hg,{align:`start`,collisionPadding:PF(),className:`w-56`,onCloseAutoFocus:e=>e.preventDefault(),children:(0,R.jsx)(nq,{editor:e,actions:i,cellPos:n.pos})})]});return(0,R.jsxs)(`div`,{"data-table-controls":!0,children:[m(U(`Opções da coluna`),eq,{left:d-14,top:l.top-12},(0,R.jsx)(Fp,{className:`size-4`,"aria-hidden":!0}),`h-5 w-7`),m(U(`Opções da linha`),$K,{left:u.left-p,top:f-14},(0,R.jsx)(Lp,{className:`size-4`,"aria-hidden":!0}),`h-7 w-6`),(0,R.jsx)(sq,{label:U(`Adicionar coluna à direita`),className:oq,style:{left:u.right-p,top:f-p,width:aq,height:aq},onClick:()=>QK.run(e,n.pos),children:(0,R.jsx)(Vm,{className:`size-4`,"aria-hidden":!0})}),(0,R.jsx)(sq,{label:U(`Adicionar linha abaixo`),className:oq,style:{left:d-p,top:l.bottom-p,width:aq,height:aq},onClick:()=>ZK.run(e,n.pos),children:(0,R.jsx)(Vm,{className:`size-4`,"aria-hidden":!0})})]})}function lq(){return(0,_.useCallback)(e=>{if(![`ArrowRight`,`ArrowLeft`,`Home`,`End`].includes(e.key))return;let t=Array.from(e.currentTarget.querySelectorAll(`[data-roving]:not([disabled])`)),n=t.indexOf(document.activeElement);if(n===-1)return;e.preventDefault();let r=e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowRight`?1:-1)+t.length)%t.length;for(let[e,n]of t.entries())n.tabIndex=e===r?0:-1;t[r]?.focus(),t[r]?.scrollIntoView({inline:`nearest`,block:`nearest`})},[])}function uq(e){return{start:e.scrollLeft>1,end:e.scrollLeft+e.clientWidth<e.scrollWidth-1}}function dq(e){let[t,n]=(0,_.useState)({start:!1,end:!1});return(0,_.useEffect)(()=>{let t=e.current;if(!t)return;let r=()=>{let e=uq(t);n(t=>t.start===e.start&&t.end===e.end?t:e)},i=e=>{if(Math.abs(e.deltaY)<=Math.abs(e.deltaX)||t.scrollWidth<=t.clientWidth)return;let{start:n,end:r}=uq(t);e.deltaY<0&&!n||e.deltaY>0&&!r||(e.preventDefault(),t.scrollLeft+=e.deltaY)};r(),t.addEventListener(`scroll`,r,{passive:!0}),t.addEventListener(`wheel`,i,{passive:!1});let a=new ResizeObserver(r);a.observe(t);let o=new MutationObserver(r);return o.observe(t,{childList:!0}),()=>{t.removeEventListener(`scroll`,r),t.removeEventListener(`wheel`,i),a.disconnect(),o.disconnect()}},[e]),t}var fq=`atkinson-hyperlegible-next`;function pq(){let e=zg(),t=xF(!0).filter(e=>e.italic),n=e.manual?.theme.fonts?.text??fq,r=t.find(e=>e.id===n);if(!r)return null;let i=t=>void e.setManualTheme({fonts:{text:t===fq?null:t}}).catch(t=>e.reportError(W(t)));return(0,R.jsxs)(Bg,{children:[(0,R.jsxs)(Xh,{children:[(0,R.jsx)(Zh,{asChild:!0,children:(0,R.jsx)(Vg,{asChild:!0,children:(0,R.jsxs)(`button`,{type:`button`,"data-roving":!0,tabIndex:-1,"aria-label":U(`Fonte do manual: {fonte}`,{fonte:r.family}),onMouseDown:e=>e.preventDefault(),className:`inline-flex h-8 w-40 shrink-0 items-center gap-2 rounded-md px-2.5 text-sm [@media(pointer:coarse)]:h-11 hover:bg-secondary data-[state=open]:bg-secondary`,children:[(0,R.jsx)(lh,{className:`size-4 shrink-0 text-primary`,"aria-hidden":!0}),(0,R.jsx)(`span`,{className:`flex-1 truncate text-left`,children:r.family}),(0,R.jsx)(sp,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0})]})})}),(0,R.jsx)(Qh,{children:U(`Fonte do manual inteiro`)})]}),(0,R.jsx)(Hg,{align:`start`,className:`w-56`,onCloseAutoFocus:e=>e.preventDefault(),children:t.map(e=>(0,R.jsxs)(Ug,{onSelect:()=>i(e.id),style:{fontFamily:`${gF(e.family)}, ${e.kind===`serif`?`serif`:`sans-serif`}`},children:[(0,R.jsx)(`span`,{className:`flex-1`,children:e.family}),e.id===n&&(0,R.jsx)(ap,{className:`size-4 text-primary`,"aria-hidden":!0})]},e.id))})]})}var mq=[...$K,...eq];function hq({editor:e}){return(0,R.jsxs)(Bg,{children:[(0,R.jsx)(Vg,{asChild:!0,children:(0,R.jsx)(`button`,{type:`button`,"data-roving":!0,tabIndex:-1,"aria-label":U(`Opções da tabela`),onMouseDown:e=>e.preventDefault(),className:`inline-flex h-8 items-center rounded-md px-2 text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground data-[state=open]:bg-secondary [@media(pointer:coarse)]:h-11 [@media(pointer:coarse)]:min-w-11 [@media(pointer:coarse)]:justify-center`,children:(0,R.jsx)(Ym,{className:`size-4`,"aria-hidden":!0})})}),(0,R.jsx)(Hg,{align:`start`,className:`w-56`,onCloseAutoFocus:e=>e.preventDefault(),children:(0,R.jsx)(nq,{editor:e,actions:mq})})]})}var gq=({show:e,side:t})=>(0,R.jsx)(`span`,{"aria-hidden":!0,className:L(`pointer-events-none absolute inset-y-0 w-8 transition-opacity motion-reduce:transition-none`,t===`left`?`left-0 bg-gradient-to-r`:`right-0 bg-gradient-to-l`,`from-background to-transparent`,e?`opacity-100`:`opacity-0`)}),_q=()=>(0,R.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":!0});function vq({editor:e,onPickImage:t,onEditLink:n}){let r=fN({editor:e,selector:({editor:e})=>({bold:e.isActive(`bold`),italic:e.isActive(`italic`),code:e.isActive(`code`),link:e.isActive(`link`),inTable:e.isActive(`table`)})}),i=()=>e.chain().focus(),a=lq(),o=(0,_.useRef)(null),s=dq(o);return(0,R.jsxs)(`div`,{"data-editor-toolbar":!0,className:`sticky top-0 z-10 -mx-2 border-b border-border bg-background/95 backdrop-blur-sm`,children:[(0,R.jsxs)(`div`,{ref:o,role:`toolbar`,"aria-label":U(`Formatação`),onKeyDown:a,className:`flex items-center gap-0.5 overflow-x-auto px-2 py-2 [scrollbar-width:none]`,children:[(0,R.jsx)(bK,{editor:e,pickImage:t}),(0,R.jsx)(SK,{icon:Zp,label:U(`Imagem`),hint:U(`Colar print`),shortcut:`Ctrl+V`,showLabel:!0,onClick:t}),(0,R.jsx)(pq,{}),(0,R.jsx)(_q,{}),(0,R.jsx)(SK,{icon:tp,label:U(`Negrito`),shortcut:`Ctrl+B`,active:r.bold,onClick:()=>i().toggleBold().run()}),(0,R.jsx)(SK,{icon:tm,label:U(`Itálico`),shortcut:`Ctrl+I`,active:r.italic,onClick:()=>i().toggleItalic().run()}),(0,R.jsx)(SK,{icon:xp,label:U(`Código no texto`),shortcut:`Ctrl+E`,active:r.code,onClick:()=>i().toggleCode().run()}),(0,R.jsx)(SK,{icon:lm,label:U(`Link`),shortcut:`Ctrl+K`,active:r.link,onClick:n}),(0,R.jsx)(xK,{editor:e,roving:!0}),(0,R.jsx)(_q,{}),r.inTable?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(SK,{icon:Zf,label:U(`Adicionar linha`),onClick:()=>i().addRowAfter().run()}),(0,R.jsx)(SK,{icon:$f,label:U(`Adicionar coluna`),onClick:()=>i().addColumnAfter().run()}),(0,R.jsx)(hq,{editor:e})]}):(0,R.jsx)(SK,{icon:rh,label:U(`Tabela`),onClick:()=>i().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()})]}),(0,R.jsx)(gq,{show:s.start,side:`left`}),(0,R.jsx)(gq,{show:s.end,side:`right`})]})}function yq({slug:e,initialMarkdown:t,onChange:n,onError:r,onReady:i,pages:a}){let o=(0,_.useRef)({slug:e,onChange:n,onError:r});o.current={slug:e,onChange:n,onError:r};let s=(0,_.useRef)(null),c=(0,_.useRef)(null),l=()=>s.current?.click(),u=zg().manual?.theme,d=xF(!0),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(null),g=(e,t,n)=>void EG(e,o.current.slug,t,n,o.current.onError),v=gN({extensions:[...mG(hF.configure({slug:e}),IF),YK.configure({pickImage:l}),bj.create({name:`linkShortcut`,addKeyboardShortcuts:()=>({"Mod-k":({editor:e})=>(LF(e),p(!0),!0)})}),bj.create({name:`endShortcut`,addKeyboardShortcuts:()=>({"Mod-End":({editor:e})=>e.commands.focus(`end`)})}),qj.configure({allowedMimeTypes:TG,onPaste:(e,t)=>g(e,t,e.state.selection.anchor),onDrop:(e,t,n)=>g(e,t,n)})],content:CF(e,t),contentType:`markdown`,shouldRerenderOnTransaction:!1,editorProps:{attributes:{"aria-label":U(`Conteúdo da página`),"aria-multiline":`true`,role:`textbox`}},onUpdate:({editor:e})=>o.current.onChange(wF(e.getMarkdown()))});return(0,_.useEffect)(()=>{v&&i?.(v)},[v,i]),v?(0,R.jsxs)(`div`,{children:[(0,R.jsx)(vq,{editor:v,onPickImage:l,onEditLink:()=>p(!0)}),(0,R.jsx)(`input`,{ref:s,type:`file`,name:`imagem`,accept:TG.join(`,`),multiple:!0,hidden:!0,onChange:e=>{let t=Array.from(e.target.files??[]);e.target.value=``,g(v,t,v.state.selection.anchor)}}),(0,R.jsxs)(`div`,{ref:c,className:`relative`,children:[(0,R.jsx)(lN,{editor:v,className:`editor-content`,style:vF(d,u)}),(0,R.jsx)(cq,{editor:v,host:c})]}),(0,R.jsx)(EK,{editor:v,pickImage:l,onEditLink:()=>p(!0)}),(0,R.jsx)(AG,{editor:v,open:f,onClose:()=>p(!1),pages:a}),(0,R.jsx)(wG,{editor:v,slug:e,onAnnotate:(e,t)=>h({src:e,alt:t})}),m&&$N(m.src)&&(0,R.jsx)(uF,{slug:e,asset:$N(m.src)??``,src:m.src,alt:m.alt,pages:a,onClose:()=>h(null)})]}):null}function bq(e){let t=[];return e.state.doc.forEach((e,n)=>{e.type.name===`heading`&&t.push({pos:n,level:e.attrs.level,text:e.textContent})}),t}function xq(e){let[t,n]=(0,_.useState)([]);return(0,_.useEffect)(()=>{if(!e)return;let t=()=>{let t=bq(e);n(e=>JSON.stringify(e)===JSON.stringify(t)?e:t)};return t(),e.on(`update`,t),()=>{e.off(`update`,t)}},[e]),t}function Sq({editor:e,headings:t,onNavigate:n}){let r=t=>{e.chain().focus().setTextSelection(t.pos+1).run(),e.view.nodeDOM(t.pos)?.scrollIntoView({block:`start`}),n?.()};return(0,R.jsxs)(`nav`,{"aria-label":U(`Nesta página`),className:`text-[13px]`,children:[(0,R.jsx)(`p`,{className:`mb-2 rotulo`,children:U(`Nesta página`)}),(0,R.jsx)(`ul`,{className:`grid grid-cols-[minmax(0,1fr)] gap-0.5 border-l border-border`,children:t.map(e=>(0,R.jsx)(`li`,{children:(0,R.jsx)(`button`,{type:`button`,onClick:()=>r(e),className:`-ml-px block w-full truncate border-l-2 border-transparent py-1 pr-2 text-left text-muted-foreground hover:border-primary hover:text-foreground`,style:{paddingLeft:`${.75*e.level}rem`},children:e.text||U(`Título vazio`)})},e.pos))})]})}function Cq(e){let[t,n]=(0,_.useState)(!1);return(0,R.jsxs)(_G,{open:t,onOpenChange:n,children:[(0,R.jsx)(vG,{asChild:!0,children:(0,R.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1.5 rounded-md px-2 py-1 text-[13px] text-muted-foreground hover:bg-muted hover:text-foreground data-[state=open]:bg-muted xl:hidden [@media(pointer:coarse)]:min-h-11`,children:[(0,R.jsx)(_m,{className:`size-3.5`,"aria-hidden":!0}),` `,U(`Nesta página`)]})}),(0,R.jsx)(yG,{align:`end`,className:`max-h-[60vh] w-72 overflow-y-auto p-3`,children:(0,R.jsx)(Sq,{...e,onNavigate:()=>n(!1)})})]})}function wq(e){return U(e===`pdf`?`Gerando PDF…`:`Exportando…`)}function Tq({busy:e,format:t,formatLabel:n,result:r}){return(0,R.jsxs)(`div`,{role:`status`,className:`grid gap-2 text-sm empty:hidden`,children:[e&&(0,R.jsxs)(`p`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,R.jsx)(xm,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}),wq(t),t===`pdf`&&(0,R.jsx)(`span`,{className:`text-xs`,children:U(`Pode levar alguns segundos.`)})]}),!e&&r&&(0,R.jsx)(Eq,{result:r,formatLabel:n})]})}function Eq({result:e,formatLabel:t}){let[n,r]=(0,_.useState)(!1),i=()=>void navigator.clipboard?.writeText(e.file).then(()=>r(!0)),a=`inline-flex w-fit items-center gap-1 rounded-md font-bold text-primary underline-offset-2 hover:underline [@media(pointer:coarse)]:min-h-11`;return(0,R.jsxs)(`div`,{className:`grid gap-2 rounded-md border border-primary/40 bg-accent p-3`,children:[(0,R.jsxs)(`p`,{className:`flex items-center gap-2 font-bold`,children:[(0,R.jsx)(ap,{className:`size-4 shrink-0 text-primary`,"aria-hidden":!0}),U(`{formato} exportado`,{formato:t}),` · `,lf(e.pages,`{n} página`,`{n} páginas`)]}),(0,R.jsxs)(`p`,{className:`grid gap-1`,children:[(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:U(`Arquivo, dentro da pasta do manual`)}),(0,R.jsx)(`code`,{className:`font-mono text-xs break-all`,children:e.file})]}),e.warnings.length>0&&(0,R.jsxs)(`div`,{className:`grid gap-1 rounded-md border border-destructive/40 bg-destructive/10 p-2`,children:[(0,R.jsx)(`p`,{className:`font-bold`,children:lf(e.warnings.length,`Atenção: {n} aviso`,`Atenção: {n} avisos`)}),(0,R.jsx)(`ul`,{className:`list-disc pl-5`,children:e.warnings.map(e=>(0,R.jsx)(`li`,{children:U(`Ficou de fora: {motivo}`,{motivo:e})},e))})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-x-4`,children:[(0,R.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:a,children:[(0,R.jsx)(Dp,{className:`size-3.5`,"aria-hidden":!0}),` `,e.format===`pdf`?U(`Abrir o PDF`):U(`Abrir o arquivo`)]}),(0,R.jsx)(`button`,{type:`button`,onClick:i,className:a,children:U(n?`Caminho copiado`:`Copiar caminho`)})]})]})}function Dq({slug:e,logo:t,disabled:n}){let r=zg(),i=(0,_.useRef)(null),[a,o]=(0,_.useState)(null),s=async e=>{if(e)try{await r.uploadManualLogo(e),o(null)}catch(e){o(W(e,U(`Não foi possível enviar o logo.`)))}},c=()=>r.setManualTheme({logo:null}).then(()=>o(null),e=>o(W(e)));return(0,R.jsxs)(`div`,{className:`grid gap-2`,children:[(0,R.jsx)(`span`,{className:`rotulo`,children:U(`Logo do cliente`)}),(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[t&&(0,R.jsx)(`img`,{src:`/files/${encodeURIComponent(e)}/${t}`,alt:U(`Logo do manual`),className:`h-10 max-w-32 rounded-sm border border-border bg-white object-contain p-1`}),(0,R.jsx)(`input`,{ref:i,type:`file`,accept:`.png,.jpg,.jpeg,.svg,image/png,image/jpeg,image/svg+xml`,className:`sr-only`,tabIndex:-1,"aria-label":U(`Logo do cliente`),onChange:e=>{s(e.target.files?.[0]),e.target.value=``}}),(0,R.jsx)($d,{type:`button`,variant:`outline`,size:`sm`,disabled:n,onClick:()=>i.current?.click(),children:U(t?`Trocar logo`:`Enviar logo`)}),t&&(0,R.jsx)($d,{type:`button`,variant:`ghost`,size:`sm`,disabled:n,onClick:()=>void c(),children:U(`Tirar logo`)})]}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:U(`Aparece na capa e no topo do sumário do HTML e do PDF. PNG, JPG ou SVG, até 1 MB.`)}),a&&(0,R.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a})]})}var Oq=/^#[0-9a-f]{6}$/i;function kq({label:e,value:t,fallback:n,onCommit:r}){let i=t??n,[a,o]=(0,_.useState)(i),[s,c]=(0,_.useState)(null);(0,_.useEffect)(()=>o(i),[i]);let l=async e=>{if(e!==null&&!Oq.test(e))c(U(`Use o formato #2b4fe0.`));else{if((e??n).toLowerCase()===i.toLowerCase())return c(null);try{await r(e),c(null)}catch(e){c(e instanceof Error?e.message:U(`Não foi possível salvar a cor.`)),o(i)}}};return(0,R.jsxs)(`div`,{className:`grid gap-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,R.jsx)(`input`,{type:`color`,"aria-label":e,value:Oq.test(a)?a.toLowerCase():i,onChange:e=>o(e.target.value),onBlur:e=>void l(e.target.value),className:`size-7 shrink-0 cursor-pointer rounded-sm border border-muted-foreground bg-transparent p-0.5`}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1`,children:e}),(0,R.jsx)(`input`,{type:`text`,"aria-label":`${e}: ${U(`código da cor`)}`,value:a,maxLength:7,spellCheck:!1,"aria-invalid":s?!0:void 0,onChange:e=>o(e.target.value),onBlur:()=>void l(a),onKeyDown:e=>e.key===`Enter`&&void l(a),className:`h-7 w-24 rounded-sm border border-input bg-transparent px-2 font-mono text-xs aria-invalid:border-destructive`}),(0,R.jsx)(`button`,{type:`button`,disabled:t===void 0,onClick:()=>void l(null),className:`rounded-sm px-1.5 py-0.5 text-xs text-primary hover:bg-accent disabled:invisible`,children:U(`Padrão`)})]}),s&&(0,R.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:s})]})}function Aq({label:e,fonts:t,value:n,fallback:r,onChange:i}){let a=n??r;return(0,R.jsxs)(`fieldset`,{className:`grid gap-1.5`,children:[(0,R.jsx)(`legend`,{className:`mb-1 text-sm`,children:e}),(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map(e=>(0,R.jsxs)(`button`,{type:`button`,"aria-pressed":a===e.id,onClick:()=>i(e.id===r?null:e.id),style:{fontFamily:`${gF(e.family)}, ${e.kind===`serif`?`serif`:`sans-serif`}`},className:`rounded-md border border-border px-2.5 py-1 text-sm hover:bg-muted aria-pressed:border-primary aria-pressed:bg-accent aria-pressed:font-bold`,children:[e.family,e.id===r&&(0,R.jsxs)(`span`,{className:`font-sans text-[11px] font-normal text-muted-foreground`,children:[` · `,U(`padrão`)]})]},e.id))})]})}var jq=[{label:U(`Cobalto`),swatch:`#2b4fe0`},{label:U(`Esmeralda`),swatch:`#0f7a55`},{label:U(`Ameixa`),swatch:`#7a3fc4`},{label:U(`Grafite`),swatch:`#3d4459`}],Mq={text:`#151a33`,accent:jq[0].swatch,highlight:`#ffd43b`,heading:`#000000`},Nq={text:`atkinson-hyperlegible-next`,headings:`archivo`},Pq=[{slot:`cover`,label:U(`Título da capa`)},{slot:`page`,label:U(`Título da página`)},{slot:`h1`,label:U(`Título 1`)},{slot:`h2`,label:U(`Título 2`)},{slot:`h3`,label:U(`Título 3`)}];function Fq({theme:e}){let t=zg(),[n,r]=(0,_.useState)(!1),i=xF(n),a=e=>t.setManualTheme(e),o=e=>void a(e).catch(e=>t.reportError(W(e)));return(0,R.jsxs)(`details`,{className:`group`,onToggle:e=>r(e.currentTarget.open),children:[(0,R.jsx)(`summary`,{className:`cursor-pointer rotulo hover:text-foreground`,children:U(`Cores do manual`)}),(0,R.jsxs)(`div`,{className:`mt-3 grid gap-2.5`,children:[(0,R.jsx)(kq,{label:U(`Cor do texto`),value:e.text,fallback:Mq.text,onCommit:e=>a({text:e})}),(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(kq,{label:U(`Cor de destaque`),value:e.accent,fallback:Mq.accent,onCommit:e=>a({accent:e})}),(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pl-9`,children:jq.map(t=>(0,R.jsxs)(`button`,{type:`button`,"aria-pressed":(e.accent??Mq.accent)===t.swatch,onClick:()=>void a({accent:t.swatch===Mq.accent?null:t.swatch}).catch(()=>void 0),className:`flex items-center gap-1.5 rounded-md border border-border px-2 py-1 text-xs hover:bg-muted aria-pressed:border-primary aria-pressed:bg-accent aria-pressed:font-bold`,children:[(0,R.jsx)(`span`,{className:`size-3.5 rounded-full ring-1 ring-foreground/20`,style:{background:t.swatch},"aria-hidden":!0}),t.label]},t.swatch))}),(0,R.jsx)(`p`,{className:`pl-9 text-xs text-muted-foreground`,children:U(`Links, números dos passos e marcações dos prints.`)})]}),(0,R.jsx)(kq,{label:U(`Cor de realce`),value:e.highlight,fallback:Mq.highlight,onCommit:e=>a({highlight:e})}),(0,R.jsx)(`p`,{className:`-mt-1 pl-9 text-xs text-muted-foreground`,children:U(`Capa, “Resultado:” e destaques nas imagens.`)}),(0,R.jsx)(`div`,{className:`mt-1 grid gap-2.5`,children:Pq.map(({slot:t,label:n})=>(0,R.jsx)(kq,{label:n,value:e.headings?.[t],fallback:Mq.heading,onCommit:e=>a({headings:{[t]:e}})},t))}),i.length>0&&(0,R.jsxs)(`div`,{className:`mt-1 grid gap-3`,children:[(0,R.jsx)(Aq,{label:U(`Fonte do texto`),fonts:i.filter(e=>e.italic),value:e.fonts?.text,fallback:Nq.text,onChange:e=>o({fonts:{text:e}})}),(0,R.jsx)(Aq,{label:U(`Fonte dos títulos`),fonts:i,value:e.fonts?.headings,fallback:Nq.headings,onChange:e=>o({fonts:{headings:e}})})]}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:U(`Texto, títulos e destaque precisam de contraste de 4,5:1 com o branco para a leitura ficar nítida.`)})]})]})}var Iq=[{id:`html`,label:U(`Site (HTML)`),hint:U(`Um arquivo para publicar ou abrir no navegador.`),ext:`.html`},{id:`pdf`,label:`PDF`,hint:U(`Para imprimir ou mandar por e-mail.`),ext:`.pdf`},{id:`markdown`,label:U(`Markdown para IA`),hint:U(`Um arquivo só, com a legenda dos prints em texto.`),ext:`.md`}];function Lq(){let e=zg(),[t,n]=(0,_.useState)(`html`),[r,i]=(0,_.useState)(!1),a=Dg(e.manual?.pages??[]).filter(e=>[`aprovado`,`publicado`].includes(e.status)).length,o=r&&a>0,[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(null),p=async()=>{c(!0),f(null),u(null);try{u(await e.exportManual(t,o))}catch(e){f(W(e,U(`Não foi possível exportar o manual.`)))}finally{c(!1)}};return(0,R.jsxs)(sg,{onOpenChange:e=>{e&&!s&&(u(null),f(null))},children:[(0,R.jsx)(cg,{asChild:!0,children:(0,R.jsx)($d,{className:`font-semibold [@media(pointer:coarse)]:h-11`,children:U(`Exportar manual`)})}),(0,R.jsxs)(dg,{className:`max-h-[90vh] overflow-y-auto sm:max-w-lg`,"aria-busy":s,showCloseButton:!s,onEscapeKeyDown:e=>s&&e.preventDefault(),onPointerDownOutside:e=>s&&e.preventDefault(),onInteractOutside:e=>s&&e.preventDefault(),children:[(0,R.jsxs)(fg,{children:[(0,R.jsx)(mg,{className:`font-display text-xl font-extrabold tracking-tight`,children:U(`Exportar manual`)}),(0,R.jsx)(hg,{children:U(`Cada página entra com a "Versão do manual" ou, sem ela, com o texto atual.`)})]}),(0,R.jsxs)(`fieldset`,{className:`grid gap-2`,disabled:s,children:[(0,R.jsx)(`legend`,{className:`mb-2 rotulo`,children:U(`Formato`)}),Iq.map(({id:e,label:r,hint:i,ext:a})=>(0,R.jsxs)(`label`,{className:L(`flex cursor-pointer items-start gap-3 rounded-md border px-3 py-2.5 has-focus-visible:outline-2 has-focus-visible:outline-ring`,t===e?`border-primary bg-accent`:`border-border hover:bg-muted`),children:[(0,R.jsx)(`input`,{type:`radio`,name:`formato`,value:e,checked:t===e,onChange:()=>n(e),className:`sr-only`}),(0,R.jsx)(`span`,{className:`w-14 shrink-0 font-mono text-lg leading-tight font-medium text-primary`,"aria-hidden":!0,children:a}),(0,R.jsxs)(`span`,{className:`grid leading-tight`,children:[(0,R.jsx)(`span`,{className:`text-sm font-bold`,children:r}),(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i})]})]},e))]}),(0,R.jsxs)(`label`,{className:L(`flex items-start gap-2.5 text-sm`,a===0&&`opacity-60`),children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:o,disabled:a===0,onChange:e=>i(e.target.checked),className:`mt-0.5 size-4 accent-[var(--primary)]`}),(0,R.jsxs)(`span`,{className:`grid leading-tight`,children:[(0,R.jsx)(`span`,{className:`font-bold`,children:U(`Só páginas aprovadas`)}),(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:a===0?U(`Nenhuma página está aprovada ou publicada. Aprove uma página para usar esta opção.`):lf(a,`{n} página aprovada ou publicada neste manual. As outras ficam de fora.`,`{n} páginas aprovadas ou publicadas neste manual. As outras ficam de fora.`)})]})]}),t!==`markdown`&&e.manual&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Dq,{slug:e.manual.slug,logo:e.manual.theme.logo,disabled:s}),(0,R.jsx)(Fq,{theme:e.manual.theme})]}),d&&(0,R.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:d}),(0,R.jsx)(Tq,{busy:s,format:t,formatLabel:Iq.find(e=>e.id===(l?.format??t))?.label??t,result:l}),(0,R.jsx)(pg,{children:(0,R.jsxs)($d,{onClick:()=>void p(),disabled:s,className:`[@media(pointer:coarse)]:h-11`,children:[s&&(0,R.jsx)(xm,{className:`animate-spin motion-reduce:animate-none`,"aria-hidden":!0}),s?wq(t):U(d?`Tentar de novo`:`Exportar`)]})})]})]})}function Rq({onUseCurrent:e}){return(0,R.jsxs)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:[U(`O manual final usa a Versão do manual desta página. O que você escrever aqui só entra nele quando você voltar para o texto atual.`),` `,(0,R.jsx)(`button`,{type:`button`,onClick:e,className:`rounded-sm font-bold text-primary underline underline-offset-2 hover:no-underline`,children:U(`Usar o texto atual`)})]})}function zq({slug:e,version:t}){let n=gN({extensions:mG(hF.configure({slug:e})),content:CF(e,t.body),contentType:`markdown`,editable:!1,editorProps:{attributes:{"aria-label":U(`Texto da versão {nome}`,{nome:t.note||U(`sem nome`)})}}},[t.id]);return(0,R.jsxs)(`div`,{className:`rounded-md border border-border bg-card px-5 py-4`,children:[(0,R.jsx)(`p`,{className:`mb-2 font-display text-2xl font-extrabold tracking-tight`,children:t.title||U(`Sem título`)}),t.body.trim()?(0,R.jsx)(lN,{editor:n,className:`editor-content [&_.tiptap]:min-h-0!`}):(0,R.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:U(`Esta versão não tem texto.`)})]})}var Bq=e=>U(e||`Versão sem nome`),Vq=e=>new Date(e).toLocaleString(sf,{dateStyle:`short`,timeStyle:`short`});function Hq({slug:e,pageId:t,onSave:n,onRestore:r,onPublish:i,pinned:a}){let[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(``),[m,h]=(0,_.useState)(null),g=()=>{d(null),vf.listVersions(e,t).then(l,e=>d(W(e)))},v=e=>d(W(e)),y=async e=>{e.preventDefault(),await n(f),p(``),g()},b=async e=>{await r(e),s(!1)},x=e=>i(e).then(g),S=n=>vf.getVersion(e,t,n).then(h,v);return(0,R.jsxs)(sg,{open:o,onOpenChange:e=>{s(e),h(null),e&&g()},children:[(0,R.jsx)(cg,{asChild:!0,children:(0,R.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1.5 rounded-md px-2 py-1 text-[13px] [@media(pointer:coarse)]:min-h-11 text-muted-foreground hover:bg-muted hover:text-foreground`,children:[U(`Versões`),a&&(0,R.jsx)(`span`,{className:`rounded-sm bg-marca px-1 text-[11px] font-bold text-[#151a33]`,children:U(`Versão do manual`)})]})}),(0,R.jsxs)(dg,{className:`grid max-h-[90vh] w-[min(96vw,46rem)] max-w-none grid-rows-[auto_auto_minmax(0,1fr)] gap-4 sm:max-w-none`,children:[(0,R.jsxs)(fg,{children:[(0,R.jsx)(mg,{className:`font-display text-xl font-extrabold tracking-tight`,children:U(`Versões desta página`)}),(0,R.jsx)(hg,{children:U(`Guarde o texto como está agora para voltar a ele depois. A "Versão do manual" é a que vai para o manual final. Sem ela, vale o texto atual.`)})]}),(0,R.jsxs)(`form`,{onSubmit:e=>void y(e),className:`flex gap-2`,children:[(0,R.jsx)(ag,{value:f,onChange:e=>p(e.target.value),maxLength:200,placeholder:U(`Nome da versão (opcional), ex.: Revisada pelo suporte`),"aria-label":U(`Nome da versão (opcional)`)}),(0,R.jsx)($d,{type:`submit`,children:U(`Guardar versão`)})]}),(0,R.jsxs)(`div`,{className:`min-h-0 overflow-y-auto`,children:[u&&(0,R.jsx)(`p`,{className:`pb-2 text-sm text-destructive`,children:u}),m?(0,R.jsxs)(`div`,{className:`grid gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsxs)($d,{variant:`ghost`,size:`sm`,onClick:()=>h(null),children:[(0,R.jsx)(Gf,{"aria-hidden":!0}),` `,U(`Voltar à lista`)]}),(0,R.jsx)(`span`,{className:`flex-1 truncate text-sm font-bold`,children:Bq(m.note)}),(0,R.jsxs)($d,{variant:`outline`,size:`sm`,onClick:()=>void b(m.id),children:[(0,R.jsx)(Gm,{"aria-hidden":!0}),` `,U(`Restaurar esta`)]})]}),(0,R.jsx)(zq,{slug:e,version:m})]}):c===null?!u&&(0,R.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:U(`Carregando…`)}):c.length===0?(0,R.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:U(`Nenhuma versão guardada ainda.`)}):(0,R.jsx)(`ul`,{className:`grid gap-1`,children:c.map(e=>(0,R.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 rounded-md px-2 py-2 hover:bg-muted`,children:[(0,R.jsxs)(`span`,{className:`grid min-w-0 flex-1 leading-tight`,children:[(0,R.jsxs)(`span`,{className:`flex items-center gap-2 text-sm`,children:[(0,R.jsx)(`span`,{className:`truncate`,children:Bq(e.note)}),e.published&&(0,R.jsx)(`span`,{className:`shrink-0 rounded-sm bg-marca px-1.5 py-0.5 text-xs font-bold text-[#151a33]`,children:U(`Versão do manual`)})]}),(0,R.jsxs)(`span`,{className:`text-xs text-muted-foreground`,title:Vq(e.savedAt),children:[x_(e.savedAt),` · `,e.title||U(`Sem título`)]})]}),(0,R.jsxs)($d,{variant:`ghost`,size:`sm`,onClick:()=>void S(e.id),children:[(0,R.jsx)(jp,{"aria-hidden":!0}),` `,U(`Ver`)]}),(0,R.jsxs)($d,{variant:`ghost`,size:`sm`,onClick:()=>void b(e.id),children:[(0,R.jsx)(Gm,{"aria-hidden":!0}),` `,U(`Restaurar`)]}),(0,R.jsxs)($d,{variant:`ghost`,size:`sm`,onClick:()=>void x(e.published?null:e.id),children:[(0,R.jsx)(rp,{"aria-hidden":!0}),` `,e.published?U(`Tirar do manual`):U(`Usar no manual`)]})]},e.id))})]})]})]})}function Uq({initialTitle:e,onChange:t,onEnter:n}){let r=(0,_.useRef)(null),i=(0,_.useCallback)(()=>{let e=r.current;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight+e.offsetHeight-e.clientHeight}px`)},[]);return(0,_.useLayoutEffect)(i,[i]),(0,_.useEffect)(()=>{let e=r.current;if(!e||(document.fonts?.ready.then(i),typeof ResizeObserver>`u`))return;let t=e.offsetWidth,n=new ResizeObserver(()=>{e.offsetWidth!==t&&(t=e.offsetWidth,i())});return n.observe(e),()=>n.disconnect()},[i]),(0,R.jsx)(`textarea`,{name:`title`,ref:r,rows:1,"aria-label":U(`Título da página`),defaultValue:e,placeholder:U(`Sem título`),autoFocus:e===``,onChange:e=>{let n=e.target.value.replace(/\s*\n\s*/g,` `);n!==e.target.value&&(e.target.value=n),i(),t(n)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),n())},className:`block w-full resize-none overflow-hidden border-b-2 border-transparent bg-transparent pb-1 font-display text-[2.125rem] leading-tight font-extrabold tracking-tight text-balance [font-stretch:105%] outline-none transition-colors placeholder:text-muted-foreground focus-visible:border-primary`})}var Wq=e=>e.toLocaleTimeString(sf,{hour:`2-digit`,minute:`2-digit`});function Gq({path:e,state:t,savedAt:n,onRetry:r}){return(0,R.jsxs)(`footer`,{className:`sticky bottom-0 z-10 flex min-h-(--rodape-h) flex-wrap items-center justify-between gap-x-4 gap-y-0.5 border-t border-border bg-background/95 px-4 py-0.5 text-[13px] min-[31.25rem]:flex-nowrap min-[31.25rem]:px-8 min-[31.25rem]:py-0 backdrop-blur-sm`,children:[(0,R.jsx)(`span`,{className:`flex min-w-0 basis-full items-center gap-2 text-muted-foreground min-[31.25rem]:basis-auto`,children:(0,R.jsx)(`span`,{className:`truncate font-mono text-xs`,title:e,children:e})}),(0,R.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5 min-[31.25rem]:shrink-0 min-[31.25rem]:flex-nowrap`,role:`status`,"aria-live":`polite`,children:[t===`saving`&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(xm,{className:`size-3.5 animate-spin text-muted-foreground`,"aria-hidden":!0}),` `,U(`Salvando…`)]}),t===`saved`&&n&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(ap,{className:`size-3.5 text-primary`,"aria-hidden":!0}),` `,U(`Salvo às {hora}`,{hora:Wq(n)})]}),t===`idle`&&(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:U(`Tudo salvo no disco`)}),t===`conflict`&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(pp,{className:`size-3.5 text-destructive`,"aria-hidden":!0}),(0,R.jsx)(`span`,{className:`text-destructive`,children:U(`Aguardando sua escolha`)})]}),t===`error`&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(pp,{className:`size-3.5 text-destructive`,"aria-hidden":!0}),(0,R.jsx)(`span`,{className:`text-destructive`,children:U(`Não foi possível salvar. O texto continua na tela.`)}),(0,R.jsx)(`button`,{type:`button`,onClick:r,className:`font-bold text-primary underline-offset-2 hover:underline [@media(pointer:coarse)]:min-h-11 [@media(pointer:coarse)]:min-w-11`,children:U(`Tentar de novo`)})]})]})]})}var Kq=`grid flex-1 [--medida:52rem] 2xl:[--medida:60rem] min-[1920px]:[--medida:68rem] xl:grid-cols-[minmax(0,1fr)_minmax(0,var(--medida))_minmax(14rem,1fr)]`;function qq({manual:e,page:t}){let n=zg(),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(t.title),s=xq(r),c=!!bg(e.pages,t.id)?.published,l=[{key:e.slug,name:e.title},...Eg(e.pages,t.id).map(e=>({key:e.id,name:e.title||U(`Sem título`)}))];return(0,R.jsxs)(`div`,{className:`flex flex-1 flex-col`,children:[(0,R.jsxs)(`div`,{className:Kq,children:[(0,R.jsxs)(`article`,{lang:e.language,className:`mx-auto w-full max-w-[var(--medida)] min-w-0 px-5 pt-6 pb-24 sm:px-8 xl:col-start-2`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,R.jsx)(`nav`,{"aria-label":U(`Caminho da página`),className:`mr-2 flex min-w-0 basis-full flex-wrap items-center gap-1 text-[13px] text-muted-foreground sm:basis-0 sm:flex-1`,children:l.map(({key:e,name:t},n)=>(0,R.jsxs)(_.Fragment,{children:[n>0&&(0,R.jsx)(lp,{className:`size-3.5`,"aria-hidden":!0}),(0,R.jsx)(`span`,{className:`max-w-60 truncate`,children:t})]},e))}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 sm:ml-auto sm:justify-end`,children:[(0,R.jsx)(Hq,{slug:e.slug,pageId:t.id,pinned:c,onSave:n.saveVersion,onRestore:n.restoreVersion,onPublish:n.publishVersion}),(0,R.jsx)(r_,{status:t.status,onChange:e=>void n.setPageStatus(e)}),r&&s.length>0&&(0,R.jsx)(Cq,{editor:r,headings:s}),e.pages.length>0&&(0,R.jsx)(Lq,{})]})]}),c&&(0,R.jsx)(Rq,{onUseCurrent:()=>void n.publishVersion(null)}),(0,R.jsx)(`h1`,{className:`sr-only`,children:a||U(`Sem título`)}),(0,R.jsx)(`div`,{className:`mt-3 mb-3`,children:(0,R.jsx)(Uq,{initialTitle:t.title,onChange:e=>{o(e),n.editPage({title:e})},onEnter:()=>r?.commands.focus(`start`)})}),(0,R.jsx)(yq,{slug:e.slug,initialMarkdown:t.body,pages:e.pages,onChange:e=>n.editPage({body:e}),onError:n.reportError,onReady:i})]}),r&&s.length>0&&(0,R.jsx)(`aside`,{className:`sticky top-0 hidden max-h-svh w-56 self-start overflow-y-auto pt-24 pr-6 xl:block`,children:(0,R.jsx)(Sq,{editor:r,headings:s})})]}),(0,R.jsx)(Gq,{path:`${e.slug}/${t.file}`,state:n.save.state,savedAt:n.save.savedAt,onRetry:()=>void n.save.retry()})]})}function Jq(){return(0,R.jsx)(Rg,{children:(0,R.jsx)(Yq,{})})}function Yq(){let e=zg(),t=A_(),n=c_(),[r,i]=(0,_.useState)(!1),{manuals:a,manual:o,page:s,bootError:c,notFound:l,openError:u}=e;if(a===null)return e.serverDown?(0,R.jsx)(ig,{attempt:e.reconnect.attempt,checking:e.reconnect.checking,onRetry:e.reconnect.retryNow,code:Tf(c)}):c?(0,R.jsx)(rg,{error:c,onRetry:()=>void e.reload()}):(0,R.jsx)(`div`,{className:`grid h-full place-items-center text-muted-foreground`,children:U(`Abrindo o Studio…`)});let d=a.length===0;return l&&!d&&!e.creatingManual?(0,R.jsx)(ng,{kind:l.kind,address:l.address,action:l.kind===`page`&&o?{label:U(`Abrir a primeira página`),onClick:()=>void e.openManual(o.slug)}:{label:U(`Abrir {nome}`,{nome:a[0]?.title??``}),onClick:()=>void e.openManual(a[0]?.slug??``)},secondary:{label:U(`Criar um manual novo`),onClick:()=>e.setCreatingManual(!0)}}):u&&!e.creatingManual?(0,R.jsx)(rg,{error:u.error,onRetry:()=>void e.openManual(u.slug)}):(0,R.jsxs)(Yh,{delayDuration:400,children:[(0,R.jsxs)(`div`,{className:`flex h-full`,children:[!d&&(0,R.jsx)(V_,{sidebar:n,onSearch:()=>i(!0)}),(0,R.jsxs)(`main`,{className:`flex h-full min-w-0 flex-1 flex-col overflow-y-auto`,children:[!d&&(0,R.jsx)(H_,{title:o?.title??``,onOpen:()=>n.setDrawerOpen(!0),drawerOpen:n.drawerOpen}),e.serverDown&&(0,R.jsx)($h,{checking:e.reconnect.checking,onRetry:e.reconnect.retryNow}),e.diskConflict&&(0,R.jsx)(tg,{onReload:()=>e.resolveConflict(`reload`),onKeep:()=>e.resolveConflict(`keep`)}),d||e.creatingManual?(0,R.jsx)(og,{firstRun:d,onCreate:e.createManual,onCancel:()=>e.setCreatingManual(!1)}):o?s?(0,R.jsx)(Of,{resetKey:s.id,children:(0,R.jsx)(qq,{manual:o,page:s},`${s.id}:${e.revision}`)}):(0,R.jsx)(ef,{title:o.title,action:{label:U(`Criar a primeira página`),onClick:()=>void e.addPage(null)},children:U(`Uma página por tela ou tarefa do sistema funciona bem. Comece pela que as pessoas mais usam.`)}):null]})]}),o&&(0,R.jsx)(i_,{open:r,onOpenChange:i}),(0,R.jsx)(Jh,{theme:t,position:`bottom-right`,offset:{bottom:56,right:24}})]})}var Xq=document.getElementById(`root`);if(!Xq)throw Error(`index.html sem o elemento #root.`);document.documentElement.lang=sf,k_(),(0,v.createRoot)(Xq).render((0,R.jsx)(_.StrictMode,{children:(0,R.jsx)(Of,{root:!0,children:(0,R.jsx)(Jq,{})})}));
|