@valbuild/ui 0.68.2 → 0.69.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.
@@ -1,372 +0,0 @@
1
- var ZL=Object.defineProperty;var QS=e=>{throw TypeError(e)};var QL=(e,t,n)=>t in e?ZL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Et=(e,t,n)=>QL(e,typeof t!="symbol"?t+"":t,n),ek=(e,t,n)=>t.has(e)||QS("Cannot "+n);var te=(e,t,n)=>(ek(e,t,"read from private field"),n?n.call(e):t.get(e)),bn=(e,t,n)=>t.has(e)?QS("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),$e=(e,t,n,r)=>(ek(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);function e4(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const i=Object.getOwnPropertyDescriptor(r,o);i&&Object.defineProperty(e,o,i.get?i:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();var t4=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ia(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var OT={exports:{}},ze={};/**
2
- * @license React
3
- * react.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var Xf=Symbol.for("react.element"),n4=Symbol.for("react.portal"),r4=Symbol.for("react.fragment"),o4=Symbol.for("react.strict_mode"),i4=Symbol.for("react.profiler"),s4=Symbol.for("react.provider"),a4=Symbol.for("react.context"),l4=Symbol.for("react.forward_ref"),c4=Symbol.for("react.suspense"),u4=Symbol.for("react.memo"),d4=Symbol.for("react.lazy"),tk=Symbol.iterator;function f4(e){return e===null||typeof e!="object"?null:(e=tk&&e[tk]||e["@@iterator"],typeof e=="function"?e:null)}var NT={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},MT=Object.assign,PT={};function Xc(e,t,n){this.props=e,this.context=t,this.refs=PT,this.updater=n||NT}Xc.prototype.isReactComponent={};Xc.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Xc.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function RT(){}RT.prototype=Xc.prototype;function Rb(e,t,n){this.props=e,this.context=t,this.refs=PT,this.updater=n||NT}var jb=Rb.prototype=new RT;jb.constructor=Rb;MT(jb,Xc.prototype);jb.isPureReactComponent=!0;var nk=Array.isArray,jT=Object.prototype.hasOwnProperty,Ab={current:null},AT={key:!0,ref:!0,__self:!0,__source:!0};function IT(e,t,n){var r,o={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)jT.call(t,r)&&!AT.hasOwnProperty(r)&&(o[r]=t[r]);var a=arguments.length-2;if(a===1)o.children=n;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];o.children=l}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)o[r]===void 0&&(o[r]=a[r]);return{$$typeof:Xf,type:e,key:i,ref:s,props:o,_owner:Ab.current}}function p4(e,t){return{$$typeof:Xf,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Ib(e){return typeof e=="object"&&e!==null&&e.$$typeof===Xf}function h4(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var rk=/\/+/g;function Uv(e,t){return typeof e=="object"&&e!==null&&e.key!=null?h4(""+e.key):t.toString(36)}function mh(e,t,n,r,o){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var s=!1;if(e===null)s=!0;else switch(i){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case Xf:case n4:s=!0}}if(s)return s=e,o=o(s),e=r===""?"."+Uv(s,0):r,nk(o)?(n="",e!=null&&(n=e.replace(rk,"$&/")+"/"),mh(o,t,n,"",function(c){return c})):o!=null&&(Ib(o)&&(o=p4(o,n+(!o.key||s&&s.key===o.key?"":(""+o.key).replace(rk,"$&/")+"/")+e)),t.push(o)),1;if(s=0,r=r===""?".":r+":",nk(e))for(var a=0;a<e.length;a++){i=e[a];var l=r+Uv(i,a);s+=mh(i,t,n,l,o)}else if(l=f4(e),typeof l=="function")for(e=l.call(e),a=0;!(i=e.next()).done;)i=i.value,l=r+Uv(i,a++),s+=mh(i,t,n,l,o);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return s}function Ip(e,t,n){if(e==null)return e;var r=[],o=0;return mh(e,r,"","",function(i){return t.call(n,i,o++)}),r}function m4(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Wn={current:null},gh={transition:null},g4={ReactCurrentDispatcher:Wn,ReactCurrentBatchConfig:gh,ReactCurrentOwner:Ab};function DT(){throw Error("act(...) is not supported in production builds of React.")}ze.Children={map:Ip,forEach:function(e,t,n){Ip(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Ip(e,function(){t++}),t},toArray:function(e){return Ip(e,function(t){return t})||[]},only:function(e){if(!Ib(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ze.Component=Xc;ze.Fragment=r4;ze.Profiler=i4;ze.PureComponent=Rb;ze.StrictMode=o4;ze.Suspense=c4;ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=g4;ze.act=DT;ze.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=MT({},e.props),o=e.key,i=e.ref,s=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,s=Ab.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)jT.call(t,l)&&!AT.hasOwnProperty(l)&&(r[l]=t[l]===void 0&&a!==void 0?a[l]:t[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];r.children=a}return{$$typeof:Xf,type:e.type,key:o,ref:i,props:r,_owner:s}};ze.createContext=function(e){return e={$$typeof:a4,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:s4,_context:e},e.Consumer=e};ze.createElement=IT;ze.createFactory=function(e){var t=IT.bind(null,e);return t.type=e,t};ze.createRef=function(){return{current:null}};ze.forwardRef=function(e){return{$$typeof:l4,render:e}};ze.isValidElement=Ib;ze.lazy=function(e){return{$$typeof:d4,_payload:{_status:-1,_result:e},_init:m4}};ze.memo=function(e,t){return{$$typeof:u4,type:e,compare:t===void 0?null:t}};ze.startTransition=function(e){var t=gh.transition;gh.transition={};try{e()}finally{gh.transition=t}};ze.unstable_act=DT;ze.useCallback=function(e,t){return Wn.current.useCallback(e,t)};ze.useContext=function(e){return Wn.current.useContext(e)};ze.useDebugValue=function(){};ze.useDeferredValue=function(e){return Wn.current.useDeferredValue(e)};ze.useEffect=function(e,t){return Wn.current.useEffect(e,t)};ze.useId=function(){return Wn.current.useId()};ze.useImperativeHandle=function(e,t,n){return Wn.current.useImperativeHandle(e,t,n)};ze.useInsertionEffect=function(e,t){return Wn.current.useInsertionEffect(e,t)};ze.useLayoutEffect=function(e,t){return Wn.current.useLayoutEffect(e,t)};ze.useMemo=function(e,t){return Wn.current.useMemo(e,t)};ze.useReducer=function(e,t,n){return Wn.current.useReducer(e,t,n)};ze.useRef=function(e){return Wn.current.useRef(e)};ze.useState=function(e){return Wn.current.useState(e)};ze.useSyncExternalStore=function(e,t,n){return Wn.current.useSyncExternalStore(e,t,n)};ze.useTransition=function(){return Wn.current.useTransition()};ze.version="18.3.1";OT.exports=ze;var g=OT.exports;const ge=ia(g),v4=e4({__proto__:null,default:ge},[g]);var Yh={},LT={exports:{}},Rr={},FT={exports:{}},zT={};/**
10
- * @license React
11
- * scheduler.production.min.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */(function(e){function t(E,A){var P=E.length;E.push(A);e:for(;0<P;){var I=P-1>>>1,U=E[I];if(0<o(U,A))E[I]=A,E[P]=U,P=I;else break e}}function n(E){return E.length===0?null:E[0]}function r(E){if(E.length===0)return null;var A=E[0],P=E.pop();if(P!==A){E[0]=P;e:for(var I=0,U=E.length,me=U>>>1;I<me;){var ee=2*(I+1)-1,ve=E[ee],q=ee+1,$=E[q];if(0>o(ve,P))q<U&&0>o($,ve)?(E[I]=$,E[q]=P,I=q):(E[I]=ve,E[ee]=P,I=ee);else if(q<U&&0>o($,P))E[I]=$,E[q]=P,I=q;else break e}}return A}function o(E,A){var P=E.sortIndex-A.sortIndex;return P!==0?P:E.id-A.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var l=[],c=[],u=1,d=null,f=3,h=!1,m=!1,v=!1,x=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(E){for(var A=n(c);A!==null;){if(A.callback===null)r(c);else if(A.startTime<=E)r(c),A.sortIndex=A.expirationTime,t(l,A);else break;A=n(c)}}function k(E){if(v=!1,S(E),!m)if(n(l)!==null)m=!0,R(C);else{var A=n(c);A!==null&&N(k,A.startTime-E)}}function C(E,A){m=!1,v&&(v=!1,b(O),O=-1),h=!0;var P=f;try{for(S(A),d=n(l);d!==null&&(!(d.expirationTime>A)||E&&!L());){var I=d.callback;if(typeof I=="function"){d.callback=null,f=d.priorityLevel;var U=I(d.expirationTime<=A);A=e.unstable_now(),typeof U=="function"?d.callback=U:d===n(l)&&r(l),S(A)}else r(l);d=n(l)}if(d!==null)var me=!0;else{var ee=n(c);ee!==null&&N(k,ee.startTime-A),me=!1}return me}finally{d=null,f=P,h=!1}}var T=!1,_=null,O=-1,M=5,j=-1;function L(){return!(e.unstable_now()-j<M)}function B(){if(_!==null){var E=e.unstable_now();j=E;var A=!0;try{A=_(!0,E)}finally{A?J():(T=!1,_=null)}}else T=!1}var J;if(typeof w=="function")J=function(){w(B)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,H=z.port2;z.port1.onmessage=B,J=function(){H.postMessage(null)}}else J=function(){x(B,0)};function R(E){_=E,T||(T=!0,J())}function N(E,A){O=x(function(){E(e.unstable_now())},A)}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_continueExecution=function(){m||h||(m=!0,R(C))},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"):M=0<E?Math.floor(1e3/E):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(E){switch(f){case 1:case 2:case 3:var A=3;break;default:A=f}var P=f;f=A;try{return E()}finally{f=P}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(E,A){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var P=f;f=E;try{return A()}finally{f=P}},e.unstable_scheduleCallback=function(E,A,P){var I=e.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?I+P:I):P=I,E){case 1:var U=-1;break;case 2:U=250;break;case 5:U=1073741823;break;case 4:U=1e4;break;default:U=5e3}return U=P+U,E={id:u++,callback:A,priorityLevel:E,startTime:P,expirationTime:U,sortIndex:-1},P>I?(E.sortIndex=P,t(c,E),n(l)===null&&E===n(c)&&(v?(b(O),O=-1):v=!0,N(k,P-I))):(E.sortIndex=U,t(l,E),m||h||(m=!0,R(C))),E},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(E){var A=f;return function(){var P=f;f=A;try{return E.apply(this,arguments)}finally{f=P}}}})(zT);FT.exports=zT;var y4=FT.exports;/**
18
- * @license React
19
- * react-dom.production.min.js
20
- *
21
- * Copyright (c) Facebook, Inc. and its affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */var x4=g,Or=y4;function W(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;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."}var $T=new Set,$d={};function pl(e,t){wc(e,t),wc(e+"Capture",t)}function wc(e,t){for($d[e]=t,e=0;e<t.length;e++)$T.add(t[e])}var Ni=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),hx=Object.prototype.hasOwnProperty,b4=/^[: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]*$/,ok={},ik={};function w4(e){return hx.call(ik,e)?!0:hx.call(ok,e)?!1:b4.test(e)?ik[e]=!0:(ok[e]=!0,!1)}function S4(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function k4(e,t,n,r){if(t===null||typeof t>"u"||S4(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Hn(e,t,n,r,o,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var pn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){pn[e]=new Hn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];pn[t]=new Hn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){pn[e]=new Hn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){pn[e]=new Hn(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){pn[e]=new Hn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){pn[e]=new Hn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){pn[e]=new Hn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){pn[e]=new Hn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){pn[e]=new Hn(e,5,!1,e.toLowerCase(),null,!1,!1)});var Db=/[\-:]([a-z])/g;function Lb(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Db,Lb);pn[t]=new Hn(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Db,Lb);pn[t]=new Hn(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Db,Lb);pn[t]=new Hn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){pn[e]=new Hn(e,1,!1,e.toLowerCase(),null,!1,!1)});pn.xlinkHref=new Hn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){pn[e]=new Hn(e,1,!1,e.toLowerCase(),null,!0,!0)});function Fb(e,t,n,r){var o=pn.hasOwnProperty(t)?pn[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(k4(t,n,o,r)&&(n=null),r||o===null?w4(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=n===null?o.type===3?!1:"":n:(t=o.attributeName,r=o.attributeNamespace,n===null?e.removeAttribute(t):(o=o.type,n=o===3||o===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var zi=x4.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Dp=Symbol.for("react.element"),Ul=Symbol.for("react.portal"),Wl=Symbol.for("react.fragment"),zb=Symbol.for("react.strict_mode"),mx=Symbol.for("react.profiler"),BT=Symbol.for("react.provider"),VT=Symbol.for("react.context"),$b=Symbol.for("react.forward_ref"),gx=Symbol.for("react.suspense"),vx=Symbol.for("react.suspense_list"),Bb=Symbol.for("react.memo"),us=Symbol.for("react.lazy"),UT=Symbol.for("react.offscreen"),sk=Symbol.iterator;function Su(e){return e===null||typeof e!="object"?null:(e=sk&&e[sk]||e["@@iterator"],typeof e=="function"?e:null)}var xt=Object.assign,Wv;function $u(e){if(Wv===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Wv=t&&t[1]||""}return`
26
- `+Wv+e}var Hv=!1;function Kv(e,t){if(!e||Hv)return"";Hv=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var o=c.stack.split(`
27
- `),i=r.stack.split(`
28
- `),s=o.length-1,a=i.length-1;1<=s&&0<=a&&o[s]!==i[a];)a--;for(;1<=s&&0<=a;s--,a--)if(o[s]!==i[a]){if(s!==1||a!==1)do if(s--,a--,0>a||o[s]!==i[a]){var l=`
29
- `+o[s].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}while(1<=s&&0<=a);break}}}finally{Hv=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?$u(e):""}function C4(e){switch(e.tag){case 5:return $u(e.type);case 16:return $u("Lazy");case 13:return $u("Suspense");case 19:return $u("SuspenseList");case 0:case 2:case 15:return e=Kv(e.type,!1),e;case 11:return e=Kv(e.type.render,!1),e;case 1:return e=Kv(e.type,!0),e;default:return""}}function yx(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Wl:return"Fragment";case Ul:return"Portal";case mx:return"Profiler";case zb:return"StrictMode";case gx:return"Suspense";case vx:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case VT:return(e.displayName||"Context")+".Consumer";case BT:return(e._context.displayName||"Context")+".Provider";case $b:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Bb:return t=e.displayName||null,t!==null?t:yx(e.type)||"Memo";case us:t=e._payload,e=e._init;try{return yx(e(t))}catch{}}return null}function E4(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return yx(t);case 8:return t===zb?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ws(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function WT(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function _4(e){var t=WT(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Lp(e){e._valueTracker||(e._valueTracker=_4(e))}function HT(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=WT(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Jh(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function xx(e,t){var n=t.checked;return xt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ak(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ws(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function KT(e,t){t=t.checked,t!=null&&Fb(e,"checked",t,!1)}function bx(e,t){KT(e,t);var n=Ws(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?wx(e,t.type,n):t.hasOwnProperty("defaultValue")&&wx(e,t.type,Ws(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function lk(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function wx(e,t,n){(t!=="number"||Jh(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Bu=Array.isArray;function rc(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Ws(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,r&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function Sx(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(W(91));return xt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function ck(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(W(92));if(Bu(n)){if(1<n.length)throw Error(W(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Ws(n)}}function qT(e,t){var n=Ws(t.value),r=Ws(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function uk(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function GT(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function kx(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?GT(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Fp,YT=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,o)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Fp=Fp||document.createElement("div"),Fp.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Fp.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Bd(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var wd={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},T4=["Webkit","ms","Moz","O"];Object.keys(wd).forEach(function(e){T4.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),wd[t]=wd[e]})});function JT(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||wd.hasOwnProperty(e)&&wd[e]?(""+t).trim():t+"px"}function XT(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=JT(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var O4=xt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Cx(e,t){if(t){if(O4[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(W(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(W(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(W(61))}if(t.style!=null&&typeof t.style!="object")throw Error(W(62))}}function Ex(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var _x=null;function Vb(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Tx=null,oc=null,ic=null;function dk(e){if(e=ep(e)){if(typeof Tx!="function")throw Error(W(280));var t=e.stateNode;t&&(t=Og(t),Tx(e.stateNode,e.type,t))}}function ZT(e){oc?ic?ic.push(e):ic=[e]:oc=e}function QT(){if(oc){var e=oc,t=ic;if(ic=oc=null,dk(e),t)for(e=0;e<t.length;e++)dk(t[e])}}function eO(e,t){return e(t)}function tO(){}var qv=!1;function nO(e,t,n){if(qv)return e(t,n);qv=!0;try{return eO(e,t,n)}finally{qv=!1,(oc!==null||ic!==null)&&(tO(),QT())}}function Vd(e,t){var n=e.stateNode;if(n===null)return null;var r=Og(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(W(231,t,typeof n));return n}var Ox=!1;if(Ni)try{var ku={};Object.defineProperty(ku,"passive",{get:function(){Ox=!0}}),window.addEventListener("test",ku,ku),window.removeEventListener("test",ku,ku)}catch{Ox=!1}function N4(e,t,n,r,o,i,s,a,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(u){this.onError(u)}}var Sd=!1,Xh=null,Zh=!1,Nx=null,M4={onError:function(e){Sd=!0,Xh=e}};function P4(e,t,n,r,o,i,s,a,l){Sd=!1,Xh=null,N4.apply(M4,arguments)}function R4(e,t,n,r,o,i,s,a,l){if(P4.apply(this,arguments),Sd){if(Sd){var c=Xh;Sd=!1,Xh=null}else throw Error(W(198));Zh||(Zh=!0,Nx=c)}}function hl(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function rO(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 fk(e){if(hl(e)!==e)throw Error(W(188))}function j4(e){var t=e.alternate;if(!t){if(t=hl(e),t===null)throw Error(W(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(o===null)break;var i=o.alternate;if(i===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===n)return fk(o),e;if(i===r)return fk(o),t;i=i.sibling}throw Error(W(188))}if(n.return!==r.return)n=o,r=i;else{for(var s=!1,a=o.child;a;){if(a===n){s=!0,n=o,r=i;break}if(a===r){s=!0,r=o,n=i;break}a=a.sibling}if(!s){for(a=i.child;a;){if(a===n){s=!0,n=i,r=o;break}if(a===r){s=!0,r=i,n=o;break}a=a.sibling}if(!s)throw Error(W(189))}}if(n.alternate!==r)throw Error(W(190))}if(n.tag!==3)throw Error(W(188));return n.stateNode.current===n?e:t}function oO(e){return e=j4(e),e!==null?iO(e):null}function iO(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=iO(e);if(t!==null)return t;e=e.sibling}return null}var sO=Or.unstable_scheduleCallback,pk=Or.unstable_cancelCallback,A4=Or.unstable_shouldYield,I4=Or.unstable_requestPaint,_t=Or.unstable_now,D4=Or.unstable_getCurrentPriorityLevel,Ub=Or.unstable_ImmediatePriority,aO=Or.unstable_UserBlockingPriority,Qh=Or.unstable_NormalPriority,L4=Or.unstable_LowPriority,lO=Or.unstable_IdlePriority,Cg=null,Ko=null;function F4(e){if(Ko&&typeof Ko.onCommitFiberRoot=="function")try{Ko.onCommitFiberRoot(Cg,e,void 0,(e.current.flags&128)===128)}catch{}}var ko=Math.clz32?Math.clz32:B4,z4=Math.log,$4=Math.LN2;function B4(e){return e>>>=0,e===0?32:31-(z4(e)/$4|0)|0}var zp=64,$p=4194304;function Vu(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function em(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var a=s&~o;a!==0?r=Vu(a):(i&=s,i!==0&&(r=Vu(i)))}else s=n&~o,s!==0?r=Vu(s):i!==0&&(r=Vu(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-ko(t),o=1<<n,r|=e[n],t&=~o;return r}function V4(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function U4(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes;0<i;){var s=31-ko(i),a=1<<s,l=o[s];l===-1?(!(a&n)||a&r)&&(o[s]=V4(a,t)):l<=t&&(e.expiredLanes|=a),i&=~a}}function Mx(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function cO(){var e=zp;return zp<<=1,!(zp&4194240)&&(zp=64),e}function Gv(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Zf(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ko(t),e[t]=n}function W4(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var o=31-ko(n),i=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~i}}function Wb(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-ko(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var Qe=0;function uO(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var dO,Hb,fO,pO,hO,Px=!1,Bp=[],Os=null,Ns=null,Ms=null,Ud=new Map,Wd=new Map,ms=[],H4="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function hk(e,t){switch(e){case"focusin":case"focusout":Os=null;break;case"dragenter":case"dragleave":Ns=null;break;case"mouseover":case"mouseout":Ms=null;break;case"pointerover":case"pointerout":Ud.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Wd.delete(t.pointerId)}}function Cu(e,t,n,r,o,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[o]},t!==null&&(t=ep(t),t!==null&&Hb(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function K4(e,t,n,r,o){switch(t){case"focusin":return Os=Cu(Os,e,t,n,r,o),!0;case"dragenter":return Ns=Cu(Ns,e,t,n,r,o),!0;case"mouseover":return Ms=Cu(Ms,e,t,n,r,o),!0;case"pointerover":var i=o.pointerId;return Ud.set(i,Cu(Ud.get(i)||null,e,t,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,Wd.set(i,Cu(Wd.get(i)||null,e,t,n,r,o)),!0}return!1}function mO(e){var t=Na(e.target);if(t!==null){var n=hl(t);if(n!==null){if(t=n.tag,t===13){if(t=rO(n),t!==null){e.blockedOn=t,hO(e.priority,function(){fO(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 vh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Rx(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);_x=r,n.target.dispatchEvent(r),_x=null}else return t=ep(n),t!==null&&Hb(t),e.blockedOn=n,!1;t.shift()}return!0}function mk(e,t,n){vh(e)&&n.delete(t)}function q4(){Px=!1,Os!==null&&vh(Os)&&(Os=null),Ns!==null&&vh(Ns)&&(Ns=null),Ms!==null&&vh(Ms)&&(Ms=null),Ud.forEach(mk),Wd.forEach(mk)}function Eu(e,t){e.blockedOn===t&&(e.blockedOn=null,Px||(Px=!0,Or.unstable_scheduleCallback(Or.unstable_NormalPriority,q4)))}function Hd(e){function t(o){return Eu(o,e)}if(0<Bp.length){Eu(Bp[0],e);for(var n=1;n<Bp.length;n++){var r=Bp[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Os!==null&&Eu(Os,e),Ns!==null&&Eu(Ns,e),Ms!==null&&Eu(Ms,e),Ud.forEach(t),Wd.forEach(t),n=0;n<ms.length;n++)r=ms[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<ms.length&&(n=ms[0],n.blockedOn===null);)mO(n),n.blockedOn===null&&ms.shift()}var sc=zi.ReactCurrentBatchConfig,tm=!0;function G4(e,t,n,r){var o=Qe,i=sc.transition;sc.transition=null;try{Qe=1,Kb(e,t,n,r)}finally{Qe=o,sc.transition=i}}function Y4(e,t,n,r){var o=Qe,i=sc.transition;sc.transition=null;try{Qe=4,Kb(e,t,n,r)}finally{Qe=o,sc.transition=i}}function Kb(e,t,n,r){if(tm){var o=Rx(e,t,n,r);if(o===null)oy(e,t,r,nm,n),hk(e,r);else if(K4(o,e,t,n,r))r.stopPropagation();else if(hk(e,r),t&4&&-1<H4.indexOf(e)){for(;o!==null;){var i=ep(o);if(i!==null&&dO(i),i=Rx(e,t,n,r),i===null&&oy(e,t,r,nm,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else oy(e,t,r,null,n)}}var nm=null;function Rx(e,t,n,r){if(nm=null,e=Vb(r),e=Na(e),e!==null)if(t=hl(e),t===null)e=null;else if(n=t.tag,n===13){if(e=rO(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 nm=e,null}function gO(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(D4()){case Ub:return 1;case aO:return 4;case Qh:case L4:return 16;case lO:return 536870912;default:return 16}default:return 16}}var ks=null,qb=null,yh=null;function vO(){if(yh)return yh;var e,t=qb,n=t.length,r,o="value"in ks?ks.value:ks.textContent,i=o.length;for(e=0;e<n&&t[e]===o[e];e++);var s=n-e;for(r=1;r<=s&&t[n-r]===o[i-r];r++);return yh=o.slice(e,1<r?1-r:void 0)}function xh(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 Vp(){return!0}function gk(){return!1}function jr(e){function t(n,r,o,i,s){this._reactName=n,this._targetInst=o,this.type=r,this.nativeEvent=i,this.target=s,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Vp:gk,this.isPropagationStopped=gk,this}return xt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Vp)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Vp)},persist:function(){},isPersistent:Vp}),t}var Zc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gb=jr(Zc),Qf=xt({},Zc,{view:0,detail:0}),J4=jr(Qf),Yv,Jv,_u,Eg=xt({},Qf,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Yb,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!==_u&&(_u&&e.type==="mousemove"?(Yv=e.screenX-_u.screenX,Jv=e.screenY-_u.screenY):Jv=Yv=0,_u=e),Yv)},movementY:function(e){return"movementY"in e?e.movementY:Jv}}),vk=jr(Eg),X4=xt({},Eg,{dataTransfer:0}),Z4=jr(X4),Q4=xt({},Qf,{relatedTarget:0}),Xv=jr(Q4),e3=xt({},Zc,{animationName:0,elapsedTime:0,pseudoElement:0}),t3=jr(e3),n3=xt({},Zc,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),r3=jr(n3),o3=xt({},Zc,{data:0}),yk=jr(o3),i3={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},s3={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"},a3={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function l3(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=a3[e])?!!t[e]:!1}function Yb(){return l3}var c3=xt({},Qf,{key:function(e){if(e.key){var t=i3[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=xh(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?s3[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Yb,charCode:function(e){return e.type==="keypress"?xh(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?xh(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),u3=jr(c3),d3=xt({},Eg,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),xk=jr(d3),f3=xt({},Qf,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Yb}),p3=jr(f3),h3=xt({},Zc,{propertyName:0,elapsedTime:0,pseudoElement:0}),m3=jr(h3),g3=xt({},Eg,{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}),v3=jr(g3),y3=[9,13,27,32],Jb=Ni&&"CompositionEvent"in window,kd=null;Ni&&"documentMode"in document&&(kd=document.documentMode);var x3=Ni&&"TextEvent"in window&&!kd,yO=Ni&&(!Jb||kd&&8<kd&&11>=kd),bk=" ",wk=!1;function xO(e,t){switch(e){case"keyup":return y3.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bO(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Hl=!1;function b3(e,t){switch(e){case"compositionend":return bO(t);case"keypress":return t.which!==32?null:(wk=!0,bk);case"textInput":return e=t.data,e===bk&&wk?null:e;default:return null}}function w3(e,t){if(Hl)return e==="compositionend"||!Jb&&xO(e,t)?(e=vO(),yh=qb=ks=null,Hl=!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 yO&&t.locale!=="ko"?null:t.data;default:return null}}var S3={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 Sk(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!S3[e.type]:t==="textarea"}function wO(e,t,n,r){ZT(r),t=rm(t,"onChange"),0<t.length&&(n=new Gb("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Cd=null,Kd=null;function k3(e){RO(e,0)}function _g(e){var t=Gl(e);if(HT(t))return e}function C3(e,t){if(e==="change")return t}var SO=!1;if(Ni){var Zv;if(Ni){var Qv="oninput"in document;if(!Qv){var kk=document.createElement("div");kk.setAttribute("oninput","return;"),Qv=typeof kk.oninput=="function"}Zv=Qv}else Zv=!1;SO=Zv&&(!document.documentMode||9<document.documentMode)}function Ck(){Cd&&(Cd.detachEvent("onpropertychange",kO),Kd=Cd=null)}function kO(e){if(e.propertyName==="value"&&_g(Kd)){var t=[];wO(t,Kd,e,Vb(e)),nO(k3,t)}}function E3(e,t,n){e==="focusin"?(Ck(),Cd=t,Kd=n,Cd.attachEvent("onpropertychange",kO)):e==="focusout"&&Ck()}function _3(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return _g(Kd)}function T3(e,t){if(e==="click")return _g(t)}function O3(e,t){if(e==="input"||e==="change")return _g(t)}function N3(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var To=typeof Object.is=="function"?Object.is:N3;function qd(e,t){if(To(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)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 o=n[r];if(!hx.call(t,o)||!To(e[o],t[o]))return!1}return!0}function Ek(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function _k(e,t){var n=Ek(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}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ek(n)}}function CO(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?CO(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function EO(){for(var e=window,t=Jh();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Jh(e.document)}return t}function Xb(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function M3(e){var t=EO(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&CO(n.ownerDocument.documentElement,n)){if(r!==null&&Xb(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!e.extend&&i>r&&(o=r,r=i,i=o),o=_k(n,i);var s=_k(n,r);o&&s&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var P3=Ni&&"documentMode"in document&&11>=document.documentMode,Kl=null,jx=null,Ed=null,Ax=!1;function Tk(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ax||Kl==null||Kl!==Jh(r)||(r=Kl,"selectionStart"in r&&Xb(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}),Ed&&qd(Ed,r)||(Ed=r,r=rm(jx,"onSelect"),0<r.length&&(t=new Gb("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Kl)))}function Up(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var ql={animationend:Up("Animation","AnimationEnd"),animationiteration:Up("Animation","AnimationIteration"),animationstart:Up("Animation","AnimationStart"),transitionend:Up("Transition","TransitionEnd")},ey={},_O={};Ni&&(_O=document.createElement("div").style,"AnimationEvent"in window||(delete ql.animationend.animation,delete ql.animationiteration.animation,delete ql.animationstart.animation),"TransitionEvent"in window||delete ql.transitionend.transition);function Tg(e){if(ey[e])return ey[e];if(!ql[e])return e;var t=ql[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in _O)return ey[e]=t[n];return e}var TO=Tg("animationend"),OO=Tg("animationiteration"),NO=Tg("animationstart"),MO=Tg("transitionend"),PO=new Map,Ok="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function sa(e,t){PO.set(e,t),pl(t,[e])}for(var ty=0;ty<Ok.length;ty++){var ny=Ok[ty],R3=ny.toLowerCase(),j3=ny[0].toUpperCase()+ny.slice(1);sa(R3,"on"+j3)}sa(TO,"onAnimationEnd");sa(OO,"onAnimationIteration");sa(NO,"onAnimationStart");sa("dblclick","onDoubleClick");sa("focusin","onFocus");sa("focusout","onBlur");sa(MO,"onTransitionEnd");wc("onMouseEnter",["mouseout","mouseover"]);wc("onMouseLeave",["mouseout","mouseover"]);wc("onPointerEnter",["pointerout","pointerover"]);wc("onPointerLeave",["pointerout","pointerover"]);pl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));pl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));pl("onBeforeInput",["compositionend","keypress","textInput","paste"]);pl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));pl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));pl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Uu="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(" "),A3=new Set("cancel close invalid load scroll toggle".split(" ").concat(Uu));function Nk(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,R4(r,t,void 0,e),e.currentTarget=null}function RO(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var s=r.length-1;0<=s;s--){var a=r[s],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==i&&o.isPropagationStopped())break e;Nk(o,a,c),i=l}else for(s=0;s<r.length;s++){if(a=r[s],l=a.instance,c=a.currentTarget,a=a.listener,l!==i&&o.isPropagationStopped())break e;Nk(o,a,c),i=l}}}if(Zh)throw e=Nx,Zh=!1,Nx=null,e}function lt(e,t){var n=t[zx];n===void 0&&(n=t[zx]=new Set);var r=e+"__bubble";n.has(r)||(jO(t,e,2,!1),n.add(r))}function ry(e,t,n){var r=0;t&&(r|=4),jO(n,e,r,t)}var Wp="_reactListening"+Math.random().toString(36).slice(2);function Gd(e){if(!e[Wp]){e[Wp]=!0,$T.forEach(function(n){n!=="selectionchange"&&(A3.has(n)||ry(n,!1,e),ry(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Wp]||(t[Wp]=!0,ry("selectionchange",!1,t))}}function jO(e,t,n,r){switch(gO(t)){case 1:var o=G4;break;case 4:o=Y4;break;default:o=Kb}n=o.bind(null,t,n,e),o=void 0,!Ox||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),r?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function oy(e,t,n,r,o){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var a=r.stateNode.containerInfo;if(a===o||a.nodeType===8&&a.parentNode===o)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&(l=s.stateNode.containerInfo,l===o||l.nodeType===8&&l.parentNode===o))return;s=s.return}for(;a!==null;){if(s=Na(a),s===null)return;if(l=s.tag,l===5||l===6){r=i=s;continue e}a=a.parentNode}}r=r.return}nO(function(){var c=i,u=Vb(n),d=[];e:{var f=PO.get(e);if(f!==void 0){var h=Gb,m=e;switch(e){case"keypress":if(xh(n)===0)break e;case"keydown":case"keyup":h=u3;break;case"focusin":m="focus",h=Xv;break;case"focusout":m="blur",h=Xv;break;case"beforeblur":case"afterblur":h=Xv;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=vk;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=Z4;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=p3;break;case TO:case OO:case NO:h=t3;break;case MO:h=m3;break;case"scroll":h=J4;break;case"wheel":h=v3;break;case"copy":case"cut":case"paste":h=r3;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=xk}var v=(t&4)!==0,x=!v&&e==="scroll",b=v?f!==null?f+"Capture":null:f;v=[];for(var w=c,S;w!==null;){S=w;var k=S.stateNode;if(S.tag===5&&k!==null&&(S=k,b!==null&&(k=Vd(w,b),k!=null&&v.push(Yd(w,k,S)))),x)break;w=w.return}0<v.length&&(f=new h(f,m,null,n,u),d.push({event:f,listeners:v}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",f&&n!==_x&&(m=n.relatedTarget||n.fromElement)&&(Na(m)||m[Mi]))break e;if((h||f)&&(f=u.window===u?u:(f=u.ownerDocument)?f.defaultView||f.parentWindow:window,h?(m=n.relatedTarget||n.toElement,h=c,m=m?Na(m):null,m!==null&&(x=hl(m),m!==x||m.tag!==5&&m.tag!==6)&&(m=null)):(h=null,m=c),h!==m)){if(v=vk,k="onMouseLeave",b="onMouseEnter",w="mouse",(e==="pointerout"||e==="pointerover")&&(v=xk,k="onPointerLeave",b="onPointerEnter",w="pointer"),x=h==null?f:Gl(h),S=m==null?f:Gl(m),f=new v(k,w+"leave",h,n,u),f.target=x,f.relatedTarget=S,k=null,Na(u)===c&&(v=new v(b,w+"enter",m,n,u),v.target=S,v.relatedTarget=x,k=v),x=k,h&&m)t:{for(v=h,b=m,w=0,S=v;S;S=Cl(S))w++;for(S=0,k=b;k;k=Cl(k))S++;for(;0<w-S;)v=Cl(v),w--;for(;0<S-w;)b=Cl(b),S--;for(;w--;){if(v===b||b!==null&&v===b.alternate)break t;v=Cl(v),b=Cl(b)}v=null}else v=null;h!==null&&Mk(d,f,h,v,!1),m!==null&&x!==null&&Mk(d,x,m,v,!0)}}e:{if(f=c?Gl(c):window,h=f.nodeName&&f.nodeName.toLowerCase(),h==="select"||h==="input"&&f.type==="file")var C=C3;else if(Sk(f))if(SO)C=O3;else{C=_3;var T=E3}else(h=f.nodeName)&&h.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(C=T3);if(C&&(C=C(e,c))){wO(d,C,n,u);break e}T&&T(e,f,c),e==="focusout"&&(T=f._wrapperState)&&T.controlled&&f.type==="number"&&wx(f,"number",f.value)}switch(T=c?Gl(c):window,e){case"focusin":(Sk(T)||T.contentEditable==="true")&&(Kl=T,jx=c,Ed=null);break;case"focusout":Ed=jx=Kl=null;break;case"mousedown":Ax=!0;break;case"contextmenu":case"mouseup":case"dragend":Ax=!1,Tk(d,n,u);break;case"selectionchange":if(P3)break;case"keydown":case"keyup":Tk(d,n,u)}var _;if(Jb)e:{switch(e){case"compositionstart":var O="onCompositionStart";break e;case"compositionend":O="onCompositionEnd";break e;case"compositionupdate":O="onCompositionUpdate";break e}O=void 0}else Hl?xO(e,n)&&(O="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(O="onCompositionStart");O&&(yO&&n.locale!=="ko"&&(Hl||O!=="onCompositionStart"?O==="onCompositionEnd"&&Hl&&(_=vO()):(ks=u,qb="value"in ks?ks.value:ks.textContent,Hl=!0)),T=rm(c,O),0<T.length&&(O=new yk(O,e,null,n,u),d.push({event:O,listeners:T}),_?O.data=_:(_=bO(n),_!==null&&(O.data=_)))),(_=x3?b3(e,n):w3(e,n))&&(c=rm(c,"onBeforeInput"),0<c.length&&(u=new yk("onBeforeInput","beforeinput",null,n,u),d.push({event:u,listeners:c}),u.data=_))}RO(d,t)})}function Yd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function rm(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=Vd(e,n),i!=null&&r.unshift(Yd(e,i,o)),i=Vd(e,t),i!=null&&r.push(Yd(e,i,o))),e=e.return}return r}function Cl(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Mk(e,t,n,r,o){for(var i=t._reactName,s=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&c!==null&&(a=c,o?(l=Vd(n,i),l!=null&&s.unshift(Yd(n,l,a))):o||(l=Vd(n,i),l!=null&&s.push(Yd(n,l,a)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var I3=/\r\n?/g,D3=/\u0000|\uFFFD/g;function Pk(e){return(typeof e=="string"?e:""+e).replace(I3,`
30
- `).replace(D3,"")}function Hp(e,t,n){if(t=Pk(t),Pk(e)!==t&&n)throw Error(W(425))}function om(){}var Ix=null,Dx=null;function Lx(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Fx=typeof setTimeout=="function"?setTimeout:void 0,L3=typeof clearTimeout=="function"?clearTimeout:void 0,Rk=typeof Promise=="function"?Promise:void 0,F3=typeof queueMicrotask=="function"?queueMicrotask:typeof Rk<"u"?function(e){return Rk.resolve(null).then(e).catch(z3)}:Fx;function z3(e){setTimeout(function(){throw e})}function iy(e,t){var n=t,r=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"){if(r===0){e.removeChild(o),Hd(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);Hd(t)}function Ps(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function jk(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Qc=Math.random().toString(36).slice(2),Wo="__reactFiber$"+Qc,Jd="__reactProps$"+Qc,Mi="__reactContainer$"+Qc,zx="__reactEvents$"+Qc,$3="__reactListeners$"+Qc,B3="__reactHandles$"+Qc;function Na(e){var t=e[Wo];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Mi]||n[Wo]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=jk(e);e!==null;){if(n=e[Wo])return n;e=jk(e)}return t}e=n,n=e.parentNode}return null}function ep(e){return e=e[Wo]||e[Mi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Gl(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(W(33))}function Og(e){return e[Jd]||null}var $x=[],Yl=-1;function aa(e){return{current:e}}function ct(e){0>Yl||(e.current=$x[Yl],$x[Yl]=null,Yl--)}function it(e,t){Yl++,$x[Yl]=e.current,e.current=t}var Hs={},On=aa(Hs),er=aa(!1),Ka=Hs;function Sc(e,t){var n=e.type.contextTypes;if(!n)return Hs;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function tr(e){return e=e.childContextTypes,e!=null}function im(){ct(er),ct(On)}function Ak(e,t,n){if(On.current!==Hs)throw Error(W(168));it(On,t),it(er,n)}function AO(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(W(108,E4(e)||"Unknown",o));return xt({},n,r)}function sm(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Hs,Ka=On.current,it(On,e),it(er,er.current),!0}function Ik(e,t,n){var r=e.stateNode;if(!r)throw Error(W(169));n?(e=AO(e,t,Ka),r.__reactInternalMemoizedMergedChildContext=e,ct(er),ct(On),it(On,e)):ct(er),it(er,n)}var gi=null,Ng=!1,sy=!1;function IO(e){gi===null?gi=[e]:gi.push(e)}function V3(e){Ng=!0,IO(e)}function la(){if(!sy&&gi!==null){sy=!0;var e=0,t=Qe;try{var n=gi;for(Qe=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}gi=null,Ng=!1}catch(o){throw gi!==null&&(gi=gi.slice(e+1)),sO(Ub,la),o}finally{Qe=t,sy=!1}}return null}var Jl=[],Xl=0,am=null,lm=0,zr=[],$r=0,qa=null,bi=1,wi="";function wa(e,t){Jl[Xl++]=lm,Jl[Xl++]=am,am=e,lm=t}function DO(e,t,n){zr[$r++]=bi,zr[$r++]=wi,zr[$r++]=qa,qa=e;var r=bi;e=wi;var o=32-ko(r)-1;r&=~(1<<o),n+=1;var i=32-ko(t)+o;if(30<i){var s=o-o%5;i=(r&(1<<s)-1).toString(32),r>>=s,o-=s,bi=1<<32-ko(t)+o|n<<o|r,wi=i+e}else bi=1<<i|n<<o|r,wi=e}function Zb(e){e.return!==null&&(wa(e,1),DO(e,1,0))}function Qb(e){for(;e===am;)am=Jl[--Xl],Jl[Xl]=null,lm=Jl[--Xl],Jl[Xl]=null;for(;e===qa;)qa=zr[--$r],zr[$r]=null,wi=zr[--$r],zr[$r]=null,bi=zr[--$r],zr[$r]=null}var Cr=null,kr=null,ut=!1,mo=null;function LO(e,t){var n=Vr(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Dk(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Cr=e,kr=Ps(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Cr=e,kr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=qa!==null?{id:bi,overflow:wi}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Vr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Cr=e,kr=null,!0):!1;default:return!1}}function Bx(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Vx(e){if(ut){var t=kr;if(t){var n=t;if(!Dk(e,t)){if(Bx(e))throw Error(W(418));t=Ps(n.nextSibling);var r=Cr;t&&Dk(e,t)?LO(r,n):(e.flags=e.flags&-4097|2,ut=!1,Cr=e)}}else{if(Bx(e))throw Error(W(418));e.flags=e.flags&-4097|2,ut=!1,Cr=e}}}function Lk(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Cr=e}function Kp(e){if(e!==Cr)return!1;if(!ut)return Lk(e),ut=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Lx(e.type,e.memoizedProps)),t&&(t=kr)){if(Bx(e))throw FO(),Error(W(418));for(;t;)LO(e,t),t=Ps(t.nextSibling)}if(Lk(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(W(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){kr=Ps(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}kr=null}}else kr=Cr?Ps(e.stateNode.nextSibling):null;return!0}function FO(){for(var e=kr;e;)e=Ps(e.nextSibling)}function kc(){kr=Cr=null,ut=!1}function ew(e){mo===null?mo=[e]:mo.push(e)}var U3=zi.ReactCurrentBatchConfig;function Tu(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(W(309));var r=n.stateNode}if(!r)throw Error(W(147,e));var o=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(s){var a=o.refs;s===null?delete a[i]:a[i]=s},t._stringRef=i,t)}if(typeof e!="string")throw Error(W(284));if(!n._owner)throw Error(W(290,e))}return e}function qp(e,t){throw e=Object.prototype.toString.call(t),Error(W(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Fk(e){var t=e._init;return t(e._payload)}function zO(e){function t(b,w){if(e){var S=b.deletions;S===null?(b.deletions=[w],b.flags|=16):S.push(w)}}function n(b,w){if(!e)return null;for(;w!==null;)t(b,w),w=w.sibling;return null}function r(b,w){for(b=new Map;w!==null;)w.key!==null?b.set(w.key,w):b.set(w.index,w),w=w.sibling;return b}function o(b,w){return b=Is(b,w),b.index=0,b.sibling=null,b}function i(b,w,S){return b.index=S,e?(S=b.alternate,S!==null?(S=S.index,S<w?(b.flags|=2,w):S):(b.flags|=2,w)):(b.flags|=1048576,w)}function s(b){return e&&b.alternate===null&&(b.flags|=2),b}function a(b,w,S,k){return w===null||w.tag!==6?(w=py(S,b.mode,k),w.return=b,w):(w=o(w,S),w.return=b,w)}function l(b,w,S,k){var C=S.type;return C===Wl?u(b,w,S.props.children,k,S.key):w!==null&&(w.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===us&&Fk(C)===w.type)?(k=o(w,S.props),k.ref=Tu(b,w,S),k.return=b,k):(k=_h(S.type,S.key,S.props,null,b.mode,k),k.ref=Tu(b,w,S),k.return=b,k)}function c(b,w,S,k){return w===null||w.tag!==4||w.stateNode.containerInfo!==S.containerInfo||w.stateNode.implementation!==S.implementation?(w=hy(S,b.mode,k),w.return=b,w):(w=o(w,S.children||[]),w.return=b,w)}function u(b,w,S,k,C){return w===null||w.tag!==7?(w=za(S,b.mode,k,C),w.return=b,w):(w=o(w,S),w.return=b,w)}function d(b,w,S){if(typeof w=="string"&&w!==""||typeof w=="number")return w=py(""+w,b.mode,S),w.return=b,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Dp:return S=_h(w.type,w.key,w.props,null,b.mode,S),S.ref=Tu(b,null,w),S.return=b,S;case Ul:return w=hy(w,b.mode,S),w.return=b,w;case us:var k=w._init;return d(b,k(w._payload),S)}if(Bu(w)||Su(w))return w=za(w,b.mode,S,null),w.return=b,w;qp(b,w)}return null}function f(b,w,S,k){var C=w!==null?w.key:null;if(typeof S=="string"&&S!==""||typeof S=="number")return C!==null?null:a(b,w,""+S,k);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case Dp:return S.key===C?l(b,w,S,k):null;case Ul:return S.key===C?c(b,w,S,k):null;case us:return C=S._init,f(b,w,C(S._payload),k)}if(Bu(S)||Su(S))return C!==null?null:u(b,w,S,k,null);qp(b,S)}return null}function h(b,w,S,k,C){if(typeof k=="string"&&k!==""||typeof k=="number")return b=b.get(S)||null,a(w,b,""+k,C);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case Dp:return b=b.get(k.key===null?S:k.key)||null,l(w,b,k,C);case Ul:return b=b.get(k.key===null?S:k.key)||null,c(w,b,k,C);case us:var T=k._init;return h(b,w,S,T(k._payload),C)}if(Bu(k)||Su(k))return b=b.get(S)||null,u(w,b,k,C,null);qp(w,k)}return null}function m(b,w,S,k){for(var C=null,T=null,_=w,O=w=0,M=null;_!==null&&O<S.length;O++){_.index>O?(M=_,_=null):M=_.sibling;var j=f(b,_,S[O],k);if(j===null){_===null&&(_=M);break}e&&_&&j.alternate===null&&t(b,_),w=i(j,w,O),T===null?C=j:T.sibling=j,T=j,_=M}if(O===S.length)return n(b,_),ut&&wa(b,O),C;if(_===null){for(;O<S.length;O++)_=d(b,S[O],k),_!==null&&(w=i(_,w,O),T===null?C=_:T.sibling=_,T=_);return ut&&wa(b,O),C}for(_=r(b,_);O<S.length;O++)M=h(_,b,O,S[O],k),M!==null&&(e&&M.alternate!==null&&_.delete(M.key===null?O:M.key),w=i(M,w,O),T===null?C=M:T.sibling=M,T=M);return e&&_.forEach(function(L){return t(b,L)}),ut&&wa(b,O),C}function v(b,w,S,k){var C=Su(S);if(typeof C!="function")throw Error(W(150));if(S=C.call(S),S==null)throw Error(W(151));for(var T=C=null,_=w,O=w=0,M=null,j=S.next();_!==null&&!j.done;O++,j=S.next()){_.index>O?(M=_,_=null):M=_.sibling;var L=f(b,_,j.value,k);if(L===null){_===null&&(_=M);break}e&&_&&L.alternate===null&&t(b,_),w=i(L,w,O),T===null?C=L:T.sibling=L,T=L,_=M}if(j.done)return n(b,_),ut&&wa(b,O),C;if(_===null){for(;!j.done;O++,j=S.next())j=d(b,j.value,k),j!==null&&(w=i(j,w,O),T===null?C=j:T.sibling=j,T=j);return ut&&wa(b,O),C}for(_=r(b,_);!j.done;O++,j=S.next())j=h(_,b,O,j.value,k),j!==null&&(e&&j.alternate!==null&&_.delete(j.key===null?O:j.key),w=i(j,w,O),T===null?C=j:T.sibling=j,T=j);return e&&_.forEach(function(B){return t(b,B)}),ut&&wa(b,O),C}function x(b,w,S,k){if(typeof S=="object"&&S!==null&&S.type===Wl&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case Dp:e:{for(var C=S.key,T=w;T!==null;){if(T.key===C){if(C=S.type,C===Wl){if(T.tag===7){n(b,T.sibling),w=o(T,S.props.children),w.return=b,b=w;break e}}else if(T.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===us&&Fk(C)===T.type){n(b,T.sibling),w=o(T,S.props),w.ref=Tu(b,T,S),w.return=b,b=w;break e}n(b,T);break}else t(b,T);T=T.sibling}S.type===Wl?(w=za(S.props.children,b.mode,k,S.key),w.return=b,b=w):(k=_h(S.type,S.key,S.props,null,b.mode,k),k.ref=Tu(b,w,S),k.return=b,b=k)}return s(b);case Ul:e:{for(T=S.key;w!==null;){if(w.key===T)if(w.tag===4&&w.stateNode.containerInfo===S.containerInfo&&w.stateNode.implementation===S.implementation){n(b,w.sibling),w=o(w,S.children||[]),w.return=b,b=w;break e}else{n(b,w);break}else t(b,w);w=w.sibling}w=hy(S,b.mode,k),w.return=b,b=w}return s(b);case us:return T=S._init,x(b,w,T(S._payload),k)}if(Bu(S))return m(b,w,S,k);if(Su(S))return v(b,w,S,k);qp(b,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,w!==null&&w.tag===6?(n(b,w.sibling),w=o(w,S),w.return=b,b=w):(n(b,w),w=py(S,b.mode,k),w.return=b,b=w),s(b)):n(b,w)}return x}var Cc=zO(!0),$O=zO(!1),cm=aa(null),um=null,Zl=null,tw=null;function nw(){tw=Zl=um=null}function rw(e){var t=cm.current;ct(cm),e._currentValue=t}function Ux(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function ac(e,t){um=e,tw=Zl=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Jn=!0),e.firstContext=null)}function Gr(e){var t=e._currentValue;if(tw!==e)if(e={context:e,memoizedValue:t,next:null},Zl===null){if(um===null)throw Error(W(308));Zl=e,um.dependencies={lanes:0,firstContext:e}}else Zl=Zl.next=e;return t}var Ma=null;function ow(e){Ma===null?Ma=[e]:Ma.push(e)}function BO(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,ow(t)):(n.next=o.next,o.next=n),t.interleaved=n,Pi(e,r)}function Pi(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var ds=!1;function iw(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function VO(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function _i(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Rs(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,We&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Pi(e,n)}return o=r.interleaved,o===null?(t.next=t,ow(r)):(t.next=o.next,o.next=t),r.interleaved=t,Pi(e,n)}function bh(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Wb(e,n)}}function zk(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?o=i=t:i=i.next=t}else o=i=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function dm(e,t,n,r){var o=e.updateQueue;ds=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,a=o.shared.pending;if(a!==null){o.shared.pending=null;var l=a,c=l.next;l.next=null,s===null?i=c:s.next=c,s=l;var u=e.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==s&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(i!==null){var d=o.baseState;s=0,u=c=l=null,a=i;do{var f=a.lane,h=a.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:h,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var m=e,v=a;switch(f=t,h=n,v.tag){case 1:if(m=v.payload,typeof m=="function"){d=m.call(h,d,f);break e}d=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=v.payload,f=typeof m=="function"?m.call(h,d,f):m,f==null)break e;d=xt({},d,f);break e;case 2:ds=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,f=o.effects,f===null?o.effects=[a]:f.push(a))}else h={eventTime:h,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=h,l=d):u=u.next=h,s|=f;if(a=a.next,a===null){if(a=o.shared.pending,a===null)break;f=a,a=f.next,f.next=null,o.lastBaseUpdate=f,o.shared.pending=null}}while(!0);if(u===null&&(l=d),o.baseState=l,o.firstBaseUpdate=c,o.lastBaseUpdate=u,t=o.shared.interleaved,t!==null){o=t;do s|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);Ya|=s,e.lanes=s,e.memoizedState=d}}function $k(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],o=r.callback;if(o!==null){if(r.callback=null,r=n,typeof o!="function")throw Error(W(191,o));o.call(r)}}}var tp={},qo=aa(tp),Xd=aa(tp),Zd=aa(tp);function Pa(e){if(e===tp)throw Error(W(174));return e}function sw(e,t){switch(it(Zd,t),it(Xd,e),it(qo,tp),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:kx(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=kx(t,e)}ct(qo),it(qo,t)}function Ec(){ct(qo),ct(Xd),ct(Zd)}function UO(e){Pa(Zd.current);var t=Pa(qo.current),n=kx(t,e.type);t!==n&&(it(Xd,e),it(qo,n))}function aw(e){Xd.current===e&&(ct(qo),ct(Xd))}var gt=aa(0);function fm(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ay=[];function lw(){for(var e=0;e<ay.length;e++)ay[e]._workInProgressVersionPrimary=null;ay.length=0}var wh=zi.ReactCurrentDispatcher,ly=zi.ReactCurrentBatchConfig,Ga=0,yt=null,It=null,Yt=null,pm=!1,_d=!1,Qd=0,W3=0;function wn(){throw Error(W(321))}function cw(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!To(e[n],t[n]))return!1;return!0}function uw(e,t,n,r,o,i){if(Ga=i,yt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,wh.current=e===null||e.memoizedState===null?G3:Y3,e=n(r,o),_d){i=0;do{if(_d=!1,Qd=0,25<=i)throw Error(W(301));i+=1,Yt=It=null,t.updateQueue=null,wh.current=J3,e=n(r,o)}while(_d)}if(wh.current=hm,t=It!==null&&It.next!==null,Ga=0,Yt=It=yt=null,pm=!1,t)throw Error(W(300));return e}function dw(){var e=Qd!==0;return Qd=0,e}function Vo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Yt===null?yt.memoizedState=Yt=e:Yt=Yt.next=e,Yt}function Yr(){if(It===null){var e=yt.alternate;e=e!==null?e.memoizedState:null}else e=It.next;var t=Yt===null?yt.memoizedState:Yt.next;if(t!==null)Yt=t,It=e;else{if(e===null)throw Error(W(310));It=e,e={memoizedState:It.memoizedState,baseState:It.baseState,baseQueue:It.baseQueue,queue:It.queue,next:null},Yt===null?yt.memoizedState=Yt=e:Yt=Yt.next=e}return Yt}function ef(e,t){return typeof t=="function"?t(e):t}function cy(e){var t=Yr(),n=t.queue;if(n===null)throw Error(W(311));n.lastRenderedReducer=e;var r=It,o=r.baseQueue,i=n.pending;if(i!==null){if(o!==null){var s=o.next;o.next=i.next,i.next=s}r.baseQueue=o=i,n.pending=null}if(o!==null){i=o.next,r=r.baseState;var a=s=null,l=null,c=i;do{var u=c.lane;if((Ga&u)===u)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var d={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=d,s=r):l=l.next=d,yt.lanes|=u,Ya|=u}c=c.next}while(c!==null&&c!==i);l===null?s=r:l.next=a,To(r,t.memoizedState)||(Jn=!0),t.memoizedState=r,t.baseState=s,t.baseQueue=l,n.lastRenderedState=r}if(e=n.interleaved,e!==null){o=e;do i=o.lane,yt.lanes|=i,Ya|=i,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function uy(e){var t=Yr(),n=t.queue;if(n===null)throw Error(W(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,i=t.memoizedState;if(o!==null){n.pending=null;var s=o=o.next;do i=e(i,s.action),s=s.next;while(s!==o);To(i,t.memoizedState)||(Jn=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function WO(){}function HO(e,t){var n=yt,r=Yr(),o=t(),i=!To(r.memoizedState,o);if(i&&(r.memoizedState=o,Jn=!0),r=r.queue,fw(GO.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Yt!==null&&Yt.memoizedState.tag&1){if(n.flags|=2048,tf(9,qO.bind(null,n,r,o,t),void 0,null),Qt===null)throw Error(W(349));Ga&30||KO(n,t,o)}return o}function KO(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=yt.updateQueue,t===null?(t={lastEffect:null,stores:null},yt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function qO(e,t,n,r){t.value=n,t.getSnapshot=r,YO(t)&&JO(e)}function GO(e,t,n){return n(function(){YO(t)&&JO(e)})}function YO(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!To(e,n)}catch{return!0}}function JO(e){var t=Pi(e,1);t!==null&&Co(t,e,1,-1)}function Bk(e){var t=Vo();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ef,lastRenderedState:e},t.queue=e,e=e.dispatch=q3.bind(null,yt,e),[t.memoizedState,e]}function tf(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=yt.updateQueue,t===null?(t={lastEffect:null,stores:null},yt.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function XO(){return Yr().memoizedState}function Sh(e,t,n,r){var o=Vo();yt.flags|=e,o.memoizedState=tf(1|t,n,void 0,r===void 0?null:r)}function Mg(e,t,n,r){var o=Yr();r=r===void 0?null:r;var i=void 0;if(It!==null){var s=It.memoizedState;if(i=s.destroy,r!==null&&cw(r,s.deps)){o.memoizedState=tf(t,n,i,r);return}}yt.flags|=e,o.memoizedState=tf(1|t,n,i,r)}function Vk(e,t){return Sh(8390656,8,e,t)}function fw(e,t){return Mg(2048,8,e,t)}function ZO(e,t){return Mg(4,2,e,t)}function QO(e,t){return Mg(4,4,e,t)}function eN(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function tN(e,t,n){return n=n!=null?n.concat([e]):null,Mg(4,4,eN.bind(null,t,e),n)}function pw(){}function nN(e,t){var n=Yr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&cw(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function rN(e,t){var n=Yr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&cw(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function oN(e,t,n){return Ga&21?(To(n,t)||(n=cO(),yt.lanes|=n,Ya|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Jn=!0),e.memoizedState=n)}function H3(e,t){var n=Qe;Qe=n!==0&&4>n?n:4,e(!0);var r=ly.transition;ly.transition={};try{e(!1),t()}finally{Qe=n,ly.transition=r}}function iN(){return Yr().memoizedState}function K3(e,t,n){var r=As(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},sN(e))aN(t,n);else if(n=BO(e,t,n,r),n!==null){var o=Fn();Co(n,e,r,o),lN(n,t,r)}}function q3(e,t,n){var r=As(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(sN(e))aN(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,a=i(s,n);if(o.hasEagerState=!0,o.eagerState=a,To(a,s)){var l=t.interleaved;l===null?(o.next=o,ow(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}n=BO(e,t,o,r),n!==null&&(o=Fn(),Co(n,e,r,o),lN(n,t,r))}}function sN(e){var t=e.alternate;return e===yt||t!==null&&t===yt}function aN(e,t){_d=pm=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function lN(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Wb(e,n)}}var hm={readContext:Gr,useCallback:wn,useContext:wn,useEffect:wn,useImperativeHandle:wn,useInsertionEffect:wn,useLayoutEffect:wn,useMemo:wn,useReducer:wn,useRef:wn,useState:wn,useDebugValue:wn,useDeferredValue:wn,useTransition:wn,useMutableSource:wn,useSyncExternalStore:wn,useId:wn,unstable_isNewReconciler:!1},G3={readContext:Gr,useCallback:function(e,t){return Vo().memoizedState=[e,t===void 0?null:t],e},useContext:Gr,useEffect:Vk,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Sh(4194308,4,eN.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Sh(4194308,4,e,t)},useInsertionEffect:function(e,t){return Sh(4,2,e,t)},useMemo:function(e,t){var n=Vo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Vo();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=K3.bind(null,yt,e),[r.memoizedState,e]},useRef:function(e){var t=Vo();return e={current:e},t.memoizedState=e},useState:Bk,useDebugValue:pw,useDeferredValue:function(e){return Vo().memoizedState=e},useTransition:function(){var e=Bk(!1),t=e[0];return e=H3.bind(null,e[1]),Vo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=yt,o=Vo();if(ut){if(n===void 0)throw Error(W(407));n=n()}else{if(n=t(),Qt===null)throw Error(W(349));Ga&30||KO(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,Vk(GO.bind(null,r,i,e),[e]),r.flags|=2048,tf(9,qO.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Vo(),t=Qt.identifierPrefix;if(ut){var n=wi,r=bi;n=(r&~(1<<32-ko(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Qd++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=W3++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Y3={readContext:Gr,useCallback:nN,useContext:Gr,useEffect:fw,useImperativeHandle:tN,useInsertionEffect:ZO,useLayoutEffect:QO,useMemo:rN,useReducer:cy,useRef:XO,useState:function(){return cy(ef)},useDebugValue:pw,useDeferredValue:function(e){var t=Yr();return oN(t,It.memoizedState,e)},useTransition:function(){var e=cy(ef)[0],t=Yr().memoizedState;return[e,t]},useMutableSource:WO,useSyncExternalStore:HO,useId:iN,unstable_isNewReconciler:!1},J3={readContext:Gr,useCallback:nN,useContext:Gr,useEffect:fw,useImperativeHandle:tN,useInsertionEffect:ZO,useLayoutEffect:QO,useMemo:rN,useReducer:uy,useRef:XO,useState:function(){return uy(ef)},useDebugValue:pw,useDeferredValue:function(e){var t=Yr();return It===null?t.memoizedState=e:oN(t,It.memoizedState,e)},useTransition:function(){var e=uy(ef)[0],t=Yr().memoizedState;return[e,t]},useMutableSource:WO,useSyncExternalStore:HO,useId:iN,unstable_isNewReconciler:!1};function fo(e,t){if(e&&e.defaultProps){t=xt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Wx(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:xt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Pg={isMounted:function(e){return(e=e._reactInternals)?hl(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Fn(),o=As(e),i=_i(r,o);i.payload=t,n!=null&&(i.callback=n),t=Rs(e,i,o),t!==null&&(Co(t,e,o,r),bh(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Fn(),o=As(e),i=_i(r,o);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Rs(e,i,o),t!==null&&(Co(t,e,o,r),bh(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Fn(),r=As(e),o=_i(n,r);o.tag=2,t!=null&&(o.callback=t),t=Rs(e,o,r),t!==null&&(Co(t,e,r,n),bh(t,e,r))}};function Uk(e,t,n,r,o,i,s){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,s):t.prototype&&t.prototype.isPureReactComponent?!qd(n,r)||!qd(o,i):!0}function cN(e,t,n){var r=!1,o=Hs,i=t.contextType;return typeof i=="object"&&i!==null?i=Gr(i):(o=tr(t)?Ka:On.current,r=t.contextTypes,i=(r=r!=null)?Sc(e,o):Hs),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Pg,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function Wk(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&&Pg.enqueueReplaceState(t,t.state,null)}function Hx(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},iw(e);var i=t.contextType;typeof i=="object"&&i!==null?o.context=Gr(i):(i=tr(t)?Ka:On.current,o.context=Sc(e,i)),o.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Wx(e,t,i,n),o.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(t=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),t!==o.state&&Pg.enqueueReplaceState(o,o.state,null),dm(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function _c(e,t){try{var n="",r=t;do n+=C4(r),r=r.return;while(r);var o=n}catch(i){o=`
31
- Error generating stack: `+i.message+`
32
- `+i.stack}return{value:e,source:t,stack:o,digest:null}}function dy(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Kx(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var X3=typeof WeakMap=="function"?WeakMap:Map;function uN(e,t,n){n=_i(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){gm||(gm=!0,n0=r),Kx(e,t)},n}function dN(e,t,n){n=_i(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){Kx(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Kx(e,t),typeof r!="function"&&(js===null?js=new Set([this]):js.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function Hk(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new X3;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=d5.bind(null,e,t,n),t.then(e,e))}function Kk(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function qk(e,t,n,r,o){return e.mode&1?(e.flags|=65536,e.lanes=o,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=_i(-1,1),t.tag=2,Rs(n,t,1))),n.lanes|=1),e)}var Z3=zi.ReactCurrentOwner,Jn=!1;function In(e,t,n,r){t.child=e===null?$O(t,null,n,r):Cc(t,e.child,n,r)}function Gk(e,t,n,r,o){n=n.render;var i=t.ref;return ac(t,o),r=uw(e,t,n,r,i,o),n=dw(),e!==null&&!Jn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Ri(e,t,o)):(ut&&n&&Zb(t),t.flags|=1,In(e,t,r,o),t.child)}function Yk(e,t,n,r,o){if(e===null){var i=n.type;return typeof i=="function"&&!ww(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,fN(e,t,i,r,o)):(e=_h(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&o)){var s=i.memoizedProps;if(n=n.compare,n=n!==null?n:qd,n(s,r)&&e.ref===t.ref)return Ri(e,t,o)}return t.flags|=1,e=Is(i,r),e.ref=t.ref,e.return=t,t.child=e}function fN(e,t,n,r,o){if(e!==null){var i=e.memoizedProps;if(qd(i,r)&&e.ref===t.ref)if(Jn=!1,t.pendingProps=r=i,(e.lanes&o)!==0)e.flags&131072&&(Jn=!0);else return t.lanes=e.lanes,Ri(e,t,o)}return qx(e,t,n,r,o)}function pN(e,t,n){var r=t.pendingProps,o=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},it(ec,xr),xr|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,it(ec,xr),xr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,it(ec,xr),xr|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,it(ec,xr),xr|=r;return In(e,t,o,n),t.child}function hN(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function qx(e,t,n,r,o){var i=tr(n)?Ka:On.current;return i=Sc(t,i),ac(t,o),n=uw(e,t,n,r,i,o),r=dw(),e!==null&&!Jn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Ri(e,t,o)):(ut&&r&&Zb(t),t.flags|=1,In(e,t,n,o),t.child)}function Jk(e,t,n,r,o){if(tr(n)){var i=!0;sm(t)}else i=!1;if(ac(t,o),t.stateNode===null)kh(e,t),cN(t,n,r),Hx(t,n,r,o),r=!0;else if(e===null){var s=t.stateNode,a=t.memoizedProps;s.props=a;var l=s.context,c=n.contextType;typeof c=="object"&&c!==null?c=Gr(c):(c=tr(n)?Ka:On.current,c=Sc(t,c));var u=n.getDerivedStateFromProps,d=typeof u=="function"||typeof s.getSnapshotBeforeUpdate=="function";d||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==r||l!==c)&&Wk(t,s,r,c),ds=!1;var f=t.memoizedState;s.state=f,dm(t,r,s,o),l=t.memoizedState,a!==r||f!==l||er.current||ds?(typeof u=="function"&&(Wx(t,n,u,r),l=t.memoizedState),(a=ds||Uk(t,n,a,r,f,l,c))?(d||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),s.props=r,s.state=l,s.context=c,r=a):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,VO(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:fo(t.type,a),s.props=c,d=t.pendingProps,f=s.context,l=n.contextType,typeof l=="object"&&l!==null?l=Gr(l):(l=tr(n)?Ka:On.current,l=Sc(t,l));var h=n.getDerivedStateFromProps;(u=typeof h=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==d||f!==l)&&Wk(t,s,r,l),ds=!1,f=t.memoizedState,s.state=f,dm(t,r,s,o);var m=t.memoizedState;a!==d||f!==m||er.current||ds?(typeof h=="function"&&(Wx(t,n,h,r),m=t.memoizedState),(c=ds||Uk(t,n,c,r,f,m,l)||!1)?(u||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,m,l),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,m,l)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),s.props=r,s.state=m,s.context=l,r=c):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Gx(e,t,n,r,i,o)}function Gx(e,t,n,r,o,i){hN(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return o&&Ik(t,n,!1),Ri(e,t,i);r=t.stateNode,Z3.current=t;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=Cc(t,e.child,null,i),t.child=Cc(t,null,a,i)):In(e,t,a,i),t.memoizedState=r.state,o&&Ik(t,n,!0),t.child}function mN(e){var t=e.stateNode;t.pendingContext?Ak(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Ak(e,t.context,!1),sw(e,t.containerInfo)}function Xk(e,t,n,r,o){return kc(),ew(o),t.flags|=256,In(e,t,n,r),t.child}var Yx={dehydrated:null,treeContext:null,retryLane:0};function Jx(e){return{baseLanes:e,cachePool:null,transitions:null}}function gN(e,t,n){var r=t.pendingProps,o=gt.current,i=!1,s=(t.flags&128)!==0,a;if((a=s)||(a=e!==null&&e.memoizedState===null?!1:(o&2)!==0),a?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),it(gt,o&1),e===null)return Vx(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(s=r.children,e=r.fallback,i?(r=t.mode,i=t.child,s={mode:"hidden",children:s},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=s):i=Ag(s,r,0,null),e=za(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Jx(n),t.memoizedState=Yx,e):hw(t,s));if(o=e.memoizedState,o!==null&&(a=o.dehydrated,a!==null))return Q3(e,t,s,r,a,o,n);if(i){i=r.fallback,s=t.mode,o=e.child,a=o.sibling;var l={mode:"hidden",children:r.children};return!(s&1)&&t.child!==o?(r=t.child,r.childLanes=0,r.pendingProps=l,t.deletions=null):(r=Is(o,l),r.subtreeFlags=o.subtreeFlags&14680064),a!==null?i=Is(a,i):(i=za(i,s,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,s=e.child.memoizedState,s=s===null?Jx(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=Yx,r}return i=e.child,e=i.sibling,r=Is(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function hw(e,t){return t=Ag({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Gp(e,t,n,r){return r!==null&&ew(r),Cc(t,e.child,null,n),e=hw(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Q3(e,t,n,r,o,i,s){if(n)return t.flags&256?(t.flags&=-257,r=dy(Error(W(422))),Gp(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,o=t.mode,r=Ag({mode:"visible",children:r.children},o,0,null),i=za(i,o,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Cc(t,e.child,null,s),t.child.memoizedState=Jx(s),t.memoizedState=Yx,i);if(!(t.mode&1))return Gp(e,t,s,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(W(419)),r=dy(i,r,void 0),Gp(e,t,s,r)}if(a=(s&e.childLanes)!==0,Jn||a){if(r=Qt,r!==null){switch(s&-s){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|s)?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,Pi(e,o),Co(r,e,o,-1))}return bw(),r=dy(Error(W(421))),Gp(e,t,s,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=f5.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,kr=Ps(o.nextSibling),Cr=t,ut=!0,mo=null,e!==null&&(zr[$r++]=bi,zr[$r++]=wi,zr[$r++]=qa,bi=e.id,wi=e.overflow,qa=t),t=hw(t,r.children),t.flags|=4096,t)}function Zk(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ux(e.return,t,n)}function fy(e,t,n,r,o){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=o)}function vN(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(In(e,t,r.children,n),r=gt.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Zk(e,n,t);else if(e.tag===19)Zk(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(it(gt,r),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&fm(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),fy(t,!1,o,n,i);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&fm(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}fy(t,!0,n,null,i);break;case"together":fy(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function kh(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Ri(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ya|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(W(153));if(t.child!==null){for(e=t.child,n=Is(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Is(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function e5(e,t,n){switch(t.tag){case 3:mN(t),kc();break;case 5:UO(t);break;case 1:tr(t.type)&&sm(t);break;case 4:sw(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;it(cm,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(it(gt,gt.current&1),t.flags|=128,null):n&t.child.childLanes?gN(e,t,n):(it(gt,gt.current&1),e=Ri(e,t,n),e!==null?e.sibling:null);it(gt,gt.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return vN(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),it(gt,gt.current),r)break;return null;case 22:case 23:return t.lanes=0,pN(e,t,n)}return Ri(e,t,n)}var yN,Xx,xN,bN;yN=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Xx=function(){};xN=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,Pa(qo.current);var i=null;switch(n){case"input":o=xx(e,o),r=xx(e,r),i=[];break;case"select":o=xt({},o,{value:void 0}),r=xt({},r,{value:void 0}),i=[];break;case"textarea":o=Sx(e,o),r=Sx(e,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=om)}Cx(n,r);var s;n=null;for(c in o)if(!r.hasOwnProperty(c)&&o.hasOwnProperty(c)&&o[c]!=null)if(c==="style"){var a=o[c];for(s in a)a.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&($d.hasOwnProperty(c)?i||(i=[]):(i=i||[]).push(c,null));for(c in r){var l=r[c];if(a=o!=null?o[c]:void 0,r.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(s in a)!a.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in l)l.hasOwnProperty(s)&&a[s]!==l[s]&&(n||(n={}),n[s]=l[s])}else n||(i||(i=[]),i.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(i=i||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(i=i||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&($d.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&lt("scroll",e),i||a===l||(i=[])):(i=i||[]).push(c,l))}n&&(i=i||[]).push("style",n);var c=i;(t.updateQueue=c)&&(t.flags|=4)}};bN=function(e,t,n,r){n!==r&&(t.flags|=4)};function Ou(e,t){if(!ut)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var 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}}function Sn(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function t5(e,t,n){var r=t.pendingProps;switch(Qb(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Sn(t),null;case 1:return tr(t.type)&&im(),Sn(t),null;case 3:return r=t.stateNode,Ec(),ct(er),ct(On),lw(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Kp(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,mo!==null&&(i0(mo),mo=null))),Xx(e,t),Sn(t),null;case 5:aw(t);var o=Pa(Zd.current);if(n=t.type,e!==null&&t.stateNode!=null)xN(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(W(166));return Sn(t),null}if(e=Pa(qo.current),Kp(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Wo]=t,r[Jd]=i,e=(t.mode&1)!==0,n){case"dialog":lt("cancel",r),lt("close",r);break;case"iframe":case"object":case"embed":lt("load",r);break;case"video":case"audio":for(o=0;o<Uu.length;o++)lt(Uu[o],r);break;case"source":lt("error",r);break;case"img":case"image":case"link":lt("error",r),lt("load",r);break;case"details":lt("toggle",r);break;case"input":ak(r,i),lt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},lt("invalid",r);break;case"textarea":ck(r,i),lt("invalid",r)}Cx(n,i),o=null;for(var s in i)if(i.hasOwnProperty(s)){var a=i[s];s==="children"?typeof a=="string"?r.textContent!==a&&(i.suppressHydrationWarning!==!0&&Hp(r.textContent,a,e),o=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&Hp(r.textContent,a,e),o=["children",""+a]):$d.hasOwnProperty(s)&&a!=null&&s==="onScroll"&&lt("scroll",r)}switch(n){case"input":Lp(r),lk(r,i,!0);break;case"textarea":Lp(r),uk(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=om)}r=o,t.updateQueue=r,r!==null&&(t.flags|=4)}else{s=o.nodeType===9?o:o.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=GT(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=s.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[Wo]=t,e[Jd]=r,yN(e,t,!1,!1),t.stateNode=e;e:{switch(s=Ex(n,r),n){case"dialog":lt("cancel",e),lt("close",e),o=r;break;case"iframe":case"object":case"embed":lt("load",e),o=r;break;case"video":case"audio":for(o=0;o<Uu.length;o++)lt(Uu[o],e);o=r;break;case"source":lt("error",e),o=r;break;case"img":case"image":case"link":lt("error",e),lt("load",e),o=r;break;case"details":lt("toggle",e),o=r;break;case"input":ak(e,r),o=xx(e,r),lt("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=xt({},r,{value:void 0}),lt("invalid",e);break;case"textarea":ck(e,r),o=Sx(e,r),lt("invalid",e);break;default:o=r}Cx(n,o),a=o;for(i in a)if(a.hasOwnProperty(i)){var l=a[i];i==="style"?XT(e,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&YT(e,l)):i==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Bd(e,l):typeof l=="number"&&Bd(e,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&($d.hasOwnProperty(i)?l!=null&&i==="onScroll"&&lt("scroll",e):l!=null&&Fb(e,i,l,s))}switch(n){case"input":Lp(e),lk(e,r,!1);break;case"textarea":Lp(e),uk(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Ws(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?rc(e,!!r.multiple,i,!1):r.defaultValue!=null&&rc(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=om)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Sn(t),null;case 6:if(e&&t.stateNode!=null)bN(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(W(166));if(n=Pa(Zd.current),Pa(qo.current),Kp(t)){if(r=t.stateNode,n=t.memoizedProps,r[Wo]=t,(i=r.nodeValue!==n)&&(e=Cr,e!==null))switch(e.tag){case 3:Hp(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Hp(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Wo]=t,t.stateNode=r}return Sn(t),null;case 13:if(ct(gt),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(ut&&kr!==null&&t.mode&1&&!(t.flags&128))FO(),kc(),t.flags|=98560,i=!1;else if(i=Kp(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(W(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(W(317));i[Wo]=t}else kc(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Sn(t),i=!1}else mo!==null&&(i0(mo),mo=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||gt.current&1?zt===0&&(zt=3):bw())),t.updateQueue!==null&&(t.flags|=4),Sn(t),null);case 4:return Ec(),Xx(e,t),e===null&&Gd(t.stateNode.containerInfo),Sn(t),null;case 10:return rw(t.type._context),Sn(t),null;case 17:return tr(t.type)&&im(),Sn(t),null;case 19:if(ct(gt),i=t.memoizedState,i===null)return Sn(t),null;if(r=(t.flags&128)!==0,s=i.rendering,s===null)if(r)Ou(i,!1);else{if(zt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=fm(e),s!==null){for(t.flags|=128,Ou(i,!1),r=s.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,s=i.alternate,s===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=s.childLanes,i.lanes=s.lanes,i.child=s.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=s.memoizedProps,i.memoizedState=s.memoizedState,i.updateQueue=s.updateQueue,i.type=s.type,e=s.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return it(gt,gt.current&1|2),t.child}e=e.sibling}i.tail!==null&&_t()>Tc&&(t.flags|=128,r=!0,Ou(i,!1),t.lanes=4194304)}else{if(!r)if(e=fm(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ou(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!ut)return Sn(t),null}else 2*_t()-i.renderingStartTime>Tc&&n!==1073741824&&(t.flags|=128,r=!0,Ou(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=_t(),t.sibling=null,n=gt.current,it(gt,r?n&1|2:n&1),t):(Sn(t),null);case 22:case 23:return xw(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?xr&1073741824&&(Sn(t),t.subtreeFlags&6&&(t.flags|=8192)):Sn(t),null;case 24:return null;case 25:return null}throw Error(W(156,t.tag))}function n5(e,t){switch(Qb(t),t.tag){case 1:return tr(t.type)&&im(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ec(),ct(er),ct(On),lw(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return aw(t),null;case 13:if(ct(gt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(W(340));kc()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ct(gt),null;case 4:return Ec(),null;case 10:return rw(t.type._context),null;case 22:case 23:return xw(),null;case 24:return null;default:return null}}var Yp=!1,En=!1,r5=typeof WeakSet=="function"?WeakSet:Set,ae=null;function Ql(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){bt(e,t,r)}else n.current=null}function Zx(e,t,n){try{n()}catch(r){bt(e,t,r)}}var Qk=!1;function o5(e,t){if(Ix=tm,e=EO(),Xb(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,c=0,u=0,d=e,f=null;t:for(;;){for(var h;d!==n||o!==0&&d.nodeType!==3||(a=s+o),d!==i||r!==0&&d.nodeType!==3||(l=s+r),d.nodeType===3&&(s+=d.nodeValue.length),(h=d.firstChild)!==null;)f=d,d=h;for(;;){if(d===e)break t;if(f===n&&++c===o&&(a=s),f===i&&++u===r&&(l=s),(h=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=h}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Dx={focusedElem:e,selectionRange:n},tm=!1,ae=t;ae!==null;)if(t=ae,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ae=e;else for(;ae!==null;){t=ae;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var v=m.memoizedProps,x=m.memoizedState,b=t.stateNode,w=b.getSnapshotBeforeUpdate(t.elementType===t.type?v:fo(t.type,v),x);b.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var S=t.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(W(163))}}catch(k){bt(t,t.return,k)}if(e=t.sibling,e!==null){e.return=t.return,ae=e;break}ae=t.return}return m=Qk,Qk=!1,m}function Td(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&Zx(t,n,i)}o=o.next}while(o!==r)}}function Rg(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Qx(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function wN(e){var t=e.alternate;t!==null&&(e.alternate=null,wN(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Wo],delete t[Jd],delete t[zx],delete t[$3],delete t[B3])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function SN(e){return e.tag===5||e.tag===3||e.tag===4}function eC(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||SN(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function e0(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=om));else if(r!==4&&(e=e.child,e!==null))for(e0(e,t,n),e=e.sibling;e!==null;)e0(e,t,n),e=e.sibling}function t0(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(t0(e,t,n),e=e.sibling;e!==null;)t0(e,t,n),e=e.sibling}var ln=null,ho=!1;function qi(e,t,n){for(n=n.child;n!==null;)kN(e,t,n),n=n.sibling}function kN(e,t,n){if(Ko&&typeof Ko.onCommitFiberUnmount=="function")try{Ko.onCommitFiberUnmount(Cg,n)}catch{}switch(n.tag){case 5:En||Ql(n,t);case 6:var r=ln,o=ho;ln=null,qi(e,t,n),ln=r,ho=o,ln!==null&&(ho?(e=ln,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ln.removeChild(n.stateNode));break;case 18:ln!==null&&(ho?(e=ln,n=n.stateNode,e.nodeType===8?iy(e.parentNode,n):e.nodeType===1&&iy(e,n),Hd(e)):iy(ln,n.stateNode));break;case 4:r=ln,o=ho,ln=n.stateNode.containerInfo,ho=!0,qi(e,t,n),ln=r,ho=o;break;case 0:case 11:case 14:case 15:if(!En&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&Zx(n,t,s),o=o.next}while(o!==r)}qi(e,t,n);break;case 1:if(!En&&(Ql(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){bt(n,t,a)}qi(e,t,n);break;case 21:qi(e,t,n);break;case 22:n.mode&1?(En=(r=En)||n.memoizedState!==null,qi(e,t,n),En=r):qi(e,t,n);break;default:qi(e,t,n)}}function tC(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new r5),t.forEach(function(r){var o=p5.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function io(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];try{var i=e,s=t,a=s;e:for(;a!==null;){switch(a.tag){case 5:ln=a.stateNode,ho=!1;break e;case 3:ln=a.stateNode.containerInfo,ho=!0;break e;case 4:ln=a.stateNode.containerInfo,ho=!0;break e}a=a.return}if(ln===null)throw Error(W(160));kN(i,s,o),ln=null,ho=!1;var l=o.alternate;l!==null&&(l.return=null),o.return=null}catch(c){bt(o,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)CN(t,e),t=t.sibling}function CN(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(io(t,e),Bo(e),r&4){try{Td(3,e,e.return),Rg(3,e)}catch(v){bt(e,e.return,v)}try{Td(5,e,e.return)}catch(v){bt(e,e.return,v)}}break;case 1:io(t,e),Bo(e),r&512&&n!==null&&Ql(n,n.return);break;case 5:if(io(t,e),Bo(e),r&512&&n!==null&&Ql(n,n.return),e.flags&32){var o=e.stateNode;try{Bd(o,"")}catch(v){bt(e,e.return,v)}}if(r&4&&(o=e.stateNode,o!=null)){var i=e.memoizedProps,s=n!==null?n.memoizedProps:i,a=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{a==="input"&&i.type==="radio"&&i.name!=null&&KT(o,i),Ex(a,s);var c=Ex(a,i);for(s=0;s<l.length;s+=2){var u=l[s],d=l[s+1];u==="style"?XT(o,d):u==="dangerouslySetInnerHTML"?YT(o,d):u==="children"?Bd(o,d):Fb(o,u,d,c)}switch(a){case"input":bx(o,i);break;case"textarea":qT(o,i);break;case"select":var f=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var h=i.value;h!=null?rc(o,!!i.multiple,h,!1):f!==!!i.multiple&&(i.defaultValue!=null?rc(o,!!i.multiple,i.defaultValue,!0):rc(o,!!i.multiple,i.multiple?[]:"",!1))}o[Jd]=i}catch(v){bt(e,e.return,v)}}break;case 6:if(io(t,e),Bo(e),r&4){if(e.stateNode===null)throw Error(W(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(v){bt(e,e.return,v)}}break;case 3:if(io(t,e),Bo(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Hd(t.containerInfo)}catch(v){bt(e,e.return,v)}break;case 4:io(t,e),Bo(e);break;case 13:io(t,e),Bo(e),o=e.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(vw=_t())),r&4&&tC(e);break;case 22:if(u=n!==null&&n.memoizedState!==null,e.mode&1?(En=(c=En)||u,io(t,e),En=c):io(t,e),Bo(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!u&&e.mode&1)for(ae=e,u=e.child;u!==null;){for(d=ae=u;ae!==null;){switch(f=ae,h=f.child,f.tag){case 0:case 11:case 14:case 15:Td(4,f,f.return);break;case 1:Ql(f,f.return);var m=f.stateNode;if(typeof m.componentWillUnmount=="function"){r=f,n=f.return;try{t=r,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(v){bt(r,n,v)}}break;case 5:Ql(f,f.return);break;case 22:if(f.memoizedState!==null){rC(d);continue}}h!==null?(h.return=f,ae=h):rC(d)}u=u.sibling}e:for(u=null,d=e;;){if(d.tag===5){if(u===null){u=d;try{o=d.stateNode,c?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(a=d.stateNode,l=d.memoizedProps.style,s=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=JT("display",s))}catch(v){bt(e,e.return,v)}}}else if(d.tag===6){if(u===null)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(v){bt(e,e.return,v)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===e)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;d.sibling===null;){if(d.return===null||d.return===e)break e;u===d&&(u=null),d=d.return}u===d&&(u=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:io(t,e),Bo(e),r&4&&tC(e);break;case 21:break;default:io(t,e),Bo(e)}}function Bo(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(SN(n)){var r=n;break e}n=n.return}throw Error(W(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(Bd(o,""),r.flags&=-33);var i=eC(e);t0(e,i,o);break;case 3:case 4:var s=r.stateNode.containerInfo,a=eC(e);e0(e,a,s);break;default:throw Error(W(161))}}catch(l){bt(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function i5(e,t,n){ae=e,EN(e)}function EN(e,t,n){for(var r=(e.mode&1)!==0;ae!==null;){var o=ae,i=o.child;if(o.tag===22&&r){var s=o.memoizedState!==null||Yp;if(!s){var a=o.alternate,l=a!==null&&a.memoizedState!==null||En;a=Yp;var c=En;if(Yp=s,(En=l)&&!c)for(ae=o;ae!==null;)s=ae,l=s.child,s.tag===22&&s.memoizedState!==null?oC(o):l!==null?(l.return=s,ae=l):oC(o);for(;i!==null;)ae=i,EN(i),i=i.sibling;ae=o,Yp=a,En=c}nC(e)}else o.subtreeFlags&8772&&i!==null?(i.return=o,ae=i):nC(e)}}function nC(e){for(;ae!==null;){var t=ae;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:En||Rg(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!En)if(n===null)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:fo(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&$k(t,i,r);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}$k(t,s,n)}break;case 5:var a=t.stateNode;if(n===null&&t.flags&4){n=a;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var u=c.memoizedState;if(u!==null){var d=u.dehydrated;d!==null&&Hd(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(W(163))}En||t.flags&512&&Qx(t)}catch(f){bt(t,t.return,f)}}if(t===e){ae=null;break}if(n=t.sibling,n!==null){n.return=t.return,ae=n;break}ae=t.return}}function rC(e){for(;ae!==null;){var t=ae;if(t===e){ae=null;break}var n=t.sibling;if(n!==null){n.return=t.return,ae=n;break}ae=t.return}}function oC(e){for(;ae!==null;){var t=ae;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Rg(4,t)}catch(l){bt(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(l){bt(t,o,l)}}var i=t.return;try{Qx(t)}catch(l){bt(t,i,l)}break;case 5:var s=t.return;try{Qx(t)}catch(l){bt(t,s,l)}}}catch(l){bt(t,t.return,l)}if(t===e){ae=null;break}var a=t.sibling;if(a!==null){a.return=t.return,ae=a;break}ae=t.return}}var s5=Math.ceil,mm=zi.ReactCurrentDispatcher,mw=zi.ReactCurrentOwner,Wr=zi.ReactCurrentBatchConfig,We=0,Qt=null,Pt=null,fn=0,xr=0,ec=aa(0),zt=0,nf=null,Ya=0,jg=0,gw=0,Od=null,Gn=null,vw=0,Tc=1/0,hi=null,gm=!1,n0=null,js=null,Jp=!1,Cs=null,vm=0,Nd=0,r0=null,Ch=-1,Eh=0;function Fn(){return We&6?_t():Ch!==-1?Ch:Ch=_t()}function As(e){return e.mode&1?We&2&&fn!==0?fn&-fn:U3.transition!==null?(Eh===0&&(Eh=cO()),Eh):(e=Qe,e!==0||(e=window.event,e=e===void 0?16:gO(e.type)),e):1}function Co(e,t,n,r){if(50<Nd)throw Nd=0,r0=null,Error(W(185));Zf(e,n,r),(!(We&2)||e!==Qt)&&(e===Qt&&(!(We&2)&&(jg|=n),zt===4&&gs(e,fn)),nr(e,r),n===1&&We===0&&!(t.mode&1)&&(Tc=_t()+500,Ng&&la()))}function nr(e,t){var n=e.callbackNode;U4(e,t);var r=em(e,e===Qt?fn:0);if(r===0)n!==null&&pk(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&pk(n),t===1)e.tag===0?V3(iC.bind(null,e)):IO(iC.bind(null,e)),F3(function(){!(We&6)&&la()}),n=null;else{switch(uO(r)){case 1:n=Ub;break;case 4:n=aO;break;case 16:n=Qh;break;case 536870912:n=lO;break;default:n=Qh}n=jN(n,_N.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function _N(e,t){if(Ch=-1,Eh=0,We&6)throw Error(W(327));var n=e.callbackNode;if(lc()&&e.callbackNode!==n)return null;var r=em(e,e===Qt?fn:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=ym(e,r);else{t=r;var o=We;We|=2;var i=ON();(Qt!==e||fn!==t)&&(hi=null,Tc=_t()+500,Fa(e,t));do try{c5();break}catch(a){TN(e,a)}while(!0);nw(),mm.current=i,We=o,Pt!==null?t=0:(Qt=null,fn=0,t=zt)}if(t!==0){if(t===2&&(o=Mx(e),o!==0&&(r=o,t=o0(e,o))),t===1)throw n=nf,Fa(e,0),gs(e,r),nr(e,_t()),n;if(t===6)gs(e,r);else{if(o=e.current.alternate,!(r&30)&&!a5(o)&&(t=ym(e,r),t===2&&(i=Mx(e),i!==0&&(r=i,t=o0(e,i))),t===1))throw n=nf,Fa(e,0),gs(e,r),nr(e,_t()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(W(345));case 2:Sa(e,Gn,hi);break;case 3:if(gs(e,r),(r&130023424)===r&&(t=vw+500-_t(),10<t)){if(em(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){Fn(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=Fx(Sa.bind(null,e,Gn,hi),t);break}Sa(e,Gn,hi);break;case 4:if(gs(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var s=31-ko(r);i=1<<s,s=t[s],s>o&&(o=s),r&=~i}if(r=o,r=_t()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*s5(r/1960))-r,10<r){e.timeoutHandle=Fx(Sa.bind(null,e,Gn,hi),r);break}Sa(e,Gn,hi);break;case 5:Sa(e,Gn,hi);break;default:throw Error(W(329))}}}return nr(e,_t()),e.callbackNode===n?_N.bind(null,e):null}function o0(e,t){var n=Od;return e.current.memoizedState.isDehydrated&&(Fa(e,t).flags|=256),e=ym(e,t),e!==2&&(t=Gn,Gn=n,t!==null&&i0(t)),e}function i0(e){Gn===null?Gn=e:Gn.push.apply(Gn,e)}function a5(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var o=n[r],i=o.getSnapshot;o=o.value;try{if(!To(i(),o))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 gs(e,t){for(t&=~gw,t&=~jg,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-ko(t),r=1<<n;e[n]=-1,t&=~r}}function iC(e){if(We&6)throw Error(W(327));lc();var t=em(e,0);if(!(t&1))return nr(e,_t()),null;var n=ym(e,t);if(e.tag!==0&&n===2){var r=Mx(e);r!==0&&(t=r,n=o0(e,r))}if(n===1)throw n=nf,Fa(e,0),gs(e,t),nr(e,_t()),n;if(n===6)throw Error(W(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Sa(e,Gn,hi),nr(e,_t()),null}function yw(e,t){var n=We;We|=1;try{return e(t)}finally{We=n,We===0&&(Tc=_t()+500,Ng&&la())}}function Ja(e){Cs!==null&&Cs.tag===0&&!(We&6)&&lc();var t=We;We|=1;var n=Wr.transition,r=Qe;try{if(Wr.transition=null,Qe=1,e)return e()}finally{Qe=r,Wr.transition=n,We=t,!(We&6)&&la()}}function xw(){xr=ec.current,ct(ec)}function Fa(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,L3(n)),Pt!==null)for(n=Pt.return;n!==null;){var r=n;switch(Qb(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&im();break;case 3:Ec(),ct(er),ct(On),lw();break;case 5:aw(r);break;case 4:Ec();break;case 13:ct(gt);break;case 19:ct(gt);break;case 10:rw(r.type._context);break;case 22:case 23:xw()}n=n.return}if(Qt=e,Pt=e=Is(e.current,null),fn=xr=t,zt=0,nf=null,gw=jg=Ya=0,Gn=Od=null,Ma!==null){for(t=0;t<Ma.length;t++)if(n=Ma[t],r=n.interleaved,r!==null){n.interleaved=null;var o=r.next,i=n.pending;if(i!==null){var s=i.next;i.next=o,r.next=s}n.pending=r}Ma=null}return e}function TN(e,t){do{var n=Pt;try{if(nw(),wh.current=hm,pm){for(var r=yt.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}pm=!1}if(Ga=0,Yt=It=yt=null,_d=!1,Qd=0,mw.current=null,n===null||n.return===null){zt=1,nf=t,Pt=null;break}e:{var i=e,s=n.return,a=n,l=t;if(t=fn,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,u=a,d=u.tag;if(!(u.mode&1)&&(d===0||d===11||d===15)){var f=u.alternate;f?(u.updateQueue=f.updateQueue,u.memoizedState=f.memoizedState,u.lanes=f.lanes):(u.updateQueue=null,u.memoizedState=null)}var h=Kk(s);if(h!==null){h.flags&=-257,qk(h,s,a,i,t),h.mode&1&&Hk(i,c,t),t=h,l=c;var m=t.updateQueue;if(m===null){var v=new Set;v.add(l),t.updateQueue=v}else m.add(l);break e}else{if(!(t&1)){Hk(i,c,t),bw();break e}l=Error(W(426))}}else if(ut&&a.mode&1){var x=Kk(s);if(x!==null){!(x.flags&65536)&&(x.flags|=256),qk(x,s,a,i,t),ew(_c(l,a));break e}}i=l=_c(l,a),zt!==4&&(zt=2),Od===null?Od=[i]:Od.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var b=uN(i,l,t);zk(i,b);break e;case 1:a=l;var w=i.type,S=i.stateNode;if(!(i.flags&128)&&(typeof w.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(js===null||!js.has(S)))){i.flags|=65536,t&=-t,i.lanes|=t;var k=dN(i,a,t);zk(i,k);break e}}i=i.return}while(i!==null)}MN(n)}catch(C){t=C,Pt===n&&n!==null&&(Pt=n=n.return);continue}break}while(!0)}function ON(){var e=mm.current;return mm.current=hm,e===null?hm:e}function bw(){(zt===0||zt===3||zt===2)&&(zt=4),Qt===null||!(Ya&268435455)&&!(jg&268435455)||gs(Qt,fn)}function ym(e,t){var n=We;We|=2;var r=ON();(Qt!==e||fn!==t)&&(hi=null,Fa(e,t));do try{l5();break}catch(o){TN(e,o)}while(!0);if(nw(),We=n,mm.current=r,Pt!==null)throw Error(W(261));return Qt=null,fn=0,zt}function l5(){for(;Pt!==null;)NN(Pt)}function c5(){for(;Pt!==null&&!A4();)NN(Pt)}function NN(e){var t=RN(e.alternate,e,xr);e.memoizedProps=e.pendingProps,t===null?MN(e):Pt=t,mw.current=null}function MN(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=n5(n,t),n!==null){n.flags&=32767,Pt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{zt=6,Pt=null;return}}else if(n=t5(n,t,xr),n!==null){Pt=n;return}if(t=t.sibling,t!==null){Pt=t;return}Pt=t=e}while(t!==null);zt===0&&(zt=5)}function Sa(e,t,n){var r=Qe,o=Wr.transition;try{Wr.transition=null,Qe=1,u5(e,t,n,r)}finally{Wr.transition=o,Qe=r}return null}function u5(e,t,n,r){do lc();while(Cs!==null);if(We&6)throw Error(W(327));n=e.finishedWork;var o=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(W(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(W4(e,i),e===Qt&&(Pt=Qt=null,fn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Jp||(Jp=!0,jN(Qh,function(){return lc(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Wr.transition,Wr.transition=null;var s=Qe;Qe=1;var a=We;We|=4,mw.current=null,o5(e,n),CN(n,e),M3(Dx),tm=!!Ix,Dx=Ix=null,e.current=n,i5(n),I4(),We=a,Qe=s,Wr.transition=i}else e.current=n;if(Jp&&(Jp=!1,Cs=e,vm=o),i=e.pendingLanes,i===0&&(js=null),F4(n.stateNode),nr(e,_t()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)o=t[n],r(o.value,{componentStack:o.stack,digest:o.digest});if(gm)throw gm=!1,e=n0,n0=null,e;return vm&1&&e.tag!==0&&lc(),i=e.pendingLanes,i&1?e===r0?Nd++:(Nd=0,r0=e):Nd=0,la(),null}function lc(){if(Cs!==null){var e=uO(vm),t=Wr.transition,n=Qe;try{if(Wr.transition=null,Qe=16>e?16:e,Cs===null)var r=!1;else{if(e=Cs,Cs=null,vm=0,We&6)throw Error(W(331));var o=We;for(We|=4,ae=e.current;ae!==null;){var i=ae,s=i.child;if(ae.flags&16){var a=i.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(ae=c;ae!==null;){var u=ae;switch(u.tag){case 0:case 11:case 15:Td(8,u,i)}var d=u.child;if(d!==null)d.return=u,ae=d;else for(;ae!==null;){u=ae;var f=u.sibling,h=u.return;if(wN(u),u===c){ae=null;break}if(f!==null){f.return=h,ae=f;break}ae=h}}}var m=i.alternate;if(m!==null){var v=m.child;if(v!==null){m.child=null;do{var x=v.sibling;v.sibling=null,v=x}while(v!==null)}}ae=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,ae=s;else e:for(;ae!==null;){if(i=ae,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Td(9,i,i.return)}var b=i.sibling;if(b!==null){b.return=i.return,ae=b;break e}ae=i.return}}var w=e.current;for(ae=w;ae!==null;){s=ae;var S=s.child;if(s.subtreeFlags&2064&&S!==null)S.return=s,ae=S;else e:for(s=w;ae!==null;){if(a=ae,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Rg(9,a)}}catch(C){bt(a,a.return,C)}if(a===s){ae=null;break e}var k=a.sibling;if(k!==null){k.return=a.return,ae=k;break e}ae=a.return}}if(We=o,la(),Ko&&typeof Ko.onPostCommitFiberRoot=="function")try{Ko.onPostCommitFiberRoot(Cg,e)}catch{}r=!0}return r}finally{Qe=n,Wr.transition=t}}return!1}function sC(e,t,n){t=_c(n,t),t=uN(e,t,1),e=Rs(e,t,1),t=Fn(),e!==null&&(Zf(e,1,t),nr(e,t))}function bt(e,t,n){if(e.tag===3)sC(e,e,n);else for(;t!==null;){if(t.tag===3){sC(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(js===null||!js.has(r))){e=_c(n,e),e=dN(t,e,1),t=Rs(t,e,1),e=Fn(),t!==null&&(Zf(t,1,e),nr(t,e));break}}t=t.return}}function d5(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Fn(),e.pingedLanes|=e.suspendedLanes&n,Qt===e&&(fn&n)===n&&(zt===4||zt===3&&(fn&130023424)===fn&&500>_t()-vw?Fa(e,0):gw|=n),nr(e,t)}function PN(e,t){t===0&&(e.mode&1?(t=$p,$p<<=1,!($p&130023424)&&($p=4194304)):t=1);var n=Fn();e=Pi(e,t),e!==null&&(Zf(e,t,n),nr(e,n))}function f5(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),PN(e,n)}function p5(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(W(314))}r!==null&&r.delete(t),PN(e,n)}var RN;RN=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||er.current)Jn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Jn=!1,e5(e,t,n);Jn=!!(e.flags&131072)}else Jn=!1,ut&&t.flags&1048576&&DO(t,lm,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;kh(e,t),e=t.pendingProps;var o=Sc(t,On.current);ac(t,n),o=uw(null,t,r,e,o,n);var i=dw();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,tr(r)?(i=!0,sm(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,iw(t),o.updater=Pg,t.stateNode=o,o._reactInternals=t,Hx(t,r,e,n),t=Gx(null,t,r,!0,i,n)):(t.tag=0,ut&&i&&Zb(t),In(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(kh(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=m5(r),e=fo(r,e),o){case 0:t=qx(null,t,r,e,n);break e;case 1:t=Jk(null,t,r,e,n);break e;case 11:t=Gk(null,t,r,e,n);break e;case 14:t=Yk(null,t,r,fo(r.type,e),n);break e}throw Error(W(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:fo(r,o),qx(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:fo(r,o),Jk(e,t,r,o,n);case 3:e:{if(mN(t),e===null)throw Error(W(387));r=t.pendingProps,i=t.memoizedState,o=i.element,VO(e,t),dm(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=_c(Error(W(423)),t),t=Xk(e,t,r,n,o);break e}else if(r!==o){o=_c(Error(W(424)),t),t=Xk(e,t,r,n,o);break e}else for(kr=Ps(t.stateNode.containerInfo.firstChild),Cr=t,ut=!0,mo=null,n=$O(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(kc(),r===o){t=Ri(e,t,n);break e}In(e,t,r,n)}t=t.child}return t;case 5:return UO(t),e===null&&Vx(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,Lx(r,o)?s=null:i!==null&&Lx(r,i)&&(t.flags|=32),hN(e,t),In(e,t,s,n),t.child;case 6:return e===null&&Vx(t),null;case 13:return gN(e,t,n);case 4:return sw(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Cc(t,null,r,n):In(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:fo(r,o),Gk(e,t,r,o,n);case 7:return In(e,t,t.pendingProps,n),t.child;case 8:return In(e,t,t.pendingProps.children,n),t.child;case 12:return In(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,i=t.memoizedProps,s=o.value,it(cm,r._currentValue),r._currentValue=s,i!==null)if(To(i.value,s)){if(i.children===o.children&&!er.current){t=Ri(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){s=i.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=_i(-1,n&-n),l.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Ux(i.return,n,t),a.lanes|=n;break}l=l.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(W(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Ux(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}In(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,ac(t,n),o=Gr(o),r=r(o),t.flags|=1,In(e,t,r,n),t.child;case 14:return r=t.type,o=fo(r,t.pendingProps),o=fo(r.type,o),Yk(e,t,r,o,n);case 15:return fN(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:fo(r,o),kh(e,t),t.tag=1,tr(r)?(e=!0,sm(t)):e=!1,ac(t,n),cN(t,r,o),Hx(t,r,o,n),Gx(null,t,r,!0,e,n);case 19:return vN(e,t,n);case 22:return pN(e,t,n)}throw Error(W(156,t.tag))};function jN(e,t){return sO(e,t)}function h5(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.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 Vr(e,t,n,r){return new h5(e,t,n,r)}function ww(e){return e=e.prototype,!(!e||!e.isReactComponent)}function m5(e){if(typeof e=="function")return ww(e)?1:0;if(e!=null){if(e=e.$$typeof,e===$b)return 11;if(e===Bb)return 14}return 2}function Is(e,t){var n=e.alternate;return n===null?(n=Vr(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&14680064,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}function _h(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")ww(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Wl:return za(n.children,o,i,t);case zb:s=8,o|=8;break;case mx:return e=Vr(12,n,t,o|2),e.elementType=mx,e.lanes=i,e;case gx:return e=Vr(13,n,t,o),e.elementType=gx,e.lanes=i,e;case vx:return e=Vr(19,n,t,o),e.elementType=vx,e.lanes=i,e;case UT:return Ag(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case BT:s=10;break e;case VT:s=9;break e;case $b:s=11;break e;case Bb:s=14;break e;case us:s=16,r=null;break e}throw Error(W(130,e==null?e:typeof e,""))}return t=Vr(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function za(e,t,n,r){return e=Vr(7,e,r,t),e.lanes=n,e}function Ag(e,t,n,r){return e=Vr(22,e,r,t),e.elementType=UT,e.lanes=n,e.stateNode={isHidden:!1},e}function py(e,t,n){return e=Vr(6,e,null,t),e.lanes=n,e}function hy(e,t,n){return t=Vr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function g5(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Gv(0),this.expirationTimes=Gv(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Gv(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Sw(e,t,n,r,o,i,s,a,l){return e=new g5(e,t,n,a,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Vr(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},iw(i),e}function v5(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Ul,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function AN(e){if(!e)return Hs;e=e._reactInternals;e:{if(hl(e)!==e||e.tag!==1)throw Error(W(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(tr(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(W(171))}if(e.tag===1){var n=e.type;if(tr(n))return AO(e,n,t)}return t}function IN(e,t,n,r,o,i,s,a,l){return e=Sw(n,r,!0,e,o,i,s,a,l),e.context=AN(null),n=e.current,r=Fn(),o=As(n),i=_i(r,o),i.callback=t??null,Rs(n,i,o),e.current.lanes=o,Zf(e,o,r),nr(e,r),e}function Ig(e,t,n,r){var o=t.current,i=Fn(),s=As(o);return n=AN(n),t.context===null?t.context=n:t.pendingContext=n,t=_i(i,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Rs(o,t,s),e!==null&&(Co(e,o,s,i),bh(e,o,s)),s}function xm(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function aC(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function kw(e,t){aC(e,t),(e=e.alternate)&&aC(e,t)}function y5(){return null}var DN=typeof reportError=="function"?reportError:function(e){console.error(e)};function Cw(e){this._internalRoot=e}Dg.prototype.render=Cw.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(W(409));Ig(e,t,null,null)};Dg.prototype.unmount=Cw.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ja(function(){Ig(null,e,null,null)}),t[Mi]=null}};function Dg(e){this._internalRoot=e}Dg.prototype.unstable_scheduleHydration=function(e){if(e){var t=pO();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ms.length&&t!==0&&t<ms[n].priority;n++);ms.splice(n,0,e),n===0&&mO(e)}};function Ew(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Lg(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function lC(){}function x5(e,t,n,r,o){if(o){if(typeof r=="function"){var i=r;r=function(){var c=xm(s);i.call(c)}}var s=IN(t,r,e,0,null,!1,!1,"",lC);return e._reactRootContainer=s,e[Mi]=s.current,Gd(e.nodeType===8?e.parentNode:e),Ja(),s}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var a=r;r=function(){var c=xm(l);a.call(c)}}var l=Sw(e,0,!1,null,null,!1,!1,"",lC);return e._reactRootContainer=l,e[Mi]=l.current,Gd(e.nodeType===8?e.parentNode:e),Ja(function(){Ig(t,l,n,r)}),l}function Fg(e,t,n,r,o){var i=n._reactRootContainer;if(i){var s=i;if(typeof o=="function"){var a=o;o=function(){var l=xm(s);a.call(l)}}Ig(t,s,e,o)}else s=x5(n,t,e,o,r);return xm(s)}dO=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Vu(t.pendingLanes);n!==0&&(Wb(t,n|1),nr(t,_t()),!(We&6)&&(Tc=_t()+500,la()))}break;case 13:Ja(function(){var r=Pi(e,1);if(r!==null){var o=Fn();Co(r,e,1,o)}}),kw(e,1)}};Hb=function(e){if(e.tag===13){var t=Pi(e,134217728);if(t!==null){var n=Fn();Co(t,e,134217728,n)}kw(e,134217728)}};fO=function(e){if(e.tag===13){var t=As(e),n=Pi(e,t);if(n!==null){var r=Fn();Co(n,e,t,r)}kw(e,t)}};pO=function(){return Qe};hO=function(e,t){var n=Qe;try{return Qe=e,t()}finally{Qe=n}};Tx=function(e,t,n){switch(t){case"input":if(bx(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=Og(r);if(!o)throw Error(W(90));HT(r),bx(r,o)}}}break;case"textarea":qT(e,n);break;case"select":t=n.value,t!=null&&rc(e,!!n.multiple,t,!1)}};eO=yw;tO=Ja;var b5={usingClientEntryPoint:!1,Events:[ep,Gl,Og,ZT,QT,yw]},Nu={findFiberByHostInstance:Na,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},w5={bundleType:Nu.bundleType,version:Nu.version,rendererPackageName:Nu.rendererPackageName,rendererConfig:Nu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:zi.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=oO(e),e===null?null:e.stateNode},findFiberByHostInstance:Nu.findFiberByHostInstance||y5,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Xp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xp.isDisabled&&Xp.supportsFiber)try{Cg=Xp.inject(w5),Ko=Xp}catch{}}Rr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=b5;Rr.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ew(t))throw Error(W(200));return v5(e,t,null,n)};Rr.createRoot=function(e,t){if(!Ew(e))throw Error(W(299));var n=!1,r="",o=DN;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=Sw(e,1,!1,null,null,n,!1,r,o),e[Mi]=t.current,Gd(e.nodeType===8?e.parentNode:e),new Cw(t)};Rr.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(W(188)):(e=Object.keys(e).join(","),Error(W(268,e)));return e=oO(t),e=e===null?null:e.stateNode,e};Rr.flushSync=function(e){return Ja(e)};Rr.hydrate=function(e,t,n){if(!Lg(t))throw Error(W(200));return Fg(null,e,t,!0,n)};Rr.hydrateRoot=function(e,t,n){if(!Ew(e))throw Error(W(405));var r=n!=null&&n.hydratedSources||null,o=!1,i="",s=DN;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=IN(t,null,e,1,n??null,o,!1,i,s),e[Mi]=t.current,Gd(e),r)for(e=0;e<r.length;e++)n=r[e],o=n._getVersion,o=o(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new Dg(t)};Rr.render=function(e,t,n){if(!Lg(t))throw Error(W(200));return Fg(null,e,t,!1,n)};Rr.unmountComponentAtNode=function(e){if(!Lg(e))throw Error(W(40));return e._reactRootContainer?(Ja(function(){Fg(null,null,e,!1,function(){e._reactRootContainer=null,e[Mi]=null})}),!0):!1};Rr.unstable_batchedUpdates=yw;Rr.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Lg(n))throw Error(W(200));if(e==null||e._reactInternals===void 0)throw Error(W(38));return Fg(e,t,n,!1,r)};Rr.version="18.3.1-next-f1338f8080-20240426";function LN(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(LN)}catch(e){console.error(e)}}LN(),LT.exports=Rr;var Yn=LT.exports;const S5=ia(Yn);var cC=Yn;Yh.createRoot=cC.createRoot,Yh.hydrateRoot=cC.hydrateRoot;var FN={exports:{}},zg={};/**
33
- * @license React
34
- * react-jsx-runtime.production.min.js
35
- *
36
- * Copyright (c) Facebook, Inc. and its affiliates.
37
- *
38
- * This source code is licensed under the MIT license found in the
39
- * LICENSE file in the root directory of this source tree.
40
- */var k5=g,C5=Symbol.for("react.element"),E5=Symbol.for("react.fragment"),_5=Object.prototype.hasOwnProperty,T5=k5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,O5={key:!0,ref:!0,__self:!0,__source:!0};function zN(e,t,n){var r,o={},i=null,s=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(s=t.ref);for(r in t)_5.call(t,r)&&!O5.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:C5,type:e,key:i,ref:s,props:o,_owner:T5.current}}zg.Fragment=E5;zg.jsx=zN;zg.jsxs=zN;FN.exports=zg;var p=FN.exports;function s0(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function _w(e,t){if(e){if(typeof e=="string")return s0(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s0(e,t):void 0}}function my(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=_w(e))||t){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(l){throw l},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
41
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return s=l.done,l},e:function(l){a=!0,i=l},f:function(){try{s||n.return==null||n.return()}finally{if(a)throw i}}}}function N5(e){return e.length>0}var Tw=Object.freeze({kind:"ok",value:void 0});function rr(e){return e===void 0?Tw:{kind:"ok",value:e}}function Oo(e){return{kind:"err",error:e}}function $g(e){return e===Tw||e.kind==="ok"}function M5(e){return e!==Tw&&e.kind==="err"}function $N(e,t){return function(n){for(var r=rr(t),o=0;o<n.length&&$g(r);++o)r=e(r.value,n[o],o);return r}}function go(e){return function(t){return $g(t)?rr(e(t.value)):t}}function Oc(e){return function(t){return $g(t)?e(t.value):t}}var Ow=function(t,n){return function(r){return $g(r)?t(r.value)?r:Oo(n(r.value)):r}};function P5(e){if(Array.isArray(e))return e}function R5(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,s,a=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(u){c=!0,o=u}finally{try{if(!l&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return a}}function j5(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
42
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hn(e,t){return P5(e)||R5(e,t)||_w(e,t)||j5()}function A5(e){if(Array.isArray(e))return s0(e)}function I5(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function D5(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
43
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Wu(e){return A5(e)||I5(e)||_w(e)||D5()}function Z(e){"@babel/helpers - typeof";return Z=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Z(e)}function L5(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function BN(e){var t=L5(e,"string");return typeof t=="symbol"?t:t+""}function F(e,t,n){return(t=BN(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function uC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function _n(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?uC(Object(n),!0).forEach(function(r){F(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ut(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function F5(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,BN(r.key),r)}}function Wt(e,t,n){return t&&F5(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function bm(e){return bm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},bm(e)}function VN(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(VN=function(){return!!e})()}function z5(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $5(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return z5(e)}function lr(e,t,n){return t=bm(t),$5(e,VN()?Reflect.construct(t,n||[],bm(e).constructor):t.apply(e,n))}function a0(e,t){return a0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},a0(e,t)}function cr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a0(e,t)}var ur=function(){function e(){Ut(this,e)}return Wt(e,[{key:"appendValidationError",value:function(n,r,o,i){return n?(n[r]?n[r].push({message:o,value:i}):n[r]=[{message:o,value:i}],n):F({},r,[{message:o,value:i}])}}])}(),Md=Symbol("GetSchema"),Ln=Symbol("Path"),Lt=Symbol("GetSource");function B5(e){return e[Md]}var Nw=Wt(function e(t){Ut(this,e),this.span=t}),V5=function(e){function t(n,r){var o;return Ut(this,t),o=lr(this,t,[r]),F(o,"type","Sym"),o.value=n,o}return cr(t,e),Wt(t,[{key:"transpile",value:function(){return this.value}}])}(Nw);new V5("()");var Xn="_type",St="_ref",l0="_tag",U5=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Ut(this,t),r=lr(this,t),r.options=n,r.opt=o,r}return cr(t,e),Wt(t,[{key:"validate",value:function(r,o){if(this.opt&&o==null)return!1;if(o==null)return F({},r,[{message:"Non-optional file was null or undefined.",value:o}]);if(typeof o[St]!="string")return F({},r,[{message:"File did not have a file reference string. Got: ".concat(Z(o[St])),value:o}]);if(o[Xn]!=="file")return F({},r,[{message:"File did not have the valid file extension type. Got: ".concat(o[Xn]),value:o,fixes:["file:change-extension","file:check-metadata"]}]);var i=this.options||{},s=i.accept,a=o.metadata||{},l=a.mimeType;if(s&&l&&!l.includes("/"))return F({},r,[{message:"Invalid mime type format. Got: ".concat(l),value:o,fixes:["file:change-extension","file:check-metadata"]}]);if(s&&l&&l.includes("/")){var c=s.split(",").map(function(f){return f.trim()}),u=c.some(function(f){if(f==="*/*")return!0;if(f.endsWith("/*")){var h=f.slice(0,-2);return l.startsWith(h)}return f===l});if(!u)return F({},r,[{message:"Mime type mismatch. Found '".concat(l,"' but schema accepts '").concat(s,"'"),value:o,fixes:["file:change-extension","file:check-metadata"]}])}var d=ue.filenameToMimeType(o[St]);return d?d!==l?F({},r,[{message:"Mime type and file extension not matching. Mime type is '".concat(l,"' but file extension is '").concat(d,"'"),value:o,fixes:["file:change-extension","file:check-metadata"]}]):o.metadata?F({},r,[{message:"Found metadata, but it could not be validated. File metadata must be an object with the mimeType.",value:o,fixes:["file:check-metadata"]}]):F({},r,[{message:"Missing File metadata.",value:o,fixes:["file:add-metadata"]}]):F({},r,[{message:"Could not determine mime type from file extension. Got: ".concat(o[St]),value:o,fixes:["file:change-extension","file:check-metadata"]}])}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:F({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])}:Z(o)!=="object"?{success:!1,errors:F({},r,[{message:"Expected object, got '".concat(Z(o),"'"),typeError:!0}])}:St in o?Xn in o&&o[Xn]==="file"?{success:!0,data:o}:{success:!1,errors:F({},r,[{message:"Value of this schema must use: 'c.file' (error type: missing_file_extension)",typeError:!0}])}:{success:!1,errors:F({},r,[{message:"Value of this schema must use: 'c.file' (error type: missing_ref_prop)",typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"file",options:this.options,opt:this.opt}}}])}(ur),W5=function(t){return new U5(t)};function UN(e){return e[St].startsWith("/public")?e.patch_id?{url:"/api/val/files"+e[St]+"?patch_id=".concat(e.patch_id),metadata:e.metadata}:{url:e[St].slice(7),metadata:e.metadata}:{url:e[St]+(e.patch_id?"?patch_id=".concat(e.patch_id):""),metadata:e.metadata}}function WN(e){return Z(e)==="object"&&e!==null&&e!==void 0&&("val"in e||"valPath"in e)}function H5(e){return Z(e)==="object"&&e!==null&&e!==void 0&&Ln in e&&"val"in e}function HN(e){return e[Ln]}function K5(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function dC(e,t,n){return t?qt(e(qt(t,n))):qt(t,n)}function Ds(e){return Z(e)==="object"&&e!==null&&(Lt in e||Ln in e)}function qt(e,t,n){if(Z(e)==="object"){if(Ds(e))return e;if(WN(e))return qt(e.val,e.valPath)}if(e&&e[St]&&e[Xn]==="file"){var r=e[St];if(typeof r!="string")throw Error("Invalid file ref: "+r);return qt(UN(e),t,n)}switch(Z(e)){case"function":case"symbol":throw Error("Invalid selector type: ".concat(Z(e),": ").concat(e));case"object":if(e!==null)return new Proxy(e,{has:function(i,s){return s===Lt||s===Ln||s==="andThen"||s===Md?!0:s in i},get:function(i,s){if(s===Lt)return e;if(s===Ln)return t;if(s===Md)return n;if(s==="andThen")return function(l){return dC(l,e,t)};if(Array.isArray(i)){if(s==="filter")return function(l){var c=i.map(function(u,d){return qt(u,Ur(t,d),void 0)}).filter(function(u){return l&&l instanceof ur?l.assert(t||"",fC(u)).success:fC(l(u))});return qt(c,t,n)};if(s==="map")return function(l){var c=i.map(function(u,d){var f=l(qt(u,Ur(t,d),void 0),qt(d));return Ds(f)?f:qt(f)});return qt(c,t,n)}}if(Array.isArray(i)&&s==="length")return qt(i.length);var a=Reflect.get(i,s);return K5(e,s)?Number.isNaN(Number(s))?qt(a,Ur(t,s),void 0):qt(a,Ur(t,Number(s)),void 0):a}});default:return F(F(F({eq:function(i){var s=i;if(Ds(i)&&(s=i[Lt],s instanceof Nw))throw Error("TODO: Cannot evaluate equality with an Expr");return qt(e===s,void 0)},andThen:function(i){return dC(i,e===void 0?null:e,t)}},Lt,e===void 0?null:e),Ln,t),Md,n)}}function Ur(e,t){if(Z(t)==="symbol")throw Error("Cannot create val path of array item with symbol prop: ".concat(t.toString()));if(e)return e.includes(ue.ModuleFilePathSep)?"".concat(e,".").concat(JSON.stringify(t)):"".concat(e).concat(ue.ModuleFilePathSep).concat(JSON.stringify(t))}function Hu(e,t){if(Z(t)==="symbol")throw Error("Cannot create val path of array item with symbol prop: ".concat(t.toString()));if(!e)throw Error("Cannot create val path of array item of empty or missing path: ".concat(e,". Item: ").concat(t));return e.includes(ue.ModuleFilePathSep)?"".concat(e,".").concat(JSON.stringify(t)):"".concat(e).concat(ue.ModuleFilePathSep).concat(JSON.stringify(t))}function fC(e){if(Z(e)==="object"&&(Lt in e||Ln in e)){var t=e[Lt];return t}return e}var Mw=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Ut(this,t),r=lr(this,t),r.items=n,r.opt=o,r}return cr(t,e),Wt(t,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:o===null?F({},r,[{message:"Expected 'object', got 'null'"}]):Z(o)!=="object"?F({},r,[{message:"Expected 'object', got '".concat(Z(o),"'")}]):Array.isArray(o)?F({},r,[{message:"Expected 'object', got 'array'"}]):(Object.entries(this.items).forEach(function(a){var l=hn(a,2),c=l[0],u=l[1],d=Ur(r,c);if(!d)s=i.appendValidationError(s,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(c),o);else{var f=u.validate(d,o[c]);f&&s?s=_n(_n({},f),s):f&&(s=f)}}),s)}},{key:"assert",value:function(r,o){if(this.opt&&o===null)return{success:!0,data:o};if(o===null)return{success:!1,errors:F({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])};if(Z(o)!=="object")return{success:!1,errors:F({},r,[{message:"Expected 'object', got '".concat(Z(o),"'"),typeError:!0}])};if(Array.isArray(o))return{success:!1,errors:F({},r,[{message:"Expected 'object', got 'array'",typeError:!0}])};for(var i=[],s=0,a=Object.keys(this.items);s<a.length;s++){var l=a[s],c=Ur(r,l);c?l in o||i.push({message:"Expected key '".concat(l,"' not found in object"),typeError:!0}):i.push({message:"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(l),internalError:!0})}return i.length>0?{success:!1,errors:F({},r,i)}:{success:!0,data:o}}},{key:"nullable",value:function(){return new t(this.items,!0)}},{key:"serialize",value:function(){return{type:"object",items:Object.fromEntries(Object.entries(this.items).map(function(r){var o=hn(r,2),i=o[0],s=o[1];return[i,s.serialize()]})),opt:this.opt}}}])}(ur),q5=function(t){return new Mw(t)},KN=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Ut(this,t),r=lr(this,t),r.item=n,r.opt=o,r}return cr(t,e),Wt(t,[{key:"validate",value:function(r,o){var i=this.assert(r,o);if(!i.success)return i.errors;if(i.data===null)return!1;for(var s={},a=0,l=Object.entries(i.data);a<l.length;a++){var c=hn(l[a],2),u=c[0],d=c[1],f=Hu(r,Number(u)),h=this.item.validate(f,d);h&&(s=_n(_n({},h),s))}return Object.keys(s).length===0?!1:s}},{key:"assert",value:function(r,o){return o===null&&this.opt?{success:!0,data:o}:o===null?{success:!1,errors:F({},r,[{message:"Expected 'array', got 'null'",typeError:!0}])}:Z(o)!=="object"?{success:!1,errors:F({},r,[{message:"Expected 'object', got '".concat(Z(o),"'"),typeError:!0}])}:Array.isArray(o)?{success:!0,data:o}:{success:!1,errors:F({},r,[{message:"Expected object of type 'array'",typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.item,!0)}},{key:"serialize",value:function(){return{type:"array",item:this.item.serialize(),opt:this.opt}}}])}(ur),G5=function(t){return new KN(t)},Ku=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Ut(this,t),r=lr(this,t),r.value=n,r.opt=o,r}return cr(t,e),Wt(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="string"?F({},r,[{message:"Expected 'string', got '".concat(Z(o),"'"),value:o}]):o!==this.value?F({},r,[{message:"Expected literal '".concat(this.value,"', got '").concat(o,"'"),value:o}]):!1}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:F({},r,[{message:"Expected 'string', got 'null'",typeError:!0}])}:typeof o=="string"&&o===this.value?{success:!0,data:o}:{success:!1,errors:F({},r,[{message:"Expected literal '".concat(this.value,"', got '").concat(o,"'"),typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.value,!0)}},{key:"serialize",value:function(){return{type:"literal",value:this.value,opt:this.opt}}}])}(ur),Y5=function(t){return new Ku(t)},qN=function(e){function t(n,r){var o,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return Ut(this,t),o=lr(this,t),o.key=n,o.items=r,o.opt=i,o}return cr(t,e),Wt(t,[{key:"validate",value:function(r,o){var i=o,s=!1;if(this.opt&&i===null)return!1;if(!this.key)return F({},r,[{message:"Missing required first argument in union",schemaError:!0}]);var a=this.key;if(!Array.isArray(this.items))return F({},r,[{message:"A union schema must take more than 1 schema arguments",schemaError:!0}]);if(typeof a=="string"){if(this.items.some(function(O){return!(O instanceof Mw)}))return F({},r,[{message:"Key is a string, so all schema items must be objects",schemaError:!0}]);var l=this.items,c=l.map(function(O){return O.serialize()}),u=c.filter(function(O){return O.type!=="object"||O.items[a].type!=="literal"});if(u.length>0)return F({},r,[{message:"All schema items must be objects with a key: ".concat(a," that is a literal schema. Found: ").concat(JSON.stringify(u,null,2)),schemaError:!0}]);var d=c,f=d.filter(function(O){return O.items[a].opt});if(f.length>1)return F({},r,[{message:"Schema cannot have an optional keys: ".concat(a),schemaError:!0}]);if(Z(i)!=="object")return F({},r,[{message:"Expected an object",typeError:!0}]);var h=i;if(h[a]===void 0)return F({},r,[{message:"Missing required key: ".concat(a),typeError:!0}]);var m=[],v=my(d),x;try{for(v.s();!(x=v.n()).done;){var b=x.value,w=b.items[a];if(w.type==="literal")if(!m.includes(w.value))m.push(w.value);else return F({},r,[{message:"Found duplicate key in schema: ".concat(w.value),schemaError:!0}])}}catch(O){v.e(O)}finally{v.f()}var S=l.find(function(O){return!O.items[a].validate(r,h[a])});if(!S){var k=Ur(r,a);if(!k)throw new Error("Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(a));return F({},k,[{message:'Invalid key: "'.concat(a,'". Value was: "').concat(h[a],'". Valid values: ').concat(d.map(function(O){var M=O.items[a];if(M.type==="literal"&&M.value)return'"'.concat(M.value,'"');throw new Error("Expected literal schema, got ".concat(JSON.stringify(M,null,2)))}).join(", "))}])}var C=S.validate(r,h);if(C)return C}else if(a instanceof Ku){if(this.items.some(function(O){return!(O instanceof Ku)}))return F({},r,[{message:"Key is a literal schema, so all schema items must be literals",typeError:!0}]);var T=[a].concat(Wu(this.items));if(typeof i=="string"){var _=T.some(function(O){return!O.validate(r,i)});if(!_)return F({},r,[{message:"Union must match one of the following: ".concat(T.map(function(O){return'"'.concat(O.value,'"')}).join(", "))}])}}else return F({},r,[{message:"Expected a string or literal"}]);return s}},{key:"assert",value:function(r,o){if(this.opt&&o===null)return{success:!0,data:o};if(o===null)return{success:!1,errors:F({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])};if(!this.key)return{success:!1,errors:F({},r,[{message:"Missing required first argument in union schema",schemaError:!0}])};if(!Array.isArray(this.items))return{success:!1,errors:F({},r,[{message:"The schema of this value is wrong. Schema is neither a union of literals nor a tagged union (of objects)",schemaError:!0}])};if(this.key instanceof Ku){var i,s=!1,a={},l=my((i=[this.key]).concat.apply(i,Wu(this.items))),c;try{for(l.s();!(c=l.n()).done;){var u=c.value;if(!(u instanceof Ku))return{success:!1,errors:F({},r,[{message:"Schema of value is a union of string, so all schema items must be literals",schemaError:!0}])};if(typeof o!="string"){a[r]=[{message:"Expected 'string', got '".concat(Z(o),"'"),typeError:!0}];continue}var d=u.assert(r,o);if(d.success){s=!0;break}else for(var f=0,h=Object.entries(d.errors);f<h.length;f++){var m,v=hn(h[f],2),x=v[0],b=v[1];a[x]||(a[x]=[]),(m=a[x]).push.apply(m,Wu(b))}}}catch(z){l.e(z)}finally{l.f()}return s?{success:!0,data:o}:{success:!1,errors:a}}else if(typeof this.key=="string"){var w=!1,S={},k=my(this.items),C;try{for(k.s();!(C=k.n()).done;){var T=C.value,_=T.assert(r,o);if(_.success){w=!0;break}else for(var O=0,M=Object.entries(_.errors);O<M.length;O++){var j,L=hn(M[O],2),B=L[0],J=L[1];S[B]||(S[B]=[]),(j=S[B]).push.apply(j,Wu(J))}}}catch(z){k.e(z)}finally{k.f()}return w?{success:!0,data:o}:{success:!1,errors:S}}else return{success:!1,errors:F({},r,[{message:"The schema of this value is wrong. Schema is neither a union of literals nor a tagged union (of objects)",schemaError:!0}])}}},{key:"nullable",value:function(){return new t(this.key,this.items,!0)}},{key:"serialize",value:function(){return typeof this.key=="string"?{type:"union",key:this.key,items:this.items.map(function(r){return r.serialize()}),opt:this.opt}:{type:"union",key:this.key.serialize(),items:this.items.map(function(r){return r.serialize()}),opt:this.opt}}}])}(ur),J5=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return new qN(t,r)},GN=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Ut(this,t),r=lr(this,t),r.options=n,r.opt=o,r}return cr(t,e),Wt(t,[{key:"validate",value:function(r,o){var i=this.assert(r,o);return i.success?!1:F({},r,i.errors[r])}},{key:"assert",value:function(r,o){if(this.opt&&o===null)return{success:!0,data:o};if(!Array.isArray(o))return{success:!1,errors:F({},r,[{message:"Expected 'array', got '".concat(Z(o),"'"),typeError:!0}])};for(var i={},s=0;s<o.length;s++)this.recursiveAssert(Hu(r,s),o[s],i);return Object.keys(i).length>0?{success:!1,errors:i}:{success:!0,data:o}}},{key:"recursiveAssert",value:function(r,o,i){if(Z(o)!=="object"){i[r]||(i[r]=[]),i[r].push({message:"Expected 'object', got '".concat(Z(o),"'"),typeError:!0});return}if(Array.isArray(o)){i[r]||(i[r]=[]),i[r].push({message:"Expected 'object', got 'array'",typeError:!0});return}if(o===null){i[r]||(i[r]=[]),i[r].push({message:"Expected 'object', got 'null'",typeError:!0});return}if("tag"in o&&typeof o.tag!="string"){i[r]||(i[r]=[]),i[r].push({message:"Expected 'string', got '".concat(Z(o.tag),"'"),typeError:!0});return}if("children"in o)if(Array.isArray(o.children))for(var s=0;s<o.children.length;s++){var a=o.children[s],l=Hu(Hu(r,"children"),s);if(Z(a)==="object")this.recursiveAssert(l,a,i);else{if(typeof a=="string")continue;i[l]||(i[l]=[]),i[l].push({message:"Expected 'object' or 'string', got '".concat(Z(a),"'"),typeError:!0})}}else{i[r]||(i[r]=[]),i[r].push({message:"Expected 'array', got '".concat(Z(o.children),"'"),typeError:!0});return}if("styles"in o)if(!Array.isArray(o.styles))i[r]||(i[r]=[]),i[r].push({message:"Expected 'array', got '".concat(Z(o.styles),"'"),typeError:!0});else for(var c=0;c<o.styles.length;c++){var u=o.styles[c];if(typeof u!="string"){var d=Hu(r,c);i[d]||(i[d]=[]),i[d].push({message:"Expected 'string', got '".concat(Z(u),"'"),typeError:!0})}}}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"richtext",opt:this.opt,options:this.options}}}])}(ur),X5=function(t){return new GN(t??{})},YN=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Ut(this,t),r=lr(this,t),r.options=n,r.opt=o,r}return cr(t,e),Wt(t,[{key:"validate",value:function(r,o){if(this.opt&&o==null)return!1;if(o==null)return F({},r,[{message:"Non-optional image was null or undefined.",value:o}]);if(typeof o[St]!="string")return F({},r,[{message:"Image did not have a file reference string. Got: ".concat(Z(o[St])),value:o}]);if(o[Xn]!=="file")return F({},r,[{message:"Image did not have the valid file extension type. Got: ".concat(o[Xn]),value:o,fixes:["image:change-extension","image:check-metadata"]}]);var i=this.options||{},s=i.accept,a=o.metadata||{},l=a.mimeType;if(s&&l&&!l.includes("/"))return F({},r,[{message:"Invalid mime type format. Got: '".concat(l,"'"),value:o,fixes:["image:check-metadata"]}]);if(s&&l&&l.includes("/")){var c=s.split(",").map(function(f){return f.trim()}),u=c.some(function(f){if(f==="*/*")return!0;if(f.endsWith("/*")){var h=f.slice(0,-2);return l.startsWith(h)}return f===l});if(!u)return F({},r,[{message:"Mime type mismatch. Found '".concat(l,"' but schema accepts '").concat(s,"'"),value:o,fixes:["image:check-metadata"]}])}var d=ue.filenameToMimeType(o[St]);return d?d&&l&&d!==l?F({},r,[{message:"Mime type and file extension not matching. Mime type is '".concat(l,"' but file extension is '").concat(d,"'"),value:o,fixes:["image:check-metadata"]}]):o.metadata?o.metadata.hotspot&&(Z(o.metadata.hotspot)!=="object"||typeof o.metadata.hotspot.x!="number"||typeof o.metadata.hotspot.y!="number")?F({},r,[{message:"Hotspot must be an object with x and y as numbers.",value:o}]):F({},r,[{message:"Found metadata, but it could not be validated. Image metadata must be an object with the required props: width (positive number), height (positive number) and the mime type.",value:o,fixes:["image:check-metadata"]}]):F({},r,[{message:"Could not validate Image metadata.",value:o,fixes:["image:add-metadata"]}]):F({},r,[{message:"Could not determine mime type from file extension. Got: ".concat(o[St]),value:o,fixes:["image:check-metadata"]}])}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:F({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])}:Z(o)!=="object"?{success:!1,errors:F({},r,[{message:"Expected 'object', got '".concat(Z(o),"'"),typeError:!0}])}:St in o?Xn in o&&o[Xn]==="file"?{success:!0,data:o}:{success:!1,errors:F({},r,[{message:"Value of this schema must use: 'c.image' (error type: missing_file_extension)",typeError:!0}])}:{success:!1,errors:F({},r,[{message:"Value of this schema must use: 'c.image' (error type: missing_ref_prop)",typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"image",options:this.options,opt:this.opt}}}])}(ur),Z5=function(t){return new YN(t)},JN=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Ut(this,t),r=lr(this,t),r.item=n,r.opt=o,r}return cr(t,e),Wt(t,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:o===null?F({},r,[{message:"Expected 'object', got 'null'"}]):Z(o)!=="object"?F({},r,[{message:"Expected 'object', got '".concat(Z(o),"'")}]):Array.isArray(o)?F({},r,[{message:"Expected 'object', got 'array'"}]):(Object.entries(o).forEach(function(a){var l=hn(a,2),c=l[0],u=l[1],d=Ur(r,c);if(!d)s=i.appendValidationError(s,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(u),o);else{var f=i.item.validate(d,u);f&&s?s=_n(_n({},f),s):f&&(s=f)}}),s)}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:Z(o)!=="object"?{success:!1,errors:F({},r,[{message:"Expected 'object', got '".concat(Z(o),"'"),typeError:!0}])}:Array.isArray(o)?{success:!1,errors:F({},r,[{message:"Expected 'object', got 'array'",typeError:!0}])}:{success:!0,data:o}}},{key:"nullable",value:function(){return new t(this.item,!0)}},{key:"serialize",value:function(){return{type:"record",item:this.item.serialize(),opt:this.opt}}}])}(ur),Q5=function(t){return new JN(t)};function eF(e){var t=e[Lt];if(t instanceof Nw)throw Error("Cannot get raw source of an Expr");var n=t;return n}function XN(e){var t=e.indexOf(Nc);return t===-1?[e,""]:[e.slice(0,t),e.slice(t+Nc.length)]}function ZN(e,t){return t===""?e:"".concat(e).concat(Nc).concat(t)}function tF(e){return e instanceof Mw||Z(e)==="object"&&"type"in e&&e.type==="object"}function nF(e){return e instanceof JN||Z(e)==="object"&&"type"in e&&e.type==="record"}function rF(e){return e instanceof KN||Z(e)==="object"&&"type"in e&&e.type==="array"}function oF(e){return e instanceof qN||Z(e)==="object"&&"type"in e&&e.type==="union"}function iF(e){return e instanceof GN||Z(e)==="object"&&"type"in e&&e.type==="richtext"}function sF(e){return e instanceof YN||Z(e)==="object"&&"type"in e&&e.type==="image"}function aF(e,t,n){for(var r=wm(e),o=Wu(r),i=n,s=t,a=function(){var u=r.shift();if(u===void 0)throw Error("Unexpected undefined part");if(rF(i)){if(Number.isNaN(Number(u)))throw Error("Invalid path: array schema ".concat(JSON.stringify(i)," must have a number as path, but got ").concat(u,". Path: ").concat(e));if(Z(s)!=="object"&&!Array.isArray(s))throw Error("Schema type error: expected source to be type of array, but got ".concat(Z(s)));s=s[u],i=i.item}else if(nF(i)){if(typeof u!="string")throw Error("Invalid path: record schema ".concat(i," must have path: ").concat(u," as string"));if(Z(s)!=="object"&&!Array.isArray(s))throw Error("Schema type error: expected source to be type of record, but got ".concat(Z(s)));if(!s[u])throw Error("Invalid path: record source did not have key ".concat(u," from path: ").concat(e));s=s[u],i=i.item}else if(tF(i)){if(Z(s)!=="object")throw Error("Schema type error: expected source to be type of object, but got ".concat(Z(s)));if(s!==null&&s[u]===void 0)throw Error("Invalid path: object source did not have key ".concat(u," from path: ").concat(e));s=s===null?s:s[u],i=i.items[u]}else{if(sF(i))return{v:{path:o.slice(0,o.length-r.length-1).map(function(m){return JSON.stringify(m)}).join("."),schema:i,source:s}};if(oF(i)){var d=i.key;if(typeof d!="string")return{v:{path:o.map(function(m){return Number.isNaN(Number(m))?JSON.stringify(m):m}).join("."),schema:i,source:s}};var f=s[d];if(!f)throw Error("Invalid path: union source ".concat(i," did not have required key ").concat(d," in path: ").concat(e));var h=i.items.find(function(m){var v;return(m==null||(v=m.items)===null||v===void 0||(v=v[d])===null||v===void 0?void 0:v.value)===f});if(!h)throw Error("Invalid path: union schema ".concat(i," did not have a child object with ").concat(d," of value ").concat(f," in path: ").concat(e));i=h.items[u],s=s[u]}else{if(iF(i))return{v:{path:o.slice(0,o.length-r.length-1).map(function(m){return JSON.stringify(m)}).join("."),schema:i,source:s}};throw Error("Invalid path: ".concat(u," resolved to an unexpected schema ").concat(JSON.stringify(i)))}}},l;r.length>0;)if(l=a(),l)return l.v;if(r.length>0)throw Error("Invalid path: ".concat(r.join(".")," is not a valid path"));return{path:o.map(function(c){return Number.isNaN(Number(c))?JSON.stringify(c):c}).join("."),schema:i,source:s}}function lF(e){var t=e.split("/").slice(1);return t}function wm(e){for(var t=[],n=0;n<e.length;){var r="";if(e[n]==='"'){for(n++;n<e.length&&e[n]!=='"';)e[n]==="\\"&&e[n+1]==='"'?(r+='"',n++):r+=e[n],n++;if(e[n]!=='"'){var o;throw new Error("Invalid input (".concat(JSON.stringify(e),"): Missing closing double quote: ").concat((o=e[n])!==null&&o!==void 0?o:"at end of string"," (char: ").concat(n,"; length: ").concat(e.length,")"))}}else for(;n<e.length&&e[n]!==".";)r+=e[n],n++;r!==""&&t.push(r),n++}return t}function cF(e){return e.split(",")}function uF(e){var t=XN(e),n=hn(t,2),r=n[0],o=n[1],i=wm(o).slice(0,-1);return i.length>0?ZN(r,QN(i)):r}function QN(e){return e.map(function(t){return Number.isInteger(Number(t))?t:JSON.stringify(t)}).join(".")}var dF=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Ut(this,t),r=lr(this,t),r.options=n,r.opt=o,r}return cr(t,e),Wt(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="number"?F({},r,[{message:"Expected 'number', got '".concat(Z(o),"'"),value:o}]):!1}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:F({},r,[{message:"Expected 'number', got 'null'",typeError:!0}])}:typeof o=="number"?{success:!0,data:o}:{success:!1,errors:F({},r,[{message:"Expected 'number', got '".concat(Z(o),"'"),typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"number",options:this.options,opt:this.opt}}}])}(ur),fF=function(t){return new dF(t)},pF=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return Ut(this,t),r=lr(this,t),r.options=n,r.opt=o,r.isRaw=i,r}return cr(t,e),Wt(t,[{key:"min",value:function(r){return new t(_n(_n({},this.options),{},{minLength:r}),this.opt,this.isRaw)}},{key:"max",value:function(r){return new t(_n(_n({},this.options),{},{maxLength:r}),this.opt,this.isRaw)}},{key:"regexp",value:function(r){return new t(_n(_n({},this.options),{},{regexp:r}),this.opt,this.isRaw)}},{key:"validate",value:function(r,o){var i,s,a;if(this.opt&&o==null)return!1;if(typeof o!="string")return F({},r,[{message:"Expected 'string', got '".concat(Z(o),"'"),value:o}]);var l=[];return(i=this.options)!==null&&i!==void 0&&i.maxLength&&o.length>this.options.maxLength&&l.push({message:"Expected string to be at most ".concat(this.options.maxLength," characters long, got ").concat(o.length),value:o}),(s=this.options)!==null&&s!==void 0&&s.minLength&&o.length<this.options.minLength&&l.push({message:"Expected string to be at least ".concat(this.options.minLength," characters long, got ").concat(o.length),value:o}),(a=this.options)!==null&&a!==void 0&&a.regexp&&!this.options.regexp.test(o)&&l.push({message:"Expected string to match reg exp: ".concat(this.options.regexp.toString(),", got '").concat(o,"'"),value:o}),l.length>0?F({},r,l):!1}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:typeof o=="string"?{success:!0,data:o}:{success:!1,errors:F({},r,[{message:"Expected 'string', got '".concat(Z(o),"'"),typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.options,!0,this.isRaw)}},{key:"raw",value:function(){return new t(this.options,this.opt,!0)}},{key:"serialize",value:function(){var r,o,i;return{type:"string",options:{maxLength:(r=this.options)===null||r===void 0?void 0:r.maxLength,minLength:(o=this.options)===null||o===void 0?void 0:o.minLength,regexp:((i=this.options)===null||i===void 0?void 0:i.regexp)&&{source:this.options.regexp.source,flags:this.options.regexp.flags}},opt:this.opt,raw:this.isRaw}}}])}(ur),hF=function(t){return new pF(t)},mF=function(e){function t(){var n,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return Ut(this,t),n=lr(this,t),n.opt=r,n}return cr(t,e),Wt(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="boolean"?F({},r,[{message:"Expected 'boolean', got '".concat(Z(o),"'"),value:o}]):!1}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:F({},r,[{message:"Expected 'boolean', got 'null'",typeError:!0}])}:typeof o!="boolean"?{success:!1,errors:F({},r,[{message:"Expected 'boolean', got '".concat(Z(o),"'"),typeError:!0}])}:{success:!0,data:o}}},{key:"nullable",value:function(){return new t(!0)}},{key:"serialize",value:function(){return{type:"boolean",opt:this.opt}}}])}(ur),gF=function(){return new mF},vF=function(e){function t(n,r){var o,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return Ut(this,t),o=lr(this,t),o.schema=n,o.sourcePath=r,o.opt=i,o}return cr(t,e),Wt(t,[{key:"validate",value:function(r,o){if(this.opt&&o==null)return!1;if(!this.schema)return F({},r,[{message:"Schema not found for module. keyOf must be used with a Val Module"}]);var i=this.schema;if(!(i.type==="object"||i.type==="record"))return F({},r,[{message:"Schema in keyOf must be an 'object' or 'record'. Found '".concat(i.type,"'")}]);if(i.opt&&o==null)return!1;if(i.type==="record"&&typeof o!="string")return F({},r,[{message:"Type of value in keyof (record) must be 'string'"}]);if(i.type==="object"){var s=Object.keys(i.items);if(!s.includes(o))return F({},r,[{message:"Value of keyOf (object) must be: ".concat(s.join(", "),". Found: ").concat(o)}])}return!1}},{key:"assert",value:function(r,o){if(this.opt&&o===null)return{success:!0,data:o};if(o===null)return{success:!1,errors:F({},r,[{message:"Expected 'string', got 'null'",typeError:!0}])};var i=this.schema;if(!i)return{success:!1,errors:F({},r,[{message:"Neither key nor schema was found. keyOf is missing an argument.",typeError:!0}])};var s=i;if(!(s.type==="object"||s.type==="record"))return{success:!1,errors:F({},r,[{message:"Schema of first argument must be either: 'array', 'object' or 'record'. Found '".concat(s.type,"'"),typeError:!0}])};if(s.type==="record"&&typeof o!="string")return{success:!1,errors:F({},r,[{message:"Value of keyOf (record) must be 'string', got '".concat(Z(o),"'"),typeError:!0}])};if(s.type==="object"){var a=Object.keys(s.items);if(!a.includes(o))return{success:!1,errors:F({},r,[{message:"Value of keyOf (object) must be: ".concat(a.join(", "),". Found: ").concat(o),typeError:!0}])}}return{success:!0,data:o}}},{key:"nullable",value:function(){return new t(this.schema,this.sourcePath,!0)}},{key:"serialize",value:function(){var r=this.sourcePath;if(!r)throw new Error("Cannot serialize keyOf schema with empty selector. TIP: keyOf must be used with a Val Module of record schema.");var o=this.schema;if(!o)throw new Error("Cannot serialize keyOf schema with empty selector.");var i;switch(o.type){case"record":i="string";break;case"object":i=Object.keys(o.items);break;default:throw new Error("Cannot serialize keyOf schema with selector of type '".concat(o.type,"'. keyOf must be used with a Val Module."))}return{type:"keyOf",path:r,schema:o,opt:this.opt,values:i}}}])}(ur),yF=function(t){var n;return new vF(t==null||(n=t[Md])===null||n===void 0?void 0:n.serialize(),HN(t))},xF=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Ut(this,t),r=lr(this,t),r.options=n,r.opt=o,r}return cr(t,e),Wt(t,[{key:"validate",value:function(r,o){var i,s,a,l;if(this.opt&&o==null)return!1;if(typeof o!="string")return F({},r,[{message:"Expected 'string', got '".concat(Z(o),"'"),value:o}]);if((i=this.options)!==null&&i!==void 0&&i.from&&(s=this.options)!==null&&s!==void 0&&s.to){if(this.options.from>this.options.to)return F({},r,[{message:"From date ".concat(this.options.from," is after to date ").concat(this.options.to),value:o,typeError:!0}]);if(o<this.options.from||o>this.options.to)return F({},r,[{message:"Date is not between ".concat(this.options.from," and ").concat(this.options.to),value:o}])}else if((a=this.options)!==null&&a!==void 0&&a.from){if(o<this.options.from)return F({},r,[{message:"Date is before the minimum date ".concat(this.options.from),value:o}])}else if((l=this.options)!==null&&l!==void 0&&l.to&&o>this.options.to)return F({},r,[{message:"Date is after the maximum date ".concat(this.options.to),value:o}]);return!1}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:F({},r,[{message:"Expected 'string', got 'null'",typeError:!0}])}:typeof o!="string"?{success:!1,errors:F({},r,[{message:"Expected 'string', got '".concat(Z(o),"'"),typeError:!0}])}:{success:!0,data:o}}},{key:"from",value:function(r){return new t(_n(_n({},this.options),{},{from:r}),this.opt)}},{key:"to",value:function(r){return new t(_n(_n({},this.options),{},{to:r}),this.opt)}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"date",opt:this.opt,options:this.options}}}])}(ur),bF=function(t){return new xF(t)};function wF(){return{string:hF,boolean:gF,array:G5,object:q5,number:fF,union:J5,richtext:X5,image:Z5,literal:Y5,keyOf:yF,record:Q5,file:W5,date:bF}}var Nr=Wt(function e(t){Ut(this,e),this.message=t});function SF(e){return eM(EF(e))}function kF(e){return Ds(e)?Z(e[Lt])==="object"&&e[Lt]!==null&&Array.isArray(e[Lt]):Array.isArray(e)}function CF(e){return Ds(e)?Z(e[Lt])==="object"&&e[Lt]!==null&&!Array.isArray(e[Lt]):Z(e)==="object"}function EF(e){var t=qt(e);function n(r){var o=kF(r),i=CF(r);if(o){var s=Lt in r?r[Lt]:r,a=Ln in r?r[Ln]:void 0;return{val:s.map(function(u,d){return n(Ds(u)?u:qt(u,Ur(a,d)))}),valPath:a}}else if(i){var l=Lt in r?r[Lt]:r,c=Ln in r?r[Ln]:void 0;return{val:l!==null&&Object.fromEntries(Object.entries(l).map(function(u){var d=hn(u,2),f=d[0],h=d[1];return[f,n(Ds(h)?h:qt(h,Ur(c,f)))]})),valPath:c}}else return Ds(r)?{val:n(r[Lt]),valPath:r[Ln]}:r}return n(t)}function c0(e){var t=WN(e)?e.val:e;switch(Z(t)){case"function":case"symbol":throw Error("Invalid val type: ".concat(Z(t)));case"object":return t===null?null:Array.isArray(t)?t.map(c0):Object.fromEntries(Object.entries(t).map(function(n){var r=hn(n,2),o=r[0],i=r[1];return[o,i&&c0(i)]}));default:return t}}function eM(e){var t=e.val;switch(Z(t)){case"function":case"symbol":throw Error("Invalid val type: ".concat(Z(t)));case"object":if(t!==null)return new Proxy(t,{has:function(r,o){return o==="val"||o===Ln?!0:pC(r,o)},get:function(r,o){if(o===Ln)return e.valPath;if(o==="val")return c0(e);if(Array.isArray(r)&&o==="length")return r.length;if(pC(t,o)){var i,s;return eM({val:Reflect.get(r,o).val,valPath:(i=(s=Reflect.get(r,o))===null||s===void 0?void 0:s.valPath)!==null&&i!==void 0?i:Ur(e.valPath,Array.isArray(r)?Number(o):o)})}return Reflect.get(r,o)}});default:return F(F({},Ln,e.valPath),"val",e.val)}}function pC(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var _F=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998],tt=function(e){return e[e.inputBytes=64]="inputBytes",e[e.inputWords=16]="inputWords",e[e.highIndex=14]="highIndex",e[e.lowIndex=15]="lowIndex",e[e.workWords=64]="workWords",e[e.allocBytes=80]="allocBytes",e[e.allocWords=20]="allocWords",e[e.allocTotal=8e3]="allocTotal",e}(tt||{});function TF(e){return new OF}var OF=function(){function e(){Ut(this,e),F(this,"A",1779033703),F(this,"B",-1150833019),F(this,"C",1013904242),F(this,"D",-1521486534),F(this,"E",1359893119),F(this,"F",-1694144372),F(this,"G",528734635),F(this,"H",1541459225),F(this,"_size",0),F(this,"_sp",0),(!Zp||Mu>=tt.allocTotal)&&(Zp=new ArrayBuffer(tt.allocTotal),Mu=0),this._byte=new Uint8Array(Zp,Mu,tt.allocBytes),this._word=new Int32Array(Zp,Mu,tt.allocWords),Mu+=tt.allocBytes}return Wt(e,[{key:"update",value:function(n){if(typeof n=="string")return this._utf8(n);if(n==null)throw new TypeError("Invalid type: "+Z(n));var r=n.byteOffset,o=n.byteLength,i=o/tt.inputBytes|0,s=0;if(i&&!(r&3)&&!(this._size%tt.inputBytes)){for(var a=new Int32Array(n.buffer,r,i*tt.inputWords);i--;)this._int32(a,s>>2),s+=tt.inputBytes;this._size+=s}var l=n.BYTES_PER_ELEMENT;if(l!==1&&n.buffer){var c=new Uint8Array(n.buffer,r+s,o-s);return this._uint8(c)}return s===o?this:this._uint8(n,s)}},{key:"_uint8",value:function(n,r){var o=this._byte,i=this._word,s=n.length;for(r=r|0;r<s;){for(var a=this._size%tt.inputBytes,l=a;r<s&&l<tt.inputBytes;)o[l++]=n[r++];l>=tt.inputBytes&&this._int32(i),this._size+=l-a}return this}},{key:"_utf8",value:function(n){for(var r=this._byte,o=this._word,i=n.length,s=this._sp,a=0;a<i;){for(var l=this._size%tt.inputBytes,c=l;a<i&&c<tt.inputBytes;){var u=n.charCodeAt(a++)|0;u<128?r[c++]=u:u<2048?(r[c++]=192|u>>>6,r[c++]=128|u&63):u<55296||u>57343?(r[c++]=224|u>>>12,r[c++]=128|u>>>6&63,r[c++]=128|u&63):s?(u=((s&1023)<<10)+(u&1023)+65536,r[c++]=240|u>>>18,r[c++]=128|u>>>12&63,r[c++]=128|u>>>6&63,r[c++]=128|u&63,s=0):s=u}c>=tt.inputBytes&&(this._int32(o),o[0]=o[tt.inputWords]),this._size+=c-l}return this._sp=s,this}},{key:"_int32",value:function(n,r){var o=this.A,i=this.B,s=this.C,a=this.D,l=this.E,c=this.F,u=this.G,d=this.H,f=0;for(r=r|0;f<tt.inputWords;)ya[f++]=so(n[r++]);for(f=tt.inputWords;f<tt.workWords;f++)ya[f]=DF(ya[f-2])+ya[f-7]+IF(ya[f-15])+ya[f-16]|0;for(f=0;f<tt.workWords;f++){var h=d+AF(l)+PF(l,c,u)+_F[f]+ya[f]|0,m=jF(o)+RF(o,i,s)|0;d=u,u=c,c=l,l=a+h|0,a=s,s=i,i=o,o=h+m|0}this.A=o+this.A|0,this.B=i+this.B|0,this.C=s+this.C|0,this.D=a+this.D|0,this.E=l+this.E|0,this.F=c+this.F|0,this.G=u+this.G|0,this.H=d+this.H|0}},{key:"digest",value:function(n){var r=this._byte,o=this._word,i=this._size%tt.inputBytes|0;for(r[i++]=128;i&3;)r[i++]=0;if(i>>=2,i>tt.highIndex){for(;i<tt.inputWords;)o[i++]=0;i=0,this._int32(o)}for(;i<tt.inputWords;)o[i++]=0;var s=this._size*8,a=(s&4294967295)>>>0,l=(s-a)/4294967296;return l&&(o[tt.highIndex]=so(l)),a&&(o[tt.lowIndex]=so(a)),this._int32(o),n==="hex"?this._hex():this._bin()}},{key:"_hex",value:function(){var n=this.A,r=this.B,o=this.C,i=this.D,s=this.E,a=this.F,l=this.G,c=this.H;return Gi(n)+Gi(r)+Gi(o)+Gi(i)+Gi(s)+Gi(a)+Gi(l)+Gi(c)}},{key:"_bin",value:function(){var n=this.A,r=this.B,o=this.C,i=this.D,s=this.E,a=this.F,l=this.G,c=this.H,u=this._byte,d=this._word;return d[0]=so(n),d[1]=so(r),d[2]=so(o),d[3]=so(i),d[4]=so(s),d[5]=so(a),d[6]=so(l),d[7]=so(c),u.slice(0,32)}}])}(),ya=new Int32Array(tt.workWords),Zp,Mu=0,Gi=function(t){return(t+4294967296).toString(16).substr(-8)},NF=function(t){return t<<24&4278190080|t<<8&16711680|t>>8&65280|t>>24&255},MF=function(t){return t},so=LF()?MF:NF,PF=function(t,n,r){return r^t&(n^r)},RF=function(t,n,r){return t&n|r&(t|n)},jF=function(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)},AF=function(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)},IF=function(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3},DF=function(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10};function LF(){var e=new Uint8Array(new Uint16Array([65279]).buffer);return e[0]===254}var FF=function(t){return TF().update(t).digest("hex")},Pw={x3d:"application/vnd.hzn-3d-crossword","3gp":"video/3gpp","3g2":"video/3gpp2",mseq:"application/vnd.mseq",pwn:"application/vnd.3m.post-it-notes",plb:"application/vnd.3gpp.pic-bw-large",psb:"application/vnd.3gpp.pic-bw-small",pvb:"application/vnd.3gpp.pic-bw-var",tcap:"application/vnd.3gpp2.tcap","7z":"application/x-7z-compressed",abw:"application/x-abiword",ace:"application/x-ace-compressed",acc:"application/vnd.americandynamics.acc",acu:"application/vnd.acucobol",atc:"application/vnd.acucorp",adp:"audio/adpcm",aab:"application/x-authorware-bin",aam:"application/x-authorware-map",aas:"application/x-authorware-seg",air:"application/vnd.adobe.air-application-installer-package+zip",swf:"application/x-shockwave-flash",fxp:"application/vnd.adobe.fxp",pdf:"application/pdf",ppd:"application/vnd.cups-ppd",dir:"application/x-director",xdp:"application/vnd.adobe.xdp+xml",xfdf:"application/vnd.adobe.xfdf",aac:"audio/x-aac",ahead:"application/vnd.ahead.space",azf:"application/vnd.airzip.filesecure.azf",azs:"application/vnd.airzip.filesecure.azs",azw:"application/vnd.amazon.ebook",ami:"application/vnd.amiga.ami","N/A":"application/andrew-inset",apk:"application/vnd.android.package-archive",cii:"application/vnd.anser-web-certificate-issue-initiation",fti:"application/vnd.anser-web-funds-transfer-initiation",atx:"application/vnd.antix.game-component",dmg:"application/x-apple-diskimage",mpkg:"application/vnd.apple.installer+xml",aw:"application/applixware",mp3:"audio/mpeg",les:"application/vnd.hhe.lesson-player",swi:"application/vnd.aristanetworks.swi",s:"text/x-asm",atomcat:"application/atomcat+xml",atomsvc:"application/atomsvc+xml",atom:"application/atom+xml",ac:"application/pkix-attr-cert",aif:"audio/x-aiff",avi:"video/x-msvideo",aep:"application/vnd.audiograph",dxf:"image/vnd.dxf",dwf:"model/vnd.dwf",par:"text/plain-bas",bcpio:"application/x-bcpio",bin:"application/octet-stream",bmp:"image/bmp",torrent:"application/x-bittorrent",cod:"application/vnd.rim.cod",mpm:"application/vnd.blueice.multipass",bmi:"application/vnd.bmi",sh:"application/x-sh",btif:"image/prs.btif",rep:"application/vnd.businessobjects",bz:"application/x-bzip",bz2:"application/x-bzip2",csh:"application/x-csh",c:"text/x-c",cdxml:"application/vnd.chemdraw+xml",css:"text/css",cdx:"chemical/x-cdx",cml:"chemical/x-cml",csml:"chemical/x-csml",cdbcmsg:"application/vnd.contact.cmsg",cla:"application/vnd.claymore",c4g:"application/vnd.clonk.c4group",sub:"image/vnd.dvb.subtitle",cdmia:"application/cdmi-capability",cdmic:"application/cdmi-container",cdmid:"application/cdmi-domain",cdmio:"application/cdmi-object",cdmiq:"application/cdmi-queue",c11amc:"application/vnd.cluetrust.cartomobile-config",c11amz:"application/vnd.cluetrust.cartomobile-config-pkg",ras:"image/x-cmu-raster",dae:"model/vnd.collada+xml",csv:"text/csv",cpt:"application/mac-compactpro",wmlc:"application/vnd.wap.wmlc",cgm:"image/cgm",ice:"x-conference/x-cooltalk",cmx:"image/x-cmx",xar:"application/vnd.xara",cmc:"application/vnd.cosmocaller",cpio:"application/x-cpio",clkx:"application/vnd.crick.clicker",clkk:"application/vnd.crick.clicker.keyboard",clkp:"application/vnd.crick.clicker.palette",clkt:"application/vnd.crick.clicker.template",clkw:"application/vnd.crick.clicker.wordbank",wbs:"application/vnd.criticaltools.wbs+xml",cryptonote:"application/vnd.rig.cryptonote",cif:"chemical/x-cif",cmdf:"chemical/x-cmdf",cu:"application/cu-seeme",cww:"application/prs.cww",curl:"text/vnd.curl",dcurl:"text/vnd.curl.dcurl",mcurl:"text/vnd.curl.mcurl",scurl:"text/vnd.curl.scurl",car:"application/vnd.curl.car",pcurl:"application/vnd.curl.pcurl",cmp:"application/vnd.yellowriver-custom-menu",dssc:"application/dssc+der",xdssc:"application/dssc+xml",deb:"application/x-debian-package",uva:"audio/vnd.dece.audio",uvi:"image/vnd.dece.graphic",uvh:"video/vnd.dece.hd",uvm:"video/vnd.dece.mobile",uvu:"video/vnd.uvvu.mp4",uvp:"video/vnd.dece.pd",uvs:"video/vnd.dece.sd",uvv:"video/vnd.dece.video",dvi:"application/x-dvi",seed:"application/vnd.fdsn.seed",dtb:"application/x-dtbook+xml",res:"application/x-dtbresource+xml",ait:"application/vnd.dvb.ait",svc:"application/vnd.dvb.service",eol:"audio/vnd.digital-winds",djvu:"image/vnd.djvu",dtd:"application/xml-dtd",mlp:"application/vnd.dolby.mlp",wad:"application/x-doom",dpg:"application/vnd.dpgraph",dra:"audio/vnd.dra",dfac:"application/vnd.dreamfactory",dts:"audio/vnd.dts",dtshd:"audio/vnd.dts.hd",dwg:"image/vnd.dwg",geo:"application/vnd.dynageo",es:"application/ecmascript",mag:"application/vnd.ecowin.chart",mmr:"image/vnd.fujixerox.edmics-mmr",rlc:"image/vnd.fujixerox.edmics-rlc",exi:"application/exi",mgz:"application/vnd.proteus.magazine",epub:"application/epub+zip",eml:"message/rfc822",nml:"application/vnd.enliven",xpr:"application/vnd.is-xpr",xif:"image/vnd.xiff",xfdl:"application/vnd.xfdl",emma:"application/emma+xml",ez2:"application/vnd.ezpix-album",ez3:"application/vnd.ezpix-package",fst:"image/vnd.fst",fvt:"video/vnd.fvt",fbs:"image/vnd.fastbidsheet",fe_launch:"application/vnd.denovo.fcselayout-link",f4v:"video/x-f4v",flv:"video/x-flv",fpx:"image/vnd.fpx",npx:"image/vnd.net-fpx",flx:"text/vnd.fmi.flexstor",fli:"video/x-fli",ftc:"application/vnd.fluxtime.clip",fdf:"application/vnd.fdf",f:"text/x-fortran",mif:"application/vnd.mif",fm:"application/vnd.framemaker",fh:"image/x-freehand",fsc:"application/vnd.fsc.weblaunch",fnc:"application/vnd.frogans.fnc",ltf:"application/vnd.frogans.ltf",ddd:"application/vnd.fujixerox.ddd",xdw:"application/vnd.fujixerox.docuworks",xbd:"application/vnd.fujixerox.docuworks.binder",oas:"application/vnd.fujitsu.oasys",oa2:"application/vnd.fujitsu.oasys2",oa3:"application/vnd.fujitsu.oasys3",fg5:"application/vnd.fujitsu.oasysgp",bh2:"application/vnd.fujitsu.oasysprs",spl:"application/x-futuresplash",fzs:"application/vnd.fuzzysheet",g3:"image/g3fax",gmx:"application/vnd.gmx",gtw:"model/vnd.gtw",txd:"application/vnd.genomatix.tuxedo",ggb:"application/vnd.geogebra.file",ggt:"application/vnd.geogebra.tool",gdl:"model/vnd.gdl",gex:"application/vnd.geometry-explorer",gxt:"application/vnd.geonext",g2w:"application/vnd.geoplan",g3w:"application/vnd.geospace",gsf:"application/x-font-ghostscript",bdf:"application/x-font-bdf",gtar:"application/x-gtar",texinfo:"application/x-texinfo",gnumeric:"application/x-gnumeric",kml:"application/vnd.google-earth.kml+xml",kmz:"application/vnd.google-earth.kmz",gqf:"application/vnd.grafeq",gif:"image/gif",gv:"text/vnd.graphviz",gac:"application/vnd.groove-account",ghf:"application/vnd.groove-help",gim:"application/vnd.groove-identity-message",grv:"application/vnd.groove-injector",gtm:"application/vnd.groove-tool-message",tpl:"application/vnd.groove-tool-template",vcg:"application/vnd.groove-vcard",h261:"video/h261",h263:"video/h263",h264:"video/h264",hpid:"application/vnd.hp-hpid",hps:"application/vnd.hp-hps",hdf:"application/x-hdf",rip:"audio/vnd.rip",hbci:"application/vnd.hbci",jlt:"application/vnd.hp-jlyt",pcl:"application/vnd.hp-pcl",hpgl:"application/vnd.hp-hpgl",hvs:"application/vnd.yamaha.hv-script",hvd:"application/vnd.yamaha.hv-dic",hvp:"application/vnd.yamaha.hv-voice","sfd-hdstx":"application/vnd.hydrostatix.sof-data",stk:"application/hyperstudio",hal:"application/vnd.hal+xml",html:"text/html",irm:"application/vnd.ibm.rights-management",sc:"application/vnd.ibm.secure-container",ics:"text/calendar",icc:"application/vnd.iccprofile",ico:"image/x-icon",igl:"application/vnd.igloader",ief:"image/ief",ivp:"application/vnd.immervision-ivp",ivu:"application/vnd.immervision-ivu",rif:"application/reginfo+xml","3dml":"text/vnd.in3d.3dml",spot:"text/vnd.in3d.spot",igs:"model/iges",i2g:"application/vnd.intergeo",cdy:"application/vnd.cinderella",xpw:"application/vnd.intercon.formnet",fcs:"application/vnd.isac.fcs",ipfix:"application/ipfix",cer:"application/pkix-cert",pki:"application/pkixcmp",crl:"application/pkix-crl",pkipath:"application/pkix-pkipath",igm:"application/vnd.insors.igm",rcprofile:"application/vnd.ipunplugged.rcprofile",irp:"application/vnd.irepository.package+xml",jad:"text/vnd.sun.j2me.app-descriptor",jar:"application/java-archive",class:"application/java-vm",jnlp:"application/x-java-jnlp-file",ser:"application/java-serialized-object",java:"text/x-java-source,java",js:"application/javascript",json:"application/json",joda:"application/vnd.joost.joda-archive",jpm:"video/jpm",jpeg:"image/jpeg",jpg:"image/jpeg",pjpeg:"image/pjpeg",jpgv:"video/jpeg",ktz:"application/vnd.kahootz",mmd:"application/vnd.chipnuts.karaoke-mmd",karbon:"application/vnd.kde.karbon",chrt:"application/vnd.kde.kchart",kfo:"application/vnd.kde.kformula",flw:"application/vnd.kde.kivio",kon:"application/vnd.kde.kontour",kpr:"application/vnd.kde.kpresenter",ksp:"application/vnd.kde.kspread",kwd:"application/vnd.kde.kword",htke:"application/vnd.kenameaapp",kia:"application/vnd.kidspiration",kne:"application/vnd.kinar",sse:"application/vnd.kodak-descriptor",lasxml:"application/vnd.las.las+xml",latex:"application/x-latex",lbd:"application/vnd.llamagraphics.life-balance.desktop",lbe:"application/vnd.llamagraphics.life-balance.exchange+xml",jam:"application/vnd.jam",123:"application/vnd.lotus-1-2-3",apr:"application/vnd.lotus-approach",pre:"application/vnd.lotus-freelance",nsf:"application/vnd.lotus-notes",org:"application/vnd.lotus-organizer",scm:"application/vnd.lotus-screencam",lwp:"application/vnd.lotus-wordpro",lvp:"audio/vnd.lucent.voice",m3u:"audio/x-mpegurl",m4v:"video/x-m4v",hqx:"application/mac-binhex40",portpkg:"application/vnd.macports.portpkg",mgp:"application/vnd.osgeo.mapguide.package",mrc:"application/marc",mrcx:"application/marcxml+xml",mxf:"application/mxf",nbp:"application/vnd.wolfram.player",ma:"application/mathematica",mathml:"application/mathml+xml",mbox:"application/mbox",mc1:"application/vnd.medcalcdata",mscml:"application/mediaservercontrol+xml",cdkey:"application/vnd.mediastation.cdkey",mwf:"application/vnd.mfer",mfm:"application/vnd.mfmp",msh:"model/mesh",mads:"application/mads+xml",mets:"application/mets+xml",mods:"application/mods+xml",meta4:"application/metalink4+xml",mcd:"application/vnd.mcd",flo:"application/vnd.micrografx.flo",igx:"application/vnd.micrografx.igx",es3:"application/vnd.eszigno3+xml",mdb:"application/x-msaccess",asf:"video/x-ms-asf",exe:"application/x-msdownload",cil:"application/vnd.ms-artgalry",cab:"application/vnd.ms-cab-compressed",ims:"application/vnd.ms-ims",application:"application/x-ms-application",clp:"application/x-msclip",mdi:"image/vnd.ms-modi",eot:"application/vnd.ms-fontobject",xls:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xltm:"application/vnd.ms-excel.template.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",chm:"application/vnd.ms-htmlhelp",crd:"application/x-mscardfile",lrm:"application/vnd.ms-lrm",mvb:"application/x-msmediaview",mny:"application/x-msmoney",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",sldx:"application/vnd.openxmlformats-officedocument.presentationml.slide",ppsx:"application/vnd.openxmlformats-officedocument.presentationml.slideshow",potx:"application/vnd.openxmlformats-officedocument.presentationml.template",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",obd:"application/x-msbinder",thmx:"application/vnd.ms-officetheme",onetoc:"application/onenote",pya:"audio/vnd.ms-playready.media.pya",pyv:"video/vnd.ms-playready.media.pyv",ppt:"application/vnd.ms-powerpoint",ppam:"application/vnd.ms-powerpoint.addin.macroenabled.12",sldm:"application/vnd.ms-powerpoint.slide.macroenabled.12",pptm:"application/vnd.ms-powerpoint.presentation.macroenabled.12",ppsm:"application/vnd.ms-powerpoint.slideshow.macroenabled.12",potm:"application/vnd.ms-powerpoint.template.macroenabled.12",mpp:"application/vnd.ms-project",pub:"application/x-mspublisher",scd:"application/x-msschedule",xap:"application/x-silverlight-app",stl:"application/vnd.ms-pki.stl",cat:"application/vnd.ms-pki.seccat",vsd:"application/vnd.visio",vsdx:"application/vnd.visio2013",wm:"video/x-ms-wm",wma:"audio/x-ms-wma",wax:"audio/x-ms-wax",wmx:"video/x-ms-wmx",wmd:"application/x-ms-wmd",wpl:"application/vnd.ms-wpl",wmz:"application/x-ms-wmz",wmv:"video/x-ms-wmv",wvx:"video/x-ms-wvx",wmf:"application/x-msmetafile",trm:"application/x-msterminal",doc:"application/msword",docm:"application/vnd.ms-word.document.macroenabled.12",dotm:"application/vnd.ms-word.template.macroenabled.12",wri:"application/x-mswrite",wps:"application/vnd.ms-works",xbap:"application/x-ms-xbap",xps:"application/vnd.ms-xpsdocument",mid:"audio/midi",mpy:"application/vnd.ibm.minipay",afp:"application/vnd.ibm.modcap",rms:"application/vnd.jcp.javame.midlet-rms",tmo:"application/vnd.tmobile-livetv",prc:"application/x-mobipocket-ebook",mbk:"application/vnd.mobius.mbk",dis:"application/vnd.mobius.dis",plc:"application/vnd.mobius.plc",mqy:"application/vnd.mobius.mqy",msl:"application/vnd.mobius.msl",txf:"application/vnd.mobius.txf",daf:"application/vnd.mobius.daf",fly:"text/vnd.fly",mpc:"application/vnd.mophun.certificate",mpn:"application/vnd.mophun.application",mj2:"video/mj2",mpga:"audio/mpeg",mxu:"video/vnd.mpegurl",mpeg:"video/mpeg",m21:"application/mp21",mp4a:"audio/mp4",mp4:"video/mp4",m3u8:"application/vnd.apple.mpegurl",mus:"application/vnd.musician",msty:"application/vnd.muvee.style",mxml:"application/xv+xml",ngdat:"application/vnd.nokia.n-gage.data","n-gage":"application/vnd.nokia.n-gage.symbian.install",ncx:"application/x-dtbncx+xml",nc:"application/x-netcdf",nlu:"application/vnd.neurolanguage.nlu",dna:"application/vnd.dna",nnd:"application/vnd.noblenet-directory",nns:"application/vnd.noblenet-sealer",nnw:"application/vnd.noblenet-web",rpst:"application/vnd.nokia.radio-preset",rpss:"application/vnd.nokia.radio-presets",n3:"text/n3",edm:"application/vnd.novadigm.edm",edx:"application/vnd.novadigm.edx",ext:"application/vnd.novadigm.ext",gph:"application/vnd.flographit",ecelp4800:"audio/vnd.nuera.ecelp4800",ecelp7470:"audio/vnd.nuera.ecelp7470",ecelp9600:"audio/vnd.nuera.ecelp9600",oda:"application/oda",ogx:"application/ogg",oga:"audio/ogg",ogv:"video/ogg",dd2:"application/vnd.oma.dd2+xml",oth:"application/vnd.oasis.opendocument.text-web",opf:"application/oebps-package+xml",qbo:"application/vnd.intu.qbo",oxt:"application/vnd.openofficeorg.extension",osf:"application/vnd.yamaha.openscoreformat",weba:"audio/webm",webm:"video/webm",odc:"application/vnd.oasis.opendocument.chart",otc:"application/vnd.oasis.opendocument.chart-template",odb:"application/vnd.oasis.opendocument.database",odf:"application/vnd.oasis.opendocument.formula",odft:"application/vnd.oasis.opendocument.formula-template",odg:"application/vnd.oasis.opendocument.graphics",otg:"application/vnd.oasis.opendocument.graphics-template",odi:"application/vnd.oasis.opendocument.image",oti:"application/vnd.oasis.opendocument.image-template",odp:"application/vnd.oasis.opendocument.presentation",otp:"application/vnd.oasis.opendocument.presentation-template",ods:"application/vnd.oasis.opendocument.spreadsheet",ots:"application/vnd.oasis.opendocument.spreadsheet-template",odt:"application/vnd.oasis.opendocument.text",odm:"application/vnd.oasis.opendocument.text-master",ott:"application/vnd.oasis.opendocument.text-template",ktx:"image/ktx",sxc:"application/vnd.sun.xml.calc",stc:"application/vnd.sun.xml.calc.template",sxd:"application/vnd.sun.xml.draw",std:"application/vnd.sun.xml.draw.template",sxi:"application/vnd.sun.xml.impress",sti:"application/vnd.sun.xml.impress.template",sxm:"application/vnd.sun.xml.math",sxw:"application/vnd.sun.xml.writer",sxg:"application/vnd.sun.xml.writer.global",stw:"application/vnd.sun.xml.writer.template",otf:"application/x-font-otf",osfpvg:"application/vnd.yamaha.openscoreformat.osfpvg+xml",dp:"application/vnd.osgi.dp",pdb:"application/vnd.palm",p:"text/x-pascal",paw:"application/vnd.pawaafile",pclxl:"application/vnd.hp-pclxl",efif:"application/vnd.picsel",pcx:"image/x-pcx",psd:"image/vnd.adobe.photoshop",prf:"application/pics-rules",pic:"image/x-pict",chat:"application/x-chat",p10:"application/pkcs10",p12:"application/x-pkcs12",p7m:"application/pkcs7-mime",p7s:"application/pkcs7-signature",p7r:"application/x-pkcs7-certreqresp",p7b:"application/x-pkcs7-certificates",p8:"application/pkcs8",plf:"application/vnd.pocketlearn",pnm:"image/x-portable-anymap",pbm:"image/x-portable-bitmap",pcf:"application/x-font-pcf",pfr:"application/font-tdpfr",pgn:"application/x-chess-pgn",pgm:"image/x-portable-graymap",png:"image/png",ppm:"image/x-portable-pixmap",pskcxml:"application/pskc+xml",pml:"application/vnd.ctc-posml",ai:"application/postscript",pfa:"application/x-font-type1",pbd:"application/vnd.powerbuilder6",pgp:"application/pgp-signature",box:"application/vnd.previewsystems.box",ptid:"application/vnd.pvi.ptid1",pls:"application/pls+xml",str:"application/vnd.pg.format",ei6:"application/vnd.pg.osasli",dsc:"text/prs.lines.tag",psf:"application/x-font-linux-psf",qps:"application/vnd.publishare-delta-tree",wg:"application/vnd.pmi.widget",qxd:"application/vnd.quark.quarkxpress",esf:"application/vnd.epson.esf",msf:"application/vnd.epson.msf",ssf:"application/vnd.epson.ssf",qam:"application/vnd.epson.quickanime",qfx:"application/vnd.intu.qfx",qt:"video/quicktime",rar:"application/x-rar-compressed",ram:"audio/x-pn-realaudio",rmp:"audio/x-pn-realaudio-plugin",rsd:"application/rsd+xml",rm:"application/vnd.rn-realmedia",bed:"application/vnd.realvnc.bed",mxl:"application/vnd.recordare.musicxml",musicxml:"application/vnd.recordare.musicxml+xml",rnc:"application/relax-ng-compact-syntax",rdz:"application/vnd.data-vision.rdz",rdf:"application/rdf+xml",rp9:"application/vnd.cloanto.rp9",jisp:"application/vnd.jisp",rtf:"application/rtf",rtx:"text/richtext",link66:"application/vnd.route66.link66+xml",rss:"application/rss+xml",shf:"application/shf+xml",st:"application/vnd.sailingtracker.track",svg:"image/svg+xml",sus:"application/vnd.sus-calendar",sru:"application/sru+xml",setpay:"application/set-payment-initiation",setreg:"application/set-registration-initiation",sema:"application/vnd.sema",semd:"application/vnd.semd",semf:"application/vnd.semf",see:"application/vnd.seemail",snf:"application/x-font-snf",spq:"application/scvp-vp-request",spp:"application/scvp-vp-response",scq:"application/scvp-cv-request",scs:"application/scvp-cv-response",sdp:"application/sdp",etx:"text/x-setext",movie:"video/x-sgi-movie",ifm:"application/vnd.shana.informed.formdata",itp:"application/vnd.shana.informed.formtemplate",iif:"application/vnd.shana.informed.interchange",ipk:"application/vnd.shana.informed.package",tfi:"application/thraud+xml",shar:"application/x-shar",rgb:"image/x-rgb",slt:"application/vnd.epson.salt",aso:"application/vnd.accpac.simply.aso",imp:"application/vnd.accpac.simply.imp",twd:"application/vnd.simtech-mindmapper",csp:"application/vnd.commonspace",saf:"application/vnd.yamaha.smaf-audio",mmf:"application/vnd.smaf",spf:"application/vnd.yamaha.smaf-phrase",teacher:"application/vnd.smart.teacher",svd:"application/vnd.svd",rq:"application/sparql-query",srx:"application/sparql-results+xml",gram:"application/srgs",grxml:"application/srgs+xml",ssml:"application/ssml+xml",skp:"application/vnd.koan",sgml:"text/sgml",sdc:"application/vnd.stardivision.calc",sda:"application/vnd.stardivision.draw",sdd:"application/vnd.stardivision.impress",smf:"application/vnd.stardivision.math",sdw:"application/vnd.stardivision.writer",sgl:"application/vnd.stardivision.writer-global",sm:"application/vnd.stepmania.stepchart",sit:"application/x-stuffit",sitx:"application/x-stuffitx",sdkm:"application/vnd.solent.sdkm+xml",xo:"application/vnd.olpc-sugar",au:"audio/basic",wqd:"application/vnd.wqd",sis:"application/vnd.symbian.install",smi:"application/smil+xml",xsm:"application/vnd.syncml+xml",bdm:"application/vnd.syncml.dm+wbxml",xdm:"application/vnd.syncml.dm+xml",sv4cpio:"application/x-sv4cpio",sv4crc:"application/x-sv4crc",sbml:"application/sbml+xml",tsv:"text/tab-separated-values",tiff:"image/tiff",tao:"application/vnd.tao.intent-module-archive",tar:"application/x-tar",tcl:"application/x-tcl",tex:"application/x-tex",tfm:"application/x-tex-tfm",tei:"application/tei+xml",txt:"text/plain",dxp:"application/vnd.spotfire.dxp",sfs:"application/vnd.spotfire.sfs",tsd:"application/timestamped-data",tpt:"application/vnd.trid.tpt",mxs:"application/vnd.triscape.mxs",t:"text/troff",tra:"application/vnd.trueapp",ttf:"application/x-font-ttf",ttl:"text/turtle",umj:"application/vnd.umajin",uoml:"application/vnd.uoml+xml",unityweb:"application/vnd.unity",ufd:"application/vnd.ufdl",uri:"text/uri-list",utz:"application/vnd.uiq.theme",ustar:"application/x-ustar",uu:"text/x-uuencode",vcs:"text/x-vcalendar",vcf:"text/x-vcard",vcd:"application/x-cdlink",vsf:"application/vnd.vsf",wrl:"model/vrml",vcx:"application/vnd.vcx",mts:"model/vnd.mts",vtu:"model/vnd.vtu",vis:"application/vnd.visionary",viv:"video/vnd.vivo",ccxml:"application/ccxml+xml,",vxml:"application/voicexml+xml",src:"application/x-wais-source",wbxml:"application/vnd.wap.wbxml",wbmp:"image/vnd.wap.wbmp",wav:"audio/x-wav",davmount:"application/davmount+xml",woff:"application/x-font-woff",wspolicy:"application/wspolicy+xml",webp:"image/webp",wtb:"application/vnd.webturbo",wgt:"application/widget",hlp:"application/winhlp",wml:"text/vnd.wap.wml",wmls:"text/vnd.wap.wmlscript",wmlsc:"application/vnd.wap.wmlscriptc",wpd:"application/vnd.wordperfect",stf:"application/vnd.wt.stf",wsdl:"application/wsdl+xml",xbm:"image/x-xbitmap",xpm:"image/x-xpixmap",xwd:"image/x-xwindowdump",der:"application/x-x509-ca-cert",fig:"application/x-xfig",xhtml:"application/xhtml+xml",xml:"application/xml",xdf:"application/xcap-diff+xml",xenc:"application/xenc+xml",xer:"application/patch-ops-error+xml",rl:"application/resource-lists+xml",rs:"application/rls-services+xml",rld:"application/resource-lists-diff+xml",xslt:"application/xslt+xml",xop:"application/xop+xml",xpi:"application/x-xpinstall",xspf:"application/xspf+xml",xul:"application/vnd.mozilla.xul+xml",xyz:"chemical/x-xyz",yaml:"text/yaml",yang:"application/yang",yin:"application/yin+xml",zir:"application/vnd.zul",zip:"application/zip",zmm:"application/vnd.handheld-entertainment+xml",zaz:"application/vnd.zzazz.deck+xml"},tM=Object.fromEntries(Object.entries(Pw).map(function(e){var t=hn(e,2),n=t[0],r=t[1];return[r,n]})),zF=/^data:(.*?);base64,/;function $F(e){var t=zF.exec(e);if(t&&t[1])return t[1]}function BF(e){var t=tM[e];return t||e.split("/")[1]}function VF(e){var t=e.split(".").pop(),n=t&&Pw[t];if(n)return n}var Nc="?p=",ue={VERSION:{core:function(){try{return require("../package.json").version}catch{return null}}()},convertFileSource:UN,getSchema:B5,getValPath:HN,getVal:SF,getSource:eF,resolvePath:aF,splitModuleFilePathAndModulePath:XN,joinModuleFilePathAndModulePath:ZN,isVal:H5,createValPathOfItem:Ur,getSHA256Hash:FF,initSchema:wF,getMimeType:$F,mimeTypeToFileExt:BF,filenameToMimeType:VF,EXT_TO_MIME_TYPES:Pw,MIME_TYPES_TO_EXT:tM,ModuleFilePathSep:Nc,notFileOp:function(t){return t.op!=="file"},isFileOp:function(t){return t.op==="file"&&typeof t.filePath=="string"},createPatchJSONPath:function(t){return"/".concat(t.split(".").map(function(n){return n&&UF(n)}).join("/"))},createPatchPath:function(t){return wm(t)},splitModulePath:wm,splitModuleFilePath:lF,splitJoinedSourcePaths:cF,parentOfSourcePath:uF,patchPathToModulePath:QN,VAL_ENABLE_COOKIE_NAME:"val_enable",VAL_STATE_COOKIE:"val_state",VAL_SESSION_COOKIE:"val_session",createFilename:function(t,n,r,o){var i,s;if(!r||!t)return n;var a=o.slice(0,5),l=(i=ue.getMimeType(t))!==null&&i!==void 0?i:"unknown",c=(s=ue.mimeTypeToFileExt(l))!==null&&s!==void 0?s:"unknown";if(n){var u=n.split(".").slice(0,-1).join(".")||n,d=u.lastIndexOf("_"),f=u.slice(d+1,u.length);f===a&&(u=u.slice(0,d));var h=encodeURIComponent(u).replace(/%[0-9A-Fa-f]{2}/g,"").toLowerCase();return"".concat(h,"_").concat(a,".").concat(c)}return"".concat(o,".").concat(c)}};function UF(e){try{return JSON.parse(e)}catch{return e}}function tc(e){return Array.isArray(e)}function Mc(e){"@babel/helpers - typeof";return Mc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mc(e)}function nn(e){if(e===null||e===!0||e===!1)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function be(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function Ae(e){be(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||Mc(e)==="object"&&t==="[object Date]"?new Date(e.getTime()):typeof e=="number"||t==="[object Number]"?new Date(e):((typeof e=="string"||t==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function Dn(e,t){be(2,arguments);var n=Ae(e),r=nn(t);return isNaN(r)?new Date(NaN):(r&&n.setDate(n.getDate()+r),n)}function No(e,t){be(2,arguments);var n=Ae(e),r=nn(t);if(isNaN(r))return new Date(NaN);if(!r)return n;var o=n.getDate(),i=new Date(n.getTime());i.setMonth(n.getMonth()+r+1,0);var s=i.getDate();return o>=s?i:(n.setFullYear(i.getFullYear(),i.getMonth(),o),n)}function WF(e,t){be(2,arguments);var n=Ae(e).getTime(),r=nn(t);return new Date(n+r)}var HF={};function ca(){return HF}function Jo(e,t){var n,r,o,i,s,a,l,c;be(1,arguments);var u=ca(),d=nn((n=(r=(o=(i=t==null?void 0:t.weekStartsOn)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.weekStartsOn)!==null&&o!==void 0?o:u.weekStartsOn)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&n!==void 0?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var f=Ae(e),h=f.getDay(),m=(h<d?7:0)+h-d;return f.setDate(f.getDate()-m),f.setHours(0,0,0,0),f}function Xa(e){return be(1,arguments),Jo(e,{weekStartsOn:1})}function KF(e){be(1,arguments);var t=Ae(e),n=t.getFullYear(),r=new Date(0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);var o=Xa(r),i=new Date(0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);var s=Xa(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=s.getTime()?n:n-1}function qF(e){be(1,arguments);var t=KF(e),n=new Date(0);n.setFullYear(t,0,4),n.setHours(0,0,0,0);var r=Xa(n);return r}function rf(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function Pc(e){be(1,arguments);var t=Ae(e);return t.setHours(0,0,0,0),t}var GF=864e5;function Si(e,t){be(2,arguments);var n=Pc(e),r=Pc(t),o=n.getTime()-rf(n),i=r.getTime()-rf(r);return Math.round((o-i)/GF)}function u0(e,t){be(2,arguments);var n=nn(t),r=n*7;return Dn(e,r)}function YF(e,t){be(2,arguments);var n=nn(t);return No(e,n*12)}function JF(e){be(1,arguments);var t;if(e&&typeof e.forEach=="function")t=e;else if(Mc(e)==="object"&&e!==null)t=Array.prototype.slice.call(e);else return new Date(NaN);var n;return t.forEach(function(r){var o=Ae(r);(n===void 0||n<o||isNaN(Number(o)))&&(n=o)}),n||new Date(NaN)}function XF(e){be(1,arguments);var t;if(e&&typeof e.forEach=="function")t=e;else if(Mc(e)==="object"&&e!==null)t=Array.prototype.slice.call(e);else return new Date(NaN);var n;return t.forEach(function(r){var o=Ae(r);(n===void 0||n>o||isNaN(o.getDate()))&&(n=o)}),n||new Date(NaN)}function Zn(e,t){be(2,arguments);var n=Pc(e),r=Pc(t);return n.getTime()===r.getTime()}function Rw(e){return be(1,arguments),e instanceof Date||Mc(e)==="object"&&Object.prototype.toString.call(e)==="[object Date]"}function ZF(e){if(be(1,arguments),!Rw(e)&&typeof e!="number")return!1;var t=Ae(e);return!isNaN(Number(t))}function of(e,t){be(2,arguments);var n=Ae(e),r=Ae(t),o=n.getFullYear()-r.getFullYear(),i=n.getMonth()-r.getMonth();return o*12+i}var QF=6048e5;function ez(e,t,n){be(2,arguments);var r=Jo(e,n),o=Jo(t,n),i=r.getTime()-rf(r),s=o.getTime()-rf(o);return Math.round((i-s)/QF)}function jw(e){be(1,arguments);var t=Ae(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function or(e){be(1,arguments);var t=Ae(e);return t.setDate(1),t.setHours(0,0,0,0),t}function tz(e){be(1,arguments);var t=Ae(e),n=new Date(0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Aw(e,t){var n,r,o,i,s,a,l,c;be(1,arguments);var u=ca(),d=nn((n=(r=(o=(i=t==null?void 0:t.weekStartsOn)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.weekStartsOn)!==null&&o!==void 0?o:u.weekStartsOn)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&n!==void 0?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var f=Ae(e),h=f.getDay(),m=(h<d?-7:0)+6-(h-d);return f.setDate(f.getDate()+m),f.setHours(23,59,59,999),f}function nM(e){return be(1,arguments),Aw(e,{weekStartsOn:1})}function nz(e,t){be(2,arguments);var n=nn(t);return WF(e,-n)}var rz=864e5;function oz(e){be(1,arguments);var t=Ae(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var r=t.getTime(),o=n-r;return Math.floor(o/rz)+1}function Sm(e){be(1,arguments);var t=1,n=Ae(e),r=n.getUTCDay(),o=(r<t?7:0)+r-t;return n.setUTCDate(n.getUTCDate()-o),n.setUTCHours(0,0,0,0),n}function rM(e){be(1,arguments);var t=Ae(e),n=t.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(n+1,0,4),r.setUTCHours(0,0,0,0);var o=Sm(r),i=new Date(0);i.setUTCFullYear(n,0,4),i.setUTCHours(0,0,0,0);var s=Sm(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=s.getTime()?n:n-1}function iz(e){be(1,arguments);var t=rM(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var r=Sm(n);return r}var sz=6048e5;function az(e){be(1,arguments);var t=Ae(e),n=Sm(t).getTime()-iz(t).getTime();return Math.round(n/sz)+1}function km(e,t){var n,r,o,i,s,a,l,c;be(1,arguments);var u=ca(),d=nn((n=(r=(o=(i=t==null?void 0:t.weekStartsOn)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.weekStartsOn)!==null&&o!==void 0?o:u.weekStartsOn)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&n!==void 0?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var f=Ae(e),h=f.getUTCDay(),m=(h<d?7:0)+h-d;return f.setUTCDate(f.getUTCDate()-m),f.setUTCHours(0,0,0,0),f}function oM(e,t){var n,r,o,i,s,a,l,c;be(1,arguments);var u=Ae(e),d=u.getUTCFullYear(),f=ca(),h=nn((n=(r=(o=(i=t==null?void 0:t.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.firstWeekContainsDate)!==null&&o!==void 0?o:f.firstWeekContainsDate)!==null&&r!==void 0?r:(l=f.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1);if(!(h>=1&&h<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=new Date(0);m.setUTCFullYear(d+1,0,h),m.setUTCHours(0,0,0,0);var v=km(m,t),x=new Date(0);x.setUTCFullYear(d,0,h),x.setUTCHours(0,0,0,0);var b=km(x,t);return u.getTime()>=v.getTime()?d+1:u.getTime()>=b.getTime()?d:d-1}function lz(e,t){var n,r,o,i,s,a,l,c;be(1,arguments);var u=ca(),d=nn((n=(r=(o=(i=t==null?void 0:t.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.firstWeekContainsDate)!==null&&o!==void 0?o:u.firstWeekContainsDate)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1),f=oM(e,t),h=new Date(0);h.setUTCFullYear(f,0,d),h.setUTCHours(0,0,0,0);var m=km(h,t);return m}var cz=6048e5;function uz(e,t){be(1,arguments);var n=Ae(e),r=km(n,t).getTime()-lz(n,t).getTime();return Math.round(r/cz)+1}function Ze(e,t){for(var n=e<0?"-":"",r=Math.abs(e).toString();r.length<t;)r="0"+r;return n+r}var Yi={y:function(t,n){var r=t.getUTCFullYear(),o=r>0?r:1-r;return Ze(n==="yy"?o%100:o,n.length)},M:function(t,n){var r=t.getUTCMonth();return n==="M"?String(r+1):Ze(r+1,2)},d:function(t,n){return Ze(t.getUTCDate(),n.length)},a:function(t,n){var r=t.getUTCHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h:function(t,n){return Ze(t.getUTCHours()%12||12,n.length)},H:function(t,n){return Ze(t.getUTCHours(),n.length)},m:function(t,n){return Ze(t.getUTCMinutes(),n.length)},s:function(t,n){return Ze(t.getUTCSeconds(),n.length)},S:function(t,n){var r=n.length,o=t.getUTCMilliseconds(),i=Math.floor(o*Math.pow(10,r-3));return Ze(i,n.length)}},El={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},dz={G:function(t,n,r){var o=t.getUTCFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return r.era(o,{width:"abbreviated"});case"GGGGG":return r.era(o,{width:"narrow"});case"GGGG":default:return r.era(o,{width:"wide"})}},y:function(t,n,r){if(n==="yo"){var o=t.getUTCFullYear(),i=o>0?o:1-o;return r.ordinalNumber(i,{unit:"year"})}return Yi.y(t,n)},Y:function(t,n,r,o){var i=oM(t,o),s=i>0?i:1-i;if(n==="YY"){var a=s%100;return Ze(a,2)}return n==="Yo"?r.ordinalNumber(s,{unit:"year"}):Ze(s,n.length)},R:function(t,n){var r=rM(t);return Ze(r,n.length)},u:function(t,n){var r=t.getUTCFullYear();return Ze(r,n.length)},Q:function(t,n,r){var o=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"Q":return String(o);case"QQ":return Ze(o,2);case"Qo":return r.ordinalNumber(o,{unit:"quarter"});case"QQQ":return r.quarter(o,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(o,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(o,{width:"wide",context:"formatting"})}},q:function(t,n,r){var o=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"q":return String(o);case"qq":return Ze(o,2);case"qo":return r.ordinalNumber(o,{unit:"quarter"});case"qqq":return r.quarter(o,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(o,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(o,{width:"wide",context:"standalone"})}},M:function(t,n,r){var o=t.getUTCMonth();switch(n){case"M":case"MM":return Yi.M(t,n);case"Mo":return r.ordinalNumber(o+1,{unit:"month"});case"MMM":return r.month(o,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(o,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(o,{width:"wide",context:"formatting"})}},L:function(t,n,r){var o=t.getUTCMonth();switch(n){case"L":return String(o+1);case"LL":return Ze(o+1,2);case"Lo":return r.ordinalNumber(o+1,{unit:"month"});case"LLL":return r.month(o,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(o,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(o,{width:"wide",context:"standalone"})}},w:function(t,n,r,o){var i=uz(t,o);return n==="wo"?r.ordinalNumber(i,{unit:"week"}):Ze(i,n.length)},I:function(t,n,r){var o=az(t);return n==="Io"?r.ordinalNumber(o,{unit:"week"}):Ze(o,n.length)},d:function(t,n,r){return n==="do"?r.ordinalNumber(t.getUTCDate(),{unit:"date"}):Yi.d(t,n)},D:function(t,n,r){var o=oz(t);return n==="Do"?r.ordinalNumber(o,{unit:"dayOfYear"}):Ze(o,n.length)},E:function(t,n,r){var o=t.getUTCDay();switch(n){case"E":case"EE":case"EEE":return r.day(o,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(o,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(o,{width:"short",context:"formatting"});case"EEEE":default:return r.day(o,{width:"wide",context:"formatting"})}},e:function(t,n,r,o){var i=t.getUTCDay(),s=(i-o.weekStartsOn+8)%7||7;switch(n){case"e":return String(s);case"ee":return Ze(s,2);case"eo":return r.ordinalNumber(s,{unit:"day"});case"eee":return r.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(i,{width:"short",context:"formatting"});case"eeee":default:return r.day(i,{width:"wide",context:"formatting"})}},c:function(t,n,r,o){var i=t.getUTCDay(),s=(i-o.weekStartsOn+8)%7||7;switch(n){case"c":return String(s);case"cc":return Ze(s,n.length);case"co":return r.ordinalNumber(s,{unit:"day"});case"ccc":return r.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(i,{width:"narrow",context:"standalone"});case"cccccc":return r.day(i,{width:"short",context:"standalone"});case"cccc":default:return r.day(i,{width:"wide",context:"standalone"})}},i:function(t,n,r){var o=t.getUTCDay(),i=o===0?7:o;switch(n){case"i":return String(i);case"ii":return Ze(i,n.length);case"io":return r.ordinalNumber(i,{unit:"day"});case"iii":return r.day(o,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(o,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(o,{width:"short",context:"formatting"});case"iiii":default:return r.day(o,{width:"wide",context:"formatting"})}},a:function(t,n,r){var o=t.getUTCHours(),i=o/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,n,r){var o=t.getUTCHours(),i;switch(o===12?i=El.noon:o===0?i=El.midnight:i=o/12>=1?"pm":"am",n){case"b":case"bb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,n,r){var o=t.getUTCHours(),i;switch(o>=17?i=El.evening:o>=12?i=El.afternoon:o>=4?i=El.morning:i=El.night,n){case"B":case"BB":case"BBB":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,n,r){if(n==="ho"){var o=t.getUTCHours()%12;return o===0&&(o=12),r.ordinalNumber(o,{unit:"hour"})}return Yi.h(t,n)},H:function(t,n,r){return n==="Ho"?r.ordinalNumber(t.getUTCHours(),{unit:"hour"}):Yi.H(t,n)},K:function(t,n,r){var o=t.getUTCHours()%12;return n==="Ko"?r.ordinalNumber(o,{unit:"hour"}):Ze(o,n.length)},k:function(t,n,r){var o=t.getUTCHours();return o===0&&(o=24),n==="ko"?r.ordinalNumber(o,{unit:"hour"}):Ze(o,n.length)},m:function(t,n,r){return n==="mo"?r.ordinalNumber(t.getUTCMinutes(),{unit:"minute"}):Yi.m(t,n)},s:function(t,n,r){return n==="so"?r.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):Yi.s(t,n)},S:function(t,n){return Yi.S(t,n)},X:function(t,n,r,o){var i=o._originalDate||t,s=i.getTimezoneOffset();if(s===0)return"Z";switch(n){case"X":return mC(s);case"XXXX":case"XX":return ka(s);case"XXXXX":case"XXX":default:return ka(s,":")}},x:function(t,n,r,o){var i=o._originalDate||t,s=i.getTimezoneOffset();switch(n){case"x":return mC(s);case"xxxx":case"xx":return ka(s);case"xxxxx":case"xxx":default:return ka(s,":")}},O:function(t,n,r,o){var i=o._originalDate||t,s=i.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+hC(s,":");case"OOOO":default:return"GMT"+ka(s,":")}},z:function(t,n,r,o){var i=o._originalDate||t,s=i.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+hC(s,":");case"zzzz":default:return"GMT"+ka(s,":")}},t:function(t,n,r,o){var i=o._originalDate||t,s=Math.floor(i.getTime()/1e3);return Ze(s,n.length)},T:function(t,n,r,o){var i=o._originalDate||t,s=i.getTime();return Ze(s,n.length)}};function hC(e,t){var n=e>0?"-":"+",r=Math.abs(e),o=Math.floor(r/60),i=r%60;if(i===0)return n+String(o);var s=t;return n+String(o)+s+Ze(i,2)}function mC(e,t){if(e%60===0){var n=e>0?"-":"+";return n+Ze(Math.abs(e)/60,2)}return ka(e,t)}function ka(e,t){var n=t||"",r=e>0?"-":"+",o=Math.abs(e),i=Ze(Math.floor(o/60),2),s=Ze(o%60,2);return r+i+n+s}var gC=function(t,n){switch(t){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},iM=function(t,n){switch(t){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},fz=function(t,n){var r=t.match(/(P+)(p+)?/)||[],o=r[1],i=r[2];if(!i)return gC(t,n);var s;switch(o){case"P":s=n.dateTime({width:"short"});break;case"PP":s=n.dateTime({width:"medium"});break;case"PPP":s=n.dateTime({width:"long"});break;case"PPPP":default:s=n.dateTime({width:"full"});break}return s.replace("{{date}}",gC(o,n)).replace("{{time}}",iM(i,n))},pz={p:iM,P:fz},hz=["D","DD"],mz=["YY","YYYY"];function gz(e){return hz.indexOf(e)!==-1}function vz(e){return mz.indexOf(e)!==-1}function vC(e,t,n){if(e==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var yz={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},xz=function(t,n,r){var o,i=yz[t];return typeof i=="string"?o=i:n===1?o=i.one:o=i.other.replace("{{count}}",n.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+o:o+" ago":o};function gy(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,r=e.formats[n]||e.formats[e.defaultWidth];return r}}var bz={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},wz={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Sz={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},kz={date:gy({formats:bz,defaultWidth:"full"}),time:gy({formats:wz,defaultWidth:"full"}),dateTime:gy({formats:Sz,defaultWidth:"full"})},Cz={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Ez=function(t,n,r,o){return Cz[t]};function Pu(e){return function(t,n){var r=n!=null&&n.context?String(n.context):"standalone",o;if(r==="formatting"&&e.formattingValues){var i=e.defaultFormattingWidth||e.defaultWidth,s=n!=null&&n.width?String(n.width):i;o=e.formattingValues[s]||e.formattingValues[i]}else{var a=e.defaultWidth,l=n!=null&&n.width?String(n.width):e.defaultWidth;o=e.values[l]||e.values[a]}var c=e.argumentCallback?e.argumentCallback(t):t;return o[c]}}var _z={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Tz={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Oz={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Nz={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Mz={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Pz={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Rz=function(t,n){var r=Number(t),o=r%100;if(o>20||o<10)switch(o%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},jz={ordinalNumber:Rz,era:Pu({values:_z,defaultWidth:"wide"}),quarter:Pu({values:Tz,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:Pu({values:Oz,defaultWidth:"wide"}),day:Pu({values:Nz,defaultWidth:"wide"}),dayPeriod:Pu({values:Mz,defaultWidth:"wide",formattingValues:Pz,defaultFormattingWidth:"wide"})};function Ru(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.width,o=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],i=t.match(o);if(!i)return null;var s=i[0],a=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(a)?Iz(a,function(d){return d.test(s)}):Az(a,function(d){return d.test(s)}),c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;var u=t.slice(s.length);return{value:c,rest:u}}}function Az(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function Iz(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}function Dz(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.match(e.matchPattern);if(!r)return null;var o=r[0],i=t.match(e.parsePattern);if(!i)return null;var s=e.valueCallback?e.valueCallback(i[0]):i[0];s=n.valueCallback?n.valueCallback(s):s;var a=t.slice(o.length);return{value:s,rest:a}}}var Lz=/^(\d+)(th|st|nd|rd)?/i,Fz=/\d+/i,zz={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},$z={any:[/^b/i,/^(a|c)/i]},Bz={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Vz={any:[/1/i,/2/i,/3/i,/4/i]},Uz={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Wz={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Hz={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Kz={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},qz={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Gz={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Yz={ordinalNumber:Dz({matchPattern:Lz,parsePattern:Fz,valueCallback:function(t){return parseInt(t,10)}}),era:Ru({matchPatterns:zz,defaultMatchWidth:"wide",parsePatterns:$z,defaultParseWidth:"any"}),quarter:Ru({matchPatterns:Bz,defaultMatchWidth:"wide",parsePatterns:Vz,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:Ru({matchPatterns:Uz,defaultMatchWidth:"wide",parsePatterns:Wz,defaultParseWidth:"any"}),day:Ru({matchPatterns:Hz,defaultMatchWidth:"wide",parsePatterns:Kz,defaultParseWidth:"any"}),dayPeriod:Ru({matchPatterns:qz,defaultMatchWidth:"any",parsePatterns:Gz,defaultParseWidth:"any"})},sM={code:"en-US",formatDistance:xz,formatLong:kz,formatRelative:Ez,localize:jz,match:Yz,options:{weekStartsOn:0,firstWeekContainsDate:1}},Jz=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Xz=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Zz=/^'([^]*?)'?$/,Qz=/''/g,e$=/[a-zA-Z]/;function $i(e,t,n){var r,o,i,s,a,l,c,u,d,f,h,m,v,x,b,w,S,k;be(2,arguments);var C=String(t),T=ca(),_=(r=(o=n==null?void 0:n.locale)!==null&&o!==void 0?o:T.locale)!==null&&r!==void 0?r:sM,O=nn((i=(s=(a=(l=n==null?void 0:n.firstWeekContainsDate)!==null&&l!==void 0?l:n==null||(c=n.locale)===null||c===void 0||(u=c.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&a!==void 0?a:T.firstWeekContainsDate)!==null&&s!==void 0?s:(d=T.locale)===null||d===void 0||(f=d.options)===null||f===void 0?void 0:f.firstWeekContainsDate)!==null&&i!==void 0?i:1);if(!(O>=1&&O<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var M=nn((h=(m=(v=(x=n==null?void 0:n.weekStartsOn)!==null&&x!==void 0?x:n==null||(b=n.locale)===null||b===void 0||(w=b.options)===null||w===void 0?void 0:w.weekStartsOn)!==null&&v!==void 0?v:T.weekStartsOn)!==null&&m!==void 0?m:(S=T.locale)===null||S===void 0||(k=S.options)===null||k===void 0?void 0:k.weekStartsOn)!==null&&h!==void 0?h:0);if(!(M>=0&&M<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!_.localize)throw new RangeError("locale must contain localize property");if(!_.formatLong)throw new RangeError("locale must contain formatLong property");var j=Ae(e);if(!ZF(j))throw new RangeError("Invalid time value");var L=rf(j),B=nz(j,L),J={firstWeekContainsDate:O,weekStartsOn:M,locale:_,_originalDate:j},z=C.match(Xz).map(function(H){var R=H[0];if(R==="p"||R==="P"){var N=pz[R];return N(H,_.formatLong)}return H}).join("").match(Jz).map(function(H){if(H==="''")return"'";var R=H[0];if(R==="'")return t$(H);var N=dz[R];if(N)return!(n!=null&&n.useAdditionalWeekYearTokens)&&vz(H)&&vC(H,t,String(e)),!(n!=null&&n.useAdditionalDayOfYearTokens)&&gz(H)&&vC(H,t,String(e)),N(B,H,_.localize,J);if(R.match(e$))throw new RangeError("Format string contains an unescaped latin alphabet character `"+R+"`");return H}).join("");return z}function t$(e){var t=e.match(Zz);return t?t[1].replace(Qz,"'"):e}function n$(e){be(1,arguments);var t=Ae(e),n=t.getFullYear(),r=t.getMonth(),o=new Date(0);return o.setFullYear(n,r+1,0),o.setHours(0,0,0,0),o.getDate()}var r$=6048e5;function o$(e){be(1,arguments);var t=Ae(e),n=Xa(t).getTime()-qF(t).getTime();return Math.round(n/r$)+1}function i$(e){be(1,arguments);var t=Ae(e),n=t.getTime();return n}function s$(e){return be(1,arguments),Math.floor(i$(e)/1e3)}function a$(e,t){var n,r,o,i,s,a,l,c;be(1,arguments);var u=Ae(e),d=u.getFullYear(),f=ca(),h=nn((n=(r=(o=(i=t==null?void 0:t.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.firstWeekContainsDate)!==null&&o!==void 0?o:f.firstWeekContainsDate)!==null&&r!==void 0?r:(l=f.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1);if(!(h>=1&&h<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=new Date(0);m.setFullYear(d+1,0,h),m.setHours(0,0,0,0);var v=Jo(m,t),x=new Date(0);x.setFullYear(d,0,h),x.setHours(0,0,0,0);var b=Jo(x,t);return u.getTime()>=v.getTime()?d+1:u.getTime()>=b.getTime()?d:d-1}function l$(e,t){var n,r,o,i,s,a,l,c;be(1,arguments);var u=ca(),d=nn((n=(r=(o=(i=t==null?void 0:t.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.firstWeekContainsDate)!==null&&o!==void 0?o:u.firstWeekContainsDate)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1),f=a$(e,t),h=new Date(0);h.setFullYear(f,0,d),h.setHours(0,0,0,0);var m=Jo(h,t);return m}var c$=6048e5;function u$(e,t){be(1,arguments);var n=Ae(e),r=Jo(n,t).getTime()-l$(n,t).getTime();return Math.round(r/c$)+1}function d$(e){be(1,arguments);var t=Ae(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(0,0,0,0),t}function f$(e,t){return be(1,arguments),ez(d$(e),or(e),t)+1}function d0(e,t){be(2,arguments);var n=Ae(e),r=Ae(t);return n.getTime()>r.getTime()}function aM(e,t){be(2,arguments);var n=Ae(e),r=Ae(t);return n.getTime()<r.getTime()}function Iw(e,t){be(2,arguments);var n=Ae(e),r=Ae(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function p$(e,t){be(2,arguments);var n=Ae(e),r=Ae(t);return n.getFullYear()===r.getFullYear()}function vy(e,t){be(2,arguments);var n=nn(t);return Dn(e,-n)}function yy(e,t){be(2,arguments);var n=Ae(e),r=nn(t),o=n.getFullYear(),i=n.getDate(),s=new Date(0);s.setFullYear(o,r,15),s.setHours(0,0,0,0);var a=n$(s);return n.setMonth(r,Math.min(i,a)),n}function yC(e,t){be(2,arguments);var n=Ae(e),r=nn(t);return isNaN(n.getTime())?new Date(NaN):(n.setFullYear(r),n)}var ke=function(){return ke=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},ke.apply(this,arguments)};function h$(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 o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function lM(e,t,n){for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}function np(e){return e.mode==="multiple"}function rp(e){return e.mode==="range"}function Bg(e){return e.mode==="single"}var m$={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function g$(e,t){return $i(e,"LLLL y",t)}function v$(e,t){return $i(e,"d",t)}function y$(e,t){return $i(e,"LLLL",t)}function x$(e){return"".concat(e)}function b$(e,t){return $i(e,"cccccc",t)}function w$(e,t){return $i(e,"yyyy",t)}var S$=Object.freeze({__proto__:null,formatCaption:g$,formatDay:v$,formatMonthCaption:y$,formatWeekNumber:x$,formatWeekdayName:b$,formatYearCaption:w$}),k$=function(e,t,n){return $i(e,"do MMMM (EEEE)",n)},C$=function(){return"Month: "},E$=function(){return"Go to next month"},_$=function(){return"Go to previous month"},T$=function(e,t){return $i(e,"cccc",t)},O$=function(e){return"Week n. ".concat(e)},N$=function(){return"Year: "},M$=Object.freeze({__proto__:null,labelDay:k$,labelMonthDropdown:C$,labelNext:E$,labelPrevious:_$,labelWeekNumber:O$,labelWeekday:T$,labelYearDropdown:N$});function P$(){var e="buttons",t=m$,n=sM,r={},o={},i=1,s={},a=new Date;return{captionLayout:e,classNames:t,formatters:S$,labels:M$,locale:n,modifiersClassNames:r,modifiers:o,numberOfMonths:i,styles:s,today:a,mode:"default"}}function R$(e){var t=e.fromYear,n=e.toYear,r=e.fromMonth,o=e.toMonth,i=e.fromDate,s=e.toDate;return r?i=or(r):t&&(i=new Date(t,0,1)),o?s=jw(o):n&&(s=new Date(n,11,31)),{fromDate:i?Pc(i):void 0,toDate:s?Pc(s):void 0}}var cM=g.createContext(void 0);function uM(e){var t,n=e.initialProps,r=P$(),o=R$(n),i=o.fromDate,s=o.toDate,a=(t=n.captionLayout)!==null&&t!==void 0?t:r.captionLayout;a!=="buttons"&&(!i||!s)&&(a="buttons");var l;(Bg(n)||np(n)||rp(n))&&(l=n.onSelect);var c=ke(ke(ke({},r),n),{captionLayout:a,classNames:ke(ke({},r.classNames),n.classNames),components:ke({},n.components),formatters:ke(ke({},r.formatters),n.formatters),fromDate:i,labels:ke(ke({},r.labels),n.labels),mode:n.mode||r.mode,modifiers:ke(ke({},r.modifiers),n.modifiers),modifiersClassNames:ke(ke({},r.modifiersClassNames),n.modifiersClassNames),onSelect:l,styles:ke(ke({},r.styles),n.styles),toDate:s});return p.jsx(cM.Provider,{value:c,children:e.children})}function st(){var e=g.useContext(cM);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function dM(e){var t=st(),n=t.locale,r=t.classNames,o=t.styles,i=t.formatters.formatCaption;return p.jsx("div",{className:r.caption_label,style:o.caption_label,"aria-live":"polite",role:"presentation",id:e.id,children:i(e.displayMonth,{locale:n})})}function j$(e){return p.jsx("svg",ke({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e,{children:p.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function fM(e){var t,n,r=e.onChange,o=e.value,i=e.children,s=e.caption,a=e.className,l=e.style,c=st(),u=(n=(t=c.components)===null||t===void 0?void 0:t.IconDropdown)!==null&&n!==void 0?n:j$;return p.jsxs("div",{className:a,style:l,children:[p.jsx("span",{className:c.classNames.vhidden,children:e["aria-label"]}),p.jsx("select",{name:e.name,"aria-label":e["aria-label"],className:c.classNames.dropdown,style:c.styles.dropdown,value:o,onChange:r,children:i}),p.jsxs("div",{className:c.classNames.caption_label,style:c.styles.caption_label,"aria-hidden":"true",children:[s,p.jsx(u,{className:c.classNames.dropdown_icon,style:c.styles.dropdown_icon})]})]})}function A$(e){var t,n=st(),r=n.fromDate,o=n.toDate,i=n.styles,s=n.locale,a=n.formatters.formatMonthCaption,l=n.classNames,c=n.components,u=n.labels.labelMonthDropdown;if(!r)return p.jsx(p.Fragment,{});if(!o)return p.jsx(p.Fragment,{});var d=[];if(p$(r,o))for(var f=or(r),h=r.getMonth();h<=o.getMonth();h++)d.push(yy(f,h));else for(var f=or(new Date),h=0;h<=11;h++)d.push(yy(f,h));var m=function(x){var b=Number(x.target.value),w=yy(or(e.displayMonth),b);e.onChange(w)},v=(t=c==null?void 0:c.Dropdown)!==null&&t!==void 0?t:fM;return p.jsx(v,{name:"months","aria-label":u(),className:l.dropdown_month,style:i.dropdown_month,onChange:m,value:e.displayMonth.getMonth(),caption:a(e.displayMonth,{locale:s}),children:d.map(function(x){return p.jsx("option",{value:x.getMonth(),children:a(x,{locale:s})},x.getMonth())})})}function I$(e){var t,n=e.displayMonth,r=st(),o=r.fromDate,i=r.toDate,s=r.locale,a=r.styles,l=r.classNames,c=r.components,u=r.formatters.formatYearCaption,d=r.labels.labelYearDropdown,f=[];if(!o)return p.jsx(p.Fragment,{});if(!i)return p.jsx(p.Fragment,{});for(var h=o.getFullYear(),m=i.getFullYear(),v=h;v<=m;v++)f.push(yC(tz(new Date),v));var x=function(w){var S=yC(or(n),Number(w.target.value));e.onChange(S)},b=(t=c==null?void 0:c.Dropdown)!==null&&t!==void 0?t:fM;return p.jsx(b,{name:"years","aria-label":d(),className:l.dropdown_year,style:a.dropdown_year,onChange:x,value:n.getFullYear(),caption:u(n,{locale:s}),children:f.map(function(w){return p.jsx("option",{value:w.getFullYear(),children:u(w,{locale:s})},w.getFullYear())})})}function D$(e,t){var n=g.useState(e),r=n[0],o=n[1],i=t===void 0?r:t;return[i,o]}function L$(e){var t=e.month,n=e.defaultMonth,r=e.today,o=t||n||r||new Date,i=e.toDate,s=e.fromDate,a=e.numberOfMonths,l=a===void 0?1:a;if(i&&of(i,o)<0){var c=-1*(l-1);o=No(i,c)}return s&&of(o,s)<0&&(o=s),or(o)}function F$(){var e=st(),t=L$(e),n=D$(t,e.month),r=n[0],o=n[1],i=function(s){var a;if(!e.disableNavigation){var l=or(s);o(l),(a=e.onMonthChange)===null||a===void 0||a.call(e,l)}};return[r,i]}function z$(e,t){for(var n=t.reverseMonths,r=t.numberOfMonths,o=or(e),i=or(No(o,r)),s=of(i,o),a=[],l=0;l<s;l++){var c=No(o,l);a.push(c)}return n&&(a=a.reverse()),a}function $$(e,t){if(!t.disableNavigation){var n=t.toDate,r=t.pagedNavigation,o=t.numberOfMonths,i=o===void 0?1:o,s=r?i:1,a=or(e);if(!n)return No(a,s);var l=of(n,e);if(!(l<i))return No(a,s)}}function B$(e,t){if(!t.disableNavigation){var n=t.fromDate,r=t.pagedNavigation,o=t.numberOfMonths,i=o===void 0?1:o,s=r?i:1,a=or(e);if(!n)return No(a,-s);var l=of(a,n);if(!(l<=0))return No(a,-s)}}var pM=g.createContext(void 0);function V$(e){var t=st(),n=F$(),r=n[0],o=n[1],i=z$(r,t),s=$$(r,t),a=B$(r,t),l=function(d){return i.some(function(f){return Iw(d,f)})},c=function(d,f){l(d)||(f&&aM(d,f)?o(No(d,1+t.numberOfMonths*-1)):o(d))},u={currentMonth:r,displayMonths:i,goToMonth:o,goToDate:c,previousMonth:a,nextMonth:s,isDateDisplayed:l};return p.jsx(pM.Provider,{value:u,children:e.children})}function op(){var e=g.useContext(pM);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function xC(e){var t,n=st(),r=n.classNames,o=n.styles,i=n.components,s=op().goToMonth,a=function(u){s(No(u,e.displayIndex?-e.displayIndex:0))},l=(t=i==null?void 0:i.CaptionLabel)!==null&&t!==void 0?t:dM,c=p.jsx(l,{id:e.id,displayMonth:e.displayMonth});return p.jsxs("div",{className:r.caption_dropdowns,style:o.caption_dropdowns,children:[p.jsx("div",{className:r.vhidden,children:c}),p.jsx(A$,{onChange:a,displayMonth:e.displayMonth}),p.jsx(I$,{onChange:a,displayMonth:e.displayMonth})]})}function U$(e){return p.jsx("svg",ke({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:p.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function W$(e){return p.jsx("svg",ke({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:p.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var Cm=g.forwardRef(function(e,t){var n=st(),r=n.classNames,o=n.styles,i=[r.button_reset,r.button];e.className&&i.push(e.className);var s=i.join(" "),a=ke(ke({},o.button_reset),o.button);return e.style&&Object.assign(a,e.style),p.jsx("button",ke({},e,{ref:t,type:"button",className:s,style:a}))});function H$(e){var t,n,r=st(),o=r.dir,i=r.locale,s=r.classNames,a=r.styles,l=r.labels,c=l.labelPrevious,u=l.labelNext,d=r.components;if(!e.nextMonth&&!e.previousMonth)return p.jsx(p.Fragment,{});var f=c(e.previousMonth,{locale:i}),h=[s.nav_button,s.nav_button_previous].join(" "),m=u(e.nextMonth,{locale:i}),v=[s.nav_button,s.nav_button_next].join(" "),x=(t=d==null?void 0:d.IconRight)!==null&&t!==void 0?t:W$,b=(n=d==null?void 0:d.IconLeft)!==null&&n!==void 0?n:U$;return p.jsxs("div",{className:s.nav,style:a.nav,children:[!e.hidePrevious&&p.jsx(Cm,{name:"previous-month","aria-label":f,className:h,style:a.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:o==="rtl"?p.jsx(x,{className:s.nav_icon,style:a.nav_icon}):p.jsx(b,{className:s.nav_icon,style:a.nav_icon})}),!e.hideNext&&p.jsx(Cm,{name:"next-month","aria-label":m,className:v,style:a.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:o==="rtl"?p.jsx(b,{className:s.nav_icon,style:a.nav_icon}):p.jsx(x,{className:s.nav_icon,style:a.nav_icon})})]})}function bC(e){var t=st().numberOfMonths,n=op(),r=n.previousMonth,o=n.nextMonth,i=n.goToMonth,s=n.displayMonths,a=s.findIndex(function(m){return Iw(e.displayMonth,m)}),l=a===0,c=a===s.length-1,u=t>1&&(l||!c),d=t>1&&(c||!l),f=function(){r&&i(r)},h=function(){o&&i(o)};return p.jsx(H$,{displayMonth:e.displayMonth,hideNext:u,hidePrevious:d,nextMonth:o,previousMonth:r,onPreviousClick:f,onNextClick:h})}function K$(e){var t,n=st(),r=n.classNames,o=n.disableNavigation,i=n.styles,s=n.captionLayout,a=n.components,l=(t=a==null?void 0:a.CaptionLabel)!==null&&t!==void 0?t:dM,c;return o?c=p.jsx(l,{id:e.id,displayMonth:e.displayMonth}):s==="dropdown"?c=p.jsx(xC,{displayMonth:e.displayMonth,id:e.id}):s==="dropdown-buttons"?c=p.jsxs(p.Fragment,{children:[p.jsx(xC,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),p.jsx(bC,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):c=p.jsxs(p.Fragment,{children:[p.jsx(l,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),p.jsx(bC,{displayMonth:e.displayMonth,id:e.id})]}),p.jsx("div",{className:r.caption,style:i.caption,children:c})}function q$(e){var t=st(),n=t.footer,r=t.styles,o=t.classNames.tfoot;return n?p.jsx("tfoot",{className:o,style:r.tfoot,children:p.jsx("tr",{children:p.jsx("td",{colSpan:8,children:n})})}):p.jsx(p.Fragment,{})}function G$(e,t,n){for(var r=n?Xa(new Date):Jo(new Date,{locale:e,weekStartsOn:t}),o=[],i=0;i<7;i++){var s=Dn(r,i);o.push(s)}return o}function Y$(){var e=st(),t=e.classNames,n=e.styles,r=e.showWeekNumber,o=e.locale,i=e.weekStartsOn,s=e.ISOWeek,a=e.formatters.formatWeekdayName,l=e.labels.labelWeekday,c=G$(o,i,s);return p.jsxs("tr",{style:n.head_row,className:t.head_row,children:[r&&p.jsx("td",{style:n.head_cell,className:t.head_cell}),c.map(function(u,d){return p.jsx("th",{scope:"col",className:t.head_cell,style:n.head_cell,"aria-label":l(u,{locale:o}),children:a(u,{locale:o})},d)})]})}function J$(){var e,t=st(),n=t.classNames,r=t.styles,o=t.components,i=(e=o==null?void 0:o.HeadRow)!==null&&e!==void 0?e:Y$;return p.jsx("thead",{style:r.head,className:n.head,children:p.jsx(i,{})})}function X$(e){var t=st(),n=t.locale,r=t.formatters.formatDay;return p.jsx(p.Fragment,{children:r(e.date,{locale:n})})}var Dw=g.createContext(void 0);function Z$(e){if(!np(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return p.jsx(Dw.Provider,{value:t,children:e.children})}return p.jsx(Q$,{initialProps:e.initialProps,children:e.children})}function Q$(e){var t=e.initialProps,n=e.children,r=t.selected,o=t.min,i=t.max,s=function(c,u,d){var f,h;(f=t.onDayClick)===null||f===void 0||f.call(t,c,u,d);var m=!!(u.selected&&o&&(r==null?void 0:r.length)===o);if(!m){var v=!!(!u.selected&&i&&(r==null?void 0:r.length)===i);if(!v){var x=r?lM([],r):[];if(u.selected){var b=x.findIndex(function(w){return Zn(c,w)});x.splice(b,1)}else x.push(c);(h=t.onSelect)===null||h===void 0||h.call(t,x,c,u,d)}}},a={disabled:[]};r&&a.disabled.push(function(c){var u=i&&r.length>i-1,d=r.some(function(f){return Zn(f,c)});return!!(u&&!d)});var l={selected:r,onDayClick:s,modifiers:a};return p.jsx(Dw.Provider,{value:l,children:n})}function Lw(){var e=g.useContext(Dw);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function e6(e,t){var n=t||{},r=n.from,o=n.to;return r&&o?Zn(o,e)&&Zn(r,e)?void 0:Zn(o,e)?{from:o,to:void 0}:Zn(r,e)?void 0:d0(r,e)?{from:e,to:o}:{from:r,to:e}:o?d0(e,o)?{from:o,to:e}:{from:e,to:o}:r?aM(e,r)?{from:e,to:r}:{from:r,to:e}:{from:e,to:void 0}}var Fw=g.createContext(void 0);function t6(e){if(!rp(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return p.jsx(Fw.Provider,{value:t,children:e.children})}return p.jsx(n6,{initialProps:e.initialProps,children:e.children})}function n6(e){var t=e.initialProps,n=e.children,r=t.selected,o=r||{},i=o.from,s=o.to,a=t.min,l=t.max,c=function(h,m,v){var x,b;(x=t.onDayClick)===null||x===void 0||x.call(t,h,m,v);var w=e6(h,r);(b=t.onSelect)===null||b===void 0||b.call(t,w,h,m,v)},u={range_start:[],range_end:[],range_middle:[],disabled:[]};if(i?(u.range_start=[i],s?(u.range_end=[s],Zn(i,s)||(u.range_middle=[{after:i,before:s}])):u.range_end=[i]):s&&(u.range_start=[s],u.range_end=[s]),a&&(i&&!s&&u.disabled.push({after:vy(i,a-1),before:Dn(i,a-1)}),i&&s&&u.disabled.push({after:i,before:Dn(i,a-1)}),!i&&s&&u.disabled.push({after:vy(s,a-1),before:Dn(s,a-1)})),l){if(i&&!s&&(u.disabled.push({before:Dn(i,-l+1)}),u.disabled.push({after:Dn(i,l-1)})),i&&s){var d=Si(s,i)+1,f=l-d;u.disabled.push({before:vy(i,f)}),u.disabled.push({after:Dn(s,f)})}!i&&s&&(u.disabled.push({before:Dn(s,-l+1)}),u.disabled.push({after:Dn(s,l-1)}))}return p.jsx(Fw.Provider,{value:{selected:r,onDayClick:c,modifiers:u},children:n})}function zw(){var e=g.useContext(Fw);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function Th(e){return Array.isArray(e)?lM([],e):e!==void 0?[e]:[]}function r6(e){var t={};return Object.entries(e).forEach(function(n){var r=n[0],o=n[1];t[r]=Th(o)}),t}var Mo;(function(e){e.Outside="outside",e.Disabled="disabled",e.Selected="selected",e.Hidden="hidden",e.Today="today",e.RangeStart="range_start",e.RangeEnd="range_end",e.RangeMiddle="range_middle"})(Mo||(Mo={}));var o6=Mo.Selected,ai=Mo.Disabled,i6=Mo.Hidden,s6=Mo.Today,xy=Mo.RangeEnd,by=Mo.RangeMiddle,wy=Mo.RangeStart,a6=Mo.Outside;function l6(e,t,n){var r,o=(r={},r[o6]=Th(e.selected),r[ai]=Th(e.disabled),r[i6]=Th(e.hidden),r[s6]=[e.today],r[xy]=[],r[by]=[],r[wy]=[],r[a6]=[],r);return e.fromDate&&o[ai].push({before:e.fromDate}),e.toDate&&o[ai].push({after:e.toDate}),np(e)?o[ai]=o[ai].concat(t.modifiers[ai]):rp(e)&&(o[ai]=o[ai].concat(n.modifiers[ai]),o[wy]=n.modifiers[wy],o[by]=n.modifiers[by],o[xy]=n.modifiers[xy]),o}var hM=g.createContext(void 0);function c6(e){var t=st(),n=Lw(),r=zw(),o=l6(t,n,r),i=r6(t.modifiers),s=ke(ke({},o),i);return p.jsx(hM.Provider,{value:s,children:e.children})}function mM(){var e=g.useContext(hM);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function u6(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function d6(e){return!!(e&&typeof e=="object"&&"from"in e)}function f6(e){return!!(e&&typeof e=="object"&&"after"in e)}function p6(e){return!!(e&&typeof e=="object"&&"before"in e)}function h6(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function m6(e,t){var n,r=t.from,o=t.to;if(r&&o){var i=Si(o,r)<0;i&&(n=[o,r],r=n[0],o=n[1]);var s=Si(e,r)>=0&&Si(o,e)>=0;return s}return o?Zn(o,e):r?Zn(r,e):!1}function g6(e){return Rw(e)}function v6(e){return Array.isArray(e)&&e.every(Rw)}function y6(e,t){return t.some(function(n){if(typeof n=="boolean")return n;if(g6(n))return Zn(e,n);if(v6(n))return n.includes(e);if(d6(n))return m6(e,n);if(h6(n))return n.dayOfWeek.includes(e.getDay());if(u6(n)){var r=Si(n.before,e),o=Si(n.after,e),i=r>0,s=o<0,a=d0(n.before,n.after);return a?s&&i:i||s}return f6(n)?Si(e,n.after)>0:p6(n)?Si(n.before,e)>0:typeof n=="function"?n(e):!1})}function $w(e,t,n){var r=Object.keys(t).reduce(function(i,s){var a=t[s];return y6(e,a)&&i.push(s),i},[]),o={};return r.forEach(function(i){return o[i]=!0}),n&&!Iw(e,n)&&(o.outside=!0),o}function x6(e,t){for(var n=or(e[0]),r=jw(e[e.length-1]),o,i,s=n;s<=r;){var a=$w(s,t),l=!a.disabled&&!a.hidden;if(!l){s=Dn(s,1);continue}if(a.selected)return s;a.today&&!i&&(i=s),o||(o=s),s=Dn(s,1)}return i||o}var b6=365;function gM(e,t){var n=t.moveBy,r=t.direction,o=t.context,i=t.modifiers,s=t.retry,a=s===void 0?{count:0,lastFocused:e}:s,l=o.weekStartsOn,c=o.fromDate,u=o.toDate,d=o.locale,f={day:Dn,week:u0,month:No,year:YF,startOfWeek:function(x){return o.ISOWeek?Xa(x):Jo(x,{locale:d,weekStartsOn:l})},endOfWeek:function(x){return o.ISOWeek?nM(x):Aw(x,{locale:d,weekStartsOn:l})}},h=f[n](e,r==="after"?1:-1);r==="before"&&c?h=JF([c,h]):r==="after"&&u&&(h=XF([u,h]));var m=!0;if(i){var v=$w(h,i);m=!v.disabled&&!v.hidden}return m?h:a.count>b6?a.lastFocused:gM(h,{moveBy:n,direction:r,context:o,modifiers:i,retry:ke(ke({},a),{count:a.count+1})})}var vM=g.createContext(void 0);function w6(e){var t=op(),n=mM(),r=g.useState(),o=r[0],i=r[1],s=g.useState(),a=s[0],l=s[1],c=x6(t.displayMonths,n),u=o??(a&&t.isDateDisplayed(a))?a:c,d=function(){l(o),i(void 0)},f=function(x){i(x)},h=st(),m=function(x,b){if(o){var w=gM(o,{moveBy:x,direction:b,context:h,modifiers:n});Zn(o,w)||(t.goToDate(w,o),f(w))}},v={focusedDay:o,focusTarget:u,blur:d,focus:f,focusDayAfter:function(){return m("day","after")},focusDayBefore:function(){return m("day","before")},focusWeekAfter:function(){return m("week","after")},focusWeekBefore:function(){return m("week","before")},focusMonthBefore:function(){return m("month","before")},focusMonthAfter:function(){return m("month","after")},focusYearBefore:function(){return m("year","before")},focusYearAfter:function(){return m("year","after")},focusStartOfWeek:function(){return m("startOfWeek","before")},focusEndOfWeek:function(){return m("endOfWeek","after")}};return p.jsx(vM.Provider,{value:v,children:e.children})}function Bw(){var e=g.useContext(vM);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function S6(e,t){var n=mM(),r=$w(e,n,t);return r}var Vw=g.createContext(void 0);function k6(e){if(!Bg(e.initialProps)){var t={selected:void 0};return p.jsx(Vw.Provider,{value:t,children:e.children})}return p.jsx(C6,{initialProps:e.initialProps,children:e.children})}function C6(e){var t=e.initialProps,n=e.children,r=function(i,s,a){var l,c,u;if((l=t.onDayClick)===null||l===void 0||l.call(t,i,s,a),s.selected&&!t.required){(c=t.onSelect)===null||c===void 0||c.call(t,void 0,i,s,a);return}(u=t.onSelect)===null||u===void 0||u.call(t,i,i,s,a)},o={selected:t.selected,onDayClick:r};return p.jsx(Vw.Provider,{value:o,children:n})}function yM(){var e=g.useContext(Vw);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function E6(e,t){var n=st(),r=yM(),o=Lw(),i=zw(),s=Bw(),a=s.focusDayAfter,l=s.focusDayBefore,c=s.focusWeekAfter,u=s.focusWeekBefore,d=s.blur,f=s.focus,h=s.focusMonthBefore,m=s.focusMonthAfter,v=s.focusYearBefore,x=s.focusYearAfter,b=s.focusStartOfWeek,w=s.focusEndOfWeek,S=function(N){var E,A,P,I;Bg(n)?(E=r.onDayClick)===null||E===void 0||E.call(r,e,t,N):np(n)?(A=o.onDayClick)===null||A===void 0||A.call(o,e,t,N):rp(n)?(P=i.onDayClick)===null||P===void 0||P.call(i,e,t,N):(I=n.onDayClick)===null||I===void 0||I.call(n,e,t,N)},k=function(N){var E;f(e),(E=n.onDayFocus)===null||E===void 0||E.call(n,e,t,N)},C=function(N){var E;d(),(E=n.onDayBlur)===null||E===void 0||E.call(n,e,t,N)},T=function(N){var E;(E=n.onDayMouseEnter)===null||E===void 0||E.call(n,e,t,N)},_=function(N){var E;(E=n.onDayMouseLeave)===null||E===void 0||E.call(n,e,t,N)},O=function(N){var E;(E=n.onDayPointerEnter)===null||E===void 0||E.call(n,e,t,N)},M=function(N){var E;(E=n.onDayPointerLeave)===null||E===void 0||E.call(n,e,t,N)},j=function(N){var E;(E=n.onDayTouchCancel)===null||E===void 0||E.call(n,e,t,N)},L=function(N){var E;(E=n.onDayTouchEnd)===null||E===void 0||E.call(n,e,t,N)},B=function(N){var E;(E=n.onDayTouchMove)===null||E===void 0||E.call(n,e,t,N)},J=function(N){var E;(E=n.onDayTouchStart)===null||E===void 0||E.call(n,e,t,N)},z=function(N){var E;(E=n.onDayKeyUp)===null||E===void 0||E.call(n,e,t,N)},H=function(N){var E;switch(N.key){case"ArrowLeft":N.preventDefault(),N.stopPropagation(),n.dir==="rtl"?a():l();break;case"ArrowRight":N.preventDefault(),N.stopPropagation(),n.dir==="rtl"?l():a();break;case"ArrowDown":N.preventDefault(),N.stopPropagation(),c();break;case"ArrowUp":N.preventDefault(),N.stopPropagation(),u();break;case"PageUp":N.preventDefault(),N.stopPropagation(),N.shiftKey?v():h();break;case"PageDown":N.preventDefault(),N.stopPropagation(),N.shiftKey?x():m();break;case"Home":N.preventDefault(),N.stopPropagation(),b();break;case"End":N.preventDefault(),N.stopPropagation(),w();break}(E=n.onDayKeyDown)===null||E===void 0||E.call(n,e,t,N)},R={onClick:S,onFocus:k,onBlur:C,onKeyDown:H,onKeyUp:z,onMouseEnter:T,onMouseLeave:_,onPointerEnter:O,onPointerLeave:M,onTouchCancel:j,onTouchEnd:L,onTouchMove:B,onTouchStart:J};return R}function _6(){var e=st(),t=yM(),n=Lw(),r=zw(),o=Bg(e)?t.selected:np(e)?n.selected:rp(e)?r.selected:void 0;return o}function T6(e){return Object.values(Mo).includes(e)}function O6(e,t){var n=[e.classNames.day];return Object.keys(t).forEach(function(r){var o=e.modifiersClassNames[r];if(o)n.push(o);else if(T6(r)){var i=e.classNames["day_".concat(r)];i&&n.push(i)}}),n}function N6(e,t){var n=ke({},e.styles.day);return Object.keys(t).forEach(function(r){var o;n=ke(ke({},n),(o=e.modifiersStyles)===null||o===void 0?void 0:o[r])}),n}function M6(e,t,n){var r,o,i,s=st(),a=Bw(),l=S6(e,t),c=E6(e,l),u=_6(),d=!!(s.onDayClick||s.mode!=="default");g.useEffect(function(){var T;l.outside||a.focusedDay&&d&&Zn(a.focusedDay,e)&&((T=n.current)===null||T===void 0||T.focus())},[a.focusedDay,e,n,d,l.outside]);var f=O6(s,l).join(" "),h=N6(s,l),m=!!(l.outside&&!s.showOutsideDays||l.hidden),v=(i=(o=s.components)===null||o===void 0?void 0:o.DayContent)!==null&&i!==void 0?i:X$,x=p.jsx(v,{date:e,displayMonth:t,activeModifiers:l}),b={style:h,className:f,children:x,role:"gridcell"},w=a.focusTarget&&Zn(a.focusTarget,e)&&!l.outside,S=a.focusedDay&&Zn(a.focusedDay,e),k=ke(ke(ke({},b),(r={disabled:l.disabled,role:"gridcell"},r["aria-selected"]=l.selected,r.tabIndex=S||w?0:-1,r)),c),C={isButton:d,isHidden:m,activeModifiers:l,selectedDays:u,buttonProps:k,divProps:b};return C}function P6(e){var t=g.useRef(null),n=M6(e.date,e.displayMonth,t);return n.isHidden?p.jsx("div",{role:"gridcell"}):n.isButton?p.jsx(Cm,ke({name:"day",ref:t},n.buttonProps)):p.jsx("div",ke({},n.divProps))}function R6(e){var t=e.number,n=e.dates,r=st(),o=r.onWeekNumberClick,i=r.styles,s=r.classNames,a=r.locale,l=r.labels.labelWeekNumber,c=r.formatters.formatWeekNumber,u=c(Number(t),{locale:a});if(!o)return p.jsx("span",{className:s.weeknumber,style:i.weeknumber,children:u});var d=l(Number(t),{locale:a}),f=function(h){o(t,n,h)};return p.jsx(Cm,{name:"week-number","aria-label":d,className:s.weeknumber,style:i.weeknumber,onClick:f,children:u})}function j6(e){var t,n,r=st(),o=r.styles,i=r.classNames,s=r.showWeekNumber,a=r.components,l=(t=a==null?void 0:a.Day)!==null&&t!==void 0?t:P6,c=(n=a==null?void 0:a.WeekNumber)!==null&&n!==void 0?n:R6,u;return s&&(u=p.jsx("td",{className:i.cell,style:o.cell,children:p.jsx(c,{number:e.weekNumber,dates:e.dates})})),p.jsxs("tr",{className:i.row,style:o.row,children:[u,e.dates.map(function(d){return p.jsx("td",{className:i.cell,style:o.cell,role:"presentation",children:p.jsx(l,{displayMonth:e.displayMonth,date:d})},s$(d))})]})}function wC(e,t,n){for(var r=n!=null&&n.ISOWeek?nM(t):Aw(t,n),o=n!=null&&n.ISOWeek?Xa(e):Jo(e,n),i=Si(r,o),s=[],a=0;a<=i;a++)s.push(Dn(o,a));var l=s.reduce(function(c,u){var d=n!=null&&n.ISOWeek?o$(u):u$(u,n),f=c.find(function(h){return h.weekNumber===d});return f?(f.dates.push(u),c):(c.push({weekNumber:d,dates:[u]}),c)},[]);return l}function A6(e,t){var n=wC(or(e),jw(e),t);if(t!=null&&t.useFixedWeeks){var r=f$(e,t);if(r<6){var o=n[n.length-1],i=o.dates[o.dates.length-1],s=u0(i,6-r),a=wC(u0(i,1),s,t);n.push.apply(n,a)}}return n}function I6(e){var t,n,r,o=st(),i=o.locale,s=o.classNames,a=o.styles,l=o.hideHead,c=o.fixedWeeks,u=o.components,d=o.weekStartsOn,f=o.firstWeekContainsDate,h=o.ISOWeek,m=A6(e.displayMonth,{useFixedWeeks:!!c,ISOWeek:h,locale:i,weekStartsOn:d,firstWeekContainsDate:f}),v=(t=u==null?void 0:u.Head)!==null&&t!==void 0?t:J$,x=(n=u==null?void 0:u.Row)!==null&&n!==void 0?n:j6,b=(r=u==null?void 0:u.Footer)!==null&&r!==void 0?r:q$;return p.jsxs("table",{id:e.id,className:s.table,style:a.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!l&&p.jsx(v,{}),p.jsx("tbody",{className:s.tbody,style:a.tbody,children:m.map(function(w){return p.jsx(x,{displayMonth:e.displayMonth,dates:w.dates,weekNumber:w.weekNumber},w.weekNumber)})}),p.jsx(b,{displayMonth:e.displayMonth})]})}function D6(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var L6=D6()?g.useLayoutEffect:g.useEffect,Sy=!1,F6=0;function SC(){return"react-day-picker-".concat(++F6)}function z6(e){var t,n=e??(Sy?SC():null),r=g.useState(n),o=r[0],i=r[1];return L6(function(){o===null&&i(SC())},[]),g.useEffect(function(){Sy===!1&&(Sy=!0)},[]),(t=e??o)!==null&&t!==void 0?t:void 0}function $6(e){var t,n,r=st(),o=r.dir,i=r.classNames,s=r.styles,a=r.components,l=op().displayMonths,c=z6(r.id?"".concat(r.id,"-").concat(e.displayIndex):void 0),u=r.id?"".concat(r.id,"-grid-").concat(e.displayIndex):void 0,d=[i.month],f=s.month,h=e.displayIndex===0,m=e.displayIndex===l.length-1,v=!h&&!m;o==="rtl"&&(t=[h,m],m=t[0],h=t[1]),h&&(d.push(i.caption_start),f=ke(ke({},f),s.caption_start)),m&&(d.push(i.caption_end),f=ke(ke({},f),s.caption_end)),v&&(d.push(i.caption_between),f=ke(ke({},f),s.caption_between));var x=(n=a==null?void 0:a.Caption)!==null&&n!==void 0?n:K$;return p.jsxs("div",{className:d.join(" "),style:f,children:[p.jsx(x,{id:c,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),p.jsx(I6,{id:u,"aria-labelledby":c,displayMonth:e.displayMonth})]},e.displayIndex)}function B6(e){var t=st(),n=t.classNames,r=t.styles;return p.jsx("div",{className:n.months,style:r.months,children:e.children})}function V6(e){var t,n,r=e.initialProps,o=st(),i=Bw(),s=op(),a=g.useState(!1),l=a[0],c=a[1];g.useEffect(function(){o.initialFocus&&i.focusTarget&&(l||(i.focus(i.focusTarget),c(!0)))},[o.initialFocus,l,i.focus,i.focusTarget,i]);var u=[o.classNames.root,o.className];o.numberOfMonths>1&&u.push(o.classNames.multiple_months),o.showWeekNumber&&u.push(o.classNames.with_weeknumber);var d=ke(ke({},o.styles.root),o.style),f=Object.keys(r).filter(function(m){return m.startsWith("data-")}).reduce(function(m,v){var x;return ke(ke({},m),(x={},x[v]=r[v],x))},{}),h=(n=(t=r.components)===null||t===void 0?void 0:t.Months)!==null&&n!==void 0?n:B6;return p.jsx("div",ke({className:u.join(" "),style:d,dir:o.dir,id:o.id,nonce:r.nonce,title:r.title,lang:r.lang},f,{children:p.jsx(h,{children:s.displayMonths.map(function(m,v){return p.jsx($6,{displayIndex:v,displayMonth:m},v)})})}))}function U6(e){var t=e.children,n=h$(e,["children"]);return p.jsx(uM,{initialProps:n,children:p.jsx(V$,{children:p.jsx(k6,{initialProps:n,children:p.jsx(Z$,{initialProps:n,children:p.jsx(t6,{initialProps:n,children:p.jsx(c6,{children:p.jsx(w6,{children:t})})})})})})})}function W6(e){return p.jsx(U6,ke({},e,{children:p.jsx(V6,{initialProps:e})}))}function Xt(e){for(var t=e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];for(var i=0,s=r;i<s.length;i++){var a=s[i];t=a(t)}return t}function xM(e){return N5(e)}function f0(e,t){if(e===t)return!0;if(Z(e)==="object"&&Z(t)==="object"&&e!==null&&t!==null){if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)if(!f0(e[n],t[n]))return!1;return!0}else if(!Array.isArray(e)&&!Array.isArray(t)){var r=Object.entries(e);if(r.length!==Object.keys(t).length)return!1;for(var o=0,i=r;o<i.length;o++){var s=hn(i[o],2),a=s[0],l=s[1],c=t[a];if(c===void 0||!f0(l,c))return!1}return!0}}return!1}function Em(e){return Array.isArray(e)?e.map(Em):Z(e)==="object"&&e!==null?Object.fromEntries(Object.entries(e).map(function(t){var n=hn(t,2),r=n[0],o=n[1];return[r,Em(o)]})):e}function Uw(e){return/^(0|[1-9][0-9]*)$/g.test(e)?rr(Number(e)):Oo(new Nr('Invalid array index "'.concat(e,'"')))}function H6(e,t){return e==="-"?rr(t.length):Xt(Uw(e),Ow(function(n){return n<=t.length},function(){return new Nr("Array index out of bounds")}))}function bM(e,t){return Xt(Uw(e),Ow(function(n){return n<t.length},function(){return new Nr("Array index out of bounds")}))}function K6(e,t,n){if(Array.isArray(e))return Xt(bM(t,e),go(function(o){var i=e[o];return e[o]=n,i}));if(Z(e)==="object"&&e!==null)if(Object.prototype.hasOwnProperty.call(e,t)){var r=e[t];return e[t]=n,rr(r)}else return Oo(new Nr("Cannot replace object element which does not exist"));return Oo(new Nr("Cannot replace in non-object/array"))}function q6(e,t,n){return xM(t)?Xt(Ww(e,t),Oc(function(r){var o=hn(r,2),i=o[0],s=o[1];return K6(i,s,n)}),go(function(r){return[e,r]})):rr([n,e])}function wM(e,t){return Array.isArray(e)?Xt(Uw(t),Oc(function(n){return n>=e.length?Oo(new Nr("Array index out of bounds")):rr(e[n])})):Z(e)==="object"&&e!==null?Object.prototype.hasOwnProperty.call(e,t)?rr(e[t]):rr(void 0):Oo(new Nr("Cannot access non-object/array"))}function Ww(e,t){for(var n=e,r=t[0],o=0;o<t.length-1;++o,r=t[o]){var i=wM(n,r);if(M5(i))return i;if(i.value===void 0)return Oo(new Nr("Path refers to non-existing object/array"));n=i.value}return rr([n,r])}function ky(e,t){return Xt(t,$N(function(n,r){return Xt(wM(n,r),Ow(function(o){return o!==void 0},function(){return new Nr("Path refers to non-existing object/array")}))},e))}function G6(e,t){if(Array.isArray(e))return Xt(bM(t,e),go(function(r){var o=e.splice(r,1),i=hn(o,1),s=i[0];return s}));if(Z(e)==="object"&&e!==null&&Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];return delete e[t],rr(n)}return Oo(new Nr("Cannot remove from non-object/array"))}function kC(e,t){return Xt(Ww(e,t),Oc(function(n){var r=hn(n,2),o=r[0],i=r[1];return G6(o,i)}))}function Y6(e,t,n){if(Array.isArray(e))return Xt(H6(t,e),go(function(o){e.splice(o,0,n)}));if(Z(e)==="object"&&e!==null){var r;return Object.prototype.hasOwnProperty.call(e,t)&&(r=e[t]),e[t]=n,rr(r)}return Oo(new Nr("Cannot add to non-object/array"))}function Cy(e,t,n){return xM(t)?Xt(Ww(e,t),Oc(function(r){var o=hn(r,2),i=o[0],s=o[1];return Y6(i,s,n)}),go(function(r){return[e,r]})):rr([n,e])}function Qp(e){var t=hn(e,1),n=t[0];return n}var J6=function(){function e(){Ut(this,e)}return Wt(e,[{key:"get",value:function(n,r){return ky(n,r)}},{key:"add",value:function(n,r,o){return Xt(Cy(n,r,o),go(Qp))}},{key:"remove",value:function(n,r){return Xt(kC(n,r),go(function(){return n}))}},{key:"replace",value:function(n,r,o){return Xt(q6(n,r,o),go(Qp))}},{key:"move",value:function(n,r,o){return Xt(kC(n,r),Oc(function(i){return Cy(n,o,i)}),go(Qp))}},{key:"copy",value:function(n,r,o){return Xt(ky(n,r),Oc(function(i){return Cy(n,o,Em(i))}),go(Qp))}},{key:"test",value:function(n,r,o){return Xt(ky(n,r),go(function(i){return f0(o,i)}))}}])}();function X6(e,t,n){switch(n.op){case"add":return t.add(e,n.path,n.value);case"remove":return t.remove(e,n.path);case"replace":return t.replace(e,n.path,n.value);case"move":return t.move(e,n.from,n.path);case"copy":return t.copy(e,n.from,n.path);case"test":return t.test(e,n.path,n.value)?rr(e):Oo(new Nr("Test failed"));case"file":return Oo(new Nr("Cannot apply a file patch here"))}}function Z6(e,t,n){return Xt(n,$N(function(r,o){return X6(r,t,o)},e))}var Ve;(function(e){e.assertEqual=o=>o;function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const i={};for(const s of o)i[s]=s;return i},e.getValidEnumValues=o=>{const i=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(const a of i)s[a]=o[a];return e.objectValues(s)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const i=[];for(const s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(const s of o)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function r(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Ve||(Ve={}));var p0;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(p0||(p0={}));const se=Ve.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),vs=e=>{switch(typeof e){case"undefined":return se.undefined;case"string":return se.string;case"number":return isNaN(e)?se.nan:se.number;case"boolean":return se.boolean;case"function":return se.function;case"bigint":return se.bigint;case"symbol":return se.symbol;case"object":return Array.isArray(e)?se.array:e===null?se.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?se.promise:typeof Map<"u"&&e instanceof Map?se.map:typeof Set<"u"&&e instanceof Set?se.set:typeof Date<"u"&&e instanceof Date?se.date:se.object;default:return se.unknown}},V=Ve.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Q6=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Er extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(i){return i.message},r={_errors:[]},o=i=>{for(const s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(this),r}static assert(t){if(!(t instanceof Er))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ve.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const o of this.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Er.create=e=>new Er(e);const Rc=(e,t)=>{let n;switch(e.code){case V.invalid_type:e.received===se.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case V.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ve.jsonStringifyReplacer)}`;break;case V.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ve.joinValues(e.keys,", ")}`;break;case V.invalid_union:n="Invalid input";break;case V.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ve.joinValues(e.options)}`;break;case V.invalid_enum_value:n=`Invalid enum value. Expected ${Ve.joinValues(e.options)}, received '${e.received}'`;break;case V.invalid_arguments:n="Invalid function arguments";break;case V.invalid_return_type:n="Invalid function return type";break;case V.invalid_date:n="Invalid date";break;case V.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ve.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case V.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case V.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case V.custom:n="Invalid input";break;case V.invalid_intersection_types:n="Intersection results could not be merged";break;case V.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case V.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ve.assertNever(e)}return{message:n}};let SM=Rc;function eB(e){SM=e}function _m(){return SM}const Tm=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,i=[...n,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(s,{data:t,defaultError:a}).message;return{...o,path:i,message:a}},tB=[];function ne(e,t){const n=_m(),r=Tm({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Rc?void 0:Rc].filter(o=>!!o)});e.common.issues.push(r)}class Nn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const o of n){if(o.status==="aborted")return Ce;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const o of n){const i=await o.key,s=await o.value;r.push({key:i,value:s})}return Nn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return Ce;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(r[i.value]=s.value)}return{status:t.value,value:r}}}const Ce=Object.freeze({status:"aborted"}),nc=e=>({status:"dirty",value:e}),$n=e=>({status:"valid",value:e}),h0=e=>e.status==="aborted",m0=e=>e.status==="dirty",sf=e=>e.status==="valid",af=e=>typeof Promise<"u"&&e instanceof Promise;function Om(e,t,n,r){if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function kM(e,t,n,r,o){if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var pe;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(pe||(pe={}));var qu,Gu;class Xo{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const CC=(e,t)=>{if(sf(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Er(e.common.issues);return this._error=n,this._error}}};function Ne(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(s,a)=>{var l,c;const{message:u}=e;return s.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:(l=u??r)!==null&&l!==void 0?l:a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:(c=u??n)!==null&&c!==void 0?c:a.defaultError}},description:o}}class Re{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return vs(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:vs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Nn,ctx:{common:t.parent.common,data:t.data,parsedType:vs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(af(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const o={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:vs(t)},i=this._parseSync({data:t,path:o.path,parent:o});return CC(o,i)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:vs(t)},o=this._parse({data:t,path:r.path,parent:r}),i=await(af(o)?o:Promise.resolve(o));return CC(r,i)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,i)=>{const s=t(o),a=()=>i.addIssue({code:V.custom,...r(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new Po({schema:this,typeName:Se.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Go.create(this,this._def)}nullable(){return Ys.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Eo.create(this,this._def)}promise(){return Ac.create(this,this._def)}or(t){return df.create([this,t],this._def)}and(t){return ff.create(this,t,this._def)}transform(t){return new Po({...Ne(this._def),schema:this,typeName:Se.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new vf({...Ne(this._def),innerType:this,defaultValue:n,typeName:Se.ZodDefault})}brand(){return new Hw({typeName:Se.ZodBranded,type:this,...Ne(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new yf({...Ne(this._def),innerType:this,catchValue:n,typeName:Se.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return ip.create(this,t)}readonly(){return xf.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const nB=/^c[^\s-]{8,}$/i,rB=/^[0-9a-z]+$/,oB=/^[0-9A-HJKMNP-TV-Z]{26}$/,iB=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,sB=/^[a-z0-9_-]{21}$/i,aB=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,lB=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,cB="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ey;const uB=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,dB=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,fB=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,CM="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",pB=new RegExp(`^${CM}$`);function EM(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function hB(e){return new RegExp(`^${EM(e)}$`)}function _M(e){let t=`${CM}T${EM(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function mB(e,t){return!!((t==="v4"||!t)&&uB.test(e)||(t==="v6"||!t)&&dB.test(e))}class wo extends Re{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==se.string){const i=this._getOrReturnCtx(t);return ne(i,{code:V.invalid_type,expected:se.string,received:i.parsedType}),Ce}const r=new Nn;let o;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),ne(o,{code:V.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),ne(o,{code:V.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const s=t.data.length>i.value,a=t.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(t,o),s?ne(o,{code:V.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&ne(o,{code:V.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")lB.test(t.data)||(o=this._getOrReturnCtx(t,o),ne(o,{validation:"email",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Ey||(Ey=new RegExp(cB,"u")),Ey.test(t.data)||(o=this._getOrReturnCtx(t,o),ne(o,{validation:"emoji",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")iB.test(t.data)||(o=this._getOrReturnCtx(t,o),ne(o,{validation:"uuid",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")sB.test(t.data)||(o=this._getOrReturnCtx(t,o),ne(o,{validation:"nanoid",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")nB.test(t.data)||(o=this._getOrReturnCtx(t,o),ne(o,{validation:"cuid",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")rB.test(t.data)||(o=this._getOrReturnCtx(t,o),ne(o,{validation:"cuid2",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")oB.test(t.data)||(o=this._getOrReturnCtx(t,o),ne(o,{validation:"ulid",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),ne(o,{validation:"url",code:V.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),ne(o,{validation:"regex",code:V.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),ne(o,{code:V.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),ne(o,{code:V.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),ne(o,{code:V.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?_M(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ne(o,{code:V.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?pB.test(t.data)||(o=this._getOrReturnCtx(t,o),ne(o,{code:V.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?hB(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ne(o,{code:V.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?aB.test(t.data)||(o=this._getOrReturnCtx(t,o),ne(o,{validation:"duration",code:V.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?mB(t.data,i.version)||(o=this._getOrReturnCtx(t,o),ne(o,{validation:"ip",code:V.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?fB.test(t.data)||(o=this._getOrReturnCtx(t,o),ne(o,{validation:"base64",code:V.invalid_string,message:i.message}),r.dirty()):Ve.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:V.invalid_string,...pe.errToObj(r)})}_addCheck(t){return new wo({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...pe.errToObj(t)})}url(t){return this._addCheck({kind:"url",...pe.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...pe.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...pe.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...pe.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...pe.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...pe.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...pe.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...pe.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...pe.errToObj(t)})}datetime(t){var n,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,local:(r=t==null?void 0:t.local)!==null&&r!==void 0?r:!1,...pe.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...pe.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...pe.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...pe.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...pe.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...pe.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...pe.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...pe.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...pe.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...pe.errToObj(n)})}nonempty(t){return this.min(1,pe.errToObj(t))}trim(){return new wo({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new wo({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new wo({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}wo.create=e=>{var t;return new wo({checks:[],typeName:Se.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Ne(e)})};function gB(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,i=parseInt(e.toFixed(o).replace(".","")),s=parseInt(t.toFixed(o).replace(".",""));return i%s/Math.pow(10,o)}class Ks extends Re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==se.number){const i=this._getOrReturnCtx(t);return ne(i,{code:V.invalid_type,expected:se.number,received:i.parsedType}),Ce}let r;const o=new Nn;for(const i of this._def.checks)i.kind==="int"?Ve.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),ne(r,{code:V.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),ne(r,{code:V.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),ne(r,{code:V.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?gB(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),ne(r,{code:V.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),ne(r,{code:V.not_finite,message:i.message}),o.dirty()):Ve.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,pe.toString(n))}gt(t,n){return this.setLimit("min",t,!1,pe.toString(n))}lte(t,n){return this.setLimit("max",t,!0,pe.toString(n))}lt(t,n){return this.setLimit("max",t,!1,pe.toString(n))}setLimit(t,n,r,o){return new Ks({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:pe.toString(o)}]})}_addCheck(t){return new Ks({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:pe.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:pe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:pe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:pe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:pe.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:pe.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:pe.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:pe.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:pe.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Ve.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Ks.create=e=>new Ks({checks:[],typeName:Se.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Ne(e)});class qs extends Re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==se.bigint){const i=this._getOrReturnCtx(t);return ne(i,{code:V.invalid_type,expected:se.bigint,received:i.parsedType}),Ce}let r;const o=new Nn;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),ne(r,{code:V.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),ne(r,{code:V.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),ne(r,{code:V.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Ve.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,pe.toString(n))}gt(t,n){return this.setLimit("min",t,!1,pe.toString(n))}lte(t,n){return this.setLimit("max",t,!0,pe.toString(n))}lt(t,n){return this.setLimit("max",t,!1,pe.toString(n))}setLimit(t,n,r,o){return new qs({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:pe.toString(o)}]})}_addCheck(t){return new qs({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:pe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:pe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:pe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:pe.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:pe.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}qs.create=e=>{var t;return new qs({checks:[],typeName:Se.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Ne(e)})};class lf extends Re{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==se.boolean){const r=this._getOrReturnCtx(t);return ne(r,{code:V.invalid_type,expected:se.boolean,received:r.parsedType}),Ce}return $n(t.data)}}lf.create=e=>new lf({typeName:Se.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Ne(e)});class Za extends Re{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==se.date){const i=this._getOrReturnCtx(t);return ne(i,{code:V.invalid_type,expected:se.date,received:i.parsedType}),Ce}if(isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return ne(i,{code:V.invalid_date}),Ce}const r=new Nn;let o;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),ne(o,{code:V.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),ne(o,{code:V.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Ve.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Za({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:pe.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:pe.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Za.create=e=>new Za({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Se.ZodDate,...Ne(e)});class Nm extends Re{_parse(t){if(this._getType(t)!==se.symbol){const r=this._getOrReturnCtx(t);return ne(r,{code:V.invalid_type,expected:se.symbol,received:r.parsedType}),Ce}return $n(t.data)}}Nm.create=e=>new Nm({typeName:Se.ZodSymbol,...Ne(e)});class cf extends Re{_parse(t){if(this._getType(t)!==se.undefined){const r=this._getOrReturnCtx(t);return ne(r,{code:V.invalid_type,expected:se.undefined,received:r.parsedType}),Ce}return $n(t.data)}}cf.create=e=>new cf({typeName:Se.ZodUndefined,...Ne(e)});class uf extends Re{_parse(t){if(this._getType(t)!==se.null){const r=this._getOrReturnCtx(t);return ne(r,{code:V.invalid_type,expected:se.null,received:r.parsedType}),Ce}return $n(t.data)}}uf.create=e=>new uf({typeName:Se.ZodNull,...Ne(e)});class jc extends Re{constructor(){super(...arguments),this._any=!0}_parse(t){return $n(t.data)}}jc.create=e=>new jc({typeName:Se.ZodAny,...Ne(e)});class $a extends Re{constructor(){super(...arguments),this._unknown=!0}_parse(t){return $n(t.data)}}$a.create=e=>new $a({typeName:Se.ZodUnknown,...Ne(e)});class ji extends Re{_parse(t){const n=this._getOrReturnCtx(t);return ne(n,{code:V.invalid_type,expected:se.never,received:n.parsedType}),Ce}}ji.create=e=>new ji({typeName:Se.ZodNever,...Ne(e)});class Mm extends Re{_parse(t){if(this._getType(t)!==se.undefined){const r=this._getOrReturnCtx(t);return ne(r,{code:V.invalid_type,expected:se.void,received:r.parsedType}),Ce}return $n(t.data)}}Mm.create=e=>new Mm({typeName:Se.ZodVoid,...Ne(e)});class Eo extends Re{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==se.array)return ne(n,{code:V.invalid_type,expected:se.array,received:n.parsedType}),Ce;if(o.exactLength!==null){const s=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(s||a)&&(ne(n,{code:s?V.too_big:V.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(ne(n,{code:V.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(ne(n,{code:V.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,a)=>o.type._parseAsync(new Xo(n,s,n.path,a)))).then(s=>Nn.mergeArray(r,s));const i=[...n.data].map((s,a)=>o.type._parseSync(new Xo(n,s,n.path,a)));return Nn.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new Eo({...this._def,minLength:{value:t,message:pe.toString(n)}})}max(t,n){return new Eo({...this._def,maxLength:{value:t,message:pe.toString(n)}})}length(t,n){return new Eo({...this._def,exactLength:{value:t,message:pe.toString(n)}})}nonempty(t){return this.min(1,t)}}Eo.create=(e,t)=>new Eo({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Se.ZodArray,...Ne(t)});function Il(e){if(e instanceof mt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Go.create(Il(r))}return new mt({...e._def,shape:()=>t})}else return e instanceof Eo?new Eo({...e._def,type:Il(e.element)}):e instanceof Go?Go.create(Il(e.unwrap())):e instanceof Ys?Ys.create(Il(e.unwrap())):e instanceof Zo?Zo.create(e.items.map(t=>Il(t))):e}class mt extends Re{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Ve.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==se.object){const c=this._getOrReturnCtx(t);return ne(c,{code:V.invalid_type,expected:se.object,received:c.parsedType}),Ce}const{status:r,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof ji&&this._def.unknownKeys==="strip"))for(const c in o.data)s.includes(c)||a.push(c);const l=[];for(const c of s){const u=i[c],d=o.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Xo(o,d,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof ji){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:o.data[u]}});else if(c==="strict")a.length>0&&(ne(o,{code:V.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const d=o.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Xo(o,d,o.path,u)),alwaysSet:u in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,f=await u.value;c.push({key:d,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>Nn.mergeObjectSync(r,c)):Nn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return pe.errToObj,new mt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var o,i,s,a;const l=(s=(i=(o=this._def).errorMap)===null||i===void 0?void 0:i.call(o,n,r).message)!==null&&s!==void 0?s:r.defaultError;return n.code==="unrecognized_keys"?{message:(a=pe.errToObj(t).message)!==null&&a!==void 0?a:l}:{message:l}}}:{}})}strip(){return new mt({...this._def,unknownKeys:"strip"})}passthrough(){return new mt({...this._def,unknownKeys:"passthrough"})}extend(t){return new mt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new mt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Se.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new mt({...this._def,catchall:t})}pick(t){const n={};return Ve.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new mt({...this._def,shape:()=>n})}omit(t){const n={};return Ve.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new mt({...this._def,shape:()=>n})}deepPartial(){return Il(this)}partial(t){const n={};return Ve.objectKeys(this.shape).forEach(r=>{const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}),new mt({...this._def,shape:()=>n})}required(t){const n={};return Ve.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Go;)i=i._def.innerType;n[r]=i}}),new mt({...this._def,shape:()=>n})}keyof(){return TM(Ve.objectKeys(this.shape))}}mt.create=(e,t)=>new mt({shape:()=>e,unknownKeys:"strip",catchall:ji.create(),typeName:Se.ZodObject,...Ne(t)});mt.strictCreate=(e,t)=>new mt({shape:()=>e,unknownKeys:"strict",catchall:ji.create(),typeName:Se.ZodObject,...Ne(t)});mt.lazycreate=(e,t)=>new mt({shape:e,unknownKeys:"strip",catchall:ji.create(),typeName:Se.ZodObject,...Ne(t)});class df extends Re{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const s=i.map(a=>new Er(a.ctx.common.issues));return ne(n,{code:V.invalid_union,unionErrors:s}),Ce}if(n.common.async)return Promise.all(r.map(async i=>{const s={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(o);{let i;const s=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=s.map(l=>new Er(l));return ne(n,{code:V.invalid_union,unionErrors:a}),Ce}}get options(){return this._def.options}}df.create=(e,t)=>new df({options:e,typeName:Se.ZodUnion,...Ne(t)});const di=e=>e instanceof hf?di(e.schema):e instanceof Po?di(e.innerType()):e instanceof mf?[e.value]:e instanceof Gs?e.options:e instanceof gf?Ve.objectValues(e.enum):e instanceof vf?di(e._def.innerType):e instanceof cf?[void 0]:e instanceof uf?[null]:e instanceof Go?[void 0,...di(e.unwrap())]:e instanceof Ys?[null,...di(e.unwrap())]:e instanceof Hw||e instanceof xf?di(e.unwrap()):e instanceof yf?di(e._def.innerType):[];class Vg extends Re{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==se.object)return ne(n,{code:V.invalid_type,expected:se.object,received:n.parsedType}),Ce;const r=this.discriminator,o=n.data[r],i=this.optionsMap.get(o);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(ne(n,{code:V.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Ce)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const o=new Map;for(const i of n){const s=di(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of s){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,i)}}return new Vg({typeName:Se.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,...Ne(r)})}}function g0(e,t){const n=vs(e),r=vs(t);if(e===t)return{valid:!0,data:e};if(n===se.object&&r===se.object){const o=Ve.objectKeys(t),i=Ve.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(const a of i){const l=g0(e[a],t[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(n===se.array&&r===se.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let i=0;i<e.length;i++){const s=e[i],a=t[i],l=g0(s,a);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===se.date&&r===se.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class ff extends Re{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=(i,s)=>{if(h0(i)||h0(s))return Ce;const a=g0(i.value,s.value);return a.valid?((m0(i)||m0(s))&&n.dirty(),{status:n.value,value:a.data}):(ne(r,{code:V.invalid_intersection_types}),Ce)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ff.create=(e,t,n)=>new ff({left:e,right:t,typeName:Se.ZodIntersection,...Ne(n)});class Zo extends Re{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==se.array)return ne(r,{code:V.invalid_type,expected:se.array,received:r.parsedType}),Ce;if(r.data.length<this._def.items.length)return ne(r,{code:V.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ce;!this._def.rest&&r.data.length>this._def.items.length&&(ne(r,{code:V.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((s,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new Xo(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>Nn.mergeArray(n,s)):Nn.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new Zo({...this._def,rest:t})}}Zo.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Zo({items:e,typeName:Se.ZodTuple,rest:null,...Ne(t)})};class pf extends Re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==se.object)return ne(r,{code:V.invalid_type,expected:se.object,received:r.parsedType}),Ce;const o=[],i=this._def.keyType,s=this._def.valueType;for(const a in r.data)o.push({key:i._parse(new Xo(r,a,r.path,a)),value:s._parse(new Xo(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Nn.mergeObjectAsync(n,o):Nn.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Re?new pf({keyType:t,valueType:n,typeName:Se.ZodRecord,...Ne(r)}):new pf({keyType:wo.create(),valueType:t,typeName:Se.ZodRecord,...Ne(n)})}}class Pm extends Re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==se.map)return ne(r,{code:V.invalid_type,expected:se.map,received:r.parsedType}),Ce;const o=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([a,l],c)=>({key:o._parse(new Xo(r,a,r.path,[c,"key"])),value:i._parse(new Xo(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of s){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Ce;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of s){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Ce;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}Pm.create=(e,t,n)=>new Pm({valueType:t,keyType:e,typeName:Se.ZodMap,...Ne(n)});class Qa extends Re{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==se.set)return ne(r,{code:V.invalid_type,expected:se.set,received:r.parsedType}),Ce;const o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(ne(r,{code:V.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(ne(r,{code:V.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const i=this._def.valueType;function s(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Ce;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>i._parse(new Xo(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(t,n){return new Qa({...this._def,minSize:{value:t,message:pe.toString(n)}})}max(t,n){return new Qa({...this._def,maxSize:{value:t,message:pe.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Qa.create=(e,t)=>new Qa({valueType:e,minSize:null,maxSize:null,typeName:Se.ZodSet,...Ne(t)});class cc extends Re{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==se.function)return ne(n,{code:V.invalid_type,expected:se.function,received:n.parsedType}),Ce;function r(a,l){return Tm({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,_m(),Rc].filter(c=>!!c),issueData:{code:V.invalid_arguments,argumentsError:l}})}function o(a,l){return Tm({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,_m(),Rc].filter(c=>!!c),issueData:{code:V.invalid_return_type,returnTypeError:l}})}const i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof Ac){const a=this;return $n(async function(...l){const c=new Er([]),u=await a._def.args.parseAsync(l,i).catch(h=>{throw c.addIssue(r(l,h)),c}),d=await Reflect.apply(s,this,u);return await a._def.returns._def.type.parseAsync(d,i).catch(h=>{throw c.addIssue(o(d,h)),c})})}else{const a=this;return $n(function(...l){const c=a._def.args.safeParse(l,i);if(!c.success)throw new Er([r(l,c.error)]);const u=Reflect.apply(s,this,c.data),d=a._def.returns.safeParse(u,i);if(!d.success)throw new Er([o(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new cc({...this._def,args:Zo.create(t).rest($a.create())})}returns(t){return new cc({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new cc({args:t||Zo.create([]).rest($a.create()),returns:n||$a.create(),typeName:Se.ZodFunction,...Ne(r)})}}class hf extends Re{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}hf.create=(e,t)=>new hf({getter:e,typeName:Se.ZodLazy,...Ne(t)});class mf extends Re{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return ne(n,{received:n.data,code:V.invalid_literal,expected:this._def.value}),Ce}return{status:"valid",value:t.data}}get value(){return this._def.value}}mf.create=(e,t)=>new mf({value:e,typeName:Se.ZodLiteral,...Ne(t)});function TM(e,t){return new Gs({values:e,typeName:Se.ZodEnum,...Ne(t)})}class Gs extends Re{constructor(){super(...arguments),qu.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return ne(n,{expected:Ve.joinValues(r),received:n.parsedType,code:V.invalid_type}),Ce}if(Om(this,qu)||kM(this,qu,new Set(this._def.values)),!Om(this,qu).has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return ne(n,{received:n.data,code:V.invalid_enum_value,options:r}),Ce}return $n(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Gs.create(t,{...this._def,...n})}exclude(t,n=this._def){return Gs.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}qu=new WeakMap;Gs.create=TM;class gf extends Re{constructor(){super(...arguments),Gu.set(this,void 0)}_parse(t){const n=Ve.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==se.string&&r.parsedType!==se.number){const o=Ve.objectValues(n);return ne(r,{expected:Ve.joinValues(o),received:r.parsedType,code:V.invalid_type}),Ce}if(Om(this,Gu)||kM(this,Gu,new Set(Ve.getValidEnumValues(this._def.values))),!Om(this,Gu).has(t.data)){const o=Ve.objectValues(n);return ne(r,{received:r.data,code:V.invalid_enum_value,options:o}),Ce}return $n(t.data)}get enum(){return this._def.values}}Gu=new WeakMap;gf.create=(e,t)=>new gf({values:e,typeName:Se.ZodNativeEnum,...Ne(t)});class Ac extends Re{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==se.promise&&n.common.async===!1)return ne(n,{code:V.invalid_type,expected:se.promise,received:n.parsedType}),Ce;const r=n.parsedType===se.promise?n.data:Promise.resolve(n.data);return $n(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Ac.create=(e,t)=>new Ac({type:e,typeName:Se.ZodPromise,...Ne(t)});class Po extends Re{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Se.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{ne(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){const s=o.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(async a=>{if(n.value==="aborted")return Ce;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Ce:l.status==="dirty"||n.value==="dirty"?nc(l.value):l});{if(n.value==="aborted")return Ce;const a=this._def.schema._parseSync({data:s,path:r.path,parent:r});return a.status==="aborted"?Ce:a.status==="dirty"||n.value==="dirty"?nc(a.value):a}}if(o.type==="refinement"){const s=a=>{const l=o.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Ce:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Ce:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!sf(s))return s;const a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>sf(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:n.value,value:a})):s);Ve.assertNever(o)}}Po.create=(e,t,n)=>new Po({schema:e,typeName:Se.ZodEffects,effect:t,...Ne(n)});Po.createWithPreprocess=(e,t,n)=>new Po({schema:t,effect:{type:"preprocess",transform:e},typeName:Se.ZodEffects,...Ne(n)});class Go extends Re{_parse(t){return this._getType(t)===se.undefined?$n(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Go.create=(e,t)=>new Go({innerType:e,typeName:Se.ZodOptional,...Ne(t)});class Ys extends Re{_parse(t){return this._getType(t)===se.null?$n(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ys.create=(e,t)=>new Ys({innerType:e,typeName:Se.ZodNullable,...Ne(t)});class vf extends Re{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===se.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}vf.create=(e,t)=>new vf({innerType:e,typeName:Se.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ne(t)});class yf extends Re{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return af(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Er(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Er(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}yf.create=(e,t)=>new yf({innerType:e,typeName:Se.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ne(t)});class Rm extends Re{_parse(t){if(this._getType(t)!==se.nan){const r=this._getOrReturnCtx(t);return ne(r,{code:V.invalid_type,expected:se.nan,received:r.parsedType}),Ce}return{status:"valid",value:t.data}}}Rm.create=e=>new Rm({typeName:Se.ZodNaN,...Ne(e)});const vB=Symbol("zod_brand");class Hw extends Re{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class ip extends Re{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ce:i.status==="dirty"?(n.dirty(),nc(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Ce:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new ip({in:t,out:n,typeName:Se.ZodPipeline})}}class xf extends Re{_parse(t){const n=this._def.innerType._parse(t),r=o=>(sf(o)&&(o.value=Object.freeze(o.value)),o);return af(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}xf.create=(e,t)=>new xf({innerType:e,typeName:Se.ZodReadonly,...Ne(t)});function OM(e,t={},n){return e?jc.create().superRefine((r,o)=>{var i,s;if(!e(r)){const a=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,l=(s=(i=a.fatal)!==null&&i!==void 0?i:n)!==null&&s!==void 0?s:!0,c=typeof a=="string"?{message:a}:a;o.addIssue({code:"custom",...c,fatal:l})}}):jc.create()}const yB={object:mt.lazycreate};var Se;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Se||(Se={}));const xB=(e,t={message:`Input not instance of ${e.name}`})=>OM(n=>n instanceof e,t),NM=wo.create,MM=Ks.create,bB=Rm.create,wB=qs.create,PM=lf.create,SB=Za.create,kB=Nm.create,CB=cf.create,EB=uf.create,_B=jc.create,TB=$a.create,OB=ji.create,NB=Mm.create,MB=Eo.create,PB=mt.create,RB=mt.strictCreate,jB=df.create,AB=Vg.create,IB=ff.create,DB=Zo.create,LB=pf.create,FB=Pm.create,zB=Qa.create,$B=cc.create,BB=hf.create,VB=mf.create,UB=Gs.create,WB=gf.create,HB=Ac.create,EC=Po.create,KB=Go.create,qB=Ys.create,GB=Po.createWithPreprocess,YB=ip.create,JB=()=>NM().optional(),XB=()=>MM().optional(),ZB=()=>PM().optional(),QB={string:e=>wo.create({...e,coerce:!0}),number:e=>Ks.create({...e,coerce:!0}),boolean:e=>lf.create({...e,coerce:!0}),bigint:e=>qs.create({...e,coerce:!0}),date:e=>Za.create({...e,coerce:!0})},e8=Ce;var y=Object.freeze({__proto__:null,defaultErrorMap:Rc,setErrorMap:eB,getErrorMap:_m,makeIssue:Tm,EMPTY_PATH:tB,addIssueToContext:ne,ParseStatus:Nn,INVALID:Ce,DIRTY:nc,OK:$n,isAborted:h0,isDirty:m0,isValid:sf,isAsync:af,get util(){return Ve},get objectUtil(){return p0},ZodParsedType:se,getParsedType:vs,ZodType:Re,datetimeRegex:_M,ZodString:wo,ZodNumber:Ks,ZodBigInt:qs,ZodBoolean:lf,ZodDate:Za,ZodSymbol:Nm,ZodUndefined:cf,ZodNull:uf,ZodAny:jc,ZodUnknown:$a,ZodNever:ji,ZodVoid:Mm,ZodArray:Eo,ZodObject:mt,ZodUnion:df,ZodDiscriminatedUnion:Vg,ZodIntersection:ff,ZodTuple:Zo,ZodRecord:pf,ZodMap:Pm,ZodSet:Qa,ZodFunction:cc,ZodLazy:hf,ZodLiteral:mf,ZodEnum:Gs,ZodNativeEnum:gf,ZodPromise:Ac,ZodEffects:Po,ZodTransformer:Po,ZodOptional:Go,ZodNullable:Ys,ZodDefault:vf,ZodCatch:yf,ZodNaN:Rm,BRAND:vB,ZodBranded:Hw,ZodPipeline:ip,ZodReadonly:xf,custom:OM,Schema:Re,ZodSchema:Re,late:yB,get ZodFirstPartyTypeKind(){return Se},coerce:QB,any:_B,array:MB,bigint:wB,boolean:PM,date:SB,discriminatedUnion:AB,effect:EC,enum:UB,function:$B,instanceof:xB,intersection:IB,lazy:BB,literal:VB,map:FB,nan:bB,nativeEnum:WB,never:OB,null:EB,nullable:qB,number:MM,object:PB,oboolean:ZB,onumber:XB,optional:KB,ostring:JB,pipeline:YB,preprocess:GB,promise:HB,record:LB,set:zB,strictObject:RB,string:NM,symbol:kB,transformer:EC,tuple:DB,undefined:CB,union:jB,unknown:TB,void:NB,NEVER:e8,ZodIssueCode:V,quotelessJson:Q6,ZodError:Er});function t8(e){var r;const t=Object.keys(e);if(t.length===0)return[];const n=[];for(const o of t){const s=e[o].sort((a,l)=>a.seqNumber-l.seqNumber);for(let a=0;a<s.length;a++){const{patch:l}=s[a];if(l.length===1&&l[0].op==="replace"){const c=(r=s[a+1])==null?void 0:r.patch;if(c&&c.length===1&&c[0].op==="replace"&&c[0].path.join("/")===l[0].path.join("/"))continue}n.push({patch:l,path:o})}}return n}const n8=new J6;function r8(e,t){var A;const[n,r]=g.useState([]),[o,i]=g.useState({status:"not-asked"}),[s,a]=g.useState({}),[l,c]=g.useState({}),[u,d]=g.useState({}),[f,h,m,v,x]=i8(e),[b,w]=g.useState({}),S=g.useRef({}),k=g.useCallback((P,I,U)=>{const me=I.length===1?I[0]:void 0;r([]),C(I);const ee={...j.current};for(const q of I)ee[q]=P;j.current={...ee};const ve=me===void 0;v(),c(q=>{const $={...q};for(const oe of I)delete $[oe];return $}),e("/sources/~","PUT",{path:me,query:{validate_sources:!0,validate_all:ve,validate_binary_files:!1},body:{patchIds:U}}).then(q=>{var $,oe,ce,ie,Te;if(q.status===401){x("login-required");return}else x("authorized");if(q.status===400&&!("errors"in q.json)){a(Object.fromEntries(I.map(ye=>[ye,{status:"error",errors:[{message:q.json.message}]}])));return}if(q.status===200){w(ye=>{var rt;const Pe=ve?{}:{...ye};for(const[rn,on]of Object.entries(q.json.modules||{})){const Ir=rn;if(on)for(const[yn,Rn]of Object.entries(((rt=q.json.modules[Ir])==null?void 0:rt.validationErrors)||{})){const xn=yn;Rn&&(Pe[xn]=Rn)}}return Pe});for(const ye of I){const Pe=ye;if(ee[Pe]!==j.current[Pe])continue;const rt=($=q.json.modules[Pe])==null?void 0:$.source,rn=(ce=(oe=q.json.modules[Pe])==null?void 0:oe.patches)==null?void 0:ce.skipped,on=(Te=(ie=q.json.modules[Pe])==null?void 0:ie.patches)==null?void 0:Te.errors;rt&&T([Pe],q.json.modules),(on||rn)&&c(Ir=>{const yn={...Ir};for(const Rn of rn||[]){(!yn[Pe]||yn[Pe].status!=="error")&&(yn[Pe]={status:"error",errors:[]});const xn=yn[Pe];xn.status==="error"&&xn.errors.push({skipped:!0,patchId:Rn,message:"Patch skipped"})}for(const[Rn,xn]of Object.entries(on||{})){const bl=Rn;(!yn[Pe]||yn[Pe].status!=="error")&&(yn[Pe]={status:"error",errors:[]});const va=yn[Pe];va.status==="error"&&xn&&va.errors.push({patchId:bl,message:xn.message})}return yn})}}else if(q.status===400){const ye={};for(const Pe of I){const rt=Pe;ye[rt]={status:"error",errors:[{message:q.json.message}]}}a(ye)}}).catch(q=>{const $=q instanceof Error?q.message:JSON.stringify(q);T(I,{},Object.fromEntries(I.map(oe=>[oe,[{error:{message:$}}]])))})},[]),C=g.useCallback(P=>{a(I=>{var ee;const U={...I};let me=!1;for(const ve of P){const q=ve;((ee=U[q])==null?void 0:ee.status)!=="loading"&&(U[q]={status:"loading"},me=!0)}return me?U:I})},[u]),T=g.useCallback((P,I,U)=>{d(me=>{var q,$;const ee={...me},ve=P;a(oe=>{var ie;const ce={...oe};for(const Te of ve)U&&U[Te]?ce[Te]={status:"error",errors:((ie=U[Te])==null?void 0:ie.map(ye=>({...ye.error,...ye})))??[]}:delete ce[Te];return ce});for(const oe of ve){const ce=oe;S.current[ce]||(q=I[ce])!=null&&q.source&&(ee[ce]=($=I[ce])==null?void 0:$.source)}return r(oe=>{const ce=oe.filter(ie=>ve.includes(ie));return ce.length!==oe.length?ce:oe}),ee})},[]),_="data"in f&&((A=f.data)!=null&&A.schemaSha)?f.data.schemaSha:void 0;g.useEffect(()=>{_&&(i({status:"loading"}),v(),e("/schema","GET",{}).then(P=>{if(P.status===401){x("login-required");return}else x("authorized");if(P.status===200)if(P.json.schemaSha===_){const I={};for(const U in P.json.schemas){const me=U,ee=P.json.schemas[me];ee&&(I[me]=ee)}i({status:"success",data:I})}else i({status:"error",error:"Schema (different checksums) mismatch"}),h(I=>({...I,schemaSha:_}));else i({status:"error",error:P.json.message})}))},[_]),g.useEffect(()=>{f.status==="error"&&(o.status==="loading"||o.status==="not-asked")&&i({status:"error",error:f.error})},[f,o]),g.useEffect(()=>{if(t)for(const P in u){const I=P;u[I]&&window.dispatchEvent(new CustomEvent("val-event",{detail:{type:"source-update",moduleFilePath:I,source:u[I]}}))}},[t,u]),g.useEffect(()=>{o.status==="success"&&r(Object.keys(o.data))},[o]);const{currentPatchIds:O,sourceState:M}=g.useMemo(()=>{if("data"in f&&f.data){const P=f.data.baseSha+f.data.patches.join(",");return{currentPatchIds:f.data.patches,sourceState:P}}return{currentPatchIds:[]}},[f]),j=g.useRef({}),L=g.useRef(0),B=g.useCallback((P,I)=>{d(U=>{if(U[P]){const me=U[P];if(me){const ee=I.filter(q=>q.op!=="file"),ve=Z6(Em(me),n8,ee);if(ve.kind==="ok"){t&&window.dispatchEvent(new CustomEvent("val-provider-overlay",{detail:{type:"source-update",detail:{moduleFilePath:P,source:ve.value}}})),S.current={...S.current,[P]:[...S.current[P]??[],{patch:I,seqNumber:L.current++}]},c($=>{const oe={...$};return oe[P]={status:"created-patch",createdAt:new Date().toISOString()},oe}),a($=>{const oe={...$};return oe[P]={status:"loading"},oe});const q={...U};return q[P]=ve.value,q}else console.error("Could not apply patch",ve.error),c(q=>{const $={...q};return $[P]={status:"error",errors:[ve.error]},$})}}else console.warn("Trying to patch a module that is not loaded",P,I),S.current={...S.current,[P]:[...S.current[P]??[],{patch:I,seqNumber:L.current++}]};return U})},[u,O,M,t]),J=g.useCallback(async P=>{const I=await e("/patches","DELETE",{query:{id:P}});return I.status===200?(r([]),{status:"ok"}):{status:"error",error:I.json.message}},[e]);g.useEffect(()=>{if(M!==void 0)if(n.length===0){const P=[];for(const I in j.current){const U=I;j.current[U]&&j.current[U]!==M&&P.push(U)}P.length>0&&k(M,P,O)}else k(M,n,O)},[n,M,O]);const z=g.useRef({}),H=g.useCallback(()=>{const P={...S.current};if(Object.keys(P).length===0)return[];const I=t8(P),U=new Set;for(const ee in P){const ve=ee;for(const{seqNumber:q}of P[ve])U.add(q)}if(c(ee=>{const ve={};for(const q in P){const $=q;let oe;const ce=ee[$];ce&&"createdAt"in ce?oe=ce.createdAt:oe=new Date().toISOString(),ve[$]={status:"uploading-patch",createdAt:oe,updatedAt:new Date().toISOString()}}return ve}),v(),!("data"in f)||!f.data){console.error("Cannot add patches without stat data");return}const me=O.length>0?{type:"patch",patchId:O[O.length-1]}:{type:"head",headBaseSha:f.data.baseSha};e("/patches","PUT",{body:{patches:I,parentRef:me}}).then(ee=>{if(ee.status===401){x("login-required");return}else x("authorized");const ve=me.type==="patch"?me.patchId:"head";if(ee.status===409)!z.current[ve]||z.current[ve]<TC?(console.warn("Conflict! Retrying. Atempts left: ",TC-(z.current[ve]||1)),z.current={[ve]:(z.current[ve]??1)+1}):a(q=>{const $={};for(const oe in P){const ce=oe;$[ce]={status:"error",errors:[{message:"Cannot apply changes. Val is online, but it could not get the latest set of changes from the server (i.e. there's a conflict). Try reloading."}]}}return $});else if(!(ee.status===null&&ee.json.type==="network_error"&&ee.json.retryable)){z.current={};for(const q in S.current){const $=q;for(const oe of S.current[$])U.has(oe.seqNumber)&&delete S.current[$]}c(q=>{const $={};if("errors"in ee.json)for(const oe in P){const ce=oe,ie=ee.json.errors[ce];ie&&($[ce]={status:"error",errors:ie.map(Te=>({...Te.error,...Te.error}))})}else if(ee.status!==200)for(const oe in P){const ce=oe;$[ce]={status:"error",errors:[{message:ee.json.message}]}}return $})}}).catch(ee=>{console.error("Could not sync patches",ee)})},[O,f.status,"data"in f&&f.data]),R=g.useRef(-1),N=g.useRef(-1);g.useEffect(()=>{if(N.current=Date.now(),R.current!==-1&&Date.now()-R.current>2e3)R.current=Date.now(),H();else{const P=setTimeout(()=>{R.current=Date.now(),H()},500);return()=>{clearTimeout(P)}}},[u,H]),g.useEffect(()=>{const P=setInterval(()=>{Date.now()-N.current>5e3&&Object.keys(S.current).length>0&&H()},5e3);return()=>{clearInterval(P)}},[H]);const E=g.useCallback(P=>{r(I=>I.includes(P)?I:[...I,P])},[]);return{stat:f,authenticationState:m,schemas:o,schemaSha:_,sources:u,addPatch:B,deletePatches:J,requestModule:E,patchesStatus:l,sourcesSyncStatus:s,validationErrors:b,patchIds:O}}const RM=y.string().uuid().refine(e=>!0),o8=y.union([y.object({type:y.literal("patches"),patches:y.array(RM)}),y.object({type:y.literal("subscribed")}),y.object({type:y.literal("error"),message:y.string(),reconnect:y.boolean().optional()})]);y.object({type:y.union([y.literal("did-change"),y.literal("no-change"),y.literal("request-again"),y.literal("use-websocket")]),config:y.object({project:y.string().optional(),files:y.object({directory:y.string()}).optional()}),schemaSha:y.string(),baseSha:y.string(),patches:y.array(RM)});function i8(e){const[t,n]=g.useState({status:"not-asked"}),r=g.useRef(null),{authenticationState:o,setAuthenticationLoadingIfNotAuthenticated:i,setIsAuthenticated:s}=s8(),a=g.useRef(0);return g.useEffect(()=>{if(t.status==="updated-request-again"||t.status==="error")if(t.wait===0)console.debug("Executing stat immediately",t.status,t.status==="error"?t.error:"no error"),_y(e,r,a,t,n,i,s);else{console.debug("Executing stat in ",t.wait," status: ",t.status);const l=setTimeout(()=>{_y(e,r,a,t,n,i,s)},t.wait);return()=>clearTimeout(l)}},[e,t]),g.useEffect(()=>{t.status==="not-asked"&&(console.log("Setting stat to initializing"),n({status:"initializing"}),console.debug("Initializing stat"),_y(e,r,a,t,n,i,s))},[e,t.status]),[t,n,o,i,s]}const _C=10*1e3,TC=10;async function _y(e,t,n,r,o,i,s){const a=++n.current;let l=null;return"data"in r&&r.data&&(l={schemaSha:r.data.schemaSha,baseSha:r.data.baseSha,patches:r.data.patches}),i(),e("/stat","POST",{body:l}).then(c=>{if(c.status===401){s("login-required");return}else s("authorized");if(!(n.current!==0&&n.current!==a))if(c.status===200){if(c.json.type==="did-change"||c.json.type==="no-change"||c.json.type==="request-again")o({status:"updated-request-again",data:c.json,wait:t.current?_C:0});else if(c.json.type==="use-websocket"){o(h=>({...h,status:"updated-request-again",data:c.json,wait:_C})),t.current&&(console.debug("Closing existing WebSocket"),t.current.close());const u=c.json.url;console.debug("Connecting to WebSocket",u),t.current=new WebSocket(u);const d=c.json.nonce;t.current.onopen=()=>{var h;(h=t.current)==null||h.send(JSON.stringify({nonce:d,type:"subscribe"}))},t.current.onmessage=h=>{try{const m=o8.safeParse(JSON.parse(h.data));if(!m.success){console.error("Could not parse WebSocket message",m.error);return}const v=m.data;v.type==="error"?o(x=>ju(x,v.message)):v.type==="patches"?o(x=>"data"in x&&x.data?{status:"ws-message-received",data:{...x.data,patches:v.patches}}:x):v.type==="subscribed"?console.debug("Subscribed!"):console.error("Unknown WebSocket message",v)}catch(m){console.error("Could not parse WebSocket message",m)}};const f=t.current;t.current.onclose=()=>{f===t.current&&(console.debug("WebSocket closed"),o(h=>ju(h,"WebSocket closed")))},t.current.onerror=()=>{console.warn("WebSocket error"),o(h=>ju(h,"Got an error while syncing with Val (reason: WebSocket error)"))}}}else o(u=>ju(u,c.json.message))}).catch(c=>{n.current!==0&&n.current!==a||o(u=>ju(u,c.message))})}function ju(e,t){const n="retries"in e?e.retries+1:0,r=e.status==="error"&&e.retries>1?Math.min(500,e.retries*50+Math.floor(Math.random()*100))*10:0;return{status:"error",error:t,data:"data"in e?e.data:void 0,retries:n,wait:r}}function s8(){const[e,t]=g.useState("not-asked"),n=g.useCallback(()=>{e==="not-asked"&&t("loading")},[e]);return{authenticationState:e,setIsAuthenticated:t,setAuthenticationLoadingIfNotAuthenticated:n}}const Ht=ge.createContext({get portalRef(){throw new Error("ValContext not provided")},get theme(){throw new Error("ValContext not provided")},get setTheme(){throw new Error("ValContext not provided")},get config(){throw new Error("ValContext not provided")},get authenticationState(){throw new Error("ValContext not provided")},get addPatch(){throw new Error("ValContext not provided")},get getPatches(){throw new Error("ValContext not provided")},get deletePatches(){throw new Error("ValContext not provided")},get addDebouncedPatch(){throw new Error("ValContext not provided")},get publish(){throw new Error("ValContext not provided")},get isPublishing(){throw new Error("ValContext not provided")},get publishError(){throw new Error("ValContext not provided")},get resetPublishError(){throw new Error("ValContext not provided")},get schemas(){throw new Error("ValContext not provided")},get schemaSha(){throw new Error("ValContext not provided")},get sources(){throw new Error("ValContext not provided")},get validationErrors(){throw new Error("ValContext not provided")},get sourcesSyncStatus(){throw new Error("ValContext not provided")},get patchesStatus(){throw new Error("ValContext not provided")},get patchIds(){throw new Error("ValContext not provided")},get profiles(){throw new Error("ValContext not provided")}});function jM({children:e,client:t,dispatchValEvents:n}){const{addPatch:r,deletePatches:o,authenticationState:i,schemas:s,schemaSha:a,stat:l,sources:c,validationErrors:u,sourcesSyncStatus:d,patchesStatus:f,patchIds:h}=r8(t,n),[m,v]=g.useState({});g.useEffect(()=>{(async()=>{const H=await t("/profiles","GET",{});if(H.status===200){const R={};for(const N of H.json.profiles)R[N.profileId]={fullName:N.fullName,avatar:N.avatar};v(R)}else console.error("Could not get profiles",H.json)})()},["data"in l&&l.data&&l.data.baseSha]);const x=g.useRef({});g.useEffect(()=>{setInterval(()=>{if(Object.keys(x.current).length!==0){for(const[z,H]of Object.entries(x.current)){const R=z,[N]=ue.splitModuleFilePathAndModulePath(R);for(const E of H)r(N,E())}x.current={}}},200)},[r]);const b=g.useCallback((z,H)=>{x.current[H]||(x.current[H]=[]),x.current[H].push(z)},[]),w="data"in l&&l.data?l.data.config:void 0,S="error"in l?l.error:void 0,[k,C]=g.useState(null);g.useEffect(()=>{if(!(!w&&!S))try{const z=localStorage.getItem("val-theme-"+((w==null?void 0:w.project)||"unknown"));if(z)if(z==="light"||z==="dark")C(z);else throw new Error(`Invalid Val theme: ${z}`);else S&&C("dark")}catch(z){console.error("Error getting theme from local storage",z)}},[w,S]),g.useEffect(()=>{w!=null&&w.defaultTheme&&k===null?(w==null?void 0:w.defaultTheme)==="dark"||(w==null?void 0:w.defaultTheme)==="light"?C(w.defaultTheme):console.warn(`Invalid config default theme: ${w.defaultTheme}`):w!==void 0&&k===null&&C("dark")},[k,w]);const[T,_]=g.useState(!1),[O,M]=g.useState(null),j=g.useCallback(()=>{_(!0),t("/save","POST",{body:{patchIds:h}}).then(z=>{z.status===200?(_(!1),M(null)):(console.error("Error publishing",z.json),M(z.json.message),_(!1))}).catch(z=>{M(z.message),_(!1)})},[t,h]),L=g.useCallback(()=>{M(null)},[]),B=g.useCallback(async z=>{const H=await t("/patches","GET",{query:{omit_patch:!1,patch_id:z,author:[],module_file_path:[]}});if(H.status===200){const R={};for(const N of H.json.patches)R[N.patchId]=N;return{status:"ok",data:R}}return{status:"error",error:H.json.message}},[t]),J=g.useRef(null);return p.jsx(Ht.Provider,{value:{portalRef:J.current,authenticationState:i,addPatch:r,getPatches:B,deletePatches:o,addDebouncedPatch:b,theme:k,setTheme:z=>{if(z==="dark"||z==="light"){try{localStorage.setItem("val-theme-"+((w==null?void 0:w.project)||"unknown"),z)}catch(H){console.error("Error setting theme in local storage",H)}C(z)}else console.warn(`Cannot set invalid theme theme: ${z}`)},publish:j,isPublishing:T,publishError:O,resetPublishError:L,config:w,schemas:s,schemaSha:a,sources:c,validationErrors:u,sourcesSyncStatus:d,patchesStatus:f,patchIds:h,profiles:m},children:p.jsxs(uM,{initialProps:{mode:"default"},children:[p.jsx("div",{"data-val-portal":"true",ref:J,...k?{"data-mode":a8(k)}:{}}),e]})})}function a8(e){return e==="light"?"dark":"light"}function ua(){return g.useContext(Ht).portalRef}function AM(){const{theme:e}=g.useContext(Ht);return e}function sp(){const{config:e}=g.useContext(Ht),t=g.useRef(e);return g.useEffect(()=>{e&&(t.current=e)},[e]),t.current}function IM(){const{authenticationState:e}=g.useContext(Ht);return e}function vn(e){const{addPatch:t,addDebouncedPatch:n}=g.useContext(Ht),[r,o]=ue.splitModuleFilePathAndModulePath(e),i=g.useMemo(()=>ue.createPatchPath(o),[o]),s=g.useCallback(a=>{t(r,a)},[t,e]);return{patchPath:i,addPatch:s,addDebouncedPatch:n}}function l8(){const{deletePatches:e}=g.useContext(Ht);return{deletePatches:e}}function c8(){const{getPatches:e}=g.useContext(Ht);return{getPatches:e}}function u8(){const{patchIds:e}=g.useContext(Ht);return e}function d8(){const{sourcesSyncStatus:e}=g.useContext(Ht);return g.useMemo(()=>Object.values(e).some(t=>t.status==="loading")?"loading":Object.values(e).some(t=>t.status==="error")?"error":"success",[e])}function f8(){const{sourcesSyncStatus:e}=g.useContext(Ht);return e}function Kw(){const{publish:e,isPublishing:t,publishError:n,resetPublishError:r}=g.useContext(Ht),{globalErrors:o}=eu(),s=DM()!=="success"||t||o.length>0;return{publish:e,isPublishing:t,publishError:n,resetPublishError:r,publishDisabled:s}}function DM(){const e=f8(),[t,n]=g.useState("not-asked");return g.useEffect(()=>{let r="success";for(const o of Object.values(e))if(o.status==="error"){r="error";break}else if(o.status==="loading"){r="loading";break}if(r==="success"){const o=setTimeout(()=>{n(r)},100);return()=>{clearTimeout(o)}}else n(r)},[e]),t}function kt(e){const{schemas:t,sources:n}=g.useContext(Ht),r=g.useCallback(()=>{const[o,i]=ue.splitModuleFilePathAndModulePath(e),s=n[o];if(t.status==="error")return t;if(t.status==="not-asked")return{status:"loading"};if(t.status==="loading")return{status:"loading"};if(s===void 0)return{status:"not-found"};const a=t.data[o];try{const{schema:l}=ue.resolvePath(i,s,a);return l===void 0?{status:"not-found"}:{status:"success",data:l}}catch(l){return{status:"error",error:l instanceof Error?l.message:"Unknown error: "+JSON.stringify(l)}}},[e,n,t]);return g.useMemo(r,[n,e,t])}function qw(){return g.useContext(Ht).schemas}function p8(){return g.useContext(Ht).schemaSha}function eu(){const{sourcesSyncStatus:e,schemas:t,patchesStatus:n,validationErrors:r}=g.useContext(Ht),o=[],i={},s={};t.status==="error"&&o.push(t.error);for(const[a,l]of Object.entries(e))if(l.status==="error")for(const c of l.errors)c.patchId?(c.skipped&&(s[c.patchId]=!0),i[c.patchId]||(i[c.patchId]=[]),i[c.patchId].push(c.message)):o.push(`Error syncing ${a}: ${c.message}`);for(const[a,l]of Object.entries(r))for(const c of l)o.push(`Error validating ${a}: ${c.message}`);for(const[a,l]of Object.entries(n)){const c=a;if(l.status==="error")for(const u of l.errors)u.patchId?(u.skipped&&(s[u.patchId]=!0),i[u.patchId]||(i[u.patchId]=[]),i[u.patchId].push(u.message)):o.push(`Error patching ${c}: ${u.message}`)}return{globalErrors:o,patchErrors:i,skippedPatches:s,validationErrors:r}}function h8(){const{profiles:e}=g.useContext(Ht);return e}function Je(e,t){const{sources:n,sourcesSyncStatus:r}=g.useContext(Ht);if(e===void 0)return{status:"loading"};const[o,i]=ue.splitModuleFilePathAndModulePath(e),s=g.useMemo(()=>{const l=n[o];return l!==void 0&&t!==void 0?m8(o,i,t,l):{status:"not-found"}},[n[o],e,t]),a=g.useMemo(()=>r[o],[o,r]);return"data"in s&&(a==null?void 0:a.status)==="loading"?{status:"loading",data:s.data}:(a==null?void 0:a.status)==="error"?{status:"error",data:"data"in s?s.data:void 0,error:a.errors.map(l=>l.message).join(", ")}:s}function LM(e){const{sources:t}=g.useContext(Ht),[n,r]=ue.splitModuleFilePathAndModulePath(e);return FM(r,t[n])}function FM(e,t){let n=t;if(t===void 0)return{status:"not-found"};for(const r of ue.splitModulePath(e)){if(n===null)return{status:"error",error:`Expected object at ${e}, got null`};if(n===void 0)return{status:"error",error:`Expected object at ${e}, got undefined`};if(typeof n!="object")return{status:"error",error:`Expected object at ${e}, got ${JSON.stringify(n)}`};if(tc(n)){const o=Number(r);if(Number.isNaN(o))return{status:"error",error:`Expected number at ${e}, got ${r}`};n=n[o]}else n=n[r]}return n===void 0?{status:"error",error:`Expected object at ${e}, got undefined`}:{status:"success",data:n}}function m8(e,t,n,r){const o=FM(t,r);return"data"in o&&o.data!==void 0?g8(e,t,n,o.data):o}function g8(e,t,n,r){if(r===null)return{status:"success",data:null};const o=n;if(o==="object"||o==="record"){if(typeof r!="object")return{status:"error",error:`Expected object, got ${typeof r}`};if(tc(r))return{status:"error",error:"Expected object, got array"};const i={};for(const s of Object.keys(r))i[s]=Ty(e,t,s);return{status:"success",data:i}}else if(o==="array"){if(typeof r!="object"||!tc(r))return{status:"error",error:`Expected array, got ${typeof r}`};const i=[];for(let s=0;s<r.length;s++)i.push(Ty(e,t,s));return{status:"success",data:i}}else{if(o==="boolean")return typeof r!="boolean"&&r!==null?{status:"error",error:`Expected boolean, got ${typeof r}`}:{status:"success",data:r};if(o==="number")return typeof r!="number"&&r!==null?{status:"error",error:`Expected number, got ${typeof r}`}:{status:"success",data:r};if(o==="richtext")return typeof r!="object"||!tc(r)?{status:"error",error:`Expected richtext (i.e. array), got ${typeof r}`}:{status:"success",data:r};if(o==="date"||o==="string"||o==="literal")return typeof r!="string"&&r!==null?{status:"error",error:`Expected string, got ${typeof r}: ${JSON.stringify(r)}`}:{status:"success",data:r};if(o==="file"||o==="image")return typeof r!="object"||!(St in r)||r[St]===void 0?{status:"error",error:`Expected object with ${St} property, got ${typeof r}`}:"metadata"in r&&r.metatadata&&typeof r.metatadata!="object"?{status:"error",error:`Expected metadata of ${o} to be an object, got ${typeof r.metadata}`}:{status:"success",data:r};if(o==="keyOf")return typeof r!="string"?{status:"error",error:`Expected string, got ${typeof r}`}:{status:"success",data:r};if(o==="union"){if(typeof r=="string")return{status:"success",data:r};if(typeof r!="object")return{status:"error",error:`Expected object, got ${typeof r}`};if(tc(r))return{status:"error",error:"Expected object, got array"};const i={};for(const s of Object.keys(r))i[s]=Ty(e,t,s);return{status:"success",data:i}}else return{status:"error",error:`Unknown schema type: ${o}`}}}function Ty(e,t,n){return t?e+Nc+t+"."+JSON.stringify(n):e+Nc+n}var zM={exports:{}};/*!
44
- Copyright (c) 2018 Jed Watson.
45
- Licensed under the MIT License (MIT), see
46
- http://jedwatson.github.io/classnames
47
- */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var i="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(i=o(i,r(a)))}return i}function r(i){if(typeof i=="string"||typeof i=="number")return i;if(typeof i!="object")return"";if(Array.isArray(i))return n.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var s="";for(var a in i)t.call(i,a)&&i[a]&&(s=o(s,a));return s}function o(i,s){return s?i?i+" "+s:i+s:i}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(zM);var v8=zM.exports;const Ue=ia(v8);/**
48
- * @license lucide-react v0.379.0 - ISC
49
- *
50
- * This source code is licensed under the ISC license.
51
- * See the LICENSE file in the root directory of this source tree.
52
- */const y8=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),$M=(...e)=>e.filter((t,n,r)=>!!t&&r.indexOf(t)===n).join(" ");/**
53
- * @license lucide-react v0.379.0 - ISC
54
- *
55
- * This source code is licensed under the ISC license.
56
- * See the LICENSE file in the root directory of this source tree.
57
- */var x8={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
58
- * @license lucide-react v0.379.0 - ISC
59
- *
60
- * This source code is licensed under the ISC license.
61
- * See the LICENSE file in the root directory of this source tree.
62
- */const b8=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:s,...a},l)=>g.createElement("svg",{ref:l,...x8,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:$M("lucide",o),...a},[...s.map(([c,u])=>g.createElement(c,u)),...Array.isArray(i)?i:[i]]));/**
63
- * @license lucide-react v0.379.0 - ISC
64
- *
65
- * This source code is licensed under the ISC license.
66
- * See the LICENSE file in the root directory of this source tree.
67
- */const De=(e,t)=>{const n=g.forwardRef(({className:r,...o},i)=>g.createElement(b8,{ref:i,iconNode:t,className:$M(`lucide-${y8(e)}`,r),...o}));return n.displayName=`${e}`,n};/**
68
- * @license lucide-react v0.379.0 - ISC
69
- *
70
- * This source code is licensed under the ISC license.
71
- * See the LICENSE file in the root directory of this source tree.
72
- */const w8=De("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);/**
73
- * @license lucide-react v0.379.0 - ISC
74
- *
75
- * This source code is licensed under the ISC license.
76
- * See the LICENSE file in the root directory of this source tree.
77
- */const S8=De("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
78
- * @license lucide-react v0.379.0 - ISC
79
- *
80
- * This source code is licensed under the ISC license.
81
- * See the LICENSE file in the root directory of this source tree.
82
- */const ap=De("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
83
- * @license lucide-react v0.379.0 - ISC
84
- *
85
- * This source code is licensed under the ISC license.
86
- * See the LICENSE file in the root directory of this source tree.
87
- */const lp=De("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
88
- * @license lucide-react v0.379.0 - ISC
89
- *
90
- * This source code is licensed under the ISC license.
91
- * See the LICENSE file in the root directory of this source tree.
92
- */const k8=De("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
93
- * @license lucide-react v0.379.0 - ISC
94
- *
95
- * This source code is licensed under the ISC license.
96
- * See the LICENSE file in the root directory of this source tree.
97
- */const tu=De("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
98
- * @license lucide-react v0.379.0 - ISC
99
- *
100
- * This source code is licensed under the ISC license.
101
- * See the LICENSE file in the root directory of this source tree.
102
- */const C8=De("ChevronsDown",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]);/**
103
- * @license lucide-react v0.379.0 - ISC
104
- *
105
- * This source code is licensed under the ISC license.
106
- * See the LICENSE file in the root directory of this source tree.
107
- */const E8=De("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
108
- * @license lucide-react v0.379.0 - ISC
109
- *
110
- * This source code is licensed under the ISC license.
111
- * See the LICENSE file in the root directory of this source tree.
112
- */const Oh=De("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
113
- * @license lucide-react v0.379.0 - ISC
114
- *
115
- * This source code is licensed under the ISC license.
116
- * See the LICENSE file in the root directory of this source tree.
117
- */const _8=De("EyeOff",[["path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24",key:"1jxqfv"}],["path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",key:"9wicm4"}],["path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61",key:"1jreej"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/**
118
- * @license lucide-react v0.379.0 - ISC
119
- *
120
- * This source code is licensed under the ISC license.
121
- * See the LICENSE file in the root directory of this source tree.
122
- */const BM=De("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/**
123
- * @license lucide-react v0.379.0 - ISC
124
- *
125
- * This source code is licensed under the ISC license.
126
- * See the LICENSE file in the root directory of this source tree.
127
- */const T8=De("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
128
- * @license lucide-react v0.379.0 - ISC
129
- *
130
- * This source code is licensed under the ISC license.
131
- * See the LICENSE file in the root directory of this source tree.
132
- */const OC=De("Heading1",[["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"}]]);/**
133
- * @license lucide-react v0.379.0 - ISC
134
- *
135
- * This source code is licensed under the ISC license.
136
- * See the LICENSE file in the root directory of this source tree.
137
- */const NC=De("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);/**
138
- * @license lucide-react v0.379.0 - ISC
139
- *
140
- * This source code is licensed under the ISC license.
141
- * See the LICENSE file in the root directory of this source tree.
142
- */const MC=De("Heading3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);/**
143
- * @license lucide-react v0.379.0 - ISC
144
- *
145
- * This source code is licensed under the ISC license.
146
- * See the LICENSE file in the root directory of this source tree.
147
- */const PC=De("Heading4",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 10v4h4",key:"13sv97"}],["path",{d:"M21 10v8",key:"1kdml4"}]]);/**
148
- * @license lucide-react v0.379.0 - ISC
149
- *
150
- * This source code is licensed under the ISC license.
151
- * See the LICENSE file in the root directory of this source tree.
152
- */const RC=De("Heading5",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 13v-3h4",key:"1nvgqp"}],["path",{d:"M17 17.7c.4.2.8.3 1.3.3 1.5 0 2.7-1.1 2.7-2.5S19.8 13 18.3 13H17",key:"2nebdn"}]]);/**
153
- * @license lucide-react v0.379.0 - ISC
154
- *
155
- * This source code is licensed under the ISC license.
156
- * See the LICENSE file in the root directory of this source tree.
157
- */const jC=De("Heading6",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["circle",{cx:"19",cy:"16",r:"2",key:"15mx69"}],["path",{d:"M20 10c-2 2-3 3.5-3 6",key:"f35dl0"}]]);/**
158
- * @license lucide-react v0.379.0 - ISC
159
- *
160
- * This source code is licensed under the ISC license.
161
- * See the LICENSE file in the root directory of this source tree.
162
- */const O8=De("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
163
- * @license lucide-react v0.379.0 - ISC
164
- *
165
- * This source code is licensed under the ISC license.
166
- * See the LICENSE file in the root directory of this source tree.
167
- */const N8=De("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/**
168
- * @license lucide-react v0.379.0 - ISC
169
- *
170
- * This source code is licensed under the ISC license.
171
- * See the LICENSE file in the root directory of this source tree.
172
- */const M8=De("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/**
173
- * @license lucide-react v0.379.0 - ISC
174
- *
175
- * This source code is licensed under the ISC license.
176
- * See the LICENSE file in the root directory of this source tree.
177
- */const P8=De("ListOrdered",[["line",{x1:"10",x2:"21",y1:"6",y2:"6",key:"76qw6h"}],["line",{x1:"10",x2:"21",y1:"12",y2:"12",key:"16nom4"}],["line",{x1:"10",x2:"21",y1:"18",y2:"18",key:"u3jurt"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
178
- * @license lucide-react v0.379.0 - ISC
179
- *
180
- * This source code is licensed under the ISC license.
181
- * See the LICENSE file in the root directory of this source tree.
182
- */const R8=De("List",[["line",{x1:"8",x2:"21",y1:"6",y2:"6",key:"7ey8pc"}],["line",{x1:"8",x2:"21",y1:"12",y2:"12",key:"rjfblc"}],["line",{x1:"8",x2:"21",y1:"18",y2:"18",key:"c3b1m8"}],["line",{x1:"3",x2:"3.01",y1:"6",y2:"6",key:"1g7gq3"}],["line",{x1:"3",x2:"3.01",y1:"12",y2:"12",key:"1pjlvk"}],["line",{x1:"3",x2:"3.01",y1:"18",y2:"18",key:"28t2mc"}]]);/**
183
- * @license lucide-react v0.379.0 - ISC
184
- *
185
- * This source code is licensed under the ISC license.
186
- * See the LICENSE file in the root directory of this source tree.
187
- */const j8=De("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/**
188
- * @license lucide-react v0.379.0 - ISC
189
- *
190
- * This source code is licensed under the ISC license.
191
- * See the LICENSE file in the root directory of this source tree.
192
- */const A8=De("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
193
- * @license lucide-react v0.379.0 - ISC
194
- *
195
- * This source code is licensed under the ISC license.
196
- * See the LICENSE file in the root directory of this source tree.
197
- */const AC=De("PanelsTopLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]);/**
198
- * @license lucide-react v0.379.0 - ISC
199
- *
200
- * This source code is licensed under the ISC license.
201
- * See the LICENSE file in the root directory of this source tree.
202
- */const VM=De("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
203
- * @license lucide-react v0.379.0 - ISC
204
- *
205
- * This source code is licensed under the ISC license.
206
- * See the LICENSE file in the root directory of this source tree.
207
- */const UM=De("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
208
- * @license lucide-react v0.379.0 - ISC
209
- *
210
- * This source code is licensed under the ISC license.
211
- * See the LICENSE file in the root directory of this source tree.
212
- */const I8=De("SquareArrowOutUpRight",[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]]);/**
213
- * @license lucide-react v0.379.0 - ISC
214
- *
215
- * This source code is licensed under the ISC license.
216
- * See the LICENSE file in the root directory of this source tree.
217
- */const D8=De("SquareDashedMousePointer",[["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"m12 12 4 10 1.7-4.3L22 16Z",key:"64ilsv"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h2",key:"1qve2z"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v2",key:"p14lih"}],["path",{d:"M3 14v1",key:"vnatye"}]]);/**
218
- * @license lucide-react v0.379.0 - ISC
219
- *
220
- * This source code is licensed under the ISC license.
221
- * See the LICENSE file in the root directory of this source tree.
222
- */const WM=De("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z",key:"1lpok0"}]]);/**
223
- * @license lucide-react v0.379.0 - ISC
224
- *
225
- * This source code is licensed under the ISC license.
226
- * See the LICENSE file in the root directory of this source tree.
227
- */const L8=De("Strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);/**
228
- * @license lucide-react v0.379.0 - ISC
229
- *
230
- * This source code is licensed under the ISC license.
231
- * See the LICENSE file in the root directory of this source tree.
232
- */const F8=De("Tally2",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}]]);/**
233
- * @license lucide-react v0.379.0 - ISC
234
- *
235
- * This source code is licensed under the ISC license.
236
- * See the LICENSE file in the root directory of this source tree.
237
- */const z8=De("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
238
- * @license lucide-react v0.379.0 - ISC
239
- *
240
- * This source code is licensed under the ISC license.
241
- * See the LICENSE file in the root directory of this source tree.
242
- */const HM=De("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]]);/**
243
- * @license lucide-react v0.379.0 - ISC
244
- *
245
- * This source code is licensed under the ISC license.
246
- * See the LICENSE file in the root directory of this source tree.
247
- */const $8=De("Unlink",[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]);/**
248
- * @license lucide-react v0.379.0 - ISC
249
- *
250
- * This source code is licensed under the ISC license.
251
- * See the LICENSE file in the root directory of this source tree.
252
- */const B8=De("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
253
- * @license lucide-react v0.379.0 - ISC
254
- *
255
- * This source code is licensed under the ISC license.
256
- * See the LICENSE file in the root directory of this source tree.
257
- */const Ug=De("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function V8(e){const t={"/":{name:"/",fullPath:"/",isDirectory:!0,children:[]}};for(const n of e){const r=n.split("/");if(r[0]!=="")throw new Error("Expected path to start with '/'");for(let o=1;o<r.length;o++){const i=r.slice(0,o).join("/"),s=[i,r[o]].join("/"),a=r[o];if(!a)throw new Error("Expected name to be non-empty");if(!t[s]){const l={name:a,fullPath:s,children:[]};o<r.length-1&&(l.isDirectory=!0),t[s]=l,t[i||"/"].children.push(t[s])}}}return t["/"]}function bf({isOpen:e,children:t,duration:n=.3}){return p.jsx("div",{style:{transition:`grid-template-rows ${n}s`},className:Ue("grid overflow-hidden",{"grid-rows-[0fr]":!e,"grid-rows-[1fr]":e}),children:p.jsx("div",{style:{transition:`visibility ${n}s`},className:Ue("min-h-0",{visible:e,invisible:!e}),children:t})})}function Gw(e){let t="",n=!1;for(let r=0;r<e.length;r++){const o=e[r]===e[r].toUpperCase();r===0?(t+=e[r].toUpperCase(),n=!1):n&&o?(n=!1,t+=" "+e[r].toUpperCase()):(t+=e[r].toLowerCase(),n=!0)}return t=t.replace(/[-–—]/g,""),t}function Ic(e){return Gw(e.split(".")[0])}const KM=ge.createContext({hardLink:!1,navigate:()=>{},currentSourcePath:""}),Oy="/val/~";function qM({children:e,overlay:t}){const[n,r]=g.useState(""),o=g.useRef([]);g.useEffect(()=>{const s=()=>{const a=location.pathname.indexOf(Oy);if(a>-1){const l=new URLSearchParams(location.search).get("p"),u=location.pathname.slice(a+Oy.length)+(l?`?p=${l}`:"");r(u);const d=o.current.pop();setTimeout(()=>{var h,m;const f=(m=(h=document.getElementById("val-shadow-root"))==null?void 0:h.shadowRoot)==null?void 0:m.getElementById("val-content-area");d&&(f==null||f.scrollTo(0,d))},50)}};return s(),window.addEventListener("popstate",s),()=>{window.removeEventListener("popstate",s)}},[]);const i=g.useCallback((s,a)=>{var c,u;const l=`${Oy}${s}`;if(r(s),t)window.location.href=l;else{const d=(u=(c=document.getElementById("val-shadow-root"))==null?void 0:c.shadowRoot)==null?void 0:u.getElementById("val-content-area"),f=d==null?void 0:d.scrollTop;d==null||d.scrollTo(0,0),f!==void 0&&o.current.push(f),a!=null&&a.replace?window.history.replaceState(null,"",l):window.history.pushState(null,"",l)}},[t]);return p.jsx(KM.Provider,{value:{hardLink:!!t,currentSourcePath:n,navigate:i},children:e})}function Zr(){const{navigate:e,currentSourcePath:t}=g.useContext(KM);return{navigate:e,currentSourcePath:t}}function U8(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Wg(...e){return t=>e.forEach(n=>U8(n,t))}function Ie(...e){return g.useCallback(Wg(...e),e)}var Ai=g.forwardRef((e,t)=>{const{children:n,...r}=e,o=g.Children.toArray(n),i=o.find(H8);if(i){const s=i.props.children,a=o.map(l=>l===i?g.Children.count(s)>1?g.Children.only(null):g.isValidElement(s)?s.props.children:null:l);return p.jsx(v0,{...r,ref:t,children:g.isValidElement(s)?g.cloneElement(s,void 0,a):null})}return p.jsx(v0,{...r,ref:t,children:n})});Ai.displayName="Slot";var v0=g.forwardRef((e,t)=>{const{children:n,...r}=e;if(g.isValidElement(n)){const o=q8(n);return g.cloneElement(n,{...K8(r,n.props),ref:t?Wg(t,o):o})}return g.Children.count(n)>1?g.Children.only(null):null});v0.displayName="SlotClone";var W8=({children:e})=>p.jsx(p.Fragment,{children:e});function H8(e){return g.isValidElement(e)&&e.type===W8}function K8(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function q8(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var G8=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Ee=G8.reduce((e,t)=>{const n=g.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?Ai:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(a,{...s,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function GM(e,t){e&&Yn.flushSync(()=>e.dispatchEvent(t))}var mn=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{};function Y8(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}var Mn=e=>{const{present:t,children:n}=e,r=J8(t),o=typeof n=="function"?n({present:r.isPresent}):g.Children.only(n),i=Ie(r.ref,X8(o));return typeof n=="function"||r.isPresent?g.cloneElement(o,{ref:i}):null};Mn.displayName="Presence";function J8(e){const[t,n]=g.useState(),r=g.useRef({}),o=g.useRef(e),i=g.useRef("none"),s=e?"mounted":"unmounted",[a,l]=Y8(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const c=eh(r.current);i.current=a==="mounted"?c:"none"},[a]),mn(()=>{const c=r.current,u=o.current;if(u!==e){const f=i.current,h=eh(c);e?l("MOUNT"):h==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&f!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),mn(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=h=>{const v=eh(r.current).includes(h.animationName);if(h.target===t&&v&&(l("ANIMATION_END"),!o.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},f=h=>{h.target===t&&(i.current=eh(r.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:g.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function eh(e){return(e==null?void 0:e.animationName)||"none"}function X8(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Z8(e,t){const n=g.createContext(t),r=i=>{const{children:s,...a}=i,l=g.useMemo(()=>a,Object.values(a));return p.jsx(n.Provider,{value:l,children:s})};r.displayName=e+"Provider";function o(i){const s=g.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,o]}function Bi(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];const c=d=>{var b;const{scope:f,children:h,...m}=d,v=((b=f==null?void 0:f[e])==null?void 0:b[l])||a,x=g.useMemo(()=>m,Object.values(m));return p.jsx(v.Provider,{value:x,children:h})};c.displayName=i+"Provider";function u(d,f){var v;const h=((v=f==null?void 0:f[e])==null?void 0:v[l])||a,m=g.useContext(h);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(s=>g.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,Q8(o,...t)]}function Q8(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Ft(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}var eV=g.createContext(void 0);function cp(e){const t=g.useContext(eV);return e||t||"ltr"}function y0(e,[t,n]){return Math.min(n,Math.max(t,e))}function re(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function tV(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}var Yw="ScrollArea",[YM,ofe]=Bi(Yw),[nV,Qr]=YM(Yw),JM=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:i=600,...s}=e,[a,l]=g.useState(null),[c,u]=g.useState(null),[d,f]=g.useState(null),[h,m]=g.useState(null),[v,x]=g.useState(null),[b,w]=g.useState(0),[S,k]=g.useState(0),[C,T]=g.useState(!1),[_,O]=g.useState(!1),M=Ie(t,L=>l(L)),j=cp(o);return p.jsx(nV,{scope:n,type:r,dir:j,scrollHideDelay:i,scrollArea:a,viewport:c,onViewportChange:u,content:d,onContentChange:f,scrollbarX:h,onScrollbarXChange:m,scrollbarXEnabled:C,onScrollbarXEnabledChange:T,scrollbarY:v,onScrollbarYChange:x,scrollbarYEnabled:_,onScrollbarYEnabledChange:O,onCornerWidthChange:w,onCornerHeightChange:k,children:p.jsx(Ee.div,{dir:j,...s,ref:M,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":S+"px",...e.style}})})});JM.displayName=Yw;var XM="ScrollAreaViewport",ZM=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...i}=e,s=Qr(XM,n),a=g.useRef(null),l=Ie(t,a,s.onViewportChange);return p.jsxs(p.Fragment,{children:[p.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),p.jsx(Ee.div,{"data-radix-scroll-area-viewport":"",...i,ref:l,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style},children:p.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});ZM.displayName=XM;var ii="ScrollAreaScrollbar",Jw=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Qr(ii,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:s}=o,a=e.orientation==="horizontal";return g.useEffect(()=>(a?i(!0):s(!0),()=>{a?i(!1):s(!1)}),[a,i,s]),o.type==="hover"?p.jsx(rV,{...r,ref:t,forceMount:n}):o.type==="scroll"?p.jsx(oV,{...r,ref:t,forceMount:n}):o.type==="auto"?p.jsx(QM,{...r,ref:t,forceMount:n}):o.type==="always"?p.jsx(Xw,{...r,ref:t}):null});Jw.displayName=ii;var rV=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Qr(ii,e.__scopeScrollArea),[i,s]=g.useState(!1);return g.useEffect(()=>{const a=o.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),s(!0)},u=()=>{l=window.setTimeout(()=>s(!1),o.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",u),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",u)}}},[o.scrollArea,o.scrollHideDelay]),p.jsx(Mn,{present:n||i,children:p.jsx(QM,{"data-state":i?"visible":"hidden",...r,ref:t})})}),oV=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Qr(ii,e.__scopeScrollArea),i=e.orientation==="horizontal",s=Kg(()=>l("SCROLL_END"),100),[a,l]=tV("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return g.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,o.scrollHideDelay,l]),g.useEffect(()=>{const c=o.viewport,u=i?"scrollLeft":"scrollTop";if(c){let d=c[u];const f=()=>{const h=c[u];d!==h&&(l("SCROLL"),s()),d=h};return c.addEventListener("scroll",f),()=>c.removeEventListener("scroll",f)}},[o.viewport,i,l,s]),p.jsx(Mn,{present:n||a!=="hidden",children:p.jsx(Xw,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:re(e.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:re(e.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),QM=g.forwardRef((e,t)=>{const n=Qr(ii,e.__scopeScrollArea),{forceMount:r,...o}=e,[i,s]=g.useState(!1),a=e.orientation==="horizontal",l=Kg(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,u=n.viewport.offsetHeight<n.viewport.scrollHeight;s(a?c:u)}},10);return Dc(n.viewport,l),Dc(n.content,l),p.jsx(Mn,{present:r||i,children:p.jsx(Xw,{"data-state":i?"visible":"hidden",...o,ref:t})})}),Xw=g.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=Qr(ii,e.__scopeScrollArea),i=g.useRef(null),s=g.useRef(0),[a,l]=g.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=oP(a.viewport,a.content),u={...r,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:f=>i.current=f,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:f=>s.current=f};function d(f,h){return uV(f,s.current,a,h)}return n==="horizontal"?p.jsx(iV,{...u,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const f=o.viewport.scrollLeft,h=IC(f,a,o.dir);i.current.style.transform=`translate3d(${h}px, 0, 0)`}},onWheelScroll:f=>{o.viewport&&(o.viewport.scrollLeft=f)},onDragScroll:f=>{o.viewport&&(o.viewport.scrollLeft=d(f,o.dir))}}):n==="vertical"?p.jsx(sV,{...u,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const f=o.viewport.scrollTop,h=IC(f,a);i.current.style.transform=`translate3d(0, ${h}px, 0)`}},onWheelScroll:f=>{o.viewport&&(o.viewport.scrollTop=f)},onDragScroll:f=>{o.viewport&&(o.viewport.scrollTop=d(f))}}):null}),iV=g.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=Qr(ii,e.__scopeScrollArea),[s,a]=g.useState(),l=g.useRef(null),c=Ie(t,l,i.onScrollbarXChange);return g.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),p.jsx(tP,{"data-orientation":"horizontal",...o,ref:c,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Hg(n)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.x),onDragScroll:u=>e.onDragScroll(u.x),onWheelScroll:(u,d)=>{if(i.viewport){const f=i.viewport.scrollLeft+u.deltaX;e.onWheelScroll(f),sP(f,d)&&u.preventDefault()}},onResize:()=>{l.current&&i.viewport&&s&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:Am(s.paddingLeft),paddingEnd:Am(s.paddingRight)}})}})}),sV=g.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=Qr(ii,e.__scopeScrollArea),[s,a]=g.useState(),l=g.useRef(null),c=Ie(t,l,i.onScrollbarYChange);return g.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),p.jsx(tP,{"data-orientation":"vertical",...o,ref:c,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Hg(n)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.y),onDragScroll:u=>e.onDragScroll(u.y),onWheelScroll:(u,d)=>{if(i.viewport){const f=i.viewport.scrollTop+u.deltaY;e.onWheelScroll(f),sP(f,d)&&u.preventDefault()}},onResize:()=>{l.current&&i.viewport&&s&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:Am(s.paddingTop),paddingEnd:Am(s.paddingBottom)}})}})}),[aV,eP]=YM(ii),tP=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:i,onThumbPointerUp:s,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:u,onResize:d,...f}=e,h=Qr(ii,n),[m,v]=g.useState(null),x=Ie(t,M=>v(M)),b=g.useRef(null),w=g.useRef(""),S=h.viewport,k=r.content-r.viewport,C=Ft(u),T=Ft(l),_=Kg(d,10);function O(M){if(b.current){const j=M.clientX-b.current.left,L=M.clientY-b.current.top;c({x:j,y:L})}}return g.useEffect(()=>{const M=j=>{const L=j.target;(m==null?void 0:m.contains(L))&&C(j,k)};return document.addEventListener("wheel",M,{passive:!1}),()=>document.removeEventListener("wheel",M,{passive:!1})},[S,m,k,C]),g.useEffect(T,[r,T]),Dc(m,_),Dc(h.content,_),p.jsx(aV,{scope:n,scrollbar:m,hasThumb:o,onThumbChange:Ft(i),onThumbPointerUp:Ft(s),onThumbPositionChange:T,onThumbPointerDown:Ft(a),children:p.jsx(Ee.div,{...f,ref:x,style:{position:"absolute",...f.style},onPointerDown:re(e.onPointerDown,M=>{M.button===0&&(M.target.setPointerCapture(M.pointerId),b.current=m.getBoundingClientRect(),w.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),O(M))}),onPointerMove:re(e.onPointerMove,O),onPointerUp:re(e.onPointerUp,M=>{const j=M.target;j.hasPointerCapture(M.pointerId)&&j.releasePointerCapture(M.pointerId),document.body.style.webkitUserSelect=w.current,h.viewport&&(h.viewport.style.scrollBehavior=""),b.current=null})})})}),jm="ScrollAreaThumb",nP=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=eP(jm,e.__scopeScrollArea);return p.jsx(Mn,{present:n||o.hasThumb,children:p.jsx(lV,{ref:t,...r})})}),lV=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,i=Qr(jm,n),s=eP(jm,n),{onThumbPositionChange:a}=s,l=Ie(t,d=>s.onThumbChange(d)),c=g.useRef(),u=Kg(()=>{c.current&&(c.current(),c.current=void 0)},100);return g.useEffect(()=>{const d=i.viewport;if(d){const f=()=>{if(u(),!c.current){const h=dV(d,a);c.current=h,a()}};return a(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[i.viewport,u,a]),p.jsx(Ee.div,{"data-state":s.hasThumb?"visible":"hidden",...o,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:re(e.onPointerDownCapture,d=>{const h=d.target.getBoundingClientRect(),m=d.clientX-h.left,v=d.clientY-h.top;s.onThumbPointerDown({x:m,y:v})}),onPointerUp:re(e.onPointerUp,s.onThumbPointerUp)})});nP.displayName=jm;var Zw="ScrollAreaCorner",rP=g.forwardRef((e,t)=>{const n=Qr(Zw,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?p.jsx(cV,{...e,ref:t}):null});rP.displayName=Zw;var cV=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=Qr(Zw,n),[i,s]=g.useState(0),[a,l]=g.useState(0),c=!!(i&&a);return Dc(o.scrollbarX,()=>{var d;const u=((d=o.scrollbarX)==null?void 0:d.offsetHeight)||0;o.onCornerHeightChange(u),l(u)}),Dc(o.scrollbarY,()=>{var d;const u=((d=o.scrollbarY)==null?void 0:d.offsetWidth)||0;o.onCornerWidthChange(u),s(u)}),c?p.jsx(Ee.div,{...r,ref:t,style:{width:i,height:a,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Am(e){return e?parseInt(e,10):0}function oP(e,t){const n=e/t;return isNaN(n)?0:n}function Hg(e){const t=oP(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function uV(e,t,n,r="ltr"){const o=Hg(n),i=o/2,s=t||i,a=o-s,l=n.scrollbar.paddingStart+s,c=n.scrollbar.size-n.scrollbar.paddingEnd-a,u=n.content-n.viewport,d=r==="ltr"?[0,u]:[u*-1,0];return iP([l,c],d)(e)}function IC(e,t,n="ltr"){const r=Hg(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-o,s=t.content-t.viewport,a=i-r,l=n==="ltr"?[0,s]:[s*-1,0],c=y0(e,l);return iP([0,s],[0,a])(c)}function iP(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function sP(e,t){return e>0&&e<t}var dV=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const i={left:e.scrollLeft,top:e.scrollTop},s=n.left!==i.left,a=n.top!==i.top;(s||a)&&t(),n=i,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function Kg(e,t){const n=Ft(e),r=g.useRef(0);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),g.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Dc(e,t){const n=Ft(t);mn(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}var aP=JM,fV=ZM,pV=rP;function lP(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=lP(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function hV(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=lP(e))&&(r&&(r+=" "),r+=t);return r}const Qw="-",mV=e=>{const t=vV(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:s=>{const a=s.split(Qw);return a[0]===""&&a.length!==1&&a.shift(),cP(a,t)||gV(s)},getConflictingClassGroupIds:(s,a)=>{const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}}},cP=(e,t)=>{var s;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?cP(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(Qw);return(s=t.validators.find(({validator:a})=>a(i)))==null?void 0:s.classGroupId},DC=/^\[(.+)\]$/,gV=e=>{if(DC.test(e)){const t=DC.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},vV=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return xV(Object.entries(e.classGroups),n).forEach(([i,s])=>{x0(s,r,i,t)}),r},x0=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:LC(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(yV(o)){x0(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,s])=>{x0(s,LC(t,i),n,r)})})},LC=(e,t)=>{let n=e;return t.split(Qw).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},yV=e=>e.isThemeGetter,xV=(e,t)=>t?e.map(([n,r])=>{const o=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([s,a])=>[t+s,a])):i);return[n,o]}):e,bV=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(i,s)=>{n.set(i,s),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let s=n.get(i);if(s!==void 0)return s;if((s=r.get(i))!==void 0)return o(i,s),s},set(i,s){n.has(i)?n.set(i,s):o(i,s)}}},uP="!",wV=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],i=t.length,s=a=>{const l=[];let c=0,u=0,d;for(let x=0;x<a.length;x++){let b=a[x];if(c===0){if(b===o&&(r||a.slice(x,x+i)===t)){l.push(a.slice(u,x)),u=x+i;continue}if(b==="/"){d=x;continue}}b==="["?c++:b==="]"&&c--}const f=l.length===0?a:a.substring(u),h=f.startsWith(uP),m=h?f.substring(1):f,v=d&&d>u?d-u:void 0;return{modifiers:l,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:v}};return n?a=>n({className:a,parseClassName:s}):s},SV=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},kV=e=>({cache:bV(e.cacheSize),parseClassName:wV(e),...mV(e)}),CV=/\s+/,EV=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,i=[],s=e.trim().split(CV);let a="";for(let l=s.length-1;l>=0;l-=1){const c=s[l],{modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:h}=n(c);let m=!!h,v=r(m?f.substring(0,h):f);if(!v){if(!m){a=c+(a.length>0?" "+a:a);continue}if(v=r(f),!v){a=c+(a.length>0?" "+a:a);continue}m=!1}const x=SV(u).join(":"),b=d?x+uP:x,w=b+v;if(i.includes(w))continue;i.push(w);const S=o(v,m);for(let k=0;k<S.length;++k){const C=S[k];i.push(b+C)}a=c+(a.length>0?" "+a:a)}return a};function _V(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=dP(t))&&(r&&(r+=" "),r+=n);return r}const dP=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=dP(e[r]))&&(n&&(n+=" "),n+=t);return n};function TV(e,...t){let n,r,o,i=s;function s(l){const c=t.reduce((u,d)=>d(u),e());return n=kV(c),r=n.cache.get,o=n.cache.set,i=a,a(l)}function a(l){const c=r(l);if(c)return c;const u=EV(l,n);return o(l,u),u}return function(){return i(_V.apply(null,arguments))}}const at=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},fP=/^\[(?:([a-z-]+):)?(.+)\]$/i,OV=/^\d+\/\d+$/,NV=new Set(["px","full","screen"]),MV=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,PV=/\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$/,RV=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,jV=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,AV=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,li=e=>uc(e)||NV.has(e)||OV.test(e),Ji=e=>nu(e,"length",VV),uc=e=>!!e&&!Number.isNaN(Number(e)),Ny=e=>nu(e,"number",uc),Au=e=>!!e&&Number.isInteger(Number(e)),IV=e=>e.endsWith("%")&&uc(e.slice(0,-1)),Me=e=>fP.test(e),Xi=e=>MV.test(e),DV=new Set(["length","size","percentage"]),LV=e=>nu(e,DV,pP),FV=e=>nu(e,"position",pP),zV=new Set(["image","url"]),$V=e=>nu(e,zV,WV),BV=e=>nu(e,"",UV),Iu=()=>!0,nu=(e,t,n)=>{const r=fP.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},VV=e=>PV.test(e)&&!RV.test(e),pP=()=>!1,UV=e=>jV.test(e),WV=e=>AV.test(e),HV=()=>{const e=at("colors"),t=at("spacing"),n=at("blur"),r=at("brightness"),o=at("borderColor"),i=at("borderRadius"),s=at("borderSpacing"),a=at("borderWidth"),l=at("contrast"),c=at("grayscale"),u=at("hueRotate"),d=at("invert"),f=at("gap"),h=at("gradientColorStops"),m=at("gradientColorStopPositions"),v=at("inset"),x=at("margin"),b=at("opacity"),w=at("padding"),S=at("saturate"),k=at("scale"),C=at("sepia"),T=at("skew"),_=at("space"),O=at("translate"),M=()=>["auto","contain","none"],j=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto",Me,t],B=()=>[Me,t],J=()=>["",li,Ji],z=()=>["auto",uc,Me],H=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],R=()=>["solid","dashed","dotted","double","none"],N=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],E=()=>["start","end","center","between","around","evenly","stretch"],A=()=>["","0",Me],P=()=>["auto","avoid","all","avoid-page","page","left","right","column"],I=()=>[uc,Me];return{cacheSize:500,separator:":",theme:{colors:[Iu],spacing:[li,Ji],blur:["none","",Xi,Me],brightness:I(),borderColor:[e],borderRadius:["none","","full",Xi,Me],borderSpacing:B(),borderWidth:J(),contrast:I(),grayscale:A(),hueRotate:I(),invert:A(),gap:B(),gradientColorStops:[e],gradientColorStopPositions:[IV,Ji],inset:L(),margin:L(),opacity:I(),padding:B(),saturate:I(),scale:I(),sepia:A(),skew:I(),space:B(),translate:B()},classGroups:{aspect:[{aspect:["auto","square","video",Me]}],container:["container"],columns:[{columns:[Xi]}],"break-after":[{"break-after":P()}],"break-before":[{"break-before":P()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...H(),Me]}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Au,Me]}],basis:[{basis:L()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Me]}],grow:[{grow:A()}],shrink:[{shrink:A()}],order:[{order:["first","last","none",Au,Me]}],"grid-cols":[{"grid-cols":[Iu]}],"col-start-end":[{col:["auto",{span:["full",Au,Me]},Me]}],"col-start":[{"col-start":z()}],"col-end":[{"col-end":z()}],"grid-rows":[{"grid-rows":[Iu]}],"row-start-end":[{row:["auto",{span:[Au,Me]},Me]}],"row-start":[{"row-start":z()}],"row-end":[{"row-end":z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Me]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Me]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...E()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...E(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...E(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[w]}],px:[{px:[w]}],py:[{py:[w]}],ps:[{ps:[w]}],pe:[{pe:[w]}],pt:[{pt:[w]}],pr:[{pr:[w]}],pb:[{pb:[w]}],pl:[{pl:[w]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[_]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[_]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Me,t]}],"min-w":[{"min-w":[Me,t,"min","max","fit"]}],"max-w":[{"max-w":[Me,t,"none","full","min","max","fit","prose",{screen:[Xi]},Xi]}],h:[{h:[Me,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Me,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Me,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Me,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Xi,Ji]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ny]}],"font-family":[{font:[Iu]}],"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-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Me]}],"line-clamp":[{"line-clamp":["none",uc,Ny]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",li,Me]}],"list-image":[{"list-image":["none",Me]}],"list-style-type":[{list:["none","disc","decimal",Me]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...R(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",li,Ji]}],"underline-offset":[{"underline-offset":["auto",li,Me]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:B()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Me]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Me]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...H(),FV]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",LV]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},$V]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...R(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:R()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...R()]}],"outline-offset":[{"outline-offset":[li,Me]}],"outline-w":[{outline:[li,Ji]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[li,Ji]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Xi,BV]}],"shadow-color":[{shadow:[Iu]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...N(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":N()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Xi,Me]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[S]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Me]}],duration:[{duration:I()}],ease:[{ease:["linear","in","out","in-out",Me]}],delay:[{delay:I()}],animate:[{animate:["none","spin","ping","pulse","bounce",Me]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[k]}],"scale-x":[{"scale-x":[k]}],"scale-y":[{"scale-y":[k]}],rotate:[{rotate:[Au,Me]}],"translate-x":[{"translate-x":[O]}],"translate-y":[{"translate-y":[O]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Me]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Me]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":B()}],"scroll-mx":[{"scroll-mx":B()}],"scroll-my":[{"scroll-my":B()}],"scroll-ms":[{"scroll-ms":B()}],"scroll-me":[{"scroll-me":B()}],"scroll-mt":[{"scroll-mt":B()}],"scroll-mr":[{"scroll-mr":B()}],"scroll-mb":[{"scroll-mb":B()}],"scroll-ml":[{"scroll-ml":B()}],"scroll-p":[{"scroll-p":B()}],"scroll-px":[{"scroll-px":B()}],"scroll-py":[{"scroll-py":B()}],"scroll-ps":[{"scroll-ps":B()}],"scroll-pe":[{"scroll-pe":B()}],"scroll-pt":[{"scroll-pt":B()}],"scroll-pr":[{"scroll-pr":B()}],"scroll-pb":[{"scroll-pb":B()}],"scroll-pl":[{"scroll-pl":B()}],"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",Me]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[li,Ji,Ny]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},KV=TV(HV);function qe(...e){return KV(hV(e))}const qg=g.forwardRef(({className:e,children:t,innerRef:n,viewportId:r,...o},i)=>p.jsxs(aP,{ref:i,className:qe("relative overflow-hidden",e),...o,children:[p.jsx(fV,{className:"h-full w-full rounded-[inherit]",ref:n,id:r,children:t}),p.jsx(hP,{}),p.jsx(pV,{})]}));qg.displayName=aP.displayName;const hP=g.forwardRef(({className:e,orientation:t="vertical",...n},r)=>p.jsx(Jw,{ref:r,orientation:t,className:qe("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:p.jsx(nP,{className:qe("relative rounded-full bg-border",t==="vertical"&&"flex-1")})}));hP.displayName=Jw.displayName;function qV({isOpen:e,setOpen:t}){const n=sp(),[r,o]=g.useState(""),[i,s]=g.useState("");g.useEffect(()=>{async function l(){let c=!1;const u=async d=>{if(!c)try{(await fetch(d)).ok&&(c=!0,o(d))}catch{}};await u("/favicon.ico"),await u("/favicon.svg"),await u("/favicon.png"),await u("/apple-touch-icon.png"),await u("https://valbuild.com/favicon.ico")}if(l(),n!=null&&n.project)s(n.project);else try{let c=new URL(location.origin).hostname;if(c!=="localhost"){const u=c.split(".");u.length>=2&&(c=u.slice(1,-1).join(".")),s(Gw(c))}else s("Dev mode")}catch{s("Studio")}},[n]);const a=qw();return p.jsxs("nav",{className:"flex flex-col gap-1 pl-4",children:[p.jsxs("div",{className:"flex items-center h-16 gap-4 p-4 mt-4 bg-bg-tertiary rounded-3xl",children:[r?p.jsx("img",{src:r,alt:"",className:"w-4 h-4"}):p.jsx("div",{className:"w-4 h-4"}),p.jsx("span",{children:i}),p.jsx("button",{className:"block xl:hidden",onClick:()=>{t(!e)},children:p.jsx(tu,{className:Ue("transform",{"rotate-90":e})})})]}),"data"in a&&p.jsx("div",{className:Ue("py-4 bg-bg-tertiary rounded-3xl",{"hidden xl:block":!e,block:e}),children:p.jsx(qg,{children:p.jsx("div",{className:"max-h-[calc(100svh-32px-64px-32px-16px)]",children:p.jsx(YV,{})})})})]})}function GV(){const e=qw();return g.useMemo(()=>{if(e.status==="success"){const t=Object.keys(e.data);return{status:e.status,data:V8(t)}}return e},[e])}function YV({title:e}){const t=GV();if(t.status==="error")return console.error(t.error),null;if(t.status!=="success")return p.jsx(JV,{});const n=t.data;return p.jsxs("div",{className:"p-4",children:[e&&p.jsx("div",{className:"py-2",children:e}),p.jsx("div",{children:n.children.sort(mP).map((r,o)=>g.createElement(gP,{...r,name:r.name,key:o}))})]})}function JV(){return null}function mP(e,t){return e.isDirectory&&!t.isDirectory?-1:!e.isDirectory&&t.isDirectory?1:e.name.localeCompare(t.name)}function gP({name:e,fullPath:t,isDirectory:n,children:r}){const{navigate:o,currentSourcePath:i}=Zr(),[s,a]=g.useState(!0);return p.jsxs("div",{className:"w-full",children:[p.jsxs("button",{className:Ue("flex justify-between w-full p-2",{underline:i.startsWith(t)}),onClick:()=>{n?a(!s):o(t)},children:[p.jsxs("div",{className:"flex items-center pr-2",children:[n?p.jsx(F8,{}):p.jsx(BM,{className:"pr-2"}),p.jsx("span",{children:Ic(e)})]}),p.jsx(tu,{className:Ue("transform",{"rotate-90":s,hidden:!r.length})})]}),p.jsx("div",{className:"pl-2",children:p.jsx(bf,{isOpen:s,children:r.sort(mP).map((l,c)=>g.createElement(gP,{...l,key:c}))})})]})}function Qo({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=XV({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=Ft(n),l=g.useCallback(c=>{if(i){const d=typeof c=="function"?c(e):c;d!==e&&a(d)}else o(c)},[i,e,o,a]);return[s,l]}function XV({defaultProp:e,onChange:t}){const n=g.useState(e),[r]=n,o=g.useRef(r),i=Ft(t);return g.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}function vP(e){const t=g.useRef({value:e,previous:e});return g.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function yP(e){const[t,n]=g.useState(void 0);return mn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var e1="Checkbox",[ZV,ife]=Bi(e1),[QV,e9]=ZV(e1),xP=g.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:l="on",onCheckedChange:c,form:u,...d}=e,[f,h]=g.useState(null),m=Ie(t,k=>h(k)),v=g.useRef(!1),x=f?u||!!f.closest("form"):!0,[b=!1,w]=Qo({prop:o,defaultProp:i,onChange:c}),S=g.useRef(b);return g.useEffect(()=>{const k=f==null?void 0:f.form;if(k){const C=()=>w(S.current);return k.addEventListener("reset",C),()=>k.removeEventListener("reset",C)}},[f,w]),p.jsxs(QV,{scope:n,state:b,disabled:a,children:[p.jsx(Ee.button,{type:"button",role:"checkbox","aria-checked":Ls(b)?"mixed":b,"aria-required":s,"data-state":SP(b),"data-disabled":a?"":void 0,disabled:a,value:l,...d,ref:m,onKeyDown:re(e.onKeyDown,k=>{k.key==="Enter"&&k.preventDefault()}),onClick:re(e.onClick,k=>{w(C=>Ls(C)?!0:!C),x&&(v.current=k.isPropagationStopped(),v.current||k.stopPropagation())})}),x&&p.jsx(t9,{control:f,bubbles:!v.current,name:r,value:l,checked:b,required:s,disabled:a,form:u,style:{transform:"translateX(-100%)"},defaultChecked:Ls(i)?!1:i})]})});xP.displayName=e1;var bP="CheckboxIndicator",wP=g.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=e9(bP,n);return p.jsx(Mn,{present:r||Ls(i.state)||i.state===!0,children:p.jsx(Ee.span,{"data-state":SP(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});wP.displayName=bP;var t9=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:o,...i}=e,s=g.useRef(null),a=vP(n),l=yP(t);g.useEffect(()=>{const u=s.current,d=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(d,"checked").set;if(a!==n&&h){const m=new Event("click",{bubbles:r});u.indeterminate=Ls(n),h.call(u,Ls(n)?!1:n),u.dispatchEvent(m)}},[a,n,r]);const c=g.useRef(Ls(n)?!1:n);return p.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o??c.current,...i,tabIndex:-1,ref:s,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Ls(e){return e==="indeterminate"}function SP(e){return Ls(e)?"indeterminate":e?"checked":"unchecked"}var kP=xP,n9=wP;const ru=g.forwardRef(({className:e,...t},n)=>{const[r,o]=g.useState();return g.useEffect(()=>{o(t.checked)},[t.checked]),p.jsx(kP,{ref:n,checked:r,onCheckedChange:i=>{o(i),t.onCheckedChange&&t.onCheckedChange(i)},className:qe("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:p.jsxs(n9,{className:qe("flex items-center justify-center text-current"),children:[r===!0&&p.jsx(ap,{className:"w-4 h-4"}),r==="indeterminate"&&p.jsx(A8,{className:"w-4 h-4"})]})})});ru.displayName=kP.displayName;function Dl(e,t){if(!t||t.length===0)return new Set([e.type]);const n=new Set;let r=e,o=-1;for(const i of t){if(o++,!r)break;if(r.type==="array")r=r.item;else if(r.type==="record")r=r.item;else if(r.type==="object")r=r.items[i];else if(r.type==="union")if(typeof r.key=="string"){const s=r.items;for(const a of s){const l=Dl(a,t.slice(o));for(const c of Array.from(l.values()))n.add(c)}return n}else{if(o!==t.length-1)throw new Error("Found string union (primitive), but path has more parts: "+t.join("/")+" at "+i);break}else if(r.type==="boolean"||r.type==="number"||r.type==="string"||r.type==="date"||r.type==="file"||r.type==="image"||r.type==="keyOf"||r.type==="literal"||r.type==="richtext"){if((r.type==="image"||r.type==="file")&&t[o]==="metadata")break;if(o!==t.length-1)throw new Error("Found "+r.type+" (primitive), but path has more parts: "+t.join("/")+" at "+i);break}else{const a=r.type;return console.error(`Unexecpted resolved schema type: ${a} in ${t.join("/")} at ${i}`),new Set([a])}}return r&&(n.add(r.type),r.type==="union"&&(typeof r.key=="string"?n.add("object"):n.add("string"))),n}class th{constructor(){this.patchSetMetadata={},this.orderedInsertKeys=[],this.insertedPatches=new Set}reset(){this.patchSetMetadata={},this.orderedInsertKeys=[],this.insertedPatches=new Set}insertPath(t,n,r,o,i,s,a,l){let c=n.length>0?`${t}?${n.join("/")}`:t;const u=[];for(let d=this.orderedInsertKeys.length-1;d>=0;d--){const f=this.orderedInsertKeys[d];c!==f?c.startsWith(f)?(c=f,this.orderedInsertKeys.splice(d,1),this.orderedInsertKeys.unshift(c)):f.startsWith(c)&&u.push(d):(this.orderedInsertKeys.splice(d,1),this.orderedInsertKeys.unshift(c))}for(const d of u){const f=this.orderedInsertKeys[d];this.orderedInsertKeys.splice(d,1);const h=this.patchSetMetadata[f];if(this.patchSetMetadata[c]||(this.patchSetMetadata[c]={moduleFilePath:t,patchPath:n,patches:[],authors:[],opTypes:[],schemaTypes:Array.from(a),lastUpdated:o,lastUpdatedBy:i}),h)for(const m of h.patches.slice())this.patchSetMetadata[c].patches.unshift(m),m.author!==null&&this.patchSetMetadata[c].authors.unshift(m.author),this.patchSetMetadata[c].opTypes.unshift(m.opType);else throw new Error(`Could not find patch set metadata or patch metadata for (inserted) patch set path: ${f}`);f!==c&&delete this.patchSetMetadata[f]}this.patchSetMetadata[c]||(this.patchSetMetadata[c]={moduleFilePath:t,patchPath:n,patches:[],authors:[],opTypes:[],schemaTypes:a,lastUpdated:o,lastUpdatedBy:i}),i!==null&&!this.patchSetMetadata[c].authors.includes(i)&&this.patchSetMetadata[c].authors.unshift(i),this.patchSetMetadata[c].lastUpdatedBy=i,this.patchSetMetadata[c].lastUpdated=o,this.patchSetMetadata[c].opTypes.includes(s)||this.patchSetMetadata[c].opTypes.unshift(s),this.patchSetMetadata[c].patches.unshift({patchPath:l,patchId:r,author:i,createdAt:o,opType:s,schemaTypes:a}),this.orderedInsertKeys.includes(c)||this.orderedInsertKeys.unshift(c)}insert(t,n,r,o,i,s){if(!this.insertedPatches.has(o)){if(!n){this.insertPath(t,[],o,i,s,r.op,[],r.path);return}if(this.insertedPatches.add(o),!(r.op==="file"||r.op==="test"))try{if(r.op==="replace"){const a=Dl(n,r.path);this.insertPath(t,r.path,o,i,s,r.op,Array.from(a),r.path)}else if(r.op==="add"||r.op==="remove"||r.op==="move"||r.op==="copy"){const a=r.path.slice(0,-1),l=Dl(n,a);if(l.size===1&&l.has("array")){if(this.insertPath(t,a,o,i,s,r.op,Array.from(l),r.path),r.op==="move"){const c=r.from.slice(0,-1),u=Dl(n,c);this.insertPath(t,c,o,i,s,r.op,Array.from(u),r.path)}}else if(l.size===1&&l.has("record")){const c=r.path,u=Dl(n,c);if(this.insertPath(t,c,o,i,s,r.op,Array.from(u),r.path),r.op==="move"){const d=r.from,f=Dl(n,d);this.insertPath(t,d,o,i,s,r.op,Array.from(f),r.path)}}else{if(l.size===1&&!(l.has("image")||l.has("file")))throw new Error(`Cannot perform op: '${r.op}' on non-array or non-record schema. Type: ${l.values().next().value}`);this.insertPath(t,a,o,i,s,r.op,[n.type],r.path)}}else{const a=r;throw new Error("Unreachable op: "+a)}}catch(a){a instanceof Error?console.error("Could not resolve path while creating patch set",a.message):console.error("Could not resolve path while creating patch set",a),this.insertPath(t,[],o,i,s,r.op,[n.type],r.path)}}}isInserted(t){return this.insertedPatches.has(t)}serialize(){return this.orderedInsertKeys.map(t=>{if(t in this.patchSetMetadata)return this.patchSetMetadata[t];throw new Error(`Could not find patch set metadata or patch metadata for (inserted) patch set path: ${t}`)})}}function FC(e,t){const n=new Date(t).getTime(),r=e.getTime(),o=Math.floor((r-n)/1e3),i=Math.floor(o/60),s=Math.floor(o/3600),a=Math.floor(o/86400),l=Math.floor(a/30);return o<60?"just now":i<60?`${i}m ago`:s<24?`${s}h ago`:a===1?"yesterday":a<30?`${a}d ago`:`${l}mo ago`}function r9({className:e,loadingStatus:t}){const{getPatches:n}=c8(),r=qw(),o=p8(),i=u8(),s=g.useRef(null),a=g.useRef(null),l=g.useRef([]),[c,u]=g.useState(null),[d,f]=g.useState({status:"not-asked"}),h=g.useRef(new Set);return g.useEffect(()=>{async function m(){s.current!==o&&(a.current=new th,h.current=new Set),s.current=o??null,a.current||(a.current=new th,h.current=new Set);for(const S of Array.from(h.current))if(!i.includes(S)){a.current=new th,h.current=new Set,l.current=[];break}const v=[];for(const S of i)h.current.has(S)||v.push(S);for(const S of Array.from(h.current.values()))if(!i.includes(S)){a.current=new th;break}if(i.length>0&&v.length===0)return;if(r.status==="error"){u(r.error);return}if(!("data"in r))return;const x=a.current,b=r.data;l.current=v,u(null);const w=await n(i.length===v.length?[]:v);if(!(l.current.length!==v.length||l.current.some((S,k)=>S!==v[k])||s.current!==o))if(w.status==="ok"){const S=w.data;for(const[k,C]of Object.entries(S)){const T=k;if(C)for(const _ of C.patch||[]){const O=C.path,M=b[O];h.current.add(T),x.insert(C.path,M,_,T,C.createdAt,C.authorId)}}f({status:"success",data:x.serialize()})}else u(w.error)}m().catch(v=>{u(v.message)})},[i,n,r,o]),p.jsxs("div",{className:Ue(e),children:[p.jsxs("div",{className:"sticky top-0 flex items-center justify-between p-4 rounded-t-3xl bg-bg-tertiary z-5",children:[p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx("span",{children:"Draft changes"}),(t==="loading"||t==="not-asked")&&p.jsx("span",{children:p.jsx(Oh,{size:16,className:"animate-spin"})})]}),p.jsxs("span",{children:[p.jsx("span",{children:"See all"}),p.jsx(ru,{checked:"indeterminate"})]})]}),c!==null&&p.jsx("div",{className:"p-4 bg-bg-tertiary text-text-error-primary",children:c}),p.jsx("div",{className:"flex flex-col gap-[2px]",children:"data"in d&&d.data.map(m=>p.jsx(i9,{patchSet:m},m.moduleFilePath+":"+m.patchPath.join("/")))})]})}function o9({moduleFilePath:e,patchMetadata:t}){const n=CP([t.opType],t.createdAt),{patchErrors:r,skippedPatches:o}=eu(),[i,s]=g.useMemo(()=>[r[t.patchId]||[],!!o[t.patchId]],[t.patchId,r[t.patchId],o[t.patchId]]);return p.jsx(b0,{path:e.split("/").map(Ic).slice(1).concat(t.patchPath),changeDescription:s?"Skipped":n,authors:[],isOpen:!0,errors:i,skipped:s})}function CP(e,t){const[n,r]=g.useState(new Date);if(g.useEffect(()=>{const s=setInterval(()=>{r(new Date)},6e4);return()=>{clearInterval(s)}},[]),e.length>1)return"Updated "+FC(n,t);const o=e[0];let i=o;return o==="add"?i="Added":o==="remove"?i="Removed":o==="replace"?i="Replaced":o==="move"?i="Moved":o==="copy"?i="Copied":o==="test"?i="Tested":o==="file"?i="Updated":console.warn("Unexpected op type: ",o),i+" "+FC(n,t)}function i9({patchSet:e}){const[t,n]=g.useState(!1),r=g.useRef(null),[o,i]=g.useState(!1);g.useEffect(()=>{const h=new IntersectionObserver(m=>{m[0].isIntersecting&&i(!0)},{threshold:0});return r.current&&h.observe(r.current),()=>{h.disconnect()}},[]);const{patchErrors:s,skippedPatches:a}=eu(),{deletePatches:l}=l8(),c=g.useMemo(()=>e.patches.map(h=>h.patchId),[e.patches]),u=g.useMemo(()=>{const h=[];for(const m of c)for(const v of s[m]||[])a[m]||h.unshift(v);return h},[c,s,a]),d=CP(e.opTypes,e.lastUpdated),f=h8();return o?p.jsxs(p.Fragment,{children:[p.jsx(b0,{path:e.moduleFilePath.split("/").map(Ic).slice(1).concat(e.patchPath),authors:e.authors.flatMap(h=>{var v;const m=f[h];if(m){const x=((v=m==null?void 0:m.avatar)==null?void 0:v.url)??null;return[{fullName:m.fullName,url:x}]}return[]}),changeDescription:d,isOpen:t,setOpen:n,errors:u,onDelete:()=>{l(c)}}),p.jsx(bf,{isOpen:t,children:e.patches.map((h,m)=>p.jsx(o9,{moduleFilePath:e.moduleFilePath,patchMetadata:h},e.moduleFilePath+":"+e.patchPath.join("/")+h.patchId+m))})]}):p.jsx(b0,{ref:r})}const b0=g.forwardRef(({path:e,changeDescription:t,authors:n,isOpen:r,setOpen:o,isSelected:i,setSelected:s,errors:a,skipped:l,onDelete:c},u)=>p.jsxs("div",{ref:u,className:Ue("p-6",{"bg-bg-secondary":!r,"bg-bg-quartenary":r}),children:[p.jsxs("div",{children:[p.jsx("span",{title:(e==null?void 0:e.join("/"))+"/",className:Ue("inline-block w-[calc(320px-24px-8px-16px-24px-48px)] truncate overflow-y-hidden h-6 mr-2 text-left",{"animate-pulse bg-bg-disabled rounded-3xl":e===void 0,"text-text-disabled":l}),dir:"rtl",children:e!==void 0&&e.join("/")+"/"}),i===void 0&&p.jsx("span",{className:Ue("inline-block w-6 h-6 rounded",{"bg-bg-disabled animate-pulse":e===void 0})}),i!==void 0&&p.jsx(ru,{checked:i,onCheckedChange:d=>{s&&s(d)}}),c&&p.jsx("button",{onClick:c,title:"Delete",className:"ml-2",children:p.jsx(HM,{size:16})})]}),a&&a.length>0&&!l&&p.jsxs("div",{className:"p-2 max-w-[240px] rounded bg-bg-error-primary text-text-primary",children:[a.slice(0,1).map((d,f)=>p.jsx("div",{title:d,className:"truncate",children:d},f)),a.length>1&&p.jsxs("div",{className:"truncate",children:["+",a.length-1," more"]})]}),(!a||a.length===0)&&l&&p.jsx("div",{className:"p-2 max-w-[240px] rounded bg-bg-error-primary text-text-primary",children:p.jsx("div",{className:"truncate",children:"Skipped"})}),p.jsxs("div",{className:"flex items-center justify-between pt-2",children:[p.jsxs("span",{className:"flex flex-shrink-0 gap-2",children:[n!==void 0&&n.length>0&&p.jsxs("span",{className:"flex gap-1 mr-2",children:[n.slice(0,2).map((d,f)=>{if(d.url)return p.jsx("img",{src:d.url,alt:d.fullName,title:d.fullName,className:Ue("flex-shrink-0 w-6 h-6 rounded-full",{"-ml-3":n.length>2&&f>0})},d.url);const h=s9(d.fullName);return p.jsx("span",{className:Ue("flex items-center justify-center w-6 h-6 text-xs font-semibold rounded-full bg-bg-quartenary text-fg-primary",{"-ml-3":n.length>2&&f>0}),"aria-label":"Initials for: "+d.fullName,title:d.fullName,children:h},d.fullName+d.url)}),n.length>2&&p.jsxs("span",{className:"flex items-center justify-center w-6 h-6 -ml-3 text-xs font-semibold rounded-full bg-bg-quartenary text-fg-primary",children:["+",2]})]}),n===void 0&&p.jsx("span",{className:Ue("inline-block w-6 h-6 mr-2",{"bg-bg-disabled animate-pulse rounded-3xl":n===void 0})}),t&&p.jsx("span",{className:Ue({"text-text-disabled":l}),children:t})]}),r!==void 0&&p.jsx("button",{className:"flex-shrink-0 inline-block",onClick:()=>{o&&o(!r)},children:p.jsx(lp,{size:16,className:Ue("transform",{"rotate-180":r})})})]})]}));function s9(e){return!e||typeof e!="string"?"":e.trim().normalize("NFC").split(/\s+/).filter(r=>r.length>0).map(r=>/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u.test(r)?r[0]:r[0].toLocaleUpperCase()).join("")}function t1(e){return e instanceof Error&&e.name==="ZodError"&&"issues"in e&&Array.isArray(e.issues)}var w0=class extends Error{constructor(n,r){super(n,r);Et(this,"name");Et(this,"details");this.name="ZodValidationError",this.details=a9(r)}toString(){return this.message}};function a9(e){if(e){const t=e.cause;if(t1(t))return t.issues}return[]}function EP(e){return e.length!==0}var l9=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function c9(e){return e.length===1?e[0].toString():e.reduce((t,n)=>{if(typeof n=="number")return t+"["+n.toString()+"]";if(n.includes('"'))return t+'["'+u9(n)+'"]';if(!l9.test(n))return t+'["'+n+'"]';const r=t.length===0?"":".";return t+r+n},"")}function u9(e){return e.replace(/"/g,'\\"')}var d9="; ",f9=99,_P="Validation error",p9=": ",h9=", or ";function m9(e={}){const{issueSeparator:t=d9,unionSeparator:n=h9,prefixSeparator:r=p9,prefix:o=_P,includePath:i=!0,maxIssuesInMessage:s=f9}=e;return a=>{const l=a.slice(0,s).map(c=>Nh({issue:c,issueSeparator:t,unionSeparator:n,includePath:i})).join(t);return g9(l,o,r)}}function Nh(e){const{issue:t,issueSeparator:n,unionSeparator:r,includePath:o}=e;if(t.code===V.invalid_union)return t.unionErrors.reduce((i,s)=>{const a=s.issues.map(l=>Nh({issue:l,issueSeparator:n,unionSeparator:r,includePath:o})).join(n);return i.includes(a)||i.push(a),i},[]).join(r);if(t.code===V.invalid_arguments)return[t.message,...t.argumentsError.issues.map(i=>Nh({issue:i,issueSeparator:n,unionSeparator:r,includePath:o}))].join(n);if(t.code===V.invalid_return_type)return[t.message,...t.returnTypeError.issues.map(i=>Nh({issue:i,issueSeparator:n,unionSeparator:r,includePath:o}))].join(n);if(o&&EP(t.path)){if(t.path.length===1){const i=t.path[0];if(typeof i=="number")return`${t.message} at index ${i}`}return`${t.message} at "${c9(t.path)}"`}return t.message}function g9(e,t,n){return t!==null?e.length>0?[t,e].join(n):t:e.length>0?e:_P}function zC(e,t={}){if(!t1(e))throw new TypeError(`Invalid zodError param; expected instance of ZodError. Did you mean to use the "${x9.name}" method instead?`);return TP(e,t)}function TP(e,t={}){const n=e.errors;let r;return EP(n)?r=v9(t)(n):r=e.message,new w0(r,{cause:e})}function v9(e){return"messageBuilder"in e?e.messageBuilder:m9(e)}var y9=(e={})=>t=>t1(t)?TP(t,e):t instanceof Error?new w0(t.message,{cause:t}):new w0("Unknown error");function x9(e,t={}){return y9(t)(e)}function b9(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function w9(e){var t=b9(e,"string");return typeof t=="symbol"?t:t+""}function ot(e,t,n){return(t=w9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $C(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function S0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$C(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$C(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function k0(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function n1(e,t){if(e){if(typeof e=="string")return k0(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?k0(e,t):void 0}}function r1(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=n1(e))||t){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(l){throw l},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
258
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return s=l.done,l},e:function(l){a=!0,i=l},f:function(){try{s||n.return==null||n.return()}finally{if(a)throw i}}}}function S9(e,t){var n={},r=[],o=0,i=r1((e==null?void 0:e.content)||[]),s;try{for(i.s();!(s=i.n()).done;){var a=s.value,l=k9([(o++).toString()],a,n,t);r.push(l)}}catch(c){i.e(c)}finally{i.f()}return{blocks:r,files:n}}function k9(e,t,n,r){if(t.type==="heading"){var o,i,s=((o=t.attrs)===null||o===void 0?void 0:o.level)||1;if(Number.isNaN(s))throw new Error("Invalid header depth");return{tag:"h".concat(s),children:((i=t.content)===null||i===void 0?void 0:i.map(function(l,c){return C9(e.concat("children",c.toString()),l,n,r)}))||[]}}else{if(t.type==="paragraph")return OP(e,t,n,r);if(t.type==="bulletList")return PP(e,t,n,r);if(t.type==="orderedList")return RP(e,t,n,r);var a=t;throw new Error("Unhandled node type: ".concat("type"in a?"exhaustiveCheck.type":"unknown"))}}function C9(e,t,n,r){if(t.type==="text")return NP(t);if(t.type==="hardBreak")return{tag:"br"};if(t.type==="image")return jP(e,t,n,r);var o=t;throw new Error("Unexpected heading child type: ".concat(JSON.stringify(o,null,2)))}function OP(e,t,n,r){var o;return{tag:"p",children:((o=t.content)===null||o===void 0?void 0:o.map(function(i,s){if(i.type==="text")return NP(i);if(i.type==="hardBreak")return{tag:"br"};if(i.type==="image")return jP(e.concat("children",s.toString()),i,n,r);var a=i;throw new Error("Unexpected paragraph child type: ".concat(JSON.stringify(a,null,2)))}))||[]}}function NP(e){if(e.type==="text"){var t,n,r=((t=e.marks)===null||t===void 0?void 0:t.flatMap(function(a){return a.type!=="link"?a.type==="strike"?["line-through"]:[a.type]:[]}))||[];if((n=e.marks)!==null&&n!==void 0&&n.some(function(a){return a.type==="link"})){var o;if(r.length>0){var i;return{tag:"a",href:((i=e.marks.find(function(a){return a.type==="link"}))===null||i===void 0?void 0:i.attrs.href)||"",children:[{tag:"span",styles:r,children:[e.text]}]}}return{tag:"a",href:((o=e.marks.find(function(a){return a.type==="link"}))===null||o===void 0?void 0:o.attrs.href)||"",children:[e.text]}}return r.length>0?{tag:"span",styles:r,children:[e.text]}:e.text}else{var s=e.type;throw new Error("Unexpected node type: ".concat(s))}}function MP(e,t,n,r){var o;return{tag:"li",children:((o=t.content)===null||o===void 0?void 0:o.map(function(i,s){if(i.type==="paragraph")return OP(e.concat("children",s.toString()),i,n,r);if(i.type==="bulletList")return PP(e.concat("children",s.toString()),i,n,r);if(i.type==="orderedList")return RP(e.concat("children",s.toString()),i,n,r);var a=i;throw new Error("Unexpected list child type: ".concat(a))}))||[]}}function PP(e,t,n,r){var o;return{tag:"ul",children:((o=t.content)===null||o===void 0?void 0:o.map(function(i,s){if(i.type==="listItem")return MP(e.concat("children",s.toString()),i,n,r);var a=i.type;throw new Error("Unexpected bullet list child type: ".concat(a))}))||[]}}function RP(e,t,n,r){var o;return{tag:"ol",children:((o=t.content)===null||o===void 0?void 0:o.map(function(i,s){if(i.type==="listItem")return MP(e.concat("children",s.toString()),i,n,r);var a=i.type;throw new Error("Unexpected ordered list child type: ".concat(a))}))||[]}}var E9=new TextEncoder;function jP(e,t,n,r){if(t.attrs&&t.attrs.src.startsWith("data:")){var o=ue.getSHA256Hash(E9.encode(t.attrs.src)),i=ue.getMimeType(t.attrs.src);if(i===void 0)throw new Error("Could not detect Mime Type for image: ".concat(t.attrs.src));var s=ue.createFilename(t.attrs.src,t.attrs.fileName||"",{width:typeof t.attrs.width=="number"?t.attrs.width:0,height:typeof t.attrs.height=="number"?t.attrs.height:0,mimeType:i},o),a=r!=null&&r.endsWith("/")?r:"".concat(r,"/"),l="".concat(a).concat(s),c=n[l],u=e.concat("src");return c?c.patchPaths.push(u):n[l]={value:t.attrs.src,patchPaths:[u]},{tag:"img",src:ot(ot(ot(ot({},Xn,"file"),St,l),l0,"image"),"metadata",{width:typeof t.attrs.width=="number"?t.attrs.width:0,height:typeof t.attrs.height=="number"?t.attrs.height:0,mimeType:i})}}else if(t.attrs){var d=t.attrs.src,f=_9("patch_id",d),h=d.split("?")[0];f?h.startsWith("/api/val/files/public")?h=h.slice(14):console.error("Patched image URL does not start with /api/val/files: "+d):h.startsWith("/public")?console.error("Unpatched image URL starts with /public: "+d):h="/public".concat(h);var m={tag:"img",src:S0(ot(ot(ot(ot({},Xn,"file"),St,h),l0,"image"),"metadata",{width:typeof t.attrs.width=="number"?t.attrs.width:0,height:typeof t.attrs.height=="number"?t.attrs.height:0,mimeType:h&&ue.filenameToMimeType(h)||""}),f?{patch_id:f}:{})};return m}else throw new Error("Invalid image node (no attrs): "+JSON.stringify(t))}function _9(e,t){var n=t.split("?");if(!(n.length<2)){var r=n[1],o=new URLSearchParams(r);if(o.has(e))return o.get(e)}}var AP=y.object({type:y.union([y.literal("bold"),y.literal("strike"),y.literal("italic")])}),T9=y.object({type:y.literal("link"),attrs:y.object({href:y.string(),target:y.union([y.literal("_blank"),y.null()]),auto:y.boolean()})}),IP=y.intersection(y.object({type:y.literal("text"),text:y.string()}),y.object({marks:y.array(y.union([AP,T9]))}).partial()),DP=y.intersection(y.object({type:y.literal("hardBreak")}),y.object({marks:y.array(AP)}).partial()),LP=y.intersection(y.object({type:y.literal("image")}),y.object({attrs:y.intersection(y.object({src:y.string()}),y.object({align:y.union([y.literal("center"),y.literal("end"),y.literal("justify"),y.literal("left"),y.literal("match-parent"),y.literal("right"),y.literal("start"),y.null()]),alt:y.union([y.string(),y.null()]),height:y.union([y.string(),y.number(),y.null()]),width:y.union([y.string(),y.number(),y.null()]),rotate:y.union([y.string(),y.null()]),title:y.union([y.string(),y.null()]),fileName:y.union([y.string(),y.null()])}).partial())}).partial()),O9=y.intersection(y.object({type:y.literal("heading")}),y.object({attrs:y.object({level:y.number()}),content:y.array(y.union([IP,LP,DP]))}).partial()),FP=y.lazy(function(){return y.intersection(y.object({type:y.literal("bulletList")}),y.object({content:y.array($P)}).partial())}),zP=y.lazy(function(){return y.intersection(y.object({type:y.literal("orderedList")}),y.object({content:y.array($P)}).partial())}),$P=y.lazy(function(){return y.intersection(y.object({type:y.literal("listItem")}),y.object({attrs:y.object({closed:y.boolean(),nested:y.boolean()}).partial().optional(),content:y.array(y.union([BP,FP,zP]))}).partial())}),BP=y.lazy(function(){return y.intersection(y.object({type:y.literal("paragraph")}),y.object({content:y.array(y.union([IP,LP,DP]))}).partial())});y.object({type:y.literal("doc"),content:y.array(y.union([BP,O9,FP,zP]))});function N9(e){if(Array.isArray(e))return k0(e)}function M9(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function P9(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
259
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function R9(e){return N9(e)||M9(e)||n1(e)||P9()}function j9(e){return{type:"doc",content:e.map(function(t){return A9(t)})}}function A9(e){switch(e.tag){case"h1":return _l(1,e.children);case"h2":return _l(2,e.children);case"h3":return _l(3,e.children);case"h4":return _l(4,e.children);case"h5":return _l(5,e.children);case"h6":return _l(6,e.children);case"p":return WP(e.children);case"ul":return GP(e);case"ol":return YP(e);default:{var t=e;throw Error("Unexpected child node: "+JSON.stringify(t))}}}function _l(e,t){return{type:"heading",attrs:{level:e},content:t.flatMap(VP)}}function Gg(e){return{type:"text",text:e}}function VP(e){return typeof e=="string"?[Gg(e)]:e.tag==="img"?[qP(e)]:e.tag==="br"?[HP()]:e.tag==="a"?KP(e):UP(e)}function UP(e){if(e.styles.length===0&&e.children.length===1){if(typeof e.children[0]=="string")return[Gg(e.children[0])];throw Error("Unexpected amount of children in span node: "+JSON.stringify(e,null,2))}var t=Array.from(new Set(e.styles));return e.children.map(function(n){return{type:"text",text:n,marks:t.map(function(r){switch(r){case"bold":return{type:"bold"};case"italic":return{type:"italic"};case"line-through":return{type:"strike"};default:{var o=r;throw Error("Unexpected span class: "+o)}}})}})}function WP(e){return{type:"paragraph",content:e.flatMap(function(t){if(typeof t=="string")return[Gg(t)];switch(t.tag){case"span":return UP(t);case"a":return KP(t);case"img":return[qP(t)];case"br":return[HP()];default:{var n=t;throw Error("Unexpected paragraph child: "+JSON.stringify(n))}}})}}function HP(){return{type:"hardBreak",marks:[]}}function KP(e){return e.children.flatMap(VP).map(function(t){return t.type!=="text"?t:S0(S0({},t),{},{marks:(t.marks||[]).concat({type:"link",attrs:{href:e.href,auto:!1,target:null}})})})}function qP(e){var t,n,r=e.src;if(!(Xn in r)||r[Xn]!=="file")throw Error("Expected file source in image node");var o=ue.convertFileSource(r);return{type:"image",attrs:{height:(t=r.metadata)===null||t===void 0?void 0:t.height,width:(n=r.metadata)===null||n===void 0?void 0:n.width,src:o.url}}}function GP(e){return{type:"bulletList",content:e.children.map(JP)}}function YP(e){return{type:"orderedList",content:e.children.map(JP)}}function JP(e){return{type:"listItem",content:I9(e.children)}}function I9(e){var t=[],n=r1(e),r;try{for(n.s();!(r=n.n()).done;){var o=r.value,i=t[t.length-1];i||(i={type:"paragraph",content:[]},t.push(i));var s=i.content;if(typeof o=="string")s.push(Gg(o));else switch(o.tag){case"ol":{t.push(YP(o));break}case"ul":{t.push(GP(o));break}case"p":{var a=WP(o.children);i.type==="paragraph"&&a.type==="paragraph"?a.content&&s.push.apply(s,R9(a.content)):t.push(a);break}default:{var l=o;throw Error("Unexpected list item child: "+JSON.stringify(l))}}}}catch(c){n.e(c)}finally{n.f()}return t}var xa=ue.VAL_SESSION_COOKIE,Du=ue.VAL_STATE_COOKIE,Lu=ue.VAL_ENABLE_COOKIE_NAME;function Yu(){Yu=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(R,N,E){R[N]=E.value},i=typeof Symbol=="function"?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(R,N,E){return Object.defineProperty(R,N,{value:E,enumerable:!0,configurable:!0,writable:!0}),R[N]}try{c({},"")}catch{c=function(N,E,A){return N[E]=A}}function u(R,N,E,A){var P=N&&N.prototype instanceof b?N:b,I=Object.create(P.prototype),U=new z(A||[]);return o(I,"_invoke",{value:j(R,E,U)}),I}function d(R,N,E){try{return{type:"normal",arg:R.call(N,E)}}catch(A){return{type:"throw",arg:A}}}t.wrap=u;var f="suspendedStart",h="suspendedYield",m="executing",v="completed",x={};function b(){}function w(){}function S(){}var k={};c(k,s,function(){return this});var C=Object.getPrototypeOf,T=C&&C(C(H([])));T&&T!==n&&r.call(T,s)&&(k=T);var _=S.prototype=b.prototype=Object.create(k);function O(R){["next","throw","return"].forEach(function(N){c(R,N,function(E){return this._invoke(N,E)})})}function M(R,N){function E(P,I,U,me){var ee=d(R[P],R,I);if(ee.type!=="throw"){var ve=ee.arg,q=ve.value;return q&&typeof q=="object"&&r.call(q,"__await")?N.resolve(q.__await).then(function($){E("next",$,U,me)},function($){E("throw",$,U,me)}):N.resolve(q).then(function($){ve.value=$,U(ve)},function($){return E("throw",$,U,me)})}me(ee.arg)}var A;o(this,"_invoke",{value:function(P,I){function U(){return new N(function(me,ee){E(P,I,me,ee)})}return A=A?A.then(U,U):U()}})}function j(R,N,E){var A=f;return function(P,I){if(A===m)throw Error("Generator is already running");if(A===v){if(P==="throw")throw I;return{value:e,done:!0}}for(E.method=P,E.arg=I;;){var U=E.delegate;if(U){var me=L(U,E);if(me){if(me===x)continue;return me}}if(E.method==="next")E.sent=E._sent=E.arg;else if(E.method==="throw"){if(A===f)throw A=v,E.arg;E.dispatchException(E.arg)}else E.method==="return"&&E.abrupt("return",E.arg);A=m;var ee=d(R,N,E);if(ee.type==="normal"){if(A=E.done?v:h,ee.arg===x)continue;return{value:ee.arg,done:E.done}}ee.type==="throw"&&(A=v,E.method="throw",E.arg=ee.arg)}}}function L(R,N){var E=N.method,A=R.iterator[E];if(A===e)return N.delegate=null,E==="throw"&&R.iterator.return&&(N.method="return",N.arg=e,L(R,N),N.method==="throw")||E!=="return"&&(N.method="throw",N.arg=new TypeError("The iterator does not provide a '"+E+"' method")),x;var P=d(A,R.iterator,N.arg);if(P.type==="throw")return N.method="throw",N.arg=P.arg,N.delegate=null,x;var I=P.arg;return I?I.done?(N[R.resultName]=I.value,N.next=R.nextLoc,N.method!=="return"&&(N.method="next",N.arg=e),N.delegate=null,x):I:(N.method="throw",N.arg=new TypeError("iterator result is not an object"),N.delegate=null,x)}function B(R){var N={tryLoc:R[0]};1 in R&&(N.catchLoc=R[1]),2 in R&&(N.finallyLoc=R[2],N.afterLoc=R[3]),this.tryEntries.push(N)}function J(R){var N=R.completion||{};N.type="normal",delete N.arg,R.completion=N}function z(R){this.tryEntries=[{tryLoc:"root"}],R.forEach(B,this),this.reset(!0)}function H(R){if(R||R===""){var N=R[s];if(N)return N.call(R);if(typeof R.next=="function")return R;if(!isNaN(R.length)){var E=-1,A=function P(){for(;++E<R.length;)if(r.call(R,E))return P.value=R[E],P.done=!1,P;return P.value=e,P.done=!0,P};return A.next=A}}throw new TypeError(typeof R+" is not iterable")}return w.prototype=S,o(_,"constructor",{value:S,configurable:!0}),o(S,"constructor",{value:w,configurable:!0}),w.displayName=c(S,l,"GeneratorFunction"),t.isGeneratorFunction=function(R){var N=typeof R=="function"&&R.constructor;return!!N&&(N===w||(N.displayName||N.name)==="GeneratorFunction")},t.mark=function(R){return Object.setPrototypeOf?Object.setPrototypeOf(R,S):(R.__proto__=S,c(R,l,"GeneratorFunction")),R.prototype=Object.create(_),R},t.awrap=function(R){return{__await:R}},O(M.prototype),c(M.prototype,a,function(){return this}),t.AsyncIterator=M,t.async=function(R,N,E,A,P){P===void 0&&(P=Promise);var I=new M(u(R,N,E,A),P);return t.isGeneratorFunction(N)?I:I.next().then(function(U){return U.done?U.value:I.next()})},O(_),c(_,l,"Generator"),c(_,s,function(){return this}),c(_,"toString",function(){return"[object Generator]"}),t.keys=function(R){var N=Object(R),E=[];for(var A in N)E.push(A);return E.reverse(),function P(){for(;E.length;){var I=E.pop();if(I in N)return P.value=I,P.done=!1,P}return P.done=!0,P}},t.values=H,z.prototype={constructor:z,reset:function(R){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(J),!R)for(var N in this)N.charAt(0)==="t"&&r.call(this,N)&&!isNaN(+N.slice(1))&&(this[N]=e)},stop:function(){this.done=!0;var R=this.tryEntries[0].completion;if(R.type==="throw")throw R.arg;return this.rval},dispatchException:function(R){if(this.done)throw R;var N=this;function E(ee,ve){return I.type="throw",I.arg=R,N.next=ee,ve&&(N.method="next",N.arg=e),!!ve}for(var A=this.tryEntries.length-1;A>=0;--A){var P=this.tryEntries[A],I=P.completion;if(P.tryLoc==="root")return E("end");if(P.tryLoc<=this.prev){var U=r.call(P,"catchLoc"),me=r.call(P,"finallyLoc");if(U&&me){if(this.prev<P.catchLoc)return E(P.catchLoc,!0);if(this.prev<P.finallyLoc)return E(P.finallyLoc)}else if(U){if(this.prev<P.catchLoc)return E(P.catchLoc,!0)}else{if(!me)throw Error("try statement without catch or finally");if(this.prev<P.finallyLoc)return E(P.finallyLoc)}}}},abrupt:function(R,N){for(var E=this.tryEntries.length-1;E>=0;--E){var A=this.tryEntries[E];if(A.tryLoc<=this.prev&&r.call(A,"finallyLoc")&&this.prev<A.finallyLoc){var P=A;break}}P&&(R==="break"||R==="continue")&&P.tryLoc<=N&&N<=P.finallyLoc&&(P=null);var I=P?P.completion:{};return I.type=R,I.arg=N,P?(this.method="next",this.next=P.finallyLoc,x):this.complete(I)},complete:function(R,N){if(R.type==="throw")throw R.arg;return R.type==="break"||R.type==="continue"?this.next=R.arg:R.type==="return"?(this.rval=this.arg=R.arg,this.method="return",this.next="end"):R.type==="normal"&&N&&(this.next=N),x},finish:function(R){for(var N=this.tryEntries.length-1;N>=0;--N){var E=this.tryEntries[N];if(E.finallyLoc===R)return this.complete(E.completion,E.afterLoc),J(E),x}},catch:function(R){for(var N=this.tryEntries.length-1;N>=0;--N){var E=this.tryEntries[N];if(E.tryLoc===R){var A=E.completion;if(A.type==="throw"){var P=A.arg;J(E)}return P}}throw Error("illegal catch attempt")},delegateYield:function(R,N,E){return this.delegate={iterator:H(R),resultName:N,nextLoc:E},this.method==="next"&&(this.arg=e),x}},t}function BC(e,t,n,r,o,i,s){try{var a=e[i](s),l=a.value}catch(c){return void n(c)}a.done?t(l):Promise.resolve(l).then(r,o)}function VC(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(l){BC(i,r,o,s,a,"next",l)}function a(l){BC(i,r,o,s,a,"throw",l)}s(void 0)})}}var Fs=y.lazy(function(){return y.union([y.string(),y.number(),y.boolean(),y.null(),y.array(Fs),y.record(Fs)])}),D9=y.discriminatedUnion("op",[y.object({op:y.literal("add"),path:y.string(),value:Fs}).strict(),y.object({op:y.literal("remove"),path:y.string()}).strict(),y.object({op:y.literal("replace"),path:y.string(),value:Fs}).strict(),y.object({op:y.literal("move"),from:y.string(),path:y.string()}).strict(),y.object({op:y.literal("copy"),from:y.string(),path:y.string()}).strict(),y.object({op:y.literal("test"),path:y.string(),value:Fs}).strict(),y.object({op:y.literal("file"),path:y.string(),filePath:y.string(),value:y.string()}).strict()]);y.array(D9);var L9=y.discriminatedUnion("op",[y.object({op:y.literal("add"),path:y.array(y.string()),value:Fs}).strict(),y.object({op:y.literal("remove"),path:y.array(y.string()).nonempty()}).strict(),y.object({op:y.literal("replace"),path:y.array(y.string()),value:Fs}).strict(),y.object({op:y.literal("move"),from:y.array(y.string()).nonempty(),path:y.array(y.string())}).strict(),y.object({op:y.literal("copy"),from:y.array(y.string()),path:y.array(y.string())}).strict(),y.object({op:y.literal("test"),path:y.array(y.string()),value:Fs}).strict(),y.object({op:y.literal("file"),path:y.array(y.string()),filePath:y.string(),nestedFilePath:y.array(y.string()).optional(),value:y.string()}).strict()]),C0=y.array(L9),an=y.string().refine(function(e){return!0}),F9=y.union([y.object({type:y.literal("head"),headBaseSha:y.string()}),y.object({type:y.literal("patch"),patchId:an})]);y.object({patch:C0,parentRef:F9});var XP=y.string().transform(function(e){return e}),z9=y.object({type:y.literal("string"),options:y.object({maxLength:y.number().optional(),minLength:y.number().optional(),regexp:y.object({source:y.string(),flags:y.string()}).optional()}).optional(),opt:y.boolean(),raw:y.boolean()}),E0=y.object({type:y.literal("literal"),value:y.string(),opt:y.boolean()}),$9=y.object({type:y.literal("boolean"),opt:y.boolean()}),B9=y.object({type:y.literal("number"),options:y.object({max:y.number().optional(),min:y.number().optional()}).optional(),opt:y.boolean()}),ZP=y.lazy(function(){return y.object({type:y.literal("object"),items:y.record(up),opt:y.boolean()})}),V9=y.lazy(function(){return y.object({type:y.literal("array"),item:up,opt:y.boolean()})}),U9=y.lazy(function(){return y.union([y.object({type:y.literal("union"),key:E0,items:y.array(E0),opt:y.boolean()}),y.object({type:y.literal("union"),key:y.string(),items:y.array(ZP),opt:y.boolean()})])}),W9=y.object({style:y.object({bold:y.boolean().optional(),italic:y.boolean().optional(),lineThrough:y.boolean().optional()}).optional(),block:y.object({h1:y.boolean().optional(),h2:y.boolean().optional(),h3:y.boolean().optional(),h4:y.boolean().optional(),h5:y.boolean().optional(),h6:y.boolean().optional(),ul:y.boolean().optional(),ol:y.boolean().optional()}).optional(),inline:y.object({a:y.boolean().optional(),img:y.boolean().optional()}).optional()}),H9=y.object({type:y.literal("richtext"),options:W9.optional(),opt:y.boolean()}),K9=y.lazy(function(){return y.object({type:y.literal("record"),item:up,opt:y.boolean()})}),q9=y.lazy(function(){return y.object({type:y.literal("keyOf"),path:XP,schema:up,values:y.union([y.literal("string"),y.array(y.string())]),opt:y.boolean()})}),G9=y.object({accept:y.string().optional()}),Y9=y.object({type:y.literal("file"),options:G9.optional(),opt:y.boolean()}),J9=y.object({type:y.literal("date"),opt:y.boolean()}),X9=y.object({ext:y.union([y.tuple([y.literal("jpg")]),y.tuple([y.literal("webp")])]).optional(),directory:y.string().optional(),prefix:y.string().optional(),accept:y.string().optional()}),Z9=y.object({type:y.literal("image"),options:X9.optional(),opt:y.boolean()}),up=y.union([z9,E0,$9,B9,ZP,V9,U9,H9,K9,q9,Y9,J9,Z9]),rs=y.string().refine(function(e){return!0}),UC=y.union([y.object({type:y.literal("head"),headBaseSha:y.string()}),y.object({type:y.literal("patch"),patchId:an})]),WC=y.object({project:y.string().optional(),root:y.string().optional(),files:y.object({directory:y.string()}).optional(),gitCommit:y.string().optional(),gitBranch:y.string().optional()}),Q9=y.union([y.literal("image:change-extension"),y.literal("image:add-metadata"),y.literal("image:check-metadata"),y.literal("file:change-extension"),y.literal("file:add-metadata"),y.literal("file:check-metadata")]),eU=y.object({message:y.string(),value:y.unknown().optional(),fatal:y.boolean().optional(),fixes:y.array(Q9).optional()}),ba=y.object({status:y.literal(401),json:y.object({message:y.string()})}),tU=y.object({status:y.literal(404),json:y.object({message:y.string()})}),Kt=y.object({message:y.string()}),HC=y.union([y.object({patchId:an,message:y.string()}),y.object({parentPatchId:y.string(),message:y.string()})]),My=y.object({message:y.string(),path:rs.optional()});y.union([y.literal("val_session"),y.literal("val_enable"),y.literal("val_state")]);var nh=y.object({value:y.literal("true"),options:y.object({httpOnly:y.literal(!1),sameSite:y.literal("lax")})}),nU={"/draft/enable":{GET:{req:{query:{redirect_to:y.string().optional()},cookies:ot({},xa,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Kt}),y.object({status:y.literal(302),redirectTo:y.string()}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/draft/disable":{GET:{req:{query:{redirect_to:y.string().optional()},cookies:ot({},xa,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Kt}),y.object({status:y.literal(302),redirectTo:y.string()}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/draft/stat":{GET:{req:{cookies:ot({},xa,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Kt}),y.object({status:y.literal(200),json:y.object({draftMode:y.boolean()})})])}},"/enable":{GET:{req:{query:{redirect_to:y.string().optional()},cookies:ot({},xa,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Kt}),y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ot(ot({},Lu,nh),Du,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("lax"),expires:y.instanceof(Date)})})))}),y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ot({},Lu,nh))}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/disable":{GET:{req:{query:{redirect_to:y.string().optional()},cookies:ot({},xa,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Kt}),y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ot({},Lu,y.object({value:y.literal("false")})))}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/authorize":{GET:{req:{query:{redirect_to:y.string().optional()}},res:y.union([y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ot(ot({},Lu,nh),Du,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("lax"),expires:y.instanceof(Date)})})))}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/callback":{GET:{req:{query:{code:y.string().optional(),state:y.string().optional()},cookies:ot({},Du,y.string())},res:y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ot(ot(ot({},Du,y.object({value:y.literal(null)})),Lu,nh.optional()),xa,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("strict"),path:y.string(),secure:y.literal(!0),expires:y.instanceof(Date)}).optional()}).optional()))})}},"/session":{GET:{req:{cookies:{val_session:y.string().optional()}},res:y.union([y.object({status:y.literal(200),json:y.object({mode:y.union([y.literal("local"),y.literal("proxy")]),enabled:y.boolean()})}),y.object({status:y.union([y.literal(400),y.literal(401),y.literal(403),y.literal(404),y.literal(500),y.literal(501)]),json:y.object({message:y.string()})}),y.object({status:y.literal(401),json:y.object({message:y.string(),details:y.union([y.string(),y.object({reason:y.string()}),y.object({sub:y.string(),exp:y.number(),token:y.string(),org:y.string(),project:y.string()})])})}),y.object({status:y.literal(500),json:y.object({message:y.string()})})])}},"/logout":{GET:{req:{},res:y.object({status:y.literal(200),cookies:y.object(ot(ot({},xa,y.object({value:y.literal(null)})),Du,y.object({value:y.literal(null)})))})}},"/stat":{POST:{req:{body:y.object({schemaSha:y.string(),baseSha:y.string(),patches:y.array(y.string()).optional()}).nullable(),cookies:{val_session:y.string().optional()}},res:y.union([y.object({status:y.literal(401),json:Kt}),y.object({status:y.literal(500),json:Kt}),y.object({status:y.literal(200),json:y.union([y.object({type:y.union([y.literal("request-again"),y.literal("no-change"),y.literal("did-change")]),baseSha:y.string(),schemaSha:y.string(),patches:y.array(an),config:WC}),y.object({type:y.literal("use-websocket"),url:y.string(),nonce:y.string(),baseSha:y.string(),schemaSha:y.string(),commitSha:y.string(),patches:y.array(an),config:WC})])})])}},"/patches":{DELETE:{req:{query:{id:y.array(an)},cookies:{val_session:y.string().optional()}},res:y.union([ba,y.object({status:y.literal(500),json:y.object({message:y.string(),errors:y.array(HC)})}),y.object({status:y.literal(200),json:y.array(an)})])},PUT:{req:{body:y.object({parentRef:UC,patches:y.array(y.object({path:rs,patch:C0}))}),cookies:{val_session:y.string().optional()}},res:y.union([ba,y.object({status:y.literal(409),json:y.object({type:y.literal("patch-head-conflict"),message:y.string()})}),y.object({status:y.literal(400),json:y.object({type:y.literal("patch-error"),message:y.string(),errors:y.record(rs,y.array(y.object({error:Kt})))})}),y.object({status:y.literal(200),json:y.object({newPatchIds:y.array(an),parentRef:UC})})])},GET:{req:{query:{author:y.array(y.string()).optional(),patch_id:y.array(an).optional(),module_file_path:y.array(rs).optional(),omit_patch:y.boolean().optional()},cookies:{val_session:y.string().optional()}},res:y.union([ba,y.object({status:y.literal(500),json:y.object({message:y.string(),patchErrors:y.array(HC)})}),y.object({status:y.literal(500),json:y.object({message:y.string(),error:Kt})}),y.object({status:y.literal(200),json:y.object({patches:y.array(y.object({path:rs,patch:C0.optional(),patchId:an,createdAt:y.string(),authorId:y.string().nullable(),appliedAt:y.object({baseSha:y.string(),git:y.object({commitSha:y.string()}).optional(),timestamp:y.string()}).nullable()})),baseSha:y.string(),error:Kt.optional(),errors:y.record(an,Kt).optional()})})])}},"/schema":{GET:{req:{cookies:{val_session:y.string().optional()}},res:y.union([ba,y.object({status:y.literal(500),json:y.object({message:y.string(),details:y.array(My)})}),y.object({status:y.literal(500),json:y.object({message:y.string(),details:y.array(Kt)})}),y.object({status:y.literal(200),json:y.object({schemaSha:y.string(),schemas:y.record(rs,up)})})])}},"/sources/~":{PUT:{req:{path:y.string().optional(),body:y.object({patchIds:y.array(an).optional()}).optional(),query:{validate_all:y.boolean().optional(),validate_sources:y.boolean().optional(),validate_binary_files:y.boolean().optional()},cookies:{val_session:y.string().optional()}},res:y.union([ba,y.object({status:y.literal(401),json:Kt}),y.object({status:y.literal(500),json:y.object({message:y.string(),details:y.union([y.array(My),Kt])})}),y.object({status:y.literal(409),json:y.object({message:y.string()})}),y.object({status:y.literal(400),json:y.object({message:y.string(),details:y.array(My)})}),y.object({status:y.literal(200),json:y.object({schemaSha:y.string(),modules:y.record(rs,y.object({source:y.any(),patches:y.object({applied:y.array(an),skipped:y.array(an).optional(),errors:y.record(an,Kt).optional()}).optional(),validationErrors:y.record(XP,y.array(eU)).optional()}))})})])}},"/profiles":{GET:{req:{cookies:{val_session:y.string().optional()}},res:y.object({status:y.literal(200),json:y.object({profiles:y.array(y.object({profileId:y.string(),fullName:y.string(),avatar:y.object({url:y.string()}).nullable()}))})})}},"/save":{POST:{req:{body:y.object({patchIds:y.array(an)}),cookies:{val_session:y.string().optional()}},res:y.union([ba,y.object({status:y.literal(200),json:y.object({})}),y.object({status:y.literal(409),json:y.object({message:y.string(),isNotFastForward:y.literal(!0)})}),y.object({status:y.literal(400),json:y.object({message:y.string(),details:y.union([y.object({sourceFilePatchErrors:y.record(rs,y.array(Kt)),binaryFilePatchErrors:y.record(Kt)}),y.array(Kt)])})})])}},"/files":{GET:{req:{path:y.string(),query:{patch_id:an.optional()}},res:y.union([ba,tU,y.object({status:y.literal(200),body:y.instanceof(ReadableStream)})])}}},QP=function(t){var n=nU;return function(){var r=VC(Yu().mark(function o(i,s,a){var l,c,u,d,f,h,m,v,x,b,w,S,k,C,T,_,O;return Yu().wrap(function(j){for(;;)switch(j.prev=j.next){case 0:if(u=a,d=i,u!=null&&u.path&&u.path.length>0&&(d+=u.path),u.query){for(f=[],h=0,m=Object.keys(u.query);h<m.length;h++)if(x=m[h],Array.isArray((v=u.query)===null||v===void 0?void 0:v[x])){w=r1(((b=u.query)===null||b===void 0?void 0:b[x])||[]);try{for(w.s();!(S=w.n()).done;)k=S.value,f.push([x,k.toString()])}catch(L){w.e(L)}finally{w.f()}}else f.push([x,u==null||(C=u.query)===null||C===void 0?void 0:C[x]]);u!=null&&u.query&&f.length>0&&(d+="?".concat(new URLSearchParams(f).toString()))}if(T=n==null||(l=n[i])===null||l===void 0?void 0:l[s],T){j.next=7;break}return j.abrupt("return",{status:null,json:{message:"Invalid route ".concat(i," with method ").concat(s,". This is most likely a Val bug."),type:"client_side_validation_error",details:{validationError:"Route ".concat(i," with method ").concat(s," not found."),data:{routes:Object.keys(n||{}),methods:Object.keys((n==null?void 0:n[i])||{}),route:i,method:s}}}});case 7:if(_=(c=T.req.body)===null||c===void 0?void 0:c.safeParse(u.body),!(_&&!_.success)){j.next=11;break}return console.error("Invalid request body",{body:u.body,error:_.error}),j.abrupt("return",{status:null,json:{message:"Invalid request body. This is most likely a Val bug.",type:"client_side_validation_error",details:{validationError:zC(_.error).toString(),data:u.body}}});case 11:return j.prev=11,j.next=14,fetch("".concat(t).concat(d),{method:s,headers:{"Content-Type":"application/json"},body:u.body!==void 0?JSON.stringify(u.body):void 0}).then(function(){var L=VC(Yu().mark(function B(J){var z,H,R,N,E;return Yu().wrap(function(P){for(;;)switch(P.prev=P.next){case 0:if(H=J.headers.get("content-type"),H!=null&&H.includes("application/json")){P.next=3;break}return P.abrupt("return",{status:null,json:{type:"client_side_validation_error",message:"Invalid response (expected JSON, but got something else). This could be a result of mismatched Val versions or a transient error.",details:{validationError:"Invalid content type",data:{status:J.status,contentType:H}}}});case 3:return P.next=5,J.json();case 5:if(R=P.sent,N={status:J.status,json:R},J.status!==500){P.next=10;break}return console.log("Server responded with an error",R),P.abrupt("return",{status:500,json:{message:R.message,type:"unknown"}});case 10:if(E=(z=T.res)===null||z===void 0?void 0:z.safeParse(N),!(E&&!E.success)){P.next=13;break}return P.abrupt("return",{status:null,json:{message:"Response could not be validated. This could also be a result of mismatched Val versions.",type:"client_side_validation_error",details:{validationError:zC(E.error).toString(),data:N}}});case 13:return P.abrupt("return",{status:J.status,json:R});case 14:case"end":return P.stop()}},B)}));return function(B){return L.apply(this,arguments)}}());case 14:return O=j.sent,j.abrupt("return",O);case 18:return j.prev=18,j.t0=j.catch(11),j.abrupt("return",{status:null,json:{message:"Failed to fetch data",type:"network_error",retryable:rU(j.t0),details:j.t0 instanceof Error?j.t0.message:JSON.stringify(j.t0)}});case 21:case"end":return j.stop()}},o,null,[[11,18]])}));return function(o,i,s){return r.apply(this,arguments)}}()};function rU(e){if(e instanceof TypeError)return!0;if(e instanceof Error&&"code"in e){var t=e.code,n=["ECONNRESET","ETIMEDOUT","ENOTFOUND","EAI_AGAIN"];return n.includes(t)}return!1}function oU(e){if(Array.isArray(e))return e}function iU(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,s,a=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(u){c=!0,o=u}finally{try{if(!l&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return a}}function sU(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
260
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aU(e,t){return oU(e)||iU(e,t)||n1(e,t)||sU()}var wf=function(){var t=arguments.length<=0?void 0:arguments[0],n=arguments.length<=1?void 0:arguments[1];if(n){var r=Object.entries(n).flatMap(function(i){var s=aU(i,2),a=s[0],l=s[1];return l?[[a,l.toString()]]:[]}),o=new URLSearchParams(r);return"".concat(t+"?"+o.toString())}return"".concat(t)},lU=v4.useId||(()=>{}),cU=0;function Hr(e){const[t,n]=g.useState(lU());return mn(()=>{n(r=>r??String(cU++))},[e]),t?`radix-${t}`:""}function uU(e,t=globalThis==null?void 0:globalThis.document){const n=Ft(e);g.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var dU="DismissableLayer",_0="dismissableLayer.update",fU="dismissableLayer.pointerDownOutside",pU="dismissableLayer.focusOutside",KC,eR=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),dp=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...l}=e,c=g.useContext(eR),[u,d]=g.useState(null),f=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=g.useState({}),m=Ie(t,_=>d(_)),v=Array.from(c.layers),[x]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(x),w=u?v.indexOf(u):-1,S=c.layersWithOutsidePointerEventsDisabled.size>0,k=w>=b,C=gU(_=>{const O=_.target,M=[...c.branches].some(j=>j.contains(O));!k||M||(o==null||o(_),s==null||s(_),_.defaultPrevented||a==null||a())},f),T=vU(_=>{const O=_.target;[...c.branches].some(j=>j.contains(O))||(i==null||i(_),s==null||s(_),_.defaultPrevented||a==null||a())},f);return uU(_=>{w===c.layers.size-1&&(r==null||r(_),!_.defaultPrevented&&a&&(_.preventDefault(),a()))},f),g.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(KC=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),qC(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=KC)}},[u,f,n,c]),g.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),qC())},[u,c]),g.useEffect(()=>{const _=()=>h({});return document.addEventListener(_0,_),()=>document.removeEventListener(_0,_)},[]),p.jsx(Ee.div,{...l,ref:m,style:{pointerEvents:S?k?"auto":"none":void 0,...e.style},onFocusCapture:re(e.onFocusCapture,T.onFocusCapture),onBlurCapture:re(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:re(e.onPointerDownCapture,C.onPointerDownCapture)})});dp.displayName=dU;var hU="DismissableLayerBranch",mU=g.forwardRef((e,t)=>{const n=g.useContext(eR),r=g.useRef(null),o=Ie(t,r);return g.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),p.jsx(Ee.div,{...e,ref:o})});mU.displayName=hU;function gU(e,t=globalThis==null?void 0:globalThis.document){const n=Ft(e),r=g.useRef(!1),o=g.useRef(()=>{});return g.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let l=function(){tR(fU,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function vU(e,t=globalThis==null?void 0:globalThis.document){const n=Ft(e),r=g.useRef(!1);return g.useEffect(()=>{const o=i=>{i.target&&!r.current&&tR(pU,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function qC(){const e=new CustomEvent(_0);document.dispatchEvent(e)}function tR(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?GM(o,i):o.dispatchEvent(i)}var Py="focusScope.autoFocusOnMount",Ry="focusScope.autoFocusOnUnmount",GC={bubbles:!1,cancelable:!0},yU="FocusScope",fp=g.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=e,[a,l]=g.useState(null),c=Ft(o),u=Ft(i),d=g.useRef(null),f=Ie(t,v=>l(v)),h=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(r){let v=function(S){if(h.paused||!a)return;const k=S.target;a.contains(k)?d.current=k:is(d.current,{select:!0})},x=function(S){if(h.paused||!a)return;const k=S.relatedTarget;k!==null&&(a.contains(k)||is(d.current,{select:!0}))},b=function(S){if(document.activeElement===document.body)for(const C of S)C.removedNodes.length>0&&is(a)};document.addEventListener("focusin",v),document.addEventListener("focusout",x);const w=new MutationObserver(b);return a&&w.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",x),w.disconnect()}}},[r,a,h.paused]),g.useEffect(()=>{if(a){JC.add(h);const v=document.activeElement;if(!a.contains(v)){const b=new CustomEvent(Py,GC);a.addEventListener(Py,c),a.dispatchEvent(b),b.defaultPrevented||(xU(CU(nR(a)),{select:!0}),document.activeElement===v&&is(a))}return()=>{a.removeEventListener(Py,c),setTimeout(()=>{const b=new CustomEvent(Ry,GC);a.addEventListener(Ry,u),a.dispatchEvent(b),b.defaultPrevented||is(v??document.body,{select:!0}),a.removeEventListener(Ry,u),JC.remove(h)},0)}}},[a,c,u,h]);const m=g.useCallback(v=>{if(!n&&!r||h.paused)return;const x=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,b=document.activeElement;if(x&&b){const w=v.currentTarget,[S,k]=bU(w);S&&k?!v.shiftKey&&b===k?(v.preventDefault(),n&&is(S,{select:!0})):v.shiftKey&&b===S&&(v.preventDefault(),n&&is(k,{select:!0})):b===w&&v.preventDefault()}},[n,r,h.paused]);return p.jsx(Ee.div,{tabIndex:-1,...s,ref:f,onKeyDown:m})});fp.displayName=yU;function xU(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(is(r,{select:t}),document.activeElement!==n)return}function bU(e){const t=nR(e),n=YC(t,e),r=YC(t.reverse(),e);return[n,r]}function nR(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function YC(e,t){for(const n of e)if(!wU(n,{upTo:t}))return n}function wU(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function SU(e){return e instanceof HTMLInputElement&&"select"in e}function is(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&SU(e)&&t&&e.select()}}var JC=kU();function kU(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=XC(e,t),e.unshift(t)},remove(t){var n;e=XC(e,t),(n=e[0])==null||n.resume()}}}function XC(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function CU(e){return e.filter(t=>t.tagName!=="A")}var EU="Portal",pp=g.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,i]=g.useState(!1);mn(()=>i(!0),[]);const s=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?S5.createPortal(p.jsx(Ee.div,{...r,ref:t}),s):null});pp.displayName=EU;var jy=0;function Yg(){g.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??ZC()),document.body.insertAdjacentElement("beforeend",e[1]??ZC()),jy++,()=>{jy===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),jy--}},[])}function ZC(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Ho=function(){return Ho=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Ho.apply(this,arguments)};function rR(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 o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function _U(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var Mh="right-scroll-bar-position",Ph="width-before-scroll-bar",TU="with-scroll-bars-hidden",OU="--removed-body-scroll-bar-size";function Ay(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function NU(e,t){var n=g.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var MU=typeof window<"u"?g.useLayoutEffect:g.useEffect,QC=new WeakMap;function PU(e,t){var n=NU(null,function(r){return e.forEach(function(o){return Ay(o,r)})});return MU(function(){var r=QC.get(n);if(r){var o=new Set(r),i=new Set(e),s=n.current;o.forEach(function(a){i.has(a)||Ay(a,null)}),i.forEach(function(a){o.has(a)||Ay(a,s)})}QC.set(n,e)},[e]),n}function RU(e){return e}function jU(e,t){t===void 0&&(t=RU);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var s=t(i,r);return n.push(s),function(){n=n.filter(function(a){return a!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var a=n;n=[],a.forEach(i),s=n}var l=function(){var u=s;s=[],u.forEach(i)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(u){s.push(u),c()},filter:function(u){return s=s.filter(u),n}}}};return o}function AU(e){e===void 0&&(e={});var t=jU(null);return t.options=Ho({async:!0,ssr:!1},e),t}var oR=function(e){var t=e.sideCar,n=rR(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return g.createElement(r,Ho({},n))};oR.isSideCarExport=!0;function IU(e,t){return e.useMedium(t),oR}var iR=AU(),Iy=function(){},Jg=g.forwardRef(function(e,t){var n=g.useRef(null),r=g.useState({onScrollCapture:Iy,onWheelCapture:Iy,onTouchMoveCapture:Iy}),o=r[0],i=r[1],s=e.forwardProps,a=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,h=e.noIsolation,m=e.inert,v=e.allowPinchZoom,x=e.as,b=x===void 0?"div":x,w=e.gapMode,S=rR(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=f,C=PU([n,t]),T=Ho(Ho({},S),o);return g.createElement(g.Fragment,null,u&&g.createElement(k,{sideCar:iR,removeScrollBar:c,shards:d,noIsolation:h,inert:m,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:w}),s?g.cloneElement(g.Children.only(a),Ho(Ho({},T),{ref:C})):g.createElement(b,Ho({},T,{className:l,ref:C}),a))});Jg.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Jg.classNames={fullWidth:Ph,zeroRight:Mh};var DU=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function LU(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=DU();return t&&e.setAttribute("nonce",t),e}function FU(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function zU(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var $U=function(){var e=0,t=null;return{add:function(n){e==0&&(t=LU())&&(FU(t,n),zU(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},BU=function(){var e=$U();return function(t,n){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},sR=function(){var e=BU(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},VU={left:0,top:0,right:0,gap:0},Dy=function(e){return parseInt(e||"",10)||0},UU=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Dy(n),Dy(r),Dy(o)]},WU=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return VU;var t=UU(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])}},HU=sR(),dc="data-scroll-locked",KU=function(e,t,n,r){var o=e.left,i=e.top,s=e.right,a=e.gap;return n===void 0&&(n="margin"),`
261
- .`.concat(TU,` {
262
- overflow: hidden `).concat(r,`;
263
- padding-right: `).concat(a,"px ").concat(r,`;
264
- }
265
- body[`).concat(dc,`] {
266
- overflow: hidden `).concat(r,`;
267
- overscroll-behavior: contain;
268
- `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
269
- padding-left: `.concat(o,`px;
270
- padding-top: `).concat(i,`px;
271
- padding-right: `).concat(s,`px;
272
- margin-left:0;
273
- margin-top:0;
274
- margin-right: `).concat(a,"px ").concat(r,`;
275
- `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
276
- }
277
-
278
- .`).concat(Mh,` {
279
- right: `).concat(a,"px ").concat(r,`;
280
- }
281
-
282
- .`).concat(Ph,` {
283
- margin-right: `).concat(a,"px ").concat(r,`;
284
- }
285
-
286
- .`).concat(Mh," .").concat(Mh,` {
287
- right: 0 `).concat(r,`;
288
- }
289
-
290
- .`).concat(Ph," .").concat(Ph,` {
291
- margin-right: 0 `).concat(r,`;
292
- }
293
-
294
- body[`).concat(dc,`] {
295
- `).concat(OU,": ").concat(a,`px;
296
- }
297
- `)},eE=function(){var e=parseInt(document.body.getAttribute(dc)||"0",10);return isFinite(e)?e:0},qU=function(){g.useEffect(function(){return document.body.setAttribute(dc,(eE()+1).toString()),function(){var e=eE()-1;e<=0?document.body.removeAttribute(dc):document.body.setAttribute(dc,e.toString())}},[])},GU=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;qU();var i=g.useMemo(function(){return WU(o)},[o]);return g.createElement(HU,{styles:KU(i,!t,o,n?"":"!important")})},T0=!1;if(typeof window<"u")try{var rh=Object.defineProperty({},"passive",{get:function(){return T0=!0,!0}});window.addEventListener("test",rh,rh),window.removeEventListener("test",rh,rh)}catch{T0=!1}var Tl=T0?{passive:!1}:!1,YU=function(e){return e.tagName==="TEXTAREA"},aR=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!YU(e)&&n[t]==="visible")},JU=function(e){return aR(e,"overflowY")},XU=function(e){return aR(e,"overflowX")},tE=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=lR(e,r);if(o){var i=cR(e,r),s=i[1],a=i[2];if(s>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},ZU=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},QU=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},lR=function(e,t){return e==="v"?JU(t):XU(t)},cR=function(e,t){return e==="v"?ZU(t):QU(t)},eW=function(e,t){return e==="h"&&t==="rtl"?-1:1},tW=function(e,t,n,r,o){var i=eW(e,window.getComputedStyle(t).direction),s=i*r,a=n.target,l=t.contains(a),c=!1,u=s>0,d=0,f=0;do{var h=cR(e,a),m=h[0],v=h[1],x=h[2],b=v-x-i*m;(m||b)&&lR(e,a)&&(d+=b,f+=m),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(u&&(Math.abs(d)<1||!o)||!u&&(Math.abs(f)<1||!o))&&(c=!0),c},oh=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},nE=function(e){return[e.deltaX,e.deltaY]},rE=function(e){return e&&"current"in e?e.current:e},nW=function(e,t){return e[0]===t[0]&&e[1]===t[1]},rW=function(e){return`
298
- .block-interactivity-`.concat(e,` {pointer-events: none;}
299
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
300
- `)},oW=0,Ol=[];function iW(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),o=g.useState(oW++)[0],i=g.useState(sR)[0],s=g.useRef(e);g.useEffect(function(){s.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var v=_U([e.lockRef.current],(e.shards||[]).map(rE),!0).filter(Boolean);return v.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),v.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=g.useCallback(function(v,x){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!s.current.allowPinchZoom;var b=oh(v),w=n.current,S="deltaX"in v?v.deltaX:w[0]-b[0],k="deltaY"in v?v.deltaY:w[1]-b[1],C,T=v.target,_=Math.abs(S)>Math.abs(k)?"h":"v";if("touches"in v&&_==="h"&&T.type==="range")return!1;var O=tE(_,T);if(!O)return!0;if(O?C=_:(C=_==="v"?"h":"v",O=tE(_,T)),!O)return!1;if(!r.current&&"changedTouches"in v&&(S||k)&&(r.current=C),!C)return!0;var M=r.current||C;return tW(M,x,v,M==="h"?S:k,!0)},[]),l=g.useCallback(function(v){var x=v;if(!(!Ol.length||Ol[Ol.length-1]!==i)){var b="deltaY"in x?nE(x):oh(x),w=t.current.filter(function(C){return C.name===x.type&&(C.target===x.target||x.target===C.shadowParent)&&nW(C.delta,b)})[0];if(w&&w.should){x.cancelable&&x.preventDefault();return}if(!w){var S=(s.current.shards||[]).map(rE).filter(Boolean).filter(function(C){return C.contains(x.target)}),k=S.length>0?a(x,S[0]):!s.current.noIsolation;k&&x.cancelable&&x.preventDefault()}}},[]),c=g.useCallback(function(v,x,b,w){var S={name:v,delta:x,target:b,should:w,shadowParent:sW(b)};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(k){return k!==S})},1)},[]),u=g.useCallback(function(v){n.current=oh(v),r.current=void 0},[]),d=g.useCallback(function(v){c(v.type,nE(v),v.target,a(v,e.lockRef.current))},[]),f=g.useCallback(function(v){c(v.type,oh(v),v.target,a(v,e.lockRef.current))},[]);g.useEffect(function(){return Ol.push(i),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",l,Tl),document.addEventListener("touchmove",l,Tl),document.addEventListener("touchstart",u,Tl),function(){Ol=Ol.filter(function(v){return v!==i}),document.removeEventListener("wheel",l,Tl),document.removeEventListener("touchmove",l,Tl),document.removeEventListener("touchstart",u,Tl)}},[]);var h=e.removeScrollBar,m=e.inert;return g.createElement(g.Fragment,null,m?g.createElement(i,{styles:rW(o)}):null,h?g.createElement(GU,{gapMode:e.gapMode}):null)}function sW(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const aW=IU(iR,iW);var hp=g.forwardRef(function(e,t){return g.createElement(Jg,Ho({},e,{ref:t,sideCar:aW}))});hp.classNames=Jg.classNames;var lW=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Nl=new WeakMap,ih=new WeakMap,sh={},Ly=0,uR=function(e){return e&&(e.host||uR(e.parentNode))},cW=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=uR(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},uW=function(e,t,n,r){var o=cW(t,Array.isArray(e)?e:[e]);sh[n]||(sh[n]=new WeakMap);var i=sh[n],s=[],a=new Set,l=new Set(o),c=function(d){!d||a.has(d)||(a.add(d),c(d.parentNode))};o.forEach(c);var u=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(f){if(a.has(f))u(f);else try{var h=f.getAttribute(r),m=h!==null&&h!=="false",v=(Nl.get(f)||0)+1,x=(i.get(f)||0)+1;Nl.set(f,v),i.set(f,x),s.push(f),v===1&&m&&ih.set(f,!0),x===1&&f.setAttribute(n,"true"),m||f.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",f,b)}})};return u(t),a.clear(),Ly++,function(){s.forEach(function(d){var f=Nl.get(d)-1,h=i.get(d)-1;Nl.set(d,f),i.set(d,h),f||(ih.has(d)||d.removeAttribute(r),ih.delete(d)),h||d.removeAttribute(n)}),Ly--,Ly||(Nl=new WeakMap,Nl=new WeakMap,ih=new WeakMap,sh={})}},Xg=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=lW(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),uW(r,o,n,"aria-hidden")):function(){return null}},o1="Dialog",[dR,afe]=Bi(o1),[dW,zo]=dR(o1),fR=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!0}=e,a=g.useRef(null),l=g.useRef(null),[c=!1,u]=Qo({prop:r,defaultProp:o,onChange:i});return p.jsx(dW,{scope:t,triggerRef:a,contentRef:l,contentId:Hr(),titleId:Hr(),descriptionId:Hr(),open:c,onOpenChange:u,onOpenToggle:g.useCallback(()=>u(d=>!d),[u]),modal:s,children:n})};fR.displayName=o1;var pR="DialogTrigger",fW=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=zo(pR,n),i=Ie(t,o.triggerRef);return p.jsx(Ee.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":l1(o.open),...r,ref:i,onClick:re(e.onClick,o.onOpenToggle)})});fW.displayName=pR;var i1="DialogPortal",[pW,hR]=dR(i1,{forceMount:void 0}),mR=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=zo(i1,t);return p.jsx(pW,{scope:t,forceMount:n,children:g.Children.map(r,s=>p.jsx(Mn,{present:n||i.open,children:p.jsx(pp,{asChild:!0,container:o,children:s})}))})};mR.displayName=i1;var Im="DialogOverlay",gR=g.forwardRef((e,t)=>{const n=hR(Im,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=zo(Im,e.__scopeDialog);return i.modal?p.jsx(Mn,{present:r||i.open,children:p.jsx(hW,{...o,ref:t})}):null});gR.displayName=Im;var hW=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=zo(Im,n);return p.jsx(hp,{as:Ai,allowPinchZoom:!0,shards:[o.contentRef],children:p.jsx(Ee.div,{"data-state":l1(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),el="DialogContent",vR=g.forwardRef((e,t)=>{const n=hR(el,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=zo(el,e.__scopeDialog);return p.jsx(Mn,{present:r||i.open,children:i.modal?p.jsx(mW,{...o,ref:t}):p.jsx(gW,{...o,ref:t})})});vR.displayName=el;var mW=g.forwardRef((e,t)=>{const n=zo(el,e.__scopeDialog),r=g.useRef(null),o=Ie(t,n.contentRef,r);return g.useEffect(()=>{const i=r.current;if(i)return Xg(i)},[]),p.jsx(yR,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:re(e.onCloseAutoFocus,i=>{var s;i.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:re(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&i.preventDefault()}),onFocusOutside:re(e.onFocusOutside,i=>i.preventDefault())})}),gW=g.forwardRef((e,t)=>{const n=zo(el,e.__scopeDialog),r=g.useRef(!1),o=g.useRef(!1);return p.jsx(yR,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,a;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;((c=n.triggerRef.current)==null?void 0:c.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),yR=g.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...s}=e,a=zo(el,n),l=g.useRef(null),c=Ie(t,l);return Yg(),p.jsxs(p.Fragment,{children:[p.jsx(fp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:p.jsx(dp,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":l1(a.open),...s,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),p.jsxs(p.Fragment,{children:[p.jsx(vW,{titleId:a.titleId}),p.jsx(xW,{contentRef:l,descriptionId:a.descriptionId})]})]})}),s1="DialogTitle",a1=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=zo(s1,n);return p.jsx(Ee.h2,{id:o.titleId,...r,ref:t})});a1.displayName=s1;var xR="DialogDescription",bR=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=zo(xR,n);return p.jsx(Ee.p,{id:o.descriptionId,...r,ref:t})});bR.displayName=xR;var wR="DialogClose",SR=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=zo(wR,n);return p.jsx(Ee.button,{type:"button",...r,ref:t,onClick:re(e.onClick,()=>o.onOpenChange(!1))})});SR.displayName=wR;function l1(e){return e?"open":"closed"}var kR="DialogTitleWarning",[lfe,CR]=Z8(kR,{contentName:el,titleName:s1,docsSlug:"dialog"}),vW=({titleId:e})=>{const t=CR(kR),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
301
-
302
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
303
-
304
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return g.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},yW="DialogDescriptionWarning",xW=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${CR(yW).contentName}}.`;return g.useEffect(()=>{var i;const o=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},bW=fR,wW=mR,ER=gR,_R=vR,TR=a1,OR=bR,SW=SR;const NR=bW,kW=wW,MR=g.forwardRef(({className:e,...t},n)=>p.jsx(ER,{ref:n,className:qe("fixed inset-0 z-50 bg-bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));MR.displayName=ER.displayName;const c1=g.forwardRef(({className:e,children:t,container:n,hideClose:r,...o},i)=>p.jsxs(kW,{container:n,children:[p.jsx(MR,{}),p.jsxs(_R,{ref:i,className:qe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-bg-background text-text-primary p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",e),...o,children:[t,r?null:p.jsxs(SW,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-bg-brand-primary data-[state=open]:text-primary_on-brand",children:[p.jsx(Ug,{className:"w-4 h-4"}),p.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));c1.displayName=_R.displayName;const PR=({className:e,...t})=>p.jsx("div",{className:qe("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});PR.displayName="DialogHeader";const CW=g.forwardRef(({className:e,...t},n)=>p.jsx(TR,{ref:n,className:qe("text-lg font-semibold leading-none tracking-tight",e),...t}));CW.displayName=TR.displayName;const RR=g.forwardRef(({className:e,...t},n)=>p.jsx(OR,{ref:n,className:qe("text-sm text-text-primary",e),...t}));RR.displayName=OR.displayName;function jR(){const{publishError:e,resetPublishError:t}=Kw(),n=ua();return p.jsx(NR,{open:!!e,onOpenChange:r=>{r||t()},children:p.jsxs(c1,{container:n,className:"bg-bg-primary text-text-primary",children:[p.jsx("div",{className:"text-xl font-bold bg-bg-error-primary text-text-error-primary",children:"Could not publish"}),p.jsx("div",{children:e})]})})}function EW({isOpen:e,setOpen:t}){const{globalErrors:n}=eu(),r=DM();return p.jsxs("nav",{className:"flex flex-col gap-1 pr-4",children:[p.jsx("div",{className:"flex items-center h-16 gap-4 p-4 mt-4 bg-bg-tertiary rounded-3xl",children:p.jsx(_W,{isOpen:e,setOpen:t})}),n.length>0&&p.jsx("div",{className:"p-4 bg-bg-error-primary text-text-Wprimary rounded-3xl",children:n.map((o,i)=>p.jsx("div",{children:o},i))}),p.jsx(jR,{}),r!=="not-asked"&&p.jsx("div",{className:Ue("bg-bg-tertiary rounded-3xl",{"hidden xl:block":!e,block:e}),children:p.jsx(qg,{children:p.jsx("div",{className:"max-h-[calc(100svh-32px-64px-32px-16px)]",children:p.jsx(r9,{loadingStatus:r})})})})]})}function _W({isOpen:e,setOpen:t}){const{publish:n,publishDisabled:r}=Kw();return p.jsxs("div",{className:"flex items-center justify-end w-full gap-4 p-4",children:[p.jsxs("div",{className:"xl:hidden",children:[p.jsxs("button",{className:"px-3 py-1 font-bold text-bg-brand-primary",onClick:()=>{e?t(!1):window.location.href=wf("/api/val/enable",{redirect_to:window.origin})},children:[!e&&p.jsx("span",{children:"Visual editing"}),e&&p.jsx("span",{children:p.jsx(Ug,{})})]}),p.jsxs("button",{className:"px-3 py-1 font-bold transition-colors border rounded bg-bg-brand-primary disabled:text-text-disabled disabled:bg-bg-disabled disabled:border-border-disabled disabled:border border-bg-brand-primary text-text-brand-primary",disabled:e&&r,onClick:()=>{e?n():t(!0)},children:[e&&p.jsx("span",{children:"Publish"}),!e&&p.jsx("span",{children:"Review"})]})]}),p.jsxs("div",{className:"hidden xl:block",children:[p.jsx("button",{className:"px-3 py-1 font-bold text-bg-brand-primary",onClick:()=>{window.location.href=wf("/api/val/enable",{redirect_to:window.origin})},children:p.jsx("span",{children:"Visual editing"})}),p.jsx("button",{className:"px-3 py-1 font-bold transition-colors border rounded bg-bg-brand-primary disabled:text-text-disabled disabled:bg-bg-disabled disabled:border-border-disabled disabled:border border-bg-brand-primary text-text-brand-primary",disabled:r,onClick:()=>{n()},children:p.jsx("span",{children:"Publish"})})]})]})}function Rt({error:e}){return p.jsx("div",{children:p.jsx("div",{className:"p-4 rounded bg-bg-error-primary text-text-primary",children:e})})}function nt({path:e,type:t}){return p.jsx("div",{className:"pt-6",children:p.jsx("div",{children:"Loading..."})})}function gn({path:e,type:t}){const[n,r]=g.useState(!1);return g.useEffect(()=>{const o=setTimeout(()=>{r(!0)},2e3);return()=>{clearTimeout(o)}},[]),e.length===0?null:n?p.jsx("div",{className:"pt-6",children:p.jsx("div",{children:"Could not get data"})}):p.jsx(nt,{path:e,type:t})}function dr({actualType:e,expectedType:t}){return p.jsx("div",{children:p.jsxs("div",{children:["Schema mismatch: actual: ",e," vs expected: ",t," "]})})}function Ke({error:e}){return p.jsx("div",{children:p.jsxs("div",{className:"p-4 rounded bg-bg-error-primary text-text-primary",children:["Source error: ",e]})})}function TW(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const Zg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ou(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function u1(e){return"nodeType"in e}function fr(e){var t,n;return e?ou(e)?e:u1(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function d1(e){const{Document:t}=fr(e);return e instanceof t}function mp(e){return ou(e)?!1:e instanceof fr(e).HTMLElement}function AR(e){return e instanceof fr(e).SVGElement}function iu(e){return e?ou(e)?e.document:u1(e)?d1(e)?e:mp(e)||AR(e)?e.ownerDocument:document:document:document}const Ro=Zg?g.useLayoutEffect:g.useEffect;function f1(e){const t=g.useRef(e);return Ro(()=>{t.current=e}),g.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function OW(){const e=g.useRef(null),t=g.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=g.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Sf(e,t){t===void 0&&(t=[e]);const n=g.useRef(e);return Ro(()=>{n.current!==e&&(n.current=e)},t),n}function gp(e,t){const n=g.useRef();return g.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Dm(e){const t=f1(e),n=g.useRef(null),r=g.useCallback(o=>{o!==n.current&&(t==null||t(o,n.current)),n.current=o},[]);return[n,r]}function O0(e){const t=g.useRef();return g.useEffect(()=>{t.current=e},[e]),t.current}let Fy={};function vp(e,t){return g.useMemo(()=>{if(t)return t;const n=Fy[e]==null?0:Fy[e]+1;return Fy[e]=n,e+"-"+n},[e,t])}function IR(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,s)=>{const a=Object.entries(s);for(const[l,c]of a){const u=i[l];u!=null&&(i[l]=u+e*c)}return i},{...t})}}const fc=IR(1),kf=IR(-1);function NW(e){return"clientX"in e&&"clientY"in e}function p1(e){if(!e)return!1;const{KeyboardEvent:t}=fr(e.target);return t&&e instanceof t}function MW(e){if(!e)return!1;const{TouchEvent:t}=fr(e.target);return t&&e instanceof t}function N0(e){if(MW(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return NW(e)?{x:e.clientX,y:e.clientY}:null}const Cf=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Cf.Translate.toString(e),Cf.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),oE="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function PW(e){return e.matches(oE)?e:e.querySelector(oE)}const RW={display:"none"};function jW(e){let{id:t,value:n}=e;return ge.createElement("div",{id:t,style:RW},n)}function AW(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ge.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function IW(){const[e,t]=g.useState("");return{announce:g.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const DR=g.createContext(null);function DW(e){const t=g.useContext(DR);g.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function LW(){const[e]=g.useState(()=>new Set),t=g.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[g.useCallback(r=>{let{type:o,event:i}=r;e.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[e]),t]}const FW={draggable:`
305
- To pick up a draggable item, press the space bar.
306
- While dragging, use the arrow keys to move the item.
307
- Press space again to drop the item in its new position, or press escape to cancel.
308
- `},zW={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function $W(e){let{announcements:t=zW,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=FW}=e;const{announce:i,announcement:s}=IW(),a=vp("DndLiveRegion"),[l,c]=g.useState(!1);if(g.useEffect(()=>{c(!0)},[]),DW(g.useMemo(()=>({onDragStart(d){let{active:f}=d;i(t.onDragStart({active:f}))},onDragMove(d){let{active:f,over:h}=d;t.onDragMove&&i(t.onDragMove({active:f,over:h}))},onDragOver(d){let{active:f,over:h}=d;i(t.onDragOver({active:f,over:h}))},onDragEnd(d){let{active:f,over:h}=d;i(t.onDragEnd({active:f,over:h}))},onDragCancel(d){let{active:f,over:h}=d;i(t.onDragCancel({active:f,over:h}))}}),[i,t])),!l)return null;const u=ge.createElement(ge.Fragment,null,ge.createElement(jW,{id:r,value:o.draggable}),ge.createElement(AW,{id:a,announcement:s}));return n?Yn.createPortal(u,n):u}var Dt;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Dt||(Dt={}));function Lm(){}function iE(e,t){return g.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function BW(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const jo=Object.freeze({x:0,y:0});function LR(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function FR(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function VW(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function sE(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function zR(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function aE(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const UW=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=aE(t,t.left,t.top),i=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=LR(aE(l),o);i.push({id:a,data:{droppableContainer:s,value:c}})}}return i.sort(FR)},WW=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=sE(t),i=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=sE(l),u=o.reduce((f,h,m)=>f+LR(c[m],h),0),d=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:s,value:d}})}}return i.sort(FR)};function HW(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),s=o-r,a=i-n;if(r<o&&n<i){const l=t.width*t.height,c=e.width*e.height,u=s*a,d=u/(l+c-u);return Number(d.toFixed(4))}return 0}const KW=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:s}=i,a=n.get(s);if(a){const l=HW(a,t);l>0&&o.push({id:s,data:{droppableContainer:i,value:l}})}}return o.sort(VW)};function qW(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function $R(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:jo}function GW(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((s,a)=>({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const YW=GW(1);function JW(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function XW(e,t,n){const r=JW(t);if(!r)return e;const{scaleX:o,scaleY:i,x:s,y:a}=r,l=e.left-s-(1-o)*parseFloat(n),c=e.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),u=o?e.width/o:e.width,d=i?e.height/i:e.height;return{width:u,height:d,top:c,right:l+u,bottom:c+d,left:l}}const ZW={ignoreTransform:!1};function su(e,t){t===void 0&&(t=ZW);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=fr(e).getComputedStyle(e);c&&(n=XW(n,c,u))}const{top:r,left:o,width:i,height:s,bottom:a,right:l}=n;return{top:r,left:o,width:i,height:s,bottom:a,right:l}}function lE(e){return su(e,{ignoreTransform:!0})}function QW(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function eH(e,t){return t===void 0&&(t=fr(e).getComputedStyle(e)),t.position==="fixed"}function tH(e,t){t===void 0&&(t=fr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function Qg(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(d1(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!mp(o)||AR(o)||n.includes(o))return n;const i=fr(e).getComputedStyle(o);return o!==e&&tH(o,i)&&n.push(o),eH(o,i)?n:r(o.parentNode)}return e?r(e):n}function BR(e){const[t]=Qg(e,1);return t??null}function zy(e){return!Zg||!e?null:ou(e)?e:u1(e)?d1(e)||e===iu(e).scrollingElement?window:mp(e)?e:null:null}function VR(e){return ou(e)?e.scrollX:e.scrollLeft}function UR(e){return ou(e)?e.scrollY:e.scrollTop}function M0(e){return{x:VR(e),y:UR(e)}}var Jt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Jt||(Jt={}));function WR(e){return!Zg||!e?!1:e===document.scrollingElement}function HR(e){const t={x:0,y:0},n=WR(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const nH={x:.2,y:.2};function rH(e,t,n,r,o){let{top:i,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=nH);const{isTop:c,isBottom:u,isLeft:d,isRight:f}=HR(e),h={x:0,y:0},m={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!c&&i<=t.top+v.height?(h.y=Jt.Backward,m.y=r*Math.abs((t.top+v.height-i)/v.height)):!u&&l>=t.bottom-v.height&&(h.y=Jt.Forward,m.y=r*Math.abs((t.bottom-v.height-l)/v.height)),!f&&a>=t.right-v.width?(h.x=Jt.Forward,m.x=r*Math.abs((t.right-v.width-a)/v.width)):!d&&s<=t.left+v.width&&(h.x=Jt.Backward,m.x=r*Math.abs((t.left+v.width-s)/v.width)),{direction:h,speed:m}}function oH(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:s}=window;return{top:0,left:0,right:i,bottom:s,width:i,height:s}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function KR(e){return e.reduce((t,n)=>fc(t,M0(n)),jo)}function iH(e){return e.reduce((t,n)=>t+VR(n),0)}function sH(e){return e.reduce((t,n)=>t+UR(n),0)}function aH(e,t){if(t===void 0&&(t=su),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);BR(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const lH=[["x",["left","right"],iH],["y",["top","bottom"],sH]];class h1{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Qg(n),o=KR(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,s,a]of lH)for(const l of s)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=o[i]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Pd{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function cH(e){const{EventTarget:t}=fr(e);return e instanceof t?e:iu(e)}function $y(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var Lr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Lr||(Lr={}));function cE(e){e.preventDefault()}function uH(e){e.stopPropagation()}var Be;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(Be||(Be={}));const qR={start:[Be.Space,Be.Enter],cancel:[Be.Esc],end:[Be.Space,Be.Enter]},dH=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Be.Right:return{...n,x:n.x+25};case Be.Left:return{...n,x:n.x-25};case Be.Down:return{...n,y:n.y+25};case Be.Up:return{...n,y:n.y-25}}};class m1{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Pd(iu(n)),this.windowListeners=new Pd(fr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Lr.Resize,this.handleCancel),this.windowListeners.add(Lr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Lr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&aH(r),n(jo)}handleKeyDown(t){if(p1(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=qR,coordinateGetter:s=dH,scrollBehavior:a="smooth"}=o,{code:l}=t;if(i.end.includes(l)){this.handleEnd(t);return}if(i.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:jo;this.referenceCoordinates||(this.referenceCoordinates=u);const d=s(t,{active:n,context:r.current,currentCoordinates:u});if(d){const f=kf(d,u),h={x:0,y:0},{scrollableAncestors:m}=r.current;for(const v of m){const x=t.code,{isTop:b,isRight:w,isLeft:S,isBottom:k,maxScroll:C,minScroll:T}=HR(v),_=oH(v),O={x:Math.min(x===Be.Right?_.right-_.width/2:_.right,Math.max(x===Be.Right?_.left:_.left+_.width/2,d.x)),y:Math.min(x===Be.Down?_.bottom-_.height/2:_.bottom,Math.max(x===Be.Down?_.top:_.top+_.height/2,d.y))},M=x===Be.Right&&!w||x===Be.Left&&!S,j=x===Be.Down&&!k||x===Be.Up&&!b;if(M&&O.x!==d.x){const L=v.scrollLeft+f.x,B=x===Be.Right&&L<=C.x||x===Be.Left&&L>=T.x;if(B&&!f.y){v.scrollTo({left:L,behavior:a});return}B?h.x=v.scrollLeft-L:h.x=x===Be.Right?v.scrollLeft-C.x:v.scrollLeft-T.x,h.x&&v.scrollBy({left:-h.x,behavior:a});break}else if(j&&O.y!==d.y){const L=v.scrollTop+f.y,B=x===Be.Down&&L<=C.y||x===Be.Up&&L>=T.y;if(B&&!f.x){v.scrollTo({top:L,behavior:a});return}B?h.y=v.scrollTop-L:h.y=x===Be.Down?v.scrollTop-C.y:v.scrollTop-T.y,h.y&&v.scrollBy({top:-h.y,behavior:a});break}}this.handleMove(t,fc(kf(d,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}m1.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=qR,onActivation:o}=t,{active:i}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function uE(e){return!!(e&&"distance"in e)}function dE(e){return!!(e&&"delay"in e)}class g1{constructor(t,n,r){var o;r===void 0&&(r=cH(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:s}=i;this.props=t,this.events=n,this.document=iu(s),this.documentListeners=new Pd(this.document),this.listeners=new Pd(r),this.windowListeners=new Pd(fr(s)),this.initialCoordinates=(o=N0(i))!=null?o:jo,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),this.windowListeners.add(Lr.Resize,this.handleCancel),this.windowListeners.add(Lr.DragStart,cE),this.windowListeners.add(Lr.VisibilityChange,this.handleCancel),this.windowListeners.add(Lr.ContextMenu,cE),this.documentListeners.add(Lr.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(dE(n)){this.timeoutId=setTimeout(this.handleStart,n.delay);return}if(uE(n))return}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Lr.Click,uH,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Lr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:s,options:{activationConstraint:a}}=i;if(!o)return;const l=(n=N0(t))!=null?n:jo,c=kf(o,l);if(!r&&a){if(uE(a)){if(a.tolerance!=null&&$y(c,a.tolerance))return this.handleCancel();if($y(c,a.distance))return this.handleStart()}return dE(a)&&$y(c,a.tolerance)?this.handleCancel():void 0}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===Be.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const fH={move:{name:"pointermove"},end:{name:"pointerup"}};class v1 extends g1{constructor(t){const{event:n}=t,r=iu(n.target);super(t,fH,r)}}v1.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const pH={move:{name:"mousemove"},end:{name:"mouseup"}};var P0;(function(e){e[e.RightClick=2]="RightClick"})(P0||(P0={}));class hH extends g1{constructor(t){super(t,pH,iu(t.event.target))}}hH.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===P0.RightClick?!1:(r==null||r({event:n}),!0)}}];const By={move:{name:"touchmove"},end:{name:"touchend"}};class mH extends g1{constructor(t){super(t,By)}static setup(){return window.addEventListener(By.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(By.move.name,t)};function t(){}}}mH.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r==null||r({event:n}),!0)}}];var Rd;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Rd||(Rd={}));var Fm;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Fm||(Fm={}));function gH(e){let{acceleration:t,activator:n=Rd.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:s=5,order:a=Fm.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:d,threshold:f}=e;const h=yH({delta:d,disabled:!i}),[m,v]=OW(),x=g.useRef({x:0,y:0}),b=g.useRef({x:0,y:0}),w=g.useMemo(()=>{switch(n){case Rd.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Rd.DraggableRect:return o}},[n,o,l]),S=g.useRef(null),k=g.useCallback(()=>{const T=S.current;if(!T)return;const _=x.current.x*b.current.x,O=x.current.y*b.current.y;T.scrollBy(_,O)},[]),C=g.useMemo(()=>a===Fm.TreeOrder?[...c].reverse():c,[a,c]);g.useEffect(()=>{if(!i||!c.length||!w){v();return}for(const T of C){if((r==null?void 0:r(T))===!1)continue;const _=c.indexOf(T),O=u[_];if(!O)continue;const{direction:M,speed:j}=rH(T,O,w,t,f);for(const L of["x","y"])h[L][M[L]]||(j[L]=0,M[L]=0);if(j.x>0||j.y>0){v(),S.current=T,m(k,s),x.current=j,b.current=M;return}}x.current={x:0,y:0},b.current={x:0,y:0},v()},[t,k,r,v,i,s,JSON.stringify(w),JSON.stringify(h),m,c,C,u,JSON.stringify(f)])}const vH={x:{[Jt.Backward]:!1,[Jt.Forward]:!1},y:{[Jt.Backward]:!1,[Jt.Forward]:!1}};function yH(e){let{delta:t,disabled:n}=e;const r=O0(t);return gp(o=>{if(n||!r||!o)return vH;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Jt.Backward]:o.x[Jt.Backward]||i.x===-1,[Jt.Forward]:o.x[Jt.Forward]||i.x===1},y:{[Jt.Backward]:o.y[Jt.Backward]||i.y===-1,[Jt.Forward]:o.y[Jt.Forward]||i.y===1}}},[n,t,r])}function xH(e,t){const n=t!==null?e.get(t):void 0,r=n?n.node.current:null;return gp(o=>{var i;return t===null?null:(i=r??o)!=null?i:null},[r,t])}function bH(e,t){return g.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...i]},[]),[e,t])}var Ef;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Ef||(Ef={}));var R0;(function(e){e.Optimized="optimized"})(R0||(R0={}));const fE=new Map;function wH(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,s]=g.useState(null),{frequency:a,measure:l,strategy:c}=o,u=g.useRef(e),d=x(),f=Sf(d),h=g.useCallback(function(b){b===void 0&&(b=[]),!f.current&&s(w=>w===null?b:w.concat(b.filter(S=>!w.includes(S))))},[f]),m=g.useRef(null),v=gp(b=>{if(d&&!n)return fE;if(!b||b===fE||u.current!==e||i!=null){const w=new Map;for(let S of e){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){w.set(S.id,S.rect.current);continue}const k=S.node.current,C=k?new h1(l(k),k):null;S.rect.current=C,C&&w.set(S.id,C)}return w}return b},[e,i,n,d,l]);return g.useEffect(()=>{u.current=e},[e]),g.useEffect(()=>{d||h()},[n,d]),g.useEffect(()=>{i&&i.length>0&&s(null)},[JSON.stringify(i)]),g.useEffect(()=>{d||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{h(),m.current=null},a))},[a,d,h,...r]),{droppableRects:v,measureDroppableContainers:h,measuringScheduled:i!=null};function x(){switch(c){case Ef.Always:return!1;case Ef.BeforeDragging:return n;default:return!n}}}function GR(e,t){return gp(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function SH(e,t){return GR(e,t)}function kH(e){let{callback:t,disabled:n}=e;const r=f1(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return g.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function ev(e){let{callback:t,disabled:n}=e;const r=f1(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return g.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function CH(e){return new h1(su(e),e)}function pE(e,t,n){t===void 0&&(t=CH);const[r,o]=g.useReducer(a,null),i=kH({callback(l){if(e)for(const c of l){const{type:u,target:d}=c;if(u==="childList"&&d instanceof HTMLElement&&d.contains(e)){o();break}}}}),s=ev({callback:o});return Ro(()=>{o(),e?(s==null||s.observe(e),i==null||i.observe(document.body,{childList:!0,subtree:!0})):(s==null||s.disconnect(),i==null||i.disconnect())},[e]),r;function a(l){if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=t(e);return JSON.stringify(l)===JSON.stringify(u)?l:u}}function EH(e){const t=GR(e);return $R(e,t)}const hE=[];function _H(e){const t=g.useRef(e),n=gp(r=>e?r&&r!==hE&&e&&t.current&&e.parentNode===t.current.parentNode?r:Qg(e):hE,[e]);return g.useEffect(()=>{t.current=e},[e]),n}function TH(e){const[t,n]=g.useState(null),r=g.useRef(e),o=g.useCallback(i=>{const s=zy(i.target);s&&n(a=>a?(a.set(s,M0(s)),new Map(a)):null)},[]);return g.useEffect(()=>{const i=r.current;if(e!==i){s(i);const a=e.map(l=>{const c=zy(l);return c?(c.addEventListener("scroll",o,{passive:!0}),[c,M0(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(i)};function s(a){a.forEach(l=>{const c=zy(l);c==null||c.removeEventListener("scroll",o)})}},[o,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,s)=>fc(i,s),jo):KR(e):jo,[e,t])}function mE(e,t){t===void 0&&(t=[]);const n=g.useRef(null);return g.useEffect(()=>{n.current=null},t),g.useEffect(()=>{const r=e!==jo;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?kf(e,n.current):jo}function OH(e){g.useEffect(()=>{if(!Zg)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function NH(e,t){return g.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=s=>{i(s,t)},n},{}),[e,t])}function YR(e){return g.useMemo(()=>e?QW(e):null,[e])}const Vy=[];function MH(e,t){t===void 0&&(t=su);const[n]=e,r=YR(n?fr(n):null),[o,i]=g.useReducer(a,Vy),s=ev({callback:i});return e.length>0&&o===Vy&&i(),Ro(()=>{e.length?e.forEach(l=>s==null?void 0:s.observe(l)):(s==null||s.disconnect(),i())},[e]),o;function a(){return e.length?e.map(l=>WR(l)?r:new h1(t(l),l)):Vy}}function PH(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return mp(t)?t:e}function RH(e){let{measure:t}=e;const[n,r]=g.useState(null),o=g.useCallback(c=>{for(const{target:u}of c)if(mp(u)){r(d=>{const f=t(u);return d?{...d,width:f.width,height:f.height}:f});break}},[t]),i=ev({callback:o}),s=g.useCallback(c=>{const u=PH(c);i==null||i.disconnect(),u&&(i==null||i.observe(u)),r(u?t(u):null)},[t,i]),[a,l]=Dm(s);return g.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const jH=[{sensor:v1,options:{}},{sensor:m1,options:{}}],AH={current:{}},Rh={draggable:{measure:lE},droppable:{measure:lE,strategy:Ef.WhileDragging,frequency:R0.Optimized},dragOverlay:{measure:su}};class jd extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const IH={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new jd,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Lm},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Rh,measureDroppableContainers:Lm,windowRect:null,measuringScheduled:!1},DH={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Lm,draggableNodes:new Map,over:null,measureDroppableContainers:Lm},tv=g.createContext(DH),JR=g.createContext(IH);function LH(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new jd}}}function FH(e,t){switch(t.type){case Dt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Dt.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case Dt.DragEnd:case Dt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Dt.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new jd(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Dt.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const s=new jd(e.droppable.containers);return s.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case Dt.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new jd(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function zH(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=g.useContext(tv),i=O0(r),s=O0(n==null?void 0:n.id);return g.useEffect(()=>{if(!t&&!r&&i&&s!=null){if(!p1(i)||document.activeElement===i.target)return;const a=o.get(s);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const d=PW(u);if(d){d.focus();break}}})}},[r,t,o,s,i]),null}function $H(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function BH(e){return g.useMemo(()=>({draggable:{...Rh.draggable,...e==null?void 0:e.draggable},droppable:{...Rh.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Rh.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function VH(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=g.useRef(!1),{x:s,y:a}=typeof o=="boolean"?{x:o,y:o}:o;Ro(()=>{if(!s&&!a||!t){i.current=!1;return}if(i.current||!r)return;const c=t==null?void 0:t.node.current;if(!c||c.isConnected===!1)return;const u=n(c),d=$R(u,r);if(s||(d.x=0),a||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const f=BR(c);f&&f.scrollBy({top:d.y,left:d.x})}},[t,s,a,r,n])}const XR=g.createContext({...jo,scaleX:1,scaleY:1});var fs;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(fs||(fs={}));const UH=g.memo(function(t){var n,r,o,i;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:u=jH,collisionDetection:d=KW,measuring:f,modifiers:h,...m}=t;const v=g.useReducer(FH,void 0,LH),[x,b]=v,[w,S]=LW(),[k,C]=g.useState(fs.Uninitialized),T=k===fs.Initialized,{draggable:{active:_,nodes:O,translate:M},droppable:{containers:j}}=x,L=_?O.get(_):null,B=g.useRef({initial:null,translated:null}),J=g.useMemo(()=>{var sn;return _!=null?{id:_,data:(sn=L==null?void 0:L.data)!=null?sn:AH,rect:B}:null},[_,L]),z=g.useRef(null),[H,R]=g.useState(null),[N,E]=g.useState(null),A=Sf(m,Object.values(m)),P=vp("DndDescribedBy",s),I=g.useMemo(()=>j.getEnabled(),[j]),U=BH(f),{droppableRects:me,measureDroppableContainers:ee,measuringScheduled:ve}=wH(I,{dragging:T,dependencies:[M.x,M.y],config:U.droppable}),q=xH(O,_),$=g.useMemo(()=>N?N0(N):null,[N]),oe=XL(),ce=SH(q,U.draggable.measure);VH({activeNode:_?O.get(_):null,config:oe.layoutShiftCompensation,initialRect:ce,measure:U.draggable.measure});const ie=pE(q,U.draggable.measure,ce),Te=pE(q?q.parentElement:null),ye=g.useRef({activatorEvent:null,active:null,activeNode:q,collisionRect:null,collisions:null,droppableRects:me,draggableNodes:O,draggingNode:null,draggingNodeRect:null,droppableContainers:j,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Pe=j.getNodeFor((n=ye.current.over)==null?void 0:n.id),rt=RH({measure:U.dragOverlay.measure}),rn=(r=rt.nodeRef.current)!=null?r:q,on=T?(o=rt.rect)!=null?o:ie:null,Ir=!!(rt.nodeRef.current&&rt.rect),yn=EH(Ir?null:ie),Rn=YR(rn?fr(rn):null),xn=_H(T?Pe??q:null),bl=MH(xn),va=$H(h,{transform:{x:M.x-yn.x,y:M.y-yn.y,scaleX:1,scaleY:1},activatorEvent:N,active:J,activeNodeRect:ie,containerNodeRect:Te,draggingNodeRect:on,over:ye.current.over,overlayNodeRect:rt.rect,scrollableAncestors:xn,scrollableAncestorRects:bl,windowRect:Rn}),KS=$?fc($,M):null,qS=TH(xn),WL=mE(qS),HL=mE(qS,[ie]),wl=fc(va,WL),Sl=on?YW(on,va):null,vu=J&&Sl?d({active:J,collisionRect:Sl,droppableRects:me,droppableContainers:I,pointerCoordinates:KS}):null,GS=zR(vu,"id"),[Hi,YS]=g.useState(null),KL=Ir?va:fc(va,HL),qL=qW(KL,(i=Hi==null?void 0:Hi.rect)!=null?i:null,ie),JS=g.useCallback((sn,hr)=>{let{sensor:mr,options:Ki}=hr;if(z.current==null)return;const Dr=O.get(z.current);if(!Dr)return;const ro=sn.nativeEvent,$o=new mr({active:z.current,activeNode:Dr,event:ro,options:Ki,context:ye,onStart(oo){const yu=z.current;if(yu==null)return;const xu=O.get(yu);if(!xu)return;const{onDragStart:jp}=A.current,Ap={active:{id:yu,data:xu.data,rect:B}};Yn.unstable_batchedUpdates(()=>{jp==null||jp(Ap),C(fs.Initializing),b({type:Dt.DragStart,initialCoordinates:oo,active:yu}),w({type:"onDragStart",event:Ap})})},onMove(oo){b({type:Dt.DragMove,coordinates:oo})},onEnd:kl(Dt.DragEnd),onCancel:kl(Dt.DragCancel)});Yn.unstable_batchedUpdates(()=>{R($o),E(sn.nativeEvent)});function kl(oo){return async function(){const{active:xu,collisions:jp,over:Ap,scrollAdjustedTranslate:ZS}=ye.current;let bu=null;if(xu&&ZS){const{cancelDrop:wu}=A.current;bu={activatorEvent:ro,active:xu,collisions:jp,delta:ZS,over:Ap},oo===Dt.DragEnd&&typeof wu=="function"&&await Promise.resolve(wu(bu))&&(oo=Dt.DragCancel)}z.current=null,Yn.unstable_batchedUpdates(()=>{b({type:oo}),C(fs.Uninitialized),YS(null),R(null),E(null);const wu=oo===Dt.DragEnd?"onDragEnd":"onDragCancel";if(bu){const Vv=A.current[wu];Vv==null||Vv(bu),w({type:wu,event:bu})}})}}},[O]),GL=g.useCallback((sn,hr)=>(mr,Ki)=>{const Dr=mr.nativeEvent,ro=O.get(Ki);if(z.current!==null||!ro||Dr.dndKit||Dr.defaultPrevented)return;const $o={active:ro};sn(mr,hr.options,$o)===!0&&(Dr.dndKit={capturedBy:hr.sensor},z.current=Ki,JS(mr,hr))},[O,JS]),XS=bH(u,GL);OH(u),Ro(()=>{ie&&k===fs.Initializing&&C(fs.Initialized)},[ie,k]),g.useEffect(()=>{const{onDragMove:sn}=A.current,{active:hr,activatorEvent:mr,collisions:Ki,over:Dr}=ye.current;if(!hr||!mr)return;const ro={active:hr,activatorEvent:mr,collisions:Ki,delta:{x:wl.x,y:wl.y},over:Dr};Yn.unstable_batchedUpdates(()=>{sn==null||sn(ro),w({type:"onDragMove",event:ro})})},[wl.x,wl.y]),g.useEffect(()=>{const{active:sn,activatorEvent:hr,collisions:mr,droppableContainers:Ki,scrollAdjustedTranslate:Dr}=ye.current;if(!sn||z.current==null||!hr||!Dr)return;const{onDragOver:ro}=A.current,$o=Ki.get(GS),kl=$o&&$o.rect.current?{id:$o.id,rect:$o.rect.current,data:$o.data,disabled:$o.disabled}:null,oo={active:sn,activatorEvent:hr,collisions:mr,delta:{x:Dr.x,y:Dr.y},over:kl};Yn.unstable_batchedUpdates(()=>{YS(kl),ro==null||ro(oo),w({type:"onDragOver",event:oo})})},[GS]),Ro(()=>{ye.current={activatorEvent:N,active:J,activeNode:q,collisionRect:Sl,collisions:vu,droppableRects:me,draggableNodes:O,draggingNode:rn,draggingNodeRect:on,droppableContainers:j,over:Hi,scrollableAncestors:xn,scrollAdjustedTranslate:wl},B.current={initial:on,translated:Sl}},[J,q,vu,Sl,O,rn,on,me,j,Hi,xn,wl]),gH({...oe,delta:M,draggingRect:Sl,pointerCoordinates:KS,scrollableAncestors:xn,scrollableAncestorRects:bl});const YL=g.useMemo(()=>({active:J,activeNode:q,activeNodeRect:ie,activatorEvent:N,collisions:vu,containerNodeRect:Te,dragOverlay:rt,draggableNodes:O,droppableContainers:j,droppableRects:me,over:Hi,measureDroppableContainers:ee,scrollableAncestors:xn,scrollableAncestorRects:bl,measuringConfiguration:U,measuringScheduled:ve,windowRect:Rn}),[J,q,ie,N,vu,Te,rt,O,j,me,Hi,ee,xn,bl,U,ve,Rn]),JL=g.useMemo(()=>({activatorEvent:N,activators:XS,active:J,activeNodeRect:ie,ariaDescribedById:{draggable:P},dispatch:b,draggableNodes:O,over:Hi,measureDroppableContainers:ee}),[N,XS,J,ie,b,P,O,Hi,ee]);return ge.createElement(DR.Provider,{value:S},ge.createElement(tv.Provider,{value:JL},ge.createElement(JR.Provider,{value:YL},ge.createElement(XR.Provider,{value:qL},c)),ge.createElement(zH,{disabled:(a==null?void 0:a.restoreFocus)===!1})),ge.createElement($W,{...a,hiddenTextDescribedById:P}));function XL(){const sn=(H==null?void 0:H.autoScrollEnabled)===!1,hr=typeof l=="object"?l.enabled===!1:l===!1,mr=T&&!sn&&!hr;return typeof l=="object"?{...l,enabled:mr}:{enabled:mr}}}),WH=g.createContext(null),gE="button",HH="Droppable";function KH(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=vp(HH),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:d,over:f}=g.useContext(tv),{role:h=gE,roleDescription:m="draggable",tabIndex:v=0}=o??{},x=(l==null?void 0:l.id)===t,b=g.useContext(x?XR:WH),[w,S]=Dm(),[k,C]=Dm(),T=NH(s,t),_=Sf(n);Ro(()=>(d.set(t,{id:t,key:i,node:w,activatorNode:k,data:_}),()=>{const M=d.get(t);M&&M.key===i&&d.delete(t)}),[d,t]);const O=g.useMemo(()=>({role:h,tabIndex:v,"aria-disabled":r,"aria-pressed":x&&h===gE?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,h,v,x,m,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:O,isDragging:x,listeners:r?void 0:T,node:w,over:f,setNodeRef:S,setActivatorNodeRef:C,transform:b}}function qH(){return g.useContext(JR)}const GH="Droppable",YH={timeout:25};function JH(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=vp(GH),{active:s,dispatch:a,over:l,measureDroppableContainers:c}=g.useContext(tv),u=g.useRef({disabled:n}),d=g.useRef(!1),f=g.useRef(null),h=g.useRef(null),{disabled:m,updateMeasurementsFor:v,timeout:x}={...YH,...o},b=Sf(v??r),w=g.useCallback(()=>{if(!d.current){d.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{c(Array.isArray(b.current)?b.current:[b.current]),h.current=null},x)},[x]),S=ev({callback:w,disabled:m||!s}),k=g.useCallback((O,M)=>{S&&(M&&(S.unobserve(M),d.current=!1),O&&S.observe(O))},[S]),[C,T]=Dm(k),_=Sf(t);return g.useEffect(()=>{!S||!C.current||(S.disconnect(),d.current=!1,S.observe(C.current))},[C,S]),Ro(()=>(a({type:Dt.RegisterDroppable,element:{id:r,key:i,disabled:n,node:C,rect:f,data:_}}),()=>a({type:Dt.UnregisterDroppable,key:i,id:r})),[r]),g.useEffect(()=>{n!==u.current.disabled&&(a({type:Dt.SetDroppableDisabled,id:r,key:i,disabled:n}),u.current.disabled=n)},[r,i,n,a]),{active:s,rect:f,isOver:(l==null?void 0:l.id)===r,node:C,over:l,setNodeRef:T}}function y1(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function XH(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function ah(e){return e!==null&&e>=0}function ZH(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]!==t[n])return!1;return!0}function QH(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const ZR=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=y1(t,r,n),s=t[o],a=i[o];return!a||!s?null:{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}},lh={scaleX:1,scaleY:1},e7=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:s}=e;const a=(t=i[n])!=null?t:r;if(!a)return null;if(o===n){const c=i[s];return c?{x:0,y:n<s?c.top+c.height-(a.top+a.height):c.top-a.top,...lh}:null}const l=t7(i,o,n);return o>n&&o<=s?{x:0,y:-a.height-l,...lh}:o<n&&o>=s?{x:0,y:a.height+l,...lh}:{x:0,y:0,...lh}};function t7(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?n<t?o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const QR="Sortable",ej=ge.createContext({activeIndex:-1,containerId:QR,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:ZR,disabled:{draggable:!1,droppable:!1}});function n7(e){let{children:t,id:n,items:r,strategy:o=ZR,disabled:i=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=qH(),d=vp(QR,n),f=a.rect!==null,h=g.useMemo(()=>r.map(T=>typeof T=="object"&&"id"in T?T.id:T),[r]),m=s!=null,v=s?h.indexOf(s.id):-1,x=c?h.indexOf(c.id):-1,b=g.useRef(h),w=!ZH(h,b.current),S=x!==-1&&v===-1||w,k=QH(i);Ro(()=>{w&&m&&u(h)},[w,h,m,u]),g.useEffect(()=>{b.current=h},[h]);const C=g.useMemo(()=>({activeIndex:v,containerId:d,disabled:k,disableTransforms:S,items:h,overIndex:x,useDragOverlay:f,sortedRects:XH(h,l),strategy:o}),[v,d,k.draggable,k.droppable,S,h,x,l,f,o]);return ge.createElement(ej.Provider,{value:C},t)}const r7=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return y1(n,r,o).indexOf(t)},o7=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:s,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==i&&o===s?!1:n?!0:s!==o&&t===l},i7={duration:200,easing:"ease"},tj="transform",s7=Cf.Transition.toString({property:tj,duration:0,easing:"linear"}),a7={roleDescription:"sortable"};function l7(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,s]=g.useState(null),a=g.useRef(n);return Ro(()=>{if(!t&&n!==a.current&&r.current){const l=o.current;if(l){const c=su(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&s(u)}}n!==a.current&&(a.current=n)},[t,n,r,o]),g.useEffect(()=>{i&&s(null)},[i]),i}function c7(e){let{animateLayoutChanges:t=o7,attributes:n,disabled:r,data:o,getNewIndex:i=r7,id:s,strategy:a,resizeObserverConfig:l,transition:c=i7}=e;const{items:u,containerId:d,activeIndex:f,disabled:h,disableTransforms:m,sortedRects:v,overIndex:x,useDragOverlay:b,strategy:w}=g.useContext(ej),S=u7(r,h),k=u.indexOf(s),C=g.useMemo(()=>({sortable:{containerId:d,index:k,items:u},...o}),[d,o,k,u]),T=g.useMemo(()=>u.slice(u.indexOf(s)),[u,s]),{rect:_,node:O,isOver:M,setNodeRef:j}=JH({id:s,data:C,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:T,...l}}),{active:L,activatorEvent:B,activeNodeRect:J,attributes:z,setNodeRef:H,listeners:R,isDragging:N,over:E,setActivatorNodeRef:A,transform:P}=KH({id:s,data:C,attributes:{...a7,...n},disabled:S.draggable}),I=TW(j,H),U=!!L,me=U&&!m&&ah(f)&&ah(x),ee=!b&&N,ve=ee&&me?P:null,$=me?ve??(a??w)({rects:v,activeNodeRect:J,activeIndex:f,overIndex:x,index:k}):null,oe=ah(f)&&ah(x)?i({id:s,items:u,activeIndex:f,overIndex:x}):k,ce=L==null?void 0:L.id,ie=g.useRef({activeId:ce,items:u,newIndex:oe,containerId:d}),Te=u!==ie.current.items,ye=t({active:L,containerId:d,isDragging:N,isSorting:U,id:s,index:k,items:u,newIndex:ie.current.newIndex,previousItems:ie.current.items,previousContainerId:ie.current.containerId,transition:c,wasDragging:ie.current.activeId!=null}),Pe=l7({disabled:!ye,index:k,node:O,rect:_});return g.useEffect(()=>{U&&ie.current.newIndex!==oe&&(ie.current.newIndex=oe),d!==ie.current.containerId&&(ie.current.containerId=d),u!==ie.current.items&&(ie.current.items=u)},[U,oe,d,u]),g.useEffect(()=>{if(ce===ie.current.activeId)return;if(ce&&!ie.current.activeId){ie.current.activeId=ce;return}const rn=setTimeout(()=>{ie.current.activeId=ce},50);return()=>clearTimeout(rn)},[ce]),{active:L,activeIndex:f,attributes:z,data:C,rect:_,index:k,newIndex:oe,items:u,isOver:M,isSorting:U,isDragging:N,listeners:R,node:O,overIndex:x,over:E,setNodeRef:I,setActivatorNodeRef:A,setDroppableNodeRef:j,setDraggableNodeRef:H,transform:Pe??$,transition:rt()};function rt(){if(Pe||Te&&ie.current.newIndex===k)return s7;if(!(ee&&!p1(B)||!c)&&(U||ye))return Cf.Transition.toString({...c,property:tj})}}function u7(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function zm(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const d7=[Be.Down,Be.Right,Be.Up,Be.Left],f7=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:s,scrollableAncestors:a}}=t;if(d7.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];i.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;const f=o.get(d.id);if(f)switch(e.code){case Be.Down:r.top<f.top&&l.push(d);break;case Be.Up:r.top>f.top&&l.push(d);break;case Be.Left:r.left>f.left&&l.push(d);break;case Be.Right:r.left<f.left&&l.push(d);break}});const c=WW({active:n,collisionRect:r,droppableRects:o,droppableContainers:l,pointerCoordinates:null});let u=zR(c,"id");if(u===(s==null?void 0:s.id)&&c.length>1&&(u=c[1].id),u!=null){const d=i.get(n.id),f=i.get(u),h=f?o.get(f.id):null,m=f==null?void 0:f.node.current;if(m&&h&&d&&f){const x=Qg(m).some((T,_)=>a[_]!==T),b=nj(d,f),w=p7(d,f),S=x||!b?{x:0,y:0}:{x:w?r.width-h.width:0,y:w?r.height-h.height:0},k={x:h.left,y:h.top};return S.x&&S.y?k:kf(k,S)}}}};function nj(e,t){return!zm(e)||!zm(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function p7(e,t){return!zm(e)||!zm(t)||!nj(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const au=g.forwardRef(({className:e,type:t,...n},r)=>p.jsx("input",{type:t,className:qe("flex h-10 m-1 w-[calc(100%-8px)] rounded-md border border-input bg-bg-primary px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));au.displayName="Input";function Mr({path:e}){const{validationErrors:t}=eu(),n=t[e];return n?p.jsx("div",{children:n.map((r,o)=>p.jsx("div",{className:"p-4 rounded bg-bg-error-primary text-text-primary",children:r.message},o))}):null}function rj({path:e,autoFocus:t}){const n="string",r=kt(e),o=Je(e,n),{patchPath:i,addDebouncedPatch:s}=vn(e),[a,l]=g.useState(!1),[c,u]=g.useState(null);return g.useEffect(()=>{!a&&"data"in o&&o.data!==void 0&&u(o.data)},["data"in o&&o.data,a]),r.status==="error"?p.jsx(Rt,{path:e,error:r.error,type:n}):o.status==="error"?p.jsx(Ke,{path:e,error:o.error,type:n}):o.status=="not-found"||r.status==="not-found"?p.jsx(gn,{path:e,type:n}):r.status==="loading"?p.jsx(nt,{path:e,type:n}):!("data"in o)||o.data===void 0?p.jsx(nt,{path:e,type:n}):r.data.type!==n?p.jsx(dr,{path:e,expectedType:n,actualType:r.data.type}):p.jsxs("div",{children:[p.jsx(Mr,{path:e}),p.jsx(au,{autoFocus:t,onFocus:()=>{l(!0)},onBlur:()=>{l(!1)},value:c||"",onChange:d=>{u(d.target.value),s(()=>[{op:"replace",path:i,value:d.target.value}],e)}})]})}function h7({path:e}){const t=Je(e,"string");return t.status==="error"?p.jsx(Ke,{path:e,error:t.error,type:"string"}):!("data"in t)||t.data===void 0?p.jsx(sr,{path:e}):t.data===null?p.jsx(ar,{path:e}):p.jsx("div",{className:"truncate",children:t.data})}function m7({path:e}){const t="boolean",n=kt(e),r=Je(e,t),{patchPath:o,addPatch:i}=vn(e);if(n.status==="error")return p.jsx(Rt,{path:e,error:n.error,type:t});if(r.status==="error")return p.jsx(Ke,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return p.jsx(gn,{path:e,type:t});if(n.status==="loading")return p.jsx(nt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return p.jsx(nt,{path:e,type:t});if(n.data.type!==t)return p.jsx(dr,{path:e,expectedType:t,actualType:n.data.type});const s=r.data,a=s===null?"indeterminate":s;return p.jsxs("div",{children:[p.jsx(Mr,{path:e}),p.jsx(ru,{checked:a,onCheckedChange:()=>{let l=!1;n.data.opt?a===!0?l=null:a===null?l=!1:a===!1?l=!0:(console.warn("Unexpected value for boolean field",a),l=!1):a===!0?l=!1:a==="indeterminate"||a===!1?l=!0:(console.warn("Unexpected value for boolean field",a),l=!1),i([{op:"replace",path:o,value:l}])}})]})}function g7({path:e,source:t,isNullable:n,loadingStatus:r}){const{addPatch:o,patchPath:i}=vn(e);return typeof t!="boolean"&&t!==null?p.jsx(Ke,{path:e,error:"Expected boolean",type:"boolean"}):p.jsx(ru,{disabled:r==="loading",checked:t===null?"indeterminate":typeof t=="boolean"?t:!1,onCheckedChange:()=>{o(t===null?[{op:"replace",path:i,value:!0}]:t===!1&&n?[{op:"replace",path:i,value:null}]:t===!1?[{op:"replace",path:i,value:!0}]:[{op:"replace",path:i,value:!1}])}})}function v7({path:e}){const t=Je(e,"boolean");return t.status==="error"?p.jsx(Ke,{path:e,error:t.error,type:"boolean"}):!("data"in t)||t.data===void 0?p.jsx(sr,{path:e}):t.data===null?p.jsx(ar,{path:e}):t.data===!0?p.jsx("div",{className:"flex items-center justify-center w-4 h-4 border rounded border-text-primary",children:p.jsx(ap,{className:"w-3 h-3"})}):t.data===!1?p.jsx("div",{className:"w-4 h-4 border rounded border-text-primary"}):(console.warn("Unexpected value for boolean field",t.data),p.jsx("div",{className:"w-4 h-4 rounded border-bg-brand-primary"}))}function y7({path:e}){const t="number",n=kt(e),r=Je(e,t),{patchPath:o,addPatch:i}=vn(e);if(n.status==="error")return p.jsx(Rt,{path:e,error:n.error,type:t});if(r.status==="error")return p.jsx(Ke,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return p.jsx(gn,{path:e,type:t});if(n.status==="loading")return p.jsx(nt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return p.jsx(nt,{path:e,type:t});if(n.data.type!==t)return p.jsx(dr,{path:e,expectedType:t,actualType:n.data.type});const s=r.data;return p.jsxs("div",{children:[p.jsx(Mr,{path:e}),p.jsx(au,{inputMode:"numeric",value:s||0,onChange:a=>{const l=Number(a.target.value);Number.isNaN(l)||i([{op:"replace",path:o,value:l}])}})]})}function x7({path:e}){const t=Je(e,"number");return t.status==="error"?p.jsx(Ke,{path:e,error:t.error,type:"number"}):!("data"in t)||t.data===void 0?p.jsx(sr,{path:e}):t.data===null?p.jsx(ar,{path:e}):p.jsx("div",{className:"truncate",children:t.data})}function b7(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];function c(d){const{scope:f,children:h,...m}=d,v=(f==null?void 0:f[e][l])||a,x=g.useMemo(()=>m,Object.values(m));return p.jsx(v.Provider,{value:x,children:h})}function u(d,f){const h=(f==null?void 0:f[e][l])||a,m=g.useContext(h);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>g.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,w7(o,...t)]}function w7(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function nv(e){const t=e+"CollectionProvider",[n,r]=b7(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=h=>{const{scope:m,children:v}=h,x=ge.useRef(null),b=ge.useRef(new Map).current;return p.jsx(o,{scope:m,itemMap:b,collectionRef:x,children:v})};s.displayName=t;const a=e+"CollectionSlot",l=ge.forwardRef((h,m)=>{const{scope:v,children:x}=h,b=i(a,v),w=Ie(m,b.collectionRef);return p.jsx(Ai,{ref:w,children:x})});l.displayName=a;const c=e+"CollectionItemSlot",u="data-radix-collection-item",d=ge.forwardRef((h,m)=>{const{scope:v,children:x,...b}=h,w=ge.useRef(null),S=Ie(m,w),k=i(c,v);return ge.useEffect(()=>(k.itemMap.set(w,{ref:w,...b}),()=>void k.itemMap.delete(w))),p.jsx(Ai,{[u]:"",ref:S,children:x})});d.displayName=c;function f(h){const m=i(e+"CollectionConsumer",h);return ge.useCallback(()=>{const x=m.collectionRef.current;if(!x)return[];const b=Array.from(x.querySelectorAll(`[${u}]`));return Array.from(m.itemMap.values()).sort((k,C)=>b.indexOf(k.ref.current)-b.indexOf(C.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:s,Slot:l,ItemSlot:d},f,r]}const S7=["top","right","bottom","left"],Js=Math.min,br=Math.max,$m=Math.round,ch=Math.floor,Yo=e=>({x:e,y:e}),k7={left:"right",right:"left",bottom:"top",top:"bottom"},C7={start:"end",end:"start"};function j0(e,t,n){return br(e,Js(t,n))}function Ii(e,t){return typeof e=="function"?e(t):e}function Di(e){return e.split("-")[0]}function lu(e){return e.split("-")[1]}function x1(e){return e==="x"?"y":"x"}function b1(e){return e==="y"?"height":"width"}function Xs(e){return["top","bottom"].includes(Di(e))?"y":"x"}function w1(e){return x1(Xs(e))}function E7(e,t,n){n===void 0&&(n=!1);const r=lu(e),o=w1(e),i=b1(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Bm(s)),[s,Bm(s)]}function _7(e){const t=Bm(e);return[A0(e),t,A0(t)]}function A0(e){return e.replace(/start|end/g,t=>C7[t])}function T7(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function O7(e,t,n,r){const o=lu(e);let i=T7(Di(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(A0)))),i}function Bm(e){return e.replace(/left|right|bottom|top/g,t=>k7[t])}function N7(e){return{top:0,right:0,bottom:0,left:0,...e}}function oj(e){return typeof e!="number"?N7(e):{top:e,right:e,bottom:e,left:e}}function Vm(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function vE(e,t,n){let{reference:r,floating:o}=e;const i=Xs(t),s=w1(t),a=b1(s),l=Di(t),c=i==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[a]/2-o[a]/2;let h;switch(l){case"top":h={x:u,y:r.y-o.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-o.width,y:d};break;default:h={x:r.x,y:r.y}}switch(lu(t)){case"start":h[s]-=f*(n&&c?-1:1);break;case"end":h[s]+=f*(n&&c?-1:1);break}return h}const M7=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=vE(c,r,l),f=r,h={},m=0;for(let v=0;v<a.length;v++){const{name:x,fn:b}=a[v],{x:w,y:S,data:k,reset:C}=await b({x:u,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:h,rects:c,platform:s,elements:{reference:e,floating:t}});u=w??u,d=S??d,h={...h,[x]:{...h[x],...k}},C&&m<=50&&(m++,typeof C=="object"&&(C.placement&&(f=C.placement),C.rects&&(c=C.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:u,y:d}=vE(c,f,l)),v=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:h}};async function _f(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=Ii(t,e),m=oj(h),x=a[f?d==="floating"?"reference":"floating":d],b=Vm(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(x)))==null||n?x:x.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),w=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),k=await(i.isElement==null?void 0:i.isElement(S))?await(i.getScale==null?void 0:i.getScale(S))||{x:1,y:1}:{x:1,y:1},C=Vm(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:S,strategy:l}):w);return{top:(b.top-C.top+m.top)/k.y,bottom:(C.bottom-b.bottom+m.bottom)/k.y,left:(b.left-C.left+m.left)/k.x,right:(C.right-b.right+m.right)/k.x}}const P7=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=Ii(e,t)||{};if(c==null)return{};const d=oj(u),f={x:n,y:r},h=w1(o),m=b1(h),v=await s.getDimensions(c),x=h==="y",b=x?"top":"left",w=x?"bottom":"right",S=x?"clientHeight":"clientWidth",k=i.reference[m]+i.reference[h]-f[h]-i.floating[m],C=f[h]-i.reference[h],T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let _=T?T[S]:0;(!_||!await(s.isElement==null?void 0:s.isElement(T)))&&(_=a.floating[S]||i.floating[m]);const O=k/2-C/2,M=_/2-v[m]/2-1,j=Js(d[b],M),L=Js(d[w],M),B=j,J=_-v[m]-L,z=_/2-v[m]/2+O,H=j0(B,z,J),R=!l.arrow&&lu(o)!=null&&z!==H&&i.reference[m]/2-(z<B?j:L)-v[m]/2<0,N=R?z<B?z-B:z-J:0;return{[h]:f[h]+N,data:{[h]:H,centerOffset:z-H-N,...R&&{alignmentOffset:N}},reset:R}}}),R7=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=!0,...x}=Ii(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=Di(o),w=Xs(a),S=Di(a)===a,k=await(l.isRTL==null?void 0:l.isRTL(c.floating)),C=f||(S||!v?[Bm(a)]:_7(a)),T=m!=="none";!f&&T&&C.push(...O7(a,v,m,k));const _=[a,...C],O=await _f(t,x),M=[];let j=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&M.push(O[b]),d){const z=E7(o,s,k);M.push(O[z[0]],O[z[1]])}if(j=[...j,{placement:o,overflows:M}],!M.every(z=>z<=0)){var L,B;const z=(((L=i.flip)==null?void 0:L.index)||0)+1,H=_[z];if(H)return{data:{index:z,overflows:j},reset:{placement:H}};let R=(B=j.filter(N=>N.overflows[0]<=0).sort((N,E)=>N.overflows[1]-E.overflows[1])[0])==null?void 0:B.placement;if(!R)switch(h){case"bestFit":{var J;const N=(J=j.filter(E=>{if(T){const A=Xs(E.placement);return A===w||A==="y"}return!0}).map(E=>[E.placement,E.overflows.filter(A=>A>0).reduce((A,P)=>A+P,0)]).sort((E,A)=>E[1]-A[1])[0])==null?void 0:J[0];N&&(R=N);break}case"initialPlacement":R=a;break}if(o!==R)return{reset:{placement:R}}}return{}}}};function yE(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function xE(e){return S7.some(t=>e[t]>=0)}const j7=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=Ii(e,t);switch(r){case"referenceHidden":{const i=await _f(t,{...o,elementContext:"reference"}),s=yE(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:xE(s)}}}case"escaped":{const i=await _f(t,{...o,altBoundary:!0}),s=yE(i,n.floating);return{data:{escapedOffsets:s,escaped:xE(s)}}}default:return{}}}}};async function A7(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Di(n),a=lu(n),l=Xs(n)==="y",c=["left","top"].includes(s)?-1:1,u=i&&l?-1:1,d=Ii(t,e);let{mainAxis:f,crossAxis:h,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof m=="number"&&(h=a==="end"?m*-1:m),l?{x:h*u,y:f*c}:{x:f*c,y:h*u}}const I7=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await A7(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},D7=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:x=>{let{x:b,y:w}=x;return{x:b,y:w}}},...l}=Ii(e,t),c={x:n,y:r},u=await _f(t,l),d=Xs(Di(o)),f=x1(d);let h=c[f],m=c[d];if(i){const x=f==="y"?"top":"left",b=f==="y"?"bottom":"right",w=h+u[x],S=h-u[b];h=j0(w,h,S)}if(s){const x=d==="y"?"top":"left",b=d==="y"?"bottom":"right",w=m+u[x],S=m-u[b];m=j0(w,m,S)}const v=a.fn({...t,[f]:h,[d]:m});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[f]:i,[d]:s}}}}}},L7=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Ii(e,t),u={x:n,y:r},d=Xs(o),f=x1(d);let h=u[f],m=u[d];const v=Ii(a,t),x=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(l){const S=f==="y"?"height":"width",k=i.reference[f]-i.floating[S]+x.mainAxis,C=i.reference[f]+i.reference[S]-x.mainAxis;h<k?h=k:h>C&&(h=C)}if(c){var b,w;const S=f==="y"?"width":"height",k=["top","left"].includes(Di(o)),C=i.reference[d]-i.floating[S]+(k&&((b=s.offset)==null?void 0:b[d])||0)+(k?0:x.crossAxis),T=i.reference[d]+i.reference[S]+(k?0:((w=s.offset)==null?void 0:w[d])||0)-(k?x.crossAxis:0);m<C?m=C:m>T&&(m=T)}return{[f]:h,[d]:m}}}},F7=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:s,elements:a}=t,{apply:l=()=>{},...c}=Ii(e,t),u=await _f(t,c),d=Di(o),f=lu(o),h=Xs(o)==="y",{width:m,height:v}=i.floating;let x,b;d==="top"||d==="bottom"?(x=d,b=f===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(b=d,x=f==="end"?"top":"bottom");const w=v-u.top-u.bottom,S=m-u.left-u.right,k=Js(v-u[x],w),C=Js(m-u[b],S),T=!t.middlewareData.shift;let _=k,O=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=S),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(_=w),T&&!f){const j=br(u.left,0),L=br(u.right,0),B=br(u.top,0),J=br(u.bottom,0);h?O=m-2*(j!==0||L!==0?j+L:br(u.left,u.right)):_=v-2*(B!==0||J!==0?B+J:br(u.top,u.bottom))}await l({...t,availableWidth:O,availableHeight:_});const M=await s.getDimensions(a.floating);return m!==M.width||v!==M.height?{reset:{rects:!0}}:{}}}};function rv(){return typeof window<"u"}function cu(e){return ij(e)?(e.nodeName||"").toLowerCase():"#document"}function _r(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function si(e){var t;return(t=(ij(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ij(e){return rv()?e instanceof Node||e instanceof _r(e).Node:!1}function Ao(e){return rv()?e instanceof Element||e instanceof _r(e).Element:!1}function ei(e){return rv()?e instanceof HTMLElement||e instanceof _r(e).HTMLElement:!1}function bE(e){return!rv()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof _r(e).ShadowRoot}function yp(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Io(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function z7(e){return["table","td","th"].includes(cu(e))}function ov(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function S1(e){const t=k1(),n=Ao(e)?Io(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function $7(e){let t=Zs(e);for(;ei(t)&&!Lc(t);){if(S1(t))return t;if(ov(t))return null;t=Zs(t)}return null}function k1(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Lc(e){return["html","body","#document"].includes(cu(e))}function Io(e){return _r(e).getComputedStyle(e)}function iv(e){return Ao(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Zs(e){if(cu(e)==="html")return e;const t=e.assignedSlot||e.parentNode||bE(e)&&e.host||si(e);return bE(t)?t.host:t}function sj(e){const t=Zs(e);return Lc(t)?e.ownerDocument?e.ownerDocument.body:e.body:ei(t)&&yp(t)?t:sj(t)}function Tf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=sj(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=_r(o);if(i){const a=I0(s);return t.concat(s,s.visualViewport||[],yp(o)?o:[],a&&n?Tf(a):[])}return t.concat(o,Tf(o,[],n))}function I0(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function aj(e){const t=Io(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=ei(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=$m(n)!==i||$m(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function C1(e){return Ao(e)?e:e.contextElement}function pc(e){const t=C1(e);if(!ei(t))return Yo(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=aj(t);let s=(i?$m(n.width):n.width)/r,a=(i?$m(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const B7=Yo(0);function lj(e){const t=_r(e);return!k1()||!t.visualViewport?B7:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function V7(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==_r(e)?!1:t}function tl(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=C1(e);let s=Yo(1);t&&(r?Ao(r)&&(s=pc(r)):s=pc(e));const a=V7(i,n,r)?lj(i):Yo(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(i){const f=_r(i),h=r&&Ao(r)?_r(r):r;let m=f,v=I0(m);for(;v&&r&&h!==m;){const x=pc(v),b=v.getBoundingClientRect(),w=Io(v),S=b.left+(v.clientLeft+parseFloat(w.paddingLeft))*x.x,k=b.top+(v.clientTop+parseFloat(w.paddingTop))*x.y;l*=x.x,c*=x.y,u*=x.x,d*=x.y,l+=S,c+=k,m=_r(v),v=I0(m)}}return Vm({width:u,height:d,x:l,y:c})}function E1(e,t){const n=iv(e).scrollLeft;return t?t.left+n:tl(si(e)).left+n}function cj(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-(n?0:E1(e,r)),i=r.top+t.scrollTop;return{x:o,y:i}}function U7(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=si(r),a=t?ov(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Yo(1);const u=Yo(0),d=ei(r);if((d||!d&&!i)&&((cu(r)!=="body"||yp(s))&&(l=iv(r)),ei(r))){const h=tl(r);c=pc(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const f=s&&!d&&!i?cj(s,l,!0):Yo(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-l.scrollTop*c.y+u.y+f.y}}function W7(e){return Array.from(e.getClientRects())}function H7(e){const t=si(e),n=iv(e),r=e.ownerDocument.body,o=br(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=br(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+E1(e);const a=-n.scrollTop;return Io(r).direction==="rtl"&&(s+=br(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function K7(e,t){const n=_r(e),r=si(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const c=k1();(!c||c&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}function q7(e,t){const n=tl(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=ei(e)?pc(e):Yo(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,c=r*i.y;return{width:s,height:a,x:l,y:c}}function wE(e,t,n){let r;if(t==="viewport")r=K7(e,n);else if(t==="document")r=H7(si(e));else if(Ao(t))r=q7(t,n);else{const o=lj(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Vm(r)}function uj(e,t){const n=Zs(e);return n===t||!Ao(n)||Lc(n)?!1:Io(n).position==="fixed"||uj(n,t)}function G7(e,t){const n=t.get(e);if(n)return n;let r=Tf(e,[],!1).filter(a=>Ao(a)&&cu(a)!=="body"),o=null;const i=Io(e).position==="fixed";let s=i?Zs(e):e;for(;Ao(s)&&!Lc(s);){const a=Io(s),l=S1(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||yp(s)&&!l&&uj(e,s))?r=r.filter(u=>u!==s):o=a,s=Zs(s)}return t.set(e,r),r}function Y7(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?ov(t)?[]:G7(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const d=wE(t,u,o);return c.top=br(d.top,c.top),c.right=Js(d.right,c.right),c.bottom=Js(d.bottom,c.bottom),c.left=br(d.left,c.left),c},wE(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function J7(e){const{width:t,height:n}=aj(e);return{width:t,height:n}}function X7(e,t,n){const r=ei(t),o=si(t),i=n==="fixed",s=tl(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=Yo(0);if(r||!r&&!i)if((cu(t)!=="body"||yp(o))&&(a=iv(t)),r){const f=tl(t,!0,i,t);l.x=f.x+t.clientLeft,l.y=f.y+t.clientTop}else o&&(l.x=E1(o));const c=o&&!r&&!i?cj(o,a):Yo(0),u=s.left+a.scrollLeft-l.x-c.x,d=s.top+a.scrollTop-l.y-c.y;return{x:u,y:d,width:s.width,height:s.height}}function Uy(e){return Io(e).position==="static"}function SE(e,t){if(!ei(e)||Io(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return si(e)===n&&(n=n.ownerDocument.body),n}function dj(e,t){const n=_r(e);if(ov(e))return n;if(!ei(e)){let o=Zs(e);for(;o&&!Lc(o);){if(Ao(o)&&!Uy(o))return o;o=Zs(o)}return n}let r=SE(e,t);for(;r&&z7(r)&&Uy(r);)r=SE(r,t);return r&&Lc(r)&&Uy(r)&&!S1(r)?n:r||$7(e)||n}const Z7=async function(e){const t=this.getOffsetParent||dj,n=this.getDimensions,r=await n(e.floating);return{reference:X7(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Q7(e){return Io(e).direction==="rtl"}const eK={convertOffsetParentRelativeRectToViewportRelativeRect:U7,getDocumentElement:si,getClippingRect:Y7,getOffsetParent:dj,getElementRects:Z7,getClientRects:W7,getDimensions:J7,getScale:pc,isElement:Ao,isRTL:Q7};function tK(e,t){let n=null,r;const o=si(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const{left:c,top:u,width:d,height:f}=e.getBoundingClientRect();if(a||t(),!d||!f)return;const h=ch(u),m=ch(o.clientWidth-(c+d)),v=ch(o.clientHeight-(u+f)),x=ch(c),w={rootMargin:-h+"px "+-m+"px "+-v+"px "+-x+"px",threshold:br(0,Js(1,l))||1};let S=!0;function k(C){const T=C[0].intersectionRatio;if(T!==l){if(!S)return s();T?s(!1,T):r=setTimeout(()=>{s(!1,1e-7)},1e3)}S=!1}try{n=new IntersectionObserver(k,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(k,w)}n.observe(e)}return s(!0),i}function nK(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=C1(e),u=o||i?[...c?Tf(c):[],...Tf(t)]:[];u.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const d=c&&a?tK(c,n):null;let f=-1,h=null;s&&(h=new ResizeObserver(b=>{let[w]=b;w&&w.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var S;(S=h)==null||S.observe(t)})),n()}),c&&!l&&h.observe(c),h.observe(t));let m,v=l?tl(e):null;l&&x();function x(){const b=tl(e);v&&(b.x!==v.x||b.y!==v.y||b.width!==v.width||b.height!==v.height)&&n(),v=b,m=requestAnimationFrame(x)}return n(),()=>{var b;u.forEach(w=>{o&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),d==null||d(),(b=h)==null||b.disconnect(),h=null,l&&cancelAnimationFrame(m)}}const rK=I7,oK=D7,iK=R7,sK=F7,aK=j7,kE=P7,lK=L7,cK=(e,t,n)=>{const r=new Map,o={platform:eK,...n},i={...o.platform,_c:r};return M7(e,t,{...o,platform:i})};var jh=typeof document<"u"?g.useLayoutEffect:g.useEffect;function Um(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,o;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(!Um(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!Um(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function fj(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function CE(e,t){const n=fj(e);return Math.round(t*n)/n}function Wy(e){const t=g.useRef(e);return jh(()=>{t.current=e}),t}function uK(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,d]=g.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,h]=g.useState(r);Um(f,r)||h(r);const[m,v]=g.useState(null),[x,b]=g.useState(null),w=g.useCallback(E=>{E!==T.current&&(T.current=E,v(E))},[]),S=g.useCallback(E=>{E!==_.current&&(_.current=E,b(E))},[]),k=i||m,C=s||x,T=g.useRef(null),_=g.useRef(null),O=g.useRef(u),M=l!=null,j=Wy(l),L=Wy(o),B=Wy(c),J=g.useCallback(()=>{if(!T.current||!_.current)return;const E={placement:t,strategy:n,middleware:f};L.current&&(E.platform=L.current),cK(T.current,_.current,E).then(A=>{const P={...A,isPositioned:B.current!==!1};z.current&&!Um(O.current,P)&&(O.current=P,Yn.flushSync(()=>{d(P)}))})},[f,t,n,L,B]);jh(()=>{c===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,d(E=>({...E,isPositioned:!1})))},[c]);const z=g.useRef(!1);jh(()=>(z.current=!0,()=>{z.current=!1}),[]),jh(()=>{if(k&&(T.current=k),C&&(_.current=C),k&&C){if(j.current)return j.current(k,C,J);J()}},[k,C,J,j,M]);const H=g.useMemo(()=>({reference:T,floating:_,setReference:w,setFloating:S}),[w,S]),R=g.useMemo(()=>({reference:k,floating:C}),[k,C]),N=g.useMemo(()=>{const E={position:n,left:0,top:0};if(!R.floating)return E;const A=CE(R.floating,u.x),P=CE(R.floating,u.y);return a?{...E,transform:"translate("+A+"px, "+P+"px)",...fj(R.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:A,top:P}},[n,a,R.floating,u.x,u.y]);return g.useMemo(()=>({...u,update:J,refs:H,elements:R,floatingStyles:N}),[u,J,H,R,N])}const dK=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?kE({element:r.current,padding:o}).fn(n):{}:r?kE({element:r,padding:o}).fn(n):{}}}},fK=(e,t)=>({...rK(e),options:[e,t]}),pK=(e,t)=>({...oK(e),options:[e,t]}),hK=(e,t)=>({...lK(e),options:[e,t]}),mK=(e,t)=>({...iK(e),options:[e,t]}),gK=(e,t)=>({...sK(e),options:[e,t]}),vK=(e,t)=>({...aK(e),options:[e,t]}),yK=(e,t)=>({...dK(e),options:[e,t]});var xK="Arrow",pj=g.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return p.jsx(Ee.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:p.jsx("polygon",{points:"0,0 30,0 15,10"})})});pj.displayName=xK;var bK=pj;function wK(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];function c(d){const{scope:f,children:h,...m}=d,v=(f==null?void 0:f[e][l])||a,x=g.useMemo(()=>m,Object.values(m));return p.jsx(v.Provider,{value:x,children:h})}function u(d,f){const h=(f==null?void 0:f[e][l])||a,m=g.useContext(h);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>g.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,SK(o,...t)]}function SK(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var _1="Popper",[hj,uu]=wK(_1),[kK,mj]=hj(_1),gj=e=>{const{__scopePopper:t,children:n}=e,[r,o]=g.useState(null);return p.jsx(kK,{scope:t,anchor:r,onAnchorChange:o,children:n})};gj.displayName=_1;var vj="PopperAnchor",yj=g.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=mj(vj,n),s=g.useRef(null),a=Ie(t,s);return g.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:p.jsx(Ee.div,{...o,ref:a})});yj.displayName=vj;var T1="PopperContent",[CK,EK]=hj(T1),xj=g.forwardRef((e,t)=>{var $,oe,ce,ie,Te,ye;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:h="optimized",onPlaced:m,...v}=e,x=mj(T1,n),[b,w]=g.useState(null),S=Ie(t,Pe=>w(Pe)),[k,C]=g.useState(null),T=yP(k),_=(T==null?void 0:T.width)??0,O=(T==null?void 0:T.height)??0,M=r+(i!=="center"?"-"+i:""),j=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},L=Array.isArray(c)?c:[c],B=L.length>0,J={padding:j,boundary:L.filter(TK),altBoundary:B},{refs:z,floatingStyles:H,placement:R,isPositioned:N,middlewareData:E}=uK({strategy:"fixed",placement:M,whileElementsMounted:(...Pe)=>nK(...Pe,{animationFrame:h==="always"}),elements:{reference:x.anchor},middleware:[fK({mainAxis:o+O,alignmentAxis:s}),l&&pK({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?hK():void 0,...J}),l&&mK({...J}),gK({...J,apply:({elements:Pe,rects:rt,availableWidth:rn,availableHeight:on})=>{const{width:Ir,height:yn}=rt.reference,Rn=Pe.floating.style;Rn.setProperty("--radix-popper-available-width",`${rn}px`),Rn.setProperty("--radix-popper-available-height",`${on}px`),Rn.setProperty("--radix-popper-anchor-width",`${Ir}px`),Rn.setProperty("--radix-popper-anchor-height",`${yn}px`)}}),k&&yK({element:k,padding:a}),OK({arrowWidth:_,arrowHeight:O}),f&&vK({strategy:"referenceHidden",...J})]}),[A,P]=Sj(R),I=Ft(m);mn(()=>{N&&(I==null||I())},[N,I]);const U=($=E.arrow)==null?void 0:$.x,me=(oe=E.arrow)==null?void 0:oe.y,ee=((ce=E.arrow)==null?void 0:ce.centerOffset)!==0,[ve,q]=g.useState();return mn(()=>{b&&q(window.getComputedStyle(b).zIndex)},[b]),p.jsx("div",{ref:z.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:N?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ve,"--radix-popper-transform-origin":[(ie=E.transformOrigin)==null?void 0:ie.x,(Te=E.transformOrigin)==null?void 0:Te.y].join(" "),...((ye=E.hide)==null?void 0:ye.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:p.jsx(CK,{scope:n,placedSide:A,onArrowChange:C,arrowX:U,arrowY:me,shouldHideArrow:ee,children:p.jsx(Ee.div,{"data-side":A,"data-align":P,...v,ref:S,style:{...v.style,animation:N?void 0:"none"}})})})});xj.displayName=T1;var bj="PopperArrow",_K={top:"bottom",right:"left",bottom:"top",left:"right"},wj=g.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=EK(bj,r),s=_K[i.placedSide];return p.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]: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:p.jsx(bK,{...o,ref:n,style:{...o.style,display:"block"}})})});wj.displayName=bj;function TK(e){return e!==null}var OK=e=>({name:"transformOrigin",options:e,fn(t){var x,b,w;const{placement:n,rects:r,middlewareData:o}=t,s=((x=o.arrow)==null?void 0:x.centerOffset)!==0,a=s?0:e.arrowWidth,l=s?0:e.arrowHeight,[c,u]=Sj(n),d={start:"0%",center:"50%",end:"100%"}[u],f=(((b=o.arrow)==null?void 0:b.x)??0)+a/2,h=(((w=o.arrow)==null?void 0:w.y)??0)+l/2;let m="",v="";return c==="bottom"?(m=s?d:`${f}px`,v=`${-l}px`):c==="top"?(m=s?d:`${f}px`,v=`${r.floating.height+l}px`):c==="right"?(m=`${-l}px`,v=s?d:`${h}px`):c==="left"&&(m=`${r.floating.width+l}px`,v=s?d:`${h}px`),{data:{x:m,y:v}}}});function Sj(e){const[t,n="center"]=e.split("-");return[t,n]}var O1=gj,sv=yj,N1=xj,M1=wj,NK="VisuallyHidden",kj=g.forwardRef((e,t)=>p.jsx(Ee.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));kj.displayName=NK;var MK=[" ","Enter","ArrowUp","ArrowDown"],PK=[" ","Enter"],xp="Select",[av,lv,RK]=nv(xp),[du,cfe]=Bi(xp,[RK,uu]),cv=uu(),[jK,da]=du(xp),[AK,IK]=du(xp),Cj=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:i,value:s,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:d,disabled:f,required:h,form:m}=e,v=cv(t),[x,b]=g.useState(null),[w,S]=g.useState(null),[k,C]=g.useState(!1),T=cp(c),[_=!1,O]=Qo({prop:r,defaultProp:o,onChange:i}),[M,j]=Qo({prop:s,defaultProp:a,onChange:l}),L=g.useRef(null),B=x?m||!!x.closest("form"):!0,[J,z]=g.useState(new Set),H=Array.from(J).map(R=>R.props.value).join(";");return p.jsx(O1,{...v,children:p.jsxs(jK,{required:h,scope:t,trigger:x,onTriggerChange:b,valueNode:w,onValueNodeChange:S,valueNodeHasChildren:k,onValueNodeHasChildrenChange:C,contentId:Hr(),value:M,onValueChange:j,open:_,onOpenChange:O,dir:T,triggerPointerDownPosRef:L,disabled:f,children:[p.jsx(av.Provider,{scope:t,children:p.jsx(AK,{scope:e.__scopeSelect,onNativeOptionAdd:g.useCallback(R=>{z(N=>new Set(N).add(R))},[]),onNativeOptionRemove:g.useCallback(R=>{z(N=>{const E=new Set(N);return E.delete(R),E})},[]),children:n})}),B?p.jsxs(qj,{"aria-hidden":!0,required:h,tabIndex:-1,name:u,autoComplete:d,value:M,onChange:R=>j(R.target.value),disabled:f,form:m,children:[M===void 0?p.jsx("option",{value:""}):null,Array.from(J)]},H):null]})})};Cj.displayName=xp;var Ej="SelectTrigger",_j=g.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,i=cv(n),s=da(Ej,n),a=s.disabled||r,l=Ie(t,s.onTriggerChange),c=lv(n),u=g.useRef("touch"),[d,f,h]=Gj(v=>{const x=c().filter(S=>!S.disabled),b=x.find(S=>S.value===s.value),w=Yj(x,v,b);w!==void 0&&s.onValueChange(w.value)}),m=v=>{a||(s.onOpenChange(!0),h()),v&&(s.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return p.jsx(sv,{asChild:!0,...i,children:p.jsx(Ee.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":Kj(s.value)?"":void 0,...o,ref:l,onClick:re(o.onClick,v=>{v.currentTarget.focus(),u.current!=="mouse"&&m(v)}),onPointerDown:re(o.onPointerDown,v=>{u.current=v.pointerType;const x=v.target;x.hasPointerCapture(v.pointerId)&&x.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(m(v),v.preventDefault())}),onKeyDown:re(o.onKeyDown,v=>{const x=d.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&f(v.key),!(x&&v.key===" ")&&MK.includes(v.key)&&(m(),v.preventDefault())})})})});_j.displayName=Ej;var Tj="SelectValue",Oj=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:i,placeholder:s="",...a}=e,l=da(Tj,n),{onValueNodeHasChildrenChange:c}=l,u=i!==void 0,d=Ie(t,l.onValueNodeChange);return mn(()=>{c(u)},[c,u]),p.jsx(Ee.span,{...a,ref:d,style:{pointerEvents:"none"},children:Kj(l.value)?p.jsx(p.Fragment,{children:s}):i})});Oj.displayName=Tj;var DK="SelectIcon",Nj=g.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return p.jsx(Ee.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});Nj.displayName=DK;var LK="SelectPortal",Mj=e=>p.jsx(pp,{asChild:!0,...e});Mj.displayName=LK;var nl="SelectContent",Pj=g.forwardRef((e,t)=>{const n=da(nl,e.__scopeSelect),[r,o]=g.useState();if(mn(()=>{o(new DocumentFragment)},[]),!n.open){const i=r;return i?Yn.createPortal(p.jsx(Rj,{scope:e.__scopeSelect,children:p.jsx(av.Slot,{scope:e.__scopeSelect,children:p.jsx("div",{children:e.children})})}),i):null}return p.jsx(jj,{...e,ref:t})});Pj.displayName=nl;var uo=10,[Rj,fa]=du(nl),FK="SelectContentImpl",jj=g.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:s,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:h,sticky:m,hideWhenDetached:v,avoidCollisions:x,...b}=e,w=da(nl,n),[S,k]=g.useState(null),[C,T]=g.useState(null),_=Ie(t,$=>k($)),[O,M]=g.useState(null),[j,L]=g.useState(null),B=lv(n),[J,z]=g.useState(!1),H=g.useRef(!1);g.useEffect(()=>{if(S)return Xg(S)},[S]),Yg();const R=g.useCallback($=>{const[oe,...ce]=B().map(ye=>ye.ref.current),[ie]=ce.slice(-1),Te=document.activeElement;for(const ye of $)if(ye===Te||(ye==null||ye.scrollIntoView({block:"nearest"}),ye===oe&&C&&(C.scrollTop=0),ye===ie&&C&&(C.scrollTop=C.scrollHeight),ye==null||ye.focus(),document.activeElement!==Te))return},[B,C]),N=g.useCallback(()=>R([O,S]),[R,O,S]);g.useEffect(()=>{J&&N()},[J,N]);const{onOpenChange:E,triggerPointerDownPosRef:A}=w;g.useEffect(()=>{if(S){let $={x:0,y:0};const oe=ie=>{var Te,ye;$={x:Math.abs(Math.round(ie.pageX)-(((Te=A.current)==null?void 0:Te.x)??0)),y:Math.abs(Math.round(ie.pageY)-(((ye=A.current)==null?void 0:ye.y)??0))}},ce=ie=>{$.x<=10&&$.y<=10?ie.preventDefault():S.contains(ie.target)||E(!1),document.removeEventListener("pointermove",oe),A.current=null};return A.current!==null&&(document.addEventListener("pointermove",oe),document.addEventListener("pointerup",ce,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",oe),document.removeEventListener("pointerup",ce,{capture:!0})}}},[S,E,A]),g.useEffect(()=>{const $=()=>E(!1);return window.addEventListener("blur",$),window.addEventListener("resize",$),()=>{window.removeEventListener("blur",$),window.removeEventListener("resize",$)}},[E]);const[P,I]=Gj($=>{const oe=B().filter(Te=>!Te.disabled),ce=oe.find(Te=>Te.ref.current===document.activeElement),ie=Yj(oe,$,ce);ie&&setTimeout(()=>ie.ref.current.focus())}),U=g.useCallback(($,oe,ce)=>{const ie=!H.current&&!ce;(w.value!==void 0&&w.value===oe||ie)&&(M($),ie&&(H.current=!0))},[w.value]),me=g.useCallback(()=>S==null?void 0:S.focus(),[S]),ee=g.useCallback(($,oe,ce)=>{const ie=!H.current&&!ce;(w.value!==void 0&&w.value===oe||ie)&&L($)},[w.value]),ve=r==="popper"?D0:Aj,q=ve===D0?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:h,sticky:m,hideWhenDetached:v,avoidCollisions:x}:{};return p.jsx(Rj,{scope:n,content:S,viewport:C,onViewportChange:T,itemRefCallback:U,selectedItem:O,onItemLeave:me,itemTextRefCallback:ee,focusSelectedItem:N,selectedItemText:j,position:r,isPositioned:J,searchRef:P,children:p.jsx(hp,{as:Ai,allowPinchZoom:!0,children:p.jsx(fp,{asChild:!0,trapped:w.open,onMountAutoFocus:$=>{$.preventDefault()},onUnmountAutoFocus:re(o,$=>{var oe;(oe=w.trigger)==null||oe.focus({preventScroll:!0}),$.preventDefault()}),children:p.jsx(dp,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:$=>$.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:p.jsx(ve,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:$=>$.preventDefault(),...b,...q,onPlaced:()=>z(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:re(b.onKeyDown,$=>{const oe=$.ctrlKey||$.altKey||$.metaKey;if($.key==="Tab"&&$.preventDefault(),!oe&&$.key.length===1&&I($.key),["ArrowUp","ArrowDown","Home","End"].includes($.key)){let ie=B().filter(Te=>!Te.disabled).map(Te=>Te.ref.current);if(["ArrowUp","End"].includes($.key)&&(ie=ie.slice().reverse()),["ArrowUp","ArrowDown"].includes($.key)){const Te=$.target,ye=ie.indexOf(Te);ie=ie.slice(ye+1)}setTimeout(()=>R(ie)),$.preventDefault()}})})})})})})});jj.displayName=FK;var zK="SelectItemAlignedPosition",Aj=g.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,i=da(nl,n),s=fa(nl,n),[a,l]=g.useState(null),[c,u]=g.useState(null),d=Ie(t,_=>u(_)),f=lv(n),h=g.useRef(!1),m=g.useRef(!0),{viewport:v,selectedItem:x,selectedItemText:b,focusSelectedItem:w}=s,S=g.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&c&&v&&x&&b){const _=i.trigger.getBoundingClientRect(),O=c.getBoundingClientRect(),M=i.valueNode.getBoundingClientRect(),j=b.getBoundingClientRect();if(i.dir!=="rtl"){const Te=j.left-O.left,ye=M.left-Te,Pe=_.left-ye,rt=_.width+Pe,rn=Math.max(rt,O.width),on=window.innerWidth-uo,Ir=y0(ye,[uo,Math.max(uo,on-rn)]);a.style.minWidth=rt+"px",a.style.left=Ir+"px"}else{const Te=O.right-j.right,ye=window.innerWidth-M.right-Te,Pe=window.innerWidth-_.right-ye,rt=_.width+Pe,rn=Math.max(rt,O.width),on=window.innerWidth-uo,Ir=y0(ye,[uo,Math.max(uo,on-rn)]);a.style.minWidth=rt+"px",a.style.right=Ir+"px"}const L=f(),B=window.innerHeight-uo*2,J=v.scrollHeight,z=window.getComputedStyle(c),H=parseInt(z.borderTopWidth,10),R=parseInt(z.paddingTop,10),N=parseInt(z.borderBottomWidth,10),E=parseInt(z.paddingBottom,10),A=H+R+J+E+N,P=Math.min(x.offsetHeight*5,A),I=window.getComputedStyle(v),U=parseInt(I.paddingTop,10),me=parseInt(I.paddingBottom,10),ee=_.top+_.height/2-uo,ve=B-ee,q=x.offsetHeight/2,$=x.offsetTop+q,oe=H+R+$,ce=A-oe;if(oe<=ee){const Te=L.length>0&&x===L[L.length-1].ref.current;a.style.bottom="0px";const ye=c.clientHeight-v.offsetTop-v.offsetHeight,Pe=Math.max(ve,q+(Te?me:0)+ye+N),rt=oe+Pe;a.style.height=rt+"px"}else{const Te=L.length>0&&x===L[0].ref.current;a.style.top="0px";const Pe=Math.max(ee,H+v.offsetTop+(Te?U:0)+q)+ce;a.style.height=Pe+"px",v.scrollTop=oe-ee+v.offsetTop}a.style.margin=`${uo}px 0`,a.style.minHeight=P+"px",a.style.maxHeight=B+"px",r==null||r(),requestAnimationFrame(()=>h.current=!0)}},[f,i.trigger,i.valueNode,a,c,v,x,b,i.dir,r]);mn(()=>S(),[S]);const[k,C]=g.useState();mn(()=>{c&&C(window.getComputedStyle(c).zIndex)},[c]);const T=g.useCallback(_=>{_&&m.current===!0&&(S(),w==null||w(),m.current=!1)},[S,w]);return p.jsx(BK,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:h,onScrollButtonChange:T,children:p.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:p.jsx(Ee.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});Aj.displayName=zK;var $K="SelectPopperPosition",D0=g.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=uo,...i}=e,s=cv(n);return p.jsx(N1,{...s,...i,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});D0.displayName=$K;var[BK,P1]=du(nl,{}),L0="SelectViewport",Ij=g.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,i=fa(L0,n),s=P1(L0,n),a=Ie(t,i.onViewportChange),l=g.useRef(0);return p.jsxs(p.Fragment,{children:[p.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),p.jsx(av.Slot,{scope:n,children:p.jsx(Ee.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:re(o.onScroll,c=>{const u=c.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:f}=s;if(f!=null&&f.current&&d){const h=Math.abs(l.current-u.scrollTop);if(h>0){const m=window.innerHeight-uo*2,v=parseFloat(d.style.minHeight),x=parseFloat(d.style.height),b=Math.max(v,x);if(b<m){const w=b+h,S=Math.min(m,w),k=w-S;d.style.height=S+"px",d.style.bottom==="0px"&&(u.scrollTop=k>0?k:0,d.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});Ij.displayName=L0;var Dj="SelectGroup",[VK,UK]=du(Dj),WK=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Hr();return p.jsx(VK,{scope:n,id:o,children:p.jsx(Ee.div,{role:"group","aria-labelledby":o,...r,ref:t})})});WK.displayName=Dj;var Lj="SelectLabel",Fj=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=UK(Lj,n);return p.jsx(Ee.div,{id:o.id,...r,ref:t})});Fj.displayName=Lj;var Wm="SelectItem",[HK,zj]=du(Wm),$j=g.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...s}=e,a=da(Wm,n),l=fa(Wm,n),c=a.value===r,[u,d]=g.useState(i??""),[f,h]=g.useState(!1),m=Ie(t,w=>{var S;return(S=l.itemRefCallback)==null?void 0:S.call(l,w,r,o)}),v=Hr(),x=g.useRef("touch"),b=()=>{o||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return p.jsx(HK,{scope:n,value:r,disabled:o,textId:v,isSelected:c,onItemTextChange:g.useCallback(w=>{d(S=>S||((w==null?void 0:w.textContent)??"").trim())},[]),children:p.jsx(av.ItemSlot,{scope:n,value:r,disabled:o,textValue:u,children:p.jsx(Ee.div,{role:"option","aria-labelledby":v,"data-highlighted":f?"":void 0,"aria-selected":c&&f,"data-state":c?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...s,ref:m,onFocus:re(s.onFocus,()=>h(!0)),onBlur:re(s.onBlur,()=>h(!1)),onClick:re(s.onClick,()=>{x.current!=="mouse"&&b()}),onPointerUp:re(s.onPointerUp,()=>{x.current==="mouse"&&b()}),onPointerDown:re(s.onPointerDown,w=>{x.current=w.pointerType}),onPointerMove:re(s.onPointerMove,w=>{var S;x.current=w.pointerType,o?(S=l.onItemLeave)==null||S.call(l):x.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:re(s.onPointerLeave,w=>{var S;w.currentTarget===document.activeElement&&((S=l.onItemLeave)==null||S.call(l))}),onKeyDown:re(s.onKeyDown,w=>{var k;((k=l.searchRef)==null?void 0:k.current)!==""&&w.key===" "||(PK.includes(w.key)&&b(),w.key===" "&&w.preventDefault())})})})})});$j.displayName=Wm;var Ju="SelectItemText",Bj=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...i}=e,s=da(Ju,n),a=fa(Ju,n),l=zj(Ju,n),c=IK(Ju,n),[u,d]=g.useState(null),f=Ie(t,b=>d(b),l.onItemTextChange,b=>{var w;return(w=a.itemTextRefCallback)==null?void 0:w.call(a,b,l.value,l.disabled)}),h=u==null?void 0:u.textContent,m=g.useMemo(()=>p.jsx("option",{value:l.value,disabled:l.disabled,children:h},l.value),[l.disabled,l.value,h]),{onNativeOptionAdd:v,onNativeOptionRemove:x}=c;return mn(()=>(v(m),()=>x(m)),[v,x,m]),p.jsxs(p.Fragment,{children:[p.jsx(Ee.span,{id:l.textId,...i,ref:f}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Yn.createPortal(i.children,s.valueNode):null]})});Bj.displayName=Ju;var Vj="SelectItemIndicator",Uj=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return zj(Vj,n).isSelected?p.jsx(Ee.span,{"aria-hidden":!0,...r,ref:t}):null});Uj.displayName=Vj;var F0="SelectScrollUpButton",KK=g.forwardRef((e,t)=>{const n=fa(F0,e.__scopeSelect),r=P1(F0,e.__scopeSelect),[o,i]=g.useState(!1),s=Ie(t,r.onScrollButtonChange);return mn(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;i(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?p.jsx(Wj,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});KK.displayName=F0;var z0="SelectScrollDownButton",qK=g.forwardRef((e,t)=>{const n=fa(z0,e.__scopeSelect),r=P1(z0,e.__scopeSelect),[o,i]=g.useState(!1),s=Ie(t,r.onScrollButtonChange);return mn(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;i(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?p.jsx(Wj,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});qK.displayName=z0;var Wj=g.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,i=fa("SelectScrollButton",n),s=g.useRef(null),a=lv(n),l=g.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return g.useEffect(()=>()=>l(),[l]),mn(()=>{var u;const c=a().find(d=>d.ref.current===document.activeElement);(u=c==null?void 0:c.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),p.jsx(Ee.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:re(o.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:re(o.onPointerMove,()=>{var c;(c=i.onItemLeave)==null||c.call(i),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:re(o.onPointerLeave,()=>{l()})})}),GK="SelectSeparator",Hj=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return p.jsx(Ee.div,{"aria-hidden":!0,...r,ref:t})});Hj.displayName=GK;var $0="SelectArrow",YK=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=cv(n),i=da($0,n),s=fa($0,n);return i.open&&s.position==="popper"?p.jsx(M1,{...o,...r,ref:t}):null});YK.displayName=$0;function Kj(e){return e===""||e===void 0}var qj=g.forwardRef((e,t)=>{const{value:n,...r}=e,o=g.useRef(null),i=Ie(t,o),s=vP(n);return g.useEffect(()=>{const a=o.current,l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(s!==n&&u){const d=new Event("change",{bubbles:!0});u.call(a,n),a.dispatchEvent(d)}},[s,n]),p.jsx(kj,{asChild:!0,children:p.jsx("select",{...r,ref:i,defaultValue:n})})});qj.displayName="BubbleSelect";function Gj(e){const t=Ft(e),n=g.useRef(""),r=g.useRef(0),o=g.useCallback(s=>{const a=n.current+s;t(a),function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(a)},[t]),i=g.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,i]}function Yj(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=JK(e,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function JK(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Jj=Cj,R1=_j,XK=Oj,ZK=Nj,QK=Mj,j1=Pj,Xj=Ij,Zj=Fj,A1=$j,Qj=Bj,eq=Uj,eA=Hj;const I1=Jj,D1=XK,uv=g.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(R1,{ref:r,className:qe("flex h-10 m-1 w-[calc(100%-8px)] items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-fg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...n,children:[t,p.jsx(ZK,{asChild:!0,children:p.jsx(lp,{className:"w-4 h-4 opacity-50"})})]}));uv.displayName=R1.displayName;const dv=g.forwardRef(({className:e,children:t,position:n="popper",container:r,...o},i)=>p.jsx(QK,{container:r,children:p.jsx(j1,{ref:i,className:qe("relative z-50 min-w-[10rem] overflow-hidden rounded-md border bg-bg-secondary_hover text-text-secondary_hover shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...o,children:p.jsx(Xj,{className:qe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));dv.displayName=j1.displayName;const tq=g.forwardRef(({className:e,...t},n)=>p.jsx(Zj,{ref:n,className:qe("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));tq.displayName=Zj.displayName;const fv=g.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(A1,{ref:r,className:qe("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm text-text-primary outline-none focus:bg-bg-brand-primary_alt focus:text-text-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[p.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(eq,{children:p.jsx(ap,{className:"w-4 h-4"})})}),p.jsx(Qj,{children:t})]}));fv.displayName=A1.displayName;const nq=g.forwardRef(({className:e,...t},n)=>p.jsx(eA,{ref:n,className:qe("-mx-1 my-1 h-px bg-muted",e),...t}));nq.displayName=eA.displayName;function rl(e){if(e.type==="object")return Object.fromEntries(Object.keys(e.items).map(n=>[n,rl(e.items[n])]));if(e.type==="array")return[];if(e.type==="record")return{};if(e.opt)return null;if(e.type==="richtext")return[];if(e.type==="string")return"";if(e.type==="boolean")return!1;if(e.type==="number")return 0;if(e.type==="keyOf")return e.values==="string"?"":e.values[0];if(e.type==="file"||e.type==="image")return null;if(e.type==="literal")return e.value;if(e.type==="union")return typeof e.key=="string"?rl(e.items[0]):e.key.value;if(e.type==="date")return $i(new Date,"yyyy-MM-dd");throw Error("Unexpected schema type: "+JSON.stringify(e))}function Fc(e,t){return e.includes("?p=")?e+"."+JSON.stringify(t):e+"?p="+JSON.stringify(t)}function rq(e){const t=e.replace(/([A-Z])/g," $1").toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)}function oq({children:e}){return p.jsx("div",{children:rq(e)})}function tA(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=tA(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function iq(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=tA(e))&&(r&&(r+=" "),r+=t);return r}const EE=e=>typeof e=="boolean"?"".concat(e):e===0?"0":e,_E=iq,sq=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return _E(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:i}=t,s=Object.keys(o).map(c=>{const u=n==null?void 0:n[c],d=i==null?void 0:i[c];if(u===null)return null;const f=EE(u)||EE(d);return o[c][f]}),a=n&&Object.entries(n).reduce((c,u)=>{let[d,f]=u;return f===void 0||(c[d]=f),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:d,className:f,...h}=u;return Object.entries(h).every(m=>{let[v,x]=m;return Array.isArray(x)?x.includes({...i,...a}[v]):{...i,...a}[v]===x})?[...c,d,f]:c},[]);return _E(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)},B0=sq("inline-flex items-center justify-center whitespace-nowrap rounded-md text-fg-primary text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:text-text-disabled disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-bg-brand-primary text-fg-primary hover:bg-bg-secondary_hover/90",destructive:"bg-bg-error text-text-error-pimary hover:bg-bg-error_hover/90",outline:"border border-input bg-bg-background hover:bg-bg-brand-solid_hover hover:text-secondary_hover",secondary:"bg-bg-secondary text-fg-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-bg-secondary_hover hover:text-fg-secondary",link:"text-fg-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Tr=g.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},i)=>{const s=r?Ai:"button";return p.jsx(s,{className:qe(B0({variant:t,size:n,className:e})),ref:i,...o})});Tr.displayName="Button";var L1="Popover",[nA,ufe]=Bi(L1,[uu]),bp=uu(),[aq,pa]=nA(L1),rA=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!1}=e,a=bp(t),l=g.useRef(null),[c,u]=g.useState(!1),[d=!1,f]=Qo({prop:r,defaultProp:o,onChange:i});return p.jsx(O1,{...a,children:p.jsx(aq,{scope:t,contentId:Hr(),triggerRef:l,open:d,onOpenChange:f,onOpenToggle:g.useCallback(()=>f(h=>!h),[f]),hasCustomAnchor:c,onCustomAnchorAdd:g.useCallback(()=>u(!0),[]),onCustomAnchorRemove:g.useCallback(()=>u(!1),[]),modal:s,children:n})})};rA.displayName=L1;var oA="PopoverAnchor",lq=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=pa(oA,n),i=bp(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:a}=o;return g.useEffect(()=>(s(),()=>a()),[s,a]),p.jsx(sv,{...i,...r,ref:t})});lq.displayName=oA;var iA="PopoverTrigger",sA=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=pa(iA,n),i=bp(n),s=Ie(t,o.triggerRef),a=p.jsx(Ee.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":dA(o.open),...r,ref:s,onClick:re(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?a:p.jsx(sv,{asChild:!0,...i,children:a})});sA.displayName=iA;var F1="PopoverPortal",[cq,uq]=nA(F1,{forceMount:void 0}),aA=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,i=pa(F1,t);return p.jsx(cq,{scope:t,forceMount:n,children:p.jsx(Mn,{present:n||i.open,children:p.jsx(pp,{asChild:!0,container:o,children:r})})})};aA.displayName=F1;var zc="PopoverContent",lA=g.forwardRef((e,t)=>{const n=uq(zc,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,i=pa(zc,e.__scopePopover);return p.jsx(Mn,{present:r||i.open,children:i.modal?p.jsx(dq,{...o,ref:t}):p.jsx(fq,{...o,ref:t})})});lA.displayName=zc;var dq=g.forwardRef((e,t)=>{const n=pa(zc,e.__scopePopover),r=g.useRef(null),o=Ie(t,r),i=g.useRef(!1);return g.useEffect(()=>{const s=r.current;if(s)return Xg(s)},[]),p.jsx(hp,{as:Ai,allowPinchZoom:!0,children:p.jsx(cA,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:re(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),i.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:re(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:re(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),fq=g.forwardRef((e,t)=>{const n=pa(zc,e.__scopePopover),r=g.useRef(!1),o=g.useRef(!1);return p.jsx(cA,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,a;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;((c=n.triggerRef.current)==null?void 0:c.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),cA=g.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...d}=e,f=pa(zc,n),h=bp(n);return Yg(),p.jsx(fp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:p.jsx(dp,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>f.onOpenChange(!1),children:p.jsx(N1,{"data-state":dA(f.open),role:"dialog",id:f.contentId,...h,...d,ref:t,style:{...d.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)"}})})})}),uA="PopoverClose",pq=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=pa(uA,n);return p.jsx(Ee.button,{type:"button",...r,ref:t,onClick:re(e.onClick,()=>o.onOpenChange(!1))})});pq.displayName=uA;var hq="PopoverArrow",mq=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=bp(n);return p.jsx(M1,{...o,...r,ref:t})});mq.displayName=hq;function dA(e){return e?"open":"closed"}var gq=rA,vq=sA,yq=aA,fA=lA;const z1=gq,$1=vq,pv=g.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>p.jsx(yq,{container:r.container,children:p.jsx(fA,{ref:o,align:t,sideOffset:n,className:qe("z-50 w-72 rounded-md border bg-bg-secondary_alt p-4 text-text-secondary shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));pv.displayName=fA.displayName;function pA(e){const[t,n]=ue.splitModuleFilePathAndModulePath(e),r=ue.joinModuleFilePathAndModulePath(t,ue.splitModulePath(n).slice(0,-1).join(".")),o=kt(r);return{path:r,schema:"data"in o?o.data:void 0}}const xq=(e,t,n)=>t!==e&&(n==null?void 0:n.type)==="record",bq=(e,t,n)=>t!==e&&(n==null?void 0:n.type)==="array",wq=e=>(e==null?void 0:e.type)==="record",Sq=e=>(e==null?void 0:e.type)==="array";function hA({path:e,variant:t}){const n=kt(e),{path:r,schema:o}=pA(e),i=mA(e),s=i[i.length-1];return p.jsxs("span",{className:"inline-flex items-center gap-2",children:[xq(e,r,o)&&p.jsxs(p.Fragment,{children:[p.jsx(Eq,{defaultValue:s.text,path:e,parentPath:r,variant:t}),p.jsx(Cq,{path:e,parentPath:r,variant:t})]}),Sq("data"in n?n.data:void 0)&&p.jsx(kq,{path:e,variant:t}),wq("data"in n?n.data:void 0)&&p.jsx(_q,{path:e,variant:t})]})}function B1(e){return e==="module"?16:12}function hv(e){return"icon"}function mv(e){return e==="module"?"outline":"ghost"}function kq({path:e,variant:t}){const{navigate:n}=Zr(),{addPatch:r,patchPath:o}=vn(e),i=kt(e),s=Je(e,"array"),[a]=ue.splitModuleFilePathAndModulePath(e);if(!("data"in s)||!s.data||!("data"in i))return null;const l=i.data;if(l.type!=="array")return console.error("Cannot add to non-array",s,{parentPath:e}),null;const c=s.data.length;return p.jsx(Tr,{title:"Add",size:hv(t),variant:mv(t),onClick:()=>{const u=o.concat(c.toString());r([{op:"add",path:u,value:rl(l.item)}]),l.item.type!=="string"&&n(ue.joinModuleFilePathAndModulePath(a,ue.patchPathToModulePath(u)))},children:p.jsx(VM,{size:B1(t)})})}function Cq({path:e,parentPath:t,variant:n}){const{navigate:r}=Zr(),{addPatch:o,patchPath:i}=vn(e),s=Je(t,"record");return!("data"in s)||s.data===void 0||s.data===null?(console.error("Parent source not found",s,{path:e}),null):p.jsx(Tr,{size:hv(n),variant:mv(n),title:"Delete",onClick:()=>{o([{op:"remove",path:i}]),r(t)},children:p.jsx(HM,{size:B1(n)})})}function Eq({defaultValue:e,path:t,parentPath:n,variant:r}){const[o,i]=ue.splitModuleFilePathAndModulePath(n),{navigate:s}=Zr(),{addPatch:a}=vn(t),l=Je(n,"record"),[c,u]=g.useState(e),[d,f]=g.useState(!1),h=ua();g.useEffect(()=>{const x=b=>{b.key==="Escape"&&f(!1)};return window.addEventListener("keydown",x),()=>{window.removeEventListener("keydown",x)}},[]);const m=ue.createPatchPath(i);if(!("data"in l)||l.data===void 0||l.data===null)return console.error("Parent source not found",l,{path:t}),null;const v=c===e||c===""||c in l.data;return p.jsxs(z1,{open:d,children:[p.jsx(Tr,{asChild:!0,size:hv(r),variant:mv(r),children:p.jsx($1,{onClick:()=>{f(!0)},title:"Change name",children:p.jsx(WM,{size:16})})}),p.jsx(pv,{container:h,className:"text-text-primary",children:p.jsxs("form",{className:"flex flex-col gap-2",onSubmit:x=>{x.preventDefault(),a([{op:"move",from:m.concat(e),path:m.concat(c)}]),s(ue.joinModuleFilePathAndModulePath(o,ue.patchPathToModulePath(m.concat(c))),{replace:!0}),f(!1)},children:[p.jsx(au,{type:"text",value:c,onChange:x=>{u(x.target.value)}}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Tr,{disabled:v,variant:"outline",type:"submit",children:"Update"}),p.jsx(Tr,{variant:"ghost",type:"reset",onClick:()=>{f(!1),u(e)},children:"Cancel"})]})]})})]})}function _q({path:e,variant:t}){const n=Je(e,"record"),r=kt(e),o=ua(),{addPatch:i}=vn(e),[s,a]=g.useState(""),{navigate:l}=Zr(),[c,u]=g.useState(!1);if(g.useEffect(()=>{const v=x=>{x.key==="Escape"&&u(!1)};return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v)}},[]),!("data"in n)||n.data===void 0||n.data===null)return console.error("Source not found",n,{path:e}),null;if(!("data"in r)||r.data===void 0)return console.error("Schema not found",n,{path:e}),null;const d=r.data;if(d.type!=="record")return console.error("Schema is not a record",r,{path:e}),null;const f=s===""||s in n.data,[h,m]=ue.splitModuleFilePathAndModulePath(e);return p.jsxs(z1,{open:c,children:[p.jsx(Tr,{asChild:!0,size:hv(t),variant:mv(t),children:p.jsx($1,{onClick:()=>{u(!0)},title:"Add",children:p.jsx(VM,{size:B1(t)})})}),p.jsx(pv,{container:o,children:p.jsxs("form",{className:"flex flex-col gap-2",onSubmit:v=>{v.preventDefault();const x=ue.createPatchPath(m).concat(s);i([{op:"add",path:x,value:rl(d.item)}]),l(ue.joinModuleFilePathAndModulePath(h,ue.patchPathToModulePath(x))),u(!1)},children:[p.jsx(au,{autoFocus:!0,value:s,onChange:v=>{a(v.target.value)}}),p.jsx("div",{children:p.jsx(Tr,{type:"submit",disabled:f,variant:"outline",children:"Add"})})]})})]})}function mA(e){const[t,n]=ue.splitModuleFilePathAndModulePath(e),r=ue.splitModuleFilePath(t).map(s=>({text:Ic(s),sourcePath:t}));if(!n)return r;const o=ue.splitModulePath(n),i=o.map((s,a)=>({text:s,sourcePath:ue.joinModuleFilePathAndModulePath(t,o.slice(0,a+1).join("."))}));return r.concat(i)}function gA({label:e,children:t,path:n,transparent:r,type:o,foldLevel:i="1"}){var S,k,C;const s=d8(),{validationErrors:a}=eu(),{patchPath:l,addPatch:c}=vn(n),u=kt(n),d=Je(n,o),[f,h]=g.useState(!0),[m,v]=g.useState(!1);g.useEffect(()=>{var T,_;"data"in d&&d.data===null&&"data"in u&&!u.data.opt&&(((T=u.data)==null?void 0:T.type)==="image"||((_=u.data)==null?void 0:_.type)==="file")&&v(!0)},[d,u]);const x="data"in d?d.data:void 0,b="data"in u&&((S=u.data)==null?void 0:S.type)==="boolean",w="data"in u&&((k=u.data)==null?void 0:k.opt)===!0;return p.jsxs("div",{className:Ue("p-4 border rounded-lg",{"bg-bg-tertiary":!r,"border-border-error":((C=a[n])==null?void 0:C.length)>0}),children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-4",children:[!b&&w&&p.jsx(ru,{disabled:s==="loading",checked:x!==null||m,onCheckedChange:()=>{(u.data.type==="image"||u.data.type==="file")&&x===null?v(!0):c(x===null?[{op:"replace",path:l,value:rl({...u.data,opt:!1})}]:[{op:"replace",path:l,value:null}])}}),b&&p.jsx(g7,{path:n,isNullable:w,loadingStatus:s,source:x}),typeof e=="string"&&p.jsx(oq,{children:e}),e&&typeof e!="string"&&e]}),p.jsxs("div",{className:"flex items-center gap-2",children:[x!==null&&p.jsx(hA,{path:n,variant:"field"}),x!==null&&!b&&p.jsxs("button",{onClick:()=>h(T=>!T),className:Ue("transform transition-transform",{"rotate-180":f}),children:[i==="1"&&p.jsx(lp,{size:16}),i==="2"&&p.jsx(C8,{size:16})]})]})]}),!b&&p.jsx(bf,{isOpen:f&&(x!==null||m),children:(x!==null||m)&&p.jsx("div",{className:"flex flex-col gap-6 pt-6",children:t})})]})}function Tq({path:e}){const t="object",n=kt(e),r=Je(e,t);if(n.status==="error")return p.jsx(Rt,{path:e,error:n.error,type:t});if(r.status==="error")return p.jsx(Ke,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return p.jsx(gn,{path:e,type:t});if(n.status==="loading")return p.jsx(nt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return p.jsx(nt,{path:e,type:t});if(n.data.type!==t)return p.jsx(dr,{path:e,expectedType:t,actualType:n.data.type});const o=n.data;return p.jsxs("div",{children:[p.jsx(Mr,{path:e}),p.jsx("div",{className:"flex flex-col gap-6",children:Object.entries(o.items).map(([i,s])=>{const a=Fc(e,i);return p.jsx(gA,{label:i,path:a,type:s.type,children:p.jsx(zv,{path:a,schema:s},a)},a)})})]})}function Oq({path:e}){const t="object",n=kt(e);if(n.status==="error")return p.jsx(Rt,{path:e,error:n.error,type:t});if(n.status==="loading")return p.jsx(nt,{path:e,type:t});if(n.status==="not-found")return p.jsx(gn,{path:e,type:t});if(n.data.type!=="object")return p.jsx(dr,{path:e,expectedType:"object",actualType:n.data.type});const r=n.data;return p.jsx(vA,{path:e,schema:r})}function vA({path:e,schema:t}){return p.jsx("div",{className:"grid grid-cols-[min-content,1fr] text-left gap-2 text-xs",children:Object.keys(t.items).map(n=>{const r=Fc(e,n);return p.jsx(Nq,{label:n,children:p.jsx(FS,{path:r})},n)})})}function Nq({label:e,children:t}){return p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"flex whitespace-nowrap text-fg-quinary",children:Gw(e)}),t]})}function V0(e){return typeof e.key!="string"}function Mq({path:e}){const t="union",n=kt(e),r=Je(e,t);if(n.status==="error")return p.jsx(Rt,{path:e,error:n.error,type:t});if(r.status==="error")return p.jsx(Ke,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return p.jsx(gn,{path:e,type:t});if(n.status==="loading")return p.jsx(nt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return p.jsx(nt,{path:e,type:t});if(n.data.type!==t)return p.jsx(dr,{path:e,expectedType:t,actualType:n.data.type});const o=r.data;if(V0(n.data))return typeof o!="string"&&o!==null?p.jsx(Ke,{path:e,error:"Expected source to be a string, but found: "+typeof o,type:t}):p.jsxs("div",{children:[p.jsx(Mr,{path:e}),p.jsx(Rq,{path:e,source:o,options:n.data.items.concat(n.data.key).flatMap(i=>(i==null?void 0:i.type)==="literal"?[i.value]:(console.warn("Unexpected item in string union",i),[]))})]});if(!V0(n.data))return typeof o!="object"?p.jsx(Ke,{path:e,error:"Expected source to be an object, but found: "+typeof o,type:t}):Array.isArray(o)?p.jsx(Ke,{path:e,error:"Expected source to be an object, but found an array",type:t}):p.jsxs("div",{children:[p.jsx(Mr,{path:e}),p.jsx(Pq,{path:e,schema:n.data})]})}function Pq({path:e,schema:t}){const n=LM(e),{addPatch:r,patchPath:o}=vn(e),i=ua(),s=Fc(e,t.key),a=Je(s,"literal");if(!("data"in a)||a.data===void 0)return p.jsx(nt,{path:e,type:"union"});const l=t.items.find(d=>{var h;const f=(h=d.items)==null?void 0:h[t.key];return f.type==="literal"?f.value===a.data:(console.error("Expected literal schema in object union",f),!1)});if((l==null?void 0:l.items)===void 0)return p.jsx(nt,{path:e,type:"union"});const c=t.items.flatMap(d=>{var h;const f=(h=d.items)==null?void 0:h[t.key];return f.type==="literal"?[f.value]:(console.error("Expected literal schema in object union",f),[])}),u=g.useRef({});return g.useEffect(()=>{n!==void 0&&a.data!==void 0&&typeof a.data=="string"&&n.status==="success"&&(u.current[e]||(u.current[e]={}),u.current[e][a.data]=n.data)},[n,a,e]),p.jsxs("div",{className:"grid gap-4",children:[p.jsxs(I1,{value:a.data??void 0,onValueChange:d=>{const f=t.items.find(m=>{var x;const v=(x=m.items)==null?void 0:x[t.key];return v.type==="literal"?v.value===d:(console.error("Expected literal schema in object union",v),!1)});if((f==null?void 0:f.items)===void 0){console.error(`Selected schema with ${t.key} = ${d} not found`);return}const h=u.current[e][d]||rl(f);console.log({newValue:h,previouslySelectedSources:u.current,emptyOf:rl(f)}),h[t.key]=d,r([{op:"replace",path:o,value:h}])},children:[p.jsx(uv,{children:p.jsx(D1,{children:a.data})}),p.jsx(dv,{container:i,className:"w-32",children:c==null?p.jsx(yA,{}):c.map(d=>p.jsx(fv,{value:d,children:d},d))})]}),Object.keys(l==null?void 0:l.items).filter(d=>d!==(t==null?void 0:t.key)).map(d=>{var h,m,v;const f=Fc(e,d);return p.jsx(gA,{path:f,foldLevel:"1",transparent:!0,label:d,type:(m=(h=l==null?void 0:l.items)==null?void 0:h[d])==null?void 0:m.type,children:p.jsx(zv,{path:f,schema:(v=l==null?void 0:l.items)==null?void 0:v[d]},d)},f)})]})}function Rq({path:e,source:t,options:n}){const{addPatch:r,patchPath:o}=vn(e),i=ua();return p.jsxs(I1,{value:t??"",onValueChange:s=>{r([{op:"replace",path:o,value:s}])},children:[p.jsx(uv,{children:p.jsx(D1,{children:t})}),p.jsx(dv,{className:"w-32",container:i,children:n==null?p.jsx(yA,{}):n.map(s=>p.jsx(fv,{value:s,children:s},s))})]})}function yA(){return p.jsx("div",{children:"Loading..."})}function jq({path:e}){const t="union",n=LM(e),r=kt(e);if(n.status==="error")return p.jsx(Ke,{path:e,error:n.error,type:"union"});if(!("data"in n)||n.data===void 0)return p.jsx(sr,{path:e});if(!("data"in r)||r.data===void 0)return p.jsx(sr,{path:e});if(n.data===null)return p.jsx(ar,{path:e});if(r.data.type!==t)return p.jsx(dr,{path:e,expectedType:t,actualType:r.data.type});const o=r.data;if(V0(o))return typeof n.data!="string"?p.jsx(Ke,{path:e,error:"Expected source to be a string, but found: "+typeof n.data,type:t}):p.jsx("div",{className:"truncate",children:n.data});{const i=n.data;if(!i)return p.jsx(ar,{path:e});if(typeof i!="object"&&!(typeof i=="object"&&o.key in i))return p.jsx(Ke,{path:e,error:"Expected source to be an object, but found: "+typeof i,type:t});const s=o.items.find(a=>{var c;const l=(c=a.items)==null?void 0:c[o.key];if((l==null?void 0:l.type)==="literal"&&i!==null&&typeof i=="object"&&o.key in i&&!tc(i))return l.value===i[o.key]});return s?p.jsx(vA,{path:e,schema:s}):p.jsx(Ke,{path:e,error:"Expected source to have key "+o.key+" but it was not found",type:t})}}const Aq=new TextEncoder;function xA(e){return new Promise((t,n)=>{var i;const r=(i=e.currentTarget.files)==null?void 0:i[0],o=new FileReader;o.addEventListener("load",()=>{const s=o.result;if(typeof s=="string"){const a=new Image;a.addEventListener("load",()=>{const l=ue.getSHA256Hash(Aq.encode(s));if(a.naturalWidth&&a.naturalHeight){const c=ue.getMimeType(s);t({src:s,width:a.naturalWidth,height:a.naturalHeight,filename:r==null?void 0:r.name,sha256:l,mimeType:c,fileExt:c&&ue.mimeTypeToFileExt(c)})}else t({src:s,filename:r==null?void 0:r.name,sha256:l})}),a.src=s}else n(s?{message:"Unexpected image result type",result:s}:{message:"Empty result"})}),r&&o.readAsDataURL(r)})}const Iq=new TextEncoder;function Dq(e){return new Promise((t,n)=>{var i;const r=(i=e.currentTarget.files)==null?void 0:i[0],o=new FileReader;o.addEventListener("load",()=>{const s=o.result;if(typeof s=="string"){const a=ue.getSHA256Hash(Iq.encode(s)),l=ue.getMimeType(s);t({src:s,filename:r==null?void 0:r.name,sha256:a,mimeType:l,fileExt:l&&ue.mimeTypeToFileExt(l)})}else n(s?{message:"Unexpected file result type",result:s}:{message:"Empty result"})}),r&&o.readAsDataURL(r)})}function bA(e,t,n,r,o,i,s="/public/val"){const a=ue.createFilename(t,n,o,r);return!a||!o?[]:[{value:{[St]:`${s}/${a}`,[Xn]:"file",...i!=="file"?{[l0]:i}:{},metadata:o},op:"replace",path:e},{value:t,op:"file",path:e,filePath:`${s}/${a}`}]}function Lq({path:e}){var l;const t="file",n=sp(),r=kt(e),o=Je(e,t),{patchPath:i,addPatch:s}=vn(e);if(r.status==="error")return p.jsx(Rt,{path:e,error:r.error,type:t});if(o.status==="error")return p.jsx(Ke,{path:e,error:o.error,type:t});if(o.status=="not-found"||r.status==="not-found")return p.jsx(gn,{path:e,type:t});if(r.status==="loading")return p.jsx(nt,{path:e,type:t});if(n===void 0)return p.jsx(nt,{path:e,type:t});if(r.data.type!==t)return p.jsx(dr,{path:e,expectedType:t,actualType:r.data.type});const a=o.data;return a===void 0?p.jsx(gn,{path:e,type:t}):p.jsxs("div",{children:[p.jsx(Mr,{path:e}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Tr,{asChild:!0,children:p.jsx("label",{htmlFor:`img_input:${e}`,children:"Update"})}),a&&p.jsx("a",{href:ue.convertFileSource({...a,_type:"file"}).url,children:p.jsx(I8,{})}),p.jsx("input",{disabled:o.status==="loading",hidden:!0,id:`img_input:${e}`,type:"file",accept:(l=r.data.options)==null?void 0:l.accept,onChange:c=>{Dq(c).then(u=>{var h;const d={src:u.src,filename:u.filename};let f;u.mimeType&&(f={mimeType:u.mimeType}),s(bA(i,d.src,d.filename??null,u.sha256,f,"file",(h=n.files)==null?void 0:h.directory))})}})]})]})}function Fq({path:e}){const t=Je(e,"image");return t.status==="error"?p.jsx(Ke,{path:e,error:t.error,type:"image"}):!("data"in t)||t.data===void 0?p.jsx(sr,{path:e}):t.data===null?p.jsx(ar,{path:e}):p.jsx(BM,{size:12})}function zq({path:e}){var u,d,f,h;const t="image",n=sp(),r=kt(e),o=Je(e,t),{patchPath:i,addPatch:s}=vn(e),[a,l]=g.useState(void 0);if(g.useEffect(()=>{if("data"in o&&o.data)if(o.data.metadata){const m=o.data.metadata;if(typeof m.width!="number"||typeof m.height!="number"){console.warn(`Expected metadata width and height to be numbers but width was: ${typeof m.width} and height was: ${typeof m.height}`);return}if("hotspot"in m){if(typeof m.hotspot=="object"&&m.hotspot&&"x"in m.hotspot&&"y"in m.hotspot){const{x:v,y:x}=m.hotspot;typeof v=="number"&&typeof x=="number"?l({x:v,y:x}):console.warn(`Expected hotspot to have x and y as numbers but x was: ${typeof v} and y: ${typeof x}`)}}else l(void 0)}else l(void 0)},["data"in o&&o.data]),r.status==="error")return p.jsx(Rt,{path:e,error:r.error,type:t});if(o.status==="error")return p.jsx(Ke,{path:e,error:o.error,type:t});if(o.status=="not-found"||r.status==="not-found")return p.jsx(gn,{path:e,type:t});if(r.status==="loading")return p.jsx(nt,{path:e,type:t});if(n===void 0)return p.jsx(nt,{path:e,type:t});if(r.data.type!==t)return p.jsx(dr,{path:e,expectedType:t,actualType:r.data.type});const c=o.data;return c===void 0?p.jsx(gn,{path:e,type:t}):p.jsxs("div",{children:[p.jsx(Mr,{path:e}),c&&p.jsxs("div",{className:"py-2",children:[p.jsx("span",{children:"Alt text"}),p.jsx(au,{value:(u=c.metadata)!=null&&u.alt&&typeof((d=c.metadata)==null?void 0:d.alt)=="string"?(f=c.metadata)==null?void 0:f.alt:"",onChange:m=>{const v=m.target.value;c.metadata&&"alt"in c.metadata?s([{op:"replace",value:v,path:i.concat(["metadata","alt"])}]):c.metadata&&!("alt"in c.metadata)?s([{op:"add",value:v,path:i.concat(["metadata","alt"])}]):c.metadata===void 0?s([{op:"add",value:{...a?{hotspot:a}:{},alt:v},path:i.concat(["metadata"])}]):console.warn(`Expected source.metadata to be an object but got ${typeof c.metadata}`)}})]}),c&&p.jsxs("div",{className:"relative",children:[p.jsx("img",{src:ue.convertFileSource({...c,_type:"file"}).url,draggable:!1,className:"object-contain w-full max-h-[500px] rounded-t-lg",style:{cursor:"crosshair"},onClick:m=>{const{width:v,height:x,left:b,top:w}=m.currentTarget.getBoundingClientRect(),S={x:Math.max((m.clientX-6-b)/v,0),y:Math.max((m.clientY-6-w)/x,0)};c.metadata&&"hotspot"in c.metadata?s([{op:"replace",path:i.concat(["metadata","hotspot"]),value:S}]):c.metadata?s([{op:"add",path:i.concat(["metadata","hotspot"]),value:S}]):c.metadata===void 0?s([{op:"add",value:{...S?{hotspot:S}:{}},path:i.concat(["metadata"])}]):console.warn(`Expected source.metadata to be an object but got ${typeof c.metadata}`)}}),a&&p.jsx("div",{className:"rounded-full h-[12px] w-[12px] bg-background mix-blend-difference border-bg-brand-solid border-2 absolute pointer-events-none",style:{top:`${a.y*100}%`,left:`${a.x*100}%`}})]}),p.jsx("label",{htmlFor:`img_input:${e}`,className:Ue("block px-1 py-2 text-sm text-center rounded-b-lg cursor-pointer bg-bg-secondary text-text-secondary",{"rounded-t-lg":!c}),children:"Update"}),p.jsx("input",{disabled:o.status==="loading",hidden:!0,id:`img_input:${e}`,type:"file",accept:((h=r.data.options)==null?void 0:h.accept)||"image/*",onChange:m=>{xA(m).then(v=>{var w;const x={src:v.src,filename:v.filename};let b;v.width&&v.height&&v.mimeType&&(b={width:v.width,height:v.height,mimeType:v.mimeType}),s(bA(i,x.src,x.filename??null,v.sha256,b,"image",(w=n.files)==null?void 0:w.directory))})}})]})}function $q({path:e}){const t=Je(e,"image");if(t.status==="error")return p.jsx(Ke,{path:e,error:t.error,type:"image"});if(!("data"in t)||t.data===void 0)return p.jsx(sr,{path:e});if(t.data===null)return p.jsx(ar,{path:e});const n=t.data;return p.jsx("img",{src:ue.convertFileSource({...n,_type:"file"}).url,draggable:!1,className:"object-contain max-w-[60px] max-h-[60px] rounded-lg"})}function Bq({path:e}){const t="keyOf",{navigate:n}=Zr(),r=kt(e),o="data"in r&&r.data&&r.data.type==="keyOf"?{type:r.data.schema.type,path:r.data.path}:void 0,i=Je(o==null?void 0:o.path,o==null?void 0:o.type),s=Je(e,t),{patchPath:a,addPatch:l}=vn(e),c=ua();if(r.status==="error")return p.jsx(Rt,{path:e,error:r.error,type:t});if(s.status==="error")return p.jsx(Ke,{path:e,error:s.error,type:t});if(i.status==="error")return p.jsx(Ke,{path:e,error:i.error,type:o==null?void 0:o.type});if(s.status=="not-found"||r.status==="not-found")return p.jsx(gn,{path:e,type:t});if(o!==void 0&&!(o.type==="record"||o.type==="object"))return p.jsx(Rt,{path:o.path,error:`Cannot refer to keyOf type: ${o.type}. Must refer to be record or object`});if(o!==void 0&&i.status==="not-found")return p.jsx(Rt,{path:o.path,error:"Referenced source not found",type:o.type});if(!("data"in s)||s.data===void 0)return p.jsx(nt,{path:e,type:t});if("data"in r&&r.data&&r.data.type!==t)return p.jsx(dr,{path:e,expectedType:t,actualType:r.data.type});if(!i)return p.jsx(Rt,{path:o==null?void 0:o.path,error:"Referenced source not found",type:"keyOf"});if("data"in i&&i.data===null)return p.jsx(Rt,{path:o==null?void 0:o.path,error:"Referenced source is null",type:"keyOf"});const u="data"in i&&i.data?Object.keys(i.data):void 0,d=s.data;return p.jsxs("div",{children:[p.jsx(Mr,{path:e}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs(I1,{value:d??"",onValueChange:f=>{l([{op:"replace",path:a,value:f}])},children:[p.jsx(uv,{children:p.jsx(D1,{children:d})}),p.jsx(dv,{className:"w-32",container:c,children:r.status==="loading"||o==null||u===void 0?p.jsx(Vq,{}):u.map(f=>p.jsx(fv,{value:f,children:f},f))})]}),d&&(o==null?void 0:o.path)&&p.jsx("button",{onClick:()=>{n(ue.createValPathOfItem(o.path,d))},children:p.jsx(tu,{size:16})})]})]})}function Vq(){return p.jsx("span",{children:"Loading..."})}function Uq({path:e}){const t=Je(e,"keyOf");return t.status==="error"?p.jsx(Ke,{path:e,error:t.error,type:"keyOf"}):!("data"in t)||t.data===void 0?p.jsx(sr,{path:e}):t.data===null?p.jsx(ar,{path:e}):p.jsx("div",{className:"truncate",children:t.data})}function wA({className:e,classNames:t,captionLayout:n,showOutsideDays:r=!0,...o}){const i=o.fromDate&&o.toDate;return p.jsx(W6,{showOutsideDays:r,captionLayout:n,className:qe("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex flex-row justify-center pt-1 relative items-center",caption_dropdowns:"flex flex-row space-x-2",caption_label:`text-sm font-medium ${i?"hidden":""}`,nav:"space-x-1 flex items-center",dropdown_month:"flex flex-row text-accent justify-between text-[0.8rem]",dropdown_year:"flex flex-row text-accent justify-between text-[0.8rem]",dropdown:"bg-transparent border-solid rounded-md border-2 border-secondary",nav_button:qe(B0({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:qe(B0({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",...t},components:{IconLeft:()=>p.jsx(k8,{className:"w-4 h-4"}),IconRight:()=>p.jsx(tu,{className:"w-4 h-4"}),Dropdown:({caption:s,children:a,value:l,onChange:c})=>{const u=d=>{c&&c({target:{value:d}})};return p.jsx("div",{className:"flex flex-row space-x-2",children:p.jsxs(Jj,{onValueChange:u,value:String(l),children:[p.jsx(R1,{asChild:!0,children:p.jsxs(Tr,{variant:"ghost",size:"sm",children:[s,p.jsx(lp,{className:"w-4 h-4"})]})}),p.jsx(j1,{className:"z-50 p-1 rounded-md bg-bg-secondary_alt text-text-secondary",children:p.jsx(Xj,{className:"overflow-y-auto rounded-md shadow-lg max-h-48",children:g.Children.map(a,d=>{if(g.isValidElement(d)){const{value:f,children:h}=d.props;return p.jsx(A1,{value:String(f),className:"p-2 rounded-md cursor-pointer hover:bg-bg-secondary_hover hover:text-text-secondary_hover",children:p.jsx(Qj,{children:h})},f)}return null})})})]})})}},...o})}wA.displayName="Calendar";function Wq({path:e}){var f,h;const t="date",n=kt(e),r=Je(e,t),{patchPath:o,addPatch:i}=vn(e),[s,a]=g.useState(null),[l,c]=g.useState(!1),u=ua();if(g.useEffect(()=>{if("data"in r&&r.data!==void 0)if(r.data===null)a(r.data);else try{const m=new Date(r.data);a(m)}catch{console.error("Cannot parse invalid date:",r.data)}},["data"in r&&r.data]),n.status==="error")return p.jsx(Rt,{path:e,error:n.error,type:t});if(r.status==="error")return p.jsx(Ke,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return p.jsx(gn,{path:e,type:t});if(n.status==="loading")return p.jsx(nt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return p.jsx(nt,{path:e,type:t});if(n.data.type!==t)return p.jsx(dr,{path:e,expectedType:t,actualType:n.data.type});const d=n.data;return p.jsxs("div",{children:[p.jsx(Mr,{path:e}),p.jsxs(z1,{open:l,onOpenChange:m=>{c(m)},children:[p.jsx($1,{asChild:!0,onClick:()=>{c(!0)},children:p.jsxs(Tr,{variant:"outline",className:Ue("w-[280px] justify-start text-left font-normal",!s&&"text-muted-foreground"),children:[p.jsx(S8,{className:"w-4 h-4 mr-2"}),s?$i(s,"PPP"):p.jsx("span",{children:"Pick a date"})]})}),p.jsx(pv,{className:"w-auto p-0",container:u,children:p.jsx(wA,{mode:"single",captionLayout:"dropdown-buttons",defaultMonth:s??void 0,weekStartsOn:1,fromDate:(f=d.options)!=null&&f.from?new Date(d.options.from):void 0,toDate:(h=d.options)!=null&&h.to?new Date(d.options.to):void 0,selected:s||void 0,onSelect:m=>{m&&(a(m),i([{op:"replace",value:m.toISOString(),path:o}]),c(!1))}})})]})]})}function Hq({path:e}){const t=Je(e,"date");return t.status==="error"?p.jsx(Ke,{path:e,error:t.error,type:"date"}):!("data"in t)||t.data===void 0?p.jsx(sr,{path:e}):t.data===null?p.jsx(ar,{path:e}):p.jsx("div",{className:"truncate",children:new Date(t.data).toLocaleString()})}function Kq({path:e}){const t=Je(e,"literal");return t.status==="error"?p.jsx(Ke,{path:e,error:t.error,type:"literal"}):!("data"in t)||t.data===void 0?p.jsx(sr,{path:e}):t.data===null?p.jsx(ar,{path:e}):p.jsx("div",{className:"truncate",children:t.data})}function qq({path:e}){const t="record",{navigate:n}=Zr(),r=kt(e),o=Je(e,t);if(r.status==="error")return p.jsx(Rt,{path:e,error:r.error,type:t});if(o.status==="error")return p.jsx(Ke,{path:e,error:o.error,type:t});if(o.status=="not-found"||r.status==="not-found")return p.jsx(gn,{path:e,type:t});if(r.status==="loading")return p.jsx(nt,{path:e,type:t});if(!("data"in o)||o.data===void 0)return p.jsx(nt,{path:e,type:t});if(r.data.type!==t)return p.jsx(dr,{path:e,expectedType:t,actualType:r.data.type});const i=o.data;return p.jsxs("div",{children:[p.jsx(Mr,{path:e}),p.jsx("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2",children:i&&Object.entries(i).map(([s])=>p.jsxs("div",{onClick:()=>n(Fc(e,s)),className:"bg-primary-foreground cursor-pointer hover:bg-primary-foreground/50 min-w-[320px] max-h-[170px] overflow-hidden rounded-md border border-border-primary p-4",children:[p.jsx("div",{children:p.jsx("div",{className:"pb-4 font-semibold text-md",children:s})}),p.jsx("div",{children:p.jsx(FS,{path:Fc(e,s)})})]},s))})]})}function Gq({path:e}){const t=Je(e,"record");if(t.status==="error")return p.jsx(Ke,{path:e,error:t.error,type:"record"});if(!("data"in t)||t.data===void 0)return p.jsx(sr,{path:e});if(t.data===null)return p.jsx(ar,{path:e});const n=Object.keys(t.data);return p.jsxs("div",{className:"text-left",children:[p.jsx("span",{className:"text-fg-brand-primary",children:n.length}),p.jsx("span",{className:"mr-1",children:` item${n.length===1?"":"s"}:`}),n.map((r,o)=>p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-fg-brand-primary",children:r},r),o<n.length-1?", ":""]}))]})}let gv=()=>({events:{},emit(e,...t){(this.events[e]||[]).forEach(n=>n(...t))},on(e,t){return(this.events[e]=this.events[e]||[]).push(t),()=>this.events[e]=(this.events[e]||[]).filter(n=>n!==t)}});var U0={exports:{}};(function(e,t){var n=typeof Reflect<"u"?Reflect.construct:void 0,r=Object.defineProperty,o=Error.captureStackTrace;o===void 0&&(o=function(c){var u=new Error;r(c,"stack",{configurable:!0,get:function(){var f=u.stack;return r(this,"stack",{configurable:!0,value:f,writable:!0}),f},set:function(f){r(c,"stack",{configurable:!0,value:f,writable:!0})}})});function i(l){l!==void 0&&r(this,"message",{configurable:!0,value:l,writable:!0});var c=this.constructor.name;c!==void 0&&c!==this.name&&r(this,"name",{configurable:!0,value:c,writable:!0}),o(this,this.constructor)}i.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:i,writable:!0}});var s=function(){function l(u,d){return r(u,"name",{configurable:!0,value:d})}try{var c=function(){};if(l(c,"foo"),c.name==="foo")return l}catch{}}();function a(l,c){if(c==null||c===Error)c=i;else if(typeof c!="function")throw new TypeError("super_ should be a function");var u;if(typeof l=="string")u=l,l=n!==void 0?function(){return n(c,arguments,this.constructor)}:function(){c.apply(this,arguments)},s!==void 0&&(s(l,u),u=void 0);else if(typeof l!="function")throw new TypeError("constructor should be either a string or a function");l.super_=l.super=c;var d={constructor:{configurable:!0,value:l,writable:!0}};return u!==void 0&&(d.name={configurable:!0,value:u,writable:!0}),l.prototype=Object.create(c.prototype,d),l}t=e.exports=a,t.BaseError=i})(U0,U0.exports);var SA=U0.exports,TE="ProseMirror-selectednode",kA="",Es="\0",OE="__state_override__",Yq={LastNodeCompatible:"lastNodeCompatible",FormattingMark:"formattingMark",FormattingNode:"formattingNode",NodeCursor:"nodeCursor",FontStyle:"fontStyle",Link:"link",Color:"color",Alignment:"alignment",Indentation:"indentation",Behavior:"behavior",Code:"code",InlineNode:"inline",ListContainerNode:"listContainer",ListItemNode:"listItemNode",Block:"block",BlockNode:"block",TextBlock:"textBlock",ExcludeInputRules:"excludeFromInputRules",PreventExits:"preventsExits",Media:"media"},je=Yq,Li=Symbol.for("__remirror__"),en=(e=>(e.PlainExtension="RemirrorPlainExtension",e.NodeExtension="RemirrorNodeExtension",e.MarkExtension="RemirrorMarkExtension",e.PlainExtensionConstructor="RemirrorPlainExtensionConstructor",e.NodeExtensionConstructor="RemirrorNodeExtensionConstructor",e.MarkExtensionConstructor="RemirrorMarkExtensionConstructor",e.Manager="RemirrorManager",e.Preset="RemirrorPreset",e.PresetConstructor="RemirrorPresetConstructor",e))(en||{}),et=(e=>(e[e.Critical=1e6]="Critical",e[e.Highest=1e5]="Highest",e[e.High=1e4]="High",e[e.Medium=1e3]="Medium",e[e.Default=100]="Default",e[e.Low=10]="Low",e[e.Lowest=0]="Lowest",e))(et||{}),qn=(e=>(e[e.None=0]="None",e[e.Create=1]="Create",e[e.EditorView=2]="EditorView",e[e.Runtime=3]="Runtime",e[e.Destroy=4]="Destroy",e))(qn||{}),G=(e=>(e.Undo="_|undo|_",e.Redo="_|redo|_",e.Bold="_|bold|_",e.Italic="_|italic|_",e.Underline="_|underline|_",e.Strike="_|strike|_",e.Code="_|code|_",e.Paragraph="_|paragraph|_",e.H1="_|h1|_",e.H2="_|h2|_",e.H3="_|h3|_",e.H4="_|h4|_",e.H5="_|h5|_",e.H6="_|h6|_",e.TaskList="_|task|_",e.BulletList="_|bullet|_",e.OrderedList="_|number|_",e.Quote="_|quote|_",e.Divider="_|divider|_",e.Codeblock="_|codeblock|_",e.ClearFormatting="_|clear|_",e.Superscript="_|sup|_",e.Subscript="_|sub|_",e.LeftAlignment="_|left-align|_",e.CenterAlignment="_|center-align|_",e.RightAlignment="_|right-align|_",e.JustifyAlignment="_|justify-align|_",e.InsertLink="_|link|_",e.Find="_|find|_",e.FindBackwards="_|find-backwards|_",e.FindReplace="_|find-replace|_",e.AddFootnote="_|footnote|_",e.AddComment="_|comment|_",e.ContextMenu="_|context-menu|_",e.IncreaseFontSize="_|inc-font-size|_",e.DecreaseFontSize="_|dec-font-size|_",e.IncreaseIndent="_|indent|_",e.DecreaseIndent="_|dedent|_",e.Shortcuts="_|shortcuts|_",e.Copy="_|copy|_",e.Cut="_|cut|_",e.Paste="_|paste|_",e.PastePlain="_|paste-plain|_",e.SelectAll="_|select-all|_",e.Format="_|format|_",e))(G||{}),K=(e=>(e.PROD="RMR0000",e.UNKNOWN="RMR0001",e.INVALID_COMMAND_ARGUMENTS="RMR0002",e.CUSTOM="RMR0003",e.CORE_HELPERS="RMR0004",e.MUTATION="RMR0005",e.INTERNAL="RMR0006",e.MISSING_REQUIRED_EXTENSION="RMR0007",e.MANAGER_PHASE_ERROR="RMR0008",e.INVALID_GET_EXTENSION="RMR0010",e.INVALID_MANAGER_ARGUMENTS="RMR0011",e.SCHEMA="RMR0012",e.HELPERS_CALLED_IN_OUTER_SCOPE="RMR0013",e.INVALID_MANAGER_EXTENSION="RMR0014",e.DUPLICATE_COMMAND_NAMES="RMR0016",e.DUPLICATE_HELPER_NAMES="RMR0017",e.NON_CHAINABLE_COMMAND="RMR0018",e.INVALID_EXTENSION="RMR0019",e.INVALID_CONTENT="RMR0021",e.INVALID_NAME="RMR0050",e.EXTENSION="RMR0100",e.EXTENSION_SPEC="RMR0101",e.EXTENSION_EXTRA_ATTRIBUTES="RMR0102",e.INVALID_SET_EXTENSION_OPTIONS="RMR0103",e.REACT_PROVIDER_CONTEXT="RMR0200",e.REACT_GET_ROOT_PROPS="RMR0201",e.REACT_EDITOR_VIEW="RMR0202",e.REACT_CONTROLLED="RMR0203",e.REACT_NODE_VIEW="RMR0204",e.REACT_GET_CONTEXT="RMR0205",e.REACT_COMPONENTS="RMR0206",e.REACT_HOOKS="RMR0207",e.I18N_CONTEXT="RMR0300",e))(K||{}),Jq=function(t){return Xq(t)&&!Zq(t)};function Xq(e){return!!e&&typeof e=="object"}function Zq(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||tG(e)}var Qq=typeof Symbol=="function"&&Symbol.for,eG=Qq?Symbol.for("react.element"):60103;function tG(e){return e.$$typeof===eG}function nG(e){return Array.isArray(e)?[]:{}}function Of(e,t){return t.clone!==!1&&t.isMergeableObject(e)?$c(nG(e),e,t):e}function rG(e,t,n){return e.concat(t).map(function(r){return Of(r,n)})}function oG(e,t){if(!t.customMerge)return $c;var n=t.customMerge(e);return typeof n=="function"?n:$c}function iG(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function NE(e){return Object.keys(e).concat(iG(e))}function CA(e,t){try{return t in e}catch{return!1}}function sG(e,t){return CA(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function aG(e,t,n){var r={};return n.isMergeableObject(e)&&NE(e).forEach(function(o){r[o]=Of(e[o],n)}),NE(t).forEach(function(o){sG(e,o)||(CA(e,o)&&n.isMergeableObject(t[o])?r[o]=oG(o,n)(e[o],t[o],n):r[o]=Of(t[o],n))}),r}function $c(e,t,n){n=n||{},n.arrayMerge=n.arrayMerge||rG,n.isMergeableObject=n.isMergeableObject||Jq,n.cloneUnlessOtherwiseSpecified=Of;var r=Array.isArray(t),o=Array.isArray(e),i=r===o;return i?r?n.arrayMerge(e,t,n):aG(e,t,n):Of(t,n)}$c.all=function(t,n){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(r,o){return $c(r,o,n)},{})};var lG=$c,cG=lG;const uG=ia(cG);/*!
309
- * isobject <https://github.com/jonschlinkert/isobject>
310
- *
311
- * Copyright (c) 2014-2017, Jon Schlinkert.
312
- * Released under the MIT License.
313
- */var EA=function(t){return t!=null&&typeof t=="object"&&Array.isArray(t)===!1};/*!
314
- * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
315
- *
316
- * Copyright (c) 2014-2017, Jon Schlinkert.
317
- * Released under the MIT License.
318
- */var dG=EA;function ME(e){return dG(e)===!0&&Object.prototype.toString.call(e)==="[object Object]"}var fG=function(t){var n,r;return!(ME(t)===!1||(n=t.constructor,typeof n!="function")||(r=n.prototype,ME(r)===!1)||r.hasOwnProperty("isPrototypeOf")===!1)};/*!
319
- * is-extendable <https://github.com/jonschlinkert/is-extendable>
320
- *
321
- * Copyright (c) 2015-2017, Jon Schlinkert.
322
- * Released under the MIT License.
323
- */var pG=fG,hG=function(t){return pG(t)||typeof t=="function"||Array.isArray(t)};/*!
324
- * object.omit <https://github.com/jonschlinkert/object.omit>
325
- *
326
- * Copyright (c) 2014-2017, Jon Schlinkert.
327
- * Released under the MIT License.
328
- */var mG=hG,gG=function(t,n,r){if(!mG(t))return{};typeof n=="function"&&(r=n,n=[]),typeof n=="string"&&(n=[n]);for(var o=typeof r=="function",i=Object.keys(t),s={},a=0;a<i.length;a++){var l=i[a],c=t[l];(!n||n.indexOf(l)===-1&&(!o||r(c,l,t)))&&(s[l]=c)}return s};const V1=ia(gG);/*!
329
- * object.pick <https://github.com/jonschlinkert/object.pick>
330
- *
331
- * Copyright (c) 2014-2015 Jon Schlinkert, contributors.
332
- * Licensed under the MIT License
333
- */var vG=EA,yG=function(t,n){if(!vG(t)&&typeof t!="function")return{};var r={};if(typeof n=="string")return n in t&&(r[n]=t[n]),r;for(var o=n.length,i=-1;++i<o;){var s=n[i];s in t&&(r[s]=t[s])}return r};const W0=ia(yG),_A=/^[a-zà-öø-ÿ]+|[A-ZÀ-ÖØ-ß][a-zà-öø-ÿ]+|[a-zà-öø-ÿ]+|[0-9]+|[A-ZÀ-ÖØ-ß]+(?![a-zà-öø-ÿ])/g,xG=/\S+/g;function bG(e,t){const n={parts:[],prefixes:[]},r=e.matchAll(t);let o=0;for(const s of r){if(typeof s.index!="number")continue;const a=s[0];n.parts.push(a);const l=e.slice(o,s.index).trim();n.prefixes.push(l),o=s.index+a.length}const i=e.slice(o).trim();return i&&(n.parts.push(""),n.prefixes.push(i)),n}function TA(e,t){const{keepSpecialCharacters:n=!1,keep:r,prefix:o=""}=t||{},i=e.trim().normalize("NFC"),s=i.includes(" "),l=bG(i,s?xG:_A);return l.parts.map((c,u)=>{let d=l.prefixes[u]||"",f=c;return n===!1&&(r&&(f=f.normalize("NFD").replace(new RegExp(`[^a-zA-ZØßø0-9${r.join("")}]`,"g"),"")),r||(f=f.normalize("NFD").replace(/[^a-zA-ZØßø0-9]/g,""),d="")),r&&(d=d.replace(new RegExp(`[^${r.join("")}]`,"g"),"")),u===0?d+f:!d&&!f?"":s&&!d&&o.match(/\s/)?" "+f:(d||o)+f}).filter(Boolean)}function wG(e){const t=e.matchAll(_A).next().value,n=t?t.index:0;return e.slice(0,n+1).toUpperCase()+e.slice(n+1).toLowerCase()}function OA(e,t){return TA(e,t).reduce((n,r)=>n+wG(r),"")}function PE(e,t){return TA(e,{...t,prefix:"-"}).join("").toLowerCase()}function H0(e,t,n,r){var o,i=!1,s=0;function a(){o&&clearTimeout(o)}function l(){a(),i=!0}typeof t!="boolean"&&(r=n,n=t,t=void 0);function c(){for(var u=arguments.length,d=new Array(u),f=0;f<u;f++)d[f]=arguments[f];var h=this,m=Date.now()-s;if(i)return;function v(){s=Date.now(),n.apply(h,d)}function x(){o=void 0}r&&!o&&v(),a(),r===void 0&&m>e?v():t!==!0&&(o=setTimeout(r?x:v,r===void 0?e-m:e))}return c.cancel=l,c}function SG(e,t,n){return n===void 0?H0(e,t,!1):H0(e,n,t!==!1)}function vt(e,t,n){const r=e[t];return NA(!yv(r),n),r}function NA(e,t){if(!e)throw new kG(t)}var kG=class extends SA.BaseError{constructor(){super(...arguments),this.name="AssertionError"}};function $t(e){return Object.entries(e)}function Nf(e){return Object.keys(e)}function vv(e){return Object.values(e)}function Do(e,t,n){return e.includes(t,n)}function he(e){return Object.assign(Object.create(null),e)}function MA(e){return Object.prototype.toString.call(e)}function PA(e){return MA(e).slice(8,-1)}function wp(e,t){return n=>typeof n!==e?!1:t?t(n):!0}function U1(e){return t=>PA(t)===e}var yv=wp("undefined"),_e=wp("string"),Pr=wp("number",e=>!Number.isNaN(e)),ft=wp("function");function CG(e){return e===null}function EG(e){return e===!0||e===!1}function ml(e){if(PA(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})}function _G(e){return e==null||/^[bns]/.test(typeof e)}function Qs(e){return CG(e)||yv(e)}function Pn(e){return!Qs(e)&&(ft(e)||wp("object")(e))}var TG=U1("RegExp");function OG(e){return U1("Map")(e)}function NG(e){return U1("Set")(e)}function Hm(e){return Pn(e)&&!OG(e)&&!NG(e)&&Object.keys(e).length===0}var Bt=Array.isArray;function ea(e){return Bt(e)&&e.length===0}function RE(e){return Bt(e)&&e.length>0}function xv(e,t,n=r=>!!r){t.lastIndex=0;const r=[],o=t.flags;let i;o.includes("g")||(t=new RegExp(t.source,`g${o}`));do i=t.exec(e),i&&r.push(i);while(n(i));return t.lastIndex=0,r}function Km(){const e=Date.now(),t=Km.last||e;return Km.last=e>t?e:t+1}Km.last=0;function qm(e=""){return`${e}${Km().toString(36)}`}function MG(e){return V1(e,t=>!yv(t))}function PG(e){if(!ml(e))throw new Error("An invalid value was passed into this clone utility. Expected a plain object");return{...e}}function Mf(e,t=!1){const n=t?[...e].reverse():e,r=new Set(n);return t?[...r].reverse():[...r]}function RA(){}function RG(...e){return uG.all(e,{isMergeableObject:ml})}function jG({min:e,max:t,value:n}){return n<e?e:n>t?t:n}function AG(e){return e[e.length-1]}function ol(e,t){return[...e].map((n,r)=>({value:n,index:r})).sort((n,r)=>t(n.value,r.value)||n.index-r.index).map(({value:n})=>n)}function IG(e,t,n){try{if(_e(t)&&t in e)return e[t];Bt(t)&&(t=`['${t.join("']['")}']`);let r=e;return t.replace(/\[\s*(["'])(.*?)\1\s*]|^\s*(\w+)\s*(?=\.|\[|$)|\.\s*(\w*)\s*(?=\.|\[|$)|\[\s*(-?\d+)\s*]/g,(o,i,s,a,l,c)=>(r=r[s||a||l||c],"")),r===void 0?n:r}catch{return n}}function DG(e,t){const n=PG(t);let r=n;for(const[o,i]of e.entries()){const s=o>=e.length-1;let a=r[i];if(s){if(Bt(r)){const l=Number.parseInt(i.toString(),10);Pr(l)&&r.splice(l,1)}else Reflect.deleteProperty(r,i);return n}if(_G(a))return n;a=Bt(a)?[...a]:{...a},r[i]=a,r=a}return n}function LG(e){return t=>IG(t,e)}function jA(e,t,n=!1){const r=[],o=new Set,i=ft(t)?t:LG(t),s=n?[...e].reverse():e;for(const a of s){const l=i(a);o.has(l)||(o.add(l),r.push(a))}return n?r.reverse():r}function AA(e,t){const n=Bt(e)?e[0]:e;return Pr(t)?n<=t?Array.from({length:t+1-n},(r,o)=>o+n):Array.from({length:n+1-t},(r,o)=>-1*o+n):Array.from({length:Math.abs(n)},(r,o)=>(n<0?-1:1)*o)}function jE(e,...t){const n=t.filter(Pr);return e>=Math.min(...n)&&e<=Math.max(...n)}function IA(e){return ft(e)?e():e}var DA="https://remirror.io/docs/errors",FG={[K.UNKNOWN]:"An error occurred but we're not quite sure why. 🧐",[K.INVALID_COMMAND_ARGUMENTS]:"The arguments passed to the command method were invalid.",[K.CUSTOM]:"This is a custom error, possibly thrown by an external library.",[K.CORE_HELPERS]:"An error occurred in a function called from the `@remirror/core-helpers` library.",[K.MUTATION]:"Mutation of immutable value detected.",[K.INTERNAL]:"This is an error which should not occur and is internal to the remirror codebase.",[K.MISSING_REQUIRED_EXTENSION]:"Your editor is missing a required extension.",[K.MANAGER_PHASE_ERROR]:"This occurs when accessing a method or property before it is available.",[K.INVALID_GET_EXTENSION]:"The user requested an invalid extension from the getExtensions method. Please check the `createExtensions` return method is returning an extension with the defined constructor.",[K.INVALID_MANAGER_ARGUMENTS]:"Invalid value(s) passed into `Manager` constructor. Only `Presets` and `Extensions` are supported.",[K.SCHEMA]:"There is a problem with the schema or you are trying to access a node / mark that doesn't exists.",[K.HELPERS_CALLED_IN_OUTER_SCOPE]:"The `helpers` method which is passed into the ``create*` method should only be called within returned method since it relies on an active view (not present in the outer scope).",[K.INVALID_MANAGER_EXTENSION]:"You requested an invalid extension from the manager.",[K.DUPLICATE_COMMAND_NAMES]:"Command method names must be unique within the editor.",[K.DUPLICATE_HELPER_NAMES]:"Helper method names must be unique within the editor.",[K.NON_CHAINABLE_COMMAND]:"Attempted to chain a non chainable command.",[K.INVALID_EXTENSION]:"The provided extension is invalid.",[K.INVALID_CONTENT]:"The content provided to the editor is not supported.",[K.INVALID_NAME]:"An invalid name was used for the extension.",[K.EXTENSION]:"An error occurred within an extension. More details should be made available.",[K.EXTENSION_SPEC]:"The spec was defined without calling the `defaults`, `parse` or `dom` methods.",[K.EXTENSION_EXTRA_ATTRIBUTES]:"Extra attributes must either be a string or an object.",[K.INVALID_SET_EXTENSION_OPTIONS]:"A call to `extension.setOptions` was made with invalid keys.",[K.REACT_PROVIDER_CONTEXT]:"`useRemirrorContext` was called outside of the `remirror` context. It can only be used within an active remirror context created by the `<Remirror />`.",[K.REACT_GET_ROOT_PROPS]:"`getRootProps` has been attached to the DOM more than once. It should only be attached to the dom once per editor.",[K.REACT_EDITOR_VIEW]:"A problem occurred adding the editor view to the dom.",[K.REACT_CONTROLLED]:"There is a problem with your controlled editor setup.",[K.REACT_NODE_VIEW]:"Something went wrong with your custom ReactNodeView Component.",[K.REACT_GET_CONTEXT]:"You attempted to call `getContext` provided by the `useRemirror` prop during the first render of the editor. This is not possible and should only be after the editor first mounts.",[K.REACT_COMPONENTS]:"An error occurred within a remirror component.",[K.REACT_HOOKS]:"An error occurred within a remirror hook.",[K.I18N_CONTEXT]:"You called `useI18n()` outside of an `I18nProvider` context."};function zG(e){return _e(e)&&Do(vv(K),e)}function $G(e,t){const n=FG[e],r=n?`${n}
334
-
335
- `:"",o=t?`${t}
336
-
337
- `:"";return`${r}${o}For more information visit ${DA}#${e.toLowerCase()}`}var LA=class extends SA.BaseError{constructor({code:e,message:t,disableLogging:n=!1}={}){const r=zG(e)?e:K.CUSTOM;super($G(r,t)),this.errorCode=r,this.url=`${DA}#${r.toLowerCase()}`,n||console.error(this.message)}static create(e={}){return new LA(e)}};function xe(e,t){if(!e)throw LA.create(t)}function Ra(e,t={}){return e}function cn(e){this.content=e}cn.prototype={constructor:cn,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,o=r.find(e),i=r.content.slice();return o==-1?i.push(n||e,t):(i[o+1]=t,n&&(i[o]=n)),new cn(i)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new cn(n)},addToStart:function(e,t){return new cn([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new cn(n)},addBefore:function(e,t,n){var r=this.remove(t),o=r.content.slice(),i=r.find(e);return o.splice(i==-1?o.length:i,0,t,n),new cn(o)},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=cn.from(e),e.size?new cn(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=cn.from(e),e.size?new cn(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=cn.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}};cn.from=function(e){if(e instanceof cn)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new cn(t)};function FA(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let o=e.child(r),i=t.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){let s=FA(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function zA(e,t,n,r){for(let o=e.childCount,i=t.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=e.child(--o),a=t.child(--i),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let c=0,u=Math.min(s.text.length,a.text.length);for(;c<u&&s.text[s.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let c=zA(s.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class D{constructor(t,n){if(this.content=t,this.size=n||0,n==null)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,n,r,o=0,i){for(let s=0,a=0;a<n;s++){let l=this.content[s],c=a+l.nodeSize;if(c>t&&r(l,o+a,i||null,s)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,t-u),Math.min(l.content.size,n-u),r,o+u)}a=c}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,r,o){let i="",s=!0;return this.nodesBetween(t,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(t,l)-l,n-l):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<t.content.length;i++)o.push(t.content[i]);return new D(o,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],o=0;if(n>t)for(let i=0,s=0;s<n;i++){let a=this.content[i],l=s+a.nodeSize;l>t&&((s<t||l>n)&&(a.isText?a=a.cut(Math.max(0,t-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,t-s-1),Math.min(a.content.size,n-s-1))),r.push(a),o+=a.nodeSize),s=l}return new D(r,o)}cutByIndex(t,n){return t==n?D.empty:t==0&&n==this.content.length?this:new D(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[t]=n,new D(o,i)}addToStart(t){return new D([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new D(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(t.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let n=this.content[t];if(!n)throw new RangeError("Index "+t+" out of range for "+this);return n}maybeChild(t){return this.content[t]||null}forEach(t){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];t(o,r,n),r+=o.nodeSize}}findDiffStart(t,n=0){return FA(this,t,n)}findDiffEnd(t,n=this.size,r=t.size){return zA(this,t,n,r)}findIndex(t,n=-1){if(t==0)return uh(0,t);if(t==this.size)return uh(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let r=0,o=0;;r++){let i=this.child(r),s=o+i.nodeSize;if(s>=t)return s==t||n>0?uh(r+1,s):uh(r,o);o=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return D.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new D(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return D.empty;let n,r=0;for(let o=0;o<t.length;o++){let i=t[o];r+=i.nodeSize,o&&i.isText&&t[o-1].sameMarkup(i)?(n||(n=t.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new D(n||t,r)}static from(t){if(!t)return D.empty;if(t instanceof D)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new D([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}D.empty=new D([],0);const Hy={index:0,offset:0};function uh(e,t){return Hy.index=e,Hy.offset=t,Hy}function Gm(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 r=0;r<e.length;r++)if(!Gm(e[r],t[r]))return!1}else{for(let r in e)if(!(r in t)||!Gm(e[r],t[r]))return!1;for(let r in t)if(!(r in e))return!1}return!0}class He{constructor(t,n){this.type=t,this.attrs=n}addToSet(t){let n,r=!1;for(let o=0;o<t.length;o++){let i=t[o];if(this.eq(i))return t;if(this.type.excludes(i.type))n||(n=t.slice(0,o));else{if(i.type.excludes(this.type))return t;!r&&i.type.rank>this.type.rank&&(n||(n=t.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=t.slice()),r||n.push(this),n}removeFromSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return t.slice(0,n).concat(t.slice(n+1));return t}isInSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return!0;return!1}eq(t){return this==t||this.type==t.type&&Gm(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=t.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let o=r.create(n.attrs);return r.checkAttrs(o.attrs),o}static sameSet(t,n){if(t==n)return!0;if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(n[r]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return He.none;if(t instanceof He)return[t];let n=t.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}}He.none=[];class Ym extends Error{}class X{constructor(t,n,r){this.content=t,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=BA(this.content,t+this.openStart,n);return r&&new X(r,this.openStart,this.openEnd)}removeBetween(t,n){return new X($A(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return X.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new X(D.fromJSON(t,n.content),r,o)}static maxOpen(t,n=!0){let r=0,o=0;for(let i=t.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=t.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new X(t,r,o)}}X.empty=new X(D.empty,0,0);function $A(e,t,n){let{index:r,offset:o}=e.findIndex(t),i=e.maybeChild(r),{index:s,offset:a}=e.findIndex(n);if(o==t||i.isText){if(a!=n&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(r,i.copy($A(i.content,t-o-1,n-o-1)))}function BA(e,t,n,r){let{index:o,offset:i}=e.findIndex(t),s=e.maybeChild(o);if(i==t||s.isText)return e.cut(0,t).append(n).append(e.cut(t));let a=BA(s.content,t-i-1,n);return a&&e.replaceChild(o,s.copy(a))}function BG(e,t,n){if(n.openStart>e.depth)throw new Ym("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Ym("Inconsistent open depths");return VA(e,t,n,0)}function VA(e,t,n,r){let o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){let s=VA(e,t,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let s=e.parent,a=s.content;return Va(s,a.cut(0,e.parentOffset).append(n.content).append(a.cut(t.parentOffset)))}else{let{start:s,end:a}=VG(n,e);return Va(i,WA(e,s,a,t,r))}else return Va(i,Jm(e,t,r))}function UA(e,t){if(!t.type.compatibleContent(e.type))throw new Ym("Cannot join "+t.type.name+" onto "+e.type.name)}function K0(e,t,n){let r=e.node(n);return UA(r,t.node(n)),r}function Ba(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 Ad(e,t,n,r){let o=(t||e).node(n),i=0,s=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(Ba(e.nodeAfter,r),i++));for(let a=i;a<s;a++)Ba(o.child(a),r);t&&t.depth==n&&t.textOffset&&Ba(t.nodeBefore,r)}function Va(e,t){return e.type.checkContent(t),e.copy(t)}function WA(e,t,n,r,o){let i=e.depth>o&&K0(e,t,o+1),s=r.depth>o&&K0(n,r,o+1),a=[];return Ad(null,e,o,a),i&&s&&t.index(o)==n.index(o)?(UA(i,s),Ba(Va(i,WA(e,t,n,r,o+1)),a)):(i&&Ba(Va(i,Jm(e,t,o+1)),a),Ad(t,n,o,a),s&&Ba(Va(s,Jm(n,r,o+1)),a)),Ad(r,null,o,a),new D(a)}function Jm(e,t,n){let r=[];if(Ad(null,e,n,r),e.depth>n){let o=K0(e,t,n+1);Ba(Va(o,Jm(e,t,n+1)),r)}return Ad(t,null,n,r),new D(r)}function VG(e,t){let n=t.depth-e.openStart,o=t.node(n).copy(e.content);for(let i=n-1;i>=0;i--)o=t.node(i).copy(D.from(o));return{start:o.resolveNoCache(e.openStart+n),end:o.resolveNoCache(o.content.size-e.openEnd-n)}}class Bc{constructor(t,n,r){this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,n=this.index(this.depth);if(n==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=t.child(n);return r?t.child(n).cut(r):o}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):t==0?null:this.parent.child(t-1)}posAtIndex(t,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<t;i++)o+=r.child(i).nodeSize;return o}marks(){let t=this.parent,n=this.index();if(t.content.size==0)return He.none;if(this.textOffset)return t.child(n).marks;let r=t.maybeChild(n-1),o=t.maybeChild(n);if(!r){let a=r;r=o,o=a}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(t){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=t.parent.maybeChild(t.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(t){for(let n=this.depth;n>0;n--)if(this.start(n)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){if(t.pos<this.pos)return t.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);r>=0;r--)if(t.pos<=this.end(r)&&(!n||n(this.node(r))))return new il(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let n=1;n<=this.depth;n++)t+=(t?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return t+":"+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,i=n;for(let s=t;;){let{index:a,offset:l}=s.content.findIndex(i),c=i-l;if(r.push(s,a,o+l),!c||(s=s.child(a),s.isText))break;i=c-1,o+=l+1}return new Bc(n,r,i)}static resolveCached(t,n){let r=AE.get(t);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else AE.set(t,r=new UG);let o=r.elts[r.i]=Bc.resolve(t,n);return r.i=(r.i+1)%WG,o}}class UG{constructor(){this.elts=[],this.i=0}}const WG=12,AE=new WeakMap;class il{constructor(t,n,r){this.$from=t,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const HG=Object.create(null);let zs=class q0{constructor(t,n,r,o=He.none){this.type=t,this.attrs=n,this.marks=o,this.content=r||D.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,n,r,o=0){this.content.nodesBetween(t,n,r,o,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,n,r,o){return this.content.textBetween(t,n,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,n,r){return this.type==t&&Gm(this.attrs,n||t.defaultAttrs||HG)&&He.sameSet(this.marks,r||He.none)}copy(t=null){return t==this.content?this:new q0(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new q0(this.type,this.attrs,this.content,t)}cut(t,n=this.content.size){return t==0&&n==this.content.size?this:this.copy(this.content.cut(t,n))}slice(t,n=this.content.size,r=!1){if(t==n)return X.empty;let o=this.resolve(t),i=this.resolve(n),s=r?0:o.sharedDepth(n),a=o.start(s),c=o.node(s).content.cut(o.pos-a,i.pos-a);return new X(c,o.depth-s,i.depth-s)}replace(t,n,r){return BG(this.resolve(t),this.resolve(n),r)}nodeAt(t){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(t);if(n=n.maybeChild(r),!n)return null;if(o==t||n.isText)return n;t-=o+1}}childAfter(t){let{index:n,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(t);if(r<t)return{node:this.content.child(n),index:n,offset:r};let o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(t){return Bc.resolveCached(this,t)}resolveNoCache(t){return Bc.resolve(this,t)}rangeHasMark(t,n,r){let o=!1;return n>t&&this.nodesBetween(t,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}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 t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),HA(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,r=D.empty,o=0,i=r.childCount){let s=this.contentMatchAt(t).matchFragment(r,o,i),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=o;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(t,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(t).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=He.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),t=r.addToSet(t)}if(!He.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(n=>n.toJSON())),t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(t.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(n.text,r)}let o=D.fromJSON(t,n.content),i=t.nodeType(n.type).create(n.attrs,o,r);return i.type.checkAttrs(i.attrs),i}};zs.prototype.text=void 0;class Xm extends zs{constructor(t,n,r,o){if(super(t,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):HA(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new Xm(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new Xm(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return t==0&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function HA(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class sl{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new KG(t,n);if(r.next==null)return sl.empty;let o=KA(r);r.next&&r.err("Unexpected trailing text");let i=QG(ZG(o));return eY(i,r),i}matchType(t){for(let n=0;n<this.next.length;n++)if(this.next[n].type==t)return this.next[n].next;return null}matchFragment(t,n=0,r=t.childCount){let o=this;for(let i=n;o&&i<r;i++)o=o.matchType(t.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:n}=this.next[t];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(t){for(let n=0;n<this.next.length;n++)for(let r=0;r<t.next.length;r++)if(this.next[n].type==t.next[r].type)return!0;return!1}fillBefore(t,n=!1,r=0){let o=[this];function i(s,a){let l=s.matchFragment(t,r);if(l&&(!n||l.validEnd))return D.from(a.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=i(d,a.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(t){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==t)return this.wrapCache[r+1];let n=this.computeWrapping(t);return this.wrapCache.push(t,n),n}computeWrapping(t){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(t)){let s=[];for(let a=o;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:a,next:l}=i.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!o.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:o}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function n(r){t.push(r);for(let o=0;o<r.next.length;o++)t.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),t.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+t.indexOf(r.next[s].next);return i}).join(`
338
- `)}}sl.empty=new sl(!0);class KG{constructor(t,n){this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.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(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function KA(e){let t=[];do t.push(qG(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function qG(e){let t=[];do t.push(GG(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function GG(e){let t=XG(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=YG(e,t);else break;return t}function IE(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function YG(e,t){let n=IE(e),r=n;return e.eat(",")&&(e.next!="}"?r=IE(e):r=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function JG(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.isInGroup(t)&&o.push(s)}return o.length==0&&e.err("No node type or group '"+t+"' found"),o}function XG(e){if(e.eat("(")){let t=KA(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=JG(e,e.next).map(n=>(e.inline==null?e.inline=n.isInline:e.inline!=n.isInline&&e.err("Mixing inline and block content"),{type:"name",value:n}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function ZG(e){let t=[[]];return o(i(e,0),n()),t;function n(){return t.push([])-1}function r(s,a,l){let c={term:l,to:a};return t[s].push(c),c}function o(s,a){s.forEach(l=>l.to=a)}function i(s,a){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(i(c,a)),[]);if(s.type=="seq")for(let l=0;;l++){let c=i(s.exprs[l],a);if(l==s.exprs.length-1)return c;o(c,a=n())}else if(s.type=="star"){let l=n();return r(a,l),o(i(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return o(i(s.expr,a),l),o(i(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(i(s.expr,a));if(s.type=="range"){let l=a;for(let c=0;c<s.min;c++){let u=n();o(i(s.expr,l),u),l=u}if(s.max==-1)o(i(s.expr,l),l);else for(let c=s.min;c<s.max;c++){let u=n();r(l,u),o(i(s.expr,l),u),l=u}return[r(l)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function qA(e,t){return t-e}function DE(e,t){let n=[];return r(t),n.sort(qA);function r(o){let i=e[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let s=0;s<i.length;s++){let{term:a,to:l}=i[s];!a&&n.indexOf(l)==-1&&r(l)}}}function QG(e){let t=Object.create(null);return n(DE(e,0));function n(r){let o=[];r.forEach(s=>{e[s].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<o.length;u++)o[u][0]==a&&(c=o[u][1]);DE(e,l).forEach(u=>{c||o.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=t[r.join(",")]=new sl(r.indexOf(e.length-1)>-1);for(let s=0;s<o.length;s++){let a=o[s][1].sort(qA);i.next.push({type:o[s][0],next:t[a.join(",")]||n(a)})}return i}}function eY(e,t){for(let n=0,r=[e];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let a=0;a<o.next.length;a++){let{type:l,next:c}=o.next[a];s.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&t.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function GA(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 YA(e,t){let n=Object.create(null);for(let r in e){let o=t&&t[r];if(o===void 0){let i=e[r];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function JA(e,t,n,r){for(let o in t)if(!(o in e))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in e){let i=e[o];i.validate&&i.validate(t[o])}}function XA(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new nY(e,r,t[r]);return n}let G0=class ZA{constructor(t,n,r){this.name=t,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=XA(t,r.attrs),this.defaultAttrs=GA(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||t=="text"),this.isText=t=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==sl.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:YA(this.attrs,t)}create(t=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new zs(this,this.computeAttrs(t),D.from(n),He.setFrom(r))}createChecked(t=null,n,r){return n=D.from(n),this.checkContent(n),new zs(this,this.computeAttrs(t),n,He.setFrom(r))}createAndFill(t=null,n,r){if(t=this.computeAttrs(t),n=D.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let o=this.contentMatch.matchFragment(n),i=o&&o.fillBefore(D.empty,!0);return i?new zs(this,t,n.append(i),He.setFrom(r)):null}validContent(t){let n=this.contentMatch.matchFragment(t);if(!n||!n.validEnd)return!1;for(let r=0;r<t.childCount;r++)if(!this.allowsMarks(t.child(r).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){JA(this.attrs,t,"node",this.name)}allowsMarkType(t){return this.markSet==null||this.markSet.indexOf(t)>-1}allowsMarks(t){if(this.markSet==null)return!0;for(let n=0;n<t.length;n++)if(!this.allowsMarkType(t[n].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let n;for(let r=0;r<t.length;r++)this.allowsMarkType(t[r].type)?n&&n.push(t[r]):n||(n=t.slice(0,r));return n?n.length?n:He.none:t}static compile(t,n){let r=Object.create(null);t.forEach((i,s)=>r[i]=new ZA(i,n,s));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function tY(e,t,n){let r=n.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}class nY{constructor(t,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?tY(t,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Sp{constructor(t,n,r,o){this.name=t,this.rank=n,this.schema=r,this.spec=o,this.attrs=XA(t,o.attrs),this.excluded=null;let i=GA(this.attrs);this.instance=i?new He(this,i):null}create(t=null){return!t&&this.instance?this.instance:new He(this,YA(this.attrs,t))}static compile(t,n){let r=Object.create(null),o=0;return t.forEach((i,s)=>r[i]=new Sp(i,o++,n,s)),r}removeFromSet(t){for(var n=0;n<t.length;n++)t[n].type==this&&(t=t.slice(0,n).concat(t.slice(n+1)),n--);return t}isInSet(t){for(let n=0;n<t.length;n++)if(t[n].type==this)return t[n]}checkAttrs(t){JA(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}class rY{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in t)n[o]=t[o];n.nodes=cn.from(t.nodes),n.marks=cn.from(t.marks||{}),this.nodes=G0.compile(this.spec.nodes,this),this.marks=Sp.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=sl.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?LE(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:LE(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,n=null,r,o){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof G0){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(n,r,o)}text(t,n){let r=this.nodes.text;return new Xm(r,r.defaultAttrs,t,He.setFrom(n))}mark(t,n){return typeof t=="string"&&(t=this.marks[t]),t.create(n)}nodeFromJSON(t){return zs.fromJSON(this,t)}markFromJSON(t){return He.fromJSON(this,t)}nodeType(t){let n=this.nodes[t];if(!n)throw new RangeError("Unknown node type: "+t);return n}}function LE(e,t){let n=[];for(let r=0;r<t.length;r++){let o=t[r],i=e.marks[o],s=i;if(i)n.push(i);else for(let a in e.marks){let l=e.marks[a];(o=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}function oY(e){return e.tag!=null}function iY(e){return e.style!=null}class Vc{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(oY(o))this.tags.push(o);else if(iY(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=t.nodes[o.node];return i.contentMatch.matchType(i)})}parse(t,n={}){let r=new zE(this,n,!1);return r.addAll(t,He.none,n.from,n.to),r.finish()}parseSlice(t,n={}){let r=new zE(this,n,!0);return r.addAll(t,He.none,n.from,n.to),X.maxOpen(r.finish())}matchTag(t,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(lY(t,i.tag)&&(i.namespace===void 0||t.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(t);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(t,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],a=s.style;if(!(a.indexOf(t)!=0||s.context&&!r.matchesContext(s.context)||a.length>t.length&&(a.charCodeAt(t.length)!=61||a.slice(t.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(t){let n=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<n.length;s++){let a=n[s];if((a.priority==null?50:a.priority)<i)break}n.splice(s,0,o)}for(let o in t.marks){let i=t.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=$E(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in t.nodes){let i=t.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=$E(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new Vc(t,Vc.schemaRules(t)))}}const QA={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},sY={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},eI={ol:!0,ul:!0},Zm=1,Qm=2,Id=4;function FE(e,t,n){return t!=null?(t?Zm:0)|(t==="full"?Qm:0):e&&e.whitespace=="pre"?Zm|Qm:n&~Id}class dh{constructor(t,n,r,o,i,s){this.type=t,this.attrs=n,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=He.none,this.match=i||(s&Id?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(D.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(t.type))?(this.match=r,o):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&Zm)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=D.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(D.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!QA.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class zE{constructor(t,n,r){this.parser=t,this.options=n,this.isOpen=r,this.open=0;let o=n.topNode,i,s=FE(null,n.preserveWhitespace,0)|(r?Id:0);o?i=new dh(o.type,o.attrs,He.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new dh(null,null,He.none,!0,null,s):i=new dh(t.schema.topNodeType,null,He.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,n){t.nodeType==3?this.addTextNode(t,n):t.nodeType==1&&this.addElement(t,n)}addTextNode(t,n){let r=t.nodeValue,o=this.top;if(o.options&Qm||o.inlineContext(t)||/[^ \t\r\n\u000c]/.test(r)){if(o.options&Zm)o.options&Qm?r=r.replace(/\r\n?/g,`
339
- `):r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let i=o.content[o.content.length-1],s=t.previousSibling;(!i||s&&s.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),n),this.findInText(t)}else this.findInside(t)}addElement(t,n,r){let o=t.nodeName.toLowerCase(),i;eI.hasOwnProperty(o)&&this.parser.normalizeLists&&aY(t);let s=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(i=this.parser.matchTag(t,this,r));if(s?s.ignore:sY.hasOwnProperty(o))this.findInside(t),this.ignoreFallback(t,n);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(t=s.skip);let a,l=this.top,c=this.needsBlock;if(QA.hasOwnProperty(o))l.content.length&&l.content[0].isInline&&this.open&&(this.open--,l=this.top),a=!0,l.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,n);return}let u=s&&s.skip?n:this.readStyles(t,n);u&&this.addAll(t,u),a&&this.sync(l),this.needsBlock=c}else{let a=this.readStyles(t,n);a&&this.addElementByRule(t,s,a,s.consuming===!1?i:void 0)}}leafFallback(t,n){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
340
- `),n)}ignoreFallback(t,n){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n)}readStyles(t,n){let r=t.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(i,s,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(t,n,r,o){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r)||this.leafFallback(t,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(t);else if(o)this.addElement(t,r,o);else if(n.getContent)this.findInside(t),n.getContent(t,this.parser.schema).forEach(l=>this.insertNode(l,r));else{let l=t;typeof n.contentElement=="string"?l=t.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(t):n.contentElement&&(l=n.contentElement),this.findAround(t,l,!0),this.addAll(l,r),this.findAround(t,l,!1)}i&&this.sync(a)&&this.open--}addAll(t,n,r,o){let i=r||0;for(let s=r?t.childNodes[r]:t.firstChild,a=o==null?null:t.childNodes[o];s!=a;s=s.nextSibling,++i)this.findAtPoint(t,i),this.addDOM(s,n);this.findAtPoint(t,i)}findPlace(t,n){let r,o;for(let i=this.open;i>=0;i--){let s=this.nodes[i],a=s.findWrapping(t);if(a&&(!r||r.length>a.length)&&(r=a,o=s,!a.length)||s.solid)break}if(!r)return null;this.sync(o);for(let i=0;i<r.length;i++)n=this.enterInner(r[i],null,n,!1);return n}insertNode(t,n){if(t.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(n=this.enterInner(o,null,n))}let r=this.findPlace(t,n);if(r){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(t.type));let i=He.none;for(let s of r.concat(t.marks))(o.type?o.type.allowsMarkType(s.type):BE(s.type,t.type))&&(i=s.addToSet(i));return o.content.push(t.mark(i)),!0}return!1}enter(t,n,r,o){let i=this.findPlace(t.create(n),r);return i&&(i=this.enterInner(t,n,r,!0,o)),i}enterInner(t,n,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(t);let a=FE(t,i,s.options);s.options&Id&&s.content.length==0&&(a|=Id);let l=He.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):BE(c.type,t))?(l=c.addToSet(l),!1):!0),this.nodes.push(new dh(t,n,l,o,null,a)),this.open++,r}closeExtra(t=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(t));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(t){for(let n=this.open;n>=0;n--)if(this.nodes[n]==t)return this.open=n,!0;return!1}get currentPos(){this.closeExtra();let t=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let o=r.length-1;o>=0;o--)t+=r[o].nodeSize;n&&t++}return t}findAtPoint(t,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==t&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&t.nodeType==1&&t.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(t,n,r){if(t!=n&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&t.nodeType==1&&t.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&(this.find[n].pos=this.currentPos-(t.nodeValue.length-this.find[n].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let n=t.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=i;l--)if(s(a-1,l))return!0;return!1}else{let u=l>0||l==0&&o?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function aY(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&eI.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):r=="li"?n=t:r&&(n=null)}}function lY(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function $E(e){let t={};for(let n in e)t[n]=e[n];return t}function BE(e,t){let n=t.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(e))continue;let i=[],s=a=>{i.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==t||i.indexOf(u)<0&&s(u))return!0}};if(s(o.contentMatch))return!0}}class ha{constructor(t,n){this.nodes=t,this.marks=n}serializeFragment(t,n={},r){r||(r=Ky(n).createDocumentFragment());let o=r,i=[];return t.forEach(s=>{if(i.length||s.marks.length){let a=0,l=0;for(;a<i.length&&l<s.marks.length;){let c=s.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(i[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<i.length;)o=i.pop()[1];for(;l<s.marks.length;){let c=s.marks[l++],u=this.serializeMark(c,s.isInline,n);u&&(i.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(t,n){let{dom:r,contentDOM:o}=Ah(Ky(n),this.nodes[t.type.name](t),null,t.attrs);if(o){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,n,o)}return r}serializeNode(t,n={}){let r=this.serializeNodeInner(t,n);for(let o=t.marks.length-1;o>=0;o--){let i=this.serializeMark(t.marks[o],t.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(t,n,r={}){let o=this.marks[t.type.name];return o&&Ah(Ky(r),o(t,n),null,t.attrs)}static renderSpec(t,n,r=null,o){return Ah(t,n,r,o)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new ha(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=VE(t.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(t){return VE(t.marks)}}function VE(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Ky(e){return e.document||window.document}const UE=new WeakMap;function cY(e){let t=UE.get(e);return t===void 0&&UE.set(e,t=uY(e)),t}function uY(e){let t=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")t||(t=[]),t.push(r);else for(let o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(e),t}function Ah(e,t,n,r){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let o=t[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=cY(r))&&i.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=o.indexOf(" ");s>0&&(n=o.slice(0,s),o=o.slice(s+1));let a,l=n?e.createElementNS(n,o):e.createElement(o),c=t[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):l.setAttribute(d,c[d])}}for(let d=u;d<t.length;d++){let f=t[d];if(f===0){if(d<t.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:m}=Ah(e,f,n,r);if(l.appendChild(h),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:l,contentDOM:a}}const tI=65535,nI=Math.pow(2,16);function dY(e,t){return e+t*nI}function WE(e){return e&tI}function fY(e){return(e-(e&tI))/nI}const rI=1,oI=2,Ih=4,iI=8;class Y0{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&iI)>0}get deletedBefore(){return(this.delInfo&(rI|Ih))>0}get deletedAfter(){return(this.delInfo&(oI|Ih))>0}get deletedAcross(){return(this.delInfo&Ih)>0}}class Sr{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&Sr.empty)return Sr.empty}recover(t){let n=0,r=WE(t);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+fY(t)}mapResult(t,n=1){return this._map(t,n,!1)}map(t,n=1){return this._map(t,n,!0)}_map(t,n,r){let o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?o:0);if(l>t)break;let c=this.ranges[a+i],u=this.ranges[a+s],d=l+c;if(t<=d){let f=c?t==l?-1:t==d?1:n:n,h=l+o+(f<0?0:u);if(r)return h;let m=t==(n<0?l:d)?null:dY(a/3,t-l),v=t==l?oI:t==d?rI:Ih;return(n<0?t!=l:t!=d)&&(v|=iI),new Y0(h,v,m)}o+=u-c}return r?t+o:new Y0(t+o,0,null)}touches(t,n){let r=0,o=WE(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>t)break;let c=this.ranges[a+i],u=l+c;if(t<=u&&a==o*3)return!0;r+=this.ranges[a+s]-c}return!1}forEach(t){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],a=s-(this.inverted?i:0),l=s+(this.inverted?0:i),c=this.ranges[o+n],u=this.ranges[o+r];t(a,a+c,l,l+u),i+=u-c}}invert(){return new Sr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?Sr.empty:new Sr(t<0?[0,-t,0]:[0,0,t])}}Sr.empty=new Sr([]);class hc{constructor(t=[],n,r=0,o=t.length){this.maps=t,this.mirror=n,this.from=r,this.to=o}slice(t=0,n=this.maps.length){return new hc(this.maps,this.mirror,t,n)}copy(){return new hc(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(t,n){this.to=this.maps.push(t),n!=null&&this.setMirror(this.maps.length-1,n)}appendMapping(t){for(let n=0,r=this.maps.length;n<t.maps.length;n++){let o=t.getMirror(n);this.appendMap(t.maps[n],o!=null&&o<n?r+o:void 0)}}getMirror(t){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==t)return this.mirror[n+(n%2?-1:1)]}}setMirror(t,n){this.mirror||(this.mirror=[]),this.mirror.push(t,n)}appendMappingInverted(t){for(let n=t.maps.length-1,r=this.maps.length+t.maps.length;n>=0;n--){let o=t.getMirror(n);this.appendMap(t.maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let t=new hc;return t.appendMappingInverted(this),t}map(t,n=1){if(this.mirror)return this._map(t,n,!0);for(let r=this.from;r<this.to;r++)t=this.maps[r].map(t,n);return t}mapResult(t,n=1){return this._map(t,n,!1)}_map(t,n,r){let o=0;for(let i=this.from;i<this.to;i++){let s=this.maps[i],a=s.mapResult(t,n);if(a.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,t=this.maps[l].recover(a.recover);continue}}o|=a.delInfo,t=a.pos}return r?t:new Y0(t,o,null)}}const qy=Object.create(null);class Vt{getMap(){return Sr.empty}merge(t){return null}static fromJSON(t,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=qy[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in qy)throw new RangeError("Duplicate use of step JSON ID "+t);return qy[t]=n,n.prototype.jsonID=t,n}}class Tt{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new Tt(t,null)}static fail(t){return new Tt(null,t)}static fromReplace(t,n,r,o){try{return Tt.ok(t.replace(n,r,o))}catch(i){if(i instanceof Ym)return Tt.fail(i.message);throw i}}}function W1(e,t,n){let r=[];for(let o=0;o<e.childCount;o++){let i=e.child(o);i.content.size&&(i=i.copy(W1(i.content,t,i))),i.isInline&&(i=t(i,n,o)),r.push(i)}return D.fromArray(r)}class ki extends Vt{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=t.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new X(W1(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return Tt.fromReplace(t,this.from,this.to,i)}invert(){return new So(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new ki(n.pos,r.pos,this.mark)}merge(t){return t instanceof ki&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new ki(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 new RangeError("Invalid input for AddMarkStep.fromJSON");return new ki(n.from,n.to,t.markFromJSON(n.mark))}}Vt.jsonID("addMark",ki);class So extends Vt{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=new X(W1(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),t),n.openStart,n.openEnd);return Tt.fromReplace(t,this.from,this.to,r)}invert(){return new ki(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new So(n.pos,r.pos,this.mark)}merge(t){return t instanceof So&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new So(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 new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new So(n.from,n.to,t.markFromJSON(n.mark))}}Vt.jsonID("removeMark",So);class _s extends Vt{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Tt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Tt.fromReplace(t,this.pos,this.pos+1,new X(D.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new _s(this.pos,n.marks[o]);return new _s(this.pos,this.mark)}}return new Uc(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new _s(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 new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new _s(n.pos,t.markFromJSON(n.mark))}}Vt.jsonID("addNodeMark",_s);class Uc extends Vt{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Tt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Tt.fromReplace(t,this.pos,this.pos+1,new X(D.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new _s(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Uc(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 new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Uc(n.pos,t.markFromJSON(n.mark))}}Vt.jsonID("removeNodeMark",Uc);class Zt extends Vt{constructor(t,n,r,o=!1){super(),this.from=t,this.to=n,this.slice=r,this.structure=o}apply(t){return this.structure&&J0(t,this.from,this.to)?Tt.fail("Structure replace would overwrite content"):Tt.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Sr([this.from,this.to-this.from,this.slice.size])}invert(t){return new Zt(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Zt(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(t){if(!(t instanceof Zt)||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?X.empty:new X(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new Zt(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?X.empty:new X(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new Zt(t.from,this.to,n,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Zt(n.from,n.to,X.fromJSON(t,n.slice),!!n.structure)}}Vt.jsonID("replace",Zt);class Ot extends Vt{constructor(t,n,r,o,i,s,a=!1){super(),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=a}apply(t){if(this.structure&&(J0(t,this.from,this.gapFrom)||J0(t,this.gapTo,this.to)))return Tt.fail("Structure gap-replace would overwrite content");let n=t.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Tt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Tt.fromReplace(t,this.from,this.to,r):Tt.fail("Content does not fit in gap")}getMap(){return new Sr([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 Ot(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),o=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||i>r.pos?null:new Ot(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}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 new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ot(n.from,n.to,n.gapFrom,n.gapTo,X.fromJSON(t,n.slice),n.insert,!!n.structure)}}Vt.jsonID("replaceAround",Ot);function J0(e,t,n){let r=e.resolve(t),o=n-t,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function pY(e,t,n,r){let o=[],i=[],s,a;e.doc.nodesBetween(t,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,t),h=Math.min(c+l.nodeSize,n),m=r.addToSet(d);for(let v=0;v<d.length;v++)d[v].isInSet(m)||(s&&s.to==f&&s.mark.eq(d[v])?s.to=h:o.push(s=new So(f,h,d[v])));a&&a.to==f?a.to=h:i.push(a=new ki(f,h,r))}}),o.forEach(l=>e.step(l)),i.forEach(l=>e.step(l))}function hY(e,t,n,r){let o=[],i=0;e.doc.nodesBetween(t,n,(s,a)=>{if(!s.isInline)return;i++;let l=null;if(r instanceof Sp){let c=s.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let c=Math.min(a+s.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],f;for(let h=0;h<o.length;h++){let m=o[h];m.step==i-1&&d.eq(o[h].style)&&(f=m)}f?(f.to=c,f.step=i):o.push({style:d,from:Math.max(a,t),to:c,step:i})}}}),o.forEach(s=>e.step(new So(s.from,s.to,s.style)))}function H1(e,t,n,r=n.contentMatch,o=!0){let i=e.doc.nodeAt(t),s=[],a=t+1;for(let l=0;l<i.childCount;l++){let c=i.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new Zt(a,u,X.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||e.step(new So(a,u,c.marks[f]));if(o&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,m;for(;f=h.exec(c.text);)m||(m=new X(D.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new Zt(a+f.index,a+f.index+f[0].length,m))}}a=u}if(!r.validEnd){let l=r.fillBefore(D.empty,!0);e.replace(a,a,new X(l,0,0))}for(let l=s.length-1;l>=0;l--)e.step(s[l])}function mY(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function fu(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth;;--r){let o=e.$from.node(r),i=e.$from.index(r),s=e.$to.indexAfter(r);if(r<e.depth&&o.canReplace(i,s,n))return r;if(r==0||o.type.spec.isolating||!mY(o,i,s))break}return null}function gY(e,t,n){let{$from:r,$to:o,depth:i}=t,s=r.before(i+1),a=o.after(i+1),l=s,c=a,u=D.empty,d=0;for(let m=i,v=!1;m>n;m--)v||r.index(m)>0?(v=!0,u=D.from(r.node(m).copy(u)),d++):l--;let f=D.empty,h=0;for(let m=i,v=!1;m>n;m--)v||o.after(m+1)<o.end(m)?(v=!0,f=D.from(o.node(m).copy(f)),h++):c++;e.step(new Ot(l,c,s,a,new X(u.append(f),d,h),u.size-d,!0))}function K1(e,t,n=null,r=e){let o=vY(e,t),i=o&&yY(r,t);return i?o.map(HE).concat({type:t,attrs:n}).concat(i.map(HE)):null}function HE(e){return{type:e,attrs:null}}function vY(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;let s=i.length?i[0]:t;return n.canReplaceWith(r,o,s)?i:null}function yY(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.child(r),s=t.contentMatch.findWrapping(i.type);if(!s)return null;let l=(s.length?s[s.length-1]:t).contentMatch;for(let c=r;l&&c<o;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:s}function xY(e,t,n){let r=D.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let a=n[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=D.from(n[s].type.create(n[s].attrs,r))}let o=t.start,i=t.end;e.step(new Ot(o,i,o,i,new X(r,0,0),n.length,!0))}function bY(e,t,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=e.steps.length;e.doc.nodesBetween(t,n,(s,a)=>{let l=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,l)&&wY(e.doc,e.mapping.slice(i).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!m?c=!1:!h&&m&&(c=!0)}c===!1&&aI(e,s,a,i),H1(e,e.mapping.slice(i).map(a,1),r,void 0,c===null);let u=e.mapping.slice(i),d=u.map(a,1),f=u.map(a+s.nodeSize,1);return e.step(new Ot(d,f,d+1,f-1,new X(D.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&sI(e,s,a,i),!1}})}function sI(e,t,n,r){t.forEach((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let l=e.mapping.slice(r).map(n+1+i+s.index);e.replaceWith(l,l+1,t.type.schema.linebreakReplacement.create())}}})}function aI(e,t,n,r){t.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=e.mapping.slice(r).map(n+1+i);e.replaceWith(s,s+1,t.type.schema.text(`
341
- `))}})}function wY(e,t,n){let r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function SY(e,t,n,r,o){let i=e.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return e.replaceWith(t,t+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new Ot(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new X(D.from(s),0,0),1,!0))}function mc(e,t,n=1,r){let o=e.resolve(t),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>i;c--,u--){let d=o.node(c),f=o.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),m=r&&r[u+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let v=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!v.type.validContent(h))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function kY(e,t,n=1,r){let o=e.doc.resolve(t),i=D.empty,s=D.empty;for(let a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){i=D.from(o.node(a).copy(i));let u=r&&r[c];s=D.from(u?u.type.create(u.attrs,s):o.node(a).copy(s))}e.step(new Zt(t,t,new X(i.append(s),n,n),!0))}function kp(e,t){let n=e.resolve(t),r=n.index();return EY(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function CY(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let o=0;o<t.childCount;o++){let i=t.child(o),s=i.type==r?e.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!e.type.allowsMarks(i.marks))return!1}return n.validEnd}function EY(e,t){return!!(e&&t&&!e.isLeaf&&CY(e,t))}function _Y(e,t,n){let r=null,{linebreakReplacement:o}=e.doc.type.schema,i=e.doc.resolve(t-n),s=i.node().type;if(o&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(o);u&&!d?r=!1:!u&&d&&(r=!0)}let a=e.steps.length;if(r===!1){let u=e.doc.resolve(t+n);aI(e,u.node(),u.before(),a)}s.inlineContent&&H1(e,t+n-1,s,i.node().contentMatchAt(i.index()),r==null);let l=e.mapping.slice(a),c=l.map(t-n);if(e.step(new Zt(c,l.map(t+n,-1),X.empty,!0)),r===!0){let u=e.doc.resolve(c);sI(e,u.node(),u.before(),e.steps.length)}return e}function lI(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 o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,n))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function cI(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=r.depth;s>=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),c=r.node(s),u=!1;if(i==1)u=c.canReplace(l,l,o);else{let d=c.contentMatchAt(l).findWrapping(o.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function q1(e,t,n=t,r=X.empty){if(t==n&&!r.size)return null;let o=e.resolve(t),i=e.resolve(n);return uI(o,i,r)?new Zt(t,n,r):new TY(o,i,r).fit()}function uI(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}class TY{constructor(t,n,r){this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=D.empty;for(let o=0;o<=t.depth;o++){let i=t.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(t.indexAfter(o))})}for(let o=t.depth;o>0;o--)this.placed=D.from(t.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(t<0?this.$to:r.doc.resolve(t));if(!o)return null;let i=this.placed,s=r.depth,a=o.depth;for(;s&&a&&i.childCount==1;)i=i.firstChild.content,s--,a--;let l=new X(i,s,a);return t>-1?new Ot(r.pos,t,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Zt(r.pos,o.pos,l):null}findFittable(){let t=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<t;r++){let i=n.firstChild;if(n.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){t=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?t:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=Gy(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(n==1&&(s?c.matchType(s.type)||(d=c.fillBefore(D.from(s),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:d};if(n==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:t,openStart:n,openEnd:r}=this.unplaced,o=Gy(t,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new X(t,n+1,Math.max(r,o.size+n>=t.size-r?n+1:0)),!0)}dropNode(){let{content:t,openStart:n,openEnd:r}=this.unplaced,o=Gy(t,n);if(o.childCount<=1&&n>0){let i=t.size-n<=n+o.size;this.unplaced=new X(Xu(t,n-1,1),n-1,i?n-1:r)}else this.unplaced=new X(Xu(t,n,1),n,r)}placeNodes({sliceDepth:t,frontierDepth:n,parent:r,inject:o,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let v=0;v<i.length;v++)this.openFrontierNode(i[v]);let s=this.unplaced,a=r?r.content:s.content,l=s.openStart-t,c=0,u=[],{match:d,type:f}=this.frontier[n];if(o){for(let v=0;v<o.childCount;v++)u.push(o.child(v));d=d.matchFragment(o)}let h=a.size+t-(s.content.size-s.openEnd);for(;c<a.childCount;){let v=a.child(c),x=d.matchType(v.type);if(!x)break;c++,(c>1||l==0||v.content.size)&&(d=x,u.push(dI(v.mark(f.allowedMarks(v.marks)),c==1?l:0,c==a.childCount?h:-1)))}let m=c==a.childCount;m||(h=-1),this.placed=Zu(this.placed,n,D.from(u)),this.frontier[n].match=d,m&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let v=0,x=a;v<h;v++){let b=x.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),x=b.content}this.unplaced=m?t==0?X.empty:new X(Xu(s.content,t-1,1),t-1,h<0?s.openEnd:t-1):new X(Xu(s.content,t,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],n;if(!t.type.isTextblock||!Yy(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(t){e:for(let n=Math.min(this.depth,t.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],i=n<t.depth&&t.end(n+1)==t.pos+(t.depth-(n+1)),s=Yy(t,n,o,r,i);if(s){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=Yy(t,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:i?t.doc.resolve(t.after(n+1)):t}}}}close(t){let n=this.findCloseLevel(t);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Zu(this.placed,n.depth,n.fit)),t=n.move;for(let r=n.depth+1;r<=t.depth;r++){let o=t.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,t.index(r));this.openFrontierNode(o.type,o.attrs,i)}return t}openFrontierNode(t,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(t),this.placed=Zu(this.placed,this.depth,D.from(t.create(n,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(D.empty,!0);n.childCount&&(this.placed=Zu(this.placed,this.frontier.length,n))}}function Xu(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Xu(e.firstChild.content,t-1,n)))}function Zu(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Zu(e.lastChild.content,t-1,n)))}function Gy(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function dI(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,dI(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(D.empty,!0)))),e.copy(r)}function Yy(e,t,n,r,o){let i=e.node(t),s=o?e.indexAfter(t):e.index(t);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!OY(n,i.content,s)?a:null}function OY(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function NY(e){return e.spec.defining||e.spec.definingForContent}function MY(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let o=e.doc.resolve(t),i=e.doc.resolve(n);if(uI(o,i,r))return e.step(new Zt(t,n,r));let s=pI(o,e.doc.resolve(n));s[s.length-1]==0&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let f=o.depth,h=o.pos-1;f>0;f--,h--){let m=o.node(f).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(f)>-1?a=f:o.before(f)==h&&s.splice(1,0,-f)}let l=s.indexOf(a),c=[],u=r.openStart;for(let f=r.content,h=0;;h++){let m=f.firstChild;if(c.push(m),h==r.openStart)break;f=m.content}for(let f=u-1;f>=0;f--){let h=c[f],m=NY(h.type);if(m&&!h.sameMarkup(o.node(Math.abs(a)-1)))u=f;else if(m||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+u+1)%(r.openStart+1),m=c[h];if(m)for(let v=0;v<s.length;v++){let x=s[(v+l)%s.length],b=!0;x<0&&(b=!1,x=-x);let w=o.node(x-1),S=o.index(x-1);if(w.canReplaceWith(S,S,m.type,m.marks))return e.replace(o.before(x),b?i.after(x):n,new X(fI(r.content,0,r.openStart,h),h,r.openEnd))}}let d=e.steps.length;for(let f=s.length-1;f>=0&&(e.replace(t,n,r),!(e.steps.length>d));f--){let h=s[f];h<0||(t=o.before(h),n=i.after(h))}}function fI(e,t,n,r,o){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(fI(i.content,t+1,n,r,i)))}if(t>r){let i=o.contentMatchAt(0),s=i.fillBefore(e).append(e);e=s.append(i.matchFragment(s).fillBefore(D.empty,!0))}return e}function PY(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let o=lI(e.doc,t,r.type);o!=null&&(t=n=o)}e.replaceRange(t,n,new X(D.from(r),0,0))}function RY(e,t,n){let r=e.doc.resolve(t),o=e.doc.resolve(n),i=pI(r,o);for(let s=0;s<i.length;s++){let a=i[s],l=s==i.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return e.delete(r.start(a),o.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),o.indexAfter(a-1))))return e.delete(r.before(a),o.after(a))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(t-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return e.delete(r.before(s),n);e.delete(t,n)}function pI(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let o=r;o>=0;o--){let i=e.start(o);if(i<e.pos-(e.depth-o)||t.end(o)>t.pos+(t.depth-o)||e.node(o).type.spec.isolating||t.node(o).type.spec.isolating)break;(i==t.start(o)||o==e.depth&&o==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&o&&t.start(o-1)==i-1)&&n.push(o)}return n}class gc extends Vt{constructor(t,n,r){super(),this.pos=t,this.attr=n,this.value=r}apply(t){let n=t.nodeAt(this.pos);if(!n)return Tt.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return Tt.fromReplace(t,this.pos,this.pos+1,new X(D.from(o),0,n.isLeaf?0:1))}getMap(){return Sr.empty}invert(t){return new gc(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 gc(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 new RangeError("Invalid input for AttrStep.fromJSON");return new gc(n.pos,n.attr,n.value)}}Vt.jsonID("attr",gc);class Pf extends Vt{constructor(t,n){super(),this.attr=t,this.value=n}apply(t){let n=Object.create(null);for(let o in t.attrs)n[o]=t.attrs[o];n[this.attr]=this.value;let r=t.type.create(n,t.content,t.marks);return Tt.ok(r)}getMap(){return Sr.empty}invert(t){return new Pf(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Pf(n.attr,n.value)}}Vt.jsonID("docAttr",Pf);let Wc=class extends Error{};Wc=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};Wc.prototype=Object.create(Error.prototype);Wc.prototype.constructor=Wc;Wc.prototype.name="TransformError";class jY{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new hc}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let n=this.maybeStep(t);if(n.failed)throw new Wc(n.failed);return this}maybeStep(t){let n=t.apply(this.doc);return n.failed||this.addStep(t,n.doc),n}get docChanged(){return this.steps.length>0}addStep(t,n){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=n}replace(t,n=t,r=X.empty){let o=q1(this.doc,t,n,r);return o&&this.step(o),this}replaceWith(t,n,r){return this.replace(t,n,new X(D.from(r),0,0))}delete(t,n){return this.replace(t,n,X.empty)}insert(t,n){return this.replaceWith(t,t,n)}replaceRange(t,n,r){return MY(this,t,n,r),this}replaceRangeWith(t,n,r){return PY(this,t,n,r),this}deleteRange(t,n){return RY(this,t,n),this}lift(t,n){return gY(this,t,n),this}join(t,n=1){return _Y(this,t,n),this}wrap(t,n){return xY(this,t,n),this}setBlockType(t,n=t,r,o=null){return bY(this,t,n,r,o),this}setNodeMarkup(t,n,r=null,o){return SY(this,t,n,r,o),this}setNodeAttribute(t,n,r){return this.step(new gc(t,n,r)),this}setDocAttribute(t,n){return this.step(new Pf(t,n)),this}addNodeMark(t,n){return this.step(new _s(t,n)),this}removeNodeMark(t,n){if(!(n instanceof He)){let r=this.doc.nodeAt(t);if(!r)throw new RangeError("No node at position "+t);if(n=n.isInSet(r.marks),!n)return this}return this.step(new Uc(t,n)),this}split(t,n=1,r){return kY(this,t,n,r),this}addMark(t,n,r){return pY(this,t,n,r),this}removeMark(t,n,r){return hY(this,t,n,r),this}clearIncompatible(t,n,r){return H1(this,t,n,r),this}}const Jy=Object.create(null);class Le{constructor(t,n,r){this.$anchor=t,this.$head=n,this.ranges=r||[new AY(t.min(n),t.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let n=0;n<t.length;n++)if(t[n].$from.pos!=t[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,n=X.empty){let r=n.content.lastChild,o=null;for(let a=0;a<n.openEnd;a++)o=r,r=r.lastChild;let i=t.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:c}=s[a],u=t.mapping.slice(i);t.replaceRange(u.map(l.pos),u.map(c.pos),a?X.empty:n),a==0&&GE(t,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(t,n){let r=t.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:s,$to:a}=o[i],l=t.mapping.slice(r),c=l.map(s.pos),u=l.map(a.pos);i?t.deleteRange(c,u):(t.replaceRangeWith(c,u,n),GE(t,r,n.isInline?-1:1))}}static findFrom(t,n,r=!1){let o=t.parent.inlineContent?new Oe(t):Ll(t.node(0),t.parent,t.pos,t.index(),n,r);if(o)return o;for(let i=t.depth-1;i>=0;i--){let s=n<0?Ll(t.node(0),t.node(i),t.before(i+1),t.index(i),n,r):Ll(t.node(0),t.node(i),t.after(i+1),t.index(i)+1,n,r);if(s)return s}return null}static near(t,n=1){return this.findFrom(t,n)||this.findFrom(t,-n)||new zn(t.node(0))}static atStart(t){return Ll(t,t,0,0,1)||new zn(t)}static atEnd(t){return Ll(t,t,t.content.size,t.childCount,-1)||new zn(t)}static fromJSON(t,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Jy[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in Jy)throw new RangeError("Duplicate use of selection JSON ID "+t);return Jy[t]=n,n.prototype.jsonID=t,n}getBookmark(){return Oe.between(this.$anchor,this.$head).getBookmark()}}Le.prototype.visible=!0;class AY{constructor(t,n){this.$from=t,this.$to=n}}let KE=!1;function qE(e){!KE&&!e.parent.inlineContent&&(KE=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Oe extends Le{constructor(t,n=t){qE(t),qE(n),super(t,n)}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 Le.near(r);let o=t.resolve(n.map(this.anchor));return new Oe(o.parent.inlineContent?o:r,r)}replace(t,n=X.empty){if(super.replace(t,n),n==X.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof Oe&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new bv(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 new RangeError("Invalid input for TextSelection.fromJSON");return new Oe(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){let o=t.resolve(n);return new this(o,r==n?o:t.resolve(r))}static between(t,n,r){let o=t.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let i=Le.findFrom(n,r,!0)||Le.findFrom(n,-r,!0);if(i)n=i.$head;else return Le.near(n,r)}return t.parent.inlineContent||(o==0?t=n:(t=(Le.findFrom(t,-r,!0)||Le.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=o<0&&(t=n))),new Oe(t,n)}}Le.jsonID("text",Oe);class bv{constructor(t,n){this.anchor=t,this.head=n}map(t){return new bv(t.map(this.anchor),t.map(this.head))}resolve(t){return Oe.between(t.resolve(this.anchor),t.resolve(this.head))}}class we extends Le{constructor(t){let n=t.nodeAfter,r=t.node(0).resolve(t.pos+n.nodeSize);super(t,r),this.node=n}map(t,n){let{deleted:r,pos:o}=n.mapResult(this.anchor),i=t.resolve(o);return r?Le.near(i):new we(i)}content(){return new X(D.from(this.node),0,0)}eq(t){return t instanceof we&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new G1(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new we(t.resolve(n.anchor))}static create(t,n){return new we(t.resolve(n))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}}we.prototype.visible=!1;Le.jsonID("node",we);class G1{constructor(t){this.anchor=t}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new bv(r,r):new G1(r)}resolve(t){let n=t.resolve(this.anchor),r=n.nodeAfter;return r&&we.isSelectable(r)?new we(n):Le.near(n)}}class zn extends Le{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,n=X.empty){if(n==X.empty){t.delete(0,t.doc.content.size);let r=Le.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else super.replace(t,n)}toJSON(){return{type:"all"}}static fromJSON(t){return new zn(t)}map(t){return new zn(t)}eq(t){return t instanceof zn}getBookmark(){return IY}}Le.jsonID("all",zn);const IY={map(){return this},resolve(e){return new zn(e)}};function Ll(e,t,n,r,o,i=!1){if(t.inlineContent)return Oe.create(e,n);for(let s=r-(o>0?0:1);o>0?s<t.childCount:s>=0;s+=o){let a=t.child(s);if(a.isAtom){if(!i&&we.isSelectable(a))return we.create(e,n-(o<0?a.nodeSize:0))}else{let l=Ll(e,a,n+o,o<0?a.childCount:0,o,i);if(l)return l}n+=a.nodeSize*o}return null}function GE(e,t,n){let r=e.steps.length-1;if(r<t)return;let o=e.steps[r];if(!(o instanceof Zt||o instanceof Ot))return;let i=e.mapping.maps[r],s;i.forEach((a,l,c,u)=>{s==null&&(s=u)}),e.setSelection(Le.near(e.doc.resolve(s),n))}const YE=1,fh=2,JE=4;class DY extends jY{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.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(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=(this.updated|YE)&~fh,this.storedMarks=null,this}get selectionSet(){return(this.updated&YE)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=fh,this}ensureMarks(t){return He.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&fh)>0}addStep(t,n){super.addStep(t,n),this.updated=this.updated&~fh,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,n=!0){let r=this.selection;return n&&(t=t.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||He.none))),r.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,n,r){let o=this.doc.type.schema;if(n==null)return t?this.replaceSelectionWith(o.text(t),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!t)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(t,i)),this.selection.empty||this.setSelection(Le.near(this.selection.$to)),this}}setMeta(t,n){return this.meta[typeof t=="string"?t:t.key]=n,this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=JE,this}get scrolledIntoView(){return(this.updated&JE)>0}}function XE(e,t){return!t||!e?e:e.bind(t)}class Qu{constructor(t,n,r){this.name=t,this.init=XE(n.init,r),this.apply=XE(n.apply,r)}}const LY=[new Qu("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new Qu("selection",{init(e,t){return e.selection||Le.atStart(t.doc)},apply(e){return e.selection}}),new Qu("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new Qu("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})];class Xy{constructor(t,n){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=LY.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Qu(r.key,r.spec.state,r))})}}class ja{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,t,this))return!1}return!0}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let n=[t],r=this.applyInner(t),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let l=o?o[s].n:0,c=o?o[s].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",t),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<s?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),i=!0}o&&(o[s]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new ja(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];n[i.name]=i.apply(t,this[i.name],this,n)}return n}get tr(){return new DY(this)}static create(t){let n=new Xy(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new ja(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(t,r);return r}reconfigure(t){let n=new Xy(this.schema,t.plugins),r=n.fields,o=new ja(n);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(t,o)}return o}toJSON(t){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),t&&typeof t=="object")for(let r in t){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=t[r],i=o.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(o,this[o.key]))}return n}static fromJSON(t,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let o=new Xy(t.schema,t.plugins),i=new ja(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=zs.fromJSON(t.schema,n.doc);else if(s.name=="selection")i.selection=Le.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[s.name]=c.fromJSON.call(l,t,n[a],i);return}}i[s.name]=s.init(t,i)}}),i}}function hI(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):r=="handleDOMEvents"&&(o=hI(o,t,{})),n[r]=o}return n}class Vi{constructor(t){this.spec=t,this.props={},t.props&&hI(t.props,this,this.props),this.key=t.key?t.key.key:mI("plugin")}getState(t){return t[this.key]}}const Zy=Object.create(null);function mI(e){return e in Zy?e+"$"+ ++Zy[e]:(Zy[e]=0,e+"$")}class pu{constructor(t="key"){this.key=mI(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}function gI(){return typeof document<"u"?document:null}function vI(e,t){if(typeof e!="string")return[e];var n=[e];typeof t=="string"||Array.isArray(t)?t={brackets:t}:t||(t={});var r=t.brackets?Array.isArray(t.brackets)?t.brackets:[t.brackets]:["{}","[]","()"],o=t.escape||"___",i=!!t.flat;r.forEach(function(l){var c=new RegExp(["\\",l[0],"[^\\",l[0],"\\",l[1],"]*\\",l[1]].join("")),u=[];function d(f,h,m){var v=n.push(f.slice(l[0].length,-l[1].length))-1;return u.push(v),o+v+o}n.forEach(function(f,h){for(var m,v=0;f!=m;)if(m=f,f=f.replace(c,d),v++>1e4)throw Error("References have circular dependency. Please, check them.");n[h]=f}),u=u.reverse(),n=n.map(function(f){return u.forEach(function(h){f=f.replace(new RegExp("(\\"+o+h+"\\"+o+")","g"),l[0]+"$1"+l[1])}),f})});var s=new RegExp("\\"+o+"([0-9]+)\\"+o);function a(l,c,u){for(var d=[],f,h=0;f=s.exec(l);){if(h++>1e4)throw Error("Circular references in parenthesis");d.push(l.slice(0,f.index)),d.push(a(c[f[1]],c)),l=l.slice(f.index+f[0].length)}return d.push(l),d}return i?n:a(n[0],n)}function yI(e,t){if(t&&t.flat){var n=t&&t.escape||"___",r=e[0],o;if(!r)return"";for(var i=new RegExp("\\"+n+"([0-9]+)\\"+n),s=0;r!=o;){if(s++>1e4)throw Error("Circular references in "+e);o=r,r=r.replace(i,a)}return r}return e.reduce(function l(c,u){return Array.isArray(u)&&(u=u.reduce(l,"")),c+u},"");function a(l,c){if(e[c]==null)throw Error("Reference "+c+"is undefined");return e[c]}}function xI(e,t){return Array.isArray(e)?yI(e,t):vI(e,t)}xI.parse=vI;xI.stringify=yI;const FY={id:"extension.command.copy.label",message:"Copy",comment:"Label for copy command."},zY={id:"extension.command.copy.description",message:"Copy the selected text",comment:"Description for copy command."},$Y={id:"extension.command.cut.label",message:"Cut",comment:"Label for cut command."},BY={id:"extension.command.cut.description",message:"Cut the selected text",comment:"Description for cut command."},VY={id:"extension.command.paste.label",message:"Paste",comment:"Label for paste command."},UY={id:"extension.command.paste.description",message:"Paste content into the editor",comment:"Description for paste command."},WY={id:"extension.command.select-all.label",message:"Select all",comment:"Label for select all command."},HY={id:"extension.command.select-all.description",message:"Select all content within the editor",comment:"Description for select all command."};var ta=Object.freeze({__proto__:null,COPY_DESCRIPTION:zY,COPY_LABEL:FY,CUT_DESCRIPTION:BY,CUT_LABEL:$Y,PASTE_DESCRIPTION:UY,PASTE_LABEL:VY,SELECT_ALL_DESCRIPTION:HY,SELECT_ALL_LABEL:WY});const KY={id:"extension.command.toggle-bold.label",message:"Bold",comment:"Label for bold formatting command."},qY={id:"extension.command.toggle-bold.description",message:"Add bold formatting to the selected text",comment:"Description for bold formatting command."};var ZE=Object.freeze({__proto__:null,DESCRIPTION:qY,LABEL:KY});const GY={id:"extension.command.toggle-heading.label",message:`{level, select, 1 {Heading 1}
342
- 2 {Heading 2}
343
- 3 {Heading 3}
344
- 4 {Heading 4}
345
- 5 {Heading 5}
346
- 6 {Heading 6}
347
- other {Heading}}`,comment:"Label for heading command with support for levels."};var YY=Object.freeze({__proto__:null,LABEL:GY});const JY={id:"extension.command.undo.label",message:"Undo",comment:"Label for undo."},XY={id:"extension.command.undo.description",message:"Undo the most recent action",comment:"Description for undo."},ZY={id:"extension.command.redo.label",message:"Redo",comment:"Label for redo."},QY={id:"extension.command.redo.description",message:"Redo the most recent action",comment:"Description for redo."};var eg=Object.freeze({__proto__:null,REDO_DESCRIPTION:QY,REDO_LABEL:ZY,UNDO_DESCRIPTION:XY,UNDO_LABEL:JY});const eJ={id:"extension.command.toggle-italic.label",message:"Italic",comment:"Label for italic formatting command."},tJ={id:"extension.command.toggle-italic.description",message:"Italicize the selected text",comment:"Description for italic formatting command."};var QE=Object.freeze({__proto__:null,DESCRIPTION:tJ,LABEL:eJ});const nJ={id:"extension.command.toggle-ordered-list.label",message:"Ordered list",comment:"Label for inserting an ordered list into the editor."},rJ={id:"extension.command.toggle-bullet-list.description",message:"Bulleted list",comment:"Description for inserting a bullet list into the editor."},oJ={id:"extension.command.toggle-task-list.description",message:"Tasked list",comment:"Description for inserting a task list into the editor."};var Y1=Object.freeze({__proto__:null,BULLET_LIST_LABEL:rJ,ORDERED_LIST_LABEL:nJ,TASK_LIST_LABEL:oJ});const iJ={id:"extension.command.insert-paragraph.label",message:"Insert Paragraph",comment:"Label for inserting a paragraph."},sJ={id:"extension.command.insert-paragraph.description",message:"Insert a new paragraph",comment:"Description for inserting a paragraph."},aJ={id:"extension.command.convert-paragraph.label",message:"Convert Paragraph",comment:"Label for converting the current node into a paragraph."},lJ={id:"extension.command.convert-paragraph.description",message:"Convert current block into a paragraph block.",comment:"Description for converting a paragraph."};var tg=Object.freeze({__proto__:null,CONVERT_DESCRIPTION:lJ,CONVERT_LABEL:aJ,INSERT_DESCRIPTION:sJ,INSERT_LABEL:iJ});const cJ={id:"extension.command.toggle-strike.label",message:"Strikethrough",comment:"Label for strike formatting command."},uJ={id:"extension.command.toggle-strike.description",message:"Strikethrough the selected text",comment:"Description for strike formatting command."};var e_=Object.freeze({__proto__:null,DESCRIPTION:uJ,LABEL:cJ});class eo{constructor(t,n,r={}){this.match=t,this.match=t,this.handler=typeof n=="string"?dJ(n):n,this.undoable=r.undoable!==!1,this.inCode=r.inCode||!1}}function dJ(e){return function(t,n,r,o){let i=e;if(n[1]){let s=n[0].lastIndexOf(n[1]);i+=n[0].slice(s+n[1].length),r+=s;let a=r-o;a>0&&(i=n[0].slice(s-a,s)+i,r=o)}return t.tr.insertText(i,r,o)}}const fJ=500;function pJ({rules:e}){let t=new Vi({state:{init(){return null},apply(n,r){let o=n.getMeta(this);return o||(n.selectionSet||n.docChanged?null:r)}},props:{handleTextInput(n,r,o,i){return t_(n,r,o,i,e,t)},handleDOMEvents:{compositionend:n=>{setTimeout(()=>{let{$cursor:r}=n.state.selection;r&&t_(n,r.pos,r.pos,"",e,t)})}}},isInputRules:!0});return t}function t_(e,t,n,r,o,i){if(e.composing)return!1;let s=e.state,a=s.doc.resolve(t),l=a.parent.textBetween(Math.max(0,a.parentOffset-fJ),a.parentOffset,null,"")+r;for(let c=0;c<o.length;c++){let u=o[c];if(a.parent.type.spec.code){if(!u.inCode)continue}else if(u.inCode==="only")continue;let d=u.match.exec(l),f=d&&u.handler(s,d,t-(d[0].length-r.length),n);if(f)return u.undoable&&f.setMeta(i,{transform:f,from:t,to:n,text:r}),e.dispatch(f),!0}return!1}const hJ=(e,t)=>{let n=e.plugins;for(let r=0;r<n.length;r++){let o=n[r],i;if(o.spec.isInputRules&&(i=o.getState(e))){if(t){let s=e.tr,a=i.transform;for(let l=a.steps.length-1;l>=0;l--)s.step(a.steps[l].invert(a.docs[l]));if(i.text){let l=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,e.schema.text(i.text,l))}else s.delete(i.from,i.to);t(s)}return!0}}return!1};new eo(/--$/,"—");new eo(/\.\.\.$/,"…");new eo(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“");new eo(/"$/,"”");new eo(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘");new eo(/'$/,"’");function J1(e,t,n=null,r){return new eo(e,(o,i,s,a)=>{let l=n instanceof Function?n(i):n,c=o.tr.delete(s,a),u=c.doc.resolve(s),d=u.blockRange(),f=d&&K1(d,t,l);if(!f)return null;c.wrap(d,f);let h=c.doc.resolve(s-1).nodeBefore;return h&&h.type==t&&kp(c.doc,s-1)&&(!r||r(i,h))&&c.join(s-1),c})}function mJ(e,t,n=null){return new eo(e,(r,o,i,s)=>{let a=r.doc.resolve(i),l=n instanceof Function?n(o):n;return a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),t)?r.tr.delete(i,s).setBlockType(i,i,t,l):null})}const un=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Rf=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t};let X0=null;const mi=function(e,t,n){let r=X0||(X0=document.createRange());return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},gJ=function(){X0=null},al=function(e,t,n,r){return n&&(n_(e,t,n,r,-1)||n_(e,t,n,r,1))},vJ=/^(img|br|input|textarea|hr)$/i;function n_(e,t,n,r,o){for(;;){if(e==n&&t==r)return!0;if(t==(o<0?0:Br(e))){let i=e.parentNode;if(!i||i.nodeType!=1||Cp(e)||vJ.test(e.nodeName)||e.contentEditable=="false")return!1;t=un(e)+(o<0?0:1),e=i}else if(e.nodeType==1){if(e=e.childNodes[t+(o<0?-1:0)],e.contentEditable=="false")return!1;t=o<0?Br(e):0}else return!1}}function Br(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function yJ(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable=="false")return null;e=e.childNodes[t-1],t=Br(e)}else if(e.parentNode&&!Cp(e))t=un(e),e=e.parentNode;else return null}}function xJ(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable=="false")return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!Cp(e))t=un(e)+1,e=e.parentNode;else return null}}function bJ(e,t,n){for(let r=t==0,o=t==Br(e);r||o;){if(e==n)return!0;let i=un(e);if(e=e.parentNode,!e)return!1;r=r&&i==0,o=o&&i==Br(e)}}function Cp(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)}const wv=function(e){return e.focusNode&&al(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Oa(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function wJ(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function SJ(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Br(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Br(r.startContainer),r.startOffset)}}}const ti=typeof navigator<"u"?navigator:null,r_=typeof document<"u"?document:null,ma=ti&&ti.userAgent||"",Z0=/Edge\/(\d+)/.exec(ma),bI=/MSIE \d/.exec(ma),Q0=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ma),ir=!!(bI||Q0||Z0),$s=bI?document.documentMode:Q0?+Q0[1]:Z0?+Z0[1]:0,Lo=!ir&&/gecko\/(\d+)/i.test(ma);Lo&&+(/Firefox\/(\d+)/.exec(ma)||[0,0])[1];const eb=!ir&&/Chrome\/(\d+)/.exec(ma),Tn=!!eb,wI=eb?+eb[1]:0,Bn=!ir&&!!ti&&/Apple Computer/.test(ti.vendor),Hc=Bn&&(/Mobile\/\w+/.test(ma)||!!ti&&ti.maxTouchPoints>2),Fr=Hc||(ti?/Mac/.test(ti.platform):!1),kJ=ti?/Win/.test(ti.platform):!1,vo=/Android \d/.test(ma),Ep=!!r_&&"webkitFontSmoothing"in r_.documentElement.style,CJ=Ep?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function EJ(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 ci(e,t){return typeof e=="number"?e:e[t]}function _J(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 o_(e,t,n){let r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let s=n||e.dom;s;s=Rf(s)){if(s.nodeType!=1)continue;let a=s,l=a==i.body,c=l?EJ(i):_J(a),u=0,d=0;if(t.top<c.top+ci(r,"top")?d=-(c.top-t.top+ci(o,"top")):t.bottom>c.bottom-ci(r,"bottom")&&(d=t.bottom-t.top>c.bottom-c.top?t.top+ci(o,"top")-c.top:t.bottom-c.bottom+ci(o,"bottom")),t.left<c.left+ci(r,"left")?u=-(c.left-t.left+ci(o,"left")):t.right>c.right-ci(r,"right")&&(u=t.right-c.right+ci(o,"right")),u||d)if(l)i.defaultView.scrollBy(u,d);else{let f=a.scrollLeft,h=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let m=a.scrollLeft-f,v=a.scrollTop-h;t={left:t.left-m,top:t.top-v,right:t.right-m,bottom:t.bottom-v}}if(l||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function TJ(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,o;for(let i=(t.left+t.right)/2,s=n+1;s<Math.min(innerHeight,t.bottom);s+=5){let a=e.root.elementFromPoint(i,s);if(!a||a==e.dom||!e.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,o=l.top;break}}return{refDOM:r,refTop:o,stack:SI(e.dom)}}function SI(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Rf(r));return t}function OJ({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;kI(n,r==0?0:r-t)}function kI(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:o,left:i}=e[n];r.scrollTop!=o+t&&(r.scrollTop=o+t),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Ml=null;function NJ(e){if(e.setActive)return e.setActive();if(Ml)return e.focus(Ml);let t=SI(e);e.focus(Ml==null?{get preventScroll(){return Ml={preventScroll:!0},!0}}:void 0),Ml||(Ml=!1,kI(t,0))}function CI(e,t){let n,r=2e8,o,i=0,s=t.top,a=t.top,l,c;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=mi(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let m=f[h];if(m.top<=s&&m.bottom>=a){s=Math.max(m.bottom,s),a=Math.min(m.top,a);let v=m.left>t.left?m.left-t.left:m.right<t.left?t.left-m.right:0;if(v<r){n=u,r=v,o=v&&n.nodeType==3?{left:m.right<t.left?m.right:m.left,top:t.top}:t,u.nodeType==1&&v&&(i=d+(t.left>=(m.left+m.right)/2?1:0));continue}}else m.top>t.top&&!l&&m.left<=t.left&&m.right>=t.left&&(l=u,c={left:Math.max(m.left,Math.min(m.right,t.left)),top:m.top});!n&&(t.left>=m.right&&t.top>=m.top||t.left>=m.left&&t.top>=m.bottom)&&(i=d+1)}}return!n&&l&&(n=l,o=c,r=0),n&&n.nodeType==3?MJ(n,o):!n||r&&n.nodeType==1?{node:e,offset:i}:CI(n,o)}function MJ(e,t){let n=e.nodeValue.length,r=document.createRange();for(let o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);let i=ss(r,1);if(i.top!=i.bottom&&X1(t,i))return{node:e,offset:o+(t.left>=(i.left+i.right)/2?1:0)}}return{node:e,offset:0}}function X1(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function PJ(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function RJ(e,t,n){let{node:r,offset:o}=CI(t,n),i=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return e.docView.posFromDOM(r,o,i)}function jJ(e,t,n,r){let o=-1;for(let i=t,s=!1;i!=e.dom;){let a=e.docView.nearestDesc(i,!0);if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)){let l=a.dom.getBoundingClientRect();if(a.node.isBlock&&a.parent&&(!s&&l.left>r.left||l.top>r.top?o=a.posBefore:(!s&&l.right<r.left||l.bottom<r.top)&&(o=a.posAfter),s=!0),!a.contentDOM&&o<0&&!a.node.isText)return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter}i=a.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,-1)}function EI(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let s=e.childNodes[i];if(s.nodeType==1){let a=s.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(X1(t,c))return EI(s,t,c)}}if((i=(i+1)%r)==o)break}return e}function AJ(e,t){let n=e.dom.ownerDocument,r,o=0,i=SJ(n,t.left,t.top);i&&({node:r,offset:o}=i);let s=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),a;if(!s||!e.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=e.dom.getBoundingClientRect();if(!X1(t,c)||(s=EI(e.dom,t,c),!s))return null}if(Bn)for(let c=s;r&&c;c=Rf(c))c.draggable&&(r=void 0);if(s=PJ(s,t),r){if(Lo&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=t.left&&d.bottom>t.top&&o++}let c;Ep&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=t.top&&o--,r==e.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?a=e.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(a=jJ(e,r,o,t))}a==null&&(a=RJ(e,s,t));let l=e.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function i_(e){return e.top<e.bottom||e.left<e.right}function ss(e,t){let n=e.getClientRects();if(n.length){let r=n[t<0?0:n.length-1];if(i_(r))return r}return Array.prototype.find.call(n,i_)||e.getBoundingClientRect()}const IJ=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function _I(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=Ep||Lo;if(r.nodeType==3)if(s&&(IJ.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let l=ss(mi(r,o,o),n);if(Lo&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=ss(mi(r,o-1,o-1),-1);if(c.top==l.top){let u=ss(mi(r,o,o+1),-1);if(u.top!=l.top)return Fu(u,u.left<c.left)}}return l}else{let l=o,c=o,u=n<0?1:-1;return n<0&&!o?(c++,u=-1):n>=0&&o==r.nodeValue.length?(l--,u=1):n<0?l--:c++,Fu(ss(mi(r,l,c),u),u<0)}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(i==null&&o&&(n<0||o==Br(r))){let l=r.childNodes[o-1];if(l.nodeType==1)return Qy(l.getBoundingClientRect(),!1)}if(i==null&&o<Br(r)){let l=r.childNodes[o];if(l.nodeType==1)return Qy(l.getBoundingClientRect(),!0)}return Qy(r.getBoundingClientRect(),n>=0)}if(i==null&&o&&(n<0||o==Br(r))){let l=r.childNodes[o-1],c=l.nodeType==3?mi(l,Br(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return Fu(ss(c,1),!1)}if(i==null&&o<Br(r)){let l=r.childNodes[o];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?mi(l,0,s?0:1):l.nodeType==1?l:null:null;if(c)return Fu(ss(c,-1),!0)}return Fu(ss(r.nodeType==3?mi(r):r,-n),n>=0)}function Fu(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 Qy(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 TI(e,t,n){let r=e.state,o=e.root.activeElement;r!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),o!=e.dom&&o&&o.focus()}}function DJ(e,t,n){let r=t.selection,o=n=="up"?r.$from:r.$to;return TI(e,t,()=>{let{node:i}=e.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let a=e.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let s=_I(e,o.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=mi(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const LJ=/[\u0590-\u08ac]/;function FJ(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=e.domSelection();return a?!LJ.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:s:TI(e,t,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=e.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",n,"character");let h=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:m,focusOffset:v}=e.domSelectionRange(),x=m&&!h.contains(m.nodeType==1?m:m.parentNode)||l==m&&c==v;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return f!=null&&(a.caretBidiLevel=f),x}):r.pos==r.start()||r.pos==r.end()}let s_=null,a_=null,l_=!1;function zJ(e,t,n){return s_==t&&a_==n?l_:(s_=t,a_=n,l_=n=="up"||n=="down"?DJ(e,t,n):FJ(e,t,n))}const Kr=0,c_=1,Aa=2,ni=3;class _p{constructor(t,n,r,o){this.parent=t,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=Kr,r.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,n,r){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let n=0;n<this.children.length;n++)t+=this.children[n].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let n=0,r=this.posAtStart;;n++){let o=this.children[n];if(o==t)return r;r+=o.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(t,n,r){if(this.contentDOM&&this.contentDOM.contains(t.nodeType==1?t:t.parentNode))if(r<0){let i,s;if(t==this.contentDOM)i=t.childNodes[n-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(t==this.contentDOM)i=t.childNodes[n];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let o;if(t==this.dom&&this.contentDOM)o=n>un(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=t;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&n==t.childNodes.length)for(let i=t;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(t,n=!1){for(let r=!0,o=t;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!n||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(t.nodeType==1?t:t.parentNode):s==t))r=!1;else return i}}getDesc(t){let n=t.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(t,n,r){for(let o=t;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(t,n,r)}return-1}descAt(t){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],i=r+o.size;if(r==t&&i!=r){for(;!o.border&&o.children.length;)o=o.children[0];return o}if(t<i)return o.descAt(t-r-o.border);r=i}}domFromPos(t,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],a=i+s.size;if(a>t||s instanceof NI){o=t-i;break}i=a}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof OI&&i.side>=0;r--);if(n<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?un(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?un(i.dom):this.contentDOM.childNodes.length}}}parseRange(t,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:t,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,i=-1;for(let s=r,a=0;;a++){let l=this.children[a],c=s+l.size;if(o==-1&&t<=c){let u=s+l.border;if(t>=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(t,n,u);t=s;for(let d=a;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){o=un(f.dom)+1;break}t-=f.size}o==-1&&(o=0)}if(o>-1&&(c>n||a==this.children.length-1)){n=c;for(let u=a+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=un(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:t,to:n,fromOffset:o,toOffset:i}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[t<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(t)}domAfterPos(t){let{node:n,offset:r}=this.domFromPos(t,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+t);return n.childNodes[r]}setSelection(t,n,r,o=!1){let i=Math.min(t,n),s=Math.max(t,n);for(let f=0,h=0;f<this.children.length;f++){let m=this.children[f],v=h+m.size;if(i>h&&s<v)return m.setSelection(t-h-m.border,n-h-m.border,r,o);h=v}let a=this.domFromPos(t,t?-1:1),l=n==t?a:this.domFromPos(n,n?-1:1),c=r.getSelection(),u=!1;if((Lo||Bn)&&t==n){let{node:f,offset:h}=a;if(f.nodeType==3){if(u=!!(h&&f.nodeValue[h-1]==`
348
- `),u&&h==f.nodeValue.length)for(let m=f,v;m;m=m.parentNode){if(v=m.nextSibling){v.nodeName=="BR"&&(a=l={node:v.parentNode,offset:un(v)+1});break}let x=m.pmViewDesc;if(x&&x.node&&x.node.isBlock)break}}else{let m=f.childNodes[h-1];u=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Lo&&c.focusNode&&c.focusNode!=l.node&&c.focusNode.nodeType==1){let f=c.focusNode.childNodes[c.focusOffset];f&&f.contentEditable=="false"&&(o=!0)}if(!(o||u&&Bn)&&al(a.node,a.offset,c.anchorNode,c.anchorOffset)&&al(l.node,l.offset,c.focusNode,c.focusOffset))return;let d=!1;if((c.extend||t==n)&&!u){c.collapse(a.node,a.offset);try{t!=n&&c.extend(l.node,l.offset),d=!0}catch{}}if(!d){if(t>n){let h=a;a=l,l=h}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(f)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,n){for(let r=0,o=0;o<this.children.length;o++){let i=this.children[o],s=r+i.size;if(r==s?t<=s&&n>=r:t<s&&n>r){let a=r+i.border,l=s-i.border;if(t>=a&&n<=l){this.dirty=t==r||n==s?Aa:c_,t==a&&n==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=ni:i.markDirty(t-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Aa:ni}r=s}this.dirty=Aa}markParentsDirty(){let t=1;for(let n=this.parent;n;n=n.parent,t++){let r=t==1?Aa:c_;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(t){return!1}}class OI extends _p{constructor(t,n,r,o){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(t,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(t){return this.dirty==Kr&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let n=this.widget.spec.stopEvent;return n?n(t):!1}ignoreMutation(t){return t.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class $J extends _p{constructor(t,n,r,o){super(t,[],n,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(t,n){return t!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}}class ll extends _p{constructor(t,n,r,o,i){super(t,[],r,o),this.mark=n,this.spec=i}static create(t,n,r,o){let i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return(!s||!s.dom)&&(s=ha.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ll(t,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&ni||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=ni&&this.mark.eq(t)}markDirty(t,n){if(super.markDirty(t,n),this.dirty!=Kr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Kr}}slice(t,n,r){let o=ll.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=nb(i,n,s,r)),t>0&&(i=nb(i,0,t,r));for(let a=0;a<i.length;a++)i[a].parent=o;return o.children=i,o}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Bs extends _p{constructor(t,n,r,o,i,s,a,l,c){super(t,[],i,s),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=a}static create(t,n,r,o,i,s){let a=i.nodeViews[n.type.name],l,c=a&&a(n,i,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,o),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=ha.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=RI(u,r,n),c?l=new BJ(t,n,r,o,u,d||null,f,c,i,s+1):n.isText?new Sv(t,n,r,o,u,f,i):new Bs(t,n,r,o,u,d||null,f,i,s+1)}parseRule(){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 n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){t.contentElement=r.dom.parentNode;break}}t.contentElement||(t.getContent=()=>D.empty)}return t}matchesNode(t,n,r){return this.dirty==Kr&&t.eq(this.node)&&ng(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,n){let r=this.node.inlineContent,o=n,i=t.composing?this.localCompositionInfo(t,n):null,s=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new UJ(this,s&&s.node,t);KJ(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,t):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?He.none:this.node.child(u).marks,r,t),l.placeWidget(c,t,o)},(c,u,d,f)=>{l.syncToMarks(c.marks,r,t);let h;l.findNodeMatch(c,u,d,f)||a&&t.state.selection.from>o&&t.state.selection.to<o+c.nodeSize&&(h=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(c,u,d,h,t)||l.updateNextNode(c,u,d,t,f,o)||l.addNode(c,u,d,t,o),o+=c.nodeSize}),l.syncToMarks([],r,t),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Aa)&&(s&&this.protectLocalComposition(t,s),MI(this.contentDOM,this.children,t),Hc&&qJ(this.dom))}localCompositionInfo(t,n){let{from:r,to:o}=t.state.selection;if(!(t.state.selection instanceof Oe)||r<n||o>n+this.node.content.size)return null;let i=t.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,a=GJ(this.node.content,s,r-n,o-n);return a<0?null:{node:i,pos:a,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(t,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new $J(this,i,n,o);t.input.compositionNodes.push(s),this.children=nb(this.children,r,r+o.length,t,s)}update(t,n,r,o){return this.dirty==ni||!t.sameMarkup(this.node)?!1:(this.updateInner(t,n,r,o),!0)}updateInner(t,n,r,o){this.updateOuterDeco(n),this.node=t,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=Kr}updateOuterDeco(t){if(ng(t,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=PI(this.dom,this.nodeDOM,tb(this.outerDeco,this.node,n),tb(t,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function u_(e,t,n,r,o){RI(r,t,e);let i=new Bs(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class Sv extends Bs{constructor(t,n,r,o,i,s,a){super(t,n,r,o,i,null,s,a,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,n,r,o){return this.dirty==ni||this.dirty!=Kr&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Kr||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=t.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=t,this.dirty=Kr,!0)}inParent(){let t=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,n,r){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(t,n,r)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,n,r){let o=this.node.cut(t,n),i=document.createTextNode(o.text);return new Sv(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}markDirty(t,n){super.markDirty(t,n),this.dom!=this.nodeDOM&&(t==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=ni)}get domAtom(){return!1}isText(t){return this.node.text==t}}class NI extends _p{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==Kr&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class BJ extends Bs{constructor(t,n,r,o,i,s,a,l,c,u){super(t,n,r,o,i,s,a,c,u),this.spec=l}update(t,n,r,o){if(this.dirty==ni)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let i=this.spec.update(t,n,r);return i&&this.updateInner(t,n,r,o),i}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,n,r,o){this.spec.setSelection?this.spec.setSelection(t,n,r):super.setSelection(t,n,r,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):!1}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function MI(e,t,n){let r=e.firstChild,o=!1;for(let i=0;i<t.length;i++){let s=t[i],a=s.dom;if(a.parentNode==e){for(;a!=r;)r=d_(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(a,r);if(s instanceof ll){let l=r?r.previousSibling:e.lastChild;MI(s.contentDOM,s.children,n),r=l?l.nextSibling:e.firstChild}}for(;r;)r=d_(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const Dd=function(e){e&&(this.nodeName=e)};Dd.prototype=Object.create(null);const Ia=[new Dd];function tb(e,t,n){if(e.length==0)return Ia;let r=n?Ia[0]:new Dd,o=[r];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&o.push(r=new Dd(s.nodeName));for(let a in s){let l=s[a];l!=null&&(n&&o.length==1&&o.push(r=new Dd(t.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return o}function PI(e,t,n,r){if(n==Ia&&r==Ia)return t;let o=t;for(let i=0;i<r.length;i++){let s=r[i],a=n[i];if(i){let l;a&&a.nodeName==s.nodeName&&o!=e&&(l=o.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(o),a=Ia[0]),o=l}VJ(o,a||Ia[0],s)}return o}function VJ(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):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&e.classList.remove(r[i]);for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&e.classList.add(o[i]);e.classList.length==0&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(t.style);)e.style.removeProperty(o[1])}n.style&&(e.style.cssText+=n.style)}}function RI(e,t,n){return PI(e,e,Ia,tb(t,n,e.nodeType!=1))}function ng(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 d_(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class UJ{constructor(t,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=WJ(t.node.content,t)}destroyBetween(t,n){if(t!=n){for(let r=t;r<n;r++)this.top.children[r].destroy();this.top.children.splice(t,n-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,n,r){let o=0,i=this.stack.length>>1,s=Math.min(i,t.length);for(;o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(t[o])&&t[o].type.spec.spanning!==!1;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=Kr,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<t.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let c=this.top.children[l];if(c.matchesMark(t[i])&&!this.isLocked(c.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=ll.create(this.top,t[i],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}}findNodeMatch(t,n,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(t,n,r))i=this.top.children.indexOf(s,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(t,n,r)&&!this.preMatch.matched.has(c)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(t,n,r,o,i){let s=this.top.children[o];return s.dirty==ni&&s.dom==s.contentDOM&&(s.dirty=Aa),s.update(t,n,r,i)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(t){for(;;){let n=t.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=t.pmViewDesc;if(r){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}t=n}}updateNextNode(t,n,r,o,i,s){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Bs){let c=this.preMatch.matched.get(l);if(c!=null&&c!=i)return!1;let u=l.dom,d,f=this.isLocked(u)&&!(t.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==t.text&&l.dirty!=ni&&ng(n,l.outerDeco));if(!f&&l.update(t,n,r,o))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(l,t,n,r,o,s)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=Aa,d.updateChildren(o,s+1),d.dirty=Kr),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,n,r,o,i,s){if(t.dirty||n.isAtom||!t.children.length||!t.node.content.eq(n.content)||!ng(r,t.outerDeco)||!o.eq(t.innerDeco))return null;let a=Bs.create(this.top,n,r,o,i,s);if(a.contentDOM){a.children=t.children,t.children=[];for(let l of a.children)l.parent=a}return t.destroy(),a}addNode(t,n,r,o,i){let s=Bs.create(this.top,t,n,r,o,i);s.contentDOM&&s.updateChildren(o,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(t,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(t)&&(t==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let i=new OI(this.top,t,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let t=this.top.children[this.index-1],n=this.top;for(;t instanceof ll;)n=t,t=n.children[n.children.length-1];(!t||!(t instanceof Sv)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((Bn||Tn)&&t&&t.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(t,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(t))this.index++;else{let r=document.createElement(t);t=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),t=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new NI(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0}}isLocked(t){return this.lock&&(t==this.lock||t.nodeType==1&&t.contains(this.lock.parentNode))}}function WJ(e,t){let n=t,r=n.children.length,o=e.childCount,i=new Map,s=[];e:for(;o>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof ll)n=c,r=c.children.length;else{a=c,r--;break}}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=e.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}function HJ(e,t){return e.type.side-t.type.side}function KJ(e,t,n,r){let o=t.locals(e),i=0;if(o.length==0){for(let c=0;c<e.childCount;c++){let u=e.child(c);r(u,o,t.forChild(i,u),c),i+=u.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let u,d;for(;s<o.length&&o[s].to==i;){let x=o[s++];x.widget&&(u?(d||(d=[u])).push(x):u=x)}if(u)if(d){d.sort(HJ);for(let x=0;x<d.length;x++)n(d[x],c,!!l)}else n(u,c,!!l);let f,h;if(l)h=-1,f=l,l=null;else if(c<e.childCount)h=c,f=e.child(c++);else break;for(let x=0;x<a.length;x++)a[x].to<=i&&a.splice(x--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);let m=i+f.nodeSize;if(f.isText){let x=m;s<o.length&&o[s].from<x&&(x=o[s].from);for(let b=0;b<a.length;b++)a[b].to<x&&(x=a[b].to);x<m&&(l=f.cut(x-i),f=f.cut(0,x-i),m=x,h=-1)}else for(;s<o.length&&o[s].to<m;)s++;let v=f.isInline&&!f.isLeaf?a.filter(x=>!x.inline):a.slice();r(f,v,t.forChild(i,f),h),i=m}}function qJ(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 GJ(e,t,n,r){for(let o=0,i=0;o<e.childCount&&i<=r;){let s=e.child(o++),a=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;o<e.childCount;){let c=e.child(o++);if(i+=c.nodeSize,!c.isText)break;l+=c.text}if(i>=n){if(i>=r&&l.slice(r-t.length-a,r-a)==t)return r-t.length;let c=a<r?l.lastIndexOf(t,r-a-1):-1;if(c>=0&&c+t.length+a>=n)return a+c;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return-1}function nb(e,t,n,r,o){let i=[];for(let s=0,a=0;s<e.length;s++){let l=e[s],c=a,u=a+=l.size;c>=n||u<=t?i.push(l):(c<t&&i.push(l.slice(0,t-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function Z1(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let o=e.docView.nearestDesc(n.focusNode),i=o&&o.size==0,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,c;if(wv(n)){for(l=s;o&&!o.node;)o=o.parent;let d=o.node;if(o&&d.isAtom&&we.isSelectable(d)&&o.parent&&!(d.isInline&&bJ(n.focusNode,n.focusOffset,o.dom))){let f=o.posBefore;c=new we(s==f?a:r.resolve(f))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,f=s;for(let h=0;h<n.rangeCount;h++){let m=n.getRangeAt(h);d=Math.min(d,e.docView.posFromDOM(m.startContainer,m.startOffset,1)),f=Math.max(f,e.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(d<0)return null;[l,s]=f==e.state.selection.anchor?[f,d]:[d,f],a=r.resolve(s)}else l=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let d=t=="pointer"||e.state.selection.head<a.pos&&!i?1:-1;c=Q1(e,u,a,d)}return c}function jI(e){return e.editable?e.hasFocus():II(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Ti(e,t=!1){let n=e.state.selection;if(AI(e,n),!!jI(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&Tn){let r=e.domSelectionRange(),o=e.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&al(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)JJ(e);else{let{anchor:r,head:o}=n,i,s;f_&&!(n instanceof Oe)&&(n.$from.parent.inlineContent||(i=p_(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=p_(e,n.to))),e.docView.setSelection(r,o,e.root,t),f_&&(i&&h_(i),s&&h_(s)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&YJ(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const f_=Bn||Tn&&wI<63;function p_(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(Bn&&o&&o.contentEditable=="false")return ex(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return ex(o);if(i)return ex(i)}}function ex(e){return e.contentEditable="true",Bn&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function h_(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function YJ(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!jI(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function JJ(e){let t=e.domSelection(),n=document.createRange();if(!t)return;let r=e.cursorWrapper.dom,o=r.nodeName=="IMG";o?n.setStart(r.parentNode,un(r)+1):n.setStart(r,0),n.collapse(!0),t.removeAllRanges(),t.addRange(n),!o&&!e.state.selection.visible&&ir&&$s<=11&&(r.disabled=!0,r.disabled=!1)}function AI(e,t){if(t instanceof we){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(m_(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else m_(e)}function m_(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Q1(e,t,n,r){return e.someProp("createSelectionBetween",o=>o(e,t,n))||Oe.between(t,n,r)}function g_(e){return e.editable&&!e.hasFocus()?!1:II(e)}function II(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function XJ(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return al(t.node,t.offset,n.anchorNode,n.anchorOffset)}function rb(e,t){let{$anchor:n,$head:r}=e.selection,o=t>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return i&&Le.findFrom(i,t)}function ps(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function v_(e,t,n){let r=e.state.selection;if(r instanceof Oe)if(n.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=e.state.doc.resolve(o.pos+i.nodeSize*(t<0?-1:1));return ps(e,new Oe(r.$anchor,s))}else if(r.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let o=rb(e.state,t);return o&&o instanceof we?ps(e,o):!1}else if(!(Fr&&n.indexOf("m")>-1)){let o=r.$head,i=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let a=t<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=e.docView.descAt(a))&&!s.contentDOM?we.isSelectable(i)?ps(e,new we(t<0?e.state.doc.resolve(o.pos-i.nodeSize):o)):Ep?ps(e,new Oe(e.state.doc.resolve(t<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof we&&r.node.isInline)return ps(e,new Oe(t>0?r.$to:r.$from));{let o=rb(e.state,t);return o?ps(e,o):!1}}}function rg(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Ld(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function Pl(e,t){return t<0?ZJ(e):QJ(e)}function ZJ(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=!1;for(Lo&&n.nodeType==1&&r<rg(n)&&Ld(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Ld(a,-1))o=n,i=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(DI(n))break;{let a=n.previousSibling;for(;a&&Ld(a,-1);)o=n.parentNode,i=un(a),a=a.previousSibling;if(a)n=a,r=rg(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}s?ob(e,n,r):o&&ob(e,o,i)}function QJ(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o=rg(n),i,s;for(;;)if(r<o){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Ld(a,1))i=n,s=++r;else break}else{if(DI(n))break;{let a=n.nextSibling;for(;a&&Ld(a,1);)i=a.parentNode,s=un(a)+1,a=a.nextSibling;if(a)n=a,r=0,o=rg(n);else{if(n=n.parentNode,n==e.dom)break;r=o=0}}}i&&ob(e,i,s)}function DI(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function eX(e,t){for(;e&&t==e.childNodes.length&&!Cp(e);)t=un(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;e=n,t=0}}function tX(e,t){for(;e&&!t&&!Cp(e);)t=un(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;e=n,t=e.childNodes.length}}function ob(e,t,n){if(t.nodeType!=3){let i,s;(s=eX(t,n))?(t=s,n=0):(i=tX(t,n))&&(t=i,n=i.nodeValue.length)}let r=e.domSelection();if(!r)return;if(wv(r)){let i=document.createRange();i.setEnd(t,n),i.setStart(t,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:o}=e;setTimeout(()=>{e.state==o&&Ti(e)},50)}function y_(e,t){let n=e.state.doc.resolve(t);if(!(Tn||kJ)&&n.parent.inlineContent){let o=e.coordsAtPos(t);if(t>n.start()){let i=e.coordsAtPos(t-1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left<o.left?"ltr":"rtl"}if(t<n.end()){let i=e.coordsAtPos(t+1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left>o.left?"ltr":"rtl"}}return getComputedStyle(e.dom).direction=="rtl"?"rtl":"ltr"}function x_(e,t,n){let r=e.state.selection;if(r instanceof Oe&&!r.empty||n.indexOf("s")>-1||Fr&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let s=rb(e.state,t);if(s&&s instanceof we)return ps(e,s)}if(!o.parent.inlineContent){let s=t<0?o:i,a=r instanceof zn?Le.near(s,t):Le.findFrom(s,t);return a?ps(e,a):!1}return!1}function b_(e,t){if(!(e.state.selection instanceof Oe))return!0;let{$head:n,$anchor:r,empty:o}=e.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let i=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=e.state.tr;return t<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),e.dispatch(s),!0}return!1}function w_(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function nX(e){if(!Bn||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let r=t.firstChild;w_(e,r,"true"),setTimeout(()=>w_(e,r,"false"),20)}return!1}function rX(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function oX(e,t){let n=t.keyCode,r=rX(t);if(n==8||Fr&&n==72&&r=="c")return b_(e,-1)||Pl(e,-1);if(n==46&&!t.shiftKey||Fr&&n==68&&r=="c")return b_(e,1)||Pl(e,1);if(n==13||n==27)return!0;if(n==37||Fr&&n==66&&r=="c"){let o=n==37?y_(e,e.state.selection.from)=="ltr"?-1:1:-1;return v_(e,o,r)||Pl(e,o)}else if(n==39||Fr&&n==70&&r=="c"){let o=n==39?y_(e,e.state.selection.from)=="ltr"?1:-1:1;return v_(e,o,r)||Pl(e,o)}else{if(n==38||Fr&&n==80&&r=="c")return x_(e,-1,r)||Pl(e,-1);if(n==40||Fr&&n==78&&r=="c")return nX(e)||x_(e,1,r)||Pl(e,1);if(r==(Fr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function LI(e,t){e.someProp("transformCopied",h=>{t=h(t,e)});let n=[],{content:r,openStart:o,openEnd:i}=t;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let s=e.someProp("clipboardSerializer")||ha.fromSchema(e.state.schema),a=UI(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=VI[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let m=a.createElement(u[h]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=e.someProp("clipboardTextSerializer",h=>h(t,e))||t.content.textBetween(0,t.content.size,`
349
-
350
- `);return{dom:l,text:f,slice:t}}function FI(e,t,n,r,o){let i=o.parent.type.spec.code,s,a;if(!n&&!t)return null;let l=t&&(r||i||!n);if(l){if(e.someProp("transformPastedText",f=>{t=f(t,i||r,e)}),i)return t?new X(D.from(e.state.schema.text(t.replace(/\r\n?/g,`
351
- `))),0,0):X.empty;let d=e.someProp("clipboardTextParser",f=>f(t,o,r,e));if(d)a=d;else{let f=o.marks(),{schema:h}=e.state,m=ha.fromSchema(h);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(v=>{let x=s.appendChild(document.createElement("p"));v&&x.appendChild(m.serializeNode(h.text(v,f)))})}}else e.someProp("transformPastedHTML",d=>{n=d(n,e)}),s=lX(n),Ep&&cX(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(a||(a=(e.someProp("clipboardParser")||e.someProp("domParser")||Vc.fromSchema(e.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||u),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!iX.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=uX(S_(a,+u[1],+u[2]),u[4]);else if(a=X.maxOpen(sX(a.content,o),!0),a.openStart||a.openEnd){let d=0,f=0;for(let h=a.content.firstChild;d<a.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=a.content.lastChild;f<a.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);a=S_(a,d,f)}return e.someProp("transformPasted",d=>{a=d(a,e)}),a}const iX=/^(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 sX(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let o=t.node(n).contentMatchAt(t.index(n)),i,s=[];if(e.forEach(a=>{if(!s)return;let l=o.findWrapping(a.type),c;if(!l)return s=null;if(c=s.length&&i.length&&$I(l,i,a,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=BI(s[s.length-1],i.length));let u=zI(a,l);s.push(u),o=o.matchType(u.type),i=l}}),s)return D.from(s)}return e}function zI(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,D.from(e));return e}function $I(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){let i=$I(e,t,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==e.length-1?n.type:e[o+1]))return r.copy(r.content.append(D.from(zI(n,e,o+1))))}}function BI(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,BI(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(D.empty,!0);return e.copy(n.append(r))}function ib(e,t,n,r,o,i){let s=t<0?e.firstChild:e.lastChild,a=s.content;return e.childCount>1&&(i=0),o<r-1&&(a=ib(a,t,n,r,o+1,i)),o>=n&&(a=t<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(D.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function S_(e,t,n){return t<e.openStart&&(e=new X(ib(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new X(ib(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const VI={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let k_=null;function UI(){return k_||(k_=document.implementation.createHTMLDocument("title"))}let tx=null;function aX(e){let t=window.trustedTypes;return t?(tx||(tx=t.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),tx.createHTML(e)):e}function lX(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=UI().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(e),o;if((o=r&&VI[r[1].toLowerCase()])&&(e=o.map(i=>"<"+i+">").join("")+e+o.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=aX(e),o)for(let i=0;i<o.length;i++)n=n.querySelector(o[i])||n;return n}function cX(e){let t=e.querySelectorAll(Tn?"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==" "&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}function uX(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:o,openStart:i,openEnd:s}=e;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;o=D.from(l.create(r[a+1],o)),i++,s++}return new X(o,i,s)}const Vn={},Un={},dX={touchstart:!0,touchmove:!0};class fX{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function pX(e){for(let t in Vn){let n=Vn[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=r=>{mX(e,r)&&!eS(e,r)&&(e.editable||!(r.type in Un))&&n(e,r)},dX[t]?{passive:!0}:void 0)}Bn&&e.dom.addEventListener("input",()=>null),sb(e)}function Ts(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function hX(e){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 sb(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=r=>eS(e,r))})}function eS(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function mX(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 gX(e,t){!eS(e,t)&&Vn[t.type]&&(e.editable||!(t.type in Un))&&Vn[t.type](e,t)}Un.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!HI(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(vo&&Tn&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),Hc&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();e.input.lastIOSEnter=r,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==r&&(e.someProp("handleKeyDown",o=>o(e,Oa(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",r=>r(e,n))||oX(e,n)?n.preventDefault():Ts(e,"key")};Un.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};Un.keypress=(e,t)=>{let n=t;if(HI(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||Fr&&n.metaKey)return;if(e.someProp("handleKeyPress",o=>o(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof Oe)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode);!/[\r\n]/.test(o)&&!e.someProp("handleTextInput",i=>i(e,r.$from.pos,r.$to.pos,o))&&e.dispatch(e.state.tr.insertText(o).scrollIntoView()),n.preventDefault()}};function kv(e){return{left:e.clientX,top:e.clientY}}function vX(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function tS(e,t,n,r,o){if(r==-1)return!1;let i=e.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(e.someProp(t,a=>s>i.depth?a(e,n,i.nodeAfter,i.before(s),o,!0):a(e,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function vc(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 yX(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&we.isSelectable(r)?(vc(e,new we(n)),!0):!1}function xX(e,t){if(t==-1)return!1;let n=e.state.selection,r,o;n instanceof we&&(r=n.node);let i=e.state.doc.resolve(t);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s);if(we.isSelectable(a)){r&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?o=i.before(n.$from.depth):o=i.before(s);break}}return o!=null?(vc(e,we.create(e.state.doc,o)),!0):!1}function bX(e,t,n,r,o){return tS(e,"handleClickOn",t,n,r)||e.someProp("handleClick",i=>i(e,t,r))||(o?xX(e,n):yX(e,n))}function wX(e,t,n,r){return tS(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",o=>o(e,t,r))}function SX(e,t,n,r){return tS(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",o=>o(e,t,r))||kX(e,n,r)}function kX(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(vc(e,Oe.create(r,0,r.content.size)),!0):!1;let o=r.resolve(t);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),a=o.before(i);if(s.inlineContent)vc(e,Oe.create(r,a+1,a+1+s.content.size));else if(we.isSelectable(s))vc(e,we.create(r,a));else continue;return!0}}function nS(e){return og(e)}const WI=Fr?"metaKey":"ctrlKey";Vn.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=nS(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&vX(n,e.input.lastClick)&&!n[WI]&&(e.input.lastClick.type=="singleClick"?i="doubleClick":e.input.lastClick.type=="doubleClick"&&(i="tripleClick")),e.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i};let s=e.posAtCoords(kv(n));s&&(i=="singleClick"?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new CX(e,s,n,!!r)):(i=="doubleClick"?wX:SX)(e,s.pos,s.inside,n)?n.preventDefault():Ts(e,"pointer"))};class CX{constructor(t,n,r,o){this.view=t,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!r[WI],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=t.state.doc.nodeAt(n.inside),s=n.inside;else{let u=t.state.doc.resolve(n.pos);i=u.parent,s=u.depth?u.before():0}const a=o?null:r.target,l=a?t.docView.nearestDesc(a,!0):null;this.target=l&&l.dom.nodeType==1?l.dom:null;let{selection:c}=t.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof we&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Lo&&!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()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Ts(t,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Ti(this.view)),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(kv(t))),this.updateAllowDefault(t),this.allowDefault||!n?Ts(this.view,"pointer"):bX(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||Bn&&this.mightDrag&&!this.mightDrag.node.isAtom||Tn&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(vc(this.view,Le.near(this.view.state.doc.resolve(n.pos))),t.preventDefault()):Ts(this.view,"pointer")}move(t){this.updateAllowDefault(t),Ts(this.view,"pointer"),t.buttons==0&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}Vn.touchstart=e=>{e.input.lastTouch=Date.now(),nS(e),Ts(e,"pointer")};Vn.touchmove=e=>{e.input.lastTouch=Date.now(),Ts(e,"pointer")};Vn.contextmenu=e=>nS(e);function HI(e,t){return e.composing?!0:Bn&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const EX=vo?5e3:-1;Un.compositionstart=Un.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Oe&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))e.markCursor=e.state.storedMarks||n.marks(),og(e,!0),e.markCursor=null;else if(og(e,!t.selection.empty),Lo&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=e.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){let a=e.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else o=s,i=-1}}e.input.composing=!0}KI(e,EX)};Un.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,KI(e,20))};function KI(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>og(e),t))}function qI(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=TX());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function _X(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=yJ(t.focusNode,t.focusOffset),r=xJ(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function TX(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function og(e,t=!1){if(!(vo&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),qI(e),t||e.docView&&e.docView.dirty){let n=Z1(e);return n&&!n.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!e.state.selection.empty?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function OX(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(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}const jf=ir&&$s<15||Hc&&CJ<604;Vn.copy=Un.cut=(e,t)=>{let n=t,r=e.state.selection,o=n.type=="cut";if(r.empty)return;let i=jf?null:n.clipboardData,s=r.content(),{dom:a,text:l}=LI(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):OX(e,a),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function NX(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function MX(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 o=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Af(e,r.value,null,o,t):Af(e,r.textContent,r.innerHTML,o,t)},50)}function Af(e,t,n,r,o){let i=FI(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",l=>l(e,o,i||X.empty)))return!0;if(!i)return!1;let s=NX(i),a=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function GI(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," "):""}Un.paste=(e,t)=>{let n=t;if(e.composing&&!vo)return;let r=jf?null:n.clipboardData,o=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&Af(e,GI(r),r.getData("text/html"),o,n)?n.preventDefault():MX(e,n)};class YI{constructor(t,n,r){this.slice=t,this.move=n,this.node=r}}const JI=Fr?"altKey":"ctrlKey";Vn.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=e.state.selection,i=o.empty?null:e.posAtCoords(kv(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof we?o.to-1:o.to))){if(r&&r.mightDrag)s=we.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=e.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=e.docView&&(s=we.create(e.state.doc,d.posBefore))}}let a=(s||e.state.selection).content(),{dom:l,text:c,slice:u}=LI(e,a);(!n.dataTransfer.files.length||!Tn||wI>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(jf?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",jf||n.dataTransfer.setData("text/plain",c),e.dragging=new YI(u,!n[JI],s)};Vn.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};Un.dragover=Un.dragenter=(e,t)=>t.preventDefault();Un.drop=(e,t)=>{let n=t,r=e.dragging;if(e.dragging=null,!n.dataTransfer)return;let o=e.posAtCoords(kv(n));if(!o)return;let i=e.state.doc.resolve(o.pos),s=r&&r.slice;s?e.someProp("transformPasted",m=>{s=m(s,e)}):s=FI(e,GI(n.dataTransfer),jf?null:n.dataTransfer.getData("text/html"),!1,i);let a=!!(r&&!n[JI]);if(e.someProp("handleDrop",m=>m(e,n,s||X.empty,a))){n.preventDefault();return}if(!s)return;n.preventDefault();let l=s?cI(e.state.doc,i.pos,s):i.pos;l==null&&(l=i.pos);let c=e.state.tr;if(a){let{node:m}=r;m?m.replace(c):c.deleteSelection()}let u=c.mapping.map(l),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,f=c.doc;if(d?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(f))return;let h=c.doc.resolve(u);if(d&&we.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new we(h));else{let m=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((v,x,b,w)=>m=w),c.setSelection(Q1(e,h,c.doc.resolve(m)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))};Vn.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())&&Ti(e)},20))};Vn.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(),e.focused=!1)};Vn.beforeinput=(e,t)=>{if(Tn&&vo&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:r}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=r||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",i=>i(e,Oa(8,"Backspace")))))return;let{$cursor:o}=e.state.selection;o&&o.pos>0&&e.dispatch(e.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let e in Un)Vn[e]=Un[e];function If(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}class ig{constructor(t,n){this.toDOM=t,this.spec=n||Ua,this.side=this.spec.side||0}map(t,n,r,o){let{pos:i,deleted:s}=t.mapResult(n.from+o,this.side<0?-1:1);return s?null:new dt(i-r,i-r,this)}valid(){return!0}eq(t){return this==t||t instanceof ig&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&If(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class Vs{constructor(t,n){this.attrs=t,this.spec=n||Ua}map(t,n,r,o){let i=t.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,s=t.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new dt(i,s,this)}valid(t,n){return n.from<n.to}eq(t){return this==t||t instanceof Vs&&If(this.attrs,t.attrs)&&If(this.spec,t.spec)}static is(t){return t.type instanceof Vs}destroy(){}}class rS{constructor(t,n){this.attrs=t,this.spec=n||Ua}map(t,n,r,o){let i=t.mapResult(n.from+o,1);if(i.deleted)return null;let s=t.mapResult(n.to+o,-1);return s.deleted||s.pos<=i.pos?null:new dt(i.pos-r,s.pos-r,this)}valid(t,n){let{index:r,offset:o}=t.content.findIndex(n.from),i;return o==n.from&&!(i=t.child(r)).isText&&o+i.nodeSize==n.to}eq(t){return this==t||t instanceof rS&&If(this.attrs,t.attrs)&&If(this.spec,t.spec)}destroy(){}}class dt{constructor(t,n,r){this.from=t,this.to=n,this.type=r}copy(t,n){return new dt(t,n,this.type)}eq(t,n=0){return this.type.eq(t.type)&&this.from+n==t.from&&this.to+n==t.to}map(t,n,r){return this.type.map(t,this,n,r)}static widget(t,n,r){return new dt(t,t,new ig(n,r))}static inline(t,n,r,o){return new dt(t,n,new Vs(r,o))}static node(t,n,r,o){return new dt(t,n,new rS(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof Vs}get widget(){return this.type instanceof ig}}const Fl=[],Ua={};class Ye{constructor(t,n){this.local=t.length?t:Fl,this.children=n.length?n:Fl}static create(t,n){return n.length?sg(n,t,0,Ua):Cn}find(t,n,r){let o=[];return this.findInner(t??0,n??1e9,o,0,r),o}findInner(t,n,r,o,i){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=n&&a.to>=t&&(!i||i(a.spec))&&r.push(a.copy(a.from+o,a.to+o))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>t){let a=this.children[s]+1;this.children[s+2].findInner(t-a,n-a,r,o+a,i)}}map(t,n,r){return this==Cn||t.maps.length==0?this:this.mapInner(t,n,0,0,r||Ua)}mapInner(t,n,r,o,i){let s;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(t,r,o);l&&l.type.valid(n,l)?(s||(s=[])).push(l):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?PX(this.children,s||[],t,n,r,o,i):s?new Ye(s.sort(Wa),Fl):Cn}add(t,n){return n.length?this==Cn?Ye.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let o,i=0;t.forEach((a,l)=>{let c=l+r,u;if(u=ZI(n,a,c)){for(o||(o=this.children.slice());i<o.length&&o[i]<l;)i+=3;o[i]==l?o[i+2]=o[i+2].addInner(a,u,c+1):o.splice(i,0,l,l+a.nodeSize,sg(u,a,c+1,Ua)),i+=3}});let s=XI(i?QI(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(t,s[a])||s.splice(a--,1);return new Ye(s.length?this.local.concat(s).sort(Wa):this.local,o||this.children)}remove(t){return t.length==0||this==Cn?this:this.removeInner(t,0)}removeInner(t,n){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,a=r[i]+n,l=r[i+1]+n;for(let u=0,d;u<t.length;u++)(d=t[u])&&d.from>a&&d.to<l&&(t[u]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(s,a+1);c!=Cn?r[i+2]=c:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<t.length;i++)if(s=t[i])for(let a=0;a<o.length;a++)o[a].eq(s,n)&&(o==this.local&&(o=this.local.slice()),o.splice(a--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new Ye(o,r):Cn}forChild(t,n){if(this==Cn)return this;if(n.isLeaf)return Ye.empty;let r,o;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=t){this.children[a]==t&&(r=this.children[a+2]);break}let i=t+1,s=i+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<s&&l.to>i&&l.type instanceof Vs){let c=Math.max(i,l.from)-i,u=Math.min(s,l.to)-i;c<u&&(o||(o=[])).push(l.copy(c,u))}}if(o){let a=new Ye(o.sort(Wa),Fl);return r?new ys([a,r]):a}return r||Cn}eq(t){if(this==t)return!0;if(!(t instanceof Ye)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(t.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=t.children[n]||this.children[n+1]!=t.children[n+1]||!this.children[n+2].eq(t.children[n+2]))return!1;return!0}locals(t){return oS(this.localsInner(t))}localsInner(t){if(this==Cn)return Fl;if(t.inlineContent||!this.local.some(Vs.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Vs||n.push(this.local[r]);return n}forEachSet(t){t(this)}}Ye.empty=new Ye([],[]);Ye.removeOverlap=oS;const Cn=Ye.empty;class ys{constructor(t){this.members=t}map(t,n){const r=this.members.map(o=>o.map(t,n,Ua));return ys.from(r)}forChild(t,n){if(n.isLeaf)return Ye.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(t,n);i!=Cn&&(i instanceof ys?r=r.concat(i.members):r.push(i))}return ys.from(r)}eq(t){if(!(t instanceof ys)||t.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(t.members[n]))return!1;return!0}locals(t){let n,r=!0;for(let o=0;o<this.members.length;o++){let i=this.members[o].localsInner(t);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?oS(r?n:n.sort(Wa)):Fl}static from(t){switch(t.length){case 0:return Cn;case 1:return t[0];default:return new ys(t.every(n=>n instanceof Ye)?t:t.reduce((n,r)=>n.concat(r instanceof Ye?r:r.members),[]))}}forEachSet(t){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(t)}}function PX(e,t,n,r,o,i,s){let a=e.slice();for(let c=0,u=i;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,h,m,v)=>{let x=v-m-(h-f);for(let b=0;b<a.length;b+=3){let w=a[b+1];if(w<0||f>w+u-d)continue;let S=a[b]+u-d;h>=S?a[b+1]=f<=S?-2:-1:f>=u&&x&&(a[b]+=x,a[b+1]+=x)}d+=x}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=n.map(e[c]+i),d=u-o;if(d<0||d>=r.content.size){l=!0;continue}let f=n.map(e[c+1]+i,-1),h=f-o,{index:m,offset:v}=r.content.findIndex(d),x=r.maybeChild(m);if(x&&v==d&&v+x.nodeSize==h){let b=a[c+2].mapInner(n,x,u+1,e[c]+i+1,s);b!=Cn?(a[c]=d,a[c+1]=h,a[c+2]=b):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=RX(a,e,t,n,o,i,s),u=sg(c,r,0,s);t=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<a.length&&a[f]<h;)f+=3;a.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new Ye(t.sort(Wa),a)}function XI(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let o=e[r];n.push(new dt(o.from+t,o.to+t,o.type))}return n}function RX(e,t,n,r,o,i,s){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,o,c);d?n.push(d):s.onRemove&&s.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<e.length;l+=3)e[l+1]==-1&&a(e[l+2],t[l]+i+1);return n}function ZI(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,o=null;for(let i=0,s;i<e.length;i++)(s=e[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),e[i]=null);return o}function QI(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function sg(e,t,n,r){let o=[],i=!1;t.forEach((a,l)=>{let c=ZI(e,a,l+n);if(c){i=!0;let u=sg(c,a,n+l+1,r);u!=Cn&&o.push(l,l+a.nodeSize,u)}});let s=XI(i?QI(e):e,-n).sort(Wa);for(let a=0;a<s.length;a++)s[a].type.valid(t,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new Ye(s,o):Cn}function Wa(e,t){return e.from-t.from||e.to-t.to}function oS(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let o=n+1;o<t.length;o++){let i=t[o];if(i.from==r.from){i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),C_(t,o+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),C_(t,o,r.copy(i.from,r.to)));break}}}return t}function C_(e,t,n){for(;t<e.length&&Wa(n,e[t])>0;)t++;e.splice(t,0,n)}function nx(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=Cn&&t.push(r)}),e.cursorWrapper&&t.push(Ye.create(e.state.doc,[e.cursorWrapper.deco])),ys.from(t)}const jX={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},AX=ir&&$s<=11;class IX{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class DX{constructor(t,n){this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new IX,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);ir&&$s<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),AX&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,jX)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let n=0;n<t.length;n++)this.queue.push(t[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(g_(this.view)){if(this.suppressingSelectionUpdates)return Ti(this.view);if(ir&&$s<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&al(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let n=new Set,r;for(let i=t.focusNode;i;i=Rf(i))n.add(i);for(let i=t.anchorNode;i;i=Rf(i))if(n.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=t.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&g_(t)&&!this.ignoreSelectionChange(r),i=-1,s=-1,a=!1,l=[];if(t.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],l);d&&(i=i<0?d.from:Math.min(d.from,i),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(a=!0))}if(Lo&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||zX(t,d)!=h)&&f.remove()}}}let c=null;i<0&&o&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&wv(r)&&(c=Z1(t))&&c.eq(Le.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,Ti(t),this.currentSelection.set(r),t.scrollToSelection()):(i>-1||o)&&(i>-1&&(t.docView.markDirty(i,s),LX(t)),this.handleDOMChange(i,s,a,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||Ti(t),this.currentSelection.set(r))}registerMutation(t,n){if(n.indexOf(t.target)>-1)return null;let r=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(r==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!r||r.ignoreMutation(t))return null;if(t.type=="childList"){for(let u=0;u<t.addedNodes.length;u++){let d=t.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(t.target))return{from:r.posBefore,to:r.posAfter};let o=t.previousSibling,i=t.nextSibling;if(ir&&$s<=11&&t.addedNodes.length)for(let u=0;u<t.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=t.addedNodes[u];(!d||Array.prototype.indexOf.call(t.addedNodes,d)<0)&&(o=d),(!f||Array.prototype.indexOf.call(t.addedNodes,f)<0)&&(i=f)}let s=o&&o.parentNode==t.target?un(o)+1:0,a=r.localPosFromDOM(t.target,s,-1),l=i&&i.parentNode==t.target?un(i):t.target.childNodes.length,c=r.localPosFromDOM(t.target,l,1);return{from:a,to:c}}else return t.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=t.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:t.target.nodeValue==t.oldValue})}}let E_=new WeakMap,__=!1;function LX(e){if(!E_.has(e)&&(E_.set(e,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=Lo,__)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."),__=!0}}function T_(e,t){let n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return al(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function FX(e,t){if(t.getComposedRanges){let o=t.getComposedRanges(e.root)[0];if(o)return T_(e,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?T_(e,n):null}function zX(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let r=e.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function $X(e,t,n){let{node:r,fromOffset:o,toOffset:i,from:s,to:a}=e.docView.parseRange(t,n),l=e.domSelectionRange(),c,u=l.anchorNode;if(u&&e.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],wv(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Tn&&e.input.lastKeyCode===8)for(let x=i;x>o;x--){let b=r.childNodes[x-1],w=b.pmViewDesc;if(b.nodeName=="BR"&&!w){i=x;break}if(!w||w.size)break}let d=e.state.doc,f=e.someProp("domParser")||Vc.fromSchema(e.state.schema),h=d.resolve(s),m=null,v=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:o,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:BX,context:h});if(c&&c[0].pos!=null){let x=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=x),m={anchor:x+s,head:b+s}}return{doc:v,sel:m,from:s,to:a}}function BX(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(Bn&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(e.parentNode.lastChild==e||Bn&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const VX=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function UX(e,t,n,r,o){let i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let M=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,j=Z1(e,M);if(j&&!e.state.selection.eq(j)){if(Tn&&vo&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",B=>B(e,Oa(13,"Enter"))))return;let L=e.state.tr.setSelection(j);M=="pointer"?L.setMeta("pointer",!0):M=="key"&&L.scrollIntoView(),i&&L.setMeta("composition",i),e.dispatch(L)}return}let s=e.state.doc.resolve(t),a=s.sharedDepth(n);t=s.before(a+1),n=e.state.doc.resolve(n).after(a+1);let l=e.state.selection,c=$X(e,t,n),u=e.state.doc,d=u.slice(c.from,c.to),f,h;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,h="end"):(f=e.state.selection.from,h="start"),e.input.lastKeyCode=null;let m=KX(d.content,c.doc.content,c.from,f,h);if(m&&e.input.domChangeCount++,(Hc&&e.input.lastIOSEnter>Date.now()-225||vo)&&o.some(M=>M.nodeType==1&&!VX.test(M.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp("handleKeyDown",M=>M(e,Oa(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof Oe&&!l.empty&&l.$head.sameParent(l.$anchor)&&!e.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let M=O_(e,e.state.doc,c.sel);if(M&&!M.eq(e.state.selection)){let j=e.state.tr.setSelection(M);i&&j.setMeta("composition",i),e.dispatch(j)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof Oe&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=c.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=c.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),ir&&$s<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>c.from&&c.doc.textBetween(m.start-c.from-1,m.start-c.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let v=c.doc.resolveNoCache(m.start-c.from),x=c.doc.resolveNoCache(m.endB-c.from),b=u.resolve(m.start),w=v.sameParent(x)&&v.parent.inlineContent&&b.end()>=m.endA,S;if((Hc&&e.input.lastIOSEnter>Date.now()-225&&(!w||o.some(M=>M.nodeName=="DIV"||M.nodeName=="P"))||!w&&v.pos<c.doc.content.size&&!v.sameParent(x)&&(S=Le.findFrom(c.doc.resolve(v.pos+1),1,!0))&&S.head==x.pos)&&e.someProp("handleKeyDown",M=>M(e,Oa(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&HX(u,m.start,m.endA,v,x)&&e.someProp("handleKeyDown",M=>M(e,Oa(8,"Backspace")))){vo&&Tn&&e.domObserver.suppressSelectionUpdates();return}Tn&&vo&&m.endB==m.start&&(e.input.lastAndroidDelete=Date.now()),vo&&!w&&v.start()!=x.start()&&x.parentOffset==0&&v.depth==x.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,x=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{e.someProp("handleKeyDown",function(M){return M(e,Oa(13,"Enter"))})},20));let k=m.start,C=m.endA,T,_,O;if(w){if(v.pos==x.pos)ir&&$s<=11&&v.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ti(e),20)),T=e.state.tr.delete(k,C),_=u.resolve(m.start).marksAcross(u.resolve(m.endA));else if(m.endA==m.endB&&(O=WX(v.parent.content.cut(v.parentOffset,x.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start()))))T=e.state.tr,O.type=="add"?T.addMark(k,C,O.mark):T.removeMark(k,C,O.mark);else if(v.parent.child(v.index()).isText&&v.index()==x.index()-(x.textOffset?0:1)){let M=v.parent.textBetween(v.parentOffset,x.parentOffset);if(e.someProp("handleTextInput",j=>j(e,k,C,M)))return;T=e.state.tr.insertText(M,k,C)}}if(T||(T=e.state.tr.replace(k,C,c.doc.slice(m.start-c.from,m.endB-c.from))),c.sel){let M=O_(e,T.doc,c.sel);M&&!(Tn&&vo&&e.composing&&M.empty&&(m.start!=m.endB||e.input.lastAndroidDelete<Date.now()-100)&&(M.head==k||M.head==T.mapping.map(C)-1)||ir&&M.empty&&M.head==k)&&T.setSelection(M)}_&&T.ensureMarks(_),i&&T.setMeta("composition",i),e.dispatch(T.scrollIntoView())}function O_(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Q1(e,t.resolve(n.anchor),t.resolve(n.head))}function WX(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,o=n,i=r,s,a,l;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(o.length==1&&i.length==0)a=o[0],s="add",l=u=>u.mark(a.addToSet(u.marks));else if(o.length==0&&i.length==1)a=i[0],s="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<t.childCount;u++)c.push(l(t.child(u)));if(D.from(c).eq(e))return{mark:a,type:s}}function HX(e,t,n,r,o){if(n-t<=o.pos-r.pos||rx(r,!0,!1)<o.pos)return!1;let i=e.resolve(t);if(!r.parent.isTextblock){let a=i.nodeAfter;return a!=null&&n==t+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=e.resolve(rx(i,!0,!0));return!s.parent.isTextblock||s.pos>n||rx(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function rx(e,t,n){let r=e.depth,o=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,o++,t=!1;if(n){let i=e.node(r).maybeChild(e.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function KX(e,t,n,r,o){let i=e.findDiffStart(t,n);if(i==null)return null;let{a:s,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if(o=="end"){let l=Math.max(0,i-Math.min(s,a));r-=s+l-i}if(s<i&&e.size<t.size){let l=r<=i&&r>=s?i-r:0;i-=l,i&&i<t.size&&N_(t.textBetween(i-1,i+1))&&(i+=l?1:-1),a=i+(a-s),s=i}else if(a<i){let l=r<=i&&r>=a?i-r:0;i-=l,i&&i<e.size&&N_(e.textBetween(i-1,i+1))&&(i+=l?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}function N_(e){if(e.length!=2)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class qX{constructor(t,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new fX,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(A_),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=R_(this),P_(this),this.nodeViews=j_(this),this.docView=u_(this.state.doc,M_(this),nx(this),this.dom,this),this.domObserver=new DX(this,(r,o,i,s)=>UX(this,r,o,i,s)),this.domObserver.start(),pX(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let n in t)this._props[n]=t[n];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&sb(this);let n=this._props;this._props=t,t.plugins&&(t.plugins.forEach(A_),this.directPlugins=t.plugins),this.updateStateInner(t.state,n)}setProps(t){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in t)n[r]=t[r];this.update(n)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,n){var r;let o=this.state,i=!1,s=!1;t.storedMarks&&this.composing&&(qI(this),s=!0),this.state=t;let a=o.plugins!=t.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=j_(this);YX(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&sb(this),this.editable=R_(this),P_(this);let l=nx(this),c=M_(this),u=o.plugins!=t.plugins&&!o.doc.eq(t.doc)?"reset":t.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(t.doc,c,l);(d||!t.selection.eq(o.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&TJ(this);if(s){this.domObserver.stop();let h=d&&(ir||Tn)&&!this.composing&&!o.selection.empty&&!t.selection.empty&&GX(o.selection,t.selection);if(d){let m=Tn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=_X(this)),(i||!this.docView.update(t.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=u_(t.doc,c,l,this.dom,this)),m&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&XJ(this))?Ti(this,h):(AI(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,o),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&OJ(f)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof we){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&o_(this,n.getBoundingClientRect(),t)}else o_(this,this.coordsAtPos(this.state.selection.head,1),t)}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(!t||t.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,t)}}updateDraggedNode(t,n){let r=t.node,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new YI(t.slice,t.move,o<0?void 0:we.create(this.state.doc,o))}someProp(t,n){let r=this._props&&this._props[t],o;if(r!=null&&(o=n?n(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[t];if(a!=null&&(o=n?n(a):a))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let a=i[s].props[t];if(a!=null&&(o=n?n(a):a))return o}}hasFocus(){if(ir){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;for(;t&&this.dom!=t&&this.dom.contains(t);){if(t.contentEditable=="false")return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&NJ(this.dom),Ti(this),this.domObserver.start()}get root(){let t=this._root;if(t==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return t||document}updateRoot(){this._root=null}posAtCoords(t){return AJ(this,t)}coordsAtPos(t,n=1){return _I(this,t,n)}domAtPos(t,n=0){return this.docView.domFromPos(t,n)}nodeDOM(t){let n=this.docView.descAt(t);return n?n.nodeDOM:null}posAtDOM(t,n,r=-1){let o=this.docView.posFromDOM(t,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(t,n){return zJ(this,n||this.state,t)}pasteHTML(t,n){return Af(this,"",t,!1,n||new ClipboardEvent("paste"))}pasteText(t,n){return Af(this,t,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(hX(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],nx(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,gJ())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return gX(this,t)}dispatch(t){let n=this._props.dispatchTransaction;n?n.call(this,t):this.updateState(this.state.apply(t))}domSelectionRange(){let t=this.domSelection();return t?Bn&&this.root.nodeType===11&&wJ(this.dom.ownerDocument)==this.dom&&FX(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function M_(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 r in n)r=="class"?t.class+=" "+n[r]:r=="style"?t.style=(t.style?t.style+";":"")+n[r]:!t[r]&&r!="contenteditable"&&r!="nodeName"&&(t[r]=String(n[r]))}),t.translate||(t.translate="no"),[dt.node(0,e.state.doc.content.size,t)]}function P_(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:dt.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function R_(e){return!e.someProp("editable",t=>t(e.state)===!1)}function GX(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 j_(e){let t=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(t,o)||(t[o]=r[o])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function YX(e,t){let n=0,r=0;for(let o in e){if(e[o]!=t[o])return!0;n++}for(let o in t)r++;return n!=r}function A_(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var JX=e=>{if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")};const XX=ia(JX);function ZX(e){return!!(e.prev&&e.next&&e.prev.text.full!==e.next.text.full)}function QX(e){return!!(e.prev&&e.next&&e.prev.range.cursor!==e.next.range.cursor)}function eZ(e){return!!(!e.prev&&e.next)}function tZ(e){return!!(e.prev&&!e.next)}function nZ(e){return!!(e.prev&&e.next&&e.prev.range.from!==e.next.range.from)}function rZ(e){return e==="invalid-exit-split"}var oZ=["jump-backward-exit","jump-forward-exit"],iZ=["jump-backward-change","jump-forward-change"];function sZ(e){var t,n;return Do(oZ,(t=e.exit)==null?void 0:t.exitReason)||Do(iZ,(n=e.change)==null?void 0:n.changeReason)}function I_(e){return!!(e&&e.query.full.length>=e.suggester.matchOffset)}function D_(e){return Pn(e)&&e instanceof Oe}function Qn(e){const{match:t,changeReason:n,exitReason:r}=e;return{...t,changeReason:n,exitReason:r}}function aZ(e,t){const{invalidPrefixCharacters:n,validPrefixCharacters:r}=t;return n?!new RegExp(lb(n)).test(e):new RegExp(lb(r)).test(e)}function lZ(e){const{text:t,regexp:n,$pos:r,suggester:o}=e,i=r.start();let s;return xv(t,n).forEach(a=>{const l=a.input.slice(Math.max(0,a.index-1),a.index);if(aZ(l,o)){const c=a.index+i,u=a[0],d=a[1];if(!_e(u)||!_e(d))return;const f=c+u.length,h=Math.min(f,r.pos),m=h-c;c<r.pos&&f>=r.pos&&(s={range:{from:c,to:f,cursor:h},match:a,query:{partial:u.slice(d.length,m),full:u.slice(d.length)},text:{partial:u.slice(0,m),full:u},textAfter:r.doc.textBetween(f,r.end(),Es,Es),textBefore:r.doc.textBetween(i,c,Es,Es),suggester:o})}}),s}function eD(e){const{$pos:t,suggester:n}=e,{char:r,name:o,startOfLine:i,supportedCharacters:s,matchOffset:a,multiline:l,caseInsensitive:c,unicode:u}=n,d=vZ({char:r,matchOffset:a,startOfLine:i,supportedCharacters:s,multiline:l,caseInsensitive:c,unicode:u}),f=t.doc.textBetween(t.before(),t.end(),Es,Es);return lZ({suggester:n,text:f,regexp:d,$pos:t,char:r,name:o})}function tD(e){const{state:t,match:n}=e;try{return eD({$pos:t.doc.resolve(n.range.cursor),suggester:n.suggester})}catch{return}}function nD(e){const{prev:t,next:n,state:r}=e;return!n&&t.range.from>=r.doc.nodeSize?{exit:Qn({match:t,exitReason:"delete"})}:!n||!t.query.partial?{exit:Qn({match:t,exitReason:"invalid-exit-split"})}:t.range.to===n.range.cursor?{exit:Qn({match:n,exitReason:"exit-end"})}:t.query.partial?{exit:Qn({match:n,exitReason:"exit-split"})}:{}}function cZ(e){const{prev:t,next:n,state:r}=e,o=he(),i=tD({state:r,match:t}),{exit:s}=i&&i.query.full!==t.query.full?nD({prev:t,next:i,state:r}):o;return t.range.from<n.range.from?{exit:s??Qn({match:t,exitReason:"jump-forward-exit"}),change:Qn({match:n,changeReason:"jump-forward-change"})}:{exit:s??Qn({match:t,exitReason:"jump-backward-exit"}),change:Qn({match:n,changeReason:"jump-backward-change"})}}function uZ(e){const{match:t,state:n,$pos:r}=e,{selection:o}=n,i=tD({match:t,state:n});return!i||i.text.full!==t.text.full?nD({prev:t,next:i,state:n}):!o.empty&&(o.from<=t.range.from||o.to>=t.range.to)?{exit:Qn({match:t,exitReason:"selection-outside"})}:r.pos>t.range.to?{exit:Qn({match:t,exitReason:"move-end"})}:r.pos<=t.range.from?{exit:Qn({match:t,exitReason:"move-start"})}:{}}function dZ(e){const{prev:t,next:n,state:r,$pos:o}=e,i=he();if(!t&&!n)return i;const s={prev:t,next:n};return nZ(s)?cZ({prev:s.prev,next:s.next,state:r}):eZ(s)?{change:Qn({match:s.next,changeReason:"start"})}:tZ(s)?uZ({$pos:o,match:s.prev,state:r}):ZX(s)?{change:Qn({match:s.next,changeReason:"change-character"})}:QX(s)?{change:Qn({match:s.next,changeReason:r.selection.empty?"move":"selection-inside"})}:i}function L_(e,t){for(let n=e.depth;n>0;n--){const r=e.node(n);if(t.includes(r.type.name))return!0}return!1}function ab(e,t){const{$from:n,$to:r}=e;return rD(e,t)?!0:AA(n.pos,r.pos).some(o=>fZ(n.doc.resolve(o),t))}function rD(e,t){const{$from:n,$to:r}=e,o=new Set((n.marksAcross(r)??[]).map(i=>i.type.name));return t.some(i=>o.has(i))}function fZ(e,t){const n=new Set(e.marks().map(r=>r.type.name));return t.some(r=>n.has(r))}function pZ(e,t){const{$cursor:n}=t,{validMarks:r,validNodes:o,invalidMarks:i,invalidNodes:s}=e;return!r&&!o&&ea(i)&&ea(s)?!0:!(r&&!rD(t,r)||o&&!L_(n,o)||!r&&ab(t,i)||!o&&L_(n,s))}function F_(e){const{suggesters:t,$pos:n,selectionEmpty:r}=e;for(const o of t)if(!(o.emptySelectionsOnly&&!r))try{const i=eD({suggester:o,$pos:n});if(!i)continue;const s={$from:n.doc.resolve(i.range.from),$to:n.doc.resolve(i.range.to),$cursor:n};if(pZ(o,s)&&o.isValidPosition(s,i))return i}catch{}}function lb(e){return TG(e)?e.source:e}function hZ(e){return e?"^":""}function mZ(e,t){return`(?:${lb(e)}){${t},}`}function gZ(e){return _e(e)?new RegExp(XX(e)):e}function vZ(e){const{char:t,matchOffset:n,startOfLine:r,supportedCharacters:o,captureChar:i=!0,caseInsensitive:s=!1,multiline:a=!1,unicode:l=!1}=e,c=`g${a?"m":""}${s?"i":""}${l?"u":""}`;let u=gZ(t).source;return i&&(u=`(${u})`),new RegExp(`${hZ(r)}${u}${mZ(o,n)}`,c)}var yZ={appendTransaction:!1,priority:50,ignoredTag:"span",matchOffset:0,disableDecorations:!1,startOfLine:!1,suggestClassName:"suggest",suggestTag:"span",supportedCharacters:/\w+/,validPrefixCharacters:/^[\s\0]?$/,invalidPrefixCharacters:null,ignoredClassName:null,invalidMarks:[],invalidNodes:[],validMarks:null,validNodes:null,isValidPosition:()=>!0,checkNextValidSelection:null,emptySelectionsOnly:!1,caseInsensitive:!1,multiline:!1,unicode:!1,captureChar:!0},oD="__ignore_prosemirror_suggest_update__",Jf,xc,At,yi,Da,po,Nt,xi,La,bc,xZ=(bc=class{constructor(t){bn(this,Jf,!1);bn(this,xc,!1);bn(this,At);bn(this,yi);bn(this,Da);bn(this,po,he());Et(this,"view");bn(this,Nt,Ye.empty);bn(this,xi,!1);bn(this,La,!1);Et(this,"setMarkRemoved",()=>{$e(this,xi,!0)});Et(this,"findNextTextSelection",t=>{const n=t.$from.doc,r=Math.min(n.nodeSize-2,t.to+1),o=n.resolve(r),i=Le.findFrom(o,1,!0);if(D_(i))return i});Et(this,"ignoreNextExit",()=>{$e(this,xc,!0)});Et(this,"addIgnored",({from:t,name:n,specific:r=!1})=>{const o=te(this,At).find(c=>c.name===n);if(!o)throw new Error(`No suggester exists for the name provided: ${n}`);const i=_e(o.char)?o.char.length:1,s=t+i,a=o.ignoredClassName?{class:o.ignoredClassName}:{},l=dt.inline(t,s,{nodeName:o.ignoredTag,...a},{name:n,specific:r,char:o.char});$e(this,Nt,te(this,Nt).add(this.view.state.doc,[l]))});Et(this,"removeIgnored",({from:t,name:n})=>{const r=te(this,At).find(s=>s.name===n);if(!r)throw new Error(`No suggester exists for the name provided: ${n}`);const o=_e(r.char)?r.char.length:1,i=te(this,Nt).find(t,t+o)[0];!i||i.spec.name!==n||$e(this,Nt,te(this,Nt).remove([i]))});Et(this,"clearIgnored",t=>{if(!t){$e(this,Nt,Ye.empty);return}const r=te(this,Nt).find().filter(({spec:o})=>o.name===t);$e(this,Nt,te(this,Nt).remove(r))});Et(this,"findMatchAtPosition",(t,n)=>{const r=n?te(this,At).filter(o=>o.name===n):te(this,At);return F_({suggesters:r,$pos:t,docChanged:!1,selectionEmpty:!0})});Et(this,"setLastChangeFromAppend",()=>{$e(this,La,!0)});const n=z_();$e(this,At,t.map(n)),$e(this,At,ol(te(this,At),(r,o)=>o.priority-r.priority))}static create(t){return new bc(t)}get decorationSet(){return te(this,Nt)}get removed(){return te(this,xi)}get match(){return te(this,yi)?te(this,yi):te(this,Da)&&te(this,po).exit?te(this,Da):void 0}init(t){return this.view=t,this}createProps(t){const{name:n,char:r}=t.suggester;return{view:this.view,addIgnored:this.addIgnored,clearIgnored:this.clearIgnored,ignoreNextExit:this.ignoreNextExit,setMarkRemoved:this.setMarkRemoved,name:n,char:r,...t}}shouldRunExit(){return te(this,xc)?($e(this,xc,!1),!1):!0}updateWithNextSelection(t){var r,o,i;const n=this.findNextTextSelection(t.selection);if(n)for(const s of te(this,At)){const a=(r=te(this,po).change)==null?void 0:r.suggester.name,l=(o=te(this,po).exit)==null?void 0:o.suggester.name;(i=s.checkNextValidSelection)==null||i.call(s,n.$from,t,{change:a,exit:l})}}changeHandler(t,n){const{change:r,exit:o}=te(this,po),i=this.match;if(!r&&!o||!I_(i))return;const s=n===(o==null?void 0:o.suggester.appendTransaction)&&this.shouldRunExit(),a=n===(r==null?void 0:r.suggester.appendTransaction);if(!(!s&&!a)){if(r&&o&&sZ({change:r,exit:o})){const l=this.createProps(o),c=this.createProps(r),u=o.range.from<r.range.from;s&&o.suggester.onChange(l,t),a&&r.suggester.onChange(c,t),s&&$e(this,xi,!1);return}r&&a&&r.suggester.onChange(this.createProps(r),t),o&&s&&(o.suggester.onChange(this.createProps(o),t),$e(this,xi,!1),rZ(o.exitReason)&&$e(this,po,he()))}}mapIgnoredDecorations(t){const n=te(this,Nt).map(t.mapping,t.doc),o=n.find().filter(({from:i,to:s,spec:a})=>{const l=_e(a.char)?a.char.length:1;return s-i!==l});$e(this,Nt,n.remove(o))}shouldIgnoreMatch({range:t,suggester:{name:n}}){return te(this,Nt).find().some(({spec:i,from:s})=>s!==t.from?!1:i.specific?i.name===n:!0)}resetState(){$e(this,po,he()),$e(this,yi,void 0),$e(this,xi,!1),$e(this,La,!1)}updateReasons(t){const{$pos:n,state:r}=t,o=te(this,Jf),i=te(this,At),s=r.selection.empty,a=D_(r.selection)?F_({suggesters:i,$pos:n,docChanged:o,selectionEmpty:s}):void 0;$e(this,yi,a&&this.shouldIgnoreMatch(a)?void 0:a),$e(this,po,dZ({next:te(this,yi),prev:te(this,Da),state:r,$pos:n}))}addSuggester(t){const n=te(this,At).find(o=>o.name===t.name),r=z_();if(n)$e(this,At,te(this,At).map(o=>o===n?r(t):o));else{const o=[...te(this,At),r(t)];$e(this,At,ol(o,(i,s)=>s.priority-i.priority))}return()=>this.removeSuggester(t.name)}removeSuggester(t){const n=_e(t)?t:t.name;$e(this,At,te(this,At).filter(r=>r.name!==n)),this.clearIgnored(n)}toJSON(){return this.match}apply(t){const{exit:n,change:r}=te(this,po);if(te(this,La)&&($e(this,La,!1),!(n!=null&&n.suggester.appendTransaction)&&!(r!=null&&r.suggester.appendTransaction)))return this;const{tr:o,state:i}=t,s=o.docChanged||o.selectionSet;return o.getMeta(oD)||!s&&!te(this,xi)?this:($e(this,Jf,o.docChanged),this.mapIgnoredDecorations(o),n&&this.resetState(),$e(this,Da,te(this,yi)),this.updateReasons({$pos:o.selection.$from,state:i}),this)}createDecorations(t){const n=this.match;if(!I_(n))return te(this,Nt);const{disableDecorations:r}=n.suggester;if(ft(r)?r(t,n):r)return te(this,Nt);const{range:i,suggester:s}=n,{name:a,suggestTag:l,suggestClassName:c}=s,{from:u,to:d}=i;return this.shouldIgnoreMatch(n)?te(this,Nt):te(this,Nt).add(t.doc,[dt.inline(u,d,{nodeName:l,class:a?`${c} suggest-${a}`:c},{name:a})])}},Jf=new WeakMap,xc=new WeakMap,At=new WeakMap,yi=new WeakMap,Da=new WeakMap,po=new WeakMap,Nt=new WeakMap,xi=new WeakMap,La=new WeakMap,bc);function z_(){const e=new Set;return t=>{if(e.has(t.name))throw new Error(`A suggester already exists with the name '${t.name}'. The name provided must be unique.`);const n={...yZ,...t};return e.add(t.name),n}}var iD=new pu("suggest");function iS(e){return iD.getState(e)}function $_(e,t){return iS(e).addSuggester(t)}function B_(e){e.setMeta(oD,!0)}function bZ(e,t){return iS(e).removeSuggester(t)}function wZ(...e){const t=xZ.create(e);return new Vi({key:iD,view:n=>(t.init(n),{update:r=>t.changeHandler(r.state.tr,!1)}),state:{init:()=>t,apply:(n,r,o,i)=>t.apply({tr:n,state:i})},appendTransaction:(n,r,o)=>{const i=o.tr;return t.updateWithNextSelection(i),t.changeHandler(i,!0),i.docChanged||i.steps.length>0||i.selectionSet||i.storedMarksSet?(t.setLastChangeFromAppend(),i):null},props:{decorations:n=>t.createDecorations(n)}})}function sS(e,t){const n=Object.getPrototypeOf(t);let r=e.selection,o=e.doc,i=e.storedMarks;const s=he();for(const[a,l]of Object.entries(t))s[a]={value:l};return Object.create(n,{...s,storedMarks:{get(){return i}},selection:{get(){return r}},doc:{get(){return o}},tr:{get(){return r=e.selection,o=e.doc,i=e.storedMarks,e}}})}function Fd(e){return({state:t,dispatch:n,view:r,tr:o})=>e(sS(o,t),n,r)}function V_(e){return t=>{var n;return xe(t.dispatch===void 0||t.dispatch===((n=t.view)==null?void 0:n.dispatch),{code:K.NON_CHAINABLE_COMMAND}),e(t)}}function SZ(...e){return({state:t,dispatch:n,view:r,tr:o,...i})=>{for(const s of e)if(s({state:t,dispatch:n,view:r,tr:o,...i}))return!0;return!1}}var yo={get isBrowser(){return!!(typeof window<"u"&&typeof window.document<"u"&&window.navigator&&window.navigator.userAgent)},get isJSDOM(){return yo.isBrowser&&window.navigator.userAgent.includes("jsdom")},get isNode(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null},get isIos(){return yo.isBrowser&&/iPod|iPhone|iPad/.test(navigator.platform)},get isMac(){return yo.isBrowser&&/Mac|iPod|iPhone|iPad/.test(navigator.platform)},get isApple(){return yo.isNode?process.platform==="darwin":yo.isBrowser?/Mac|iPod|iPhone|iPad/.test(window.navigator.platform):!1},get isDevelopment(){return!1},get isTest(){return!1},get isProduction(){return!0}};function Zi(e,t){var n;const r=GZ(e);return((n=r==null?void 0:r.getComputedStyle(e))==null?void 0:n.getPropertyValue(t))??""}function kn(e,t){return Object.assign(e.style,t)}function cb(e){return Pn(e)&&Pr(e.nodeType)&&_e(e.nodeName)}function ri(e){return cb(e)&&e.nodeType===1}function aS(e){const{types:t,node:n}=e;if(!n)return!1;const r=o=>o===n.type||o===n.type.name;return Bt(t)?t.some(r):r(t)}function kZ(e,t){const{tr:n}=t;return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function Cv(e){const{predicate:t,selection:n}=e,r=aD(n)?n.selection.$from:uS(n)?n.$from:n;for(let o=r.depth;o>0;o--){const i=r.node(o),s=o>0?r.before(o):0,a=r.start(o),l=s+i.nodeSize;if(t(i,s))return{pos:s,depth:o,node:i,start:a,end:l}}}function CZ(e){const{depth:t}=e,n=t>0?e.before(t):0,r=e.node(t),o=e.start(t),i=n+r.nodeSize;return{pos:n,start:o,node:r,end:i,depth:t}}function Df(e){const{types:t,selection:n}=e;return Cv({predicate:r=>aS({types:t,node:r}),selection:n})}function EZ(e){const{types:t,selection:n}=e;if(!(!_v(n)||!aS({types:t,node:n.node})))return{pos:n.$from.pos,depth:n.$from.depth,start:n.$from.start(),end:n.$from.pos+n.node.nodeSize,node:n.node}}function lS(e){return uS(e)?e.empty:e.selection.empty}function _Z(e){return e.docChanged||e.selectionSet}function TZ(e){return!!Lf(e)}function Lf(e){const{state:t,type:n,attrs:r}=e,{selection:o,doc:i}=t,s=_e(n)?i.type.schema.nodes[n]:n;xe(s,{code:K.SCHEMA,message:`No node exists for ${n}`});const a=EZ({selection:o,types:n})??Cv({predicate:l=>l.type===s,selection:o});return!r||Hm(r)||!a||a.node.hasMarkup(s,{...a.node.attrs,...r})?a:void 0}function ag(...e){return t=>{if(!RE(e))return!1;const[n,...r]=e;let o=!1;const i=(...l)=>()=>{if(!RE(l))return!1;o=!0;const[,...c]=l;return ag(...l)({...t,next:i(...c)})},s=i(...r),a=n({...t,next:s});return o||a?a:s()}}function OZ(e,t){const n=new Map,r=he();for(const o of e)for(const[i,s]of $t(o)){const l=[...n.get(i)??[],s],c=ag(...l);n.set(i,l),r[i]=t(c)}return r}function NZ(e){return OZ(e,t=>(n,r,o)=>t({state:n,dispatch:r,view:o,tr:n.tr,next:()=>!1}))}function cS(e,t){const n=e.attrs??{};return Object.entries(t).every(([r,o])=>n[r]===o)}function MZ(e){return cD(e,[ki,Ot,Zt,So])}function hu(e){return Pn(e)}function mu(e,t){return Bt(t)?Do(t,e[Li]):t===e[Li]}function PZ(e){return Pn(e)&&e instanceof G0}function RZ(e,t){return _e(e)?vt(t.nodes,e):e}function sD(e){return Pn(e)&&e instanceof Sp}function jZ(e,t){return _e(e)?vt(t.marks,e):e}function Ev(e){return Pn(e)&&e instanceof zs}function AZ(e){return Pn(e)&&e instanceof D}function IZ(e){return Pn(e)&&e instanceof He}function aD(e){return Pn(e)&&e instanceof ja}function gl(e){return Pn(e)&&e instanceof Oe}function DZ(e){return Pn(e)&&e instanceof zn}function uS(e){return Pn(e)&&e instanceof Le}function LZ(e){return Pn(e)&&e instanceof Bc}function U_(e){const{trState:t,from:n,to:r,type:o,attrs:i={}}=e,{doc:s}=t,a=jZ(o,s.type.schema);if(Object.keys(i).length===0)return s.rangeHasMark(n,r,a);let l=!1;return r>n&&s.nodesBetween(n,r,c=>l?!1:(l=(c.marks??[]).some(d=>d.type!==a?!1:cS(d,i)),!l)),l}function _v(e){return Pn(e)&&e instanceof we}function lg(e){const{trState:t,type:n,attrs:r={},from:o,to:i}=e,{selection:s,doc:a,storedMarks:l}=t,c=_e(n)?a.type.schema.marks[n]:n;if(xe(c,{code:K.SCHEMA,message:`Mark type: ${n} does not exist on the current schema.`}),o&&i)try{return Math.max(o,i)<a.nodeSize&&U_({...e,from:o,to:i})}catch{return!1}return s.empty?(l??s.$from.marks()).some(d=>d.type!==n?!1:cS(d,r??{})):U_({...e,from:s.from,to:s.to})}function dS(e,t={}){const n=FZ(e.type.schema);if(!n)return!1;const{ignoreAttributes:r,ignoreDocAttributes:o}=t;return r?lD(n,e):o?n.content.eq(e.content):n.eq(e)}function lD(e,t){if(e===t)return!0;const n=e.type===t.type&&He.sameSet(e.marks,t.marks);function r(){if(e.content===t.content)return!0;if(e.content.size!==t.content.size)return!1;const o=[],i=[];e.content.forEach(s=>o.push(s)),t.content.forEach(s=>i.push(s));for(const[s,a]of o.entries()){const l=i[s];if(!l||!lD(a,l))return!1}return!0}return n&&r()}function FZ(e){var t;return((t=e.nodes.doc)==null?void 0:t.createAndFill())??void 0}function Tv(e){for(const t of Object.values(e.nodes))if(t.name!=="doc"&&(t.isBlock||t.isTextblock))return t;xe(!1,{code:K.SCHEMA,message:"No default block node found for the provided schema."})}function zZ(e){return e.type===Tv(e.type.schema)}function fS(e){return!!e&&e.type.isBlock&&!e.textContent&&!e.childCount}function Fi(e,t,n){const r=e.parent.childAfter(e.parentOffset);if(!r.node)return;const o=_e(t)?t:t.name,i=r.node.marks.find(({type:d})=>d.name===o);let s=e.index(),a=e.start()+r.offset,l=s+1,c=a+r.node.nodeSize;if(!i)return n&&c<n.pos?Fi(e.doc.resolve(c+1),t,n):void 0;for(;s>0&&i.isInSet(e.parent.child(s-1).marks);)s-=1,a-=e.parent.child(s).nodeSize;for(;l<e.parent.childCount&&i.isInSet(e.parent.child(l).marks);)c+=e.parent.child(l).nodeSize,l+=1;const u=e.doc.textBetween(a,c,kA,`
352
-
353
- `);return{from:a,to:c,text:u,mark:i}}function cD(e,t){return t.length===0||t.some(n=>e instanceof n)}function $Z(e){return jA(e,({from:n,to:r,prevFrom:o,prevTo:i})=>`${n}_${r}_${o}_${i}`).filter((n,r,o)=>!o.some((i,s)=>r===s?!1:n.prevFrom>=i.prevFrom&&n.prevTo<=i.prevTo&&n.from>=i.from&&n.to<=i.to))}function BZ(e,t=[]){const n=[],{steps:r,mapping:o}=e,i=o.invert();r.forEach((a,l)=>{if(!cD(a,t))return;const c=[],u=a.getMap(),d=o.slice(l);if(u.ranges.length===0&&MZ(a)){const{from:f,to:h}=a;c.push({from:f,to:h})}else u.forEach((f,h)=>{c.push({from:f,to:h})});c.forEach(f=>{const h=d.map(f.from,-1),m=d.map(f.to);n.push({from:h,to:m,prevFrom:i.map(h,-1),prevTo:i.map(m)})})});const s=ol(n,(a,l)=>a.from-l.from);return $Z(s)}function VZ(e){var t;return((t=e.content.firstChild)==null?void 0:t.textContent)??""}function UZ(e,t){if(!gl(e.selection))return;let{from:n,to:r}=e.selection;const o=(s,a)=>VZ(Oe.between(e.doc.resolve(s),e.doc.resolve(a)).content());for(let s=o(n-1,n);s&&!t.test(s);n--,s=o(n-1,n));for(let s=o(r,r+1);s&&!t.test(s);r++,s=o(r,r+1));if(n===r)return;const i=e.doc.textBetween(n,r,kA,`
354
-
355
- `);return{from:n,to:r,text:i}}function uD(e){return UZ(e,/\W/)}function zd(e,t=0){const n=Bt(e)?e[t]:e;return NA(_e(n),`No match string found for match ${e}`),n??""}function WZ(e){return gl(e)?e.$cursor:void 0}function HZ(e,t){return Ev(e)?t?e.type===t.nodes.doc:e.type.name==="doc":!1}function KZ(e){return Pn(e)&&Pr(e.anchor)&&Pr(e.head)}function Jr(e,t){const n=t.nodeSize-2,r=0;let o;const i=l=>jG({min:r,max:n,value:l});if(uS(e))return e;if(e==="all")return new zn(t);if(e==="start"?o=r:e==="end"?o=n:LZ(e)?o=e.pos:o=e,Pr(o))return o=i(o),Oe.near(t.resolve(o));if(KZ(o)){const l=i(o.anchor),c=i(o.head);return Oe.between(t.resolve(l),t.resolve(c))}const s=i(o.from),a=i(o.to);return Oe.between(t.resolve(s),t.resolve(a))}var qZ=3;function dD(e){const{content:t,schema:n,document:r,stringHandler:o,onError:i,attempts:s=0}=e,a=i&&s<=qZ||s===0;if(xe(a,{code:K.INVALID_CONTENT,message:"The invalid content has been called recursively more than ${MAX_ATTEMPTS} times. The content is invalid and the error handler has not been able to recover properly."}),_e(t))return xe(o,{code:K.INVALID_CONTENT,message:`The string '${t}' was added to the editor, but no \`stringHandler\` was added. Please provide a valid string handler which transforms your content to a \`ProsemirrorNode\` to prevent this error.`}),o({document:r,content:t,schema:n});if(aD(t))return t.doc;if(Ev(t))return t;try{return n.nodeFromJSON(t)}catch(l){const c=eQ({schema:n,error:l,json:t}),u=i==null?void 0:i(c);return xe(u,{code:K.INVALID_CONTENT,message:`An error occurred when processing the content. Please provide an \`onError\` handler to process the invalid content: ${JSON.stringify(c.invalidContent,null,2)}`}),dD({...e,content:u,attempts:s+1})}}function Ov(){const e=gI();if(e)return e;throw new Error(`Unable to retrieve the document from the global scope.
356
- It seems that you are running Remirror in a non-browser environment. Remirror need browser APIs to work.
357
- If you are using Jest (or other testing frameworks), make sure that you are using the JSDOM environment (https://jestjs.io/docs/29.0/configuration#testenvironment-string).
358
- If you are using Next.js (or other server-side rendering frameworks), please use dynamic import with \`ssr: false\` to load the editor component without rendering it on the server (https://nextjs.org/docs/advanced-features/dynamic-import#with-no-ssr).
359
- If you are using Node.js, you can install JSDOM and Remirror will try to use it automatically, or you can create a fake document and pass it to Remirror`)}function fD(e){var t;return(e==null?void 0:e.defaultView)??(typeof window<"u"?window:void 0)??((t=gI())==null?void 0:t.defaultView)}function GZ(e){return fD(e==null?void 0:e.ownerDocument)}function YZ(e){const t=fD(e)??Ov().defaultView;if(t)return t;throw new Error("Unable to retrieve the window from the global scope")}function JZ(e,t=Ov()){const n=HZ(e,e.type.schema)?e.content:D.from(e);return ha.fromSchema(e.type.schema).serializeFragment(n,{document:t})}function XZ(e,t){return new(YZ(t)).DOMParser().parseFromString(`<body>${e}</body>`,"text/html").body}function ZZ(e,t=Ov()){const n=t.createElement("div");return n.append(JZ(e,t)),n.innerHTML}function ub(e){const{content:t,schema:n,document:r,fragment:o=!1,...i}=e,s=XZ(t,r),a=Vc.fromSchema(n);return o?a.parseSlice(s,{...W_,...i}).content:a.parse(s,{...W_,...i})}var W_={preserveWhitespace:!1};function pD(e,t){const n=Nf(t.defaults());return V1({...e},n)}var QZ={remove(e,t){let n=e;for(const r of t)r.invalidParentNode||(n=DG(r.path,n));return n}};function eQ({json:e,schema:t,...n}){const r=new Set(Nf(t.marks)),o=new Set(Nf(t.nodes)),i=hD({json:e,path:[],validNodes:o,validMarks:r});return{json:e,invalidContent:i,transformers:QZ,...n}}function hD(e){const{json:t,validMarks:n,validNodes:r,path:o=[]}=e,i={validMarks:n,validNodes:r},s=[],{type:a,marks:l,content:c}=t;let{invalidParentMark:u=!1,invalidParentNode:d=!1}=e;if(l){const f=[];for(const[h,m]of l.entries()){const v=_e(m)?m:m.type;n.has(v)||(f.unshift({name:v,path:[...o,"marks",`${h}`],type:"mark",invalidParentMark:u,invalidParentNode:d}),u=!0)}s.push(...f)}if(r.has(a)||(s.push({name:a,type:"node",path:o,invalidParentMark:u,invalidParentNode:d}),d=!0),c){const f=[];for(const[h,m]of c.entries())f.unshift(...hD({...i,json:m,path:[...o,"content",`${h}`],invalidParentMark:u,invalidParentNode:d}));s.unshift(...f)}return s}function tQ(e){return!!(gl(e)&&e.$cursor&&e.$cursor.parentOffset>=e.$cursor.parent.content.size)}function db(e){return!!(gl(e)&&e.$cursor&&e.$cursor.parentOffset<=0)}function H_(e){const t=Le.atStart(e.$anchor.doc);return!!(db(e)&&t.anchor===e.anchor)}function nQ(e){return({dispatch:t,tr:n})=>{const{type:r,attrs:o=he(),appendText:i,range:s}=e,a=s?Oe.between(n.doc.resolve(s.from),n.doc.resolve(s.to)):n.selection,{$from:l,from:c,to:u}=a;let d=l.depth===0?n.doc.type.allowsMarkType(r):!1;return n.doc.nodesBetween(c,u,f=>{if(d)return!1;if(f.inlineContent&&f.type.allowsMarkType(r)){d=!0;return}}),d?(t==null||t(n.addMark(c,u,r.create(o))&&i?n.insertText(i):n),!0):!1}}function rQ({tr:e,dispatch:t}){const{$from:n,$to:r}=e.selection,o=n.blockRange(r),i=o&&fu(o);return!Pr(i)||!o?!1:(t==null||t(e.lift(o,i).scrollIntoView()),!0)}function mD(e,t={},n){return function(r){const{tr:o,dispatch:i,state:s}=r,a=_e(e)?vt(s.schema.nodes,e):e,{from:l,to:c}=Jr(n??o.selection,o.doc),u=o.doc.resolve(l),d=o.doc.resolve(c),f=u.blockRange(d),h=f&&K1(f,a,t);return!h||!f?!1:(i==null||i(o.wrap(f,h).scrollIntoView()),!0)}}function oQ(e,t={},n){return r=>{const{tr:o,state:i}=r,s=_e(e)?vt(i.schema.nodes,e):e;return Lf({state:o,type:s,attrs:t})?rQ(r):mD(e,t,n)(r)}}function cg(e,t,n,r=!0){return function(o){const{tr:i,dispatch:s,state:a}=o,l=_e(e)?vt(a.schema.nodes,e):e,{from:c,to:u}=Jr(n??i.selection,i.doc);let d=!1,f;return i.doc.nodesBetween(c,u,(h,m)=>{if(d)return!1;if(!h.isTextblock||h.hasMarkup(l,t))return;if(h.type===l){d=!0,f=h.attrs;return}const v=i.doc.resolve(m),x=v.index();d=v.parent.canReplaceWith(x,x+1,l),d&&(f=v.parent.attrs)}),d?(s==null||s(i.setBlockType(c,u,l,{...r?f:{},...t}).scrollIntoView()),!0):!1}}function gD(e){return t=>{const{tr:n,state:r}=t,{type:o,attrs:i,preserveAttrs:s=!0}=e,a=Lf({state:n,type:o,attrs:i}),l=e.toggleType??Tv(r.schema);if(a)return cg(l,{...s?a.node.attrs:{},...i})(t);const c=Lf({state:n,type:l,attrs:i});return cg(o,{...s?c==null?void 0:c.node.attrs:{},...i})(t)}}function iQ(e=0){const t=navigator.userAgent.match(/Chrom(e|ium)\/(\d+)\./);return t?Number.parseInt(vt(t,2),10)>=e:!1}function sQ(e,t){let{head:n,empty:r,anchor:o}=e;for(const i of t.steps)n=i.getMap().map(n);r?t.setSelection(Oe.near(t.doc.resolve(n))):t.setSelection(Oe.between(t.doc.resolve(o),t.doc.resolve(n)))}function aQ(e){const{attrs:t={},appendText:n="",content:r="",keepSelection:o=!1,range:i}=e;return({state:s,tr:a,dispatch:l})=>{var c;const u=s.schema,d=Jr(e.selection??i??a.selection,a.doc),f=d.$from.index(),{from:h,to:m,$from:v}=d,x=_e(e.type)?u.nodes[e.type]??u.marks[e.type]:e.type;if(xe(_e(e.type)?x:!0,{code:K.SCHEMA,message:`Schema contains no marks or nodes with name ${x}`}),PZ(x)){if(!v.parent.canReplaceWith(f,f,x))return!1;a.replaceWith(h,m,x.create(t,r?u.text(r):void 0))}else xe(r,{message:"`replaceText` cannot be called without content when using a mark type"}),a.replaceWith(h,m,u.text(r,sD(x)?[x.create(t)]:void 0));return n&&a.insertText(n),o&&sQ(s.selection,a),l&&(iQ(60)&&((c=document.getSelection())==null||c.empty()),l(a)),!0}}function vD(e,t){const n=e.parent.childAfter(e.parentOffset);if(!n.node)return;const{marks:r,nodeSize:o}=n.node;if(r[0])return r[0].type;const s=e.start()+n.offset+o;return vD(e.doc.resolve(s+1))}function yD(e){return({dispatch:t,tr:n,state:r})=>{const{type:o,expand:i=!0,range:s}=e,a=Jr(e.selection??s??n.selection,n.doc);let{from:l,to:c,$from:u,$to:d}=a;const f=_e(o)?r.schema.marks[o]:o;f!==null&&xe(f,{code:K.SCHEMA,message:`Mark type: ${o} does not exist on the current schema.`});const h=f??vD(u);if(!h)return!1;const m=Fi(u,h,d);return i&&m&&(l=Math.max(0,Math.min(l,m.from)),c=Math.min(Math.max(c,m.to),n.doc.nodeSize-2)),t==null||t(n.removeMark(l,Pr(c)?c:l,sD(f)?f:void 0)),!0}}function ug(e){const{regexp:t,type:n,getAttributes:r,ignoreWhitespace:o=!1,beforeDispatch:i,updateCaptured:s,shouldSkip:a,invalidMarks:l}=e;let c;const u=new eo(t,(d,f,h,m)=>{const{tr:v,schema:x}=d;c||(c=_e(n)?x.marks[n]:n,xe(c,{code:K.SCHEMA,message:`Mark type: ${n} does not exist on the current schema.`}));let b=f[1],w=f[0];const S=lQ({captureGroup:b,fullMatch:w,end:m,start:h,rule:u,state:d,ignoreWhitespace:o,invalidMarks:l,shouldSkip:a,updateCaptured:s});if(!S)return null;({start:h,end:m,captureGroup:b,fullMatch:w}=S);const k=ft(r)?r(f):r;let C=m,T=[];if(b){const _=w.search(/\S/),O=h+w.indexOf(b),M=O+b.length;T=v.storedMarks??[],M<m&&v.delete(M,m),O>h&&v.delete(h+_,O),C=h+_+b.length}return v.addMark(h,C,c.create(k)),v.setStoredMarks(T),i==null||i({tr:v,match:f,start:h,end:m}),v});return u}function lQ({captureGroup:e,fullMatch:t,end:n,start:r,rule:o,ignoreWhitespace:i,shouldSkip:s,updateCaptured:a,state:l,invalidMarks:c}){var u;if(t==null)return null;const d=(a==null?void 0:a({captureGroup:e,fullMatch:t,start:r,end:n}))??{};e=d.captureGroup??e,t=d.fullMatch??t,r=d.start??r,n=d.end??n;const f=l.doc.resolve(r),h=l.doc.resolve(n);return c&&ab({$from:f,$to:h},c)||o.invalidMarks&&ab({$from:f,$to:h},o.invalidMarks)||i&&(e==null?void 0:e.trim())===""||s!=null&&s({state:l,captureGroup:e,fullMatch:t,start:r,end:n,ruleType:"mark"})||(u=o.shouldSkip)!=null&&u.call(o,{state:l,captureGroup:e,fullMatch:t,start:r,end:n,ruleType:"mark"})?null:{captureGroup:e,end:n,fullMatch:t,start:r}}var cQ=function(){const t=Array.prototype.slice.call(arguments).filter(Boolean),n={},r=[];t.forEach(i=>{(i?i.split(" "):[]).forEach(a=>{if(a.startsWith("atm_")){const[,l]=a.split("_");n[l]=a}else r.push(a)})});const o=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&o.push(n[i]);return o.push(...r),o.join(" ")},uQ=cQ;const xD=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function dQ(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const bD=(e,t,n)=>{let r=dQ(e,n);if(!r)return!1;let o=wD(r);if(!o){let s=r.blockRange(),a=s&&fu(s);return a==null?!1:(t&&t(e.tr.lift(s,a).scrollIntoView()),!0)}let i=o.nodeBefore;if(CD(e,o,t,-1))return!0;if(r.parent.content.size==0&&(Kc(i,"end")||we.isSelectable(i)))for(let s=r.depth;;s--){let a=q1(e.doc,r.before(s),r.after(s),X.empty);if(a&&a.slice.size<a.to-a.from){if(t){let l=e.tr.step(a);l.setSelection(Kc(i,"end")?Le.findFrom(l.doc.resolve(l.mapping.map(o.pos,-1)),-1):we.create(l.doc,o.pos-i.nodeSize)),t(l.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&o.depth==r.depth-1?(t&&t(e.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1};function Kc(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}const fQ=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;i=wD(r)}let s=i&&i.nodeBefore;return!s||!we.isSelectable(s)?!1:(t&&t(e.tr.setSelection(we.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function wD(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 pQ(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const hQ=(e,t,n)=>{let r=pQ(e,n);if(!r)return!1;let o=SD(r);if(!o)return!1;let i=o.nodeAfter;if(CD(e,o,t,1))return!0;if(r.parent.content.size==0&&(Kc(i,"start")||we.isSelectable(i))){let s=q1(e.doc,r.before(),r.after(),X.empty);if(s&&s.slice.size<s.to-s.from){if(t){let a=e.tr.step(s);a.setSelection(Kc(i,"start")?Le.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):we.create(a.doc,a.mapping.map(o.pos))),t(a.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(t&&t(e.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},mQ=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;i=SD(r)}let s=i&&i.nodeAfter;return!s||!we.isSelectable(s)?!1:(t&&t(e.tr.setSelection(we.create(e.doc,i.pos)).scrollIntoView()),!0)};function SD(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}const gQ=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
360
- `).scrollIntoView()),!0)};function pS(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const kD=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=pS(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(t){let a=n.after(),l=e.tr.replaceWith(a,a,s.createAndFill());l.setSelection(Le.near(l.doc.resolve(a),1)),t(l.scrollIntoView())}return!0},vQ=(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof zn||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=pS(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=e.tr.insert(s,i.createAndFill());a.setSelection(Oe.create(a.doc,s+1)),t(a.scrollIntoView())}return!0},yQ=(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 i=n.before();if(mc(e.doc,i))return t&&t(e.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&fu(r);return o==null?!1:(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)};function xQ(e){return(t,n)=>{let{$from:r,$to:o}=t.selection;if(t.selection instanceof we&&t.selection.node.isBlock)return!r.parentOffset||!mc(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],s,a,l=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){l=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),a=pS(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),i.unshift(l&&a?{type:a}:null),s=h;break}else{if(h==1)return!1;i.unshift(null)}let u=t.tr;(t.selection instanceof Oe||t.selection instanceof zn)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=mc(u.doc,d,i.length,i);if(f||(i[0]=a?{type:a}:null,f=mc(u.doc,d,i.length,i)),u.split(d,i.length,i),!l&&c&&r.node(s).type!=a){let h=u.mapping.map(r.before(s)),m=u.doc.resolve(h);a&&r.node(s-1).canReplaceWith(m.index(),m.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(s)),a)}return n&&n(u.scrollIntoView()),!0}}const bQ=xQ(),wQ=(e,t)=>{let{$from:n,to:r}=e.selection,o,i=n.sharedDepth(r);return i==0?!1:(o=n.before(i),t&&t(e.tr.setSelection(we.create(e.doc,o))),!0)},SQ=(e,t)=>(t&&t(e.tr.setSelection(new zn(e.doc))),!0);function kQ(e,t,n){let r=t.nodeBefore,o=t.nodeAfter,i=t.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&t.parent.canReplace(i-1,i)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(i,i+1)||!(o.isTextblock||kp(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function CD(e,t,n,r){let o=t.nodeBefore,i=t.nodeAfter,s,a,l=o.type.spec.isolating||i.type.spec.isolating;if(!l&&kQ(e,t,n))return!0;let c=!l&&t.parent.canReplace(t.index(),t.index()+1);if(c&&(s=(a=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&a.matchType(s[0]||i.type).validEnd){if(n){let h=t.pos+i.nodeSize,m=D.empty;for(let b=s.length-1;b>=0;b--)m=D.from(s[b].create(null,m));m=D.from(o.copy(m));let v=e.tr.step(new Ot(t.pos-1,h,t.pos,h,new X(m,1,0),s.length,!0)),x=v.doc.resolve(h+2*s.length);x.nodeAfter&&x.nodeAfter.type==o.type&&kp(v.doc,x.pos)&&v.join(x.pos),n(v.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&l?null:Le.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&fu(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(c&&Kc(i,"start",!0)&&Kc(o,"end")){let h=o,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let v=i,x=1;for(;!v.isTextblock;v=v.firstChild)x++;if(h.canReplace(h.childCount,h.childCount,v.content)){if(n){let b=D.empty;for(let S=m.length-1;S>=0;S--)b=D.from(m[S].copy(b));let w=e.tr.step(new Ot(t.pos-m.length,t.pos+i.nodeSize,t.pos+x,t.pos+i.nodeSize-x,new X(b,m.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function ED(e){return function(t,n){let r=t.selection,o=e<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(t.tr.setSelection(Oe.create(t.doc,e<0?o.start(i):o.end(i)))),!0):!1}}const CQ=ED(-1),EQ=ED(1);function _Q(e,t,n,r){for(let o=0;o<t.length;o++){let{$from:i,$to:s}=t[o],a=i.depth==0?e.inlineContent&&e.type.allowsMarkType(n):!1;if(e.nodesBetween(i.pos,s.pos,(l,c)=>{if(a||!r)return!1;a=l.inlineContent&&l.type.allowsMarkType(n)}),a)return!0}return!1}function TQ(e,t=null,n){let r=n!==!1;return function(o,i){let{empty:s,$cursor:a,ranges:l}=o.selection;if(s&&!a||!_Q(o.doc,l,e,r))return!1;if(i)if(a)e.isInSet(o.storedMarks||a.marks())?i(o.tr.removeStoredMark(e)):i(o.tr.addStoredMark(e.create(t)));else{let c,u=o.tr;c=!l.some(d=>o.doc.rangeHasMark(d.$from.pos,d.$to.pos,e));for(let d=0;d<l.length;d++){let{$from:f,$to:h}=l[d];if(!c)u.removeMark(f.pos,h.pos,e);else{let m=f.pos,v=h.pos,x=f.nodeAfter,b=h.nodeBefore,w=x&&x.isText?/^\s*/.exec(x.text)[0].length:0,S=b&&b.isText?/\s*$/.exec(b.text)[0].length:0;m+w<v&&(m+=w,v-=S),u.addMark(m,v,e.create(t))}}i(u.scrollIntoView())}return!0}}function Nv(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}let ox=Nv(xD,bD,fQ),K_=Nv(xD,hQ,mQ);const vi={Enter:Nv(gQ,vQ,yQ,bQ),"Mod-Enter":kD,Backspace:ox,"Mod-Backspace":ox,"Shift-Backspace":ox,Delete:K_,"Mod-Delete":K_,"Mod-a":SQ},_D={"Ctrl-h":vi.Backspace,"Alt-Backspace":vi["Mod-Backspace"],"Ctrl-d":vi.Delete,"Ctrl-Alt-Backspace":vi["Mod-Delete"],"Alt-Delete":vi["Mod-Delete"],"Alt-d":vi["Mod-Delete"],"Ctrl-a":CQ,"Ctrl-e":EQ};for(let e in vi)_D[e]=vi[e];const OQ=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,ix=OQ?_D:vi;var na={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:"'"},dg={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},NQ=typeof navigator<"u"&&/Mac/.test(navigator.platform),MQ=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var dn=0;dn<10;dn++)na[48+dn]=na[96+dn]=String(dn);for(var dn=1;dn<=24;dn++)na[dn+111]="F"+dn;for(var dn=65;dn<=90;dn++)na[dn]=String.fromCharCode(dn+32),dg[dn]=String.fromCharCode(dn);for(var sx in na)dg.hasOwnProperty(sx)||(dg[sx]=na[sx]);function PQ(e){var t=NQ&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||MQ&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?dg:na)[e.keyCode]||e.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const RQ=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function jQ(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n=="Space"&&(n=" ");let r,o,i,s;for(let a=0;a<t.length-1;a++){let l=t[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))o=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))RQ?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function AQ(e){let t=Object.create(null);for(let n in e)t[jQ(n)]=e[n];return t}function ax(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 TD(e){let t=AQ(e);return function(n,r){let o=PQ(r),i,s=t[ax(o,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=t[ax(o,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||o.charCodeAt(0)>127)&&(i=na[r.keyCode])&&i!=o){let a=t[ax(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}function IQ(e){const t=ol(e,(i,s)=>(s.priority??et.Low)-(i.priority??et.Low)),n=[],r=[];for(const i of t)VQ(i)?n.push(i):r.push(i);let o;return new Vi({key:DQ,view:i=>(o=i,{}),props:{transformPasted:i=>{var c,u,d;const s=o.state.selection.$from,a=s.node().type.name,l=new Set(s.marks().map(f=>f.type.name));for(const f of n){if((c=f.ignoredNodes)!=null&&c.includes(a)||(u=f.ignoredMarks)!=null&&u.some(w=>l.has(w)))continue;const h=((d=i.content.firstChild)==null?void 0:d.textContent)??"",m=!o.state.selection.empty&&i.content.childCount===1&&h,v=xv(h,f.regexp)[0];if(m&&v&&f.type==="mark"&&f.replaceSelection){const{from:w,to:S}=o.state.selection,k=o.state.doc.slice(w,S),C=k.content.textBetween(0,k.content.size);if(typeof f.replaceSelection!="boolean"?f.replaceSelection(C):f.replaceSelection){const T=[],{getAttributes:_,markType:O}=f,M=ft(_)?_(v,!0):_,j=O.create(M);return k.content.forEach(L=>{if(L.isText){const B=j.addToSet(L.marks);T.push(L.mark(B))}}),X.maxOpen(D.fromArray(T))}}const{nodes:x,transformed:b}=$Q(i.content,f,o.state.schema);b&&(i=f.type==="node"&&f.nodeType.isBlock?new X(D.fromArray(x),0,0):new X(D.fromArray(x),i.openStart,i.openEnd))}return KQ(i)},handleDOMEvents:{paste:(i,s)=>{var d,f;const a=s;if(!((f=(d=i.props).editable)!=null&&f.call(d,i.state)))return!1;const{clipboardData:l}=a;if(!l)return!1;const c=[...l.items].map(h=>h.getAsFile()).filter(h=>!!h);if(c.length===0)return!1;const{selection:u}=i.state;for(const{fileHandler:h,regexp:m}of r){const v=m?c.filter(x=>m.test(x.type)):c;if(v.length!==0&&h({event:a,files:v,selection:u,view:i,type:"paste"}))return a.preventDefault(),!0}return!1},drop:(i,s)=>{var h,m,v;const a=s;if(!((m=(h=i.props).editable)!=null&&m.call(h,i.state)))return!1;const{dataTransfer:l,clientX:c,clientY:u}=a;if(!l)return!1;const d=HQ(a);if(d.length===0)return!1;const f=((v=i.posAtCoords({left:c,top:u}))==null?void 0:v.pos)??i.state.selection.anchor;for(const{fileHandler:x,regexp:b}of r){const w=b?d.filter(S=>b.test(S.type)):d;if(w.length!==0&&x({event:a,files:w,pos:f,view:i,type:"drop"}))return a.preventDefault(),!0}return!1}}}})}var DQ=new pu("pasteRule");function lx(e,t){return function n(r){const{fragment:o,rule:i,nodes:s}=r,{regexp:a,ignoreWhitespace:l,ignoredMarks:c,ignoredNodes:u}=i;let d=!1;return o.forEach(f=>{if(u!=null&&u.includes(f.type.name)||UQ(f)){s.push(f);return}if(!f.isText){const v=n({fragment:f.content,rule:i,nodes:[]});d||(d=v.transformed);const x=D.fromArray(v.nodes);f.type.validContent(x)?s.push(f.copy(x)):s.push(...v.nodes);return}if(f.marks.some(v=>WQ(v)||(c==null?void 0:c.includes(v.type.name)))){s.push(f);return}const h=f.text??"";let m=0;for(const v of xv(h,a)){const x=v[1],b=v[0];if(l&&(x==null?void 0:x.trim())===""||!b)return;const w=v.index,S=w+b.length;w>m&&s.push(f.cut(m,w));let k=f.cut(w,S);if(b&&x){const C=b.search(/\S/),T=w+b.indexOf(x),_=T+x.length;C&&s.push(f.cut(w,w+C)),k=f.cut(T,_)}e({nodes:s,rule:i,textNode:k,match:v,schema:t}),d=!0,m=S}h&&m<h.length&&s.push(f.cut(m))}),{nodes:s,transformed:d}}}function LQ(e){const{nodes:t,rule:n,textNode:r,match:o,schema:i}=e,{transformMatch:s,getAttributes:a,markType:l}=n,c=ft(a)?a(o,!1):a,u=r.text??"",d=l.create(c),f=s==null?void 0:s(o);if(f==="")return;if(f===!1){t.push(i.text(u,r.marks));return}const h=d.addToSet(r.marks);t.push(i.text(f??u,h))}function FQ(e){const{nodes:t,rule:n,textNode:r,match:o,schema:i}=e,{transformMatch:s}=n,a=s==null?void 0:s(o);if(a===""||a===!1)return;const l=a??r.text??"";t.push(i.text(l,r.marks))}function zQ(e){const{nodes:t,rule:n,textNode:r,match:o}=e,{getAttributes:i,nodeType:s,getContent:a}=n,l=ft(i)?i(o,!1):i,c=(a?a(o):r)||void 0;t.push(s.createChecked(l,c))}function $Q(e,t,n){const r=[];switch(t.type){case"mark":return lx(LQ,n)({fragment:e,nodes:r,rule:t});case"node":return lx(zQ,n)({fragment:e,nodes:r,rule:t});default:return lx(FQ,n)({fragment:e,nodes:r,rule:t})}}var BQ=["mark","node","text"];function VQ(e){return Do(BQ,e.type)}function UQ(e){var t;return e.type.spec.code||((t=e.type.spec.group)==null?void 0:t.split(" ").includes("code"))}function WQ(e){var t;return e.type.name==="code"||((t=e.type.spec.group)==null?void 0:t.split(" ").includes("code"))}function HQ(e){var n,r;const{dataTransfer:t}=e;return t?((n=t.files)==null?void 0:n.length)>0?[...t.files]:(r=t.items)!=null&&r.length?[...t.items].map(o=>o.getAsFile()).filter(o=>!!o):[]:[]}function KQ(e){const t=X.maxOpen(e.content);return t.openStart<e.openStart||t.openEnd<e.openEnd?t:e}var qQ=Object.defineProperty,GQ=Object.getOwnPropertyDescriptor,le=(e,t,n,r)=>{for(var o=r>1?void 0:r?GQ(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&qQ(t,n,o),o},OD=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Q=(e,t,n)=>(OD(e,t,"read from private field"),n?n.call(e):t.get(e)),Mt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Gt=(e,t,n,r)=>(OD(e,t,"write to private field"),t.set(e,n),n);function YQ(e,t){return e===t}function q_(e){const{previousOptions:t,update:n,equals:r=YQ}=e,o=Ra({...t,...n}),i=he(),s=Nf(t);for(const l of s){const c=t[l],u=o[l];if(r(c,u)){i[l]={changed:!1};continue}i[l]={changed:!0,previousValue:c,value:u}}const a=l=>{const c=he();for(const u of l){const d=i[u];d!=null&&d.changed&&(c[u]=d.value)}return c};return{changes:Ra(i),options:o,pickChanged:a}}var JQ={[K.DUPLICATE_HELPER_NAMES]:"helper method",[K.DUPLICATE_COMMAND_NAMES]:"command method"};function ND(e){const{name:t,set:n,code:r}=e,o=JQ[r];xe(!n.has(t),{code:r,message:`There is a naming conflict for the name: ${t} used in this '${o}'. Please rename or remove from the editor to avoid runtime errors.`}),n.add(t)}function fb(...e){return Mf(uQ(...e).split(" ")).join(" ")}var G_="__IGNORE__",XQ="__ALL__",gu=class{constructor(e,...[t]){this["~O"]={},this._mappedHandlers=he(),this.populateMappedHandlers(),this._options=this._initialOptions=RG(e,this.constructor.defaultOptions,t??he(),this.createDefaultHandlerOptions()),this._dynamicKeys=this.getDynamicKeys(),this.init()}get options(){return this._options}get dynamicKeys(){return this._dynamicKeys}get initialOptions(){return this._initialOptions}init(){}getDynamicKeys(){const e=[],{customHandlerKeys:t,handlerKeys:n,staticKeys:r}=this.constructor;for(const o of Nf(this._options))r.includes(o)||n.includes(o)||t.includes(o)||e.push(o);return e}ensureAllKeysAreDynamic(e){}setOptions(e){var t;const n=this.getDynamicOptions();this.ensureAllKeysAreDynamic(e);const{changes:r,options:o,pickChanged:i}=q_({previousOptions:n,update:e});this.updateDynamicOptions(o),(t=this.onSetOptions)==null||t.call(this,{reason:"set",changes:r,options:o,pickChanged:i,initialOptions:this._initialOptions})}resetOptions(){var e;const t=this.getDynamicOptions(),{changes:n,options:r,pickChanged:o}=q_({previousOptions:t,update:this._initialOptions});this.updateDynamicOptions(r),(e=this.onSetOptions)==null||e.call(this,{reason:"reset",options:r,changes:n,pickChanged:o,initialOptions:this._initialOptions})}getDynamicOptions(){return V1(this._options,[...this.constructor.customHandlerKeys,...this.constructor.handlerKeys])}updateDynamicOptions(e){this._options={...this._options,...e}}populateMappedHandlers(){for(const e of this.constructor.handlerKeys)this._mappedHandlers[e]=[]}createDefaultHandlerOptions(){const e=he();for(const t of this.constructor.handlerKeys)e[t]=(...n)=>{var r;const{handlerKeyOptions:o}=this.constructor,i=(r=o[t])==null?void 0:r.reducer;let s=i==null?void 0:i.getDefault(...n);for(const[,a]of this._mappedHandlers[t]){const l=a(...n);if(s=i?i.accumulator(s,l,...n):l,ZQ(o,s,t))return s}return s};return e}addHandler(e,t,n=et.Default){return this._mappedHandlers[e].push([n,t]),this.sortHandlers(e),()=>this._mappedHandlers[e]=this._mappedHandlers[e].filter(([,r])=>r!==t)}hasHandlers(e){return(this._mappedHandlers[e]??[]).length>0}sortHandlers(e){this._mappedHandlers[e]=ol(this._mappedHandlers[e],([t],[n])=>n-t)}addCustomHandler(e,t){var n;return((n=this.onAddCustomHandler)==null?void 0:n.call(this,{[e]:t}))??RA}};gu.defaultOptions={};gu.staticKeys=[];gu.handlerKeys=[];gu.handlerKeyOptions={};gu.customHandlerKeys=[];function ZQ(e,t,n){const{[XQ]:r}=e,o=e[n];return!r&&!o?!1:!!(o&&o.earlyReturnValue!==G_&&(ft(o.earlyReturnValue)?o.earlyReturnValue(t)===!0:t===o.earlyReturnValue)||r&&r.earlyReturnValue!==G_&&(ft(r.earlyReturnValue)?r.earlyReturnValue(t)===!0:t===r.earlyReturnValue))}var Mv=class extends gu{constructor(...e){super(QQ,...e),this["~E"]={},this._extensions=jA(this.createExtensions(),t=>t.constructor),this.extensionMap=new Map;for(const t of this._extensions)this.extensionMap.set(t.constructor,t)}get priority(){return this.priorityOverride??this.options.priority??this.constructor.defaultPriority}get constructorName(){return`${OA(this.name)}Extension`}get store(){return xe(this._store,{code:K.MANAGER_PHASE_ERROR,message:"An error occurred while attempting to access the 'extension.store' when the Manager has not yet set created the lifecycle methods."}),Ra(this._store,{requireKeys:!0})}get extensions(){return this._extensions}replaceChildExtension(e,t){this.extensionMap.has(e)&&(this.extensionMap.set(e,t),this._extensions=this.extensions.map(n=>t.constructor===e?t:n))}createExtensions(){return[]}getExtension(e){const t=this.extensionMap.get(e);return xe(t,{code:K.INVALID_GET_EXTENSION,message:`'${e.name}' does not exist within the preset: '${this.name}'`}),t}isOfType(e){return this.constructor===e}setStore(e){this._store||(this._store=e)}clone(...e){return new this.constructor(...e)}setPriority(e){this.priorityOverride=e}};Mv.defaultPriority=et.Default;var pt=class extends Mv{static get[Li](){return en.PlainExtensionConstructor}get[Li](){return en.PlainExtension}},Tp=class extends Mv{static get[Li](){return en.MarkExtensionConstructor}get[Li](){return en.MarkExtension}get type(){return vt(this.store.schema.marks,this.name)}constructor(...e){super(...e)}};Tp.disableExtraAttributes=!1;var to=class extends Mv{static get[Li](){return en.NodeExtensionConstructor}get[Li](){return en.NodeExtension}get type(){return vt(this.store.schema.nodes,this.name)}constructor(...e){super(...e)}};to.disableExtraAttributes=!1;var QQ={priority:void 0,extraAttributes:{},disableExtraAttributes:!1,exclude:{}};function MD(e){return hu(e)&&mu(e,[en.PlainExtension,en.MarkExtension,en.NodeExtension])}function eee(e){return hu(e)&&mu(e,[en.PlainExtensionConstructor,en.MarkExtensionConstructor,en.NodeExtensionConstructor])}function PD(e){return hu(e)&&mu(e,en.PlainExtension)}function Op(e){return hu(e)&&mu(e,en.NodeExtension)}function Pv(e){return hu(e)&&mu(e,en.MarkExtension)}function Ge(e){return t=>{const{defaultOptions:n,customHandlerKeys:r,handlerKeys:o,staticKeys:i,defaultPriority:s,handlerKeyOptions:a,...l}=e,c=t;n&&(c.defaultOptions=n),s&&(c.defaultPriority=s),a&&(c.handlerKeyOptions=a),c.staticKeys=i??[],c.handlerKeys=o??[],c.customHandlerKeys=r??[];for(const[u,d]of Object.entries(l))c[u]||(c[u]=d);return c}}var tee=class extends pt{constructor(){super(...arguments),this.attributeList=[],this.attributeObject=he(),this.updateAttributes=(e=!0)=>{this.transformAttributes(),e&&this.store.commands.forceUpdate("attributes")}}get name(){return"attributes"}onCreate(){this.transformAttributes(),this.store.setExtensionStore("updateAttributes",this.updateAttributes)}transformAttributes(){var e,t,n;if(this.attributeObject=he(),(e=this.store.managerSettings.exclude)!=null&&e.attributes){this.store.setStoreKey("attributes",this.attributeObject);return}this.attributeList=[];for(const r of this.store.extensions){if((t=r.options.exclude)!=null&&t.attributes)continue;const o=(n=r.createAttributes)==null?void 0:n.call(r),i={...o,class:fb(...r.classNames??[],o==null?void 0:o.class)};this.attributeList.unshift(i)}for(const r of this.attributeList)this.attributeObject={...this.attributeObject,...r,class:fb(this.attributeObject.class,r.class)};this.store.setStoreKey("attributes",this.attributeObject)}};function Ct(e={}){return(t,n,r)=>{(t.decoratedHelpers??(t.decoratedHelpers={}))[n]=e}}function de(e={}){return(t,n,r)=>{(t.decoratedCommands??(t.decoratedCommands={}))[n]=e}}function Ar(e){return(t,n,r)=>{(t.decoratedKeybindings??(t.decoratedKeybindings={}))[n]=e}}var nee=class{constructor(e){this.promiseCreator=e,this.failureHandlers=[],this.successHandlers=[],this.validateHandlers=[],this.generateCommand=()=>t=>{let n=!0;const{view:r,tr:o,dispatch:i}=t;if(!r)return!1;for(const a of this.validateHandlers)if(!a({...t,dispatch:()=>{}})){n=!1;break}return!i||!n?n:(this.promiseCreator(t).then(a=>{this.runHandlers(this.successHandlers,{value:a,state:r.state,tr:r.state.tr,dispatch:r.dispatch,view:r})}).catch(a=>{this.runHandlers(this.failureHandlers,{error:a,state:r.state,tr:r.state.tr,dispatch:r.dispatch,view:r})}),i(o),!0)}}validate(e,t="push"){return this.validateHandlers[t](e),this}success(e,t="push"){return this.successHandlers[t](e),this}failure(e,t="push"){return this.failureHandlers[t](e),this}runHandlers(e,t){var n;for(const r of e)if(!r({...t,dispatch:()=>{}}))break;(n=t.dispatch)==null||n.call(t,t.tr)}};function Ff(e){const{type:t,attrs:n,range:r,selection:o}=e;return i=>{const{dispatch:s,tr:a,state:l}=i,c=_e(t)?l.schema.marks[t]:t;if(xe(c,{code:K.SCHEMA,message:`Mark type: ${t} does not exist on the current schema.`}),r||o){const{from:u,to:d}=Jr(o??r??a.selection,a.doc);return lg({trState:a,type:t,...r})?s==null||s(a.removeMark(u,d,c)):s==null||s(a.addMark(u,d,c.create(n))),!0}return Fd(TQ(c,n))(i)}}function ree(e,t,n){for(const{$from:r,$to:o}of n){let i=r.depth===0?t.type.allowsMarkType(e):!1;if(t.nodesBetween(r.pos,o.pos,s=>{if(i)return!1;i=s.inlineContent&&s.type.allowsMarkType(e)}),i)return!0}return!1}function oee(e,t,n){return({tr:r,dispatch:o,state:i})=>{const s=Jr(n??r.selection,r.doc),a=WZ(s),l=_e(e)?i.schema.marks[e]:e;if(xe(l,{code:K.SCHEMA,message:`Mark type: ${e} does not exist on the current schema.`}),s.empty&&!a||!ree(l,r.doc,s.ranges))return!1;if(!o)return!0;if(a)return r.removeStoredMark(l),t&&r.addStoredMark(l.create(t)),o(r),!0;let c=!1;for(const{$from:u,$to:d}of s.ranges){if(c)break;c=r.doc.rangeHasMark(u.pos,d.pos,l)}for(const{$from:u,$to:d}of s.ranges)c&&r.removeMark(u.pos,d.pos,l),t&&r.addMark(u.pos,d.pos,l.create(t));return o(r),!0}}function iee(e,t={}){return({tr:n,dispatch:r,state:o})=>{const i=o.schema,s=n.selection,{from:a=s.from,to:l=a??s.to,marks:c={}}=t;if(!r)return!0;n.insertText(e,a,l);const u=vt(n.steps,n.steps.length-1).getMap().map(l);for(const[d,f]of $t(c))n.addMark(a,u,vt(i.marks,d).create(f));return r(n),!0}}var Fe=class extends pt{constructor(){super(...arguments),this.decorated=new Map,this.forceUpdateTransaction=(e,...t)=>{const{forcedUpdates:n}=this.getCommandMeta(e);return this.setCommandMeta(e,{forcedUpdates:Mf([...n,...t])}),e}}get name(){return"commands"}get transaction(){const e=this.store.getState();this._transaction||(this._transaction=e.tr);const t=this._transaction.before.eq(e.doc),n=!ea(this._transaction.steps);if(!t){const r=e.tr;if(n)for(const o of this._transaction.steps)r.step(o);this._transaction=r}return this._transaction}onCreate(){this.store.setStoreKey("getForcedUpdates",this.getForcedUpdates.bind(this))}onView(e){var t;const{extensions:n,helpers:r}=this.store,o=he(),i=new Set;let s=he();const a=c=>{var u;const d=he(),f=()=>c??this.transaction;let h=[];const m=()=>h;for(const[x,b]of Object.entries(o))(u=s[x])!=null&&u.disableChaining||(d[x]=this.chainedFactory({chain:d,command:b.original,getTr:f,getChain:m}));const v=x=>{xe(x===f(),{message:"Chaining currently only supports `CommandFunction` methods which do not use the `state.tr` property. Instead you should use the provided `tr` property."})};return d.run=(x={})=>{const b=h;h=[];for(const w of b)if(!w(v)&&x.exitEarly)return;e.dispatch(f())},d.tr=()=>{const x=h;h=[];for(const b of x)b(v);return f()},d.enabled=()=>{for(const x of h)if(!x())return!1;return!0},d.new=x=>a(x),d};for(const c of n){const u=((t=c.createCommands)==null?void 0:t.call(c))??{},d=c.decoratedCommands??{},f={};s={...s,decoratedCommands:d};for(const[h,m]of Object.entries(d)){const v=_e(m.shortcut)&&m.shortcut.startsWith("_|")?{shortcut:r.getNamedShortcut(m.shortcut,c.options)}:void 0;this.updateDecorated(h,{...m,name:c.name,...v}),u[h]=c[h].bind(c),m.active&&(f[h]=()=>{var x;return((x=m.active)==null?void 0:x.call(m,c.options,this.store))??!1})}Hm(u)||this.addCommands({active:f,names:i,commands:o,extensionCommands:u})}const l=a();for(const[c,u]of Object.entries(l))a[c]=u;this.store.setStoreKey("commands",o),this.store.setStoreKey("chain",a),this.store.setExtensionStore("commands",o),this.store.setExtensionStore("chain",a)}onStateUpdate({state:e}){this._transaction=e.tr}createPlugin(){return{}}customDispatch(e){return e}insertText(e,t={}){return _e(e)?iee(e,t):this.store.createPlaceholderCommand({promise:e,placeholder:{type:"inline"},onSuccess:(n,r,o)=>this.insertText(n,{...t,...r})(o)}).generateCommand()}selectText(e,t={}){return({tr:n,dispatch:r})=>{const o=Jr(e,n.doc);return n.selection.anchor===o.anchor&&n.selection.head===o.head&&!t.forceUpdate?!1:(r==null||r(n.setSelection(o)),!0)}}selectMark(e){return t=>{const{tr:n}=t,r=Fi(n.selection.$from,e);return r?this.store.commands.selectText.original({from:r.from,to:r.to})(t):!1}}delete(e){return({tr:t,dispatch:n})=>{const{from:r,to:o}=e??t.selection;return n==null||n(t.delete(r,o)),!0}}emptyUpdate(e){return({tr:t,dispatch:n})=>(n&&(e==null||e(),n(t)),!0)}forceUpdate(...e){return({tr:t,dispatch:n})=>(n==null||n(this.forceUpdateTransaction(t,...e)),!0)}updateNodeAttributes(e,t){return({tr:n,dispatch:r})=>(r==null||r(n.setNodeMarkup(e,void 0,t)),!0)}setContent(e,t){return n=>{const{tr:r,dispatch:o}=n,i=this.store.manager.createState({content:e,selection:t});return i?(o==null||o(r.replaceRangeWith(0,r.doc.nodeSize-2,i.doc)),!0):!1}}resetContent(){return e=>{const{tr:t,dispatch:n}=e,r=this.store.manager.createEmptyDoc();return r?this.setContent(r)(e):(n==null||n(t.delete(0,t.doc.nodeSize)),!0)}}emptySelection(){return({tr:e,dispatch:t})=>e.selection.empty?!1:(t==null||t(e.setSelection(Oe.near(e.selection.$anchor))),!0)}insertNewLine(){return({dispatch:e,tr:t})=>gl(t.selection)?(e==null||e(t.insertText(`
361
- `)),!0):!1}insertNode(e,t={}){return({dispatch:n,tr:r,state:o})=>{var i;const{attrs:s,range:a,selection:l,replaceEmptyParentBlock:c=!1}=t,{from:u,to:d,$from:f}=Jr(l??a??r.selection,r.doc);if(Ev(e)||AZ(e)){const b=f.before(f.depth);return n==null||n(c&&u===d&&fS(f.parent)?r.replaceWith(b,b+f.parent.nodeSize,e):r.replaceWith(u,d,e)),!0}const h=_e(e)?o.schema.nodes[e]:e;xe(h,{code:K.SCHEMA,message:`The requested node type ${e} does not exist in the schema.`});const m=(i=t.marks)==null?void 0:i.map(b=>{if(b instanceof He)return b;const w=_e(b)?o.schema.marks[b]:b;return xe(w,{code:K.SCHEMA,message:`The requested mark type ${b} does not exist in the schema.`}),w.create()}),v=h.createAndFill(s,_e(t.content)?o.schema.text(t.content):t.content,m);if(!v)return!1;const x=u!==d;return n==null||n(x?r.replaceRangeWith(u,d,v):r.insert(u,v)),!0}}focus(e){return t=>{const{dispatch:n,tr:r}=t,{view:o}=this.store;if(e===!1||o.hasFocus()&&(e===void 0||e===!0))return!1;if(e===void 0||e===!0){const{from:i=0,to:s=i}=r.selection;e={from:i,to:s}}return n&&this.delayedFocus(),this.selectText(e)(t)}}blur(e){return t=>{const{view:n}=this.store;return n.hasFocus()?(requestAnimationFrame(()=>{n.dom.blur()}),e?this.selectText(e)(t):!0):!1}}setBlockNodeType(e,t,n,r=!0){return cg(e,t,n,r)}toggleWrappingNode(e,t,n){return oQ(e,t,n)}toggleBlockNodeItem(e){return gD(e)}wrapInNode(e,t,n){return mD(e,t,n)}applyMark(e,t,n){return oee(e,t,n)}toggleMark(e){return Ff(e)}removeMark(e){return yD(e)}setMeta(e,t){return({tr:n})=>(n.setMeta(e,t),!0)}selectAll(){return this.selectText("all")}copy(){return e=>e.tr.selection.empty?!1:(e.dispatch&&document.execCommand("copy"),!0)}paste(){return this.store.createPlaceholderCommand({promise:async()=>{var e;return(e=navigator.clipboard)!=null&&e.readText?await navigator.clipboard.readText():""},placeholder:{type:"inline"},onSuccess:(e,t,n)=>this.insertNode(ub({content:e,schema:n.state.schema}),{selection:t})(n)}).generateCommand()}cut(){return e=>e.tr.selection.empty?!1:(e.dispatch&&document.execCommand("cut"),!0)}replaceText(e){return aQ(e)}getAllCommandOptions(){const e={};for(const[t,n]of this.decorated)Hm(n)||(e[t]=n);return e}getCommandOptions(e){return this.decorated.get(e)}getCommandProp(){return{tr:this.transaction,dispatch:this.store.view.dispatch,state:this.store.view.state,view:this.store.view}}updateDecorated(e,t){if(!t){this.decorated.delete(e);return}const n=this.decorated.get(e)??{name:""};this.decorated.set(e,{...n,...t})}handleIosFocus(){yo.isIos&&this.store.view.dom.focus()}delayedFocus(){this.handleIosFocus(),requestAnimationFrame(()=>{this.store.view.focus(),this.store.view.dispatch(this.transaction.scrollIntoView())})}getForcedUpdates(e){return this.getCommandMeta(e).forcedUpdates}getCommandMeta(e){const t=e.getMeta(this.pluginKey)??{};return{...see,...t}}setCommandMeta(e,t){const n=this.getCommandMeta(e);e.setMeta(this.pluginKey,{...n,...t})}addCommands(e){const{extensionCommands:t,commands:n,names:r,active:o}=e;for(const[i,s]of $t(t))ND({name:i,set:r,code:K.DUPLICATE_COMMAND_NAMES}),xe(!aee.has(i),{code:K.DUPLICATE_COMMAND_NAMES,message:"The command name you chose is forbidden."}),n[i]=this.createUnchainedCommand(s,o[i])}unchainedFactory(e){return(...t)=>{const{shouldDispatch:n=!0,command:r}=e,{view:o}=this.store,{state:i}=o;let s;return n&&(s=o.dispatch),r(...t)({state:i,dispatch:s,view:o,tr:i.tr})}}createUnchainedCommand(e,t){const n=this.unchainedFactory({command:e});return n.enabled=this.unchainedFactory({command:e,shouldDispatch:!1}),n.isEnabled=n.enabled,n.original=e,n.active=t,n}chainedFactory(e){return(...t)=>{const{chain:n,command:r,getTr:o,getChain:i}=e,s=i(),{view:a}=this.store,{state:l}=a;return s.push(c=>r(...t)({state:l,dispatch:c,view:a,tr:o()})),n}}};le([de()],Fe.prototype,"customDispatch",1);le([de()],Fe.prototype,"insertText",1);le([de()],Fe.prototype,"selectText",1);le([de()],Fe.prototype,"selectMark",1);le([de()],Fe.prototype,"delete",1);le([de()],Fe.prototype,"emptyUpdate",1);le([de()],Fe.prototype,"forceUpdate",1);le([de()],Fe.prototype,"updateNodeAttributes",1);le([de()],Fe.prototype,"setContent",1);le([de()],Fe.prototype,"resetContent",1);le([de()],Fe.prototype,"emptySelection",1);le([de()],Fe.prototype,"insertNewLine",1);le([de()],Fe.prototype,"insertNode",1);le([de()],Fe.prototype,"focus",1);le([de()],Fe.prototype,"blur",1);le([de()],Fe.prototype,"setBlockNodeType",1);le([de()],Fe.prototype,"toggleWrappingNode",1);le([de()],Fe.prototype,"toggleBlockNodeItem",1);le([de()],Fe.prototype,"wrapInNode",1);le([de()],Fe.prototype,"applyMark",1);le([de()],Fe.prototype,"toggleMark",1);le([de()],Fe.prototype,"removeMark",1);le([de()],Fe.prototype,"setMeta",1);le([de({description:({t:e})=>e(ta.SELECT_ALL_DESCRIPTION),label:({t:e})=>e(ta.SELECT_ALL_LABEL),shortcut:G.SelectAll})],Fe.prototype,"selectAll",1);le([de({description:({t:e})=>e(ta.COPY_DESCRIPTION),label:({t:e})=>e(ta.COPY_LABEL),shortcut:G.Copy,icon:"fileCopyLine"})],Fe.prototype,"copy",1);le([de({description:({t:e})=>e(ta.PASTE_DESCRIPTION),label:({t:e})=>e(ta.PASTE_LABEL),shortcut:G.Paste,icon:"clipboardLine"})],Fe.prototype,"paste",1);le([de({description:({t:e})=>e(ta.CUT_DESCRIPTION),label:({t:e})=>e(ta.CUT_LABEL),shortcut:G.Cut,icon:"scissorsFill"})],Fe.prototype,"cut",1);le([de()],Fe.prototype,"replaceText",1);le([Ct()],Fe.prototype,"getAllCommandOptions",1);le([Ct()],Fe.prototype,"getCommandOptions",1);le([Ct()],Fe.prototype,"getCommandProp",1);Fe=le([Ge({defaultPriority:et.Highest,defaultOptions:{trackerClassName:"remirror-tracker-position",trackerNodeName:"span"},staticKeys:["trackerClassName","trackerNodeName"]})],Fe);var see={forcedUpdates:[]},aee=new Set(["run","chain","original","raw","enabled","tr","new"]),Fo=class extends pt{constructor(){super(...arguments),this.placeholders=Ye.empty,this.placeholderWidgets=new Map,this.createPlaceholderCommand=e=>{const t=qm(),{promise:n,placeholder:r,onFailure:o,onSuccess:i}=e;return new nee(n).validate(s=>this.addPlaceholder(t,r)(s)).success(s=>{const{state:a,tr:l,dispatch:c,view:u,value:d}=s,f=this.store.helpers.findPlaceholder(t);if(!f){const h=new Error("The placeholder has been removed");return(o==null?void 0:o({error:h,state:a,tr:l,dispatch:c,view:u}))??!1}return this.removePlaceholder(t)({state:a,tr:l,view:u,dispatch:()=>{}}),i(d,f,{state:a,tr:l,dispatch:c,view:u})}).failure(s=>(this.removePlaceholder(t)({...s,dispatch:()=>{}}),(o==null?void 0:o(s))??!1))}}get name(){return"decorations"}onCreate(){this.store.setExtensionStore("createPlaceholderCommand",this.createPlaceholderCommand)}createPlugin(){return{state:{init:()=>{},apply:e=>{var t,n,r,o,i,s;const{added:a,clearTrackers:l,removed:c,updated:u}=this.getMeta(e);if(l){this.placeholders=Ye.empty;for(const[,d]of this.placeholderWidgets)(n=(t=d.spec).onDestroy)==null||n.call(t,this.store.view,d.spec.element);this.placeholderWidgets.clear();return}this.placeholders=this.placeholders.map(e.mapping,e.doc,{onRemove:d=>{var f,h;const m=this.placeholderWidgets.get(d.id);m&&((h=(f=m.spec).onDestroy)==null||h.call(f,this.store.view,m.spec.element))}});for(const[,d]of this.placeholderWidgets)(o=(r=d.spec).onUpdate)==null||o.call(r,this.store.view,d.from,d.spec.element,d.spec.data);for(const d of a){if(d.type==="inline"){this.addInlinePlaceholder(d,e);continue}if(d.type==="node"){this.addNodePlaceholder(d,e);continue}if(d.type==="widget"){this.addWidgetPlaceholder(d,e);continue}}for(const{id:d,data:f}of u){const h=this.placeholderWidgets.get(d);if(!h)continue;const m=dt.widget(h.from,h.spec.element,{...h.spec,data:f});this.placeholders=this.placeholders.remove([h]).add(e.doc,[m]),this.placeholderWidgets.set(d,m)}for(const d of c){const f=this.placeholders.find(void 0,void 0,m=>m.id===d&&m.__type===Rl),h=this.placeholderWidgets.get(d);h&&((s=(i=h.spec).onDestroy)==null||s.call(i,this.store.view,h.spec.element)),this.placeholders=this.placeholders.remove(f),this.placeholderWidgets.delete(d)}}},props:{decorations:e=>{let t=this.options.decorations(e);t=t.add(e.doc,this.placeholders.find());for(const n of this.store.extensions){if(!n.createDecorations)continue;const r=n.createDecorations(e).find();t=t.add(e.doc,r)}return t},handleDOMEvents:{blur:e=>(this.options.persistentSelectionClass&&e.dispatch(e.state.tr.setMeta(Y_,!1)),!1),focus:e=>(this.options.persistentSelectionClass&&e.dispatch(e.state.tr.setMeta(Y_,!0)),!1)}}}}updateDecorations(){return({tr:e,dispatch:t})=>(t==null||t(e),!0)}addPlaceholder(e,t,n){return({dispatch:r,tr:o})=>this.addPlaceholderTransaction(e,t,o,!r)?(r==null||r(n?o.deleteSelection():o),!0):!1}updatePlaceholder(e,t){return({dispatch:n,tr:r})=>this.updatePlaceholderTransaction({id:e,data:t,tr:r,checkOnly:!n})?(n==null||n(r),!0):!1}removePlaceholder(e){return({dispatch:t,tr:n})=>this.removePlaceholderTransaction({id:e,tr:n,checkOnly:!t})?(t==null||t(n),!0):!1}clearPlaceholders(){return({tr:e,dispatch:t})=>this.clearPlaceholdersTransaction({tr:e,checkOnly:!t})?(t==null||t(e),!0):!1}findPlaceholder(e){return this.findAllPlaceholders().get(e)}findAllPlaceholders(){const e=new Map,t=this.placeholders.find(void 0,void 0,n=>n.__type===Rl);for(const n of t)e.set(n.spec.id,{from:n.from,to:n.to});return e}createDecorations(e){var t,n,r;const{persistentSelectionClass:o}=this.options;return!o||(t=this.store.view)!=null&&t.hasFocus()||(r=(n=this.store.helpers).isInteracting)!=null&&r.call(n)?Ye.empty:cee(e,Ye.empty,{class:_e(o)?o:"selection"})}onApplyState(){}addWidgetPlaceholder(e,t){const{pos:n,createElement:r,onDestroy:o,onUpdate:i,className:s,nodeName:a,id:l,type:c}=e,u=(r==null?void 0:r(this.store.view,n))??document.createElement(a);u.classList.add(s);const d=dt.widget(n,u,{id:l,__type:Rl,type:c,element:u,onDestroy:o,onUpdate:i});this.placeholderWidgets.set(l,d),this.placeholders=this.placeholders.add(t.doc,[d])}addInlinePlaceholder(e,t){const{from:n=t.selection.from,to:r=t.selection.to,className:o,nodeName:i,id:s,type:a}=e;let l;if(n===r){const c=document.createElement(i);c.classList.add(o),l=dt.widget(n,c,{id:s,type:a,__type:Rl,widget:c})}else l=dt.inline(n,r,{nodeName:i,class:o},{id:s,__type:Rl});this.placeholders=this.placeholders.add(t.doc,[l])}addNodePlaceholder(e,t){const{pos:n,className:r,nodeName:o,id:i}=e,s=Pr(n)?t.doc.resolve(n):t.selection.$from,a=Pr(n)?s.nodeAfter?{pos:n,end:s.nodeAfter.nodeSize}:void 0:CZ(s);if(!a)return;const l=dt.node(a.pos,a.end,{nodeName:o,class:r},{id:i,__type:Rl});this.placeholders=this.placeholders.add(t.doc,[l])}withRequiredBase(e,t){const{placeholderNodeName:n,placeholderClassName:r}=this.options,{nodeName:o=n,className:i,...s}=t,a=(i?[r,i]:[r]).join(" ");return{nodeName:o,className:a,...s,id:e}}getMeta(e){const t=e.getMeta(this.pluginKey)??{};return{...lee,...t}}setMeta(e,t){const n=this.getMeta(e);e.setMeta(this.pluginKey,{...n,...t})}addPlaceholderTransaction(e,t,n,r=!1){if(this.findPlaceholder(e))return!1;if(r)return!0;const{added:i}=this.getMeta(n);return this.setMeta(n,{added:[...i,this.withRequiredBase(e,t)]}),!0}updatePlaceholderTransaction(e){const{id:t,tr:n,checkOnly:r=!1,data:o}=e;if(!this.findPlaceholder(t))return!1;if(r)return!0;const{updated:s}=this.getMeta(n);return this.setMeta(n,{updated:Mf([...s,{id:t,data:o}])}),!0}removePlaceholderTransaction(e){const{id:t,tr:n,checkOnly:r=!1}=e;if(!this.findPlaceholder(t))return!1;if(r)return!0;const{removed:i}=this.getMeta(n);return this.setMeta(n,{removed:Mf([...i,t])}),!0}clearPlaceholdersTransaction(e){const{tr:t,checkOnly:n=!1}=e;return this.getPluginState()===Ye.empty?!1:(n||this.setMeta(t,{clearTrackers:!0}),!0)}};le([de()],Fo.prototype,"updateDecorations",1);le([de()],Fo.prototype,"addPlaceholder",1);le([de()],Fo.prototype,"updatePlaceholder",1);le([de()],Fo.prototype,"removePlaceholder",1);le([de()],Fo.prototype,"clearPlaceholders",1);le([Ct()],Fo.prototype,"findPlaceholder",1);le([Ct()],Fo.prototype,"findAllPlaceholders",1);Fo=le([Ge({defaultOptions:{persistentSelectionClass:void 0,placeholderClassName:"placeholder",placeholderNodeName:"span"},staticKeys:["placeholderClassName","placeholderNodeName"],handlerKeys:["decorations"],handlerKeyOptions:{decorations:{reducer:{accumulator:(e,t,n)=>e.add(n.doc,t.find()),getDefault:()=>Ye.empty}}},defaultPriority:et.Low})],Fo);var lee={added:[],updated:[],clearTrackers:!1,removed:[]},Rl="placeholderDecoration",Y_="persistentSelectionFocus";function cee(e,t,n){const{selection:r,doc:o}=e;if(r.empty)return t;const{from:i,to:s}=r,a=_v(r)?dt.node(i,s,n):dt.inline(i,s,n);return t.add(o,[a])}var pb=class extends pt{get name(){return"docChanged"}onStateUpdate(e){const{firstUpdate:t,transactions:n,tr:r}=e;t||(n??[r]).some(o=>o==null?void 0:o.docChanged)&&this.options.docChanged(e)}};pb=le([Ge({handlerKeys:["docChanged"],handlerKeyOptions:{docChanged:{earlyReturnValue:!1}},defaultPriority:et.Lowest})],pb);var Xr=class extends pt{get name(){return"helpers"}onCreate(){var e;this.store.setStringHandler("text",this.textToProsemirrorNode.bind(this)),this.store.setStringHandler("html",ub);const t=he(),n=he(),r=he(),o=new Set;for(const i of this.store.extensions){Op(i)&&(n[i.name]=a=>TZ({state:this.store.getState(),type:i.type,attrs:a}),r[i.name]=a=>{var l;return(l=Lf({state:this.store.getState(),type:i.type,attrs:a}))==null?void 0:l.node.attrs}),Pv(i)&&(n[i.name]=a=>lg({trState:this.store.getState(),type:i.type,attrs:a}),r[i.name]=a=>{const l=Fi(this.store.getState().selection.$from,i.type);if(!l||!a)return l==null?void 0:l.mark.attrs;if(cS(l.mark,a))return l.mark.attrs});const s=((e=i.createHelpers)==null?void 0:e.call(i))??{};for(const a of Object.keys(i.decoratedHelpers??{}))s[a]=i[a].bind(i);if(!Hm(s))for(const[a,l]of $t(s))ND({name:a,set:o,code:K.DUPLICATE_HELPER_NAMES}),t[a]=l}this.store.setStoreKey("attrs",r),this.store.setStoreKey("active",n),this.store.setStoreKey("helpers",t),this.store.setExtensionStore("attrs",r),this.store.setExtensionStore("active",n),this.store.setExtensionStore("helpers",t)}isSelectionEmpty(e=this.store.getState()){return lS(e)}isViewEditable(e=this.store.getState()){var t,n;return((n=(t=this.store.view.props).editable)==null?void 0:n.call(t,e))??!1}getStateJSON(e=this.store.getState()){return e.toJSON()}getJSON(e=this.store.getState()){return e.doc.toJSON()}getRemirrorJSON(e=this.store.getState()){return this.getJSON(e)}insertHtml(e,t){return n=>{const{state:r}=n,o=ub({content:e,schema:r.schema,fragment:!0});return this.store.commands.insertNode.original(o,t)(n)}}getText({lineBreakDivider:e=`
362
-
363
- `,state:t=this.store.getState()}={}){return t.doc.textBetween(0,t.doc.content.size,e,Es)}getTextBetween(e,t,n=this.store.getState().doc){return n.textBetween(e,t,`
364
-
365
- `,Es)}getHTML(e=this.store.getState()){return ZZ(e.doc,this.store.document)}textToProsemirrorNode(e){const t=`<pre>${e.content}</pre>`;return this.store.stringHandlers.html({...e,content:t})}};le([Ct()],Xr.prototype,"isSelectionEmpty",1);le([Ct()],Xr.prototype,"isViewEditable",1);le([Ct()],Xr.prototype,"getStateJSON",1);le([Ct()],Xr.prototype,"getJSON",1);le([Ct()],Xr.prototype,"getRemirrorJSON",1);le([de()],Xr.prototype,"insertHtml",1);le([Ct()],Xr.prototype,"getText",1);le([Ct()],Xr.prototype,"getTextBetween",1);le([Ct()],Xr.prototype,"getHTML",1);Xr=le([Ge({})],Xr);var hb=class extends pt{get name(){return"inputRules"}onCreate(){this.store.setExtensionStore("rebuildInputRules",this.rebuildInputRules.bind(this))}createExternalPlugins(){return[this.generateInputRulesPlugin()]}generateInputRulesPlugin(){var e,t;const n=[],r=this.store.markTags[je.ExcludeInputRules];for(const o of this.store.extensions)if(!((e=this.store.managerSettings.exclude)!=null&&e.inputRules||!o.createInputRules||(t=o.options.exclude)!=null&&t.inputRules))for(const i of o.createInputRules())i.shouldSkip=this.options.shouldSkipInputRule,i.invalidMarks=r,n.push(i);return pJ({rules:n})}rebuildInputRules(){this.store.updateExtensionPlugins(this)}};hb=le([Ge({defaultPriority:et.Default,handlerKeys:["shouldSkipInputRule"],handlerKeyOptions:{shouldSkipInputRule:{earlyReturnValue:!0}}})],hb);var xo=class extends pt{constructor(){super(...arguments),this.extraKeyBindings=[],this.backwardMarkExitTracker=new Map,this.keydownHandler=null,this.onAddCustomHandler=({keymap:e})=>{var t,n;if(e)return this.extraKeyBindings=[...this.extraKeyBindings,e],(n=(t=this.store).rebuildKeymap)==null||n.call(t),()=>{var r,o;this.extraKeyBindings=this.extraKeyBindings.filter(i=>i!==e),(o=(r=this.store).rebuildKeymap)==null||o.call(r)}},this.rebuildKeymap=()=>{this.setupKeydownHandler()}}get name(){return"keymap"}get shortcutMap(){const{shortcuts:e}=this.options;return _e(e)?pee[e]:e}onCreate(){this.store.setExtensionStore("rebuildKeymap",this.rebuildKeymap)}createExternalPlugins(){var e;return(e=this.store.managerSettings.exclude)!=null&&e.keymap?[]:(this.setupKeydownHandler(),[new Vi({props:{handleKeyDown:(t,n)=>{var r;return(r=this.keydownHandler)==null?void 0:r.call(this,t,n)}}})])}setupKeydownHandler(){const e=this.generateKeymapBindings();this.keydownHandler=TD(e)}generateKeymapBindings(){var e;const t=[],n=this.shortcutMap,r=this.store.getExtension(Fe),o=a=>l=>Dh({shortcut:l,map:n,store:this.store,options:a.options});for(const a of this.store.extensions){const l=a.decoratedKeybindings??{};if(!((e=a.options.exclude)!=null&&e.keymap)){a.createKeymap&&t.push(dee(a.createKeymap(o(a)),n));for(const[c,u]of $t(l)){if(u.isActive&&!u.isActive(a.options,this.store))continue;const d=a[c].bind(a),f=Dh({shortcut:u.shortcut,map:n,options:a.options,store:this.store}),h=ft(u.priority)?u.priority(a.options,this.store):u.priority??et.Low,m=he();for(const v of f)m[v]=d;t.push([h,m]),u.command&&r.updateDecorated(u.command,{shortcut:f})}}}const i=this.sortKeymaps([...this.extraKeyBindings,...t]);return NZ(i)}arrowRightShortcut(e){const t=this.store.markTags[je.PreventExits],n=this.store.nodeTags[je.PreventExits];return this.exitMarkForwards(t,n)(e)}arrowLeftShortcut(e){const t=this.store.markTags[je.PreventExits],n=this.store.nodeTags[je.PreventExits];return ag(this.exitNodeBackwards(n),this.exitMarkBackwards(t,n))(e)}backspace(e){const t=this.store.markTags[je.PreventExits],n=this.store.nodeTags[je.PreventExits];return ag(this.exitNodeBackwards(n,!0),this.exitMarkBackwards(t,n,!0))(e)}createKeymap(){const{selectParentNodeOnEscape:e,undoInputRuleOnBackspace:t,excludeBaseKeymap:n}=this.options,r=he();if(!n)for(const[o,i]of $t(ix))r[o]=Fd(i);return t&&ix.Backspace&&(r.Backspace=Fd(Nv(hJ,ix.Backspace))),e&&(r.Escape=Fd(wQ)),[et.Low,r]}getNamedShortcut(e,t={}){return e.startsWith("_|")?Dh({shortcut:e,map:this.shortcutMap,store:this.store,options:t}):[e]}onSetOptions(e){var t,n;const{changes:r}=e;(r.excludeBaseKeymap.changed||r.selectParentNodeOnEscape.changed||r.undoInputRuleOnBackspace.changed)&&((n=(t=this.store).rebuildKeymap)==null||n.call(t))}sortKeymaps(e){return ol(e.map(t=>Bt(t)?t:[et.Default,t]),(t,n)=>n[0]-t[0]).map(t=>t[1])}exitMarkForwards(e,t){return n=>{const{tr:r,dispatch:o}=n;if(!tQ(r.selection)||Df({selection:r.selection,types:t}))return!1;const a=r.selection.$from.marks().filter(l=>!e.includes(l.type.name));if(ea(a))return!1;if(!o)return!0;for(const l of a)r.removeStoredMark(l);return o(r.insertText(" ",r.selection.from)),!0}}exitNodeBackwards(e,t=!1){return n=>{const{tr:r}=n;if(!(t?H_:db)(r.selection))return!1;const i=r.selection.$anchor.node();return!fS(i)||zZ(i)||e.includes(i.type.name)?!1:this.store.commands.toggleBlockNodeItem.original({type:i.type})(n)}}exitMarkBackwards(e,t,n=!1){return r=>{const{tr:o,dispatch:i}=r;if(!(n?H_:db)(o.selection)||this.backwardMarkExitTracker.has(o.selection.anchor))return this.backwardMarkExitTracker.clear(),!1;if(Df({selection:o.selection,types:t}))return!1;const l=[...o.storedMarks??[],...o.selection.$from.marks()].filter(c=>!e.includes(c.type.name));if(ea(l))return!1;if(!i)return!0;for(const c of l)o.removeStoredMark(c);return this.backwardMarkExitTracker.set(o.selection.anchor,!0),i(o),!0}}};le([Ar({shortcut:"ArrowRight",isActive:e=>e.exitMarksOnArrowPress})],xo.prototype,"arrowRightShortcut",1);le([Ar({shortcut:"ArrowLeft",isActive:e=>e.exitMarksOnArrowPress})],xo.prototype,"arrowLeftShortcut",1);le([Ar({shortcut:"Backspace",isActive:e=>e.exitMarksOnArrowPress})],xo.prototype,"backspace",1);le([Ct()],xo.prototype,"getNamedShortcut",1);xo=le([Ge({defaultPriority:et.Low,defaultOptions:{shortcuts:"default",undoInputRuleOnBackspace:!0,selectParentNodeOnEscape:!1,excludeBaseKeymap:!1,exitMarksOnArrowPress:!0},customHandlerKeys:["keymap"]})],xo);function uee(e){return Do(vv(G),e)}function Dh({shortcut:e,map:t,options:n,store:r}){return _e(e)?[mb(e,t)]:Bt(e)?e.map(o=>mb(o,t)):(e=e(n,r),Dh({shortcut:e,map:t,options:n,store:r}))}function mb(e,t){return uee(e)?t[e]:e}function dee(e,t){const n={};let r,o;Bt(e)?[o,r]=e:r=e;for(const[i,s]of $t(r))n[mb(i,t)]=s;return yv(o)?n:[o,n]}var RD={[G.Copy]:"Mod-c",[G.Cut]:"Mod-x",[G.Paste]:"Mod-v",[G.PastePlain]:"Mod-Shift-v",[G.SelectAll]:"Mod-a",[G.Undo]:"Mod-z",[G.Redo]:yo.isMac?"Shift-Mod-z":"Mod-y",[G.Bold]:"Mod-b",[G.Italic]:"Mod-i",[G.Underline]:"Mod-u",[G.Strike]:"Mod-d",[G.Code]:"Mod-`",[G.Paragraph]:"Mod-Shift-0",[G.H1]:"Mod-Shift-1",[G.H2]:"Mod-Shift-2",[G.H3]:"Mod-Shift-3",[G.H4]:"Mod-Shift-4",[G.H5]:"Mod-Shift-5",[G.H6]:"Mod-Shift-6",[G.TaskList]:"Mod-Shift-7",[G.BulletList]:"Mod-Shift-8",[G.OrderedList]:"Mod-Shift-9",[G.Quote]:"Mod->",[G.Divider]:"Mod-Shift-|",[G.Codeblock]:"Mod-Shift-~",[G.ClearFormatting]:"Mod-Shift-C",[G.Superscript]:"Mod-.",[G.Subscript]:"Mod-,",[G.LeftAlignment]:"Mod-Shift-L",[G.CenterAlignment]:"Mod-Shift-E",[G.RightAlignment]:"Mod-Shift-R",[G.JustifyAlignment]:"Mod-Shift-J",[G.InsertLink]:"Mod-k",[G.Find]:"Mod-f",[G.FindBackwards]:"Mod-Shift-f",[G.FindReplace]:"Mod-Shift-H",[G.AddFootnote]:"Mod-Alt-f",[G.AddComment]:"Mod-Alt-m",[G.ContextMenu]:"Mod-Shift-\\",[G.IncreaseFontSize]:"Mod-Shift-.",[G.DecreaseFontSize]:"Mod-Shift-,",[G.IncreaseIndent]:"Tab",[G.DecreaseIndent]:"Shift-Tab",[G.Shortcuts]:"Mod-/",[G.Format]:yo.isMac?"Alt-Shift-f":"Shift-Ctrl-f"},fee={...RD,[G.Strike]:"Mod-Shift-S",[G.Code]:"Mod-Shift-M",[G.Paragraph]:"Mod-Alt-0",[G.H1]:"Mod-Alt-1",[G.H2]:"Mod-Alt-2",[G.H3]:"Mod-Alt-3",[G.H4]:"Mod-Alt-4",[G.H5]:"Mod-Alt-5",[G.H6]:"Mod-Alt-6",[G.OrderedList]:"Mod-Alt-7",[G.BulletList]:"Mod-Alt-8",[G.Quote]:"Mod-Alt-9",[G.ClearFormatting]:"Mod-\\",[G.IncreaseIndent]:"Mod-[",[G.DecreaseIndent]:"Mod-]"},pee={default:RD,googleDoc:fee},hee=class extends pt{get name(){return"nodeViews"}createPlugin(){const e=[],t=he();for(const n of this.store.extensions){if(!n.createNodeViews)continue;const r=n.createNodeViews();e.unshift(ft(r)?{[n.name]:r}:r)}e.unshift(this.store.managerSettings.nodeViews??{});for(const n of e)Object.assign(t,n);return{props:{nodeViews:t}}}},mee=class extends pt{get name(){return"pasteRules"}createExternalPlugins(){return[this.generatePasteRulesPlugin()]}generatePasteRulesPlugin(){var e,t;const n=[];for(const r of this.store.extensions){if((e=this.store.managerSettings.exclude)!=null&&e.pasteRules||!r.createPasteRules||(t=r.options.exclude)!=null&&t.pasteRules)continue;const o=r.createPasteRules(),i=Bt(o)?o:[o];n.push(...i)}return IQ(n)}},gb=class extends pt{constructor(){super(...arguments),this.plugins=[],this.managerPlugins=[],this.applyStateHandlers=[],this.initStateHandlers=[],this.appendTransactionHandlers=[],this.pluginKeys=he(),this.stateGetters=new Map,this.getPluginStateCreator=e=>t=>e.getState(t??this.store.getState()),this.getStateByName=e=>{const t=this.stateGetters.get(e);return xe(t,{message:"No plugin exists for the requested extension name."}),t()}}get name(){return"plugins"}onCreate(){const{setStoreKey:e,setExtensionStore:t,managerSettings:n,extensions:r}=this.store;this.updateExtensionStore();const{plugins:o=[]}=n;this.updatePlugins(o,this.managerPlugins);for(const i of r)i.onApplyState&&this.applyStateHandlers.push(i.onApplyState.bind(i)),i.onInitState&&this.initStateHandlers.push(i.onInitState.bind(i)),i.onAppendTransaction&&this.appendTransactionHandlers.push(i.onAppendTransaction.bind(i)),this.extractExtensionPlugins(i);this.managerPlugins=o,this.store.setStoreKey("plugins",this.plugins),e("pluginKeys",this.pluginKeys),e("getPluginState",this.getStateByName),t("getPluginState",this.getStateByName)}createPlugin(){return{appendTransaction:(e,t,n)=>{const r=n.tr,o={previousState:t,tr:r,transactions:e,state:n};for(const i of this.appendTransactionHandlers)i(o);return this.options.appendTransaction(o),r.docChanged||r.steps.length>0||r.selectionSet||r.storedMarksSet?r:void 0},state:{init:(e,t)=>{for(const n of this.initStateHandlers)n(t)},apply:(e,t,n,r)=>{const o={previousState:n,state:r,tr:e};for(const i of this.applyStateHandlers)i(o);this.options.applyState(o)}}}}extractExtensionPlugins(e){var t,n;if(!(!e.createPlugin&&!e.createExternalPlugins||(t=this.store.managerSettings.exclude)!=null&&t.plugins||(n=e.options.exclude)!=null&&n.plugins)){if(e.createPlugin){const o=new pu(e.name);this.pluginKeys[e.name]=o;const i=this.getPluginStateCreator(o);e.pluginKey=o,e.getPluginState=i,this.stateGetters.set(e.name,i),this.stateGetters.set(e.constructor,i);const s={...e.createPlugin(),key:o},a=new Vi(s);this.updatePlugins([a],e.plugin?[e.plugin]:void 0),e.plugin=a}if(e.createExternalPlugins){const o=e.createExternalPlugins();this.updatePlugins(o,e.externalPlugins),e.externalPlugins=o}}}updatePlugins(e,t){if(!t||ea(t)){this.plugins=[...this.plugins,...e];return}if(e.length!==t.length){this.plugins=[...this.plugins.filter(r=>!t.includes(r)),...e];return}const n=new Map;for(const[r,o]of e.entries())n.set(vt(t,r),o);this.plugins=this.plugins.map(r=>t.includes(r)?n.get(r):r)}updateExtensionStore(){const{setExtensionStore:e}=this.store;e("updatePlugins",this.updatePlugins.bind(this)),e("dispatchPluginUpdate",this.dispatchPluginUpdate.bind(this)),e("updateExtensionPlugins",this.updateExtensionPlugins.bind(this))}updateExtensionPlugins(e){const t=MD(e)?e:eee(e)?this.store.manager.getExtension(e):this.store.extensions.find(n=>n.name===e);xe(t,{code:K.INVALID_MANAGER_EXTENSION,message:`The extension ${e} does not exist within the editor.`}),this.extractExtensionPlugins(t),this.store.setStoreKey("plugins",this.plugins),this.dispatchPluginUpdate()}dispatchPluginUpdate(){xe(this.store.phase>=qn.EditorView,{code:K.MANAGER_PHASE_ERROR,message:"`dispatchPluginUpdate` should only be called after the view has been added to the manager."});const{view:e,updateState:t}=this.store,n=e.state.reconfigure({plugins:this.plugins});t(n)}};gb=le([Ge({defaultPriority:et.Highest,handlerKeys:["applyState","appendTransaction"]})],gb);var vb=class extends pt{constructor(){super(...arguments),this.dynamicAttributes={marks:he(),nodes:he()}}get name(){return"schema"}onCreate(){const{managerSettings:e,tags:t,markNames:n,nodeNames:r,extensions:o}=this.store,{defaultBlockNode:i,disableExtraAttributes:s,nodeOverride:a,markOverride:l}=e,c=m=>!!(m&&t[je.Block].includes(m));if(e.schema){const{nodes:m,marks:v}=kee(e.schema);this.addSchema(e.schema,m,v);return}const u=c(i)?{doc:he(),[i]:he()}:he(),d=he(),f=gee({settings:e,gatheredSchemaAttributes:this.gatherExtraAttributes(o),nodeNames:r,markNames:n,tags:t});for(const m of o){f[m.name]={...f[m.name],...m.options.extraAttributes};const v=s===!0||m.options.disableExtraAttributes===!0||m.constructor.disableExtraAttributes===!0;if(Op(m)){const{spec:x,dynamic:b}=J_({createExtensionSpec:(w,S)=>m.createNodeSpec(w,S),extraAttributes:vt(f,m.name),override:{...a,...m.options.nodeOverride},ignoreExtraAttributes:v,name:m.constructorName,tags:m.tags});m.spec=x,u[m.name]=x,Object.keys(b).length>0&&(this.dynamicAttributes.nodes[m.name]=b)}if(Pv(m)){const{spec:x,dynamic:b}=J_({createExtensionSpec:(w,S)=>m.createMarkSpec(w,S),extraAttributes:vt(f,m.name),override:{...l,...m.options.markOverride},ignoreExtraAttributes:v,name:m.constructorName,tags:m.tags??[]});m.spec=x,d[m.name]=x,Object.keys(b).length>0&&(this.dynamicAttributes.marks[m.name]=b)}}const h=new rY({nodes:u,marks:d,topNode:"doc"});this.addSchema(h,u,d)}createPlugin(){return{appendTransaction:(e,t,n)=>{const{tr:r}=n;return!e.some(i=>i.docChanged)||Object.keys(this.dynamicAttributes.nodes).length===0&&Object.keys(this.dynamicAttributes.marks).length===0?null:(r.doc.descendants((i,s)=>(this.checkAndUpdateDynamicNodes(i,s,r),this.checkAndUpdateDynamicMarks(i,s,r),!0)),r.steps.length>0?r:null)}}}addSchema(e,t,n){this.store.setStoreKey("nodes",t),this.store.setStoreKey("marks",n),this.store.setStoreKey("schema",e),this.store.setExtensionStore("schema",e),this.store.setStoreKey("defaultBlockNode",Tv(e).name);for(const r of Object.values(e.nodes))if(r.name!=="doc"&&(r.isBlock||r.isTextblock))break}checkAndUpdateDynamicNodes(e,t,n){for(const[r,o]of $t(this.dynamicAttributes.nodes))if(e.type.name===r)for(const[i,s]of $t(o)){if(!Qs(e.attrs[i]))continue;const a={...e.attrs,[i]:s(e)};n.setNodeMarkup(t,void 0,a),B_(n)}}checkAndUpdateDynamicMarks(e,t,n){for(const[r,o]of $t(this.dynamicAttributes.marks)){const i=vt(this.store.schema.marks,r),s=e.marks.find(a=>a.type.name===r);if(s)for(const[a,l]of $t(o)){if(!Qs(s.attrs[a]))continue;const c=Fi(n.doc.resolve(t),i);if(!c)continue;const{from:u,to:d}=c,f=i.create({...s.attrs,[a]:l(s)});n.removeMark(u,d,i).addMark(u,d,f),B_(n)}}}gatherExtraAttributes(e){const t=[];for(const n of e)n.createSchemaAttributes&&t.push(...n.createSchemaAttributes());return t}};vb=le([Ge({defaultPriority:et.Highest})],vb);function gee(e){const{settings:t,gatheredSchemaAttributes:n,nodeNames:r,markNames:o,tags:i}=e,s=he();if(t.disableExtraAttributes)return s;const a=[...n,...t.extraAttributes??[]];for(const l of a??[]){const c=yee({identifiers:l.identifiers,nodeNames:r,markNames:o,tags:i});for(const u of c){const d=s[u]??{};s[u]={...d,...l.attributes}}}return s}function vee(e){return ml(e)&&Bt(e.tags)}function yee(e){const{identifiers:t,nodeNames:n,markNames:r,tags:o}=e;if(t==="nodes")return n;if(t==="marks")return r;if(t==="all")return[...n,...r];if(Bt(t))return t;xe(vee(t),{code:K.EXTENSION_EXTRA_ATTRIBUTES,message:"Invalid value passed as an identifier when creating `extraAttributes`."});const{tags:i=[],names:s=[],behavior:a="any",excludeNames:l,excludeTags:c,type:u}=t,d=new Set,f=u==="mark"?r:u==="node"?n:[...r,...n],h=v=>f.includes(v)&&!(l!=null&&l.includes(v));for(const v of s)h(v)&&d.add(v);const m=new Map;for(const v of i)if(!(c!=null&&c.includes(v)))for(const x of o[v]){if(!h(x))continue;if(a==="any"){d.add(x);continue}const b=m.get(x)??new Set;b.add(v),m.set(x,b)}for(const[v,x]of m)x.size===i.length&&d.add(v);return[...d]}function J_(e){var t;const{createExtensionSpec:n,extraAttributes:r,ignoreExtraAttributes:o,name:i,tags:s,override:a}=e,l=he();function c(x,b){l[x]=b}let u=!1;function d(){u=!0}const f=xee(r,o,d,c),h=bee(r,o),m=wee(r,o),v=n({defaults:f,parse:h,dom:m},a);return xe(o||u,{code:K.EXTENSION_SPEC,message:`When creating a node specification you must call the 'defaults', and parse, and 'dom' methods. To avoid this error you can set the static property 'disableExtraAttributes' of '${i}' to 'true'.`}),v.group=[...((t=v.group)==null?void 0:t.split(" "))??[],...s].join(" ")||void 0,{spec:v,dynamic:l}}function hS(e){return _e(e)||ft(e)?{default:e}:(xe(e,{message:`${MA(e)} is not supported`,code:K.EXTENSION_EXTRA_ATTRIBUTES}),e)}function xee(e,t,n,r){return()=>{n();const o=he();if(t)return o;for(const[i,s]of $t(e)){let l=hS(s).default;ft(l)&&(r(i,l),l=null),o[i]=l===void 0?{}:{default:l}}return o}}function bee(e,t){return n=>{const r=he();if(t)return r;for(const[o,i]of $t(e)){const{parseDOM:s,...a}=hS(i);if(ri(n)){if(Qs(s)){r[o]=n.getAttribute(o)??a.default;continue}if(ft(s)){r[o]=s(n)??a.default;continue}r[o]=n.getAttribute(s)??a.default}}return r}}function wee(e,t){return n=>{const r=he();if(t)return r;function o(i,s){if(i){if(_e(i)){r[s]=i;return}if(Bt(i)){const[a,l]=i;r[a]=l??n.attrs[s];return}for(const[a,l]of $t(i))r[a]=l}}for(const[i,s]of $t(e)){const{toDOM:a,parseDOM:l}=hS(s);if(Qs(a)){const c=_e(l)?l:i;r[c]=n.attrs[i];continue}if(ft(a)){o(a(n.attrs,See(n)),i);continue}o(a,i)}return r}}function See(e){return Ev(e)?{node:e}:IZ(e)?{mark:e}:{}}function kee(e){const t=he(),n=he();for(const[r,o]of Object.entries(e.nodes))t[r]=o.spec;for(const[r,o]of Object.entries(e.marks))n[r]=o.spec;return{nodes:t,marks:n}}var qc=class extends pt{constructor(){super(...arguments),this.onAddCustomHandler=({suggester:e})=>{var t;if(!(!e||(t=this.store.managerSettings.exclude)!=null&&t.suggesters))return $_(this.store.getState(),e)}}get name(){return"suggest"}onCreate(){this.store.setExtensionStore("addSuggester",e=>$_(this.store.getState(),e)),this.store.setExtensionStore("removeSuggester",e=>bZ(this.store.getState(),e))}createExternalPlugins(){var e,t;const n=[];for(const r of this.store.extensions){if((e=this.store.managerSettings.exclude)!=null&&e.suggesters)break;if(!r.createSuggesters||(t=r.options.exclude)!=null&&t.suggesters)continue;const o=r.createSuggesters(),i=Bt(o)?o:[o];n.push(...i)}return[wZ(...n)]}getSuggestState(e){return iS(e??this.store.getState())}getSuggestMethods(){const{addIgnored:e,clearIgnored:t,removeIgnored:n,ignoreNextExit:r,setMarkRemoved:o,findMatchAtPosition:i,findNextTextSelection:s,setLastChangeFromAppend:a}=this.getSuggestState();return{addIgnored:e,clearIgnored:t,removeIgnored:n,ignoreNextExit:r,setMarkRemoved:o,findMatchAtPosition:i,findNextTextSelection:s,setLastChangeFromAppend:a}}isSuggesterActive(e){var t;return Do(Bt(e)?e:[e],(t=this.getSuggestState().match)==null?void 0:t.suggester.name)}};le([Ct()],qc.prototype,"getSuggestState",1);le([Ct()],qc.prototype,"getSuggestMethods",1);le([Ct()],qc.prototype,"isSuggesterActive",1);qc=le([Ge({customHandlerKeys:["suggester"]})],qc);var yb=class extends pt{constructor(){super(...arguments),this.allTags=he(),this.plainTags=he(),this.markTags=he(),this.nodeTags=he()}get name(){return"tags"}onCreate(){this.resetTags();for(const e of this.store.extensions)this.updateTagForExtension(e);this.store.setStoreKey("tags",this.allTags),this.store.setExtensionStore("tags",this.allTags),this.store.setStoreKey("plainTags",this.plainTags),this.store.setExtensionStore("plainTags",this.plainTags),this.store.setStoreKey("markTags",this.markTags),this.store.setExtensionStore("markTags",this.markTags),this.store.setStoreKey("nodeTags",this.nodeTags),this.store.setExtensionStore("nodeTags",this.nodeTags)}resetTags(){const e=he(),t=he(),n=he(),r=he();for(const o of vv(je))e[o]=[],t[o]=[],n[o]=[],r[o]=[];this.allTags=e,this.plainTags=t,this.markTags=n,this.nodeTags=r}updateTagForExtension(e){var t,n;const r=new Set([...e.tags??[],...((t=e.createTags)==null?void 0:t.call(e))??[],...e.options.extraTags??[],...((n=this.store.managerSettings.extraTags)==null?void 0:n[e.name])??[]]);for(const o of r)xe(Cee(o),{code:K.EXTENSION,message:`The tag provided by the extension: ${e.constructorName} is not supported by the editor. To add custom tags you can use the 'mutateTag' method.`}),this.allTags[o].push(e.name),PD(e)&&this.plainTags[o].push(e.name),Pv(e)&&this.markTags[o].push(e.name),Op(e)&&this.nodeTags[o].push(e.name);e.tags=[...r]}};yb=le([Ge({defaultPriority:et.Highest})],yb);function Cee(e){return Do(vv(je),e)}var Eee=new pu("remirrorFilePlaceholderPlugin");function _ee(){const e=new Vi({key:Eee,state:{init(){return{set:Ye.empty,payloads:new Map}},apply(t,{set:n,payloads:r}){n=n.map(t.mapping,t.doc);const o=t.getMeta(e);if(o)if(o.type===0){const i=document.createElement("placeholder"),s=dt.widget(o.pos,i,{id:o.id});n=n.add(t.doc,[s]),r.set(o.id,o.payload)}else o.type===1&&(n=n.remove(n.find(void 0,void 0,i=>i.id===o.id)),r.delete(o.id));return{set:n,payloads:r}}},props:{decorations(t){var n;return((n=e.getState(t))==null?void 0:n.set)??null}}});return e}var Tee=class extends pt{get name(){return"upload"}createExternalPlugins(){return[_ee()]}};function Oee(e={}){e={...{exitMarksOnArrowPress:xo.defaultOptions.exitMarksOnArrowPress,excludeBaseKeymap:xo.defaultOptions.excludeBaseKeymap,selectParentNodeOnEscape:xo.defaultOptions.selectParentNodeOnEscape,undoInputRuleOnBackspace:xo.defaultOptions.undoInputRuleOnBackspace,persistentSelectionClass:Fo.defaultOptions.persistentSelectionClass},...e};const n=W0(e,["excludeBaseKeymap","selectParentNodeOnEscape","undoInputRuleOnBackspace"]),r=W0(e,["persistentSelectionClass"]);return[new yb,new vb,new tee,new gb,new hb,new mee,new hee,new qc,new Fe,new Xr,new xo(n),new pb,new Tee,new Fo(r)]}var X_=class extends pt{get name(){return"meta"}onCreate(){if(this.store.setStoreKey("getCommandMeta",this.getCommandMeta.bind(this)),!!this.options.capture)for(const e of this.store.extensions)this.captureCommands(e),this.captureKeybindings(e)}createPlugin(){return{}}captureCommands(e){const t=e.decoratedCommands??{},n=e.createCommands;for(const r of Object.keys(t)){const o=e[r];e[r]=(...i)=>s=>{var a;const l=o(...i)(s);return s.dispatch&&l&&this.setCommandMeta(s.tr,{type:"command",chain:s.dispatch!==((a=s.view)==null?void 0:a.dispatch),name:r,extension:e.name,decorated:!0}),l}}n&&(e.createCommands=()=>{const r=n();for(const[o,i]of Object.entries(r))r[o]=(...s)=>a=>{var l;const c=i(...s)(a);return a.dispatch&&c&&this.setCommandMeta(a.tr,{type:"command",chain:a.dispatch!==((l=a.view)==null?void 0:l.dispatch),name:o,extension:e.name,decorated:!1}),c};return r})}captureKeybindings(e){}getCommandMeta(e){return e.getMeta(this.pluginKey)??[]}setCommandMeta(e,t){const n=this.getCommandMeta(e);e.setMeta(this.pluginKey,[...n,t])}};X_=le([Ge({defaultOptions:{capture:yo.isDevelopment},staticKeys:["capture"],defaultPriority:et.Highest})],X_);var Lh,ed,Fh,zl,as,zh,$h,Nee=class{constructor(e){Mt(this,Lh,qm()),Mt(this,ed,void 0),Mt(this,Fh,void 0),Mt(this,zl,!0),Mt(this,as,gv()),Mt(this,zh,void 0),Mt(this,$h,void 0),this.getState=()=>this.view.state??this.initialEditorState,this.getPreviousState=()=>this.previousState,this.dispatchTransaction=i=>{var s,a;xe(!this.manager.destroyed,{code:K.MANAGER_PHASE_ERROR,message:"A transaction was dispatched to a manager that has already been destroyed. Please check your set up, or open an issue."}),i=((a=(s=this.props).onDispatchTransaction)==null?void 0:a.call(s,i,this.getState()))??i;const l=this.getState(),{state:c,transactions:u}=l.applyTransaction(i);Gt(this,Fh,l),this.updateState({state:c,tr:i,transactions:u});const d=this.manager.store.getForcedUpdates(i);ea(d)||this.updateViewProps(...d)},this.onChange=(i=he())=>{var s,a;const l=this.eventListenerProps(i);Q(this,zl)&&Gt(this,zl,!1),(a=(s=this.props).onChange)==null||a.call(s,l)},this.onBlur=i=>{var s,a;const l=this.eventListenerProps();(a=(s=this.props).onBlur)==null||a.call(s,l,i),Q(this,as).emit("blur",l,i)},this.onFocus=i=>{var s,a;const l=this.eventListenerProps();(a=(s=this.props).onFocus)==null||a.call(s,l,i),Q(this,as).emit("focus",l,i)},this.setContent=(i,{triggerChange:s=!1}={})=>{const{doc:a}=this.manager.createState({content:i}),l=this.getState(),{state:c}=this.getState().applyTransaction(l.tr.replaceRangeWith(0,l.doc.nodeSize-2,a));if(s)return this.updateState({state:c,triggerChange:s});this.view.updateState(c)},this.clearContent=({triggerChange:i=!1}={})=>{this.setContent(this.manager.createEmptyDoc(),{triggerChange:i})},this.createStateFromContent=(i,s)=>this.manager.createState({content:i,selection:s}),this.focus=i=>{this.manager.store.commands.focus(i)},this.blur=i=>{this.manager.store.commands.blur(i)};const{getProps:t,initialEditorState:n,element:r}=e;if(Gt(this,ed,t),Gt(this,$h,n),this.manager.attachFramework(this,this.updateListener.bind(this)),this.manager.view)return;const o=this.createView(n,r);this.manager.addView(o)}get addHandler(){return Q(this,zh)??Gt(this,zh,Q(this,as).on.bind(Q(this,as)))}get updatableViewProps(){return{attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0}}get firstRender(){return Q(this,zl)}get props(){return Q(this,ed).call(this)}get previousState(){return this.previousStateOverride??Q(this,Fh)??this.initialEditorState}get manager(){return this.props.manager}get view(){return this.manager.view}get uid(){return Q(this,Lh)}get initialEditorState(){return Q(this,$h)}updateListener(e){const{state:t,tr:n}=e;return Q(this,as).emit("updated",this.eventListenerProps({state:t,tr:n}))}update(e){const{getProps:t}=e;return Gt(this,ed,t),this}updateViewProps(...e){const t=W0(this.updatableViewProps,e);this.view.setProps({...this.view.props,...t})}getAttributes(e){var t;const{attributes:n,autoFocus:r,classNames:o=[],label:i,editable:s}=this.props,a=(t=this.manager.store)==null?void 0:t.attributes,l=ft(n)?n(this.eventListenerProps()):n;let c={};(r||Pr(r))&&(c=e?{autoFocus:!0}:{autofocus:"true"});const u=Mf(fb(e&&"Prosemirror","remirror-editor",a==null?void 0:a.class,...o).split(" ")).join(" "),d={role:"textbox",...c,"aria-multiline":"true",...s??!0?{}:{"aria-readonly":"true"},"aria-label":i??"",...a,class:u};return MG({...d,...l})}addFocusListeners(){this.view.dom.addEventListener("blur",this.onBlur),this.view.dom.addEventListener("focus",this.onFocus)}removeFocusListeners(){this.view.dom.removeEventListener("blur",this.onBlur),this.view.dom.removeEventListener("focus",this.onFocus)}destroy(){Q(this,as).emit("destroy"),this.view&&this.removeFocusListeners()}eventListenerProps(e=he()){const{state:t,tr:n,transactions:r}=e;return{tr:n,transactions:r,internalUpdate:!n,view:this.view,firstRender:Q(this,zl),state:t??this.getState(),createStateFromContent:this.createStateFromContent,previousState:this.previousState,helpers:this.manager.store.helpers}}get baseOutput(){return{manager:this.manager,...this.manager.store,addHandler:this.addHandler,focus:this.focus,blur:this.blur,uid:Q(this,Lh),view:this.view,getState:this.getState,getPreviousState:this.getPreviousState,getExtension:this.manager.getExtension.bind(this.manager),hasExtension:this.manager.hasExtension.bind(this.manager),clearContent:this.clearContent,setContent:this.setContent}}};Lh=new WeakMap;ed=new WeakMap;Fh=new WeakMap;zl=new WeakMap;as=new WeakMap;zh=new WeakMap;$h=new WeakMap;function Mee(e,t){const n=[],r=new WeakMap,o=[],i=new WeakMap;let s=[];const a={duplicateMap:i,parentExtensions:o,gatheredExtensions:s,settings:t};for(const d of e)jD(a,{extension:d});s=ol(s,(d,f)=>f.priority-d.priority);const l=new WeakSet,c=new Set;for(const d of s){const f=d.constructor,h=d.name,m=i.get(f);xe(m,{message:`No entries were found for the ExtensionConstructor ${d.name}`,code:K.INTERNAL}),!(l.has(f)||c.has(h))&&(l.add(f),c.add(h),n.push(d),r.set(f,d),m.forEach(v=>v==null?void 0:v.replaceChildExtension(f,d)))}const u=[];for(const d of n)Pee({extension:d,found:l,missing:u});return xe(ea(u),{code:K.MISSING_REQUIRED_EXTENSION,message:u.map(({Constructor:d,extension:f})=>`The extension '${f.name}' requires '${d.name} in order to run correctly.`).join(`
366
- `)}),{extensions:n,extensionMap:r}}function jD(e,t){var n;const{gatheredExtensions:r,duplicateMap:o,parentExtensions:i,settings:s}=e,{extension:a,parentExtension:l}=t;let{names:c=[]}=t;xe(MD(a),{code:K.INVALID_MANAGER_EXTENSION,message:`An invalid extension: ${a} was provided to the [[\`RemirrorManager\`]].`});const u=a.extensions;if(a.setPriority((n=s.priority)==null?void 0:n[a.name]),r.push(a),Ree({duplicateMap:o,extension:a,parentExtension:l}),u.length!==0){if(c.includes(a.name)){`${c.join(" > ")}${a.name}`;return}c=[...c,a.name],i.push(a);for(const d of u)jD(e,{names:c,extension:d,parentExtension:a})}}function Pee(e){const{extension:t,found:n,missing:r}=e;if(t.requiredExtensions)for(const o of t.requiredExtensions??[])n.has(o)||r.push({Constructor:o,extension:t})}function Ree(e){const{duplicateMap:t,extension:n,parentExtension:r}=e,o=n.constructor,i=t.get(o),s=r?[r]:[];t.set(o,i?[...i,...s]:s)}function jee(e){var t,n,r,o;const{extension:i,nodeNames:s,markNames:a,plainNames:l,store:c,handlers:u}=e;i.setStore(c);const d=(t=i.onCreate)==null?void 0:t.bind(i),f=(n=i.onView)==null?void 0:n.bind(i),h=(r=i.onStateUpdate)==null?void 0:r.bind(i),m=(o=i.onDestroy)==null?void 0:o.bind(i);d&&u.create.push(d),f&&u.view.push(f),h&&u.update.push(h),m&&u.destroy.push(m),Pv(i)&&a.push(i.name),Op(i)&&i.name!=="doc"&&s.push(i.name),PD(i)&&l.push(i.name)}var ls,td,ao,fi,nd,vr,Ca,rd,Ea,od,_a,lo,id,Bh=class{constructor(e,t={}){Mt(this,ls,void 0),Mt(this,td,he()),Mt(this,ao,he()),Mt(this,fi,void 0),Mt(this,nd,void 0),Mt(this,vr,qn.None),Mt(this,Ca,void 0),Mt(this,rd,!0),Mt(this,Ea,{create:[],view:[],update:[],destroy:[]}),Mt(this,od,[]),Mt(this,_a,gv()),Mt(this,lo,void 0),Mt(this,id,void 0),this.getState=()=>{var o;return Q(this,vr)>=qn.EditorView?this.view.state:(xe(Q(this,lo),{code:K.MANAGER_PHASE_ERROR,message:"`getState` can only be called after the `Framework` or the `EditorView` has been added to the manager`. Check your plugins to make sure that the decorations callback uses the state argument."}),(o=Q(this,lo))==null?void 0:o.initialEditorState)},this.updateState=o=>{const i=this.getState();this.view.updateState(o),this.onStateUpdate({previousState:i,state:o})};const{extensions:n,extensionMap:r}=Mee(e,t);Gt(this,Ca,t),Gt(this,fi,Ra(n)),Gt(this,nd,r),Gt(this,ls,this.createExtensionStore()),Gt(this,vr,qn.Create),this.setupLifecycleHandlers();for(const o of Q(this,Ea).create){const i=o();i&&Q(this,od).push(i)}}static create(e,t={}){return new Bh([...IA(e),...Oee(t.builtin)],t)}get[Li](){return en.Manager}get destroyed(){return Q(this,vr)===qn.Destroy}get mounted(){return Q(this,vr)>=qn.EditorView&&Q(this,vr)<qn.Destroy}get output(){var e;return(e=Q(this,lo))==null?void 0:e.frameworkOutput}get frameworkAttached(){return!!Q(this,lo)}get extensions(){return Q(this,fi)}get stringHandlers(){return Q(this,td)}get store(){return Ra(Q(this,ao))}get extensionStore(){return Ra(Q(this,ls))}get tr(){return this.getExtension(Fe).transaction}get nodes(){return Q(this,ao).nodes}get marks(){return Q(this,ao).marks}get schema(){return Q(this,ao).schema}get extensionTags(){return Q(this,ao).tags}get view(){return Q(this,ao).view}get settings(){return Q(this,Ca)}get document(){return Q(this,Ca).document??Ov()}setupLifecycleHandlers(){const e=Q(this,ls),t=Q(this,Ea),n=[],r=[],o=[];e.nodeNames=n,e.markNames=r,e.plainNames=o;for(const i of Q(this,fi))jee({extension:i,nodeNames:n,markNames:r,plainNames:o,handlers:t,store:e})}setStringHandler(e,t){Q(this,td)[e]=t}setStoreKey(e,t){Q(this,ao)[e]=t}getStoreKey(e){const t=Q(this,ao)[e];return xe(!Qs(t),{code:K.MANAGER_PHASE_ERROR,message:"`getStoreKey` should not be called before the values are available."}),t}setExtensionStore(e,t){xe(Q(this,vr)<=qn.EditorView,{code:K.MANAGER_PHASE_ERROR,message:"`setExtensionStore` should only be called during the `onCreate` lifecycle hook. Make sure to only call it within the returned methods."}),Q(this,ls)[e]=t}createExtensionStore(){const e=he(),t=!0;let n,r;return Object.defineProperties(e,{extensions:{get:()=>Q(this,fi),enumerable:t},phase:{get:()=>Q(this,vr),enumerable:t},view:{get:()=>this.view,enumerable:t},managerSettings:{get:()=>Ra(Q(this,Ca)),enumerable:t},getState:{value:this.getState,enumerable:t},updateState:{value:this.updateState,enumerable:t},isMounted:{value:()=>this.mounted,enumerable:t},getExtension:{value:this.getExtension.bind(this),enumerable:t},manager:{get:()=>this,enumerable:t},document:{get:()=>this.document,enumerable:t},stringHandlers:{get:()=>Q(this,td),enumerable:t},currentState:{get:()=>n??(n=this.getState()),set:o=>{n=o},enumerable:t},previousState:{get:()=>r,set:o=>{r=o},enumerable:t}}),e.getStoreKey=this.getStoreKey.bind(this),e.setStoreKey=this.setStoreKey.bind(this),e.setExtensionStore=this.setExtensionStore.bind(this),e.setStringHandler=this.setStringHandler.bind(this),e}addView(e){if(Q(this,vr)>=qn.EditorView)return this;Gt(this,rd,!0),Gt(this,vr,qn.EditorView),Q(this,ao).view=e;for(const t of Q(this,Ea).view){const n=t(e);n&&Q(this,od).push(n)}return this}attachFramework(e,t){var n;Q(this,lo)!==e&&(Q(this,lo)&&(Q(this,lo).destroy(),(n=Q(this,id))==null||n.call(this)),Gt(this,lo,e),Gt(this,id,this.addHandler("stateUpdate",t)))}createEmptyDoc(){var e;const t=(e=this.schema.nodes.doc)==null?void 0:e.createAndFill();return xe(t,{code:K.INVALID_CONTENT,message:"An empty node could not be created due to an invalid schema."}),t}createState(e={}){const{onError:t,defaultSelection:n="end"}=this.settings,{content:r=this.createEmptyDoc(),selection:o=n,stringHandler:i=this.settings.stringHandler}=e,{schema:s,plugins:a}=this.store,l=dD({stringHandler:_e(i)?this.stringHandlers[i]:i,document:this.document,content:r,onError:t,schema:s,selection:o});return ja.create({schema:s,doc:l,plugins:a,selection:Jr(o,l)})}addHandler(e,t){return Q(this,_a).on(e,t)}onStateUpdate(e){const t=Q(this,rd);Q(this,ls).currentState=e.state,Q(this,ls).previousState=e.previousState,t&&(Gt(this,vr,qn.Runtime),Gt(this,rd,!1));const n={...e,firstUpdate:t};for(const r of Q(this,Ea).update)r(n);Q(this,_a).emit("stateUpdate",n)}getExtension(e){const t=Q(this,nd).get(e);return xe(t,{code:K.INVALID_MANAGER_EXTENSION,message:`'${e.name}' doesn't exist within this manager. Make sure it is properly added before attempting to use it.`}),t}hasExtension(e){return!!Q(this,nd).get(e)}clone(){const e=Q(this,fi).map(n=>n.clone(n.options)),t=Bh.create(()=>e,Q(this,Ca));return Q(this,_a).emit("clone",t),t}recreate(e=[],t={}){const n=Q(this,fi).map(o=>o.clone(o.initialOptions)),r=Bh.create(()=>[...n,...e],t);return Q(this,_a).emit("recreate",r),r}destroy(){var e,t,n,r,o,i;Gt(this,vr,qn.Destroy);for(const s of((e=this.view)==null?void 0:e.state.plugins)??[])(n=(t=s.getState(this.view.state))==null?void 0:t.destroy)==null||n.call(t);(r=Q(this,lo))==null||r.destroy(),(o=Q(this,id))==null||o.call(this);for(const s of Q(this,od))s();for(const s of Q(this,Ea).destroy)s();(i=this.view)==null||i.destroy(),Q(this,_a).emit("destroy")}includes(e){const t=[],n=[];for(const r of Q(this,fi))t.push(r.name,r.constructorName),n.push(r.constructor);return e.every(r=>_e(r)?Do(t,r):Do(n,r))}},Aee=Bh;ls=new WeakMap;td=new WeakMap;ao=new WeakMap;fi=new WeakMap;nd=new WeakMap;vr=new WeakMap;Ca=new WeakMap;rd=new WeakMap;Ea=new WeakMap;od=new WeakMap;_a=new WeakMap;lo=new WeakMap;id=new WeakMap;function Iee(e,t){return!(!hu(e)||!mu(e,en.Manager))}var Dee=Object.defineProperty,Lee=Object.getOwnPropertyDescriptor,Fee=(e,t,n,r)=>{for(var o=r>1?void 0:r?Lee(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Dee(t,n,o),o},AD=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},fe=(e,t,n)=>(AD(e,t,"read from private field"),n?n.call(e):t.get(e)),yr=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},gr=(e,t,n,r)=>(AD(e,t,"write to private field"),t.set(e,n),n),sd,zee=class{constructor(){this.portals=new Map,yr(this,sd,gv()),this.on=e=>fe(this,sd).on("update",e),this.once=e=>{const t=fe(this,sd).on("update",n=>{t(),e(n)});return t}}update(){fe(this,sd).emit("update",this.portals)}render({Component:e,container:t}){const n=this.portals.get(t);this.portals.set(t,{Component:e,key:(n==null?void 0:n.key)??qm()}),this.update()}forceUpdate(){for(const[e,{Component:t}]of this.portals)this.portals.set(e,{Component:t,key:qm()})}remove(e){this.portals.delete(e),this.update()}};sd=new WeakMap;var $ee=e=>{const{portals:t}=e;return ge.createElement(ge.Fragment,null,t.map(([n,{Component:r,key:o}])=>Yn.createPortal(ge.createElement(r,null),n,o)))};function Bee(e){const[t,n]=g.useState(()=>Array.from(e.portals.entries()));return g.useEffect(()=>e.on(r=>{n(Array.from(r.entries()))}),[e]),g.useMemo(()=>t,[t])}var ht,ad,Ta,ld,Vh,cd,$l,ud,Uh,pi,jn,xb,ID=class{constructor({getPosition:e,node:t,portalContainer:n,view:r,ReactComponent:o,options:i}){yr(this,ht,void 0),yr(this,ad,[]),yr(this,Ta,void 0),yr(this,ld,void 0),yr(this,Vh,void 0),yr(this,cd,void 0),yr(this,$l,void 0),yr(this,ud,!1),yr(this,Uh,void 0),yr(this,pi,void 0),yr(this,jn,void 0),yr(this,xb,l=>{l&&(xe(fe(this,pi),{code:K.REACT_NODE_VIEW,message:`You have applied a ref to a node view provided for '${fe(this,ht).type.name}' which doesn't support content.`}),l.append(fe(this,pi)))}),this.Component=()=>{const l=fe(this,Vh);return xe(l,{code:K.REACT_NODE_VIEW,message:`The custom react node view provided for ${fe(this,ht).type.name} doesn't have a valid ReactComponent`}),ge.createElement(l,{updateAttributes:this.updateAttributes,selected:this.selected,view:fe(this,Ta),getPosition:fe(this,cd),node:fe(this,ht),forwardRef:fe(this,xb),decorations:fe(this,ad)})},this.updateAttributes=l=>{if(!fe(this,Ta).editable)return;const c=fe(this,cd).call(this);if(c==null)return;const u=fe(this,Ta).state.tr.setNodeMarkup(c,void 0,{...fe(this,ht).attrs,...l});fe(this,Ta).dispatch(u)},xe(ft(e),{message:"You are attempting to use a node view for a mark type. This is not supported yet. Please check your configuration."}),gr(this,ht,t),gr(this,Ta,r),gr(this,ld,n),gr(this,Vh,o),gr(this,cd,e),gr(this,$l,i),gr(this,jn,this.createDom());const{contentDOM:s,wrapper:a}=this.createContentDom()??{};gr(this,Uh,s??void 0),gr(this,pi,a),fe(this,pi)&&fe(this,jn).append(fe(this,pi)),this.setDomAttributes(fe(this,ht),fe(this,jn)),this.Component.displayName=OA(`${fe(this,ht).type.name}NodeView`),this.renderComponent()}static create(e){const{portalContainer:t,ReactComponent:n,options:r}=e;return(o,i,s)=>new ID({options:r,node:o,view:i,getPosition:s,portalContainer:t,ReactComponent:n})}get selected(){return fe(this,ud)}get contentDOM(){return fe(this,Uh)}get dom(){return fe(this,jn)}renderComponent(){fe(this,ld).render({Component:this.Component,container:fe(this,jn)})}createDom(){const{defaultBlockNode:e,defaultInlineNode:t}=fe(this,$l),n=fe(this,ht).isInline?document.createElement(t):document.createElement(e);return n.classList.add(`${PE(fe(this,ht).type.name)}-node-view-wrapper`),n}createContentDom(){var e,t;if(fe(this,ht).isLeaf)return;const n=(t=(e=fe(this,ht).type.spec).toDOM)==null?void 0:t.call(e,fe(this,ht));if(!n)return;const{contentDOM:r,dom:o}=ha.renderSpec(document,n);let i;if(ri(o))return i=o,o===r&&(i=document.createElement("span"),i.classList.add(`${PE(fe(this,ht).type.name)}-node-view-content-wrapper`),i.append(r)),ri(r),{wrapper:i,contentDOM:r}}update(e,t){return aS({types:fe(this,ht).type,node:e})?(fe(this,ht)===e&&fe(this,ad)===t||(fe(this,ht).sameMarkup(e)||this.setDomAttributes(e,fe(this,jn)),gr(this,ht,e),gr(this,ad,t),this.renderComponent()),!0):!1}setDomAttributes(e,t){const{toDOM:n}=fe(this,ht).type.spec;let r=e.attrs;if(n){const o=n(e);if(_e(o)||Vee(o))return;ml(o[1])&&(r=o[1])}for(const[o,i]of $t(r))t.setAttribute(o,i)}selectNode(){gr(this,ud,!0),fe(this,jn)&&fe(this,jn).classList.add(TE),this.renderComponent()}deselectNode(){gr(this,ud,!1),fe(this,jn)&&fe(this,jn).classList.remove(TE),this.renderComponent()}destroy(){fe(this,ld).remove(fe(this,jn))}ignoreMutation(e){return e.type==="selection"?!fe(this,ht).type.spec.selectable:fe(this,pi)?!fe(this,pi).contains(e.target):!0}stopEvent(e){var t;if(!fe(this,jn))return!1;if(ft(fe(this,$l).stopEvent))return fe(this,$l).stopEvent({event:e});const n=e.target;if(!(fe(this,jn).contains(n)&&!((t=this.contentDOM)!=null&&t.contains(n))))return!1;const o=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!o)return!0;const s=!!fe(this,ht).type.spec.draggable,a=we.isSelectable(fe(this,ht)),l=e.type==="copy",c=e.type==="paste",u=e.type==="cut",d=e.type==="mousedown",f=e.type.startsWith("drag");return!s&&a&&f&&e.preventDefault(),!(f||o||l||c||u||d&&a)}},Z_=ID;ht=new WeakMap;ad=new WeakMap;Ta=new WeakMap;ld=new WeakMap;Vh=new WeakMap;cd=new WeakMap;$l=new WeakMap;ud=new WeakMap;Uh=new WeakMap;pi=new WeakMap;jn=new WeakMap;xb=new WeakMap;function Vee(e){return cb(e)||ml(e)&&cb(e.dom)}var zf=class extends pt{constructor(){super(...arguments),this.portalContainer=new zee}get name(){return"reactComponent"}onCreate(){this.store.setStoreKey("portalContainer",this.portalContainer)}createNodeViews(){const e=he(),t=this.store.managerSettings.nodeViewComponents??{};for(const r of this.store.extensions)!r.ReactComponent||!Op(r)||r.reactComponentEnvironment==="ssr"||(e[r.name]=Z_.create({options:this.options,ReactComponent:r.ReactComponent,portalContainer:this.portalContainer}));const n=$t({...this.options.nodeViewComponents,...t});for(const[r,o]of n)e[r]=Z_.create({options:this.options,ReactComponent:o,portalContainer:this.portalContainer});return e}};zf=Fee([Ge({defaultOptions:{defaultBlockNode:"div",defaultInlineNode:"span",defaultContentNode:"span",defaultEnvironment:"both",nodeViewComponents:{},stopEvent:null},staticKeys:["defaultBlockNode","defaultInlineNode","defaultContentNode","defaultEnvironment"]})],zf);var Uee=Object.defineProperty,Q_=Object.getOwnPropertySymbols,Wee=Object.prototype.hasOwnProperty,Hee=Object.prototype.propertyIsEnumerable,eT=(e,t,n)=>t in e?Uee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tT=(e,t)=>{for(var n in t||(t={}))Wee.call(t,n)&&eT(e,n,t[n]);if(Q_)for(var n of Q_(t))Hee.call(t,n)&&eT(e,n,t[n]);return e};function Kee(e){const t=g.createContext(null),n=qee(t);return[o=>{const i=e(o);return ge.createElement(t.Provider,{value:i},o.children)},n,t]}function qee(e){return(t,n)=>{const r=g.useContext(e),o=Gee(r);if(!r)throw new Error("`useContextHook` must be placed inside the `Provider` returned by the `createContextState` method");if(!t)return r;if(typeof t!="function")throw new TypeError("invalid arguments passed to `useContextHook`. This hook must be called with zero arguments, a getter function or a path string.");const i=t(r);if(!o||!n)return i;const s=t(o);return n(s,i)?s:i}}function Gee(e){const t=g.useRef();return Yee(()=>{t.current=e}),t.current}var Yee=typeof document<"u"?g.useLayoutEffect:g.useEffect;function Jee(e,t){return Kee(n=>{const r=g.useRef(null),o=g.useRef(),i=void 0,[s,a]=g.useState(()=>e({get:nT(r),set:rT(o),previousContext:void 0,props:n,state:i})),l=[...Object.values(n),i];return g.useEffect(()=>{l.length!==0&&a(c=>e({get:nT(r),set:rT(o),previousContext:c,props:n,state:i}))},l),r.current=s,o.current=a,s})}function nT(e){return t=>{if(!e.current)throw new Error("`get` called outside of function scope. `get` can only be called within a function.");if(!t)return e.current;if(typeof t!="function")throw new TypeError("Invalid arguments passed to `useContextHook`. The hook must be called with zero arguments, a getter function or a path string.");return t(e.current)}}function rT(e){return t=>{if(!e.current)throw new Error("`set` called outside of function scope. `set` can only be called within a function.");e.current(n=>tT(tT({},n),typeof t=="function"?t(n):t))}}var DD={},LD={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.errorMessages=e.ErrorType=void 0;var t;(function(n){n.MalformedUnicode="MALFORMED_UNICODE",n.MalformedHexadecimal="MALFORMED_HEXADECIMAL",n.CodePointLimit="CODE_POINT_LIMIT",n.OctalDeprecation="OCTAL_DEPRECATION",n.EndOfString="END_OF_STRING"})(t=e.ErrorType||(e.ErrorType={})),e.errorMessages=new Map([[t.MalformedUnicode,"malformed Unicode character escape sequence"],[t.MalformedHexadecimal,"malformed hexadecimal character escape sequence"],[t.CodePointLimit,"Unicode codepoint must not be greater than 0x10FFFF in escape sequence"],[t.OctalDeprecation,'"0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead'],[t.EndOfString,"malformed escape sequence at end of string"]])})(LD);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.unraw=e.errorMessages=e.ErrorType=void 0;const t=LD;Object.defineProperty(e,"ErrorType",{enumerable:!0,get:function(){return t.ErrorType}}),Object.defineProperty(e,"errorMessages",{enumerable:!0,get:function(){return t.errorMessages}});function n(h){return!h.match(/[^a-f0-9]/i)?parseInt(h,16):NaN}function r(h,m,v){const x=n(h);if(Number.isNaN(x)||v!==void 0&&v!==h.length)throw new SyntaxError(t.errorMessages.get(m));return x}function o(h){const m=r(h,t.ErrorType.MalformedHexadecimal,2);return String.fromCharCode(m)}function i(h,m){const v=r(h,t.ErrorType.MalformedUnicode,4);if(m!==void 0){const x=r(m,t.ErrorType.MalformedUnicode,4);return String.fromCharCode(v,x)}return String.fromCharCode(v)}function s(h){return h.charAt(0)==="{"&&h.charAt(h.length-1)==="}"}function a(h){if(!s(h))throw new SyntaxError(t.errorMessages.get(t.ErrorType.MalformedUnicode));const m=h.slice(1,-1),v=r(m,t.ErrorType.MalformedUnicode);try{return String.fromCodePoint(v)}catch(x){throw x instanceof RangeError?new SyntaxError(t.errorMessages.get(t.ErrorType.CodePointLimit)):x}}function l(h,m=!1){if(m)throw new SyntaxError(t.errorMessages.get(t.ErrorType.OctalDeprecation));const v=parseInt(h,8);return String.fromCharCode(v)}const c=new Map([["b","\b"],["f","\f"],["n",`
367
- `],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function u(h){return c.get(h)||h}const d=/\\(?:(\\)|x([\s\S]{0,2})|u(\{[^}]*\}?)|u([\s\S]{4})\\u([^{][\s\S]{0,3})|u([\s\S]{0,4})|([0-3]?[0-7]{1,2})|([\s\S])|$)/g;function f(h,m=!1){return h.replace(d,function(v,x,b,w,S,k,C,T,_){if(x!==void 0)return"\\";if(b!==void 0)return o(b);if(w!==void 0)return a(w);if(S!==void 0)return i(S,k);if(C!==void 0)return i(C);if(T==="0")return"\0";if(T!==void 0)return l(T,!m);if(_!==void 0)return u(_);throw new SyntaxError(t.errorMessages.get(t.ErrorType.EndOfString))})}e.unraw=f,e.default=f})(DD);const Ha=e=>typeof e=="string",Xee=e=>typeof e=="function",oT=new Map,FD="en";function mS(e){return[...Array.isArray(e)?e:[e],FD]}function zD(e,t,n){const r=mS(e);return fg(()=>pg("date",r,n),()=>new Intl.DateTimeFormat(r,n)).format(Ha(t)?new Date(t):t)}function bb(e,t,n){const r=mS(e);return fg(()=>pg("number",r,n),()=>new Intl.NumberFormat(r,n)).format(t)}function iT(e,t,n,{offset:r=0,...o}){const i=mS(e),s=t?fg(()=>pg("plural-ordinal",i),()=>new Intl.PluralRules(i,{type:"ordinal"})):fg(()=>pg("plural-cardinal",i),()=>new Intl.PluralRules(i,{type:"cardinal"}));return o[n]??o[s.select(n-r)]??o.other}function fg(e,t){const n=e();let r=oT.get(n);return r||(r=t(),oT.set(n,r)),r}function pg(e,t,n){const r=t.join("-");return`${e}-${r}-${JSON.stringify(n)}`}const $D=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,BD="%__lingui_octothorpe__%",Zee=(e,t,n={})=>{const r=t||e,o=s=>typeof s=="object"?s:n[s]||{style:s},i=(s,a)=>{const l=Object.keys(n).length?o("number"):void 0,c=bb(r,s,l);return a.replace(new RegExp(BD,"g"),c)};return{plural:(s,a)=>{const{offset:l=0}=a,c=iT(r,!1,s,a);return i(s-l,c)},selectordinal:(s,a)=>{const{offset:l=0}=a,c=iT(r,!0,s,a);return i(s-l,c)},select:Qee,number:(s,a)=>bb(r,s,o(a)),date:(s,a)=>zD(r,s,o(a))}},Qee=(e,t)=>t[e]??t.other;function ete(e,t,n){return(r={},o)=>{const i=Zee(t,n,o),s=(l,c=!1)=>Array.isArray(l)?l.reduce((u,d)=>{if(d==="#"&&c)return u+BD;if(Ha(d))return u+d;const[f,h,m]=d;let v={};h==="plural"||h==="selectordinal"||h==="select"?Object.entries(m).forEach(([b,w])=>{v[b]=s(w,h==="plural"||h==="selectordinal")}):v=m;let x;if(h){const b=i[h];x=b(r[f],v)}else x=r[f];return x==null?u:u+x},""):l,a=s(e);return Ha(a)&&$D.test(a)?DD.unraw(a.trim()):Ha(a)?a.trim():a?String(a):""}}var tte=Object.defineProperty,nte=(e,t,n)=>t in e?tte(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rte=(e,t,n)=>(nte(e,t+"",n),n);class ote{constructor(){rte(this,"_events",{})}on(t,n){var r;return(r=this._events)[t]??(r[t]=[]),this._events[t].push(n),()=>this.removeListener(t,n)}removeListener(t,n){const r=this._getListeners(t);if(!r)return;const o=r.indexOf(n);~o&&r.splice(o,1)}emit(t,...n){const r=this._getListeners(t);r&&r.map(o=>o.apply(this,n))}_getListeners(t){const n=this._events[t];return Array.isArray(n)?n:!1}}var ite=Object.defineProperty,ste=(e,t,n)=>t in e?ite(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jl=(e,t,n)=>(ste(e,typeof t!="symbol"?t+"":t,n),n);class ate extends ote{constructor(t){super(),jl(this,"_locale",""),jl(this,"_locales"),jl(this,"_localeData",{}),jl(this,"_messages",{}),jl(this,"_missing"),jl(this,"t",this._.bind(this)),t.missing!=null&&(this._missing=t.missing),t.messages!=null&&this.load(t.messages),t.localeData!=null&&this.loadLocaleData(t.localeData),(typeof t.locale=="string"||t.locales)&&this.activate(t.locale??FD,t.locales)}get locale(){return this._locale}get locales(){return this._locales}get messages(){return this._messages[this._locale]??{}}get localeData(){return this._localeData[this._locale]??{}}_loadLocaleData(t,n){const r=this._localeData[t];r?Object.assign(r,n):this._localeData[t]=n}loadLocaleData(t,n){n!=null?this._loadLocaleData(t,n):Object.keys(t).forEach(r=>this._loadLocaleData(r,t[r])),this.emit("change")}_load(t,n){const r=this._messages[t];r?Object.assign(r,n):this._messages[t]=n}load(t,n){typeof t=="string"&&typeof n=="object"?this._load(t,n):Object.entries(t).forEach(([r,o])=>this._load(r,o)),this.emit("change")}loadAndActivate({locale:t,locales:n,messages:r}){this._locale=t,this._locales=n||void 0,this._messages[this._locale]=r,this.emit("change")}activate(t,n){this._locale=t,this._locales=n,this.emit("change")}_(t,n,r){let o=r==null?void 0:r.message;t||(t=""),Ha(t)||(n=t.values||n,o=t.message,t=t.id);const i=this.messages[t],s=i===void 0,a=this._missing;if(a&&s)return Xee(a)?a(this._locale,t):a;s&&this.emit("missing",{id:t,locale:this._locale});let l=i||o||t;return Ha(l)&&$D.test(l)?JSON.parse(`"${l}"`):Ha(l)?l:ete(l,this._locale,this._locales)(n,r==null?void 0:r.formats)}date(t,n){return zD(this._locales||this._locale,t,n)}number(t,n){return bb(this._locales||this._locale,t,n)}}function lte(e={}){return new ate(e)}const Rv=lte();function Y(e,t){return t?"other":e==1?"one":"other"}function Ui(e,t){return t?"other":e==0||e==1?"one":"other"}function pr(e,t){var n=String(e).split("."),r=!n[1];return t?"other":e==1&&r?"one":"other"}function Xe(e,t){return"other"}function ga(e,t){return t?"other":e==1?"one":e==2?"two":"other"}const cte=Xe,ute=Y,dte=Ui;function fte(e,t){return t?"other":e>=0&&e<=1?"one":"other"}const pte=Y;function hte(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2);return t?"other":e==0?"zero":e==1?"one":e==2?"two":o>=3&&o<=10?"few":o>=11&&o<=99?"many":"other"}function mte(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2);return t?"other":e==0?"zero":e==1?"one":e==2?"two":o>=3&&o<=10?"few":o>=11&&o<=99?"many":"other"}function gte(e,t){return t?e==1||e==5||e==7||e==8||e==9||e==10?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e>=0&&e<=1?"one":"other"}const vte=Y,yte=pr;function xte(e,t){var n=String(e).split("."),r=n[0],o=r.slice(-1),i=r.slice(-2),s=r.slice(-3);return t?o==1||o==2||o==5||o==7||o==8||i==20||i==50||i==70||i==80?"one":o==3||o==4||s==100||s==200||s==300||s==400||s==500||s==600||s==700||s==800||s==900?"few":r==0||o==6||i==40||i==60||i==90?"many":"other":e==1?"one":"other"}function bte(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2);return t?(o==2||o==3)&&i!=12&&i!=13?"few":"other":o==1&&i!=11?"one":o>=2&&o<=4&&(i<12||i>14)?"few":r&&o==0||o>=5&&o<=9||i>=11&&i<=14?"many":"other"}const wte=Y,Ste=Y,kte=Y,Cte=Ui,Ete=Xe;function _te(e,t){return t?e==1||e==5||e==7||e==8||e==9||e==10?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e>=0&&e<=1?"one":"other"}const Tte=Xe;function Ote(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2),s=r&&n[0].slice(-6);return t?"other":o==1&&i!=11&&i!=71&&i!=91?"one":o==2&&i!=12&&i!=72&&i!=92?"two":(o==3||o==4||o==9)&&(i<10||i>19)&&(i<70||i>79)&&(i<90||i>99)?"few":e!=0&&r&&s==0?"many":"other"}const Nte=Y;function Mte(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":i&&s==1&&a!=11||l==1&&c!=11?"one":i&&s>=2&&s<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function Pte(e,t){var n=String(e).split("."),r=!n[1];return t?e==1||e==3?"one":e==2?"two":e==4?"few":"other":e==1&&r?"one":"other"}const Rte=Y;function jte(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=o.slice(-1);return t?"other":i&&(r==1||r==2||r==3)||i&&s!=4&&s!=6&&s!=9||!i&&a!=4&&a!=6&&a!=9?"one":"other"}const Ate=Y,Ite=Y,Dte=Y;function Lte(e,t){var n=String(e).split("."),r=n[0],o=!n[1];return t?"other":e==1&&o?"one":r>=2&&r<=4&&o?"few":o?"other":"many"}function Fte(e,t){return t?e==0||e==7||e==8||e==9?"zero":e==1?"one":e==2?"two":e==3||e==4?"few":e==5||e==6?"many":"other":e==0?"zero":e==1?"one":e==2?"two":e==3?"few":e==6?"many":"other"}function zte(e,t){var n=String(e).split("."),r=n[0],o=Number(n[0])==e;return t?"other":e==1||!o&&(r==0||r==1)?"one":"other"}const $te=pr;function Bte(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-2),a=o.slice(-2);return t?"other":i&&s==1||a==1?"one":i&&s==2||a==2?"two":i&&(s==3||s==4)||a==3||a==4?"few":"other"}const Vte=Y,Ute=Xe,Wte=Y,Hte=Y;function Kte(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-1),s=o&&n[0].slice(-2);return t?i==1&&s!=11?"one":i==2&&s!=12?"two":i==3&&s!=13?"few":"other":e==1&&r?"one":"other"}const qte=Y,Gte=Y,Yte=pr,Jte=Y;function Xte(e,t){return t?"other":e>=0&&e<=1?"one":"other"}function Zte(e,t){return t?"other":e>=0&&e<2?"one":"other"}const Qte=pr;function ene(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=o.slice(-1);return t?e==1?"one":"other":i&&(r==1||r==2||r==3)||i&&s!=4&&s!=6&&s!=9||!i&&a!=4&&a!=6&&a!=9?"one":"other"}const tne=Y;function nne(e,t){return t?e==1?"one":"other":e>=0&&e<2?"one":"other"}const rne=Y,one=pr;function ine(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?e==1?"one":"other":e==1?"one":e==2?"two":r&&e>=3&&e<=6?"few":r&&e>=7&&e<=10?"many":"other"}function sne(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?e==1||e==11?"one":e==2||e==12?"two":e==3||e==13?"few":"other":e==1||e==11?"one":e==2||e==12?"two":r&&e>=3&&e<=10||r&&e>=13&&e<=19?"few":"other"}const ane=pr,lne=Y;function cne(e,t){return t?e==1?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e>=0&&e<=1?"one":"other"}const une=Ui;function dne(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return t?"other":o&&i==1?"one":o&&i==2?"two":o&&(s==0||s==20||s==40||s==60||s==80)?"few":o?"other":"many"}const fne=Y,pne=Y;function hne(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=Number(n[0])==e,s=i&&n[0].slice(-1);return t?"other":e==1&&o?"one":r==2&&o?"two":o&&(e<0||e>10)&&i&&s==0?"many":"other"}function mne(e,t){return t?e==1?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e>=0&&e<=1?"one":"other"}function gne(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":i&&s==1&&a!=11||l==1&&c!=11?"one":i&&s>=2&&s<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function vne(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-2),a=o.slice(-2);return t?"other":i&&s==1||a==1?"one":i&&s==2||a==2?"two":i&&(s==3||s==4)||a==3||a==4?"few":"other"}function yne(e,t){return t?e==1||e==5?"one":"other":e==1?"one":"other"}function xne(e,t){return t?e==1?"one":"other":e>=0&&e<2?"one":"other"}const bne=pr,wne=Xe,Sne=Xe,kne=Xe,Cne=pr;function Ene(e,t){var n=String(e).split("."),r=n[0],o=Number(n[0])==e,i=r.slice(-1),s=r.slice(-2);return t?"other":o&&i==1&&s!=11||!o?"one":"other"}function _ne(e,t){var n=String(e).split("."),r=!n[1];return t?e==11||e==8||e==80||e==800?"many":"other":e==1&&r?"one":"other"}const Tne=ga;function One(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=Number(n[0])==e,s=i&&n[0].slice(-1);return t?"other":e==1&&o?"one":r==2&&o?"two":o&&(e<0||e>10)&&i&&s==0?"many":"other"}const Nne=Xe,Mne=Xe,Pne=Y,Rne=pr,jne=Y,Ane=Xe,Ine=Xe;function Dne(e,t){var n=String(e).split("."),r=n[0],o=r.slice(-2);return t?r==1?"one":r==0||o>=2&&o<=20||o==40||o==60||o==80?"many":"other":e==1?"one":"other"}function Lne(e,t){return t?"other":e>=0&&e<2?"one":"other"}const Fne=Y,zne=Y,$ne=Xe,Bne=Xe;function Vne(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1);return t?o==6||o==9||r&&o==0&&e!=0?"many":"other":e==1?"one":"other"}const Une=Y,Wne=Y,Hne=Xe;function Kne(e,t){return t?"other":e>=0&&e<=1?"one":"other"}const qne=Xe,Gne=Y,Yne=Y;function Jne(e,t){return t?"other":e==0?"zero":e==1?"one":"other"}const Xne=Y;function Zne(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2),i=r&&n[0].slice(-3),s=r&&n[0].slice(-5),a=r&&n[0].slice(-6);return t?r&&e>=1&&e<=4||o>=1&&o<=4||o>=21&&o<=24||o>=41&&o<=44||o>=61&&o<=64||o>=81&&o<=84?"one":e==5||o==5?"many":"other":e==0?"zero":e==1?"one":o==2||o==22||o==42||o==62||o==82||r&&i==0&&(s>=1e3&&s<=2e4||s==4e4||s==6e4||s==8e4)||e!=0&&a==1e5?"two":o==3||o==23||o==43||o==63||o==83?"few":e!=1&&(o==1||o==21||o==41||o==61||o==81)?"many":"other"}const Qne=Y;function ere(e,t){var n=String(e).split("."),r=n[0];return t?"other":e==0?"zero":(r==0||r==1)&&e!=0?"one":"other"}const tre=Y,nre=Y,rre=Xe,ore=Ui;function ire(e,t){return t&&e==1?"one":"other"}function sre(e,t){var n=String(e).split("."),r=n[1]||"",o=Number(n[0])==e,i=o&&n[0].slice(-1),s=o&&n[0].slice(-2);return t?"other":i==1&&(s<11||s>19)?"one":i>=2&&i<=9&&(s<11||s>19)?"few":r!=0?"many":"other"}function are(e,t){var n=String(e).split("."),r=n[1]||"",o=r.length,i=Number(n[0])==e,s=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-2),c=r.slice(-1);return t?"other":i&&s==0||a>=11&&a<=19||o==2&&l>=11&&l<=19?"zero":s==1&&a!=11||o==2&&c==1&&l!=11||o!=2&&c==1?"one":"other"}const lre=Y,cre=Ui,ure=Y;function dre(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?s==1&&a!=11?"one":s==2&&a!=12?"two":(s==7||s==8)&&a!=17&&a!=18?"many":"other":i&&s==1&&a!=11||l==1&&c!=11?"one":"other"}const fre=Y,pre=Y;function hre(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-2);return t?e==1?"one":"other":e==1&&r?"one":!r||e==0||i>=2&&i<=19?"few":"other"}function mre(e,t){return t?e==1?"one":e==2||e==3?"two":e==4?"few":"other":e==1?"one":"other"}function gre(e,t){return t&&e==1?"one":"other"}function vre(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2);return t?"other":e==1?"one":e==0||o>=2&&o<=10?"few":o>=11&&o<=19?"many":"other"}const yre=Xe,xre=Y,bre=ga,wre=Y,Sre=Y;function kre(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?r&&e>=1&&e<=4?"one":"other":e==1?"one":"other"}const Cre=pr,Ere=Y,_re=Y,Tre=Y,Ore=Xe,Nre=Y,Mre=Ui,Pre=Y,Rre=Y,jre=Y;function Are(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?e==1||e==5||r&&e>=7&&e<=9?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e==1?"one":"other"}const Ire=Y,Dre=Xe,Lre=Ui,Fre=Y;function zre(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return t?"other":e==1&&o?"one":o&&i>=2&&i<=4&&(s<12||s>14)?"few":o&&r!=1&&(i==0||i==1)||o&&i>=5&&i<=9||o&&s>=12&&s<=14?"many":"other"}function $re(e,t){var n=String(e).split("."),r=n[1]||"",o=r.length,i=Number(n[0])==e,s=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-2),c=r.slice(-1);return t?"other":i&&s==0||a>=11&&a<=19||o==2&&l>=11&&l<=19?"zero":s==1&&a!=11||o==2&&c==1&&l!=11||o!=2&&c==1?"one":"other"}const Bre=Y;function Vre(e,t){var n=String(e).split("."),r=n[0];return t?"other":r==0||r==1?"one":"other"}const Ure=pr,Wre=Y;function Hre(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-2);return t?e==1?"one":"other":e==1&&r?"one":!r||e==0||i>=2&&i<=19?"few":"other"}const Kre=Y,qre=Xe;function Gre(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return t?"other":o&&i==1&&s!=11?"one":o&&i>=2&&i<=4&&(s<12||s>14)?"few":o&&i==0||o&&i>=5&&i<=9||o&&s>=11&&s<=14?"many":"other"}const Yre=Y,Jre=Xe,Xre=Y;function Zre(e,t){var n=String(e).split("."),r=!n[1];return t?e==11||e==8||e==80||e==800?"many":"other":e==1&&r?"one":"other"}function Qre(e,t){var n=String(e).split("."),r=!n[1];return t?e==11||e==8||e==80||e==800?"many":"other":e==1&&r?"one":"other"}const eoe=Y,toe=Y,noe=ga,roe=Y,ooe=Xe,ioe=Xe;function soe(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":i&&s==1&&a!=11||l==1&&c!=11?"one":i&&s>=2&&s<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function aoe(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?"other":e>=0&&e<=1?"one":r&&e>=2&&e<=10?"few":"other"}function loe(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"";return t?"other":e==0||e==1||r==0&&o==1?"one":"other"}function coe(e,t){var n=String(e).split("."),r=n[0],o=!n[1];return t?"other":e==1&&o?"one":r>=2&&r<=4&&o?"few":o?"other":"many"}function uoe(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-2);return t?"other":o&&i==1?"one":o&&i==2?"two":o&&(i==3||i==4)||!o?"few":"other"}const doe=ga,foe=ga,poe=ga,hoe=ga,moe=ga,goe=Y,voe=Y;function yoe(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2);return t?e==1?"one":o==4&&i!=14?"many":"other":e==1?"one":"other"}function xoe(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":i&&s==1&&a!=11||l==1&&c!=11?"one":i&&s>=2&&s<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}const boe=Y,woe=Y,Soe=Y,koe=Xe;function Coe(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-1),s=o&&n[0].slice(-2);return t?(i==1||i==2)&&s!=11&&s!=12?"one":"other":e==1&&r?"one":"other"}const Eoe=pr,_oe=Y,Toe=Y,Ooe=Y,Noe=Y,Moe=Xe,Poe=Ui,Roe=Y;function joe(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1);return t?o==6||o==9||e==10?"few":"other":e==1?"one":"other"}function Aoe(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=o.slice(-1);return t?e==1?"one":"other":i&&(r==1||r==2||r==3)||i&&s!=4&&s!=6&&s!=9||!i&&a!=4&&a!=6&&a!=9?"one":"other"}const Ioe=Y,Doe=Xe,Loe=Y,Foe=Y;function zoe(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?"other":e==0||e==1||r&&e>=11&&e<=99?"one":"other"}const $oe=Y;function Boe(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=Number(n[0])==e,s=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-1),c=r.slice(-2);return t?s==3&&a!=13?"few":"other":o&&l==1&&c!=11?"one":o&&l>=2&&l<=4&&(c<12||c>14)?"few":o&&l==0||o&&l>=5&&l<=9||o&&c>=11&&c<=14?"many":"other"}const Voe=pr,Uoe=Y,Woe=Y;function Hoe(e,t){return t&&e==1?"one":"other"}const Koe=Y,qoe=Y,Goe=Ui,Yoe=Y,Joe=Xe,Xoe=Y,Zoe=Y,Qoe=pr,eie=Xe,tie=Xe,nie=Xe;function rie(e,t){return t?"other":e>=0&&e<=1?"one":"other"}const oie=Object.freeze(Object.defineProperty({__proto__:null,_in:cte,af:ute,ak:dte,am:fte,an:pte,ar:hte,ars:mte,as:gte,asa:vte,ast:yte,az:xte,be:bte,bem:wte,bez:Ste,bg:kte,bho:Cte,bm:Ete,bn:_te,bo:Tte,br:Ote,brx:Nte,bs:Mte,ca:Pte,ce:Rte,ceb:jte,cgg:Ate,chr:Ite,ckb:Dte,cs:Lte,cy:Fte,da:zte,de:$te,dsb:Bte,dv:Vte,dz:Ute,ee:Wte,el:Hte,en:Kte,eo:qte,es:Gte,et:Yte,eu:Jte,fa:Xte,ff:Zte,fi:Qte,fil:ene,fo:tne,fr:nne,fur:rne,fy:one,ga:ine,gd:sne,gl:ane,gsw:lne,gu:cne,guw:une,gv:dne,ha:fne,haw:pne,he:hne,hi:mne,hr:gne,hsb:vne,hu:yne,hy:xne,ia:bne,id:wne,ig:Sne,ii:kne,io:Cne,is:Ene,it:_ne,iu:Tne,iw:One,ja:Nne,jbo:Mne,jgo:Pne,ji:Rne,jmc:jne,jv:Ane,jw:Ine,ka:Dne,kab:Lne,kaj:Fne,kcg:zne,kde:$ne,kea:Bne,kk:Vne,kkj:Une,kl:Wne,km:Hne,kn:Kne,ko:qne,ks:Gne,ksb:Yne,ksh:Jne,ku:Xne,kw:Zne,ky:Qne,lag:ere,lb:tre,lg:nre,lkt:rre,ln:ore,lo:ire,lt:sre,lv:are,mas:lre,mg:cre,mgo:ure,mk:dre,ml:fre,mn:pre,mo:hre,mr:mre,ms:gre,mt:vre,my:yre,nah:xre,naq:bre,nb:wre,nd:Sre,ne:kre,nl:Cre,nn:Ere,nnh:_re,no:Tre,nqo:Ore,nr:Nre,nso:Mre,ny:Pre,nyn:Rre,om:jre,or:Are,os:Ire,osa:Dre,pa:Lre,pap:Fre,pl:zre,prg:$re,ps:Bre,pt:Vre,pt_PT:Ure,rm:Wre,ro:Hre,rof:Kre,root:qre,ru:Gre,rwk:Yre,sah:Jre,saq:Xre,sc:Zre,scn:Qre,sd:eoe,sdh:toe,se:noe,seh:roe,ses:ooe,sg:ioe,sh:soe,shi:aoe,si:loe,sk:coe,sl:uoe,sma:doe,smi:foe,smj:poe,smn:hoe,sms:moe,sn:goe,so:voe,sq:yoe,sr:xoe,ss:boe,ssy:woe,st:Soe,su:koe,sv:Coe,sw:Eoe,syr:_oe,ta:Toe,te:Ooe,teo:Noe,th:Moe,ti:Poe,tig:Roe,tk:joe,tl:Aoe,tn:Ioe,to:Doe,tr:Loe,ts:Foe,tzm:zoe,ug:$oe,uk:Boe,ur:Voe,uz:Uoe,ve:Woe,vi:Hoe,vo:Koe,vun:qoe,wa:Goe,wae:Yoe,wo:Joe,xh:Xoe,xog:Zoe,yi:Qoe,yo:eie,yue:tie,zh:nie,zu:rie},Symbol.toStringTag,{value:"Module"}));var iie=Object.defineProperty,sie=Object.getOwnPropertyDescriptor,aie=Object.getOwnPropertyNames,lie=Object.prototype.hasOwnProperty,cie=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of aie(t))!lie.call(e,o)&&o!==n&&iie(e,o,{get:()=>t[o],enumerable:!(r=sie(t,o))||r.enumerable});return e},uie=(e,t,n)=>(cie(e,t,"default"),n),die=JSON.parse('{"extension.command.toggle-upper-case.label":[["case","select",{"upper":"Uppercase","lower":"Lowercase","capitalize":"Sentence case","smallCaps":"Small caps","other":"Text case"}]],"extension.table.column_count":[["count","plural",{"one":["#"," column"],"other":["#"," columns"]}]],"extension.table.row_count":[["count","plural",{"one":["#"," row"],"other":["#"," rows"]}]],"extension.command.toggle-columns.description":[["count","select",{"2":"Split the block into two columns","3":"Split the current block into three columns","4":"Split the current block into four columns","other":"Split the current block into multiple columns"}]],"extension.command.toggle-columns.label":[["count","select",{"2":"Two Column Block","3":"Three Column Block","4":"Four Column Block","other":"Multi Column Block"}]],"extension.command.set-text-direction.label":[["dir","select",{"ltr":"Left-To-Right","rtl":"Right-To-Left","other":"Reset Direction"}]],"extension.command.set-text-direction.description":[["dir","select",{"ltr":"Set the text direction from left to right","rtl":"Set the text direction from right to left","other":"Reset text direction"}]],"extension.command.toggle-heading.label":[["level","select",{"1":"Heading 1","2":"Heading 2","3":"Heading 3","4":"Heading 4","5":"Heading 5","6":"Heading 6","other":"Heading"}]],"extension.command.toggle-callout.description":[["type","select",{"info":"Create an information callout block","warning":"Create a warning callout block","error":"Create an error callout block","success":"Create a success callout block","other":"Create a callout block"}]],"extension.command.toggle-callout.label":[["type","select",{"info":"Information Callout","warning":"Warning Callout","error":"Error Callout","success":"Success Callout","other":"Callout"}]],"extension.command.toggle-code-block.description":"Add a code block","extension.command.add-annotation.label":"Add annotation","extension.command.toggle-blockquote.description":"Add blockquote formatting to the selected text","extension.command.toggle-bold.description":"Add bold formatting to the selected text","extension.command.toggle-code.description":"Add inline code formatting to the selected text","keyboard.shortcut.alt":"Alt","keyboard.shortcut.arrowDown":"Arrow Down","keyboard.shortcut.arrowLeft":"Arrow Left","keyboard.shortcut.arrowRight":"Arrow Right","keyboard.shortcut.arrowUp":"Arrow Up","keyboard.shortcut.backspace":"Backspace","ui.text-color.black":"Black","extension.command.toggle-blockquote.label":"Blockquote","ui.text-color.blue":"Blue","ui.text-color.blue.hue":["Blue ",["hue"]],"extension.command.toggle-bold.label":"Bold","extension.command.toggle-bullet-list.description":"Bulleted list","keyboard.shortcut.capsLock":"Caps Lock","extension.command.center-align.label":"Center align","extension.command.toggle-code.label":"Code","extension.command.toggle-code-block.label":"Codeblock","keyboard.shortcut.command":"Command","QcPNd6":"Image description","ogrUzJ":"Add a short description here.","yqdyzr":"Image","6/02F4":"Image source","X8H91v":"Image","zhQ7Zt":"Italic","ZL7E7l":"Underline","keyboard.shortcut.control":"Control","extension.command.convert-paragraph.description":"Convert current block into a paragraph block.","extension.command.convert-paragraph.label":"Convert Paragraph","extension.command.copy.label":"Copy","extension.command.copy.description":"Copy the selected text","extension.command.create-table.description":"Create a table with set number of rows and columns.","extension.command.create-table.label":"Create table","extension.command.cut.label":"Cut","extension.command.cut.description":"Cut the selected text","ui.text-color.cyan":"Cyan","ui.text-color.cyan.hue":["Cyan ",["hue"]],"extension.command.decrease-font-size.label":"Decrease","extension.command.decrease-indent.label":"Decrease indentation","extension.command.decrease-font-size.description":"Decrease the font size.","keyboard.shortcut.delete":"Delete","extension.command.insert-horizontal-rule.label":"Divider","keyboard.shortcut.end":"End","keyboard.shortcut.escape":"Enter","keyboard.shortcut.enter":"Enter","6PjrOF":"Add annotation","OTq5WC":"Center align","oeZ3ox":"Convert current block into a paragraph block.","m1khs+":"Convert Paragraph","w/1U+3":"Copy the selected text","kdodi0":"Copy","k0KR/u":"Create a table with set number of rows and columns.","zrwMyD":"Create table","D/nWxh":"Cut the selected text","jHPv5m":"Cut","5cNgRx":"Decrease the font size.","vyRNWx":"Decrease","Jgiol4":"Decrease indentation","1gJSHH":"Increase the font size","OQXJXz":"Increase","72TLhr":"Increase indentation","HFlfzJ":"Insert Emoji","RPq9fY":"Separate content with a diving horizontal line","OKQF+e":"Divider","zjYb9C":"Insert a new paragraph","4M4sXC":"Insert Paragraph","1Q+eVc":"Justify","ejWWtP":"Left align","wVqrpS":"Paste content into the editor","07v9aw":"Paste","zUYfou":"Redo the most recent action","9Nq9zr":"Redo","0uxaZe":"Remove annotation","iJWZAz":"Right align","g5WpPn":"Select all content within the editor","2+pZDT":"Select all","yChCR1":"Set text case","GMzAC/":"Set the font size for the selected text.","vzEyrv":"Font size","7VCkJ8":"Set the text color for the selected text.","qjWFaR":"Text color","LVWgFu":[["dir","select",{"ltr":"Set the text direction from left to right","rtl":"Set the text direction from right to left","other":"Reset text direction"}]],"WXwRy1":[["dir","select",{"ltr":"Left-To-Right","rtl":"Right-To-Left","other":"Reset Direction"}]],"G/o315":"Set the text highlight color for the selected text.","xtHg6d":"Text highlight","1p1W/p":"Add blockquote formatting to the selected text","6+rh6I":"Blockquote","0yB3LV":"Add bold formatting to the selected text","sFMo4Z":"Bold","SMKG/s":"Bulleted list","/BYCMi":[["type","select",{"info":"Create an information callout block","warning":"Create a warning callout block","error":"Create an error callout block","success":"Create a success callout block","other":"Create a callout block"}]],"V+3IBe":[["type","select",{"info":"Information Callout","warning":"Warning Callout","error":"Error Callout","success":"Success Callout","other":"Callout"}]],"hbIo4L":"Add a code block","7GkMcx":"Codeblock","2r4JYl":"Add inline code formatting to the selected text","Up8Tpe":"Code","ATHSPS":[["count","select",{"2":"Split the block into two columns","3":"Split the current block into three columns","4":"Split the current block into four columns","other":"Split the current block into multiple columns"}]],"7DC1VE":[["count","select",{"2":"Two Column Block","3":"Three Column Block","4":"Four Column Block","other":"Multi Column Block"}]],"hnrBeo":[["level","select",{"1":"Heading 1","2":"Heading 2","3":"Heading 3","4":"Heading 4","5":"Heading 5","6":"Heading 6","other":"Heading"}]],"NkZAcw":"Italicize the selected text","2fTW9e":"Italic","c759Ra":"Ordered list","uQwrZu":"Strikethrough the selected text","pT3qly":"Strikethrough","BHk+zu":"Subscript","18BVwM":"Superscript","tOIVCV":"Tasked list","4Janx3":"Underline the selected text","dCHt+D":"Underline","YYAprs":[["case","select",{"upper":"Uppercase","lower":"Lowercase","capitalize":"Sentence case","smallCaps":"Small caps","other":"Text case"}]],"tczyZL":"Show hidden whitespace characters in your editor.","0qAX23":"Toggle Whitespace","ezMADU":"Undo the most recent action","N3P7EC":"Undo","2nj/+s":"Update annotation","dWD7u4":[["count","plural",{"one":["#"," column"],"other":["#"," columns"]}]],"qXqgVT":[["count","plural",{"one":["#"," row"],"other":["#"," rows"]}]],"extension.command.set-font-size.label":"Font size","ui.text-color.grape":"Grape","ui.text-color.grape.hue":["Grape ",["hue"]],"ui.text-color.gray":"Gray","ui.text-color.gray.hue":["Gray ",["hue"]],"ui.text-color.green":"Green","ui.text-color.green.hue":["Green ",["hue"]],"keyboard.shortcut.home":"Home","extension.command.increase-font-size.label":"Increase","extension.command.increase-indent.label":"Increase indentation","extension.command.increase-font-size.description":"Increase the font size","ui.text-color.indigo":"Indigo","ui.text-color.indigo.hue":["Indigo ",["hue"]],"extension.command.insert-paragraph.description":"Insert a new paragraph","extension.command.insert-emoji.label":"Insert Emoji","extension.command.insert-paragraph.label":"Insert Paragraph","extension.command.toggle-italic.label":"Italic","extension.command.toggle-italic.description":"Italicize the selected text","extension.command.justify-align.label":"Justify","R7NlCw":"Alt","RbDiK5":"Arrow Down","Dgyd+E":"Arrow Left","8pdCk4":"Arrow Right","Gp/343":"Arrow Up","PFPV0A":"Backspace","0IRYvp":"Caps Lock","X7HX0D":"Command","zq0AdD":"Control","8SfToN":"Delete","Ys/uah":"End","3K5hww":"Enter","veQt1j":"Enter","ySv7i+":"Home","e6RUI1":"Page Down","EEJk31":"Page Up","7sbhAU":"Shift","Q4eplT":"Space","SUhVVC":"Tab","extension.command.left-align.label":"Left align","ui.text-color.lime":"Lime","ui.text-color.lime.hue":["Lime ",["hue"]],"react-components.mention-atom-component.zero-items":"No items available","ui.text-color.orange":"Orange","ui.text-color.orange.hue":["Orange ",["hue"]],"extension.command.toggle-ordered-list.label":"Ordered list","keyboard.shortcut.pageDown":"Page Down","keyboard.shortcut.pageUp":"Page Up","extension.command.paste.label":"Paste","extension.command.paste.description":"Paste content into the editor","ui.text-color.pink":"Pink","ui.text-color.pink.hue":["Pink ",["hue"]],"zvMfIA":"No items available","pEjhti":"Static Menu","ui.text-color.red":"Red","ui.text-color.red.hue":["Red ",["hue"]],"extension.command.redo.label":"Redo","extension.command.redo.description":"Redo the most recent action","extension.command.remove-annotation.label":"Remove annotation","extension.command.right-align.label":"Right align","extension.command.select-all.label":"Select all","extension.command.select-all.description":"Select all content within the editor","extension.command.insert-horizontal-rule.description":"Separate content with a diving horizontal line","extension.command.set-casing.label":"Set text case","extension.command.set-font-size.description":"Set the font size for the selected text.","extension.command.set-text-color.description":"Set the text color for the selected text.","extension.command.set-text-highlight.description":"Set the text highlight color for the selected text.","keyboard.shortcut.shift":"Shift","extension.command.toggle-whitespace.description":"Show hidden whitespace characters in your editor.","keyboard.shortcut.space":"Space","extension.command.toggle-strike.label":"Strikethrough","extension.command.toggle-strike.description":"Strikethrough the selected text","extension.command.toggle-subscript.label":"Subscript","extension.command.toggle-superscript.label":"Superscript","keyboard.shortcut.tab":"Tab","extension.command.toggle-task-list.description":"Tasked list","ui.text-color.teal":"Teal","ui.text-color.teal.hue":["Teal ",["hue"]],"extension.command.set-text-color.label":"Text color","extension.command.set-text-highlight.label":"Text highlight","extension.command.toggle-whitespace.label":"Toggle Whitespace","ui.text-color.transparent":"Transparent","slrB1c":"Black","6QML30":"Blue","xw+keN":["Blue ",["hue"]],"38RHqP":"Cyan","D89yPf":["Cyan ",["hue"]],"VjBLnd":"Grape","Rp40yv":["Grape ",["hue"]],"5Dm9D1":"Gray","HGjXjC":["Gray ",["hue"]],"b9fz+n":"Green","18jo3M":["Green ",["hue"]],"CFzqCV":"Indigo","aVlDku":["Indigo ",["hue"]],"04PfLc":"Lime","KRTK6Y":["Lime ",["hue"]],"pSnXFd":"Orange","ve/MJZ":["Orange ",["hue"]],"OvCgDa":"Pink","l7NqyT":["Pink ",["hue"]],"IT9k0j":"Red","AdyJ7/":["Red ",["hue"]],"3D2UWc":"Teal","Dcq0Y1":["Teal ",["hue"]],"bsi2ik":"Transparent","Tj3PRR":"Violet","xxMH5N":["Violet ",["hue"]],"Rum0ah":"White","4gaw/Q":"Yellow","hhauc3":["Yellow ",["hue"]],"extension.command.toggle-underline.label":"Underline","extension.command.toggle-underline.description":"Underline the selected text","extension.command.undo.label":"Undo","extension.command.undo.description":"Undo the most recent action","extension.command.update-annotation.label":"Update annotation","ui.text-color.violet":"Violet","ui.text-color.violet.hue":["Violet ",["hue"]],"ui.text-color.white":"White","ui.text-color.yellow":"Yellow","ui.text-color.yellow.hue":["Yellow ",["hue"]]}'),VD={};uie(VD,oie);Rv.loadLocaleData("en",{plurals:VD.en});Rv.load("en",die);Rv.activate("en");var fie=Object.defineProperty,pie=Object.getOwnPropertyDescriptor,gS=(e,t,n,r)=>{for(var o=r>1?void 0:r?pie(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&fie(t,n,o),o},Gc=class extends to{get name(){return"doc"}createNodeSpec(e,t){const{docAttributes:n,content:r}=this.options,o=he();if(ml(n))for(const[i,s]of $t(n))o[i]={default:s};else for(const i of n)o[i]={default:null};return{attrs:o,content:r,...t}}setDocAttributes(e){return({tr:t,dispatch:n})=>{if(n){for(const[r,o]of Object.entries(e))t.step(new wb(r,o));n(t)}return!0}}isDefaultDocNode({state:e=this.store.getState(),options:t}={}){return dS(e.doc,t)}};gS([de()],Gc.prototype,"setDocAttributes",1);gS([Ct()],Gc.prototype,"isDefaultDocNode",1);Gc=gS([Ge({defaultOptions:{content:"block+",docAttributes:[]},defaultPriority:et.Medium,staticKeys:["content","docAttributes"],disableExtraAttributes:!0})],Gc);var UD="SetDocAttribute",WD="RevertSetDocAttribute",wb=class Sb extends Vt{constructor(n,r,o=UD){super();Et(this,"key");Et(this,"stepType");Et(this,"value");Et(this,"previous");this.stepType=o,this.key=n,this.value=r}static fromJSON(n,r){return new Sb(r.key,r.value,r.stepType)}apply(n){this.previous=n.attrs[this.key];const r={...n.attrs,[this.key]:this.value};return Tt.ok(n.type.create(r,n.content,n.marks))}invert(){return new Sb(this.key,this.previous,WD)}map(){return this}toJSON(){return{stepType:this.stepType,key:this.key,value:this.value}}};try{Vt.jsonID(UD,wb),Vt.jsonID(WD,wb)}catch(e){if(!e.message.startsWith("Duplicate use of step JSON ID"))throw e}var hie=Object.defineProperty,mie=Object.getOwnPropertyDescriptor,HD=(e,t,n,r)=>{for(var o=r>1?void 0:r?mie(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&hie(t,n,o),o};function gie(e,t,n,r){const o=e.docView.posFromDOM(t,n,r);return o===null||o<0?null:o}function vie(e,t){const n=t.target;if(n){const r=gie(e,n,0);if(r!==null){const o=e.state.doc.resolve(r),i=o.node().isLeaf?0:1,s=o.start()-i;return{pos:r,inside:s}}}return e.posAtCoords({left:t.clientX,top:t.clientY})??void 0}var hg=class extends pt{constructor(){super(...arguments),this.mousedown=!1,this.mouseover=!1,this.createMouseEventHandler=e=>(t,n)=>{const r=n,o=vie(t,r);if(!o)return!1;const i=[],s=[],{inside:a,pos:l}=o;if(a===-1)return!1;const c=t.state.doc.resolve(l),u=c.depth+1;for(const d of AA(u,1))i.push({node:d>c.depth&&c.nodeAfter?c.nodeAfter:c.node(d),pos:c.before(d)});for(const{type:d}of c.marksAcross(c)??[]){const f=Fi(c,d);f&&s.push(f)}return e(r,{view:t,nodes:i,marks:s,getMark:d=>{const f=_e(d)?t.state.schema.marks[d]:d;return xe(f,{code:K.EXTENSION,message:`The mark ${d} being checked does not exist within the editor schema.`}),s.find(h=>h.mark.type===f)},getNode:d=>{var f;const h=_e(d)?t.state.schema.nodes[d]:d;xe(h,{code:K.EXTENSION,message:"The node being checked does not exist"});const m=i.find(({node:v})=>v.type===h);if(m)return{...m,isRoot:!!((f=i[0])!=null&&f.node.eq(m.node))}}})}}get name(){return"events"}onView(){var e,t;if(!((e=this.store.managerSettings.exclude)!=null&&e.clickHandler))for(const n of this.store.extensions){if(!n.createEventHandlers||(t=n.options.exclude)!=null&&t.clickHandler)continue;const r=n.createEventHandlers();for(const[o,i]of $t(r))this.addHandler(o,i)}}createPlugin(){const e=new WeakMap,t=(n,r,o,i,s,a,l,c)=>{const u=this.store.currentState,{schema:d,doc:f}=u,h=f.resolve(i),m=e.has(l),v=yie({$pos:h,handled:m,view:o,state:u});let x=!1;m||(x=n(l,v)||x);const b={...v,pos:i,direct:c,nodeWithPosition:{node:s,pos:a},getNode:w=>{const S=_e(w)?d.nodes[w]:w;return xe(S,{code:K.EXTENSION,message:"The node being checked does not exist"}),S===s.type?{node:s,pos:a}:void 0}};return e.set(l,!0),r(l,b)||x};return{props:{handleKeyPress:(n,r)=>this.options.keypress(r)||!1,handleKeyDown:(n,r)=>this.options.keydown(r)||!1,handleTextInput:(n,r,o,i)=>this.options.textInput({from:r,to:o,text:i})||!1,handleClickOn:(n,r,o,i,s,a)=>t(this.options.clickMark,this.options.click,n,r,o,i,s,a),handleDoubleClickOn:(n,r,o,i,s,a)=>t(this.options.doubleClickMark,this.options.doubleClick,n,r,o,i,s,a),handleTripleClickOn:(n,r,o,i,s,a)=>t(this.options.tripleClickMark,this.options.tripleClick,n,r,o,i,s,a),handleDOMEvents:{focus:(n,r)=>this.options.focus(r)||!1,blur:(n,r)=>this.options.blur(r)||!1,mousedown:(n,r)=>(this.startMouseover(),this.options.mousedown(r)||!1),mouseup:(n,r)=>(this.endMouseover(),this.options.mouseup(r)||!1),mouseleave:(n,r)=>(this.mouseover=!1,this.options.mouseleave(r)||!1),mouseenter:(n,r)=>(this.mouseover=!0,this.options.mouseenter(r)||!1),keyup:(n,r)=>this.options.keyup(r)||!1,mouseout:this.createMouseEventHandler((n,r)=>{const o={...r,hovering:!1};return this.options.hover(n,o)||!1}),mouseover:this.createMouseEventHandler((n,r)=>{const o={...r,hovering:!0};return this.options.hover(n,o)||!1}),contextmenu:this.createMouseEventHandler((n,r)=>this.options.contextmenu(n,r)||!1),scroll:(n,r)=>this.options.scroll(r)||!1,copy:(n,r)=>this.options.copy(r)||!1,cut:(n,r)=>this.options.cut(r)||!1,paste:(n,r)=>this.options.paste(r)||!1}},view:n=>{let r=n.editable;const o=this.options;return{update(i){const s=i.editable;s!==r&&(o.editable(s),r=s)}}}}}isInteracting(){return this.mousedown&&this.mouseover}startMouseover(){this.mouseover=!0,!this.mousedown&&(this.mousedown=!0,this.store.document.documentElement.addEventListener("mouseup",()=>{this.endMouseover()},{once:!0}))}endMouseover(){this.mousedown&&(this.mousedown=!1,this.store.commands.emptyUpdate())}};HD([Ct()],hg.prototype,"isInteracting",1);hg=HD([Ge({handlerKeys:["blur","focus","mousedown","mouseup","mouseenter","mouseleave","textInput","keypress","keyup","keydown","click","clickMark","doubleClick","doubleClickMark","tripleClick","tripleClickMark","contextmenu","hover","scroll","copy","cut","paste","editable"],handlerKeyOptions:{blur:{earlyReturnValue:!0},focus:{earlyReturnValue:!0},mousedown:{earlyReturnValue:!0},mouseleave:{earlyReturnValue:!0},mouseup:{earlyReturnValue:!0},click:{earlyReturnValue:!0},doubleClick:{earlyReturnValue:!0},tripleClick:{earlyReturnValue:!0},hover:{earlyReturnValue:!0},contextmenu:{earlyReturnValue:!0},scroll:{earlyReturnValue:!0},copy:{earlyReturnValue:!0},cut:{earlyReturnValue:!0},paste:{earlyReturnValue:!0}},defaultPriority:et.High})],hg);function yie(e){const{handled:t,view:n,$pos:r,state:o}=e,i={getMark:RA,markRanges:[],view:n,state:o};if(t)return i;for(const{type:s}of r.marksAcross(r)??[]){const a=Fi(r,s);a&&i.markRanges.push(a)}return i.getMark=s=>{const a=_e(s)?o.schema.marks[s]:s;return xe(a,{code:K.EXTENSION,message:`The mark ${s} being checked does not exist within the editor schema.`}),i.markRanges.find(l=>l.mark.type===a)},i}class wt extends Le{constructor(t){super(t,t)}map(t,n){let r=t.resolve(n.map(this.head));return wt.valid(r)?new wt(r):Le.near(r)}content(){return X.empty}eq(t){return t instanceof wt&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new wt(t.resolve(n.pos))}getBookmark(){return new vS(this.anchor)}static valid(t){let n=t.parent;if(n.isTextblock||!xie(t)||!bie(t))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(t.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(t,n,r=!1){e:for(;;){if(!r&&wt.valid(t))return t;let o=t.pos,i=null;for(let s=t.depth;;s--){let a=t.node(s);if(n>0?t.indexAfter(s)<a.childCount:t.index(s)>0){i=a.child(n>0?t.indexAfter(s):t.index(s)-1);break}else if(s==0)return null;o+=n;let l=t.doc.resolve(o);if(wt.valid(l))return l}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!we.isSelectable(i)){t=t.doc.resolve(o+i.nodeSize*n),r=!1;continue e}break}i=s,o+=n;let a=t.doc.resolve(o);if(wt.valid(a))return a}return null}}}wt.prototype.visible=!1;wt.findFrom=wt.findGapCursorFrom;Le.jsonID("gapcursor",wt);class vS{constructor(t){this.pos=t}map(t){return new vS(t.map(this.pos))}resolve(t){let n=t.resolve(this.pos);return wt.valid(n)?new wt(n):Le.near(n)}}function xie(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;continue}for(let o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function bie(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;continue}for(let o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function wie(){return new Vi({props:{decorations:Eie,createSelectionBetween(e,t,n){return t.pos==n.pos&&wt.valid(n)?new wt(n):null},handleClick:kie,handleKeyDown:Sie,handleDOMEvents:{beforeinput:Cie}}})}const Sie=TD({ArrowLeft:ph("horiz",-1),ArrowRight:ph("horiz",1),ArrowUp:ph("vert",-1),ArrowDown:ph("vert",1)});function ph(e,t){const n=e=="vert"?t>0?"down":"up":t>0?"right":"left";return function(r,o,i){let s=r.selection,a=t>0?s.$to:s.$from,l=s.empty;if(s instanceof Oe){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(t>0?a.after():a.before())}let c=wt.findGapCursorFrom(a,t,l);return c?(o&&o(r.tr.setSelection(new wt(c))),!0):!1}}function kie(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!wt.valid(r))return!1;let o=e.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&we.isSelectable(e.state.doc.nodeAt(o.inside))?!1:(e.dispatch(e.state.tr.setSelection(new wt(r))),!0)}function Cie(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof wt))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 o=D.empty;for(let s=r.length-1;s>=0;s--)o=D.from(r[s].createAndFill(null,o));let i=e.state.tr.replace(n.pos,n.pos,new X(o,0,0));return i.setSelection(Oe.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function Eie(e){if(!(e.selection instanceof wt))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",Ye.create(e.doc,[dt.widget(e.selection.head,t,{key:"gapcursor"})])}var _ie=Object.defineProperty,Tie=Object.getOwnPropertyDescriptor,Oie=(e,t,n,r)=>{for(var o=r>1?void 0:r?Tie(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&_ie(t,n,o),o},kb=class extends pt{get name(){return"gapCursor"}createExternalPlugins(){return[wie()]}};kb=Oie([Ge({})],kb);var mg=200,tn=function(){};tn.prototype.append=function(t){return t.length?(t=tn.from(t),!this.length&&t||t.length<mg&&this.leafAppend(t)||this.length<mg&&t.leafPrepend(this)||this.appendInner(t)):this};tn.prototype.prepend=function(t){return t.length?tn.from(t).append(this):this};tn.prototype.appendInner=function(t){return new Nie(this,t)};tn.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?tn.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};tn.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};tn.prototype.forEach=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(t,n,r,0):this.forEachInvertedInner(t,n,r,0)};tn.prototype.map=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(t(i,s))},n,r),o};tn.from=function(t){return t instanceof tn?t:t&&t.length?new KD(t):tn.empty};var KD=function(e){function t(r){e.call(this),this.values=r}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(o,i){return o==0&&i==this.length?this:new t(this.values.slice(o,i))},t.prototype.getInner=function(o){return this.values[o]},t.prototype.forEachInner=function(o,i,s,a){for(var l=i;l<s;l++)if(o(this.values[l],a+l)===!1)return!1},t.prototype.forEachInvertedInner=function(o,i,s,a){for(var l=i-1;l>=s;l--)if(o(this.values[l],a+l)===!1)return!1},t.prototype.leafAppend=function(o){if(this.length+o.length<=mg)return new t(this.values.concat(o.flatten()))},t.prototype.leafPrepend=function(o){if(this.length+o.length<=mg)return new t(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(tn);tn.empty=new KD([]);var Nie=function(e){function t(n,r){e.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.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(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},t.prototype.forEachInner=function(r,o,i,s){var a=this.left.length;if(o<a&&this.left.forEachInner(r,o,Math.min(i,a),s)===!1||i>a&&this.right.forEachInner(r,Math.max(o-a,0),Math.min(this.length,i)-a,s+a)===!1)return!1},t.prototype.forEachInvertedInner=function(r,o,i,s){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(r,o-a,Math.max(i,a)-a,s+a)===!1||i<a&&this.left.forEachInvertedInner(r,Math.min(o,a),i,s)===!1)return!1},t.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},t.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new t(this.left,o)},t.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new t(o,this.right)},t.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new t(this.left,new t(this.right,r)):new t(this,r)},t}(tn);const Mie=500;class bo{constructor(t,n){this.items=t,this.eventCount=n}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 o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=t.tr,a,l,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new Qi(d.map));let h=d.step.map(o.slice(i)),m;h&&s.maybeStep(h).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],c.push(new Qi(m,void 0,void 0,c.length+u.length))),i--,m&&o.appendMap(m,i)}else s.maybeStep(d.step);if(d.selection)return a=o?d.selection.map(o.slice(i)):d.selection,l=new bo(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(t,n,r,o){let i=[],s=this.eventCount,a=this.items,l=!o&&a.length?a.get(a.length-1):null;for(let u=0;u<t.steps.length;u++){let d=t.steps[u].invert(t.docs[u]),f=new Qi(t.mapping.maps[u],d,n),h;(h=l&&l.merge(f))&&(f=h,u?i.pop():a=a.slice(0,a.length-1)),i.push(f),n&&(s++,n=void 0),o||(l=f)}let c=s-r.depth;return c>Rie&&(a=Pie(a,c),s-=c),new bo(a.append(i),s)}remapping(t,n){let r=new hc;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=t?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},t,n),r}addMaps(t){return this.eventCount==0?this:new bo(this.items.append(t.map(n=>new Qi(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=t.mapping,s=t.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},o);let l=n;this.items.forEach(f=>{let h=i.getMirror(--l);if(h==null)return;s=Math.min(s,h);let m=i.maps[h];if(f.step){let v=t.steps[h].invert(t.docs[h]),x=f.selection&&f.selection.map(i.slice(l+1,h));x&&a++,r.push(new Qi(m,v,x))}else r.push(new Qi(m))},o);let c=[];for(let f=n;f<s;f++)c.push(new Qi(i.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new bo(u,a);return d.emptyItemCount()>Mie&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,o=[],i=0;return this.items.forEach((s,a)=>{if(a>=t)o.push(s),s.selection&&i++;else if(s.step){let l=s.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=s.selection&&s.selection.map(n.slice(r));u&&i++;let d=new Qi(c.invert(),l,u),f,h=o.length-1;(f=o.length&&o[h].merge(d))?o[h]=f:o.push(d)}}else s.map&&r--},this.items.length,0),new bo(tn.from(o.reverse()),i)}}bo.empty=new bo(tn.empty,0);function Pie(e,t){let n;return e.forEach((r,o)=>{if(r.selection&&t--==0)return n=o,!1}),e.slice(n)}let Qi=class qD{constructor(t,n,r,o){this.map=t,this.step=n,this.selection=r,this.mirrorOffset=o}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new qD(n.getMap().invert(),n,this.selection)}}};class hs{constructor(t,n,r,o,i){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const Rie=20;function jie(e,t,n,r){let o=n.getMeta(Oi),i;if(o)return o.historyState;n.getMeta(Die)&&(e=new hs(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(s&&s.getMeta(Oi))return s.getMeta(Oi).redo?new hs(e.done.addTransform(n,void 0,r,Wh(t)),e.undone,sT(n.mapping.maps),e.prevTime,e.prevComposition):new hs(e.done,e.undone.addTransform(n,void 0,r,Wh(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=e.prevTime==0||!s&&e.prevComposition!=a&&(e.prevTime<(n.time||0)-r.newGroupDelay||!Aie(n,e.prevRanges)),c=s?cx(e.prevRanges,n.mapping):sT(n.mapping.maps);return new hs(e.done.addTransform(n,l?t.selection.getBookmark():void 0,r,Wh(t)),bo.empty,c,n.time,a??e.prevComposition)}else return(i=n.getMeta("rebased"))?new hs(e.done.rebased(n,i),e.undone.rebased(n,i),cx(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new hs(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),cx(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function Aie(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<t.length;i+=2)r<=t[i+1]&&o>=t[i]&&(n=!0)}),n}function sT(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((r,o,i,s)=>t.push(i,s));return t}function cx(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}function Iie(e,t,n){let r=Wh(t),o=Oi.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),o,r),l=new hs(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(Oi,{redo:n,historyState:l})}let ux=!1,aT=null;function Wh(e){let t=e.plugins;if(aT!=t){ux=!1,aT=t;for(let n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){ux=!0;break}}return ux}const Oi=new pu("history"),Die=new pu("closeHistory");function Lie(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Vi({key:Oi,state:{init(){return new hs(bo.empty,bo.empty,null,0,-1)},apply(t,n,r){return jie(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,n){let r=n.inputType,o=r=="historyUndo"?Hh:r=="historyRedo"?dd:null;return o?(n.preventDefault(),o(t.state,t.dispatch)):!1}}}})}function GD(e,t){return(n,r)=>{let o=Oi.getState(n);if(!o||(e?o.undone:o.done).eventCount==0)return!1;if(r){let i=Iie(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const Hh=GD(!1,!0),dd=GD(!0,!0);function Cb(e){let t=Oi.getState(e);return t?t.done.eventCount:0}function Fie(e){let t=Oi.getState(e);return t?t.undone.eventCount:0}var zie=Object.defineProperty,$ie=Object.getOwnPropertyDescriptor,vl=(e,t,n,r)=>{for(var o=r>1?void 0:r?$ie(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&zie(t,n,o),o},oi=class extends pt{constructor(){super(...arguments),this.wrapMethod=(e,t)=>({state:n,dispatch:r,view:o})=>{const{getState:i,getDispatch:s}=this.options,a=ft(i)?i():n,l=ft(s)&&r?s():r,c=e(a,l,o);return t==null||t(c),c}}get name(){return"history"}createKeymap(){return{"Mod-y":yo.isMac?()=>!1:this.wrapMethod(dd,this.options.onRedo),"Mod-z":this.wrapMethod(Hh,this.options.onUndo),"Shift-Mod-z":this.wrapMethod(dd,this.options.onRedo)}}undoShortcut(e){return this.wrapMethod(Hh,this.options.onUndo)(e)}redoShortcut(e){return this.wrapMethod(dd,this.options.onRedo)(e)}createExternalPlugins(){const{depth:e,newGroupDelay:t}=this.options;return[Lie({depth:e,newGroupDelay:t})]}undo(){return V_(this.wrapMethod(Hh,this.options.onUndo))}redo(){return V_(this.wrapMethod(dd,this.options.onRedo))}undoDepth(e=this.store.getState()){return Cb(e)}redoDepth(e=this.store.getState()){return Fie(e)}};vl([Ar({shortcut:G.Undo,command:"undo"})],oi.prototype,"undoShortcut",1);vl([Ar({shortcut:G.Redo,command:"redo"})],oi.prototype,"redoShortcut",1);vl([de({disableChaining:!0,description:({t:e})=>e(eg.UNDO_DESCRIPTION),label:({t:e})=>e(eg.UNDO_LABEL),icon:"arrowGoBackFill"})],oi.prototype,"undo",1);vl([de({disableChaining:!0,description:({t:e})=>e(eg.REDO_DESCRIPTION),label:({t:e})=>e(eg.REDO_LABEL),icon:"arrowGoForwardFill"})],oi.prototype,"redo",1);vl([Ct()],oi.prototype,"undoDepth",1);vl([Ct()],oi.prototype,"redoDepth",1);oi=vl([Ge({defaultOptions:{depth:100,newGroupDelay:500,getDispatch:void 0,getState:void 0},staticKeys:["depth","newGroupDelay"],handlerKeys:["onUndo","onRedo"]})],oi);var Bie=Object.defineProperty,Vie=Object.getOwnPropertyDescriptor,jv=(e,t,n,r)=>{for(var o=r>1?void 0:r?Vie(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Bie(t,n,o),o},Uie={icon:"paragraph",label:({t:e})=>e(tg.INSERT_LABEL),description:({t:e})=>e(tg.INSERT_DESCRIPTION)},Wie={icon:"paragraph",label:({t:e})=>e(tg.CONVERT_LABEL),description:({t:e})=>e(tg.CONVERT_DESCRIPTION)},cl=class extends to{get name(){return"paragraph"}createTags(){return[je.LastNodeCompatible,je.TextBlock,je.Block,je.FormattingNode]}createNodeSpec(e,t){return{content:"inline*",draggable:!1,...t,attrs:{...e.defaults()},parseDOM:[{tag:"p",getAttrs:n=>({...e.parse(n)})},...t.parseDOM??[]],toDOM:n=>["p",e.dom(n),0]}}convertParagraph(e={}){const{attrs:t,selection:n,preserveAttrs:r}=e;return this.store.commands.setBlockNodeType.original(this.type,t,n,r)}insertParagraph(e,t={}){const{selection:n,attrs:r}=t;return this.store.commands.insertNode.original(this.type,{content:e,selection:n,attrs:r})}shortcut(e){return this.convertParagraph()(e)}};jv([de(Wie)],cl.prototype,"convertParagraph",1);jv([de(Uie)],cl.prototype,"insertParagraph",1);jv([Ar({shortcut:G.Paragraph,command:"convertParagraph"})],cl.prototype,"shortcut",1);cl=jv([Ge({defaultPriority:et.Medium})],cl);function Ci(e,t,n){return Math.min(Math.max(e,n),t)}class Hie extends Error{constructor(t){super(`Failed to parse color: "${t}"`)}}var fd=Hie;function yS(e){if(typeof e!="string")throw new fd(e);if(e.trim().toLowerCase()==="transparent")return[0,0,0,0];let t=e.trim();t=Qie.test(e)?Gie(e):e;const n=Yie.exec(t);if(n){const s=Array.from(n).slice(1);return[...s.slice(0,3).map(a=>parseInt($f(a,2),16)),parseInt($f(s[3]||"f",2),16)/255]}const r=Jie.exec(t);if(r){const s=Array.from(r).slice(1);return[...s.slice(0,3).map(a=>parseInt(a,16)),parseInt(s[3]||"ff",16)/255]}const o=Xie.exec(t);if(o){const s=Array.from(o).slice(1);return[...s.slice(0,3).map(a=>parseInt(a,10)),parseFloat(s[3]||"1")]}const i=Zie.exec(t);if(i){const[s,a,l,c]=Array.from(i).slice(1).map(parseFloat);if(Ci(0,100,a)!==a)throw new fd(e);if(Ci(0,100,l)!==l)throw new fd(e);return[...ese(s,a,l),Number.isNaN(c)?1:c]}throw new fd(e)}function Kie(e){let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return(t>>>0)%2341}const lT=e=>parseInt(e.replace(/_/g,""),36),qie="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((e,t)=>{const n=lT(t.substring(0,3)),r=lT(t.substring(3)).toString(16);let o="";for(let i=0;i<6-r.length;i++)o+="0";return e[n]=`${o}${r}`,e},{});function Gie(e){const t=e.toLowerCase().trim(),n=qie[Kie(t)];if(!n)throw new fd(e);return`#${n}`}const $f=(e,t)=>Array.from(Array(t)).map(()=>e).join(""),Yie=new RegExp(`^#${$f("([a-f0-9])",3)}([a-f0-9])?$`,"i"),Jie=new RegExp(`^#${$f("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),Xie=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${$f(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),Zie=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,Qie=/^[a-z]+$/i,cT=e=>Math.round(e*255),ese=(e,t,n)=>{let r=n/100;if(t===0)return[r,r,r].map(cT);const o=(e%360+360)%360/60,i=(1-Math.abs(2*r-1))*(t/100),s=i*(1-Math.abs(o%2-1));let a=0,l=0,c=0;o>=0&&o<1?(a=i,l=s):o>=1&&o<2?(a=s,l=i):o>=2&&o<3?(l=i,c=s):o>=3&&o<4?(l=s,c=i):o>=4&&o<5?(a=s,c=i):o>=5&&o<6&&(a=i,c=s);const u=r-i/2,d=a+u,f=l+u,h=c+u;return[d,f,h].map(cT)};function tse(e){const[t,n,r,o]=yS(e).map((d,f)=>f===3?d:d/255),i=Math.max(t,n,r),s=Math.min(t,n,r),a=(i+s)/2;if(i===s)return[0,0,a,o];const l=i-s,c=a>.5?l/(2-i-s):l/(i+s);return[60*(t===i?(n-r)/l+(n<r?6:0):n===i?(r-t)/l+2:(t-n)/l+4),c,a,o]}function nse(e,t,n,r){return`hsla(${(e%360).toFixed()}, ${Ci(0,100,t*100).toFixed()}%, ${Ci(0,100,n*100).toFixed()}%, ${parseFloat(Ci(0,1,r).toFixed(3))})`}function wr(e,t){const[n,r,o,i]=tse(e);return nse(n,r,o-t,i)}function rse(e){if(e==="transparent")return 0;function t(i){const s=i/255;return s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4)}const[n,r,o]=yS(e);return .2126*t(n)+.7152*t(r)+.0722*t(o)}function ose(e,t,n,r){return`rgba(${Ci(0,255,e).toFixed()}, ${Ci(0,255,t).toFixed()}, ${Ci(0,255,n).toFixed()}, ${parseFloat(Ci(0,1,r).toFixed(3))})`}function Kh(e,t){return wr(e,-t)}function gg(e,t){const[n,r,o,i]=yS(e);return ose(n,r,o,i-t)}function ise(e){return rse(e)>.179}function yc(e){return ise(e)?"#000":"#fff"}const sse="remirror-editor-wrapper",ase="remirror-button-active",lse="remirror-button",cse="remirror-composite",use="remirror-dialog",dse="remirror-dialog-backdrop",fse="remirror-form",pse="remirror-form-message",hse="remirror-form-label",mse="remirror-form-group",gse="remirror-group",vse="remirror-input",yse="remirror-menu",xse="remirror-menu-pane",bse="remirror-menu-pane-active",wse="remirror-menu-dropdown-label",Sse="remirror-menu-pane-icon",kse="remirror-menu-pane-label",Cse="remirror-menu-pane-shortcut",Ese="remirror-menu-button-left",_se="remirror-menu-button-right",Tse="remirror-menu-button-nested-left",Ose="remirror-menu-button-nested-right",Nse="remirror-menu-button",Mse="remirror-menu-bar",Pse="remirror-flex-column",Rse="remirror-flex-row",jse="remirror-menu-item",Ase="remirror-menu-item-row",Ise="remirror-menu-item-column",Dse="remirror-menu-item-checkbox",Lse="remirror-menu-item-radio",Fse="remirror-menu-group",zse="remirror-floating-popover",$se="remirror-popover",Bse="remirror-animated-popover",Vse="remirror-role",Use="remirror-separator",Wse="remirror-tab",Hse="remirror-tab-list",Kse="remirror-tabbable",qse="remirror-toolbar",Gse="remirror-tooltip",Yse="remirror-table-size-editor",Jse="remirror-table-size-editor-body",Xse="remirror-table-size-editor-cell",Zse="remirror-table-size-editor-cell-selected",Qse="remirror-table-size-editor-footer",eae="remirror-color-picker",tae="remirror-color-picker-cell",nae="remirror-color-picker-cell-selected";var rae=Object.freeze({__proto__:null,ANIMATED_POPOVER:Bse,BUTTON:lse,BUTTON_ACTIVE:ase,COLOR_PICKER:eae,COLOR_PICKER_CELL:tae,COLOR_PICKER_CELL_SELECTED:nae,COMPOSITE:cse,DIALOG:use,DIALOG_BACKDROP:dse,EDITOR_WRAPPER:sse,FLEX_COLUMN:Pse,FLEX_ROW:Rse,FLOATING_POPOVER:zse,FORM:fse,FORM_GROUP:mse,FORM_LABEL:hse,FORM_MESSAGE:pse,GROUP:gse,INPUT:vse,MENU:yse,MENU_BAR:Mse,MENU_BUTTON:Nse,MENU_BUTTON_LEFT:Ese,MENU_BUTTON_NESTED_LEFT:Tse,MENU_BUTTON_NESTED_RIGHT:Ose,MENU_BUTTON_RIGHT:_se,MENU_DROPDOWN_LABEL:wse,MENU_GROUP:Fse,MENU_ITEM:jse,MENU_ITEM_CHECKBOX:Dse,MENU_ITEM_COLUMN:Ise,MENU_ITEM_RADIO:Lse,MENU_ITEM_ROW:Ase,MENU_PANE:xse,MENU_PANE_ACTIVE:bse,MENU_PANE_ICON:Sse,MENU_PANE_LABEL:kse,MENU_PANE_SHORTCUT:Cse,POPOVER:$se,ROLE:Vse,SEPARATOR:Use,TAB:Wse,TABBABLE:Kse,TABLE_SIZE_EDITOR:Yse,TABLE_SIZE_EDITOR_BODY:Jse,TABLE_SIZE_EDITOR_CELL:Xse,TABLE_SIZE_EDITOR_CELL_SELECTED:Zse,TABLE_SIZE_EDITOR_FOOTER:Qse,TAB_LIST:Hse,TOOLBAR:qse,TOOLTIP:Gse});const oae="remirror-image-loader";var iae=Object.freeze({__proto__:null,IMAGE_LOADER:oae});const sae="remirror-list-item-with-custom-mark",aae="remirror-ul-list-content",lae="remirror-editor",cae="remirror-list-item-marker-container",uae="remirror-list-item-checkbox",dae="remirror-collapsible-list-item-closed",fae="remirror-collapsible-list-item-button",pae="remirror-list-spine";var ra=Object.freeze({__proto__:null,COLLAPSIBLE_LIST_ITEM_BUTTON:fae,COLLAPSIBLE_LIST_ITEM_CLOSED:dae,EDITOR:lae,LIST_ITEM_CHECKBOX:uae,LIST_ITEM_MARKER_CONTAINER:cae,LIST_ITEM_WITH_CUSTOM_MARKER:sae,LIST_SPINE:pae,UL_LIST_CONTENT:aae});const hae="remirror-is-empty";var mae=Object.freeze({__proto__:null,IS_EMPTY:hae});const gae="remirror-editor",vae="remirror-positioner",yae="remirror-positioner-widget";var xae=Object.freeze({__proto__:null,EDITOR:gae,POSITIONER:vae,POSITIONER_WIDGET:yae});const co={gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]},Ei="#000000",xS="#ffffff",bae="#252103",bS=gg(Ei,.75),Av="#7963d2",wS="#bcd263",wae="#fff",Sae="#fff",SS=co.gray[1],uT="rgba(10,31,68,0.08)",dT="rgba(10,31,68,0.10)",fT="rgba(10,31,68,0.12)",kae=Kh(gg(Ei,.1),.13),kS={background:xS,border:bS,foreground:Ei,muted:SS,primary:Av,secondary:wS,primaryText:wae,secondaryText:Sae,text:bae,faded:kae},Cae={...kS,background:wr(xS,.15),border:wr(bS,.15),foreground:wr(Ei,.15),muted:wr(SS,.15),primary:wr(Av,.15),secondary:wr(wS,.15),get text(){return yc(this.background)},get primaryText(){return yc(this.primary)},get secondaryText(){return yc(this.secondary)}},Eae={...kS,background:wr(xS,.075),border:wr(bS,.075),foreground:wr(Ei,.075),muted:wr(SS,.075),primary:wr(Av,.075),secondary:wr(wS,.075),get text(){return yc(this.background)},get primaryText(){return yc(this.primary)},get secondaryText(){return yc(this.secondary)}};({...kS,backdrop:gg(Ei,.1),outline:gg(Av,.6),table:(Kh(Ei,.8),Kh(Ei,.4),co.gray[3],co.blue[7],co.blue[1],co.blue[5],co.blue[7],Kh(Ei,.4),co.blue[5],co.red[7],co.red[1],co.red[5])},`${uT}`,`${dT}`,`${fT}`);var _ae=Object.defineProperty,Tae=Object.getOwnPropertyDescriptor,CS=(e,t,n,r)=>{for(var o=r>1?void 0:r?Tae(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&_ae(t,n,o),o},YD=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},jt=(e,t,n)=>(YD(e,t,"read from private field"),n?n.call(e):t.get(e)),ui=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},es=(e,t,n,r)=>(YD(e,t,"write to private field"),t.set(e,n),n),pd,hd,Bl,md,qh,gd,vd,yd,xd,Gh=class{constructor(e){ui(this,pd,gv()),ui(this,hd,[]),ui(this,Bl,new Map),ui(this,md,[]),ui(this,qh,!1),ui(this,gd,void 0),ui(this,vd,void 0),ui(this,yd,void 0),ui(this,xd,void 0),this.addListener=(t,n)=>jt(this,pd).on(t,n),es(this,gd,e),es(this,vd,e.getActive),es(this,xd,e.getPosition),es(this,yd,e.getID),this.hasChanged=e.hasChanged,this.events=e.events??["state","scroll"]}static create(e){return new Gh(e)}static fromPositioner(e,t){return Gh.create({...e.basePositioner,...t})}get basePositioner(){return{getActive:jt(this,vd),getPosition:jt(this,xd),hasChanged:this.hasChanged,events:this.events,getID:jt(this,yd)}}onActiveChanged(e){this.recentUpdate=e;const t=jt(this,vd).call(this,e);es(this,hd,t),es(this,Bl,new Map),es(this,qh,!1),es(this,md,[]);const n=[];for(const[r,o]of t.entries()){const i=this.getID(o,r);jt(this,md).push(i),n.push({setElement:s=>this.addProps({...e,data:o,element:s},r),id:i,data:o})}jt(this,pd).emit("update",n)}getID(e,t){var n;return((n=jt(this,yd))==null?void 0:n.call(this,e,t))??t.toString()}addProps(e,t){if(jt(this,qh)||(jt(this,Bl).set(t,e),jt(this,Bl).size<jt(this,hd).length))return;const n=[];for(const r of jt(this,hd).keys()){const o=jt(this,Bl).get(r);xe(o,{code:K.INTERNAL,message:"Something went wrong when retrieving the parameters"});const i=jt(this,md)[r];if(!i)return;n.push({position:jt(this,xd).call(this,o),element:o.element,id:i})}jt(this,pd).emit("done",n)}clone(e){return Gh.create({...jt(this,gd),...ft(e)?e(jt(this,gd)):e})}active(e){const t=ft(e)?e:()=>e;return this.clone(n=>({getActive:r=>n.getActive(r).filter(t)}))}},_o=Gh;pd=new WeakMap;hd=new WeakMap;Bl=new WeakMap;md=new WeakMap;qh=new WeakMap;gd=new WeakMap;vd=new WeakMap;yd=new WeakMap;xd=new WeakMap;_o.EMPTY=[];function Oae(e,t=QD){const{key:n}=(e==null?void 0:e.getMeta(ZD))??{};return n===t}function JD(e){const{tr:t,state:n,previousState:r}=e;return!r||t&&Oae(t)?!0:t?_Z(t):!n.doc.eq(r.doc)||!n.selection.eq(r.selection)}function XD(e,t,n={}){const r=t.getBoundingClientRect(),{accountForPadding:o=!1}=n;let i=0,s=0,a=0,l=0;if(ri(t)&&o){const u=Number.parseFloat(Zi(t,"padding-left").replace("px","")),d=Number.parseFloat(Zi(t,"padding-right").replace("px","")),f=Number.parseFloat(Zi(t,"padding-top").replace("px","")),h=Number.parseFloat(Zi(t,"padding-bottom").replace("px","")),m=Number.parseFloat(Zi(t,"border-left").replace("px","")),v=Number.parseFloat(Zi(t,"border-right").replace("px","")),x=Number.parseFloat(Zi(t,"border-top").replace("px","")),b=Number.parseFloat(Zi(t,"border-bottom").replace("px","")),w=t.offsetWidth-t.clientWidth,S=t.offsetHeight-t.clientHeight;i+=u+m+(t.dir==="rtl"?w:0),s+=d+v+(t.dir==="rtl"?0:w),a+=f+x,l+=h+b+S}const c=new DOMRect(r.left+i,r.top+a,r.width-s,r.height-l);for(const[u,d]of[[e.top,e.left],[e.top,e.right],[e.bottom,e.left],[e.bottom,e.right]])if(jE(u,c.top,c.bottom)&&jE(d,c.left,c.right))return!0;return!1}var Nae="remirror-positioner-widget",ZD="positionerUpdate",QD="__all_positioners__",e2={y:-999999,x:-999999,width:0,height:0},pT={...e2,left:-999999,top:-999999,bottom:-999999,right:-999999},Mae={...e2,rect:{...pT,toJSON:()=>pT},visible:!1},Pae=_o.create({hasChanged:JD,getActive(e){const{state:t}=e;if(!lS(t)||t.selection.$anchor.depth>2)return _o.EMPTY;const n=Cv({predicate:r=>r.type.isBlock,selection:t});return n?[n]:_o.EMPTY},getPosition(e){const{view:t,data:n}=e,r=t.nodeDOM(n.pos);if(!ri(r))return Mae;const o=r.getBoundingClientRect(),i=t.dom.getBoundingClientRect(),s=o.height,a=o.width,l=t.dom.scrollLeft+o.left-i.left,c=t.dom.scrollTop+o.top-i.top,u=XD(o,t.dom);return{y:c,x:l,height:s,width:a,rect:o,visible:u}}}),t2=Pae.clone(({getActive:e})=>({getActive:t=>{const[n]=e(t);return n&&fS(n.node)&&n.node.type===Tv(t.state.schema)?[n]:_o.EMPTY}}));t2.clone(({getPosition:e})=>({getPosition:t=>({...e(t),width:1})}));t2.clone(({getPosition:e})=>({getPosition:t=>{const{width:n,x:r,y:o,height:i}=e(t);return{...e(t),width:1,x:n+r,rect:new DOMRect(n+r,o,1,i)}}}));function ES(e){return _o.create({hasChanged:JD,getActive:t=>{const{state:n,view:r}=t;if(!e(n)||!gl(n.selection))return _o.EMPTY;try{const{head:o,anchor:i}=n.selection;return[{from:r.coordsAtPos(i),to:r.coordsAtPos(o)}]}catch{return _o.EMPTY}},getPosition(t){const{element:n,data:r,view:o}=t,{from:i,to:s}=r,a=n.offsetParent??o.dom,l=a.getBoundingClientRect(),c=Math.abs(s.bottom-i.top),u=c>i.bottom-i.top,d=Math.min(i.left,s.left),f=Math.min(i.top,s.top),h=a.scrollLeft+(u?s.left-l.left:d-l.left),m=a.scrollTop+f-l.top,v=u?1:Math.abs(i.left-s.right),x=new DOMRect(u?s.left:d,f,v,c),b=XD(x,o.dom);return{rect:x,y:m,x:h,height:c,width:v,visible:b}}})}var Rae=ES(e=>!e.selection.empty);ES(e=>e.selection.empty);ES(()=>!0);Rae.clone(()=>({getActive:e=>{const{state:t,view:n}=e;if(!t.selection.empty)return _o.EMPTY;const r=uD(t);if(!r)return _o.EMPTY;try{return[{from:n.coordsAtPos(r.from),to:n.coordsAtPos(r.to)}]}catch{return _o.EMPTY}}}));var Bf=class extends pt{constructor(){super(...arguments),this.positioners=[],this.onAddCustomHandler=({positioner:e})=>{if(e)return this.positioners=[...this.positioners,e],this.store.commands.forceUpdate(),()=>{this.positioners=this.positioners.filter(t=>t!==e)}}}get name(){return"positioner"}createAttributes(){return{class:xae.EDITOR}}init(){this.onScroll=SG(this.options.scrollDebounce,this.onScroll.bind(this))}createEventHandlers(){return{scroll:()=>(this.onScroll(),!1),hover:(e,t)=>(this.positioner(this.getBaseProps("hover",{hover:t})),!1),contextmenu:(e,t)=>(this.positioner(this.getBaseProps("contextmenu",{contextmenu:t})),!1)}}onStateUpdate(e){this.positioner({...e,previousState:e.firstUpdate?void 0:e.previousState,event:"state",helpers:this.store.helpers})}createDecorations(e){if(this.element??(this.element=this.createElement()),!this.element.hasChildNodes())return Ye.empty;const t=dt.widget(0,this.element,{key:"positioner-widget",side:-1,stopEvent:()=>!0});return Ye.create(e.doc,[t])}forceUpdatePositioners(e=QD){return({tr:t,dispatch:n})=>(n==null||n(t.setMeta(ZD,{key:e})),!0)}getPositionerWidget(){return this.element??(this.element=this.createElement())}createElement(){const e=document.createElement("span");return e.dataset.id=Nae,e.setAttribute("role","presentation"),e}triggerPositioner(e,t){e.hasChanged(t)&&e.onActiveChanged({...t,view:this.store.view})}positioner(e){for(const t of this.positioners)t.events.includes(e.event)&&this.triggerPositioner(t,e)}getBaseProps(e,t){const n=this.store.getState(),r=this.store.previousState;return{helpers:this.store.helpers,event:e,firstUpdate:!1,previousState:r,state:n,...t}}onScroll(){this.positioner(this.getBaseProps("scroll",{scroll:{scrollTop:this.store.view.dom.scrollTop}}))}};CS([de()],Bf.prototype,"forceUpdatePositioners",1);CS([Ct()],Bf.prototype,"getPositionerWidget",1);Bf=CS([Ge({defaultOptions:{scrollDebounce:100},customHandlerKeys:["positioner"],staticKeys:["scrollDebounce"]})],Bf);var jae=Object.defineProperty,Aae=Object.getOwnPropertyDescriptor,Iae=(e,t,n,r)=>{for(var o=r>1?void 0:r?Aae(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&jae(t,n,o),o},Eb=class extends to{get name(){return"text"}createTags(){return[je.InlineNode]}createNodeSpec(){return{}}};Eb=Iae([Ge({disableExtraAttributes:!0,defaultPriority:et.Medium})],Eb);var Dae={...Gc.defaultOptions,...cl.defaultOptions,...oi.defaultOptions,excludeExtensions:[]};function Lae(e={}){e={...Dae,...e};const{content:t,depth:n,getDispatch:r,getState:o,newGroupDelay:i,excludeExtensions:s}=e,a={};for(const c of s??[])a[c]=!0;const l=[];if(!a.history){const c=new oi({depth:n,getDispatch:r,getState:o,newGroupDelay:i});l.push(c)}return a.doc||l.push(new Gc({content:t})),a.text||l.push(new Eb),a.paragraph||l.push(new cl),a.positioner||l.push(new Bf),a.gapCursor||l.push(new kb),a.events||l.push(new hg),l}var Fae=Object.defineProperty,zae=Object.getOwnPropertyDescriptor,$ae=(e,t,n,r)=>{for(var o=r>1?void 0:r?zae(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Fae(t,n,o),o},ul=class extends pt{get name(){return"placeholder"}createAttributes(){return{"aria-placeholder":this.options.placeholder}}createPlugin(){return{state:{init:(e,t)=>({...this.options,empty:dS(t.doc,{ignoreAttributes:!0})}),apply:(e,t,n,r)=>Bae({pluginState:t,tr:e,extension:this,state:r})},props:{decorations:e=>Vae({state:e,extension:this})}}}onSetOptions(e){const{changes:t}=e;t.placeholder.changed&&this.store.phase>=qn.EditorView&&this.store.updateAttributes()}};ul=$ae([Ge({defaultOptions:{emptyNodeClass:mae.IS_EMPTY,placeholder:""}})],ul);function Bae(e){const{pluginState:t,extension:n,tr:r,state:o}=e;return r.docChanged?{...n.options,empty:dS(o.doc)}:t}function Vae(e){const{extension:t,state:n}=e,{empty:r}=t.pluginKey.getState(n),{emptyNodeClass:o,placeholder:i}=t.options;if(!r)return null;const s=[];return n.doc.descendants((a,l)=>{const c=dt.node(l,l+a.nodeSize,{class:o,"data-placeholder":i});s.push(c)}),Ye.create(n.doc,s)}var Uae=Object.defineProperty,Wae=Object.getOwnPropertyDescriptor,Hae=(e,t,n,r)=>{for(var o=r>1?void 0:r?Wae(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Uae(t,n,o),o},Kae={...ul.defaultOptions,...zf.defaultOptions},qae=[...ul.staticKeys,...zf.staticKeys],Vf=class extends pt{get name(){return"react"}onSetOptions(e){const{pickChanged:t}=e;this.getExtension(ul).setOptions(t(["placeholder"]))}createExtensions(){const{emptyNodeClass:e,placeholder:t,defaultBlockNode:n,defaultContentNode:r,defaultEnvironment:o,defaultInlineNode:i,nodeViewComponents:s}=this.options;return[new ul({emptyNodeClass:e,placeholder:t,priority:et.Low}),new zf({defaultBlockNode:n,defaultContentNode:r,defaultEnvironment:o,defaultInlineNode:i,nodeViewComponents:s})]}};Vf=Hae([Ge({defaultOptions:Kae,staticKeys:qae})],Vf);var n2={};Object.defineProperty(n2,"__esModule",{value:!0});function Gae(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length===2)return mT(e[0],e[1])||null;var n=e.slice(1).reduce(function(r,o){return mT(r,o)},e[0]);return n||null}var zu=n2.default=Gae,hT=new WeakMap;function mT(e,t){if(e&&t){var n=hT.get(e)||new WeakMap;hT.set(e,n);var r=n.get(t)||function(o){gT(e,o),gT(t,o)};return n.set(t,r),r}return e||t}function gT(e,t){typeof e=="function"?e(t):e.current=t}var r2=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},dx=(e,t,n)=>(r2(e,t,"read from private field"),t.get(e)),Yae=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Jae=(e,t,n,r)=>(r2(e,t,"write to private field"),t.set(e,n),n);function Xae(){const[,e]=g.useState(he());return g.useCallback(()=>{e(he())},[])}var o2=g.createContext(null);function Iv(e){const t=g.useContext(o2),n=g.useRef(Xae());xe(t,{code:K.REACT_PROVIDER_CONTEXT});const{addHandler:r}=t;return g.useEffect(()=>{let o=e;if(o){if(ml(o)){const{autoUpdate:i}=o;o=i?()=>n.current():void 0}if(ft(o))return r("updated",o)}},[r,e]),t}function Zae(e=!0){return Iv({autoUpdate:e}).active}function Qae(e=!1){return Iv(e?{autoUpdate:!0}:void 0).attrs}function i2(){return Iv().chain.new()}var[ele,dfe]=Jee(({props:e})=>{const t=e.locale??"en",n=e.i18n??Rv,r=e.supportedLocales??[t],o=n._.bind(n);return{locale:t,i18n:n,supportedLocales:r,t:o}});function vT(e,t={}){const{core:n,react:r,...o}=t;return Iee(e)?e:Aee.create(()=>[...IA(e),new Vf(r),...Lae(n)],o)}function tle(e,t={}){const n=g.useRef(e),r=g.useRef(t),[o,i]=g.useState(()=>vT(e,t));return n.current=e,r.current=t,g.useEffect(()=>o.addHandler("destroy",()=>{i(()=>vT(n.current,r.current))}),[o]),o}var nle=typeof zu=="object"&&zu.__esModule&&zu.default?zu.default:zu,Vl,rle=class extends Nee{constructor(e){if(super(e),Yae(this,Vl,void 0),this.rootPropsConfig={called:!1,count:0},this.getRootProps=t=>this.internalGetRootProps(t,null),this.internalGetRootProps=(t,n)=>{this.rootPropsConfig.called=!0;const{refKey:r="ref",ref:o,...i}=t??he();return{[r]:nle(o,this.onRef),key:this.uid,...i,children:n}},this.onRef=t=>{t&&(this.rootPropsConfig.count+=1,xe(this.rootPropsConfig.count<=1,{code:K.REACT_GET_ROOT_PROPS,message:`Called ${this.rootPropsConfig.count} times`}),Jae(this,Vl,t),this.onRefLoad())},this.manager.view){this.manager.view.setProps({state:this.manager.view.state,dispatchTransaction:this.dispatchTransaction,attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0});return}this.manager.getExtension(ul).setOptions({placeholder:this.props.placeholder??""})}get name(){return"react"}update(e){return super.update(e),this}createView(e){return new qX(null,{state:e,dispatchTransaction:this.dispatchTransaction,attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0,plugins:[]})}updateState({state:e,...t}){const{triggerChange:n=!0,tr:r,transactions:o}=t;if(this.props.state){const{onChange:i}=this.props;xe(i,{code:K.REACT_CONTROLLED,message:"You are required to provide the `onChange` handler when creating a controlled editor."}),xe(n,{code:K.REACT_CONTROLLED,message:"Controlled editors do not support `clearContent` or `setContent` where `triggerChange` is `true`. Update the `state` prop instead."}),this.previousStateOverride||(this.previousStateOverride=this.getState()),this.onChange({state:e,tr:r,transactions:o});return}!r&&!o&&(e=e.apply(e.tr.setMeta(OE,{}))),this.view.updateState(e),n&&(o==null?void 0:o.length)!==0&&this.onChange({state:e,tr:r,transactions:o}),this.manager.onStateUpdate({previousState:this.previousState,state:e,tr:r,transactions:o})}updateControlledState(e,t){this.previousStateOverride=t,e=e.apply(e.tr.setMeta(OE,{})),this.view.updateState(e),this.manager.onStateUpdate({previousState:this.previousState,state:e}),this.previousStateOverride=void 0}addProsemirrorViewToDom(e,t){this.props.insertPosition==="start"?e.insertBefore(t,e.firstChild):e.append(t)}onRefLoad(){xe(dx(this,Vl),{code:K.REACT_EDITOR_VIEW,message:"Something went wrong when initializing the text editor. Please check your setup."});const{autoFocus:e}=this.props;this.addProsemirrorViewToDom(dx(this,Vl),this.view.dom),e&&this.focus(e),this.onChange(),this.addFocusListeners()}onUpdate(){this.view&&dx(this,Vl)&&this.view.setProps({...this.view.props,editable:()=>this.props.editable??!0})}get frameworkOutput(){return{...this.baseOutput,getRootProps:this.getRootProps,portalContainer:this.manager.store.portalContainer}}resetRender(){this.rootPropsConfig.called=!1,this.rootPropsConfig.count=0}};Vl=new WeakMap;var s2=typeof document<"u"?g.useLayoutEffect:g.useEffect;function ole(e){const t=g.useRef();return s2(()=>{t.current=e}),t.current}function ile(e){const{manager:t,state:n}=e,{placeholder:r,editable:o}=e;g.useRef(!0).current&&!Qs(r)&&t.getExtension(Vf).setOptions({placeholder:r}),g.useEffect(()=>{r!=null&&t.getExtension(Vf).setOptions({placeholder:r})},[r,t]);const[s]=g.useState(()=>{if(n)return n;const l=t.createEmptyDoc(),[c,u]=Bt(e.initialContent)?e.initialContent:[e.initialContent??l];return t.createState({content:c,selection:u})}),a=sle({initialEditorState:s,getProps:()=>e});return g.useEffect(()=>()=>{a.destroy()},[a]),g.useEffect(()=>{a.onUpdate()},[o,a]),ale(a),a.frameworkOutput}function sle(e){const t=g.useRef(e);t.current=e;const n=g.useMemo(()=>new rle(t.current),[]);return n.update(e),n}function ale(e){const{state:t}=e.props,n=g.useRef(!!t),r=ole(t);s2(()=>{const o=t?n.current===!0:n.current===!1;xe(o,{code:K.REACT_CONTROLLED,message:n.current?"You have attempted to switch from a controlled to an uncontrolled editor. Once you set up an editor as a controlled editor it must always provide a `state` prop.":"You have provided a `state` prop to an uncontrolled editor. In order to set up your editor as controlled you must provide the `state` prop from the very first render."}),!(!t||t===r)&&e.updateControlledState(t,r??void 0)},[t,r,e])}function lle(e={}){const{content:t,document:n,selection:r,extensions:o,...i}=e,s=tle(o??(()=>[]),i),[a,l]=g.useState(()=>s.createState({selection:r,content:t??s.createEmptyDoc()})),c=g.useCallback(({state:d})=>{l(d)},[]),u=g.useCallback(()=>s.output,[s]);return g.useMemo(()=>({state:a,setState:l,manager:s,onChange:c,getContext:u}),[u,s,c,a])}var _b=()=>ge.createElement("div",{className:rae.EDITOR_WRAPPER,...Iv().getRootProps()}),cle=e=>(e.hook(),null);function ule(e){const{children:t,autoRender:n,i18n:r,locale:o,supportedLocales:i,hooks:s=[],...a}=e,l=ile(a),c=Bee(l.portalContainer),u=n==="start"||n===!0||!t&&Qs(n),d=n==="end";return ge.createElement(ele,{i18n:r,locale:o,supportedLocales:i},ge.createElement(o2.Provider,{value:l},ge.createElement($ee,{portals:c}),s.map((f,h)=>ge.createElement(cle,{hook:f,key:h})),u&&ge.createElement(_b,null),t,d&&ge.createElement(_b,null)))}function dle(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),a=!1,l=s;if(!s)return!1;if(s.depth>=2&&o.node(s.depth-1).type.compatibleContent(e)&&s.startIndex==0){if(o.index(s.depth-1)==0)return!1;let u=n.doc.resolve(s.start-2);l=new il(u,u,s.depth),s.endIndex<s.parent.childCount&&(s=new il(o,n.doc.resolve(i.end(s.depth)),s.depth)),a=!0}let c=K1(l,e,t,s);return c?(r&&r(fle(n.tr,s,c,a,e).scrollIntoView()),!0):!1}}function fle(e,t,n,r,o){let i=D.empty;for(let u=n.length-1;u>=0;u--)i=D.from(n[u].type.create(n[u].attrs,i));e.step(new Ot(t.start-(r?2:0),t.end,t.start,t.end,new X(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==o&&(s=u+1);let a=n.length-s,l=t.start+n.length-(r?2:0),c=t.parent;for(let u=t.startIndex,d=t.endIndex,f=!0;u<d;u++,f=!1)!f&&mc(e.doc,l,a)&&(e.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return e}function ple(e){return function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==e);return i?n?r.node(i.depth-1).type==e?hle(t,n,e,i):mle(t,n,i):!0:!1}}function hle(e,t,n,r){let o=e.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new Ot(i-1,s,i,s,new X(D.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new il(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=fu(r);if(a==null)return!1;o.lift(r,a);let l=o.mapping.map(i,-1)-1;return kp(o.doc,l)&&o.join(l),t(o.scrollIntoView()),!0}function mle(e,t,n){let r=e.tr,o=n.parent;for(let h=n.end,m=n.endIndex-1,v=n.startIndex;m>v;m--)h-=o.child(m).nodeSize,r.delete(h-1,h+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(a?0:1),u+1,s.content.append(l?D.empty:D.from(o))))return!1;let d=i.pos,f=d+s.nodeSize;return r.step(new Ot(d-(a?1:0),f+(l?1:0),d+1,f-1,new X((a?D.empty:D.from(o.copy(D.empty))).append(l?D.empty:D.from(o.copy(D.empty))),a?0:1,l?0:1),a?0:1)),t(r.scrollIntoView()),!0}var gle=Object.defineProperty,vle=Object.getOwnPropertyDescriptor,no=(e,t,n,r)=>{for(var o=r>1?void 0:r?vle(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&gle(t,n,o),o};function Tb(e){var t;return!!((t=e.spec.group)!=null&&t.includes(je.ListContainerNode))}function yle(e){var t;return!!((t=e.spec.group)!=null&&t.includes(je.ListItemNode))}function oa(e){return Tb(e.type)}function Us(e){return yle(e.type)}function _S(e,t){return n=>{const{dispatch:r,tr:o}=n,i=sS(o,n.state),{$from:s,$to:a}=o.selection,l=s.blockRange(a);if(!l)return!1;const c=Cv({predicate:u=>Tb(u.type),selection:o.selection});if(c&&l.depth-c.depth<=1&&l.startIndex===0){if(c.node.type===e)return c2(t)(n);if(Tb(c.node.type))return e.validContent(c.node.content)?(r==null||r(o.setNodeMarkup(c.pos,e)),!0):xle(o,c,e,t)?(r==null||r(o.scrollIntoView()),!0):!1}return dle(e)(i,r)}}function a2(e,t=["checked"]){return function({tr:n,dispatch:r,state:o}){var h,m;const i=RZ(e,o.schema),{$from:s,$to:a}=n.selection;if(_v(n.selection)&&n.selection.node.isBlock||s.depth<2||!s.sameParent(a))return!1;const l=s.node(-1);if(l.type!==i)return!1;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==i||s.index(-2)!==s.node(-2).childCount-1)return!1;if(r){const v=s.index(-1)>0;let x=D.empty;for(let S=s.depth-(v?1:2);S>=s.depth-3;S--)x=D.from(s.node(S).copy(x));const b=((h=i.contentMatch.defaultType)==null?void 0:h.createAndFill())||void 0;x=x.append(D.from(i.createAndFill(null,b)||void 0));const w=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3;n.replace(s.before(v?void 0:-1),s.after(-w),new X(x,v?3:2,2)),n.setSelection(n.selection.constructor.near(n.doc.resolve(s.pos+(v?3:2)))),r(n.scrollIntoView())}return!0}if(l.attrs.closed&&s.sameParent(a)&&a.pos===a.end()){if(r){const v=s.after(-1),x=((m=i.contentMatch.defaultType)==null?void 0:m.createAndFill())||void 0,b=i.createAndFill(null,x);b&&(n.insert(v,b),n.setSelection(Oe.near(n.doc.resolve(v+1)))),n.delete(s.pos,a.pos),r(n.scrollIntoView())}return!0}const c=Object.fromEntries(Object.entries(l.attrs).filter(([v])=>!t.includes(v))),u=a.pos===s.end()?l.contentMatchAt(0).defaultType:null,d={...s.node().attrs};n.delete(s.pos,a.pos);const f=u?[{type:i,attrs:c},{type:u,attrs:d}]:[{type:i,attrs:c}];return mc(n.doc,s.pos,2)?(r&&r(n.split(s.pos,2,f).scrollIntoView()),!0):!1}}function xle(e,t,n,r){const o=t.node,i=e.doc.resolve(t.start),s=i.node(-1),a=i.index(-1);if(!s||!s.canReplace(a,a+1,D.from(n.create())))return!1;const l=[];for(let h=0;h<o.childCount;h++){const m=o.child(h);if(!r.validContent(m.content))return!1;const v=r.createChecked(null,m.content);l.push(v)}const c=n.createChecked(null,l),u=t.pos,d=u+o.nodeSize,f=e.selection.from;return e.replaceRangeWith(u,d,c),e.setSelection(e.selection.constructor.near(e.doc.resolve(f))),!0}function ble({listType:e,itemType:t,tr:n,range:r}){var l;const o=r.parent,i=n.doc.slice(r.start,r.end);if(o.type===e&&((l=i.content.firstChild)==null?void 0:l.type)===t)return!1;const s=[];for(let c=0;c<i.content.childCount;c++){const u=i.content.child(c);if(!t.validContent(u.content))return!1;const d=t.createChecked(null,u.content);s.push(d)}const a=e.createChecked(null,s);return n.replaceRange(r.start,r.end,new X(D.from(a),0,0)),!0}function Yc({listType:e,itemType:t,tr:n}){const r=vg(n.selection);if(!r)return!1;const o=r.startIndex===0,{from:i,to:s}=n.selection;return ble({listType:e,itemType:t,tr:n,range:r})?(n.setSelection(Oe.between(n.doc.resolve(o?i:i+2),n.doc.resolve(o?s:s+2))),n.scrollIntoView(),!0):!1}function wle(e,t,n){const r=e.tr,o=n.parent,i=r.mapping.maps.length;for(let m=n.end,v=n.endIndex-1,x=n.startIndex;v>x;v--)m-=o.child(v).nodeSize,r.delete(m-1,m+1);const s=r.doc.resolve(n.start),a=s.nodeAfter;if(!a||r.mapping.slice(i).map(n.end)!==n.start+a.nodeSize)return!1;const l=n.startIndex===0,c=n.endIndex===o.childCount,u=s.node(-1),d=s.index(-1);if(!u.canReplace(d+(l?0:1),d+1,a.content.append(c?D.empty:D.from(o))))return!1;const f=s.pos,h=f+a.nodeSize;return r.step(new Ot(f-(l?1:0),h+(c?1:0),f+1,h-1,new X((l?D.empty:D.from(o.copy(D.empty))).append(c?D.empty:D.from(o.copy(D.empty))),l?0:1,c?0:1),l?0:1)),t(r.scrollIntoView()),!0}function l2(e,t){const n=t||e.selection.$from;let r=[],o,i,s,a;for(let c=n.depth;c>=0;c--){if(i=n.node(c),o=n.index(c),s=i.maybeChild(o-1),a=i.maybeChild(o),s&&a&&s.type.name===a.type.name&&oa(s)){const u=n.before(c+1);r.push(u)}if(o=n.indexAfter(c),s=i.maybeChild(o-1),a=i.maybeChild(o),s&&a&&s.type.name===a.type.name&&oa(s)){const u=n.after(c+1);r.push(u)}}r=[...new Set(r)].sort((c,u)=>u-c);let l=!1;for(const c of r)kp(e.doc,c)&&(e.join(c),l=!0);return l}function c2(e){return t=>{const{dispatch:n,tr:r}=t,o=sS(r,t.state),i=Sle(e,r.selection);return i?(n&&wle(o,n,i),!0):!1}}function Sle(e,t){const{$from:n,$to:r}=t;return n.blockRange(r,i=>{var s;return((s=i.firstChild)==null?void 0:s.type)===e})}function vg(e){const{$from:t,$to:n}=e;return t.blockRange(n,oa)}function kle(e){const t=e.selection.$from,n=t.blockRange();if(!n||!Us(n.parent)||n.startIndex!==0)return!1;const r=t.node(n.depth-2),o=t.index(n.depth),i=t.index(n.depth-1),s=t.index(n.depth-2),a=r.maybeChild(s-1),l=a==null?void 0:a.lastChild;if(o!==0||i!==0)return!1;if(a&&oa(a)&&l&&Us(l))return Yc({listType:a.type,itemType:l.type,tr:e});if(Us(r)){const c=r,u=t.node(n.depth-3);if(oa(u))return Yc({listType:u.type,itemType:c.type,tr:e})}return!1}function yT({view:e}){if(!e)return!1;{const t=e.state.selection.$cursor;if(!t||t.parentOffset>0)return!1;const n=t.blockRange();if(!n||!Us(n.parent)||n.startIndex!==0)return!1}{const t=e.state.tr;kle(t)&&e.dispatch(t)}{const t=e.state.selection.$cursor;if(!t||t.parentOffset>0)return!1;const n=t.blockRange();if(!n||!Us(n.parent)||n.startIndex!==0)return!1;const r=t.index(n.depth),o=t.index(n.depth-1),i=t.index(n.depth-2),s=n.depth-2>=1&&Us(t.node(n.depth-2));r===0&&o===0&&i<=1&&s&&ple(n.parent.type)(e.state,e.dispatch)}return bD(e.state,e.dispatch,e),!0}function u2({node:e,mark:t,updateDOM:n,updateMark:r}){const o=document.createElement("label");o.contentEditable="false",o.classList.add(ra.LIST_ITEM_MARKER_CONTAINER),o.append(t);const i=document.createElement("div"),s=document.createElement("li");s.classList.add(ra.LIST_ITEM_WITH_CUSTOM_MARKER),s.append(o),s.append(i);const a=l=>l.type!==e.type?!1:(e=l,n(e,s),r(e,t),!0);return a(e),{dom:s,contentDOM:i,update:a}}function Cle(e,t){const n=e.node(t.depth-1),r=e.node(t.depth-2);return!Us(n)||!oa(r)?!1:{parentItem:n,parentList:r}}function Ele(e,t){const n=t.parent,r=t.parent.child(t.endIndex-1),o=t.end,i=t.$to.end(t.depth);return o<i?(e.step(new Ot(o-1,i,o,i,new X(D.from(r.type.create(null,n.copy())),1,0),1,!0)),new il(e.doc.resolve(t.$from.pos),e.doc.resolve(i),t.depth)):t}function _le(e,t){const n=t.parent,r=t.parent.child(t.endIndex-1),o=t.end,i=t.$to.end(t.depth-1);return o+1<i?(e.step(new Ot(o-1,i,o+1,i,new X(D.from(n.type.create(null,r.type.create(null))),2,0),0,!0)),new il(e.selection.$from,e.selection.$to,t.depth)):t}function Tle(e,t,n,r){return Yc({listType:n.type,itemType:r.type,tr:e})?new il(e.selection.$from,e.selection.$to,t.depth):t}function Ole(e){let t=vg(e.selection);if(!t)return!1;const n=Cle(e.selection.$from,t);if(!n)return!1;const{parentItem:r,parentList:o}=n;t=Ele(e,t),t=_le(e,t),t=Tle(e,t,o,r);const i=fu(t);return typeof i!="number"||(e.lift(t,i),t=vg(e.selection),t&&l2(e,e.doc.resolve(t.end-2))),!0}var Nle=({tr:e,dispatch:t})=>Ole(e)?(t==null||t(e.scrollIntoView()),!0):!1;function Mle(e,t,n){let r,o,i,s;const a=t.doc;if(n.startIndex>=1){r=e.child(n.startIndex-1),o=e,s=a.resolve(n.start).start(n.depth),i=s+1;for(let l=0;l<n.startIndex-1;l++)i+=o.child(l).nodeSize}else{const l=t.index(n.depth-1);if(l>=1){const c=t.node(n.depth-1),u=t.start(n.depth-1);if(o=c.child(l-1),!oa(o))return!1;s=u+1;for(let d=0;d<l-1;d++)s+=c.child(d).nodeSize;if(r=o.child(o.childCount-1),i=s+o.nodeSize-r.nodeSize-1,!Us(r))return!1}else return!1}return{previousItem:r,previousList:o,previousItemStart:i,previousListStart:s}}function Ple(e,t,n){let r,o;const i=n.start,s=t.depth>=n.depth+2?t.end(n.depth+2):n.end-1,a=n.end;return s+1>=a?(r=e.slice(i,a),o=null):(r=e.slice(i,s),o=e.slice(s+1,a-1)),{selectedSlice:r,unselectedSlice:o}}function Rle(e){const{$from:t,$to:n}=e.selection,r=vg(e.selection);if(!r)return!1;const o=e.doc.resolve(r.start).node();if(!oa(o))return!1;const i=Mle(o,t,r);if(!i)return!1;const{previousItem:s,previousList:a,previousItemStart:l}=i,{selectedSlice:c,unselectedSlice:u}=Ple(e.doc,n,r),d=s.content.append(D.fromArray([o.copy(c.content)])).append(u?u.content:D.empty);e.deleteRange(r.start,r.end);const f=l+s.nodeSize-2,h=s.copy(d);return h.check(),e.replaceRangeWith(l-1,f+1,h),e.setSelection(a===o?Oe.between(e.doc.resolve(t.pos),e.doc.resolve(n.pos)):Oe.between(e.doc.resolve(t.pos-2),e.doc.resolve(n.pos-2))),!0}var jle=({tr:e,dispatch:t})=>Rle(e)?(t==null||t(e.scrollIntoView()),!0):!1,d2=class extends pt{get name(){return"listItemShared"}createKeymap(){const e={Tab:jle,"Shift-Tab":Nle,Backspace:yT,"Mod-Backspace":yT};if(yo.isMac){const t={"Ctrl-h":e.Backspace,"Alt-Backspace":e["Mod-Backspace"]};return{...e,...t}}return e}createPlugin(){return{appendTransaction:(e,t,n)=>{const r=n.tr;return l2(r)?r:null}}}},Jc=class extends to{get name(){return"listItem"}createTags(){return[je.ListItemNode]}createNodeSpec(e,t){return{content:"paragraph block*",defining:!0,draggable:!1,...t,attrs:{...e.defaults(),closed:{default:!1},nested:{default:!1}},parseDOM:[{tag:"li",getAttrs:e.parse,priority:et.Lowest},...t.parseDOM??[]],toDOM:n=>["li",e.dom(n),0]}}createNodeViews(){return this.options.enableCollapsible?(e,t,n)=>{const r=document.createElement("div");return r.classList.add(ra.COLLAPSIBLE_LIST_ITEM_BUTTON),r.contentEditable="false",r.addEventListener("click",()=>{if(r.classList.contains("disabled"))return;const o=n(),i=we.create(t.state.doc,o);return t.dispatch(t.state.tr.setSelection(i)),this.store.commands.toggleListItemClosed(),!0}),u2({mark:r,node:e,updateDOM:Ale,updateMark:Ile})}:{}}createKeymap(){return{Enter:a2(this.type)}}createExtensions(){return[new d2]}toggleListItemClosed(e){return({state:{tr:t,selection:n},dispatch:r})=>{if(!_v(n)||n.node.type.name!==this.name)return!1;const{node:o,from:i}=n;return e=EG(e)?e:!o.attrs.closed,r==null||r(t.setNodeMarkup(i,void 0,{...o.attrs,closed:e})),!0}}liftListItemOutOfList(e){return c2(e??this.type)}};no([de()],Jc.prototype,"toggleListItemClosed",1);no([de()],Jc.prototype,"liftListItemOutOfList",1);Jc=no([Ge({defaultOptions:{enableCollapsible:!1},staticKeys:["enableCollapsible"]})],Jc);function Ale(e,t){e.attrs.closed?t.classList.add(ra.COLLAPSIBLE_LIST_ITEM_CLOSED):t.classList.remove(ra.COLLAPSIBLE_LIST_ITEM_CLOSED)}function Ile(e,t){e.childCount<=1?t.classList.add("disabled"):t.classList.remove("disabled")}var Uf=class extends to{get name(){return"bulletList"}createTags(){return[je.Block,je.ListContainerNode]}createNodeSpec(e,t){return{content:"listItem+",...t,attrs:e.defaults(),parseDOM:[{tag:"ul",getAttrs:e.parse},...t.parseDOM??[]],toDOM:n=>["ul",e.dom(n),0]}}createNodeViews(){return this.options.enableSpine?(e,t,n)=>{var c;const r=document.createElement("div");r.style.position="relative";const o=n(),i=t.state.doc.resolve(o+1),s=i.node(i.depth-1);if(!(((c=s==null?void 0:s.type)==null?void 0:c.name)!=="listItem")){const u=document.createElement("div");u.contentEditable="false",u.classList.add(ra.LIST_SPINE),u.addEventListener("click",d=>{const f=n(),h=t.state.doc.resolve(f+1),m=h.start(h.depth-1),v=we.create(t.state.doc,m-1);t.dispatch(t.state.tr.setSelection(v)),this.store.commands.toggleListItemClosed(),d.preventDefault(),d.stopPropagation()}),r.append(u)}const l=document.createElement("ul");return l.classList.add(ra.UL_LIST_CONTENT),r.append(l),{dom:r,contentDOM:l}}:{}}createExtensions(){return[new Jc({priority:et.Low,enableCollapsible:this.options.enableSpine})]}toggleBulletList(){return _S(this.type,vt(this.store.schema.nodes,"listItem"))}listShortcut(e){return this.toggleBulletList()(e)}createInputRules(){const e=/^\s*([*+-])\s$/;return[J1(e,this.type),new eo(e,(t,n,r,o)=>{const i=t.tr;return i.deleteRange(r,o),Yc({listType:this.type,itemType:vt(this.store.schema.nodes,"listItem"),tr:i})?i:null})]}};no([de({icon:"listUnordered",label:({t:e})=>e(Y1.BULLET_LIST_LABEL)})],Uf.prototype,"toggleBulletList",1);no([Ar({shortcut:G.BulletList,command:"toggleBulletList"})],Uf.prototype,"listShortcut",1);Uf=no([Ge({defaultOptions:{enableSpine:!1},staticKeys:["enableSpine"]})],Uf);var Wf=class extends to{get name(){return"orderedList"}createTags(){return[je.Block,je.ListContainerNode]}createNodeSpec(e,t){return{content:"listItem+",...t,attrs:{...e.defaults(),order:{default:1}},parseDOM:[{tag:"ol",getAttrs:n=>ri(n)?{...e.parse(n),order:+(n.getAttribute("start")??1)}:{}},...t.parseDOM??[]],toDOM:n=>{const r=e.dom(n);return n.attrs.order===1?["ol",r,0]:["ol",{...r,start:n.attrs.order},0]}}}createExtensions(){return[new Jc({priority:et.Low})]}toggleOrderedList(){return _S(this.type,vt(this.store.schema.nodes,"listItem"))}listShortcut(e){return this.toggleOrderedList()(e)}createInputRules(){const e=/^(\d+)\.\s$/;return[J1(e,this.type,t=>({order:+vt(t,1)}),(t,n)=>n.childCount+n.attrs.order===+vt(t,1)),new eo(e,(t,n,r,o)=>{const i=t.tr;if(i.deleteRange(r,o),!Yc({listType:this.type,itemType:vt(this.store.schema.nodes,"listItem"),tr:i}))return null;const a=+vt(n,1);if(a!==1){const l=Df({selection:i.selection,types:this.type});l&&i.setNodeMarkup(l.pos,void 0,{order:a})}return i})]}};no([de({icon:"listOrdered",label:({t:e})=>e(Y1.ORDERED_LIST_LABEL)})],Wf.prototype,"toggleOrderedList",1);no([Ar({shortcut:G.OrderedList,command:"toggleOrderedList"})],Wf.prototype,"listShortcut",1);Wf=no([Ge({})],Wf);var f2=class extends to{get name(){return"taskListItem"}createTags(){return[je.ListItemNode]}createNodeSpec(e,t){return{content:"paragraph block*",defining:!0,draggable:!1,...t,attrs:{...e.defaults(),checked:{default:!1}},parseDOM:[{tag:"li[data-task-list-item]",getAttrs:n=>{let r=!1;return ri(n)&&n.getAttribute("data-checked")!==null&&(r=!0),{checked:r,...e.parse(n)}},priority:et.Medium},...t.parseDOM??[]],toDOM:n=>["li",{...e.dom(n),"data-task-list-item":"","data-checked":n.attrs.checked?"":void 0},0]}}createNodeViews(){return(e,t,n)=>{const r=document.createElement("input");return r.type="checkbox",r.classList.add(ra.LIST_ITEM_CHECKBOX),r.contentEditable="false",r.addEventListener("click",o=>{t.editable||o.preventDefault()}),r.addEventListener("change",()=>{const o=n(),i=t.state.doc.resolve(o+1);this.store.commands.toggleCheckboxChecked({$pos:i})}),r.checked=e.attrs.checked,u2({node:e,mark:r,updateDOM:Dle,updateMark:Lle})}}createKeymap(){return{Enter:a2(this.type)}}createExtensions(){return[new d2]}toggleCheckboxChecked(e){let t,n;return typeof e=="boolean"?t=e:e&&(t=e.checked,n=e.$pos),({tr:r,dispatch:o})=>{const i=Df({selection:n??r.selection.$from,types:this.type});if(!i)return!1;const{node:s,pos:a}=i,l={...s.attrs,checked:t??!s.attrs.checked};return o==null||o(r.setNodeMarkup(a,void 0,l)),!0}}createInputRules(){const e=/^\s*(\[( ?|x|X)]\s)$/;return[J1(e,this.type,t=>({checked:["x","X"].includes(zd(t,2))})),new eo(e,(t,n,r,o)=>{const i=t.tr;if(i.deleteRange(r,o),!Yc({listType:vt(this.store.schema.nodes,"taskList"),itemType:this.type,tr:i}))return null;const a=["x","X"].includes(zd(n,2));if(a){const l=Df({selection:i.selection,types:this.type});l&&i.setNodeMarkup(l.pos,void 0,{checked:a})}return i})]}};no([de()],f2.prototype,"toggleCheckboxChecked",1);function Dle(e,t){e.attrs.checked?t.setAttribute("data-checked",""):t.removeAttribute("data-checked"),t.setAttribute("data-task-list-item","")}function Lle(e,t){t.checked=!!e.attrs.checked}var p2=class extends to{get name(){return"taskList"}createTags(){return[je.Block,je.ListContainerNode]}createNodeSpec(e,t){return{content:"taskListItem+",...t,attrs:e.defaults(),parseDOM:[{tag:"ul[data-task-list]",getAttrs:e.parse,priority:et.Medium},...t.parseDOM??[]],toDOM:n=>["ul",{...e.dom(n),"data-task-list":""},0]}}createExtensions(){return[new f2({})]}toggleTaskList(){return _S(this.type,vt(this.store.schema.nodes,"taskListItem"))}listShortcut(e){return this.toggleTaskList()(e)}};no([de({icon:"checkboxMultipleLine",label:({t:e})=>e(Y1.TASK_LIST_LABEL)})],p2.prototype,"toggleTaskList",1);no([Ar({shortcut:G.TaskList,command:"toggleTaskList"})],p2.prototype,"listShortcut",1);function Fle(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];function c(d){const{scope:f,children:h,...m}=d,v=(f==null?void 0:f[e][l])||a,x=g.useMemo(()=>m,Object.values(m));return p.jsx(v.Provider,{value:x,children:h})}function u(d,f){const h=(f==null?void 0:f[e][l])||a,m=g.useContext(h);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>g.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,zle(o,...t)]}function zle(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var fx="rovingFocusGroup.onEntryFocus",$le={bubbles:!1,cancelable:!0},Dv="RovingFocusGroup",[Ob,h2,Ble]=nv(Dv),[Vle,m2]=Fle(Dv,[Ble]),[Ule,Wle]=Vle(Dv),g2=g.forwardRef((e,t)=>p.jsx(Ob.Provider,{scope:e.__scopeRovingFocusGroup,children:p.jsx(Ob.Slot,{scope:e.__scopeRovingFocusGroup,children:p.jsx(Hle,{...e,ref:t})})}));g2.displayName=Dv;var Hle=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,f=g.useRef(null),h=Ie(t,f),m=cp(i),[v=null,x]=Qo({prop:s,defaultProp:a,onChange:l}),[b,w]=g.useState(!1),S=Ft(c),k=h2(n),C=g.useRef(!1),[T,_]=g.useState(0);return g.useEffect(()=>{const O=f.current;if(O)return O.addEventListener(fx,S),()=>O.removeEventListener(fx,S)},[S]),p.jsx(Ule,{scope:n,orientation:r,dir:m,loop:o,currentTabStopId:v,onItemFocus:g.useCallback(O=>x(O),[x]),onItemShiftTab:g.useCallback(()=>w(!0),[]),onFocusableItemAdd:g.useCallback(()=>_(O=>O+1),[]),onFocusableItemRemove:g.useCallback(()=>_(O=>O-1),[]),children:p.jsx(Ee.div,{tabIndex:b||T===0?-1:0,"data-orientation":r,...d,ref:h,style:{outline:"none",...e.style},onMouseDown:re(e.onMouseDown,()=>{C.current=!0}),onFocus:re(e.onFocus,O=>{const M=!C.current;if(O.target===O.currentTarget&&M&&!b){const j=new CustomEvent(fx,$le);if(O.currentTarget.dispatchEvent(j),!j.defaultPrevented){const L=k().filter(R=>R.focusable),B=L.find(R=>R.active),J=L.find(R=>R.id===v),H=[B,J,...L].filter(Boolean).map(R=>R.ref.current);x2(H,u)}}C.current=!1}),onBlur:re(e.onBlur,()=>w(!1))})})}),v2="RovingFocusGroupItem",y2=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=Hr(),l=i||a,c=Wle(v2,n),u=c.currentTabStopId===l,d=h2(n),{onFocusableItemAdd:f,onFocusableItemRemove:h}=c;return g.useEffect(()=>{if(r)return f(),()=>h()},[r,f,h]),p.jsx(Ob.ItemSlot,{scope:n,id:l,focusable:r,active:o,children:p.jsx(Ee.span,{tabIndex:u?0:-1,"data-orientation":c.orientation,...s,ref:t,onMouseDown:re(e.onMouseDown,m=>{r?c.onItemFocus(l):m.preventDefault()}),onFocus:re(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:re(e.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){c.onItemShiftTab();return}if(m.target!==m.currentTarget)return;const v=Gle(m,c.orientation,c.dir);if(v!==void 0){if(m.metaKey||m.ctrlKey||m.altKey||m.shiftKey)return;m.preventDefault();let b=d().filter(w=>w.focusable).map(w=>w.ref.current);if(v==="last")b.reverse();else if(v==="prev"||v==="next"){v==="prev"&&b.reverse();const w=b.indexOf(m.currentTarget);b=c.loop?Yle(b,w+1):b.slice(w+1)}setTimeout(()=>x2(b))}})})})});y2.displayName=v2;var Kle={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function qle(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Gle(e,t,n){const r=qle(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Kle[r]}function x2(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Yle(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Jle=g2,Xle=y2,Nb=["Enter"," "],Zle=["ArrowDown","PageUp","Home"],b2=["ArrowUp","PageDown","End"],Qle=[...Zle,...b2],ece={ltr:[...Nb,"ArrowRight"],rtl:[...Nb,"ArrowLeft"]},tce={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Np="Menu",[Hf,nce,rce]=nv(Np),[yl,w2]=Bi(Np,[rce,uu,m2]),Lv=uu(),S2=m2(),[oce,xl]=yl(Np),[ice,Mp]=yl(Np),k2=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=e,a=Lv(t),[l,c]=g.useState(null),u=g.useRef(!1),d=Ft(i),f=cp(o);return g.useEffect(()=>{const h=()=>{u.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>u.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),p.jsx(O1,{...a,children:p.jsx(oce,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:c,children:p.jsx(ice,{scope:t,onClose:g.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:s,children:r})})})};k2.displayName=Np;var sce="MenuAnchor",TS=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Lv(n);return p.jsx(sv,{...o,...r,ref:t})});TS.displayName=sce;var OS="MenuPortal",[ace,C2]=yl(OS,{forceMount:void 0}),E2=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,i=xl(OS,t);return p.jsx(ace,{scope:t,forceMount:n,children:p.jsx(Mn,{present:n||i.open,children:p.jsx(pp,{asChild:!0,container:o,children:r})})})};E2.displayName=OS;var qr="MenuContent",[lce,NS]=yl(qr),_2=g.forwardRef((e,t)=>{const n=C2(qr,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=xl(qr,e.__scopeMenu),s=Mp(qr,e.__scopeMenu);return p.jsx(Hf.Provider,{scope:e.__scopeMenu,children:p.jsx(Mn,{present:r||i.open,children:p.jsx(Hf.Slot,{scope:e.__scopeMenu,children:s.modal?p.jsx(cce,{...o,ref:t}):p.jsx(uce,{...o,ref:t})})})})}),cce=g.forwardRef((e,t)=>{const n=xl(qr,e.__scopeMenu),r=g.useRef(null),o=Ie(t,r);return g.useEffect(()=>{const i=r.current;if(i)return Xg(i)},[]),p.jsx(MS,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:re(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),uce=g.forwardRef((e,t)=>{const n=xl(qr,e.__scopeMenu);return p.jsx(MS,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),MS=g.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:h,disableOutsideScroll:m,...v}=e,x=xl(qr,n),b=Mp(qr,n),w=Lv(n),S=S2(n),k=nce(n),[C,T]=g.useState(null),_=g.useRef(null),O=Ie(t,_,x.onContentChange),M=g.useRef(0),j=g.useRef(""),L=g.useRef(0),B=g.useRef(null),J=g.useRef("right"),z=g.useRef(0),H=m?hp:g.Fragment,R=m?{as:Ai,allowPinchZoom:!0}:void 0,N=A=>{var $,oe;const P=j.current+A,I=k().filter(ce=>!ce.disabled),U=document.activeElement,me=($=I.find(ce=>ce.ref.current===U))==null?void 0:$.textValue,ee=I.map(ce=>ce.textValue),ve=Sce(ee,P,me),q=(oe=I.find(ce=>ce.textValue===ve))==null?void 0:oe.ref.current;(function ce(ie){j.current=ie,window.clearTimeout(M.current),ie!==""&&(M.current=window.setTimeout(()=>ce(""),1e3))})(P),q&&setTimeout(()=>q.focus())};g.useEffect(()=>()=>window.clearTimeout(M.current),[]),Yg();const E=g.useCallback(A=>{var I,U;return J.current===((I=B.current)==null?void 0:I.side)&&Cce(A,(U=B.current)==null?void 0:U.area)},[]);return p.jsx(lce,{scope:n,searchRef:j,onItemEnter:g.useCallback(A=>{E(A)&&A.preventDefault()},[E]),onItemLeave:g.useCallback(A=>{var P;E(A)||((P=_.current)==null||P.focus(),T(null))},[E]),onTriggerLeave:g.useCallback(A=>{E(A)&&A.preventDefault()},[E]),pointerGraceTimerRef:L,onPointerGraceIntentChange:g.useCallback(A=>{B.current=A},[]),children:p.jsx(H,{...R,children:p.jsx(fp,{asChild:!0,trapped:o,onMountAutoFocus:re(i,A=>{var P;A.preventDefault(),(P=_.current)==null||P.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:p.jsx(dp,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:h,children:p.jsx(Jle,{asChild:!0,...S,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:T,onEntryFocus:re(l,A=>{b.isUsingKeyboardRef.current||A.preventDefault()}),preventScrollOnEntryFocus:!0,children:p.jsx(N1,{role:"menu","aria-orientation":"vertical","data-state":V2(x.open),"data-radix-menu-content":"",dir:b.dir,...w,...v,ref:O,style:{outline:"none",...v.style},onKeyDown:re(v.onKeyDown,A=>{const I=A.target.closest("[data-radix-menu-content]")===A.currentTarget,U=A.ctrlKey||A.altKey||A.metaKey,me=A.key.length===1;I&&(A.key==="Tab"&&A.preventDefault(),!U&&me&&N(A.key));const ee=_.current;if(A.target!==ee||!Qle.includes(A.key))return;A.preventDefault();const q=k().filter($=>!$.disabled).map($=>$.ref.current);b2.includes(A.key)&&q.reverse(),bce(q)}),onBlur:re(e.onBlur,A=>{A.currentTarget.contains(A.target)||(window.clearTimeout(M.current),j.current="")}),onPointerMove:re(e.onPointerMove,Kf(A=>{const P=A.target,I=z.current!==A.clientX;if(A.currentTarget.contains(P)&&I){const U=A.clientX>z.current?"right":"left";J.current=U,z.current=A.clientX}}))})})})})})})});_2.displayName=qr;var dce="MenuGroup",PS=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(Ee.div,{role:"group",...r,ref:t})});PS.displayName=dce;var fce="MenuLabel",T2=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(Ee.div,{...r,ref:t})});T2.displayName=fce;var yg="MenuItem",xT="menu.itemSelect",Fv=g.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,i=g.useRef(null),s=Mp(yg,e.__scopeMenu),a=NS(yg,e.__scopeMenu),l=Ie(t,i),c=g.useRef(!1),u=()=>{const d=i.current;if(!n&&d){const f=new CustomEvent(xT,{bubbles:!0,cancelable:!0});d.addEventListener(xT,h=>r==null?void 0:r(h),{once:!0}),GM(d,f),f.defaultPrevented?c.current=!1:s.onClose()}};return p.jsx(O2,{...o,ref:l,disabled:n,onClick:re(e.onClick,u),onPointerDown:d=>{var f;(f=e.onPointerDown)==null||f.call(e,d),c.current=!0},onPointerUp:re(e.onPointerUp,d=>{var f;c.current||(f=d.currentTarget)==null||f.click()}),onKeyDown:re(e.onKeyDown,d=>{const f=a.searchRef.current!=="";n||f&&d.key===" "||Nb.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});Fv.displayName=yg;var O2=g.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=e,s=NS(yg,n),a=S2(n),l=g.useRef(null),c=Ie(t,l),[u,d]=g.useState(!1),[f,h]=g.useState("");return g.useEffect(()=>{const m=l.current;m&&h((m.textContent??"").trim())},[i.children]),p.jsx(Hf.ItemSlot,{scope:n,disabled:r,textValue:o??f,children:p.jsx(Xle,{asChild:!0,...a,focusable:!r,children:p.jsx(Ee.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:c,onPointerMove:re(e.onPointerMove,Kf(m=>{r?s.onItemLeave(m):(s.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:re(e.onPointerLeave,Kf(m=>s.onItemLeave(m))),onFocus:re(e.onFocus,()=>d(!0)),onBlur:re(e.onBlur,()=>d(!1))})})})}),pce="MenuCheckboxItem",N2=g.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return p.jsx(A2,{scope:e.__scopeMenu,checked:n,children:p.jsx(Fv,{role:"menuitemcheckbox","aria-checked":xg(n)?"mixed":n,...o,ref:t,"data-state":jS(n),onSelect:re(o.onSelect,()=>r==null?void 0:r(xg(n)?!0:!n),{checkForDefaultPrevented:!1})})})});N2.displayName=pce;var M2="MenuRadioGroup",[hce,mce]=yl(M2,{value:void 0,onValueChange:()=>{}}),P2=g.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,i=Ft(r);return p.jsx(hce,{scope:e.__scopeMenu,value:n,onValueChange:i,children:p.jsx(PS,{...o,ref:t})})});P2.displayName=M2;var R2="MenuRadioItem",j2=g.forwardRef((e,t)=>{const{value:n,...r}=e,o=mce(R2,e.__scopeMenu),i=n===o.value;return p.jsx(A2,{scope:e.__scopeMenu,checked:i,children:p.jsx(Fv,{role:"menuitemradio","aria-checked":i,...r,ref:t,"data-state":jS(i),onSelect:re(r.onSelect,()=>{var s;return(s=o.onValueChange)==null?void 0:s.call(o,n)},{checkForDefaultPrevented:!1})})})});j2.displayName=R2;var RS="MenuItemIndicator",[A2,gce]=yl(RS,{checked:!1}),I2=g.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,i=gce(RS,n);return p.jsx(Mn,{present:r||xg(i.checked)||i.checked===!0,children:p.jsx(Ee.span,{...o,ref:t,"data-state":jS(i.checked)})})});I2.displayName=RS;var vce="MenuSeparator",D2=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(Ee.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});D2.displayName=vce;var yce="MenuArrow",L2=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Lv(n);return p.jsx(M1,{...o,...r,ref:t})});L2.displayName=yce;var xce="MenuSub",[ffe,F2]=yl(xce),bd="MenuSubTrigger",z2=g.forwardRef((e,t)=>{const n=xl(bd,e.__scopeMenu),r=Mp(bd,e.__scopeMenu),o=F2(bd,e.__scopeMenu),i=NS(bd,e.__scopeMenu),s=g.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=i,c={__scopeMenu:e.__scopeMenu},u=g.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return g.useEffect(()=>u,[u]),g.useEffect(()=>{const d=a.current;return()=>{window.clearTimeout(d),l(null)}},[a,l]),p.jsx(TS,{asChild:!0,...c,children:p.jsx(O2,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":V2(n.open),...e,ref:Wg(t,o.onTriggerChange),onClick:d=>{var f;(f=e.onClick)==null||f.call(e,d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:re(e.onPointerMove,Kf(d=>{i.onItemEnter(d),!d.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:re(e.onPointerLeave,Kf(d=>{var h,m;u();const f=(h=n.content)==null?void 0:h.getBoundingClientRect();if(f){const v=(m=n.content)==null?void 0:m.dataset.side,x=v==="right",b=x?-5:5,w=f[x?"left":"right"],S=f[x?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+b,y:d.clientY},{x:w,y:f.top},{x:S,y:f.top},{x:S,y:f.bottom},{x:w,y:f.bottom}],side:v}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(d),d.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:re(e.onKeyDown,d=>{var h;const f=i.searchRef.current!=="";e.disabled||f&&d.key===" "||ece[r.dir].includes(d.key)&&(n.onOpenChange(!0),(h=n.content)==null||h.focus(),d.preventDefault())})})})});z2.displayName=bd;var $2="MenuSubContent",B2=g.forwardRef((e,t)=>{const n=C2(qr,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=xl(qr,e.__scopeMenu),s=Mp(qr,e.__scopeMenu),a=F2($2,e.__scopeMenu),l=g.useRef(null),c=Ie(t,l);return p.jsx(Hf.Provider,{scope:e.__scopeMenu,children:p.jsx(Mn,{present:r||i.open,children:p.jsx(Hf.Slot,{scope:e.__scopeMenu,children:p.jsx(MS,{id:a.contentId,"aria-labelledby":a.triggerId,...o,ref:c,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var d;s.isUsingKeyboardRef.current&&((d=l.current)==null||d.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:re(e.onFocusOutside,u=>{u.target!==a.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:re(e.onEscapeKeyDown,u=>{s.onClose(),u.preventDefault()}),onKeyDown:re(e.onKeyDown,u=>{var h;const d=u.currentTarget.contains(u.target),f=tce[s.dir].includes(u.key);d&&f&&(i.onOpenChange(!1),(h=a.trigger)==null||h.focus(),u.preventDefault())})})})})})});B2.displayName=$2;function V2(e){return e?"open":"closed"}function xg(e){return e==="indeterminate"}function jS(e){return xg(e)?"indeterminate":e?"checked":"unchecked"}function bce(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function wce(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Sce(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=wce(e,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function kce(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i].x,l=t[i].y,c=t[s].x,u=t[s].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(o=!o)}return o}function Cce(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return kce(n,t)}function Kf(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Ece=k2,_ce=TS,Tce=E2,Oce=_2,Nce=PS,Mce=T2,Pce=Fv,Rce=N2,jce=P2,Ace=j2,Ice=I2,Dce=D2,Lce=L2,Fce=z2,zce=B2,AS="DropdownMenu",[$ce,pfe]=Bi(AS,[w2]),Kn=w2(),[Bce,U2]=$ce(AS),W2=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:s,modal:a=!0}=e,l=Kn(t),c=g.useRef(null),[u=!1,d]=Qo({prop:o,defaultProp:i,onChange:s});return p.jsx(Bce,{scope:t,triggerId:Hr(),triggerRef:c,contentId:Hr(),open:u,onOpenChange:d,onOpenToggle:g.useCallback(()=>d(f=>!f),[d]),modal:a,children:p.jsx(Ece,{...l,open:u,onOpenChange:d,dir:r,modal:a,children:n})})};W2.displayName=AS;var H2="DropdownMenuTrigger",K2=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,i=U2(H2,n),s=Kn(n);return p.jsx(_ce,{asChild:!0,...s,children:p.jsx(Ee.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:Wg(t,i.triggerRef),onPointerDown:re(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(i.onOpenToggle(),i.open||a.preventDefault())}),onKeyDown:re(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&i.onOpenToggle(),a.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});K2.displayName=H2;var Vce="DropdownMenuPortal",q2=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Kn(t);return p.jsx(Tce,{...r,...n})};q2.displayName=Vce;var G2="DropdownMenuContent",Y2=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=U2(G2,n),i=Kn(n),s=g.useRef(!1);return p.jsx(Oce,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...r,ref:t,onCloseAutoFocus:re(e.onCloseAutoFocus,a=>{var l;s.current||(l=o.triggerRef.current)==null||l.focus(),s.current=!1,a.preventDefault()}),onInteractOutside:re(e.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!o.modal||u)&&(s.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)"}})});Y2.displayName=G2;var Uce="DropdownMenuGroup",Wce=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Kn(n);return p.jsx(Nce,{...o,...r,ref:t})});Wce.displayName=Uce;var Hce="DropdownMenuLabel",J2=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Kn(n);return p.jsx(Mce,{...o,...r,ref:t})});J2.displayName=Hce;var Kce="DropdownMenuItem",X2=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Kn(n);return p.jsx(Pce,{...o,...r,ref:t})});X2.displayName=Kce;var qce="DropdownMenuCheckboxItem",Z2=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Kn(n);return p.jsx(Rce,{...o,...r,ref:t})});Z2.displayName=qce;var Gce="DropdownMenuRadioGroup",Yce=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Kn(n);return p.jsx(jce,{...o,...r,ref:t})});Yce.displayName=Gce;var Jce="DropdownMenuRadioItem",Q2=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Kn(n);return p.jsx(Ace,{...o,...r,ref:t})});Q2.displayName=Jce;var Xce="DropdownMenuItemIndicator",eL=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Kn(n);return p.jsx(Ice,{...o,...r,ref:t})});eL.displayName=Xce;var Zce="DropdownMenuSeparator",tL=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Kn(n);return p.jsx(Dce,{...o,...r,ref:t})});tL.displayName=Zce;var Qce="DropdownMenuArrow",eue=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Kn(n);return p.jsx(Lce,{...o,...r,ref:t})});eue.displayName=Qce;var tue="DropdownMenuSubTrigger",nL=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Kn(n);return p.jsx(Fce,{...o,...r,ref:t})});nL.displayName=tue;var nue="DropdownMenuSubContent",rL=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Kn(n);return p.jsx(zce,{...o,...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)"}})});rL.displayName=nue;var rue=W2,oue=K2,iue=q2,oL=Y2,iL=J2,sL=X2,aL=Z2,lL=Q2,cL=eL,uL=tL,dL=nL,fL=rL;const sue=rue,aue=oue,lue=g.forwardRef(({className:e,inset:t,children:n,...r},o)=>p.jsxs(dL,{ref:o,className:qe("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-bg-brand-primary_alt data-[state=open]:bg-bg-brand-primary",t&&"pl-8",e),...r,children:[n,p.jsx(tu,{className:"w-4 h-4 ml-auto"})]}));lue.displayName=dL.displayName;const cue=g.forwardRef(({className:e,...t},n)=>p.jsx(fL,{ref:n,className:qe("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-bg-secondary_alt p-1 text-text-secondary shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));cue.displayName=fL.displayName;const pL=g.forwardRef(({className:e,sideOffset:t=4,container:n,...r},o)=>p.jsx(iue,{container:n,children:p.jsx(oL,{ref:o,sideOffset:t,className:qe("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-bg-secondary_alt p-1 text-text-secondary shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));pL.displayName=oL.displayName;const cs=g.forwardRef(({className:e,inset:t,...n},r)=>p.jsx(sL,{ref:r,className:qe("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-bg-brand-solid focus:text-text-brand-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));cs.displayName=sL.displayName;const uue=g.forwardRef(({className:e,children:t,checked:n,...r},o)=>p.jsxs(aL,{ref:o,className:qe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[p.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(cL,{children:p.jsx(ap,{className:"w-4 h-4"})})}),t]}));uue.displayName=aL.displayName;const due=g.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(lL,{ref:r,className:qe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[p.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(cL,{children:p.jsx(E8,{className:"w-2 h-2 fill-current"})})}),t]}));due.displayName=lL.displayName;const fue=g.forwardRef(({className:e,inset:t,...n},r)=>p.jsx(iL,{ref:r,className:qe("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));fue.displayName=iL.displayName;const pue=g.forwardRef(({className:e,...t},n)=>p.jsx(uL,{ref:n,className:qe("-mx-1 my-1 h-px bg-muted",e),...t}));pue.displayName=uL.displayName;var hue=Object.defineProperty,mue=Object.getOwnPropertyDescriptor,Pp=(e,t,n,r)=>{for(var o=r>1?void 0:r?mue(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&hue(t,n,o),o},gue={icon:"bold",label:({t:e})=>e(ZE.LABEL),description:({t:e})=>e(ZE.DESCRIPTION)},dl=class extends Tp{get name(){return"bold"}createTags(){return[je.FormattingMark,je.FontStyle]}createMarkSpec(e,t){return{...t,attrs:e.defaults(),parseDOM:[{tag:"strong",getAttrs:e.parse},{tag:"b",getAttrs:n=>ri(n)&&n.style.fontWeight!=="normal"?e.parse(n):!1},{style:"font-weight",getAttrs:n=>_e(n)&&/^(bold(er)?|[5-9]\d{2,})$/.test(n)?null:!1},...t.parseDOM??[]],toDOM:n=>{const{weight:r}=this.options;return r?["strong",{"font-weight":r.toString()},0]:["strong",e.dom(n),0]}}}createInputRules(){return[ug({regexp:/(?:\*\*|__)([^*_]+)(?:\*\*|__)$/,type:this.type,ignoreWhitespace:!0})]}toggleBold(e){return Ff({type:this.type,selection:e})}setBold(e){return({tr:t,dispatch:n})=>{const{from:r,to:o}=Jr(e??t.selection,t.doc);return n==null||n(t.addMark(r,o,this.type.create())),!0}}removeBold(e){return({tr:t,dispatch:n})=>{const{from:r,to:o}=Jr(e??t.selection,t.doc);return t.doc.rangeHasMark(r,o,this.type)?(n==null||n(t.removeMark(r,o,this.type)),!0):!1}}shortcut(e){return this.toggleBold()(e)}};Pp([de(gue)],dl.prototype,"toggleBold",1);Pp([de()],dl.prototype,"setBold",1);Pp([de()],dl.prototype,"removeBold",1);Pp([Ar({shortcut:G.Bold,command:"toggleBold"})],dl.prototype,"shortcut",1);dl=Pp([Ge({defaultOptions:{weight:void 0},staticKeys:["weight"]})],dl);var vue=Object.defineProperty,yue=Object.getOwnPropertyDescriptor,IS=(e,t,n,r)=>{for(var o=r>1?void 0:r?yue(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&vue(t,n,o),o},xue={icon:"italic",label:({t:e})=>e(QE.LABEL),description:({t:e})=>e(QE.DESCRIPTION)},qf=class extends Tp{get name(){return"italic"}createTags(){return[je.FontStyle,je.FormattingMark]}createMarkSpec(e,t){return{...t,attrs:e.defaults(),parseDOM:[{tag:"i",getAttrs:e.parse},{tag:"em",getAttrs:e.parse},{style:"font-style=italic"},...t.parseDOM??[]],toDOM:n=>["em",e.dom(n),0]}}createKeymap(){return{"Mod-i":Ff({type:this.type})}}createInputRules(){return[ug({regexp:/(?:^|[^*])\*([^*]+)\*$/,type:this.type,ignoreWhitespace:!0,updateCaptured:({fullMatch:e,start:t})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:t+1}}),ug({regexp:/(?:^|\W)_([^_]+)_$/,type:this.type,ignoreWhitespace:!0,updateCaptured:({fullMatch:e,start:t})=>e.startsWith("_")?{}:{fullMatch:e.slice(1),start:t+1}})]}createPasteRules(){return[{type:"mark",markType:this.type,regexp:/(?:^|\W)_([^_]+)_/g},{type:"mark",markType:this.type,regexp:/\*([^*]+)\*/g}]}toggleItalic(e){return Ff({type:this.type,selection:e})}shortcut(e){return this.toggleItalic()(e)}};IS([de(xue)],qf.prototype,"toggleItalic",1);IS([Ar({shortcut:G.Italic,command:"toggleItalic"})],qf.prototype,"shortcut",1);qf=IS([Ge({})],qf);var bue=Object.defineProperty,wue=Object.getOwnPropertyDescriptor,DS=(e,t,n,r)=>{for(var o=r>1?void 0:r?wue(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&bue(t,n,o),o},Sue={icon:"strikethrough",label:({t:e})=>e(e_.LABEL),description:({t:e})=>e(e_.DESCRIPTION)},Gf=class extends Tp{get name(){return"strike"}createTags(){return[je.FontStyle,je.FormattingMark]}createMarkSpec(e,t){return{...t,attrs:e.defaults(),parseDOM:[{tag:"s",getAttrs:e.parse},{tag:"del",getAttrs:e.parse},{tag:"strike",getAttrs:e.parse},{style:"text-decoration",getAttrs:n=>n==="line-through"?{}:!1},...t.parseDOM??[]],toDOM:n=>["s",e.dom(n),0]}}toggleStrike(){return Ff({type:this.type})}shortcut(e){return this.toggleStrike()(e)}createInputRules(){return[ug({regexp:/~([^~]+)~$/,type:this.type,ignoreWhitespace:!0})]}createPasteRules(){return[{regexp:/~([^~]+)~/g,type:"mark",markType:this.type}]}};DS([de(Sue)],Gf.prototype,"toggleStrike",1);DS([Ar({shortcut:G.Strike,command:"toggleStrike"})],Gf.prototype,"shortcut",1);Gf=DS([Ge({})],Gf);var kue='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="22" height="22" fill="rgba(0, 0, 0, 0.65)" stroke="rgba(255, 255, 255, 0.5)" transform="rotate(90)" xmlns:v="https://vecta.io/nano"><path fill-rule="evenodd" d="M14 0a2 2 0 0 0-2 2v10H2a2 2 0 1 0 0 4h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/></svg>',Cue='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="22" height="22" fill="rgba(0, 0, 0, 0.65)" stroke="rgba(255, 255, 255, 0.5)" transform="matrix(0 1 1 0 0 0)" xmlns:v="https://vecta.io/nano"><path fill-rule="evenodd" d="M14 0a2 2 0 0 0-2 2v10H2a2 2 0 1 0 0 4h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/></svg>',Eue=encodeURIComponent(kue),_ue=encodeURIComponent(Cue),An,_T,Tue=(_T=class{constructor(e){Et(this,"dom");bn(this,An);Et(this,"type");const t=document.createElement("div"),n=document.createElement("div");this.dom=t,$e(this,An,n),this.type=e,this.createHandle(e)}createHandle(e){switch(kn(this.dom,{position:"absolute",pointerEvents:"auto",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"100"}),kn(te(this,An),{opacity:"0",transition:"opacity 300ms ease-in 0s"}),te(this,An).dataset.dragging="",e){case 0:kn(this.dom,{right:"0px",top:"0px",height:"100%",width:"15px",cursor:"col-resize"}),kn(te(this,An),{width:" 4px",height:"36px",maxHeight:"50%",boxSizing:"content-box",background:"rgba(0, 0, 0, 0.65)",border:"1px solid rgba(255, 255, 255, 0.5)",borderRadius:"6px"});break;case 1:kn(this.dom,{left:"0px",top:"0px",height:"100%",width:"15px",cursor:"col-resize"}),kn(te(this,An),{width:" 4px",height:"36px",maxHeight:"50%",boxSizing:"content-box",background:"rgba(0, 0, 0, 0.65)",border:"1px solid rgba(255, 255, 255, 0.5)",borderRadius:"6px"});break;case 2:kn(this.dom,{bottom:"0px",width:"100%",height:"14px",cursor:"row-resize"}),kn(te(this,An),{width:" 42px",height:"4px",boxSizing:"content-box",maxWidth:"50%",background:"rgba(0, 0, 0, 0.65)",border:"1px solid rgba(255, 255, 255, 0.5)",borderRadius:"6px"});break;case 3:kn(this.dom,{right:"-1px",bottom:"-2px",width:"30px",height:"30px",cursor:"nwse-resize",zIndex:"101"}),kn(te(this,An),{height:"22px",width:"22px",backgroundRepeat:"no-repeat",backgroundImage:`url("data:image/svg+xml,${_ue}") `});break;case 4:kn(this.dom,{left:"-1px",bottom:"-2px",width:"30px",height:"30px",cursor:"nesw-resize",zIndex:"101"}),kn(te(this,An),{height:"22px",width:"22px",backgroundRepeat:"no-repeat",backgroundImage:`url("data:image/svg+xml,${Eue}") `});break}this.dom.append(te(this,An))}setHandleVisibility(e){const t=e||!!te(this,An).dataset.dragging;te(this,An).style.opacity=t?"1":"0"}dataSetDragging(e){te(this,An).dataset.dragging=e?"true":""}},An=new WeakMap,_T),hh=50,hL=(e=>(e[e.Fixed=0]="Fixed",e[e.Flexible=1]="Flexible",e))(hL||{}),xs,bs,ws,Uo,Ss,TT,Oue=(TT=class{constructor({node:e,view:t,getPos:n,aspectRatio:r=0,options:o,initialSize:i}){Et(this,"dom");bn(this,xs);bn(this,bs);bn(this,ws,[]);Et(this,"aspectRatio");bn(this,Uo);bn(this,Ss);const s=this.createWrapper(e,i),a=this.createElement({node:e,view:t,getPos:n,options:o}),c=(r===1?[0,1,2,3,4]:[0,1]).map(f=>new Tue(f));for(const f of c){const h=m=>{this.startResizing(m,t,n,f)};f.dom.addEventListener("mousedown",h),te(this,ws).push(()=>f.dom.removeEventListener("mousedown",h)),s.append(f.dom)}const u=()=>{c.forEach(f=>f.setHandleVisibility(!0))},d=()=>{c.forEach(f=>f.setHandleVisibility(!1))};s.addEventListener("mouseover",u),s.addEventListener("mouseout",d),te(this,ws).push(()=>s.removeEventListener("mouseover",u),()=>s.removeEventListener("mouseout",d)),s.append(a),this.dom=s,$e(this,bs,e),$e(this,xs,a),this.aspectRatio=r}createWrapper(e,t){const n=document.createElement("div");return n.classList.add("remirror-resizable-view"),n.style.position="relative",t?kn(n,{width:bT(t.width),aspectRatio:`${t.width} / ${t.height}`}):kn(n,{width:bT(e.attrs.width),aspectRatio:`${e.attrs.width} / ${e.attrs.height}`}),kn(n,{maxWidth:"100%",minWidth:`${hh}px`,verticalAlign:"bottom",display:"inline-block",lineHeight:"0",transition:"width 0.15s ease-out, height 0.15s ease-out"}),n}startResizing(e,t,n,r){var u,d;e.preventDefault(),r.dataSetDragging(!0),te(this,xs).style.pointerEvents="none";const o=e.pageX,i=e.pageY,s=((u=te(this,xs))==null?void 0:u.getBoundingClientRect().width)||0,a=((d=te(this,xs))==null?void 0:d.getBoundingClientRect().height)||0,l=H0(100,!1,f=>{const h=f.pageX,m=f.pageY,v=h-o,x=m-i;let b=null,w=null;if(this.aspectRatio===0&&s&&a)switch(r.type){case 0:case 3:b=s+v,w=a/s*b;break;case 1:case 4:b=s-v,w=a/s*b;break;case 2:w=a+x,b=s/a*w;break}else if(this.aspectRatio===1)switch(r.type){case 0:b=s+v;break;case 1:b=s-v;break;case 2:w=a+x;break;case 3:b=s+v,w=a+x;break;case 4:b=s-v,w=a+x;break}typeof b=="number"&&b<hh&&(this.aspectRatio===0&&s&&a?(b=hh,w=a/s*b):this.aspectRatio===1&&(b=hh)),b&&($e(this,Uo,Math.round(b)),this.dom.style.width=`${te(this,Uo)}px`),w&&$e(this,Ss,Math.round(w)),(b||w)&&(this.dom.style.aspectRatio=`${te(this,Uo)} / ${te(this,Ss)}`)}),c=f=>{f.preventDefault(),r.dataSetDragging(!1),r.setHandleVisibility(!1),te(this,xs).style.pointerEvents="auto",document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",c);const h=n(),m=t.state.tr.setNodeMarkup(h,void 0,{...te(this,bs).attrs,width:te(this,Uo),height:te(this,Ss)});t.dispatch(m)};document.addEventListener("mousemove",l),document.addEventListener("mouseup",c),te(this,ws).push(()=>document.removeEventListener("mousemove",l)),te(this,ws).push(()=>document.removeEventListener("mouseup",c))}update(e){return e.type!==te(this,bs).type||this.aspectRatio===0&&e.attrs.width&&e.attrs.width!==te(this,Uo)||this.aspectRatio===1&&e.attrs.width&&e.attrs.height&&e.attrs.width!==te(this,Uo)&&e.attrs.height!==te(this,Ss)||!Nue(te(this,bs),e,["width","height"])?!1:($e(this,bs,e),$e(this,Uo,e.attrs.width),$e(this,Ss,e.attrs.height),!0)}destroy(){te(this,ws).forEach(e=>e())}},xs=new WeakMap,bs=new WeakMap,ws=new WeakMap,Uo=new WeakMap,Ss=new WeakMap,TT);function Nue(e,t,n){return e===t||Mue(e,t,n)&&e.content.eq(t.content)}function Mue(e,t,n){const r=e.attrs,o=t.attrs,i={};for(const a of n)i[a]=null;e.attrs={...r,...i},t.attrs={...o,...i};const s=e.sameMarkup(t);return e.attrs=r,t.attrs=o,s}function bT(e){return typeof e=="number"?`${e}px`:e||void 0}var Pue=Object.defineProperty,Rue=Object.getOwnPropertyDescriptor,LS=(e,t,n,r)=>{for(var o=r>1?void 0:r?Rue(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Pue(t,n,o),o},jue=class extends Oue{constructor(e,t,n){super({node:e,view:t,getPos:n,aspectRatio:hL.Fixed})}createElement({node:e}){const t=document.createElement("img");return t.setAttribute("src",e.attrs.src),kn(t,{width:"100%",minWidth:"50px",objectFit:"contain"}),t}},Yf=class extends to{get name(){return"image"}createTags(){return[je.InlineNode,je.Media]}createNodeSpec(e,t){const{preferPastedTextContent:n}=this.options;return{inline:!0,draggable:!0,selectable:!1,...t,attrs:{...e.defaults(),alt:{default:""},crop:{default:null},height:{default:null},width:{default:null},rotate:{default:null},src:{default:null},title:{default:""},fileName:{default:null},resizable:{default:!1}},parseDOM:[{tag:"img[src]",getAttrs:r=>{var o;if(ri(r)){const i=Iue({element:r,parse:e.parse});return n&&((o=i.src)!=null&&o.startsWith("file:///"))?!1:i}return{}}},...t.parseDOM??[]],toDOM:r=>{const o=pD(r.attrs,e);return["img",{...e.dom(r),...o}]}}}insertImage(e,t){return({tr:n,dispatch:r})=>{const{from:o,to:i}=Jr(t??n.selection,n.doc),s=this.type.create(e);return r==null||r(n.replaceRangeWith(o,i,s)),!0}}uploadImage(e,t){const{updatePlaceholder:n,destroyPlaceholder:r,createPlaceholder:o}=this.options;return i=>{const{tr:s}=i;let a=s.selection.from;return this.store.createPlaceholderCommand({promise:e,placeholder:{type:"widget",get pos(){return a},createElement:(l,c)=>{const u=o(l,c);return t==null||t(u),u},onUpdate:(l,c,u,d)=>{n(l,c,u,d)},onDestroy:(l,c)=>{r(l,c)}},onSuccess:(l,c,u)=>this.insertImage(l,c)(u)}).validate(({tr:l,dispatch:c})=>{const u=lI(l.doc,a,this.type);return u==null?!1:(a=u,l.selection.empty||c==null||c(l.deleteSelection()),!0)},"unshift").generateCommand()(i)}}fileUploadFileHandler(e,t,n){var c;const{preferPastedTextContent:r,uploadHandler:o}=this.options;if(r&&Fue(t)&&((c=t.clipboardData)!=null&&c.getData("text/plain")))return!1;const{commands:i,chain:s}=this.store,a=e.map((u,d)=>({file:u,progress:f=>{i.updatePlaceholder(l[d],f)}})),l=o(a);Pr(n)&&s.selectText(n);for(const u of l)s.uploadImage(u);return s.run(),!0}createPasteRules(){return[{type:"file",regexp:/image/i,fileHandler:e=>{const t=e.type==="drop"?e.pos:void 0;return this.fileUploadFileHandler(e.files,e.event,t)}}]}createNodeViews(){return this.options.enableResizing?(e,t,n)=>new jue(e,t,n):{}}};LS([de()],Yf.prototype,"insertImage",1);LS([de()],Yf.prototype,"uploadImage",1);Yf=LS([Ge({defaultOptions:{createPlaceholder:Due,updatePlaceholder:()=>{},destroyPlaceholder:()=>{},uploadHandler:Lue,enableResizing:!1,preferPastedTextContent:!0}})],Yf);function Aue(e){let{width:t,height:n}=e.style;return t=t||e.getAttribute("width")||"",n=n||e.getAttribute("height")||"",{width:t,height:n}}function Iue({element:e,parse:t}){const{width:n,height:r}=Aue(e);return{...t(e),alt:e.getAttribute("alt")??"",height:Number.parseInt(r||"0",10)||null,src:e.getAttribute("src")??null,title:e.getAttribute("title")??"",width:Number.parseInt(n||"0",10)||null,fileName:e.getAttribute("data-file-name")??null}}function Due(e,t){const n=document.createElement("div");return n.classList.add(iae.IMAGE_LOADER),n}function Lue(e){xe(e.length>0,{code:K.EXTENSION,message:"The upload handler was applied for the image extension without any valid files"});let t=0;const n=[];for(const{file:r,progress:o}of e)n.push(()=>new Promise(i=>{const s=new FileReader;s.addEventListener("load",a=>{var l;t+=1,o(t/e.length),i({src:(l=a.target)==null?void 0:l.result,fileName:r.name})},{once:!0}),s.readAsDataURL(r)}));return n}function Fue(e){return e.clipboardData!==void 0}function zue(e={}){return new Vi({view(t){return new $ue(t,e)}})}class $ue{constructor(t,n){var r;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return t.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.handlers.forEach(({name:t,handler:n})=>this.editorView.dom.removeEventListener(t,n))}update(t,n){this.cursorPos!=null&&n.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,r;if(n){let a=t.nodeBefore,l=t.nodeAfter;if(a||l){let c=this.editorView.nodeDOM(this.cursorPos-(a?a.nodeSize:0));if(c){let u=c.getBoundingClientRect(),d=a?u.bottom:u.top;a&&l&&(d=(d+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:u.left,right:u.right,top:d-this.width/2,bottom:d+this.width/2}}}}if(!r){let a=this.editorView.coordsAtPos(this.cursorPos);r={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let o=this.editorView.dom.offsetParent;this.element||(this.element=o.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let i,s;if(!o||o==document.body&&getComputedStyle(o).position=="static")i=-pageXOffset,s=-pageYOffset;else{let a=o.getBoundingClientRect();i=a.left-o.scrollLeft,s=a.top-o.scrollTop}this.element.style.left=r.left-i+"px",this.element.style.top=r.top-s+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),t)}dragover(t){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,t):o;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=cI(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){(t.target==this.editorView.dom||!this.editorView.dom.contains(t.relatedTarget))&&this.setCursor(null)}}var Bue=Object.defineProperty,Vue=Object.getOwnPropertyDescriptor,Uue=(e,t,n,r)=>{for(var o=r>1?void 0:r?Vue(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Bue(t,n,o),o},Mb=class extends pt{get name(){return"dropCursor"}createExternalPlugins(){const{color:e,width:t}=this.options;return[zue({color:e,width:t})]}};Mb=Uue([Ge({defaultOptions:{color:"black",width:1}})],Mb);var Wue=Object.defineProperty,Hue=Object.getOwnPropertyDescriptor,mL=(e,t,n,r)=>{for(var o=r>1?void 0:r?Hue(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Wue(t,n,o),o},{LABEL:Kue}=YY,que={icon:({attrs:e})=>`h${(e==null?void 0:e.level)??"1"}`,label:({t:e,attrs:t})=>e({...Kue,values:{level:t==null?void 0:t.level}})},Gue=[G.H1,G.H2,G.H3,G.H4,G.H5,G.H6],bg=class extends to{get name(){return"heading"}createTags(){return[je.Block,je.TextBlock,je.FormattingNode]}createNodeSpec(e,t){return{content:"inline*",defining:!0,draggable:!1,...t,attrs:{...e.defaults(),level:{default:this.options.defaultLevel}},parseDOM:[...this.options.levels.map(n=>({tag:`h${n}`,getAttrs:r=>({...e.parse(r),level:n})})),...t.parseDOM??[]],toDOM:n=>this.options.levels.includes(n.attrs.level)?[`h${n.attrs.level}`,e.dom(n),0]:[`h${this.options.defaultLevel}`,e.dom(n),0]}}toggleHeading(e={}){return gD({type:this.type,toggleType:"paragraph",attrs:e})}createKeymap(e){const t=this.store.getExtension(Fe),n=he(),r=[];for(const o of this.options.levels){const i=Gue[o-1]??G.H1;n[i]=cg(this.type,{level:o}),r.push({attrs:{level:o},shortcut:e(i)[0]})}return t.updateDecorated("toggleHeading",{shortcut:r}),n}createInputRules(){return this.options.levels.map(e=>mJ(new RegExp(`^(#{1,${e}})\\s$`),this.type,()=>({level:e})))}createPasteRules(){return this.options.levels.map(e=>({type:"node",nodeType:this.type,regexp:new RegExp(`^#{${e}}\\s([\\s\\w]+)$`),getAttributes:()=>({level:e}),startOfTextBlock:!0}))}};mL([de(que)],bg.prototype,"toggleHeading",1);bg=mL([Ge({defaultOptions:{levels:[1,2,3,4,5,6],defaultLevel:1},staticKeys:["defaultLevel","levels"]})],bg);var gL={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(typeof self<"u"?self:t4,function(){return function(n){function r(i){if(o[i])return o[i].exports;var s=o[i]={i,l:!1,exports:{}};return n[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}var o={};return r.m=n,r.c=o,r.d=function(i,s,a){r.o(i,s)||Object.defineProperty(i,s,{configurable:!1,enumerable:!0,get:a})},r.n=function(i){var s=i&&i.__esModule?function(){return i.default}:function(){return i};return r.d(s,"a",s),s},r.o=function(i,s){return Object.prototype.hasOwnProperty.call(i,s)},r.p="",r(r.s=0)}([function(n,r,o){function i(){throw new TypeError("The given URL is not a string. Please verify your string|array.")}function s(c){typeof c!="string"&&i();for(var u=0,d=0,f=0,h=c.length,m=0;h--&&++m&&!(u&&-1<a.indexOf(c[m]));)c[m]==="."&&(++u,d=m);for(u=m,m=d;m--;)if(l.indexOf(c[m])!==-1){f=m+1;break}return 2>f?"":c.slice(f,u)}var a=["/",":","?","#"],l=[".","/","@"];n.exports=function(c){if(typeof c=="string")return s(c);if(Array.isArray(c)){var u=[],d,f=0;for(d=c.length;f<d;f++)u.push(s(c[f]));return u}i()}}])})})(gL);var Yue=gL.exports;const Jue=ia(Yue);var Xue=Object.defineProperty,Zue=Object.getOwnPropertyDescriptor,Rp=(e,t,n,r)=>{for(var o=r>1?void 0:r?Zue(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Xue(t,n,o),o},Que=["com","de","net","org","uk","cn","ga","nl","cf","ml","tk","ru","br","gq","xyz","fr","eu","info","co","au","ca","it","in","ch","pl","es","online","us","top","be","jp","biz","se","at","dk","cz","za","me","ir","icu","shop","kr","site","mx","hu","io","cc","club","no","cyou"],wT="updateLink",ede=/(?:(?:(?:https?|ftp):)?\/\/)?(?:\S+(?::\S*)?@)?(?:(?:[\da-z\u00A1-\uFFFF][\w\u00A1-\uFFFF-]{0,62})?[\da-z\u00A1-\uFFFF]\.)*(?:(?:\d(?!\.)|[a-z\u00A1-\uFFFF])(?:[\da-z\u00A1-\uFFFF][\w\u00A1-\uFFFF-]{0,62})?[\da-z\u00A1-\uFFFF]\.)+[a-z\u00A1-\uFFFF]{2,}(?::\d{2,5})?(?:[#/?]\S*)?/gi,fl=class extends Tp{constructor(){super(...arguments);Et(this,"_autoLinkRegexNonGlobal")}get name(){return"link"}createTags(){return[je.Link,je.ExcludeInputRules]}createMarkSpec(t,n){const r="data-link-auto",o=i=>{const{defaultTarget:s,supportedTargets:a}=this.options,l=s?[...a,s]:a;return i&&Do(l,i)?{target:i}:void 0};return{inclusive:!1,excludes:"_",...n,attrs:{...t.defaults(),href:{},target:{default:this.options.defaultTarget},auto:{default:!1}},parseDOM:[{tag:"a[href]",getAttrs:i=>{if(!ri(i))return!1;const s=i.getAttribute("href"),a=i.textContent,l=this.options.autoLink&&(i.hasAttribute(r)||s===a||(s==null?void 0:s.replace(`${this.options.defaultProtocol}//`,""))===a);return{...t.parse(i),href:s,auto:l,...o(i.getAttribute("target"))}}},...n.parseDOM??[]],toDOM:i=>{const{auto:s,target:a,...l}=pD(i.attrs,t),c=i.attrs.auto?{[r]:""}:{};return["a",{...t.dom(i),...l,rel:"noopener noreferrer nofollow",...c,...o(i.attrs.target)},0]}}}onCreate(){const{autoLinkRegex:t}=this.options;this._autoLinkRegexNonGlobal=new RegExp(`^${t.source}$`,t.flags.replace("g",""))}shortcut({tr:t}){let n="",{from:r,to:o,empty:i,$from:s}=t.selection,a=!1;const l=Fi(s,this.type);if(i){const c=l??uD(t);if(!c)return!1;({text:n,from:r,to:o}=c),a=!0}return r===o?!1:(a||(n=t.doc.textBetween(r,o)),this.options.onActivateLink(n),this.options.onShortcut({activeLink:l?{attrs:l.mark.attrs,from:l.from,to:l.to}:void 0,selectedText:n,from:r,to:o}),!0)}updateLink(t,n){return r=>{const{tr:o}=r;return!(gl(o.selection)&&!lS(o.selection)||DZ(o.selection)||lg({trState:o,type:this.type}))&&!n?!1:(o.setMeta(this.name,{command:wT,attrs:t,range:n}),nQ({type:this.type,attrs:t,range:n})(r))}}selectLink(){return this.store.commands.selectMark.original(this.type)}removeLink(t){return n=>{const{tr:r}=n;return lg({trState:r,type:this.type,...t})?yD({type:this.type,expand:!0,range:t})(n):!1}}createPasteRules(){return[{type:"mark",regexp:this.options.autoLinkRegex,markType:this.type,getAttributes:(t,n)=>({href:this.buildHref(zd(t)),auto:!n}),transformMatch:t=>{const n=zd(t);return!n||!this.isValidUrl(n)?!1:n}}]}createEventHandlers(){return{clickMark:(t,n)=>{const r=n.getMark(this.type);if(!r)return;const o=r.mark.attrs,i={...o,...r};if(this.options.onClick(t,i))return!0;if(!this.store.view.editable)return;let s=!1;if(this.options.openLinkOnClick){s=!0;const a=o.href;window.open(a,"_blank")}return this.options.selectTextOnClick&&(s=!0,this.store.commands.selectText(r)),s}}}createPlugin(){return{appendTransaction:(t,n,r)=>{if(t.filter(m=>!!m.getMeta(this.name)).forEach(m=>{const v=m.getMeta(this.name);if(v.command===wT){const{range:x,attrs:b}=v,{selection:w,doc:S}=r,k={range:x,selection:w,doc:S,attrs:b},{from:C,to:T}=x??w;this.options.onUpdateLink(S.textBetween(C,T),k)}}),!this.options.autoLink||Cb(n)-Cb(r)===1||!t.some(m=>m.docChanged))return;const a=kZ(t,n),l=BZ(a,[Ot,Zt]),{mapping:c}=a,{tr:u,doc:d}=r,{updateLink:f,removeLink:h}=this.store.chain(u);if(l.forEach(({prevFrom:m,prevTo:v,from:x,to:b})=>{const w=[],S=b-x===2,k=this.getLinkMarksInRange(n.doc,m,v,!0).filter(C=>C.mark.type===this.type).map(({from:C,to:T,text:_})=>({mappedFrom:c.map(C),mappedTo:c.map(T),text:_,from:C,to:T}));k.forEach(({mappedFrom:C,mappedTo:T,from:_,to:O},M)=>this.getLinkMarksInRange(d,C,T,!0).filter(j=>j.mark.type===this.type).forEach(j=>{const L=n.doc.textBetween(_,O,void 0," "),B=d.textBetween(j.from,j.to+1,void 0," ").trim(),J=this.isValidUrl(L);this.isValidUrl(B)||(J&&(h({from:j.from,to:j.to}).tr(),k.splice(M,1)),!S&&x===b&&this.findAutoLinks(B).map(H=>this.addLinkProperties({...H,from:C+H.start,to:C+H.end})).forEach(({attrs:H,range:R,text:N})=>{f(H,R).tr(),w.push({attrs:H,range:R,text:N})}))})),this.findTextBlocksInRange(d,{from:x,to:b}).forEach(({text:C,positionStart:T})=>{this.findAutoLinks(C).map(_=>this.addLinkProperties({..._,from:T+_.start+1,to:T+_.end+1})).filter(({range:_})=>{const O=x>=_.from&&x<=_.to,M=b>=_.from&&b<=_.to;return O||M||S}).filter(({range:_})=>this.getLinkMarksInRange(u.doc,_.from,_.to,!1).length===0).filter(({range:{from:_},text:O})=>!k.some(({text:M,mappedFrom:j})=>j===_&&M===O)).forEach(({attrs:_,text:O,range:M})=>{f(_,M).tr(),w.push({attrs:_,range:M,text:O})})}),window.requestAnimationFrame(()=>{w.forEach(({attrs:C,range:T,text:_})=>{const{doc:O,selection:M}=u;this.options.onUpdateLink(_,{attrs:C,doc:O,range:T,selection:M})})})}),u.steps.length!==0)return u}}}buildHref(t){return this.options.extractHref({url:t,defaultProtocol:this.options.defaultProtocol})}getLinkMarksInRange(t,n,r,o){const i=[];if(n===r){const s=Math.max(n-1,0),a=t.resolve(s),l=Fi(a,this.type);(l==null?void 0:l.mark.attrs.auto)===o&&i.push(l)}else t.nodesBetween(n,r,(s,a)=>{const c=(s.marks??[]).find(({type:u,attrs:d})=>u===this.type&&d.auto===o);c&&i.push({from:a,to:a+s.nodeSize,mark:c,text:s.textContent})});return i}findTextBlocksInRange(t,n){const r=[];return t.nodesBetween(n.from,n.to,(o,i)=>{!o.isTextblock||!o.type.allowsMarkType(this.type)||r.push({node:o,pos:i})}),r.map(o=>({text:t.textBetween(o.pos,o.pos+o.node.nodeSize,void 0," "),positionStart:o.pos}))}addLinkProperties({from:t,to:n,href:r,...o}){return{...o,range:{from:t,to:n},attrs:{href:r,auto:!0}}}findAutoLinks(t){if(this.options.findAutoLinks)return this.options.findAutoLinks(t,this.options.defaultProtocol);const n=[];for(const r of xv(t,this.options.autoLinkRegex)){const o=zd(r);if(!o)continue;const i=this.buildHref(o);!this.isValidTLD(i)&&!i.startsWith("tel:")||n.push({text:o,href:i,start:r.index,end:r.index+o.length})}return n}isValidUrl(t){var n;return this.options.isValidUrl?this.options.isValidUrl(t,this.options.defaultProtocol):this.isValidTLD(this.buildHref(t))&&!!((n=this._autoLinkRegexNonGlobal)!=null&&n.test(t))}isValidTLD(t){const{autoLinkAllowedTLDs:n}=this.options;if(n.length===0)return!0;const r=Jue(t);if(r==="")return!0;const o=AG(r.split("."));return n.includes(o)}};Rp([Ar({shortcut:G.InsertLink})],fl.prototype,"shortcut",1);Rp([de()],fl.prototype,"updateLink",1);Rp([de()],fl.prototype,"selectLink",1);Rp([de()],fl.prototype,"removeLink",1);fl=Rp([Ge({defaultOptions:{autoLink:!1,defaultProtocol:"",selectTextOnClick:!1,openLinkOnClick:!1,autoLinkRegex:ede,autoLinkAllowedTLDs:Que,findAutoLinks:void 0,isValidUrl:void 0,defaultTarget:null,supportedTargets:[],extractHref:tde},staticKeys:["autoLinkRegex"],handlerKeyOptions:{onClick:{earlyReturnValue:!0}},handlerKeys:["onActivateLink","onShortcut","onUpdateLink","onClick"],defaultPriority:et.Medium})],fl);function tde({url:e,defaultProtocol:t}){const n=/^((?:https?|ftp)?:)\/\//.test(e);return!n&&e.includes("@")?`mailto:${e}`:n?e:`${t}//${e}`}var nde=Object.defineProperty,rde=Object.getOwnPropertyDescriptor,vL=(e,t,n,r)=>{for(var o=r>1?void 0:r?rde(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&nde(t,n,o),o},wg=class extends to{get name(){return"hardBreak"}createTags(){return[je.InlineNode]}createNodeSpec(e,t){return{inline:!0,selectable:!1,atom:!0,leafText:()=>`
368
- `,...t,attrs:e.defaults(),parseDOM:[{tag:"br",getAttrs:e.parse},...t.parseDOM??[]],toDOM:n=>["br",e.dom(n)]}}createKeymap(){const e=SZ(Fd(kD),()=>(this.store.commands.insertHardBreak(),!0));return{"Mod-Enter":e,"Shift-Enter":e}}insertHardBreak(){return e=>{const{tr:t,dispatch:n}=e;return n==null||n(t.replaceSelectionWith(this.type.create()).scrollIntoView()),!0}}};vL([de()],wg.prototype,"insertHardBreak",1);wg=vL([Ge({defaultPriority:et.Low})],wg);const ode=()=>[new dl({}),new qf,new Gf,new Yf({enableResizing:!1}),new Mb({}),new bg({levels:[1,2,3,4,5,6],defaultLevel:1}),new Uf({}),new Wf,new fl({autoLink:!0}),new wg].slice();function ide(e){const{manager:t,state:n,setState:r}=lle({extensions:ode,content:e,selection:"start"});return{manager:t,state:n,setState:r}}function sde({initialContent:e,state:t,manager:n,options:r,onChange:o,onFocus:i,debug:s,autoFocus:a}){const l=r&&Object.entries(r).some(([,f])=>f),[c,u]=g.useState(l),d=g.useMemo(()=>[Ue("p-4 outline-none focus:outline-none appearance-none bg-background rounded-b-md")],[c]);return p.jsx("div",{autoFocus:a,onFocus:()=>{i&&i(!0)},onBlur:()=>{i&&i(!1)},className:Ue("relative text-base m-1 val-rich-text-editor focus-within:outline-none focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 border border-input rounded-md"),children:p.jsxs(ule,{manager:n,initialContent:e,state:t,classNames:d,onChange:o,children:[p.jsx(ade,{hasOptions:l,options:r,debug:s,setShowToolbar:u}),p.jsx(_b,{})]})})}const ade=({options:e,hasOptions:t,debug:n,setShowToolbar:r})=>{var l,c,u,d,f,h,m,v,x,b,w,S,k,C,T,_;const o=i2(),i=Zae(),s=t||i.heading()||i.image()||i.link()||i.bulletList()||i.orderedList()||i.bold()||i.italic()||i.strike();g.useEffect(()=>{r(s)},[s]);const a=g.useRef(null);return p.jsxs("div",{children:[p.jsx("div",{className:"h-0",ref:a}),p.jsxs("div",{className:Ue("sticky top-0 flex flex-col py-2 z-[40] divide-y rounded-md rounded-b-none border-b border-input bg-primary-foreground",{hidden:!s}),children:[p.jsx("div",{className:"flex items-center justify-between",children:p.jsxs("div",{className:"flex flex-row items-center justify-start px-4 py-1 gap-x-3",children:[(((l=e==null?void 0:e.block)==null?void 0:l.h1)||((c=e==null?void 0:e.block)==null?void 0:c.h2)||((u=e==null?void 0:e.block)==null?void 0:u.h3)||((d=e==null?void 0:e.block)==null?void 0:d.h4)||((f=e==null?void 0:e.block)==null?void 0:f.h5)||((h=e==null?void 0:e.block)==null?void 0:h.h6)||i.heading())&&p.jsxs(sue,{children:[p.jsx(aue,{asChild:!0,className:"pr-4",children:p.jsxs("button",{children:[i.heading({level:1})&&p.jsx(OC,{size:22}),i.heading({level:2})&&p.jsx(NC,{size:22}),i.heading({level:3})&&p.jsx(MC,{size:22}),i.heading({level:4})&&p.jsx(PC,{size:22}),i.heading({level:5})&&p.jsx(RC,{size:22}),i.heading({level:6})&&p.jsx(jC,{size:22}),!i.heading()&&"Normal"]})}),p.jsxs(pL,{container:a.current,children:[p.jsx(cs,{onClick:()=>{o.setBlockNodeType("paragraph").focus().run()},children:"Normal"}),((m=e==null?void 0:e.block)==null?void 0:m.h1)&&p.jsx(cs,{onClick:()=>{o.setBlockNodeType("heading",{level:1}).focus().run()},children:p.jsx(OC,{size:16})}),((v=e==null?void 0:e.block)==null?void 0:v.h2)&&p.jsx(cs,{onClick:()=>{o.setBlockNodeType("heading",{level:2}).focus().run()},children:p.jsx(NC,{size:16})}),((x=e==null?void 0:e.block)==null?void 0:x.h3)&&p.jsx(cs,{onClick:()=>{o.setBlockNodeType("heading",{level:3}).focus().run()},children:p.jsx(MC,{size:16})}),((b=e==null?void 0:e.block)==null?void 0:b.h4)&&p.jsx(cs,{onClick:()=>{o.setBlockNodeType("heading",{level:4}).focus().run()},children:p.jsx(PC,{size:16})}),((w=e==null?void 0:e.block)==null?void 0:w.h5)&&p.jsx(cs,{onClick:()=>{o.setBlockNodeType("heading",{level:5}).focus().run()},children:p.jsx(RC,{size:16})}),((S=e==null?void 0:e.block)==null?void 0:S.h6)&&p.jsx(cs,{onClick:()=>{o.setBlockNodeType("heading",{level:6}).focus().run()},children:p.jsx(jC,{size:16})})]})]}),p.jsx(Al,{icon:p.jsx(w8,{size:18}),stroke:3,isOption:(k=e==null?void 0:e.style)==null?void 0:k.bold,isActive:i.bold(),onToggle:()=>o.toggleBold().focus().run()}),p.jsx(Al,{icon:p.jsx(L8,{size:18}),stroke:3,isOption:(C=e==null?void 0:e.style)==null?void 0:C.lineThrough,isActive:i.strike(),onToggle:()=>o.toggleStrike().focus().run()}),p.jsx(Al,{icon:p.jsx(N8,{size:18}),stroke:3,isOption:(T=e==null?void 0:e.style)==null?void 0:T.italic,isActive:i.italic(),onToggle:()=>o.toggleItalic().focus().run()}),p.jsx(Al,{icon:p.jsx(R8,{size:18}),stroke:3,isActive:i.bulletList(),onToggle:()=>o.toggleBulletList().focus().run()}),p.jsx(Al,{icon:p.jsx(P8,{size:18}),stroke:3,isActive:i.orderedList(),onToggle:()=>o.toggleOrderedList().focus().run()}),p.jsx(Al,{icon:p.jsx(M8,{size:18}),stroke:3,isActive:i.link(),onToggle:()=>o.selectMark("link").updateLink({href:""}).focus().run()}),(((_=e==null?void 0:e.inline)==null?void 0:_.img)||i.image())&&p.jsxs("label",{className:"cursor-pointer",htmlFor:"val-toolbar-image-select",children:[p.jsx("input",{hidden:!0,id:"val-toolbar-image-select",accept:"image/*",type:"file",onChange:O=>{xA(O).then(M=>{o.insertImage({src:M.src,width:M.width,height:M.height,fileName:ue.createFilename(M.src,M.filename??null,{width:M.width,height:M.height,mimeType:M.mimeType},M.sha256)??void 0}).focus().run()})}}),p.jsx(O8,{size:18,className:`${i.image()&&"stroke-[3px]"}`})]}),n&&p.jsx("button",{onMouseDown:O=>O.preventDefault(),onClick:()=>o.insertHardBreak().run(),children:"Br"})]})}),p.jsx(lde,{})]})]})};function lde(){const e=i2(),[t,n]=g.useState(),r=Qae().link();return g.useEffect(()=>{const i=typeof r=="object"&&"href"in r&&typeof r.href=="string"?r.href:void 0;n(i)},[r==null?void 0:r.href]),r!==void 0?p.jsxs("div",{className:"flex items-center justify-start px-4 pt-1 gap-x-2",children:[p.jsx("input",{className:"bg-transparent text-accent",onChange:i=>{n(i.target.value)},defaultValue:t,placeholder:"https://"}),p.jsx("button",{className:"p-2",title:"Update",disabled:t===void 0,onClick:()=>{t!==void 0&&e.selectMark("link").updateLink({href:t}).focus().run()},children:p.jsx(ap,{size:14})}),p.jsx("button",{className:"p-2",title:"Remove",onClick:()=>{e.removeLink().focus().run()},children:p.jsx($8,{size:13})})]}):null}function Al({stroke:e,isActive:t,onToggle:n,icon:r}){return p.jsx("button",{className:Ue({"text-accent":t,"stroke-[2px]":t&&e===2,"stroke-[3px]":t&&e===3}),onClick:o=>{o.preventDefault(),n()},children:r})}function cde({path:e,autoFocus:t}){const n="richtext",r=sp(),o=kt(e),i=Je(e,n),s="data"in i?i.data:void 0,{state:a,manager:l}=ide(s&&j9(s)),{patchPath:c,addDebouncedPatch:u}=vn(e);if(o.status==="error")return p.jsx(Rt,{path:e,error:o.error,type:n});if(i.status==="error")return p.jsx(Ke,{path:e,error:i.error,type:n});if(i.status=="not-found"||o.status==="not-found")return p.jsx(gn,{path:e,type:n});if(o.status==="loading")return p.jsx(nt,{path:e,type:n});if(!("data"in i)||i.data===void 0)return p.jsx(nt,{path:e,type:n});if(o.data.type!==n)return p.jsx(dr,{path:e,expectedType:n,actualType:o.data.type});const d=o.data;return p.jsxs("div",{children:[p.jsx(Mr,{path:e}),p.jsx(sde,{autoFocus:t,initialContent:a,options:d.options,manager:l,onChange:f=>{f.state.doc.eq(a.doc)||u(()=>{var h;return ude(c,((h=r==null?void 0:r.files)==null?void 0:h.directory)??"/public/val",f.state.doc.toJSON())},e)}})]})}function ude(e,t,n){const{blocks:r,files:o}=n?S9(n,t):{blocks:[],files:{}};return[{op:"replace",path:e,value:r},...Object.entries(o).flatMap(([i,{value:s,patchPaths:a}])=>a.map(l=>({op:"file",path:e,filePath:i,value:s,nestedFilePath:l})))]}function dde({path:e}){const t=Je(e,"richtext");if(t.status==="error")return p.jsx(Ke,{path:e,error:t.error,type:"richtext"});if(t.status=="not-found")return p.jsx(gn,{path:e,type:"richtext"});if(!("data"in t)||t.data===void 0)return p.jsx(sr,{path:e});if(t.data===null)return p.jsx(ar,{path:e});const n=fde(t.data);return n.status==="error"?p.jsx(Ke,{path:e,error:n.error,type:"richtext"}):p.jsx("div",{className:"truncate",children:n.value})}function fde(e){let t;function n(o){if(t)return t;if(typeof o=="string")return o;if(typeof o=="object"&&o){if("children"in o&&Array.isArray(o.children))return o.children.map(n).join(" ");if("tag"in o&&typeof o.tag=="string")return""}return t="Invalid richtext node: "+JSON.stringify(o),JSON.stringify(o)}const r=e.map(n).join(" ");return t?{status:"error",error:t}:{status:"ok",value:r}}function FS({path:e}){const t=kt(e),n=Je(e,"data"in t&&t.data.type?t.data.type:void 0);if(!("data"in t)||t.data===void 0)return p.jsx(sr,{path:e});const r=t.data.type;if("data"in n&&n.data===null)return p.jsx(ar,{path:e});if(r==="string")return p.jsx(h7,{path:e});if(r==="array")return p.jsx(vde,{path:e});if(r==="boolean")return p.jsx(v7,{path:e});if(r==="number")return p.jsx(x7,{path:e});if(r==="union")return p.jsx(jq,{path:e});if(r==="object")return p.jsx(Oq,{path:e});if(r==="image")return p.jsx($q,{path:e});if(r==="keyOf")return p.jsx(Uq,{path:e});if(r==="date")return p.jsx(Hq,{path:e});if(r==="literal")return p.jsx(Kq,{path:e});if(r==="record")return p.jsx(Gq,{path:e});if(r==="richtext")return p.jsx(dde,{path:e});if(r==="file")return p.jsx(Fq,{path:e});{const o=r;return p.jsxs("div",{children:["Cannot preview: ",o]})}}function sr({path:e}){return p.jsx("div",{children:"Loading..."},e+"-loading")}function ar({path:e}){return p.jsx("div",{className:"text-text-quartenary",children:"null"},e+"-null")}function pde({source:e,path:t,schema:n,onClick:r,onMove:o,onDelete:i}){const[s,a]=g.useState([]);g.useEffect(()=>{const u=[];let d=1;for(const f of e)u.push({path:f,id:d}),d++;a(u)},[e,t]);const l=BW(iE(v1),iE(m1,{coordinateGetter:f7})),c=g.useCallback(u=>{const{active:d,over:f}=u;if((d==null?void 0:d.id)!==(f==null?void 0:f.id)){const h=s.findIndex(v=>v.id===Number(d==null?void 0:d.id)),m=s.findIndex(v=>v.id===Number(f==null?void 0:f.id));a(v=>y1(v,h,m)),o(h,m)}},[s]);return p.jsx(UH,{sensors:l,collisionDetection:UW,onDragEnd:c,children:p.jsx(n7,{items:s,strategy:e7,children:p.jsx("div",{className:"grid grid-cols-[min-content,min-content,1fr,min-content] gap-4",children:s.map(({path:u,id:d})=>p.jsx(hde,{id:d,schema:n,path:u,onClick:r,onDelete:f=>{i(f-1)}},d))})})})}const ST=170;function hde({id:e,path:t,schema:n,disabled:r,onClick:o,onDelete:i}){var v,x;const s=g.useRef(null),[a,l]=g.useState(!1);g.useEffect(()=>{s.current&&(s.current.getBoundingClientRect().height>=ST?l(!0):l(!1))},[e,t]);const{attributes:c,listeners:u,setNodeRef:d,transform:f,transition:h}=c7({id:e,disabled:r===!0}),m={transform:Cf.Transform.toString(f),transition:h};return p.jsxs("div",{ref:d,style:m,className:"grid items-start col-span-4 gap-4 grid-cols-subgrid disabled:opacity-55",children:[p.jsx("button",{...c,...u,className:Ue("pt-2 m-1",{"opacity-30":r}),disabled:r,onClick:()=>{o(t)},children:p.jsx(T8,{})}),p.jsx("button",{className:"pt-2 m-1 font-serif text-accent",disabled:r,onClick:()=>{o(t)},children:mde(e)}),((v=n==null?void 0:n.item)==null?void 0:v.type)==="string"&&p.jsx(rj,{path:t}),((x=n==null?void 0:n.item)==null?void 0:x.type)!=="string"&&p.jsxs("button",{className:"relative grid p-4 overflow-hidden text-left border rounded border-border bg-card gap-y-2 grid-cols-subgrid cols-span-1",style:{maxHeight:ST},ref:s,disabled:r,onClick:()=>{o(t)},children:[p.jsx(FS,{path:t}),a&&p.jsx("div",{className:"absolute bottom-0 left-0 w-full bg-gradient-to-b via-50% from-transparent via-card/90 to-card",style:{height:40}})]}),p.jsx("button",{className:"pt-4",onClick:()=>{i(e)},children:p.jsx(z8,{className:"w-4 h-4 mr-2"})})]})}function mde(e){return"#"+e.toString()}function gde({path:e}){const t="array",{navigate:n}=Zr(),r=kt(e),o=Je(e,t),{addPatch:i,patchPath:s}=vn(e);if(r.status==="error")return p.jsx(Rt,{path:e,error:r.error,type:t});if(o.status==="error")return p.jsx(Ke,{path:e,error:o.error,type:t});if(o.status=="not-found"||r.status==="not-found")return p.jsx(gn,{path:e,type:t});if(r.status==="loading")return p.jsx(nt,{path:e,type:t});if(r.data.type!=="array")return p.jsx(dr,{path:e,expectedType:"array",actualType:r.data.type});const a=r.data;return p.jsxs("div",{children:[p.jsx(Mr,{path:e}),p.jsx(pde,{path:e,onClick:l=>{n(l)},onDelete:async l=>{i([{op:"remove",path:s.concat(l.toString())}])},onMove:async(l,c)=>{i([{op:"move",from:s.concat(l.toString()),path:s.concat(c.toString())}])},schema:a,source:o.data||[]})]})}function vde({path:e}){const t=Je(e,"array");return t.status==="error"?p.jsx(Ke,{path:e,error:t.error,type:"array"}):!("data"in t)||t.data===void 0?p.jsx(sr,{path:e}):t.data===null?p.jsx(ar,{path:e}):p.jsx("div",{children:`${t.data.length} items`})}function zv({path:e,schema:t,autoFocus:n}){if(t.type==="string")return p.jsx(rj,{path:e,autoFocus:n},e);if(t.type==="number")return p.jsx(y7,{path:e},e);if(t.type==="boolean")return p.jsx(m7,{path:e},e);if(t.type==="image")return p.jsx(zq,{path:e},e);if(t.type==="object")return p.jsx(Tq,{path:e},e);if(t.type==="array")return p.jsx(gde,{path:e},e);if(t.type==="record")return p.jsx(qq,{path:e},e);if(t.type==="union")return p.jsx(Mq,{path:e},e);if(t.type==="keyOf")return p.jsx(Bq,{path:e},e);if(t.type==="richtext")return p.jsx(cde,{path:e,autoFocus:n},e);if(t.type==="date")return p.jsx(Wq,{path:e},e);if(t.type==="file")return p.jsx(Lq,{path:e},e);if(t.type==="literal")return p.jsx(Rt,{path:e,error:"Literal fields are not editable"});{const r=t;return p.jsx(Rt,{path:e,error:"Unexpected field schema: "+JSON.stringify(r)})}}function yde({path:e}){const t=kt(e),{path:n,schema:r}=pA(e),{navigate:o}=Zr();if(t.status==="error")return p.jsx(Rt,{path:e,error:t.error,type:"module"});if(t.status==="loading")return p.jsx(nt,{path:e,type:"module"});if(t.status==="not-found")return p.jsx(gn,{path:e,type:"module"});const i=t.data,s=mA(e),a=s.slice(0,-1),l=s[s.length-1],c=bq(e,n,r);return p.jsxs("div",{className:"flex flex-col gap-6 py-10",children:[p.jsxs("div",{className:"flex flex-col gap-2 text-left",children:[s.length>1&&p.jsx("div",{className:"inline-flex items-center text-sm text-text-quartenary",children:a.map((u,d)=>d<a.length-1?p.jsxs(g.Fragment,{children:[p.jsx("button",{onClick:()=>{o(u.sourcePath)},children:u.text}),p.jsx("span",{children:p.jsx(tu,{size:16})})]},d):p.jsx("button",{onClick:()=>{o(u.sourcePath)},children:u.text},d))}),p.jsx("div",{children:p.jsxs("div",{className:"flex items-center justify-between h-12 gap-4 text-xl",children:[!c&&p.jsx("span",{children:l.text}),c&&p.jsxs("span",{children:["#",Number(l.text)+1]}),p.jsx(hA,{path:e,variant:"module"})]})})]}),p.jsx(zv,{path:e,schema:i},e)]})}function xde(){return p.jsx(qg,{viewportId:"val-content-area",children:p.jsxs("div",{className:"max-h-[100svh] pt-20 xl:pt-0 max-w-[800px] mx-auto",children:[p.jsx(bde,{}),p.jsx(wde,{})]})})}function bde(){return p.jsx("div",{className:"sticky top-0 text-text-primary z-[2] pt-4 hidden xl:block",children:p.jsxs("div",{className:"grid grid-cols-[min-content,1fr,min-content] items-center xl:w-[calc(100%-16px)] ml-2 h-16 p-4 bg-bg-tertiary rounded-3xl",children:[p.jsx(UM,{size:22}),p.jsx("input",{className:"w-full h-full px-4 text-lg bg-transparent text-text-primary focus:outline-none",onClick:()=>{}}),p.jsx("div",{children:"⌘K"})]})})}function wde(){const{currentSourcePath:e}=Zr(),t=e;return p.jsx(yde,{path:t})}function Sde(){const e=ua();return p.jsx(NR,{open:!0,modal:!0,children:p.jsxs(c1,{container:e,"aria-label":"Login required",children:[p.jsx(PR,{children:p.jsx(a1,{children:p.jsx("span",{children:"Log in required"})})}),p.jsx(RR,{children:"You need to log in to access Val."}),p.jsx(Tr,{asChild:!0,children:p.jsx("a",{href:wf("/api/val/authorize",{redirect_to:window.origin+wf("/val")}),children:"Log in"})})]})})}function kde(){const e=AM(),[t,n]=g.useState(!1),[r,o]=g.useState(!0),[i,s]=g.useState(!1),{currentSourcePath:a}=Zr();return g.useEffect(()=>{!t&&a&&(n(!0),o(!1))},[t,a]),IM()==="login-required"?p.jsx("div",{className:"min-h-screen bg-bg-primary",children:p.jsx(Sde,{})}):p.jsxs("main",{className:Ue("font-sans bg-bg-primary text-text-primary min-h-screen"),...e?{"data-mode":e}:{},children:[p.jsx("div",{className:"fixed top-0 left-0 ml-auto w-[320px] z-[5]",children:p.jsx(qV,{isOpen:r,setOpen:c=>{o(c),s(!1)}})}),p.jsx("div",{className:"w-[calc(100%-16px*2)] mx-auto xl:w-[calc(100%-320px*2-32px*2)] min-h-screen",children:p.jsx(xde,{})}),p.jsx("div",{className:"fixed top-0 right-0 mr-auto w-[320px] z-[5]",children:p.jsx(EW,{isOpen:i,setOpen:c=>{s(c),o(!1)}})})]})}const Cde=({client:e})=>p.jsx(jM,{client:e,dispatchValEvents:!1,children:p.jsx(kde,{})}),Ede=g.createContext(null),px={didCatch:!1,error:null};class yL extends g.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=px}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];(n=(r=this.props).onReset)===null||n===void 0||n.call(r,{args:i,reason:"imperative-api"}),this.setState(px)}}componentDidCatch(t,n){var r,o;(r=(o=this.props).onError)===null||r===void 0||r.call(o,t,n)}componentDidUpdate(t,n){const{didCatch:r}=this.state,{resetKeys:o}=this.props;if(r&&n.error!==null&&_de(t.resetKeys,o)){var i,s;(i=(s=this.props).onReset)===null||i===void 0||i.call(s,{next:o,prev:t.resetKeys,reason:"keys"}),this.setState(px)}}render(){const{children:t,fallbackRender:n,FallbackComponent:r,fallback:o}=this.props,{didCatch:i,error:s}=this.state;let a=t;if(i){const l={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")a=n(l);else if(r)a=g.createElement(r,l);else if(o!==void 0)a=o;else throw s}return g.createElement(Ede.Provider,{value:{didCatch:i,error:s,resetErrorBoundary:this.resetErrorBoundary}},a)}}function _de(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}var zS="Collapsible",[Tde,xL]=Bi(zS),[Ode,$S]=Tde(zS),bL=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:i,onOpenChange:s,...a}=e,[l=!1,c]=Qo({prop:r,defaultProp:o,onChange:s});return p.jsx(Ode,{scope:n,disabled:i,contentId:Hr(),open:l,onOpenToggle:g.useCallback(()=>c(u=>!u),[c]),children:p.jsx(Ee.div,{"data-state":VS(l),"data-disabled":i?"":void 0,...a,ref:t})})});bL.displayName=zS;var wL="CollapsibleTrigger",SL=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=$S(wL,n);return p.jsx(Ee.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":VS(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:re(e.onClick,o.onOpenToggle)})});SL.displayName=wL;var BS="CollapsibleContent",kL=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=$S(BS,e.__scopeCollapsible);return p.jsx(Mn,{present:n||o.open,children:({present:i})=>p.jsx(Nde,{...r,ref:t,present:i})})});kL.displayName=BS;var Nde=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...i}=e,s=$S(BS,n),[a,l]=g.useState(r),c=g.useRef(null),u=Ie(t,c),d=g.useRef(0),f=d.current,h=g.useRef(0),m=h.current,v=s.open||a,x=g.useRef(v),b=g.useRef();return g.useEffect(()=>{const w=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(w)},[]),mn(()=>{const w=c.current;if(w){b.current=b.current||{transitionDuration:w.style.transitionDuration,animationName:w.style.animationName},w.style.transitionDuration="0s",w.style.animationName="none";const S=w.getBoundingClientRect();d.current=S.height,h.current=S.width,x.current||(w.style.transitionDuration=b.current.transitionDuration,w.style.animationName=b.current.animationName),l(r)}},[s.open,r]),p.jsx(Ee.div,{"data-state":VS(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!v,...i,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:v&&o})});function VS(e){return e?"open":"closed"}var Mde=bL,Pde=SL,Rde=kL,Wi="Accordion",jde=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[US,Ade,Ide]=nv(Wi),[$v,hfe]=Bi(Wi,[Ide,xL]),WS=xL(),CL=ge.forwardRef((e,t)=>{const{type:n,...r}=e,o=r,i=r;return p.jsx(US.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?p.jsx(zde,{...i,ref:t}):p.jsx(Fde,{...o,ref:t})})});CL.displayName=Wi;var[EL,Dde]=$v(Wi),[_L,Lde]=$v(Wi,{collapsible:!1}),Fde=ge.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},collapsible:i=!1,...s}=e,[a,l]=Qo({prop:n,defaultProp:r,onChange:o});return p.jsx(EL,{scope:e.__scopeAccordion,value:a?[a]:[],onItemOpen:l,onItemClose:ge.useCallback(()=>i&&l(""),[i,l]),children:p.jsx(_L,{scope:e.__scopeAccordion,collapsible:i,children:p.jsx(TL,{...s,ref:t})})})}),zde=ge.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...i}=e,[s=[],a]=Qo({prop:n,defaultProp:r,onChange:o}),l=ge.useCallback(u=>a((d=[])=>[...d,u]),[a]),c=ge.useCallback(u=>a((d=[])=>d.filter(f=>f!==u)),[a]);return p.jsx(EL,{scope:e.__scopeAccordion,value:s,onItemOpen:l,onItemClose:c,children:p.jsx(_L,{scope:e.__scopeAccordion,collapsible:!0,children:p.jsx(TL,{...i,ref:t})})})}),[$de,Bv]=$v(Wi),TL=ge.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:o,orientation:i="vertical",...s}=e,a=ge.useRef(null),l=Ie(a,t),c=Ade(n),d=cp(o)==="ltr",f=re(e.onKeyDown,h=>{var O;if(!jde.includes(h.key))return;const m=h.target,v=c().filter(M=>{var j;return!((j=M.ref.current)!=null&&j.disabled)}),x=v.findIndex(M=>M.ref.current===m),b=v.length;if(x===-1)return;h.preventDefault();let w=x;const S=0,k=b-1,C=()=>{w=x+1,w>k&&(w=S)},T=()=>{w=x-1,w<S&&(w=k)};switch(h.key){case"Home":w=S;break;case"End":w=k;break;case"ArrowRight":i==="horizontal"&&(d?C():T());break;case"ArrowDown":i==="vertical"&&C();break;case"ArrowLeft":i==="horizontal"&&(d?T():C());break;case"ArrowUp":i==="vertical"&&T();break}const _=w%b;(O=v[_].ref.current)==null||O.focus()});return p.jsx($de,{scope:n,disabled:r,direction:o,orientation:i,children:p.jsx(US.Slot,{scope:n,children:p.jsx(Ee.div,{...s,"data-orientation":i,ref:l,onKeyDown:r?void 0:f})})})}),Sg="AccordionItem",[Bde,HS]=$v(Sg),OL=ge.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...o}=e,i=Bv(Sg,n),s=Dde(Sg,n),a=WS(n),l=Hr(),c=r&&s.value.includes(r)||!1,u=i.disabled||e.disabled;return p.jsx(Bde,{scope:n,open:c,disabled:u,triggerId:l,children:p.jsx(Mde,{"data-orientation":i.orientation,"data-state":AL(c),...a,...o,ref:t,disabled:u,open:c,onOpenChange:d=>{d?s.onItemOpen(r):s.onItemClose(r)}})})});OL.displayName=Sg;var NL="AccordionHeader",ML=ge.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=Bv(Wi,n),i=HS(NL,n);return p.jsx(Ee.h3,{"data-orientation":o.orientation,"data-state":AL(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});ML.displayName=NL;var Pb="AccordionTrigger",PL=ge.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=Bv(Wi,n),i=HS(Pb,n),s=Lde(Pb,n),a=WS(n);return p.jsx(US.ItemSlot,{scope:n,children:p.jsx(Pde,{"aria-disabled":i.open&&!s.collapsible||void 0,"data-orientation":o.orientation,id:i.triggerId,...a,...r,ref:t})})});PL.displayName=Pb;var RL="AccordionContent",jL=ge.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=Bv(Wi,n),i=HS(RL,n),s=WS(n);return p.jsx(Rde,{role:"region","aria-labelledby":i.triggerId,"data-orientation":o.orientation,...s,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});jL.displayName=RL;function AL(e){return e?"open":"closed"}var Vde=CL,Ude=OL,Wde=ML,IL=PL,DL=jL;const Hde=Vde,LL=g.forwardRef(({className:e,...t},n)=>p.jsx(Ude,{ref:n,className:qe("border-b",e),...t}));LL.displayName="AccordionItem";const FL=g.forwardRef(({className:e,children:t,...n},r)=>p.jsx(Wde,{className:"flex",children:p.jsxs(IL,{ref:r,className:qe("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,p.jsx(lp,{className:"w-4 h-4 transition-transform duration-200 shrink-0"})]})}));FL.displayName=IL.displayName;const zL=g.forwardRef(({className:e,children:t,...n},r)=>p.jsx(DL,{ref:r,className:qe("overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",e),...n,children:p.jsx("div",{className:"pt-0 pb-4",children:t})}));zL.displayName=DL.displayName;const Kde=({className:e})=>p.jsxs("svg",{width:"58",height:"34",viewBox:"0 0 58 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[p.jsx("g",{filter:"url(#filter0_d_21_1677)",children:p.jsx("path",{d:"M5 5.36426C5 5.16309 5.16309 5 5.36426 5H17.6581C17.8593 5 18.0223 5.16309 18.0223 5.36426V28.4949C18.0223 28.696 17.8593 28.8591 17.6581 28.8591H5.36426C5.16309 28.8591 5 28.696 5 28.4949V5.36426Z",fill:"hsl(var(--accent))"})}),p.jsx("g",{filter:"url(#filter1_i_21_1677)",children:p.jsx("circle",{cx:"11.4656",cy:"23.7595",r:"2.18557",fill:"currentColor"})}),p.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M52.8588 23.839H48.7257H48.537H48.1128C47.6715 23.839 47.4508 23.5942 47.4508 23.1044V13.7293C47.4508 13.5784 47.3285 13.4561 47.1777 13.4561H45.8118C45.6609 13.4561 45.5386 13.5784 45.5386 13.7293V15.1836C45.5386 15.2844 45.4569 15.3661 45.3561 15.3661C45.2876 15.3661 45.225 15.3275 45.1924 15.2672C44.805 14.5503 44.283 14.02 43.6264 13.6765C42.9563 13.301 42.2045 13.1132 41.3709 13.1132C40.6028 13.1132 39.8755 13.252 39.189 13.5295C38.5026 13.8071 37.8979 14.2152 37.3748 14.7539C36.8682 15.2764 36.4678 15.9212 36.1736 16.6885C35.8794 17.4558 35.7323 18.3374 35.7323 19.3332V19.725C35.7323 20.7372 35.8794 21.627 36.1736 22.3942C36.4678 23.1615 36.8682 23.8146 37.3748 24.3533C37.8979 24.8757 38.5026 25.2757 39.189 25.5532C39.8755 25.8144 40.6191 25.945 41.42 25.945C42.1881 25.945 42.9154 25.7491 43.6019 25.3573C44.2751 24.982 44.8058 24.4119 45.1941 23.6471C45.2255 23.5852 45.2886 23.5452 45.358 23.5452H45.3917C45.4728 23.5452 45.5386 23.611 45.5386 23.6921C45.5386 23.7904 45.544 23.8856 45.5547 23.9777V25.1392C45.5547 25.3904 45.7584 25.5941 46.0096 25.5941H47.2261C47.2914 25.5995 47.3581 25.6022 47.4263 25.6022H48.537H48.7257H57.7268C57.8777 25.6022 58 25.4799 58 25.329V24.1122C58 23.9614 57.8777 23.839 57.7268 23.839H55.3174C55.1665 23.839 55.0442 23.7167 55.0442 23.5659V8.73368C55.0442 8.58279 54.9219 8.46048 54.771 8.46048H50.5054C50.3545 8.46048 50.2322 8.58279 50.2322 8.73368V9.95043C50.2322 10.1013 50.3545 10.2236 50.5054 10.2236H52.8588C53.0097 10.2236 53.132 10.3459 53.132 10.4968V23.5659C53.132 23.7167 53.0097 23.839 52.8588 23.839ZM41.6161 24.1329C42.1881 24.1329 42.7111 24.0268 43.1851 23.8146C43.6754 23.6023 44.0922 23.3003 44.4354 22.9085C44.7786 22.5167 45.0483 22.0514 45.2444 21.5127C45.4406 20.9576 45.5386 20.3454 45.5386 19.6761V19.3822C45.5386 18.7292 45.4406 18.1333 45.2444 17.5946C45.0483 17.0395 44.7705 16.5661 44.4109 16.1743C44.0677 15.7824 43.6509 15.4804 43.1606 15.2682C42.6866 15.0396 42.1718 14.9254 41.6161 14.9254C41.044 14.9254 40.521 15.0315 40.0471 15.2437C39.5731 15.4559 39.1563 15.758 38.7968 16.1498C38.4535 16.5252 38.1839 16.9905 37.9877 17.5456C37.7916 18.0843 37.6936 18.6802 37.6936 19.3332V19.725C37.6936 21.1127 38.0531 22.1983 38.7722 22.982C39.5077 23.7493 40.4557 24.1329 41.6161 24.1329ZM31.1115 25.4191C31.0732 25.5287 30.9698 25.6022 30.8536 25.6022H27.4661C27.35 25.6022 27.2465 25.5287 27.2082 25.4191L23.1578 13.8193C23.0958 13.6417 23.2276 13.4561 23.4157 13.4561H25.089C25.2068 13.4561 25.3114 13.5316 25.3484 13.6435L28.9666 24.581C28.9942 24.6643 29.0721 24.7206 29.1599 24.7206C29.2477 24.7206 29.3256 24.6643 29.3532 24.581L32.9714 13.6435C33.0084 13.5316 33.1129 13.4561 33.2308 13.4561H34.9041C35.0922 13.4561 35.224 13.6417 35.162 13.8193L31.1115 25.4191Z",fill:"currentColor"}),p.jsxs("defs",{children:[p.jsxs("filter",{id:"filter0_d_21_1677",x:"0.124722",y:"0.124722",width:"22.7729",height:"33.6097",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[p.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),p.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),p.jsx("feOffset",{}),p.jsx("feGaussianBlur",{stdDeviation:"2.43764"}),p.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),p.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.219608 0 0 0 0 0.803922 0 0 0 0 0.501961 0 0 0 0.3 0"}),p.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_21_1677"}),p.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_21_1677",result:"shape"})]}),p.jsxs("filter",{id:"filter1_i_21_1677",x:"9.28003",y:"21.5739",width:"4.37112",height:"4.37112",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[p.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),p.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),p.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),p.jsx("feOffset",{}),p.jsx("feGaussianBlur",{stdDeviation:"0.546392"}),p.jsx("feComposite",{in2:"hardAlpha",operator:"arithmetic",k2:"-1",k3:"1"}),p.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.219608 0 0 0 0 0.803922 0 0 0 0 0.501961 0 0 0 0.3 0"}),p.jsx("feBlend",{mode:"normal",in2:"shape",result:"effect1_innerShadow_21_1677"})]})]})]});function $L({error:e,resetErrorBoundary:t}){return console.error(e),p.jsx("div",{className:"absolute top-0 left-0 flex items-center justify-center w-screen h-screen bg-bg-primary text-text-primary",children:p.jsx("div",{className:"w-full h-full p-10",children:p.jsxs("div",{className:"w-full h-full p-10 overflow-scroll bg-card text-primary",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-[0.5em] text-lg font-bold text-center py-2",children:[p.jsx(Kde,{})," encountered an error"]}),p.jsx("button",{onClick:t,children:p.jsx(Ug,{})})]}),p.jsx("div",{className:"text-4xl font-normal ",children:"Message:"}),p.jsx("pre",{children:e.message}),e.stack&&p.jsx(Hde,{type:"single",className:"font-serif",collapsible:!0,defaultValue:"error",children:p.jsxs(LL,{value:"error",children:[p.jsx(FL,{children:"Stack trace:"}),p.jsx(zL,{className:"p-4 bg-bg-secondary",children:e.stack&&p.jsx("pre",{children:e.stack})})]})})]})})})}function qde({root:e,children:t}){return Yn.createPortal(t,e)}const BL=({children:e,style:t})=>{const n=g.useRef(null),[r,o]=g.useState(null);return g.useLayoutEffect(()=>{if(n.current)if(n.current.shadowRoot)o(n.current.shadowRoot);else{const i=n.current.attachShadow({mode:"open"});o(i)}},[]),p.jsx("div",{ref:n,style:t,id:"val-shadow-root",children:r&&p.jsx(qde,{root:r,children:e})})},VL="/spa/index.css",Gde="val-app",Yde="val-overlay";function UL(){return p.jsxs(p.Fragment,{children:[p.jsx("link",{rel:"preconnect",href:"https://fonts.googleapis.com"}),p.jsx("link",{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"use-credentials"}),p.jsx("link",{href:"https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=Space+Grotesk:wght@300..700&display=swap",rel:"stylesheet"})]})}function Jde(){const{client:e}=g.useMemo(()=>({client:QP("/api/val")}),[]);return p.jsxs(p.Fragment,{children:[p.jsx(UL,{}),p.jsxs(BL,{children:[p.jsx("link",{rel:"stylesheet",href:`/api/val/static${VL}`}),p.jsx(yL,{fallbackRender:$L,children:p.jsx(qM,{children:p.jsx(Cde,{client:e})})})]})]})}function Xde({path:e,disabled:t}){const[n,r]=ue.splitModuleFilePathAndModulePath(e),o=n.split("/"),i=ue.splitModulePath(r),{navigate:s}=Zr();return p.jsxs("div",{title:e,className:"w-full",children:[p.jsx("button",{type:"button",disabled:t,className:"inline-block text-left truncate",onClick:()=>{s(n)},children:o.map((a,l)=>p.jsxs(g.Fragment,{children:[l===0&&p.jsx("span",{className:"text-muted",children:"/"}),p.jsx("span",{className:Ue({"text-muted":!(i.length===0&&l===o.length-1)}),children:Ic(a)}),l>0&&l<o.length-1&&p.jsx("span",{className:"text-muted",children:"/"})]},`${a}-${l}`))}),p.jsx("button",{type:"button",disabled:t,className:"inline-block text-left truncate",onClick:()=>{s(ue.joinModuleFilePathAndModulePath(n,r))},children:i.map((a,l)=>p.jsxs(g.Fragment,{children:[p.jsx("span",{className:"text-muted",children:"/"}),p.jsx("span",{className:Ue({"text-muted":l===i.length-2}),children:Ic(a)})]},`${a}-${l}`))})]})}function Zde(e){const[t,n]=g.useState(null),[r,o]=g.useState([]),[i,s]=g.useState({x:0,y:0});g.useEffect(()=>{const u=()=>{s({x:window.scrollX,y:window.scrollY})};return window.addEventListener("scroll",u,{passive:!1}),()=>{window.removeEventListener("scroll",u)}},[]),g.useEffect(()=>{if(t==="select"){let u;const d=()=>{const f=[];document.querySelectorAll("[data-val-path]").forEach(h=>{const m=h.getAttribute("data-val-path");if(!m)return;const v=h.getBoundingClientRect();f.push({top:v.top,left:v.left,width:v.width,height:v.height,joinedPaths:m})}),o(f),u=setTimeout(d,1e3)};return d(),()=>{clearTimeout(u)}}else o([])},[t,i]);const[a,l]=g.useState(null);g.useEffect(()=>{if(t==="select"&&a===null){const u=d=>{d.key==="Escape"&&n(null)};return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u)}}},[t,a]);const c=AM();return p.jsxs("div",{...c?{"data-mode":c}:{},id:"val-overlay-container",children:[a!==null&&p.jsx(Qde,{editMode:a,setMode:n,setEditMode:l}),r.map((u,d)=>p.jsx("div",{className:"absolute top-0 border border-bg-primary hover:border-2 z-[8998]",onClickCapture:f=>{f.stopPropagation(),n(null),l({joinedPaths:u.joinedPaths,clientY:f.clientY,clientX:f.clientX,boundingBox:u})},style:{display:"block",top:(u==null?void 0:u.top)+i.y,left:(u==null?void 0:u.left)+i.x,width:u==null?void 0:u.width,height:u==null?void 0:u.height},children:p.jsx("div",{className:"relative top-0 left-0 w-full",children:p.jsx("div",{className:"absolute top-[0px] right-[0px] truncate bg-bg-primary text-text-primary",style:{fontSize:`${Math.min(u.height-2,10)}px`,maxHeight:`${Math.min(u.height-2,16)}px`,maxWidth:`${Math.min(u.width-2,300)}px`},children:u.joinedPaths})})},d)),p.jsx(tfe,{...e,mode:t,setMode:n,loading:c===null})]})}function Qde({editMode:e,setMode:t,setEditMode:n}){const[r,o]=g.useState({x:0,y:0}),i=g.useRef(null);g.useEffect(()=>{(()=>{if(i.current){const{innerWidth:c,innerHeight:u}=window,{offsetWidth:d,offsetHeight:f}=i.current;let h=e.clientX,m=e.clientY;h+d>c?h=c-d-10:h<0&&(h=10),m+f>u?m=e.clientY-f-10:m=e.clientY+10,o({x:h,y:m})}})()},[e]);const[s,a]=g.useState(!1);return g.useEffect(()=>{if(s){const l=d=>{o(f=>({x:f.x+d.movementX,y:f.y+d.movementY}))},c=()=>{a(!1)},u=()=>{a(!1)};return window.addEventListener("mousemove",l),window.addEventListener("mouseup",c),window.addEventListener("click",u),()=>{window.removeEventListener("mousemove",l),window.removeEventListener("mouseup",c),window.removeEventListener("click",u)}}},[s]),g.useEffect(()=>{const l=c=>{c.key==="Escape"&&(t("select"),n(null))};return window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}},[]),p.jsxs("div",{className:"fixed h-[100svh] w-[100svw] top-0 left-0 z-[8999]",children:[p.jsx("div",{className:"fixed h-[100svh] w-[100svw] top-0 left-0",onClick:l=>{l.preventDefault(),s||(t("select"),n(null))}}),p.jsxs("div",{className:"absolute grid grid-cols-[32px,1fr,32px] rounded bg-bg-primary text-text-primary",style:{top:r.y,left:r.x},children:[p.jsx("div",{ref:i,className:"cursor-grab",onMouseDown:()=>{a(!0)}}),p.jsxs("div",{className:"grid grid-rows-[32px,1fr,32px]",children:[p.jsx("div",{ref:i,className:"cursor-grab",onMouseDown:()=>{a(!0)}}),p.jsxs("form",{className:"flex flex-col gap-4",onSubmit:l=>{l.stopPropagation(),t("select"),n(null)},children:[ue.splitJoinedSourcePaths(e.joinedPaths).map(l=>p.jsxs(g.Fragment,{children:[p.jsx(Xde,{disabled:!1,path:l}),p.jsx(efe,{path:l})]},l)),p.jsx(Tr,{className:"self-end",type:"submit",children:"Done"})]}),p.jsx("div",{ref:i,className:"cursor-grab",onMouseDown:()=>{a(!0)}})]}),p.jsx("div",{ref:i,className:"cursor-grab",onMouseDown:()=>{a(!0)}})]})]})}function efe({path:e}){const t=kt(e);return!("data"in t)||t.data===void 0?p.jsx("div",{className:"flex flex-col gap-4",children:p.jsx(nt,{path:e})}):p.jsx("div",{className:"flex flex-col gap-4 max-w-[600px]",children:p.jsx(zv,{path:e,schema:t.data,autoFocus:!0})})}function kT({dropZone:e,ghost:t,draftMode:n,draftModeLoading:r,setDraftMode:o,mode:i,setMode:s,disableOverlay:a,loading:l}){const c=e==="val-menu-right-center"||e==="val-menu-left-center"?"vertical":"horizontal",u=IM(),{publish:d,publishDisabled:f}=Kw();return p.jsxs("div",{className:"p-4 right-16",children:[l&&p.jsx("div",{className:kg(e)+" p-4",children:p.jsx("div",{className:"flex items-center justify-center p-2 text-white bg-black rounded backdrop-blur",children:p.jsx(Oh,{className:"animate-spin",size:16})})}),u==="login-required"&&p.jsx("div",{className:kg(e)+" p-4",children:p.jsx("div",{className:"flex items-center justify-center p-2 text-white bg-black rounded backdrop-blur",children:p.jsx("a",{href:wf("/api/val/authorize",{redirect_to:window.location.href}),children:p.jsx(j8,{size:16})})})}),p.jsx(jR,{}),p.jsx(bf,{isOpen:n&&!r&&!l&&u!=="login-required",children:p.jsxs("div",{className:Ue("flex relative rounded bg-bg-primary text-text-primary gap-2",{"flex-col py-4 px-2":c==="vertical","flex-row px-4 py-2":c==="horizontal","opacity-70":t}),children:[p.jsx(ts,{label:"Pick content",active:i==="select",onClick:()=>s(h=>h==="select"?null:"select"),icon:p.jsx(D8,{size:16})}),p.jsx(ts,{label:"Search",icon:p.jsx(UM,{size:16})}),p.jsx(ts,{label:"Disable draft mode",disabled:r,icon:r?p.jsx(Oh,{size:16,className:"animate-spin"}):p.jsx(_8,{size:16}),onClick:()=>o(!1)}),p.jsx("div",{className:"pb-1 mt-1 border-t border-border-primary"}),p.jsx(ts,{label:"Publish",disabled:f,variant:"primary",onClick:()=>{d()},icon:p.jsx(B8,{size:16})}),p.jsx(ts,{label:"Studio",icon:p.jsx(AC,{size:16}),onClick:()=>{window.location.href=window.origin+"/val/~"}})]})}),p.jsx(bf,{isOpen:!(n&&!r)&&!l&&u!=="login-required",children:p.jsxs("div",{className:Ue("flex relative rounded bg-bg-primary text-text-primary gap-2",{"flex-col py-4 px-2":c==="vertical","flex-row px-4 py-2":c==="horizontal","opacity-70":t}),children:[p.jsx(ts,{label:"Enable draft mode",disabled:r,icon:r?p.jsx(Oh,{size:16,className:"animate-spin"}):p.jsx(WM,{size:16}),onClick:()=>{o(!0)}}),p.jsx(ts,{label:"Studio",icon:p.jsx(AC,{size:16}),onClick:()=>{window.location.href=window.origin+"/val/~"}}),p.jsx(ts,{label:"Disable Val",icon:p.jsx(Ug,{size:16}),onClick:()=>a()})]})})]})}function ts({icon:e,onClick:t,disabled:n,active:r,label:o,variant:i}){return p.jsx("button",{disabled:n,className:Ue("p-2 rounded-full disabled:bg-bg-disabled",{"bg-bg-brand-primary text-text-brand-primary":i==="primary","border border-border-primary":!!r}),onClick:t,"aria-label":o,title:o,children:e})}function tfe(e){const t="val-menu-right-center",[n,r]=g.useState(!1),[o,i]=g.useState(),s=sp();g.useEffect(()=>{try{const d=localStorage.getItem("val-menu-drop-zone-"+((s==null?void 0:s.project)||"unknown"))||localStorage.getItem("val-menu-drop-zone-default");if(d)if(d==="val-menu-left-top"||d==="val-menu-left-center"||d==="val-menu-left-bottom"||d==="val-menu-center-top"||d==="val-menu-center-bottom"||d==="val-menu-right-top"||d==="val-menu-right-center"||d==="val-menu-right-bottom")i(d);else throw new Error("Invalid drop zone: "+d);else i(t)}catch(d){console.error("Error getting drop zone from local storage",d),i(t)}},[]);const[a,l]=g.useState(null),c=d=>f=>{f.preventDefault(),i(d);try{localStorage.setItem("val-menu-drop-zone-"+((s==null?void 0:s.project)||"unknown"),d),localStorage.setItem("val-menu-drop-zone-default",d)}catch(h){console.error("Error setting drop zone to local storage",h)}},u=d=>f=>{f.preventDefault(),l(d)};return p.jsxs(p.Fragment,{children:[o&&p.jsx("div",{className:Ue("z-[8999] cursor-grab",kg(o)),draggable:!0,onDragStart:()=>{r(!0)},onDragEnd:()=>{r(!1)},children:p.jsx(kT,{dropZone:o,...e})}),n&&o&&p.jsxs(p.Fragment,{children:[a&&a!==o&&p.jsx("div",{className:Ue("z-[3]",kg(a)),onDrop:c(a),onDragOver:u(a),children:p.jsx(kT,{dropZone:a,ghost:!0,...e})}),p.jsxs("div",{className:"fixed top-0 left-0 grid w-screen h-screen grid-cols-3 grid-rows-3 z-[2]",children:[p.jsx(ns,{id:"val-menu-left-top",dropZone:o,dragOverDropZone:a,onDrop:c,onDragOver:u}),p.jsx(ns,{id:"val-menu-center-top",dropZone:o,dragOverDropZone:a,onDrop:c,onDragOver:u}),p.jsx(ns,{id:"val-menu-right-top",dropZone:o,dragOverDropZone:a,onDrop:c,onDragOver:u}),p.jsx(ns,{id:"val-menu-left-center",dropZone:o,dragOverDropZone:a,onDrop:c,onDragOver:u}),p.jsx("div",{}),p.jsx(ns,{id:"val-menu-right-center",dropZone:o,dragOverDropZone:a,onDrop:c,onDragOver:u}),p.jsx(ns,{id:"val-menu-left-bottom",dropZone:o,dragOverDropZone:a,onDrop:c,onDragOver:u}),p.jsx(ns,{id:"val-menu-center-bottom",dropZone:o,dragOverDropZone:a,onDrop:c,onDragOver:u}),p.jsx(ns,{id:"val-menu-right-bottom",dropZone:o,dragOverDropZone:a,onDrop:c,onDragOver:u})]})]})]})}function kg(e){let t="fixed transform";return e==="val-menu-left-top"?t+=" left-0 top-0":e==="val-menu-left-center"?t+=" left-0 top-1/2 -translate-y-1/2":e==="val-menu-left-bottom"?t+=" left-0 bottom-0":e==="val-menu-center-top"?t+=" left-1/2 -translate-x-1/2 top-0":e==="val-menu-center-bottom"?t+=" left-1/2 -translate-x-1/2 bottom-0":e==="val-menu-right-top"?t+=" right-0 top-0":e==="val-menu-right-center"?t+=" right-0 top-1/2 -translate-y-1/2":t+=" right-0 bottom-0",t}const ns=({id:e,onDrop:t,onDragOver:n})=>p.jsx("div",{onDrop:t(e),onDragOver:n(e)});function nfe(){const e="/api/val",t=QP(e),[n,r]=g.useState(!1),[o,i]=g.useState(!1);return g.useEffect(()=>{const s=a=>{a instanceof CustomEvent?(a==null?void 0:a.detail.type)==="draftMode"&&typeof(a==null?void 0:a.detail.value)=="boolean"?r(a.detail.value):a.detail.type==="draftModeLoading"&&typeof a.detail.value=="boolean"?i(a.detail.value):console.error("Val: invalid event detail (val-overlay-spa)",a.detail):console.error("Val: invalid event (val-overlay-spa)",a)};return window.addEventListener("val-overlay-spa",s),window.dispatchEvent(new CustomEvent("val-overlay-provider",{detail:{type:"spa-ready"}})),()=>{window.removeEventListener("val-overlay-spa",s)}},[]),p.jsxs(p.Fragment,{children:[p.jsx(UL,{}),p.jsxs(BL,{children:[p.jsx("style",{children:`
369
- #val-overlay-container {
370
- visibility: hidden;
371
- }
372
- `}),p.jsx("link",{rel:"stylesheet",href:`${e}/static${VL}`}),p.jsx(yL,{fallbackRender:$L,children:p.jsx(qM,{overlay:!0,children:p.jsx(jM,{client:t,dispatchValEvents:n,children:p.jsx(Zde,{draftMode:n,draftModeLoading:o,setDraftMode:s=>{const a=new CustomEvent("val-overlay-provider",{detail:{type:"draftMode",value:s}});window.dispatchEvent(a)},disableOverlay:()=>{location.href=`${window.location.origin}/api/val/disable?redirect_to=${encodeURIComponent(window.location.href)}`}})})})})]})]})}const CT=document.getElementById(Gde),ET=document.getElementById(Yde);CT?Yh.createRoot(CT).render(ge.createElement(ge.StrictMode,null,ge.createElement(Jde,null))):ET?Yh.createRoot(ET).render(ge.createElement(ge.StrictMode,null,ge.createElement(nfe,null))):console.error("Val: could not mount Val element. Check your configuration.");