Files
CreaBook/client/dist/assets/index-D3_QgWye.js
2026-04-05 03:56:31 +02:00

454 lines
1013 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
var x4=t=>{throw TypeError(t)};var G1=(t,e,n)=>e.has(t)||x4("Cannot "+n);var L=(t,e,n)=>(G1(t,e,"read from private field"),n?n.call(t):e.get(t)),ge=(t,e,n)=>e.has(t)?x4("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),se=(t,e,n,r)=>(G1(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Te=(t,e,n)=>(G1(t,e,"access private method"),n);var gf=(t,e,n,r)=>({set _(i){se(t,e,i,n)},get _(){return L(t,e,r)}});function zM(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var S4=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function nh(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var l6={exports:{}},Qm={},u6={exports:{}},Ie={};/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var rh=Symbol.for("react.element"),BM=Symbol.for("react.portal"),UM=Symbol.for("react.fragment"),HM=Symbol.for("react.strict_mode"),VM=Symbol.for("react.profiler"),GM=Symbol.for("react.provider"),$M=Symbol.for("react.context"),WM=Symbol.for("react.forward_ref"),KM=Symbol.for("react.suspense"),qM=Symbol.for("react.memo"),QM=Symbol.for("react.lazy"),w4=Symbol.iterator;function YM(t){return t===null||typeof t!="object"?null:(t=w4&&t[w4]||t["@@iterator"],typeof t=="function"?t:null)}var c6={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},d6=Object.assign,h6={};function Lu(t,e,n){this.props=t,this.context=e,this.refs=h6,this.updater=n||c6}Lu.prototype.isReactComponent={};Lu.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Lu.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function f6(){}f6.prototype=Lu.prototype;function vx(t,e,n){this.props=t,this.context=e,this.refs=h6,this.updater=n||c6}var xx=vx.prototype=new f6;xx.constructor=vx;d6(xx,Lu.prototype);xx.isPureReactComponent=!0;var k4=Array.isArray,p6=Object.prototype.hasOwnProperty,Sx={current:null},m6={key:!0,ref:!0,__self:!0,__source:!0};function g6(t,e,n){var r,i={},s=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)p6.call(e,r)&&!m6.hasOwnProperty(r)&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1<a){for(var l=Array(a),d=0;d<a;d++)l[d]=arguments[d+2];i.children=l}if(t&&t.defaultProps)for(r in a=t.defaultProps,a)i[r]===void 0&&(i[r]=a[r]);return{$$typeof:rh,type:t,key:s,ref:o,props:i,_owner:Sx.current}}function JM(t,e){return{$$typeof:rh,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function wx(t){return typeof t=="object"&&t!==null&&t.$$typeof===rh}function XM(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var C4=/\/+/g;function $1(t,e){return typeof t=="object"&&t!==null&&t.key!=null?XM(""+t.key):e.toString(36)}function tp(t,e,n,r,i){var s=typeof t;(s==="undefined"||s==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case rh:case BM:o=!0}}if(o)return o=t,i=i(o),t=r===""?"."+$1(o,0):r,k4(i)?(n="",t!=null&&(n=t.replace(C4,"$&/")+"/"),tp(i,e,n,"",function(d){return d})):i!=null&&(wx(i)&&(i=JM(i,n+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(C4,"$&/")+"/")+t)),e.push(i)),1;if(o=0,r=r===""?".":r+":",k4(t))for(var a=0;a<t.length;a++){s=t[a];var l=r+$1(s,a);o+=tp(s,e,n,l,i)}else if(l=YM(t),typeof l=="function")for(t=l.call(t),a=0;!(s=t.next()).done;)s=s.value,l=r+$1(s,a++),o+=tp(s,e,n,l,i);else if(s==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function yf(t,e,n){if(t==null)return t;var r=[],i=0;return tp(t,r,"","",function(s){return e.call(n,s,i++)}),r}function ZM(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var Un={current:null},np={transition:null},eP={ReactCurrentDispatcher:Un,ReactCurrentBatchConfig:np,ReactCurrentOwner:Sx};function y6(){throw Error("act(...) is not supported in production builds of React.")}Ie.Children={map:yf,forEach:function(t,e,n){yf(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return yf(t,function(){e++}),e},toArray:function(t){return yf(t,function(e){return e})||[]},only:function(t){if(!wx(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};Ie.Component=Lu;Ie.Fragment=UM;Ie.Profiler=VM;Ie.PureComponent=vx;Ie.StrictMode=HM;Ie.Suspense=KM;Ie.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=eP;Ie.act=y6;Ie.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=d6({},t.props),i=t.key,s=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,o=Sx.current),e.key!==void 0&&(i=""+e.key),t.type&&t.type.defaultProps)var a=t.type.defaultProps;for(l in e)p6.call(e,l)&&!m6.hasOwnProperty(l)&&(r[l]=e[l]===void 0&&a!==void 0?a[l]:e[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var d=0;d<l;d++)a[d]=arguments[d+2];r.children=a}return{$$typeof:rh,type:t.type,key:i,ref:s,props:r,_owner:o}};Ie.createContext=function(t){return t={$$typeof:$M,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:GM,_context:t},t.Consumer=t};Ie.createElement=g6;Ie.createFactory=function(t){var e=g6.bind(null,t);return e.type=t,e};Ie.createRef=function(){return{current:null}};Ie.forwardRef=function(t){return{$$typeof:WM,render:t}};Ie.isValidElement=wx;Ie.lazy=function(t){return{$$typeof:QM,_payload:{_status:-1,_result:t},_init:ZM}};Ie.memo=function(t,e){return{$$typeof:qM,type:t,compare:e===void 0?null:e}};Ie.startTransition=function(t){var e=np.transition;np.transition={};try{t()}finally{np.transition=e}};Ie.unstable_act=y6;Ie.useCallback=function(t,e){return Un.current.useCallback(t,e)};Ie.useContext=function(t){return Un.current.useContext(t)};Ie.useDebugValue=function(){};Ie.useDeferredValue=function(t){return Un.current.useDeferredValue(t)};Ie.useEffect=function(t,e){return Un.current.useEffect(t,e)};Ie.useId=function(){return Un.current.useId()};Ie.useImperativeHandle=function(t,e,n){return Un.current.useImperativeHandle(t,e,n)};Ie.useInsertionEffect=function(t,e){return Un.current.useInsertionEffect(t,e)};Ie.useLayoutEffect=function(t,e){return Un.current.useLayoutEffect(t,e)};Ie.useMemo=function(t,e){return Un.current.useMemo(t,e)};Ie.useReducer=function(t,e,n){return Un.current.useReducer(t,e,n)};Ie.useRef=function(t){return Un.current.useRef(t)};Ie.useState=function(t){return Un.current.useState(t)};Ie.useSyncExternalStore=function(t,e,n){return Un.current.useSyncExternalStore(t,e,n)};Ie.useTransition=function(){return Un.current.useTransition()};Ie.version="18.3.1";u6.exports=Ie;var z=u6.exports;const ct=nh(z),tP=zM({__proto__:null,default:ct},[z]);/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var nP=z,rP=Symbol.for("react.element"),iP=Symbol.for("react.fragment"),sP=Object.prototype.hasOwnProperty,oP=nP.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,aP={key:!0,ref:!0,__self:!0,__source:!0};function v6(t,e,n){var r,i={},s=null,o=null;n!==void 0&&(s=""+n),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)sP.call(e,r)&&!aP.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:rP,type:t,key:s,ref:o,props:i,_owner:oP.current}}Qm.Fragment=iP;Qm.jsx=v6;Qm.jsxs=v6;l6.exports=Qm;var N=l6.exports,f2={},x6={exports:{}},yr={},S6={exports:{}},w6={};/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/(function(t){function e(W,re){var te=W.length;W.push(re);e:for(;0<te;){var Y=te-1>>>1,oe=W[Y];if(0<i(oe,re))W[Y]=re,W[te]=oe,te=Y;else break e}}function n(W){return W.length===0?null:W[0]}function r(W){if(W.length===0)return null;var re=W[0],te=W.pop();if(te!==re){W[0]=te;e:for(var Y=0,oe=W.length,_e=oe>>>1;Y<_e;){var rt=2*(Y+1)-1,yt=W[rt],it=rt+1,F=W[it];if(0>i(yt,te))it<oe&&0>i(F,yt)?(W[Y]=F,W[it]=te,Y=it):(W[Y]=yt,W[rt]=te,Y=rt);else if(it<oe&&0>i(F,te))W[Y]=F,W[it]=te,Y=it;else break e}}return re}function i(W,re){var te=W.sortIndex-re.sortIndex;return te!==0?te:W.id-re.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],d=[],h=1,f=null,p=3,y=!1,g=!1,x=!1,S=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(W){for(var re=n(d);re!==null;){if(re.callback===null)r(d);else if(re.startTime<=W)r(d),re.sortIndex=re.expirationTime,e(l,re);else break;re=n(d)}}function b(W){if(x=!1,w(W),!g)if(n(l)!==null)g=!0,ie(T);else{var re=n(d);re!==null&&fe(b,re.startTime-W)}}function T(W,re){g=!1,x&&(x=!1,C(M),M=-1),y=!0;var te=p;try{for(w(re),f=n(l);f!==null&&(!(f.expirationTime>re)||W&&!U());){var Y=f.callback;if(typeof Y=="function"){f.callback=null,p=f.priorityLevel;var oe=Y(f.expirationTime<=re);re=t.unstable_now(),typeof oe=="function"?f.callback=oe:f===n(l)&&r(l),w(re)}else r(l);f=n(l)}if(f!==null)var _e=!0;else{var rt=n(d);rt!==null&&fe(b,rt.startTime-re),_e=!1}return _e}finally{f=null,p=te,y=!1}}var P=!1,A=null,M=-1,I=5,R=-1;function U(){return!(t.unstable_now()-R<I)}function B(){if(A!==null){var W=t.unstable_now();R=W;var re=!0;try{re=A(!0,W)}finally{re?$():(P=!1,A=null)}}else P=!1}var $;if(typeof E=="function")$=function(){E(B)};else if(typeof MessageChannel<"u"){var Q=new MessageChannel,q=Q.port2;Q.port1.onmessage=B,$=function(){q.postMessage(null)}}else $=function(){S(B,0)};function ie(W){A=W,P||(P=!0,$())}function fe(W,re){M=S(function(){W(t.unstable_now())},re)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(W){W.callback=null},t.unstable_continueExecution=function(){g||y||(g=!0,ie(T))},t.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<W?Math.floor(1e3/W):5},t.unstable_getCurrentPriorityLevel=function(){return p},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(W){switch(p){case 1:case 2:case 3:var re=3;break;default:re=p}var te=p;p=re;try{return W()}finally{p=te}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(W,re){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var te=p;p=W;try{return re()}finally{p=te}},t.unstable_scheduleCallback=function(W,re,te){var Y=t.unstable_now();switch(typeof te=="object"&&te!==null?(te=te.delay,te=typeof te=="number"&&0<te?Y+te:Y):te=Y,W){case 1:var oe=-1;break;case 2:oe=250;break;case 5:oe=1073741823;break;case 4:oe=1e4;break;default:oe=5e3}return oe=te+oe,W={id:h++,callback:re,priorityLevel:W,startTime:te,expirationTime:oe,sortIndex:-1},te>Y?(W.sortIndex=te,e(d,W),n(l)===null&&W===n(d)&&(x?(C(M),M=-1):x=!0,fe(b,te-Y))):(W.sortIndex=oe,e(l,W),g||y||(g=!0,ie(T))),W},t.unstable_shouldYield=U,t.unstable_wrapCallback=function(W){var re=p;return function(){var te=p;p=re;try{return W.apply(this,arguments)}finally{p=te}}}})(w6);S6.exports=w6;var $c=S6.exports;/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var lP=z,gr=$c;function ee(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var k6=new Set,pd={};function Qa(t,e){mu(t,e),mu(t+"Capture",e)}function mu(t,e){for(pd[t]=e,t=0;t<e.length;t++)k6.add(e[t])}var ps=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p2=Object.prototype.hasOwnProperty,uP=/^[: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]*$/,b4={},E4={};function cP(t){return p2.call(E4,t)?!0:p2.call(b4,t)?!1:uP.test(t)?E4[t]=!0:(b4[t]=!0,!1)}function dP(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function hP(t,e,n,r){if(e===null||typeof e>"u"||dP(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Hn(t,e,n,r,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var gn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){gn[t]=new Hn(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];gn[e]=new Hn(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){gn[t]=new Hn(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){gn[t]=new Hn(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){gn[t]=new Hn(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){gn[t]=new Hn(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){gn[t]=new Hn(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){gn[t]=new Hn(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){gn[t]=new Hn(t,5,!1,t.toLowerCase(),null,!1,!1)});var kx=/[\-:]([a-z])/g;function Cx(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(kx,Cx);gn[e]=new Hn(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(kx,Cx);gn[e]=new Hn(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(kx,Cx);gn[e]=new Hn(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){gn[t]=new Hn(t,1,!1,t.toLowerCase(),null,!1,!1)});gn.xlinkHref=new Hn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){gn[t]=new Hn(t,1,!1,t.toLowerCase(),null,!0,!0)});function bx(t,e,n,r){var i=gn.hasOwnProperty(e)?gn[e]:null;(i!==null?i.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(hP(e,n,i,r)&&(n=null),r||i===null?cP(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):i.mustUseProperty?t[i.propertyName]=n===null?i.type===3?!1:"":n:(e=i.attributeName,r=i.attributeNamespace,n===null?t.removeAttribute(e):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var vs=lP.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,vf=Symbol.for("react.element"),Il=Symbol.for("react.portal"),Dl=Symbol.for("react.fragment"),Ex=Symbol.for("react.strict_mode"),m2=Symbol.for("react.profiler"),C6=Symbol.for("react.provider"),b6=Symbol.for("react.context"),_x=Symbol.for("react.forward_ref"),g2=Symbol.for("react.suspense"),y2=Symbol.for("react.suspense_list"),Nx=Symbol.for("react.memo"),Vs=Symbol.for("react.lazy"),E6=Symbol.for("react.offscreen"),_4=Symbol.iterator;function gc(t){return t===null||typeof t!="object"?null:(t=_4&&t[_4]||t["@@iterator"],typeof t=="function"?t:null)}var Ct=Object.assign,W1;function Rc(t){if(W1===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);W1=e&&e[1]||""}return`
`+W1+t}var K1=!1;function q1(t,e){if(!t||K1)return"";K1=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(d){var r=d}Reflect.construct(t,[],e)}else{try{e.call()}catch(d){r=d}t.call(e.prototype)}else{try{throw Error()}catch(d){r=d}t()}}catch(d){if(d&&r&&typeof d.stack=="string"){for(var i=d.stack.split(`
`),s=r.stack.split(`
`),o=i.length-1,a=s.length-1;1<=o&&0<=a&&i[o]!==s[a];)a--;for(;1<=o&&0<=a;o--,a--)if(i[o]!==s[a]){if(o!==1||a!==1)do if(o--,a--,0>a||i[o]!==s[a]){var l=`
`+i[o].replace(" at new "," at ");return t.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",t.displayName)),l}while(1<=o&&0<=a);break}}}finally{K1=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Rc(t):""}function fP(t){switch(t.tag){case 5:return Rc(t.type);case 16:return Rc("Lazy");case 13:return Rc("Suspense");case 19:return Rc("SuspenseList");case 0:case 2:case 15:return t=q1(t.type,!1),t;case 11:return t=q1(t.type.render,!1),t;case 1:return t=q1(t.type,!0),t;default:return""}}function v2(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Dl:return"Fragment";case Il:return"Portal";case m2:return"Profiler";case Ex:return"StrictMode";case g2:return"Suspense";case y2:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case b6:return(t.displayName||"Context")+".Consumer";case C6:return(t._context.displayName||"Context")+".Provider";case _x:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Nx:return e=t.displayName||null,e!==null?e:v2(t.type)||"Memo";case Vs:e=t._payload,t=t._init;try{return v2(t(e))}catch{}}return null}function pP(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return v2(e);case 8:return e===Ex?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function No(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function _6(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function mP(t){var e=_6(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function xf(t){t._valueTracker||(t._valueTracker=mP(t))}function N6(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=_6(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Ep(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function x2(t,e){var n=e.checked;return Ct({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function N4(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=No(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function T6(t,e){e=e.checked,e!=null&&bx(t,"checked",e,!1)}function S2(t,e){T6(t,e);var n=No(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?w2(t,e.type,n):e.hasOwnProperty("defaultValue")&&w2(t,e.type,No(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function T4(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function w2(t,e,n){(e!=="number"||Ep(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Lc=Array.isArray;function ql(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i<n.length;i++)e["$"+n[i]]=!0;for(n=0;n<t.length;n++)i=e.hasOwnProperty("$"+t[n].value),t[n].selected!==i&&(t[n].selected=i),i&&r&&(t[n].defaultSelected=!0)}else{for(n=""+No(n),e=null,i=0;i<t.length;i++){if(t[i].value===n){t[i].selected=!0,r&&(t[i].defaultSelected=!0);return}e!==null||t[i].disabled||(e=t[i])}e!==null&&(e.selected=!0)}}function k2(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(ee(91));return Ct({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function M4(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(ee(92));if(Lc(n)){if(1<n.length)throw Error(ee(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:No(n)}}function M6(t,e){var n=No(e.value),r=No(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function P4(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function P6(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function C2(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?P6(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Sf,O6=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,i){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,i)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(Sf=Sf||document.createElement("div"),Sf.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Sf.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function md(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Wc={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},gP=["Webkit","ms","Moz","O"];Object.keys(Wc).forEach(function(t){gP.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Wc[e]=Wc[t]})});function A6(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Wc.hasOwnProperty(t)&&Wc[t]?(""+e).trim():e+"px"}function R6(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=A6(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var yP=Ct({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 b2(t,e){if(e){if(yP[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(ee(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(ee(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(ee(61))}if(e.style!=null&&typeof e.style!="object")throw Error(ee(62))}}function E2(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var _2=null;function Tx(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var N2=null,Ql=null,Yl=null;function O4(t){if(t=oh(t)){if(typeof N2!="function")throw Error(ee(280));var e=t.stateNode;e&&(e=eg(e),N2(t.stateNode,t.type,e))}}function L6(t){Ql?Yl?Yl.push(t):Yl=[t]:Ql=t}function I6(){if(Ql){var t=Ql,e=Yl;if(Yl=Ql=null,O4(t),e)for(t=0;t<e.length;t++)O4(e[t])}}function D6(t,e){return t(e)}function F6(){}var Q1=!1;function j6(t,e,n){if(Q1)return t(e,n);Q1=!0;try{return D6(t,e,n)}finally{Q1=!1,(Ql!==null||Yl!==null)&&(F6(),I6())}}function gd(t,e){var n=t.stateNode;if(n===null)return null;var r=eg(n);if(r===null)return null;n=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(ee(231,e,typeof n));return n}var T2=!1;if(ps)try{var yc={};Object.defineProperty(yc,"passive",{get:function(){T2=!0}}),window.addEventListener("test",yc,yc),window.removeEventListener("test",yc,yc)}catch{T2=!1}function vP(t,e,n,r,i,s,o,a,l){var d=Array.prototype.slice.call(arguments,3);try{e.apply(n,d)}catch(h){this.onError(h)}}var Kc=!1,_p=null,Np=!1,M2=null,xP={onError:function(t){Kc=!0,_p=t}};function SP(t,e,n,r,i,s,o,a,l){Kc=!1,_p=null,vP.apply(xP,arguments)}function wP(t,e,n,r,i,s,o,a,l){if(SP.apply(this,arguments),Kc){if(Kc){var d=_p;Kc=!1,_p=null}else throw Error(ee(198));Np||(Np=!0,M2=d)}}function Ya(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function z6(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function A4(t){if(Ya(t)!==t)throw Error(ee(188))}function kP(t){var e=t.alternate;if(!e){if(e=Ya(t),e===null)throw Error(ee(188));return e!==t?null:t}for(var n=t,r=e;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return A4(i),t;if(s===r)return A4(i),e;s=s.sibling}throw Error(ee(188))}if(n.return!==r.return)n=i,r=s;else{for(var o=!1,a=i.child;a;){if(a===n){o=!0,n=i,r=s;break}if(a===r){o=!0,r=i,n=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===n){o=!0,n=s,r=i;break}if(a===r){o=!0,r=s,n=i;break}a=a.sibling}if(!o)throw Error(ee(189))}}if(n.alternate!==r)throw Error(ee(190))}if(n.tag!==3)throw Error(ee(188));return n.stateNode.current===n?t:e}function B6(t){return t=kP(t),t!==null?U6(t):null}function U6(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=U6(t);if(e!==null)return e;t=t.sibling}return null}var H6=gr.unstable_scheduleCallback,R4=gr.unstable_cancelCallback,CP=gr.unstable_shouldYield,bP=gr.unstable_requestPaint,Lt=gr.unstable_now,EP=gr.unstable_getCurrentPriorityLevel,Mx=gr.unstable_ImmediatePriority,V6=gr.unstable_UserBlockingPriority,Tp=gr.unstable_NormalPriority,_P=gr.unstable_LowPriority,G6=gr.unstable_IdlePriority,Ym=null,Ai=null;function NP(t){if(Ai&&typeof Ai.onCommitFiberRoot=="function")try{Ai.onCommitFiberRoot(Ym,t,void 0,(t.current.flags&128)===128)}catch{}}var si=Math.clz32?Math.clz32:PP,TP=Math.log,MP=Math.LN2;function PP(t){return t>>>=0,t===0?32:31-(TP(t)/MP|0)|0}var wf=64,kf=4194304;function Ic(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Mp(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,s=t.pingedLanes,o=n&268435455;if(o!==0){var a=o&~i;a!==0?r=Ic(a):(s&=o,s!==0&&(r=Ic(s)))}else o=n&~i,o!==0?r=Ic(o):s!==0&&(r=Ic(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-si(e),i=1<<n,r|=t[n],e&=~i;return r}function OP(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function AP(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,i=t.expirationTimes,s=t.pendingLanes;0<s;){var o=31-si(s),a=1<<o,l=i[o];l===-1?(!(a&n)||a&r)&&(i[o]=OP(a,e)):l<=e&&(t.expiredLanes|=a),s&=~a}}function P2(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function $6(){var t=wf;return wf<<=1,!(wf&4194240)&&(wf=64),t}function Y1(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function ih(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-si(e),t[e]=n}function RP(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<n;){var i=31-si(n),s=1<<i;e[i]=0,r[i]=-1,t[i]=-1,n&=~s}}function Px(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-si(n),i=1<<r;i&e|t[r]&e&&(t[r]|=e),n&=~i}}var qe=0;function W6(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var K6,Ox,q6,Q6,Y6,O2=!1,Cf=[],po=null,mo=null,go=null,yd=new Map,vd=new Map,qs=[],LP="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 L4(t,e){switch(t){case"focusin":case"focusout":po=null;break;case"dragenter":case"dragleave":mo=null;break;case"mouseover":case"mouseout":go=null;break;case"pointerover":case"pointerout":yd.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":vd.delete(e.pointerId)}}function vc(t,e,n,r,i,s){return t===null||t.nativeEvent!==s?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},e!==null&&(e=oh(e),e!==null&&Ox(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,i!==null&&e.indexOf(i)===-1&&e.push(i),t)}function IP(t,e,n,r,i){switch(e){case"focusin":return po=vc(po,t,e,n,r,i),!0;case"dragenter":return mo=vc(mo,t,e,n,r,i),!0;case"mouseover":return go=vc(go,t,e,n,r,i),!0;case"pointerover":var s=i.pointerId;return yd.set(s,vc(yd.get(s)||null,t,e,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,vd.set(s,vc(vd.get(s)||null,t,e,n,r,i)),!0}return!1}function J6(t){var e=la(t.target);if(e!==null){var n=Ya(e);if(n!==null){if(e=n.tag,e===13){if(e=z6(n),e!==null){t.blockedOn=e,Y6(t.priority,function(){q6(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function rp(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=A2(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);_2=r,n.target.dispatchEvent(r),_2=null}else return e=oh(n),e!==null&&Ox(e),t.blockedOn=n,!1;e.shift()}return!0}function I4(t,e,n){rp(t)&&n.delete(e)}function DP(){O2=!1,po!==null&&rp(po)&&(po=null),mo!==null&&rp(mo)&&(mo=null),go!==null&&rp(go)&&(go=null),yd.forEach(I4),vd.forEach(I4)}function xc(t,e){t.blockedOn===e&&(t.blockedOn=null,O2||(O2=!0,gr.unstable_scheduleCallback(gr.unstable_NormalPriority,DP)))}function xd(t){function e(i){return xc(i,t)}if(0<Cf.length){xc(Cf[0],t);for(var n=1;n<Cf.length;n++){var r=Cf[n];r.blockedOn===t&&(r.blockedOn=null)}}for(po!==null&&xc(po,t),mo!==null&&xc(mo,t),go!==null&&xc(go,t),yd.forEach(e),vd.forEach(e),n=0;n<qs.length;n++)r=qs[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<qs.length&&(n=qs[0],n.blockedOn===null);)J6(n),n.blockedOn===null&&qs.shift()}var Jl=vs.ReactCurrentBatchConfig,Pp=!0;function FP(t,e,n,r){var i=qe,s=Jl.transition;Jl.transition=null;try{qe=1,Ax(t,e,n,r)}finally{qe=i,Jl.transition=s}}function jP(t,e,n,r){var i=qe,s=Jl.transition;Jl.transition=null;try{qe=4,Ax(t,e,n,r)}finally{qe=i,Jl.transition=s}}function Ax(t,e,n,r){if(Pp){var i=A2(t,e,n,r);if(i===null)oy(t,e,r,Op,n),L4(t,r);else if(IP(i,t,e,n,r))r.stopPropagation();else if(L4(t,r),e&4&&-1<LP.indexOf(t)){for(;i!==null;){var s=oh(i);if(s!==null&&K6(s),s=A2(t,e,n,r),s===null&&oy(t,e,r,Op,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else oy(t,e,r,null,n)}}var Op=null;function A2(t,e,n,r){if(Op=null,t=Tx(r),t=la(t),t!==null)if(e=Ya(t),e===null)t=null;else if(n=e.tag,n===13){if(t=z6(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return Op=t,null}function X6(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(EP()){case Mx:return 1;case V6:return 4;case Tp:case _P:return 16;case G6:return 536870912;default:return 16}default:return 16}}var ao=null,Rx=null,ip=null;function Z6(){if(ip)return ip;var t,e=Rx,n=e.length,r,i="value"in ao?ao.value:ao.textContent,s=i.length;for(t=0;t<n&&e[t]===i[t];t++);var o=n-t;for(r=1;r<=o&&e[n-r]===i[s-r];r++);return ip=i.slice(t,1<r?1-r:void 0)}function sp(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function bf(){return!0}function D4(){return!1}function vr(t){function e(n,r,i,s,o){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var a in t)t.hasOwnProperty(a)&&(n=t[a],this[a]=n?n(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?bf:D4,this.isPropagationStopped=D4,this}return Ct(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=bf)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=bf)},persist:function(){},isPersistent:bf}),e}var Iu={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Lx=vr(Iu),sh=Ct({},Iu,{view:0,detail:0}),zP=vr(sh),J1,X1,Sc,Jm=Ct({},sh,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ix,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Sc&&(Sc&&t.type==="mousemove"?(J1=t.screenX-Sc.screenX,X1=t.screenY-Sc.screenY):X1=J1=0,Sc=t),J1)},movementY:function(t){return"movementY"in t?t.movementY:X1}}),F4=vr(Jm),BP=Ct({},Jm,{dataTransfer:0}),UP=vr(BP),HP=Ct({},sh,{relatedTarget:0}),Z1=vr(HP),VP=Ct({},Iu,{animationName:0,elapsedTime:0,pseudoElement:0}),GP=vr(VP),$P=Ct({},Iu,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),WP=vr($P),KP=Ct({},Iu,{data:0}),j4=vr(KP),qP={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},QP={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"},YP={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function JP(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=YP[t])?!!e[t]:!1}function Ix(){return JP}var XP=Ct({},sh,{key:function(t){if(t.key){var e=qP[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=sp(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?QP[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ix,charCode:function(t){return t.type==="keypress"?sp(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?sp(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),ZP=vr(XP),eO=Ct({},Jm,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),z4=vr(eO),tO=Ct({},sh,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ix}),nO=vr(tO),rO=Ct({},Iu,{propertyName:0,elapsedTime:0,pseudoElement:0}),iO=vr(rO),sO=Ct({},Jm,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),oO=vr(sO),aO=[9,13,27,32],Dx=ps&&"CompositionEvent"in window,qc=null;ps&&"documentMode"in document&&(qc=document.documentMode);var lO=ps&&"TextEvent"in window&&!qc,eE=ps&&(!Dx||qc&&8<qc&&11>=qc),B4=" ",U4=!1;function tE(t,e){switch(t){case"keyup":return aO.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function nE(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Fl=!1;function uO(t,e){switch(t){case"compositionend":return nE(e);case"keypress":return e.which!==32?null:(U4=!0,B4);case"textInput":return t=e.data,t===B4&&U4?null:t;default:return null}}function cO(t,e){if(Fl)return t==="compositionend"||!Dx&&tE(t,e)?(t=Z6(),ip=Rx=ao=null,Fl=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return eE&&e.locale!=="ko"?null:e.data;default:return null}}var dO={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 H4(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!dO[t.type]:e==="textarea"}function rE(t,e,n,r){L6(r),e=Ap(e,"onChange"),0<e.length&&(n=new Lx("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var Qc=null,Sd=null;function hO(t){pE(t,0)}function Xm(t){var e=Bl(t);if(N6(e))return t}function fO(t,e){if(t==="change")return e}var iE=!1;if(ps){var ey;if(ps){var ty="oninput"in document;if(!ty){var V4=document.createElement("div");V4.setAttribute("oninput","return;"),ty=typeof V4.oninput=="function"}ey=ty}else ey=!1;iE=ey&&(!document.documentMode||9<document.documentMode)}function G4(){Qc&&(Qc.detachEvent("onpropertychange",sE),Sd=Qc=null)}function sE(t){if(t.propertyName==="value"&&Xm(Sd)){var e=[];rE(e,Sd,t,Tx(t)),j6(hO,e)}}function pO(t,e,n){t==="focusin"?(G4(),Qc=e,Sd=n,Qc.attachEvent("onpropertychange",sE)):t==="focusout"&&G4()}function mO(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Xm(Sd)}function gO(t,e){if(t==="click")return Xm(e)}function yO(t,e){if(t==="input"||t==="change")return Xm(e)}function vO(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var ui=typeof Object.is=="function"?Object.is:vO;function wd(t,e){if(ui(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!p2.call(e,i)||!ui(t[i],e[i]))return!1}return!0}function $4(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function W4(t,e){var n=$4(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=$4(n)}}function oE(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?oE(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function aE(){for(var t=window,e=Ep();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Ep(t.document)}return e}function Fx(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function xO(t){var e=aE(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&oE(n.ownerDocument.documentElement,n)){if(r!==null&&Fx(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!t.extend&&s>r&&(i=r,r=s,s=i),i=W4(n,s);var o=W4(n,r);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var SO=ps&&"documentMode"in document&&11>=document.documentMode,jl=null,R2=null,Yc=null,L2=!1;function K4(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;L2||jl==null||jl!==Ep(r)||(r=jl,"selectionStart"in r&&Fx(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}),Yc&&wd(Yc,r)||(Yc=r,r=Ap(R2,"onSelect"),0<r.length&&(e=new Lx("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=jl)))}function Ef(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var zl={animationend:Ef("Animation","AnimationEnd"),animationiteration:Ef("Animation","AnimationIteration"),animationstart:Ef("Animation","AnimationStart"),transitionend:Ef("Transition","TransitionEnd")},ny={},lE={};ps&&(lE=document.createElement("div").style,"AnimationEvent"in window||(delete zl.animationend.animation,delete zl.animationiteration.animation,delete zl.animationstart.animation),"TransitionEvent"in window||delete zl.transitionend.transition);function Zm(t){if(ny[t])return ny[t];if(!zl[t])return t;var e=zl[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in lE)return ny[t]=e[n];return t}var uE=Zm("animationend"),cE=Zm("animationiteration"),dE=Zm("animationstart"),hE=Zm("transitionend"),fE=new Map,q4="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 Ao(t,e){fE.set(t,e),Qa(e,[t])}for(var ry=0;ry<q4.length;ry++){var iy=q4[ry],wO=iy.toLowerCase(),kO=iy[0].toUpperCase()+iy.slice(1);Ao(wO,"on"+kO)}Ao(uE,"onAnimationEnd");Ao(cE,"onAnimationIteration");Ao(dE,"onAnimationStart");Ao("dblclick","onDoubleClick");Ao("focusin","onFocus");Ao("focusout","onBlur");Ao(hE,"onTransitionEnd");mu("onMouseEnter",["mouseout","mouseover"]);mu("onMouseLeave",["mouseout","mouseover"]);mu("onPointerEnter",["pointerout","pointerover"]);mu("onPointerLeave",["pointerout","pointerover"]);Qa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Qa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Qa("onBeforeInput",["compositionend","keypress","textInput","paste"]);Qa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Qa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Qa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Dc="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(" "),CO=new Set("cancel close invalid load scroll toggle".split(" ").concat(Dc));function Q4(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,wP(r,e,void 0,t),t.currentTarget=null}function pE(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],i=r.event;r=r.listeners;e:{var s=void 0;if(e)for(var o=r.length-1;0<=o;o--){var a=r[o],l=a.instance,d=a.currentTarget;if(a=a.listener,l!==s&&i.isPropagationStopped())break e;Q4(i,a,d),s=l}else for(o=0;o<r.length;o++){if(a=r[o],l=a.instance,d=a.currentTarget,a=a.listener,l!==s&&i.isPropagationStopped())break e;Q4(i,a,d),s=l}}}if(Np)throw t=M2,Np=!1,M2=null,t}function lt(t,e){var n=e[z2];n===void 0&&(n=e[z2]=new Set);var r=t+"__bubble";n.has(r)||(mE(e,t,2,!1),n.add(r))}function sy(t,e,n){var r=0;e&&(r|=4),mE(n,t,r,e)}var _f="_reactListening"+Math.random().toString(36).slice(2);function kd(t){if(!t[_f]){t[_f]=!0,k6.forEach(function(n){n!=="selectionchange"&&(CO.has(n)||sy(n,!1,t),sy(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[_f]||(e[_f]=!0,sy("selectionchange",!1,e))}}function mE(t,e,n,r){switch(X6(e)){case 1:var i=FP;break;case 4:i=jP;break;default:i=Ax}n=i.bind(null,e,n,t),i=void 0,!T2||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(i=!0),r?i!==void 0?t.addEventListener(e,n,{capture:!0,passive:i}):t.addEventListener(e,n,!0):i!==void 0?t.addEventListener(e,n,{passive:i}):t.addEventListener(e,n,!1)}function oy(t,e,n,r,i){var s=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;if(a===i||a.nodeType===8&&a.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===i||l.nodeType===8&&l.parentNode===i))return;o=o.return}for(;a!==null;){if(o=la(a),o===null)return;if(l=o.tag,l===5||l===6){r=s=o;continue e}a=a.parentNode}}r=r.return}j6(function(){var d=s,h=Tx(n),f=[];e:{var p=fE.get(t);if(p!==void 0){var y=Lx,g=t;switch(t){case"keypress":if(sp(n)===0)break e;case"keydown":case"keyup":y=ZP;break;case"focusin":g="focus",y=Z1;break;case"focusout":g="blur",y=Z1;break;case"beforeblur":case"afterblur":y=Z1;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":y=F4;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":y=UP;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":y=nO;break;case uE:case cE:case dE:y=GP;break;case hE:y=iO;break;case"scroll":y=zP;break;case"wheel":y=oO;break;case"copy":case"cut":case"paste":y=WP;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":y=z4}var x=(e&4)!==0,S=!x&&t==="scroll",C=x?p!==null?p+"Capture":null:p;x=[];for(var E=d,w;E!==null;){w=E;var b=w.stateNode;if(w.tag===5&&b!==null&&(w=b,C!==null&&(b=gd(E,C),b!=null&&x.push(Cd(E,b,w)))),S)break;E=E.return}0<x.length&&(p=new y(p,g,null,n,h),f.push({event:p,listeners:x}))}}if(!(e&7)){e:{if(p=t==="mouseover"||t==="pointerover",y=t==="mouseout"||t==="pointerout",p&&n!==_2&&(g=n.relatedTarget||n.fromElement)&&(la(g)||g[ms]))break e;if((y||p)&&(p=h.window===h?h:(p=h.ownerDocument)?p.defaultView||p.parentWindow:window,y?(g=n.relatedTarget||n.toElement,y=d,g=g?la(g):null,g!==null&&(S=Ya(g),g!==S||g.tag!==5&&g.tag!==6)&&(g=null)):(y=null,g=d),y!==g)){if(x=F4,b="onMouseLeave",C="onMouseEnter",E="mouse",(t==="pointerout"||t==="pointerover")&&(x=z4,b="onPointerLeave",C="onPointerEnter",E="pointer"),S=y==null?p:Bl(y),w=g==null?p:Bl(g),p=new x(b,E+"leave",y,n,h),p.target=S,p.relatedTarget=w,b=null,la(h)===d&&(x=new x(C,E+"enter",g,n,h),x.target=w,x.relatedTarget=S,b=x),S=b,y&&g)t:{for(x=y,C=g,E=0,w=x;w;w=Cl(w))E++;for(w=0,b=C;b;b=Cl(b))w++;for(;0<E-w;)x=Cl(x),E--;for(;0<w-E;)C=Cl(C),w--;for(;E--;){if(x===C||C!==null&&x===C.alternate)break t;x=Cl(x),C=Cl(C)}x=null}else x=null;y!==null&&Y4(f,p,y,x,!1),g!==null&&S!==null&&Y4(f,S,g,x,!0)}}e:{if(p=d?Bl(d):window,y=p.nodeName&&p.nodeName.toLowerCase(),y==="select"||y==="input"&&p.type==="file")var T=fO;else if(H4(p))if(iE)T=yO;else{T=mO;var P=pO}else(y=p.nodeName)&&y.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(T=gO);if(T&&(T=T(t,d))){rE(f,T,n,h);break e}P&&P(t,p,d),t==="focusout"&&(P=p._wrapperState)&&P.controlled&&p.type==="number"&&w2(p,"number",p.value)}switch(P=d?Bl(d):window,t){case"focusin":(H4(P)||P.contentEditable==="true")&&(jl=P,R2=d,Yc=null);break;case"focusout":Yc=R2=jl=null;break;case"mousedown":L2=!0;break;case"contextmenu":case"mouseup":case"dragend":L2=!1,K4(f,n,h);break;case"selectionchange":if(SO)break;case"keydown":case"keyup":K4(f,n,h)}var A;if(Dx)e:{switch(t){case"compositionstart":var M="onCompositionStart";break e;case"compositionend":M="onCompositionEnd";break e;case"compositionupdate":M="onCompositionUpdate";break e}M=void 0}else Fl?tE(t,n)&&(M="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(M="onCompositionStart");M&&(eE&&n.locale!=="ko"&&(Fl||M!=="onCompositionStart"?M==="onCompositionEnd"&&Fl&&(A=Z6()):(ao=h,Rx="value"in ao?ao.value:ao.textContent,Fl=!0)),P=Ap(d,M),0<P.length&&(M=new j4(M,t,null,n,h),f.push({event:M,listeners:P}),A?M.data=A:(A=nE(n),A!==null&&(M.data=A)))),(A=lO?uO(t,n):cO(t,n))&&(d=Ap(d,"onBeforeInput"),0<d.length&&(h=new j4("onBeforeInput","beforeinput",null,n,h),f.push({event:h,listeners:d}),h.data=A))}pE(f,e)})}function Cd(t,e,n){return{instance:t,listener:e,currentTarget:n}}function Ap(t,e){for(var n=e+"Capture",r=[];t!==null;){var i=t,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=gd(t,n),s!=null&&r.unshift(Cd(t,s,i)),s=gd(t,e),s!=null&&r.push(Cd(t,s,i))),t=t.return}return r}function Cl(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Y4(t,e,n,r,i){for(var s=e._reactName,o=[];n!==null&&n!==r;){var a=n,l=a.alternate,d=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&d!==null&&(a=d,i?(l=gd(n,s),l!=null&&o.unshift(Cd(n,l,a))):i||(l=gd(n,s),l!=null&&o.push(Cd(n,l,a)))),n=n.return}o.length!==0&&t.push({event:e,listeners:o})}var bO=/\r\n?/g,EO=/\u0000|\uFFFD/g;function J4(t){return(typeof t=="string"?t:""+t).replace(bO,`
`).replace(EO,"")}function Nf(t,e,n){if(e=J4(e),J4(t)!==e&&n)throw Error(ee(425))}function Rp(){}var I2=null,D2=null;function F2(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var j2=typeof setTimeout=="function"?setTimeout:void 0,_O=typeof clearTimeout=="function"?clearTimeout:void 0,X4=typeof Promise=="function"?Promise:void 0,NO=typeof queueMicrotask=="function"?queueMicrotask:typeof X4<"u"?function(t){return X4.resolve(null).then(t).catch(TO)}:j2;function TO(t){setTimeout(function(){throw t})}function ay(t,e){var n=e,r=0;do{var i=n.nextSibling;if(t.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){t.removeChild(i),xd(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);xd(e)}function yo(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function Z4(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var Du=Math.random().toString(36).slice(2),Mi="__reactFiber$"+Du,bd="__reactProps$"+Du,ms="__reactContainer$"+Du,z2="__reactEvents$"+Du,MO="__reactListeners$"+Du,PO="__reactHandles$"+Du;function la(t){var e=t[Mi];if(e)return e;for(var n=t.parentNode;n;){if(e=n[ms]||n[Mi]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=Z4(t);t!==null;){if(n=t[Mi])return n;t=Z4(t)}return e}t=n,n=t.parentNode}return null}function oh(t){return t=t[Mi]||t[ms],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Bl(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(ee(33))}function eg(t){return t[bd]||null}var B2=[],Ul=-1;function Ro(t){return{current:t}}function dt(t){0>Ul||(t.current=B2[Ul],B2[Ul]=null,Ul--)}function nt(t,e){Ul++,B2[Ul]=t.current,t.current=e}var To={},Mn=Ro(To),tr=Ro(!1),Ia=To;function gu(t,e){var n=t.type.contextTypes;if(!n)return To;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=e[s];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function nr(t){return t=t.childContextTypes,t!=null}function Lp(){dt(tr),dt(Mn)}function ek(t,e,n){if(Mn.current!==To)throw Error(ee(168));nt(Mn,e),nt(tr,n)}function gE(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(ee(108,pP(t)||"Unknown",i));return Ct({},n,r)}function Ip(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||To,Ia=Mn.current,nt(Mn,t),nt(tr,tr.current),!0}function tk(t,e,n){var r=t.stateNode;if(!r)throw Error(ee(169));n?(t=gE(t,e,Ia),r.__reactInternalMemoizedMergedChildContext=t,dt(tr),dt(Mn),nt(Mn,t)):dt(tr),nt(tr,n)}var es=null,tg=!1,ly=!1;function yE(t){es===null?es=[t]:es.push(t)}function OO(t){tg=!0,yE(t)}function Lo(){if(!ly&&es!==null){ly=!0;var t=0,e=qe;try{var n=es;for(qe=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}es=null,tg=!1}catch(i){throw es!==null&&(es=es.slice(t+1)),H6(Mx,Lo),i}finally{qe=e,ly=!1}}return null}var Hl=[],Vl=0,Dp=null,Fp=0,Ir=[],Dr=0,Da=null,ss=1,as="";function ia(t,e){Hl[Vl++]=Fp,Hl[Vl++]=Dp,Dp=t,Fp=e}function vE(t,e,n){Ir[Dr++]=ss,Ir[Dr++]=as,Ir[Dr++]=Da,Da=t;var r=ss;t=as;var i=32-si(r)-1;r&=~(1<<i),n+=1;var s=32-si(e)+i;if(30<s){var o=i-i%5;s=(r&(1<<o)-1).toString(32),r>>=o,i-=o,ss=1<<32-si(e)+i|n<<i|r,as=s+t}else ss=1<<s|n<<i|r,as=t}function jx(t){t.return!==null&&(ia(t,1),vE(t,1,0))}function zx(t){for(;t===Dp;)Dp=Hl[--Vl],Hl[Vl]=null,Fp=Hl[--Vl],Hl[Vl]=null;for(;t===Da;)Da=Ir[--Dr],Ir[Dr]=null,as=Ir[--Dr],Ir[Dr]=null,ss=Ir[--Dr],Ir[Dr]=null}var pr=null,fr=null,pt=!1,ni=null;function xE(t,e){var n=jr(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function nk(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,pr=t,fr=yo(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,pr=t,fr=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=Da!==null?{id:ss,overflow:as}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=jr(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,pr=t,fr=null,!0):!1;default:return!1}}function U2(t){return(t.mode&1)!==0&&(t.flags&128)===0}function H2(t){if(pt){var e=fr;if(e){var n=e;if(!nk(t,e)){if(U2(t))throw Error(ee(418));e=yo(n.nextSibling);var r=pr;e&&nk(t,e)?xE(r,n):(t.flags=t.flags&-4097|2,pt=!1,pr=t)}}else{if(U2(t))throw Error(ee(418));t.flags=t.flags&-4097|2,pt=!1,pr=t}}}function rk(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;pr=t}function Tf(t){if(t!==pr)return!1;if(!pt)return rk(t),pt=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!F2(t.type,t.memoizedProps)),e&&(e=fr)){if(U2(t))throw SE(),Error(ee(418));for(;e;)xE(t,e),e=yo(e.nextSibling)}if(rk(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(ee(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){fr=yo(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}fr=null}}else fr=pr?yo(t.stateNode.nextSibling):null;return!0}function SE(){for(var t=fr;t;)t=yo(t.nextSibling)}function yu(){fr=pr=null,pt=!1}function Bx(t){ni===null?ni=[t]:ni.push(t)}var AO=vs.ReactCurrentBatchConfig;function wc(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(ee(309));var r=n.stateNode}if(!r)throw Error(ee(147,t));var i=r,s=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===s?e.ref:(e=function(o){var a=i.refs;o===null?delete a[s]:a[s]=o},e._stringRef=s,e)}if(typeof t!="string")throw Error(ee(284));if(!n._owner)throw Error(ee(290,t))}return t}function Mf(t,e){throw t=Object.prototype.toString.call(e),Error(ee(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function ik(t){var e=t._init;return e(t._payload)}function wE(t){function e(C,E){if(t){var w=C.deletions;w===null?(C.deletions=[E],C.flags|=16):w.push(E)}}function n(C,E){if(!t)return null;for(;E!==null;)e(C,E),E=E.sibling;return null}function r(C,E){for(C=new Map;E!==null;)E.key!==null?C.set(E.key,E):C.set(E.index,E),E=E.sibling;return C}function i(C,E){return C=wo(C,E),C.index=0,C.sibling=null,C}function s(C,E,w){return C.index=w,t?(w=C.alternate,w!==null?(w=w.index,w<E?(C.flags|=2,E):w):(C.flags|=2,E)):(C.flags|=1048576,E)}function o(C){return t&&C.alternate===null&&(C.flags|=2),C}function a(C,E,w,b){return E===null||E.tag!==6?(E=my(w,C.mode,b),E.return=C,E):(E=i(E,w),E.return=C,E)}function l(C,E,w,b){var T=w.type;return T===Dl?h(C,E,w.props.children,b,w.key):E!==null&&(E.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Vs&&ik(T)===E.type)?(b=i(E,w.props),b.ref=wc(C,E,w),b.return=C,b):(b=hp(w.type,w.key,w.props,null,C.mode,b),b.ref=wc(C,E,w),b.return=C,b)}function d(C,E,w,b){return E===null||E.tag!==4||E.stateNode.containerInfo!==w.containerInfo||E.stateNode.implementation!==w.implementation?(E=gy(w,C.mode,b),E.return=C,E):(E=i(E,w.children||[]),E.return=C,E)}function h(C,E,w,b,T){return E===null||E.tag!==7?(E=Na(w,C.mode,b,T),E.return=C,E):(E=i(E,w),E.return=C,E)}function f(C,E,w){if(typeof E=="string"&&E!==""||typeof E=="number")return E=my(""+E,C.mode,w),E.return=C,E;if(typeof E=="object"&&E!==null){switch(E.$$typeof){case vf:return w=hp(E.type,E.key,E.props,null,C.mode,w),w.ref=wc(C,null,E),w.return=C,w;case Il:return E=gy(E,C.mode,w),E.return=C,E;case Vs:var b=E._init;return f(C,b(E._payload),w)}if(Lc(E)||gc(E))return E=Na(E,C.mode,w,null),E.return=C,E;Mf(C,E)}return null}function p(C,E,w,b){var T=E!==null?E.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return T!==null?null:a(C,E,""+w,b);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case vf:return w.key===T?l(C,E,w,b):null;case Il:return w.key===T?d(C,E,w,b):null;case Vs:return T=w._init,p(C,E,T(w._payload),b)}if(Lc(w)||gc(w))return T!==null?null:h(C,E,w,b,null);Mf(C,w)}return null}function y(C,E,w,b,T){if(typeof b=="string"&&b!==""||typeof b=="number")return C=C.get(w)||null,a(E,C,""+b,T);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case vf:return C=C.get(b.key===null?w:b.key)||null,l(E,C,b,T);case Il:return C=C.get(b.key===null?w:b.key)||null,d(E,C,b,T);case Vs:var P=b._init;return y(C,E,w,P(b._payload),T)}if(Lc(b)||gc(b))return C=C.get(w)||null,h(E,C,b,T,null);Mf(E,b)}return null}function g(C,E,w,b){for(var T=null,P=null,A=E,M=E=0,I=null;A!==null&&M<w.length;M++){A.index>M?(I=A,A=null):I=A.sibling;var R=p(C,A,w[M],b);if(R===null){A===null&&(A=I);break}t&&A&&R.alternate===null&&e(C,A),E=s(R,E,M),P===null?T=R:P.sibling=R,P=R,A=I}if(M===w.length)return n(C,A),pt&&ia(C,M),T;if(A===null){for(;M<w.length;M++)A=f(C,w[M],b),A!==null&&(E=s(A,E,M),P===null?T=A:P.sibling=A,P=A);return pt&&ia(C,M),T}for(A=r(C,A);M<w.length;M++)I=y(A,C,M,w[M],b),I!==null&&(t&&I.alternate!==null&&A.delete(I.key===null?M:I.key),E=s(I,E,M),P===null?T=I:P.sibling=I,P=I);return t&&A.forEach(function(U){return e(C,U)}),pt&&ia(C,M),T}function x(C,E,w,b){var T=gc(w);if(typeof T!="function")throw Error(ee(150));if(w=T.call(w),w==null)throw Error(ee(151));for(var P=T=null,A=E,M=E=0,I=null,R=w.next();A!==null&&!R.done;M++,R=w.next()){A.index>M?(I=A,A=null):I=A.sibling;var U=p(C,A,R.value,b);if(U===null){A===null&&(A=I);break}t&&A&&U.alternate===null&&e(C,A),E=s(U,E,M),P===null?T=U:P.sibling=U,P=U,A=I}if(R.done)return n(C,A),pt&&ia(C,M),T;if(A===null){for(;!R.done;M++,R=w.next())R=f(C,R.value,b),R!==null&&(E=s(R,E,M),P===null?T=R:P.sibling=R,P=R);return pt&&ia(C,M),T}for(A=r(C,A);!R.done;M++,R=w.next())R=y(A,C,M,R.value,b),R!==null&&(t&&R.alternate!==null&&A.delete(R.key===null?M:R.key),E=s(R,E,M),P===null?T=R:P.sibling=R,P=R);return t&&A.forEach(function(B){return e(C,B)}),pt&&ia(C,M),T}function S(C,E,w,b){if(typeof w=="object"&&w!==null&&w.type===Dl&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case vf:e:{for(var T=w.key,P=E;P!==null;){if(P.key===T){if(T=w.type,T===Dl){if(P.tag===7){n(C,P.sibling),E=i(P,w.props.children),E.return=C,C=E;break e}}else if(P.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Vs&&ik(T)===P.type){n(C,P.sibling),E=i(P,w.props),E.ref=wc(C,P,w),E.return=C,C=E;break e}n(C,P);break}else e(C,P);P=P.sibling}w.type===Dl?(E=Na(w.props.children,C.mode,b,w.key),E.return=C,C=E):(b=hp(w.type,w.key,w.props,null,C.mode,b),b.ref=wc(C,E,w),b.return=C,C=b)}return o(C);case Il:e:{for(P=w.key;E!==null;){if(E.key===P)if(E.tag===4&&E.stateNode.containerInfo===w.containerInfo&&E.stateNode.implementation===w.implementation){n(C,E.sibling),E=i(E,w.children||[]),E.return=C,C=E;break e}else{n(C,E);break}else e(C,E);E=E.sibling}E=gy(w,C.mode,b),E.return=C,C=E}return o(C);case Vs:return P=w._init,S(C,E,P(w._payload),b)}if(Lc(w))return g(C,E,w,b);if(gc(w))return x(C,E,w,b);Mf(C,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,E!==null&&E.tag===6?(n(C,E.sibling),E=i(E,w),E.return=C,C=E):(n(C,E),E=my(w,C.mode,b),E.return=C,C=E),o(C)):n(C,E)}return S}var vu=wE(!0),kE=wE(!1),jp=Ro(null),zp=null,Gl=null,Ux=null;function Hx(){Ux=Gl=zp=null}function Vx(t){var e=jp.current;dt(jp),t._currentValue=e}function V2(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function Xl(t,e){zp=t,Ux=Gl=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(er=!0),t.firstContext=null)}function Hr(t){var e=t._currentValue;if(Ux!==t)if(t={context:t,memoizedValue:e,next:null},Gl===null){if(zp===null)throw Error(ee(308));Gl=t,zp.dependencies={lanes:0,firstContext:t}}else Gl=Gl.next=t;return e}var ua=null;function Gx(t){ua===null?ua=[t]:ua.push(t)}function CE(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,Gx(e)):(n.next=i.next,i.next=n),e.interleaved=n,gs(t,r)}function gs(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Gs=!1;function $x(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function bE(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function us(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function vo(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,Be&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,gs(t,n)}return i=r.interleaved,i===null?(e.next=e,Gx(r)):(e.next=i.next,i.next=e),r.interleaved=e,gs(t,n)}function op(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Px(t,n)}}function sk(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=e:s=s.next=e}else i=s=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function Bp(t,e,n,r){var i=t.updateQueue;Gs=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,d=l.next;l.next=null,o===null?s=d:o.next=d,o=l;var h=t.alternate;h!==null&&(h=h.updateQueue,a=h.lastBaseUpdate,a!==o&&(a===null?h.firstBaseUpdate=d:a.next=d,h.lastBaseUpdate=l))}if(s!==null){var f=i.baseState;o=0,h=d=l=null,a=s;do{var p=a.lane,y=a.eventTime;if((r&p)===p){h!==null&&(h=h.next={eventTime:y,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var g=t,x=a;switch(p=e,y=n,x.tag){case 1:if(g=x.payload,typeof g=="function"){f=g.call(y,f,p);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=x.payload,p=typeof g=="function"?g.call(y,f,p):g,p==null)break e;f=Ct({},f,p);break e;case 2:Gs=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,p=i.effects,p===null?i.effects=[a]:p.push(a))}else y={eventTime:y,lane:p,tag:a.tag,payload:a.payload,callback:a.callback,next:null},h===null?(d=h=y,l=f):h=h.next=y,o|=p;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;p=a,a=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);if(h===null&&(l=f),i.baseState=l,i.firstBaseUpdate=d,i.lastBaseUpdate=h,e=i.shared.interleaved,e!==null){i=e;do o|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);ja|=o,t.lanes=o,t.memoizedState=f}}function ok(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(ee(191,i));i.call(r)}}}var ah={},Ri=Ro(ah),Ed=Ro(ah),_d=Ro(ah);function ca(t){if(t===ah)throw Error(ee(174));return t}function Wx(t,e){switch(nt(_d,e),nt(Ed,t),nt(Ri,ah),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:C2(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=C2(e,t)}dt(Ri),nt(Ri,e)}function xu(){dt(Ri),dt(Ed),dt(_d)}function EE(t){ca(_d.current);var e=ca(Ri.current),n=C2(e,t.type);e!==n&&(nt(Ed,t),nt(Ri,n))}function Kx(t){Ed.current===t&&(dt(Ri),dt(Ed))}var St=Ro(0);function Up(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var uy=[];function qx(){for(var t=0;t<uy.length;t++)uy[t]._workInProgressVersionPrimary=null;uy.length=0}var ap=vs.ReactCurrentDispatcher,cy=vs.ReactCurrentBatchConfig,Fa=0,kt=null,$t=null,rn=null,Hp=!1,Jc=!1,Nd=0,RO=0;function kn(){throw Error(ee(321))}function Qx(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!ui(t[n],e[n]))return!1;return!0}function Yx(t,e,n,r,i,s){if(Fa=s,kt=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,ap.current=t===null||t.memoizedState===null?FO:jO,t=n(r,i),Jc){s=0;do{if(Jc=!1,Nd=0,25<=s)throw Error(ee(301));s+=1,rn=$t=null,e.updateQueue=null,ap.current=zO,t=n(r,i)}while(Jc)}if(ap.current=Vp,e=$t!==null&&$t.next!==null,Fa=0,rn=$t=kt=null,Hp=!1,e)throw Error(ee(300));return t}function Jx(){var t=Nd!==0;return Nd=0,t}function ki(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return rn===null?kt.memoizedState=rn=t:rn=rn.next=t,rn}function Vr(){if($t===null){var t=kt.alternate;t=t!==null?t.memoizedState:null}else t=$t.next;var e=rn===null?kt.memoizedState:rn.next;if(e!==null)rn=e,$t=t;else{if(t===null)throw Error(ee(310));$t=t,t={memoizedState:$t.memoizedState,baseState:$t.baseState,baseQueue:$t.baseQueue,queue:$t.queue,next:null},rn===null?kt.memoizedState=rn=t:rn=rn.next=t}return rn}function Td(t,e){return typeof e=="function"?e(t):e}function dy(t){var e=Vr(),n=e.queue;if(n===null)throw Error(ee(311));n.lastRenderedReducer=t;var r=$t,i=r.baseQueue,s=n.pending;if(s!==null){if(i!==null){var o=i.next;i.next=s.next,s.next=o}r.baseQueue=i=s,n.pending=null}if(i!==null){s=i.next,r=r.baseState;var a=o=null,l=null,d=s;do{var h=d.lane;if((Fa&h)===h)l!==null&&(l=l.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),r=d.hasEagerState?d.eagerState:t(r,d.action);else{var f={lane:h,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};l===null?(a=l=f,o=r):l=l.next=f,kt.lanes|=h,ja|=h}d=d.next}while(d!==null&&d!==s);l===null?o=r:l.next=a,ui(r,e.memoizedState)||(er=!0),e.memoizedState=r,e.baseState=o,e.baseQueue=l,n.lastRenderedState=r}if(t=n.interleaved,t!==null){i=t;do s=i.lane,kt.lanes|=s,ja|=s,i=i.next;while(i!==t)}else i===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function hy(t){var e=Vr(),n=e.queue;if(n===null)throw Error(ee(311));n.lastRenderedReducer=t;var r=n.dispatch,i=n.pending,s=e.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do s=t(s,o.action),o=o.next;while(o!==i);ui(s,e.memoizedState)||(er=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),n.lastRenderedState=s}return[s,r]}function _E(){}function NE(t,e){var n=kt,r=Vr(),i=e(),s=!ui(r.memoizedState,i);if(s&&(r.memoizedState=i,er=!0),r=r.queue,Xx(PE.bind(null,n,r,t),[t]),r.getSnapshot!==e||s||rn!==null&&rn.memoizedState.tag&1){if(n.flags|=2048,Md(9,ME.bind(null,n,r,i,e),void 0,null),sn===null)throw Error(ee(349));Fa&30||TE(n,e,i)}return i}function TE(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=kt.updateQueue,e===null?(e={lastEffect:null,stores:null},kt.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function ME(t,e,n,r){e.value=n,e.getSnapshot=r,OE(e)&&AE(t)}function PE(t,e,n){return n(function(){OE(e)&&AE(t)})}function OE(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!ui(t,n)}catch{return!0}}function AE(t){var e=gs(t,1);e!==null&&oi(e,t,1,-1)}function ak(t){var e=ki();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Td,lastRenderedState:t},e.queue=t,t=t.dispatch=DO.bind(null,kt,t),[e.memoizedState,t]}function Md(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=kt.updateQueue,e===null?(e={lastEffect:null,stores:null},kt.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function RE(){return Vr().memoizedState}function lp(t,e,n,r){var i=ki();kt.flags|=t,i.memoizedState=Md(1|e,n,void 0,r===void 0?null:r)}function ng(t,e,n,r){var i=Vr();r=r===void 0?null:r;var s=void 0;if($t!==null){var o=$t.memoizedState;if(s=o.destroy,r!==null&&Qx(r,o.deps)){i.memoizedState=Md(e,n,s,r);return}}kt.flags|=t,i.memoizedState=Md(1|e,n,s,r)}function lk(t,e){return lp(8390656,8,t,e)}function Xx(t,e){return ng(2048,8,t,e)}function LE(t,e){return ng(4,2,t,e)}function IE(t,e){return ng(4,4,t,e)}function DE(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function FE(t,e,n){return n=n!=null?n.concat([t]):null,ng(4,4,DE.bind(null,e,t),n)}function Zx(){}function jE(t,e){var n=Vr();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Qx(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function zE(t,e){var n=Vr();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Qx(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function BE(t,e,n){return Fa&21?(ui(n,e)||(n=$6(),kt.lanes|=n,ja|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,er=!0),t.memoizedState=n)}function LO(t,e){var n=qe;qe=n!==0&&4>n?n:4,t(!0);var r=cy.transition;cy.transition={};try{t(!1),e()}finally{qe=n,cy.transition=r}}function UE(){return Vr().memoizedState}function IO(t,e,n){var r=So(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},HE(t))VE(e,n);else if(n=CE(t,e,n,r),n!==null){var i=jn();oi(n,t,r,i),GE(n,e,r)}}function DO(t,e,n){var r=So(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(HE(t))VE(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,n);if(i.hasEagerState=!0,i.eagerState=a,ui(a,o)){var l=e.interleaved;l===null?(i.next=i,Gx(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}n=CE(t,e,i,r),n!==null&&(i=jn(),oi(n,t,r,i),GE(n,e,r))}}function HE(t){var e=t.alternate;return t===kt||e!==null&&e===kt}function VE(t,e){Jc=Hp=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function GE(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Px(t,n)}}var Vp={readContext:Hr,useCallback:kn,useContext:kn,useEffect:kn,useImperativeHandle:kn,useInsertionEffect:kn,useLayoutEffect:kn,useMemo:kn,useReducer:kn,useRef:kn,useState:kn,useDebugValue:kn,useDeferredValue:kn,useTransition:kn,useMutableSource:kn,useSyncExternalStore:kn,useId:kn,unstable_isNewReconciler:!1},FO={readContext:Hr,useCallback:function(t,e){return ki().memoizedState=[t,e===void 0?null:e],t},useContext:Hr,useEffect:lk,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,lp(4194308,4,DE.bind(null,e,t),n)},useLayoutEffect:function(t,e){return lp(4194308,4,t,e)},useInsertionEffect:function(t,e){return lp(4,2,t,e)},useMemo:function(t,e){var n=ki();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=ki();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=IO.bind(null,kt,t),[r.memoizedState,t]},useRef:function(t){var e=ki();return t={current:t},e.memoizedState=t},useState:ak,useDebugValue:Zx,useDeferredValue:function(t){return ki().memoizedState=t},useTransition:function(){var t=ak(!1),e=t[0];return t=LO.bind(null,t[1]),ki().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=kt,i=ki();if(pt){if(n===void 0)throw Error(ee(407));n=n()}else{if(n=e(),sn===null)throw Error(ee(349));Fa&30||TE(r,e,n)}i.memoizedState=n;var s={value:n,getSnapshot:e};return i.queue=s,lk(PE.bind(null,r,s,t),[t]),r.flags|=2048,Md(9,ME.bind(null,r,s,n,e),void 0,null),n},useId:function(){var t=ki(),e=sn.identifierPrefix;if(pt){var n=as,r=ss;n=(r&~(1<<32-si(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Nd++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=RO++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},jO={readContext:Hr,useCallback:jE,useContext:Hr,useEffect:Xx,useImperativeHandle:FE,useInsertionEffect:LE,useLayoutEffect:IE,useMemo:zE,useReducer:dy,useRef:RE,useState:function(){return dy(Td)},useDebugValue:Zx,useDeferredValue:function(t){var e=Vr();return BE(e,$t.memoizedState,t)},useTransition:function(){var t=dy(Td)[0],e=Vr().memoizedState;return[t,e]},useMutableSource:_E,useSyncExternalStore:NE,useId:UE,unstable_isNewReconciler:!1},zO={readContext:Hr,useCallback:jE,useContext:Hr,useEffect:Xx,useImperativeHandle:FE,useInsertionEffect:LE,useLayoutEffect:IE,useMemo:zE,useReducer:hy,useRef:RE,useState:function(){return hy(Td)},useDebugValue:Zx,useDeferredValue:function(t){var e=Vr();return $t===null?e.memoizedState=t:BE(e,$t.memoizedState,t)},useTransition:function(){var t=hy(Td)[0],e=Vr().memoizedState;return[t,e]},useMutableSource:_E,useSyncExternalStore:NE,useId:UE,unstable_isNewReconciler:!1};function Zr(t,e){if(t&&t.defaultProps){e=Ct({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function G2(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:Ct({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var rg={isMounted:function(t){return(t=t._reactInternals)?Ya(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=jn(),i=So(t),s=us(r,i);s.payload=e,n!=null&&(s.callback=n),e=vo(t,s,i),e!==null&&(oi(e,t,i,r),op(e,t,i))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=jn(),i=So(t),s=us(r,i);s.tag=1,s.payload=e,n!=null&&(s.callback=n),e=vo(t,s,i),e!==null&&(oi(e,t,i,r),op(e,t,i))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=jn(),r=So(t),i=us(n,r);i.tag=2,e!=null&&(i.callback=e),e=vo(t,i,r),e!==null&&(oi(e,t,r,n),op(e,t,r))}};function uk(t,e,n,r,i,s,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,s,o):e.prototype&&e.prototype.isPureReactComponent?!wd(n,r)||!wd(i,s):!0}function $E(t,e,n){var r=!1,i=To,s=e.contextType;return typeof s=="object"&&s!==null?s=Hr(s):(i=nr(e)?Ia:Mn.current,r=e.contextTypes,s=(r=r!=null)?gu(t,i):To),e=new e(n,s),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=rg,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=i,t.__reactInternalMemoizedMaskedChildContext=s),e}function ck(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&rg.enqueueReplaceState(e,e.state,null)}function $2(t,e,n,r){var i=t.stateNode;i.props=n,i.state=t.memoizedState,i.refs={},$x(t);var s=e.contextType;typeof s=="object"&&s!==null?i.context=Hr(s):(s=nr(e)?Ia:Mn.current,i.context=gu(t,s)),i.state=t.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(G2(t,e,s,n),i.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(e=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),e!==i.state&&rg.enqueueReplaceState(i,i.state,null),Bp(t,n,i,r),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308)}function Su(t,e){try{var n="",r=e;do n+=fP(r),r=r.return;while(r);var i=n}catch(s){i=`
Error generating stack: `+s.message+`
`+s.stack}return{value:t,source:e,stack:i,digest:null}}function fy(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function W2(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var BO=typeof WeakMap=="function"?WeakMap:Map;function WE(t,e,n){n=us(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){$p||($p=!0,nv=r),W2(t,e)},n}function KE(t,e,n){n=us(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var i=e.value;n.payload=function(){return r(i)},n.callback=function(){W2(t,e)}}var s=t.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){W2(t,e),typeof r!="function"&&(xo===null?xo=new Set([this]):xo.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),n}function dk(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new BO;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(n)||(i.add(n),t=eA.bind(null,t,e,n),e.then(t,t))}function hk(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function fk(t,e,n,r,i){return t.mode&1?(t.flags|=65536,t.lanes=i,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=us(-1,1),e.tag=2,vo(n,e,1))),n.lanes|=1),t)}var UO=vs.ReactCurrentOwner,er=!1;function In(t,e,n,r){e.child=t===null?kE(e,null,n,r):vu(e,t.child,n,r)}function pk(t,e,n,r,i){n=n.render;var s=e.ref;return Xl(e,i),r=Yx(t,e,n,r,s,i),n=Jx(),t!==null&&!er?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,ys(t,e,i)):(pt&&n&&jx(e),e.flags|=1,In(t,e,r,i),e.child)}function mk(t,e,n,r,i){if(t===null){var s=n.type;return typeof s=="function"&&!aS(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=s,qE(t,e,s,r,i)):(t=hp(n.type,null,r,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(s=t.child,!(t.lanes&i)){var o=s.memoizedProps;if(n=n.compare,n=n!==null?n:wd,n(o,r)&&t.ref===e.ref)return ys(t,e,i)}return e.flags|=1,t=wo(s,r),t.ref=e.ref,t.return=e,e.child=t}function qE(t,e,n,r,i){if(t!==null){var s=t.memoizedProps;if(wd(s,r)&&t.ref===e.ref)if(er=!1,e.pendingProps=r=s,(t.lanes&i)!==0)t.flags&131072&&(er=!0);else return e.lanes=t.lanes,ys(t,e,i)}return K2(t,e,n,r,i)}function QE(t,e,n){var r=e.pendingProps,i=r.children,s=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},nt(Wl,ur),ur|=n;else{if(!(n&1073741824))return t=s!==null?s.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,nt(Wl,ur),ur|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,nt(Wl,ur),ur|=r}else s!==null?(r=s.baseLanes|n,e.memoizedState=null):r=n,nt(Wl,ur),ur|=r;return In(t,e,i,n),e.child}function YE(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function K2(t,e,n,r,i){var s=nr(n)?Ia:Mn.current;return s=gu(e,s),Xl(e,i),n=Yx(t,e,n,r,s,i),r=Jx(),t!==null&&!er?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,ys(t,e,i)):(pt&&r&&jx(e),e.flags|=1,In(t,e,n,i),e.child)}function gk(t,e,n,r,i){if(nr(n)){var s=!0;Ip(e)}else s=!1;if(Xl(e,i),e.stateNode===null)up(t,e),$E(e,n,r),$2(e,n,r,i),r=!0;else if(t===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,d=n.contextType;typeof d=="object"&&d!==null?d=Hr(d):(d=nr(n)?Ia:Mn.current,d=gu(e,d));var h=n.getDerivedStateFromProps,f=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||l!==d)&&ck(e,o,r,d),Gs=!1;var p=e.memoizedState;o.state=p,Bp(e,r,o,i),l=e.memoizedState,a!==r||p!==l||tr.current||Gs?(typeof h=="function"&&(G2(e,n,h,r),l=e.memoizedState),(a=Gs||uk(e,n,a,r,p,l,d))?(f||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=l),o.props=r,o.state=l,o.context=d,r=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,bE(t,e),a=e.memoizedProps,d=e.type===e.elementType?a:Zr(e.type,a),o.props=d,f=e.pendingProps,p=o.context,l=n.contextType,typeof l=="object"&&l!==null?l=Hr(l):(l=nr(n)?Ia:Mn.current,l=gu(e,l));var y=n.getDerivedStateFromProps;(h=typeof y=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==f||p!==l)&&ck(e,o,r,l),Gs=!1,p=e.memoizedState,o.state=p,Bp(e,r,o,i);var g=e.memoizedState;a!==f||p!==g||tr.current||Gs?(typeof y=="function"&&(G2(e,n,y,r),g=e.memoizedState),(d=Gs||uk(e,n,d,r,p,g,l)||!1)?(h||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,g,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,g,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&p===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&p===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=g),o.props=r,o.state=g,o.context=l,r=d):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&p===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&p===t.memoizedState||(e.flags|=1024),r=!1)}return q2(t,e,n,r,s,i)}function q2(t,e,n,r,i,s){YE(t,e);var o=(e.flags&128)!==0;if(!r&&!o)return i&&tk(e,n,!1),ys(t,e,s);r=e.stateNode,UO.current=e;var a=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&o?(e.child=vu(e,t.child,null,s),e.child=vu(e,null,a,s)):In(t,e,a,s),e.memoizedState=r.state,i&&tk(e,n,!0),e.child}function JE(t){var e=t.stateNode;e.pendingContext?ek(t,e.pendingContext,e.pendingContext!==e.context):e.context&&ek(t,e.context,!1),Wx(t,e.containerInfo)}function yk(t,e,n,r,i){return yu(),Bx(i),e.flags|=256,In(t,e,n,r),e.child}var Q2={dehydrated:null,treeContext:null,retryLane:0};function Y2(t){return{baseLanes:t,cachePool:null,transitions:null}}function XE(t,e,n){var r=e.pendingProps,i=St.current,s=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=t!==null&&t.memoizedState===null?!1:(i&2)!==0),a?(s=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),nt(St,i&1),t===null)return H2(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=r.children,t=r.fallback,s?(r=e.mode,s=e.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=og(o,r,0,null),t=Na(t,r,n,null),s.return=e,t.return=e,s.sibling=t,e.child=s,e.child.memoizedState=Y2(n),e.memoizedState=Q2,t):eS(e,o));if(i=t.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return HO(t,e,o,r,a,i,n);if(s){s=r.fallback,o=e.mode,i=t.child,a=i.sibling;var l={mode:"hidden",children:r.children};return!(o&1)&&e.child!==i?(r=e.child,r.childLanes=0,r.pendingProps=l,e.deletions=null):(r=wo(i,l),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?s=wo(a,s):(s=Na(s,o,n,null),s.flags|=2),s.return=e,r.return=e,r.sibling=s,e.child=r,r=s,s=e.child,o=t.child.memoizedState,o=o===null?Y2(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=t.childLanes&~n,e.memoizedState=Q2,r}return s=t.child,t=s.sibling,r=wo(s,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function eS(t,e){return e=og({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Pf(t,e,n,r){return r!==null&&Bx(r),vu(e,t.child,null,n),t=eS(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function HO(t,e,n,r,i,s,o){if(n)return e.flags&256?(e.flags&=-257,r=fy(Error(ee(422))),Pf(t,e,o,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(s=r.fallback,i=e.mode,r=og({mode:"visible",children:r.children},i,0,null),s=Na(s,i,o,null),s.flags|=2,r.return=e,s.return=e,r.sibling=s,e.child=r,e.mode&1&&vu(e,t.child,null,o),e.child.memoizedState=Y2(o),e.memoizedState=Q2,s);if(!(e.mode&1))return Pf(t,e,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,s=Error(ee(419)),r=fy(s,r,void 0),Pf(t,e,o,r)}if(a=(o&t.childLanes)!==0,er||a){if(r=sn,r!==null){switch(o&-o){case 4:i=2;break;case 16:i=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:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,gs(t,i),oi(r,t,i,-1))}return oS(),r=fy(Error(ee(421))),Pf(t,e,o,r)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=tA.bind(null,t),i._reactRetry=e,null):(t=s.treeContext,fr=yo(i.nextSibling),pr=e,pt=!0,ni=null,t!==null&&(Ir[Dr++]=ss,Ir[Dr++]=as,Ir[Dr++]=Da,ss=t.id,as=t.overflow,Da=e),e=eS(e,r.children),e.flags|=4096,e)}function vk(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),V2(t.return,e,n)}function py(t,e,n,r,i){var s=t.memoizedState;s===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=i)}function ZE(t,e,n){var r=e.pendingProps,i=r.revealOrder,s=r.tail;if(In(t,e,r.children,n),r=St.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&vk(t,n,e);else if(t.tag===19)vk(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(nt(St,r),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(n=e.child,i=null;n!==null;)t=n.alternate,t!==null&&Up(t)===null&&(i=n),n=n.sibling;n=i,n===null?(i=e.child,e.child=null):(i=n.sibling,n.sibling=null),py(e,!1,i,n,s);break;case"backwards":for(n=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&Up(t)===null){e.child=i;break}t=i.sibling,i.sibling=n,n=i,i=t}py(e,!0,n,null,s);break;case"together":py(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function up(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function ys(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),ja|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(ee(153));if(e.child!==null){for(t=e.child,n=wo(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=wo(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function VO(t,e,n){switch(e.tag){case 3:JE(e),yu();break;case 5:EE(e);break;case 1:nr(e.type)&&Ip(e);break;case 4:Wx(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;nt(jp,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(nt(St,St.current&1),e.flags|=128,null):n&e.child.childLanes?XE(t,e,n):(nt(St,St.current&1),t=ys(t,e,n),t!==null?t.sibling:null);nt(St,St.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return ZE(t,e,n);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),nt(St,St.current),r)break;return null;case 22:case 23:return e.lanes=0,QE(t,e,n)}return ys(t,e,n)}var e8,J2,t8,n8;e8=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};J2=function(){};t8=function(t,e,n,r){var i=t.memoizedProps;if(i!==r){t=e.stateNode,ca(Ri.current);var s=null;switch(n){case"input":i=x2(t,i),r=x2(t,r),s=[];break;case"select":i=Ct({},i,{value:void 0}),r=Ct({},r,{value:void 0}),s=[];break;case"textarea":i=k2(t,i),r=k2(t,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=Rp)}b2(n,r);var o;n=null;for(d in i)if(!r.hasOwnProperty(d)&&i.hasOwnProperty(d)&&i[d]!=null)if(d==="style"){var a=i[d];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(pd.hasOwnProperty(d)?s||(s=[]):(s=s||[]).push(d,null));for(d in r){var l=r[d];if(a=i!=null?i[d]:void 0,r.hasOwnProperty(d)&&l!==a&&(l!=null||a!=null))if(d==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(n||(n={}),n[o]=l[o])}else n||(s||(s=[]),s.push(d,n)),n=l;else d==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(d,l)):d==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(d,""+l):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(pd.hasOwnProperty(d)?(l!=null&&d==="onScroll"&&lt("scroll",t),s||a===l||(s=[])):(s=s||[]).push(d,l))}n&&(s=s||[]).push("style",n);var d=s;(e.updateQueue=d)&&(e.flags|=4)}};n8=function(t,e,n,r){n!==r&&(e.flags|=4)};function kc(t,e){if(!pt)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function Cn(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function GO(t,e,n){var r=e.pendingProps;switch(zx(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Cn(e),null;case 1:return nr(e.type)&&Lp(),Cn(e),null;case 3:return r=e.stateNode,xu(),dt(tr),dt(Mn),qx(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Tf(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,ni!==null&&(sv(ni),ni=null))),J2(t,e),Cn(e),null;case 5:Kx(e);var i=ca(_d.current);if(n=e.type,t!==null&&e.stateNode!=null)t8(t,e,n,r,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(ee(166));return Cn(e),null}if(t=ca(Ri.current),Tf(e)){r=e.stateNode,n=e.type;var s=e.memoizedProps;switch(r[Mi]=e,r[bd]=s,t=(e.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(i=0;i<Dc.length;i++)lt(Dc[i],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":N4(r,s),lt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},lt("invalid",r);break;case"textarea":M4(r,s),lt("invalid",r)}b2(n,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?r.textContent!==a&&(s.suppressHydrationWarning!==!0&&Nf(r.textContent,a,t),i=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&Nf(r.textContent,a,t),i=["children",""+a]):pd.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&lt("scroll",r)}switch(n){case"input":xf(r),T4(r,s,!0);break;case"textarea":xf(r),P4(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=Rp)}r=i,e.updateQueue=r,r!==null&&(e.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=P6(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=o.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[Mi]=e,t[bd]=r,e8(t,e,!1,!1),e.stateNode=t;e:{switch(o=E2(n,r),n){case"dialog":lt("cancel",t),lt("close",t),i=r;break;case"iframe":case"object":case"embed":lt("load",t),i=r;break;case"video":case"audio":for(i=0;i<Dc.length;i++)lt(Dc[i],t);i=r;break;case"source":lt("error",t),i=r;break;case"img":case"image":case"link":lt("error",t),lt("load",t),i=r;break;case"details":lt("toggle",t),i=r;break;case"input":N4(t,r),i=x2(t,r),lt("invalid",t);break;case"option":i=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},i=Ct({},r,{value:void 0}),lt("invalid",t);break;case"textarea":M4(t,r),i=k2(t,r),lt("invalid",t);break;default:i=r}b2(n,i),a=i;for(s in a)if(a.hasOwnProperty(s)){var l=a[s];s==="style"?R6(t,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&O6(t,l)):s==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&md(t,l):typeof l=="number"&&md(t,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(pd.hasOwnProperty(s)?l!=null&&s==="onScroll"&&lt("scroll",t):l!=null&&bx(t,s,l,o))}switch(n){case"input":xf(t),T4(t,r,!1);break;case"textarea":xf(t),P4(t);break;case"option":r.value!=null&&t.setAttribute("value",""+No(r.value));break;case"select":t.multiple=!!r.multiple,s=r.value,s!=null?ql(t,!!r.multiple,s,!1):r.defaultValue!=null&&ql(t,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(t.onclick=Rp)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Cn(e),null;case 6:if(t&&e.stateNode!=null)n8(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(ee(166));if(n=ca(_d.current),ca(Ri.current),Tf(e)){if(r=e.stateNode,n=e.memoizedProps,r[Mi]=e,(s=r.nodeValue!==n)&&(t=pr,t!==null))switch(t.tag){case 3:Nf(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Nf(r.nodeValue,n,(t.mode&1)!==0)}s&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Mi]=e,e.stateNode=r}return Cn(e),null;case 13:if(dt(St),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(pt&&fr!==null&&e.mode&1&&!(e.flags&128))SE(),yu(),e.flags|=98560,s=!1;else if(s=Tf(e),r!==null&&r.dehydrated!==null){if(t===null){if(!s)throw Error(ee(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(ee(317));s[Mi]=e}else yu(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Cn(e),s=!1}else ni!==null&&(sv(ni),ni=null),s=!0;if(!s)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||St.current&1?Kt===0&&(Kt=3):oS())),e.updateQueue!==null&&(e.flags|=4),Cn(e),null);case 4:return xu(),J2(t,e),t===null&&kd(e.stateNode.containerInfo),Cn(e),null;case 10:return Vx(e.type._context),Cn(e),null;case 17:return nr(e.type)&&Lp(),Cn(e),null;case 19:if(dt(St),s=e.memoizedState,s===null)return Cn(e),null;if(r=(e.flags&128)!==0,o=s.rendering,o===null)if(r)kc(s,!1);else{if(Kt!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=Up(t),o!==null){for(e.flags|=128,kc(s,!1),r=o.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)s=n,t=r,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=t,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,t=o.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return nt(St,St.current&1|2),e.child}t=t.sibling}s.tail!==null&&Lt()>wu&&(e.flags|=128,r=!0,kc(s,!1),e.lanes=4194304)}else{if(!r)if(t=Up(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),kc(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!pt)return Cn(e),null}else 2*Lt()-s.renderingStartTime>wu&&n!==1073741824&&(e.flags|=128,r=!0,kc(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(n=s.last,n!==null?n.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Lt(),e.sibling=null,n=St.current,nt(St,r?n&1|2:n&1),e):(Cn(e),null);case 22:case 23:return sS(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?ur&1073741824&&(Cn(e),e.subtreeFlags&6&&(e.flags|=8192)):Cn(e),null;case 24:return null;case 25:return null}throw Error(ee(156,e.tag))}function $O(t,e){switch(zx(e),e.tag){case 1:return nr(e.type)&&Lp(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return xu(),dt(tr),dt(Mn),qx(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Kx(e),null;case 13:if(dt(St),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(ee(340));yu()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return dt(St),null;case 4:return xu(),null;case 10:return Vx(e.type._context),null;case 22:case 23:return sS(),null;case 24:return null;default:return null}}var Of=!1,Nn=!1,WO=typeof WeakSet=="function"?WeakSet:Set,de=null;function $l(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Tt(t,e,r)}else n.current=null}function X2(t,e,n){try{n()}catch(r){Tt(t,e,r)}}var xk=!1;function KO(t,e){if(I2=Pp,t=aE(),Fx(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,d=0,h=0,f=t,p=null;t:for(;;){for(var y;f!==n||i!==0&&f.nodeType!==3||(a=o+i),f!==s||r!==0&&f.nodeType!==3||(l=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(y=f.firstChild)!==null;)p=f,f=y;for(;;){if(f===t)break t;if(p===n&&++d===i&&(a=o),p===s&&++h===r&&(l=o),(y=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=y}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(D2={focusedElem:t,selectionRange:n},Pp=!1,de=e;de!==null;)if(e=de,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,de=t;else for(;de!==null;){e=de;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var x=g.memoizedProps,S=g.memoizedState,C=e.stateNode,E=C.getSnapshotBeforeUpdate(e.elementType===e.type?x:Zr(e.type,x),S);C.__reactInternalSnapshotBeforeUpdate=E}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ee(163))}}catch(b){Tt(e,e.return,b)}if(t=e.sibling,t!==null){t.return=e.return,de=t;break}de=e.return}return g=xk,xk=!1,g}function Xc(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&X2(e,n,s)}i=i.next}while(i!==r)}}function ig(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Z2(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function r8(t){var e=t.alternate;e!==null&&(t.alternate=null,r8(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Mi],delete e[bd],delete e[z2],delete e[MO],delete e[PO])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function i8(t){return t.tag===5||t.tag===3||t.tag===4}function Sk(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||i8(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function ev(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Rp));else if(r!==4&&(t=t.child,t!==null))for(ev(t,e,n),t=t.sibling;t!==null;)ev(t,e,n),t=t.sibling}function tv(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(tv(t,e,n),t=t.sibling;t!==null;)tv(t,e,n),t=t.sibling}var cn=null,ti=!1;function Fs(t,e,n){for(n=n.child;n!==null;)s8(t,e,n),n=n.sibling}function s8(t,e,n){if(Ai&&typeof Ai.onCommitFiberUnmount=="function")try{Ai.onCommitFiberUnmount(Ym,n)}catch{}switch(n.tag){case 5:Nn||$l(n,e);case 6:var r=cn,i=ti;cn=null,Fs(t,e,n),cn=r,ti=i,cn!==null&&(ti?(t=cn,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):cn.removeChild(n.stateNode));break;case 18:cn!==null&&(ti?(t=cn,n=n.stateNode,t.nodeType===8?ay(t.parentNode,n):t.nodeType===1&&ay(t,n),xd(t)):ay(cn,n.stateNode));break;case 4:r=cn,i=ti,cn=n.stateNode.containerInfo,ti=!0,Fs(t,e,n),cn=r,ti=i;break;case 0:case 11:case 14:case 15:if(!Nn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&X2(n,e,o),i=i.next}while(i!==r)}Fs(t,e,n);break;case 1:if(!Nn&&($l(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Tt(n,e,a)}Fs(t,e,n);break;case 21:Fs(t,e,n);break;case 22:n.mode&1?(Nn=(r=Nn)||n.memoizedState!==null,Fs(t,e,n),Nn=r):Fs(t,e,n);break;default:Fs(t,e,n)}}function wk(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new WO),e.forEach(function(r){var i=nA.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Jr(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var s=t,o=e,a=o;e:for(;a!==null;){switch(a.tag){case 5:cn=a.stateNode,ti=!1;break e;case 3:cn=a.stateNode.containerInfo,ti=!0;break e;case 4:cn=a.stateNode.containerInfo,ti=!0;break e}a=a.return}if(cn===null)throw Error(ee(160));s8(s,o,i),cn=null,ti=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(d){Tt(i,e,d)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)o8(e,t),e=e.sibling}function o8(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Jr(e,t),wi(t),r&4){try{Xc(3,t,t.return),ig(3,t)}catch(x){Tt(t,t.return,x)}try{Xc(5,t,t.return)}catch(x){Tt(t,t.return,x)}}break;case 1:Jr(e,t),wi(t),r&512&&n!==null&&$l(n,n.return);break;case 5:if(Jr(e,t),wi(t),r&512&&n!==null&&$l(n,n.return),t.flags&32){var i=t.stateNode;try{md(i,"")}catch(x){Tt(t,t.return,x)}}if(r&4&&(i=t.stateNode,i!=null)){var s=t.memoizedProps,o=n!==null?n.memoizedProps:s,a=t.type,l=t.updateQueue;if(t.updateQueue=null,l!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&T6(i,s),E2(a,o);var d=E2(a,s);for(o=0;o<l.length;o+=2){var h=l[o],f=l[o+1];h==="style"?R6(i,f):h==="dangerouslySetInnerHTML"?O6(i,f):h==="children"?md(i,f):bx(i,h,f,d)}switch(a){case"input":S2(i,s);break;case"textarea":M6(i,s);break;case"select":var p=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var y=s.value;y!=null?ql(i,!!s.multiple,y,!1):p!==!!s.multiple&&(s.defaultValue!=null?ql(i,!!s.multiple,s.defaultValue,!0):ql(i,!!s.multiple,s.multiple?[]:"",!1))}i[bd]=s}catch(x){Tt(t,t.return,x)}}break;case 6:if(Jr(e,t),wi(t),r&4){if(t.stateNode===null)throw Error(ee(162));i=t.stateNode,s=t.memoizedProps;try{i.nodeValue=s}catch(x){Tt(t,t.return,x)}}break;case 3:if(Jr(e,t),wi(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{xd(e.containerInfo)}catch(x){Tt(t,t.return,x)}break;case 4:Jr(e,t),wi(t);break;case 13:Jr(e,t),wi(t),i=t.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(rS=Lt())),r&4&&wk(t);break;case 22:if(h=n!==null&&n.memoizedState!==null,t.mode&1?(Nn=(d=Nn)||h,Jr(e,t),Nn=d):Jr(e,t),wi(t),r&8192){if(d=t.memoizedState!==null,(t.stateNode.isHidden=d)&&!h&&t.mode&1)for(de=t,h=t.child;h!==null;){for(f=de=h;de!==null;){switch(p=de,y=p.child,p.tag){case 0:case 11:case 14:case 15:Xc(4,p,p.return);break;case 1:$l(p,p.return);var g=p.stateNode;if(typeof g.componentWillUnmount=="function"){r=p,n=p.return;try{e=r,g.props=e.memoizedProps,g.state=e.memoizedState,g.componentWillUnmount()}catch(x){Tt(r,n,x)}}break;case 5:$l(p,p.return);break;case 22:if(p.memoizedState!==null){Ck(f);continue}}y!==null?(y.return=p,de=y):Ck(f)}h=h.sibling}e:for(h=null,f=t;;){if(f.tag===5){if(h===null){h=f;try{i=f.stateNode,d?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=f.stateNode,l=f.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=A6("display",o))}catch(x){Tt(t,t.return,x)}}}else if(f.tag===6){if(h===null)try{f.stateNode.nodeValue=d?"":f.memoizedProps}catch(x){Tt(t,t.return,x)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===t)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;h===f&&(h=null),f=f.return}h===f&&(h=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Jr(e,t),wi(t),r&4&&wk(t);break;case 21:break;default:Jr(e,t),wi(t)}}function wi(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(i8(n)){var r=n;break e}n=n.return}throw Error(ee(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(md(i,""),r.flags&=-33);var s=Sk(t);tv(t,s,i);break;case 3:case 4:var o=r.stateNode.containerInfo,a=Sk(t);ev(t,a,o);break;default:throw Error(ee(161))}}catch(l){Tt(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function qO(t,e,n){de=t,a8(t)}function a8(t,e,n){for(var r=(t.mode&1)!==0;de!==null;){var i=de,s=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||Of;if(!o){var a=i.alternate,l=a!==null&&a.memoizedState!==null||Nn;a=Of;var d=Nn;if(Of=o,(Nn=l)&&!d)for(de=i;de!==null;)o=de,l=o.child,o.tag===22&&o.memoizedState!==null?bk(i):l!==null?(l.return=o,de=l):bk(i);for(;s!==null;)de=s,a8(s),s=s.sibling;de=i,Of=a,Nn=d}kk(t)}else i.subtreeFlags&8772&&s!==null?(s.return=i,de=s):kk(t)}}function kk(t){for(;de!==null;){var e=de;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:Nn||ig(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!Nn)if(n===null)r.componentDidMount();else{var i=e.elementType===e.type?n.memoizedProps:Zr(e.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&ok(e,s,r);break;case 3:var o=e.updateQueue;if(o!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}ok(e,o,n)}break;case 5:var a=e.stateNode;if(n===null&&e.flags&4){n=a;var l=e.memoizedProps;switch(e.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(e.memoizedState===null){var d=e.alternate;if(d!==null){var h=d.memoizedState;if(h!==null){var f=h.dehydrated;f!==null&&xd(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ee(163))}Nn||e.flags&512&&Z2(e)}catch(p){Tt(e,e.return,p)}}if(e===t){de=null;break}if(n=e.sibling,n!==null){n.return=e.return,de=n;break}de=e.return}}function Ck(t){for(;de!==null;){var e=de;if(e===t){de=null;break}var n=e.sibling;if(n!==null){n.return=e.return,de=n;break}de=e.return}}function bk(t){for(;de!==null;){var e=de;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{ig(4,e)}catch(l){Tt(e,n,l)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var i=e.return;try{r.componentDidMount()}catch(l){Tt(e,i,l)}}var s=e.return;try{Z2(e)}catch(l){Tt(e,s,l)}break;case 5:var o=e.return;try{Z2(e)}catch(l){Tt(e,o,l)}}}catch(l){Tt(e,e.return,l)}if(e===t){de=null;break}var a=e.sibling;if(a!==null){a.return=e.return,de=a;break}de=e.return}}var QO=Math.ceil,Gp=vs.ReactCurrentDispatcher,tS=vs.ReactCurrentOwner,zr=vs.ReactCurrentBatchConfig,Be=0,sn=null,jt=null,mn=0,ur=0,Wl=Ro(0),Kt=0,Pd=null,ja=0,sg=0,nS=0,Zc=null,Xn=null,rS=0,wu=1/0,Xi=null,$p=!1,nv=null,xo=null,Af=!1,lo=null,Wp=0,ed=0,rv=null,cp=-1,dp=0;function jn(){return Be&6?Lt():cp!==-1?cp:cp=Lt()}function So(t){return t.mode&1?Be&2&&mn!==0?mn&-mn:AO.transition!==null?(dp===0&&(dp=$6()),dp):(t=qe,t!==0||(t=window.event,t=t===void 0?16:X6(t.type)),t):1}function oi(t,e,n,r){if(50<ed)throw ed=0,rv=null,Error(ee(185));ih(t,n,r),(!(Be&2)||t!==sn)&&(t===sn&&(!(Be&2)&&(sg|=n),Kt===4&&Qs(t,mn)),rr(t,r),n===1&&Be===0&&!(e.mode&1)&&(wu=Lt()+500,tg&&Lo()))}function rr(t,e){var n=t.callbackNode;AP(t,e);var r=Mp(t,t===sn?mn:0);if(r===0)n!==null&&R4(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&R4(n),e===1)t.tag===0?OO(Ek.bind(null,t)):yE(Ek.bind(null,t)),NO(function(){!(Be&6)&&Lo()}),n=null;else{switch(W6(r)){case 1:n=Mx;break;case 4:n=V6;break;case 16:n=Tp;break;case 536870912:n=G6;break;default:n=Tp}n=m8(n,l8.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function l8(t,e){if(cp=-1,dp=0,Be&6)throw Error(ee(327));var n=t.callbackNode;if(Zl()&&t.callbackNode!==n)return null;var r=Mp(t,t===sn?mn:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=Kp(t,r);else{e=r;var i=Be;Be|=2;var s=c8();(sn!==t||mn!==e)&&(Xi=null,wu=Lt()+500,_a(t,e));do try{XO();break}catch(a){u8(t,a)}while(!0);Hx(),Gp.current=s,Be=i,jt!==null?e=0:(sn=null,mn=0,e=Kt)}if(e!==0){if(e===2&&(i=P2(t),i!==0&&(r=i,e=iv(t,i))),e===1)throw n=Pd,_a(t,0),Qs(t,r),rr(t,Lt()),n;if(e===6)Qs(t,r);else{if(i=t.current.alternate,!(r&30)&&!YO(i)&&(e=Kp(t,r),e===2&&(s=P2(t),s!==0&&(r=s,e=iv(t,s))),e===1))throw n=Pd,_a(t,0),Qs(t,r),rr(t,Lt()),n;switch(t.finishedWork=i,t.finishedLanes=r,e){case 0:case 1:throw Error(ee(345));case 2:sa(t,Xn,Xi);break;case 3:if(Qs(t,r),(r&130023424)===r&&(e=rS+500-Lt(),10<e)){if(Mp(t,0)!==0)break;if(i=t.suspendedLanes,(i&r)!==r){jn(),t.pingedLanes|=t.suspendedLanes&i;break}t.timeoutHandle=j2(sa.bind(null,t,Xn,Xi),e);break}sa(t,Xn,Xi);break;case 4:if(Qs(t,r),(r&4194240)===r)break;for(e=t.eventTimes,i=-1;0<r;){var o=31-si(r);s=1<<o,o=e[o],o>i&&(i=o),r&=~s}if(r=i,r=Lt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*QO(r/1960))-r,10<r){t.timeoutHandle=j2(sa.bind(null,t,Xn,Xi),r);break}sa(t,Xn,Xi);break;case 5:sa(t,Xn,Xi);break;default:throw Error(ee(329))}}}return rr(t,Lt()),t.callbackNode===n?l8.bind(null,t):null}function iv(t,e){var n=Zc;return t.current.memoizedState.isDehydrated&&(_a(t,e).flags|=256),t=Kp(t,e),t!==2&&(e=Xn,Xn=n,e!==null&&sv(e)),t}function sv(t){Xn===null?Xn=t:Xn.push.apply(Xn,t)}function YO(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],s=i.getSnapshot;i=i.value;try{if(!ui(s(),i))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Qs(t,e){for(e&=~nS,e&=~sg,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-si(e),r=1<<n;t[n]=-1,e&=~r}}function Ek(t){if(Be&6)throw Error(ee(327));Zl();var e=Mp(t,0);if(!(e&1))return rr(t,Lt()),null;var n=Kp(t,e);if(t.tag!==0&&n===2){var r=P2(t);r!==0&&(e=r,n=iv(t,r))}if(n===1)throw n=Pd,_a(t,0),Qs(t,e),rr(t,Lt()),n;if(n===6)throw Error(ee(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,sa(t,Xn,Xi),rr(t,Lt()),null}function iS(t,e){var n=Be;Be|=1;try{return t(e)}finally{Be=n,Be===0&&(wu=Lt()+500,tg&&Lo())}}function za(t){lo!==null&&lo.tag===0&&!(Be&6)&&Zl();var e=Be;Be|=1;var n=zr.transition,r=qe;try{if(zr.transition=null,qe=1,t)return t()}finally{qe=r,zr.transition=n,Be=e,!(Be&6)&&Lo()}}function sS(){ur=Wl.current,dt(Wl)}function _a(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,_O(n)),jt!==null)for(n=jt.return;n!==null;){var r=n;switch(zx(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Lp();break;case 3:xu(),dt(tr),dt(Mn),qx();break;case 5:Kx(r);break;case 4:xu();break;case 13:dt(St);break;case 19:dt(St);break;case 10:Vx(r.type._context);break;case 22:case 23:sS()}n=n.return}if(sn=t,jt=t=wo(t.current,null),mn=ur=e,Kt=0,Pd=null,nS=sg=ja=0,Xn=Zc=null,ua!==null){for(e=0;e<ua.length;e++)if(n=ua[e],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,s=n.pending;if(s!==null){var o=s.next;s.next=i,r.next=o}n.pending=r}ua=null}return t}function u8(t,e){do{var n=jt;try{if(Hx(),ap.current=Vp,Hp){for(var r=kt.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Hp=!1}if(Fa=0,rn=$t=kt=null,Jc=!1,Nd=0,tS.current=null,n===null||n.return===null){Kt=1,Pd=e,jt=null;break}e:{var s=t,o=n.return,a=n,l=e;if(e=mn,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var d=l,h=a,f=h.tag;if(!(h.mode&1)&&(f===0||f===11||f===15)){var p=h.alternate;p?(h.updateQueue=p.updateQueue,h.memoizedState=p.memoizedState,h.lanes=p.lanes):(h.updateQueue=null,h.memoizedState=null)}var y=hk(o);if(y!==null){y.flags&=-257,fk(y,o,a,s,e),y.mode&1&&dk(s,d,e),e=y,l=d;var g=e.updateQueue;if(g===null){var x=new Set;x.add(l),e.updateQueue=x}else g.add(l);break e}else{if(!(e&1)){dk(s,d,e),oS();break e}l=Error(ee(426))}}else if(pt&&a.mode&1){var S=hk(o);if(S!==null){!(S.flags&65536)&&(S.flags|=256),fk(S,o,a,s,e),Bx(Su(l,a));break e}}s=l=Su(l,a),Kt!==4&&(Kt=2),Zc===null?Zc=[s]:Zc.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var C=WE(s,l,e);sk(s,C);break e;case 1:a=l;var E=s.type,w=s.stateNode;if(!(s.flags&128)&&(typeof E.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(xo===null||!xo.has(w)))){s.flags|=65536,e&=-e,s.lanes|=e;var b=KE(s,a,e);sk(s,b);break e}}s=s.return}while(s!==null)}h8(n)}catch(T){e=T,jt===n&&n!==null&&(jt=n=n.return);continue}break}while(!0)}function c8(){var t=Gp.current;return Gp.current=Vp,t===null?Vp:t}function oS(){(Kt===0||Kt===3||Kt===2)&&(Kt=4),sn===null||!(ja&268435455)&&!(sg&268435455)||Qs(sn,mn)}function Kp(t,e){var n=Be;Be|=2;var r=c8();(sn!==t||mn!==e)&&(Xi=null,_a(t,e));do try{JO();break}catch(i){u8(t,i)}while(!0);if(Hx(),Be=n,Gp.current=r,jt!==null)throw Error(ee(261));return sn=null,mn=0,Kt}function JO(){for(;jt!==null;)d8(jt)}function XO(){for(;jt!==null&&!CP();)d8(jt)}function d8(t){var e=p8(t.alternate,t,ur);t.memoizedProps=t.pendingProps,e===null?h8(t):jt=e,tS.current=null}function h8(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=$O(n,e),n!==null){n.flags&=32767,jt=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Kt=6,jt=null;return}}else if(n=GO(n,e,ur),n!==null){jt=n;return}if(e=e.sibling,e!==null){jt=e;return}jt=e=t}while(e!==null);Kt===0&&(Kt=5)}function sa(t,e,n){var r=qe,i=zr.transition;try{zr.transition=null,qe=1,ZO(t,e,n,r)}finally{zr.transition=i,qe=r}return null}function ZO(t,e,n,r){do Zl();while(lo!==null);if(Be&6)throw Error(ee(327));n=t.finishedWork;var i=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(ee(177));t.callbackNode=null,t.callbackPriority=0;var s=n.lanes|n.childLanes;if(RP(t,s),t===sn&&(jt=sn=null,mn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Af||(Af=!0,m8(Tp,function(){return Zl(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=zr.transition,zr.transition=null;var o=qe;qe=1;var a=Be;Be|=4,tS.current=null,KO(t,n),o8(n,t),xO(D2),Pp=!!I2,D2=I2=null,t.current=n,qO(n),bP(),Be=a,qe=o,zr.transition=s}else t.current=n;if(Af&&(Af=!1,lo=t,Wp=i),s=t.pendingLanes,s===0&&(xo=null),NP(n.stateNode),rr(t,Lt()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)i=e[n],r(i.value,{componentStack:i.stack,digest:i.digest});if($p)throw $p=!1,t=nv,nv=null,t;return Wp&1&&t.tag!==0&&Zl(),s=t.pendingLanes,s&1?t===rv?ed++:(ed=0,rv=t):ed=0,Lo(),null}function Zl(){if(lo!==null){var t=W6(Wp),e=zr.transition,n=qe;try{if(zr.transition=null,qe=16>t?16:t,lo===null)var r=!1;else{if(t=lo,lo=null,Wp=0,Be&6)throw Error(ee(331));var i=Be;for(Be|=4,de=t.current;de!==null;){var s=de,o=s.child;if(de.flags&16){var a=s.deletions;if(a!==null){for(var l=0;l<a.length;l++){var d=a[l];for(de=d;de!==null;){var h=de;switch(h.tag){case 0:case 11:case 15:Xc(8,h,s)}var f=h.child;if(f!==null)f.return=h,de=f;else for(;de!==null;){h=de;var p=h.sibling,y=h.return;if(r8(h),h===d){de=null;break}if(p!==null){p.return=y,de=p;break}de=y}}}var g=s.alternate;if(g!==null){var x=g.child;if(x!==null){g.child=null;do{var S=x.sibling;x.sibling=null,x=S}while(x!==null)}}de=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,de=o;else e:for(;de!==null;){if(s=de,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Xc(9,s,s.return)}var C=s.sibling;if(C!==null){C.return=s.return,de=C;break e}de=s.return}}var E=t.current;for(de=E;de!==null;){o=de;var w=o.child;if(o.subtreeFlags&2064&&w!==null)w.return=o,de=w;else e:for(o=E;de!==null;){if(a=de,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:ig(9,a)}}catch(T){Tt(a,a.return,T)}if(a===o){de=null;break e}var b=a.sibling;if(b!==null){b.return=a.return,de=b;break e}de=a.return}}if(Be=i,Lo(),Ai&&typeof Ai.onPostCommitFiberRoot=="function")try{Ai.onPostCommitFiberRoot(Ym,t)}catch{}r=!0}return r}finally{qe=n,zr.transition=e}}return!1}function _k(t,e,n){e=Su(n,e),e=WE(t,e,1),t=vo(t,e,1),e=jn(),t!==null&&(ih(t,1,e),rr(t,e))}function Tt(t,e,n){if(t.tag===3)_k(t,t,n);else for(;e!==null;){if(e.tag===3){_k(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(xo===null||!xo.has(r))){t=Su(n,t),t=KE(e,t,1),e=vo(e,t,1),t=jn(),e!==null&&(ih(e,1,t),rr(e,t));break}}e=e.return}}function eA(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=jn(),t.pingedLanes|=t.suspendedLanes&n,sn===t&&(mn&n)===n&&(Kt===4||Kt===3&&(mn&130023424)===mn&&500>Lt()-rS?_a(t,0):nS|=n),rr(t,e)}function f8(t,e){e===0&&(t.mode&1?(e=kf,kf<<=1,!(kf&130023424)&&(kf=4194304)):e=1);var n=jn();t=gs(t,e),t!==null&&(ih(t,e,n),rr(t,n))}function tA(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),f8(t,n)}function nA(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(ee(314))}r!==null&&r.delete(e),f8(t,n)}var p8;p8=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||tr.current)er=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return er=!1,VO(t,e,n);er=!!(t.flags&131072)}else er=!1,pt&&e.flags&1048576&&vE(e,Fp,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;up(t,e),t=e.pendingProps;var i=gu(e,Mn.current);Xl(e,n),i=Yx(null,e,r,t,i,n);var s=Jx();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,nr(r)?(s=!0,Ip(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,$x(e),i.updater=rg,e.stateNode=i,i._reactInternals=e,$2(e,r,t,n),e=q2(null,e,r,!0,s,n)):(e.tag=0,pt&&s&&jx(e),In(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(up(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=iA(r),t=Zr(r,t),i){case 0:e=K2(null,e,r,t,n);break e;case 1:e=gk(null,e,r,t,n);break e;case 11:e=pk(null,e,r,t,n);break e;case 14:e=mk(null,e,r,Zr(r.type,t),n);break e}throw Error(ee(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Zr(r,i),K2(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Zr(r,i),gk(t,e,r,i,n);case 3:e:{if(JE(e),t===null)throw Error(ee(387));r=e.pendingProps,s=e.memoizedState,i=s.element,bE(t,e),Bp(e,r,null,n);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=Su(Error(ee(423)),e),e=yk(t,e,r,n,i);break e}else if(r!==i){i=Su(Error(ee(424)),e),e=yk(t,e,r,n,i);break e}else for(fr=yo(e.stateNode.containerInfo.firstChild),pr=e,pt=!0,ni=null,n=kE(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(yu(),r===i){e=ys(t,e,n);break e}In(t,e,r,n)}e=e.child}return e;case 5:return EE(e),t===null&&H2(e),r=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,F2(r,i)?o=null:s!==null&&F2(r,s)&&(e.flags|=32),YE(t,e),In(t,e,o,n),e.child;case 6:return t===null&&H2(e),null;case 13:return XE(t,e,n);case 4:return Wx(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=vu(e,null,r,n):In(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Zr(r,i),pk(t,e,r,i,n);case 7:return In(t,e,e.pendingProps,n),e.child;case 8:return In(t,e,e.pendingProps.children,n),e.child;case 12:return In(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,nt(jp,r._currentValue),r._currentValue=o,s!==null)if(ui(s.value,o)){if(s.children===i.children&&!tr.current){e=ys(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=us(-1,n&-n),l.tag=2;var d=s.updateQueue;if(d!==null){d=d.shared;var h=d.pending;h===null?l.next=l:(l.next=h.next,h.next=l),d.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),V2(s.return,n,e),a.lanes|=n;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(ee(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),V2(o,n,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}In(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,Xl(e,n),i=Hr(i),r=r(i),e.flags|=1,In(t,e,r,n),e.child;case 14:return r=e.type,i=Zr(r,e.pendingProps),i=Zr(r.type,i),mk(t,e,r,i,n);case 15:return qE(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Zr(r,i),up(t,e),e.tag=1,nr(r)?(t=!0,Ip(e)):t=!1,Xl(e,n),$E(e,r,i),$2(e,r,i,n),q2(null,e,r,!0,t,n);case 19:return ZE(t,e,n);case 22:return QE(t,e,n)}throw Error(ee(156,e.tag))};function m8(t,e){return H6(t,e)}function rA(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function jr(t,e,n,r){return new rA(t,e,n,r)}function aS(t){return t=t.prototype,!(!t||!t.isReactComponent)}function iA(t){if(typeof t=="function")return aS(t)?1:0;if(t!=null){if(t=t.$$typeof,t===_x)return 11;if(t===Nx)return 14}return 2}function wo(t,e){var n=t.alternate;return n===null?(n=jr(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function hp(t,e,n,r,i,s){var o=2;if(r=t,typeof t=="function")aS(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case Dl:return Na(n.children,i,s,e);case Ex:o=8,i|=8;break;case m2:return t=jr(12,n,e,i|2),t.elementType=m2,t.lanes=s,t;case g2:return t=jr(13,n,e,i),t.elementType=g2,t.lanes=s,t;case y2:return t=jr(19,n,e,i),t.elementType=y2,t.lanes=s,t;case E6:return og(n,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case C6:o=10;break e;case b6:o=9;break e;case _x:o=11;break e;case Nx:o=14;break e;case Vs:o=16,r=null;break e}throw Error(ee(130,t==null?t:typeof t,""))}return e=jr(o,n,e,i),e.elementType=t,e.type=r,e.lanes=s,e}function Na(t,e,n,r){return t=jr(7,t,r,e),t.lanes=n,t}function og(t,e,n,r){return t=jr(22,t,r,e),t.elementType=E6,t.lanes=n,t.stateNode={isHidden:!1},t}function my(t,e,n){return t=jr(6,t,null,e),t.lanes=n,t}function gy(t,e,n){return e=jr(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function sA(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Y1(0),this.expirationTimes=Y1(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Y1(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function lS(t,e,n,r,i,s,o,a,l){return t=new sA(t,e,n,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=jr(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},$x(s),t}function oA(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Il,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function g8(t){if(!t)return To;t=t._reactInternals;e:{if(Ya(t)!==t||t.tag!==1)throw Error(ee(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(nr(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(ee(171))}if(t.tag===1){var n=t.type;if(nr(n))return gE(t,n,e)}return e}function y8(t,e,n,r,i,s,o,a,l){return t=lS(n,r,!0,t,i,s,o,a,l),t.context=g8(null),n=t.current,r=jn(),i=So(n),s=us(r,i),s.callback=e??null,vo(n,s,i),t.current.lanes=i,ih(t,i,r),rr(t,r),t}function ag(t,e,n,r){var i=e.current,s=jn(),o=So(i);return n=g8(n),e.context===null?e.context=n:e.pendingContext=n,e=us(s,o),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=vo(i,e,o),t!==null&&(oi(t,i,o,s),op(t,i,o)),o}function qp(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function Nk(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function uS(t,e){Nk(t,e),(t=t.alternate)&&Nk(t,e)}function aA(){return null}var v8=typeof reportError=="function"?reportError:function(t){console.error(t)};function cS(t){this._internalRoot=t}lg.prototype.render=cS.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(ee(409));ag(t,e,null,null)};lg.prototype.unmount=cS.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;za(function(){ag(null,t,null,null)}),e[ms]=null}};function lg(t){this._internalRoot=t}lg.prototype.unstable_scheduleHydration=function(t){if(t){var e=Q6();t={blockedOn:null,target:t,priority:e};for(var n=0;n<qs.length&&e!==0&&e<qs[n].priority;n++);qs.splice(n,0,t),n===0&&J6(t)}};function dS(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function ug(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Tk(){}function lA(t,e,n,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var d=qp(o);s.call(d)}}var o=y8(e,r,t,0,null,!1,!1,"",Tk);return t._reactRootContainer=o,t[ms]=o.current,kd(t.nodeType===8?t.parentNode:t),za(),o}for(;i=t.lastChild;)t.removeChild(i);if(typeof r=="function"){var a=r;r=function(){var d=qp(l);a.call(d)}}var l=lS(t,0,!1,null,null,!1,!1,"",Tk);return t._reactRootContainer=l,t[ms]=l.current,kd(t.nodeType===8?t.parentNode:t),za(function(){ag(e,l,n,r)}),l}function cg(t,e,n,r,i){var s=n._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var a=i;i=function(){var l=qp(o);a.call(l)}}ag(e,o,t,i)}else o=lA(n,e,t,i,r);return qp(o)}K6=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=Ic(e.pendingLanes);n!==0&&(Px(e,n|1),rr(e,Lt()),!(Be&6)&&(wu=Lt()+500,Lo()))}break;case 13:za(function(){var r=gs(t,1);if(r!==null){var i=jn();oi(r,t,1,i)}}),uS(t,1)}};Ox=function(t){if(t.tag===13){var e=gs(t,134217728);if(e!==null){var n=jn();oi(e,t,134217728,n)}uS(t,134217728)}};q6=function(t){if(t.tag===13){var e=So(t),n=gs(t,e);if(n!==null){var r=jn();oi(n,t,e,r)}uS(t,e)}};Q6=function(){return qe};Y6=function(t,e){var n=qe;try{return qe=t,e()}finally{qe=n}};N2=function(t,e,n){switch(e){case"input":if(S2(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var i=eg(r);if(!i)throw Error(ee(90));N6(r),S2(r,i)}}}break;case"textarea":M6(t,n);break;case"select":e=n.value,e!=null&&ql(t,!!n.multiple,e,!1)}};D6=iS;F6=za;var uA={usingClientEntryPoint:!1,Events:[oh,Bl,eg,L6,I6,iS]},Cc={findFiberByHostInstance:la,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},cA={bundleType:Cc.bundleType,version:Cc.version,rendererPackageName:Cc.rendererPackageName,rendererConfig:Cc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:vs.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=B6(t),t===null?null:t.stateNode},findFiberByHostInstance:Cc.findFiberByHostInstance||aA,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 Rf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Rf.isDisabled&&Rf.supportsFiber)try{Ym=Rf.inject(cA),Ai=Rf}catch{}}yr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=uA;yr.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!dS(e))throw Error(ee(200));return oA(t,e,null,n)};yr.createRoot=function(t,e){if(!dS(t))throw Error(ee(299));var n=!1,r="",i=v8;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(i=e.onRecoverableError)),e=lS(t,1,!1,null,null,n,!1,r,i),t[ms]=e.current,kd(t.nodeType===8?t.parentNode:t),new cS(e)};yr.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(ee(188)):(t=Object.keys(t).join(","),Error(ee(268,t)));return t=B6(e),t=t===null?null:t.stateNode,t};yr.flushSync=function(t){return za(t)};yr.hydrate=function(t,e,n){if(!ug(e))throw Error(ee(200));return cg(null,t,e,!0,n)};yr.hydrateRoot=function(t,e,n){if(!dS(t))throw Error(ee(405));var r=n!=null&&n.hydratedSources||null,i=!1,s="",o=v8;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),e=y8(e,null,t,1,n??null,i,!1,s,o),t[ms]=e.current,kd(t),r)for(t=0;t<r.length;t++)n=r[t],i=n._getVersion,i=i(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,i]:e.mutableSourceEagerHydrationData.push(n,i);return new lg(e)};yr.render=function(t,e,n){if(!ug(e))throw Error(ee(200));return cg(null,t,e,!1,n)};yr.unmountComponentAtNode=function(t){if(!ug(t))throw Error(ee(40));return t._reactRootContainer?(za(function(){cg(null,null,t,!1,function(){t._reactRootContainer=null,t[ms]=null})}),!0):!1};yr.unstable_batchedUpdates=iS;yr.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!ug(n))throw Error(ee(200));if(t==null||t._reactInternals===void 0)throw Error(ee(38));return cg(t,e,n,!1,r)};yr.version="18.3.1-next-f1338f8080-20240426";function x8(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(x8)}catch(t){console.error(t)}}x8(),x6.exports=yr;var S8=x6.exports;const dA=nh(S8);var Mk=S8;f2.createRoot=Mk.createRoot,f2.hydrateRoot=Mk.hydrateRoot;/**
* @remix-run/router v1.23.2
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function Od(){return Od=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Od.apply(this,arguments)}var uo;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(uo||(uo={}));const Pk="popstate";function hA(t){t===void 0&&(t={});function e(r,i){let{pathname:s,search:o,hash:a}=r.location;return ov("",{pathname:s,search:o,hash:a},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(r,i){return typeof i=="string"?i:w8(i)}return pA(e,n,null,t)}function qt(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function hS(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function fA(){return Math.random().toString(36).substr(2,8)}function Ok(t,e){return{usr:t.state,key:t.key,idx:e}}function ov(t,e,n,r){return n===void 0&&(n=null),Od({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Fu(e):e,{state:n,key:e&&e.key||r||fA()})}function w8(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Fu(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function pA(t,e,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,a=uo.Pop,l=null,d=h();d==null&&(d=0,o.replaceState(Od({},o.state,{idx:d}),""));function h(){return(o.state||{idx:null}).idx}function f(){a=uo.Pop;let S=h(),C=S==null?null:S-d;d=S,l&&l({action:a,location:x.location,delta:C})}function p(S,C){a=uo.Push;let E=ov(x.location,S,C);d=h()+1;let w=Ok(E,d),b=x.createHref(E);try{o.pushState(w,"",b)}catch(T){if(T instanceof DOMException&&T.name==="DataCloneError")throw T;i.location.assign(b)}s&&l&&l({action:a,location:x.location,delta:1})}function y(S,C){a=uo.Replace;let E=ov(x.location,S,C);d=h();let w=Ok(E,d),b=x.createHref(E);o.replaceState(w,"",b),s&&l&&l({action:a,location:x.location,delta:0})}function g(S){let C=i.location.origin!=="null"?i.location.origin:i.location.href,E=typeof S=="string"?S:w8(S);return E=E.replace(/ $/,"%20"),qt(C,"No window.location.(origin|href) available to create URL for href: "+E),new URL(E,C)}let x={get action(){return a},get location(){return t(i,o)},listen(S){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(Pk,f),l=S,()=>{i.removeEventListener(Pk,f),l=null}},createHref(S){return e(i,S)},createURL:g,encodeLocation(S){let C=g(S);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:p,replace:y,go(S){return o.go(S)}};return x}var Ak;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Ak||(Ak={}));function mA(t,e,n){return n===void 0&&(n="/"),gA(t,e,n)}function gA(t,e,n,r){let i=typeof e=="string"?Fu(e):e,s=b8(i.pathname||"/",n);if(s==null)return null;let o=k8(t);yA(o);let a=null;for(let l=0;a==null&&l<o.length;++l){let d=MA(s);a=_A(o[l],d)}return a}function k8(t,e,n,r){e===void 0&&(e=[]),n===void 0&&(n=[]),r===void 0&&(r="");let i=(s,o,a)=>{let l={relativePath:a===void 0?s.path||"":a,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};l.relativePath.startsWith("/")&&(qt(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let d=Ta([r,l.relativePath]),h=n.concat(l);s.children&&s.children.length>0&&(qt(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),k8(s.children,e,h,d)),!(s.path==null&&!s.index)&&e.push({path:d,score:bA(d,s.index),routesMeta:h})};return t.forEach((s,o)=>{var a;if(s.path===""||!((a=s.path)!=null&&a.includes("?")))i(s,o);else for(let l of C8(s.path))i(s,o,l)}),e}function C8(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=C8(r.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),i&&a.push(...o),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function yA(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:EA(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const vA=/^:[\w-]+$/,xA=3,SA=2,wA=1,kA=10,CA=-2,Rk=t=>t==="*";function bA(t,e){let n=t.split("/"),r=n.length;return n.some(Rk)&&(r+=CA),e&&(r+=SA),n.filter(i=>!Rk(i)).reduce((i,s)=>i+(vA.test(s)?xA:s===""?wA:kA),r)}function EA(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function _A(t,e,n){let{routesMeta:r}=t,i={},s="/",o=[];for(let a=0;a<r.length;++a){let l=r[a],d=a===r.length-1,h=s==="/"?e:e.slice(s.length)||"/",f=NA({path:l.relativePath,caseSensitive:l.caseSensitive,end:d},h),p=l.route;if(!f)return null;Object.assign(i,f.params),o.push({params:i,pathname:Ta([s,f.pathname]),pathnameBase:DA(Ta([s,f.pathnameBase])),route:p}),f.pathnameBase!=="/"&&(s=Ta([s,f.pathnameBase]))}return o}function NA(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=TA(t.path,t.caseSensitive,t.end),i=e.match(n);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),a=i.slice(1);return{params:r.reduce((d,h,f)=>{let{paramName:p,isOptional:y}=h;if(p==="*"){let x=a[f]||"";o=s.slice(0,s.length-x.length).replace(/(.)\/+$/,"$1")}const g=a[f];return y&&!g?d[p]=void 0:d[p]=(g||"").replace(/%2F/g,"/"),d},{}),pathname:s,pathnameBase:o,pattern:t}}function TA(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),hS(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function MA(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return hS(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function b8(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}const PA=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,OA=t=>PA.test(t);function AA(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?Fu(t):t,s;if(n)if(OA(n))s=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),hS(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?s=Lk(n.substring(1),"/"):s=Lk(n,e)}else s=e;return{pathname:s,search:FA(r),hash:jA(i)}}function Lk(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function yy(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function RA(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function LA(t,e){let n=RA(t);return e?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function IA(t,e,n,r){r===void 0&&(r=!1);let i;typeof t=="string"?i=Fu(t):(i=Od({},t),qt(!i.pathname||!i.pathname.includes("?"),yy("?","pathname","search",i)),qt(!i.pathname||!i.pathname.includes("#"),yy("#","pathname","hash",i)),qt(!i.search||!i.search.includes("#"),yy("#","search","hash",i)));let s=t===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=n;else{let f=e.length-1;if(!r&&o.startsWith("..")){let p=o.split("/");for(;p[0]==="..";)p.shift(),f-=1;i.pathname=p.join("/")}a=f>=0?e[f]:"/"}let l=AA(i,a),d=o&&o!=="/"&&o.endsWith("/"),h=(s||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(d||h)&&(l.pathname+="/"),l}const Ta=t=>t.join("/").replace(/\/\/+/g,"/"),DA=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),FA=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,jA=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function zA(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const E8=["post","put","patch","delete"];new Set(E8);const BA=["get",...E8];new Set(BA);/**
* React Router v6.30.3
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function Ad(){return Ad=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ad.apply(this,arguments)}const fS=z.createContext(null),UA=z.createContext(null),dg=z.createContext(null),hg=z.createContext(null),ju=z.createContext({outlet:null,matches:[],isDataRoute:!1}),_8=z.createContext(null);function fg(){return z.useContext(hg)!=null}function pS(){return fg()||qt(!1),z.useContext(hg).location}function N8(t){z.useContext(dg).static||z.useLayoutEffect(t)}function HA(){let{isDataRoute:t}=z.useContext(ju);return t?tR():VA()}function VA(){fg()||qt(!1);let t=z.useContext(fS),{basename:e,future:n,navigator:r}=z.useContext(dg),{matches:i}=z.useContext(ju),{pathname:s}=pS(),o=JSON.stringify(LA(i,n.v7_relativeSplatPath)),a=z.useRef(!1);return N8(()=>{a.current=!0}),z.useCallback(function(d,h){if(h===void 0&&(h={}),!a.current)return;if(typeof d=="number"){r.go(d);return}let f=IA(d,JSON.parse(o),s,h.relative==="path");t==null&&e!=="/"&&(f.pathname=f.pathname==="/"?e:Ta([e,f.pathname])),(h.replace?r.replace:r.push)(f,h.state,h)},[e,r,o,s,t])}function GA(t,e){return $A(t,e)}function $A(t,e,n,r){fg()||qt(!1);let{navigator:i}=z.useContext(dg),{matches:s}=z.useContext(ju),o=s[s.length-1],a=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let d=pS(),h;if(e){var f;let S=typeof e=="string"?Fu(e):e;l==="/"||(f=S.pathname)!=null&&f.startsWith(l)||qt(!1),h=S}else h=d;let p=h.pathname||"/",y=p;if(l!=="/"){let S=l.replace(/^\//,"").split("/");y="/"+p.replace(/^\//,"").split("/").slice(S.length).join("/")}let g=mA(t,{pathname:y}),x=YA(g&&g.map(S=>Object.assign({},S,{params:Object.assign({},a,S.params),pathname:Ta([l,i.encodeLocation?i.encodeLocation(S.pathname).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?l:Ta([l,i.encodeLocation?i.encodeLocation(S.pathnameBase).pathname:S.pathnameBase])})),s,n,r);return e&&x?z.createElement(hg.Provider,{value:{location:Ad({pathname:"/",search:"",hash:"",state:null,key:"default"},h),navigationType:uo.Pop}},x):x}function WA(){let t=eR(),e=zA(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return z.createElement(z.Fragment,null,z.createElement("h2",null,"Unexpected Application Error!"),z.createElement("h3",{style:{fontStyle:"italic"}},e),n?z.createElement("pre",{style:i},n):null,null)}const KA=z.createElement(WA,null);class qA extends z.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?z.createElement(ju.Provider,{value:this.props.routeContext},z.createElement(_8.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function QA(t){let{routeContext:e,match:n,children:r}=t,i=z.useContext(fS);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),z.createElement(ju.Provider,{value:e},r)}function YA(t,e,n,r){var i;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var s;if(!n)return null;if(n.errors)t=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,a=(i=n)==null?void 0:i.errors;if(a!=null){let h=o.findIndex(f=>f.route.id&&(a==null?void 0:a[f.route.id])!==void 0);h>=0||qt(!1),o=o.slice(0,Math.min(o.length,h+1))}let l=!1,d=-1;if(n&&r&&r.v7_partialHydration)for(let h=0;h<o.length;h++){let f=o[h];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(d=h),f.route.id){let{loaderData:p,errors:y}=n,g=f.route.loader&&p[f.route.id]===void 0&&(!y||y[f.route.id]===void 0);if(f.route.lazy||g){l=!0,d>=0?o=o.slice(0,d+1):o=[o[0]];break}}}return o.reduceRight((h,f,p)=>{let y,g=!1,x=null,S=null;n&&(y=a&&f.route.id?a[f.route.id]:void 0,x=f.route.errorElement||KA,l&&(d<0&&p===0?(nR("route-fallback"),g=!0,S=null):d===p&&(g=!0,S=f.route.hydrateFallbackElement||null)));let C=e.concat(o.slice(0,p+1)),E=()=>{let w;return y?w=x:g?w=S:f.route.Component?w=z.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=h,z.createElement(QA,{match:f,routeContext:{outlet:h,matches:C,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||p===0)?z.createElement(qA,{location:n.location,revalidation:n.revalidation,component:x,error:y,children:E(),routeContext:{outlet:null,matches:C,isDataRoute:!0}}):E()},null)}var T8=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(T8||{}),M8=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(M8||{});function JA(t){let e=z.useContext(fS);return e||qt(!1),e}function XA(t){let e=z.useContext(UA);return e||qt(!1),e}function ZA(t){let e=z.useContext(ju);return e||qt(!1),e}function P8(t){let e=ZA(),n=e.matches[e.matches.length-1];return n.route.id||qt(!1),n.route.id}function eR(){var t;let e=z.useContext(_8),n=XA(),r=P8();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function tR(){let{router:t}=JA(T8.UseNavigateStable),e=P8(M8.UseNavigateStable),n=z.useRef(!1);return N8(()=>{n.current=!0}),z.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Ad({fromRouteId:e},s)))},[t,e])}const Ik={};function nR(t,e,n){Ik[t]||(Ik[t]=!0)}function rR(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Fc(t){qt(!1)}function iR(t){let{basename:e="/",children:n=null,location:r,navigationType:i=uo.Pop,navigator:s,static:o=!1,future:a}=t;fg()&&qt(!1);let l=e.replace(/^\/*/,"/"),d=z.useMemo(()=>({basename:l,navigator:s,static:o,future:Ad({v7_relativeSplatPath:!1},a)}),[l,a,s,o]);typeof r=="string"&&(r=Fu(r));let{pathname:h="/",search:f="",hash:p="",state:y=null,key:g="default"}=r,x=z.useMemo(()=>{let S=b8(h,l);return S==null?null:{location:{pathname:S,search:f,hash:p,state:y,key:g},navigationType:i}},[l,h,f,p,y,g,i]);return x==null?null:z.createElement(dg.Provider,{value:d},z.createElement(hg.Provider,{children:n,value:x}))}function sR(t){let{children:e,location:n}=t;return GA(av(e),n)}new Promise(()=>{});function av(t,e){e===void 0&&(e=[]);let n=[];return z.Children.forEach(t,(r,i)=>{if(!z.isValidElement(r))return;let s=[...e,i];if(r.type===z.Fragment){n.push.apply(n,av(r.props.children,s));return}r.type!==Fc&&qt(!1),!r.props.index||!r.props.children||qt(!1);let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=av(r.props.children,s)),n.push(o)}),n}/**
* React Router DOM v6.30.3
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/const oR="6";try{window.__reactRouterVersion=oR}catch{}const aR="startTransition",Dk=tP[aR];function lR(t){let{basename:e,children:n,future:r,window:i}=t,s=z.useRef();s.current==null&&(s.current=hA({window:i,v5Compat:!0}));let o=s.current,[a,l]=z.useState({action:o.action,location:o.location}),{v7_startTransition:d}=r||{},h=z.useCallback(f=>{d&&Dk?Dk(()=>l(f)):l(f)},[l,d]);return z.useLayoutEffect(()=>o.listen(h),[o,h]),z.useEffect(()=>rR(r),[r]),z.createElement(iR,{basename:e,children:n,location:a.location,navigationType:a.action,navigator:o,future:r})}var Fk;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Fk||(Fk={}));var jk;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(jk||(jk={}));var zu=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ya,Xs,ru,Jb,uR=(Jb=class extends zu{constructor(){super();ge(this,ya);ge(this,Xs);ge(this,ru);se(this,ru,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){L(this,Xs)||this.setEventListener(L(this,ru))}onUnsubscribe(){var e;this.hasListeners()||((e=L(this,Xs))==null||e.call(this),se(this,Xs,void 0))}setEventListener(e){var n;se(this,ru,e),(n=L(this,Xs))==null||n.call(this),se(this,Xs,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){L(this,ya)!==e&&(se(this,ya,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof L(this,ya)=="boolean"?L(this,ya):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},ya=new WeakMap,Xs=new WeakMap,ru=new WeakMap,Jb),mS=new uR,cR={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Zs,yx,Xb,dR=(Xb=class{constructor(){ge(this,Zs,cR);ge(this,yx,!1)}setTimeoutProvider(t){se(this,Zs,t)}setTimeout(t,e){return L(this,Zs).setTimeout(t,e)}clearTimeout(t){L(this,Zs).clearTimeout(t)}setInterval(t,e){return L(this,Zs).setInterval(t,e)}clearInterval(t){L(this,Zs).clearInterval(t)}},Zs=new WeakMap,yx=new WeakMap,Xb),da=new dR;function hR(t){setTimeout(t,0)}var fR=typeof window>"u"||"Deno"in globalThis;function Dn(){}function pR(t,e){return typeof t=="function"?t(e):t}function lv(t){return typeof t=="number"&&t>=0&&t!==1/0}function O8(t,e){return Math.max(t+(e||0)-Date.now(),0)}function ko(t,e){return typeof t=="function"?t(e):t}function Rr(t,e){return typeof t=="function"?t(e):t}function zk(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=t;if(o){if(r){if(e.queryHash!==gS(o,e.options))return!1}else if(!Rd(e.queryKey,o))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||i&&i!==e.state.fetchStatus||s&&!s(e))}function Bk(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(Ba(e.options.mutationKey)!==Ba(s))return!1}else if(!Rd(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function gS(t,e){return((e==null?void 0:e.queryKeyHashFn)||Ba)(t)}function Ba(t){return JSON.stringify(t,(e,n)=>uv(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function Rd(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>Rd(t[n],e[n])):!1}var mR=Object.prototype.hasOwnProperty;function A8(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=Uk(t)&&Uk(e);if(!r&&!(uv(t)&&uv(e)))return e;const s=(r?t:Object.keys(t)).length,o=r?e:Object.keys(e),a=o.length,l=r?new Array(a):{};let d=0;for(let h=0;h<a;h++){const f=r?h:o[h],p=t[f],y=e[f];if(p===y){l[f]=p,(r?h<s:mR.call(t,f))&&d++;continue}if(p===null||y===null||typeof p!="object"||typeof y!="object"){l[f]=y;continue}const g=A8(p,y,n+1);l[f]=g,g===p&&d++}return s===a&&d===s?t:l}function Qp(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}function Uk(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function uv(t){if(!Hk(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!Hk(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function Hk(t){return Object.prototype.toString.call(t)==="[object Object]"}function gR(t){return new Promise(e=>{da.setTimeout(e,t)})}function cv(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?A8(t,e):e}function yR(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function vR(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var yS=Symbol();function R8(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===yS?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function vS(t,e){return typeof t=="function"?t(...e):!!t}function xR(t,e,n){let r=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(i??(i=e()),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),t}var Ld=(()=>{let t=()=>fR;return{isServer(){return t()},setIsServer(e){t=e}}})();function dv(){let t,e;const n=new Promise((i,s)=>{t=i,e=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}var SR=hR;function wR(){let t=[],e=0,n=a=>{a()},r=a=>{a()},i=SR;const s=a=>{e?t.push(a):i(()=>{n(a)})},o=()=>{const a=t;t=[],a.length&&i(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;e++;try{l=a()}finally{e--,e||o()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var Wt=wR(),iu,eo,su,Zb,kR=(Zb=class extends zu{constructor(){super();ge(this,iu,!0);ge(this,eo);ge(this,su);se(this,su,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){L(this,eo)||this.setEventListener(L(this,su))}onUnsubscribe(){var e;this.hasListeners()||((e=L(this,eo))==null||e.call(this),se(this,eo,void 0))}setEventListener(e){var n;se(this,su,e),(n=L(this,eo))==null||n.call(this),se(this,eo,e(this.setOnline.bind(this)))}setOnline(e){L(this,iu)!==e&&(se(this,iu,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return L(this,iu)}},iu=new WeakMap,eo=new WeakMap,su=new WeakMap,Zb),Yp=new kR;function CR(t){return Math.min(1e3*2**t,3e4)}function L8(t){return(t??"online")==="online"?Yp.isOnline():!0}var hv=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function I8(t){let e=!1,n=0,r;const i=dv(),s=()=>i.status!=="pending",o=x=>{var S;if(!s()){const C=new hv(x);p(C),(S=t.onCancel)==null||S.call(t,C)}},a=()=>{e=!0},l=()=>{e=!1},d=()=>mS.isFocused()&&(t.networkMode==="always"||Yp.isOnline())&&t.canRun(),h=()=>L8(t.networkMode)&&t.canRun(),f=x=>{s()||(r==null||r(),i.resolve(x))},p=x=>{s()||(r==null||r(),i.reject(x))},y=()=>new Promise(x=>{var S;r=C=>{(s()||d())&&x(C)},(S=t.onPause)==null||S.call(t)}).then(()=>{var x;r=void 0,s()||(x=t.onContinue)==null||x.call(t)}),g=()=>{if(s())return;let x;const S=n===0?t.initialPromise:void 0;try{x=S??t.fn()}catch(C){x=Promise.reject(C)}Promise.resolve(x).then(f).catch(C=>{var P;if(s())return;const E=t.retry??(Ld.isServer()?0:3),w=t.retryDelay??CR,b=typeof w=="function"?w(n,C):w,T=E===!0||typeof E=="number"&&n<E||typeof E=="function"&&E(n,C);if(e||!T){p(C);return}n++,(P=t.onFail)==null||P.call(t,n,C),gR(b).then(()=>d()?void 0:y()).then(()=>{e?p(C):g()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r==null||r(),i),cancelRetry:a,continueRetry:l,canStart:h,start:()=>(h()?g():y().then(g),i)}}var va,e6,D8=(e6=class{constructor(){ge(this,va)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),lv(this.gcTime)&&se(this,va,da.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Ld.isServer()?1/0:5*60*1e3))}clearGcTimeout(){L(this,va)&&(da.clearTimeout(L(this,va)),se(this,va,void 0))}},va=new WeakMap,e6),xa,ou,Ar,Sa,nn,Jd,wa,cr,F8,Qi,t6,bR=(t6=class extends D8{constructor(e){super();ge(this,cr);ge(this,xa);ge(this,ou);ge(this,Ar);ge(this,Sa);ge(this,nn);ge(this,Jd);ge(this,wa);se(this,wa,!1),se(this,Jd,e.defaultOptions),this.setOptions(e.options),this.observers=[],se(this,Sa,e.client),se(this,Ar,L(this,Sa).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,se(this,xa,Gk(this.options)),this.state=e.state??L(this,xa),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=L(this,nn))==null?void 0:e.promise}setOptions(e){if(this.options={...L(this,Jd),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Gk(this.options);n.data!==void 0&&(this.setState(Vk(n.data,n.dataUpdatedAt)),se(this,xa,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&L(this,Ar).remove(this)}setData(e,n){const r=cv(this.state.data,e,this.options);return Te(this,cr,Qi).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){Te(this,cr,Qi).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,i;const n=(r=L(this,nn))==null?void 0:r.promise;return(i=L(this,nn))==null||i.cancel(e),n?n.then(Dn).catch(Dn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return L(this,xa)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Rr(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===yS||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>ko(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!O8(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=L(this,nn))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=L(this,nn))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),L(this,Ar).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(L(this,nn)&&(L(this,wa)||Te(this,cr,F8).call(this)?L(this,nn).cancel({revert:!0}):L(this,nn).cancelRetry()),this.scheduleGc()),L(this,Ar).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Te(this,cr,Qi).call(this,{type:"invalidate"})}async fetch(e,n){var l,d,h,f,p,y,g,x,S,C,E,w;if(this.state.fetchStatus!=="idle"&&((l=L(this,nn))==null?void 0:l.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(L(this,nn))return L(this,nn).continueRetry(),L(this,nn).promise}if(e&&this.setOptions(e),!this.options.queryFn){const b=this.observers.find(T=>T.options.queryFn);b&&this.setOptions(b.options)}const r=new AbortController,i=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(se(this,wa,!0),r.signal)})},s=()=>{const b=R8(this.options,n),P=(()=>{const A={client:L(this,Sa),queryKey:this.queryKey,meta:this.meta};return i(A),A})();return se(this,wa,!1),this.options.persister?this.options.persister(b,P,this):b(P)},a=(()=>{const b={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:L(this,Sa),state:this.state,fetchFn:s};return i(b),b})();(d=this.options.behavior)==null||d.onFetch(a,this),se(this,ou,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((h=a.fetchOptions)==null?void 0:h.meta))&&Te(this,cr,Qi).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),se(this,nn,I8({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:b=>{b instanceof hv&&b.revert&&this.setState({...L(this,ou),fetchStatus:"idle"}),r.abort()},onFail:(b,T)=>{Te(this,cr,Qi).call(this,{type:"failed",failureCount:b,error:T})},onPause:()=>{Te(this,cr,Qi).call(this,{type:"pause"})},onContinue:()=>{Te(this,cr,Qi).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const b=await L(this,nn).start();if(b===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(b),(y=(p=L(this,Ar).config).onSuccess)==null||y.call(p,b,this),(x=(g=L(this,Ar).config).onSettled)==null||x.call(g,b,this.state.error,this),b}catch(b){if(b instanceof hv){if(b.silent)return L(this,nn).promise;if(b.revert){if(this.state.data===void 0)throw b;return this.state.data}}throw Te(this,cr,Qi).call(this,{type:"error",error:b}),(C=(S=L(this,Ar).config).onError)==null||C.call(S,b,this),(w=(E=L(this,Ar).config).onSettled)==null||w.call(E,this.state.data,b,this),b}finally{this.scheduleGc()}}},xa=new WeakMap,ou=new WeakMap,Ar=new WeakMap,Sa=new WeakMap,nn=new WeakMap,Jd=new WeakMap,wa=new WeakMap,cr=new WeakSet,F8=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Qi=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...j8(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...Vk(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return se(this,ou,e.manual?i:void 0),i;case"error":const s=e.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),Wt.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),L(this,Ar).notify({query:this,type:"updated",action:e})})},t6);function j8(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:L8(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function Vk(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Gk(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Yn,je,Xd,Ln,ka,au,ts,to,Zd,lu,uu,Ca,ba,no,cu,$e,jc,fv,pv,mv,gv,yv,vv,xv,z8,n6,ER=(n6=class extends zu{constructor(e,n){super();ge(this,$e);ge(this,Yn);ge(this,je);ge(this,Xd);ge(this,Ln);ge(this,ka);ge(this,au);ge(this,ts);ge(this,to);ge(this,Zd);ge(this,lu);ge(this,uu);ge(this,Ca);ge(this,ba);ge(this,no);ge(this,cu,new Set);this.options=n,se(this,Yn,e),se(this,to,null),se(this,ts,dv()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(L(this,je).addObserver(this),$k(L(this,je),this.options)?Te(this,$e,jc).call(this):this.updateResult(),Te(this,$e,gv).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Sv(L(this,je),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Sv(L(this,je),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Te(this,$e,yv).call(this),Te(this,$e,vv).call(this),L(this,je).removeObserver(this)}setOptions(e){const n=this.options,r=L(this,je);if(this.options=L(this,Yn).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Rr(this.options.enabled,L(this,je))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Te(this,$e,xv).call(this),L(this,je).setOptions(this.options),n._defaulted&&!Qp(this.options,n)&&L(this,Yn).getQueryCache().notify({type:"observerOptionsUpdated",query:L(this,je),observer:this});const i=this.hasListeners();i&&Wk(L(this,je),r,this.options,n)&&Te(this,$e,jc).call(this),this.updateResult(),i&&(L(this,je)!==r||Rr(this.options.enabled,L(this,je))!==Rr(n.enabled,L(this,je))||ko(this.options.staleTime,L(this,je))!==ko(n.staleTime,L(this,je)))&&Te(this,$e,fv).call(this);const s=Te(this,$e,pv).call(this);i&&(L(this,je)!==r||Rr(this.options.enabled,L(this,je))!==Rr(n.enabled,L(this,je))||s!==L(this,no))&&Te(this,$e,mv).call(this,s)}getOptimisticResult(e){const n=L(this,Yn).getQueryCache().build(L(this,Yn),e),r=this.createResult(n,e);return NR(this,r)&&(se(this,Ln,r),se(this,au,this.options),se(this,ka,L(this,je).state)),r}getCurrentResult(){return L(this,Ln)}trackResult(e,n){return new Proxy(e,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&L(this,ts).status==="pending"&&L(this,ts).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){L(this,cu).add(e)}getCurrentQuery(){return L(this,je)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=L(this,Yn).defaultQueryOptions(e),r=L(this,Yn).getQueryCache().build(L(this,Yn),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return Te(this,$e,jc).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),L(this,Ln)))}createResult(e,n){var I;const r=L(this,je),i=this.options,s=L(this,Ln),o=L(this,ka),a=L(this,au),d=e!==r?e.state:L(this,Xd),{state:h}=e;let f={...h},p=!1,y;if(n._optimisticResults){const R=this.hasListeners(),U=!R&&$k(e,n),B=R&&Wk(e,r,n,i);(U||B)&&(f={...f,...j8(h.data,e.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:g,errorUpdatedAt:x,status:S}=f;y=f.data;let C=!1;if(n.placeholderData!==void 0&&y===void 0&&S==="pending"){let R;s!=null&&s.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(R=s.data,C=!0):R=typeof n.placeholderData=="function"?n.placeholderData((I=L(this,uu))==null?void 0:I.state.data,L(this,uu)):n.placeholderData,R!==void 0&&(S="success",y=cv(s==null?void 0:s.data,R,n),p=!0)}if(n.select&&y!==void 0&&!C)if(s&&y===(o==null?void 0:o.data)&&n.select===L(this,Zd))y=L(this,lu);else try{se(this,Zd,n.select),y=n.select(y),y=cv(s==null?void 0:s.data,y,n),se(this,lu,y),se(this,to,null)}catch(R){se(this,to,R)}L(this,to)&&(g=L(this,to),y=L(this,lu),x=Date.now(),S="error");const E=f.fetchStatus==="fetching",w=S==="pending",b=S==="error",T=w&&E,P=y!==void 0,M={status:S,fetchStatus:f.fetchStatus,isPending:w,isSuccess:S==="success",isError:b,isInitialLoading:T,isLoading:T,data:y,dataUpdatedAt:f.dataUpdatedAt,error:g,errorUpdatedAt:x,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:E,isRefetching:E&&!w,isLoadingError:b&&!P,isPaused:f.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:b&&P,isStale:xS(e,n),refetch:this.refetch,promise:L(this,ts),isEnabled:Rr(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const R=M.data!==void 0,U=M.status==="error"&&!R,B=q=>{U?q.reject(M.error):R&&q.resolve(M.data)},$=()=>{const q=se(this,ts,M.promise=dv());B(q)},Q=L(this,ts);switch(Q.status){case"pending":e.queryHash===r.queryHash&&B(Q);break;case"fulfilled":(U||M.data!==Q.value)&&$();break;case"rejected":(!U||M.error!==Q.reason)&&$();break}}return M}updateResult(){const e=L(this,Ln),n=this.createResult(L(this,je),this.options);if(se(this,ka,L(this,je).state),se(this,au,this.options),L(this,ka).data!==void 0&&se(this,uu,L(this,je)),Qp(n,e))return;se(this,Ln,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!L(this,cu).size)return!0;const o=new Set(s??L(this,cu));return this.options.throwOnError&&o.add("error"),Object.keys(L(this,Ln)).some(a=>{const l=a;return L(this,Ln)[l]!==e[l]&&o.has(l)})};Te(this,$e,z8).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Te(this,$e,gv).call(this)}},Yn=new WeakMap,je=new WeakMap,Xd=new WeakMap,Ln=new WeakMap,ka=new WeakMap,au=new WeakMap,ts=new WeakMap,to=new WeakMap,Zd=new WeakMap,lu=new WeakMap,uu=new WeakMap,Ca=new WeakMap,ba=new WeakMap,no=new WeakMap,cu=new WeakMap,$e=new WeakSet,jc=function(e){Te(this,$e,xv).call(this);let n=L(this,je).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(Dn)),n},fv=function(){Te(this,$e,yv).call(this);const e=ko(this.options.staleTime,L(this,je));if(Ld.isServer()||L(this,Ln).isStale||!lv(e))return;const r=O8(L(this,Ln).dataUpdatedAt,e)+1;se(this,Ca,da.setTimeout(()=>{L(this,Ln).isStale||this.updateResult()},r))},pv=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(L(this,je)):this.options.refetchInterval)??!1},mv=function(e){Te(this,$e,vv).call(this),se(this,no,e),!(Ld.isServer()||Rr(this.options.enabled,L(this,je))===!1||!lv(L(this,no))||L(this,no)===0)&&se(this,ba,da.setInterval(()=>{(this.options.refetchIntervalInBackground||mS.isFocused())&&Te(this,$e,jc).call(this)},L(this,no)))},gv=function(){Te(this,$e,fv).call(this),Te(this,$e,mv).call(this,Te(this,$e,pv).call(this))},yv=function(){L(this,Ca)&&(da.clearTimeout(L(this,Ca)),se(this,Ca,void 0))},vv=function(){L(this,ba)&&(da.clearInterval(L(this,ba)),se(this,ba,void 0))},xv=function(){const e=L(this,Yn).getQueryCache().build(L(this,Yn),this.options);if(e===L(this,je))return;const n=L(this,je);se(this,je,e),se(this,Xd,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},z8=function(e){Wt.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(L(this,Ln))}),L(this,Yn).getQueryCache().notify({query:L(this,je),type:"observerResultsUpdated"})})},n6);function _R(t,e){return Rr(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function $k(t,e){return _R(t,e)||t.state.data!==void 0&&Sv(t,e,e.refetchOnMount)}function Sv(t,e,n){if(Rr(e.enabled,t)!==!1&&ko(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&xS(t,e)}return!1}function Wk(t,e,n,r){return(t!==e||Rr(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&xS(t,n)}function xS(t,e){return Rr(e.enabled,t)!==!1&&t.isStaleByTime(ko(e.staleTime,t))}function NR(t,e){return!Qp(t.getCurrentResult(),e)}function Kk(t){return{onFetch:(e,n)=>{var h,f,p,y,g;const r=e.options,i=(p=(f=(h=e.fetchOptions)==null?void 0:h.meta)==null?void 0:f.fetchMore)==null?void 0:p.direction,s=((y=e.state.data)==null?void 0:y.pages)||[],o=((g=e.state.data)==null?void 0:g.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const d=async()=>{let x=!1;const S=w=>{xR(w,()=>e.signal,()=>x=!0)},C=R8(e.options,e.fetchOptions),E=async(w,b,T)=>{if(x)return Promise.reject();if(b==null&&w.pages.length)return Promise.resolve(w);const A=(()=>{const U={client:e.client,queryKey:e.queryKey,pageParam:b,direction:T?"backward":"forward",meta:e.options.meta};return S(U),U})(),M=await C(A),{maxPages:I}=e.options,R=T?vR:yR;return{pages:R(w.pages,M,I),pageParams:R(w.pageParams,b,I)}};if(i&&s.length){const w=i==="backward",b=w?TR:qk,T={pages:s,pageParams:o},P=b(r,T);a=await E(T,P,w)}else{const w=t??s.length;do{const b=l===0?o[0]??r.initialPageParam:qk(r,a);if(l>0&&b==null)break;a=await E(a,b),l++}while(l<w)}return a};e.options.persister?e.fetchFn=()=>{var x,S;return(S=(x=e.options).persister)==null?void 0:S.call(x,d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=d}}}function qk(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function TR(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var eh,_i,En,Ea,Ni,Bs,r6,MR=(r6=class extends D8{constructor(e){super();ge(this,Ni);ge(this,eh);ge(this,_i);ge(this,En);ge(this,Ea);se(this,eh,e.client),this.mutationId=e.mutationId,se(this,En,e.mutationCache),se(this,_i,[]),this.state=e.state||B8(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){L(this,_i).includes(e)||(L(this,_i).push(e),this.clearGcTimeout(),L(this,En).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){se(this,_i,L(this,_i).filter(n=>n!==e)),this.scheduleGc(),L(this,En).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){L(this,_i).length||(this.state.status==="pending"?this.scheduleGc():L(this,En).remove(this))}continue(){var e;return((e=L(this,Ea))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,a,l,d,h,f,p,y,g,x,S,C,E,w,b,T,P,A;const n=()=>{Te(this,Ni,Bs).call(this,{type:"continue"})},r={client:L(this,eh),meta:this.options.meta,mutationKey:this.options.mutationKey};se(this,Ea,I8({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(M,I)=>{Te(this,Ni,Bs).call(this,{type:"failed",failureCount:M,error:I})},onPause:()=>{Te(this,Ni,Bs).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>L(this,En).canRun(this)}));const i=this.state.status==="pending",s=!L(this,Ea).canStart();try{if(i)n();else{Te(this,Ni,Bs).call(this,{type:"pending",variables:e,isPaused:s}),L(this,En).config.onMutate&&await L(this,En).config.onMutate(e,this,r);const I=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,e,r));I!==this.state.context&&Te(this,Ni,Bs).call(this,{type:"pending",context:I,variables:e,isPaused:s})}const M=await L(this,Ea).start();return await((d=(l=L(this,En).config).onSuccess)==null?void 0:d.call(l,M,e,this.state.context,this,r)),await((f=(h=this.options).onSuccess)==null?void 0:f.call(h,M,e,this.state.context,r)),await((y=(p=L(this,En).config).onSettled)==null?void 0:y.call(p,M,null,this.state.variables,this.state.context,this,r)),await((x=(g=this.options).onSettled)==null?void 0:x.call(g,M,null,e,this.state.context,r)),Te(this,Ni,Bs).call(this,{type:"success",data:M}),M}catch(M){try{await((C=(S=L(this,En).config).onError)==null?void 0:C.call(S,M,e,this.state.context,this,r))}catch(I){Promise.reject(I)}try{await((w=(E=this.options).onError)==null?void 0:w.call(E,M,e,this.state.context,r))}catch(I){Promise.reject(I)}try{await((T=(b=L(this,En).config).onSettled)==null?void 0:T.call(b,void 0,M,this.state.variables,this.state.context,this,r))}catch(I){Promise.reject(I)}try{await((A=(P=this.options).onSettled)==null?void 0:A.call(P,void 0,M,e,this.state.context,r))}catch(I){Promise.reject(I)}throw Te(this,Ni,Bs).call(this,{type:"error",error:M}),M}finally{L(this,En).runNext(this)}}},eh=new WeakMap,_i=new WeakMap,En=new WeakMap,Ea=new WeakMap,Ni=new WeakSet,Bs=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Wt.batch(()=>{L(this,_i).forEach(r=>{r.onMutationUpdate(e)}),L(this,En).notify({mutation:this,type:"updated",action:e})})},r6);function B8(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ns,ei,th,i6,PR=(i6=class extends zu{constructor(e={}){super();ge(this,ns);ge(this,ei);ge(this,th);this.config=e,se(this,ns,new Set),se(this,ei,new Map),se(this,th,0)}build(e,n,r){const i=new MR({client:e,mutationCache:this,mutationId:++gf(this,th)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){L(this,ns).add(e);const n=Lf(e);if(typeof n=="string"){const r=L(this,ei).get(n);r?r.push(e):L(this,ei).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(L(this,ns).delete(e)){const n=Lf(e);if(typeof n=="string"){const r=L(this,ei).get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&L(this,ei).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=Lf(e);if(typeof n=="string"){const r=L(this,ei).get(n),i=r==null?void 0:r.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){var r;const n=Lf(e);if(typeof n=="string"){const i=(r=L(this,ei).get(n))==null?void 0:r.find(s=>s!==e&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Wt.batch(()=>{L(this,ns).forEach(e=>{this.notify({type:"removed",mutation:e})}),L(this,ns).clear(),L(this,ei).clear()})}getAll(){return Array.from(L(this,ns))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>Bk(n,r))}findAll(e={}){return this.getAll().filter(n=>Bk(e,n))}notify(e){Wt.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Wt.batch(()=>Promise.all(e.map(n=>n.continue().catch(Dn))))}},ns=new WeakMap,ei=new WeakMap,th=new WeakMap,i6);function Lf(t){var e;return(e=t.options.scope)==null?void 0:e.id}var rs,ro,Jn,is,fs,fp,wv,s6,OR=(s6=class extends zu{constructor(n,r){super();ge(this,fs);ge(this,rs);ge(this,ro);ge(this,Jn);ge(this,is);se(this,rs,n),this.setOptions(r),this.bindMethods(),Te(this,fs,fp).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var i;const r=this.options;this.options=L(this,rs).defaultMutationOptions(n),Qp(this.options,r)||L(this,rs).getMutationCache().notify({type:"observerOptionsUpdated",mutation:L(this,Jn),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Ba(r.mutationKey)!==Ba(this.options.mutationKey)?this.reset():((i=L(this,Jn))==null?void 0:i.state.status)==="pending"&&L(this,Jn).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=L(this,Jn))==null||n.removeObserver(this)}onMutationUpdate(n){Te(this,fs,fp).call(this),Te(this,fs,wv).call(this,n)}getCurrentResult(){return L(this,ro)}reset(){var n;(n=L(this,Jn))==null||n.removeObserver(this),se(this,Jn,void 0),Te(this,fs,fp).call(this),Te(this,fs,wv).call(this)}mutate(n,r){var i;return se(this,is,r),(i=L(this,Jn))==null||i.removeObserver(this),se(this,Jn,L(this,rs).getMutationCache().build(L(this,rs),this.options)),L(this,Jn).addObserver(this),L(this,Jn).execute(n)}},rs=new WeakMap,ro=new WeakMap,Jn=new WeakMap,is=new WeakMap,fs=new WeakSet,fp=function(){var r;const n=((r=L(this,Jn))==null?void 0:r.state)??B8();se(this,ro,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},wv=function(n){Wt.batch(()=>{var r,i,s,o,a,l,d,h;if(L(this,is)&&this.hasListeners()){const f=L(this,ro).variables,p=L(this,ro).context,y={client:L(this,rs),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(i=(r=L(this,is)).onSuccess)==null||i.call(r,n.data,f,p,y)}catch(g){Promise.reject(g)}try{(o=(s=L(this,is)).onSettled)==null||o.call(s,n.data,null,f,p,y)}catch(g){Promise.reject(g)}}else if((n==null?void 0:n.type)==="error"){try{(l=(a=L(this,is)).onError)==null||l.call(a,n.error,f,p,y)}catch(g){Promise.reject(g)}try{(h=(d=L(this,is)).onSettled)==null||h.call(d,void 0,n.error,f,p,y)}catch(g){Promise.reject(g)}}}this.listeners.forEach(f=>{f(L(this,ro))})})},s6),Ti,o6,AR=(o6=class extends zu{constructor(e={}){super();ge(this,Ti);this.config=e,se(this,Ti,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??gS(i,n);let o=this.get(s);return o||(o=new bR({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){L(this,Ti).has(e.queryHash)||(L(this,Ti).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=L(this,Ti).get(e.queryHash);n&&(e.destroy(),n===e&&L(this,Ti).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Wt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return L(this,Ti).get(e)}getAll(){return[...L(this,Ti).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>zk(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>zk(e,r)):n}notify(e){Wt.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Wt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Wt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ti=new WeakMap,o6),Nt,io,so,du,hu,oo,fu,pu,a6,RR=(a6=class{constructor(t={}){ge(this,Nt);ge(this,io);ge(this,so);ge(this,du);ge(this,hu);ge(this,oo);ge(this,fu);ge(this,pu);se(this,Nt,t.queryCache||new AR),se(this,io,t.mutationCache||new PR),se(this,so,t.defaultOptions||{}),se(this,du,new Map),se(this,hu,new Map),se(this,oo,0)}mount(){gf(this,oo)._++,L(this,oo)===1&&(se(this,fu,mS.subscribe(async t=>{t&&(await this.resumePausedMutations(),L(this,Nt).onFocus())})),se(this,pu,Yp.subscribe(async t=>{t&&(await this.resumePausedMutations(),L(this,Nt).onOnline())})))}unmount(){var t,e;gf(this,oo)._--,L(this,oo)===0&&((t=L(this,fu))==null||t.call(this),se(this,fu,void 0),(e=L(this,pu))==null||e.call(this),se(this,pu,void 0))}isFetching(t){return L(this,Nt).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return L(this,io).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=L(this,Nt).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=L(this,Nt).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(ko(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return L(this,Nt).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),i=L(this,Nt).get(r.queryHash),s=i==null?void 0:i.state.data,o=pR(e,s);if(o!==void 0)return L(this,Nt).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return Wt.batch(()=>L(this,Nt).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=L(this,Nt).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=L(this,Nt);Wt.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=L(this,Nt);return Wt.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Wt.batch(()=>L(this,Nt).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(Dn).catch(Dn)}invalidateQueries(t,e={}){return Wt.batch(()=>(L(this,Nt).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=Wt.batch(()=>L(this,Nt).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(Dn)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Dn)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=L(this,Nt).build(this,e);return n.isStaleByTime(ko(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Dn).catch(Dn)}fetchInfiniteQuery(t){return t.behavior=Kk(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Dn).catch(Dn)}ensureInfiniteQueryData(t){return t.behavior=Kk(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Yp.isOnline()?L(this,io).resumePausedMutations():Promise.resolve()}getQueryCache(){return L(this,Nt)}getMutationCache(){return L(this,io)}getDefaultOptions(){return L(this,so)}setDefaultOptions(t){se(this,so,t)}setQueryDefaults(t,e){L(this,du).set(Ba(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...L(this,du).values()],n={};return e.forEach(r=>{Rd(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){L(this,hu).set(Ba(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...L(this,hu).values()],n={};return e.forEach(r=>{Rd(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...L(this,so).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=gS(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===yS&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...L(this,so).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){L(this,Nt).clear(),L(this,io).clear()}},Nt=new WeakMap,io=new WeakMap,so=new WeakMap,du=new WeakMap,hu=new WeakMap,oo=new WeakMap,fu=new WeakMap,pu=new WeakMap,a6),U8=z.createContext(void 0),SS=t=>{const e=z.useContext(U8);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},LR=({client:t,children:e})=>(z.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),N.jsx(U8.Provider,{value:t,children:e})),H8=z.createContext(!1),IR=()=>z.useContext(H8);H8.Provider;function DR(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var FR=z.createContext(DR()),jR=()=>z.useContext(FR),zR=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?vS(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},BR=t=>{z.useEffect(()=>{t.clearReset()},[t])},UR=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||vS(n,[t.error,r])),HR=t=>{if(t.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},VR=(t,e)=>t.isLoading&&t.isFetching&&!e,GR=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,Qk=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function $R(t,e,n){var p,y,g,x;const r=IR(),i=jR(),s=SS(),o=s.defaultQueryOptions(t);(y=(p=s.getDefaultOptions().queries)==null?void 0:p._experimental_beforeQuery)==null||y.call(p,o);const a=s.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",HR(o),zR(o,i,a),BR(i);const l=!s.getQueryCache().get(o.queryHash),[d]=z.useState(()=>new e(s,o)),h=d.getOptimisticResult(o),f=!r&&t.subscribed!==!1;if(z.useSyncExternalStore(z.useCallback(S=>{const C=f?d.subscribe(Wt.batchCalls(S)):Dn;return d.updateResult(),C},[d,f]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),z.useEffect(()=>{d.setOptions(o)},[o,d]),GR(o,h))throw Qk(o,d,i);if(UR({result:h,errorResetBoundary:i,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw h.error;if((x=(g=s.getDefaultOptions().queries)==null?void 0:g._experimental_afterQuery)==null||x.call(g,o,h),o.experimental_prefetchInRender&&!Ld.isServer()&&VR(h,r)){const S=l?Qk(o,d,i):a==null?void 0:a.promise;S==null||S.catch(Dn).finally(()=>{d.updateResult()})}return o.notifyOnChangeProps?h:d.trackResult(h)}function wS(t,e){return $R(t,ER)}function WR(t,e){const n=SS(),[r]=z.useState(()=>new OR(n,t));z.useEffect(()=>{r.setOptions(t)},[r,t]);const i=z.useSyncExternalStore(z.useCallback(o=>r.subscribe(Wt.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=z.useCallback((o,a)=>{r.mutate(o,a).catch(Dn)},[r]);if(i.error&&vS(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:s,mutateAsync:i.mutate}}/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var KR={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"};/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const qR=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),Fe=(t,e)=>{const n=z.forwardRef(({color:r="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:o,className:a="",children:l,...d},h)=>z.createElement("svg",{ref:h,...KR,width:i,height:i,stroke:r,strokeWidth:o?Number(s)*24/Number(i):s,className:["lucide",`lucide-${qR(t)}`,a].join(" "),...d},[...e.map(([f,p])=>z.createElement(f,p)),...Array.isArray(l)?l:[l]]));return n.displayName=`${t}`,n};/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const QR=Fe("AlignCenter",[["line",{x1:"21",x2:"3",y1:"6",y2:"6",key:"1fp77t"}],["line",{x1:"17",x2:"7",y1:"12",y2:"12",key:"rsh8ii"}],["line",{x1:"19",x2:"5",y1:"18",y2:"18",key:"1t0tuv"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const YR=Fe("AlignLeft",[["line",{x1:"21",x2:"3",y1:"6",y2:"6",key:"1fp77t"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}],["line",{x1:"17",x2:"3",y1:"18",y2:"18",key:"1awlsn"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const JR=Fe("AlignRight",[["line",{x1:"21",x2:"3",y1:"6",y2:"6",key:"1fp77t"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}],["line",{x1:"21",x2:"7",y1:"18",y2:"18",key:"1g9eri"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const XR=Fe("Bold",[["path",{d:"M14 12a4 4 0 0 0 0-8H6v8",key:"v2sylx"}],["path",{d:"M15 20a4 4 0 0 0 0-8H6v8Z",key:"1ef5ya"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Id=Fe("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ZR=Fe("CheckCircle",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const eL=Fe("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const tL=Fe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const nL=Fe("Cpu",[["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"9",y:"9",width:"6",height:"6",key:"o3kz5p"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const V8=Fe("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const rL=Fe("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const iL=Fe("FileText",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["line",{x1:"16",x2:"8",y1:"13",y2:"13",key:"14keom"}],["line",{x1:"16",x2:"8",y1:"17",y2:"17",key:"17nazh"}],["line",{x1:"10",x2:"8",y1:"9",y2:"9",key:"1a5vjj"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const G8=Fe("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const sL=Fe("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"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const oL=Fe("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"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const aL=Fe("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"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const kS=Fe("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"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const lL=Fe("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"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const uL=Fe("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"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const cL=Fe("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"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const dL=Fe("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const hL=Fe("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const $8=Fe("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z",key:"ymcmye"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const fL=Fe("Quote",[["path",{d:"M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z",key:"4rm80e"}],["path",{d:"M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z",key:"10za9r"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const pL=Fe("Redo2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5v0A5.5 5.5 0 0 0 9.5 20H13",key:"19mnr4"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const mL=Fe("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const gL=Fe("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const W8=Fe("Sparkles",[["path",{d:"m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z",key:"17u4zn"}],["path",{d:"M5 3v4",key:"bklmnn"}],["path",{d:"M19 17v4",key:"iiml17"}],["path",{d:"M3 5h4",key:"nem4j1"}],["path",{d:"M17 19h4",key:"lbex7p"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const yL=Fe("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"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const vL=Fe("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"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const pp=Fe("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const xL=Fe("Underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const SL=Fe("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5v0a5.5 5.5 0 0 1-5.5 5.5H11",key:"llx8ln"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const K8=Fe("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ua=Fe("Wand2",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72Z",key:"1bcowg"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/**
* @license lucide-react v0.303.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const wL=Fe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),ke=t=>typeof t=="string",bc=()=>{let t,e;const n=new Promise((r,i)=>{t=r,e=i});return n.resolve=t,n.reject=e,n},Yk=t=>t==null?"":String(t),kL=(t,e,n)=>{t.forEach(r=>{e[r]&&(n[r]=e[r])})},CL=/###/g,Jk=t=>t&&t.includes("###")?t.replace(CL,"."):t,Xk=t=>!t||ke(t),td=(t,e,n)=>{const r=ke(e)?e.split("."):e;let i=0;for(;i<r.length-1;){if(Xk(t))return{};const s=Jk(r[i]);!t[s]&&n&&(t[s]=new n),Object.prototype.hasOwnProperty.call(t,s)?t=t[s]:t={},++i}return Xk(t)?{}:{obj:t,k:Jk(r[i])}},Zk=(t,e,n)=>{const{obj:r,k:i}=td(t,e,Object);if(r!==void 0||e.length===1){r[i]=n;return}let s=e[e.length-1],o=e.slice(0,e.length-1),a=td(t,o,Object);for(;a.obj===void 0&&o.length;)s=`${o[o.length-1]}.${s}`,o=o.slice(0,o.length-1),a=td(t,o,Object),a!=null&&a.obj&&typeof a.obj[`${a.k}.${s}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${s}`]=n},bL=(t,e,n,r)=>{const{obj:i,k:s}=td(t,e,Object);i[s]=i[s]||[],i[s].push(n)},Jp=(t,e)=>{const{obj:n,k:r}=td(t,e);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},EL=(t,e,n)=>{const r=Jp(t,n);return r!==void 0?r:Jp(e,n)},q8=(t,e,n)=>{for(const r in e)r!=="__proto__"&&r!=="constructor"&&(r in t?ke(t[r])||t[r]instanceof String||ke(e[r])||e[r]instanceof String?n&&(t[r]=e[r]):q8(t[r],e[r],n):t[r]=e[r]);return t},ta=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),_L={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},NL=t=>ke(t)?t.replace(/[&<>"'\/]/g,e=>_L[e]):t;class TL{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const n=this.regExpMap.get(e);if(n!==void 0)return n;const r=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,r),this.regExpQueue.push(e),r}}const ML=[" ",",","?","!",";"],PL=new TL(20),OL=(t,e,n)=>{e=e||"",n=n||"";const r=ML.filter(o=>!e.includes(o)&&!n.includes(o));if(r.length===0)return!0;const i=PL.getRegExp(`(${r.map(o=>o==="?"?"\\?":o).join("|")})`);let s=!i.test(t);if(!s){const o=t.indexOf(n);o>0&&!i.test(t.substring(0,o))&&(s=!0)}return s},kv=(t,e,n=".")=>{if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;const r=e.split(n);let i=t;for(let s=0;s<r.length;){if(!i||typeof i!="object")return;let o,a="";for(let l=s;l<r.length;++l)if(l!==s&&(a+=n),a+=r[l],o=i[a],o!==void 0){if(["string","number","boolean"].includes(typeof o)&&l<r.length-1)continue;s+=l-s+1;break}i=o}return i},Dd=t=>t==null?void 0:t.replace(/_/g,"-"),AL={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){var n,r;(r=(n=console==null?void 0:console[t])==null?void 0:n.apply)==null||r.call(n,console,e)}};class Xp{constructor(e,n={}){this.init(e,n)}init(e,n={}){this.prefix=n.prefix||"i18next:",this.logger=e||AL,this.options=n,this.debug=n.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,n,r,i){return i&&!this.debug?null:(ke(e[0])&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new Xp(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new Xp(this.logger,e)}}var Oi=new Xp;let pg=class{constructor(){this.observers={}}on(e,n){return e.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const i=this.observers[r].get(n)||0;this.observers[r].set(n,i+1)}),this}off(e,n){if(this.observers[e]){if(!n){delete this.observers[e];return}this.observers[e].delete(n)}}once(e,n){const r=(...i)=>{n(...i),this.off(e,r)};return this.on(e,r),this}emit(e,...n){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([i,s])=>{for(let o=0;o<s;o++)i(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([i,s])=>{for(let o=0;o<s;o++)i(e,...n)})}};class e5 extends pg{constructor(e,n={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.includes(e)||this.options.ns.push(e)}removeNamespaces(e){const n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,r,i={}){var d,h;const s=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,o=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;e.includes(".")?a=e.split("."):(a=[e,n],r&&(Array.isArray(r)?a.push(...r):ke(r)&&s?a.push(...r.split(s)):a.push(r)));const l=Jp(this.data,a);return!l&&!n&&!r&&e.includes(".")&&(e=a[0],n=a[1],r=a.slice(2).join(".")),l||!o||!ke(r)?l:kv((h=(d=this.data)==null?void 0:d[e])==null?void 0:h[n],r,s)}addResource(e,n,r,i,s={silent:!1}){const o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let a=[e,n];r&&(a=a.concat(o?r.split(o):r)),e.includes(".")&&(a=e.split("."),i=n,n=a[1]),this.addNamespaces(n),Zk(this.data,a,i),s.silent||this.emit("added",e,n,r,i)}addResources(e,n,r,i={silent:!1}){for(const s in r)(ke(r[s])||Array.isArray(r[s]))&&this.addResource(e,n,s,r[s],{silent:!0});i.silent||this.emit("added",e,n,r)}addResourceBundle(e,n,r,i,s,o={silent:!1,skipCopy:!1}){let a=[e,n];e.includes(".")&&(a=e.split("."),i=r,r=n,n=a[1]),this.addNamespaces(n);let l=Jp(this.data,a)||{};o.skipCopy||(r=JSON.parse(JSON.stringify(r))),i?q8(l,r,s):l={...l,...r},Zk(this.data,a,l),o.silent||this.emit("added",e,n,r)}removeResourceBundle(e,n){this.hasResourceBundle(e,n)&&delete this.data[e][n],this.removeNamespaces(n),this.emit("removed",e,n)}hasResourceBundle(e,n){return this.getResource(e,n)!==void 0}getResourceBundle(e,n){return n||(n=this.options.defaultNS),this.getResource(e,n)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const n=this.getDataByLanguage(e);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var Q8={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,r,i){return t.forEach(s=>{var o;e=((o=this.processors[s])==null?void 0:o.process(e,n,r,i))??e}),e}};const Y8=Symbol("i18next/PATH_KEY");function RL(){const t=[],e=Object.create(null);let n;return e.get=(r,i)=>{var s;return(s=n==null?void 0:n.revoke)==null||s.call(n),i===Y8?t:(t.push(i),n=Proxy.revocable(r,e),n.proxy)},Proxy.revocable(Object.create(null),e).proxy}function eu(t,e){const{[Y8]:n}=t(RL()),r=(e==null?void 0:e.keySeparator)??".",i=(e==null?void 0:e.nsSeparator)??":";if(n.length>1&&i){const s=e==null?void 0:e.ns,o=Array.isArray(s)?s:null;if(o&&o.length>1&&o.slice(1).includes(n[0]))return`${n[0]}${i}${n.slice(1).join(r)}`}return n.join(r)}const vy=t=>!ke(t)&&typeof t!="boolean"&&typeof t!="number";class Zp extends pg{constructor(e,n={}){super(),kL(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Oi.create("translator"),this.checkedLoadedFor={}}changeLanguage(e){e&&(this.language=e)}exists(e,n={interpolation:{}}){const r={...n};if(e==null)return!1;const i=this.resolve(e,r);if((i==null?void 0:i.res)===void 0)return!1;const s=vy(i.res);return!(r.returnObjects===!1&&s)}extractFromKey(e,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let s=n.ns||this.options.defaultNS||[];const o=r&&e.includes(r),a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!OL(e,r,i);if(o&&!a){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:ke(s)?[s]:s};const d=e.split(r);(r!==i||r===i&&this.options.ns.includes(d[0]))&&(s=d.shift()),e=d.join(i)}return{key:e,namespaces:ke(s)?[s]:s}}translate(e,n,r){let i=typeof n=="object"?{...n}:n;if(typeof i!="object"&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i=="object"&&(i={...i}),i||(i={}),e==null)return"";typeof e=="function"&&(e=eu(e,{...this.options,...i})),Array.isArray(e)||(e=[String(e)]),e=e.map($=>typeof $=="function"?eu($,{...this.options,...i}):String($));const s=i.returnDetails!==void 0?i.returnDetails:this.options.returnDetails,o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,{key:a,namespaces:l}=this.extractFromKey(e[e.length-1],i),d=l[l.length-1];let h=i.nsSeparator!==void 0?i.nsSeparator:this.options.nsSeparator;h===void 0&&(h=":");const f=i.lng||this.language,p=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((f==null?void 0:f.toLowerCase())==="cimode")return p?s?{res:`${d}${h}${a}`,usedKey:a,exactUsedKey:a,usedLng:f,usedNS:d,usedParams:this.getUsedParamsDetails(i)}:`${d}${h}${a}`:s?{res:a,usedKey:a,exactUsedKey:a,usedLng:f,usedNS:d,usedParams:this.getUsedParamsDetails(i)}:a;const y=this.resolve(e,i);let g=y==null?void 0:y.res;const x=(y==null?void 0:y.usedKey)||a,S=(y==null?void 0:y.exactUsedKey)||a,C=["[object Number]","[object Function]","[object RegExp]"],E=i.joinArrays!==void 0?i.joinArrays:this.options.joinArrays,w=!this.i18nFormat||this.i18nFormat.handleAsObject,b=i.count!==void 0&&!ke(i.count),T=Zp.hasDefaultValue(i),P=b?this.pluralResolver.getSuffix(f,i.count,i):"",A=i.ordinal&&b?this.pluralResolver.getSuffix(f,i.count,{ordinal:!1}):"",M=b&&!i.ordinal&&i.count===0,I=M&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${P}`]||i[`defaultValue${A}`]||i.defaultValue;let R=g;w&&!g&&T&&(R=I);const U=vy(R),B=Object.prototype.toString.apply(R);if(w&&R&&U&&!C.includes(B)&&!(ke(E)&&Array.isArray(R))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const $=this.options.returnedObjectHandler?this.options.returnedObjectHandler(x,R,{...i,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return s?(y.res=$,y.usedParams=this.getUsedParamsDetails(i),y):$}if(o){const $=Array.isArray(R),Q=$?[]:{},q=$?S:x;for(const ie in R)if(Object.prototype.hasOwnProperty.call(R,ie)){const fe=`${q}${o}${ie}`;T&&!g?Q[ie]=this.translate(fe,{...i,defaultValue:vy(I)?I[ie]:void 0,joinArrays:!1,ns:l}):Q[ie]=this.translate(fe,{...i,joinArrays:!1,ns:l}),Q[ie]===fe&&(Q[ie]=R[ie])}g=Q}}else if(w&&ke(E)&&Array.isArray(g))g=g.join(E),g&&(g=this.extendTranslation(g,e,i,r));else{let $=!1,Q=!1;!this.isValidLookup(g)&&T&&($=!0,g=I),this.isValidLookup(g)||(Q=!0,g=a);const ie=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&Q?void 0:g,fe=T&&I!==g&&this.options.updateMissing;if(Q||$||fe){if(this.logger.log(fe?"updateKey":"missingKey",f,d,a,fe?I:g),o){const Y=this.resolve(a,{...i,keySeparator:!1});Y&&Y.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let W=[];const re=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&re&&re[0])for(let Y=0;Y<re.length;Y++)W.push(re[Y]);else this.options.saveMissingTo==="all"?W=this.languageUtils.toResolveHierarchy(i.lng||this.language):W.push(i.lng||this.language);const te=(Y,oe,_e)=>{var yt;const rt=T&&_e!==g?_e:ie;this.options.missingKeyHandler?this.options.missingKeyHandler(Y,d,oe,rt,fe,i):(yt=this.backendConnector)!=null&&yt.saveMissing&&this.backendConnector.saveMissing(Y,d,oe,rt,fe,i),this.emit("missingKey",Y,d,oe,g)};this.options.saveMissing&&(this.options.saveMissingPlurals&&b?W.forEach(Y=>{const oe=this.pluralResolver.getSuffixes(Y,i);M&&i[`defaultValue${this.options.pluralSeparator}zero`]&&!oe.includes(`${this.options.pluralSeparator}zero`)&&oe.push(`${this.options.pluralSeparator}zero`),oe.forEach(_e=>{te([Y],a+_e,i[`defaultValue${_e}`]||I)})}):te(W,a,I))}g=this.extendTranslation(g,e,i,y,r),Q&&g===a&&this.options.appendNamespaceToMissingKey&&(g=`${d}${h}${a}`),(Q||$)&&this.options.parseMissingKeyHandler&&(g=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${d}${h}${a}`:a,$?g:void 0,i))}return s?(y.res=g,y.usedParams=this.getUsedParamsDetails(i),y):g}extendTranslation(e,n,r,i,s){var l,d;if((l=this.i18nFormat)!=null&&l.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const h=ke(e)&&(((d=r==null?void 0:r.interpolation)==null?void 0:d.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let f;if(h){const y=e.match(this.interpolator.nestingRegexp);f=y&&y.length}let p=r.replace&&!ke(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(p={...this.options.interpolation.defaultVariables,...p}),e=this.interpolator.interpolate(e,p,r.lng||this.language||i.usedLng,r),h){const y=e.match(this.interpolator.nestingRegexp),g=y&&y.length;f<g&&(r.nest=!1)}!r.lng&&i&&i.res&&(r.lng=this.language||i.usedLng),r.nest!==!1&&(e=this.interpolator.nest(e,(...y)=>(s==null?void 0:s[0])===y[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${y[0]} in key: ${n[0]}`),null):this.translate(...y,n),r)),r.interpolation&&this.interpolator.reset()}const o=r.postProcess||this.options.postProcess,a=ke(o)?[o]:o;return e!=null&&(a!=null&&a.length)&&r.applyPostProcessor!==!1&&(e=Q8.handle(a,e,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),e}resolve(e,n={}){let r,i,s,o,a;return ke(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(l=>typeof l=="function"?eu(l,{...this.options,...n}):l)),e.forEach(l=>{if(this.isValidLookup(r))return;const d=this.extractFromKey(l,n),h=d.key;i=h;let f=d.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const p=n.count!==void 0&&!ke(n.count),y=p&&!n.ordinal&&n.count===0,g=n.context!==void 0&&(ke(n.context)||typeof n.context=="number")&&n.context!=="",x=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);f.forEach(S=>{var C,E;this.isValidLookup(r)||(a=S,!this.checkedLoadedFor[`${x[0]}-${S}`]&&((C=this.utils)!=null&&C.hasLoadedNamespace)&&!((E=this.utils)!=null&&E.hasLoadedNamespace(a))&&(this.checkedLoadedFor[`${x[0]}-${S}`]=!0,this.logger.warn(`key "${i}" for languages "${x.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),x.forEach(w=>{var P;if(this.isValidLookup(r))return;o=w;const b=[h];if((P=this.i18nFormat)!=null&&P.addLookupKeys)this.i18nFormat.addLookupKeys(b,h,w,S,n);else{let A;p&&(A=this.pluralResolver.getSuffix(w,n.count,n));const M=`${this.options.pluralSeparator}zero`,I=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(p&&(n.ordinal&&A.startsWith(I)&&b.push(h+A.replace(I,this.options.pluralSeparator)),b.push(h+A),y&&b.push(h+M)),g){const R=`${h}${this.options.contextSeparator||"_"}${n.context}`;b.push(R),p&&(n.ordinal&&A.startsWith(I)&&b.push(R+A.replace(I,this.options.pluralSeparator)),b.push(R+A),y&&b.push(R+M))}}let T;for(;T=b.pop();)this.isValidLookup(r)||(s=T,r=this.getResource(w,S,T,n))}))})}),{res:r,usedKey:i,exactUsedKey:s,usedLng:o,usedNS:a}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,r,i={}){var s;return(s=this.i18nFormat)!=null&&s.getResource?this.i18nFormat.getResource(e,n,r,i):this.resourceStore.getResource(e,n,r,i)}getUsedParamsDetails(e={}){const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=e.replace&&!ke(e.replace);let i=r?e.replace:e;if(r&&typeof e.count<"u"&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!r){i={...i};for(const s of n)delete i[s]}return i}static hasDefaultValue(e){const n="defaultValue";for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&r.startsWith(n)&&e[r]!==void 0)return!0;return!1}}class t5{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Oi.create("languageUtils")}getScriptPartFromCode(e){if(e=Dd(e),!e||!e.includes("-"))return null;const n=e.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(e){if(e=Dd(e),!e||!e.includes("-"))return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(ke(e)&&e.includes("-")){let n;try{n=Intl.getCanonicalLocales(e)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(e)}getBestMatchFromCodes(e){if(!e)return null;let n;return e.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&e.forEach(r=>{if(n)return;const i=this.getScriptPartFromCode(r);if(this.isSupportedCode(i))return n=i;const s=this.getLanguagePartFromCode(r);if(this.isSupportedCode(s))return n=s;n=this.options.supportedLngs.find(o=>o===s?!0:!o.includes("-")&&!s.includes("-")?!1:!!(o.includes("-")&&!s.includes("-")&&o.slice(0,o.indexOf("-"))===s||o.startsWith(s)&&s.length>1))}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),ke(e)&&(e=[e]),Array.isArray(e))return e;if(!n)return e.default||[];let r=e[n];return r||(r=e[this.getScriptPartFromCode(n)]),r||(r=e[this.formatLanguageCode(n)]),r||(r=e[this.getLanguagePartFromCode(n)]),r||(r=e.default),r||[]}toResolveHierarchy(e,n){const r=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],e),i=[],s=o=>{o&&(this.isSupportedCode(o)?i.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return ke(e)&&(e.includes("-")||e.includes("_"))?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(e))):ke(e)&&s(this.formatLanguageCode(e)),r.forEach(o=>{i.includes(o)||s(this.formatLanguageCode(o))}),i}}const n5={zero:0,one:1,two:2,few:3,many:4,other:5},r5={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class LL{constructor(e,n={}){this.languageUtils=e,this.options=n,this.logger=Oi.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,n={}){const r=Dd(e==="dev"?"en":e),i=n.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:r,type:i});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let o;try{o=new Intl.PluralRules(r,{type:i})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),r5;if(!e.match(/-|_/))return r5;const l=this.languageUtils.getLanguagePartFromCode(e);o=this.getRule(l,n)}return this.pluralRulesCache[s]=o,o}needsPlural(e,n={}){let r=this.getRule(e,n);return r||(r=this.getRule("dev",n)),(r==null?void 0:r.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,n,r={}){return this.getSuffixes(e,r).map(i=>`${n}${i}`)}getSuffixes(e,n={}){let r=this.getRule(e,n);return r||(r=this.getRule("dev",n)),r?r.resolvedOptions().pluralCategories.sort((i,s)=>n5[i]-n5[s]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):[]}getSuffix(e,n,r={}){const i=this.getRule(e,r);return i?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",n,r))}}const i5=(t,e,n,r=".",i=!0)=>{let s=EL(t,e,n);return!s&&i&&ke(n)&&(s=kv(t,n,r),s===void 0&&(s=kv(e,n,r))),s},xy=t=>t.replace(/\$/g,"$$$$");class s5{constructor(e={}){var n;this.logger=Oi.create("interpolator"),this.options=e,this.format=((n=e==null?void 0:e.interpolation)==null?void 0:n.format)||(r=>r),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:i,prefix:s,prefixEscaped:o,suffix:a,suffixEscaped:l,formatSeparator:d,unescapeSuffix:h,unescapePrefix:f,nestingPrefix:p,nestingPrefixEscaped:y,nestingSuffix:g,nestingSuffixEscaped:x,nestingOptionsSeparator:S,maxReplaces:C,alwaysFormat:E}=e.interpolation;this.escape=n!==void 0?n:NL,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=s?ta(s):o||"{{",this.suffix=a?ta(a):l||"}}",this.formatSeparator=d||",",this.unescapePrefix=h?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":h||"",this.nestingPrefix=p?ta(p):y||ta("$t("),this.nestingSuffix=g?ta(g):x||ta(")"),this.nestingOptionsSeparator=S||",",this.maxReplaces=C||1e3,this.alwaysFormat=E!==void 0?E:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(n,r)=>(n==null?void 0:n.source)===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,n,r,i){var y;let s,o,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},d=g=>{if(!g.includes(this.formatSeparator)){const E=i5(n,l,g,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(E,void 0,r,{...i,...n,interpolationkey:g}):E}const x=g.split(this.formatSeparator),S=x.shift().trim(),C=x.join(this.formatSeparator).trim();return this.format(i5(n,l,S,this.options.keySeparator,this.options.ignoreJSONStructure),C,r,{...i,...n,interpolationkey:S})};this.resetRegExp();const h=(i==null?void 0:i.missingInterpolationHandler)||this.options.missingInterpolationHandler,f=((y=i==null?void 0:i.interpolation)==null?void 0:y.skipOnVariables)!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:g=>xy(g)},{regex:this.regexp,safeValue:g=>this.escapeValue?xy(this.escape(g)):xy(g)}].forEach(g=>{for(a=0;s=g.regex.exec(e);){const x=s[1].trim();if(o=d(x),o===void 0)if(typeof h=="function"){const C=h(e,s,i);o=ke(C)?C:""}else if(i&&Object.prototype.hasOwnProperty.call(i,x))o="";else if(f){o=s[0];continue}else this.logger.warn(`missed to pass in variable ${x} for interpolating ${e}`),o="";else!ke(o)&&!this.useRawValueToEscape&&(o=Yk(o));const S=g.safeValue(o);if(e=e.replace(s[0],S),f?(g.regex.lastIndex+=o.length,g.regex.lastIndex-=s[0].length):g.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,n,r={}){let i,s,o;const a=(l,d)=>{const h=this.nestingOptionsSeparator;if(!l.includes(h))return l;const f=l.split(new RegExp(`${ta(h)}[ ]*{`));let p=`{${f[1]}`;l=f[0],p=this.interpolate(p,o);const y=p.match(/'/g),g=p.match(/"/g);(((y==null?void 0:y.length)??0)%2===0&&!g||((g==null?void 0:g.length)??0)%2!==0)&&(p=p.replace(/'/g,'"'));try{o=JSON.parse(p),d&&(o={...d,...o})}catch(x){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,x),`${l}${h}${p}`}return o.defaultValue&&o.defaultValue.includes(this.prefix)&&delete o.defaultValue,l};for(;i=this.nestingRegexp.exec(e);){let l=[];o={...r},o=o.replace&&!ke(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;const d=/{.*}/.test(i[1])?i[1].lastIndexOf("}")+1:i[1].indexOf(this.formatSeparator);if(d!==-1&&(l=i[1].slice(d).split(this.formatSeparator).map(h=>h.trim()).filter(Boolean),i[1]=i[1].slice(0,d)),s=n(a.call(this,i[1].trim(),o),o),s&&i[0]===e&&!ke(s))return s;ke(s)||(s=Yk(s)),s||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),s=""),l.length&&(s=l.reduce((h,f)=>this.format(h,f,r.lng,{...r,interpolationkey:i[1].trim()}),s.trim())),e=e.replace(i[0],s),this.regexp.lastIndex=0}return e}}const IL=t=>{let e=t.toLowerCase().trim();const n={};if(t.includes("(")){const r=t.split("(");e=r[0].toLowerCase().trim();const i=r[1].slice(0,-1);e==="currency"&&!i.includes(":")?n.currency||(n.currency=i.trim()):e==="relativetime"&&!i.includes(":")?n.range||(n.range=i.trim()):i.split(";").forEach(o=>{if(o){const[a,...l]=o.split(":"),d=l.join(":").trim().replace(/^'+|'+$/g,""),h=a.trim();n[h]||(n[h]=d),d==="false"&&(n[h]=!1),d==="true"&&(n[h]=!0),isNaN(d)||(n[h]=parseInt(d,10))}})}return{formatName:e,formatOptions:n}},o5=t=>{const e={};return(n,r,i)=>{let s=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(s={...s,[i.interpolationkey]:void 0});const o=r+JSON.stringify(s);let a=e[o];return a||(a=t(Dd(r),i),e[o]=a),a(n)}},DL=t=>(e,n,r)=>t(Dd(n),r)(e);class FL{constructor(e={}){this.logger=Oi.create("formatter"),this.options=e,this.init(e)}init(e,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const r=n.cacheInBuiltFormats?o5:DL;this.formats={number:r((i,s)=>{const o=new Intl.NumberFormat(i,{...s});return a=>o.format(a)}),currency:r((i,s)=>{const o=new Intl.NumberFormat(i,{...s,style:"currency"});return a=>o.format(a)}),datetime:r((i,s)=>{const o=new Intl.DateTimeFormat(i,{...s});return a=>o.format(a)}),relativetime:r((i,s)=>{const o=new Intl.RelativeTimeFormat(i,{...s});return a=>o.format(a,s.range||"day")}),list:r((i,s)=>{const o=new Intl.ListFormat(i,{...s});return a=>o.format(a)})}}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=o5(n)}format(e,n,r,i={}){if(!n||e==null)return e;const s=n.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&!s[0].includes(")")&&s.find(a=>a.includes(")"))){const a=s.findIndex(l=>l.includes(")"));s[0]=[s[0],...s.splice(1,a)].join(this.formatSeparator)}return s.reduce((a,l)=>{var f;const{formatName:d,formatOptions:h}=IL(l);if(this.formats[d]){let p=a;try{const y=((f=i==null?void 0:i.formatParams)==null?void 0:f[i.interpolationkey])||{},g=y.locale||y.lng||i.locale||i.lng||r;p=this.formats[d](a,g,{...h,...i,...y})}catch(y){this.logger.warn(y)}return p}else this.logger.warn(`there was no format function for ${d}`);return a},e)}}const jL=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class zL extends pg{constructor(e,n,r,i={}){var s,o;super(),this.backend=e,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=i,this.logger=Oi.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],(o=(s=this.backend)==null?void 0:s.init)==null||o.call(s,r,i.backend,i)}queueLoad(e,n,r,i){const s={},o={},a={},l={};return e.forEach(d=>{let h=!0;n.forEach(f=>{const p=`${d}|${f}`;!r.reload&&this.store.hasResourceBundle(d,f)?this.state[p]=2:this.state[p]<0||(this.state[p]===1?o[p]===void 0&&(o[p]=!0):(this.state[p]=1,h=!1,o[p]===void 0&&(o[p]=!0),s[p]===void 0&&(s[p]=!0),l[f]===void 0&&(l[f]=!0)))}),h||(a[d]=!0)}),(Object.keys(s).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(s),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(e,n,r){const i=e.split("|"),s=i[0],o=i[1];n&&this.emit("failedLoading",s,o,n),!n&&r&&this.store.addResourceBundle(s,o,r,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2,n&&r&&(this.state[e]=0);const a={};this.queue.forEach(l=>{bL(l.loaded,[s],o),jL(l,e),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(d=>{a[d]||(a[d]={});const h=l.loaded[d];h.length&&h.forEach(f=>{a[d][f]===void 0&&(a[d][f]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(e,n,r,i=0,s=this.retryTimeout,o){if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:r,tried:i,wait:s,callback:o});return}this.readingCalls++;const a=(d,h)=>{if(this.readingCalls--,this.waitingReads.length>0){const f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(d&&h&&i<this.maxRetries){setTimeout(()=>{this.read(e,n,r,i+1,s*2,o)},s);return}o(d,h)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const d=l(e,n);d&&typeof d.then=="function"?d.then(h=>a(null,h)).catch(a):a(null,d)}catch(d){a(d)}return}return l(e,n,a)}prepareLoading(e,n,r={},i){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();ke(e)&&(e=this.languageUtils.toResolveHierarchy(e)),ke(n)&&(n=[n]);const s=this.queueLoad(e,n,r,i);if(!s.toLoad.length)return s.pending.length||i(),null;s.toLoad.forEach(o=>{this.loadOne(o)})}load(e,n,r){this.prepareLoading(e,n,{},r)}reload(e,n,r){this.prepareLoading(e,n,{reload:!0},r)}loadOne(e,n=""){const r=e.split("|"),i=r[0],s=r[1];this.read(i,s,"read",void 0,void 0,(o,a)=>{o&&this.logger.warn(`${n}loading namespace ${s} for language ${i} failed`,o),!o&&a&&this.logger.log(`${n}loaded namespace ${s} for language ${i}`,a),this.loaded(e,o,a)})}saveMissing(e,n,r,i,s,o={},a=()=>{}){var l,d,h,f,p;if((d=(l=this.services)==null?void 0:l.utils)!=null&&d.hasLoadedNamespace&&!((f=(h=this.services)==null?void 0:h.utils)!=null&&f.hasLoadedNamespace(n))){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if((p=this.backend)!=null&&p.create){const y={...o,isUpdate:s},g=this.backend.create.bind(this.backend);if(g.length<6)try{let x;g.length===5?x=g(e,n,r,i,y):x=g(e,n,r,i),x&&typeof x.then=="function"?x.then(S=>a(null,S)).catch(a):a(null,x)}catch(x){a(x)}else g(e,n,r,i,a,y)}!e||!e[0]||this.store.addResource(e[0],n,r,i)}}}const Sy=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),ke(t[1])&&(e.defaultValue=t[1]),ke(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const n=t[3]||t[2];Object.keys(n).forEach(r=>{e[r]=n[r]})}return e},interpolation:{escapeValue:!0,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),a5=t=>(ke(t.ns)&&(t.ns=[t.ns]),ke(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),ke(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs&&!t.supportedLngs.includes("cimode")&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t),If=()=>{},BL=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})};class nd extends pg{constructor(e={},n){if(super(),this.options=a5(e),this.services={},this.logger=Oi,this.modules={external:[]},BL(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(e={},n){this.isInitializing=!0,typeof e=="function"&&(n=e,e={}),e.defaultNS==null&&e.ns&&(ke(e.ns)?e.defaultNS=e.ns:e.ns.includes("translation")||(e.defaultNS=e.ns[0]));const r=Sy();this.options={...r,...this.options,...a5(e)},this.options.interpolation={...r.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=r.overloadTranslationOptionHandler);const i=d=>d?typeof d=="function"?new d:d:null;if(!this.options.isClone){this.modules.logger?Oi.init(i(this.modules.logger),this.options):Oi.init(null,this.options);let d;this.modules.formatter?d=this.modules.formatter:d=FL;const h=new t5(this.options);this.store=new e5(this.options.resources,this.options);const f=this.services;f.logger=Oi,f.resourceStore=this.store,f.languageUtils=h,f.pluralResolver=new LL(h,{prepend:this.options.pluralSeparator}),d&&(f.formatter=i(d),f.formatter.init&&f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new s5(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new zL(i(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",(p,...y)=>{this.emit(p,...y)}),this.modules.languageDetector&&(f.languageDetector=i(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=i(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new Zp(this.services,this.options),this.translator.on("*",(p,...y)=>{this.emit(p,...y)}),this.modules.external.forEach(p=>{p.init&&p.init(this)})}if(this.format=this.options.interpolation.format,n||(n=If),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const d=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);d.length>0&&d[0]!=="dev"&&(this.options.lng=d[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(d=>{this[d]=(...h)=>this.store[d](...h)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(d=>{this[d]=(...h)=>(this.store[d](...h),this)});const a=bc(),l=()=>{const d=(h,f)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),a.resolve(f),n(h,f)};if(this.languages&&!this.isInitialized)return d(null,this.t.bind(this));this.changeLanguage(this.options.lng,d)};return this.options.resources||!this.options.initAsync?l():setTimeout(l,0),a}loadResources(e,n=If){var s,o;let r=n;const i=ke(e)?e:this.language;if(typeof e=="function"&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if((i==null?void 0:i.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const a=[],l=d=>{if(!d||d==="cimode")return;this.services.languageUtils.toResolveHierarchy(d).forEach(f=>{f!=="cimode"&&(a.includes(f)||a.push(f))})};i?l(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(h=>l(h)),(o=(s=this.options.preload)==null?void 0:s.forEach)==null||o.call(s,d=>l(d)),this.services.backendConnector.load(a,this.options.ns,d=>{!d&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(d)})}else r(null)}reloadResources(e,n,r){const i=bc();return typeof e=="function"&&(r=e,e=void 0),typeof n=="function"&&(r=n,n=void 0),e||(e=this.languages),n||(n=this.options.ns),r||(r=If),this.services.backendConnector.reload(e,n,s=>{i.resolve(),r(s)}),i}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&Q8.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!["cimode","dev"].includes(e)){for(let n=0;n<this.languages.length;n++){const r=this.languages[n];if(!["cimode","dev"].includes(r)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}!this.resolvedLanguage&&!this.languages.includes(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,n){this.isLanguageChangingTo=e;const r=bc();this.emit("languageChanging",e);const i=a=>{this.language=a,this.languages=this.services.languageUtils.toResolveHierarchy(a),this.resolvedLanguage=void 0,this.setResolvedLanguage(a)},s=(a,l)=>{l?this.isLanguageChangingTo===e&&(i(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,r.resolve((...d)=>this.t(...d)),n&&n(a,(...d)=>this.t(...d))},o=a=>{var h,f;!e&&!a&&this.services.languageDetector&&(a=[]);const l=ke(a)?a:a&&a[0],d=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(ke(a)?[a]:a);d&&(this.language||i(d),this.translator.language||this.translator.changeLanguage(d),(f=(h=this.services.languageDetector)==null?void 0:h.cacheUserLanguage)==null||f.call(h,d)),this.loadResources(d,p=>{s(p,d)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?o(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e),r}getFixedT(e,n,r){const i=(s,o,...a)=>{let l;typeof o!="object"?l=this.options.overloadTranslationOptionHandler([s,o].concat(a)):l={...o},l.lng=l.lng||i.lng,l.lngs=l.lngs||i.lngs,l.ns=l.ns||i.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||r||i.keyPrefix);const d={...this.options,...l};typeof l.keyPrefix=="function"&&(l.keyPrefix=eu(l.keyPrefix,d));const h=this.options.keySeparator||".";let f;return l.keyPrefix&&Array.isArray(s)?f=s.map(p=>(typeof p=="function"&&(p=eu(p,d)),`${l.keyPrefix}${h}${p}`)):(typeof s=="function"&&(s=eu(s,d)),f=l.keyPrefix?`${l.keyPrefix}${h}${s}`:s),this.t(f,l)};return ke(e)?i.lng=e:i.lngs=e,i.ns=n,i.keyPrefix=r,i}t(...e){var n;return(n=this.translator)==null?void 0:n.translate(...e)}exists(...e){var n;return(n=this.translator)==null?void 0:n.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,n={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(a,l)=>{const d=this.services.backendConnector.state[`${a}|${l}`];return d===-1||d===0||d===2};if(n.precheck){const a=n.precheck(this,o);if(a!==void 0)return a}return!!(this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(r,e)&&(!i||o(s,e)))}loadNamespaces(e,n){const r=bc();return this.options.ns?(ke(e)&&(e=[e]),e.forEach(i=>{this.options.ns.includes(i)||this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}loadLanguages(e,n){const r=bc();ke(e)&&(e=[e]);const i=this.options.preload||[],s=e.filter(o=>!i.includes(o)&&this.services.languageUtils.isSupportedCode(o));return s.length?(this.options.preload=i.concat(s),this.loadResources(o=>{r.resolve(),n&&n(o)}),r):(n&&n(),Promise.resolve())}dir(e){var i,s;if(e||(e=this.resolvedLanguage||(((i=this.languages)==null?void 0:i.length)>0?this.languages[0]:this.language)),!e)return"rtl";try{const o=new Intl.Locale(e);if(o&&o.getTextInfo){const a=o.getTextInfo();if(a&&a.direction)return a.direction}}catch{}const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=((s=this.services)==null?void 0:s.languageUtils)||new t5(Sy());return e.toLowerCase().indexOf("-latn")>1?"ltr":n.includes(r.getLanguagePartFromCode(e))||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},n){const r=new nd(e,n);return r.createInstance=nd.createInstance,r}cloneInstance(e={},n=If){const r=e.forkResourceStore;r&&delete e.forkResourceStore;const i={...this.options,...e,isClone:!0},s=new nd(i);if((e.debug!==void 0||e.prefix!==void 0)&&(s.logger=s.logger.clone(e)),["store","services","language"].forEach(a=>{s[a]=this[a]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},r){const a=Object.keys(this.store.data).reduce((l,d)=>(l[d]={...this.store.data[d]},l[d]=Object.keys(l[d]).reduce((h,f)=>(h[f]={...l[d][f]},h),l[d]),l),{});s.store=new e5(a,i),s.services.resourceStore=s.store}if(e.interpolation){const l={...Sy().interpolation,...this.options.interpolation,...e.interpolation},d={...i,interpolation:l};s.services.interpolator=new s5(d)}return s.translator=new Zp(s.services,i),s.translator.on("*",(a,...l)=>{s.emit(a,...l)}),s.init(i,n),s.translator.options=i,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Vn=nd.createInstance();Vn.createInstance;Vn.dir;Vn.init;Vn.loadResources;Vn.reloadResources;Vn.use;Vn.changeLanguage;Vn.getFixedT;Vn.t;Vn.exists;Vn.setDefaultNamespace;Vn.hasLoadedNamespace;Vn.loadNamespaces;Vn.loadLanguages;const UL=(t,e,n,r)=>{var s,o,a,l;const i=[n,{code:e,...r||{}}];if((o=(s=t==null?void 0:t.services)==null?void 0:s.logger)!=null&&o.forward)return t.services.logger.forward(i,"warn","react-i18next::",!0);Ha(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),(l=(a=t==null?void 0:t.services)==null?void 0:a.logger)!=null&&l.warn?t.services.logger.warn(...i):console!=null&&console.warn&&console.warn(...i)},l5={},Cv=(t,e,n,r)=>{Ha(n)&&l5[n]||(Ha(n)&&(l5[n]=new Date),UL(t,e,n,r))},J8=(t,e)=>()=>{if(t.isInitialized)e();else{const n=()=>{setTimeout(()=>{t.off("initialized",n)},0),e()};t.on("initialized",n)}},bv=(t,e,n)=>{t.loadNamespaces(e,J8(t,n))},u5=(t,e,n,r)=>{if(Ha(n)&&(n=[n]),t.options.preload&&t.options.preload.indexOf(e)>-1)return bv(t,n,r);n.forEach(i=>{t.options.ns.indexOf(i)<0&&t.options.ns.push(i)}),t.loadLanguages(e,J8(t,r))},HL=(t,e,n={})=>!e.languages||!e.languages.length?(Cv(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(t,{lng:n.lng,precheck:(r,i)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!i(r.isLanguageChangingTo,t))return!1}}),Ha=t=>typeof t=="string",VL=t=>typeof t=="object"&&t!==null,GL=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,$L={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},WL=t=>$L[t],KL=t=>t.replace(GL,WL);let Ev={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:KL,transDefaultProps:void 0};const qL=(t={})=>{Ev={...Ev,...t}},QL=()=>Ev;let X8;const YL=t=>{X8=t},JL=()=>X8,XL={type:"3rdParty",init(t){qL(t.options.react),YL(t)}},ZL=z.createContext();class eI{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var Z8={exports:{}},e_={};/**
* @license React
* use-sync-external-store-shim.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var ku=z;function tI(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var nI=typeof Object.is=="function"?Object.is:tI,rI=ku.useState,iI=ku.useEffect,sI=ku.useLayoutEffect,oI=ku.useDebugValue;function aI(t,e){var n=e(),r=rI({inst:{value:n,getSnapshot:e}}),i=r[0].inst,s=r[1];return sI(function(){i.value=n,i.getSnapshot=e,wy(i)&&s({inst:i})},[t,n,e]),iI(function(){return wy(i)&&s({inst:i}),t(function(){wy(i)&&s({inst:i})})},[t]),oI(n),n}function wy(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!nI(t,n)}catch{return!0}}function lI(t,e){return e()}var uI=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?lI:aI;e_.useSyncExternalStore=ku.useSyncExternalStore!==void 0?ku.useSyncExternalStore:uI;Z8.exports=e_;var mg=Z8.exports;const cI=(t,e)=>{if(Ha(e))return e;if(VL(e)&&Ha(e.defaultValue))return e.defaultValue;if(typeof t=="function")return"";if(Array.isArray(t)){const n=t[t.length-1];return typeof n=="function"?"":n}return t},dI={t:cI,ready:!1},hI=()=>()=>{},xs=(t,e={})=>{var I,R,U;const{i18n:n}=e,{i18n:r,defaultNS:i}=z.useContext(ZL)||{},s=n||r||JL();s&&!s.reportNamespaces&&(s.reportNamespaces=new eI),s||Cv(s,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const o=z.useMemo(()=>{var B;return{...QL(),...(B=s==null?void 0:s.options)==null?void 0:B.react,...e}},[s,e]),{useSuspense:a,keyPrefix:l}=o,d=i||((I=s==null?void 0:s.options)==null?void 0:I.defaultNS),h=Ha(d)?[d]:d||["translation"],f=z.useMemo(()=>h,h);(U=(R=s==null?void 0:s.reportNamespaces)==null?void 0:R.addUsedNamespaces)==null||U.call(R,f);const p=z.useRef(0),y=z.useCallback(B=>{if(!s)return hI;const{bindI18n:$,bindI18nStore:Q}=o,q=()=>{p.current+=1,B()};return $&&s.on($,q),Q&&s.store.on(Q,q),()=>{$&&$.split(" ").forEach(ie=>s.off(ie,q)),Q&&Q.split(" ").forEach(ie=>s.store.off(ie,q))}},[s,o]),g=z.useRef(),x=z.useCallback(()=>{if(!s)return dI;const B=!!(s.isInitialized||s.initializedStoreOnce)&&f.every(W=>HL(W,s,o)),$=e.lng||s.language,Q=p.current,q=g.current;if(q&&q.ready===B&&q.lng===$&&q.keyPrefix===l&&q.revision===Q)return q;const fe={t:s.getFixedT($,o.nsMode==="fallback"?f:f[0],l),ready:B,lng:$,keyPrefix:l,revision:Q};return g.current=fe,fe},[s,f,l,o,e.lng]),[S,C]=z.useState(0),{t:E,ready:w}=mg.useSyncExternalStore(y,x,x);z.useEffect(()=>{if(s&&!w&&!a){const B=()=>C($=>$+1);e.lng?u5(s,e.lng,f,B):bv(s,f,B)}},[s,e.lng,f,w,a,S]);const b=s||{},T=z.useRef(null),P=z.useRef(),A=B=>{const $=Object.getOwnPropertyDescriptors(B);$.__original&&delete $.__original;const Q=Object.create(Object.getPrototypeOf(B),$);if(!Object.prototype.hasOwnProperty.call(Q,"__original"))try{Object.defineProperty(Q,"__original",{value:B,writable:!1,enumerable:!1,configurable:!1})}catch{}return Q},M=z.useMemo(()=>{const B=b,$=B==null?void 0:B.language;let Q=B;B&&(T.current&&T.current.__original===B?P.current!==$?(Q=A(B),T.current=Q,P.current=$):Q=T.current:(Q=A(B),T.current=Q,P.current=$));const q=!w&&!a?(...fe)=>(Cv(s,"USE_T_BEFORE_READY","useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t."),E(...fe)):E,ie=[q,Q,w];return ie.t=q,ie.i18n=Q,ie.ready=w,ie},[E,b,w,b.resolvedLanguage,b.language,b.languages]);if(s&&a&&!w)throw new Promise(B=>{const $=()=>B();e.lng?u5(s,e.lng,f,$):bv(s,f,$)});return M},fI={},c5=t=>{let e;const n=new Set,r=(h,f)=>{const p=typeof h=="function"?h(e):h;if(!Object.is(p,e)){const y=e;e=f??(typeof p!="object"||p===null)?p:Object.assign({},e,p),n.forEach(g=>g(e,y))}},i=()=>e,l={setState:r,getState:i,getInitialState:()=>d,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(fI?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=e=t(r,i,l);return l},pI=t=>t?c5(t):c5;var t_={exports:{}},n_={};/**
* @license React
* use-sync-external-store-shim/with-selector.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var gg=z,mI=mg;function gI(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var yI=typeof Object.is=="function"?Object.is:gI,vI=mI.useSyncExternalStore,xI=gg.useRef,SI=gg.useEffect,wI=gg.useMemo,kI=gg.useDebugValue;n_.useSyncExternalStoreWithSelector=function(t,e,n,r,i){var s=xI(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=wI(function(){function l(y){if(!d){if(d=!0,h=y,y=r(y),i!==void 0&&o.hasValue){var g=o.value;if(i(g,y))return f=g}return f=y}if(g=f,yI(h,y))return g;var x=r(y);return i!==void 0&&i(g,x)?(h=y,g):(h=y,f=x)}var d=!1,h,f,p=n===void 0?null:n;return[function(){return l(e())},p===null?void 0:function(){return l(p())}]},[e,n,r,i]);var a=vI(t,s[0],s[1]);return SI(function(){o.hasValue=!0,o.value=a},[a]),kI(a),a};t_.exports=n_;var r_=t_.exports;const CI=nh(r_),i_={},{useDebugValue:bI}=ct,{useSyncExternalStoreWithSelector:EI}=CI;let d5=!1;const _I=t=>t;function NI(t,e=_I,n){(i_?"production":void 0)!=="production"&&n&&!d5&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),d5=!0);const r=EI(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return bI(r),r}const h5=t=>{(i_?"production":void 0)!=="production"&&typeof t!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof t=="function"?pI(t):t,n=(r,i)=>NI(e,r,i);return Object.assign(n,e),n},CS=t=>t?h5(t):h5;function s_(t,e){return function(){return t.apply(e,arguments)}}const{toString:TI}=Object.prototype,{getPrototypeOf:bS}=Object,{iterator:yg,toStringTag:o_}=Symbol,vg=(t=>e=>{const n=TI.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),ci=t=>(t=t.toLowerCase(),e=>vg(e)===t),xg=t=>e=>typeof e===t,{isArray:Bu}=Array,Cu=xg("undefined");function lh(t){return t!==null&&!Cu(t)&&t.constructor!==null&&!Cu(t.constructor)&&ir(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const a_=ci("ArrayBuffer");function MI(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&a_(t.buffer),e}const PI=xg("string"),ir=xg("function"),l_=xg("number"),uh=t=>t!==null&&typeof t=="object",OI=t=>t===!0||t===!1,mp=t=>{if(vg(t)!=="object")return!1;const e=bS(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(o_ in t)&&!(yg in t)},AI=t=>{if(!uh(t)||lh(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},RI=ci("Date"),LI=ci("File"),II=t=>!!(t&&typeof t.uri<"u"),DI=t=>t&&typeof t.getParts<"u",FI=ci("Blob"),jI=ci("FileList"),zI=t=>uh(t)&&ir(t.pipe);function BI(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const f5=BI(),p5=typeof f5.FormData<"u"?f5.FormData:void 0,UI=t=>{let e;return t&&(p5&&t instanceof p5||ir(t.append)&&((e=vg(t))==="formdata"||e==="object"&&ir(t.toString)&&t.toString()==="[object FormData]"))},HI=ci("URLSearchParams"),[VI,GI,$I,WI]=["ReadableStream","Request","Response","Headers"].map(ci),KI=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ch(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,i;if(typeof t!="object"&&(t=[t]),Bu(t))for(r=0,i=t.length;r<i;r++)e.call(null,t[r],r,t);else{if(lh(t))return;const s=n?Object.getOwnPropertyNames(t):Object.keys(t),o=s.length;let a;for(r=0;r<o;r++)a=s[r],e.call(null,t[a],a,t)}}function u_(t,e){if(lh(t))return null;e=e.toLowerCase();const n=Object.keys(t);let r=n.length,i;for(;r-- >0;)if(i=n[r],e===i.toLowerCase())return i;return null}const ha=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,c_=t=>!Cu(t)&&t!==ha;function _v(){const{caseless:t,skipUndefined:e}=c_(this)&&this||{},n={},r=(i,s)=>{if(s==="__proto__"||s==="constructor"||s==="prototype")return;const o=t&&u_(n,s)||s;mp(n[o])&&mp(i)?n[o]=_v(n[o],i):mp(i)?n[o]=_v({},i):Bu(i)?n[o]=i.slice():(!e||!Cu(i))&&(n[o]=i)};for(let i=0,s=arguments.length;i<s;i++)arguments[i]&&ch(arguments[i],r);return n}const qI=(t,e,n,{allOwnKeys:r}={})=>(ch(e,(i,s)=>{n&&ir(i)?Object.defineProperty(t,s,{value:s_(i,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,s,{value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),t),QI=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),YI=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},JI=(t,e,n,r)=>{let i,s,o;const a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!r||r(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=n!==!1&&bS(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},XI=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},ZI=t=>{if(!t)return null;if(Bu(t))return t;let e=t.length;if(!l_(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},eD=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&bS(Uint8Array)),tD=(t,e)=>{const r=(t&&t[yg]).call(t);let i;for(;(i=r.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},nD=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},rD=ci("HTMLFormElement"),iD=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),m5=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),sD=ci("RegExp"),d_=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};ch(n,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(r[s]=o||i)}),Object.defineProperties(t,r)},oD=t=>{d_(t,(e,n)=>{if(ir(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(ir(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},aD=(t,e)=>{const n={},r=i=>{i.forEach(s=>{n[s]=!0})};return Bu(t)?r(t):r(String(t).split(e)),n},lD=()=>{},uD=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function cD(t){return!!(t&&ir(t.append)&&t[o_]==="FormData"&&t[yg])}const dD=t=>{const e=new Array(10),n=(r,i)=>{if(uh(r)){if(e.indexOf(r)>=0)return;if(lh(r))return r;if(!("toJSON"in r)){e[i]=r;const s=Bu(r)?[]:{};return ch(r,(o,a)=>{const l=n(o,i+1);!Cu(l)&&(s[a]=l)}),e[i]=void 0,s}}return r};return n(t,0)},hD=ci("AsyncFunction"),fD=t=>t&&(uh(t)||ir(t))&&ir(t.then)&&ir(t.catch),h_=((t,e)=>t?setImmediate:e?((n,r)=>(ha.addEventListener("message",({source:i,data:s})=>{i===ha&&s===n&&r.length&&r.shift()()},!1),i=>{r.push(i),ha.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",ir(ha.postMessage)),pD=typeof queueMicrotask<"u"?queueMicrotask.bind(ha):typeof process<"u"&&process.nextTick||h_,mD=t=>t!=null&&ir(t[yg]),V={isArray:Bu,isArrayBuffer:a_,isBuffer:lh,isFormData:UI,isArrayBufferView:MI,isString:PI,isNumber:l_,isBoolean:OI,isObject:uh,isPlainObject:mp,isEmptyObject:AI,isReadableStream:VI,isRequest:GI,isResponse:$I,isHeaders:WI,isUndefined:Cu,isDate:RI,isFile:LI,isReactNativeBlob:II,isReactNative:DI,isBlob:FI,isRegExp:sD,isFunction:ir,isStream:zI,isURLSearchParams:HI,isTypedArray:eD,isFileList:jI,forEach:ch,merge:_v,extend:qI,trim:KI,stripBOM:QI,inherits:YI,toFlatObject:JI,kindOf:vg,kindOfTest:ci,endsWith:XI,toArray:ZI,forEachEntry:tD,matchAll:nD,isHTMLForm:rD,hasOwnProperty:m5,hasOwnProp:m5,reduceDescriptors:d_,freezeMethods:oD,toObjectSet:aD,toCamelCase:iD,noop:lD,toFiniteNumber:uD,findKey:u_,global:ha,isContextDefined:c_,isSpecCompliantForm:cD,toJSONObject:dD,isAsyncFn:hD,isThenable:fD,setImmediate:h_,asap:pD,isIterable:mD};let xe=class f_ extends Error{static from(e,n,r,i,s,o){const a=new f_(e.message,n||e.code,r,i,s);return a.cause=e,a.name=e.name,e.status!=null&&a.status==null&&(a.status=e.status),o&&Object.assign(a,o),a}constructor(e,n,r,i,s){super(e),Object.defineProperty(this,"message",{value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),i&&(this.request=i),s&&(this.response=s,this.status=s.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:V.toJSONObject(this.config),code:this.code,status:this.status}}};xe.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";xe.ERR_BAD_OPTION="ERR_BAD_OPTION";xe.ECONNABORTED="ECONNABORTED";xe.ETIMEDOUT="ETIMEDOUT";xe.ERR_NETWORK="ERR_NETWORK";xe.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";xe.ERR_DEPRECATED="ERR_DEPRECATED";xe.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";xe.ERR_BAD_REQUEST="ERR_BAD_REQUEST";xe.ERR_CANCELED="ERR_CANCELED";xe.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";xe.ERR_INVALID_URL="ERR_INVALID_URL";const gD=null;function Nv(t){return V.isPlainObject(t)||V.isArray(t)}function p_(t){return V.endsWith(t,"[]")?t.slice(0,-2):t}function ky(t,e,n){return t?t.concat(e).map(function(i,s){return i=p_(i),!n&&s?"["+i+"]":i}).join(n?".":""):e}function yD(t){return V.isArray(t)&&!t.some(Nv)}const vD=V.toFlatObject(V,{},null,function(e){return/^is[A-Z]/.test(e)});function Sg(t,e,n){if(!V.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=V.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(x,S){return!V.isUndefined(S[x])});const r=n.metaTokens,i=n.visitor||h,s=n.dots,o=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&V.isSpecCompliantForm(e);if(!V.isFunction(i))throw new TypeError("visitor must be a function");function d(g){if(g===null)return"";if(V.isDate(g))return g.toISOString();if(V.isBoolean(g))return g.toString();if(!l&&V.isBlob(g))throw new xe("Blob is not supported. Use a Buffer instead.");return V.isArrayBuffer(g)||V.isTypedArray(g)?l&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function h(g,x,S){let C=g;if(V.isReactNative(e)&&V.isReactNativeBlob(g))return e.append(ky(S,x,s),d(g)),!1;if(g&&!S&&typeof g=="object"){if(V.endsWith(x,"{}"))x=r?x:x.slice(0,-2),g=JSON.stringify(g);else if(V.isArray(g)&&yD(g)||(V.isFileList(g)||V.endsWith(x,"[]"))&&(C=V.toArray(g)))return x=p_(x),C.forEach(function(w,b){!(V.isUndefined(w)||w===null)&&e.append(o===!0?ky([x],b,s):o===null?x:x+"[]",d(w))}),!1}return Nv(g)?!0:(e.append(ky(S,x,s),d(g)),!1)}const f=[],p=Object.assign(vD,{defaultVisitor:h,convertValue:d,isVisitable:Nv});function y(g,x){if(!V.isUndefined(g)){if(f.indexOf(g)!==-1)throw Error("Circular reference detected in "+x.join("."));f.push(g),V.forEach(g,function(C,E){(!(V.isUndefined(C)||C===null)&&i.call(e,C,V.isString(E)?E.trim():E,x,p))===!0&&y(C,x?x.concat(E):[E])}),f.pop()}}if(!V.isObject(t))throw new TypeError("data must be an object");return y(t),e}function g5(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function ES(t,e){this._pairs=[],t&&Sg(t,this,e)}const m_=ES.prototype;m_.append=function(e,n){this._pairs.push([e,n])};m_.toString=function(e){const n=e?function(r){return e.call(this,r,g5)}:g5;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function xD(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function g_(t,e,n){if(!e)return t;const r=n&&n.encode||xD,i=V.isFunction(n)?{serialize:n}:n,s=i&&i.serialize;let o;if(s?o=s(e,i):o=V.isURLSearchParams(e)?e.toString():new ES(e,i).toString(r),o){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}class y5{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){V.forEach(this.handlers,function(r){r!==null&&e(r)})}}const _S={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},SD=typeof URLSearchParams<"u"?URLSearchParams:ES,wD=typeof FormData<"u"?FormData:null,kD=typeof Blob<"u"?Blob:null,CD={isBrowser:!0,classes:{URLSearchParams:SD,FormData:wD,Blob:kD},protocols:["http","https","file","blob","url","data"]},NS=typeof window<"u"&&typeof document<"u",Tv=typeof navigator=="object"&&navigator||void 0,bD=NS&&(!Tv||["ReactNative","NativeScript","NS"].indexOf(Tv.product)<0),ED=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",_D=NS&&window.location.href||"http://localhost",ND=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:NS,hasStandardBrowserEnv:bD,hasStandardBrowserWebWorkerEnv:ED,navigator:Tv,origin:_D},Symbol.toStringTag,{value:"Module"})),Tn={...ND,...CD};function TD(t,e){return Sg(t,new Tn.classes.URLSearchParams,{visitor:function(n,r,i,s){return Tn.isNode&&V.isBuffer(n)?(this.append(r,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},...e})}function MD(t){return V.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function PD(t){const e={},n=Object.keys(t);let r;const i=n.length;let s;for(r=0;r<i;r++)s=n[r],e[s]=t[s];return e}function y_(t){function e(n,r,i,s){let o=n[s++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),l=s>=n.length;return o=!o&&V.isArray(i)?i.length:o,l?(V.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!a):((!i[o]||!V.isObject(i[o]))&&(i[o]=[]),e(n,r,i[o],s)&&V.isArray(i[o])&&(i[o]=PD(i[o])),!a)}if(V.isFormData(t)&&V.isFunction(t.entries)){const n={};return V.forEachEntry(t,(r,i)=>{e(MD(r),i,n,0)}),n}return null}function OD(t,e,n){if(V.isString(t))try{return(e||JSON.parse)(t),V.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const dh={transitional:_S,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,s=V.isObject(e);if(s&&V.isHTMLForm(e)&&(e=new FormData(e)),V.isFormData(e))return i?JSON.stringify(y_(e)):e;if(V.isArrayBuffer(e)||V.isBuffer(e)||V.isStream(e)||V.isFile(e)||V.isBlob(e)||V.isReadableStream(e))return e;if(V.isArrayBufferView(e))return e.buffer;if(V.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return TD(e,this.formSerializer).toString();if((a=V.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Sg(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||i?(n.setContentType("application/json",!1),OD(e)):e}],transformResponse:[function(e){const n=this.transitional||dh.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(V.isResponse(e)||V.isReadableStream(e))return e;if(e&&V.isString(e)&&(r&&!this.responseType||i)){const o=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(e,this.parseReviver)}catch(a){if(o)throw a.name==="SyntaxError"?xe.from(a,xe.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Tn.classes.FormData,Blob:Tn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};V.forEach(["delete","get","head","post","put","patch"],t=>{dh.headers[t]={}});const AD=V.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),RD=t=>{const e={};let n,r,i;return t&&t.split(`
`).forEach(function(o){i=o.indexOf(":"),n=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!n||e[n]&&AD[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},v5=Symbol("internals");function Ec(t){return t&&String(t).trim().toLowerCase()}function gp(t){return t===!1||t==null?t:V.isArray(t)?t.map(gp):String(t).replace(/[\r\n]+$/,"")}function LD(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const ID=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Cy(t,e,n,r,i){if(V.isFunction(r))return r.call(this,e,n);if(i&&(e=n),!!V.isString(e)){if(V.isString(r))return e.indexOf(r)!==-1;if(V.isRegExp(r))return r.test(e)}}function DD(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function FD(t,e){const n=V.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(i,s,o){return this[r].call(this,e,i,s,o)},configurable:!0})})}let sr=class{constructor(e){e&&this.set(e)}set(e,n,r){const i=this;function s(a,l,d){const h=Ec(l);if(!h)throw new Error("header name must be a non-empty string");const f=V.findKey(i,h);(!f||i[f]===void 0||d===!0||d===void 0&&i[f]!==!1)&&(i[f||l]=gp(a))}const o=(a,l)=>V.forEach(a,(d,h)=>s(d,h,l));if(V.isPlainObject(e)||e instanceof this.constructor)o(e,n);else if(V.isString(e)&&(e=e.trim())&&!ID(e))o(RD(e),n);else if(V.isObject(e)&&V.isIterable(e)){let a={},l,d;for(const h of e){if(!V.isArray(h))throw TypeError("Object iterator must return a key-value pair");a[d=h[0]]=(l=a[d])?V.isArray(l)?[...l,h[1]]:[l,h[1]]:h[1]}o(a,n)}else e!=null&&s(n,e,r);return this}get(e,n){if(e=Ec(e),e){const r=V.findKey(this,e);if(r){const i=this[r];if(!n)return i;if(n===!0)return LD(i);if(V.isFunction(n))return n.call(this,i,r);if(V.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Ec(e),e){const r=V.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||Cy(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let i=!1;function s(o){if(o=Ec(o),o){const a=V.findKey(r,o);a&&(!n||Cy(r,r[a],a,n))&&(delete r[a],i=!0)}}return V.isArray(e)?e.forEach(s):s(e),i}clear(e){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const s=n[r];(!e||Cy(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const n=this,r={};return V.forEach(this,(i,s)=>{const o=V.findKey(r,s);if(o){n[o]=gp(i),delete n[s];return}const a=e?DD(s):String(s).trim();a!==s&&delete n[s],n[a]=gp(i),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return V.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=e&&V.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[v5]=this[v5]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Ec(o);r[a]||(FD(i,o),r[a]=!0)}return V.isArray(e)?e.forEach(s):s(e),this}};sr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);V.reduceDescriptors(sr.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});V.freezeMethods(sr);function by(t,e){const n=this||dh,r=e||n,i=sr.from(r.headers);let s=r.data;return V.forEach(t,function(a){s=a.call(n,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function v_(t){return!!(t&&t.__CANCEL__)}let hh=class extends xe{constructor(e,n,r){super(e??"canceled",xe.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function x_(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new xe("Request failed with status code "+n.status,[xe.ERR_BAD_REQUEST,xe.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function jD(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function zD(t,e){t=t||10;const n=new Array(t),r=new Array(t);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(l){const d=Date.now(),h=r[s];o||(o=d),n[i]=l,r[i]=d;let f=s,p=0;for(;f!==i;)p+=n[f++],f=f%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),d-o<e)return;const y=h&&d-h;return y?Math.round(p*1e3/y):void 0}}function BD(t,e){let n=0,r=1e3/e,i,s;const o=(d,h=Date.now())=>{n=h,i=null,s&&(clearTimeout(s),s=null),t(...d)};return[(...d)=>{const h=Date.now(),f=h-n;f>=r?o(d,h):(i=d,s||(s=setTimeout(()=>{s=null,o(i)},r-f)))},()=>i&&o(i)]}const em=(t,e,n=3)=>{let r=0;const i=zD(50,250);return BD(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,l=o-r,d=i(l),h=o<=a;r=o;const f={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:d||void 0,estimated:d&&a&&h?(a-o)/d:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(f)},n)},x5=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},S5=t=>(...e)=>V.asap(()=>t(...e)),UD=Tn.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,Tn.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(Tn.origin),Tn.navigator&&/(msie|trident)/i.test(Tn.navigator.userAgent)):()=>!0,HD=Tn.hasStandardBrowserEnv?{write(t,e,n,r,i,s,o){if(typeof document>"u")return;const a=[`${t}=${encodeURIComponent(e)}`];V.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),V.isString(r)&&a.push(`path=${r}`),V.isString(i)&&a.push(`domain=${i}`),s===!0&&a.push("secure"),V.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function VD(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function GD(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function S_(t,e,n){let r=!VD(e);return t&&(r||n==!1)?GD(t,e):e}const w5=t=>t instanceof sr?{...t}:t;function Va(t,e){e=e||{};const n={};function r(d,h,f,p){return V.isPlainObject(d)&&V.isPlainObject(h)?V.merge.call({caseless:p},d,h):V.isPlainObject(h)?V.merge({},h):V.isArray(h)?h.slice():h}function i(d,h,f,p){if(V.isUndefined(h)){if(!V.isUndefined(d))return r(void 0,d,f,p)}else return r(d,h,f,p)}function s(d,h){if(!V.isUndefined(h))return r(void 0,h)}function o(d,h){if(V.isUndefined(h)){if(!V.isUndefined(d))return r(void 0,d)}else return r(void 0,h)}function a(d,h,f){if(f in e)return r(d,h);if(f in t)return r(void 0,d)}const l={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(d,h,f)=>i(w5(d),w5(h),f,!0)};return V.forEach(Object.keys({...t,...e}),function(h){if(h==="__proto__"||h==="constructor"||h==="prototype")return;const f=V.hasOwnProp(l,h)?l[h]:i,p=f(t[h],e[h],h);V.isUndefined(p)&&f!==a||(n[h]=p)}),n}const w_=t=>{const e=Va({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;if(e.headers=o=sr.from(o),e.url=g_(S_(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),V.isFormData(n)){if(Tn.hasStandardBrowserEnv||Tn.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(V.isFunction(n.getHeaders)){const l=n.getHeaders(),d=["content-type","content-length"];Object.entries(l).forEach(([h,f])=>{d.includes(h.toLowerCase())&&o.set(h,f)})}}if(Tn.hasStandardBrowserEnv&&(r&&V.isFunction(r)&&(r=r(e)),r||r!==!1&&UD(e.url))){const l=i&&s&&HD.read(s);l&&o.set(i,l)}return e},$D=typeof XMLHttpRequest<"u",WD=$D&&function(t){return new Promise(function(n,r){const i=w_(t);let s=i.data;const o=sr.from(i.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:d}=i,h,f,p,y,g;function x(){y&&y(),g&&g(),i.cancelToken&&i.cancelToken.unsubscribe(h),i.signal&&i.signal.removeEventListener("abort",h)}let S=new XMLHttpRequest;S.open(i.method.toUpperCase(),i.url,!0),S.timeout=i.timeout;function C(){if(!S)return;const w=sr.from("getAllResponseHeaders"in S&&S.getAllResponseHeaders()),T={data:!a||a==="text"||a==="json"?S.responseText:S.response,status:S.status,statusText:S.statusText,headers:w,config:t,request:S};x_(function(A){n(A),x()},function(A){r(A),x()},T),S=null}"onloadend"in S?S.onloadend=C:S.onreadystatechange=function(){!S||S.readyState!==4||S.status===0&&!(S.responseURL&&S.responseURL.indexOf("file:")===0)||setTimeout(C)},S.onabort=function(){S&&(r(new xe("Request aborted",xe.ECONNABORTED,t,S)),S=null)},S.onerror=function(b){const T=b&&b.message?b.message:"Network Error",P=new xe(T,xe.ERR_NETWORK,t,S);P.event=b||null,r(P),S=null},S.ontimeout=function(){let b=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const T=i.transitional||_S;i.timeoutErrorMessage&&(b=i.timeoutErrorMessage),r(new xe(b,T.clarifyTimeoutError?xe.ETIMEDOUT:xe.ECONNABORTED,t,S)),S=null},s===void 0&&o.setContentType(null),"setRequestHeader"in S&&V.forEach(o.toJSON(),function(b,T){S.setRequestHeader(T,b)}),V.isUndefined(i.withCredentials)||(S.withCredentials=!!i.withCredentials),a&&a!=="json"&&(S.responseType=i.responseType),d&&([p,g]=em(d,!0),S.addEventListener("progress",p)),l&&S.upload&&([f,y]=em(l),S.upload.addEventListener("progress",f),S.upload.addEventListener("loadend",y)),(i.cancelToken||i.signal)&&(h=w=>{S&&(r(!w||w.type?new hh(null,t,S):w),S.abort(),S=null)},i.cancelToken&&i.cancelToken.subscribe(h),i.signal&&(i.signal.aborted?h():i.signal.addEventListener("abort",h)));const E=jD(i.url);if(E&&Tn.protocols.indexOf(E)===-1){r(new xe("Unsupported protocol "+E+":",xe.ERR_BAD_REQUEST,t));return}S.send(s||null)})},KD=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,i;const s=function(d){if(!i){i=!0,a();const h=d instanceof Error?d:this.reason;r.abort(h instanceof xe?h:new hh(h instanceof Error?h.message:h))}};let o=e&&setTimeout(()=>{o=null,s(new xe(`timeout of ${e}ms exceeded`,xe.ETIMEDOUT))},e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(d=>{d.unsubscribe?d.unsubscribe(s):d.removeEventListener("abort",s)}),t=null)};t.forEach(d=>d.addEventListener("abort",s));const{signal:l}=r;return l.unsubscribe=()=>V.asap(a),l}},qD=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let r=0,i;for(;r<n;)i=r+e,yield t.slice(r,i),r=i},QD=async function*(t,e){for await(const n of YD(t))yield*qD(n,e)},YD=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:r}=await e.read();if(n)break;yield r}}finally{await e.cancel()}},k5=(t,e,n,r)=>{const i=QD(t,e);let s=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:d,value:h}=await i.next();if(d){a(),l.close();return}let f=h.byteLength;if(n){let p=s+=f;n(p)}l.enqueue(new Uint8Array(h))}catch(d){throw a(d),d}},cancel(l){return a(l),i.return()}},{highWaterMark:2})},C5=64*1024,{isFunction:Df}=V,JD=(({Request:t,Response:e})=>({Request:t,Response:e}))(V.global),{ReadableStream:b5,TextEncoder:E5}=V.global,_5=(t,...e)=>{try{return!!t(...e)}catch{return!1}},XD=t=>{t=V.merge.call({skipUndefined:!0},JD,t);const{fetch:e,Request:n,Response:r}=t,i=e?Df(e):typeof fetch=="function",s=Df(n),o=Df(r);if(!i)return!1;const a=i&&Df(b5),l=i&&(typeof E5=="function"?(g=>x=>g.encode(x))(new E5):async g=>new Uint8Array(await new n(g).arrayBuffer())),d=s&&a&&_5(()=>{let g=!1;const x=new b5,S=new n(Tn.origin,{body:x,method:"POST",get duplex(){return g=!0,"half"}}).headers.has("Content-Type");return x.cancel(),g&&!S}),h=o&&a&&_5(()=>V.isReadableStream(new r("").body)),f={stream:h&&(g=>g.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(g=>{!f[g]&&(f[g]=(x,S)=>{let C=x&&x[g];if(C)return C.call(x);throw new xe(`Response type '${g}' is not supported`,xe.ERR_NOT_SUPPORT,S)})});const p=async g=>{if(g==null)return 0;if(V.isBlob(g))return g.size;if(V.isSpecCompliantForm(g))return(await new n(Tn.origin,{method:"POST",body:g}).arrayBuffer()).byteLength;if(V.isArrayBufferView(g)||V.isArrayBuffer(g))return g.byteLength;if(V.isURLSearchParams(g)&&(g=g+""),V.isString(g))return(await l(g)).byteLength},y=async(g,x)=>{const S=V.toFiniteNumber(g.getContentLength());return S??p(x)};return async g=>{let{url:x,method:S,data:C,signal:E,cancelToken:w,timeout:b,onDownloadProgress:T,onUploadProgress:P,responseType:A,headers:M,withCredentials:I="same-origin",fetchOptions:R}=w_(g),U=e||fetch;A=A?(A+"").toLowerCase():"text";let B=KD([E,w&&w.toAbortSignal()],b),$=null;const Q=B&&B.unsubscribe&&(()=>{B.unsubscribe()});let q;try{if(P&&d&&S!=="get"&&S!=="head"&&(q=await y(M,C))!==0){let Y=new n(x,{method:"POST",body:C,duplex:"half"}),oe;if(V.isFormData(C)&&(oe=Y.headers.get("content-type"))&&M.setContentType(oe),Y.body){const[_e,rt]=x5(q,em(S5(P)));C=k5(Y.body,C5,_e,rt)}}V.isString(I)||(I=I?"include":"omit");const ie=s&&"credentials"in n.prototype,fe={...R,signal:B,method:S.toUpperCase(),headers:M.normalize().toJSON(),body:C,duplex:"half",credentials:ie?I:void 0};$=s&&new n(x,fe);let W=await(s?U($,R):U(x,fe));const re=h&&(A==="stream"||A==="response");if(h&&(T||re&&Q)){const Y={};["status","statusText","headers"].forEach(yt=>{Y[yt]=W[yt]});const oe=V.toFiniteNumber(W.headers.get("content-length")),[_e,rt]=T&&x5(oe,em(S5(T),!0))||[];W=new r(k5(W.body,C5,_e,()=>{rt&&rt(),Q&&Q()}),Y)}A=A||"text";let te=await f[V.findKey(f,A)||"text"](W,g);return!re&&Q&&Q(),await new Promise((Y,oe)=>{x_(Y,oe,{data:te,headers:sr.from(W.headers),status:W.status,statusText:W.statusText,config:g,request:$})})}catch(ie){throw Q&&Q(),ie&&ie.name==="TypeError"&&/Load failed|fetch/i.test(ie.message)?Object.assign(new xe("Network Error",xe.ERR_NETWORK,g,$,ie&&ie.response),{cause:ie.cause||ie}):xe.from(ie,ie&&ie.code,g,$,ie&&ie.response)}}},ZD=new Map,k_=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:i}=e,s=[r,i,n];let o=s.length,a=o,l,d,h=ZD;for(;a--;)l=s[a],d=h.get(l),d===void 0&&h.set(l,d=a?new Map:XD(e)),h=d;return d};k_();const TS={http:gD,xhr:WD,fetch:{get:k_}};V.forEach(TS,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const N5=t=>`- ${t}`,eF=t=>V.isFunction(t)||t===null||t===!1;function tF(t,e){t=V.isArray(t)?t:[t];const{length:n}=t;let r,i;const s={};for(let o=0;o<n;o++){r=t[o];let a;if(i=r,!eF(r)&&(i=TS[(a=String(r)).toLowerCase()],i===void 0))throw new xe(`Unknown adapter '${a}'`);if(i&&(V.isFunction(i)||(i=i.get(e))))break;s[a||"#"+o]=i}if(!i){const o=Object.entries(s).map(([l,d])=>`adapter ${l} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=n?o.length>1?`since :
`+o.map(N5).join(`
`):" "+N5(o[0]):"as no adapter specified";throw new xe("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return i}const C_={getAdapter:tF,adapters:TS};function Ey(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new hh(null,t)}function T5(t){return Ey(t),t.headers=sr.from(t.headers),t.data=by.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),C_.getAdapter(t.adapter||dh.adapter,t)(t).then(function(r){return Ey(t),r.data=by.call(t,t.transformResponse,r),r.headers=sr.from(r.headers),r},function(r){return v_(r)||(Ey(t),r&&r.response&&(r.response.data=by.call(t,t.transformResponse,r.response),r.response.headers=sr.from(r.response.headers))),Promise.reject(r)})}const b_="1.14.0",wg={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{wg[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const M5={};wg.transitional=function(e,n,r){function i(s,o){return"[Axios v"+b_+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,a)=>{if(e===!1)throw new xe(i(o," has been removed"+(n?" in "+n:"")),xe.ERR_DEPRECATED);return n&&!M5[o]&&(M5[o]=!0,console.warn(i(o," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(s,o,a):!0}};wg.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function nF(t,e,n){if(typeof t!="object")throw new xe("options must be an object",xe.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let i=r.length;for(;i-- >0;){const s=r[i],o=e[s];if(o){const a=t[s],l=a===void 0||o(a,s,t);if(l!==!0)throw new xe("option "+s+" must be "+l,xe.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new xe("Unknown option "+s,xe.ERR_BAD_OPTION)}}const yp={assertOptions:nF,validators:wg},Tr=yp.validators;let Ma=class{constructor(e){this.defaults=e||{},this.interceptors={request:new y5,response:new y5}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=`
`+s):r.stack=s}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Va(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:s}=n;r!==void 0&&yp.assertOptions(r,{silentJSONParsing:Tr.transitional(Tr.boolean),forcedJSONParsing:Tr.transitional(Tr.boolean),clarifyTimeoutError:Tr.transitional(Tr.boolean),legacyInterceptorReqResOrdering:Tr.transitional(Tr.boolean)},!1),i!=null&&(V.isFunction(i)?n.paramsSerializer={serialize:i}:yp.assertOptions(i,{encode:Tr.function,serialize:Tr.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),yp.assertOptions(n,{baseUrl:Tr.spelling("baseURL"),withXsrfToken:Tr.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=s&&V.merge(s.common,s[n.method]);s&&V.forEach(["delete","get","head","post","put","patch","common"],g=>{delete s[g]}),n.headers=sr.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(x){if(typeof x.runWhen=="function"&&x.runWhen(n)===!1)return;l=l&&x.synchronous;const S=n.transitional||_S;S&&S.legacyInterceptorReqResOrdering?a.unshift(x.fulfilled,x.rejected):a.push(x.fulfilled,x.rejected)});const d=[];this.interceptors.response.forEach(function(x){d.push(x.fulfilled,x.rejected)});let h,f=0,p;if(!l){const g=[T5.bind(this),void 0];for(g.unshift(...a),g.push(...d),p=g.length,h=Promise.resolve(n);f<p;)h=h.then(g[f++],g[f++]);return h}p=a.length;let y=n;for(;f<p;){const g=a[f++],x=a[f++];try{y=g(y)}catch(S){x.call(this,S);break}}try{h=T5.call(this,y)}catch(g){return Promise.reject(g)}for(f=0,p=d.length;f<p;)h=h.then(d[f++],d[f++]);return h}getUri(e){e=Va(this.defaults,e);const n=S_(e.baseURL,e.url,e.allowAbsoluteUrls);return g_(n,e.params,e.paramsSerializer)}};V.forEach(["delete","get","head","options"],function(e){Ma.prototype[e]=function(n,r){return this.request(Va(r||{},{method:e,url:n,data:(r||{}).data}))}});V.forEach(["post","put","patch"],function(e){function n(r){return function(s,o,a){return this.request(Va(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}Ma.prototype[e]=n(),Ma.prototype[e+"Form"]=n(!0)});let rF=class E_{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(i=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{r.subscribe(a),s=a}).then(i);return o.cancel=function(){r.unsubscribe(s)},o},e(function(s,o,a){r.reason||(r.reason=new hh(s,o,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new E_(function(i){e=i}),cancel:e}}};function iF(t){return function(n){return t.apply(null,n)}}function sF(t){return V.isObject(t)&&t.isAxiosError===!0}const Mv={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Mv).forEach(([t,e])=>{Mv[e]=t});function __(t){const e=new Ma(t),n=s_(Ma.prototype.request,e);return V.extend(n,Ma.prototype,e,{allOwnKeys:!0}),V.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return __(Va(t,i))},n}const mt=__(dh);mt.Axios=Ma;mt.CanceledError=hh;mt.CancelToken=rF;mt.isCancel=v_;mt.VERSION=b_;mt.toFormData=Sg;mt.AxiosError=xe;mt.Cancel=mt.CanceledError;mt.all=function(e){return Promise.all(e)};mt.spread=iF;mt.isAxiosError=sF;mt.mergeConfig=Va;mt.AxiosHeaders=sr;mt.formToJSON=t=>y_(V.isHTMLForm(t)?new FormData(t):t);mt.getAdapter=C_.getAdapter;mt.HttpStatusCode=Mv;mt.default=mt;const{Axios:fJ,AxiosError:pJ,CanceledError:mJ,isCancel:gJ,CancelToken:yJ,VERSION:vJ,all:xJ,Cancel:SJ,isAxiosError:wJ,spread:kJ,toFormData:CJ,AxiosHeaders:bJ,HttpStatusCode:EJ,formToJSON:_J,getAdapter:NJ,mergeConfig:TJ}=mt,N_=CS(t=>({user:null,token:localStorage.getItem("creabook_token"),isAuthenticated:!!localStorage.getItem("creabook_token"),setAuth:(e,n)=>{localStorage.setItem("creabook_token",n),t({user:e,token:n,isAuthenticated:!0})},logout:async()=>{const e=localStorage.getItem("creabook_token");if(e)try{await mt.post("/api/auth/logout",{},{headers:{Authorization:`Bearer ${e}`}})}catch{}localStorage.removeItem("creabook_token"),t({user:null,token:null,isAuthenticated:!1})},checkAuth:async()=>{const e=localStorage.getItem("creabook_token");if(e)try{const n=await mt.get("/api/auth/me",{headers:{Authorization:`Bearer ${e}`}});t({user:n.data.user,token:e,isAuthenticated:!0})}catch{localStorage.removeItem("creabook_token"),t({user:null,token:null,isAuthenticated:!1})}}}));function oF({isOpen:t,onClose:e}){const[n,r]=z.useState(!0),[i,s]=z.useState(""),[o,a]=z.useState(""),[l,d]=z.useState(""),[h,f]=z.useState(""),[p,y]=z.useState(!1),{t:g}=xs(),{setAuth:x}=N_();if(!t)return null;const S=async C=>{var E,w;C.preventDefault(),f(""),y(!0);try{const b=n?"/api/auth/login":"/api/auth/register",T=n?{email:i,password:l}:{email:i,password:l,name:o},P=await mt.post(b,T);x(P.data.user,P.data.token),e()}catch(b){f(((w=(E=b.response)==null?void 0:E.data)==null?void 0:w.error)||"Authentication failed")}finally{y(!1)}};return N.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:N.jsxs("div",{className:"bg-white rounded-xl shadow-xl w-full max-w-md overflow-hidden relative",children:[N.jsx("button",{onClick:e,className:"absolute top-4 right-4 text-gray-400 flex items-center justify-center hover:bg-gray-100 rounded-lg p-2",children:N.jsx(wL,{size:20})}),N.jsxs("div",{className:"p-6",children:[N.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-6 text-center",children:g(n?"auth.welcomeBack":"auth.createAccount")}),h&&N.jsx("div",{className:"bg-red-50 text-red-600 p-3 rounded-lg mb-4 text-sm",children:h}),N.jsxs("form",{onSubmit:S,className:"space-y-4",children:[!n&&N.jsxs("div",{children:[N.jsx("label",{className:"label",children:g("auth.name")}),N.jsx("input",{type:"text",value:o,onChange:C=>a(C.target.value),className:"input",placeholder:g("auth.name")})]}),N.jsxs("div",{children:[N.jsx("label",{className:"label",children:g("auth.email")}),N.jsx("input",{type:"email",value:i,onChange:C=>s(C.target.value),required:!0,className:"input",placeholder:"you@example.com"})]}),N.jsxs("div",{children:[N.jsx("label",{className:"label",children:g("auth.password")}),N.jsx("input",{type:"password",value:l,onChange:C=>d(C.target.value),required:!0,className:"input",placeholder:"••••••••"})]}),N.jsx("button",{type:"submit",disabled:p,className:"btn-primary w-full py-2.5 mt-2",children:g(p?"auth.pleaseWait":n?"auth.login":"auth.signUp")})]}),N.jsxs("div",{className:"mt-6 text-center text-sm text-gray-500",children:[g(n?"auth.dontHaveAccount":"auth.alreadyHaveAccount"),N.jsx("button",{type:"button",onClick:()=>{r(!n),f("")},className:"text-primary-600 font-semibold hover:underline",children:g(n?"auth.signUp":"auth.login")})]})]})]})})}function aF({covers:t,onSelect:e,onDelete:n}){return t.length===0?N.jsxs("div",{className:"card text-center py-12",children:[N.jsx(kS,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),N.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"No covers yet"}),N.jsx("p",{className:"text-gray-500 mt-2",children:"Upload a cover image or generate one with AI to get started"})]}):N.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:t.map(r=>N.jsxs("div",{className:"card p-0 overflow-hidden group hover:shadow-lg transition-shadow",children:[N.jsxs("div",{className:"aspect-[2/3] relative bg-gray-100",children:[N.jsx("img",{src:r.url,alt:r.filename,className:"w-full h-full object-cover"}),N.jsxs("div",{className:"absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2",children:[N.jsx("button",{onClick:()=>e(r.url),className:"p-2 bg-white rounded-lg hover:bg-gray-100 transition-colors",title:"Edit",children:N.jsx(rL,{className:"w-5 h-5 text-gray-700"})}),N.jsx("button",{onClick:()=>{const i=document.createElement("a");i.href=r.url,i.download=r.filename,i.click()},className:"p-2 bg-white rounded-lg hover:bg-gray-100 transition-colors",title:"Download",children:N.jsx(V8,{className:"w-5 h-5 text-gray-700"})}),N.jsx("button",{onClick:()=>n(r.id),className:"p-2 bg-red-500 rounded-lg hover:bg-red-600 transition-colors",title:"Delete",children:N.jsx(vL,{className:"w-5 h-5 text-white"})})]})]}),N.jsxs("div",{className:"p-3",children:[N.jsx("p",{className:"text-sm font-medium text-gray-900 truncate",children:r.filename}),N.jsx("p",{className:"text-xs text-gray-500 mt-1",children:new Date(r.createdAt).toLocaleDateString()})]})]},r.id))})}var T_={exports:{}},kg={},tm={},Ae={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t._registerNode=t.Konva=t.glob=void 0;const e=Math.PI/180;function n(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}t.glob=typeof S4<"u"?S4:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},t.Konva={_global:t.glob,version:"9.3.22",isBrowser:n(),isUnminified:/param/.test((function(i){}).toString()),dblClickWindow:400,getAngle(i){return t.Konva.angleDeg?i*e:i},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_fixTextRendering:!1,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return t.Konva.DD.isDragging},isTransforming(){var i;return(i=t.Konva.Transformer)===null||i===void 0?void 0:i.isTransforming()},isDragReady(){return!!t.Konva.DD.node},releaseCanvasOnDestroy:!0,document:t.glob.document,_injectGlobal(i){t.glob.Konva=i}};const r=i=>{t.Konva[i.prototype.getClassName()]=i};t._registerNode=r,t.Konva._injectGlobal(t.Konva)})(Ae);var bt={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Util=t.Transform=void 0;const e=Ae;class n{constructor(b=[1,0,0,1,0,0]){this.dirty=!1,this.m=b&&b.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new n(this.m)}copyInto(b){b.m[0]=this.m[0],b.m[1]=this.m[1],b.m[2]=this.m[2],b.m[3]=this.m[3],b.m[4]=this.m[4],b.m[5]=this.m[5]}point(b){const T=this.m;return{x:T[0]*b.x+T[2]*b.y+T[4],y:T[1]*b.x+T[3]*b.y+T[5]}}translate(b,T){return this.m[4]+=this.m[0]*b+this.m[2]*T,this.m[5]+=this.m[1]*b+this.m[3]*T,this}scale(b,T){return this.m[0]*=b,this.m[1]*=b,this.m[2]*=T,this.m[3]*=T,this}rotate(b){const T=Math.cos(b),P=Math.sin(b),A=this.m[0]*T+this.m[2]*P,M=this.m[1]*T+this.m[3]*P,I=this.m[0]*-P+this.m[2]*T,R=this.m[1]*-P+this.m[3]*T;return this.m[0]=A,this.m[1]=M,this.m[2]=I,this.m[3]=R,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(b,T){const P=this.m[0]+this.m[2]*T,A=this.m[1]+this.m[3]*T,M=this.m[2]+this.m[0]*b,I=this.m[3]+this.m[1]*b;return this.m[0]=P,this.m[1]=A,this.m[2]=M,this.m[3]=I,this}multiply(b){const T=this.m[0]*b.m[0]+this.m[2]*b.m[1],P=this.m[1]*b.m[0]+this.m[3]*b.m[1],A=this.m[0]*b.m[2]+this.m[2]*b.m[3],M=this.m[1]*b.m[2]+this.m[3]*b.m[3],I=this.m[0]*b.m[4]+this.m[2]*b.m[5]+this.m[4],R=this.m[1]*b.m[4]+this.m[3]*b.m[5]+this.m[5];return this.m[0]=T,this.m[1]=P,this.m[2]=A,this.m[3]=M,this.m[4]=I,this.m[5]=R,this}invert(){const b=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),T=this.m[3]*b,P=-this.m[1]*b,A=-this.m[2]*b,M=this.m[0]*b,I=b*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),R=b*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=T,this.m[1]=P,this.m[2]=A,this.m[3]=M,this.m[4]=I,this.m[5]=R,this}getMatrix(){return this.m}decompose(){const b=this.m[0],T=this.m[1],P=this.m[2],A=this.m[3],M=this.m[4],I=this.m[5],R=b*A-T*P,U={x:M,y:I,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(b!=0||T!=0){const B=Math.sqrt(b*b+T*T);U.rotation=T>0?Math.acos(b/B):-Math.acos(b/B),U.scaleX=B,U.scaleY=R/B,U.skewX=(b*P+T*A)/R,U.skewY=0}else if(P!=0||A!=0){const B=Math.sqrt(P*P+A*A);U.rotation=Math.PI/2-(A>0?Math.acos(-P/B):-Math.acos(P/B)),U.scaleX=R/B,U.scaleY=B,U.skewX=0,U.skewY=(b*P+T*A)/R}return U.rotation=t.Util._getRotation(U.rotation),U}}t.Transform=n;const r="[object Array]",i="[object Number]",s="[object String]",o="[object Boolean]",a=Math.PI/180,l=180/Math.PI,d="#",h="",f="0",p="Konva warning: ",y="Konva error: ",g="rgb(",x={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},S=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;let C=[];const E=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(w){setTimeout(w,60)};t.Util={_isElement(w){return!!(w&&w.nodeType==1)},_isFunction(w){return!!(w&&w.constructor&&w.call&&w.apply)},_isPlainObject(w){return!!w&&w.constructor===Object},_isArray(w){return Object.prototype.toString.call(w)===r},_isNumber(w){return Object.prototype.toString.call(w)===i&&!isNaN(w)&&isFinite(w)},_isString(w){return Object.prototype.toString.call(w)===s},_isBoolean(w){return Object.prototype.toString.call(w)===o},isObject(w){return w instanceof Object},isValidSelector(w){if(typeof w!="string")return!1;const b=w[0];return b==="#"||b==="."||b===b.toUpperCase()},_sign(w){return w===0||w>0?1:-1},requestAnimFrame(w){C.push(w),C.length===1&&E(function(){const b=C;C=[],b.forEach(function(T){T()})})},createCanvasElement(){const w=document.createElement("canvas");try{w.style=w.style||{}}catch{}return w},createImageElement(){return document.createElement("img")},_isInDocument(w){for(;w=w.parentNode;)if(w==document)return!0;return!1},_urlToImage(w,b){const T=t.Util.createImageElement();T.onload=function(){b(T)},T.src=w},_rgbToHex(w,b,T){return((1<<24)+(w<<16)+(b<<8)+T).toString(16).slice(1)},_hexToRgb(w){w=w.replace(d,h);const b=parseInt(w,16);return{r:b>>16&255,g:b>>8&255,b:b&255}},getRandomColor(){let w=(Math.random()*16777215<<0).toString(16);for(;w.length<6;)w=f+w;return d+w},getRGB(w){let b;return w in x?(b=x[w],{r:b[0],g:b[1],b:b[2]}):w[0]===d?this._hexToRgb(w.substring(1)):w.substr(0,4)===g?(b=S.exec(w.replace(/ /g,"")),{r:parseInt(b[1],10),g:parseInt(b[2],10),b:parseInt(b[3],10)}):{r:0,g:0,b:0}},colorToRGBA(w){return w=w||"black",t.Util._namedColorToRBA(w)||t.Util._hex3ColorToRGBA(w)||t.Util._hex4ColorToRGBA(w)||t.Util._hex6ColorToRGBA(w)||t.Util._hex8ColorToRGBA(w)||t.Util._rgbColorToRGBA(w)||t.Util._rgbaColorToRGBA(w)||t.Util._hslColorToRGBA(w)},_namedColorToRBA(w){const b=x[w.toLowerCase()];return b?{r:b[0],g:b[1],b:b[2],a:1}:null},_rgbColorToRGBA(w){if(w.indexOf("rgb(")===0){w=w.match(/rgb\(([^)]+)\)/)[1];const b=w.split(/ *, */).map(Number);return{r:b[0],g:b[1],b:b[2],a:1}}},_rgbaColorToRGBA(w){if(w.indexOf("rgba(")===0){w=w.match(/rgba\(([^)]+)\)/)[1];const b=w.split(/ *, */).map((T,P)=>T.slice(-1)==="%"?P===3?parseInt(T)/100:parseInt(T)/100*255:Number(T));return{r:b[0],g:b[1],b:b[2],a:b[3]}}},_hex8ColorToRGBA(w){if(w[0]==="#"&&w.length===9)return{r:parseInt(w.slice(1,3),16),g:parseInt(w.slice(3,5),16),b:parseInt(w.slice(5,7),16),a:parseInt(w.slice(7,9),16)/255}},_hex6ColorToRGBA(w){if(w[0]==="#"&&w.length===7)return{r:parseInt(w.slice(1,3),16),g:parseInt(w.slice(3,5),16),b:parseInt(w.slice(5,7),16),a:1}},_hex4ColorToRGBA(w){if(w[0]==="#"&&w.length===5)return{r:parseInt(w[1]+w[1],16),g:parseInt(w[2]+w[2],16),b:parseInt(w[3]+w[3],16),a:parseInt(w[4]+w[4],16)/255}},_hex3ColorToRGBA(w){if(w[0]==="#"&&w.length===4)return{r:parseInt(w[1]+w[1],16),g:parseInt(w[2]+w[2],16),b:parseInt(w[3]+w[3],16),a:1}},_hslColorToRGBA(w){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(w)){const[b,...T]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(w),P=Number(T[0])/360,A=Number(T[1])/100,M=Number(T[2])/100;let I,R,U;if(A===0)return U=M*255,{r:Math.round(U),g:Math.round(U),b:Math.round(U),a:1};M<.5?I=M*(1+A):I=M+A-M*A;const B=2*M-I,$=[0,0,0];for(let Q=0;Q<3;Q++)R=P+1/3*-(Q-1),R<0&&R++,R>1&&R--,6*R<1?U=B+(I-B)*6*R:2*R<1?U=I:3*R<2?U=B+(I-B)*(2/3-R)*6:U=B,$[Q]=U*255;return{r:Math.round($[0]),g:Math.round($[1]),b:Math.round($[2]),a:1}}},haveIntersection(w,b){return!(b.x>w.x+w.width||b.x+b.width<w.x||b.y>w.y+w.height||b.y+b.height<w.y)},cloneObject(w){const b={};for(const T in w)this._isPlainObject(w[T])?b[T]=this.cloneObject(w[T]):this._isArray(w[T])?b[T]=this.cloneArray(w[T]):b[T]=w[T];return b},cloneArray(w){return w.slice(0)},degToRad(w){return w*a},radToDeg(w){return w*l},_degToRad(w){return t.Util.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),t.Util.degToRad(w)},_radToDeg(w){return t.Util.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),t.Util.radToDeg(w)},_getRotation(w){return e.Konva.angleDeg?t.Util.radToDeg(w):w},_capitalize(w){return w.charAt(0).toUpperCase()+w.slice(1)},throw(w){throw new Error(y+w)},error(w){console.error(y+w)},warn(w){e.Konva.showWarnings&&console.warn(p+w)},each(w,b){for(const T in w)b(T,w[T])},_inRange(w,b,T){return b<=w&&w<T},_getProjectionToSegment(w,b,T,P,A,M){let I,R,U;const B=(w-T)*(w-T)+(b-P)*(b-P);if(B==0)I=w,R=b,U=(A-T)*(A-T)+(M-P)*(M-P);else{const $=((A-w)*(T-w)+(M-b)*(P-b))/B;$<0?(I=w,R=b,U=(w-A)*(w-A)+(b-M)*(b-M)):$>1?(I=T,R=P,U=(T-A)*(T-A)+(P-M)*(P-M)):(I=w+$*(T-w),R=b+$*(P-b),U=(I-A)*(I-A)+(R-M)*(R-M))}return[I,R,U]},_getProjectionToLine(w,b,T){const P=t.Util.cloneObject(w);let A=Number.MAX_VALUE;return b.forEach(function(M,I){if(!T&&I===b.length-1)return;const R=b[(I+1)%b.length],U=t.Util._getProjectionToSegment(M.x,M.y,R.x,R.y,w.x,w.y),B=U[0],$=U[1],Q=U[2];Q<A&&(P.x=B,P.y=$,A=Q)}),P},_prepareArrayForTween(w,b,T){const P=[],A=[];if(w.length>b.length){const I=b;b=w,w=I}for(let I=0;I<w.length;I+=2)P.push({x:w[I],y:w[I+1]});for(let I=0;I<b.length;I+=2)A.push({x:b[I],y:b[I+1]});const M=[];return A.forEach(function(I){const R=t.Util._getProjectionToLine(I,P,T);M.push(R.x),M.push(R.y)}),M},_prepareToStringify(w){let b;w.visitedByCircularReferenceRemoval=!0;for(const T in w)if(w.hasOwnProperty(T)&&w[T]&&typeof w[T]=="object"){if(b=Object.getOwnPropertyDescriptor(w,T),w[T].visitedByCircularReferenceRemoval||t.Util._isElement(w[T]))if(b.configurable)delete w[T];else return null;else if(t.Util._prepareToStringify(w[T])===null)if(b.configurable)delete w[T];else return null}return delete w.visitedByCircularReferenceRemoval,w},_assign(w,b){for(const T in b)w[T]=b[T];return w},_getFirstPointerId(w){return w.touches?w.changedTouches[0].identifier:w.pointerId||999},releaseCanvas(...w){e.Konva.releaseCanvasOnDestroy&&w.forEach(b=>{b.width=0,b.height=0})},drawRoundedRectPath(w,b,T,P){let A=0,M=0,I=0,R=0;typeof P=="number"?A=M=I=R=Math.min(P,b/2,T/2):(A=Math.min(P[0]||0,b/2,T/2),M=Math.min(P[1]||0,b/2,T/2),R=Math.min(P[2]||0,b/2,T/2),I=Math.min(P[3]||0,b/2,T/2)),w.moveTo(A,0),w.lineTo(b-M,0),w.arc(b-M,M,M,Math.PI*3/2,0,!1),w.lineTo(b,T-R),w.arc(b-R,T-R,R,0,Math.PI/2,!1),w.lineTo(I,T),w.arc(I,T-I,I,Math.PI/2,Math.PI,!1),w.lineTo(0,A),w.arc(A,A,A,Math.PI,Math.PI*3/2,!1)}}})(bt);var gt={},ai={},cs={};Object.defineProperty(cs,"__esModule",{value:!0});cs.HitContext=cs.SceneContext=cs.Context=void 0;const M_=bt,lF=Ae;function uF(t){const e=[],n=t.length,r=M_.Util;for(let i=0;i<n;i++){let s=t[i];r._isNumber(s)?s=Math.round(s*1e3)/1e3:r._isString(s)||(s=s+""),e.push(s)}return e}const P5=",",cF="(",dF=")",hF="([",fF="])",pF=";",mF="()",gF="=",O5=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","roundRect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],yF=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"],vF=100;class Cg{constructor(e){this.canvas=e,lF.Konva.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(e){e.fillEnabled()&&this._fill(e)}_fill(e){}strokeShape(e){e.hasStroke()&&this._stroke(e)}_stroke(e){}fillStrokeShape(e){e.attrs.fillAfterStrokeEnabled?(this.strokeShape(e),this.fillShape(e)):(this.fillShape(e),this.strokeShape(e))}getTrace(e,n){let r=this.traceArr,i=r.length,s="",o,a,l,d;for(o=0;o<i;o++)a=r[o],l=a.method,l?(d=a.args,s+=l,e?s+=mF:M_.Util._isArray(d[0])?s+=hF+d.join(P5)+fF:(n&&(d=d.map(h=>typeof h=="number"?Math.floor(h):h)),s+=cF+d.join(P5)+dF)):(s+=a.property,e||(s+=gF+a.val)),s+=pF;return s}clearTrace(){this.traceArr=[]}_trace(e){let n=this.traceArr,r;n.push(e),r=n.length,r>=vF&&n.shift()}reset(){const e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){const n=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(e){const n=e.attrs.lineCap;n&&this.setAttr("lineCap",n)}_applyOpacity(e){const n=e.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(e){const n=e.attrs.lineJoin;n&&this.setAttr("lineJoin",n)}setAttr(e,n){this._context[e]=n}arc(e,n,r,i,s,o){this._context.arc(e,n,r,i,s,o)}arcTo(e,n,r,i,s){this._context.arcTo(e,n,r,i,s)}beginPath(){this._context.beginPath()}bezierCurveTo(e,n,r,i,s,o){this._context.bezierCurveTo(e,n,r,i,s,o)}clearRect(e,n,r,i){this._context.clearRect(e,n,r,i)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,n){const r=arguments;if(r.length===2)return this._context.createImageData(e,n);if(r.length===1)return this._context.createImageData(e)}createLinearGradient(e,n,r,i){return this._context.createLinearGradient(e,n,r,i)}createPattern(e,n){return this._context.createPattern(e,n)}createRadialGradient(e,n,r,i,s,o){return this._context.createRadialGradient(e,n,r,i,s,o)}drawImage(e,n,r,i,s,o,a,l,d){const h=arguments,f=this._context;h.length===3?f.drawImage(e,n,r):h.length===5?f.drawImage(e,n,r,i,s):h.length===9&&f.drawImage(e,n,r,i,s,o,a,l,d)}ellipse(e,n,r,i,s,o,a,l){this._context.ellipse(e,n,r,i,s,o,a,l)}isPointInPath(e,n,r,i){return r?this._context.isPointInPath(r,e,n,i):this._context.isPointInPath(e,n,i)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,n,r,i){this._context.fillRect(e,n,r,i)}strokeRect(e,n,r,i){this._context.strokeRect(e,n,r,i)}fillText(e,n,r,i){i?this._context.fillText(e,n,r,i):this._context.fillText(e,n,r)}measureText(e){return this._context.measureText(e)}getImageData(e,n,r,i){return this._context.getImageData(e,n,r,i)}lineTo(e,n){this._context.lineTo(e,n)}moveTo(e,n){this._context.moveTo(e,n)}rect(e,n,r,i){this._context.rect(e,n,r,i)}roundRect(e,n,r,i,s){this._context.roundRect(e,n,r,i,s)}putImageData(e,n,r){this._context.putImageData(e,n,r)}quadraticCurveTo(e,n,r,i){this._context.quadraticCurveTo(e,n,r,i)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,n){this._context.scale(e,n)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,n,r,i,s,o){this._context.setTransform(e,n,r,i,s,o)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,n,r,i){this._context.strokeText(e,n,r,i)}transform(e,n,r,i,s,o){this._context.transform(e,n,r,i,s,o)}translate(e,n){this._context.translate(e,n)}_enableTrace(){let e=this,n=O5.length,r=this.setAttr,i,s;const o=function(a){let l=e[a],d;e[a]=function(){return s=uF(Array.prototype.slice.call(arguments,0)),d=l.apply(e,arguments),e._trace({method:a,args:s}),d}};for(i=0;i<n;i++)o(O5[i]);e.setAttr=function(){r.apply(e,arguments);const a=arguments[0];let l=arguments[1];(a==="shadowOffsetX"||a==="shadowOffsetY"||a==="shadowBlur")&&(l=l/this.canvas.getPixelRatio()),e._trace({property:a,val:l})}}_applyGlobalCompositeOperation(e){const n=e.attrs.globalCompositeOperation;!n||n==="source-over"||this.setAttr("globalCompositeOperation",n)}}cs.Context=Cg;yF.forEach(function(t){Object.defineProperty(Cg.prototype,t,{get(){return this._context[t]},set(e){this._context[t]=e}})});class xF extends Cg{constructor(e,{willReadFrequently:n=!1}={}){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:n})}_fillColor(e){const n=e.fill();this.setAttr("fillStyle",n),e._fillFunc(this)}_fillPattern(e){this.setAttr("fillStyle",e._getFillPattern()),e._fillFunc(this)}_fillLinearGradient(e){const n=e._getLinearGradient();n&&(this.setAttr("fillStyle",n),e._fillFunc(this))}_fillRadialGradient(e){const n=e._getRadialGradient();n&&(this.setAttr("fillStyle",n),e._fillFunc(this))}_fill(e){const n=e.fill(),r=e.getFillPriority();if(n&&r==="color"){this._fillColor(e);return}const i=e.getFillPatternImage();if(i&&r==="pattern"){this._fillPattern(e);return}const s=e.getFillLinearGradientColorStops();if(s&&r==="linear-gradient"){this._fillLinearGradient(e);return}const o=e.getFillRadialGradientColorStops();if(o&&r==="radial-gradient"){this._fillRadialGradient(e);return}n?this._fillColor(e):i?this._fillPattern(e):s?this._fillLinearGradient(e):o&&this._fillRadialGradient(e)}_strokeLinearGradient(e){const n=e.getStrokeLinearGradientStartPoint(),r=e.getStrokeLinearGradientEndPoint(),i=e.getStrokeLinearGradientColorStops(),s=this.createLinearGradient(n.x,n.y,r.x,r.y);if(i){for(let o=0;o<i.length;o+=2)s.addColorStop(i[o],i[o+1]);this.setAttr("strokeStyle",s)}}_stroke(e){const n=e.dash(),r=e.getStrokeScaleEnabled();if(e.hasStroke()){if(!r){this.save();const s=this.getCanvas().getPixelRatio();this.setTransform(s,0,0,s,0,0)}this._applyLineCap(e),n&&e.dashEnabled()&&(this.setLineDash(n),this.setAttr("lineDashOffset",e.dashOffset())),this.setAttr("lineWidth",e.strokeWidth()),e.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)"),e.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(e):this.setAttr("strokeStyle",e.stroke()),e._strokeFunc(this),r||this.restore()}}_applyShadow(e){var n,r,i;const s=(n=e.getShadowRGBA())!==null&&n!==void 0?n:"black",o=(r=e.getShadowBlur())!==null&&r!==void 0?r:5,a=(i=e.getShadowOffset())!==null&&i!==void 0?i:{x:0,y:0},l=e.getAbsoluteScale(),d=this.canvas.getPixelRatio(),h=l.x*d,f=l.y*d;this.setAttr("shadowColor",s),this.setAttr("shadowBlur",o*Math.min(Math.abs(h),Math.abs(f))),this.setAttr("shadowOffsetX",a.x*h),this.setAttr("shadowOffsetY",a.y*f)}}cs.SceneContext=xF;class SF extends Cg{constructor(e){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:!0})}_fill(e){this.save(),this.setAttr("fillStyle",e.colorKey),e._fillFuncHit(this),this.restore()}strokeShape(e){e.hasHitStroke()&&this._stroke(e)}_stroke(e){if(e.hasHitStroke()){const n=e.getStrokeScaleEnabled();if(!n){this.save();const s=this.getCanvas().getPixelRatio();this.setTransform(s,0,0,s,0,0)}this._applyLineCap(e);const r=e.hitStrokeWidth(),i=r==="auto"?e.strokeWidth():r;this.setAttr("lineWidth",i),this.setAttr("strokeStyle",e.colorKey),e._strokeFuncHit(this),n||this.restore()}}}cs.HitContext=SF;Object.defineProperty(ai,"__esModule",{value:!0});ai.HitCanvas=ai.SceneCanvas=ai.Canvas=void 0;const nm=bt,P_=cs,O_=Ae;let Ff;function wF(){if(Ff)return Ff;const t=nm.Util.createCanvasElement(),e=t.getContext("2d");return Ff=function(){const n=O_.Konva._global.devicePixelRatio||1,r=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return n/r}(),nm.Util.releaseCanvas(t),Ff}class MS{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;const r=(e||{}).pixelRatio||O_.Konva.pixelRatio||wF();this.pixelRatio=r,this._canvas=nm.Util.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(e){const n=this.pixelRatio;this.pixelRatio=e,this.setSize(this.getWidth()/n,this.getHeight()/n)}setWidth(e){this.width=this._canvas.width=e*this.pixelRatio,this._canvas.style.width=e+"px";const n=this.pixelRatio;this.getContext()._context.scale(n,n)}setHeight(e){this.height=this._canvas.height=e*this.pixelRatio,this._canvas.style.height=e+"px";const n=this.pixelRatio;this.getContext()._context.scale(n,n)}getWidth(){return this.width}getHeight(){return this.height}setSize(e,n){this.setWidth(e||0),this.setHeight(n||0)}toDataURL(e,n){try{return this._canvas.toDataURL(e,n)}catch{try{return this._canvas.toDataURL()}catch(i){return nm.Util.error("Unable to get data URL. "+i.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}ai.Canvas=MS;class kF extends MS{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new P_.SceneContext(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}}ai.SceneCanvas=kF;class CF extends MS{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new P_.HitContext(this),this.setSize(e.width,e.height)}}ai.HitCanvas=CF;var bg={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.DD=void 0;const e=Ae,n=bt;t.DD={get isDragging(){let r=!1;return t.DD._dragElements.forEach(i=>{i.dragStatus==="dragging"&&(r=!0)}),r},justDragged:!1,get node(){let r;return t.DD._dragElements.forEach(i=>{r=i.node}),r},_dragElements:new Map,_drag(r){const i=[];t.DD._dragElements.forEach((s,o)=>{const{node:a}=s,l=a.getStage();l.setPointersPositions(r),s.pointerId===void 0&&(s.pointerId=n.Util._getFirstPointerId(r));const d=l._changedPointerPositions.find(h=>h.id===s.pointerId);if(d){if(s.dragStatus!=="dragging"){const h=a.dragDistance();if(Math.max(Math.abs(d.x-s.startPointerPos.x),Math.abs(d.y-s.startPointerPos.y))<h||(a.startDrag({evt:r}),!a.isDragging()))return}a._setDragPosition(r,s),i.push(a)}}),i.forEach(s=>{s.fire("dragmove",{type:"dragmove",target:s,evt:r},!0)})},_endDragBefore(r){const i=[];t.DD._dragElements.forEach(s=>{const{node:o}=s,a=o.getStage();if(r&&a.setPointersPositions(r),!a._changedPointerPositions.find(h=>h.id===s.pointerId))return;(s.dragStatus==="dragging"||s.dragStatus==="stopped")&&(t.DD.justDragged=!0,e.Konva._mouseListenClick=!1,e.Konva._touchListenClick=!1,e.Konva._pointerListenClick=!1,s.dragStatus="stopped");const d=s.node.getLayer()||s.node instanceof e.Konva.Stage&&s.node;d&&i.indexOf(d)===-1&&i.push(d)}),i.forEach(s=>{s.draw()})},_endDragAfter(r){t.DD._dragElements.forEach((i,s)=>{i.dragStatus==="stopped"&&i.node.fire("dragend",{type:"dragend",target:i.node,evt:r},!0),i.dragStatus!=="dragging"&&t.DD._dragElements.delete(s)})}},e.Konva.isBrowser&&(window.addEventListener("mouseup",t.DD._endDragBefore,!0),window.addEventListener("touchend",t.DD._endDragBefore,!0),window.addEventListener("touchcancel",t.DD._endDragBefore,!0),window.addEventListener("mousemove",t.DD._drag),window.addEventListener("touchmove",t.DD._drag),window.addEventListener("mouseup",t.DD._endDragAfter,!1),window.addEventListener("touchend",t.DD._endDragAfter,!1),window.addEventListener("touchcancel",t.DD._endDragAfter,!1))})(bg);var Le={},Se={};Object.defineProperty(Se,"__esModule",{value:!0});Se.RGBComponent=bF;Se.alphaComponent=EF;Se.getNumberValidator=_F;Se.getNumberOrArrayOfNumbersValidator=NF;Se.getNumberOrAutoValidator=TF;Se.getStringValidator=MF;Se.getStringOrGradientValidator=PF;Se.getFunctionValidator=OF;Se.getNumberArrayValidator=AF;Se.getBooleanValidator=RF;Se.getComponentValidator=LF;const Ss=Ae,Pt=bt;function ws(t){return Pt.Util._isString(t)?'"'+t+'"':Object.prototype.toString.call(t)==="[object Number]"||Pt.Util._isBoolean(t)?t:Object.prototype.toString.call(t)}function bF(t){return t>255?255:t<0?0:Math.round(t)}function EF(t){return t>1?1:t<1e-4?1e-4:t}function _F(){if(Ss.Konva.isUnminified)return function(t,e){return Pt.Util._isNumber(t)||Pt.Util.warn(ws(t)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),t}}function NF(t){if(Ss.Konva.isUnminified)return function(e,n){let r=Pt.Util._isNumber(e),i=Pt.Util._isArray(e)&&e.length==t;return!r&&!i&&Pt.Util.warn(ws(e)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array<number>('+t+")"),e}}function TF(){if(Ss.Konva.isUnminified)return function(t,e){return Pt.Util._isNumber(t)||t==="auto"||Pt.Util.warn(ws(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),t}}function MF(){if(Ss.Konva.isUnminified)return function(t,e){return Pt.Util._isString(t)||Pt.Util.warn(ws(t)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),t}}function PF(){if(Ss.Konva.isUnminified)return function(t,e){const n=Pt.Util._isString(t),r=Object.prototype.toString.call(t)==="[object CanvasGradient]"||t&&t.addColorStop;return n||r||Pt.Util.warn(ws(t)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),t}}function OF(){if(Ss.Konva.isUnminified)return function(t,e){return Pt.Util._isFunction(t)||Pt.Util.warn(ws(t)+' is a not valid value for "'+e+'" attribute. The value should be a function.'),t}}function AF(){if(Ss.Konva.isUnminified)return function(t,e){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&t instanceof n||(Pt.Util._isArray(t)?t.forEach(function(r){Pt.Util._isNumber(r)||Pt.Util.warn('"'+e+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):Pt.Util.warn(ws(t)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),t}}function RF(){if(Ss.Konva.isUnminified)return function(t,e){return t===!0||t===!1||Pt.Util.warn(ws(t)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),t}}function LF(t){if(Ss.Konva.isUnminified)return function(e,n){return e==null||Pt.Util.isObject(e)||Pt.Util.warn(ws(e)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+t),e}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Factory=void 0;const e=bt,n=Se,r="get",i="set";t.Factory={addGetterSetter(s,o,a,l,d){t.Factory.addGetter(s,o,a),t.Factory.addSetter(s,o,l,d),t.Factory.addOverloadedGetterSetter(s,o)},addGetter(s,o,a){const l=r+e.Util._capitalize(o);s.prototype[l]=s.prototype[l]||function(){const d=this.attrs[o];return d===void 0?a:d}},addSetter(s,o,a,l){const d=i+e.Util._capitalize(o);s.prototype[d]||t.Factory.overWriteSetter(s,o,a,l)},overWriteSetter(s,o,a,l){const d=i+e.Util._capitalize(o);s.prototype[d]=function(h){return a&&h!==void 0&&h!==null&&(h=a.call(this,h,o)),this._setAttr(o,h),l&&l.call(this),this}},addComponentsGetterSetter(s,o,a,l,d){const h=a.length,f=e.Util._capitalize,p=r+f(o),y=i+f(o);s.prototype[p]=function(){const x={};for(let S=0;S<h;S++){const C=a[S];x[C]=this.getAttr(o+f(C))}return x};const g=(0,n.getComponentValidator)(a);s.prototype[y]=function(x){const S=this.attrs[o];l&&(x=l.call(this,x,o)),g&&g.call(this,x,o);for(const C in x)x.hasOwnProperty(C)&&this._setAttr(o+f(C),x[C]);return x||a.forEach(C=>{this._setAttr(o+f(C),void 0)}),this._fireChangeEvent(o,S,x),d&&d.call(this),this},t.Factory.addOverloadedGetterSetter(s,o)},addOverloadedGetterSetter(s,o){const a=e.Util._capitalize(o),l=i+a,d=r+a;s.prototype[o]=function(){return arguments.length?(this[l](arguments[0]),this):this[d]()}},addDeprecatedGetterSetter(s,o,a,l){e.Util.error("Adding deprecated "+o);const d=r+e.Util._capitalize(o),h=o+" property is deprecated and will be removed soon. Look at Konva change log for more information.";s.prototype[d]=function(){e.Util.error(h);const f=this.attrs[o];return f===void 0?a:f},t.Factory.addSetter(s,o,l,function(){e.Util.error(h)}),t.Factory.addOverloadedGetterSetter(s,o)},backCompat(s,o){e.Util.each(o,function(a,l){const d=s.prototype[l],h=r+e.Util._capitalize(a),f=i+e.Util._capitalize(a);function p(){d.apply(this,arguments),e.Util.error('"'+a+'" method is deprecated and will be removed soon. Use ""'+l+'" instead.')}s.prototype[a]=p,s.prototype[h]=p,s.prototype[f]=p})},afterSetFilter(){this._filterUpToDate=!1}}})(Le);Object.defineProperty(gt,"__esModule",{value:!0});gt.Node=void 0;const bl=ai,Mr=bg,fh=Le,js=Ae,De=bt,It=Se,vp="absoluteOpacity",jf="allEventListeners",Yi="absoluteTransform",A5="absoluteScale",na="canvas",IF="Change",DF="children",FF="konva",Pv="listening",jF="mouseenter",zF="mouseleave",BF="pointerenter",UF="pointerleave",HF="touchenter",VF="touchleave",R5="set",L5="Shape",xp=" ",I5="stage",Us="transform",GF="Stage",Ov="visible",$F=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(xp);let WF=1,Ee=class Av{constructor(e){this._id=WF++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){(e===Us||e===Yi)&&this._cache.get(e)?this._cache.get(e).dirty=!0:e?this._cache.delete(e):this._cache.clear()}_getCache(e,n){let r=this._cache.get(e);return(r===void 0||(e===Us||e===Yi)&&r.dirty===!0)&&(r=n.call(this),this._cache.set(e,r)),r}_calculate(e,n,r){if(!this._attachedDepsListeners.get(e)){const i=n.map(s=>s+"Change.konva").join(xp);this.on(i,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,r)}_getCanvasCache(){return this._cache.get(na)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===Yi&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(na)){const{scene:e,filter:n,hit:r,buffer:i}=this._cache.get(na);De.Util.releaseCanvas(e,n,r,i),this._cache.delete(na)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){const n=e||{};let r={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let i=Math.ceil(n.width||r.width),s=Math.ceil(n.height||r.height),o=n.pixelRatio,a=n.x===void 0?Math.floor(r.x):n.x,l=n.y===void 0?Math.floor(r.y):n.y,d=n.offset||0,h=n.drawBorder||!1,f=n.hitCanvasPixelRatio||1;if(!i||!s){De.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}const p=Math.abs(Math.round(r.x)-a)>.5?1:0,y=Math.abs(Math.round(r.y)-l)>.5?1:0;i+=d*2+p,s+=d*2+y,a-=d,l-=d;const g=new bl.SceneCanvas({pixelRatio:o,width:i,height:s}),x=new bl.SceneCanvas({pixelRatio:o,width:0,height:0,willReadFrequently:!0}),S=new bl.HitCanvas({pixelRatio:f,width:i,height:s}),C=g.getContext(),E=S.getContext(),w=new bl.SceneCanvas({width:g.width/g.pixelRatio+Math.abs(a),height:g.height/g.pixelRatio+Math.abs(l),pixelRatio:g.pixelRatio}),b=w.getContext();return S.isCache=!0,g.isCache=!0,this._cache.delete(na),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(g.getContext()._context.imageSmoothingEnabled=!1,x.getContext()._context.imageSmoothingEnabled=!1),C.save(),E.save(),b.save(),C.translate(-a,-l),E.translate(-a,-l),b.translate(-a,-l),w.x=a,w.y=l,this._isUnderCache=!0,this._clearSelfAndDescendantCache(vp),this._clearSelfAndDescendantCache(A5),this.drawScene(g,this,w),this.drawHit(S,this),this._isUnderCache=!1,C.restore(),E.restore(),h&&(C.save(),C.beginPath(),C.rect(0,0,i,s),C.closePath(),C.setAttr("strokeStyle","red"),C.setAttr("lineWidth",5),C.stroke(),C.restore()),this._cache.set(na,{scene:g,filter:x,hit:S,buffer:w,x:a,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(na)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,n){const r=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}];let i=1/0,s=1/0,o=-1/0,a=-1/0;const l=this.getAbsoluteTransform(n);return r.forEach(function(d){const h=l.point(d);i===void 0&&(i=o=h.x,s=a=h.y),i=Math.min(i,h.x),s=Math.min(s,h.y),o=Math.max(o,h.x),a=Math.max(a,h.y)}),{x:i,y:s,width:o-i,height:a-s}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();e.translate(n.x,n.y);const r=this._getCachedSceneCanvas(),i=r.pixelRatio;e.drawImage(r._canvas,0,0,r.width/i,r.height/i),e.restore()}_drawCachedHitCanvas(e){const n=this._getCanvasCache(),r=n.hit;e.save(),e.translate(n.x,n.y),e.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),e.restore()}_getCachedSceneCanvas(){let e=this.filters(),n=this._getCanvasCache(),r=n.scene,i=n.filter,s=i.getContext(),o,a,l,d;if(e){if(!this._filterUpToDate){const h=r.pixelRatio;i.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio);try{for(o=e.length,s.clear(),s.drawImage(r._canvas,0,0,r.getWidth()/h,r.getHeight()/h),a=s.getImageData(0,0,i.getWidth(),i.getHeight()),l=0;l<o;l++){if(d=e[l],typeof d!="function"){De.Util.error("Filter should be type of function, but got "+typeof d+" instead. Please check correct filters");continue}d.call(this,a),s.putImageData(a,0,0)}}catch(f){De.Util.error("Unable to apply filter. "+f.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}this._filterUpToDate=!0}return i}return r}on(e,n){if(this._cache&&this._cache.delete(jf),arguments.length===3)return this._delegate.apply(this,arguments);const r=e.split(xp);for(let i=0;i<r.length;i++){const o=r[i].split("."),a=o[0],l=o[1]||"";this.eventListeners[a]||(this.eventListeners[a]=[]),this.eventListeners[a].push({name:l,handler:n})}return this}off(e,n){let r=(e||"").split(xp),i=r.length,s,o,a,l,d,h;if(this._cache&&this._cache.delete(jf),!e)for(o in this.eventListeners)this._off(o);for(s=0;s<i;s++)if(a=r[s],l=a.split("."),d=l[0],h=l[1],d)this.eventListeners[d]&&this._off(d,h,n);else for(o in this.eventListeners)this._off(o,h,n);return this}dispatchEvent(e){const n={target:this,type:e.type,evt:e};return this.fire(e.type,n),this}addEventListener(e,n){return this.on(e,function(r){n.call(this,r.evt)}),this}removeEventListener(e){return this.off(e),this}_delegate(e,n,r){const i=this;this.on(e,function(s){const o=s.target.findAncestors(n,!0,i);for(let a=0;a<o.length;a++)s=De.Util.cloneObject(s),s.currentTarget=o[a],r.call(o[a],s)})}remove(){return this.isDragging()&&this.stopDrag(),Mr.DD._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(Yi),this._clearSelfAndDescendantCache(vp),this._clearSelfAndDescendantCache(A5),this._clearSelfAndDescendantCache(I5),this._clearSelfAndDescendantCache(Ov),this._clearSelfAndDescendantCache(Pv)}_remove(){this._clearCaches();const e=this.getParent();e&&e.children&&(e.children.splice(this.index,1),e._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(e){const n="get"+De.Util._capitalize(e);return De.Util._isFunction(this[n])?this[n]():this.attrs[e]}getAncestors(){let e=this.getParent(),n=[];for(;e;)n.push(e),e=e.getParent();return n}getAttrs(){return this.attrs||{}}setAttrs(e){return this._batchTransformChanges(()=>{let n,r;if(!e)return this;for(n in e)n!==DF&&(r=R5+De.Util._capitalize(n),De.Util._isFunction(this[r])?this[r](e[n]):this._setAttr(n,e[n]))}),this}isListening(){return this._getCache(Pv,this._isListening)}_isListening(e){if(!this.listening())return!1;const r=this.getParent();return r&&r!==e&&this!==e?r._isListening(e):!0}isVisible(){return this._getCache(Ov,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const r=this.getParent();return r&&r!==e&&this!==e?r._isVisible(e):!0}shouldDrawHit(e,n=!1){if(e)return this._isVisible(e)&&this._isListening(e);const r=this.getLayer();let i=!1;Mr.DD._dragElements.forEach(o=>{o.dragStatus==="dragging"&&(o.node.nodeType==="Stage"||o.node.getLayer()===r)&&(i=!0)});const s=!n&&!js.Konva.hitOnDragEnabled&&(i||js.Konva.isTransforming());return this.isListening()&&this.isVisible()&&!s}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let e=this.getDepth(),n=this,r=0,i,s,o,a;function l(h){for(i=[],s=h.length,o=0;o<s;o++)a=h[o],r++,a.nodeType!==L5&&(i=i.concat(a.getChildren().slice())),a._id===n._id&&(o=s);i.length>0&&i[0].getDepth()<=e&&l(i)}const d=this.getStage();return n.nodeType!==GF&&d&&l(d.getChildren()),r}getDepth(){let e=0,n=this.parent;for(;n;)e++,n=n.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(Us),this._clearSelfAndDescendantCache(Yi)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges(()=>{this.x(e.x),this.y(e.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const e=this.getStage();if(!e)return null;const n=e.getPointerPosition();if(!n)return null;const r=this.getAbsoluteTransform().copy();return r.invert(),r.point(n)}getAbsolutePosition(e){let n=!1,r=this.parent;for(;r;){if(r.isCached()){n=!0;break}r=r.parent}n&&!e&&(e=!0);const i=this.getAbsoluteTransform(e).getMatrix(),s=new De.Transform,o=this.offset();return s.m=i.slice(),s.translate(o.x,o.y),s.getTranslation()}setAbsolutePosition(e){const{x:n,y:r,...i}=this._clearTransform();this.attrs.x=n,this.attrs.y=r,this._clearCache(Us);const s=this._getAbsoluteTransform().copy();return s.invert(),s.translate(e.x,e.y),e={x:this.attrs.x+s.getTranslation().x,y:this.attrs.y+s.getTranslation().y},this._setTransform(i),this.setPosition({x:e.x,y:e.y}),this._clearCache(Us),this._clearSelfAndDescendantCache(Yi),this}_setTransform(e){let n;for(n in e)this.attrs[n]=e[n]}_clearTransform(){const e={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,e}move(e){let n=e.x,r=e.y,i=this.x(),s=this.y();return n!==void 0&&(i+=n),r!==void 0&&(s+=r),this.setPosition({x:i,y:s}),this}_eachAncestorReverse(e,n){let r=[],i=this.getParent(),s,o;if(!(n&&n._id===this._id)){for(r.unshift(this);i&&(!n||i._id!==n._id);)r.unshift(i),i=i.parent;for(s=r.length,o=0;o<s;o++)e(r[o])}}rotate(e){return this.rotation(this.rotation()+e),this}moveToTop(){if(!this.parent)return De.Util.warn("Node has no parent. moveToTop function is ignored."),!1;const e=this.index,n=this.parent.getChildren().length;return e<n-1?(this.parent.children.splice(e,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0):!1}moveUp(){if(!this.parent)return De.Util.warn("Node has no parent. moveUp function is ignored."),!1;const e=this.index,n=this.parent.getChildren().length;return e<n-1?(this.parent.children.splice(e,1),this.parent.children.splice(e+1,0,this),this.parent._setChildrenIndices(),!0):!1}moveDown(){if(!this.parent)return De.Util.warn("Node has no parent. moveDown function is ignored."),!1;const e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return De.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;const e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(e){if(!this.parent)return De.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&De.Util.warn("Unexpected value "+e+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");const n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(vp,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let e=this.opacity();const n=this.getParent();return n&&!n._isUnderCache&&(e*=n.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){let e=this.getAttrs(),n,r,i,s,o;const a={attrs:{},className:this.getClassName()};for(n in e)r=e[n],o=De.Util.isObject(r)&&!De.Util._isPlainObject(r)&&!De.Util._isArray(r),!o&&(i=typeof this[n]=="function"&&this[n],delete e[n],s=i?i.call(this):null,e[n]=r,s!==r&&(a.attrs[n]=r));return De.Util._prepareToStringify(a)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,n,r){const i=[];n&&this._isMatch(e)&&i.push(this);let s=this.parent;for(;s;){if(s===r)return i;s._isMatch(e)&&i.push(s),s=s.parent}return i}isAncestorOf(e){return!1}findAncestor(e,n,r){return this.findAncestors(e,n,r)[0]}_isMatch(e){if(!e)return!1;if(typeof e=="function")return e(this);let n=e.replace(/ /g,"").split(","),r=n.length,i,s;for(i=0;i<r;i++)if(s=n[i],De.Util.isValidSelector(s)||(De.Util.warn('Selector "'+s+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),De.Util.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),De.Util.warn("Konva is awesome, right?")),s.charAt(0)==="#"){if(this.id()===s.slice(1))return!0}else if(s.charAt(0)==="."){if(this.hasName(s.slice(1)))return!0}else if(this.className===s||this.nodeType===s)return!0;return!1}getLayer(){const e=this.getParent();return e?e.getLayer():null}getStage(){return this._getCache(I5,this._getStage)}_getStage(){const e=this.getParent();return e?e.getStage():null}fire(e,n={},r){return n.target=n.target||this,r?this._fireAndBubble(e,n):this._fire(e,n),this}getAbsoluteTransform(e){return e?this._getAbsoluteTransform(e):this._getCache(Yi,this._getAbsoluteTransform)}_getAbsoluteTransform(e){let n;if(e)return n=new De.Transform,this._eachAncestorReverse(function(r){const i=r.transformsEnabled();i==="all"?n.multiply(r.getTransform()):i==="position"&&n.translate(r.x()-r.offsetX(),r.y()-r.offsetY())},e),n;{n=this._cache.get(Yi)||new De.Transform,this.parent?this.parent.getAbsoluteTransform().copyInto(n):n.reset();const r=this.transformsEnabled();if(r==="all")n.multiply(this.getTransform());else if(r==="position"){const i=this.attrs.x||0,s=this.attrs.y||0,o=this.attrs.offsetX||0,a=this.attrs.offsetY||0;n.translate(i-o,s-a)}return n.dirty=!1,n}}getAbsoluteScale(e){let n=this;for(;n;)n._isUnderCache&&(e=n),n=n.getParent();const i=this.getAbsoluteTransform(e).decompose();return{x:i.scaleX,y:i.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(Us,this._getTransform)}_getTransform(){var e,n;const r=this._cache.get(Us)||new De.Transform;r.reset();const i=this.x(),s=this.y(),o=js.Konva.getAngle(this.rotation()),a=(e=this.attrs.scaleX)!==null&&e!==void 0?e:1,l=(n=this.attrs.scaleY)!==null&&n!==void 0?n:1,d=this.attrs.skewX||0,h=this.attrs.skewY||0,f=this.attrs.offsetX||0,p=this.attrs.offsetY||0;return(i!==0||s!==0)&&r.translate(i,s),o!==0&&r.rotate(o),(d!==0||h!==0)&&r.skew(d,h),(a!==1||l!==1)&&r.scale(a,l),(f!==0||p!==0)&&r.translate(-1*f,-1*p),r.dirty=!1,r}clone(e){let n=De.Util.cloneObject(this.attrs),r,i,s,o,a;for(r in e)n[r]=e[r];const l=new this.constructor(n);for(r in this.eventListeners)for(i=this.eventListeners[r],s=i.length,o=0;o<s;o++)a=i[o],a.name.indexOf(FF)<0&&(l.eventListeners[r]||(l.eventListeners[r]=[]),l.eventListeners[r].push(a));return l}_toKonvaCanvas(e){e=e||{};const n=this.getClientRect(),r=this.getStage(),i=e.x!==void 0?e.x:Math.floor(n.x),s=e.y!==void 0?e.y:Math.floor(n.y),o=e.pixelRatio||1,a=new bl.SceneCanvas({width:e.width||Math.ceil(n.width)||(r?r.width():0),height:e.height||Math.ceil(n.height)||(r?r.height():0),pixelRatio:o}),l=a.getContext(),d=new bl.SceneCanvas({width:a.width/a.pixelRatio+Math.abs(i),height:a.height/a.pixelRatio+Math.abs(s),pixelRatio:a.pixelRatio});return e.imageSmoothingEnabled===!1&&(l._context.imageSmoothingEnabled=!1),l.save(),(i||s)&&l.translate(-1*i,-1*s),this.drawScene(a,void 0,d),l.restore(),a}toCanvas(e){return this._toKonvaCanvas(e)._canvas}toDataURL(e){e=e||{};const n=e.mimeType||null,r=e.quality||null,i=this._toKonvaCanvas(e).toDataURL(n,r);return e.callback&&e.callback(i),i}toImage(e){return new Promise((n,r)=>{try{const i=e==null?void 0:e.callback;i&&delete e.callback,De.Util._urlToImage(this.toDataURL(e),function(s){n(s),i==null||i(s)})}catch(i){r(i)}})}toBlob(e){return new Promise((n,r)=>{try{const i=e==null?void 0:e.callback;i&&delete e.callback,this.toCanvas(e).toBlob(s=>{n(s),i==null||i(s)},e==null?void 0:e.mimeType,e==null?void 0:e.quality)}catch(i){r(i)}})}setSize(e){return this.width(e.width),this.height(e.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():js.Konva.dragDistance}_off(e,n,r){let i=this.eventListeners[e],s,o,a;for(s=0;s<i.length;s++)if(o=i[s].name,a=i[s].handler,(o!=="konva"||n==="konva")&&(!n||o===n)&&(!r||r===a)){if(i.splice(s,1),i.length===0){delete this.eventListeners[e];break}s--}}_fireChangeEvent(e,n,r){this._fire(e+IF,{oldVal:n,newVal:r})}addName(e){if(!this.hasName(e)){const n=this.name(),r=n?n+" "+e:e;this.name(r)}return this}hasName(e){if(!e)return!1;const n=this.name();return n?(n||"").split(/\s/g).indexOf(e)!==-1:!1}removeName(e){const n=(this.name()||"").split(/\s/g),r=n.indexOf(e);return r!==-1&&(n.splice(r,1),this.name(n.join(" "))),this}setAttr(e,n){const r=this[R5+De.Util._capitalize(e)];return De.Util._isFunction(r)?r.call(this,n):this._setAttr(e,n),this}_requestDraw(){if(js.Konva.autoDrawEnabled){const e=this.getLayer()||this.getStage();e==null||e.batchDraw()}}_setAttr(e,n){const r=this.attrs[e];r===n&&!De.Util.isObject(n)||(n==null?delete this.attrs[e]:this.attrs[e]=n,this._shouldFireChangeEvents&&this._fireChangeEvent(e,r,n),this._requestDraw())}_setComponentAttr(e,n,r){let i;r!==void 0&&(i=this.attrs[e],i||(this.attrs[e]=this.getAttr(e)),this.attrs[e][n]=r,this._fireChangeEvent(e,i,r))}_fireAndBubble(e,n,r){n&&this.nodeType===L5&&(n.target=this);const i=[jF,zF,BF,UF,HF,VF];if(!(i.indexOf(e)!==-1&&(r&&(this===r||this.isAncestorOf&&this.isAncestorOf(r))||this.nodeType==="Stage"&&!r))){this._fire(e,n);const o=i.indexOf(e)!==-1&&r&&r.isAncestorOf&&r.isAncestorOf(this)&&!r.isAncestorOf(this.parent);(n&&!n.cancelBubble||!n)&&this.parent&&this.parent.isListening()&&!o&&(r&&r.parent?this._fireAndBubble.call(this.parent,e,n,r):this._fireAndBubble.call(this.parent,e,n))}}_getProtoListeners(e){var n,r,i;const s=(n=this._cache.get(jf))!==null&&n!==void 0?n:{};let o=s==null?void 0:s[e];if(o===void 0){o=[];let a=Object.getPrototypeOf(this);for(;a;){const l=(i=(r=a.eventListeners)===null||r===void 0?void 0:r[e])!==null&&i!==void 0?i:[];o.push(...l),a=Object.getPrototypeOf(a)}s[e]=o,this._cache.set(jf,s)}return o}_fire(e,n){n=n||{},n.currentTarget=this,n.type=e;const r=this._getProtoListeners(e);if(r)for(let s=0;s<r.length;s++)r[s].handler.call(this,n);const i=this.eventListeners[e];if(i)for(let s=0;s<i.length;s++)i[s].handler.call(this,n)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(e){const n=e?e.pointerId:void 0,r=this.getStage(),i=this.getAbsolutePosition();if(!r)return;const s=r._getPointerById(n)||r._changedPointerPositions[0]||i;Mr.DD._dragElements.set(this._id,{node:this,startPointerPos:s,offset:{x:s.x-i.x,y:s.y-i.y},dragStatus:"ready",pointerId:n})}startDrag(e,n=!0){Mr.DD._dragElements.has(this._id)||this._createDragElement(e);const r=Mr.DD._dragElements.get(this._id);r.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:e&&e.evt},n)}_setDragPosition(e,n){const r=this.getStage()._getPointerById(n.pointerId);if(!r)return;let i={x:r.x-n.offset.x,y:r.y-n.offset.y};const s=this.dragBoundFunc();if(s!==void 0){const o=s.call(this,i,e);o?i=o:De.Util.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}(!this._lastPos||this._lastPos.x!==i.x||this._lastPos.y!==i.y)&&(this.setAbsolutePosition(i),this._requestDraw()),this._lastPos=i}stopDrag(e){const n=Mr.DD._dragElements.get(this._id);n&&(n.dragStatus="stopped"),Mr.DD._endDragBefore(e),Mr.DD._endDragAfter(e)}setDraggable(e){this._setAttr("draggable",e),this._dragChange()}isDragging(){const e=Mr.DD._dragElements.get(this._id);return e?e.dragStatus==="dragging":!1}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(e){if(!(!(e.evt.button!==void 0)||js.Konva.dragButtons.indexOf(e.evt.button)>=0)||this.isDragging())return;let i=!1;Mr.DD._dragElements.forEach(s=>{this.isAncestorOf(s.node)&&(i=!0)}),i||this._createDragElement(e)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const n=Mr.DD._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";r?this.stopDrag():i&&Mr.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const n=this.getStage();if(!n)return!1;const r={x:-e.x,y:-e.y,width:n.width()+2*e.x,height:n.height()+2*e.y};return De.Util.haveIntersection(r,this.getClientRect())}static create(e,n){return De.Util._isString(e)&&(e=JSON.parse(e)),this._createNode(e,n)}static _createNode(e,n){let r=Av.prototype.getClassName.call(e),i=e.children,s,o,a;n&&(e.attrs.container=n),js.Konva[r]||(De.Util.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=js.Konva[r];if(s=new l(e.attrs),i)for(o=i.length,a=0;a<o;a++)s.add(Av._createNode(i[a]));return s}};gt.Node=Ee;Ee.prototype.nodeType="Node";Ee.prototype._attrsAffectingSize=[];Ee.prototype.eventListeners={};Ee.prototype.on.call(Ee.prototype,$F,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(Us),this._clearSelfAndDescendantCache(Yi)});Ee.prototype.on.call(Ee.prototype,"visibleChange.konva",function(){this._clearSelfAndDescendantCache(Ov)});Ee.prototype.on.call(Ee.prototype,"listeningChange.konva",function(){this._clearSelfAndDescendantCache(Pv)});Ee.prototype.on.call(Ee.prototype,"opacityChange.konva",function(){this._clearSelfAndDescendantCache(vp)});const Ze=fh.Factory.addGetterSetter;Ze(Ee,"zIndex");Ze(Ee,"absolutePosition");Ze(Ee,"position");Ze(Ee,"x",0,(0,It.getNumberValidator)());Ze(Ee,"y",0,(0,It.getNumberValidator)());Ze(Ee,"globalCompositeOperation","source-over",(0,It.getStringValidator)());Ze(Ee,"opacity",1,(0,It.getNumberValidator)());Ze(Ee,"name","",(0,It.getStringValidator)());Ze(Ee,"id","",(0,It.getStringValidator)());Ze(Ee,"rotation",0,(0,It.getNumberValidator)());fh.Factory.addComponentsGetterSetter(Ee,"scale",["x","y"]);Ze(Ee,"scaleX",1,(0,It.getNumberValidator)());Ze(Ee,"scaleY",1,(0,It.getNumberValidator)());fh.Factory.addComponentsGetterSetter(Ee,"skew",["x","y"]);Ze(Ee,"skewX",0,(0,It.getNumberValidator)());Ze(Ee,"skewY",0,(0,It.getNumberValidator)());fh.Factory.addComponentsGetterSetter(Ee,"offset",["x","y"]);Ze(Ee,"offsetX",0,(0,It.getNumberValidator)());Ze(Ee,"offsetY",0,(0,It.getNumberValidator)());Ze(Ee,"dragDistance",void 0,(0,It.getNumberValidator)());Ze(Ee,"width",0,(0,It.getNumberValidator)());Ze(Ee,"height",0,(0,It.getNumberValidator)());Ze(Ee,"listening",!0,(0,It.getBooleanValidator)());Ze(Ee,"preventDefault",!0,(0,It.getBooleanValidator)());Ze(Ee,"filters",void 0,function(t){return this._filterUpToDate=!1,t});Ze(Ee,"visible",!0,(0,It.getBooleanValidator)());Ze(Ee,"transformsEnabled","all",(0,It.getStringValidator)());Ze(Ee,"size");Ze(Ee,"dragBoundFunc");Ze(Ee,"draggable",!1,(0,It.getBooleanValidator)());fh.Factory.backCompat(Ee,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});var Ja={};Object.defineProperty(Ja,"__esModule",{value:!0});Ja.Container=void 0;const Uu=Le,_y=gt,Eg=Se;class Xa extends _y.Node{constructor(){super(...arguments),this.children=[]}getChildren(e){const n=this.children||[];return e?n.filter(e):n}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(e.length===0)return this;if(e.length>1){for(let r=0;r<e.length;r++)this.add(e[r]);return this}const n=e[0];return n.getParent()?(n.moveTo(this),this):(this._validateAdd(n),n.index=this.getChildren().length,n.parent=this,n._clearCaches(),this.getChildren().push(n),this._fire("add",{child:n}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(e){return this._generalFind(e,!1)}findOne(e){const n=this._generalFind(e,!0);return n.length>0?n[0]:void 0}_generalFind(e,n){const r=[];return this._descendants(i=>{const s=i._isMatch(e);return s&&r.push(i),!!(s&&n)}),r}_descendants(e){let n=!1;const r=this.getChildren();for(const i of r){if(n=e(i),n)return!0;if(i.hasChildren()&&(n=i._descendants(e),n))return!0}return!1}toObject(){const e=_y.Node.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(n=>{e.children.push(n.toObject())}),e}isAncestorOf(e){let n=e.getParent();for(;n;){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(e){const n=_y.Node.prototype.clone.call(this,e);return this.getChildren().forEach(function(r){n.add(r.clone())}),n}getAllIntersections(e){const n=[];return this.find("Shape").forEach(r=>{r.isVisible()&&r.intersects(e)&&n.push(r)}),n}_clearSelfAndDescendantCache(e){var n;super._clearSelfAndDescendantCache(e),!this.isCached()&&((n=this.children)===null||n===void 0||n.forEach(function(r){r._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(n,r){n.index=r}),this._requestDraw()}drawScene(e,n,r){const i=this.getLayer(),s=e||i&&i.getCanvas(),o=s&&s.getContext(),a=this._getCanvasCache(),l=a&&a.scene,d=s&&s.isCache;if(!this.isVisible()&&!d)return this;if(l){o.save();const h=this.getAbsoluteTransform(n).getMatrix();o.transform(h[0],h[1],h[2],h[3],h[4],h[5]),this._drawCachedSceneCanvas(o),o.restore()}else this._drawChildren("drawScene",s,n,r);return this}drawHit(e,n){if(!this.shouldDrawHit(n))return this;const r=this.getLayer(),i=e||r&&r.hitCanvas,s=i&&i.getContext(),o=this._getCanvasCache();if(o&&o.hit){s.save();const l=this.getAbsoluteTransform(n).getMatrix();s.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedHitCanvas(s),s.restore()}else this._drawChildren("drawHit",i,n);return this}_drawChildren(e,n,r,i){var s;const o=n&&n.getContext(),a=this.clipWidth(),l=this.clipHeight(),d=this.clipFunc(),h=typeof a=="number"&&typeof l=="number"||d,f=r===this;if(h){o.save();const y=this.getAbsoluteTransform(r);let g=y.getMatrix();o.transform(g[0],g[1],g[2],g[3],g[4],g[5]),o.beginPath();let x;if(d)x=d.call(this,o,this);else{const S=this.clipX(),C=this.clipY();o.rect(S||0,C||0,a,l)}o.clip.apply(o,x),g=y.copy().invert().getMatrix(),o.transform(g[0],g[1],g[2],g[3],g[4],g[5])}const p=!f&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";p&&(o.save(),o._applyGlobalCompositeOperation(this)),(s=this.children)===null||s===void 0||s.forEach(function(y){y[e](n,r,i)}),p&&o.restore(),h&&o.restore()}getClientRect(e={}){var n;const r=e.skipTransform,i=e.relativeTo;let s,o,a,l,d={x:1/0,y:1/0,width:0,height:0};const h=this;(n=this.children)===null||n===void 0||n.forEach(function(y){if(!y.visible())return;const g=y.getClientRect({relativeTo:h,skipShadow:e.skipShadow,skipStroke:e.skipStroke});g.width===0&&g.height===0||(s===void 0?(s=g.x,o=g.y,a=g.x+g.width,l=g.y+g.height):(s=Math.min(s,g.x),o=Math.min(o,g.y),a=Math.max(a,g.x+g.width),l=Math.max(l,g.y+g.height)))});const f=this.find("Shape");let p=!1;for(let y=0;y<f.length;y++)if(f[y]._isVisible(this)){p=!0;break}return p&&s!==void 0?d={x:s,y:o,width:a-s,height:l-o}:d={x:0,y:0,width:0,height:0},r?d:this._transformedRect(d,i)}}Ja.Container=Xa;Uu.Factory.addComponentsGetterSetter(Xa,"clip",["x","y","width","height"]);Uu.Factory.addGetterSetter(Xa,"clipX",void 0,(0,Eg.getNumberValidator)());Uu.Factory.addGetterSetter(Xa,"clipY",void 0,(0,Eg.getNumberValidator)());Uu.Factory.addGetterSetter(Xa,"clipWidth",void 0,(0,Eg.getNumberValidator)());Uu.Factory.addGetterSetter(Xa,"clipHeight",void 0,(0,Eg.getNumberValidator)());Uu.Factory.addGetterSetter(Xa,"clipFunc");var A_={},Io={};Object.defineProperty(Io,"__esModule",{value:!0});Io.getCapturedShape=qF;Io.createEvent=PS;Io.hasPointerCapture=QF;Io.setPointerCapture=YF;Io.releaseCapture=L_;const KF=Ae,Fd=new Map,R_=KF.Konva._global.PointerEvent!==void 0;function qF(t){return Fd.get(t)}function PS(t){return{evt:t,pointerId:t.pointerId}}function QF(t,e){return Fd.get(t)===e}function YF(t,e){L_(t),e.getStage()&&(Fd.set(t,e),R_&&e._fire("gotpointercapture",PS(new PointerEvent("gotpointercapture"))))}function L_(t,e){const n=Fd.get(t);if(!n)return;const r=n.getStage();r&&r.content,Fd.delete(t),R_&&n._fire("lostpointercapture",PS(new PointerEvent("lostpointercapture")))}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Stage=t.stages=void 0;const e=bt,n=Le,r=Ja,i=Ae,s=ai,o=bg,a=Ae,l=Io,d="Stage",h="string",f="px",p="mouseout",y="mouseleave",g="mouseover",x="mouseenter",S="mousemove",C="mousedown",E="mouseup",w="pointermove",b="pointerdown",T="pointerup",P="pointercancel",A="lostpointercapture",M="pointerout",I="pointerleave",R="pointerover",U="pointerenter",B="contextmenu",$="touchstart",Q="touchend",q="touchmove",ie="touchcancel",fe="wheel",W=5,re=[[x,"_pointerenter"],[C,"_pointerdown"],[S,"_pointermove"],[E,"_pointerup"],[y,"_pointerleave"],[$,"_pointerdown"],[q,"_pointermove"],[Q,"_pointerup"],[ie,"_pointercancel"],[g,"_pointerover"],[fe,"_wheel"],[B,"_contextmenu"],[b,"_pointerdown"],[w,"_pointermove"],[T,"_pointerup"],[P,"_pointercancel"],[I,"_pointerleave"],[A,"_lostpointercapture"]],te={mouse:{[M]:p,[I]:y,[R]:g,[U]:x,[w]:S,[b]:C,[T]:E,[P]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[M]:"touchout",[I]:"touchleave",[R]:"touchover",[U]:"touchenter",[w]:q,[b]:$,[T]:Q,[P]:ie,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[M]:M,[I]:I,[R]:R,[U]:U,[w]:w,[b]:b,[T]:T,[P]:P,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},Y=it=>it.indexOf("pointer")>=0?"pointer":it.indexOf("touch")>=0?"touch":"mouse",oe=it=>{const F=Y(it);if(F==="pointer")return i.Konva.pointerEventsEnabled&&te.pointer;if(F==="touch")return te.touch;if(F==="mouse")return te.mouse};function _e(it={}){return(it.clipFunc||it.clipWidth||it.clipHeight)&&e.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),it}const rt="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);";t.stages=[];class yt extends r.Container{constructor(F){super(_e(F)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),t.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{_e(this.attrs)}),this._checkVisibility()}_validateAdd(F){const X=F.getType()==="Layer",me=F.getType()==="FastLayer";X||me||e.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const F=this.visible()?"":"none";this.content.style.display=F}setContainer(F){if(typeof F===h){let X;if(F.charAt(0)==="."){const me=F.slice(1);F=document.getElementsByClassName(me)[0]}else F.charAt(0)!=="#"?X=F:X=F.slice(1),F=document.getElementById(X);if(!F)throw"Can not find container in document with id "+X}return this._setAttr("container",F),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),F.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){const F=this.children,X=F.length;for(let me=0;me<X;me++)F[me].clear();return this}clone(F){return F||(F={}),F.container=typeof document<"u"&&document.createElement("div"),r.Container.prototype.clone.call(this,F)}destroy(){super.destroy();const F=this.content;F&&e.Util._isInDocument(F)&&this.container().removeChild(F);const X=t.stages.indexOf(this);return X>-1&&t.stages.splice(X,1),e.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const F=this._pointerPositions[0]||this._changedPointerPositions[0];return F?{x:F.x,y:F.y}:(e.Util.warn(rt),null)}_getPointerById(F){return this._pointerPositions.find(X=>X.id===F)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(F){F=F||{},F.x=F.x||0,F.y=F.y||0,F.width=F.width||this.width(),F.height=F.height||this.height();const X=new s.SceneCanvas({width:F.width,height:F.height,pixelRatio:F.pixelRatio||1}),me=X.getContext()._context,We=this.children;return(F.x||F.y)&&me.translate(-1*F.x,-1*F.y),We.forEach(function(Ne){if(!Ne.isVisible())return;const et=Ne._toKonvaCanvas(F);me.drawImage(et._canvas,F.x,F.y,et.getWidth()/et.getPixelRatio(),et.getHeight()/et.getPixelRatio())}),X}getIntersection(F){if(!F)return null;const X=this.children,me=X.length,We=me-1;for(let Ne=We;Ne>=0;Ne--){const et=X[Ne].getIntersection(F);if(et)return et}return null}_resizeDOM(){const F=this.width(),X=this.height();this.content&&(this.content.style.width=F+f,this.content.style.height=X+f),this.bufferCanvas.setSize(F,X),this.bufferHitCanvas.setSize(F,X),this.children.forEach(me=>{me.setSize({width:F,height:X}),me.draw()})}add(F,...X){if(arguments.length>1){for(let We=0;We<arguments.length;We++)this.add(arguments[We]);return this}super.add(F);const me=this.children.length;return me>W&&e.Util.warn("The stage has "+me+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),F.setSize({width:this.width(),height:this.height()}),F.draw(),i.Konva.isBrowser&&this.content.appendChild(F.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(F){return l.hasPointerCapture(F,this)}setPointerCapture(F){l.setPointerCapture(F,this)}releaseCapture(F){l.releaseCapture(F,this)}getLayers(){return this.children}_bindContentEvents(){i.Konva.isBrowser&&re.forEach(([F,X])=>{this.content.addEventListener(F,me=>{this[X](me)},{passive:!1})})}_pointerenter(F){this.setPointersPositions(F);const X=oe(F.type);X&&this._fire(X.pointerenter,{evt:F,target:this,currentTarget:this})}_pointerover(F){this.setPointersPositions(F);const X=oe(F.type);X&&this._fire(X.pointerover,{evt:F,target:this,currentTarget:this})}_getTargetShape(F){let X=this[F+"targetShape"];return X&&!X.getStage()&&(X=null),X}_pointerleave(F){const X=oe(F.type),me=Y(F.type);if(!X)return;this.setPointersPositions(F);const We=this._getTargetShape(me),Ne=!(i.Konva.isDragging()||i.Konva.isTransforming())||i.Konva.hitOnDragEnabled;We&&Ne?(We._fireAndBubble(X.pointerout,{evt:F}),We._fireAndBubble(X.pointerleave,{evt:F}),this._fire(X.pointerleave,{evt:F,target:this,currentTarget:this}),this[me+"targetShape"]=null):Ne&&(this._fire(X.pointerleave,{evt:F,target:this,currentTarget:this}),this._fire(X.pointerout,{evt:F,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(F){const X=oe(F.type),me=Y(F.type);if(!X)return;this.setPointersPositions(F);let We=!1;this._changedPointerPositions.forEach(Ne=>{const et=this.getIntersection(Ne);if(o.DD.justDragged=!1,i.Konva["_"+me+"ListenClick"]=!0,!et||!et.isListening()){this[me+"ClickStartShape"]=void 0;return}i.Konva.capturePointerEventsEnabled&&et.setPointerCapture(Ne.id),this[me+"ClickStartShape"]=et,et._fireAndBubble(X.pointerdown,{evt:F,pointerId:Ne.id}),We=!0;const st=F.type.indexOf("touch")>=0;et.preventDefault()&&F.cancelable&&st&&F.preventDefault()}),We||this._fire(X.pointerdown,{evt:F,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(F){const X=oe(F.type),me=Y(F.type);if(!X||(i.Konva.isDragging()&&o.DD.node.preventDefault()&&F.cancelable&&F.preventDefault(),this.setPointersPositions(F),!(!(i.Konva.isDragging()||i.Konva.isTransforming())||i.Konva.hitOnDragEnabled)))return;const Ne={};let et=!1;const st=this._getTargetShape(me);this._changedPointerPositions.forEach(hi=>{const Ye=l.getCapturedShape(hi.id)||this.getIntersection(hi),Es=hi.id,Gr={evt:F,pointerId:Es},_s=st!==Ye;if(_s&&st&&(st._fireAndBubble(X.pointerout,{...Gr},Ye),st._fireAndBubble(X.pointerleave,{...Gr},Ye)),Ye){if(Ne[Ye._id])return;Ne[Ye._id]=!0}Ye&&Ye.isListening()?(et=!0,_s&&(Ye._fireAndBubble(X.pointerover,{...Gr},st),Ye._fireAndBubble(X.pointerenter,{...Gr},st),this[me+"targetShape"]=Ye),Ye._fireAndBubble(X.pointermove,{...Gr})):st&&(this._fire(X.pointerover,{evt:F,target:this,currentTarget:this,pointerId:Es}),this[me+"targetShape"]=null)}),et||this._fire(X.pointermove,{evt:F,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(F){const X=oe(F.type),me=Y(F.type);if(!X)return;this.setPointersPositions(F);const We=this[me+"ClickStartShape"],Ne=this[me+"ClickEndShape"],et={};let st=!1;this._changedPointerPositions.forEach(hi=>{const Ye=l.getCapturedShape(hi.id)||this.getIntersection(hi);if(Ye){if(Ye.releaseCapture(hi.id),et[Ye._id])return;et[Ye._id]=!0}const Es=hi.id,Gr={evt:F,pointerId:Es};let _s=!1;i.Konva["_"+me+"InDblClickWindow"]?(_s=!0,clearTimeout(this[me+"DblTimeout"])):o.DD.justDragged||(i.Konva["_"+me+"InDblClickWindow"]=!0,clearTimeout(this[me+"DblTimeout"])),this[me+"DblTimeout"]=setTimeout(function(){i.Konva["_"+me+"InDblClickWindow"]=!1},i.Konva.dblClickWindow),Ye&&Ye.isListening()?(st=!0,this[me+"ClickEndShape"]=Ye,Ye._fireAndBubble(X.pointerup,{...Gr}),i.Konva["_"+me+"ListenClick"]&&We&&We===Ye&&(Ye._fireAndBubble(X.pointerclick,{...Gr}),_s&&Ne&&Ne===Ye&&Ye._fireAndBubble(X.pointerdblclick,{...Gr}))):(this[me+"ClickEndShape"]=null,i.Konva["_"+me+"ListenClick"]&&this._fire(X.pointerclick,{evt:F,target:this,currentTarget:this,pointerId:Es}),_s&&this._fire(X.pointerdblclick,{evt:F,target:this,currentTarget:this,pointerId:Es}))}),st||this._fire(X.pointerup,{evt:F,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),i.Konva["_"+me+"ListenClick"]=!1,F.cancelable&&me!=="touch"&&me!=="pointer"&&F.preventDefault()}_contextmenu(F){this.setPointersPositions(F);const X=this.getIntersection(this.getPointerPosition());X&&X.isListening()?X._fireAndBubble(B,{evt:F}):this._fire(B,{evt:F,target:this,currentTarget:this})}_wheel(F){this.setPointersPositions(F);const X=this.getIntersection(this.getPointerPosition());X&&X.isListening()?X._fireAndBubble(fe,{evt:F}):this._fire(fe,{evt:F,target:this,currentTarget:this})}_pointercancel(F){this.setPointersPositions(F);const X=l.getCapturedShape(F.pointerId)||this.getIntersection(this.getPointerPosition());X&&X._fireAndBubble(T,l.createEvent(F)),l.releaseCapture(F.pointerId)}_lostpointercapture(F){l.releaseCapture(F.pointerId)}setPointersPositions(F){const X=this._getContentPosition();let me=null,We=null;F=F||window.event,F.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(F.touches,Ne=>{this._pointerPositions.push({id:Ne.identifier,x:(Ne.clientX-X.left)/X.scaleX,y:(Ne.clientY-X.top)/X.scaleY})}),Array.prototype.forEach.call(F.changedTouches||F.touches,Ne=>{this._changedPointerPositions.push({id:Ne.identifier,x:(Ne.clientX-X.left)/X.scaleX,y:(Ne.clientY-X.top)/X.scaleY})})):(me=(F.clientX-X.left)/X.scaleX,We=(F.clientY-X.top)/X.scaleY,this.pointerPos={x:me,y:We},this._pointerPositions=[{x:me,y:We,id:e.Util._getFirstPointerId(F)}],this._changedPointerPositions=[{x:me,y:We,id:e.Util._getFirstPointerId(F)}])}_setPointerPosition(F){e.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(F)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};const F=this.content.getBoundingClientRect();return{top:F.top,left:F.left,scaleX:F.width/this.content.clientWidth||1,scaleY:F.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new s.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new s.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!i.Konva.isBrowser)return;const F=this.container();if(!F)throw"Stage has no container. A container is required.";F.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),F.appendChild(this.content),this._resizeDOM()}cache(){return e.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(F){F.batchDraw()}),this}}t.Stage=yt,yt.prototype.nodeType=d,(0,a._registerNode)(yt),n.Factory.addGetterSetter(yt,"container"),i.Konva.isBrowser&&document.addEventListener("visibilitychange",()=>{t.stages.forEach(it=>{it.batchDraw()})})})(A_);var ph={},Qt={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Shape=t.shapes=void 0;const e=Ae,n=bt,r=Le,i=gt,s=Se,o=Ae,a=Io,l="hasShadow",d="shadowRGBA",h="patternImage",f="linearGradient",p="radialGradient";let y;function g(){return y||(y=n.Util.createCanvasElement().getContext("2d"),y)}t.shapes={};function x(I){const R=this.attrs.fillRule;R?I.fill(R):I.fill()}function S(I){I.stroke()}function C(I){const R=this.attrs.fillRule;R?I.fill(R):I.fill()}function E(I){I.stroke()}function w(){this._clearCache(l)}function b(){this._clearCache(d)}function T(){this._clearCache(h)}function P(){this._clearCache(f)}function A(){this._clearCache(p)}class M extends i.Node{constructor(R){super(R);let U;for(;U=n.Util.getRandomColor(),!(U&&!(U in t.shapes)););this.colorKey=U,t.shapes[U]=this}getContext(){return n.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return n.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(l,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(h,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const U=g().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(U&&U.setTransform){const B=new n.Transform;B.translate(this.fillPatternX(),this.fillPatternY()),B.rotate(e.Konva.getAngle(this.fillPatternRotation())),B.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),B.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const $=B.getMatrix(),Q=typeof DOMMatrix>"u"?{a:$[0],b:$[1],c:$[2],d:$[3],e:$[4],f:$[5]}:new DOMMatrix($);U.setTransform(Q)}return U}}_getLinearGradient(){return this._getCache(f,this.__getLinearGradient)}__getLinearGradient(){const R=this.fillLinearGradientColorStops();if(R){const U=g(),B=this.fillLinearGradientStartPoint(),$=this.fillLinearGradientEndPoint(),Q=U.createLinearGradient(B.x,B.y,$.x,$.y);for(let q=0;q<R.length;q+=2)Q.addColorStop(R[q],R[q+1]);return Q}}_getRadialGradient(){return this._getCache(p,this.__getRadialGradient)}__getRadialGradient(){const R=this.fillRadialGradientColorStops();if(R){const U=g(),B=this.fillRadialGradientStartPoint(),$=this.fillRadialGradientEndPoint(),Q=U.createRadialGradient(B.x,B.y,this.fillRadialGradientStartRadius(),$.x,$.y,this.fillRadialGradientEndRadius());for(let q=0;q<R.length;q+=2)Q.addColorStop(R[q],R[q+1]);return Q}}getShadowRGBA(){return this._getCache(d,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;const R=n.Util.colorToRGBA(this.shadowColor());if(R)return"rgba("+R.r+","+R.g+","+R.b+","+R.a*(this.shadowOpacity()||1)+")"}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const R=this.hitStrokeWidth();return R==="auto"?this.hasStroke():this.strokeEnabled()&&!!R}intersects(R){const U=this.getStage();if(!U)return!1;const B=U.bufferHitCanvas;return B.getContext().clear(),this.drawHit(B,void 0,!0),B.context.getImageData(Math.round(R.x),Math.round(R.y),1,1).data[3]>0}destroy(){return i.Node.prototype.destroy.call(this),delete t.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(R){var U;if(!((U=this.attrs.perfectDrawEnabled)!==null&&U!==void 0?U:!0))return!1;const $=R||this.hasFill(),Q=this.hasStroke(),q=this.getAbsoluteOpacity()!==1;if($&&Q&&q)return!0;const ie=this.hasShadow(),fe=this.shadowForStrokeEnabled();return!!($&&Q&&ie&&fe)}setStrokeHitEnabled(R){n.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),R?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){const R=this.size();return{x:this._centroid?-R.width/2:0,y:this._centroid?-R.height/2:0,width:R.width,height:R.height}}getClientRect(R={}){let U=!1,B=this.getParent();for(;B;){if(B.isCached()){U=!0;break}B=B.getParent()}const $=R.skipTransform,Q=R.relativeTo||U&&this.getStage()||void 0,q=this.getSelfRect(),fe=!R.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,W=q.width+fe,re=q.height+fe,te=!R.skipShadow&&this.hasShadow(),Y=te?this.shadowOffsetX():0,oe=te?this.shadowOffsetY():0,_e=W+Math.abs(Y),rt=re+Math.abs(oe),yt=te&&this.shadowBlur()||0,it=_e+yt*2,F=rt+yt*2,X={width:it,height:F,x:-(fe/2+yt)+Math.min(Y,0)+q.x,y:-(fe/2+yt)+Math.min(oe,0)+q.y};return $?X:this._transformedRect(X,Q)}drawScene(R,U,B){const $=this.getLayer(),Q=R||$.getCanvas(),q=Q.getContext(),ie=this._getCanvasCache(),fe=this.getSceneFunc(),W=this.hasShadow();let re;const te=U===this;if(!this.isVisible()&&!te)return this;if(ie){q.save();const Y=this.getAbsoluteTransform(U).getMatrix();return q.transform(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5]),this._drawCachedSceneCanvas(q),q.restore(),this}if(!fe)return this;if(q.save(),this._useBufferCanvas()){re=this.getStage();const Y=B||re.bufferCanvas,oe=Y.getContext();oe.clear(),oe.save(),oe._applyLineJoin(this);const _e=this.getAbsoluteTransform(U).getMatrix();oe.transform(_e[0],_e[1],_e[2],_e[3],_e[4],_e[5]),fe.call(this,oe,this),oe.restore();const rt=Y.pixelRatio;W&&q._applyShadow(this),q._applyOpacity(this),q._applyGlobalCompositeOperation(this),q.drawImage(Y._canvas,Y.x||0,Y.y||0,Y.width/rt,Y.height/rt)}else{if(q._applyLineJoin(this),!te){const Y=this.getAbsoluteTransform(U).getMatrix();q.transform(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5]),q._applyOpacity(this),q._applyGlobalCompositeOperation(this)}W&&q._applyShadow(this),fe.call(this,q,this)}return q.restore(),this}drawHit(R,U,B=!1){if(!this.shouldDrawHit(U,B))return this;const $=this.getLayer(),Q=R||$.hitCanvas,q=Q&&Q.getContext(),ie=this.hitFunc()||this.sceneFunc(),fe=this._getCanvasCache(),W=fe&&fe.hit;if(this.colorKey||n.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),W){q.save();const te=this.getAbsoluteTransform(U).getMatrix();return q.transform(te[0],te[1],te[2],te[3],te[4],te[5]),this._drawCachedHitCanvas(q),q.restore(),this}if(!ie)return this;if(q.save(),q._applyLineJoin(this),!(this===U)){const te=this.getAbsoluteTransform(U).getMatrix();q.transform(te[0],te[1],te[2],te[3],te[4],te[5])}return ie.call(this,q,this),q.restore(),this}drawHitFromCache(R=0){const U=this._getCanvasCache(),B=this._getCachedSceneCanvas(),$=U.hit,Q=$.getContext(),q=$.getWidth(),ie=$.getHeight();Q.clear(),Q.drawImage(B._canvas,0,0,q,ie);try{const fe=Q.getImageData(0,0,q,ie),W=fe.data,re=W.length,te=n.Util._hexToRgb(this.colorKey);for(let Y=0;Y<re;Y+=4)W[Y+3]>R?(W[Y]=te.r,W[Y+1]=te.g,W[Y+2]=te.b,W[Y+3]=255):W[Y+3]=0;Q.putImageData(fe,0,0)}catch(fe){n.Util.error("Unable to draw hit graph from cached scene canvas. "+fe.message)}return this}hasPointerCapture(R){return a.hasPointerCapture(R,this)}setPointerCapture(R){a.setPointerCapture(R,this)}releaseCapture(R){a.releaseCapture(R,this)}}t.Shape=M,M.prototype._fillFunc=x,M.prototype._strokeFunc=S,M.prototype._fillFuncHit=C,M.prototype._strokeFuncHit=E,M.prototype._centroid=!1,M.prototype.nodeType="Shape",(0,o._registerNode)(M),M.prototype.eventListeners={},M.prototype.on.call(M.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",w),M.prototype.on.call(M.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",b),M.prototype.on.call(M.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",T),M.prototype.on.call(M.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",P),M.prototype.on.call(M.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",A),r.Factory.addGetterSetter(M,"stroke",void 0,(0,s.getStringOrGradientValidator)()),r.Factory.addGetterSetter(M,"strokeWidth",2,(0,s.getNumberValidator)()),r.Factory.addGetterSetter(M,"fillAfterStrokeEnabled",!1),r.Factory.addGetterSetter(M,"hitStrokeWidth","auto",(0,s.getNumberOrAutoValidator)()),r.Factory.addGetterSetter(M,"strokeHitEnabled",!0,(0,s.getBooleanValidator)()),r.Factory.addGetterSetter(M,"perfectDrawEnabled",!0,(0,s.getBooleanValidator)()),r.Factory.addGetterSetter(M,"shadowForStrokeEnabled",!0,(0,s.getBooleanValidator)()),r.Factory.addGetterSetter(M,"lineJoin"),r.Factory.addGetterSetter(M,"lineCap"),r.Factory.addGetterSetter(M,"sceneFunc"),r.Factory.addGetterSetter(M,"hitFunc"),r.Factory.addGetterSetter(M,"dash"),r.Factory.addGetterSetter(M,"dashOffset",0,(0,s.getNumberValidator)()),r.Factory.addGetterSetter(M,"shadowColor",void 0,(0,s.getStringValidator)()),r.Factory.addGetterSetter(M,"shadowBlur",0,(0,s.getNumberValidator)()),r.Factory.addGetterSetter(M,"shadowOpacity",1,(0,s.getNumberValidator)()),r.Factory.addComponentsGetterSetter(M,"shadowOffset",["x","y"]),r.Factory.addGetterSetter(M,"shadowOffsetX",0,(0,s.getNumberValidator)()),r.Factory.addGetterSetter(M,"shadowOffsetY",0,(0,s.getNumberValidator)()),r.Factory.addGetterSetter(M,"fillPatternImage"),r.Factory.addGetterSetter(M,"fill",void 0,(0,s.getStringOrGradientValidator)()),r.Factory.addGetterSetter(M,"fillPatternX",0,(0,s.getNumberValidator)()),r.Factory.addGetterSetter(M,"fillPatternY",0,(0,s.getNumberValidator)()),r.Factory.addGetterSetter(M,"fillLinearGradientColorStops"),r.Factory.addGetterSetter(M,"strokeLinearGradientColorStops"),r.Factory.addGetterSetter(M,"fillRadialGradientStartRadius",0),r.Factory.addGetterSetter(M,"fillRadialGradientEndRadius",0),r.Factory.addGetterSetter(M,"fillRadialGradientColorStops"),r.Factory.addGetterSetter(M,"fillPatternRepeat","repeat"),r.Factory.addGetterSetter(M,"fillEnabled",!0),r.Factory.addGetterSetter(M,"strokeEnabled",!0),r.Factory.addGetterSetter(M,"shadowEnabled",!0),r.Factory.addGetterSetter(M,"dashEnabled",!0),r.Factory.addGetterSetter(M,"strokeScaleEnabled",!0),r.Factory.addGetterSetter(M,"fillPriority","color"),r.Factory.addComponentsGetterSetter(M,"fillPatternOffset",["x","y"]),r.Factory.addGetterSetter(M,"fillPatternOffsetX",0,(0,s.getNumberValidator)()),r.Factory.addGetterSetter(M,"fillPatternOffsetY",0,(0,s.getNumberValidator)()),r.Factory.addComponentsGetterSetter(M,"fillPatternScale",["x","y"]),r.Factory.addGetterSetter(M,"fillPatternScaleX",1,(0,s.getNumberValidator)()),r.Factory.addGetterSetter(M,"fillPatternScaleY",1,(0,s.getNumberValidator)()),r.Factory.addComponentsGetterSetter(M,"fillLinearGradientStartPoint",["x","y"]),r.Factory.addComponentsGetterSetter(M,"strokeLinearGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(M,"fillLinearGradientStartPointX",0),r.Factory.addGetterSetter(M,"strokeLinearGradientStartPointX",0),r.Factory.addGetterSetter(M,"fillLinearGradientStartPointY",0),r.Factory.addGetterSetter(M,"strokeLinearGradientStartPointY",0),r.Factory.addComponentsGetterSetter(M,"fillLinearGradientEndPoint",["x","y"]),r.Factory.addComponentsGetterSetter(M,"strokeLinearGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(M,"fillLinearGradientEndPointX",0),r.Factory.addGetterSetter(M,"strokeLinearGradientEndPointX",0),r.Factory.addGetterSetter(M,"fillLinearGradientEndPointY",0),r.Factory.addGetterSetter(M,"strokeLinearGradientEndPointY",0),r.Factory.addComponentsGetterSetter(M,"fillRadialGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(M,"fillRadialGradientStartPointX",0),r.Factory.addGetterSetter(M,"fillRadialGradientStartPointY",0),r.Factory.addComponentsGetterSetter(M,"fillRadialGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(M,"fillRadialGradientEndPointX",0),r.Factory.addGetterSetter(M,"fillRadialGradientEndPointY",0),r.Factory.addGetterSetter(M,"fillPatternRotation",0),r.Factory.addGetterSetter(M,"fillRule",void 0,(0,s.getStringValidator)()),r.Factory.backCompat(M,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(Qt);Object.defineProperty(ph,"__esModule",{value:!0});ph.Layer=void 0;const $i=bt,Ny=Ja,El=gt,OS=Le,D5=ai,JF=Se,XF=Qt,ZF=Ae,ej="#",tj="beforeDraw",nj="draw",I_=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],rj=I_.length;let Hu=class extends Ny.Container{constructor(e){super(e),this.canvas=new D5.SceneCanvas,this.hitCanvas=new D5.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);const n=this.getStage();return n&&n.content&&(n.content.removeChild(this.getNativeCanvasElement()),e<n.children.length-1?n.content.insertBefore(this.getNativeCanvasElement(),n.children[e+1].getCanvas()._canvas):n.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){El.Node.prototype.moveToTop.call(this);const e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!El.Node.prototype.moveUp.call(this))return!1;const n=this.getStage();return!n||!n.content?!1:(n.content.removeChild(this.getNativeCanvasElement()),this.index<n.children.length-1?n.content.insertBefore(this.getNativeCanvasElement(),n.children[this.index+1].getCanvas()._canvas):n.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(El.Node.prototype.moveDown.call(this)){const e=this.getStage();if(e){const n=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),n[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(El.Node.prototype.moveToBottom.call(this)){const e=this.getStage();if(e){const n=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),n[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){const e=this.getNativeCanvasElement();return El.Node.prototype.remove.call(this),e&&e.parentNode&&$i.Util._isInDocument(e)&&e.parentNode.removeChild(e),this}getStage(){return this.parent}setSize({width:e,height:n}){return this.canvas.setSize(e,n),this.hitCanvas.setSize(e,n),this._setSmoothEnabled(),this}_validateAdd(e){const n=e.getType();n!=="Group"&&n!=="Shape"&&$i.Util.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(e){return e=e||{},e.width=e.width||this.getWidth(),e.height=e.height||this.getHeight(),e.x=e.x!==void 0?e.x:this.x(),e.y=e.y!==void 0?e.y:this.y(),El.Node.prototype._toKonvaCanvas.call(this,e)}_checkVisibility(){this.visible()?this.canvas._canvas.style.display="block":this.canvas._canvas.style.display="none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){$i.Util.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){$i.Util.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,$i.Util.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;let n=1,r=!1;for(;;){for(let i=0;i<rj;i++){const s=I_[i],o=this._getIntersection({x:e.x+s.x*n,y:e.y+s.y*n}),a=o.shape;if(a)return a;if(r=!!o.antialiased,!o.antialiased)break}if(r)n+=1;else return null}}_getIntersection(e){const n=this.hitCanvas.pixelRatio,r=this.hitCanvas.context.getImageData(Math.round(e.x*n),Math.round(e.y*n),1,1).data,i=r[3];if(i===255){const s=$i.Util._rgbToHex(r[0],r[1],r[2]),o=XF.shapes[ej+s];return o?{shape:o}:{antialiased:!0}}else if(i>0)return{antialiased:!0};return{}}drawScene(e,n,r){const i=this.getLayer(),s=e||i&&i.getCanvas();return this._fire(tj,{node:this}),this.clearBeforeDraw()&&s.getContext().clear(),Ny.Container.prototype.drawScene.call(this,s,n,r),this._fire(nj,{node:this}),this}drawHit(e,n){const r=this.getLayer(),i=e||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),Ny.Container.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){$i.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return $i.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;const e=this.parent;!!this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}destroy(){return $i.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};ph.Layer=Hu;Hu.prototype.nodeType="Layer";(0,ZF._registerNode)(Hu);OS.Factory.addGetterSetter(Hu,"imageSmoothingEnabled",!0);OS.Factory.addGetterSetter(Hu,"clearBeforeDraw",!0);OS.Factory.addGetterSetter(Hu,"hitGraphEnabled",!0,(0,JF.getBooleanValidator)());var _g={};Object.defineProperty(_g,"__esModule",{value:!0});_g.FastLayer=void 0;const ij=bt,sj=ph,oj=Ae;class AS extends sj.Layer{constructor(e){super(e),this.listening(!1),ij.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}_g.FastLayer=AS;AS.prototype.nodeType="FastLayer";(0,oj._registerNode)(AS);var Vu={};Object.defineProperty(Vu,"__esModule",{value:!0});Vu.Group=void 0;const aj=bt,lj=Ja,uj=Ae;class RS extends lj.Container{_validateAdd(e){const n=e.getType();n!=="Group"&&n!=="Shape"&&aj.Util.throw("You may only add groups and shapes to groups.")}}Vu.Group=RS;RS.prototype.nodeType="Group";(0,uj._registerNode)(RS);var Gu={};Object.defineProperty(Gu,"__esModule",{value:!0});Gu.Animation=void 0;const Ty=Ae,F5=bt,My=function(){return Ty.glob.performance&&Ty.glob.performance.now?function(){return Ty.glob.performance.now()}:function(){return new Date().getTime()}}();class Pi{constructor(e,n){this.id=Pi.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:My(),frameRate:0},this.func=e,this.setLayers(n)}setLayers(e){let n=[];return e&&(n=Array.isArray(e)?e:[e]),this.layers=n,this}getLayers(){return this.layers}addLayer(e){const n=this.layers,r=n.length;for(let i=0;i<r;i++)if(n[i]._id===e._id)return!1;return this.layers.push(e),!0}isRunning(){const n=Pi.animations,r=n.length;for(let i=0;i<r;i++)if(n[i].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=My(),Pi._addAnimation(this),this}stop(){return Pi._removeAnimation(this),this}_updateFrameObject(e){this.frame.timeDiff=e-this.frame.lastTime,this.frame.lastTime=e,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(e){this.animations.push(e),this._handleAnimation()}static _removeAnimation(e){const n=e.id,r=this.animations,i=r.length;for(let s=0;s<i;s++)if(r[s].id===n){this.animations.splice(s,1);break}}static _runFrames(){const e={},n=this.animations;for(let r=0;r<n.length;r++){const i=n[r],s=i.layers,o=i.func;i._updateFrameObject(My());const a=s.length;let l;if(o?l=o.call(i,i.frame)!==!1:l=!0,!!l)for(let d=0;d<a;d++){const h=s[d];h._id!==void 0&&(e[h._id]=h)}}for(const r in e)e.hasOwnProperty(r)&&e[r].batchDraw()}static _animationLoop(){const e=Pi;e.animations.length?(e._runFrames(),F5.Util.requestAnimFrame(e._animationLoop)):e.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,F5.Util.requestAnimFrame(this._animationLoop))}}Gu.Animation=Pi;Pi.animations=[];Pi.animIdCounter=0;Pi.animRunning=!1;var D_={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Easings=t.Tween=void 0;const e=bt,n=Gu,r=gt,i=Ae,s={node:1,duration:1,easing:1,onFinish:1,yoyo:1},o=1,a=2,l=3,d=["fill","stroke","shadowColor"];let h=0;class f{constructor(g,x,S,C,E,w,b){this.prop=g,this.propFunc=x,this.begin=C,this._pos=C,this.duration=w,this._change=0,this.prevPos=0,this.yoyo=b,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=S,this._change=E-this.begin,this.pause()}fire(g){const x=this[g];x&&x()}setTime(g){g>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():g<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=g,this.update())}getTime(){return this._time}setPosition(g){this.prevPos=this._pos,this.propFunc(g),this._pos=g}getPosition(g){return g===void 0&&(g=this._time),this.func(g,this.begin,this._change,this.duration)}play(){this.state=a,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=l,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(g){this.pause(),this._time=g,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){const g=this.getTimer()-this._startTime;this.state===a?this.setTime(g):this.state===l&&this.setTime(this.duration-g)}pause(){this.state=o,this.fire("onPause")}getTimer(){return new Date().getTime()}}class p{constructor(g){const x=this,S=g.node,C=S._id,E=g.easing||t.Easings.Linear,w=!!g.yoyo;let b,T;typeof g.duration>"u"?b=.3:g.duration===0?b=.001:b=g.duration,this.node=S,this._id=h++;const P=S.getLayer()||(S instanceof i.Konva.Stage?S.getLayers():null);P||e.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new n.Animation(function(){x.tween.onEnterFrame()},P),this.tween=new f(T,function(A){x._tweenFunc(A)},E,0,1,b*1e3,w),this._addListeners(),p.attrs[C]||(p.attrs[C]={}),p.attrs[C][this._id]||(p.attrs[C][this._id]={}),p.tweens[C]||(p.tweens[C]={});for(T in g)s[T]===void 0&&this._addAttr(T,g[T]);this.reset(),this.onFinish=g.onFinish,this.onReset=g.onReset,this.onUpdate=g.onUpdate}_addAttr(g,x){const S=this.node,C=S._id;let E,w,b,T,P;const A=p.tweens[C][g];A&&delete p.attrs[C][A][g];let M=S.getAttr(g);if(e.Util._isArray(x))if(E=[],w=Math.max(x.length,M.length),g==="points"&&x.length!==M.length&&(x.length>M.length?(T=M,M=e.Util._prepareArrayForTween(M,x,S.closed())):(b=x,x=e.Util._prepareArrayForTween(x,M,S.closed()))),g.indexOf("fill")===0)for(let I=0;I<w;I++)if(I%2===0)E.push(x[I]-M[I]);else{const R=e.Util.colorToRGBA(M[I]);P=e.Util.colorToRGBA(x[I]),M[I]=R,E.push({r:P.r-R.r,g:P.g-R.g,b:P.b-R.b,a:P.a-R.a})}else for(let I=0;I<w;I++)E.push(x[I]-M[I]);else d.indexOf(g)!==-1?(M=e.Util.colorToRGBA(M),P=e.Util.colorToRGBA(x),E={r:P.r-M.r,g:P.g-M.g,b:P.b-M.b,a:P.a-M.a}):E=x-M;p.attrs[C][this._id][g]={start:M,diff:E,end:x,trueEnd:b,trueStart:T},p.tweens[C][g]=this._id}_tweenFunc(g){const x=this.node,S=p.attrs[x._id][this._id];let C,E,w,b,T,P,A,M;for(C in S){if(E=S[C],w=E.start,b=E.diff,M=E.end,e.Util._isArray(w))if(T=[],A=Math.max(w.length,M.length),C.indexOf("fill")===0)for(P=0;P<A;P++)P%2===0?T.push((w[P]||0)+b[P]*g):T.push("rgba("+Math.round(w[P].r+b[P].r*g)+","+Math.round(w[P].g+b[P].g*g)+","+Math.round(w[P].b+b[P].b*g)+","+(w[P].a+b[P].a*g)+")");else for(P=0;P<A;P++)T.push((w[P]||0)+b[P]*g);else d.indexOf(C)!==-1?T="rgba("+Math.round(w.r+b.r*g)+","+Math.round(w.g+b.g*g)+","+Math.round(w.b+b.b*g)+","+(w.a+b.a*g)+")":T=w+b*g;x.setAttr(C,T)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{const g=this.node,x=p.attrs[g._id][this._id];x.points&&x.points.trueEnd&&g.setAttr("points",x.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{const g=this.node,x=p.attrs[g._id][this._id];x.points&&x.points.trueStart&&g.points(x.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(g){return this.tween.seek(g*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){const g=this.node._id,x=this._id,S=p.tweens[g];this.pause(),this.anim&&this.anim.stop();for(const C in S)delete p.tweens[g][C];delete p.attrs[g][x],p.tweens[g]&&(Object.keys(p.tweens[g]).length===0&&delete p.tweens[g],Object.keys(p.attrs[g]).length===0&&delete p.attrs[g])}}t.Tween=p,p.attrs={},p.tweens={},r.Node.prototype.to=function(y){const g=y.onFinish;y.node=this,y.onFinish=function(){this.destroy(),g&&g()},new p(y).play()},t.Easings={BackEaseIn(y,g,x,S){return x*(y/=S)*y*((1.70158+1)*y-1.70158)+g},BackEaseOut(y,g,x,S){return x*((y=y/S-1)*y*((1.70158+1)*y+1.70158)+1)+g},BackEaseInOut(y,g,x,S){let C=1.70158;return(y/=S/2)<1?x/2*(y*y*(((C*=1.525)+1)*y-C))+g:x/2*((y-=2)*y*(((C*=1.525)+1)*y+C)+2)+g},ElasticEaseIn(y,g,x,S,C,E){let w=0;return y===0?g:(y/=S)===1?g+x:(E||(E=S*.3),!C||C<Math.abs(x)?(C=x,w=E/4):w=E/(2*Math.PI)*Math.asin(x/C),-(C*Math.pow(2,10*(y-=1))*Math.sin((y*S-w)*(2*Math.PI)/E))+g)},ElasticEaseOut(y,g,x,S,C,E){let w=0;return y===0?g:(y/=S)===1?g+x:(E||(E=S*.3),!C||C<Math.abs(x)?(C=x,w=E/4):w=E/(2*Math.PI)*Math.asin(x/C),C*Math.pow(2,-10*y)*Math.sin((y*S-w)*(2*Math.PI)/E)+x+g)},ElasticEaseInOut(y,g,x,S,C,E){let w=0;return y===0?g:(y/=S/2)===2?g+x:(E||(E=S*(.3*1.5)),!C||C<Math.abs(x)?(C=x,w=E/4):w=E/(2*Math.PI)*Math.asin(x/C),y<1?-.5*(C*Math.pow(2,10*(y-=1))*Math.sin((y*S-w)*(2*Math.PI)/E))+g:C*Math.pow(2,-10*(y-=1))*Math.sin((y*S-w)*(2*Math.PI)/E)*.5+x+g)},BounceEaseOut(y,g,x,S){return(y/=S)<1/2.75?x*(7.5625*y*y)+g:y<2/2.75?x*(7.5625*(y-=1.5/2.75)*y+.75)+g:y<2.5/2.75?x*(7.5625*(y-=2.25/2.75)*y+.9375)+g:x*(7.5625*(y-=2.625/2.75)*y+.984375)+g},BounceEaseIn(y,g,x,S){return x-t.Easings.BounceEaseOut(S-y,0,x,S)+g},BounceEaseInOut(y,g,x,S){return y<S/2?t.Easings.BounceEaseIn(y*2,0,x,S)*.5+g:t.Easings.BounceEaseOut(y*2-S,0,x,S)*.5+x*.5+g},EaseIn(y,g,x,S){return x*(y/=S)*y+g},EaseOut(y,g,x,S){return-x*(y/=S)*(y-2)+g},EaseInOut(y,g,x,S){return(y/=S/2)<1?x/2*y*y+g:-x/2*(--y*(y-2)-1)+g},StrongEaseIn(y,g,x,S){return x*(y/=S)*y*y*y*y+g},StrongEaseOut(y,g,x,S){return x*((y=y/S-1)*y*y*y*y+1)+g},StrongEaseInOut(y,g,x,S){return(y/=S/2)<1?x/2*y*y*y*y*y+g:x/2*((y-=2)*y*y*y*y+2)+g},Linear(y,g,x,S){return x*y/S+g}}})(D_);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Konva=void 0;const e=Ae,n=bt,r=gt,i=Ja,s=A_,o=ph,a=_g,l=Vu,d=bg,h=Qt,f=Gu,p=D_,y=cs,g=ai;t.Konva=n.Util._assign(e.Konva,{Util:n.Util,Transform:n.Transform,Node:r.Node,Container:i.Container,Stage:s.Stage,stages:s.stages,Layer:o.Layer,FastLayer:a.FastLayer,Group:l.Group,DD:d.DD,Shape:h.Shape,shapes:h.shapes,Animation:f.Animation,Tween:p.Tween,Easings:p.Easings,Context:y.Context,Canvas:g.Canvas}),t.default=t.Konva})(tm);var Ng={};Object.defineProperty(Ng,"__esModule",{value:!0});Ng.Arc=void 0;const Tg=Le,cj=Qt,j5=Ae,Mg=Se,dj=Ae;class ks extends cj.Shape{_sceneFunc(e){const n=j5.Konva.getAngle(this.angle()),r=this.clockwise();e.beginPath(),e.arc(0,0,this.outerRadius(),0,n,r),e.arc(0,0,this.innerRadius(),n,0,!r),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}getSelfRect(){const e=this.innerRadius(),n=this.outerRadius(),r=this.clockwise(),i=j5.Konva.getAngle(r?360-this.angle():this.angle()),s=Math.cos(Math.min(i,Math.PI)),o=1,a=Math.sin(Math.min(Math.max(Math.PI,i),3*Math.PI/2)),l=Math.sin(Math.min(i,Math.PI/2)),d=s*(s>0?e:n),h=o*n,f=a*(a>0?e:n),p=l*(l>0?n:e);return{x:d,y:r?-1*p:f,width:h-d,height:p-f}}}Ng.Arc=ks;ks.prototype._centroid=!0;ks.prototype.className="Arc";ks.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"];(0,dj._registerNode)(ks);Tg.Factory.addGetterSetter(ks,"innerRadius",0,(0,Mg.getNumberValidator)());Tg.Factory.addGetterSetter(ks,"outerRadius",0,(0,Mg.getNumberValidator)());Tg.Factory.addGetterSetter(ks,"angle",0,(0,Mg.getNumberValidator)());Tg.Factory.addGetterSetter(ks,"clockwise",!1,(0,Mg.getBooleanValidator)());var Pg={},mh={};Object.defineProperty(mh,"__esModule",{value:!0});mh.Line=void 0;const Og=Le,hj=Ae,fj=Qt,F_=Se;function Rv(t,e,n,r,i,s,o){const a=Math.sqrt(Math.pow(n-t,2)+Math.pow(r-e,2)),l=Math.sqrt(Math.pow(i-n,2)+Math.pow(s-r,2)),d=o*a/(a+l),h=o*l/(a+l),f=n-d*(i-t),p=r-d*(s-e),y=n+h*(i-t),g=r+h*(s-e);return[f,p,y,g]}function z5(t,e){const n=t.length,r=[];for(let i=2;i<n-2;i+=2){const s=Rv(t[i-2],t[i-1],t[i],t[i+1],t[i+2],t[i+3],e);isNaN(s[0])||(r.push(s[0]),r.push(s[1]),r.push(t[i]),r.push(t[i+1]),r.push(s[2]),r.push(s[3]))}return r}class Do extends fj.Shape{constructor(e){super(e),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_sceneFunc(e){const n=this.points(),r=n.length,i=this.tension(),s=this.closed(),o=this.bezier();if(!r)return;let a=0;if(e.beginPath(),e.moveTo(n[0],n[1]),i!==0&&r>4){const l=this.getTensionPoints(),d=l.length;for(a=s?0:4,s||e.quadraticCurveTo(l[0],l[1],l[2],l[3]);a<d-2;)e.bezierCurveTo(l[a++],l[a++],l[a++],l[a++],l[a++],l[a++]);s||e.quadraticCurveTo(l[d-2],l[d-1],n[r-2],n[r-1])}else if(o)for(a=2;a<r;)e.bezierCurveTo(n[a++],n[a++],n[a++],n[a++],n[a++],n[a++]);else for(a=2;a<r;a+=2)e.lineTo(n[a],n[a+1]);s?(e.closePath(),e.fillStrokeShape(this)):e.strokeShape(this)}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():z5(this.points(),this.tension())}_getTensionPointsClosed(){const e=this.points(),n=e.length,r=this.tension(),i=Rv(e[n-2],e[n-1],e[0],e[1],e[2],e[3],r),s=Rv(e[n-4],e[n-3],e[n-2],e[n-1],e[0],e[1],r),o=z5(e,r);return[i[2],i[3]].concat(o).concat([s[0],s[1],e[n-2],e[n-1],s[2],s[3],i[0],i[1],e[0],e[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){let e=this.points();if(e.length<4)return{x:e[0]||0,y:e[1]||0,width:0,height:0};this.tension()!==0?e=[e[0],e[1],...this._getTensionPoints(),e[e.length-2],e[e.length-1]]:e=this.points();let n=e[0],r=e[0],i=e[1],s=e[1],o,a;for(let l=0;l<e.length/2;l++)o=e[l*2],a=e[l*2+1],n=Math.min(n,o),r=Math.max(r,o),i=Math.min(i,a),s=Math.max(s,a);return{x:n,y:i,width:r-n,height:s-i}}}mh.Line=Do;Do.prototype.className="Line";Do.prototype._attrsAffectingSize=["points","bezier","tension"];(0,hj._registerNode)(Do);Og.Factory.addGetterSetter(Do,"closed",!1);Og.Factory.addGetterSetter(Do,"bezier",!1);Og.Factory.addGetterSetter(Do,"tension",0,(0,F_.getNumberValidator)());Og.Factory.addGetterSetter(Do,"points",[],(0,F_.getNumberArrayValidator)());var $u={},j_={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.t2length=t.getQuadraticArcLength=t.getCubicArcLength=t.binomialCoefficients=t.cValues=t.tValues=void 0,t.tValues=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],t.cValues=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],t.binomialCoefficients=[[1],[1,1],[1,2,1],[1,3,3,1]];const e=(o,a,l)=>{let d,h;const p=l/2;d=0;for(let y=0;y<20;y++)h=p*t.tValues[20][y]+p,d+=t.cValues[20][y]*r(o,a,h);return p*d};t.getCubicArcLength=e;const n=(o,a,l)=>{l===void 0&&(l=1);const d=o[0]-2*o[1]+o[2],h=a[0]-2*a[1]+a[2],f=2*o[1]-2*o[0],p=2*a[1]-2*a[0],y=4*(d*d+h*h),g=4*(d*f+h*p),x=f*f+p*p;if(y===0)return l*Math.sqrt(Math.pow(o[2]-o[0],2)+Math.pow(a[2]-a[0],2));const S=g/(2*y),C=x/y,E=l+S,w=C-S*S,b=E*E+w>0?Math.sqrt(E*E+w):0,T=S*S+w>0?Math.sqrt(S*S+w):0,P=S+Math.sqrt(S*S+w)!==0?w*Math.log(Math.abs((E+b)/(S+T))):0;return Math.sqrt(y)/2*(E*b-S*T+P)};t.getQuadraticArcLength=n;function r(o,a,l){const d=i(1,l,o),h=i(1,l,a),f=d*d+h*h;return Math.sqrt(f)}const i=(o,a,l)=>{const d=l.length-1;let h,f;if(d===0)return 0;if(o===0){f=0;for(let p=0;p<=d;p++)f+=t.binomialCoefficients[d][p]*Math.pow(1-a,d-p)*Math.pow(a,p)*l[p];return f}else{h=new Array(d);for(let p=0;p<d;p++)h[p]=d*(l[p+1]-l[p]);return i(o-1,a,h)}},s=(o,a,l)=>{let d=1,h=o/a,f=(o-l(h))/a,p=0;for(;d>.001;){const y=l(h+f),g=Math.abs(o-y)/a;if(g<d)d=g,h+=f;else{const x=l(h-f),S=Math.abs(o-x)/a;S<d?(d=S,h-=f):f/=2}if(p++,p>500)break}return h};t.t2length=s})(j_);Object.defineProperty($u,"__esModule",{value:!0});$u.Path=void 0;const pj=Le,mj=Ae,gj=Qt,_l=j_;class Gt extends gj.Shape{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=Gt.parsePathData(this.data()),this.pathLength=Gt.getPathLength(this.dataArray)}_sceneFunc(e){const n=this.dataArray;e.beginPath();let r=!1;for(let i=0;i<n.length;i++){const s=n[i].command,o=n[i].points;switch(s){case"L":e.lineTo(o[0],o[1]);break;case"M":e.moveTo(o[0],o[1]);break;case"C":e.bezierCurveTo(o[0],o[1],o[2],o[3],o[4],o[5]);break;case"Q":e.quadraticCurveTo(o[0],o[1],o[2],o[3]);break;case"A":const a=o[0],l=o[1],d=o[2],h=o[3],f=o[4],p=o[5],y=o[6],g=o[7],x=d>h?d:h,S=d>h?1:d/h,C=d>h?h/d:1;e.translate(a,l),e.rotate(y),e.scale(S,C),e.arc(0,0,x,f,f+p,1-g),e.scale(1/S,1/C),e.rotate(-y),e.translate(-a,-l);break;case"z":r=!0,e.closePath();break}}!r&&!this.hasFill()?e.strokeShape(this):e.fillStrokeShape(this)}getSelfRect(){let e=[];this.dataArray.forEach(function(l){if(l.command==="A"){const d=l.points[4],h=l.points[5],f=l.points[4]+h;let p=Math.PI/180;if(Math.abs(d-f)<p&&(p=Math.abs(d-f)),h<0)for(let y=d-p;y>f;y-=p){const g=Gt.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],y,0);e.push(g.x,g.y)}else for(let y=d+p;y<f;y+=p){const g=Gt.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],y,0);e.push(g.x,g.y)}}else if(l.command==="C")for(let d=0;d<=1;d+=.01){const h=Gt.getPointOnCubicBezier(d,l.start.x,l.start.y,l.points[0],l.points[1],l.points[2],l.points[3],l.points[4],l.points[5]);e.push(h.x,h.y)}else e=e.concat(l.points)});let n=e[0],r=e[0],i=e[1],s=e[1],o,a;for(let l=0;l<e.length/2;l++)o=e[l*2],a=e[l*2+1],isNaN(o)||(n=Math.min(n,o),r=Math.max(r,o)),isNaN(a)||(i=Math.min(i,a),s=Math.max(s,a));return{x:n,y:i,width:r-n,height:s-i}}getLength(){return this.pathLength}getPointAtLength(e){return Gt.getPointAtLengthOfDataArray(e,this.dataArray)}static getLineLength(e,n,r,i){return Math.sqrt((r-e)*(r-e)+(i-n)*(i-n))}static getPathLength(e){let n=0;for(let r=0;r<e.length;++r)n+=e[r].pathLength;return n}static getPointAtLengthOfDataArray(e,n){let r,i=0,s=n.length;if(!s)return null;for(;i<s&&e>n[i].pathLength;)e-=n[i].pathLength,++i;if(i===s)return r=n[i-1].points.slice(-2),{x:r[0],y:r[1]};if(e<.01)return n[i].command==="M"?(r=n[i].points.slice(0,2),{x:r[0],y:r[1]}):{x:n[i].start.x,y:n[i].start.y};const o=n[i],a=o.points;switch(o.command){case"L":return Gt.getPointOnLine(e,o.start.x,o.start.y,a[0],a[1]);case"C":return Gt.getPointOnCubicBezier((0,_l.t2length)(e,Gt.getPathLength(n),x=>(0,_l.getCubicArcLength)([o.start.x,a[0],a[2],a[4]],[o.start.y,a[1],a[3],a[5]],x)),o.start.x,o.start.y,a[0],a[1],a[2],a[3],a[4],a[5]);case"Q":return Gt.getPointOnQuadraticBezier((0,_l.t2length)(e,Gt.getPathLength(n),x=>(0,_l.getQuadraticArcLength)([o.start.x,a[0],a[2]],[o.start.y,a[1],a[3]],x)),o.start.x,o.start.y,a[0],a[1],a[2],a[3]);case"A":const l=a[0],d=a[1],h=a[2],f=a[3],p=a[5],y=a[6];let g=a[4];return g+=p*e/o.pathLength,Gt.getPointOnEllipticalArc(l,d,h,f,g,y)}return null}static getPointOnLine(e,n,r,i,s,o,a){o=o??n,a=a??r;const l=this.getLineLength(n,r,i,s);if(l<1e-10)return{x:n,y:r};if(i===n)return{x:o,y:a+(s>r?e:-e)};const d=(s-r)/(i-n),h=Math.sqrt(e*e/(1+d*d))*(i<n?-1:1),f=d*h;if(Math.abs(a-r-d*(o-n))<1e-10)return{x:o+h,y:a+f};const p=((o-n)*(i-n)+(a-r)*(s-r))/(l*l),y=n+p*(i-n),g=r+p*(s-r),x=this.getLineLength(o,a,y,g),S=Math.sqrt(e*e-x*x),C=Math.sqrt(S*S/(1+d*d))*(i<n?-1:1),E=d*C;return{x:y+C,y:g+E}}static getPointOnCubicBezier(e,n,r,i,s,o,a,l,d){function h(S){return S*S*S}function f(S){return 3*S*S*(1-S)}function p(S){return 3*S*(1-S)*(1-S)}function y(S){return(1-S)*(1-S)*(1-S)}const g=l*h(e)+o*f(e)+i*p(e)+n*y(e),x=d*h(e)+a*f(e)+s*p(e)+r*y(e);return{x:g,y:x}}static getPointOnQuadraticBezier(e,n,r,i,s,o,a){function l(y){return y*y}function d(y){return 2*y*(1-y)}function h(y){return(1-y)*(1-y)}const f=o*l(e)+i*d(e)+n*h(e),p=a*l(e)+s*d(e)+r*h(e);return{x:f,y:p}}static getPointOnEllipticalArc(e,n,r,i,s,o){const a=Math.cos(o),l=Math.sin(o),d={x:r*Math.cos(s),y:i*Math.sin(s)};return{x:e+(d.x*a-d.y*l),y:n+(d.x*l+d.y*a)}}static parsePathData(e){if(!e)return[];let n=e;const r=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];n=n.replace(new RegExp(" ","g"),",");for(let f=0;f<r.length;f++)n=n.replace(new RegExp(r[f],"g"),"|"+r[f]);const i=n.split("|"),s=[],o=[];let a=0,l=0;const d=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;let h;for(let f=1;f<i.length;f++){let p=i[f],y=p.charAt(0);for(p=p.slice(1),o.length=0;h=d.exec(p);)o.push(h[0]);const g=[];for(let x=0,S=o.length;x<S;x++){if(o[x]==="00"){g.push(0,0);continue}const C=parseFloat(o[x]);isNaN(C)?g.push(0):g.push(C)}for(;g.length>0&&!isNaN(g[0]);){let x="",S=[];const C=a,E=l;let w,b,T,P,A,M,I,R,U,B;switch(y){case"l":a+=g.shift(),l+=g.shift(),x="L",S.push(a,l);break;case"L":a=g.shift(),l=g.shift(),S.push(a,l);break;case"m":const $=g.shift(),Q=g.shift();if(a+=$,l+=Q,x="M",s.length>2&&s[s.length-1].command==="z"){for(let q=s.length-2;q>=0;q--)if(s[q].command==="M"){a=s[q].points[0]+$,l=s[q].points[1]+Q;break}}S.push(a,l),y="l";break;case"M":a=g.shift(),l=g.shift(),x="M",S.push(a,l),y="L";break;case"h":a+=g.shift(),x="L",S.push(a,l);break;case"H":a=g.shift(),x="L",S.push(a,l);break;case"v":l+=g.shift(),x="L",S.push(a,l);break;case"V":l=g.shift(),x="L",S.push(a,l);break;case"C":S.push(g.shift(),g.shift(),g.shift(),g.shift()),a=g.shift(),l=g.shift(),S.push(a,l);break;case"c":S.push(a+g.shift(),l+g.shift(),a+g.shift(),l+g.shift()),a+=g.shift(),l+=g.shift(),x="C",S.push(a,l);break;case"S":b=a,T=l,w=s[s.length-1],w.command==="C"&&(b=a+(a-w.points[2]),T=l+(l-w.points[3])),S.push(b,T,g.shift(),g.shift()),a=g.shift(),l=g.shift(),x="C",S.push(a,l);break;case"s":b=a,T=l,w=s[s.length-1],w.command==="C"&&(b=a+(a-w.points[2]),T=l+(l-w.points[3])),S.push(b,T,a+g.shift(),l+g.shift()),a+=g.shift(),l+=g.shift(),x="C",S.push(a,l);break;case"Q":S.push(g.shift(),g.shift()),a=g.shift(),l=g.shift(),S.push(a,l);break;case"q":S.push(a+g.shift(),l+g.shift()),a+=g.shift(),l+=g.shift(),x="Q",S.push(a,l);break;case"T":b=a,T=l,w=s[s.length-1],w.command==="Q"&&(b=a+(a-w.points[0]),T=l+(l-w.points[1])),a=g.shift(),l=g.shift(),x="Q",S.push(b,T,a,l);break;case"t":b=a,T=l,w=s[s.length-1],w.command==="Q"&&(b=a+(a-w.points[0]),T=l+(l-w.points[1])),a+=g.shift(),l+=g.shift(),x="Q",S.push(b,T,a,l);break;case"A":P=g.shift(),A=g.shift(),M=g.shift(),I=g.shift(),R=g.shift(),U=a,B=l,a=g.shift(),l=g.shift(),x="A",S=this.convertEndpointToCenterParameterization(U,B,a,l,I,R,P,A,M);break;case"a":P=g.shift(),A=g.shift(),M=g.shift(),I=g.shift(),R=g.shift(),U=a,B=l,a+=g.shift(),l+=g.shift(),x="A",S=this.convertEndpointToCenterParameterization(U,B,a,l,I,R,P,A,M);break}s.push({command:x||y,points:S,start:{x:C,y:E},pathLength:this.calcLength(C,E,x||y,S)})}(y==="z"||y==="Z")&&s.push({command:"z",points:[],start:void 0,pathLength:0})}return s}static calcLength(e,n,r,i){let s,o,a,l;const d=Gt;switch(r){case"L":return d.getLineLength(e,n,i[0],i[1]);case"C":return(0,_l.getCubicArcLength)([e,i[0],i[2],i[4]],[n,i[1],i[3],i[5]],1);case"Q":return(0,_l.getQuadraticArcLength)([e,i[0],i[2]],[n,i[1],i[3]],1);case"A":s=0;const h=i[4],f=i[5],p=i[4]+f;let y=Math.PI/180;if(Math.abs(h-p)<y&&(y=Math.abs(h-p)),o=d.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],h,0),f<0)for(l=h-y;l>p;l-=y)a=d.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],l,0),s+=d.getLineLength(o.x,o.y,a.x,a.y),o=a;else for(l=h+y;l<p;l+=y)a=d.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],l,0),s+=d.getLineLength(o.x,o.y,a.x,a.y),o=a;return a=d.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],p,0),s+=d.getLineLength(o.x,o.y,a.x,a.y),s}return 0}static convertEndpointToCenterParameterization(e,n,r,i,s,o,a,l,d){const h=d*(Math.PI/180),f=Math.cos(h)*(e-r)/2+Math.sin(h)*(n-i)/2,p=-1*Math.sin(h)*(e-r)/2+Math.cos(h)*(n-i)/2,y=f*f/(a*a)+p*p/(l*l);y>1&&(a*=Math.sqrt(y),l*=Math.sqrt(y));let g=Math.sqrt((a*a*(l*l)-a*a*(p*p)-l*l*(f*f))/(a*a*(p*p)+l*l*(f*f)));s===o&&(g*=-1),isNaN(g)&&(g=0);const x=g*a*p/l,S=g*-l*f/a,C=(e+r)/2+Math.cos(h)*x-Math.sin(h)*S,E=(n+i)/2+Math.sin(h)*x+Math.cos(h)*S,w=function(R){return Math.sqrt(R[0]*R[0]+R[1]*R[1])},b=function(R,U){return(R[0]*U[0]+R[1]*U[1])/(w(R)*w(U))},T=function(R,U){return(R[0]*U[1]<R[1]*U[0]?-1:1)*Math.acos(b(R,U))},P=T([1,0],[(f-x)/a,(p-S)/l]),A=[(f-x)/a,(p-S)/l],M=[(-1*f-x)/a,(-1*p-S)/l];let I=T(A,M);return b(A,M)<=-1&&(I=Math.PI),b(A,M)>=1&&(I=0),o===0&&I>0&&(I=I-2*Math.PI),o===1&&I<0&&(I=I+2*Math.PI),[C,E,a,l,P,I,h,o]}}$u.Path=Gt;Gt.prototype.className="Path";Gt.prototype._attrsAffectingSize=["data"];(0,mj._registerNode)(Gt);pj.Factory.addGetterSetter(Gt,"data");Object.defineProperty(Pg,"__esModule",{value:!0});Pg.Arrow=void 0;const Ag=Le,yj=mh,z_=Se,vj=Ae,B5=$u;class Za extends yj.Line{_sceneFunc(e){super._sceneFunc(e);const n=Math.PI*2,r=this.points();let i=r;const s=this.tension()!==0&&r.length>4;s&&(i=this.getTensionPoints());const o=this.pointerLength(),a=r.length;let l,d;if(s){const p=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[a-2],r[a-1]],y=B5.Path.calcLength(i[i.length-4],i[i.length-3],"C",p),g=B5.Path.getPointOnQuadraticBezier(Math.min(1,1-o/y),p[0],p[1],p[2],p[3],p[4],p[5]);l=r[a-2]-g.x,d=r[a-1]-g.y}else l=r[a-2]-r[a-4],d=r[a-1]-r[a-3];const h=(Math.atan2(d,l)+n)%n,f=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(r[a-2],r[a-1]),e.rotate(h),e.moveTo(0,0),e.lineTo(-o,f/2),e.lineTo(-o,-f/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(r[0],r[1]),s?(l=(i[0]+i[2])/2-r[0],d=(i[1]+i[3])/2-r[1]):(l=r[2]-r[0],d=r[3]-r[1]),e.rotate((Math.atan2(-d,-l)+n)%n),e.moveTo(0,0),e.lineTo(-o,f/2),e.lineTo(-o,-f/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){const n=this.dashEnabled();n&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),n&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),n=this.pointerWidth()/2;return{x:e.x,y:e.y-n,width:e.width,height:e.height+n*2}}}Pg.Arrow=Za;Za.prototype.className="Arrow";(0,vj._registerNode)(Za);Ag.Factory.addGetterSetter(Za,"pointerLength",10,(0,z_.getNumberValidator)());Ag.Factory.addGetterSetter(Za,"pointerWidth",10,(0,z_.getNumberValidator)());Ag.Factory.addGetterSetter(Za,"pointerAtBeginning",!1);Ag.Factory.addGetterSetter(Za,"pointerAtEnding",!0);var Rg={};Object.defineProperty(Rg,"__esModule",{value:!0});Rg.Circle=void 0;const xj=Le,Sj=Qt,wj=Se,kj=Ae;class Wu extends Sj.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}}Rg.Circle=Wu;Wu.prototype._centroid=!0;Wu.prototype.className="Circle";Wu.prototype._attrsAffectingSize=["radius"];(0,kj._registerNode)(Wu);xj.Factory.addGetterSetter(Wu,"radius",0,(0,wj.getNumberValidator)());var Lg={};Object.defineProperty(Lg,"__esModule",{value:!0});Lg.Ellipse=void 0;const LS=Le,Cj=Qt,B_=Se,bj=Ae;class Fo extends Cj.Shape{_sceneFunc(e){const n=this.radiusX(),r=this.radiusY();e.beginPath(),e.save(),n!==r&&e.scale(1,r/n),e.arc(0,0,n,0,Math.PI*2,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}}Lg.Ellipse=Fo;Fo.prototype.className="Ellipse";Fo.prototype._centroid=!0;Fo.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,bj._registerNode)(Fo);LS.Factory.addComponentsGetterSetter(Fo,"radius",["x","y"]);LS.Factory.addGetterSetter(Fo,"radiusX",0,(0,B_.getNumberValidator)());LS.Factory.addGetterSetter(Fo,"radiusY",0,(0,B_.getNumberValidator)());var Ig={};Object.defineProperty(Ig,"__esModule",{value:!0});Ig.Image=void 0;const Py=bt,el=Le,Ej=Qt,_j=Ae,gh=Se;let Di=class U_ extends Ej.Shape{constructor(e){super(e),this._loadListener=()=>{this._requestDraw()},this.on("imageChange.konva",n=>{this._removeImageLoad(n.oldVal),this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const e=this.image();e&&e.complete||e&&e.readyState===4||e&&e.addEventListener&&e.addEventListener("load",this._loadListener)}_removeImageLoad(e){e&&e.removeEventListener&&e.removeEventListener("load",this._loadListener)}destroy(){return this._removeImageLoad(this.image()),super.destroy(),this}_useBufferCanvas(){const e=!!this.cornerRadius(),n=this.hasShadow();return e&&n?!0:super._useBufferCanvas(!0)}_sceneFunc(e){const n=this.getWidth(),r=this.getHeight(),i=this.cornerRadius(),s=this.attrs.image;let o;if(s){const a=this.attrs.cropWidth,l=this.attrs.cropHeight;a&&l?o=[s,this.cropX(),this.cropY(),a,l,0,0,n,r]:o=[s,0,0,n,r]}(this.hasFill()||this.hasStroke()||i)&&(e.beginPath(),i?Py.Util.drawRoundedRectPath(e,n,r,i):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)),s&&(i&&e.clip(),e.drawImage.apply(e,o))}_hitFunc(e){const n=this.width(),r=this.height(),i=this.cornerRadius();e.beginPath(),i?Py.Util.drawRoundedRectPath(e,n,r,i):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,n;return(e=this.attrs.width)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.width}getHeight(){var e,n;return(e=this.attrs.height)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.height}static fromURL(e,n,r=null){const i=Py.Util.createImageElement();i.onload=function(){const s=new U_({image:i});n(s)},i.onerror=r,i.crossOrigin="Anonymous",i.src=e}};Ig.Image=Di;Di.prototype.className="Image";(0,_j._registerNode)(Di);el.Factory.addGetterSetter(Di,"cornerRadius",0,(0,gh.getNumberOrArrayOfNumbersValidator)(4));el.Factory.addGetterSetter(Di,"image");el.Factory.addComponentsGetterSetter(Di,"crop",["x","y","width","height"]);el.Factory.addGetterSetter(Di,"cropX",0,(0,gh.getNumberValidator)());el.Factory.addGetterSetter(Di,"cropY",0,(0,gh.getNumberValidator)());el.Factory.addGetterSetter(Di,"cropWidth",0,(0,gh.getNumberValidator)());el.Factory.addGetterSetter(Di,"cropHeight",0,(0,gh.getNumberValidator)());var bu={};Object.defineProperty(bu,"__esModule",{value:!0});bu.Tag=bu.Label=void 0;const Dg=Le,Nj=Qt,Tj=Vu,IS=Se,H_=Ae,V_=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],Mj="Change.konva",Pj="none",Lv="up",Iv="right",Dv="down",Fv="left",Oj=V_.length;class DS extends Tj.Group{constructor(e){super(e),this.on("add.konva",function(n){this._addListeners(n.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){let n=this,r;const i=function(){n._sync()};for(r=0;r<Oj;r++)e.on(V_[r]+Mj,i)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){let e=this.getText(),n=this.getTag(),r,i,s,o,a,l,d;if(e&&n){switch(r=e.width(),i=e.height(),s=n.pointerDirection(),o=n.pointerWidth(),d=n.pointerHeight(),a=0,l=0,s){case Lv:a=r/2,l=-1*d;break;case Iv:a=r+o,l=i/2;break;case Dv:a=r/2,l=i+d;break;case Fv:a=-1*o,l=i/2;break}n.setAttrs({x:-1*a,y:-1*l,width:r,height:i}),e.setAttrs({x:-1*a,y:-1*l})}}}bu.Label=DS;DS.prototype.className="Label";(0,H_._registerNode)(DS);class tl extends Nj.Shape{_sceneFunc(e){const n=this.width(),r=this.height(),i=this.pointerDirection(),s=this.pointerWidth(),o=this.pointerHeight(),a=this.cornerRadius();let l=0,d=0,h=0,f=0;typeof a=="number"?l=d=h=f=Math.min(a,n/2,r/2):(l=Math.min(a[0]||0,n/2,r/2),d=Math.min(a[1]||0,n/2,r/2),f=Math.min(a[2]||0,n/2,r/2),h=Math.min(a[3]||0,n/2,r/2)),e.beginPath(),e.moveTo(l,0),i===Lv&&(e.lineTo((n-s)/2,0),e.lineTo(n/2,-1*o),e.lineTo((n+s)/2,0)),e.lineTo(n-d,0),e.arc(n-d,d,d,Math.PI*3/2,0,!1),i===Iv&&(e.lineTo(n,(r-o)/2),e.lineTo(n+s,r/2),e.lineTo(n,(r+o)/2)),e.lineTo(n,r-f),e.arc(n-f,r-f,f,0,Math.PI/2,!1),i===Dv&&(e.lineTo((n+s)/2,r),e.lineTo(n/2,r+o),e.lineTo((n-s)/2,r)),e.lineTo(h,r),e.arc(h,r-h,h,Math.PI/2,Math.PI,!1),i===Fv&&(e.lineTo(0,(r+o)/2),e.lineTo(-1*s,r/2),e.lineTo(0,(r-o)/2)),e.lineTo(0,l),e.arc(l,l,l,Math.PI,Math.PI*3/2,!1),e.closePath(),e.fillStrokeShape(this)}getSelfRect(){let e=0,n=0,r=this.pointerWidth(),i=this.pointerHeight(),s=this.pointerDirection(),o=this.width(),a=this.height();return s===Lv?(n-=i,a+=i):s===Dv?a+=i:s===Fv?(e-=r*1.5,o+=r):s===Iv&&(o+=r*1.5),{x:e,y:n,width:o,height:a}}}bu.Tag=tl;tl.prototype.className="Tag";(0,H_._registerNode)(tl);Dg.Factory.addGetterSetter(tl,"pointerDirection",Pj);Dg.Factory.addGetterSetter(tl,"pointerWidth",0,(0,IS.getNumberValidator)());Dg.Factory.addGetterSetter(tl,"pointerHeight",0,(0,IS.getNumberValidator)());Dg.Factory.addGetterSetter(tl,"cornerRadius",0,(0,IS.getNumberOrArrayOfNumbersValidator)(4));var yh={};Object.defineProperty(yh,"__esModule",{value:!0});yh.Rect=void 0;const Aj=Le,Rj=Qt,Lj=Ae,Ij=bt,Dj=Se;let Fg=class extends Rj.Shape{_sceneFunc(e){const n=this.cornerRadius(),r=this.width(),i=this.height();e.beginPath(),n?Ij.Util.drawRoundedRectPath(e,r,i,n):e.rect(0,0,r,i),e.closePath(),e.fillStrokeShape(this)}};yh.Rect=Fg;Fg.prototype.className="Rect";(0,Lj._registerNode)(Fg);Aj.Factory.addGetterSetter(Fg,"cornerRadius",0,(0,Dj.getNumberOrArrayOfNumbersValidator)(4));var jg={};Object.defineProperty(jg,"__esModule",{value:!0});jg.RegularPolygon=void 0;const G_=Le,Fj=Qt,$_=Se,jj=Ae;class nl extends Fj.Shape{_sceneFunc(e){const n=this._getPoints();e.beginPath(),e.moveTo(n[0].x,n[0].y);for(let r=1;r<n.length;r++)e.lineTo(n[r].x,n[r].y);e.closePath(),e.fillStrokeShape(this)}_getPoints(){const e=this.attrs.sides,n=this.attrs.radius||0,r=[];for(let i=0;i<e;i++)r.push({x:n*Math.sin(i*2*Math.PI/e),y:-1*n*Math.cos(i*2*Math.PI/e)});return r}getSelfRect(){const e=this._getPoints();let n=e[0].x,r=e[0].y,i=e[0].x,s=e[0].y;return e.forEach(o=>{n=Math.min(n,o.x),r=Math.max(r,o.x),i=Math.min(i,o.y),s=Math.max(s,o.y)}),{x:n,y:i,width:r-n,height:s-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}jg.RegularPolygon=nl;nl.prototype.className="RegularPolygon";nl.prototype._centroid=!0;nl.prototype._attrsAffectingSize=["radius"];(0,jj._registerNode)(nl);G_.Factory.addGetterSetter(nl,"radius",0,(0,$_.getNumberValidator)());G_.Factory.addGetterSetter(nl,"sides",0,(0,$_.getNumberValidator)());var zg={};Object.defineProperty(zg,"__esModule",{value:!0});zg.Ring=void 0;const W_=Le,zj=Qt,K_=Se,Bj=Ae,U5=Math.PI*2;class rl extends zj.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,U5,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),U5,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}zg.Ring=rl;rl.prototype.className="Ring";rl.prototype._centroid=!0;rl.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,Bj._registerNode)(rl);W_.Factory.addGetterSetter(rl,"innerRadius",0,(0,K_.getNumberValidator)());W_.Factory.addGetterSetter(rl,"outerRadius",0,(0,K_.getNumberValidator)());var Bg={};Object.defineProperty(Bg,"__esModule",{value:!0});Bg.Sprite=void 0;const il=Le,Uj=Qt,Hj=Gu,q_=Se,Vj=Ae;class Fi extends Uj.Shape{constructor(e){super(e),this._updated=!0,this.anim=new Hj.Animation(()=>{const n=this._updated;return this._updated=!1,n}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(e){const n=this.animation(),r=this.frameIndex(),i=r*4,s=this.animations()[n],o=this.frameOffsets(),a=s[i+0],l=s[i+1],d=s[i+2],h=s[i+3],f=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,d,h),e.closePath(),e.fillStrokeShape(this)),f)if(o){const p=o[n],y=r*2;e.drawImage(f,a,l,d,h,p[y+0],p[y+1],d,h)}else e.drawImage(f,a,l,d,h,0,0,d,h)}_hitFunc(e){const n=this.animation(),r=this.frameIndex(),i=r*4,s=this.animations()[n],o=this.frameOffsets(),a=s[i+2],l=s[i+3];if(e.beginPath(),o){const d=o[n],h=r*2;e.rect(d[h+0],d[h+1],a,l)}else e.rect(0,0,a,l);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){const e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(this.isRunning())return;const e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){const e=this.frameIndex(),n=this.animation(),r=this.animations(),i=r[n],s=i.length/4;e<s-1?this.frameIndex(e+1):this.frameIndex(0)}}Bg.Sprite=Fi;Fi.prototype.className="Sprite";(0,Vj._registerNode)(Fi);il.Factory.addGetterSetter(Fi,"animation");il.Factory.addGetterSetter(Fi,"animations");il.Factory.addGetterSetter(Fi,"frameOffsets");il.Factory.addGetterSetter(Fi,"image");il.Factory.addGetterSetter(Fi,"frameIndex",0,(0,q_.getNumberValidator)());il.Factory.addGetterSetter(Fi,"frameRate",17,(0,q_.getNumberValidator)());il.Factory.backCompat(Fi,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});var Ug={};Object.defineProperty(Ug,"__esModule",{value:!0});Ug.Star=void 0;const FS=Le,Gj=Qt,jS=Se,$j=Ae;class jo extends Gj.Shape{_sceneFunc(e){const n=this.innerRadius(),r=this.outerRadius(),i=this.numPoints();e.beginPath(),e.moveTo(0,0-r);for(let s=1;s<i*2;s++){const o=s%2===0?r:n,a=o*Math.sin(s*Math.PI/i),l=-1*o*Math.cos(s*Math.PI/i);e.lineTo(a,l)}e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}Ug.Star=jo;jo.prototype.className="Star";jo.prototype._centroid=!0;jo.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,$j._registerNode)(jo);FS.Factory.addGetterSetter(jo,"numPoints",5,(0,jS.getNumberValidator)());FS.Factory.addGetterSetter(jo,"innerRadius",0,(0,jS.getNumberValidator)());FS.Factory.addGetterSetter(jo,"outerRadius",0,(0,jS.getNumberValidator)());var Ku={};Object.defineProperty(Ku,"__esModule",{value:!0});Ku.Text=void 0;Ku.stringToArray=oa;const jv=bt,On=Le,Wj=Qt,Oy=Ae,zo=Se,Kj=Ae;function oa(t){return[...t].reduce((e,n,r,i)=>{if(new RegExp("\\p{Emoji}","u").test(n)){const s=i[r+1];s&&new RegExp("\\p{Emoji_Modifier}|\\u200D","u").test(s)?(e.push(n+s),i[r+1]=""):e.push(n)}else new RegExp("\\p{Regional_Indicator}{2}","u").test(n+(i[r+1]||""))?e.push(n+i[r+1]):r>0&&new RegExp("\\p{Mn}|\\p{Me}|\\p{Mc}","u").test(n)?e[e.length-1]+=n:n&&e.push(n);return e},[])}const Nl="auto",qj="center",Q_="inherit",_c="justify",Qj="Change.konva",Yj="2d",H5="-",Y_="left",Jj="text",Xj="Text",Zj="top",ez="bottom",V5="middle",J_="normal",tz="px ",zf=" ",nz="right",G5="rtl",rz="word",iz="char",$5="none",Ay="…",X_=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],sz=X_.length;function oz(t){return t.split(",").map(e=>{e=e.trim();const n=e.indexOf(" ")>=0,r=e.indexOf('"')>=0||e.indexOf("'")>=0;return n&&!r&&(e=`"${e}"`),e}).join(", ")}let Bf;function Ry(){return Bf||(Bf=jv.Util.createCanvasElement().getContext(Yj),Bf)}function az(t){t.fillText(this._partialText,this._partialTextX,this._partialTextY)}function lz(t){t.setAttr("miterLimit",2),t.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function uz(t){return t=t||{},!t.fillLinearGradientColorStops&&!t.fillRadialGradientColorStops&&!t.fillPatternImage&&(t.fill=t.fill||"black"),t}let Ot=class extends Wj.Shape{constructor(e){super(uz(e)),this._partialTextX=0,this._partialTextY=0;for(let n=0;n<sz;n++)this.on(X_[n]+Qj,this._setTextData);this._setTextData()}_sceneFunc(e){const n=this.textArr,r=n.length;if(!this.text())return;let i=this.padding(),s=this.fontSize(),o=this.lineHeight()*s,a=this.verticalAlign(),l=this.direction(),d=0,h=this.align(),f=this.getWidth(),p=this.letterSpacing(),y=this.fill(),g=this.textDecoration(),x=g.indexOf("underline")!==-1,S=g.indexOf("line-through")!==-1,C;l=l===Q_?e.direction:l;let E=o/2,w=V5;if(Oy.Konva._fixTextRendering){const b=this.measureSize("M");w="alphabetic",E=(b.fontBoundingBoxAscent-b.fontBoundingBoxDescent)/2+o/2}for(l===G5&&e.setAttr("direction",l),e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",w),e.setAttr("textAlign",Y_),a===V5?d=(this.getHeight()-r*o-i*2)/2:a===ez&&(d=this.getHeight()-r*o-i*2),e.translate(i,d+i),C=0;C<r;C++){let b=0,T=0;const P=n[C],A=P.text,M=P.width,I=P.lastInParagraph;if(e.save(),h===nz?b+=f-M-i*2:h===qj&&(b+=(f-M-i*2)/2),x){e.save(),e.beginPath();const R=Oy.Konva._fixTextRendering?Math.round(s/4):Math.round(s/2),U=b,B=E+T+R;e.moveTo(U,B);const $=h===_c&&!I?f-i*2:M;e.lineTo(U+Math.round($),B),e.lineWidth=s/15;const Q=this._getLinearGradient();e.strokeStyle=Q||y,e.stroke(),e.restore()}if(S){e.save(),e.beginPath();const R=Oy.Konva._fixTextRendering?-Math.round(s/4):0;e.moveTo(b,E+T+R);const U=h===_c&&!I?f-i*2:M;e.lineTo(b+Math.round(U),E+T+R),e.lineWidth=s/15;const B=this._getLinearGradient();e.strokeStyle=B||y,e.stroke(),e.restore()}if(l!==G5&&(p!==0||h===_c)){const R=A.split(" ").length-1,U=oa(A);for(let B=0;B<U.length;B++){const $=U[B];$===" "&&!I&&h===_c&&(b+=(f-i*2-M)/R),this._partialTextX=b,this._partialTextY=E+T,this._partialText=$,e.fillStrokeShape(this),b+=this.measureSize($).width+p}}else p!==0&&e.setAttr("letterSpacing",`${p}px`),this._partialTextX=b,this._partialTextY=E+T,this._partialText=A,e.fillStrokeShape(this);e.restore(),r>1&&(E+=o)}}_hitFunc(e){const n=this.getWidth(),r=this.getHeight();e.beginPath(),e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}setText(e){const n=jv.Util._isString(e)?e:e==null?"":e+"";return this._setAttr(Jj,n),this}getWidth(){return this.attrs.width===Nl||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===Nl||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return jv.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var n,r,i,s,o,a,l,d,h,f,p;let y=Ry(),g=this.fontSize(),x;y.save(),y.font=this._getContextFont(),x=y.measureText(e),y.restore();const S=g/100;return{actualBoundingBoxAscent:(n=x.actualBoundingBoxAscent)!==null&&n!==void 0?n:71.58203125*S,actualBoundingBoxDescent:(r=x.actualBoundingBoxDescent)!==null&&r!==void 0?r:0,actualBoundingBoxLeft:(i=x.actualBoundingBoxLeft)!==null&&i!==void 0?i:-7.421875*S,actualBoundingBoxRight:(s=x.actualBoundingBoxRight)!==null&&s!==void 0?s:75.732421875*S,alphabeticBaseline:(o=x.alphabeticBaseline)!==null&&o!==void 0?o:0,emHeightAscent:(a=x.emHeightAscent)!==null&&a!==void 0?a:100*S,emHeightDescent:(l=x.emHeightDescent)!==null&&l!==void 0?l:-20*S,fontBoundingBoxAscent:(d=x.fontBoundingBoxAscent)!==null&&d!==void 0?d:91*S,fontBoundingBoxDescent:(h=x.fontBoundingBoxDescent)!==null&&h!==void 0?h:21*S,hangingBaseline:(f=x.hangingBaseline)!==null&&f!==void 0?f:72.80000305175781*S,ideographicBaseline:(p=x.ideographicBaseline)!==null&&p!==void 0?p:-21*S,width:x.width,height:g}}_getContextFont(){return this.fontStyle()+zf+this.fontVariant()+zf+(this.fontSize()+tz)+oz(this.fontFamily())}_addTextLine(e){this.align()===_c&&(e=e.trim());const r=this._getTextWidth(e);return this.textArr.push({text:e,width:r,lastInParagraph:!1})}_getTextWidth(e){const n=this.letterSpacing(),r=e.length;return Ry().measureText(e).width+n*r}_setTextData(){let e=this.text().split(`
`),n=+this.fontSize(),r=0,i=this.lineHeight()*n,s=this.attrs.width,o=this.attrs.height,a=s!==Nl&&s!==void 0,l=o!==Nl&&o!==void 0,d=this.padding(),h=s-d*2,f=o-d*2,p=0,y=this.wrap(),g=y!==$5,x=y!==iz&&g,S=this.ellipsis();this.textArr=[],Ry().font=this._getContextFont();const C=S?this._getTextWidth(Ay):0;for(let E=0,w=e.length;E<w;++E){let b=e[E],T=this._getTextWidth(b);if(a&&T>h)for(;b.length>0;){let P=0,A=oa(b).length,M="",I=0;for(;P<A;){const R=P+A>>>1,U=oa(b),B=U.slice(0,R+1).join(""),$=this._getTextWidth(B);(S&&l&&p+i>f?$+C:$)<=h?(P=R+1,M=B,I=$):A=R}if(M){if(x){const B=oa(b),$=oa(M),Q=B[$.length],q=Q===zf||Q===H5;let ie;if(q&&I<=h)ie=$.length;else{const fe=$.lastIndexOf(zf),W=$.lastIndexOf(H5);ie=Math.max(fe,W)+1}ie>0&&(P=ie,M=B.slice(0,P).join(""),I=this._getTextWidth(M))}if(M=M.trimRight(),this._addTextLine(M),r=Math.max(r,I),p+=i,this._shouldHandleEllipsis(p)){this._tryToAddEllipsisToLastLine();break}if(b=oa(b).slice(P).join("").trimLeft(),b.length>0&&(T=this._getTextWidth(b),T<=h)){this._addTextLine(b),p+=i,r=Math.max(r,T);break}}else break}else this._addTextLine(b),p+=i,r=Math.max(r,T),this._shouldHandleEllipsis(p)&&E<w-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),l&&p+i>f)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(e){const n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,s=i!==Nl&&i!==void 0,o=this.padding(),a=i-o*2;return!(this.wrap()!==$5)||s&&e+r>a}_tryToAddEllipsisToLastLine(){const e=this.attrs.width,n=e!==Nl&&e!==void 0,r=this.padding(),i=e-r*2,s=this.ellipsis(),o=this.textArr[this.textArr.length-1];!o||!s||(n&&(this._getTextWidth(o.text+Ay)<i||(o.text=o.text.slice(0,o.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(o.text+Ay))}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){const e=this.textDecoration().indexOf("underline")!==-1||this.textDecoration().indexOf("line-through")!==-1,n=this.hasShadow();return e&&n?!0:super._useBufferCanvas()}};Ku.Text=Ot;Ot.prototype._fillFunc=az;Ot.prototype._strokeFunc=lz;Ot.prototype.className=Xj;Ot.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"];(0,Kj._registerNode)(Ot);On.Factory.overWriteSetter(Ot,"width",(0,zo.getNumberOrAutoValidator)());On.Factory.overWriteSetter(Ot,"height",(0,zo.getNumberOrAutoValidator)());On.Factory.addGetterSetter(Ot,"direction",Q_);On.Factory.addGetterSetter(Ot,"fontFamily","Arial");On.Factory.addGetterSetter(Ot,"fontSize",12,(0,zo.getNumberValidator)());On.Factory.addGetterSetter(Ot,"fontStyle",J_);On.Factory.addGetterSetter(Ot,"fontVariant",J_);On.Factory.addGetterSetter(Ot,"padding",0,(0,zo.getNumberValidator)());On.Factory.addGetterSetter(Ot,"align",Y_);On.Factory.addGetterSetter(Ot,"verticalAlign",Zj);On.Factory.addGetterSetter(Ot,"lineHeight",1,(0,zo.getNumberValidator)());On.Factory.addGetterSetter(Ot,"wrap",rz);On.Factory.addGetterSetter(Ot,"ellipsis",!1,(0,zo.getBooleanValidator)());On.Factory.addGetterSetter(Ot,"letterSpacing",0,(0,zo.getNumberValidator)());On.Factory.addGetterSetter(Ot,"text","",(0,zo.getStringValidator)());On.Factory.addGetterSetter(Ot,"textDecoration","");var Hg={};Object.defineProperty(Hg,"__esModule",{value:!0});Hg.TextPath=void 0;const Ly=bt,di=Le,cz=Qt,Nc=$u,Iy=Ku,Z_=Se,dz=Ae,hz="",e9="normal";function t9(t){t.fillText(this.partialText,0,0)}function n9(t){t.strokeText(this.partialText,0,0)}class Yt extends cz.Shape{constructor(e){super(e),this.dummyCanvas=Ly.Util.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute(),this._setTextData()}),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva",this._setTextData),this._setTextData()}_getTextPathLength(){return Nc.Path.getPathLength(this.dataArray)}_getPointAtLength(e){if(!this.attrs.data)return null;const n=this.pathLength;return e-1>n?null:Nc.Path.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=Nc.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(e){e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",this.textBaseline()),e.setAttr("textAlign","left"),e.save();const n=this.textDecoration(),r=this.fill(),i=this.fontSize(),s=this.glyphInfo;n==="underline"&&e.beginPath();for(let o=0;o<s.length;o++){e.save();const a=s[o].p0;e.translate(a.x,a.y),e.rotate(s[o].rotation),this.partialText=s[o].text,e.fillStrokeShape(this),n==="underline"&&(o===0&&e.moveTo(0,i/2+1),e.lineTo(i,i/2+1)),e.restore()}n==="underline"&&(e.strokeStyle=r,e.lineWidth=i/20,e.stroke()),e.restore()}_hitFunc(e){e.beginPath();const n=this.glyphInfo;if(n.length>=1){const r=n[0].p0;e.moveTo(r.x,r.y)}for(let r=0;r<n.length;r++){const i=n[r].p1;e.lineTo(i.x,i.y)}e.setAttr("lineWidth",this.fontSize()),e.setAttr("strokeStyle",this.colorKey),e.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return Ly.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(e){return Iy.Text.prototype.setText.call(this,e)}_getContextFont(){return Iy.Text.prototype._getContextFont.call(this)}_getTextSize(e){const r=this.dummyCanvas.getContext("2d");r.save(),r.font=this._getContextFont();const i=r.measureText(e);return r.restore(),{width:i.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){const{width:e,height:n}=this._getTextSize(this.attrs.text);if(this.textWidth=e,this.textHeight=n,this.glyphInfo=[],!this.attrs.data)return null;const r=this.letterSpacing(),i=this.align(),s=this.kerningFunc(),o=Math.max(this.textWidth+((this.attrs.text||"").length-1)*r,0);let a=0;i==="center"&&(a=Math.max(0,this.pathLength/2-o/2)),i==="right"&&(a=Math.max(0,this.pathLength-o));const l=(0,Iy.stringToArray)(this.text());let d=a;for(let h=0;h<l.length;h++){const f=this._getPointAtLength(d);if(!f)return;let p=this._getTextSize(l[h]).width+r;if(l[h]===" "&&i==="justify"){const E=this.text().split(" ").length-1;p+=(this.pathLength-o)/E}const y=this._getPointAtLength(d+p);if(!y)return;const g=Nc.Path.getLineLength(f.x,f.y,y.x,y.y);let x=0;if(s)try{x=s(l[h-1],l[h])*this.fontSize()}catch{x=0}f.x+=x,y.x+=x,this.textWidth+=x;const S=Nc.Path.getPointOnLine(x+g/2,f.x,f.y,y.x,y.y),C=Math.atan2(y.y-f.y,y.x-f.x);this.glyphInfo.push({transposeX:S.x,transposeY:S.y,text:l[h],rotation:C,p0:f,p1:y}),d+=p}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};const e=[];this.glyphInfo.forEach(function(d){e.push(d.p0.x),e.push(d.p0.y),e.push(d.p1.x),e.push(d.p1.y)});let n=e[0]||0,r=e[0]||0,i=e[1]||0,s=e[1]||0,o,a;for(let d=0;d<e.length/2;d++)o=e[d*2],a=e[d*2+1],n=Math.min(n,o),r=Math.max(r,o),i=Math.min(i,a),s=Math.max(s,a);const l=this.fontSize();return{x:n-l/2,y:i-l/2,width:r-n+l,height:s-i+l}}destroy(){return Ly.Util.releaseCanvas(this.dummyCanvas),super.destroy()}}Hg.TextPath=Yt;Yt.prototype._fillFunc=t9;Yt.prototype._strokeFunc=n9;Yt.prototype._fillFuncHit=t9;Yt.prototype._strokeFuncHit=n9;Yt.prototype.className="TextPath";Yt.prototype._attrsAffectingSize=["text","fontSize","data"];(0,dz._registerNode)(Yt);di.Factory.addGetterSetter(Yt,"data");di.Factory.addGetterSetter(Yt,"fontFamily","Arial");di.Factory.addGetterSetter(Yt,"fontSize",12,(0,Z_.getNumberValidator)());di.Factory.addGetterSetter(Yt,"fontStyle",e9);di.Factory.addGetterSetter(Yt,"align","left");di.Factory.addGetterSetter(Yt,"letterSpacing",0,(0,Z_.getNumberValidator)());di.Factory.addGetterSetter(Yt,"textBaseline","middle");di.Factory.addGetterSetter(Yt,"fontVariant",e9);di.Factory.addGetterSetter(Yt,"text",hz);di.Factory.addGetterSetter(Yt,"textDecoration","");di.Factory.addGetterSetter(Yt,"kerningFunc",void 0);var Vg={};Object.defineProperty(Vg,"__esModule",{value:!0});Vg.Transformer=void 0;const Qe=bt,Ge=Le,W5=gt,fz=Qt,pz=yh,K5=Vu,Xr=Ae,Bo=Se,mz=Ae,r9="tr-konva",gz=["resizeEnabledChange","rotateAnchorOffsetChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(t=>t+`.${r9}`).join(" "),q5="nodesRect",yz=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],vz={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},xz="ontouchstart"in Xr.Konva._global;function Sz(t,e,n){if(t==="rotater")return n;e+=Qe.Util.degToRad(vz[t]||0);const r=(Qe.Util.radToDeg(e)%360+360)%360;return Qe.Util._inRange(r,315+22.5,360)||Qe.Util._inRange(r,0,22.5)?"ns-resize":Qe.Util._inRange(r,45-22.5,45+22.5)?"nesw-resize":Qe.Util._inRange(r,90-22.5,90+22.5)?"ew-resize":Qe.Util._inRange(r,135-22.5,135+22.5)?"nwse-resize":Qe.Util._inRange(r,180-22.5,180+22.5)?"ns-resize":Qe.Util._inRange(r,225-22.5,225+22.5)?"nesw-resize":Qe.Util._inRange(r,270-22.5,270+22.5)?"ew-resize":Qe.Util._inRange(r,315-22.5,315+22.5)?"nwse-resize":(Qe.Util.error("Transformer has unknown angle for cursor detection: "+r),"pointer")}const rm=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function wz(t){return{x:t.x+t.width/2*Math.cos(t.rotation)+t.height/2*Math.sin(-t.rotation),y:t.y+t.height/2*Math.cos(t.rotation)+t.width/2*Math.sin(t.rotation)}}function i9(t,e,n){const r=n.x+(t.x-n.x)*Math.cos(e)-(t.y-n.y)*Math.sin(e),i=n.y+(t.x-n.x)*Math.sin(e)+(t.y-n.y)*Math.cos(e);return{...t,rotation:t.rotation+e,x:r,y:i}}function kz(t,e){const n=wz(t);return i9(t,e,n)}function Cz(t,e,n){let r=e;for(let i=0;i<t.length;i++){const s=Xr.Konva.getAngle(t[i]),o=Math.abs(s-e)%(Math.PI*2);Math.min(o,Math.PI*2-o)<n&&(r=s)}return r}let zv=0,ze=class extends K5.Group{constructor(e){super(e),this._movingAnchorName=null,this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(gz,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return Qe.Util.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return r9+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();const n=e.filter(i=>i.isAncestorOf(this)?(Qe.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);return this._nodes=e=n,e.length===1&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(i=>{const s=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()};if(i._attrsAffectingSize.length){const o=i._attrsAffectingSize.map(a=>a+"Change."+this._getEventNamespace()).join(" ");i.on(o,s)}i.on(yz.map(o=>o+`.${this._getEventNamespace()}`).join(" "),s),i.on(`absoluteTransformChange.${this._getEventNamespace()}`,s),this._proxyDrag(i)}),this._resetTransformCache(),!!this.findOne(".top-left")&&this.update(),this}_proxyDrag(e){let n;e.on(`dragstart.${this._getEventNamespace()}`,r=>{n=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(".back")&&this.startDrag(r,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,r=>{if(!n)return;const i=e.getAbsolutePosition(),s=i.x-n.x,o=i.y-n.y;this.nodes().forEach(a=>{if(a===e||a.isDragging())return;const l=a.getAbsolutePosition();a.setAbsolutePosition({x:l.x+s,y:l.y+o}),a.startDrag(r)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(e=>{e.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(q5),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(q5,this.__getNodeRect)}__getNodeShape(e,n=this.rotation(),r){const i=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),s=e.getAbsoluteScale(r),o=e.getAbsolutePosition(r),a=i.x*s.x-e.offsetX()*s.x,l=i.y*s.y-e.offsetY()*s.y,d=(Xr.Konva.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),h={x:o.x+a*Math.cos(d)+l*Math.sin(-d),y:o.y+l*Math.cos(d)+a*Math.sin(d),width:i.width*s.x,height:i.height*s.y,rotation:d};return i9(h,-Xr.Konva.getAngle(n),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};const n=[];this.nodes().map(d=>{const h=d.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),f=[{x:h.x,y:h.y},{x:h.x+h.width,y:h.y},{x:h.x+h.width,y:h.y+h.height},{x:h.x,y:h.y+h.height}],p=d.getAbsoluteTransform();f.forEach(function(y){const g=p.point(y);n.push(g)})});const r=new Qe.Transform;r.rotate(-Xr.Konva.getAngle(this.rotation()));let i=1/0,s=1/0,o=-1/0,a=-1/0;n.forEach(function(d){const h=r.point(d);i===void 0&&(i=o=h.x,s=a=h.y),i=Math.min(i,h.x),s=Math.min(s,h.y),o=Math.max(o,h.x),a=Math.max(a,h.y)}),r.invert();const l=r.point({x:i,y:s});return{x:l.x,y:l.y,width:o-i,height:a-s,rotation:Xr.Konva.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),rm.forEach(e=>{this._createAnchor(e)}),this._createAnchor("rotater")}_createAnchor(e){const n=new pz.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:xz?10:"auto"}),r=this;n.on("mousedown touchstart",function(i){r._handleMouseDown(i)}),n.on("dragstart",i=>{n.stopDrag(),i.cancelBubble=!0}),n.on("dragend",i=>{i.cancelBubble=!0}),n.on("mouseenter",()=>{const i=Xr.Konva.getAngle(this.rotation()),s=this.rotateAnchorCursor(),o=Sz(e,i,s);n.getStage().content&&(n.getStage().content.style.cursor=o),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){const e=new fz.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(n,r){const i=r.getParent(),s=i.padding();n.beginPath(),n.rect(-s,-s,r.width()+s*2,r.height()+s*2),n.moveTo(r.width()/2,-s),i.rotateEnabled()&&i.rotateLineVisible()&&n.lineTo(r.width()/2,-i.rotateAnchorOffset()*Qe.Util._sign(r.height())-s),n.fillStrokeShape(r)},hitFunc:(n,r)=>{if(!this.shouldOverdrawWholeArea())return;const i=this.padding();n.beginPath(),n.rect(-i,-i,r.width()+i*2,r.height()+i*2),n.fillStrokeShape(r)}});this.add(e),this._proxyDrag(e),e.on("dragstart",n=>{n.cancelBubble=!0}),e.on("dragmove",n=>{n.cancelBubble=!0}),e.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(e){if(this._transforming)return;this._movingAnchorName=e.target.name().split(" ")[0];const n=this._getNodeRect(),r=n.width,i=n.height,s=Math.sqrt(Math.pow(r,2)+Math.pow(i,2));this.sin=Math.abs(i/s),this.cos=Math.abs(r/s),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;const o=e.target.getAbsolutePosition(),a=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:a.x-o.x,y:a.y-o.y},zv++,this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach(l=>{l._fire("transformstart",{evt:e.evt,target:l})})}_handleMouseMove(e){let n,r,i;const s=this.findOne("."+this._movingAnchorName),o=s.getStage();o.setPointersPositions(e);const a=o.getPointerPosition();let l={x:a.x-this._anchorDragOffset.x,y:a.y-this._anchorDragOffset.y};const d=s.getAbsolutePosition();this.anchorDragBoundFunc()&&(l=this.anchorDragBoundFunc()(d,l,e)),s.setAbsolutePosition(l);const h=s.getAbsolutePosition();if(d.x===h.x&&d.y===h.y)return;if(this._movingAnchorName==="rotater"){const E=this._getNodeRect();n=s.x()-E.width/2,r=-s.y()+E.height/2;let w=Math.atan2(-r,n)+Math.PI/2;E.height<0&&(w-=Math.PI);const T=Xr.Konva.getAngle(this.rotation())+w,P=Xr.Konva.getAngle(this.rotationSnapTolerance()),M=Cz(this.rotationSnaps(),T,P)-E.rotation,I=kz(E,M);this._fitNodesInto(I,e);return}const f=this.shiftBehavior();let p;f==="inverted"?p=this.keepRatio()&&!e.shiftKey:f==="none"?p=this.keepRatio():p=this.keepRatio()||e.shiftKey;let y=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(p){const E=y?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};i=Math.sqrt(Math.pow(E.x-s.x(),2)+Math.pow(E.y-s.y(),2));const w=this.findOne(".top-left").x()>E.x?-1:1,b=this.findOne(".top-left").y()>E.y?-1:1;n=i*this.cos*w,r=i*this.sin*b,this.findOne(".top-left").x(E.x-n),this.findOne(".top-left").y(E.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(s.y());else if(this._movingAnchorName==="top-right"){if(p){const E=y?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};i=Math.sqrt(Math.pow(s.x()-E.x,2)+Math.pow(E.y-s.y(),2));const w=this.findOne(".top-right").x()<E.x?-1:1,b=this.findOne(".top-right").y()>E.y?-1:1;n=i*this.cos*w,r=i*this.sin*b,this.findOne(".top-right").x(E.x+n),this.findOne(".top-right").y(E.y-r)}var g=s.position();this.findOne(".top-left").y(g.y),this.findOne(".bottom-right").x(g.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(s.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(s.x());else if(this._movingAnchorName==="bottom-left"){if(p){const E=y?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};i=Math.sqrt(Math.pow(E.x-s.x(),2)+Math.pow(s.y()-E.y,2));const w=E.x<s.x()?-1:1,b=s.y()<E.y?-1:1;n=i*this.cos*w,r=i*this.sin*b,s.x(E.x-n),s.y(E.y+r)}g=s.position(),this.findOne(".top-left").x(g.x),this.findOne(".bottom-right").y(g.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(s.y());else if(this._movingAnchorName==="bottom-right"){if(p){const E=y?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};i=Math.sqrt(Math.pow(s.x()-E.x,2)+Math.pow(s.y()-E.y,2));const w=this.findOne(".bottom-right").x()<E.x?-1:1,b=this.findOne(".bottom-right").y()<E.y?-1:1;n=i*this.cos*w,r=i*this.sin*b,this.findOne(".bottom-right").x(E.x+n),this.findOne(".bottom-right").y(E.y+r)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(y=this.centeredScaling()||e.altKey,y){const E=this.findOne(".top-left"),w=this.findOne(".bottom-right"),b=E.x(),T=E.y(),P=this.getWidth()-w.x(),A=this.getHeight()-w.y();w.move({x:-b,y:-T}),E.move({x:P,y:A})}const x=this.findOne(".top-left").getAbsolutePosition();n=x.x,r=x.y;const S=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),C=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:n,y:r,width:S,height:C,rotation:Xr.Konva.getAngle(this.rotation())},e)}_handleMouseUp(e){this._removeEvents(e)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(e){var n;if(this._transforming){this._transforming=!1,typeof window<"u"&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));const r=this.getNode();zv--,this._fire("transformend",{evt:e,target:r}),(n=this.getLayer())===null||n===void 0||n.batchDraw(),r&&this._nodes.forEach(i=>{var s;i._fire("transformend",{evt:e,target:i}),(s=i.getLayer())===null||s===void 0||s.batchDraw()}),this._movingAnchorName=null}}_fitNodesInto(e,n){const r=this._getNodeRect(),i=1;if(Qe.Util._inRange(e.width,-this.padding()*2-i,i)){this.update();return}if(Qe.Util._inRange(e.height,-this.padding()*2-i,i)){this.update();return}const s=new Qe.Transform;if(s.rotate(Xr.Konva.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const p=s.point({x:-this.padding()*2,y:0});e.x+=p.x,e.y+=p.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const p=s.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.width+=this.padding()*2}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const p=s.point({x:0,y:-this.padding()*2});e.x+=p.x,e.y+=p.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.height+=this.padding()*2}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const p=s.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.height+=this.padding()*2}if(this.boundBoxFunc()){const p=this.boundBoxFunc()(r,e);p?e=p:Qe.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const o=1e7,a=new Qe.Transform;a.translate(r.x,r.y),a.rotate(r.rotation),a.scale(r.width/o,r.height/o);const l=new Qe.Transform,d=e.width/o,h=e.height/o;this.flipEnabled()===!1?(l.translate(e.x,e.y),l.rotate(e.rotation),l.translate(e.width<0?e.width:0,e.height<0?e.height:0),l.scale(Math.abs(d),Math.abs(h))):(l.translate(e.x,e.y),l.rotate(e.rotation),l.scale(d,h));const f=l.multiply(a.invert());this._nodes.forEach(p=>{var y;const g=p.getParent().getAbsoluteTransform(),x=p.getTransform().copy();x.translate(p.offsetX(),p.offsetY());const S=new Qe.Transform;S.multiply(g.copy().invert()).multiply(f).multiply(g).multiply(x);const C=S.decompose();p.setAttrs(C),(y=p.getLayer())===null||y===void 0||y.batchDraw()}),this.rotation(Qe.Util._getRotation(e.rotation)),this._nodes.forEach(p=>{this._fire("transform",{evt:n,target:p}),p._fire("transform",{evt:n,target:p})}),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,n){this.findOne(e).setAttrs(n)}update(){var e;const n=this._getNodeRect();this.rotation(Qe.Util._getRotation(n.rotation));const r=n.width,i=n.height,s=this.enabledAnchors(),o=this.resizeEnabled(),a=this.padding(),l=this.anchorSize(),d=this.find("._anchor");d.forEach(f=>{f.setAttrs({width:l,height:l,offsetX:l/2,offsetY:l/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:l/2+a,offsetY:l/2+a,visible:o&&s.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:l/2+a,visible:o&&s.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:l/2-a,offsetY:l/2+a,visible:o&&s.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:l/2+a,visible:o&&s.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:l/2-a,visible:o&&s.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:l/2+a,offsetY:l/2-a,visible:o&&s.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:l/2-a,visible:o&&s.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:l/2-a,offsetY:l/2-a,visible:o&&s.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*Qe.Util._sign(i)-a,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:r,height:i,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const h=this.anchorStyleFunc();h&&d.forEach(f=>{h(f)}),(e=this.getLayer())===null||e===void 0||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();const e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),K5.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return W5.Node.prototype.toObject.call(this)}clone(e){return W5.Node.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};Vg.Transformer=ze;ze.isTransforming=()=>zv>0;function bz(t){return t instanceof Array||Qe.Util.warn("enabledAnchors value should be an array"),t instanceof Array&&t.forEach(function(e){rm.indexOf(e)===-1&&Qe.Util.warn("Unknown anchor name: "+e+". Available names are: "+rm.join(", "))}),t||[]}ze.prototype.className="Transformer";(0,mz._registerNode)(ze);Ge.Factory.addGetterSetter(ze,"enabledAnchors",rm,bz);Ge.Factory.addGetterSetter(ze,"flipEnabled",!0,(0,Bo.getBooleanValidator)());Ge.Factory.addGetterSetter(ze,"resizeEnabled",!0);Ge.Factory.addGetterSetter(ze,"anchorSize",10,(0,Bo.getNumberValidator)());Ge.Factory.addGetterSetter(ze,"rotateEnabled",!0);Ge.Factory.addGetterSetter(ze,"rotateLineVisible",!0);Ge.Factory.addGetterSetter(ze,"rotationSnaps",[]);Ge.Factory.addGetterSetter(ze,"rotateAnchorOffset",50,(0,Bo.getNumberValidator)());Ge.Factory.addGetterSetter(ze,"rotateAnchorCursor","crosshair");Ge.Factory.addGetterSetter(ze,"rotationSnapTolerance",5,(0,Bo.getNumberValidator)());Ge.Factory.addGetterSetter(ze,"borderEnabled",!0);Ge.Factory.addGetterSetter(ze,"anchorStroke","rgb(0, 161, 255)");Ge.Factory.addGetterSetter(ze,"anchorStrokeWidth",1,(0,Bo.getNumberValidator)());Ge.Factory.addGetterSetter(ze,"anchorFill","white");Ge.Factory.addGetterSetter(ze,"anchorCornerRadius",0,(0,Bo.getNumberValidator)());Ge.Factory.addGetterSetter(ze,"borderStroke","rgb(0, 161, 255)");Ge.Factory.addGetterSetter(ze,"borderStrokeWidth",1,(0,Bo.getNumberValidator)());Ge.Factory.addGetterSetter(ze,"borderDash");Ge.Factory.addGetterSetter(ze,"keepRatio",!0);Ge.Factory.addGetterSetter(ze,"shiftBehavior","default");Ge.Factory.addGetterSetter(ze,"centeredScaling",!1);Ge.Factory.addGetterSetter(ze,"ignoreStroke",!1);Ge.Factory.addGetterSetter(ze,"padding",0,(0,Bo.getNumberValidator)());Ge.Factory.addGetterSetter(ze,"nodes");Ge.Factory.addGetterSetter(ze,"node");Ge.Factory.addGetterSetter(ze,"boundBoxFunc");Ge.Factory.addGetterSetter(ze,"anchorDragBoundFunc");Ge.Factory.addGetterSetter(ze,"anchorStyleFunc");Ge.Factory.addGetterSetter(ze,"shouldOverdrawWholeArea",!1);Ge.Factory.addGetterSetter(ze,"useSingleNodeRotation",!0);Ge.Factory.backCompat(ze,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var Gg={};Object.defineProperty(Gg,"__esModule",{value:!0});Gg.Wedge=void 0;const $g=Le,Ez=Qt,_z=Ae,s9=Se,Nz=Ae;class Cs extends Ez.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,_z.Konva.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}Gg.Wedge=Cs;Cs.prototype.className="Wedge";Cs.prototype._centroid=!0;Cs.prototype._attrsAffectingSize=["radius"];(0,Nz._registerNode)(Cs);$g.Factory.addGetterSetter(Cs,"radius",0,(0,s9.getNumberValidator)());$g.Factory.addGetterSetter(Cs,"angle",0,(0,s9.getNumberValidator)());$g.Factory.addGetterSetter(Cs,"clockwise",!1);$g.Factory.backCompat(Cs,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var Wg={};Object.defineProperty(Wg,"__esModule",{value:!0});Wg.Blur=void 0;const Q5=Le,Tz=gt,Mz=Se;function Y5(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}const Pz=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],Oz=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function Az(t,e){const n=t.data,r=t.width,i=t.height;let s,o,a,l,d,h,f,p,y,g,x,S,C,E,w,b,T,P,A,M;const I=e+e+1,R=r-1,U=i-1,B=e+1,$=B*(B+1)/2,Q=new Y5,q=Pz[e],ie=Oz[e];let fe=null,W=Q,re=null,te=null;for(let Y=1;Y<I;Y++)W=W.next=new Y5,Y===B&&(fe=W);W.next=Q,a=o=0;for(let Y=0;Y<i;Y++){S=C=E=w=l=d=h=f=0,p=B*(b=n[o]),y=B*(T=n[o+1]),g=B*(P=n[o+2]),x=B*(A=n[o+3]),l+=$*b,d+=$*T,h+=$*P,f+=$*A,W=Q;for(let oe=0;oe<B;oe++)W.r=b,W.g=T,W.b=P,W.a=A,W=W.next;for(let oe=1;oe<B;oe++)s=o+((R<oe?R:oe)<<2),l+=(W.r=b=n[s])*(M=B-oe),d+=(W.g=T=n[s+1])*M,h+=(W.b=P=n[s+2])*M,f+=(W.a=A=n[s+3])*M,S+=b,C+=T,E+=P,w+=A,W=W.next;re=Q,te=fe;for(let oe=0;oe<r;oe++)n[o+3]=A=f*q>>ie,A!==0?(A=255/A,n[o]=(l*q>>ie)*A,n[o+1]=(d*q>>ie)*A,n[o+2]=(h*q>>ie)*A):n[o]=n[o+1]=n[o+2]=0,l-=p,d-=y,h-=g,f-=x,p-=re.r,y-=re.g,g-=re.b,x-=re.a,s=a+((s=oe+e+1)<R?s:R)<<2,S+=re.r=n[s],C+=re.g=n[s+1],E+=re.b=n[s+2],w+=re.a=n[s+3],l+=S,d+=C,h+=E,f+=w,re=re.next,p+=b=te.r,y+=T=te.g,g+=P=te.b,x+=A=te.a,S-=b,C-=T,E-=P,w-=A,te=te.next,o+=4;a+=r}for(let Y=0;Y<r;Y++){C=E=w=S=d=h=f=l=0,o=Y<<2,p=B*(b=n[o]),y=B*(T=n[o+1]),g=B*(P=n[o+2]),x=B*(A=n[o+3]),l+=$*b,d+=$*T,h+=$*P,f+=$*A,W=Q;for(let _e=0;_e<B;_e++)W.r=b,W.g=T,W.b=P,W.a=A,W=W.next;let oe=r;for(let _e=1;_e<=e;_e++)o=oe+Y<<2,l+=(W.r=b=n[o])*(M=B-_e),d+=(W.g=T=n[o+1])*M,h+=(W.b=P=n[o+2])*M,f+=(W.a=A=n[o+3])*M,S+=b,C+=T,E+=P,w+=A,W=W.next,_e<U&&(oe+=r);o=Y,re=Q,te=fe;for(let _e=0;_e<i;_e++)s=o<<2,n[s+3]=A=f*q>>ie,A>0?(A=255/A,n[s]=(l*q>>ie)*A,n[s+1]=(d*q>>ie)*A,n[s+2]=(h*q>>ie)*A):n[s]=n[s+1]=n[s+2]=0,l-=p,d-=y,h-=g,f-=x,p-=re.r,y-=re.g,g-=re.b,x-=re.a,s=Y+((s=_e+B)<U?s:U)*r<<2,l+=S+=re.r=n[s],d+=C+=re.g=n[s+1],h+=E+=re.b=n[s+2],f+=w+=re.a=n[s+3],re=re.next,p+=b=te.r,y+=T=te.g,g+=P=te.b,x+=A=te.a,S-=b,C-=T,E-=P,w-=A,te=te.next,o+=r}}const Rz=function(e){const n=Math.round(this.blurRadius());n>0&&Az(e,n)};Wg.Blur=Rz;Q5.Factory.addGetterSetter(Tz.Node,"blurRadius",0,(0,Mz.getNumberValidator)(),Q5.Factory.afterSetFilter);var Kg={};Object.defineProperty(Kg,"__esModule",{value:!0});Kg.Brighten=void 0;const J5=Le,Lz=gt,Iz=Se,Dz=function(t){const e=this.brightness()*255,n=t.data,r=n.length;for(let i=0;i<r;i+=4)n[i]+=e,n[i+1]+=e,n[i+2]+=e};Kg.Brighten=Dz;J5.Factory.addGetterSetter(Lz.Node,"brightness",0,(0,Iz.getNumberValidator)(),J5.Factory.afterSetFilter);var qg={};Object.defineProperty(qg,"__esModule",{value:!0});qg.Contrast=void 0;const X5=Le,Fz=gt,jz=Se,zz=function(t){const e=Math.pow((this.contrast()+100)/100,2),n=t.data,r=n.length;let i=150,s=150,o=150;for(let a=0;a<r;a+=4)i=n[a],s=n[a+1],o=n[a+2],i/=255,i-=.5,i*=e,i+=.5,i*=255,s/=255,s-=.5,s*=e,s+=.5,s*=255,o/=255,o-=.5,o*=e,o+=.5,o*=255,i=i<0?0:i>255?255:i,s=s<0?0:s>255?255:s,o=o<0?0:o>255?255:o,n[a]=i,n[a+1]=s,n[a+2]=o};qg.Contrast=zz;X5.Factory.addGetterSetter(Fz.Node,"contrast",0,(0,jz.getNumberValidator)(),X5.Factory.afterSetFilter);var Qg={};Object.defineProperty(Qg,"__esModule",{value:!0});Qg.Emboss=void 0;const Mo=Le,Yg=gt,Bz=bt,o9=Se,Uz=function(t){const e=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),s=t.data,o=t.width,a=t.height,l=o*4;let d=0,h=0,f=a;switch(r){case"top-left":d=-1,h=-1;break;case"top":d=-1,h=0;break;case"top-right":d=-1,h=1;break;case"right":d=0,h=1;break;case"bottom-right":d=1,h=1;break;case"bottom":d=1,h=0;break;case"bottom-left":d=1,h=-1;break;case"left":d=0,h=-1;break;default:Bz.Util.error("Unknown emboss direction: "+r)}do{const p=(f-1)*l;let y=d;f+y<1&&(y=0),f+y>a&&(y=0);const g=(f-1+y)*o*4;let x=o;do{const S=p+(x-1)*4;let C=h;x+C<1&&(C=0),x+C>o&&(C=0);const E=g+(x-1+C)*4,w=s[S]-s[E],b=s[S+1]-s[E+1],T=s[S+2]-s[E+2];let P=w;const A=P>0?P:-P,M=b>0?b:-b,I=T>0?T:-T;if(M>A&&(P=b),I>A&&(P=T),P*=e,i){const R=s[S]+P,U=s[S+1]+P,B=s[S+2]+P;s[S]=R>255?255:R<0?0:R,s[S+1]=U>255?255:U<0?0:U,s[S+2]=B>255?255:B<0?0:B}else{let R=n-P;R<0?R=0:R>255&&(R=255),s[S]=s[S+1]=s[S+2]=R}}while(--x)}while(--f)};Qg.Emboss=Uz;Mo.Factory.addGetterSetter(Yg.Node,"embossStrength",.5,(0,o9.getNumberValidator)(),Mo.Factory.afterSetFilter);Mo.Factory.addGetterSetter(Yg.Node,"embossWhiteLevel",.5,(0,o9.getNumberValidator)(),Mo.Factory.afterSetFilter);Mo.Factory.addGetterSetter(Yg.Node,"embossDirection","top-left",void 0,Mo.Factory.afterSetFilter);Mo.Factory.addGetterSetter(Yg.Node,"embossBlend",!1,void 0,Mo.Factory.afterSetFilter);var Jg={};Object.defineProperty(Jg,"__esModule",{value:!0});Jg.Enhance=void 0;const Z5=Le,Hz=gt,Vz=Se;function Dy(t,e,n,r,i){const s=n-e,o=i-r;if(s===0)return r+o/2;if(o===0)return r;let a=(t-e)/s;return a=o*a+r,a}const Gz=function(t){const e=t.data,n=e.length;let r=e[0],i=r,s,o=e[1],a=o,l,d=e[2],h=d,f;const p=this.enhance();if(p===0)return;for(let w=0;w<n;w+=4)s=e[w+0],s<r?r=s:s>i&&(i=s),l=e[w+1],l<o?o=l:l>a&&(a=l),f=e[w+2],f<d?d=f:f>h&&(h=f);i===r&&(i=255,r=0),a===o&&(a=255,o=0),h===d&&(h=255,d=0);let y,g,x,S,C,E;if(p>0)y=i+p*(255-i),g=r-p*(r-0),x=a+p*(255-a),S=o-p*(o-0),C=h+p*(255-h),E=d-p*(d-0);else{const w=(i+r)*.5;y=i+p*(i-w),g=r+p*(r-w);const b=(a+o)*.5;x=a+p*(a-b),S=o+p*(o-b);const T=(h+d)*.5;C=h+p*(h-T),E=d+p*(d-T)}for(let w=0;w<n;w+=4)e[w+0]=Dy(e[w+0],r,i,g,y),e[w+1]=Dy(e[w+1],o,a,S,x),e[w+2]=Dy(e[w+2],d,h,E,C)};Jg.Enhance=Gz;Z5.Factory.addGetterSetter(Hz.Node,"enhance",0,(0,Vz.getNumberValidator)(),Z5.Factory.afterSetFilter);var Xg={};Object.defineProperty(Xg,"__esModule",{value:!0});Xg.Grayscale=void 0;const $z=function(t){const e=t.data,n=e.length;for(let r=0;r<n;r+=4){const i=.34*e[r]+.5*e[r+1]+.16*e[r+2];e[r]=i,e[r+1]=i,e[r+2]=i}};Xg.Grayscale=$z;var Zg={};Object.defineProperty(Zg,"__esModule",{value:!0});Zg.HSL=void 0;const Eu=Le,zS=gt,BS=Se;Eu.Factory.addGetterSetter(zS.Node,"hue",0,(0,BS.getNumberValidator)(),Eu.Factory.afterSetFilter);Eu.Factory.addGetterSetter(zS.Node,"saturation",0,(0,BS.getNumberValidator)(),Eu.Factory.afterSetFilter);Eu.Factory.addGetterSetter(zS.Node,"luminance",0,(0,BS.getNumberValidator)(),Eu.Factory.afterSetFilter);const Wz=function(t){const e=t.data,n=e.length,r=1,i=Math.pow(2,this.saturation()),s=Math.abs(this.hue()+360)%360,o=this.luminance()*127,a=r*i*Math.cos(s*Math.PI/180),l=r*i*Math.sin(s*Math.PI/180),d=.299*r+.701*a+.167*l,h=.587*r-.587*a+.33*l,f=.114*r-.114*a-.497*l,p=.299*r-.299*a-.328*l,y=.587*r+.413*a+.035*l,g=.114*r-.114*a+.293*l,x=.299*r-.3*a+1.25*l,S=.587*r-.586*a-1.05*l,C=.114*r+.886*a-.2*l;let E,w,b,T;for(let P=0;P<n;P+=4)E=e[P+0],w=e[P+1],b=e[P+2],T=e[P+3],e[P+0]=d*E+h*w+f*b+o,e[P+1]=p*E+y*w+g*b+o,e[P+2]=x*E+S*w+C*b+o,e[P+3]=T};Zg.HSL=Wz;var e0={};Object.defineProperty(e0,"__esModule",{value:!0});e0.HSV=void 0;const _u=Le,US=gt,HS=Se,Kz=function(t){const e=t.data,n=e.length,r=Math.pow(2,this.value()),i=Math.pow(2,this.saturation()),s=Math.abs(this.hue()+360)%360,o=r*i*Math.cos(s*Math.PI/180),a=r*i*Math.sin(s*Math.PI/180),l=.299*r+.701*o+.167*a,d=.587*r-.587*o+.33*a,h=.114*r-.114*o-.497*a,f=.299*r-.299*o-.328*a,p=.587*r+.413*o+.035*a,y=.114*r-.114*o+.293*a,g=.299*r-.3*o+1.25*a,x=.587*r-.586*o-1.05*a,S=.114*r+.886*o-.2*a;for(let C=0;C<n;C+=4){const E=e[C+0],w=e[C+1],b=e[C+2],T=e[C+3];e[C+0]=l*E+d*w+h*b,e[C+1]=f*E+p*w+y*b,e[C+2]=g*E+x*w+S*b,e[C+3]=T}};e0.HSV=Kz;_u.Factory.addGetterSetter(US.Node,"hue",0,(0,HS.getNumberValidator)(),_u.Factory.afterSetFilter);_u.Factory.addGetterSetter(US.Node,"saturation",0,(0,HS.getNumberValidator)(),_u.Factory.afterSetFilter);_u.Factory.addGetterSetter(US.Node,"value",0,(0,HS.getNumberValidator)(),_u.Factory.afterSetFilter);var t0={};Object.defineProperty(t0,"__esModule",{value:!0});t0.Invert=void 0;const qz=function(t){const e=t.data,n=e.length;for(let r=0;r<n;r+=4)e[r]=255-e[r],e[r+1]=255-e[r+1],e[r+2]=255-e[r+2]};t0.Invert=qz;var n0={};Object.defineProperty(n0,"__esModule",{value:!0});n0.Kaleidoscope=void 0;const im=Le,a9=gt,eC=bt,l9=Se,Qz=function(t,e,n){const r=t.data,i=e.data,s=t.width,o=t.height,a=n.polarCenterX||s/2,l=n.polarCenterY||o/2;let d=Math.sqrt(a*a+l*l),h=s-a,f=o-l;const p=Math.sqrt(h*h+f*f);d=p>d?p:d;const y=o,g=s,x=360/g*Math.PI/180;for(let S=0;S<g;S+=1){const C=Math.sin(S*x),E=Math.cos(S*x);for(let w=0;w<y;w+=1){h=Math.floor(a+d*w/y*E),f=Math.floor(l+d*w/y*C);let b=(f*s+h)*4;const T=r[b+0],P=r[b+1],A=r[b+2],M=r[b+3];b=(S+w*s)*4,i[b+0]=T,i[b+1]=P,i[b+2]=A,i[b+3]=M}}},Yz=function(t,e,n){const r=t.data,i=e.data,s=t.width,o=t.height,a=n.polarCenterX||s/2,l=n.polarCenterY||o/2;let d=Math.sqrt(a*a+l*l),h=s-a,f=o-l;const p=Math.sqrt(h*h+f*f);d=p>d?p:d;const y=o,g=s,x=0;let S,C;for(h=0;h<s;h+=1)for(f=0;f<o;f+=1){const E=h-a,w=f-l,b=Math.sqrt(E*E+w*w)*y/d;let T=(Math.atan2(w,E)*180/Math.PI+360+x)%360;T=T*g/360,S=Math.floor(T),C=Math.floor(b);let P=(C*s+S)*4;const A=r[P+0],M=r[P+1],I=r[P+2],R=r[P+3];P=(f*s+h)*4,i[P+0]=A,i[P+1]=M,i[P+2]=I,i[P+3]=R}},Jz=function(t){const e=t.width,n=t.height;let r,i,s,o,a,l,d,h,f,p,y=Math.round(this.kaleidoscopePower());const g=Math.round(this.kaleidoscopeAngle()),x=Math.floor(e*(g%360)/360);if(y<1)return;const S=eC.Util.createCanvasElement();S.width=e,S.height=n;const C=S.getContext("2d").getImageData(0,0,e,n);eC.Util.releaseCanvas(S),Qz(t,C,{polarCenterX:e/2,polarCenterY:n/2});let E=e/Math.pow(2,y);for(;E<=8;)E=E*2,y-=1;E=Math.ceil(E);let w=E,b=0,T=w,P=1;for(x+E>e&&(b=w,T=0,P=-1),i=0;i<n;i+=1)for(r=b;r!==T;r+=P)s=Math.round(r+x)%e,f=(e*i+s)*4,a=C.data[f+0],l=C.data[f+1],d=C.data[f+2],h=C.data[f+3],p=(e*i+r)*4,C.data[p+0]=a,C.data[p+1]=l,C.data[p+2]=d,C.data[p+3]=h;for(i=0;i<n;i+=1)for(w=Math.floor(E),o=0;o<y;o+=1){for(r=0;r<w+1;r+=1)f=(e*i+r)*4,a=C.data[f+0],l=C.data[f+1],d=C.data[f+2],h=C.data[f+3],p=(e*i+w*2-r-1)*4,C.data[p+0]=a,C.data[p+1]=l,C.data[p+2]=d,C.data[p+3]=h;w*=2}Yz(C,t,{})};n0.Kaleidoscope=Jz;im.Factory.addGetterSetter(a9.Node,"kaleidoscopePower",2,(0,l9.getNumberValidator)(),im.Factory.afterSetFilter);im.Factory.addGetterSetter(a9.Node,"kaleidoscopeAngle",0,(0,l9.getNumberValidator)(),im.Factory.afterSetFilter);var r0={};Object.defineProperty(r0,"__esModule",{value:!0});r0.Mask=void 0;const tC=Le,Xz=gt,Zz=Se;function Uf(t,e,n){let r=(n*t.width+e)*4;const i=[];return i.push(t.data[r++],t.data[r++],t.data[r++],t.data[r++]),i}function Tc(t,e){return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2))}function eB(t){const e=[0,0,0];for(let n=0;n<t.length;n++)e[0]+=t[n][0],e[1]+=t[n][1],e[2]+=t[n][2];return e[0]/=t.length,e[1]/=t.length,e[2]/=t.length,e}function tB(t,e){const n=Uf(t,0,0),r=Uf(t,t.width-1,0),i=Uf(t,0,t.height-1),s=Uf(t,t.width-1,t.height-1),o=e||10;if(Tc(n,r)<o&&Tc(r,s)<o&&Tc(s,i)<o&&Tc(i,n)<o){const a=eB([r,n,s,i]),l=[];for(let d=0;d<t.width*t.height;d++){const h=Tc(a,[t.data[d*4],t.data[d*4+1],t.data[d*4+2]]);l[d]=h<o?0:255}return l}}function nB(t,e){for(let n=0;n<t.width*t.height;n++)t.data[4*n+3]=e[n]}function rB(t,e,n){const r=[1,1,1,1,0,1,1,1,1],i=Math.round(Math.sqrt(r.length)),s=Math.floor(i/2),o=[];for(let a=0;a<n;a++)for(let l=0;l<e;l++){const d=a*e+l;let h=0;for(let f=0;f<i;f++)for(let p=0;p<i;p++){const y=a+f-s,g=l+p-s;if(y>=0&&y<n&&g>=0&&g<e){const x=y*e+g,S=r[f*i+p];h+=t[x]*S}}o[d]=h===255*8?255:0}return o}function iB(t,e,n){const r=[1,1,1,1,1,1,1,1,1],i=Math.round(Math.sqrt(r.length)),s=Math.floor(i/2),o=[];for(let a=0;a<n;a++)for(let l=0;l<e;l++){const d=a*e+l;let h=0;for(let f=0;f<i;f++)for(let p=0;p<i;p++){const y=a+f-s,g=l+p-s;if(y>=0&&y<n&&g>=0&&g<e){const x=y*e+g,S=r[f*i+p];h+=t[x]*S}}o[d]=h>=255*4?255:0}return o}function sB(t,e,n){const r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(r.length)),s=Math.floor(i/2),o=[];for(let a=0;a<n;a++)for(let l=0;l<e;l++){const d=a*e+l;let h=0;for(let f=0;f<i;f++)for(let p=0;p<i;p++){const y=a+f-s,g=l+p-s;if(y>=0&&y<n&&g>=0&&g<e){const x=y*e+g,S=r[f*i+p];h+=t[x]*S}}o[d]=h}return o}const oB=function(t){const e=this.threshold();let n=tB(t,e);return n&&(n=rB(n,t.width,t.height),n=iB(n,t.width,t.height),n=sB(n,t.width,t.height),nB(t,n)),t};r0.Mask=oB;tC.Factory.addGetterSetter(Xz.Node,"threshold",0,(0,Zz.getNumberValidator)(),tC.Factory.afterSetFilter);var i0={};Object.defineProperty(i0,"__esModule",{value:!0});i0.Noise=void 0;const nC=Le,aB=gt,lB=Se,uB=function(t){const e=this.noise()*255,n=t.data,r=n.length,i=e/2;for(let s=0;s<r;s+=4)n[s+0]+=i-2*i*Math.random(),n[s+1]+=i-2*i*Math.random(),n[s+2]+=i-2*i*Math.random()};i0.Noise=uB;nC.Factory.addGetterSetter(aB.Node,"noise",.2,(0,lB.getNumberValidator)(),nC.Factory.afterSetFilter);var s0={};Object.defineProperty(s0,"__esModule",{value:!0});s0.Pixelate=void 0;const rC=Le,cB=bt,dB=gt,hB=Se,fB=function(t){let e=Math.ceil(this.pixelSize()),n=t.width,r=t.height,i=Math.ceil(n/e),s=Math.ceil(r/e),o=t.data;if(e<=0){cB.Util.error("pixelSize value can not be <= 0");return}for(let a=0;a<i;a+=1)for(let l=0;l<s;l+=1){let d=0,h=0,f=0,p=0;const y=a*e,g=y+e,x=l*e,S=x+e;let C=0;for(let E=y;E<g;E+=1)if(!(E>=n))for(let w=x;w<S;w+=1){if(w>=r)continue;const b=(n*w+E)*4;d+=o[b+0],h+=o[b+1],f+=o[b+2],p+=o[b+3],C+=1}d=d/C,h=h/C,f=f/C,p=p/C;for(let E=y;E<g;E+=1)if(!(E>=n))for(let w=x;w<S;w+=1){if(w>=r)continue;const b=(n*w+E)*4;o[b+0]=d,o[b+1]=h,o[b+2]=f,o[b+3]=p}}};s0.Pixelate=fB;rC.Factory.addGetterSetter(dB.Node,"pixelSize",8,(0,hB.getNumberValidator)(),rC.Factory.afterSetFilter);var o0={};Object.defineProperty(o0,"__esModule",{value:!0});o0.Posterize=void 0;const iC=Le,pB=gt,mB=Se,gB=function(t){const e=Math.round(this.levels()*254)+1,n=t.data,r=n.length,i=255/e;for(let s=0;s<r;s+=1)n[s]=Math.floor(n[s]/i)*i};o0.Posterize=gB;iC.Factory.addGetterSetter(pB.Node,"levels",.5,(0,mB.getNumberValidator)(),iC.Factory.afterSetFilter);var a0={};Object.defineProperty(a0,"__esModule",{value:!0});a0.RGB=void 0;const sm=Le,VS=gt,yB=Se,vB=function(t){const e=t.data,n=e.length,r=this.red(),i=this.green(),s=this.blue();for(let o=0;o<n;o+=4){const a=(.34*e[o]+.5*e[o+1]+.16*e[o+2])/255;e[o]=a*r,e[o+1]=a*i,e[o+2]=a*s,e[o+3]=e[o+3]}};a0.RGB=vB;sm.Factory.addGetterSetter(VS.Node,"red",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});sm.Factory.addGetterSetter(VS.Node,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});sm.Factory.addGetterSetter(VS.Node,"blue",0,yB.RGBComponent,sm.Factory.afterSetFilter);var l0={};Object.defineProperty(l0,"__esModule",{value:!0});l0.RGBA=void 0;const jd=Le,u0=gt,xB=Se,SB=function(t){const e=t.data,n=e.length,r=this.red(),i=this.green(),s=this.blue(),o=this.alpha();for(let a=0;a<n;a+=4){const l=1-o;e[a]=r*o+e[a]*l,e[a+1]=i*o+e[a+1]*l,e[a+2]=s*o+e[a+2]*l}};l0.RGBA=SB;jd.Factory.addGetterSetter(u0.Node,"red",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});jd.Factory.addGetterSetter(u0.Node,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});jd.Factory.addGetterSetter(u0.Node,"blue",0,xB.RGBComponent,jd.Factory.afterSetFilter);jd.Factory.addGetterSetter(u0.Node,"alpha",1,function(t){return this._filterUpToDate=!1,t>1?1:t<0?0:t});var c0={};Object.defineProperty(c0,"__esModule",{value:!0});c0.Sepia=void 0;const wB=function(t){const e=t.data,n=e.length;for(let r=0;r<n;r+=4){const i=e[r+0],s=e[r+1],o=e[r+2];e[r+0]=Math.min(255,i*.393+s*.769+o*.189),e[r+1]=Math.min(255,i*.349+s*.686+o*.168),e[r+2]=Math.min(255,i*.272+s*.534+o*.131)}};c0.Sepia=wB;var d0={};Object.defineProperty(d0,"__esModule",{value:!0});d0.Solarize=void 0;const kB=function(t){const e=t.data,n=t.width,r=t.height,i=n*4;let s=r;do{const o=(s-1)*i;let a=n;do{const l=o+(a-1)*4;let d=e[l],h=e[l+1],f=e[l+2];d>127&&(d=255-d),h>127&&(h=255-h),f>127&&(f=255-f),e[l]=d,e[l+1]=h,e[l+2]=f}while(--a)}while(--s)};d0.Solarize=kB;var h0={};Object.defineProperty(h0,"__esModule",{value:!0});h0.Threshold=void 0;const sC=Le,CB=gt,bB=Se,EB=function(t){const e=this.threshold()*255,n=t.data,r=n.length;for(let i=0;i<r;i+=1)n[i]=n[i]<e?0:255};h0.Threshold=EB;sC.Factory.addGetterSetter(CB.Node,"threshold",.5,(0,bB.getNumberValidator)(),sC.Factory.afterSetFilter);Object.defineProperty(kg,"__esModule",{value:!0});kg.Konva=void 0;const oC=tm,_B=Ng,NB=Pg,TB=Rg,MB=Lg,PB=Ig,aC=bu,OB=mh,AB=$u,RB=yh,LB=jg,IB=zg,DB=Bg,FB=Ug,jB=Ku,zB=Hg,BB=Vg,UB=Gg,HB=Wg,VB=Kg,GB=qg,$B=Qg,WB=Jg,KB=Xg,qB=Zg,QB=e0,YB=t0,JB=n0,XB=r0,ZB=i0,eU=s0,tU=o0,nU=a0,rU=l0,iU=c0,sU=d0,oU=h0;kg.Konva=oC.Konva.Util._assign(oC.Konva,{Arc:_B.Arc,Arrow:NB.Arrow,Circle:TB.Circle,Ellipse:MB.Ellipse,Image:PB.Image,Label:aC.Label,Tag:aC.Tag,Line:OB.Line,Path:AB.Path,Rect:RB.Rect,RegularPolygon:LB.RegularPolygon,Ring:IB.Ring,Sprite:DB.Sprite,Star:FB.Star,Text:jB.Text,TextPath:zB.TextPath,Transformer:BB.Transformer,Wedge:UB.Wedge,Filters:{Blur:HB.Blur,Brighten:VB.Brighten,Contrast:GB.Contrast,Emboss:$B.Emboss,Enhance:WB.Enhance,Grayscale:KB.Grayscale,HSL:qB.HSL,HSV:QB.HSV,Invert:YB.Invert,Kaleidoscope:JB.Kaleidoscope,Mask:XB.Mask,Noise:ZB.Noise,Pixelate:eU.Pixelate,Posterize:tU.Posterize,RGB:nU.RGB,RGBA:rU.RGBA,Sepia:iU.Sepia,Solarize:sU.Solarize,Threshold:oU.Threshold}});var aU=T_.exports;Object.defineProperty(aU,"__esModule",{value:!0});const lU=kg;T_.exports=lU.Konva;var Bv={exports:{}};(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Konva=void 0;var n=tm;Object.defineProperty(e,"Konva",{enumerable:!0,get:function(){return n.Konva}});const r=tm;t.exports=r.Konva})(Bv,Bv.exports);var uU=Bv.exports;const zd=nh(uU);var u9={exports:{}};/**
* @license React
* react-reconciler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var cU=function(e){var n={},r=z,i=$c,s=Object.assign;function o(u){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+u,m=1;m<arguments.length;m++)c+="&args[]="+encodeURIComponent(arguments[m]);return"Minified React error #"+u+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var a=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,l=Symbol.for("react.element"),d=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),y=Symbol.for("react.provider"),g=Symbol.for("react.context"),x=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),b=Symbol.for("react.offscreen"),T=Symbol.iterator;function P(u){return u===null||typeof u!="object"?null:(u=T&&u[T]||u["@@iterator"],typeof u=="function"?u:null)}function A(u){if(u==null)return null;if(typeof u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case h:return"Fragment";case d:return"Portal";case p:return"Profiler";case f:return"StrictMode";case S:return"Suspense";case C:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case g:return(u.displayName||"Context")+".Consumer";case y:return(u._context.displayName||"Context")+".Provider";case x:var c=u.render;return u=u.displayName,u||(u=c.displayName||c.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case E:return c=u.displayName||null,c!==null?c:A(u.type)||"Memo";case w:c=u._payload,u=u._init;try{return A(u(c))}catch{}}return null}function M(u){var c=u.type;switch(u.tag){case 24:return"Cache";case 9:return(c.displayName||"Context")+".Consumer";case 10:return(c._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return u=c.render,u=u.displayName||u.name||"",c.displayName||(u!==""?"ForwardRef("+u+")":"ForwardRef");case 7:return"Fragment";case 5:return c;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return A(c);case 8:return c===f?"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 c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c}return null}function I(u){var c=u,m=u;if(u.alternate)for(;c.return;)c=c.return;else{u=c;do c=u,c.flags&4098&&(m=c.return),u=c.return;while(u)}return c.tag===3?m:null}function R(u){if(I(u)!==u)throw Error(o(188))}function U(u){var c=u.alternate;if(!c){if(c=I(u),c===null)throw Error(o(188));return c!==u?null:u}for(var m=u,v=c;;){var k=m.return;if(k===null)break;var _=k.alternate;if(_===null){if(v=k.return,v!==null){m=v;continue}break}if(k.child===_.child){for(_=k.child;_;){if(_===m)return R(k),u;if(_===v)return R(k),c;_=_.sibling}throw Error(o(188))}if(m.return!==v.return)m=k,v=_;else{for(var O=!1,D=k.child;D;){if(D===m){O=!0,m=k,v=_;break}if(D===v){O=!0,v=k,m=_;break}D=D.sibling}if(!O){for(D=_.child;D;){if(D===m){O=!0,m=_,v=k;break}if(D===v){O=!0,v=_,m=k;break}D=D.sibling}if(!O)throw Error(o(189))}}if(m.alternate!==v)throw Error(o(190))}if(m.tag!==3)throw Error(o(188));return m.stateNode.current===m?u:c}function B(u){return u=U(u),u!==null?$(u):null}function $(u){if(u.tag===5||u.tag===6)return u;for(u=u.child;u!==null;){var c=$(u);if(c!==null)return c;u=u.sibling}return null}function Q(u){if(u.tag===5||u.tag===6)return u;for(u=u.child;u!==null;){if(u.tag!==4){var c=Q(u);if(c!==null)return c}u=u.sibling}return null}var q=Array.isArray,ie=e.getPublicInstance,fe=e.getRootHostContext,W=e.getChildHostContext,re=e.prepareForCommit,te=e.resetAfterCommit,Y=e.createInstance,oe=e.appendInitialChild,_e=e.finalizeInitialChildren,rt=e.prepareUpdate,yt=e.shouldSetTextContent,it=e.createTextInstance,F=e.scheduleTimeout,X=e.cancelTimeout,me=e.noTimeout,We=e.isPrimaryRenderer,Ne=e.supportsMutation,et=e.supportsPersistence,st=e.supportsHydration,hi=e.getInstanceFromNode,Ye=e.preparePortalMount,Es=e.getCurrentEventPriority,Gr=e.detachDeletedInstance,_s=e.supportsMicrotasks,s7=e.scheduleMicrotask,Qu=e.supportsTestSelectors,o7=e.findFiberRoot,a7=e.getBoundingRect,l7=e.getTextContent,Yu=e.isHiddenSubtree,u7=e.matchAccessibilityRole,c7=e.setFocusIfFocusable,d7=e.setupIntersectionObserver,h7=e.appendChild,f7=e.appendChildToContainer,p7=e.commitTextUpdate,m7=e.commitMount,g7=e.commitUpdate,y7=e.insertBefore,v7=e.insertInContainerBefore,x7=e.removeChild,S7=e.removeChildFromContainer,Aw=e.resetTextContent,w7=e.hideInstance,k7=e.hideTextInstance,C7=e.unhideInstance,b7=e.unhideTextInstance,E7=e.clearContainer,_7=e.cloneInstance,Rw=e.createContainerChildSet,Lw=e.appendChildToContainerChildSet,N7=e.finalizeContainerChildren,P0=e.replaceContainerChildren,Iw=e.cloneHiddenInstance,Dw=e.cloneHiddenTextInstance,T7=e.canHydrateInstance,M7=e.canHydrateTextInstance,P7=e.canHydrateSuspenseInstance,Fw=e.isSuspenseInstancePending,O0=e.isSuspenseInstanceFallback,O7=e.getSuspenseInstanceFallbackErrorDetails,A7=e.registerSuspenseInstanceRetry,Ch=e.getNextHydratableSibling,R7=e.getFirstHydratableChild,L7=e.getFirstHydratableChildWithinContainer,I7=e.getFirstHydratableChildWithinSuspenseInstance,D7=e.hydrateInstance,F7=e.hydrateTextInstance,j7=e.hydrateSuspenseInstance,z7=e.getNextHydratableInstanceAfterSuspenseInstance,B7=e.commitHydratedContainer,U7=e.commitHydratedSuspenseInstance,H7=e.clearSuspenseBoundary,V7=e.clearSuspenseBoundaryFromContainer,G7=e.shouldDeleteUnhydratedTailInstances,$7=e.didNotMatchHydratedContainerTextInstance,W7=e.didNotMatchHydratedTextInstance,A0;function Ju(u){if(A0===void 0)try{throw Error()}catch(m){var c=m.stack.trim().match(/\n( *(at )?)/);A0=c&&c[1]||""}return`
`+A0+u}var R0=!1;function L0(u,c){if(!u||R0)return"";R0=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(c)if(c=function(){throw Error()},Object.defineProperty(c.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(c,[])}catch(ne){var v=ne}Reflect.construct(u,[],c)}else{try{c.call()}catch(ne){v=ne}u.call(c.prototype)}else{try{throw Error()}catch(ne){v=ne}u()}}catch(ne){if(ne&&v&&typeof ne.stack=="string"){for(var k=ne.stack.split(`
`),_=v.stack.split(`
`),O=k.length-1,D=_.length-1;1<=O&&0<=D&&k[O]!==_[D];)D--;for(;1<=O&&0<=D;O--,D--)if(k[O]!==_[D]){if(O!==1||D!==1)do if(O--,D--,0>D||k[O]!==_[D]){var G=`
`+k[O].replace(" at new "," at ");return u.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",u.displayName)),G}while(1<=O&&0<=D);break}}}finally{R0=!1,Error.prepareStackTrace=m}return(u=u?u.displayName||u.name:"")?Ju(u):""}var K7=Object.prototype.hasOwnProperty,I0=[],ul=-1;function Ns(u){return{current:u}}function ot(u){0>ul||(u.current=I0[ul],I0[ul]=null,ul--)}function tt(u,c){ul++,I0[ul]=u.current,u.current=c}var Ts={},yn=Ns(Ts),Gn=Ns(!1),$o=Ts;function cl(u,c){var m=u.type.contextTypes;if(!m)return Ts;var v=u.stateNode;if(v&&v.__reactInternalMemoizedUnmaskedChildContext===c)return v.__reactInternalMemoizedMaskedChildContext;var k={},_;for(_ in m)k[_]=c[_];return v&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=c,u.__reactInternalMemoizedMaskedChildContext=k),k}function $n(u){return u=u.childContextTypes,u!=null}function bh(){ot(Gn),ot(yn)}function jw(u,c,m){if(yn.current!==Ts)throw Error(o(168));tt(yn,c),tt(Gn,m)}function zw(u,c,m){var v=u.stateNode;if(c=c.childContextTypes,typeof v.getChildContext!="function")return m;v=v.getChildContext();for(var k in v)if(!(k in c))throw Error(o(108,M(u)||"Unknown",k));return s({},m,v)}function Eh(u){return u=(u=u.stateNode)&&u.__reactInternalMemoizedMergedChildContext||Ts,$o=yn.current,tt(yn,u),tt(Gn,Gn.current),!0}function Bw(u,c,m){var v=u.stateNode;if(!v)throw Error(o(169));m?(u=zw(u,c,$o),v.__reactInternalMemoizedMergedChildContext=u,ot(Gn),ot(yn),tt(yn,u)):ot(Gn),tt(Gn,m)}var $r=Math.clz32?Math.clz32:Y7,q7=Math.log,Q7=Math.LN2;function Y7(u){return u>>>=0,u===0?32:31-(q7(u)/Q7|0)|0}var _h=64,Nh=4194304;function Xu(u){switch(u&-u){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 u&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return u&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return u}}function Th(u,c){var m=u.pendingLanes;if(m===0)return 0;var v=0,k=u.suspendedLanes,_=u.pingedLanes,O=m&268435455;if(O!==0){var D=O&~k;D!==0?v=Xu(D):(_&=O,_!==0&&(v=Xu(_)))}else O=m&~k,O!==0?v=Xu(O):_!==0&&(v=Xu(_));if(v===0)return 0;if(c!==0&&c!==v&&!(c&k)&&(k=v&-v,_=c&-c,k>=_||k===16&&(_&4194240)!==0))return c;if(v&4&&(v|=m&16),c=u.entangledLanes,c!==0)for(u=u.entanglements,c&=v;0<c;)m=31-$r(c),k=1<<m,v|=u[m],c&=~k;return v}function J7(u,c){switch(u){case 1:case 2:case 4:return c+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 c+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 X7(u,c){for(var m=u.suspendedLanes,v=u.pingedLanes,k=u.expirationTimes,_=u.pendingLanes;0<_;){var O=31-$r(_),D=1<<O,G=k[O];G===-1?(!(D&m)||D&v)&&(k[O]=J7(D,c)):G<=c&&(u.expiredLanes|=D),_&=~D}}function D0(u){return u=u.pendingLanes&-1073741825,u!==0?u:u&1073741824?1073741824:0}function Uw(){var u=_h;return _h<<=1,!(_h&4194240)&&(_h=64),u}function F0(u){for(var c=[],m=0;31>m;m++)c.push(u);return c}function Zu(u,c,m){u.pendingLanes|=c,c!==536870912&&(u.suspendedLanes=0,u.pingedLanes=0),u=u.eventTimes,c=31-$r(c),u[c]=m}function Z7(u,c){var m=u.pendingLanes&~c;u.pendingLanes=c,u.suspendedLanes=0,u.pingedLanes=0,u.expiredLanes&=c,u.mutableReadLanes&=c,u.entangledLanes&=c,c=u.entanglements;var v=u.eventTimes;for(u=u.expirationTimes;0<m;){var k=31-$r(m),_=1<<k;c[k]=0,v[k]=-1,u[k]=-1,m&=~_}}function j0(u,c){var m=u.entangledLanes|=c;for(u=u.entanglements;m;){var v=31-$r(m),k=1<<v;k&c|u[v]&c&&(u[v]|=c),m&=~k}}var Ue=0;function Hw(u){return u&=-u,1<u?4<u?u&268435455?16:536870912:4:1}var z0=i.unstable_scheduleCallback,Vw=i.unstable_cancelCallback,eM=i.unstable_shouldYield,tM=i.unstable_requestPaint,Xt=i.unstable_now,B0=i.unstable_ImmediatePriority,nM=i.unstable_UserBlockingPriority,U0=i.unstable_NormalPriority,rM=i.unstable_IdlePriority,Mh=null,fi=null;function iM(u){if(fi&&typeof fi.onCommitFiberRoot=="function")try{fi.onCommitFiberRoot(Mh,u,void 0,(u.current.flags&128)===128)}catch{}}function sM(u,c){return u===c&&(u!==0||1/u===1/c)||u!==u&&c!==c}var Wr=typeof Object.is=="function"?Object.is:sM,ji=null,Ph=!1,H0=!1;function Gw(u){ji===null?ji=[u]:ji.push(u)}function oM(u){Ph=!0,Gw(u)}function pi(){if(!H0&&ji!==null){H0=!0;var u=0,c=Ue;try{var m=ji;for(Ue=1;u<m.length;u++){var v=m[u];do v=v(!0);while(v!==null)}ji=null,Ph=!1}catch(k){throw ji!==null&&(ji=ji.slice(u+1)),z0(B0,pi),k}finally{Ue=c,H0=!1}}return null}var dl=[],hl=0,Oh=null,Ah=0,Sr=[],wr=0,Wo=null,zi=1,Bi="";function Ko(u,c){dl[hl++]=Ah,dl[hl++]=Oh,Oh=u,Ah=c}function $w(u,c,m){Sr[wr++]=zi,Sr[wr++]=Bi,Sr[wr++]=Wo,Wo=u;var v=zi;u=Bi;var k=32-$r(v)-1;v&=~(1<<k),m+=1;var _=32-$r(c)+k;if(30<_){var O=k-k%5;_=(v&(1<<O)-1).toString(32),v>>=O,k-=O,zi=1<<32-$r(c)+k|m<<k|v,Bi=_+u}else zi=1<<_|m<<k|v,Bi=u}function V0(u){u.return!==null&&(Ko(u,1),$w(u,1,0))}function G0(u){for(;u===Oh;)Oh=dl[--hl],dl[hl]=null,Ah=dl[--hl],dl[hl]=null;for(;u===Wo;)Wo=Sr[--wr],Sr[wr]=null,Bi=Sr[--wr],Sr[wr]=null,zi=Sr[--wr],Sr[wr]=null}var ar=null,kr=null,ht=!1,ec=!1,Kr=null;function Ww(u,c){var m=Nr(5,null,null,0);m.elementType="DELETED",m.stateNode=c,m.return=u,c=u.deletions,c===null?(u.deletions=[m],u.flags|=16):c.push(m)}function Kw(u,c){switch(u.tag){case 5:return c=T7(c,u.type,u.pendingProps),c!==null?(u.stateNode=c,ar=u,kr=R7(c),!0):!1;case 6:return c=M7(c,u.pendingProps),c!==null?(u.stateNode=c,ar=u,kr=null,!0):!1;case 13:if(c=P7(c),c!==null){var m=Wo!==null?{id:zi,overflow:Bi}:null;return u.memoizedState={dehydrated:c,treeContext:m,retryLane:1073741824},m=Nr(18,null,null,0),m.stateNode=c,m.return=u,u.child=m,ar=u,kr=null,!0}return!1;default:return!1}}function $0(u){return(u.mode&1)!==0&&(u.flags&128)===0}function W0(u){if(ht){var c=kr;if(c){var m=c;if(!Kw(u,c)){if($0(u))throw Error(o(418));c=Ch(m);var v=ar;c&&Kw(u,c)?Ww(v,m):(u.flags=u.flags&-4097|2,ht=!1,ar=u)}}else{if($0(u))throw Error(o(418));u.flags=u.flags&-4097|2,ht=!1,ar=u}}}function qw(u){for(u=u.return;u!==null&&u.tag!==5&&u.tag!==3&&u.tag!==13;)u=u.return;ar=u}function Rh(u){if(!st||u!==ar)return!1;if(!ht)return qw(u),ht=!0,!1;if(u.tag!==3&&(u.tag!==5||G7(u.type)&&!yt(u.type,u.memoizedProps))){var c=kr;if(c){if($0(u))throw Qw(),Error(o(418));for(;c;)Ww(u,c),c=Ch(c)}}if(qw(u),u.tag===13){if(!st)throw Error(o(316));if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(o(317));kr=z7(u)}else kr=ar?Ch(u.stateNode):null;return!0}function Qw(){for(var u=kr;u;)u=Ch(u)}function fl(){st&&(kr=ar=null,ec=ht=!1)}function K0(u){Kr===null?Kr=[u]:Kr.push(u)}var aM=a.ReactCurrentBatchConfig;function Lh(u,c){if(Wr(u,c))return!0;if(typeof u!="object"||u===null||typeof c!="object"||c===null)return!1;var m=Object.keys(u),v=Object.keys(c);if(m.length!==v.length)return!1;for(v=0;v<m.length;v++){var k=m[v];if(!K7.call(c,k)||!Wr(u[k],c[k]))return!1}return!0}function lM(u){switch(u.tag){case 5:return Ju(u.type);case 16:return Ju("Lazy");case 13:return Ju("Suspense");case 19:return Ju("SuspenseList");case 0:case 2:case 15:return u=L0(u.type,!1),u;case 11:return u=L0(u.type.render,!1),u;case 1:return u=L0(u.type,!0),u;default:return""}}function tc(u,c,m){if(u=m.ref,u!==null&&typeof u!="function"&&typeof u!="object"){if(m._owner){if(m=m._owner,m){if(m.tag!==1)throw Error(o(309));var v=m.stateNode}if(!v)throw Error(o(147,u));var k=v,_=""+u;return c!==null&&c.ref!==null&&typeof c.ref=="function"&&c.ref._stringRef===_?c.ref:(c=function(O){var D=k.refs;O===null?delete D[_]:D[_]=O},c._stringRef=_,c)}if(typeof u!="string")throw Error(o(284));if(!m._owner)throw Error(o(290,u))}return u}function Ih(u,c){throw u=Object.prototype.toString.call(c),Error(o(31,u==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":u))}function Yw(u){var c=u._init;return c(u._payload)}function Jw(u){function c(H,j){if(u){var K=H.deletions;K===null?(H.deletions=[j],H.flags|=16):K.push(j)}}function m(H,j){if(!u)return null;for(;j!==null;)c(H,j),j=j.sibling;return null}function v(H,j){for(H=new Map;j!==null;)j.key!==null?H.set(j.key,j):H.set(j.index,j),j=j.sibling;return H}function k(H,j){return H=Is(H,j),H.index=0,H.sibling=null,H}function _(H,j,K){return H.index=K,u?(K=H.alternate,K!==null?(K=K.index,K<j?(H.flags|=2,j):K):(H.flags|=2,j)):(H.flags|=1048576,j)}function O(H){return u&&H.alternate===null&&(H.flags|=2),H}function D(H,j,K,le){return j===null||j.tag!==6?(j=H1(K,H.mode,le),j.return=H,j):(j=k(j,K),j.return=H,j)}function G(H,j,K,le){var ve=K.type;return ve===h?he(H,j,K.props.children,le,K.key):j!==null&&(j.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===w&&Yw(ve)===j.type)?(le=k(j,K.props),le.ref=tc(H,j,K),le.return=H,le):(le=ff(K.type,K.key,K.props,null,H.mode,le),le.ref=tc(H,j,K),le.return=H,le)}function ne(H,j,K,le){return j===null||j.tag!==4||j.stateNode.containerInfo!==K.containerInfo||j.stateNode.implementation!==K.implementation?(j=V1(K,H.mode,le),j.return=H,j):(j=k(j,K.children||[]),j.return=H,j)}function he(H,j,K,le,ve){return j===null||j.tag!==7?(j=ea(K,H.mode,le,ve),j.return=H,j):(j=k(j,K),j.return=H,j)}function Ce(H,j,K){if(typeof j=="string"&&j!==""||typeof j=="number")return j=H1(""+j,H.mode,K),j.return=H,j;if(typeof j=="object"&&j!==null){switch(j.$$typeof){case l:return K=ff(j.type,j.key,j.props,null,H.mode,K),K.ref=tc(H,null,j),K.return=H,K;case d:return j=V1(j,H.mode,K),j.return=H,j;case w:var le=j._init;return Ce(H,le(j._payload),K)}if(q(j)||P(j))return j=ea(j,H.mode,K,null),j.return=H,j;Ih(H,j)}return null}function ae(H,j,K,le){var ve=j!==null?j.key:null;if(typeof K=="string"&&K!==""||typeof K=="number")return ve!==null?null:D(H,j,""+K,le);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case l:return K.key===ve?G(H,j,K,le):null;case d:return K.key===ve?ne(H,j,K,le):null;case w:return ve=K._init,ae(H,j,ve(K._payload),le)}if(q(K)||P(K))return ve!==null?null:he(H,j,K,le,null);Ih(H,K)}return null}function at(H,j,K,le,ve){if(typeof le=="string"&&le!==""||typeof le=="number")return H=H.get(K)||null,D(j,H,""+le,ve);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case l:return H=H.get(le.key===null?K:le.key)||null,G(j,H,le,ve);case d:return H=H.get(le.key===null?K:le.key)||null,ne(j,H,le,ve);case w:var Me=le._init;return at(H,j,K,Me(le._payload),ve)}if(q(le)||P(le))return H=H.get(K)||null,he(j,H,le,ve,null);Ih(j,le)}return null}function Je(H,j,K,le){for(var ve=null,Me=null,be=j,He=j=0,tn=null;be!==null&&He<K.length;He++){be.index>He?(tn=be,be=null):tn=be.sibling;var Ve=ae(H,be,K[He],le);if(Ve===null){be===null&&(be=tn);break}u&&be&&Ve.alternate===null&&c(H,be),j=_(Ve,j,He),Me===null?ve=Ve:Me.sibling=Ve,Me=Ve,be=tn}if(He===K.length)return m(H,be),ht&&Ko(H,He),ve;if(be===null){for(;He<K.length;He++)be=Ce(H,K[He],le),be!==null&&(j=_(be,j,He),Me===null?ve=be:Me.sibling=be,Me=be);return ht&&Ko(H,He),ve}for(be=v(H,be);He<K.length;He++)tn=at(be,H,He,K[He],le),tn!==null&&(u&&tn.alternate!==null&&be.delete(tn.key===null?He:tn.key),j=_(tn,j,He),Me===null?ve=tn:Me.sibling=tn,Me=tn);return u&&be.forEach(function(Ds){return c(H,Ds)}),ht&&Ko(H,He),ve}function Qn(H,j,K,le){var ve=P(K);if(typeof ve!="function")throw Error(o(150));if(K=ve.call(K),K==null)throw Error(o(151));for(var Me=ve=null,be=j,He=j=0,tn=null,Ve=K.next();be!==null&&!Ve.done;He++,Ve=K.next()){be.index>He?(tn=be,be=null):tn=be.sibling;var Ds=ae(H,be,Ve.value,le);if(Ds===null){be===null&&(be=tn);break}u&&be&&Ds.alternate===null&&c(H,be),j=_(Ds,j,He),Me===null?ve=Ds:Me.sibling=Ds,Me=Ds,be=tn}if(Ve.done)return m(H,be),ht&&Ko(H,He),ve;if(be===null){for(;!Ve.done;He++,Ve=K.next())Ve=Ce(H,Ve.value,le),Ve!==null&&(j=_(Ve,j,He),Me===null?ve=Ve:Me.sibling=Ve,Me=Ve);return ht&&Ko(H,He),ve}for(be=v(H,be);!Ve.done;He++,Ve=K.next())Ve=at(be,H,He,Ve.value,le),Ve!==null&&(u&&Ve.alternate!==null&&be.delete(Ve.key===null?He:Ve.key),j=_(Ve,j,He),Me===null?ve=Ve:Me.sibling=Ve,Me=Ve);return u&&be.forEach(function(jM){return c(H,jM)}),ht&&Ko(H,He),ve}function Gi(H,j,K,le){if(typeof K=="object"&&K!==null&&K.type===h&&K.key===null&&(K=K.props.children),typeof K=="object"&&K!==null){switch(K.$$typeof){case l:e:{for(var ve=K.key,Me=j;Me!==null;){if(Me.key===ve){if(ve=K.type,ve===h){if(Me.tag===7){m(H,Me.sibling),j=k(Me,K.props.children),j.return=H,H=j;break e}}else if(Me.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===w&&Yw(ve)===Me.type){m(H,Me.sibling),j=k(Me,K.props),j.ref=tc(H,Me,K),j.return=H,H=j;break e}m(H,Me);break}else c(H,Me);Me=Me.sibling}K.type===h?(j=ea(K.props.children,H.mode,le,K.key),j.return=H,H=j):(le=ff(K.type,K.key,K.props,null,H.mode,le),le.ref=tc(H,j,K),le.return=H,H=le)}return O(H);case d:e:{for(Me=K.key;j!==null;){if(j.key===Me)if(j.tag===4&&j.stateNode.containerInfo===K.containerInfo&&j.stateNode.implementation===K.implementation){m(H,j.sibling),j=k(j,K.children||[]),j.return=H,H=j;break e}else{m(H,j);break}else c(H,j);j=j.sibling}j=V1(K,H.mode,le),j.return=H,H=j}return O(H);case w:return Me=K._init,Gi(H,j,Me(K._payload),le)}if(q(K))return Je(H,j,K,le);if(P(K))return Qn(H,j,K,le);Ih(H,K)}return typeof K=="string"&&K!==""||typeof K=="number"?(K=""+K,j!==null&&j.tag===6?(m(H,j.sibling),j=k(j,K),j.return=H,H=j):(m(H,j),j=H1(K,H.mode,le),j.return=H,H=j),O(H)):m(H,j)}return Gi}var pl=Jw(!0),Xw=Jw(!1),Dh=Ns(null),Fh=null,ml=null,q0=null;function Q0(){q0=ml=Fh=null}function Zw(u,c,m){We?(tt(Dh,c._currentValue),c._currentValue=m):(tt(Dh,c._currentValue2),c._currentValue2=m)}function Y0(u){var c=Dh.current;ot(Dh),We?u._currentValue=c:u._currentValue2=c}function J0(u,c,m){for(;u!==null;){var v=u.alternate;if((u.childLanes&c)!==c?(u.childLanes|=c,v!==null&&(v.childLanes|=c)):v!==null&&(v.childLanes&c)!==c&&(v.childLanes|=c),u===m)break;u=u.return}}function gl(u,c){Fh=u,q0=ml=null,u=u.dependencies,u!==null&&u.firstContext!==null&&(u.lanes&c&&(Wn=!0),u.firstContext=null)}function Cr(u){var c=We?u._currentValue:u._currentValue2;if(q0!==u)if(u={context:u,memoizedValue:c,next:null},ml===null){if(Fh===null)throw Error(o(308));ml=u,Fh.dependencies={lanes:0,firstContext:u}}else ml=ml.next=u;return c}var qo=null;function X0(u){qo===null?qo=[u]:qo.push(u)}function e3(u,c,m,v){var k=c.interleaved;return k===null?(m.next=m,X0(c)):(m.next=k.next,k.next=m),c.interleaved=m,mi(u,v)}function mi(u,c){u.lanes|=c;var m=u.alternate;for(m!==null&&(m.lanes|=c),m=u,u=u.return;u!==null;)u.childLanes|=c,m=u.alternate,m!==null&&(m.childLanes|=c),m=u,u=u.return;return m.tag===3?m.stateNode:null}var Ms=!1;function Z0(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function t3(u,c){u=u.updateQueue,c.updateQueue===u&&(c.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,effects:u.effects})}function Ui(u,c){return{eventTime:u,lane:c,tag:0,payload:null,callback:null,next:null}}function Ps(u,c,m){var v=u.updateQueue;if(v===null)return null;if(v=v.shared,Re&2){var k=v.pending;return k===null?c.next=c:(c.next=k.next,k.next=c),v.pending=c,mi(u,m)}return k=v.interleaved,k===null?(c.next=c,X0(v)):(c.next=k.next,k.next=c),v.interleaved=c,mi(u,m)}function jh(u,c,m){if(c=c.updateQueue,c!==null&&(c=c.shared,(m&4194240)!==0)){var v=c.lanes;v&=u.pendingLanes,m|=v,c.lanes=m,j0(u,m)}}function n3(u,c){var m=u.updateQueue,v=u.alternate;if(v!==null&&(v=v.updateQueue,m===v)){var k=null,_=null;if(m=m.firstBaseUpdate,m!==null){do{var O={eventTime:m.eventTime,lane:m.lane,tag:m.tag,payload:m.payload,callback:m.callback,next:null};_===null?k=_=O:_=_.next=O,m=m.next}while(m!==null);_===null?k=_=c:_=_.next=c}else k=_=c;m={baseState:v.baseState,firstBaseUpdate:k,lastBaseUpdate:_,shared:v.shared,effects:v.effects},u.updateQueue=m;return}u=m.lastBaseUpdate,u===null?m.firstBaseUpdate=c:u.next=c,m.lastBaseUpdate=c}function zh(u,c,m,v){var k=u.updateQueue;Ms=!1;var _=k.firstBaseUpdate,O=k.lastBaseUpdate,D=k.shared.pending;if(D!==null){k.shared.pending=null;var G=D,ne=G.next;G.next=null,O===null?_=ne:O.next=ne,O=G;var he=u.alternate;he!==null&&(he=he.updateQueue,D=he.lastBaseUpdate,D!==O&&(D===null?he.firstBaseUpdate=ne:D.next=ne,he.lastBaseUpdate=G))}if(_!==null){var Ce=k.baseState;O=0,he=ne=G=null,D=_;do{var ae=D.lane,at=D.eventTime;if((v&ae)===ae){he!==null&&(he=he.next={eventTime:at,lane:0,tag:D.tag,payload:D.payload,callback:D.callback,next:null});e:{var Je=u,Qn=D;switch(ae=c,at=m,Qn.tag){case 1:if(Je=Qn.payload,typeof Je=="function"){Ce=Je.call(at,Ce,ae);break e}Ce=Je;break e;case 3:Je.flags=Je.flags&-65537|128;case 0:if(Je=Qn.payload,ae=typeof Je=="function"?Je.call(at,Ce,ae):Je,ae==null)break e;Ce=s({},Ce,ae);break e;case 2:Ms=!0}}D.callback!==null&&D.lane!==0&&(u.flags|=64,ae=k.effects,ae===null?k.effects=[D]:ae.push(D))}else at={eventTime:at,lane:ae,tag:D.tag,payload:D.payload,callback:D.callback,next:null},he===null?(ne=he=at,G=Ce):he=he.next=at,O|=ae;if(D=D.next,D===null){if(D=k.shared.pending,D===null)break;ae=D,D=ae.next,ae.next=null,k.lastBaseUpdate=ae,k.shared.pending=null}}while(!0);if(he===null&&(G=Ce),k.baseState=G,k.firstBaseUpdate=ne,k.lastBaseUpdate=he,c=k.shared.interleaved,c!==null){k=c;do O|=k.lane,k=k.next;while(k!==c)}else _===null&&(k.shared.lanes=0);Yo|=O,u.lanes=O,u.memoizedState=Ce}}function r3(u,c,m){if(u=c.effects,c.effects=null,u!==null)for(c=0;c<u.length;c++){var v=u[c],k=v.callback;if(k!==null){if(v.callback=null,v=m,typeof k!="function")throw Error(o(191,k));k.call(v)}}}var nc={},br=Ns(nc),rc=Ns(nc),yl=Ns(nc);function gi(u){if(u===nc)throw Error(o(174));return u}function e1(u,c){tt(yl,c),tt(rc,u),tt(br,nc),u=fe(c),ot(br),tt(br,u)}function vl(){ot(br),ot(rc),ot(yl)}function i3(u){var c=gi(yl.current),m=gi(br.current);c=W(m,u.type,c),m!==c&&(tt(rc,u),tt(br,c))}function t1(u){rc.current===u&&(ot(br),ot(rc))}var vt=Ns(0);function Bh(u){for(var c=u;c!==null;){if(c.tag===13){var m=c.memoizedState;if(m!==null&&(m=m.dehydrated,m===null||Fw(m)||O0(m)))return c}else if(c.tag===19&&c.memoizedProps.revealOrder!==void 0){if(c.flags&128)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===u)break;for(;c.sibling===null;){if(c.return===null||c.return===u)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var n1=[];function r1(){for(var u=0;u<n1.length;u++){var c=n1[u];We?c._workInProgressVersionPrimary=null:c._workInProgressVersionSecondary=null}n1.length=0}var Uh=a.ReactCurrentDispatcher,i1=a.ReactCurrentBatchConfig,Qo=0,xt=null,Ht=null,Zt=null,Hh=!1,ic=!1,sc=0,uM=0;function vn(){throw Error(o(321))}function s1(u,c){if(c===null)return!1;for(var m=0;m<c.length&&m<u.length;m++)if(!Wr(u[m],c[m]))return!1;return!0}function o1(u,c,m,v,k,_){if(Qo=_,xt=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,Uh.current=u===null||u.memoizedState===null?fM:pM,u=m(v,k),ic){_=0;do{if(ic=!1,sc=0,25<=_)throw Error(o(301));_+=1,Zt=Ht=null,c.updateQueue=null,Uh.current=mM,u=m(v,k)}while(ic)}if(Uh.current=$h,c=Ht!==null&&Ht.next!==null,Qo=0,Zt=Ht=xt=null,Hh=!1,c)throw Error(o(300));return u}function a1(){var u=sc!==0;return sc=0,u}function yi(){var u={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Zt===null?xt.memoizedState=Zt=u:Zt=Zt.next=u,Zt}function Er(){if(Ht===null){var u=xt.alternate;u=u!==null?u.memoizedState:null}else u=Ht.next;var c=Zt===null?xt.memoizedState:Zt.next;if(c!==null)Zt=c,Ht=u;else{if(u===null)throw Error(o(310));Ht=u,u={memoizedState:Ht.memoizedState,baseState:Ht.baseState,baseQueue:Ht.baseQueue,queue:Ht.queue,next:null},Zt===null?xt.memoizedState=Zt=u:Zt=Zt.next=u}return Zt}function oc(u,c){return typeof c=="function"?c(u):c}function l1(u){var c=Er(),m=c.queue;if(m===null)throw Error(o(311));m.lastRenderedReducer=u;var v=Ht,k=v.baseQueue,_=m.pending;if(_!==null){if(k!==null){var O=k.next;k.next=_.next,_.next=O}v.baseQueue=k=_,m.pending=null}if(k!==null){_=k.next,v=v.baseState;var D=O=null,G=null,ne=_;do{var he=ne.lane;if((Qo&he)===he)G!==null&&(G=G.next={lane:0,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null}),v=ne.hasEagerState?ne.eagerState:u(v,ne.action);else{var Ce={lane:he,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null};G===null?(D=G=Ce,O=v):G=G.next=Ce,xt.lanes|=he,Yo|=he}ne=ne.next}while(ne!==null&&ne!==_);G===null?O=v:G.next=D,Wr(v,c.memoizedState)||(Wn=!0),c.memoizedState=v,c.baseState=O,c.baseQueue=G,m.lastRenderedState=v}if(u=m.interleaved,u!==null){k=u;do _=k.lane,xt.lanes|=_,Yo|=_,k=k.next;while(k!==u)}else k===null&&(m.lanes=0);return[c.memoizedState,m.dispatch]}function u1(u){var c=Er(),m=c.queue;if(m===null)throw Error(o(311));m.lastRenderedReducer=u;var v=m.dispatch,k=m.pending,_=c.memoizedState;if(k!==null){m.pending=null;var O=k=k.next;do _=u(_,O.action),O=O.next;while(O!==k);Wr(_,c.memoizedState)||(Wn=!0),c.memoizedState=_,c.baseQueue===null&&(c.baseState=_),m.lastRenderedState=_}return[_,v]}function s3(){}function o3(u,c){var m=xt,v=Er(),k=c(),_=!Wr(v.memoizedState,k);if(_&&(v.memoizedState=k,Wn=!0),v=v.queue,c1(u3.bind(null,m,v,u),[u]),v.getSnapshot!==c||_||Zt!==null&&Zt.memoizedState.tag&1){if(m.flags|=2048,ac(9,l3.bind(null,m,v,k,c),void 0,null),en===null)throw Error(o(349));Qo&30||a3(m,c,k)}return k}function a3(u,c,m){u.flags|=16384,u={getSnapshot:c,value:m},c=xt.updateQueue,c===null?(c={lastEffect:null,stores:null},xt.updateQueue=c,c.stores=[u]):(m=c.stores,m===null?c.stores=[u]:m.push(u))}function l3(u,c,m,v){c.value=m,c.getSnapshot=v,c3(c)&&d3(u)}function u3(u,c,m){return m(function(){c3(c)&&d3(u)})}function c3(u){var c=u.getSnapshot;u=u.value;try{var m=c();return!Wr(u,m)}catch{return!0}}function d3(u){var c=mi(u,1);c!==null&&_r(c,u,1,-1)}function h3(u){var c=yi();return typeof u=="function"&&(u=u()),c.memoizedState=c.baseState=u,u={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:oc,lastRenderedState:u},c.queue=u,u=u.dispatch=hM.bind(null,xt,u),[c.memoizedState,u]}function ac(u,c,m,v){return u={tag:u,create:c,destroy:m,deps:v,next:null},c=xt.updateQueue,c===null?(c={lastEffect:null,stores:null},xt.updateQueue=c,c.lastEffect=u.next=u):(m=c.lastEffect,m===null?c.lastEffect=u.next=u:(v=m.next,m.next=u,u.next=v,c.lastEffect=u)),u}function f3(){return Er().memoizedState}function Vh(u,c,m,v){var k=yi();xt.flags|=u,k.memoizedState=ac(1|c,m,void 0,v===void 0?null:v)}function Gh(u,c,m,v){var k=Er();v=v===void 0?null:v;var _=void 0;if(Ht!==null){var O=Ht.memoizedState;if(_=O.destroy,v!==null&&s1(v,O.deps)){k.memoizedState=ac(c,m,_,v);return}}xt.flags|=u,k.memoizedState=ac(1|c,m,_,v)}function p3(u,c){return Vh(8390656,8,u,c)}function c1(u,c){return Gh(2048,8,u,c)}function m3(u,c){return Gh(4,2,u,c)}function g3(u,c){return Gh(4,4,u,c)}function y3(u,c){if(typeof c=="function")return u=u(),c(u),function(){c(null)};if(c!=null)return u=u(),c.current=u,function(){c.current=null}}function v3(u,c,m){return m=m!=null?m.concat([u]):null,Gh(4,4,y3.bind(null,c,u),m)}function d1(){}function x3(u,c){var m=Er();c=c===void 0?null:c;var v=m.memoizedState;return v!==null&&c!==null&&s1(c,v[1])?v[0]:(m.memoizedState=[u,c],u)}function S3(u,c){var m=Er();c=c===void 0?null:c;var v=m.memoizedState;return v!==null&&c!==null&&s1(c,v[1])?v[0]:(u=u(),m.memoizedState=[u,c],u)}function w3(u,c,m){return Qo&21?(Wr(m,c)||(m=Uw(),xt.lanes|=m,Yo|=m,u.baseState=!0),c):(u.baseState&&(u.baseState=!1,Wn=!0),u.memoizedState=m)}function cM(u,c){var m=Ue;Ue=m!==0&&4>m?m:4,u(!0);var v=i1.transition;i1.transition={};try{u(!1),c()}finally{Ue=m,i1.transition=v}}function k3(){return Er().memoizedState}function dM(u,c,m){var v=Rs(u);if(m={lane:v,action:m,hasEagerState:!1,eagerState:null,next:null},C3(u))b3(c,m);else if(m=e3(u,c,m,v),m!==null){var k=wn();_r(m,u,v,k),E3(m,c,v)}}function hM(u,c,m){var v=Rs(u),k={lane:v,action:m,hasEagerState:!1,eagerState:null,next:null};if(C3(u))b3(c,k);else{var _=u.alternate;if(u.lanes===0&&(_===null||_.lanes===0)&&(_=c.lastRenderedReducer,_!==null))try{var O=c.lastRenderedState,D=_(O,m);if(k.hasEagerState=!0,k.eagerState=D,Wr(D,O)){var G=c.interleaved;G===null?(k.next=k,X0(c)):(k.next=G.next,G.next=k),c.interleaved=k;return}}catch{}finally{}m=e3(u,c,k,v),m!==null&&(k=wn(),_r(m,u,v,k),E3(m,c,v))}}function C3(u){var c=u.alternate;return u===xt||c!==null&&c===xt}function b3(u,c){ic=Hh=!0;var m=u.pending;m===null?c.next=c:(c.next=m.next,m.next=c),u.pending=c}function E3(u,c,m){if(m&4194240){var v=c.lanes;v&=u.pendingLanes,m|=v,c.lanes=m,j0(u,m)}}var $h={readContext:Cr,useCallback:vn,useContext:vn,useEffect:vn,useImperativeHandle:vn,useInsertionEffect:vn,useLayoutEffect:vn,useMemo:vn,useReducer:vn,useRef:vn,useState:vn,useDebugValue:vn,useDeferredValue:vn,useTransition:vn,useMutableSource:vn,useSyncExternalStore:vn,useId:vn,unstable_isNewReconciler:!1},fM={readContext:Cr,useCallback:function(u,c){return yi().memoizedState=[u,c===void 0?null:c],u},useContext:Cr,useEffect:p3,useImperativeHandle:function(u,c,m){return m=m!=null?m.concat([u]):null,Vh(4194308,4,y3.bind(null,c,u),m)},useLayoutEffect:function(u,c){return Vh(4194308,4,u,c)},useInsertionEffect:function(u,c){return Vh(4,2,u,c)},useMemo:function(u,c){var m=yi();return c=c===void 0?null:c,u=u(),m.memoizedState=[u,c],u},useReducer:function(u,c,m){var v=yi();return c=m!==void 0?m(c):c,v.memoizedState=v.baseState=c,u={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:c},v.queue=u,u=u.dispatch=dM.bind(null,xt,u),[v.memoizedState,u]},useRef:function(u){var c=yi();return u={current:u},c.memoizedState=u},useState:h3,useDebugValue:d1,useDeferredValue:function(u){return yi().memoizedState=u},useTransition:function(){var u=h3(!1),c=u[0];return u=cM.bind(null,u[1]),yi().memoizedState=u,[c,u]},useMutableSource:function(){},useSyncExternalStore:function(u,c,m){var v=xt,k=yi();if(ht){if(m===void 0)throw Error(o(407));m=m()}else{if(m=c(),en===null)throw Error(o(349));Qo&30||a3(v,c,m)}k.memoizedState=m;var _={value:m,getSnapshot:c};return k.queue=_,p3(u3.bind(null,v,_,u),[u]),v.flags|=2048,ac(9,l3.bind(null,v,_,m,c),void 0,null),m},useId:function(){var u=yi(),c=en.identifierPrefix;if(ht){var m=Bi,v=zi;m=(v&~(1<<32-$r(v)-1)).toString(32)+m,c=":"+c+"R"+m,m=sc++,0<m&&(c+="H"+m.toString(32)),c+=":"}else m=uM++,c=":"+c+"r"+m.toString(32)+":";return u.memoizedState=c},unstable_isNewReconciler:!1},pM={readContext:Cr,useCallback:x3,useContext:Cr,useEffect:c1,useImperativeHandle:v3,useInsertionEffect:m3,useLayoutEffect:g3,useMemo:S3,useReducer:l1,useRef:f3,useState:function(){return l1(oc)},useDebugValue:d1,useDeferredValue:function(u){var c=Er();return w3(c,Ht.memoizedState,u)},useTransition:function(){var u=l1(oc)[0],c=Er().memoizedState;return[u,c]},useMutableSource:s3,useSyncExternalStore:o3,useId:k3,unstable_isNewReconciler:!1},mM={readContext:Cr,useCallback:x3,useContext:Cr,useEffect:c1,useImperativeHandle:v3,useInsertionEffect:m3,useLayoutEffect:g3,useMemo:S3,useReducer:u1,useRef:f3,useState:function(){return u1(oc)},useDebugValue:d1,useDeferredValue:function(u){var c=Er();return Ht===null?c.memoizedState=u:w3(c,Ht.memoizedState,u)},useTransition:function(){var u=u1(oc)[0],c=Er().memoizedState;return[u,c]},useMutableSource:s3,useSyncExternalStore:o3,useId:k3,unstable_isNewReconciler:!1};function qr(u,c){if(u&&u.defaultProps){c=s({},c),u=u.defaultProps;for(var m in u)c[m]===void 0&&(c[m]=u[m]);return c}return c}function h1(u,c,m,v){c=u.memoizedState,m=m(v,c),m=m==null?c:s({},c,m),u.memoizedState=m,u.lanes===0&&(u.updateQueue.baseState=m)}var Wh={isMounted:function(u){return(u=u._reactInternals)?I(u)===u:!1},enqueueSetState:function(u,c,m){u=u._reactInternals;var v=wn(),k=Rs(u),_=Ui(v,k);_.payload=c,m!=null&&(_.callback=m),c=Ps(u,_,k),c!==null&&(_r(c,u,k,v),jh(c,u,k))},enqueueReplaceState:function(u,c,m){u=u._reactInternals;var v=wn(),k=Rs(u),_=Ui(v,k);_.tag=1,_.payload=c,m!=null&&(_.callback=m),c=Ps(u,_,k),c!==null&&(_r(c,u,k,v),jh(c,u,k))},enqueueForceUpdate:function(u,c){u=u._reactInternals;var m=wn(),v=Rs(u),k=Ui(m,v);k.tag=2,c!=null&&(k.callback=c),c=Ps(u,k,v),c!==null&&(_r(c,u,v,m),jh(c,u,v))}};function _3(u,c,m,v,k,_,O){return u=u.stateNode,typeof u.shouldComponentUpdate=="function"?u.shouldComponentUpdate(v,_,O):c.prototype&&c.prototype.isPureReactComponent?!Lh(m,v)||!Lh(k,_):!0}function N3(u,c,m){var v=!1,k=Ts,_=c.contextType;return typeof _=="object"&&_!==null?_=Cr(_):(k=$n(c)?$o:yn.current,v=c.contextTypes,_=(v=v!=null)?cl(u,k):Ts),c=new c(m,_),u.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=Wh,u.stateNode=c,c._reactInternals=u,v&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=k,u.__reactInternalMemoizedMaskedChildContext=_),c}function T3(u,c,m,v){u=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(m,v),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(m,v),c.state!==u&&Wh.enqueueReplaceState(c,c.state,null)}function f1(u,c,m,v){var k=u.stateNode;k.props=m,k.state=u.memoizedState,k.refs={},Z0(u);var _=c.contextType;typeof _=="object"&&_!==null?k.context=Cr(_):(_=$n(c)?$o:yn.current,k.context=cl(u,_)),k.state=u.memoizedState,_=c.getDerivedStateFromProps,typeof _=="function"&&(h1(u,c,_,m),k.state=u.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof k.getSnapshotBeforeUpdate=="function"||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(c=k.state,typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount(),c!==k.state&&Wh.enqueueReplaceState(k,k.state,null),zh(u,m,k,v),k.state=u.memoizedState),typeof k.componentDidMount=="function"&&(u.flags|=4194308)}function xl(u,c){try{var m="",v=c;do m+=lM(v),v=v.return;while(v);var k=m}catch(_){k=`
Error generating stack: `+_.message+`
`+_.stack}return{value:u,source:c,stack:k,digest:null}}function p1(u,c,m){return{value:u,source:null,stack:m??null,digest:c??null}}function m1(u,c){try{console.error(c.value)}catch(m){setTimeout(function(){throw m})}}var gM=typeof WeakMap=="function"?WeakMap:Map;function M3(u,c,m){m=Ui(-1,m),m.tag=3,m.payload={element:null};var v=c.value;return m.callback=function(){af||(af=!0,I1=v),m1(u,c)},m}function P3(u,c,m){m=Ui(-1,m),m.tag=3;var v=u.type.getDerivedStateFromError;if(typeof v=="function"){var k=c.value;m.payload=function(){return v(k)},m.callback=function(){m1(u,c)}}var _=u.stateNode;return _!==null&&typeof _.componentDidCatch=="function"&&(m.callback=function(){m1(u,c),typeof v!="function"&&(Os===null?Os=new Set([this]):Os.add(this));var O=c.stack;this.componentDidCatch(c.value,{componentStack:O!==null?O:""})}),m}function O3(u,c,m){var v=u.pingCache;if(v===null){v=u.pingCache=new gM;var k=new Set;v.set(c,k)}else k=v.get(c),k===void 0&&(k=new Set,v.set(c,k));k.has(m)||(k.add(m),u=PM.bind(null,u,c,m),c.then(u,u))}function A3(u){do{var c;if((c=u.tag===13)&&(c=u.memoizedState,c=c!==null?c.dehydrated!==null:!0),c)return u;u=u.return}while(u!==null);return null}function R3(u,c,m,v,k){return u.mode&1?(u.flags|=65536,u.lanes=k,u):(u===c?u.flags|=65536:(u.flags|=128,m.flags|=131072,m.flags&=-52805,m.tag===1&&(m.alternate===null?m.tag=17:(c=Ui(-1,1),c.tag=2,Ps(m,c,1))),m.lanes|=1),u)}var yM=a.ReactCurrentOwner,Wn=!1;function Rn(u,c,m,v){c.child=u===null?Xw(c,null,m,v):pl(c,u.child,m,v)}function L3(u,c,m,v,k){m=m.render;var _=c.ref;return gl(c,k),v=o1(u,c,m,v,_,k),m=a1(),u!==null&&!Wn?(c.updateQueue=u.updateQueue,c.flags&=-2053,u.lanes&=~k,Hi(u,c,k)):(ht&&m&&V0(c),c.flags|=1,Rn(u,c,v,k),c.child)}function I3(u,c,m,v,k){if(u===null){var _=m.type;return typeof _=="function"&&!U1(_)&&_.defaultProps===void 0&&m.compare===null&&m.defaultProps===void 0?(c.tag=15,c.type=_,D3(u,c,_,v,k)):(u=ff(m.type,null,v,c,c.mode,k),u.ref=c.ref,u.return=c,c.child=u)}if(_=u.child,!(u.lanes&k)){var O=_.memoizedProps;if(m=m.compare,m=m!==null?m:Lh,m(O,v)&&u.ref===c.ref)return Hi(u,c,k)}return c.flags|=1,u=Is(_,v),u.ref=c.ref,u.return=c,c.child=u}function D3(u,c,m,v,k){if(u!==null){var _=u.memoizedProps;if(Lh(_,v)&&u.ref===c.ref)if(Wn=!1,c.pendingProps=v=_,(u.lanes&k)!==0)u.flags&131072&&(Wn=!0);else return c.lanes=u.lanes,Hi(u,c,k)}return g1(u,c,m,v,k)}function F3(u,c,m){var v=c.pendingProps,k=v.children,_=u!==null?u.memoizedState:null;if(v.mode==="hidden")if(!(c.mode&1))c.memoizedState={baseLanes:0,cachePool:null,transitions:null},tt(wl,lr),lr|=m;else{if(!(m&1073741824))return u=_!==null?_.baseLanes|m:m,c.lanes=c.childLanes=1073741824,c.memoizedState={baseLanes:u,cachePool:null,transitions:null},c.updateQueue=null,tt(wl,lr),lr|=u,null;c.memoizedState={baseLanes:0,cachePool:null,transitions:null},v=_!==null?_.baseLanes:m,tt(wl,lr),lr|=v}else _!==null?(v=_.baseLanes|m,c.memoizedState=null):v=m,tt(wl,lr),lr|=v;return Rn(u,c,k,m),c.child}function j3(u,c){var m=c.ref;(u===null&&m!==null||u!==null&&u.ref!==m)&&(c.flags|=512,c.flags|=2097152)}function g1(u,c,m,v,k){var _=$n(m)?$o:yn.current;return _=cl(c,_),gl(c,k),m=o1(u,c,m,v,_,k),v=a1(),u!==null&&!Wn?(c.updateQueue=u.updateQueue,c.flags&=-2053,u.lanes&=~k,Hi(u,c,k)):(ht&&v&&V0(c),c.flags|=1,Rn(u,c,m,k),c.child)}function z3(u,c,m,v,k){if($n(m)){var _=!0;Eh(c)}else _=!1;if(gl(c,k),c.stateNode===null)qh(u,c),N3(c,m,v),f1(c,m,v,k),v=!0;else if(u===null){var O=c.stateNode,D=c.memoizedProps;O.props=D;var G=O.context,ne=m.contextType;typeof ne=="object"&&ne!==null?ne=Cr(ne):(ne=$n(m)?$o:yn.current,ne=cl(c,ne));var he=m.getDerivedStateFromProps,Ce=typeof he=="function"||typeof O.getSnapshotBeforeUpdate=="function";Ce||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(D!==v||G!==ne)&&T3(c,O,v,ne),Ms=!1;var ae=c.memoizedState;O.state=ae,zh(c,v,O,k),G=c.memoizedState,D!==v||ae!==G||Gn.current||Ms?(typeof he=="function"&&(h1(c,m,he,v),G=c.memoizedState),(D=Ms||_3(c,m,D,v,ae,G,ne))?(Ce||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount()),typeof O.componentDidMount=="function"&&(c.flags|=4194308)):(typeof O.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=v,c.memoizedState=G),O.props=v,O.state=G,O.context=ne,v=D):(typeof O.componentDidMount=="function"&&(c.flags|=4194308),v=!1)}else{O=c.stateNode,t3(u,c),D=c.memoizedProps,ne=c.type===c.elementType?D:qr(c.type,D),O.props=ne,Ce=c.pendingProps,ae=O.context,G=m.contextType,typeof G=="object"&&G!==null?G=Cr(G):(G=$n(m)?$o:yn.current,G=cl(c,G));var at=m.getDerivedStateFromProps;(he=typeof at=="function"||typeof O.getSnapshotBeforeUpdate=="function")||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(D!==Ce||ae!==G)&&T3(c,O,v,G),Ms=!1,ae=c.memoizedState,O.state=ae,zh(c,v,O,k);var Je=c.memoizedState;D!==Ce||ae!==Je||Gn.current||Ms?(typeof at=="function"&&(h1(c,m,at,v),Je=c.memoizedState),(ne=Ms||_3(c,m,ne,v,ae,Je,G)||!1)?(he||typeof O.UNSAFE_componentWillUpdate!="function"&&typeof O.componentWillUpdate!="function"||(typeof O.componentWillUpdate=="function"&&O.componentWillUpdate(v,Je,G),typeof O.UNSAFE_componentWillUpdate=="function"&&O.UNSAFE_componentWillUpdate(v,Je,G)),typeof O.componentDidUpdate=="function"&&(c.flags|=4),typeof O.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof O.componentDidUpdate!="function"||D===u.memoizedProps&&ae===u.memoizedState||(c.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||D===u.memoizedProps&&ae===u.memoizedState||(c.flags|=1024),c.memoizedProps=v,c.memoizedState=Je),O.props=v,O.state=Je,O.context=G,v=ne):(typeof O.componentDidUpdate!="function"||D===u.memoizedProps&&ae===u.memoizedState||(c.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||D===u.memoizedProps&&ae===u.memoizedState||(c.flags|=1024),v=!1)}return y1(u,c,m,v,_,k)}function y1(u,c,m,v,k,_){j3(u,c);var O=(c.flags&128)!==0;if(!v&&!O)return k&&Bw(c,m,!1),Hi(u,c,_);v=c.stateNode,yM.current=c;var D=O&&typeof m.getDerivedStateFromError!="function"?null:v.render();return c.flags|=1,u!==null&&O?(c.child=pl(c,u.child,null,_),c.child=pl(c,null,D,_)):Rn(u,c,D,_),c.memoizedState=v.state,k&&Bw(c,m,!0),c.child}function B3(u){var c=u.stateNode;c.pendingContext?jw(u,c.pendingContext,c.pendingContext!==c.context):c.context&&jw(u,c.context,!1),e1(u,c.containerInfo)}function U3(u,c,m,v,k){return fl(),K0(k),c.flags|=256,Rn(u,c,m,v),c.child}var v1={dehydrated:null,treeContext:null,retryLane:0};function x1(u){return{baseLanes:u,cachePool:null,transitions:null}}function H3(u,c,m){var v=c.pendingProps,k=vt.current,_=!1,O=(c.flags&128)!==0,D;if((D=O)||(D=u!==null&&u.memoizedState===null?!1:(k&2)!==0),D?(_=!0,c.flags&=-129):(u===null||u.memoizedState!==null)&&(k|=1),tt(vt,k&1),u===null)return W0(c),u=c.memoizedState,u!==null&&(u=u.dehydrated,u!==null)?(c.mode&1?O0(u)?c.lanes=8:c.lanes=1073741824:c.lanes=1,null):(O=v.children,u=v.fallback,_?(v=c.mode,_=c.child,O={mode:"hidden",children:O},!(v&1)&&_!==null?(_.childLanes=0,_.pendingProps=O):_=pf(O,v,0,null),u=ea(u,v,m,null),_.return=c,u.return=c,_.sibling=u,c.child=_,c.child.memoizedState=x1(m),c.memoizedState=v1,u):S1(c,O));if(k=u.memoizedState,k!==null&&(D=k.dehydrated,D!==null))return vM(u,c,O,v,D,k,m);if(_){_=v.fallback,O=c.mode,k=u.child,D=k.sibling;var G={mode:"hidden",children:v.children};return!(O&1)&&c.child!==k?(v=c.child,v.childLanes=0,v.pendingProps=G,c.deletions=null):(v=Is(k,G),v.subtreeFlags=k.subtreeFlags&14680064),D!==null?_=Is(D,_):(_=ea(_,O,m,null),_.flags|=2),_.return=c,v.return=c,v.sibling=_,c.child=v,v=_,_=c.child,O=u.child.memoizedState,O=O===null?x1(m):{baseLanes:O.baseLanes|m,cachePool:null,transitions:O.transitions},_.memoizedState=O,_.childLanes=u.childLanes&~m,c.memoizedState=v1,v}return _=u.child,u=_.sibling,v=Is(_,{mode:"visible",children:v.children}),!(c.mode&1)&&(v.lanes=m),v.return=c,v.sibling=null,u!==null&&(m=c.deletions,m===null?(c.deletions=[u],c.flags|=16):m.push(u)),c.child=v,c.memoizedState=null,v}function S1(u,c){return c=pf({mode:"visible",children:c},u.mode,0,null),c.return=u,u.child=c}function Kh(u,c,m,v){return v!==null&&K0(v),pl(c,u.child,null,m),u=S1(c,c.pendingProps.children),u.flags|=2,c.memoizedState=null,u}function vM(u,c,m,v,k,_,O){if(m)return c.flags&256?(c.flags&=-257,v=p1(Error(o(422))),Kh(u,c,O,v)):c.memoizedState!==null?(c.child=u.child,c.flags|=128,null):(_=v.fallback,k=c.mode,v=pf({mode:"visible",children:v.children},k,0,null),_=ea(_,k,O,null),_.flags|=2,v.return=c,_.return=c,v.sibling=_,c.child=v,c.mode&1&&pl(c,u.child,null,O),c.child.memoizedState=x1(O),c.memoizedState=v1,_);if(!(c.mode&1))return Kh(u,c,O,null);if(O0(k))return v=O7(k).digest,_=Error(o(419)),v=p1(_,v,void 0),Kh(u,c,O,v);if(m=(O&u.childLanes)!==0,Wn||m){if(v=en,v!==null){switch(O&-O){case 4:k=2;break;case 16:k=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:k=32;break;case 536870912:k=268435456;break;default:k=0}k=k&(v.suspendedLanes|O)?0:k,k!==0&&k!==_.retryLane&&(_.retryLane=k,mi(u,k),_r(v,u,k,-1))}return B1(),v=p1(Error(o(421))),Kh(u,c,O,v)}return Fw(k)?(c.flags|=128,c.child=u.child,c=OM.bind(null,u),A7(k,c),null):(u=_.treeContext,st&&(kr=I7(k),ar=c,ht=!0,Kr=null,ec=!1,u!==null&&(Sr[wr++]=zi,Sr[wr++]=Bi,Sr[wr++]=Wo,zi=u.id,Bi=u.overflow,Wo=c)),c=S1(c,v.children),c.flags|=4096,c)}function V3(u,c,m){u.lanes|=c;var v=u.alternate;v!==null&&(v.lanes|=c),J0(u.return,c,m)}function w1(u,c,m,v,k){var _=u.memoizedState;_===null?u.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:v,tail:m,tailMode:k}:(_.isBackwards=c,_.rendering=null,_.renderingStartTime=0,_.last=v,_.tail=m,_.tailMode=k)}function G3(u,c,m){var v=c.pendingProps,k=v.revealOrder,_=v.tail;if(Rn(u,c,v.children,m),v=vt.current,v&2)v=v&1|2,c.flags|=128;else{if(u!==null&&u.flags&128)e:for(u=c.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&V3(u,m,c);else if(u.tag===19)V3(u,m,c);else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===c)break e;for(;u.sibling===null;){if(u.return===null||u.return===c)break e;u=u.return}u.sibling.return=u.return,u=u.sibling}v&=1}if(tt(vt,v),!(c.mode&1))c.memoizedState=null;else switch(k){case"forwards":for(m=c.child,k=null;m!==null;)u=m.alternate,u!==null&&Bh(u)===null&&(k=m),m=m.sibling;m=k,m===null?(k=c.child,c.child=null):(k=m.sibling,m.sibling=null),w1(c,!1,k,m,_);break;case"backwards":for(m=null,k=c.child,c.child=null;k!==null;){if(u=k.alternate,u!==null&&Bh(u)===null){c.child=k;break}u=k.sibling,k.sibling=m,m=k,k=u}w1(c,!0,m,null,_);break;case"together":w1(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function qh(u,c){!(c.mode&1)&&u!==null&&(u.alternate=null,c.alternate=null,c.flags|=2)}function Hi(u,c,m){if(u!==null&&(c.dependencies=u.dependencies),Yo|=c.lanes,!(m&c.childLanes))return null;if(u!==null&&c.child!==u.child)throw Error(o(153));if(c.child!==null){for(u=c.child,m=Is(u,u.pendingProps),c.child=m,m.return=c;u.sibling!==null;)u=u.sibling,m=m.sibling=Is(u,u.pendingProps),m.return=c;m.sibling=null}return c.child}function xM(u,c,m){switch(c.tag){case 3:B3(c),fl();break;case 5:i3(c);break;case 1:$n(c.type)&&Eh(c);break;case 4:e1(c,c.stateNode.containerInfo);break;case 10:Zw(c,c.type._context,c.memoizedProps.value);break;case 13:var v=c.memoizedState;if(v!==null)return v.dehydrated!==null?(tt(vt,vt.current&1),c.flags|=128,null):m&c.child.childLanes?H3(u,c,m):(tt(vt,vt.current&1),u=Hi(u,c,m),u!==null?u.sibling:null);tt(vt,vt.current&1);break;case 19:if(v=(m&c.childLanes)!==0,u.flags&128){if(v)return G3(u,c,m);c.flags|=128}var k=c.memoizedState;if(k!==null&&(k.rendering=null,k.tail=null,k.lastEffect=null),tt(vt,vt.current),v)break;return null;case 22:case 23:return c.lanes=0,F3(u,c,m)}return Hi(u,c,m)}function vi(u){u.flags|=4}function $3(u,c){if(u!==null&&u.child===c.child)return!0;if(c.flags&16)return!1;for(u=c.child;u!==null;){if(u.flags&12854||u.subtreeFlags&12854)return!1;u=u.sibling}return!0}var lc,uc,Qh,Yh;if(Ne)lc=function(u,c){for(var m=c.child;m!==null;){if(m.tag===5||m.tag===6)oe(u,m.stateNode);else if(m.tag!==4&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===c)break;for(;m.sibling===null;){if(m.return===null||m.return===c)return;m=m.return}m.sibling.return=m.return,m=m.sibling}},uc=function(){},Qh=function(u,c,m,v,k){if(u=u.memoizedProps,u!==v){var _=c.stateNode,O=gi(br.current);m=rt(_,m,u,v,k,O),(c.updateQueue=m)&&vi(c)}},Yh=function(u,c,m,v){m!==v&&vi(c)};else if(et){lc=function(u,c,m,v){for(var k=c.child;k!==null;){if(k.tag===5){var _=k.stateNode;m&&v&&(_=Iw(_,k.type,k.memoizedProps,k)),oe(u,_)}else if(k.tag===6)_=k.stateNode,m&&v&&(_=Dw(_,k.memoizedProps,k)),oe(u,_);else if(k.tag!==4){if(k.tag===22&&k.memoizedState!==null)_=k.child,_!==null&&(_.return=k),lc(u,k,!0,!0);else if(k.child!==null){k.child.return=k,k=k.child;continue}}if(k===c)break;for(;k.sibling===null;){if(k.return===null||k.return===c)return;k=k.return}k.sibling.return=k.return,k=k.sibling}};var W3=function(u,c,m,v){for(var k=c.child;k!==null;){if(k.tag===5){var _=k.stateNode;m&&v&&(_=Iw(_,k.type,k.memoizedProps,k)),Lw(u,_)}else if(k.tag===6)_=k.stateNode,m&&v&&(_=Dw(_,k.memoizedProps,k)),Lw(u,_);else if(k.tag!==4){if(k.tag===22&&k.memoizedState!==null)_=k.child,_!==null&&(_.return=k),W3(u,k,!0,!0);else if(k.child!==null){k.child.return=k,k=k.child;continue}}if(k===c)break;for(;k.sibling===null;){if(k.return===null||k.return===c)return;k=k.return}k.sibling.return=k.return,k=k.sibling}};uc=function(u,c){var m=c.stateNode;if(!$3(u,c)){u=m.containerInfo;var v=Rw(u);W3(v,c,!1,!1),m.pendingChildren=v,vi(c),N7(u,v)}},Qh=function(u,c,m,v,k){var _=u.stateNode,O=u.memoizedProps;if((u=$3(u,c))&&O===v)c.stateNode=_;else{var D=c.stateNode,G=gi(br.current),ne=null;O!==v&&(ne=rt(D,m,O,v,k,G)),u&&ne===null?c.stateNode=_:(_=_7(_,ne,m,O,v,c,u,D),_e(_,m,v,k,G)&&vi(c),c.stateNode=_,u?vi(c):lc(_,c,!1,!1))}},Yh=function(u,c,m,v){m!==v?(u=gi(yl.current),m=gi(br.current),c.stateNode=it(v,u,m,c),vi(c)):c.stateNode=u.stateNode}}else uc=function(){},Qh=function(){},Yh=function(){};function cc(u,c){if(!ht)switch(u.tailMode){case"hidden":c=u.tail;for(var m=null;c!==null;)c.alternate!==null&&(m=c),c=c.sibling;m===null?u.tail=null:m.sibling=null;break;case"collapsed":m=u.tail;for(var v=null;m!==null;)m.alternate!==null&&(v=m),m=m.sibling;v===null?c||u.tail===null?u.tail=null:u.tail.sibling=null:v.sibling=null}}function xn(u){var c=u.alternate!==null&&u.alternate.child===u.child,m=0,v=0;if(c)for(var k=u.child;k!==null;)m|=k.lanes|k.childLanes,v|=k.subtreeFlags&14680064,v|=k.flags&14680064,k.return=u,k=k.sibling;else for(k=u.child;k!==null;)m|=k.lanes|k.childLanes,v|=k.subtreeFlags,v|=k.flags,k.return=u,k=k.sibling;return u.subtreeFlags|=v,u.childLanes=m,c}function SM(u,c,m){var v=c.pendingProps;switch(G0(c),c.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return xn(c),null;case 1:return $n(c.type)&&bh(),xn(c),null;case 3:return m=c.stateNode,vl(),ot(Gn),ot(yn),r1(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(u===null||u.child===null)&&(Rh(c)?vi(c):u===null||u.memoizedState.isDehydrated&&!(c.flags&256)||(c.flags|=1024,Kr!==null&&(j1(Kr),Kr=null))),uc(u,c),xn(c),null;case 5:t1(c),m=gi(yl.current);var k=c.type;if(u!==null&&c.stateNode!=null)Qh(u,c,k,v,m),u.ref!==c.ref&&(c.flags|=512,c.flags|=2097152);else{if(!v){if(c.stateNode===null)throw Error(o(166));return xn(c),null}if(u=gi(br.current),Rh(c)){if(!st)throw Error(o(175));u=D7(c.stateNode,c.type,c.memoizedProps,m,u,c,!ec),c.updateQueue=u,u!==null&&vi(c)}else{var _=Y(k,v,m,u,c);lc(_,c,!1,!1),c.stateNode=_,_e(_,k,v,m,u)&&vi(c)}c.ref!==null&&(c.flags|=512,c.flags|=2097152)}return xn(c),null;case 6:if(u&&c.stateNode!=null)Yh(u,c,u.memoizedProps,v);else{if(typeof v!="string"&&c.stateNode===null)throw Error(o(166));if(u=gi(yl.current),m=gi(br.current),Rh(c)){if(!st)throw Error(o(176));if(u=c.stateNode,m=c.memoizedProps,(v=F7(u,m,c,!ec))&&(k=ar,k!==null))switch(k.tag){case 3:$7(k.stateNode.containerInfo,u,m,(k.mode&1)!==0);break;case 5:W7(k.type,k.memoizedProps,k.stateNode,u,m,(k.mode&1)!==0)}v&&vi(c)}else c.stateNode=it(v,u,m,c)}return xn(c),null;case 13:if(ot(vt),v=c.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(ht&&kr!==null&&c.mode&1&&!(c.flags&128))Qw(),fl(),c.flags|=98560,k=!1;else if(k=Rh(c),v!==null&&v.dehydrated!==null){if(u===null){if(!k)throw Error(o(318));if(!st)throw Error(o(344));if(k=c.memoizedState,k=k!==null?k.dehydrated:null,!k)throw Error(o(317));j7(k,c)}else fl(),!(c.flags&128)&&(c.memoizedState=null),c.flags|=4;xn(c),k=!1}else Kr!==null&&(j1(Kr),Kr=null),k=!0;if(!k)return c.flags&65536?c:null}return c.flags&128?(c.lanes=m,c):(m=v!==null,m!==(u!==null&&u.memoizedState!==null)&&m&&(c.child.flags|=8192,c.mode&1&&(u===null||vt.current&1?Vt===0&&(Vt=3):B1())),c.updateQueue!==null&&(c.flags|=4),xn(c),null);case 4:return vl(),uc(u,c),u===null&&Ye(c.stateNode.containerInfo),xn(c),null;case 10:return Y0(c.type._context),xn(c),null;case 17:return $n(c.type)&&bh(),xn(c),null;case 19:if(ot(vt),k=c.memoizedState,k===null)return xn(c),null;if(v=(c.flags&128)!==0,_=k.rendering,_===null)if(v)cc(k,!1);else{if(Vt!==0||u!==null&&u.flags&128)for(u=c.child;u!==null;){if(_=Bh(u),_!==null){for(c.flags|=128,cc(k,!1),u=_.updateQueue,u!==null&&(c.updateQueue=u,c.flags|=4),c.subtreeFlags=0,u=m,m=c.child;m!==null;)v=m,k=u,v.flags&=14680066,_=v.alternate,_===null?(v.childLanes=0,v.lanes=k,v.child=null,v.subtreeFlags=0,v.memoizedProps=null,v.memoizedState=null,v.updateQueue=null,v.dependencies=null,v.stateNode=null):(v.childLanes=_.childLanes,v.lanes=_.lanes,v.child=_.child,v.subtreeFlags=0,v.deletions=null,v.memoizedProps=_.memoizedProps,v.memoizedState=_.memoizedState,v.updateQueue=_.updateQueue,v.type=_.type,k=_.dependencies,v.dependencies=k===null?null:{lanes:k.lanes,firstContext:k.firstContext}),m=m.sibling;return tt(vt,vt.current&1|2),c.child}u=u.sibling}k.tail!==null&&Xt()>L1&&(c.flags|=128,v=!0,cc(k,!1),c.lanes=4194304)}else{if(!v)if(u=Bh(_),u!==null){if(c.flags|=128,v=!0,u=u.updateQueue,u!==null&&(c.updateQueue=u,c.flags|=4),cc(k,!0),k.tail===null&&k.tailMode==="hidden"&&!_.alternate&&!ht)return xn(c),null}else 2*Xt()-k.renderingStartTime>L1&&m!==1073741824&&(c.flags|=128,v=!0,cc(k,!1),c.lanes=4194304);k.isBackwards?(_.sibling=c.child,c.child=_):(u=k.last,u!==null?u.sibling=_:c.child=_,k.last=_)}return k.tail!==null?(c=k.tail,k.rendering=c,k.tail=c.sibling,k.renderingStartTime=Xt(),c.sibling=null,u=vt.current,tt(vt,v?u&1|2:u&1),c):(xn(c),null);case 22:case 23:return z1(),m=c.memoizedState!==null,u!==null&&u.memoizedState!==null!==m&&(c.flags|=8192),m&&c.mode&1?lr&1073741824&&(xn(c),Ne&&c.subtreeFlags&6&&(c.flags|=8192)):xn(c),null;case 24:return null;case 25:return null}throw Error(o(156,c.tag))}function wM(u,c){switch(G0(c),c.tag){case 1:return $n(c.type)&&bh(),u=c.flags,u&65536?(c.flags=u&-65537|128,c):null;case 3:return vl(),ot(Gn),ot(yn),r1(),u=c.flags,u&65536&&!(u&128)?(c.flags=u&-65537|128,c):null;case 5:return t1(c),null;case 13:if(ot(vt),u=c.memoizedState,u!==null&&u.dehydrated!==null){if(c.alternate===null)throw Error(o(340));fl()}return u=c.flags,u&65536?(c.flags=u&-65537|128,c):null;case 19:return ot(vt),null;case 4:return vl(),null;case 10:return Y0(c.type._context),null;case 22:case 23:return z1(),null;case 24:return null;default:return null}}var Jh=!1,Sn=!1,kM=typeof WeakSet=="function"?WeakSet:Set,ce=null;function Sl(u,c){var m=u.ref;if(m!==null)if(typeof m=="function")try{m(null)}catch(v){ft(u,c,v)}else m.current=null}function k1(u,c,m){try{m()}catch(v){ft(u,c,v)}}var K3=!1;function CM(u,c){for(re(u.containerInfo),ce=c;ce!==null;)if(u=ce,c=u.child,(u.subtreeFlags&1028)!==0&&c!==null)c.return=u,ce=c;else for(;ce!==null;){u=ce;try{var m=u.alternate;if(u.flags&1024)switch(u.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var v=m.memoizedProps,k=m.memoizedState,_=u.stateNode,O=_.getSnapshotBeforeUpdate(u.elementType===u.type?v:qr(u.type,v),k);_.__reactInternalSnapshotBeforeUpdate=O}break;case 3:Ne&&E7(u.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(D){ft(u,u.return,D)}if(c=u.sibling,c!==null){c.return=u.return,ce=c;break}ce=u.return}return m=K3,K3=!1,m}function dc(u,c,m){var v=c.updateQueue;if(v=v!==null?v.lastEffect:null,v!==null){var k=v=v.next;do{if((k.tag&u)===u){var _=k.destroy;k.destroy=void 0,_!==void 0&&k1(c,m,_)}k=k.next}while(k!==v)}}function Xh(u,c){if(c=c.updateQueue,c=c!==null?c.lastEffect:null,c!==null){var m=c=c.next;do{if((m.tag&u)===u){var v=m.create;m.destroy=v()}m=m.next}while(m!==c)}}function C1(u){var c=u.ref;if(c!==null){var m=u.stateNode;switch(u.tag){case 5:u=ie(m);break;default:u=m}typeof c=="function"?c(u):c.current=u}}function q3(u){var c=u.alternate;c!==null&&(u.alternate=null,q3(c)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(c=u.stateNode,c!==null&&Gr(c)),u.stateNode=null,u.return=null,u.dependencies=null,u.memoizedProps=null,u.memoizedState=null,u.pendingProps=null,u.stateNode=null,u.updateQueue=null}function Q3(u){return u.tag===5||u.tag===3||u.tag===4}function Y3(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||Q3(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function b1(u,c,m){var v=u.tag;if(v===5||v===6)u=u.stateNode,c?v7(m,u,c):f7(m,u);else if(v!==4&&(u=u.child,u!==null))for(b1(u,c,m),u=u.sibling;u!==null;)b1(u,c,m),u=u.sibling}function E1(u,c,m){var v=u.tag;if(v===5||v===6)u=u.stateNode,c?y7(m,u,c):h7(m,u);else if(v!==4&&(u=u.child,u!==null))for(E1(u,c,m),u=u.sibling;u!==null;)E1(u,c,m),u=u.sibling}var ln=null,Qr=!1;function xi(u,c,m){for(m=m.child;m!==null;)_1(u,c,m),m=m.sibling}function _1(u,c,m){if(fi&&typeof fi.onCommitFiberUnmount=="function")try{fi.onCommitFiberUnmount(Mh,m)}catch{}switch(m.tag){case 5:Sn||Sl(m,c);case 6:if(Ne){var v=ln,k=Qr;ln=null,xi(u,c,m),ln=v,Qr=k,ln!==null&&(Qr?S7(ln,m.stateNode):x7(ln,m.stateNode))}else xi(u,c,m);break;case 18:Ne&&ln!==null&&(Qr?V7(ln,m.stateNode):H7(ln,m.stateNode));break;case 4:Ne?(v=ln,k=Qr,ln=m.stateNode.containerInfo,Qr=!0,xi(u,c,m),ln=v,Qr=k):(et&&(v=m.stateNode.containerInfo,k=Rw(v),P0(v,k)),xi(u,c,m));break;case 0:case 11:case 14:case 15:if(!Sn&&(v=m.updateQueue,v!==null&&(v=v.lastEffect,v!==null))){k=v=v.next;do{var _=k,O=_.destroy;_=_.tag,O!==void 0&&(_&2||_&4)&&k1(m,c,O),k=k.next}while(k!==v)}xi(u,c,m);break;case 1:if(!Sn&&(Sl(m,c),v=m.stateNode,typeof v.componentWillUnmount=="function"))try{v.props=m.memoizedProps,v.state=m.memoizedState,v.componentWillUnmount()}catch(D){ft(m,c,D)}xi(u,c,m);break;case 21:xi(u,c,m);break;case 22:m.mode&1?(Sn=(v=Sn)||m.memoizedState!==null,xi(u,c,m),Sn=v):xi(u,c,m);break;default:xi(u,c,m)}}function J3(u){var c=u.updateQueue;if(c!==null){u.updateQueue=null;var m=u.stateNode;m===null&&(m=u.stateNode=new kM),c.forEach(function(v){var k=AM.bind(null,u,v);m.has(v)||(m.add(v),v.then(k,k))})}}function Yr(u,c){var m=c.deletions;if(m!==null)for(var v=0;v<m.length;v++){var k=m[v];try{var _=u,O=c;if(Ne){var D=O;e:for(;D!==null;){switch(D.tag){case 5:ln=D.stateNode,Qr=!1;break e;case 3:ln=D.stateNode.containerInfo,Qr=!0;break e;case 4:ln=D.stateNode.containerInfo,Qr=!0;break e}D=D.return}if(ln===null)throw Error(o(160));_1(_,O,k),ln=null,Qr=!1}else _1(_,O,k);var G=k.alternate;G!==null&&(G.return=null),k.return=null}catch(ne){ft(k,c,ne)}}if(c.subtreeFlags&12854)for(c=c.child;c!==null;)X3(c,u),c=c.sibling}function X3(u,c){var m=u.alternate,v=u.flags;switch(u.tag){case 0:case 11:case 14:case 15:if(Yr(c,u),Si(u),v&4){try{dc(3,u,u.return),Xh(3,u)}catch(ae){ft(u,u.return,ae)}try{dc(5,u,u.return)}catch(ae){ft(u,u.return,ae)}}break;case 1:Yr(c,u),Si(u),v&512&&m!==null&&Sl(m,m.return);break;case 5:if(Yr(c,u),Si(u),v&512&&m!==null&&Sl(m,m.return),Ne){if(u.flags&32){var k=u.stateNode;try{Aw(k)}catch(ae){ft(u,u.return,ae)}}if(v&4&&(k=u.stateNode,k!=null)){var _=u.memoizedProps;if(m=m!==null?m.memoizedProps:_,v=u.type,c=u.updateQueue,u.updateQueue=null,c!==null)try{g7(k,c,v,m,_,u)}catch(ae){ft(u,u.return,ae)}}}break;case 6:if(Yr(c,u),Si(u),v&4&&Ne){if(u.stateNode===null)throw Error(o(162));k=u.stateNode,_=u.memoizedProps,m=m!==null?m.memoizedProps:_;try{p7(k,m,_)}catch(ae){ft(u,u.return,ae)}}break;case 3:if(Yr(c,u),Si(u),v&4){if(Ne&&st&&m!==null&&m.memoizedState.isDehydrated)try{B7(c.containerInfo)}catch(ae){ft(u,u.return,ae)}if(et){k=c.containerInfo,_=c.pendingChildren;try{P0(k,_)}catch(ae){ft(u,u.return,ae)}}}break;case 4:if(Yr(c,u),Si(u),v&4&&et){_=u.stateNode,k=_.containerInfo,_=_.pendingChildren;try{P0(k,_)}catch(ae){ft(u,u.return,ae)}}break;case 13:Yr(c,u),Si(u),k=u.child,k.flags&8192&&(_=k.memoizedState!==null,k.stateNode.isHidden=_,!_||k.alternate!==null&&k.alternate.memoizedState!==null||(R1=Xt())),v&4&&J3(u);break;case 22:var O=m!==null&&m.memoizedState!==null;if(u.mode&1?(Sn=(m=Sn)||O,Yr(c,u),Sn=m):Yr(c,u),Si(u),v&8192){if(m=u.memoizedState!==null,(u.stateNode.isHidden=m)&&!O&&u.mode&1)for(ce=u,v=u.child;v!==null;){for(c=ce=v;ce!==null;){O=ce;var D=O.child;switch(O.tag){case 0:case 11:case 14:case 15:dc(4,O,O.return);break;case 1:Sl(O,O.return);var G=O.stateNode;if(typeof G.componentWillUnmount=="function"){var ne=O,he=O.return;try{var Ce=ne;G.props=Ce.memoizedProps,G.state=Ce.memoizedState,G.componentWillUnmount()}catch(ae){ft(ne,he,ae)}}break;case 5:Sl(O,O.return);break;case 22:if(O.memoizedState!==null){t4(c);continue}}D!==null?(D.return=O,ce=D):t4(c)}v=v.sibling}if(Ne){e:if(v=null,Ne)for(c=u;;){if(c.tag===5){if(v===null){v=c;try{k=c.stateNode,m?w7(k):C7(c.stateNode,c.memoizedProps)}catch(ae){ft(u,u.return,ae)}}}else if(c.tag===6){if(v===null)try{_=c.stateNode,m?k7(_):b7(_,c.memoizedProps)}catch(ae){ft(u,u.return,ae)}}else if((c.tag!==22&&c.tag!==23||c.memoizedState===null||c===u)&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===u)break e;for(;c.sibling===null;){if(c.return===null||c.return===u)break e;v===c&&(v=null),c=c.return}v===c&&(v=null),c.sibling.return=c.return,c=c.sibling}}}break;case 19:Yr(c,u),Si(u),v&4&&J3(u);break;case 21:break;default:Yr(c,u),Si(u)}}function Si(u){var c=u.flags;if(c&2){try{if(Ne){e:{for(var m=u.return;m!==null;){if(Q3(m)){var v=m;break e}m=m.return}throw Error(o(160))}switch(v.tag){case 5:var k=v.stateNode;v.flags&32&&(Aw(k),v.flags&=-33);var _=Y3(u);E1(u,_,k);break;case 3:case 4:var O=v.stateNode.containerInfo,D=Y3(u);b1(u,D,O);break;default:throw Error(o(161))}}}catch(G){ft(u,u.return,G)}u.flags&=-3}c&4096&&(u.flags&=-4097)}function bM(u,c,m){ce=u,Z3(u)}function Z3(u,c,m){for(var v=(u.mode&1)!==0;ce!==null;){var k=ce,_=k.child;if(k.tag===22&&v){var O=k.memoizedState!==null||Jh;if(!O){var D=k.alternate,G=D!==null&&D.memoizedState!==null||Sn;D=Jh;var ne=Sn;if(Jh=O,(Sn=G)&&!ne)for(ce=k;ce!==null;)O=ce,G=O.child,O.tag===22&&O.memoizedState!==null?n4(k):G!==null?(G.return=O,ce=G):n4(k);for(;_!==null;)ce=_,Z3(_),_=_.sibling;ce=k,Jh=D,Sn=ne}e4(u)}else k.subtreeFlags&8772&&_!==null?(_.return=k,ce=_):e4(u)}}function e4(u){for(;ce!==null;){var c=ce;if(c.flags&8772){var m=c.alternate;try{if(c.flags&8772)switch(c.tag){case 0:case 11:case 15:Sn||Xh(5,c);break;case 1:var v=c.stateNode;if(c.flags&4&&!Sn)if(m===null)v.componentDidMount();else{var k=c.elementType===c.type?m.memoizedProps:qr(c.type,m.memoizedProps);v.componentDidUpdate(k,m.memoizedState,v.__reactInternalSnapshotBeforeUpdate)}var _=c.updateQueue;_!==null&&r3(c,_,v);break;case 3:var O=c.updateQueue;if(O!==null){if(m=null,c.child!==null)switch(c.child.tag){case 5:m=ie(c.child.stateNode);break;case 1:m=c.child.stateNode}r3(c,O,m)}break;case 5:var D=c.stateNode;m===null&&c.flags&4&&m7(D,c.type,c.memoizedProps,c);break;case 6:break;case 4:break;case 12:break;case 13:if(st&&c.memoizedState===null){var G=c.alternate;if(G!==null){var ne=G.memoizedState;if(ne!==null){var he=ne.dehydrated;he!==null&&U7(he)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(o(163))}Sn||c.flags&512&&C1(c)}catch(Ce){ft(c,c.return,Ce)}}if(c===u){ce=null;break}if(m=c.sibling,m!==null){m.return=c.return,ce=m;break}ce=c.return}}function t4(u){for(;ce!==null;){var c=ce;if(c===u){ce=null;break}var m=c.sibling;if(m!==null){m.return=c.return,ce=m;break}ce=c.return}}function n4(u){for(;ce!==null;){var c=ce;try{switch(c.tag){case 0:case 11:case 15:var m=c.return;try{Xh(4,c)}catch(G){ft(c,m,G)}break;case 1:var v=c.stateNode;if(typeof v.componentDidMount=="function"){var k=c.return;try{v.componentDidMount()}catch(G){ft(c,k,G)}}var _=c.return;try{C1(c)}catch(G){ft(c,_,G)}break;case 5:var O=c.return;try{C1(c)}catch(G){ft(c,O,G)}}}catch(G){ft(c,c.return,G)}if(c===u){ce=null;break}var D=c.sibling;if(D!==null){D.return=c.return,ce=D;break}ce=c.return}}var Zh=0,ef=1,tf=2,nf=3,rf=4;if(typeof Symbol=="function"&&Symbol.for){var hc=Symbol.for;Zh=hc("selector.component"),ef=hc("selector.has_pseudo_class"),tf=hc("selector.role"),nf=hc("selector.test_id"),rf=hc("selector.text")}function N1(u){var c=hi(u);if(c!=null){if(typeof c.memoizedProps["data-testname"]!="string")throw Error(o(364));return c}if(u=o7(u),u===null)throw Error(o(362));return u.stateNode.current}function T1(u,c){switch(c.$$typeof){case Zh:if(u.type===c.value)return!0;break;case ef:e:{c=c.value,u=[u,0];for(var m=0;m<u.length;){var v=u[m++],k=u[m++],_=c[k];if(v.tag!==5||!Yu(v)){for(;_!=null&&T1(v,_);)k++,_=c[k];if(k===c.length){c=!0;break e}else for(v=v.child;v!==null;)u.push(v,k),v=v.sibling}}c=!1}return c;case tf:if(u.tag===5&&u7(u.stateNode,c.value))return!0;break;case rf:if((u.tag===5||u.tag===6)&&(u=l7(u),u!==null&&0<=u.indexOf(c.value)))return!0;break;case nf:if(u.tag===5&&(u=u.memoizedProps["data-testname"],typeof u=="string"&&u.toLowerCase()===c.value.toLowerCase()))return!0;break;default:throw Error(o(365))}return!1}function M1(u){switch(u.$$typeof){case Zh:return"<"+(A(u.value)||"Unknown")+">";case ef:return":has("+(M1(u)||"")+")";case tf:return'[role="'+u.value+'"]';case rf:return'"'+u.value+'"';case nf:return'[data-testname="'+u.value+'"]';default:throw Error(o(365))}}function r4(u,c){var m=[];u=[u,0];for(var v=0;v<u.length;){var k=u[v++],_=u[v++],O=c[_];if(k.tag!==5||!Yu(k)){for(;O!=null&&T1(k,O);)_++,O=c[_];if(_===c.length)m.push(k);else for(k=k.child;k!==null;)u.push(k,_),k=k.sibling}}return m}function P1(u,c){if(!Qu)throw Error(o(363));u=N1(u),u=r4(u,c),c=[],u=Array.from(u);for(var m=0;m<u.length;){var v=u[m++];if(v.tag===5)Yu(v)||c.push(v.stateNode);else for(v=v.child;v!==null;)u.push(v),v=v.sibling}return c}var EM=Math.ceil,sf=a.ReactCurrentDispatcher,O1=a.ReactCurrentOwner,Rt=a.ReactCurrentBatchConfig,Re=0,en=null,Dt=null,un=0,lr=0,wl=Ns(0),Vt=0,fc=null,Yo=0,of=0,A1=0,pc=null,Kn=null,R1=0,L1=1/0,Vi=null;function kl(){L1=Xt()+500}var af=!1,I1=null,Os=null,lf=!1,As=null,uf=0,mc=0,D1=null,cf=-1,df=0;function wn(){return Re&6?Xt():cf!==-1?cf:cf=Xt()}function Rs(u){return u.mode&1?Re&2&&un!==0?un&-un:aM.transition!==null?(df===0&&(df=Uw()),df):(u=Ue,u!==0?u:Es()):1}function _r(u,c,m,v){if(50<mc)throw mc=0,D1=null,Error(o(185));Zu(u,m,v),(!(Re&2)||u!==en)&&(u===en&&(!(Re&2)&&(of|=m),Vt===4&&Ls(u,un)),qn(u,v),m===1&&Re===0&&!(c.mode&1)&&(kl(),Ph&&pi()))}function qn(u,c){var m=u.callbackNode;X7(u,c);var v=Th(u,u===en?un:0);if(v===0)m!==null&&Vw(m),u.callbackNode=null,u.callbackPriority=0;else if(c=v&-v,u.callbackPriority!==c){if(m!=null&&Vw(m),c===1)u.tag===0?oM(s4.bind(null,u)):Gw(s4.bind(null,u)),_s?s7(function(){!(Re&6)&&pi()}):z0(B0,pi),m=null;else{switch(Hw(v)){case 1:m=B0;break;case 4:m=nM;break;case 16:m=U0;break;case 536870912:m=rM;break;default:m=U0}m=p4(m,i4.bind(null,u))}u.callbackPriority=c,u.callbackNode=m}}function i4(u,c){if(cf=-1,df=0,Re&6)throw Error(o(327));var m=u.callbackNode;if(Zo()&&u.callbackNode!==m)return null;var v=Th(u,u===en?un:0);if(v===0)return null;if(v&30||v&u.expiredLanes||c)c=hf(u,v);else{c=v;var k=Re;Re|=2;var _=l4();(en!==u||un!==c)&&(Vi=null,kl(),Jo(u,c));do try{TM();break}catch(D){a4(u,D)}while(!0);Q0(),sf.current=_,Re=k,Dt!==null?c=0:(en=null,un=0,c=Vt)}if(c!==0){if(c===2&&(k=D0(u),k!==0&&(v=k,c=F1(u,k))),c===1)throw m=fc,Jo(u,0),Ls(u,v),qn(u,Xt()),m;if(c===6)Ls(u,v);else{if(k=u.current.alternate,!(v&30)&&!_M(k)&&(c=hf(u,v),c===2&&(_=D0(u),_!==0&&(v=_,c=F1(u,_))),c===1))throw m=fc,Jo(u,0),Ls(u,v),qn(u,Xt()),m;switch(u.finishedWork=k,u.finishedLanes=v,c){case 0:case 1:throw Error(o(345));case 2:Xo(u,Kn,Vi);break;case 3:if(Ls(u,v),(v&130023424)===v&&(c=R1+500-Xt(),10<c)){if(Th(u,0)!==0)break;if(k=u.suspendedLanes,(k&v)!==v){wn(),u.pingedLanes|=u.suspendedLanes&k;break}u.timeoutHandle=F(Xo.bind(null,u,Kn,Vi),c);break}Xo(u,Kn,Vi);break;case 4:if(Ls(u,v),(v&4194240)===v)break;for(c=u.eventTimes,k=-1;0<v;){var O=31-$r(v);_=1<<O,O=c[O],O>k&&(k=O),v&=~_}if(v=k,v=Xt()-v,v=(120>v?120:480>v?480:1080>v?1080:1920>v?1920:3e3>v?3e3:4320>v?4320:1960*EM(v/1960))-v,10<v){u.timeoutHandle=F(Xo.bind(null,u,Kn,Vi),v);break}Xo(u,Kn,Vi);break;case 5:Xo(u,Kn,Vi);break;default:throw Error(o(329))}}}return qn(u,Xt()),u.callbackNode===m?i4.bind(null,u):null}function F1(u,c){var m=pc;return u.current.memoizedState.isDehydrated&&(Jo(u,c).flags|=256),u=hf(u,c),u!==2&&(c=Kn,Kn=m,c!==null&&j1(c)),u}function j1(u){Kn===null?Kn=u:Kn.push.apply(Kn,u)}function _M(u){for(var c=u;;){if(c.flags&16384){var m=c.updateQueue;if(m!==null&&(m=m.stores,m!==null))for(var v=0;v<m.length;v++){var k=m[v],_=k.getSnapshot;k=k.value;try{if(!Wr(_(),k))return!1}catch{return!1}}}if(m=c.child,c.subtreeFlags&16384&&m!==null)m.return=c,c=m;else{if(c===u)break;for(;c.sibling===null;){if(c.return===null||c.return===u)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function Ls(u,c){for(c&=~A1,c&=~of,u.suspendedLanes|=c,u.pingedLanes&=~c,u=u.expirationTimes;0<c;){var m=31-$r(c),v=1<<m;u[m]=-1,c&=~v}}function s4(u){if(Re&6)throw Error(o(327));Zo();var c=Th(u,0);if(!(c&1))return qn(u,Xt()),null;var m=hf(u,c);if(u.tag!==0&&m===2){var v=D0(u);v!==0&&(c=v,m=F1(u,v))}if(m===1)throw m=fc,Jo(u,0),Ls(u,c),qn(u,Xt()),m;if(m===6)throw Error(o(345));return u.finishedWork=u.current.alternate,u.finishedLanes=c,Xo(u,Kn,Vi),qn(u,Xt()),null}function o4(u){As!==null&&As.tag===0&&!(Re&6)&&Zo();var c=Re;Re|=1;var m=Rt.transition,v=Ue;try{if(Rt.transition=null,Ue=1,u)return u()}finally{Ue=v,Rt.transition=m,Re=c,!(Re&6)&&pi()}}function z1(){lr=wl.current,ot(wl)}function Jo(u,c){u.finishedWork=null,u.finishedLanes=0;var m=u.timeoutHandle;if(m!==me&&(u.timeoutHandle=me,X(m)),Dt!==null)for(m=Dt.return;m!==null;){var v=m;switch(G0(v),v.tag){case 1:v=v.type.childContextTypes,v!=null&&bh();break;case 3:vl(),ot(Gn),ot(yn),r1();break;case 5:t1(v);break;case 4:vl();break;case 13:ot(vt);break;case 19:ot(vt);break;case 10:Y0(v.type._context);break;case 22:case 23:z1()}m=m.return}if(en=u,Dt=u=Is(u.current,null),un=lr=c,Vt=0,fc=null,A1=of=Yo=0,Kn=pc=null,qo!==null){for(c=0;c<qo.length;c++)if(m=qo[c],v=m.interleaved,v!==null){m.interleaved=null;var k=v.next,_=m.pending;if(_!==null){var O=_.next;_.next=k,v.next=O}m.pending=v}qo=null}return u}function a4(u,c){do{var m=Dt;try{if(Q0(),Uh.current=$h,Hh){for(var v=xt.memoizedState;v!==null;){var k=v.queue;k!==null&&(k.pending=null),v=v.next}Hh=!1}if(Qo=0,Zt=Ht=xt=null,ic=!1,sc=0,O1.current=null,m===null||m.return===null){Vt=1,fc=c,Dt=null;break}e:{var _=u,O=m.return,D=m,G=c;if(c=un,D.flags|=32768,G!==null&&typeof G=="object"&&typeof G.then=="function"){var ne=G,he=D,Ce=he.tag;if(!(he.mode&1)&&(Ce===0||Ce===11||Ce===15)){var ae=he.alternate;ae?(he.updateQueue=ae.updateQueue,he.memoizedState=ae.memoizedState,he.lanes=ae.lanes):(he.updateQueue=null,he.memoizedState=null)}var at=A3(O);if(at!==null){at.flags&=-257,R3(at,O,D,_,c),at.mode&1&&O3(_,ne,c),c=at,G=ne;var Je=c.updateQueue;if(Je===null){var Qn=new Set;Qn.add(G),c.updateQueue=Qn}else Je.add(G);break e}else{if(!(c&1)){O3(_,ne,c),B1();break e}G=Error(o(426))}}else if(ht&&D.mode&1){var Gi=A3(O);if(Gi!==null){!(Gi.flags&65536)&&(Gi.flags|=256),R3(Gi,O,D,_,c),K0(xl(G,D));break e}}_=G=xl(G,D),Vt!==4&&(Vt=2),pc===null?pc=[_]:pc.push(_),_=O;do{switch(_.tag){case 3:_.flags|=65536,c&=-c,_.lanes|=c;var H=M3(_,G,c);n3(_,H);break e;case 1:D=G;var j=_.type,K=_.stateNode;if(!(_.flags&128)&&(typeof j.getDerivedStateFromError=="function"||K!==null&&typeof K.componentDidCatch=="function"&&(Os===null||!Os.has(K)))){_.flags|=65536,c&=-c,_.lanes|=c;var le=P3(_,D,c);n3(_,le);break e}}_=_.return}while(_!==null)}c4(m)}catch(ve){c=ve,Dt===m&&m!==null&&(Dt=m=m.return);continue}break}while(!0)}function l4(){var u=sf.current;return sf.current=$h,u===null?$h:u}function B1(){(Vt===0||Vt===3||Vt===2)&&(Vt=4),en===null||!(Yo&268435455)&&!(of&268435455)||Ls(en,un)}function hf(u,c){var m=Re;Re|=2;var v=l4();(en!==u||un!==c)&&(Vi=null,Jo(u,c));do try{NM();break}catch(k){a4(u,k)}while(!0);if(Q0(),Re=m,sf.current=v,Dt!==null)throw Error(o(261));return en=null,un=0,Vt}function NM(){for(;Dt!==null;)u4(Dt)}function TM(){for(;Dt!==null&&!eM();)u4(Dt)}function u4(u){var c=f4(u.alternate,u,lr);u.memoizedProps=u.pendingProps,c===null?c4(u):Dt=c,O1.current=null}function c4(u){var c=u;do{var m=c.alternate;if(u=c.return,c.flags&32768){if(m=wM(m,c),m!==null){m.flags&=32767,Dt=m;return}if(u!==null)u.flags|=32768,u.subtreeFlags=0,u.deletions=null;else{Vt=6,Dt=null;return}}else if(m=SM(m,c,lr),m!==null){Dt=m;return}if(c=c.sibling,c!==null){Dt=c;return}Dt=c=u}while(c!==null);Vt===0&&(Vt=5)}function Xo(u,c,m){var v=Ue,k=Rt.transition;try{Rt.transition=null,Ue=1,MM(u,c,m,v)}finally{Rt.transition=k,Ue=v}return null}function MM(u,c,m,v){do Zo();while(As!==null);if(Re&6)throw Error(o(327));m=u.finishedWork;var k=u.finishedLanes;if(m===null)return null;if(u.finishedWork=null,u.finishedLanes=0,m===u.current)throw Error(o(177));u.callbackNode=null,u.callbackPriority=0;var _=m.lanes|m.childLanes;if(Z7(u,_),u===en&&(Dt=en=null,un=0),!(m.subtreeFlags&2064)&&!(m.flags&2064)||lf||(lf=!0,p4(U0,function(){return Zo(),null})),_=(m.flags&15990)!==0,m.subtreeFlags&15990||_){_=Rt.transition,Rt.transition=null;var O=Ue;Ue=1;var D=Re;Re|=4,O1.current=null,CM(u,m),X3(m,u),te(u.containerInfo),u.current=m,bM(m),tM(),Re=D,Ue=O,Rt.transition=_}else u.current=m;if(lf&&(lf=!1,As=u,uf=k),_=u.pendingLanes,_===0&&(Os=null),iM(m.stateNode),qn(u,Xt()),c!==null)for(v=u.onRecoverableError,m=0;m<c.length;m++)k=c[m],v(k.value,{componentStack:k.stack,digest:k.digest});if(af)throw af=!1,u=I1,I1=null,u;return uf&1&&u.tag!==0&&Zo(),_=u.pendingLanes,_&1?u===D1?mc++:(mc=0,D1=u):mc=0,pi(),null}function Zo(){if(As!==null){var u=Hw(uf),c=Rt.transition,m=Ue;try{if(Rt.transition=null,Ue=16>u?16:u,As===null)var v=!1;else{if(u=As,As=null,uf=0,Re&6)throw Error(o(331));var k=Re;for(Re|=4,ce=u.current;ce!==null;){var _=ce,O=_.child;if(ce.flags&16){var D=_.deletions;if(D!==null){for(var G=0;G<D.length;G++){var ne=D[G];for(ce=ne;ce!==null;){var he=ce;switch(he.tag){case 0:case 11:case 15:dc(8,he,_)}var Ce=he.child;if(Ce!==null)Ce.return=he,ce=Ce;else for(;ce!==null;){he=ce;var ae=he.sibling,at=he.return;if(q3(he),he===ne){ce=null;break}if(ae!==null){ae.return=at,ce=ae;break}ce=at}}}var Je=_.alternate;if(Je!==null){var Qn=Je.child;if(Qn!==null){Je.child=null;do{var Gi=Qn.sibling;Qn.sibling=null,Qn=Gi}while(Qn!==null)}}ce=_}}if(_.subtreeFlags&2064&&O!==null)O.return=_,ce=O;else e:for(;ce!==null;){if(_=ce,_.flags&2048)switch(_.tag){case 0:case 11:case 15:dc(9,_,_.return)}var H=_.sibling;if(H!==null){H.return=_.return,ce=H;break e}ce=_.return}}var j=u.current;for(ce=j;ce!==null;){O=ce;var K=O.child;if(O.subtreeFlags&2064&&K!==null)K.return=O,ce=K;else e:for(O=j;ce!==null;){if(D=ce,D.flags&2048)try{switch(D.tag){case 0:case 11:case 15:Xh(9,D)}}catch(ve){ft(D,D.return,ve)}if(D===O){ce=null;break e}var le=D.sibling;if(le!==null){le.return=D.return,ce=le;break e}ce=D.return}}if(Re=k,pi(),fi&&typeof fi.onPostCommitFiberRoot=="function")try{fi.onPostCommitFiberRoot(Mh,u)}catch{}v=!0}return v}finally{Ue=m,Rt.transition=c}}return!1}function d4(u,c,m){c=xl(m,c),c=M3(u,c,1),u=Ps(u,c,1),c=wn(),u!==null&&(Zu(u,1,c),qn(u,c))}function ft(u,c,m){if(u.tag===3)d4(u,u,m);else for(;c!==null;){if(c.tag===3){d4(c,u,m);break}else if(c.tag===1){var v=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&(Os===null||!Os.has(v))){u=xl(m,u),u=P3(c,u,1),c=Ps(c,u,1),u=wn(),c!==null&&(Zu(c,1,u),qn(c,u));break}}c=c.return}}function PM(u,c,m){var v=u.pingCache;v!==null&&v.delete(c),c=wn(),u.pingedLanes|=u.suspendedLanes&m,en===u&&(un&m)===m&&(Vt===4||Vt===3&&(un&130023424)===un&&500>Xt()-R1?Jo(u,0):A1|=m),qn(u,c)}function h4(u,c){c===0&&(u.mode&1?(c=Nh,Nh<<=1,!(Nh&130023424)&&(Nh=4194304)):c=1);var m=wn();u=mi(u,c),u!==null&&(Zu(u,c,m),qn(u,m))}function OM(u){var c=u.memoizedState,m=0;c!==null&&(m=c.retryLane),h4(u,m)}function AM(u,c){var m=0;switch(u.tag){case 13:var v=u.stateNode,k=u.memoizedState;k!==null&&(m=k.retryLane);break;case 19:v=u.stateNode;break;default:throw Error(o(314))}v!==null&&v.delete(c),h4(u,m)}var f4;f4=function(u,c,m){if(u!==null)if(u.memoizedProps!==c.pendingProps||Gn.current)Wn=!0;else{if(!(u.lanes&m)&&!(c.flags&128))return Wn=!1,xM(u,c,m);Wn=!!(u.flags&131072)}else Wn=!1,ht&&c.flags&1048576&&$w(c,Ah,c.index);switch(c.lanes=0,c.tag){case 2:var v=c.type;qh(u,c),u=c.pendingProps;var k=cl(c,yn.current);gl(c,m),k=o1(null,c,v,u,k,m);var _=a1();return c.flags|=1,typeof k=="object"&&k!==null&&typeof k.render=="function"&&k.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,$n(v)?(_=!0,Eh(c)):_=!1,c.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,Z0(c),k.updater=Wh,c.stateNode=k,k._reactInternals=c,f1(c,v,u,m),c=y1(null,c,v,!0,_,m)):(c.tag=0,ht&&_&&V0(c),Rn(null,c,k,m),c=c.child),c;case 16:v=c.elementType;e:{switch(qh(u,c),u=c.pendingProps,k=v._init,v=k(v._payload),c.type=v,k=c.tag=LM(v),u=qr(v,u),k){case 0:c=g1(null,c,v,u,m);break e;case 1:c=z3(null,c,v,u,m);break e;case 11:c=L3(null,c,v,u,m);break e;case 14:c=I3(null,c,v,qr(v.type,u),m);break e}throw Error(o(306,v,""))}return c;case 0:return v=c.type,k=c.pendingProps,k=c.elementType===v?k:qr(v,k),g1(u,c,v,k,m);case 1:return v=c.type,k=c.pendingProps,k=c.elementType===v?k:qr(v,k),z3(u,c,v,k,m);case 3:e:{if(B3(c),u===null)throw Error(o(387));v=c.pendingProps,_=c.memoizedState,k=_.element,t3(u,c),zh(c,v,null,m);var O=c.memoizedState;if(v=O.element,st&&_.isDehydrated)if(_={element:v,isDehydrated:!1,cache:O.cache,pendingSuspenseBoundaries:O.pendingSuspenseBoundaries,transitions:O.transitions},c.updateQueue.baseState=_,c.memoizedState=_,c.flags&256){k=xl(Error(o(423)),c),c=U3(u,c,v,m,k);break e}else if(v!==k){k=xl(Error(o(424)),c),c=U3(u,c,v,m,k);break e}else for(st&&(kr=L7(c.stateNode.containerInfo),ar=c,ht=!0,Kr=null,ec=!1),m=Xw(c,null,v,m),c.child=m;m;)m.flags=m.flags&-3|4096,m=m.sibling;else{if(fl(),v===k){c=Hi(u,c,m);break e}Rn(u,c,v,m)}c=c.child}return c;case 5:return i3(c),u===null&&W0(c),v=c.type,k=c.pendingProps,_=u!==null?u.memoizedProps:null,O=k.children,yt(v,k)?O=null:_!==null&&yt(v,_)&&(c.flags|=32),j3(u,c),Rn(u,c,O,m),c.child;case 6:return u===null&&W0(c),null;case 13:return H3(u,c,m);case 4:return e1(c,c.stateNode.containerInfo),v=c.pendingProps,u===null?c.child=pl(c,null,v,m):Rn(u,c,v,m),c.child;case 11:return v=c.type,k=c.pendingProps,k=c.elementType===v?k:qr(v,k),L3(u,c,v,k,m);case 7:return Rn(u,c,c.pendingProps,m),c.child;case 8:return Rn(u,c,c.pendingProps.children,m),c.child;case 12:return Rn(u,c,c.pendingProps.children,m),c.child;case 10:e:{if(v=c.type._context,k=c.pendingProps,_=c.memoizedProps,O=k.value,Zw(c,v,O),_!==null)if(Wr(_.value,O)){if(_.children===k.children&&!Gn.current){c=Hi(u,c,m);break e}}else for(_=c.child,_!==null&&(_.return=c);_!==null;){var D=_.dependencies;if(D!==null){O=_.child;for(var G=D.firstContext;G!==null;){if(G.context===v){if(_.tag===1){G=Ui(-1,m&-m),G.tag=2;var ne=_.updateQueue;if(ne!==null){ne=ne.shared;var he=ne.pending;he===null?G.next=G:(G.next=he.next,he.next=G),ne.pending=G}}_.lanes|=m,G=_.alternate,G!==null&&(G.lanes|=m),J0(_.return,m,c),D.lanes|=m;break}G=G.next}}else if(_.tag===10)O=_.type===c.type?null:_.child;else if(_.tag===18){if(O=_.return,O===null)throw Error(o(341));O.lanes|=m,D=O.alternate,D!==null&&(D.lanes|=m),J0(O,m,c),O=_.sibling}else O=_.child;if(O!==null)O.return=_;else for(O=_;O!==null;){if(O===c){O=null;break}if(_=O.sibling,_!==null){_.return=O.return,O=_;break}O=O.return}_=O}Rn(u,c,k.children,m),c=c.child}return c;case 9:return k=c.type,v=c.pendingProps.children,gl(c,m),k=Cr(k),v=v(k),c.flags|=1,Rn(u,c,v,m),c.child;case 14:return v=c.type,k=qr(v,c.pendingProps),k=qr(v.type,k),I3(u,c,v,k,m);case 15:return D3(u,c,c.type,c.pendingProps,m);case 17:return v=c.type,k=c.pendingProps,k=c.elementType===v?k:qr(v,k),qh(u,c),c.tag=1,$n(v)?(u=!0,Eh(c)):u=!1,gl(c,m),N3(c,v,k),f1(c,v,k,m),y1(null,c,v,!0,u,m);case 19:return G3(u,c,m);case 22:return F3(u,c,m)}throw Error(o(156,c.tag))};function p4(u,c){return z0(u,c)}function RM(u,c,m,v){this.tag=u,this.key=m,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=v,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Nr(u,c,m,v){return new RM(u,c,m,v)}function U1(u){return u=u.prototype,!(!u||!u.isReactComponent)}function LM(u){if(typeof u=="function")return U1(u)?1:0;if(u!=null){if(u=u.$$typeof,u===x)return 11;if(u===E)return 14}return 2}function Is(u,c){var m=u.alternate;return m===null?(m=Nr(u.tag,c,u.key,u.mode),m.elementType=u.elementType,m.type=u.type,m.stateNode=u.stateNode,m.alternate=u,u.alternate=m):(m.pendingProps=c,m.type=u.type,m.flags=0,m.subtreeFlags=0,m.deletions=null),m.flags=u.flags&14680064,m.childLanes=u.childLanes,m.lanes=u.lanes,m.child=u.child,m.memoizedProps=u.memoizedProps,m.memoizedState=u.memoizedState,m.updateQueue=u.updateQueue,c=u.dependencies,m.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},m.sibling=u.sibling,m.index=u.index,m.ref=u.ref,m}function ff(u,c,m,v,k,_){var O=2;if(v=u,typeof u=="function")U1(u)&&(O=1);else if(typeof u=="string")O=5;else e:switch(u){case h:return ea(m.children,k,_,c);case f:O=8,k|=8;break;case p:return u=Nr(12,m,c,k|2),u.elementType=p,u.lanes=_,u;case S:return u=Nr(13,m,c,k),u.elementType=S,u.lanes=_,u;case C:return u=Nr(19,m,c,k),u.elementType=C,u.lanes=_,u;case b:return pf(m,k,_,c);default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case y:O=10;break e;case g:O=9;break e;case x:O=11;break e;case E:O=14;break e;case w:O=16,v=null;break e}throw Error(o(130,u==null?u:typeof u,""))}return c=Nr(O,m,c,k),c.elementType=u,c.type=v,c.lanes=_,c}function ea(u,c,m,v){return u=Nr(7,u,v,c),u.lanes=m,u}function pf(u,c,m,v){return u=Nr(22,u,v,c),u.elementType=b,u.lanes=m,u.stateNode={isHidden:!1},u}function H1(u,c,m){return u=Nr(6,u,null,c),u.lanes=m,u}function V1(u,c,m){return c=Nr(4,u.children!==null?u.children:[],u.key,c),c.lanes=m,c.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},c}function IM(u,c,m,v,k){this.tag=c,this.containerInfo=u,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=me,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=F0(0),this.expirationTimes=F0(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=F0(0),this.identifierPrefix=v,this.onRecoverableError=k,st&&(this.mutableSourceEagerHydrationData=null)}function m4(u,c,m,v,k,_,O,D,G){return u=new IM(u,c,m,D,G),c===1?(c=1,_===!0&&(c|=8)):c=0,_=Nr(3,null,null,c),u.current=_,_.stateNode=u,_.memoizedState={element:v,isDehydrated:m,cache:null,transitions:null,pendingSuspenseBoundaries:null},Z0(_),u}function g4(u){if(!u)return Ts;u=u._reactInternals;e:{if(I(u)!==u||u.tag!==1)throw Error(o(170));var c=u;do{switch(c.tag){case 3:c=c.stateNode.context;break e;case 1:if($n(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break e}}c=c.return}while(c!==null);throw Error(o(171))}if(u.tag===1){var m=u.type;if($n(m))return zw(u,m,c)}return c}function y4(u){var c=u._reactInternals;if(c===void 0)throw typeof u.render=="function"?Error(o(188)):(u=Object.keys(u).join(","),Error(o(268,u)));return u=B(c),u===null?null:u.stateNode}function v4(u,c){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var m=u.retryLane;u.retryLane=m!==0&&m<c?m:c}}function mf(u,c){v4(u,c),(u=u.alternate)&&v4(u,c)}function DM(u){return u=B(u),u===null?null:u.stateNode}function FM(){return null}return n.attemptContinuousHydration=function(u){if(u.tag===13){var c=mi(u,134217728);if(c!==null){var m=wn();_r(c,u,134217728,m)}mf(u,134217728)}},n.attemptDiscreteHydration=function(u){if(u.tag===13){var c=mi(u,1);if(c!==null){var m=wn();_r(c,u,1,m)}mf(u,1)}},n.attemptHydrationAtCurrentPriority=function(u){if(u.tag===13){var c=Rs(u),m=mi(u,c);if(m!==null){var v=wn();_r(m,u,c,v)}mf(u,c)}},n.attemptSynchronousHydration=function(u){switch(u.tag){case 3:var c=u.stateNode;if(c.current.memoizedState.isDehydrated){var m=Xu(c.pendingLanes);m!==0&&(j0(c,m|1),qn(c,Xt()),!(Re&6)&&(kl(),pi()))}break;case 13:o4(function(){var v=mi(u,1);if(v!==null){var k=wn();_r(v,u,1,k)}}),mf(u,1)}},n.batchedUpdates=function(u,c){var m=Re;Re|=1;try{return u(c)}finally{Re=m,Re===0&&(kl(),Ph&&pi())}},n.createComponentSelector=function(u){return{$$typeof:Zh,value:u}},n.createContainer=function(u,c,m,v,k,_,O){return m4(u,c,!1,null,m,v,k,_,O)},n.createHasPseudoClassSelector=function(u){return{$$typeof:ef,value:u}},n.createHydrationContainer=function(u,c,m,v,k,_,O,D,G){return u=m4(m,v,!0,u,k,_,O,D,G),u.context=g4(null),m=u.current,v=wn(),k=Rs(m),_=Ui(v,k),_.callback=c??null,Ps(m,_,k),u.current.lanes=k,Zu(u,k,v),qn(u,v),u},n.createPortal=function(u,c,m){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:d,key:v==null?null:""+v,children:u,containerInfo:c,implementation:m}},n.createRoleSelector=function(u){return{$$typeof:tf,value:u}},n.createTestNameSelector=function(u){return{$$typeof:nf,value:u}},n.createTextSelector=function(u){return{$$typeof:rf,value:u}},n.deferredUpdates=function(u){var c=Ue,m=Rt.transition;try{return Rt.transition=null,Ue=16,u()}finally{Ue=c,Rt.transition=m}},n.discreteUpdates=function(u,c,m,v,k){var _=Ue,O=Rt.transition;try{return Rt.transition=null,Ue=1,u(c,m,v,k)}finally{Ue=_,Rt.transition=O,Re===0&&kl()}},n.findAllNodes=P1,n.findBoundingRects=function(u,c){if(!Qu)throw Error(o(363));c=P1(u,c),u=[];for(var m=0;m<c.length;m++)u.push(a7(c[m]));for(c=u.length-1;0<c;c--){m=u[c];for(var v=m.x,k=v+m.width,_=m.y,O=_+m.height,D=c-1;0<=D;D--)if(c!==D){var G=u[D],ne=G.x,he=ne+G.width,Ce=G.y,ae=Ce+G.height;if(v>=ne&&_>=Ce&&k<=he&&O<=ae){u.splice(c,1);break}else if(v!==ne||m.width!==G.width||ae<_||Ce>O){if(!(_!==Ce||m.height!==G.height||he<v||ne>k)){ne>v&&(G.width+=ne-v,G.x=v),he<k&&(G.width=k-ne),u.splice(c,1);break}}else{Ce>_&&(G.height+=Ce-_,G.y=_),ae<O&&(G.height=O-Ce),u.splice(c,1);break}}}return u},n.findHostInstance=y4,n.findHostInstanceWithNoPortals=function(u){return u=U(u),u=u!==null?Q(u):null,u===null?null:u.stateNode},n.findHostInstanceWithWarning=function(u){return y4(u)},n.flushControlled=function(u){var c=Re;Re|=1;var m=Rt.transition,v=Ue;try{Rt.transition=null,Ue=1,u()}finally{Ue=v,Rt.transition=m,Re=c,Re===0&&(kl(),pi())}},n.flushPassiveEffects=Zo,n.flushSync=o4,n.focusWithin=function(u,c){if(!Qu)throw Error(o(363));for(u=N1(u),c=r4(u,c),c=Array.from(c),u=0;u<c.length;){var m=c[u++];if(!Yu(m)){if(m.tag===5&&c7(m.stateNode))return!0;for(m=m.child;m!==null;)c.push(m),m=m.sibling}}return!1},n.getCurrentUpdatePriority=function(){return Ue},n.getFindAllNodesFailureDescription=function(u,c){if(!Qu)throw Error(o(363));var m=0,v=[];u=[N1(u),0];for(var k=0;k<u.length;){var _=u[k++],O=u[k++],D=c[O];if((_.tag!==5||!Yu(_))&&(T1(_,D)&&(v.push(M1(D)),O++,O>m&&(m=O)),O<c.length))for(_=_.child;_!==null;)u.push(_,O),_=_.sibling}if(m<c.length){for(u=[];m<c.length;m++)u.push(M1(c[m]));return`findAllNodes was able to match part of the selector:
`+(v.join(" > ")+`
No matching component was found for:
`)+u.join(" > ")}return null},n.getPublicRootInstance=function(u){if(u=u.current,!u.child)return null;switch(u.child.tag){case 5:return ie(u.child.stateNode);default:return u.child.stateNode}},n.injectIntoDevTools=function(u){if(u={bundleType:u.bundleType,version:u.version,rendererPackageName:u.rendererPackageName,rendererConfig:u.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:DM,findFiberByHostInstance:u.findFiberByHostInstance||FM,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")u=!1;else{var c=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(c.isDisabled||!c.supportsFiber)u=!0;else{try{Mh=c.inject(u),fi=c}catch{}u=!!c.checkDCE}}return u},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(u,c,m,v){if(!Qu)throw Error(o(363));u=P1(u,c);var k=d7(u,m,v).disconnect;return{disconnect:function(){k()}}},n.registerMutableSourceForHydration=function(u,c){var m=c._getVersion;m=m(c._source),u.mutableSourceEagerHydrationData==null?u.mutableSourceEagerHydrationData=[c,m]:u.mutableSourceEagerHydrationData.push(c,m)},n.runWithPriority=function(u,c){var m=Ue;try{return Ue=u,c()}finally{Ue=m}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(u,c,m,v){var k=c.current,_=wn(),O=Rs(k);return m=g4(m),c.context===null?c.context=m:c.pendingContext=m,c=Ui(_,O),c.payload={element:u},v=v===void 0?null:v,v!==null&&(c.callback=v),u=Ps(k,c,O),u!==null&&(_r(u,k,O,_),jh(u,k,O)),O},n};u9.exports=cU;var dU=u9.exports;const hU=nh(dU);var c9={exports:{}},sl={};/**
* @license React
* react-reconciler-constants.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/sl.ConcurrentRoot=1;sl.ContinuousEventPriority=4;sl.DefaultEventPriority=16;sl.DiscreteEventPriority=1;sl.IdleEventPriority=536870912;sl.LegacyRoot=0;c9.exports=sl;var d9=c9.exports;const lC={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let uC=!1,cC=!1;const GS=".react-konva-event",fU=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled.
Position of a node will be changed during drag&drop, so you should update state of the react app as well.
Consider to add onDragMove or onDragEnd events.
For more info see: https://github.com/konvajs/react-konva/issues/256
`,pU=`ReactKonva: You are using "zIndex" attribute for a Konva node.
react-konva may get confused with ordering. Just define correct order of elements in your render function of a component.
For more info see: https://github.com/konvajs/react-konva/issues/194
`,mU={};function f0(t,e,n=mU){if(!uC&&"zIndex"in e&&(console.warn(pU),uC=!0),!cC&&e.draggable){var r=e.x!==void 0||e.y!==void 0,i=e.onDragEnd||e.onDragMove;r&&!i&&(console.warn(fU),cC=!0)}for(var s in n)if(!lC[s]){var o=s.slice(0,2)==="on",a=n[s]!==e[s];if(o&&a){var l=s.substr(2).toLowerCase();l.substr(0,7)==="content"&&(l="content"+l.substr(7,1).toUpperCase()+l.substr(8)),t.off(l,n[s])}var d=!e.hasOwnProperty(s);d&&t.setAttr(s,void 0)}var h=e._useStrictMode,f={},p=!1;const y={};for(var s in e)if(!lC[s]){var o=s.slice(0,2)==="on",g=n[s]!==e[s];if(o&&g){var l=s.substr(2).toLowerCase();l.substr(0,7)==="content"&&(l="content"+l.substr(7,1).toUpperCase()+l.substr(8)),e[s]&&(y[l]=e[s])}!o&&(e[s]!==n[s]||h&&e[s]!==t.getAttr(s))&&(p=!0,f[s]=e[s])}p&&(t.setAttrs(f),Uo(t));for(var l in y)t.on(l+GS,y[l])}function Uo(t){if(!Ae.Konva.autoDrawEnabled){var e=t.getLayer()||t.getStage();e&&e.batchDraw()}}const h9={},gU={};zd.Node.prototype._applyProps=f0;function yU(t,e){if(typeof e=="string"){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${e}`);return}t.add(e),Uo(t)}function vU(t,e,n){let r=zd[t];r||(console.error(`Konva has no node with the type ${t}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${t}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),r=zd.Group);const i={},s={};for(var o in e){var a=o.slice(0,2)==="on";a?s[o]=e[o]:i[o]=e[o]}const l=new r(i);return f0(l,s),l}function xU(t,e,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${t}"`)}function SU(t,e,n){return!1}function wU(t){return t}function kU(){return null}function CU(){return null}function bU(t,e,n,r){return gU}function EU(){}function _U(t){}function NU(t,e){return!1}function TU(){return h9}function MU(){return h9}const PU=setTimeout,OU=clearTimeout,AU=-1;function RU(t,e){return!1}const LU=!1,IU=!0,DU=!0;function FU(t,e){e.parent===t?e.moveToTop():t.add(e),Uo(t)}function jU(t,e){e.parent===t?e.moveToTop():t.add(e),Uo(t)}function f9(t,e,n){e._remove(),t.add(e),e.setZIndex(n.getZIndex()),Uo(t)}function zU(t,e,n){f9(t,e,n)}function BU(t,e){e.destroy(),e.off(GS),Uo(t)}function UU(t,e){e.destroy(),e.off(GS),Uo(t)}function HU(t,e,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function VU(t,e,n){}function GU(t,e,n,r,i){f0(t,i,r)}function $U(t){t.hide(),Uo(t)}function WU(t){}function KU(t,e){(e.visible==null||e.visible)&&t.show()}function qU(t,e){}function QU(t){}function YU(){}const JU=()=>d9.DefaultEventPriority,XU=Object.freeze(Object.defineProperty({__proto__:null,appendChild:FU,appendChildToContainer:jU,appendInitialChild:yU,cancelTimeout:OU,clearContainer:QU,commitMount:VU,commitTextUpdate:HU,commitUpdate:GU,createInstance:vU,createTextInstance:xU,detachDeletedInstance:YU,finalizeInitialChildren:SU,getChildHostContext:MU,getCurrentEventPriority:JU,getPublicInstance:wU,getRootHostContext:TU,hideInstance:$U,hideTextInstance:WU,idlePriority:$c.unstable_IdlePriority,insertBefore:f9,insertInContainerBefore:zU,isPrimaryRenderer:LU,noTimeout:AU,now:$c.unstable_now,prepareForCommit:kU,preparePortalMount:CU,prepareUpdate:bU,removeChild:BU,removeChildFromContainer:UU,resetAfterCommit:EU,resetTextContent:_U,run:$c.unstable_runWithPriority,scheduleTimeout:PU,shouldDeprioritizeSubtree:NU,shouldSetTextContent:RU,supportsMutation:DU,unhideInstance:KU,unhideTextInstance:qU,warnsIfNotActing:IU},Symbol.toStringTag,{value:"Module"}));var ZU=Object.defineProperty,eH=Object.defineProperties,tH=Object.getOwnPropertyDescriptors,dC=Object.getOwnPropertySymbols,nH=Object.prototype.hasOwnProperty,rH=Object.prototype.propertyIsEnumerable,hC=(t,e,n)=>e in t?ZU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,fC=(t,e)=>{for(var n in e||(e={}))nH.call(e,n)&&hC(t,n,e[n]);if(dC)for(var n of dC(e))rH.call(e,n)&&hC(t,n,e[n]);return t},iH=(t,e)=>eH(t,tH(e)),pC,mC;typeof window<"u"&&((pC=window.document)!=null&&pC.createElement||((mC=window.navigator)==null?void 0:mC.product)==="ReactNative")?z.useLayoutEffect:z.useEffect;function p9(t,e,n){if(!t)return;if(n(t)===!0)return t;let r=t.child;for(;r;){const i=p9(r,e,n);if(i)return i;r=r.sibling}}function m9(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const gC=console.error;console.error=function(){const t=[...arguments].join("");if(t!=null&&t.startsWith("Warning:")&&t.includes("useContext")){console.error=gC;return}return gC.apply(this,arguments)};const $S=m9(z.createContext(null));class g9 extends z.Component{render(){return z.createElement($S.Provider,{value:this._reactInternals},this.props.children)}}function sH(){const t=z.useContext($S);if(t===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=z.useId();return z.useMemo(()=>{for(const r of[t,t==null?void 0:t.alternate]){if(!r)continue;const i=p9(r,!1,s=>{let o=s.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(i)return i}},[t,e])}function oH(){const t=sH(),[e]=z.useState(()=>new Map);e.clear();let n=t;for(;n;){if(n.type&&typeof n.type=="object"){const i=n.type._context===void 0&&n.type.Provider===n.type?n.type:n.type._context;i&&i!==$S&&!e.has(i)&&e.set(i,z.useContext(m9(i)))}n=n.return}return e}function aH(){const t=oH();return z.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>r=>z.createElement(e,null,z.createElement(n.Provider,iH(fC({},r),{value:t.get(n)}))),e=>z.createElement(g9,fC({},e))),[t])}function lH(t){const e=ct.useRef({});return ct.useLayoutEffect(()=>{e.current=t}),ct.useLayoutEffect(()=>()=>{e.current={}},[]),e.current}const uH=t=>{const e=ct.useRef(null),n=ct.useRef(null),r=ct.useRef(null),i=lH(t),s=aH(),o=a=>{const{forwardedRef:l}=t;l&&(typeof l=="function"?l(a):l.current=a)};return ct.useLayoutEffect(()=>(n.current=new zd.Stage({width:t.width,height:t.height,container:e.current}),o(n.current),r.current=zc.createContainer(n.current,d9.LegacyRoot,!1,null),zc.updateContainer(ct.createElement(s,{},t.children),r.current),()=>{zd.isBrowser&&(o(null),zc.updateContainer(null,r.current,null),n.current.destroy())}),[]),ct.useLayoutEffect(()=>{o(n.current),f0(n.current,t,i),zc.updateContainer(ct.createElement(s,{},t.children),r.current,null)}),ct.createElement("div",{ref:e,id:t.id,accessKey:t.accessKey,className:t.className,role:t.role,style:t.style,tabIndex:t.tabIndex,title:t.title})},cH="Layer",dH="Rect",hH="Image",fH="Text",pH="Transformer",zc=hU(XU);zc.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:ct.version,rendererPackageName:"react-konva"});const mH=ct.forwardRef((t,e)=>ct.createElement(g9,{},ct.createElement(uH,{...t,forwardedRef:e}))),y9=CS(t=>({covers:[],activeCover:null,selectedLayer:null,addCover:e=>t(n=>({covers:[e,...n.covers],activeCover:e})),updateCover:(e,n)=>t(r=>{var i;return{covers:r.covers.map(s=>s.id===e?{...s,...n,updatedAt:new Date}:s),activeCover:((i=r.activeCover)==null?void 0:i.id)===e?{...r.activeCover,...n,updatedAt:new Date}:r.activeCover}}),deleteCover:e=>t(n=>{var r;return{covers:n.covers.filter(i=>i.id!==e),activeCover:((r=n.activeCover)==null?void 0:r.id)===e?null:n.activeCover}}),setActiveCover:e=>t({activeCover:e,selectedLayer:null}),setSelectedLayer:e=>t({selectedLayer:e}),addLayer:e=>t(n=>{if(!n.activeCover)return n;const r={...n.activeCover,layers:[...n.activeCover.layers,e],updatedAt:new Date};return{activeCover:r,covers:n.covers.map(i=>i.id===n.activeCover.id?r:i)}}),updateLayer:(e,n)=>t(r=>{if(!r.activeCover)return r;const i={...r.activeCover,layers:r.activeCover.layers.map(s=>s.id===e?{...s,...n}:s),updatedAt:new Date};return{activeCover:i,covers:r.covers.map(s=>s.id===r.activeCover.id?i:s)}}),deleteLayer:e=>t(n=>{if(!n.activeCover)return n;const r={...n.activeCover,layers:n.activeCover.layers.filter(i=>i.id!==e),updatedAt:new Date};return{activeCover:r,covers:n.covers.map(i=>i.id===n.activeCover.id?r:i),selectedLayer:n.selectedLayer===e?null:n.selectedLayer}})})),gH=({url:t,width:e,height:n})=>{const[r,i]=z.useState(null);return z.useEffect(()=>{const s=new window.Image;s.crossOrigin="Anonymous",s.src=t,s.onload=()=>{i(s)}},[t]),r?N.jsx(hH,{image:r,x:0,y:0,width:e,height:n}):null},yC=[{name:"Roboto",label:"Modern (Roboto)"},{name:"Montserrat",label:"Minimalist (Montserrat)"},{name:"Playfair Display",label:"Elegant (Playfair Display)"},{name:"Bebas Neue",label:"Bold (Bebas Neue)"},{name:"Pacifico",label:"Playful (Pacifico)"},{name:"Georgia",label:"Classic (Georgia)"},{name:"Arial",label:"Standard (Arial)"}];function yH(){var w,b;const{activeCover:t,addLayer:e,updateLayer:n,deleteLayer:r,selectedLayer:i,setSelectedLayer:s}=y9(),o=z.useRef(null),[a,l]=z.useState(.5),[d,h]=z.useState("title"),[f,p]=z.useState(""),[y,g]=z.useState("Roboto");if(!t)return N.jsx("div",{className:"card text-center py-12",children:N.jsx("p",{className:"text-gray-500",children:"Select a cover from the gallery to edit"})});const x=()=>{if(!f.trim())return;const T={id:`text-${Date.now()}`,type:"text",x:t.width/2,y:t.height/2,content:f,fontSize:d==="title"?72:36,fontFamily:y,fill:d==="title"?"#ffffff":"#f0f0f0",rotation:0,opacity:1};e(T),p("")},S=()=>{const T=o.current;if(T){const P=T.toDataURL({pixelRatio:2}),A=document.createElement("a");A.download=`${t.title.replace(/\s+/g,"-")}-cover.png`,A.href=P,A.click()}},C=800,E=t.height/t.width*C;return N.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6",children:[N.jsxs("div",{className:"lg:col-span-3 card p-4 bg-gray-100",children:[N.jsxs("div",{className:"flex items-center justify-between mb-4",children:[N.jsxs("h3",{className:"font-semibold text-gray-900",children:["Editing: ",t.title]}),N.jsx("div",{className:"flex items-center gap-2",children:N.jsxs("button",{onClick:S,className:"btn-primary flex items-center gap-2",children:[N.jsx(V8,{className:"w-4 h-4"}),"Export"]})})]}),N.jsx("div",{className:"bg-white rounded-lg shadow-sm overflow-hidden flex items-center justify-center p-4",children:N.jsx(mH,{ref:o,width:C,height:E,scaleX:a,scaleY:a,children:N.jsxs(cH,{children:[N.jsx(dH,{x:0,y:0,width:t.width,height:t.height,fill:t.backgroundColor}),t.backgroundImage&&N.jsx(gH,{url:t.backgroundImage,width:t.width,height:t.height}),t.layers.map(T=>N.jsx(fH,{id:T.id,x:T.x,y:T.y,text:T.content,fontSize:T.fontSize,fontFamily:T.fontFamily,fill:T.fill,rotation:T.rotation,opacity:T.opacity,draggable:!0,onClick:()=>s(T.id),onTap:()=>s(T.id)},T.id)),i&&N.jsx(pH,{nodes:t.layers.filter(T=>T.id===i).map(T=>document.getElementById(T.id))})]})})}),N.jsxs("div",{className:"mt-4 flex items-center justify-center gap-4",children:[N.jsx("button",{onClick:()=>l(Math.max(.2,a-.1)),className:"btn-secondary px-3",children:"-"}),N.jsxs("span",{className:"text-sm text-gray-600",children:[Math.round(a*100),"%"]}),N.jsx("button",{onClick:()=>l(Math.min(1,a+.1)),className:"btn-secondary px-3",children:"+"})]})]}),N.jsxs("div",{className:"space-y-4",children:[N.jsxs("div",{className:"card",children:[N.jsxs("h4",{className:"font-medium text-gray-900 mb-4 flex items-center gap-2",children:[N.jsx(pp,{className:"w-4 h-4"}),"Add Text"]}),N.jsxs("div",{className:"space-y-3",children:[N.jsxs("div",{children:[N.jsx("label",{className:"label",children:"Text Type"}),N.jsxs("div",{className:"flex gap-2",children:[N.jsx("button",{onClick:()=>h("title"),className:`flex-1 py-2 rounded-lg text-sm font-medium transition-colors ${d==="title"?"bg-primary-100 text-primary-700":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:"Title"}),N.jsx("button",{onClick:()=>h("author"),className:`flex-1 py-2 rounded-lg text-sm font-medium transition-colors ${d==="author"?"bg-primary-100 text-primary-700":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:"Author"})]})]}),N.jsxs("div",{children:[N.jsx("label",{className:"label",children:"Font"}),N.jsx("select",{value:y,onChange:T=>g(T.target.value),className:"input",children:yC.map(T=>N.jsx("option",{value:T.name,children:T.label},T.name))})]}),N.jsxs("div",{children:[N.jsx("label",{className:"label",children:"Text Content"}),N.jsx("input",{type:"text",value:f,onChange:T=>p(T.target.value),placeholder:d==="title"?"Book Title":"Author Name",className:"input",onKeyPress:T=>T.key==="Enter"&&x()})]}),N.jsx("button",{onClick:x,disabled:!f.trim(),className:"btn-primary w-full",children:"Add Text Layer"})]})]}),i&&((w=t.layers.find(T=>T.id===i))==null?void 0:w.type)==="text"&&N.jsxs("div",{className:"card",children:[N.jsxs("h4",{className:"font-medium text-gray-900 mb-4 flex items-center gap-2",children:[N.jsx(pp,{className:"w-4 h-4"}),"Edit Selected Text"]}),N.jsx("div",{className:"space-y-3",children:N.jsxs("div",{children:[N.jsx("label",{className:"label",children:"Font"}),N.jsx("select",{value:((b=t.layers.find(T=>T.id===i))==null?void 0:b.fontFamily)||"Roboto",onChange:T=>n(i,{fontFamily:T.target.value}),className:"input",children:yC.map(T=>N.jsx("option",{value:T.name,children:T.label},T.name))})]})})]}),N.jsxs("div",{className:"card",children:[N.jsx("h4",{className:"font-medium text-gray-900 mb-4",children:"Layers"}),t.layers.length===0?N.jsx("p",{className:"text-sm text-gray-500",children:"No layers yet"}):N.jsx("div",{className:"space-y-2",children:t.layers.map((T,P)=>{var A;return N.jsxs("div",{className:`flex items-center justify-between p-2 rounded-lg border cursor-pointer transition-colors ${i===T.id?"border-primary-500 bg-primary-50":"border-gray-200 hover:bg-gray-50"}`,onClick:()=>s(T.id),children:[N.jsxs("div",{className:"flex items-center gap-2",children:[N.jsx(pp,{className:"w-4 h-4 text-gray-400"}),N.jsx("span",{className:"text-sm truncate max-w-[150px]",children:((A=T.content)==null?void 0:A.substring(0,20))||`Layer ${P+1}`})]}),N.jsx("button",{onClick:M=>{M.stopPropagation(),r(T.id)},className:"p-1 hover:bg-red-100 rounded",children:N.jsx("svg",{className:"w-4 h-4 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:N.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},T.id)})})]}),N.jsxs("div",{className:"card",children:[N.jsx("h4",{className:"font-medium text-gray-900 mb-4",children:"Cover Info"}),N.jsxs("div",{className:"space-y-2 text-sm",children:[N.jsxs("div",{className:"flex justify-between",children:[N.jsx("span",{className:"text-gray-500",children:"Dimensions"}),N.jsxs("span",{className:"text-gray-900",children:[t.width," x ",t.height]})]}),N.jsxs("div",{className:"flex justify-between",children:[N.jsx("span",{className:"text-gray-500",children:"Layers"}),N.jsx("span",{className:"text-gray-900",children:t.layers.length})]})]})]})]})]})}const dr=mt.create({baseURL:"/api",headers:{"Content-Type":"application/json"}});dr.interceptors.request.use(t=>{const e=localStorage.getItem("i18nextLng")||"en";return t.data&&typeof t.data=="object"&&!(t.data instanceof FormData)?t.data.language=e:t.data instanceof FormData&&t.data.append("language",e),t.headers["Accept-Language"]=e,t});const Fy={getAll:()=>dr.get("/covers"),upload:t=>{const e=new FormData;return e.append("image",t),dr.post("/covers/upload",e,{headers:{"Content-Type":"multipart/form-data"}})},delete:t=>dr.delete(`/covers/${t}`),process:(t,e)=>{const n=new FormData;return n.append("image",t),e&&Object.entries(e).forEach(([r,i])=>{n.append(r,i)}),dr.post("/covers/process",n,{headers:{"Content-Type":"multipart/form-data"}})},generate:(t,e)=>dr.post("/covers/generate",{prompt:t,genre:e})},vh={getGenres:()=>dr.get("/books/genres"),getGenre:t=>dr.get(`/books/genres/${t}`),generateOutline:(t,e,n)=>dr.post("/books/outline",{genre:t,idea:e,title:n}),generateChapter:(t,e,n,r)=>dr.post("/books/chapter",{genre:t,chapterTitle:e,chapterSummary:n,previousContent:r}),expand:(t,e)=>dr.post("/books/expand",{text:t,instruction:e}),generateCharacters:(t,e)=>dr.post("/books/characters",{genre:t,storyIdea:e}),generatePlot:(t,e,n)=>dr.post("/books/plot",{genre:t,currentPlot:e,issue:n})};function vH(){const[t,e]=z.useState("gallery"),{activeCover:n,setActiveCover:r}=y9(),i=SS(),{data:s}=wS({queryKey:["covers"],queryFn:async()=>(await Fy.getAll()).data.covers}),o=WR({mutationFn:async d=>(await Fy.generate(d)).data,onSuccess:()=>{i.invalidateQueries({queryKey:["covers"]}),e("gallery")}}),a=d=>{o.mutate(d)},l=d=>{const h={id:`cover-${Date.now()}`,title:"New Book",author:"Author Name",backgroundImage:d,backgroundColor:"#ffffff",width:1600,height:2400,layers:[],createdAt:new Date,updatedAt:new Date};r(h),e("editor")};return N.jsxs("div",{className:"space-y-6",children:[N.jsxs("div",{className:"flex items-center justify-between",children:[N.jsxs("div",{children:[N.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:"Cover Designer"}),N.jsx("p",{className:"text-gray-500 mt-1",children:"Design stunning book covers with AI or manual editing"})]}),N.jsxs("div",{className:"flex bg-white rounded-lg p-1 border border-gray-200",children:[N.jsxs("button",{onClick:()=>e("gallery"),className:`flex items-center gap-2 px-4 py-2 rounded-md transition-colors ${t==="gallery"?"bg-primary-100 text-primary-700":"text-gray-600 hover:bg-gray-100"}`,children:[N.jsx(kS,{className:"w-4 h-4"}),"Gallery"]}),N.jsxs("button",{onClick:()=>e("editor"),className:`flex items-center gap-2 px-4 py-2 rounded-md transition-colors ${t==="editor"?"bg-primary-100 text-primary-700":"text-gray-600 hover:bg-gray-100"}`,children:[N.jsx(pp,{className:"w-4 h-4"}),"Editor"]}),N.jsxs("button",{onClick:()=>e("ai"),className:`flex items-center gap-2 px-4 py-2 rounded-md transition-colors ${t==="ai"?"bg-primary-100 text-primary-700":"text-gray-600 hover:bg-gray-100"}`,children:[N.jsx(Ua,{className:"w-4 h-4"}),"AI Generate"]})]})]}),t==="gallery"&&N.jsx(aF,{covers:s||[],onSelect:l,onDelete:d=>{Fy.delete(d).then(()=>{i.invalidateQueries({queryKey:["covers"]})})}}),t==="editor"&&n&&N.jsx(yH,{}),t==="ai"&&N.jsx(xH,{onGenerate:a,isGenerating:o.isPending})]})}function xH({onGenerate:t,isGenerating:e}){const[n,r]=z.useState(""),[i,s]=z.useState("modern"),o=[{id:"modern",name:"Modern",icon:""},{id:"minimal",name:"Minimalist",icon:"🎯"},{id:"vintage",name:"Vintage",icon:"📜"},{id:"bold",name:"Bold",icon:"🔥"},{id:"elegant",name:"Elegant",icon:"💎"},{id:"playful",name:"Playful",icon:"🎨"}],a=[{genre:"Mystery",prompt:"A mysterious book cover with dark shadows, silhouette of a detective, foggy street scene, noir atmosphere"},{genre:"Romance",prompt:"A romantic book cover with soft pastel colors, couple silhouette at sunset, dreamy and emotional"},{genre:"Fantasy",prompt:"An epic fantasy book cover with magical elements, dragon, castle in the background, mystical glowing effects"},{genre:"Sci-Fi",prompt:"A futuristic sci-fi book cover with spaceships, neon lights, cyberpunk city, high-tech atmosphere"},{genre:"Self-Help",prompt:"A clean self-help book cover with inspiring imagery, mountain peak or sunrise, professional and motivating"}],l=h=>{r(h)},d=()=>{if(n.trim()){const h=`${n}, ${i} style, professional book cover design, high quality, detailed`;t(h)}};return N.jsx("div",{className:"card space-y-6",children:N.jsxs("div",{children:[N.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:"AI Cover Generator"}),N.jsxs("div",{className:"mb-6",children:[N.jsx("label",{className:"label",children:"Select Style"}),N.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 mt-2",children:o.map(h=>N.jsxs("button",{onClick:()=>s(h.id),className:`p-3 rounded-lg border text-center transition-colors ${i===h.id?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-200 hover:border-gray-300"}`,children:[N.jsx("span",{className:"text-xl",children:h.icon}),N.jsx("p",{className:"text-xs mt-1",children:h.name})]},h.id))})]}),N.jsxs("div",{className:"mb-6",children:[N.jsx("label",{className:"label",children:"Describe Your Cover"}),N.jsx("textarea",{value:n,onChange:h=>r(h.target.value),placeholder:"Describe the book cover you want to generate... e.g., 'A mysterious forest with glowing eyes in the darkness'",className:"input min-h-[120px] resize-y"})]}),N.jsxs("div",{className:"mb-6",children:[N.jsx("label",{className:"label",children:"Quick Presets by Genre"}),N.jsx("div",{className:"grid gap-2 mt-2",children:a.map(h=>N.jsxs("button",{onClick:()=>l(h.prompt),className:"text-left px-4 py-2 rounded-lg border border-gray-200 hover:border-primary-300 hover:bg-primary-50 transition-colors",children:[N.jsx("span",{className:"font-medium",children:h.genre}),N.jsx("p",{className:"text-sm text-gray-500 truncate",children:h.prompt})]},h.genre))})]}),N.jsxs("button",{onClick:d,disabled:!n.trim()||e,className:"btn-primary w-full py-3 flex items-center justify-center gap-2",children:[N.jsx(Ua,{className:"w-5 h-5"}),e?"Generating...":"Generate Cover"]})]})})}function SH({genres:t,onSelect:e}){const{t:n}=xs(),[r,i]=z.useState(""),[s,o]=z.useState(""),[a,l]=z.useState(""),d=h=>{h.preventDefault(),r&&a.trim()&&e(r,a.trim(),s.trim())};return N.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[N.jsx("div",{className:"lg:col-span-2",children:N.jsxs("div",{className:"card",children:[N.jsxs("h3",{className:"text-lg font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[N.jsx(Id,{className:"w-5 h-5"}),n("genreSelector.selectGenre")]}),N.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:t.map(h=>N.jsxs("button",{onClick:()=>i(h.id),className:`p-4 rounded-xl border-2 text-left transition-all ${r===h.id?"border-primary-500 bg-primary-50 shadow-md":"border-gray-200 hover:border-gray-300 hover:bg-gray-50"}`,children:[N.jsx("span",{className:"text-2xl mb-2 block",children:h.icon}),N.jsx("h4",{className:"font-medium text-gray-900",children:n(`genres.${h.id}.name`,h.name)}),N.jsx("p",{className:"text-xs text-gray-500 mt-1 line-clamp-2",children:n(`genres.${h.id}.description`,h.description)})]},h.id))})]})}),N.jsx("div",{children:N.jsxs("div",{className:"card sticky top-6",children:[N.jsxs("h3",{className:"text-lg font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[N.jsx(W8,{className:"w-5 h-5"}),n("genreSelector.bookDetails")]}),N.jsxs("form",{onSubmit:d,className:"space-y-4",children:[N.jsxs("div",{children:[N.jsx("label",{className:"label",children:n("genreSelector.bookTitle")}),N.jsx("input",{type:"text",value:s,onChange:h=>o(h.target.value),placeholder:n("genreSelector.bookTitlePlaceholder"),className:"input"})]}),N.jsxs("div",{children:[N.jsxs("label",{className:"label",children:[n("genreSelector.coreIdea")," ",N.jsx("span",{className:"text-red-500",children:"*"})]}),N.jsx("textarea",{value:a,onChange:h=>l(h.target.value),placeholder:n("genreSelector.coreIdeaPlaceholder"),className:"input min-h-[150px] resize-y",required:!0})]}),N.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-3",children:N.jsxs("p",{className:"text-xs text-amber-700",children:[N.jsx("strong",{children:"Tip:"})," ",n("genreSelector.tip")]})}),N.jsx("button",{type:"submit",disabled:!r||!a.trim(),className:"btn-primary w-full py-3",children:n("genreSelector.generateOutline")})]})]})})]})}const p0=CS(t=>({books:[],activeBook:null,isGenerating:!1,generationProgress:0,addBook:e=>t(n=>({books:[e,...n.books],activeBook:e})),updateBook:(e,n)=>t(r=>{var i;return{books:r.books.map(s=>s.id===e?{...s,...n,updatedAt:new Date}:s),activeBook:((i=r.activeBook)==null?void 0:i.id)===e?{...r.activeBook,...n,updatedAt:new Date}:r.activeBook}}),deleteBook:e=>t(n=>{var r;return{books:n.books.filter(i=>i.id!==e),activeBook:((r=n.activeBook)==null?void 0:r.id)===e?null:n.activeBook}}),setActiveBook:e=>t({activeBook:e}),setOutline:e=>t(n=>{if(!n.activeBook)return n;const r={...n.activeBook,outline:e,updatedAt:new Date};return{activeBook:r,books:n.books.map(i=>i.id===n.activeBook.id?r:i)}}),addCharacter:e=>t(n=>{if(!n.activeBook)return n;const r={...n.activeBook,characters:[...n.activeBook.characters,e],updatedAt:new Date};return{activeBook:r,books:n.books.map(i=>i.id===n.activeBook.id?r:i)}}),updateChapterContent:(e,n)=>t(r=>{if(!r.activeBook||!r.activeBook.outline)return r;const i={...r.activeBook.outline,chapters:r.activeBook.outline.chapters.map(o=>o.number===e?{...o,content:n,isGenerated:!0}:o)},s={...r.activeBook,outline:i,updatedAt:new Date};return{activeBook:s,books:r.books.map(o=>o.id===r.activeBook.id?s:o)}}),setCurrentChapter:e=>t(n=>n.activeBook?{activeBook:{...n.activeBook,currentChapter:e}}:n),setCoverForBook:e=>t(n=>{if(!n.activeBook)return n;const r={...n.activeBook,coverId:e,updatedAt:new Date};return{activeBook:r,books:n.books.map(i=>i.id===n.activeBook.id?r:i)}}),setIsGenerating:e=>t({isGenerating:e}),setGenerationProgress:e=>t({generationProgress:e})}));function wH({book:t,onComplete:e}){var h;const{activeBook:n}=p0(),[r,i]=z.useState(!1),[s,o]=z.useState(""),{t:a}=xs(),l=n==null?void 0:n.outline,d=async()=>{var f,p;i(!0),o("");try{const g=(await vh.generateOutline(t.genre,t.idea,t.title)).data.outline;console.log("Generated outline:",g),console.log("Outline chapters:",g==null?void 0:g.chapters),e(g)}catch(y){console.error("Outline generation error:",y),o(((p=(f=y.response)==null?void 0:f.data)==null?void 0:p.error)||a("bookOutline.failedToGenerate"))}finally{i(!1)}};return N.jsxs("div",{className:"space-y-6",children:[N.jsx("div",{className:"card bg-gradient-to-r from-primary-50 to-accent-50",children:N.jsxs("div",{className:"flex items-start justify-between",children:[N.jsxs("div",{children:[N.jsx("h3",{className:"font-semibold text-gray-900",children:t.title||a("bookOutline.untitledBook")}),N.jsxs("p",{className:"text-sm text-gray-600 mt-1 capitalize",children:[a("bookOutline.genre"),": ",t.genre]}),N.jsx("p",{className:"text-sm text-gray-500 mt-2 line-clamp-2",children:t.idea})]}),!l&&N.jsx("button",{onClick:d,disabled:r,className:"btn-primary flex items-center gap-2",children:r?N.jsxs(N.Fragment,{children:[N.jsx(dL,{className:"w-4 h-4 animate-spin"}),a("bookOutline.generatingOutline")]}):N.jsxs(N.Fragment,{children:[N.jsx(Ua,{className:"w-4 h-4"}),a("bookOutline.generateOutline")]})})]})}),s&&N.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4",children:N.jsx("p",{className:"text-red-700",children:s})}),l&&N.jsx("div",{className:"card",children:l.error?N.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 mb-4",children:[N.jsx("h4",{className:"text-red-800 font-medium mb-2",children:"Generation Error"}),N.jsx("p",{className:"text-red-700 text-sm",children:l.error}),l.raw&&N.jsxs("details",{className:"mt-2",children:[N.jsx("summary",{className:"text-red-600 cursor-pointer",children:"Raw AI Response"}),N.jsx("pre",{className:"text-xs text-gray-600 mt-2 whitespace-pre-wrap bg-gray-100 p-2 rounded",children:l.raw})]})]}):N.jsxs(N.Fragment,{children:[N.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[N.jsx(ZR,{className:"w-5 h-5 text-green-500"}),N.jsxs("h3",{className:"text-lg font-semibold text-gray-900",children:[a("bookOutline.generatedOutline"),": ",l.title||t.title]})]}),l.logline&&N.jsxs("div",{className:"mb-6 pb-6 border-b border-gray-200",children:[N.jsx("h4",{className:"text-sm font-medium text-gray-500 mb-2",children:a("bookOutline.logline")}),N.jsx("p",{className:"text-gray-900 italic",children:l.logline})]}),N.jsxs("div",{children:[N.jsx("h4",{className:"text-sm font-medium text-gray-500 mb-4",children:a("bookOutline.chapterOutline")}),N.jsx("div",{className:"space-y-3",children:(h=l.chapters)==null?void 0:h.map((f,p)=>N.jsx("div",{className:"border border-gray-200 rounded-lg p-4 hover:border-primary-300 transition-colors",children:N.jsxs("div",{className:"flex items-start gap-3",children:[N.jsx("span",{className:"flex-shrink-0 w-8 h-8 bg-primary-100 text-primary-700 rounded-full flex items-center justify-center text-sm font-medium",children:f.number||p+1}),N.jsxs("div",{className:"flex-1",children:[N.jsx("h5",{className:"font-medium text-gray-900",children:f.title||`${a("bookOutline.chapter")} ${f.number||p+1}`}),N.jsx("p",{className:"text-sm text-gray-600 mt-1",children:f.summary||a("bookOutline.noSummary")})]})]})},p))})]}),N.jsx("div",{className:"mt-6 flex items-center justify-end gap-3",children:N.jsx("p",{className:"text-sm text-gray-500",children:a("bookOutline.readyToWrite")})})]})}),!l&&!r&&N.jsxs("div",{className:"card text-center py-12",children:[N.jsx(Ua,{className:"w-12 h-12 text-gray-300 mx-auto mb-4"}),N.jsx("h3",{className:"text-lg font-medium text-gray-900",children:a("bookOutline.readyToGenerate")}),N.jsx("p",{className:"text-gray-500 mt-2 max-w-md mx-auto",children:a("bookOutline.readyToGenerateDesc")})]})]})}function dn(t){this.content=t}dn.prototype={constructor:dn,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new dn(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new dn(n)},addToStart:function(t,e){return new dn([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new dn(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new dn(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=dn.from(t),t.size?new dn(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=dn.from(t),t.size?new dn(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=dn.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};dn.from=function(t){if(t instanceof dn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new dn(e)};function v9(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)n++;return n}if(i.content.size||s.content.size){let o=v9(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function x9(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){n-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let d=0,h=Math.min(o.text.length,a.text.length);for(;d<h&&o.text[o.text.length-d-1]==a.text[a.text.length-d-1];)d++,n--,r--;return{a:n,b:r}}if(o.content.size||a.content.size){let d=x9(o.content,a.content,n-1,r-1);if(d)return d}n-=l,r-=l}}class J{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let o=0,a=0;a<n;o++){let l=this.content[o],d=a+l.nodeSize;if(d>e&&r(l,i+a,s||null,o)!==!1&&l.content.size){let h=a+1;l.nodesBetween(Math.max(0,e-h),Math.min(l.content.size,n-h),r,i+h)}a=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(a,l)=>{let d=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&d||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=d},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new J(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,o=0;o<n;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),i+=a.nodeSize),o=l}return new J(r,i)}cutByIndex(e,n){return e==n?J.empty:e==0&&n==this.content.length?this:new J(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new J(i,s)}addToStart(e){return new J([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new J(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return v9(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return x9(this,e,n,r)}findIndex(e){if(e==0)return Hf(0,e);if(e==this.size)return Hf(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),s=r+i.nodeSize;if(s>=e)return s==e?Hf(n+1,s):Hf(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return J.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new J(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return J.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new J(n||e,r)}static from(e){if(!e)return J.empty;if(e instanceof J)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new J([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}J.empty=new J([],0);const jy={index:0,offset:0};function Hf(t,e){return jy.index=t,jy.offset=e,jy}function om(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!om(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!om(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Xe=class Uv{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&om(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Uv.none;if(e instanceof Uv)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};Xe.none=[];class am extends Error{}class ue{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=w9(this.content,e+this.openStart,n);return r&&new ue(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ue(S9(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return ue.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ue(J.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new ue(e,r,i)}}ue.empty=new ue(J.empty,0,0);function S9(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(i==e||s.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(S9(s.content,e-i-1,n-i-1)))}function w9(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),o=t.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=w9(o.content,e-s-1,n,o);return a&&t.replaceChild(i,o.copy(a))}function kH(t,e,n){if(n.openStart>t.depth)throw new am("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new am("Inconsistent open depths");return k9(t,e,n,0)}function k9(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let o=k9(t,e,n,r+1);return s.copy(s.content.replaceChild(i,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,a=o.content;return Oa(o,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=CH(n,t);return Oa(s,b9(t,o,a,e,r))}else return Oa(s,lm(t,e,r))}function C9(t,e){if(!e.type.compatibleContent(t.type))throw new am("Cannot join "+e.type.name+" onto "+t.type.name)}function Hv(t,e,n){let r=t.node(n);return C9(r,e.node(n)),r}function Pa(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function rd(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(Pa(t.nodeAfter,r),s++));for(let a=s;a<o;a++)Pa(i.child(a),r);e&&e.depth==n&&e.textOffset&&Pa(e.nodeBefore,r)}function Oa(t,e){return t.type.checkContent(e),t.copy(e)}function b9(t,e,n,r,i){let s=t.depth>i&&Hv(t,e,i+1),o=r.depth>i&&Hv(n,r,i+1),a=[];return rd(null,t,i,a),s&&o&&e.index(i)==n.index(i)?(C9(s,o),Pa(Oa(s,b9(t,e,n,r,i+1)),a)):(s&&Pa(Oa(s,lm(t,e,i+1)),a),rd(e,n,i,a),o&&Pa(Oa(o,lm(n,r,i+1)),a)),rd(r,null,i,a),new J(a)}function lm(t,e,n){let r=[];if(rd(null,t,n,r),t.depth>n){let i=Hv(t,e,n+1);Pa(Oa(i,lm(t,e,n+1)),r)}return rd(e,null,n,r),new J(r)}function CH(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(J.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Bd{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Xe.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let a=r;r=i,i=a}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new um(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),d=s-l;if(r.push(o,a,i+l),!d||(o=o.child(a),o.isText))break;s=d-1,i+=l+1}return new Bd(n,r,s)}static resolveCached(e,n){let r=vC.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==n)return o}else vC.set(e,r=new bH);let i=r.elts[r.i]=Bd.resolve(e,n);return r.i=(r.i+1)%EH,i}}class bH{constructor(){this.elts=[],this.i=0}}const EH=12,vC=new WeakMap;class um{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const _H=Object.create(null);class li{constructor(e,n,r,i=Xe.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||J.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&om(this.attrs,n||e.defaultAttrs||_H)&&Xe.sameSet(this.marks,r||Xe.none)}copy(e=null){return e==this.content?this:new li(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new li(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return ue.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),a=i.start(o),d=i.node(o).content.cut(i.pos-a,s.pos-a);return new ue(d,i.depth-o,s.depth-o)}replace(e,n,r){return kH(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return Bd.resolveCached(this,e)}resolveNoCache(e){return Bd.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),E9(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=J.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Xe.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Xe.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=J.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}}li.prototype.text=void 0;class cm extends li{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):E9(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new cm(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new cm(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function E9(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Ga{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new NH(e,n);if(r.next==null)return Ga.empty;let i=_9(r);r.next&&r.err("Unexpected trailing text");let s=LH(RH(i));return IH(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(o,a){let l=o.matchFragment(e,r);if(l&&(!n||l.validEnd))return J.from(a.map(d=>d.createAndFill()));for(let d=0;d<o.next.length;d++){let{type:h,next:f}=o.next[d];if(!(h.isText||h.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let p=s(f,a.concat(h));if(p)return p}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
`)}}Ga.empty=new Ga(!0);class NH{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function _9(t){let e=[];do e.push(TH(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function TH(t){let e=[];do e.push(MH(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function MH(t){let e=AH(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=PH(t,e);else break;return e}function xC(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function PH(t,e){let n=xC(t),r=n;return t.eat(",")&&(t.next!="}"?r=xC(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function OH(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let o=n[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function AH(t){if(t.eat("(")){let e=_9(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=OH(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function RH(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,a,l){let d={term:l,to:a};return e[o].push(d),d}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,d)=>l.concat(s(d,a)),[]);if(o.type=="seq")for(let l=0;;l++){let d=s(o.exprs[l],a);if(l==o.exprs.length-1)return d;i(d,a=n())}else if(o.type=="star"){let l=n();return r(a,l),i(s(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=n();return i(s(o.expr,a),l),i(s(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let d=0;d<o.min;d++){let h=n();i(s(o.expr,l),h),l=h}if(o.max==-1)i(s(o.expr,l),l);else for(let d=o.min;d<o.max;d++){let h=n();r(l,h),i(s(o.expr,l),h),l=h}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function N9(t,e){return e-t}function SC(t,e){let n=[];return r(e),n.sort(N9);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&n.indexOf(l)==-1&&r(l)}}}function LH(t){let e=Object.create(null);return n(SC(t,0));function n(r){let i=[];r.forEach(o=>{t[o].forEach(({term:a,to:l})=>{if(!a)return;let d;for(let h=0;h<i.length;h++)i[h][0]==a&&(d=i[h][1]);SC(t,l).forEach(h=>{d||i.push([a,d=[]]),d.indexOf(h)==-1&&d.push(h)})})});let s=e[r.join(",")]=new Ga(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(N9);s.next.push({type:i[o][0],next:e[a.join(",")]||n(a)})}return s}}function IH(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:d}=i.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),r.indexOf(d)==-1&&r.push(d)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function T9(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function M9(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function P9(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let s=t[i];s.validate&&s.validate(e[i])}}function O9(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new FH(t,r,e[r]);return n}let wC=class A9{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=O9(e,r.attrs),this.defaultAttrs=T9(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Ga.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:M9(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new li(this,this.computeAttrs(e),J.from(n),Xe.setFrom(r))}createChecked(e=null,n,r){return n=J.from(n),this.checkContent(n),new li(this,this.computeAttrs(e),n,Xe.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=J.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(J.empty,!0);return s?new li(this,e,n.append(s),Xe.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){P9(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Xe.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new A9(s,n,o));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function DH(t,e,n){let r=n.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class FH{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?DH(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class m0{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=O9(e,i.attrs),this.excluded=null;let s=T9(this.attrs);this.instance=s?new Xe(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Xe(this,M9(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new m0(s,i++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){P9(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class R9{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=dn.from(e.nodes),n.marks=dn.from(e.marks||{}),this.nodes=wC.compile(this.spec.nodes,this),this.marks=m0.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=Ga.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?kC(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:kC(this,o.split(" "))}this.nodeFromJSON=i=>li.fromJSON(this,i),this.markFromJSON=i=>Xe.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof wC){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new cm(r,r.defaultAttrs,e,Xe.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function kC(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let a in t.marks){let l=t.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function jH(t){return t.tag!=null}function zH(t){return t.style!=null}class Co{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(jH(i))this.tags.push(i);else if(zH(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new bC(this,n,!1);return r.addAll(e,Xe.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new bC(this,n,!0);return r.addAll(e,Xe.none,n.from,n.to),ue.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(HH(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(o.getAttrs){let l=o.getAttrs(n);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<n.length;o++){let a=n[o];if((a.priority==null?50:a.priority)<s)break}n.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=EC(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=EC(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Co(e,Co.schemaRules(e)))}}const L9={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},BH={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},I9={ol:!0,ul:!0},Ud=1,Vv=2,id=4;function CC(t,e,n){return e!=null?(e?Ud:0)|(e==="full"?Vv:0):t&&t.whitespace=="pre"?Ud|Vv:n&~id}class Vf{constructor(e,n,r,i,s,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=Xe.none,this.match=s||(o&id?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(J.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ud)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let n=J.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(J.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!L9.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class bC{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,o=CC(null,n.preserveWhitespace,0)|(r?id:0);i?s=new Vf(i.type,i.attrs,Xe.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new Vf(null,null,Xe.none,!0,null,o):s=new Vf(e.schema.topNodeType,null,Xe.none,!0,null,o),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,s=i.options&Vv?"full":this.localPreserveWS||(i.options&Ud)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(o.text(a[l]),n,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;I9.hasOwnProperty(o)&&this.parser.normalizeLists&&UH(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:BH.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let d,h=this.needsBlock;if(L9.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),d=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let f=l&&l.skip?n:this.readStyles(e,n);f&&this.addAll(e,f),d&&this.sync(s),this.needsBlock=h}else{let d=this.readStyles(e,n);d&&this.addElementByRule(e,l,d,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(s,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(d=>!l.clearMark(d)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,i){let s,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(o,n.attrs||null,r,n.preserveWhitespace);l&&(s=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}s&&this.sync(a)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],d=l.findWrapping(e);if(d&&(!i||i.length>d.length+a)&&(i=d,s=l,!d.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)n=this.enterInner(i[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=Xe.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):_C(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,n,r,i){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,i)),s}enterInner(e,n,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=CC(e,s,o.options);o.options&id&&o.content.length==0&&(a|=id);let l=Xe.none;return r=r.filter(d=>(o.type?o.type.allowsMarkType(d.type):_C(d.type,e))?(l=d.addToSet(l),!1):!0),this.nodes.push(new Vf(e,n,l,i,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Ud)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let d=n[a];if(d==""){if(a==n.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let h=l>0||l==0&&i?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!h||h.name!=d&&!h.isInGroup(d))return!1;l--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function UH(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&I9.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function HH(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function EC(t){let e={};for(let n in t)e[n]=t[n];return e}function _C(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:d,next:h}=a.edge(l);if(d==e||s.indexOf(h)<0&&o(h))return!0}};if(o(i.contentMatch))return!0}}class ol{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=zy(n).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let d=o.marks[l];if(!this.marks[d.type.name]){l++;continue}if(!d.eq(s[a][0])||d.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let d=o.marks[l++],h=this.serializeMark(d,o.isInline,n);h&&(s.push([d,i]),i.appendChild(h.dom),i=h.contentDOM||h.dom)}}i.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=Sp(zy(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Sp(zy(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return Sp(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ol(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=NC(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return NC(e.marks)}}function NC(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function zy(t){return t.document||window.document}const TC=new WeakMap;function VH(t){let e=TC.get(t);return e===void 0&&TC.set(t,e=GH(t)),e}function GH(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function Sp(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=VH(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(n=i.slice(0,o),i=i.slice(o+1));let a,l=n?t.createElementNS(n,i):t.createElement(i),d=e[1],h=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){h=2;for(let f in d)if(d[f]!=null){let p=f.indexOf(" ");p>0?l.setAttributeNS(f.slice(0,p),f.slice(p+1),d[f]):f=="style"&&l.style?l.style.cssText=d[f]:l.setAttribute(f,d[f])}}for(let f=h;f<e.length;f++){let p=e[f];if(p===0){if(f<e.length-1||f>h)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:y,contentDOM:g}=Sp(t,p,n,r);if(l.appendChild(y),g){if(a)throw new RangeError("Multiple content holes");a=g}}}return{dom:l,contentDOM:a}}const D9=65535,F9=Math.pow(2,16);function $H(t,e){return t+e*F9}function MC(t){return t&D9}function WH(t){return(t-(t&D9))/F9}const j9=1,z9=2,wp=4,B9=8;class Gv{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&B9)>0}get deletedBefore(){return(this.delInfo&(j9|wp))>0}get deletedAfter(){return(this.delInfo&(z9|wp))>0}get deletedAcross(){return(this.delInfo&wp)>0}}class hr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&hr.empty)return hr.empty}recover(e){let n=0,r=MC(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+WH(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let d=this.ranges[a+s],h=this.ranges[a+o],f=l+d;if(e<=f){let p=d?e==l?-1:e==f?1:n:n,y=l+i+(p<0?0:h);if(r)return y;let g=e==(n<0?l:f)?null:$H(a/3,e-l),x=e==l?z9:e==f?j9:wp;return(n<0?e!=l:e!=f)&&(x|=B9),new Gv(y,x,g)}i+=h-d}return r?e+i:new Gv(e+i,0,null)}touches(e,n){let r=0,i=MC(n),s=this.inverted?2:1,o=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>e)break;let d=this.ranges[a+s],h=l+d;if(e<=h&&a==i*3)return!0;r+=this.ranges[a+o]-d}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),d=this.ranges[i+n],h=this.ranges[i+r];e(a,a+d,l,l+h),s+=h-d}}invert(){return new hr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?hr.empty:new hr(e<0?[0,-e,0]:[0,0,e])}}hr.empty=new hr([]);class Hd{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Hd(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Hd;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new Gv(e,i,null)}}const By=Object.create(null);class An{getMap(){return hr.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=By[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in By)throw new RangeError("Duplicate use of step JSON ID "+e);return By[e]=n,n.prototype.jsonID=e,n}}class zt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new zt(e,null)}static fail(e){return new zt(null,e)}static fromReplace(e,n,r,i){try{return zt.ok(e.replace(n,r,i))}catch(s){if(s instanceof am)return zt.fail(s.message);throw s}}}function WS(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(WS(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return J.fromArray(r)}class co extends An{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new ue(WS(n.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return zt.fromReplace(e,this.from,this.to,s)}invert(){return new ii(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new co(n.pos,r.pos,this.mark)}merge(e){return e instanceof co&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new co(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new co(n.from,n.to,e.markFromJSON(n.mark))}}An.jsonID("addMark",co);class ii extends An{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new ue(WS(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return zt.fromReplace(e,this.from,this.to,r)}invert(){return new co(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new ii(n.pos,r.pos,this.mark)}merge(e){return e instanceof ii&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ii(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ii(n.from,n.to,e.markFromJSON(n.mark))}}An.jsonID("removeMark",ii);class ho extends An{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return zt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return zt.fromReplace(e,this.pos,this.pos+1,new ue(J.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new ho(this.pos,n.marks[i]);return new ho(this.pos,this.mark)}}return new $a(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ho(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ho(n.pos,e.markFromJSON(n.mark))}}An.jsonID("addNodeMark",ho);class $a extends An{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return zt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return zt.fromReplace(e,this.pos,this.pos+1,new ue(J.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new ho(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new $a(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new $a(n.pos,e.markFromJSON(n.mark))}}An.jsonID("removeNodeMark",$a);class Ft extends An{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&$v(e,this.from,this.to)?zt.fail("Structure replace would overwrite content"):zt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new hr([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ft(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&Ft.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new Ft(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ft)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?ue.empty:new ue(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ft(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?ue.empty:new ue(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ft(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ft(n.from,n.to,ue.fromJSON(e,n.slice),!!n.structure)}}Ft.MAP_BIAS=1;An.jsonID("replace",Ft);class on extends An{constructor(e,n,r,i,s,o,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&($v(e,this.from,this.gapFrom)||$v(e,this.gapTo,this.to)))return zt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return zt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?zt.fromReplace(e,this.from,this.to,r):zt.fail("Content does not fit in gap")}getMap(){return new hr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new on(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new on(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new on(n.from,n.to,n.gapFrom,n.gapTo,ue.fromJSON(e,n.slice),n.insert,!!n.structure)}}An.jsonID("replaceAround",on);function $v(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function KH(t,e,n,r){let i=[],s=[],o,a;t.doc.nodesBetween(e,n,(l,d,h)=>{if(!l.isInline)return;let f=l.marks;if(!r.isInSet(f)&&h.type.allowsMarkType(r.type)){let p=Math.max(d,e),y=Math.min(d+l.nodeSize,n),g=r.addToSet(f);for(let x=0;x<f.length;x++)f[x].isInSet(g)||(o&&o.to==p&&o.mark.eq(f[x])?o.to=y:i.push(o=new ii(p,y,f[x])));a&&a.to==p?a.to=y:s.push(a=new co(p,y,r))}}),i.forEach(l=>t.step(l)),s.forEach(l=>t.step(l))}function qH(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(r instanceof m0){let d=o.marks,h;for(;h=r.isInSet(d);)(l||(l=[])).push(h),d=h.removeFromSet(d)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let d=Math.min(a+o.nodeSize,n);for(let h=0;h<l.length;h++){let f=l[h],p;for(let y=0;y<i.length;y++){let g=i[y];g.step==s-1&&f.eq(i[y].style)&&(p=g)}p?(p.to=d,p.step=s):i.push({style:f,from:Math.max(a,e),to:d,step:s})}}}),i.forEach(o=>t.step(new ii(o.from,o.to,o.style)))}function KS(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let d=s.child(l),h=a+d.nodeSize,f=r.matchType(d.type);if(!f)o.push(new Ft(a,h,ue.empty));else{r=f;for(let p=0;p<d.marks.length;p++)n.allowsMarkType(d.marks[p].type)||t.step(new ii(a,h,d.marks[p]));if(i&&d.isText&&n.whitespace!="pre"){let p,y=/\r?\n|\r/g,g;for(;p=y.exec(d.text);)g||(g=new ue(J.from(n.schema.text(" ",n.allowedMarks(d.marks))),0,0)),o.push(new Ft(a+p.index,a+p.index+p[0].length,g))}}a=h}if(!r.validEnd){let l=r.fillBefore(J.empty,!0);t.replace(a,a,new ue(l,0,0))}for(let l=o.length-1;l>=0;l--)t.step(o[l])}function QH(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function qu(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let o=t.$from.node(r),a=t.$from.index(r)+i,l=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(a,l,n))return r;if(r==0||o.type.spec.isolating||!QH(o,a,l))break;a&&(i=1),l<o.childCount&&(s=1)}return null}function YH(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),a=i.after(s+1),l=o,d=a,h=J.empty,f=0;for(let g=s,x=!1;g>n;g--)x||r.index(g)>0?(x=!0,h=J.from(r.node(g).copy(h)),f++):l--;let p=J.empty,y=0;for(let g=s,x=!1;g>n;g--)x||i.after(g+1)<i.end(g)?(x=!0,p=J.from(i.node(g).copy(p)),y++):d++;t.step(new on(l,d,o,a,new ue(h.append(p),f,y),h.size-f,!0))}function qS(t,e,n=null,r=t){let i=JH(t,e),s=i&&XH(r,e);return s?i.map(PC).concat({type:e,attrs:n}).concat(s.map(PC)):null}function PC(t){return{type:t,attrs:null}}function JH(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function XH(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let d=r;l&&d<i;d++)l=l.matchType(n.child(d).type);return!l||!l.validEnd?null:o}function ZH(t,e,n){let r=J.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let a=n[o].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=J.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new on(i,s,i,s,new ue(r,0,0),n.length,!0))}function eV(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,l)&&tV(t.doc,t.mapping.slice(s).map(a),r)){let d=null;if(r.schema.linebreakReplacement){let y=r.whitespace=="pre",g=!!r.contentMatch.matchType(r.schema.linebreakReplacement);y&&!g?d=!1:!y&&g&&(d=!0)}d===!1&&H9(t,o,a,s),KS(t,t.mapping.slice(s).map(a,1),r,void 0,d===null);let h=t.mapping.slice(s),f=h.map(a,1),p=h.map(a+o.nodeSize,1);return t.step(new on(f,p,f+1,p-1,new ue(J.from(r.create(l,null,o.marks)),0,0),1,!0)),d===!0&&U9(t,o,a,s),!1}})}function U9(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function H9(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
`))}})}function tV(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function nV(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new on(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new ue(J.from(o),0,0),1,!0))}function ds(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let d=i.depth-1,h=n-2;d>s;d--,h--){let f=i.node(d),p=i.index(d);if(f.type.spec.isolating)return!1;let y=f.content.cutByIndex(p,f.childCount),g=r&&r[h+1];g&&(y=y.replaceChild(0,g.type.create(g.attrs)));let x=r&&r[h]||f;if(!f.canReplace(p+1,f.childCount)||!x.type.validContent(y))return!1}let a=i.indexAfter(s),l=r&&r[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function rV(t,e,n=1,r){let i=t.doc.resolve(e),s=J.empty,o=J.empty;for(let a=i.depth,l=i.depth-n,d=n-1;a>l;a--,d--){s=J.from(i.node(a).copy(s));let h=r&&r[d];o=J.from(h?h.type.create(h.attrs,o):i.node(a).copy(o))}t.step(new Ft(e,e,new ue(s.append(o),n,n),!0))}function Ho(t,e){let n=t.resolve(e),r=n.index();return V9(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function iV(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function V9(t,e){return!!(t&&e&&!t.isLeaf&&iV(t,e))}function g0(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,o,a=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):n>0?(s=r.node(i+1),a++,o=r.node(i).maybeChild(a)):(s=r.node(i).maybeChild(a-1),o=r.node(i+1)),s&&!s.isTextblock&&V9(s,o)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function sV(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(i&&o.inlineContent){let h=o.whitespace=="pre",f=!!o.contentMatch.matchType(i);h&&!f?r=!1:!h&&f&&(r=!0)}let a=t.steps.length;if(r===!1){let h=t.doc.resolve(e+n);H9(t,h.node(),h.before(),a)}o.inlineContent&&KS(t,e+n-1,o,s.node().contentMatchAt(s.index()),r==null);let l=t.mapping.slice(a),d=l.map(e-n);if(t.step(new Ft(d,l.map(e+n,-1),ue.empty,!0)),r===!0){let h=t.doc.resolve(d);U9(t,h.node(),h.before(),t.steps.length)}return t}function oV(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function G9(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),d=r.node(o),h=!1;if(s==1)h=d.canReplace(l,l,i);else{let f=d.contentMatchAt(l).findWrapping(i.firstChild.type);h=f&&d.canReplaceWith(l,l,f[0])}if(h)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function y0(t,e,n=e,r=ue.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return $9(i,s,r)?new Ft(e,n,r):new aV(i,s,r).fit()}function $9(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class aV{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=J.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=J.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new ue(s,o,a);return e>-1?new on(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Ft(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Uy(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:d}=this.frontier[a],h,f=null;if(n==1&&(o?d.matchType(o.type)||(f=d.fillBefore(J.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:f};if(n==2&&o&&(h=d.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:h};if(s&&d.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Uy(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new ue(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Uy(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new ue(Bc(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new ue(Bc(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let x=0;x<s.length;x++)this.openFrontierNode(s[x]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,d=0,h=[],{match:f,type:p}=this.frontier[n];if(i){for(let x=0;x<i.childCount;x++)h.push(i.child(x));f=f.matchFragment(i)}let y=a.size+e-(o.content.size-o.openEnd);for(;d<a.childCount;){let x=a.child(d),S=f.matchType(x.type);if(!S)break;d++,(d>1||l==0||x.content.size)&&(f=S,h.push(W9(x.mark(p.allowedMarks(x.marks)),d==1?l:0,d==a.childCount?y:-1)))}let g=d==a.childCount;g||(y=-1),this.placed=Uc(this.placed,n,J.from(h)),this.frontier[n].match=f,g&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let x=0,S=a;x<y;x++){let C=S.lastChild;this.frontier.push({type:C.type,match:C.contentMatchAt(C.childCount)}),S=C.content}this.unplaced=g?e==0?ue.empty:new ue(Bc(o.content,e-1,1),e-1,y<0?o.openEnd:e-1):new ue(Bc(o.content,e,d),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Hy(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=Hy(e,n,i,r,s);if(o){for(let a=n-1;a>=0;a--){let{match:l,type:d}=this.frontier[a],h=Hy(e,a,d,l,!0);if(!h||h.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Uc(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Uc(this.placed,this.depth,J.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(J.empty,!0);n.childCount&&(this.placed=Uc(this.placed,this.frontier.length,n))}}function Bc(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Bc(t.firstChild.content,e-1,n)))}function Uc(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Uc(t.lastChild.content,e-1,n)))}function Uy(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function W9(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,W9(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(J.empty,!0)))),t.copy(r)}function Hy(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!lV(n,s.content,o)?a:null}function lV(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function uV(t){return t.spec.defining||t.spec.definingForContent}function cV(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if($9(i,s,r))return t.step(new Ft(e,n,r));let o=q9(i,s);o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let p=i.depth,y=i.pos-1;p>0;p--,y--){let g=i.node(p).type.spec;if(g.defining||g.definingAsContext||g.isolating)break;o.indexOf(p)>-1?a=p:i.before(p)==y&&o.splice(1,0,-p)}let l=o.indexOf(a),d=[],h=r.openStart;for(let p=r.content,y=0;;y++){let g=p.firstChild;if(d.push(g),y==r.openStart)break;p=g.content}for(let p=h-1;p>=0;p--){let y=d[p],g=uV(y.type);if(g&&!y.sameMarkup(i.node(Math.abs(a)-1)))h=p;else if(g||!y.type.isTextblock)break}for(let p=r.openStart;p>=0;p--){let y=(p+h+1)%(r.openStart+1),g=d[y];if(g)for(let x=0;x<o.length;x++){let S=o[(x+l)%o.length],C=!0;S<0&&(C=!1,S=-S);let E=i.node(S-1),w=i.index(S-1);if(E.canReplaceWith(w,w,g.type,g.marks))return t.replace(i.before(S),C?s.after(S):n,new ue(K9(r.content,0,r.openStart,y),y,r.openEnd))}}let f=t.steps.length;for(let p=o.length-1;p>=0&&(t.replace(e,n,r),!(t.steps.length>f));p--){let y=o[p];y<0||(e=i.before(y),n=s.after(y))}}function K9(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(K9(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(J.empty,!0))}return t}function dV(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=oV(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new ue(J.from(r),0,0))}function hV(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let o=r.sharedDepth(n),a=!1;for(let l=r.depth;l>o;l--)r.node(l).type.spec.isolating&&(a=!0);for(let l=i.depth;l>o;l--)i.node(l).type.spec.isolating&&(a=!0);if(!a){for(let l=r.depth;l>0&&e==r.start(l);l--)e=r.before(l);for(let l=i.depth;l>0&&n==i.start(l);l--)n=i.before(l);r=t.doc.resolve(e),i=t.doc.resolve(n)}}let s=q9(r,i);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.delete(r.before(a),i.after(a))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function q9(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}class tu extends An{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return zt.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return zt.fromReplace(e,this.pos,this.pos+1,new ue(J.from(i),0,n.isLeaf?0:1))}getMap(){return hr.empty}invert(e){return new tu(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new tu(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new tu(n.pos,n.attr,n.value)}}An.jsonID("attr",tu);class Vd extends An{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return zt.ok(r)}getMap(){return hr.empty}invert(e){return new Vd(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Vd(n.attr,n.value)}}An.jsonID("docAttr",Vd);let Nu=class extends Error{};Nu=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Nu.prototype=Object.create(Error.prototype);Nu.prototype.constructor=Nu;Nu.prototype.name="TransformError";class Q9{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Hd}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Nu(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.forEach((s,o,a,l)=>{e=Math.min(e,a),n=Math.max(n,l)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=ue.empty){let i=y0(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new ue(J.from(r),0,0))}delete(e,n){return this.replace(e,n,ue.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return cV(this,e,n,r),this}replaceRangeWith(e,n,r){return dV(this,e,n,r),this}deleteRange(e,n){return hV(this,e,n),this}lift(e,n){return YH(this,e,n),this}join(e,n=1){return sV(this,e,n),this}wrap(e,n){return ZH(this,e,n),this}setBlockType(e,n=e,r,i=null){return eV(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return nV(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new tu(e,n,r)),this}setDocAttribute(e,n){return this.step(new Vd(e,n)),this}addNodeMark(e,n){return this.step(new ho(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof Xe)n.isInSet(r.marks)&&this.step(new $a(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new $a(e,s)),i=s.removeFromSet(i);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,n=1,r){return rV(this,e,n,r),this}addMark(e,n,r){return KH(this,e,n,r),this}removeMark(e,n,r){return qH(this,e,n,r),this}clearIncompatible(e,n,r){return KS(this,e,n,r),this}}const Vy=Object.create(null);class Oe{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new fV(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=ue.empty){let r=n.content.lastChild,i=null;for(let a=0;a<n.openEnd;a++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:d}=o[a],h=e.mapping.slice(s);e.replaceRange(h.map(l.pos),h.map(d.pos),a?ue.empty:n),a==0&&RC(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],l=e.mapping.slice(r),d=l.map(o.pos),h=l.map(a.pos);s?e.deleteRange(d,h):(e.replaceRangeWith(d,h,n),RC(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new we(e):Al(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=n<0?Al(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):Al(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new mr(e.node(0))}static atStart(e){return Al(e,e,0,0,1)||new mr(e)}static atEnd(e){return Al(e,e,e.content.size,e.childCount,-1)||new mr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Vy[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Vy)throw new RangeError("Duplicate use of selection JSON ID "+e);return Vy[e]=n,n.prototype.jsonID=e,n}getBookmark(){return we.between(this.$anchor,this.$head).getBookmark()}}Oe.prototype.visible=!0;class fV{constructor(e,n){this.$from=e,this.$to=n}}let OC=!1;function AC(t){!OC&&!t.parent.inlineContent&&(OC=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class we extends Oe{constructor(e,n=e){AC(e),AC(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Oe.near(r);let i=e.resolve(n.map(this.anchor));return new we(i.parent.inlineContent?i:r,r)}replace(e,n=ue.empty){if(super.replace(e,n),n==ue.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof we&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new v0(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new we(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=Oe.findFrom(n,r,!0)||Oe.findFrom(n,-r,!0);if(s)n=s.$head;else return Oe.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(Oe.findFrom(e,-r,!0)||Oe.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new we(e,n)}}Oe.jsonID("text",we);class v0{constructor(e,n){this.anchor=e,this.head=n}map(e){return new v0(e.map(this.anchor),e.map(this.head))}resolve(e){return we.between(e.resolve(this.anchor),e.resolve(this.head))}}class ye extends Oe{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?Oe.near(s):new ye(s)}content(){return new ue(J.from(this.node),0,0)}eq(e){return e instanceof ye&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new QS(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ye(e.resolve(n.anchor))}static create(e,n){return new ye(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ye.prototype.visible=!1;Oe.jsonID("node",ye);class QS{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new v0(r,r):new QS(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&ye.isSelectable(r)?new ye(n):Oe.near(n)}}class mr extends Oe{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=ue.empty){if(n==ue.empty){e.delete(0,e.doc.content.size);let r=Oe.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new mr(e)}map(e){return new mr(e)}eq(e){return e instanceof mr}getBookmark(){return pV}}Oe.jsonID("all",mr);const pV={map(){return this},resolve(t){return new mr(t)}};function Al(t,e,n,r,i,s=!1){if(e.inlineContent)return we.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&ye.isSelectable(a))return ye.create(t,n-(i<0?a.nodeSize:0))}else{let l=Al(t,a,n+i,i<0?a.childCount:0,i,s);if(l)return l}n+=a.nodeSize*i}return null}function RC(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof Ft||i instanceof on))return;let s=t.mapping.maps[r],o;s.forEach((a,l,d,h)=>{o==null&&(o=h)}),t.setSelection(Oe.near(t.doc.resolve(o),n))}const LC=1,Gf=2,IC=4;class mV extends Q9{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|LC)&~Gf,this.storedMarks=null,this}get selectionSet(){return(this.updated&LC)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Gf,this}ensureMarks(e){return Xe.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Gf)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Gf,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Xe.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Oe.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=IC,this}get scrolledIntoView(){return(this.updated&IC)>0}}function DC(t,e){return!e||!t?t:t.bind(e)}class Hc{constructor(e,n,r){this.name=e,this.init=DC(n.init,r),this.apply=DC(n.apply,r)}}const gV=[new Hc("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Hc("selection",{init(t,e){return t.selection||Oe.atStart(e.doc)},apply(t){return t.selection}}),new Hc("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Hc("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Gy{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=gV.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 Hc(r.key,r.spec.state,r))})}}class Kl{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=i?i[o].n:0,d=i?i[o].state:this,h=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,d,r);if(h&&r.filterTransaction(h,o)){if(h.setMeta("appendedTransaction",e),!i){i=[];for(let f=0;f<this.config.plugins.length;f++)i.push(f<o?{state:r,n:n.length}:{state:this,n:0})}n.push(h),r=r.applyInner(h),s=!0}i&&(i[o]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Kl(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new mV(this)}static create(e){let n=new Gy(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Kl(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new Gy(this.schema,e.plugins),r=n.fields,i=new Kl(n);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Gy(e.schema,e.plugins),s=new Kl(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=li.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=Oe.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],d=l.spec.state;if(l.key==o.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){s[o.name]=d.fromJSON.call(l,e,n[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function Y9(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Y9(i,e,{})),n[r]=i}return n}class Et{constructor(e){this.spec=e,this.props={},e.props&&Y9(e.props,this,this.props),this.key=e.key?e.key.key:J9("plugin")}getState(e){return e[this.key]}}const $y=Object.create(null);function J9(t){return t in $y?t+"$"+ ++$y[t]:($y[t]=0,t+"$")}class Jt{constructor(e="key"){this.key=J9(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const YS=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function X9(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Z9=(t,e,n)=>{let r=X9(t,n);if(!r)return!1;let i=JS(r);if(!i){let o=r.blockRange(),a=o&&qu(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(lN(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Tu(s,"end")||ye.isSelectable(s)))for(let o=r.depth;;o--){let a=y0(t.doc,r.before(o),r.after(o),ue.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(Tu(s,"end")?Oe.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):ye.create(l.doc,i.pos-s.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},yV=(t,e,n)=>{let r=X9(t,n);if(!r)return!1;let i=JS(r);return i?eN(t,i,e):!1},vV=(t,e,n)=>{let r=nN(t,n);if(!r)return!1;let i=XS(r);return i?eN(t,i,e):!1};function eN(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let h=i.lastChild;if(!h)return!1;i=h}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let h=a.firstChild;if(!h)return!1;a=h}let d=y0(t.doc,s,l,ue.empty);if(!d||d.from!=s||d instanceof Ft&&d.slice.size>=l-s)return!1;if(n){let h=t.tr.step(d);h.setSelection(we.create(h.doc,s)),n(h.scrollIntoView())}return!0}function Tu(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const tN=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=JS(r)}let o=s&&s.nodeBefore;return!o||!ye.isSelectable(o)?!1:(e&&e(t.tr.setSelection(ye.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function JS(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function nN(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const rN=(t,e,n)=>{let r=nN(t,n);if(!r)return!1;let i=XS(r);if(!i)return!1;let s=i.nodeAfter;if(lN(t,i,e,1))return!0;if(r.parent.content.size==0&&(Tu(s,"start")||ye.isSelectable(s))){let o=y0(t.doc,r.before(),r.after(),ue.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(Tu(s,"start")?Oe.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):ye.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},iN=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=XS(r)}let o=s&&s.nodeAfter;return!o||!ye.isSelectable(o)?!1:(e&&e(t.tr.setSelection(ye.create(t.doc,s.pos)).scrollIntoView()),!0)};function XS(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const xV=(t,e)=>{let n=t.selection,r=n instanceof ye,i;if(r){if(n.node.isTextblock||!Ho(t.doc,n.from))return!1;i=n.from}else if(i=g0(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(ye.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},SV=(t,e)=>{let n=t.selection,r;if(n instanceof ye){if(n.node.isTextblock||!Ho(t.doc,n.to))return!1;r=n.to}else if(r=g0(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},wV=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&qu(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},sN=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
`).scrollIntoView()),!0)};function ZS(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const kV=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=ZS(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,o.createAndFill());l.setSelection(Oe.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},oN=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof mr||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=ZS(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=t.tr.insert(o,s.createAndFill());a.setSelection(we.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},aN=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(ds(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&qu(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function CV(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof ye&&e.selection.node.isBlock)return!r.parentOffset||!ds(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,a,l=!1,d=!1;for(let y=r.depth;;y--)if(r.node(y).isBlock){l=r.end(y)==r.pos+(r.depth-y),d=r.start(y)==r.pos-(r.depth-y),a=ZS(r.node(y-1).contentMatchAt(r.indexAfter(y-1))),s.unshift(l&&a?{type:a}:null),o=y;break}else{if(y==1)return!1;s.unshift(null)}let h=e.tr;(e.selection instanceof we||e.selection instanceof mr)&&h.deleteSelection();let f=h.mapping.map(r.pos),p=ds(h.doc,f,s.length,s);if(p||(s[0]=a?{type:a}:null,p=ds(h.doc,f,s.length,s)),!p)return!1;if(h.split(f,s.length,s),!l&&d&&r.node(o).type!=a){let y=h.mapping.map(r.before(o)),g=h.doc.resolve(y);a&&r.node(o-1).canReplaceWith(g.index(),g.index()+1,a)&&h.setNodeMarkup(h.mapping.map(r.before(o)),a)}return n&&n(h.scrollIntoView()),!0}}const bV=CV(),EV=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(ye.create(t.doc,i))),!0)};function _V(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Ho(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function lN(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,o,a,l=i.type.spec.isolating||s.type.spec.isolating;if(!l&&_V(t,e,n))return!0;let d=!l&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(n){let y=e.pos+s.nodeSize,g=J.empty;for(let C=o.length-1;C>=0;C--)g=J.from(o[C].create(null,g));g=J.from(i.copy(g));let x=t.tr.step(new on(e.pos-1,y,e.pos,y,new ue(g,1,0),o.length,!0)),S=x.doc.resolve(y+2*o.length);S.nodeAfter&&S.nodeAfter.type==i.type&&Ho(x.doc,S.pos)&&x.join(S.pos),n(x.scrollIntoView())}return!0}let h=s.type.spec.isolating||r>0&&l?null:Oe.findFrom(e,1),f=h&&h.$from.blockRange(h.$to),p=f&&qu(f);if(p!=null&&p>=e.depth)return n&&n(t.tr.lift(f,p).scrollIntoView()),!0;if(d&&Tu(s,"start",!0)&&Tu(i,"end")){let y=i,g=[];for(;g.push(y),!y.isTextblock;)y=y.lastChild;let x=s,S=1;for(;!x.isTextblock;x=x.firstChild)S++;if(y.canReplace(y.childCount,y.childCount,x.content)){if(n){let C=J.empty;for(let w=g.length-1;w>=0;w--)C=J.from(g[w].copy(C));let E=t.tr.step(new on(e.pos-g.length,e.pos+s.nodeSize,e.pos+S,e.pos+s.nodeSize-S,new ue(C,g.length,0),0,!0));n(E.scrollIntoView())}return!0}}return!1}function uN(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(we.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const NV=uN(-1),TV=uN(1);function MV(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),a=o&&qS(o,t,e);return a?(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0):!1}}function FC(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=n.selection.ranges[s];n.doc.nodesBetween(o,a,(l,d)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)i=!0;else{let h=n.doc.resolve(d),f=h.index();i=h.parent.canReplaceWith(f,f+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[o];s.setBlockType(a,l,t,e)}r(s.scrollIntoView())}return!0}}function ew(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}ew(YS,Z9,tN);ew(YS,rN,iN);ew(sN,oN,aN,bV);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function PV(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s);if(!o)return!1;let a=r?n.tr:null;return OV(a,o,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function OV(t,e,n,r=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);s=new um(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new um(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=qS(s,n,r,e);return a?(t&&AV(t,e,a,i,n),!0):!1}function AV(t,e,n,r,i){let s=J.empty;for(let h=n.length-1;h>=0;h--)s=J.from(n[h].type.create(n[h].attrs,s));t.step(new on(e.start-(r?2:0),e.end,e.start,e.end,new ue(s,0,0),n.length,!0));let o=0;for(let h=0;h<n.length;h++)n[h].type==i&&(o=h+1);let a=n.length-o,l=e.start+n.length-(r?2:0),d=e.parent;for(let h=e.startIndex,f=e.endIndex,p=!0;h<f;h++,p=!1)!p&&ds(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=d.child(h).nodeSize;return t}function RV(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?LV(e,n,t,s):IV(e,n,s):!0:!1}}function LV(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new on(s-1,o,s,o,new ue(J.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new um(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const a=qu(r);if(a==null)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(s,-1)-1);return Ho(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function IV(t,e,n){let r=t.tr,i=n.parent;for(let y=n.end,g=n.endIndex-1,x=n.startIndex;g>x;g--)y-=i.child(g).nodeSize,r.delete(y-1,y+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==i.childCount,d=s.node(-1),h=s.index(-1);if(!d.canReplace(h+(a?0:1),h+1,o.content.append(l?J.empty:J.from(i))))return!1;let f=s.pos,p=f+o.nodeSize;return r.step(new on(f-(a?1:0),p+(l?1:0),f+1,p-1,new ue((a?J.empty:J.from(i.copy(J.empty))).append(l?J.empty:J.from(i.copy(J.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function DV(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,d=>d.childCount>0&&d.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=t)return!1;if(n){let d=l.lastChild&&l.lastChild.type==a.type,h=J.from(d?t.create():null),f=new ue(J.from(t.create(null,J.from(a.type.create(null,h)))),d?3:1,0),p=s.start,y=s.end;n(e.tr.step(new on(p-(d?3:1),y,p,y,f,1,!0)).scrollIntoView())}return!0}}const hn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Mu=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Wv=null;const Zi=function(t,e,n){let r=Wv||(Wv=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},FV=function(){Wv=null},Wa=function(t,e,n,r){return n&&(jC(t,e,n,r,-1)||jC(t,e,n,r,1))},jV=/^(img|br|input|textarea|hr)$/i;function jC(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Fr(t))){let o=t.parentNode;if(!o||o.nodeType!=1||xh(t)||jV.test(t.nodeName)||t.contentEditable=="false")return!1;e=hn(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?Fr(t):0}else return!1}}function Fr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function zV(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Fr(t)}else if(t.parentNode&&!xh(t))e=hn(t),t=t.parentNode;else return null}}function BV(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!xh(t))e=hn(t)+1,t=t.parentNode;else return null}}function UV(t,e,n){for(let r=e==0,i=e==Fr(t);r||i;){if(t==n)return!0;let s=hn(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Fr(t)}}function xh(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const x0=function(t){return t.focusNode&&Wa(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function aa(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function HV(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function VV(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Fr(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Fr(r.startContainer),r.startOffset)}}}const Li=typeof navigator<"u"?navigator:null,zC=typeof document<"u"?document:null,Vo=Li&&Li.userAgent||"",Kv=/Edge\/(\d+)/.exec(Vo),cN=/MSIE \d/.exec(Vo),qv=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Vo),or=!!(cN||qv||Kv),bo=cN?document.documentMode:qv?+qv[1]:Kv?+Kv[1]:0,Br=!or&&/gecko\/(\d+)/i.test(Vo);Br&&+(/Firefox\/(\d+)/.exec(Vo)||[0,0])[1];const Qv=!or&&/Chrome\/(\d+)/.exec(Vo),pn=!!Qv,dN=Qv?+Qv[1]:0,Pn=!or&&!!Li&&/Apple Computer/.test(Li.vendor),Pu=Pn&&(/Mobile\/\w+/.test(Vo)||!!Li&&Li.maxTouchPoints>2),Lr=Pu||(Li?/Mac/.test(Li.platform):!1),hN=Li?/Win/.test(Li.platform):!1,ls=/Android \d/.test(Vo),Sh=!!zC&&"webkitFontSmoothing"in zC.documentElement.style,GV=Sh?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function $V(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Wi(t,e){return typeof t=="number"?t:t[e]}function WV(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function BC(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=Mu(o);continue}let a=o,l=a==s.body,d=l?$V(s):WV(a),h=0,f=0;if(e.top<d.top+Wi(r,"top")?f=-(d.top-e.top+Wi(i,"top")):e.bottom>d.bottom-Wi(r,"bottom")&&(f=e.bottom-e.top>d.bottom-d.top?e.top+Wi(i,"top")-d.top:e.bottom-d.bottom+Wi(i,"bottom")),e.left<d.left+Wi(r,"left")?h=-(d.left-e.left+Wi(i,"left")):e.right>d.right-Wi(r,"right")&&(h=e.right-d.right+Wi(i,"right")),h||f)if(l)s.defaultView.scrollBy(h,f);else{let y=a.scrollLeft,g=a.scrollTop;f&&(a.scrollTop+=f),h&&(a.scrollLeft+=h);let x=a.scrollLeft-y,S=a.scrollTop-g;e={left:e.left-x,top:e.top-S,right:e.right-x,bottom:e.bottom-S}}let p=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(p))break;o=p=="absolute"?o.offsetParent:Mu(o)}}function KV(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=t.root.elementFromPoint(s,o);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:fN(t.dom)}}function fN(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Mu(r));return e}function qV({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;pN(n,r==0?0:r-e)}function pN(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Tl=null;function QV(t){if(t.setActive)return t.setActive();if(Tl)return t.focus(Tl);let e=fN(t);t.focus(Tl==null?{get preventScroll(){return Tl={preventScroll:!0},!0}}:void 0),Tl||(Tl=!1,pN(e,0))}function mN(t,e){let n,r=2e8,i,s=0,o=e.top,a=e.top,l,d;for(let h=t.firstChild,f=0;h;h=h.nextSibling,f++){let p;if(h.nodeType==1)p=h.getClientRects();else if(h.nodeType==3)p=Zi(h).getClientRects();else continue;for(let y=0;y<p.length;y++){let g=p[y];if(g.top<=o&&g.bottom>=a){o=Math.max(g.bottom,o),a=Math.min(g.top,a);let x=g.left>e.left?g.left-e.left:g.right<e.left?e.left-g.right:0;if(x<r){n=h,r=x,i=x&&n.nodeType==3?{left:g.right<e.left?g.right:g.left,top:e.top}:e,h.nodeType==1&&x&&(s=f+(e.left>=(g.left+g.right)/2?1:0));continue}}else g.top>e.top&&!l&&g.left<=e.left&&g.right>=e.left&&(l=h,d={left:Math.max(g.left,Math.min(g.right,e.left)),top:g.top});!n&&(e.left>=g.right&&e.top>=g.top||e.left>=g.left&&e.top>=g.bottom)&&(s=f+1)}}return!n&&l&&(n=l,i=d,r=0),n&&n.nodeType==3?YV(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:mN(n,i)}function YV(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let o=Hs(r,1);if(o.top!=o.bottom&&tw(e,o)){i={node:t,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function tw(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function JV(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function XV(t,e,n){let{node:r,offset:i}=mN(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function ZV(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let a=t.docView.nearestDesc(s,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&l.left>r.left||l.top>r.top?i=a.posBefore:(!o&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<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;s=a.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function gN(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let o=t.childNodes[s];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let d=a[l];if(tw(e,d))return gN(o,e,d)}}if((s=(s+1)%r)==i)break}return t}function eG(t,e){let n=t.dom.ownerDocument,r,i=0,s=VV(n,e.left,e.top);s&&({node:r,offset:i}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let d=t.dom.getBoundingClientRect();if(!tw(e,d)||(o=gN(t.dom,e,d),!o))return null}if(Pn)for(let d=o;r&&d;d=Mu(d))d.draggable&&(r=void 0);if(o=JV(o,e),r){if(Br&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let h=r.childNodes[i],f;h.nodeName=="IMG"&&(f=h.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}let d;Sh&&i&&r.nodeType==1&&(d=r.childNodes[i-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=ZV(t,r,i,e))}a==null&&(a=XV(t,o,e));let l=t.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function UC(t){return t.top<t.bottom||t.left<t.right}function Hs(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(UC(r))return r}return Array.prototype.find.call(n,UC)||t.getBoundingClientRect()}const tG=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function yN(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=Sh||Br;if(r.nodeType==3)if(o&&(tG.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let l=Hs(Zi(r,i,i),n);if(Br&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let d=Hs(Zi(r,i-1,i-1),-1);if(d.top==l.top){let h=Hs(Zi(r,i,i+1),-1);if(h.top!=l.top)return Mc(h,h.left<d.left)}}return l}else{let l=i,d=i,h=n<0?1:-1;return n<0&&!i?(d++,h=-1):n>=0&&i==r.nodeValue.length?(l--,h=1):n<0?l--:d++,Mc(Hs(Zi(r,l,d),h),h<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==Fr(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return Wy(l.getBoundingClientRect(),!1)}if(s==null&&i<Fr(r)){let l=r.childNodes[i];if(l.nodeType==1)return Wy(l.getBoundingClientRect(),!0)}return Wy(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==Fr(r))){let l=r.childNodes[i-1],d=l.nodeType==3?Zi(l,Fr(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(d)return Mc(Hs(d,1),!1)}if(s==null&&i<Fr(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let d=l?l.nodeType==3?Zi(l,0,o?0:1):l.nodeType==1?l:null:null;if(d)return Mc(Hs(d,-1),!0)}return Mc(Hs(r.nodeType==3?Zi(r):r,-n),n>=0)}function Mc(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Wy(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function vN(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function nG(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return vN(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=yN(t,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Zi(a,0,a.nodeValue.length).getClientRects();else continue;for(let d=0;d<l.length;d++){let h=l[d];if(h.bottom>h.top+1&&(n=="up"?o.top-h.top>(h.bottom-o.top)*2:h.bottom-o.bottom>(o.bottom-h.top)*2))return!1}}return!0})}const rG=/[\u0590-\u08ac]/;function iG(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=t.domSelection();return a?!rG.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?s:o:vN(t,e,()=>{let{focusNode:l,focusOffset:d,anchorNode:h,anchorOffset:f}=t.domSelectionRange(),p=a.caretBidiLevel;a.modify("move",n,"character");let y=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:g,focusOffset:x}=t.domSelectionRange(),S=g&&!y.contains(g.nodeType==1?g:g.parentNode)||l==g&&d==x;try{a.collapse(h,f),l&&(l!=h||d!=f)&&a.extend&&a.extend(l,d)}catch{}return p!=null&&(a.caretBidiLevel=p),S}):r.pos==r.start()||r.pos==r.end()}let HC=null,VC=null,GC=!1;function sG(t,e,n){return HC==e&&VC==n?GC:(HC=e,VC=n,GC=n=="up"||n=="down"?nG(t,e,n):iG(t,e,n))}const Ur=0,$C=1,fa=2,Ii=3;class wh{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Ur,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>hn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!n||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let a=i.children[o];if(a.size){i=a;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],a=s+o.size;if(a>e||o instanceof SN){i=e-s;break}s=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof xN&&s.side>=0;r--);if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?hn(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?hn(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,a=0;;a++){let l=this.children[a],d=o+l.size;if(i==-1&&e<=d){let h=o+l.border;if(e>=h&&n<=d-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,h);e=o;for(let f=a;f>0;f--){let p=this.children[f-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){i=hn(p.dom)+1;break}e-=p.size}i==-1&&(i=0)}if(i>-1&&(d>n||a==this.children.length-1)){n=d;for(let h=a+1;h<this.children.length;h++){let f=this.children[h];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){s=hn(f.dom);break}n+=f.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=d}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),o=Math.max(e,n);for(let y=0,g=0;y<this.children.length;y++){let x=this.children[y],S=g+x.size;if(s>g&&o<S)return x.setSelection(e-g-x.border,n-g-x.border,r,i);g=S}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),d=r.root.getSelection(),h=r.domSelectionRange(),f=!1;if((Br||Pn)&&e==n){let{node:y,offset:g}=a;if(y.nodeType==3){if(f=!!(g&&y.nodeValue[g-1]==`
`),f&&g==y.nodeValue.length)for(let x=y,S;x;x=x.parentNode){if(S=x.nextSibling){S.nodeName=="BR"&&(a=l={node:S.parentNode,offset:hn(S)+1});break}let C=x.pmViewDesc;if(C&&C.node&&C.node.isBlock)break}}else{let x=y.childNodes[g-1];f=x&&(x.nodeName=="BR"||x.contentEditable=="false")}}if(Br&&h.focusNode&&h.focusNode!=l.node&&h.focusNode.nodeType==1){let y=h.focusNode.childNodes[h.focusOffset];y&&y.contentEditable=="false"&&(i=!0)}if(!(i||f&&Pn)&&Wa(a.node,a.offset,h.anchorNode,h.anchorOffset)&&Wa(l.node,l.offset,h.focusNode,h.focusOffset))return;let p=!1;if((d.extend||e==n)&&!(f&&Br)){d.collapse(a.node,a.offset);try{e!=n&&d.extend(l.node,l.offset),p=!0}catch{}}if(!p){if(e>n){let g=a;a=l,l=g}let y=document.createRange();y.setEnd(l.node,l.offset),y.setStart(a.node,a.offset),d.removeAllRanges(),d.addRange(y)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let a=r+s.border,l=o-s.border;if(e>=a&&n<=l){this.dirty=e==r||n==o?fa:$C,e==a&&n==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Ii:s.markDirty(e-a,n-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?fa:Ii}r=o}this.dirty=fa}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?fa:$C;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class xN extends wh{constructor(e,n,r,i){let s,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==Ur&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class oG extends wh{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Ka extends wh{constructor(e,n,r,i,s){super(e,[],r,i),this.mark=n,this.spec=s}static create(e,n,r,i){let s=i.nodeViews[n.type.name],o=s&&s(n,i,r);return(!o||!o.dom)&&(o=ol.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Ka(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Ii||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ii&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Ur){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Ur}}slice(e,n,r){let i=Ka.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=Jv(s,n,o,r)),e>0&&(s=Jv(s,0,e,r));for(let a=0;a<s.length;a++)s[a].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Eo extends wh{constructor(e,n,r,i,s,o,a,l,d){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,n,r,i,s,o){let a=s.nodeViews[n.type.name],l,d=a&&a(n,s,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,i),h=d&&d.dom,f=d&&d.contentDOM;if(n.isText){if(!h)h=document.createTextNode(n.text);else if(h.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else h||({dom:h,contentDOM:f}=ol.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!f&&!n.isText&&h.nodeName!="BR"&&(h.hasAttribute("contenteditable")||(h.contentEditable="false"),n.type.spec.draggable&&(h.draggable=!0));let p=h;return h=CN(h,r,n),d?l=new aG(e,n,r,i,h,f||null,p,d,s,o+1):n.isText?new S0(e,n,r,i,h,p,s):new Eo(e,n,r,i,h,f||null,p,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>J.empty)}return e}matchesNode(e,n,r){return this.dirty==Ur&&e.eq(this.node)&&dm(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new uG(this,o&&o.node,e);hG(this.node,this.innerDeco,(d,h,f)=>{d.spec.marks?l.syncToMarks(d.spec.marks,r,e,h):d.type.side>=0&&!f&&l.syncToMarks(h==this.node.childCount?Xe.none:this.node.child(h).marks,r,e,h),l.placeWidget(d,e,i)},(d,h,f,p)=>{l.syncToMarks(d.marks,r,e,p);let y;l.findNodeMatch(d,h,f,p)||a&&e.state.selection.from>i&&e.state.selection.to<i+d.nodeSize&&(y=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(d,h,f,y,e)||l.updateNextNode(d,h,f,e,p,i)||l.addNode(d,h,f,e,i),i+=d.nodeSize}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==fa)&&(o&&this.protectLocalComposition(e,o),wN(this.contentDOM,this.children,e),Pu&&fG(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof we)||r<n||i>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,a=pG(this.node.content,o,r-n,i-n);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new oG(this,s,n,i);e.input.compositionNodes.push(o),this.children=Jv(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==Ii||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Ur}updateOuterDeco(e){if(dm(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=kN(this.dom,this.nodeDOM,Yv(this.outerDeco,this.node,n),Yv(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function WC(t,e,n,r,i){CN(r,e,t);let s=new Eo(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class S0 extends Eo{constructor(e,n,r,i,s,o,a){super(e,n,r,i,s,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==Ii||this.dirty!=Ur&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Ur||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Ur,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new S0(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Ii)}get domAtom(){return!1}isText(e){return this.node.text==e}}class SN extends wh{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Ur&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class aG extends Eo{constructor(e,n,r,i,s,o,a,l,d,h){super(e,n,r,i,s,o,a,d,h),this.spec=l}update(e,n,r,i){if(this.dirty==Ii)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function wN(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],a=o.dom;if(a.parentNode==t){for(;a!=r;)r=KC(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(a,r);if(o instanceof Ka){let l=r?r.previousSibling:t.lastChild;wN(o.contentDOM,o.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=KC(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const sd=function(t){t&&(this.nodeName=t)};sd.prototype=Object.create(null);const pa=[new sd];function Yv(t,e,n){if(t.length==0)return pa;let r=n?pa[0]:new sd,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new sd(o.nodeName));for(let a in o){let l=o[a];l!=null&&(n&&i.length==1&&i.push(r=new sd(e.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 i}function kN(t,e,n,r){if(n==pa&&r==pa)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],a=n[s];if(s){let l;a&&a.nodeName==o.nodeName&&i!=t&&(l=i.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=pa[0]),i=l}lG(i,a||pa[0],o)}return i}function lG(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&t.classList.add(i[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function CN(t,e,n){return kN(t,t,pa,Yv(e,n,t.nodeType!=1))}function dm(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function KC(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class uG{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=cG(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,i){let s=0,o=this.stack.length>>1,a=Math.min(o,e.length);for(;s<a&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=Ur,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let l=-1,d=this.top.children.length;i<this.preMatch.index&&(d=Math.min(this.index+3,d));for(let h=this.index;h<d;h++){let f=this.top.children[h];if(f.matchesMark(e[o])&&!this.isLocked(f.dom)){l=h;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let h=Ka.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,h),this.top=h,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let d=this.top.children[a];if(d.matchesNode(e,n,r)&&!this.preMatch.matched.has(d)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let o=this.top.children[i];return o.dirty==Ii&&o.dom==o.contentDOM&&(o.dirty=fa),o.update(e,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Eo){let d=this.preMatch.matched.get(l);if(d!=null&&d!=s)return!1;let h=l.dom,f,p=this.isLocked(h)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Ii&&dm(n,l.outerDeco));if(!p&&l.update(e,n,r,i))return this.destroyBetween(this.index,a),l.dom!=h&&(this.changed=!0),this.index++,!0;if(!p&&(f=this.recreateWrapper(l,e,n,r,i,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=fa,f.updateChildren(i,o+1),f.dirty=Ur),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!dm(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=Eo.create(this.top,n,r,i,s,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,i,s){let o=Eo.create(this.top,e,n,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new xN(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Ka;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof S0)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Pn||pn)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new SN(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function cG(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(r){let d=n.children[r-1];if(d instanceof Ka)n=d,r=d.children.length;else{a=d,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function dG(t,e){return t.type.side-e.type.side}function hG(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let d=0;d<t.childCount;d++){let h=t.child(d);r(h,i,e.forChild(s,h),d),s+=h.nodeSize}return}let o=0,a=[],l=null;for(let d=0;;){let h,f;for(;o<i.length&&i[o].to==s;){let S=i[o++];S.widget&&(h?(f||(f=[h])).push(S):h=S)}if(h)if(f){f.sort(dG);for(let S=0;S<f.length;S++)n(f[S],d,!!l)}else n(h,d,!!l);let p,y;if(l)y=-1,p=l,l=null;else if(d<t.childCount)y=d,p=t.child(d++);else break;for(let S=0;S<a.length;S++)a[S].to<=s&&a.splice(S--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let g=s+p.nodeSize;if(p.isText){let S=g;o<i.length&&i[o].from<S&&(S=i[o].from);for(let C=0;C<a.length;C++)a[C].to<S&&(S=a[C].to);S<g&&(l=p.cut(S-s),p=p.cut(0,S-s),g=S,y=-1)}else for(;o<i.length&&i[o].to<g;)o++;let x=p.isInline&&!p.isLeaf?a.filter(S=>!S.inline):a.slice();r(p,x,e.forChild(s,p),y),s=g}}function fG(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function pG(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<t.childCount;){let d=t.child(i++);if(s+=d.nodeSize,!d.isText)break;l+=d.text}if(s>=n){if(s>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let d=a<r?l.lastIndexOf(e,r-a-1):-1;if(d>=0&&d+e.length+a>=n)return a+d;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function Jv(t,e,n,r,i){let s=[];for(let o=0,a=0;o<t.length;o++){let l=t[o],d=a,h=a+=l.size;d>=n||h<=e?s.push(l):(d<e&&s.push(l.slice(0,e-d,r)),i&&(s.push(i),i=void 0),h>n&&s.push(l.slice(n-d,l.size,r)))}return s}function nw(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,d;if(x0(n)){for(l=o;i&&!i.node;)i=i.parent;let f=i.node;if(i&&f.isAtom&&ye.isSelectable(f)&&i.parent&&!(f.isInline&&UV(n.focusNode,n.focusOffset,i.dom))){let p=i.posBefore;d=new ye(o==p?a:r.resolve(p))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let f=o,p=o;for(let y=0;y<n.rangeCount;y++){let g=n.getRangeAt(y);f=Math.min(f,t.docView.posFromDOM(g.startContainer,g.startOffset,1)),p=Math.max(p,t.docView.posFromDOM(g.endContainer,g.endOffset,-1))}if(f<0)return null;[l,o]=p==t.state.selection.anchor?[p,f]:[f,p],a=r.resolve(o)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let h=r.resolve(l);if(!d){let f=e=="pointer"||t.state.selection.head<a.pos&&!s?1:-1;d=rw(t,h,a,f)}return d}function bN(t){return t.editable?t.hasFocus():_N(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function hs(t,e=!1){let n=t.state.selection;if(EN(t,n),!!bN(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&pn){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Wa(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)gG(t);else{let{anchor:r,head:i}=n,s,o;qC&&!(n instanceof we)&&(n.$from.parent.inlineContent||(s=QC(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=QC(t,n.to))),t.docView.setSelection(r,i,t,e),qC&&(s&&YC(s),o&&YC(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&mG(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const qC=Pn||pn&&dN<63;function QC(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(Pn&&i&&i.contentEditable=="false")return Ky(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Ky(i);if(s)return Ky(s)}}function Ky(t){return t.contentEditable="true",Pn&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function YC(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function mG(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!bN(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function gG(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,hn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&or&&bo<=11&&(n.disabled=!0,n.disabled=!1)}function EN(t,e){if(e instanceof ye){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(JC(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else JC(t)}function JC(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function rw(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||we.between(e,n,r)}function XC(t){return t.editable&&!t.hasFocus()?!1:_N(t)}function _N(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function yG(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Wa(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Xv(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Oe.findFrom(s,e)}function $s(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function ZC(t,e,n){let r=t.state.selection;if(r instanceof we)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return $s(t,new we(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Xv(t.state,e);return i&&i instanceof ye?$s(t,i):!1}else if(!(Lr&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(a))&&!o.contentDOM?ye.isSelectable(s)?$s(t,new ye(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):Sh?$s(t,new we(t.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof ye&&r.node.isInline)return $s(t,new we(e>0?r.$to:r.$from));{let i=Xv(t.state,e);return i?$s(t,i):!1}}}function hm(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function od(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Ml(t,e){return e<0?vG(t):xG(t)}function vG(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(Br&&n.nodeType==1&&r<hm(n)&&od(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(od(a,-1))i=n,s=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(NN(n))break;{let a=n.previousSibling;for(;a&&od(a,-1);)i=n.parentNode,s=hn(a),a=a.previousSibling;if(a)n=a,r=hm(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Zv(t,n,r):i&&Zv(t,i,s)}function xG(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=hm(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let a=n.childNodes[r];if(od(a,1))s=n,o=++r;else break}else{if(NN(n))break;{let a=n.nextSibling;for(;a&&od(a,1);)s=a.parentNode,o=hn(a)+1,a=a.nextSibling;if(a)n=a,r=0,i=hm(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&Zv(t,s,o)}function NN(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function SG(t,e){for(;t&&e==t.childNodes.length&&!xh(t);)e=hn(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function wG(t,e){for(;t&&!e&&!xh(t);)e=hn(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Zv(t,e,n){if(e.nodeType!=3){let s,o;(o=SG(e,n))?(e=o,n=0):(s=wG(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(x0(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&hs(t)},50)}function eb(t,e){let n=t.state.doc.resolve(e);if(!(pn||hN)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function tb(t,e,n){let r=t.state.selection;if(r instanceof we&&!r.empty||n.indexOf("s")>-1||Lr&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Xv(t.state,e);if(o&&o instanceof ye)return $s(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=r instanceof mr?Oe.near(o,e):Oe.findFrom(o,e);return a?$s(t,a):!1}return!1}function nb(t,e){if(!(t.state.selection instanceof we))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function rb(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function kG(t){if(!Pn||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;rb(t,r,"true"),setTimeout(()=>rb(t,r,"false"),20)}return!1}function CG(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function bG(t,e){let n=e.keyCode,r=CG(e);if(n==8||Lr&&n==72&&r=="c")return nb(t,-1)||Ml(t,-1);if(n==46&&!e.shiftKey||Lr&&n==68&&r=="c")return nb(t,1)||Ml(t,1);if(n==13||n==27)return!0;if(n==37||Lr&&n==66&&r=="c"){let i=n==37?eb(t,t.state.selection.from)=="ltr"?-1:1:-1;return ZC(t,i,r)||Ml(t,i)}else if(n==39||Lr&&n==70&&r=="c"){let i=n==39?eb(t,t.state.selection.from)=="ltr"?1:-1:1;return ZC(t,i,r)||Ml(t,i)}else{if(n==38||Lr&&n==80&&r=="c")return tb(t,-1,r)||Ml(t,-1);if(n==40||Lr&&n==78&&r=="c")return kG(t)||tb(t,1,r)||Ml(t,1);if(r==(Lr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function iw(t,e){t.someProp("transformCopied",y=>{e=y(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let y=r.firstChild;n.push(y.type.name,y.attrs!=y.type.defaultAttrs?y.attrs:null),r=y.content}let o=t.someProp("clipboardSerializer")||ol.fromSchema(t.state.schema),a=RN(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let d=l.firstChild,h,f=0;for(;d&&d.nodeType==1&&(h=AN[d.nodeName.toLowerCase()]);){for(let y=h.length-1;y>=0;y--){let g=a.createElement(h[y]);for(;l.firstChild;)g.appendChild(l.firstChild);l.appendChild(g),f++}d=l.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${i} ${s}${f?` -${f}`:""} ${JSON.stringify(n)}`);let p=t.someProp("clipboardTextSerializer",y=>y(e,t))||e.content.textBetween(0,e.content.size,`
`);return{dom:l,text:p,slice:e}}function TN(t,e,n,r,i){let s=i.parent.type.spec.code,o,a;if(!n&&!e)return null;let l=!!e&&(r||s||!n);if(l){if(t.someProp("transformPastedText",p=>{e=p(e,s||r,t)}),s)return a=new ue(J.from(t.state.schema.text(e.replace(/\r\n?/g,`
`))),0,0),t.someProp("transformPasted",p=>{a=p(a,t,!0)}),a;let f=t.someProp("clipboardTextParser",p=>p(e,i,r,t));if(f)a=f;else{let p=i.marks(),{schema:y}=t.state,g=ol.fromSchema(y);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(x=>{let S=o.appendChild(document.createElement("p"));x&&S.appendChild(g.serializeNode(y.text(x,p)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),o=TG(n),Sh&&MG(o);let d=o&&o.querySelector("[data-pm-slice]"),h=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let f=+h[3];f>0;f--){let p=o.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;o=p}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||Co.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||h),context:i,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!EG.test(p.parentNode.nodeName)?{ignore:!0}:null}})),h)a=PG(ib(a,+h[1],+h[2]),h[4]);else if(a=ue.maxOpen(_G(a.content,i),!0),a.openStart||a.openEnd){let f=0,p=0;for(let y=a.content.firstChild;f<a.openStart&&!y.type.spec.isolating;f++,y=y.firstChild);for(let y=a.content.lastChild;p<a.openEnd&&!y.type.spec.isolating;p++,y=y.lastChild);a=ib(a,f,p)}return t.someProp("transformPasted",f=>{a=f(a,t,l)}),a}const EG=/^(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 _G(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),d;if(!l)return o=null;if(d=o.length&&s.length&&PN(l,s,a,o[o.length-1],0))o[o.length-1]=d;else{o.length&&(o[o.length-1]=ON(o[o.length-1],s.length));let h=MN(a,l);o.push(h),i=i.matchType(h.type),s=l}}),o)return J.from(o)}return t}function MN(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,J.from(t));return t}function PN(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=PN(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(J.from(MN(n,t,i+1))))}}function ON(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,ON(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(J.empty,!0);return t.copy(n.append(r))}function ex(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,a=o.content;return t.childCount>1&&(s=0),i<r-1&&(a=ex(a,e,n,r,i+1,s)),i>=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(J.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function ib(t,e,n){return e<t.openStart&&(t=new ue(ex(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new ue(ex(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const AN={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 sb=null;function RN(){return sb||(sb=document.implementation.createHTMLDocument("title"))}let qy=null;function NG(t){let e=window.trustedTypes;return e?(qy||(qy=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),qy.createHTML(t)):t}function TG(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=RN().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&AN[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=NG(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function MG(t){let e=t.querySelectorAll(pn?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function PG(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=J.from(l.create(r[a+1],i)),s++,o++}return new ue(i,s,o)}const zn={},Bn={},OG={touchstart:!0,touchmove:!0};class AG{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function RG(t){for(let e in zn){let n=zn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{IG(t,r)&&!sw(t,r)&&(t.editable||!(r.type in Bn))&&n(t,r)},OG[e]?{passive:!0}:void 0)}Pn&&t.dom.addEventListener("input",()=>null),tx(t)}function fo(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function LG(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function tx(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>sw(t,r))})}function sw(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function IG(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function DG(t,e){!sw(t,e)&&zn[e.type]&&(t.editable||!(e.type in Bn))&&zn[e.type](t,e)}Bn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!IN(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(ls&&pn&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Pu&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,aa(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||bG(t,n)?n.preventDefault():fo(t,"key")};Bn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Bn.keypress=(t,e)=>{let n=e;if(IN(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Lr&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof we)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function w0(t){return{left:t.clientX,top:t.clientY}}function FG(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function ow(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,a=>o>s.depth?a(t,n,s.nodeAfter,s.before(o),i,!0):a(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function nu(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function jG(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&ye.isSelectable(r)?(nu(t,new ye(n)),!0):!1}function zG(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof ye&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(ye.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(nu(t,ye.create(t.state.doc,i)),!0):!1}function BG(t,e,n,r,i){return ow(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?zG(t,n):jG(t,n))}function UG(t,e,n,r){return ow(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function HG(t,e,n,r){return ow(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||VG(t,n,r)}function VG(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(nu(t,we.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)nu(t,we.create(r,a+1,a+1+o.content.size));else if(ye.isSelectable(o))nu(t,ye.create(r,a));else continue;return!0}}function aw(t){return fm(t)}const LN=Lr?"metaKey":"ctrlKey";zn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=aw(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&FG(n,t.input.lastClick)&&!n[LN]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let o=t.posAtCoords(w0(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new GG(t,o,n,!!r)):(s=="doubleClick"?UG:HG)(t,o.pos,o.inside,n)?n.preventDefault():fo(t,"pointer"))};class GG{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[LN],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let h=e.state.doc.resolve(n.pos);s=h.parent,o=h.depth?h.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:d}=e.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||d instanceof ye&&d.from<=o&&d.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Br&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),fo(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>hs(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(w0(e))),this.updateAllowDefault(e),this.allowDefault||!n?fo(this.view,"pointer"):BG(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Pn&&this.mightDrag&&!this.mightDrag.node.isAtom||pn&&!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)?(nu(this.view,Oe.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):fo(this.view,"pointer")}move(e){this.updateAllowDefault(e),fo(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}zn.touchstart=t=>{t.input.lastTouch=Date.now(),aw(t),fo(t,"pointer")};zn.touchmove=t=>{t.input.lastTouch=Date.now(),fo(t,"pointer")};zn.contextmenu=t=>aw(t);function IN(t,e){return t.composing?!0:Pn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const $G=ls?5e3:-1;Bn.compositionstart=Bn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof we&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||pn&&hN&&WG(t)))t.markCursor=t.state.storedMarks||n.marks(),fm(t,!0),t.markCursor=null;else if(fm(t,!e.selection.empty),Br&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let a=t.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}DN(t,$G)};function WG(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Bn.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,DN(t,20))};function DN(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>fm(t),e))}function FN(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=qG());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function KG(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=zV(e.focusNode,e.focusOffset),r=BV(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function qG(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function fm(t,e=!1){if(!(ls&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),FN(t),e||t.docView&&t.docView.dirty){let n=nw(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function QG(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Gd=or&&bo<15||Pu&&GV<604;zn.copy=Bn.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=Gd?null:n.clipboardData,o=r.content(),{dom:a,text:l}=iw(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):QG(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function YG(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function JG(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?$d(t,r.value,null,i,e):$d(t,r.textContent,r.innerHTML,i,e)},50)}function $d(t,e,n,r,i){let s=TN(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,s||ue.empty)))return!0;if(!s)return!1;let o=YG(s),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function jN(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Bn.paste=(t,e)=>{let n=e;if(t.composing&&!ls)return;let r=Gd?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&$d(t,jN(r),r.getData("text/html"),i,n)?n.preventDefault():JG(t,n)};class zN{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const XG=Lr?"altKey":"ctrlKey";function BN(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[XG]}zn.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(w0(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof ye?i.to-1:i.to))){if(r&&r.mightDrag)o=ye.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(o=ye.create(t.state.doc,f.posBefore))}}let a=(o||t.state.selection).content(),{dom:l,text:d,slice:h}=iw(t,a);(!n.dataTransfer.files.length||!pn||dN>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Gd?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Gd||n.dataTransfer.setData("text/plain",d),t.dragging=new zN(h,BN(t,n),o)};zn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Bn.dragover=Bn.dragenter=(t,e)=>e.preventDefault();Bn.drop=(t,e)=>{try{ZG(t,e,t.dragging)}finally{t.dragging=null}};function ZG(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(w0(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",y=>{s=y(s,t,!1)}):s=TN(t,jN(e.dataTransfer),Gd?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&BN(t,e));if(t.someProp("handleDrop",y=>y(t,e,s||ue.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let a=s?G9(t.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let l=t.state.tr;if(o){let{node:y}=n;y?y.replace(l):l.deleteSelection()}let d=l.mapping.map(a),h=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,f=l.doc;if(h?l.replaceRangeWith(d,d,s.content.firstChild):l.replaceRange(d,d,s),l.doc.eq(f))return;let p=l.doc.resolve(d);if(h&&ye.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))l.setSelection(new ye(p));else{let y=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((g,x,S,C)=>y=C),l.setSelection(rw(t,p,l.doc.resolve(y)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}zn.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&hs(t)},20))};zn.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};zn.beforeinput=(t,e)=>{if(pn&&ls&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,aa(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Bn)zn[t]=Bn[t];function Wd(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class pm{constructor(e,n){this.toDOM=e,this.spec=n||Aa,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new Fn(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof pm&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Wd(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class _o{constructor(e,n){this.attrs=e,this.spec=n||Aa}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new Fn(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof _o&&Wd(this.attrs,e.attrs)&&Wd(this.spec,e.spec)}static is(e){return e.type instanceof _o}destroy(){}}class lw{constructor(e,n){this.attrs=e,this.spec=n||Aa}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new Fn(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof lw&&Wd(this.attrs,e.attrs)&&Wd(this.spec,e.spec)}destroy(){}}class Fn{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Fn(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Fn(e,e,new pm(n,r))}static inline(e,n,r,i){return new Fn(e,n,new _o(r,i))}static node(e,n,r,i){return new Fn(e,n,new lw(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof _o}get widget(){return this.type instanceof pm}}const Rl=[],Aa={};class wt{constructor(e,n){this.local=e.length?e:Rl,this.children=n.length?n:Rl}static create(e,n){return n.length?mm(n,e,0,Aa):_n}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=n&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,i+a,s)}}map(e,n,r){return this==_n||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Aa)}mapInner(e,n,r,i,s){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(n,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?e$(this.children,o||[],e,n,r,i,s):o?new wt(o.sort(Ra),Rl):_n}add(e,n){return n.length?this==_n?wt.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((a,l)=>{let d=l+r,h;if(h=HN(n,a,d)){for(i||(i=this.children.slice());s<i.length&&i[s]<l;)s+=3;i[s]==l?i[s+2]=i[s+2].addInner(a,h,d+1):i.splice(s,0,l,l+a.nodeSize,mm(h,a,d+1,Aa)),s+=3}});let o=UN(s?VN(n):n,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new wt(o.length?this.local.concat(o).sort(Ra):this.local,i||this.children)}remove(e){return e.length==0||this==_n?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,a=r[s]+n,l=r[s+1]+n;for(let h=0,f;h<e.length;h++)(f=e[h])&&f.from>a&&f.to<l&&(e[h]=null,(o||(o=[])).push(f));if(!o)continue;r==this.children&&(r=this.children.slice());let d=r[s+2].removeInner(o,a+1);d!=_n?r[s+2]=d:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new wt(i,r):_n}forChild(e,n){if(this==_n)return this;if(n.isLeaf)return wt.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,o=s+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>s&&l.type instanceof _o){let d=Math.max(s,l.from)-s,h=Math.min(o,l.to)-s;d<h&&(i||(i=[])).push(l.copy(d,h))}}if(i){let a=new wt(i.sort(Ra),Rl);return r?new Ys([a,r]):a}return r||_n}eq(e){if(this==e)return!0;if(!(e instanceof wt)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return uw(this.localsInner(e))}localsInner(e){if(this==_n)return Rl;if(e.inlineContent||!this.local.some(_o.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof _o||n.push(this.local[r]);return n}forEachSet(e){e(this)}}wt.empty=new wt([],[]);wt.removeOverlap=uw;const _n=wt.empty;class Ys{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Aa));return Ys.from(r)}forChild(e,n){if(n.isLeaf)return wt.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=_n&&(s instanceof Ys?r=r.concat(s.members):r.push(s))}return Ys.from(r)}eq(e){if(!(e instanceof Ys)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?uw(r?n:n.sort(Ra)):Rl}static from(e){switch(e.length){case 0:return _n;case 1:return e[0];default:return new Ys(e.every(n=>n instanceof wt)?e:e.reduce((n,r)=>n.concat(r instanceof wt?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function e$(t,e,n,r,i,s,o){let a=t.slice();for(let d=0,h=s;d<n.maps.length;d++){let f=0;n.maps[d].forEach((p,y,g,x)=>{let S=x-g-(y-p);for(let C=0;C<a.length;C+=3){let E=a[C+1];if(E<0||p>E+h-f)continue;let w=a[C]+h-f;y>=w?a[C+1]=p<=w?-2:-1:p>=h&&S&&(a[C]+=S,a[C+1]+=S)}f+=S}),h=n.maps[d].map(h,-1)}let l=!1;for(let d=0;d<a.length;d+=3)if(a[d+1]<0){if(a[d+1]==-2){l=!0,a[d+1]=-1;continue}let h=n.map(t[d]+s),f=h-i;if(f<0||f>=r.content.size){l=!0;continue}let p=n.map(t[d+1]+s,-1),y=p-i,{index:g,offset:x}=r.content.findIndex(f),S=r.maybeChild(g);if(S&&x==f&&x+S.nodeSize==y){let C=a[d+2].mapInner(n,S,h+1,t[d]+s+1,o);C!=_n?(a[d]=f,a[d+1]=y,a[d+2]=C):(a[d+1]=-2,l=!0)}else l=!0}if(l){let d=t$(a,t,e,n,i,s,o),h=mm(d,r,0,o);e=h.local;for(let f=0;f<a.length;f+=3)a[f+1]<0&&(a.splice(f,3),f-=3);for(let f=0,p=0;f<h.children.length;f+=3){let y=h.children[f];for(;p<a.length&&a[p]<y;)p+=3;a.splice(p,0,h.children[f],h.children[f+1],h.children[f+2])}}return new wt(e.sort(Ra),a)}function UN(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new Fn(i.from+e,i.to+e,i.type))}return n}function t$(t,e,n,r,i,s,o){function a(l,d){for(let h=0;h<l.local.length;h++){let f=l.local[h].map(r,i,d);f?n.push(f):o.onRemove&&o.onRemove(l.local[h].spec)}for(let h=0;h<l.children.length;h+=3)a(l.children[h+2],l.children[h]+d+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+s+1);return n}function HN(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function VN(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function mm(t,e,n,r){let i=[],s=!1;e.forEach((a,l)=>{let d=HN(t,a,l+n);if(d){s=!0;let h=mm(d,a,n+l+1,r);h!=_n&&i.push(l,l+a.nodeSize,h)}});let o=UN(s?VN(t):t,-n).sort(Ra);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new wt(o,i):_n}function Ra(t,e){return t.from-e.from||t.to-e.to}function uw(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),ob(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),ob(e,i,r.copy(s.from,r.to)));break}}}return e}function ob(t,e,n){for(;e<t.length&&Ra(n,t[e])>0;)e++;t.splice(e,0,n)}function Qy(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=_n&&e.push(r)}),t.cursorWrapper&&e.push(wt.create(t.state.doc,[t.cursorWrapper.deco])),Ys.from(e)}const n$={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},r$=or&&bo<=11;class i${constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class s${constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new i$,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);or&&bo<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Pn&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),r$&&(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,n$)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(XC(this.view)){if(this.suppressingSelectionUpdates)return hs(this.view);if(or&&bo<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Wa(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let s=e.focusNode;s;s=Mu(s))n.add(s);for(let s=e.anchorNode;s;s=Mu(s))if(n.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&XC(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let h=0;h<n.length;h++){let f=this.registerMutation(n[h],l);f&&(s=s<0?f.from:Math.min(f.from,s),o=o<0?f.to:Math.max(f.to,o),f.typeOver&&(a=!0))}if(l.some(h=>h.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let h of l)if(h.nodeName=="BR"&&h.parentNode){let f=h.nextSibling;for(;f&&f.nodeType==1;){if(f.contentEditable=="false"){h.parentNode.removeChild(h);break}f=f.firstChild}}}else if(Br&&l.length){let h=l.filter(f=>f.nodeName=="BR");if(h.length==2){let[f,p]=h;f.parentNode&&f.parentNode.parentNode==p.parentNode?p.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let p of h){let y=p.parentNode;y&&y.nodeName=="LI"&&(!f||l$(e,f)!=y)&&p.remove()}}}let d=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&x0(r)&&(d=nw(e))&&d.eq(Oe.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,hs(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),o$(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,u$(e,l)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||hs(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let h=0;h<e.addedNodes.length;h++){let f=e.addedNodes[h];n.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(or&&bo<=11&&e.addedNodes.length)for(let h=0;h<e.addedNodes.length;h++){let{previousSibling:f,nextSibling:p}=e.addedNodes[h];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f),(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(s=p)}let o=i&&i.parentNode==e.target?hn(i)+1:0,a=r.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?hn(s):e.target.childNodes.length,d=r.localPosFromDOM(e.target,l,1);return{from:a,to:d}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let ab=new WeakMap,lb=!1;function o$(t){if(!ab.has(t)&&(ab.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Br,lb)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."),lb=!0}}function ub(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return Wa(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function a$(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return ub(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?ub(t,n):null}function l$(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function u$(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let a=o;for(;;){let l=a.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;a=l}a.insertBefore(s,a.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function c$(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:o,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),d,h=l.anchorNode;if(h&&t.dom.contains(h.nodeType==1?h:h.parentNode)&&(d=[{node:h,offset:l.anchorOffset}],x0(l)||d.push({node:l.focusNode,offset:l.focusOffset})),pn&&t.input.lastKeyCode===8)for(let S=s;S>i;S--){let C=r.childNodes[S-1],E=C.pmViewDesc;if(C.nodeName=="BR"&&!E){s=S;break}if(!E||E.size)break}let f=t.state.doc,p=t.someProp("domParser")||Co.fromSchema(t.state.schema),y=f.resolve(o),g=null,x=p.parse(r,{topNode:y.parent,topMatch:y.parent.contentMatchAt(y.index()),topOpen:!0,from:i,to:s,preserveWhitespace:y.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:d$,context:y});if(d&&d[0].pos!=null){let S=d[0].pos,C=d[1]&&d[1].pos;C==null&&(C=S),g={anchor:S+o,head:C+o}}return{doc:x,sel:g,from:o,to:a}}function d$(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Pn&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Pn&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const h$=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function f$(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let A=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,M=nw(t,A);if(M&&!t.state.selection.eq(M)){if(pn&&ls&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",R=>R(t,aa(13,"Enter"))))return;let I=t.state.tr.setSelection(M);A=="pointer"?I.setMeta("pointer",!0):A=="key"&&I.scrollIntoView(),s&&I.setMeta("composition",s),t.dispatch(I)}return}let o=t.state.doc.resolve(e),a=o.sharedDepth(n);e=o.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,d=c$(t,e,n),h=t.state.doc,f=h.slice(d.from,d.to),p,y;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(p=t.state.selection.to,y="end"):(p=t.state.selection.from,y="start"),t.input.lastKeyCode=null;let g=g$(f.content,d.doc.content,d.from,p,y);if(g&&t.input.domChangeCount++,(Pu&&t.input.lastIOSEnter>Date.now()-225||ls)&&i.some(A=>A.nodeType==1&&!h$.test(A.nodeName))&&(!g||g.endA>=g.endB)&&t.someProp("handleKeyDown",A=>A(t,aa(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!g)if(r&&l instanceof we&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))g={start:l.from,endA:l.to,endB:l.to};else{if(d.sel){let A=cb(t,t.state.doc,d.sel);if(A&&!A.eq(t.state.selection)){let M=t.state.tr.setSelection(A);s&&M.setMeta("composition",s),t.dispatch(M)}}return}t.state.selection.from<t.state.selection.to&&g.start==g.endB&&t.state.selection instanceof we&&(g.start>t.state.selection.from&&g.start<=t.state.selection.from+2&&t.state.selection.from>=d.from?g.start=t.state.selection.from:g.endA<t.state.selection.to&&g.endA>=t.state.selection.to-2&&t.state.selection.to<=d.to&&(g.endB+=t.state.selection.to-g.endA,g.endA=t.state.selection.to)),or&&bo<=11&&g.endB==g.start+1&&g.endA==g.start&&g.start>d.from&&d.doc.textBetween(g.start-d.from-1,g.start-d.from+1)=="  "&&(g.start--,g.endA--,g.endB--);let x=d.doc.resolveNoCache(g.start-d.from),S=d.doc.resolveNoCache(g.endB-d.from),C=h.resolve(g.start),E=x.sameParent(S)&&x.parent.inlineContent&&C.end()>=g.endA;if((Pu&&t.input.lastIOSEnter>Date.now()-225&&(!E||i.some(A=>A.nodeName=="DIV"||A.nodeName=="P"))||!E&&x.pos<d.doc.content.size&&(!x.sameParent(S)||!x.parent.inlineContent)&&x.pos<S.pos&&!/\S/.test(d.doc.textBetween(x.pos,S.pos,"","")))&&t.someProp("handleKeyDown",A=>A(t,aa(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>g.start&&m$(h,g.start,g.endA,x,S)&&t.someProp("handleKeyDown",A=>A(t,aa(8,"Backspace")))){ls&&pn&&t.domObserver.suppressSelectionUpdates();return}pn&&g.endB==g.start&&(t.input.lastChromeDelete=Date.now()),ls&&!E&&x.start()!=S.start()&&S.parentOffset==0&&x.depth==S.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==g.endA&&(g.endB-=2,S=d.doc.resolveNoCache(g.endB-d.from),setTimeout(()=>{t.someProp("handleKeyDown",function(A){return A(t,aa(13,"Enter"))})},20));let w=g.start,b=g.endA,T=A=>{let M=A||t.state.tr.replace(w,b,d.doc.slice(g.start-d.from,g.endB-d.from));if(d.sel){let I=cb(t,M.doc,d.sel);I&&!(pn&&t.composing&&I.empty&&(g.start!=g.endB||t.input.lastChromeDelete<Date.now()-100)&&(I.head==w||I.head==M.mapping.map(b)-1)||or&&I.empty&&I.head==w)&&M.setSelection(I)}return s&&M.setMeta("composition",s),M.scrollIntoView()},P;if(E)if(x.pos==S.pos){or&&bo<=11&&x.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>hs(t),20));let A=T(t.state.tr.delete(w,b)),M=h.resolve(g.start).marksAcross(h.resolve(g.endA));M&&A.ensureMarks(M),t.dispatch(A)}else if(g.endA==g.endB&&(P=p$(x.parent.content.cut(x.parentOffset,S.parentOffset),C.parent.content.cut(C.parentOffset,g.endA-C.start())))){let A=T(t.state.tr);P.type=="add"?A.addMark(w,b,P.mark):A.removeMark(w,b,P.mark),t.dispatch(A)}else if(x.parent.child(x.index()).isText&&x.index()==S.index()-(S.textOffset?0:1)){let A=x.parent.textBetween(x.parentOffset,S.parentOffset),M=()=>T(t.state.tr.insertText(A,w,b));t.someProp("handleTextInput",I=>I(t,w,b,A,M))||t.dispatch(M())}else t.dispatch(T());else t.dispatch(T())}function cb(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:rw(t,e.resolve(n.anchor),e.resolve(n.head))}function p$(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,a,l;for(let h=0;h<r.length;h++)i=r[h].removeFromSet(i);for(let h=0;h<n.length;h++)s=n[h].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",l=h=>h.mark(a.addToSet(h.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=h=>h.mark(a.removeFromSet(h.marks));else return null;let d=[];for(let h=0;h<e.childCount;h++)d.push(l(e.child(h)));if(J.from(d).eq(t))return{mark:a,type:o}}function m$(t,e,n,r,i){if(n-e<=i.pos-r.pos||Yy(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&n==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(Yy(s,!0,!0));return!o.parent.isTextblock||o.pos>n||Yy(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Yy(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function g$(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:o,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let l=Math.max(0,s-Math.min(o,a));r-=o+l-s}if(o<s&&t.size<e.size){let l=r<=s&&r>=o?s-r:0;s-=l,s&&s<e.size&&db(e.textBetween(s-1,s+1))&&(s+=l?1:-1),a=s+(a-o),o=s}else if(a<s){let l=r<=s&&r>=a?s-r:0;s-=l,s&&s<t.size&&db(t.textBetween(s-1,s+1))&&(s+=l?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}function db(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class GN{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new AG,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(gb),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=pb(this),fb(this),this.nodeViews=mb(this),this.docView=WC(this.state.doc,hb(this),Qy(this),this.dom,this),this.domObserver=new s$(this,(r,i,s,o)=>f$(this,r,i,s,o)),this.domObserver.start(),RG(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&tx(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(gb),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(FN(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let y=mb(this);v$(y,this.nodeViews)&&(this.nodeViews=y,s=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&tx(this),this.editable=pb(this),fb(this);let l=Qy(this),d=hb(this),h=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=s||!this.docView.matchesNode(e.doc,d,l);(f||!e.selection.eq(i.selection))&&(o=!0);let p=h=="preserve"&&o&&this.dom.style.overflowAnchor==null&&KV(this);if(o){this.domObserver.stop();let y=f&&(or||pn)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&y$(i.selection,e.selection);if(f){let g=pn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=KG(this)),(s||!this.docView.update(e.doc,d,l,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=WC(e.doc,d,l,this.dom,this)),g&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(y=!0)}y||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&yG(this))?hs(this,y):(EN(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),h=="reset"?this.dom.scrollTop=0:h=="to selection"?this.scrollToSelection():p&&qV(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof ye){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&BC(this,n.getBoundingClientRect(),e)}else BC(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new zN(e.slice,e.move,i<0?void 0:ye.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=n?n(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=n?n(a):a))return i}}hasFocus(){if(or){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&QV(this.dom),hs(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return eG(this,e)}coordsAtPos(e,n=1){return yN(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return sG(this,n||this.state,e)}pasteHTML(e,n){return $d(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return $d(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return iw(this,e)}destroy(){this.docView&&(LG(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Qy(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,FV())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return DG(this,e)}domSelectionRange(){let e=this.domSelection();return e?Pn&&this.root.nodeType===11&&HV(this.dom.ownerDocument)==this.dom&&a$(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}GN.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function hb(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Fn.node(0,t.state.doc.content.size,e)]}function fb(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Fn.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function pb(t){return!t.someProp("editable",e=>e(t.state)===!1)}function y$(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function mb(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function v$(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function gb(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Po={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:"'"},gm={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},x$=typeof navigator<"u"&&/Mac/.test(navigator.platform),S$=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var fn=0;fn<10;fn++)Po[48+fn]=Po[96+fn]=String(fn);for(var fn=1;fn<=24;fn++)Po[fn+111]="F"+fn;for(var fn=65;fn<=90;fn++)Po[fn]=String.fromCharCode(fn+32),gm[fn]=String.fromCharCode(fn);for(var Jy in Po)gm.hasOwnProperty(Jy)||(gm[Jy]=Po[Jy]);function w$(t){var e=x$&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||S$&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?gm:Po)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const k$=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),C$=typeof navigator<"u"&&/Win/.test(navigator.platform);function b$(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))k$?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function E$(t){let e=Object.create(null);for(let n in t)e[b$(n)]=t[n];return e}function Xy(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function _$(t){return new Et({props:{handleKeyDown:$N(t)}})}function $N(t){let e=E$(t);return function(n,r){let i=w$(r),s,o=e[Xy(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[Xy(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(C$&&r.ctrlKey&&r.altKey)&&(s=Po[r.keyCode])&&s!=i){let a=e[Xy(s,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var N$=Object.defineProperty,cw=(t,e)=>{for(var n in e)N$(t,n,{get:e[n],enumerable:!0})};function k0(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,s=n.storedMarks,n}}}var C0=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:i}=n,s=this.buildProps(i);return Object.fromEntries(Object.entries(t).map(([o,a])=>[o,(...d)=>{const h=a(...d)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),h}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,o=[],a=!!t,l=t||i.tr,d=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(l),o.every(f=>f===!0)),h={...Object.fromEntries(Object.entries(n).map(([f,p])=>[f,(...g)=>{const x=this.buildProps(l,e),S=p(...g)(x);return o.push(S),h}])),run:d};return h}createCan(t){const{rawCommands:e,state:n}=this,r=!1,i=t||n.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...d)=>l(...d)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,o={tr:t,editor:r,view:s,state:k0({state:i,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([a,l])=>[a,(...d)=>l(...d)(o)]))}};return o}},WN={};cw(WN,{blur:()=>T$,clearContent:()=>M$,clearNodes:()=>P$,command:()=>O$,createParagraphNear:()=>A$,cut:()=>R$,deleteCurrentNode:()=>L$,deleteNode:()=>I$,deleteRange:()=>D$,deleteSelection:()=>F$,enter:()=>j$,exitCode:()=>z$,extendMarkRange:()=>B$,first:()=>U$,focus:()=>V$,forEach:()=>G$,insertContent:()=>$$,insertContentAt:()=>q$,joinBackward:()=>J$,joinDown:()=>Y$,joinForward:()=>X$,joinItemBackward:()=>Z$,joinItemForward:()=>eW,joinTextblockBackward:()=>tW,joinTextblockForward:()=>nW,joinUp:()=>Q$,keyboardShortcut:()=>iW,lift:()=>sW,liftEmptyBlock:()=>oW,liftListItem:()=>aW,newlineInCode:()=>lW,resetAttributes:()=>uW,scrollIntoView:()=>cW,selectAll:()=>dW,selectNodeBackward:()=>hW,selectNodeForward:()=>fW,selectParentNode:()=>pW,selectTextblockEnd:()=>mW,selectTextblockStart:()=>gW,setContent:()=>yW,setMark:()=>jW,setMeta:()=>zW,setNode:()=>BW,setNodeSelection:()=>UW,setTextDirection:()=>HW,setTextSelection:()=>VW,sinkListItem:()=>GW,splitBlock:()=>$W,splitListItem:()=>WW,toggleList:()=>qW,toggleMark:()=>QW,toggleNode:()=>YW,toggleWrap:()=>JW,undoInputRule:()=>XW,unsetAllMarks:()=>ZW,unsetMark:()=>eK,unsetTextDirection:()=>tK,updateAttributes:()=>nK,wrapIn:()=>rK,wrapInList:()=>iK});var T$=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),M$=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),P$=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:o})=>{t.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:d,mapping:h}=e,f=d.resolve(h.map(l)),p=d.resolve(h.map(l+a.nodeSize)),y=f.blockRange(p);if(!y)return;const g=qu(y);if(a.type.isTextblock){const{defaultType:x}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(y.start,x)}(g||g===0)&&e.lift(y,g)})}),!0},O$=t=>e=>t(e),A$=()=>({state:t,dispatch:e})=>oN(t,e),R$=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new we(r.doc.resolve(Math.max(o-1,0)))),!0},L$=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const a=i.before(s),l=i.after(s);t.delete(a,l).scrollIntoView()}return!0}return!1};function Bt(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var I$=t=>({tr:e,state:n,dispatch:r})=>{const i=Bt(t,n.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const l=s.before(o),d=s.after(o);e.delete(l,d).scrollIntoView()}return!0}return!1},D$=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},F$=()=>({state:t,dispatch:e})=>YS(t,e),j$=()=>({commands:t})=>t.keyboardShortcut("Enter"),z$=()=>({state:t,dispatch:e})=>kV(t,e);function dw(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function ym(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:dw(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function KN(t,e,n={}){return t.find(r=>r.type===e&&ym(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function yb(t,e,n={}){return!!KN(t,e,n)}function hw(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(d=>d.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(d=>d.type===e))return;if(!n){const d=r.node.marks.find(h=>h.type===e);d&&(n=d.attrs)}if(!KN([...r.node.marks],e,n))return;let s=r.index,o=t.start()+r.offset,a=s+1,l=o+r.node.nodeSize;for(;s>0&&yb([...t.parent.child(s-1).marks],e,n);)s-=1,o-=t.parent.child(s).nodeSize;for(;a<t.parent.childCount&&yb([...t.parent.child(a).marks],e,n);)l+=t.parent.child(a).nodeSize,a+=1;return{from:o,to:l}}function bs(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var B$=(t,e)=>({tr:n,state:r,dispatch:i})=>{const s=bs(t,r.schema),{doc:o,selection:a}=n,{$from:l,from:d,to:h}=a;if(i){const f=hw(l,s,e);if(f&&f.from<=d&&f.to>=h){const p=we.create(o,f.from,f.to);n.setSelection(p)}}return!0},U$=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function qN(t){return t instanceof we}function ma(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function QN(t,e=null){if(!e)return null;const n=Oe.atStart(t),r=Oe.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?we.create(t,ma(0,i,s),ma(t.content.size,i,s)):we.create(t,ma(e,i,s),ma(e,i,s))}function vb(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function vm(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function H$(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var V$=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(vm()||vb())&&r.dom.focus(),H$()&&!vm()&&!vb()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(s&&t===null&&!qN(n.state.selection))return o(),!0;const a=QN(i.doc,t)||n.state.selection,l=n.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},G$=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),$$=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),YN=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&YN(r)}return t};function $f(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return YN(n)}function Kd(t,e,n){if(t instanceof li||t instanceof J)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return J.fromArray(t.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),Kd("",e,n)}if(i){if(n.errorOnInvalidContent){let o=!1,a="";const l=new R9({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:d=>(o=!0,a=typeof d=="string"?d:d.outerHTML,null)}]}})});if(n.slice?Co.fromSchema(l).parseSlice($f(t),n.parseOptions):Co.fromSchema(l).parse($f(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=Co.fromSchema(e);return n.slice?s.parseSlice($f(t),n.parseOptions).content:s.parse($f(t),n.parseOptions)}return Kd("",e,n)}function W$(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof Ft||i instanceof on))return;const s=t.mapping.maps[r];let o=0;s.forEach((a,l,d,h)=>{o===0&&(o=h)}),t.setSelection(Oe.near(t.doc.resolve(o),n))}var K$=t=>!("type"in t),q$=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const l=S=>{s.emit("contentError",{editor:s,error:S,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Kd(e,s.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(S){l(S)}try{a=Kd(e,s.schema,{parseOptions:d,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(S){return l(S),!1}let{from:h,to:f}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},p=!0,y=!0;if((K$(a)?a:[a]).forEach(S=>{S.check(),p=p?S.isText&&S.marks.length===0:!1,y=y?S.isBlock:!1}),h===f&&y){const{parent:S}=r.doc.resolve(h);S.isTextblock&&!S.type.spec.code&&!S.childCount&&(h-=1,f+=1)}let x;if(p){if(Array.isArray(e))x=e.map(S=>S.text||"").join("");else if(e instanceof J){let S="";e.forEach(C=>{C.text&&(S+=C.text)}),x=S}else typeof e=="object"&&e&&e.text?x=e.text:x=e;r.insertText(x,h,f)}else{x=a;const S=r.doc.resolve(h),C=S.node(),E=S.parentOffset===0,w=C.isText||C.isTextblock,b=C.content.size>0;E&&w&&b&&(h=Math.max(0,h-1)),r.replaceWith(h,f,x)}n.updateSelection&&W$(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:h,text:x}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:h,text:x})}return!0},Q$=()=>({state:t,dispatch:e})=>xV(t,e),Y$=()=>({state:t,dispatch:e})=>SV(t,e),J$=()=>({state:t,dispatch:e})=>Z9(t,e),X$=()=>({state:t,dispatch:e})=>rN(t,e),Z$=()=>({state:t,dispatch:e,tr:n})=>{try{const r=g0(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},eW=()=>({state:t,dispatch:e,tr:n})=>{try{const r=g0(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},tW=()=>({state:t,dispatch:e})=>yV(t,e),nW=()=>({state:t,dispatch:e})=>vV(t,e);function JN(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function rW(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))vm()||JN()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}var iW=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=rW(t).split(/-(?!$)/),o=s.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",d=>d(n,a))});return l==null||l.steps.forEach(d=>{const h=d.map(r.mapping);h&&i&&r.maybeStep(h)}),!0};function Oo(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?Bt(e,t.schema):null,a=[];t.doc.nodesBetween(r,i,(f,p)=>{if(f.isText)return;const y=Math.max(r,p),g=Math.min(i,p+f.nodeSize);a.push({node:f,from:y,to:g})});const l=i-r,d=a.filter(f=>o?o.name===f.node.type.name:!0).filter(f=>ym(f.node.attrs,n,{strict:!1}));return s?!!d.length:d.reduce((f,p)=>f+p.to-p.from,0)>=l}var sW=(t,e={})=>({state:n,dispatch:r})=>{const i=Bt(t,n.schema);return Oo(n,i,e)?wV(n,r):!1},oW=()=>({state:t,dispatch:e})=>aN(t,e),aW=t=>({state:e,dispatch:n})=>{const r=Bt(t,e.schema);return RV(r)(e,n)},lW=()=>({state:t,dispatch:e})=>sN(t,e);function b0(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function xb(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}var uW=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=b0(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(s=Bt(t,r.schema)),a==="mark"&&(o=bs(t,r.schema));let l=!1;return n.selection.ranges.forEach(d=>{r.doc.nodesBetween(d.$from.pos,d.$to.pos,(h,f)=>{s&&s===h.type&&(l=!0,i&&n.setNodeMarkup(f,void 0,xb(h.attrs,e))),o&&h.marks.length&&h.marks.forEach(p=>{o===p.type&&(l=!0,i&&n.addMark(f,f+h.nodeSize,o.create(xb(p.attrs,e))))})})}),l},cW=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),dW=()=>({tr:t,dispatch:e})=>{if(e){const n=new mr(t.doc);t.setSelection(n)}return!0},hW=()=>({state:t,dispatch:e})=>tN(t,e),fW=()=>({state:t,dispatch:e})=>iN(t,e),pW=()=>({state:t,dispatch:e})=>EV(t,e),mW=()=>({state:t,dispatch:e})=>TV(t,e),gW=()=>({state:t,dispatch:e})=>NV(t,e);function nx(t,e,n={},r={}){return Kd(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var yW=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{const{doc:l}=s;if(r.preserveWhitespace!=="full"){const d=nx(t,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return o&&s.replaceWith(0,l.content.size,d).setMeta("preventUpdate",!n),!0}return o&&s.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},t,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function XN(t,e){const n=bs(e,t.schema),{from:r,to:i,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function ZN(t,e){const n=new Q9(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function vW(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function xW(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function SW(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function E0(t){return e=>SW(e.$from,t)}function pe(t,e,n){return t.config[e]===void 0&&t.parent?pe(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?pe(t.parent,e,n):null}):t.config[e]}function fw(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=pe(e,"addExtensions",n);return r?[e,...fw(r())]:e}).flat(10)}function pw(t,e){const n=ol.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function eT(t){return typeof t=="function"}function Ke(t,e=void 0,...n){return eT(t)?e?t.bind(e)(...n):t(...n):t}function wW(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Ou(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function tT(t){const e=[],{nodeExtensions:n,markExtensions:r}=Ou(t),i=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(d=>d.name!=="text").map(d=>d.name),a=r.map(d=>d.name),l=[...o,...a];return t.forEach(d=>{const h={name:d.name,options:d.options,storage:d.storage,extensions:i},f=pe(d,"addGlobalAttributes",h);if(!f)return;f().forEach(y=>{let g;Array.isArray(y.types)?g=y.types:y.types==="*"?g=l:y.types==="nodes"?g=o:y.types==="marks"?g=a:g=[],g.forEach(x=>{Object.entries(y.attributes).forEach(([S,C])=>{e.push({type:x,name:S,attribute:{...s,...C}})})})})}),i.forEach(d=>{const h={name:d.name,options:d.options,storage:d.storage},f=pe(d,"addAttributes",h);if(!f)return;const p=f();Object.entries(p).forEach(([y,g])=>{const x={...s,...g};typeof(x==null?void 0:x.default)=="function"&&(x.default=x.default()),x!=null&&x.isRequired&&(x==null?void 0:x.default)===void 0&&delete x.default,e.push({type:d.name,name:y,attribute:x})})}),e}function kW(t){const e=[];let n="",r=!1,i=!1,s=0;const o=t.length;for(let a=0;a<o;a+=1){const l=t[a];if(l==="'"&&!i){r=!r,n+=l;continue}if(l==='"'&&!r){i=!i,n+=l;continue}if(!r&&!i){if(l==="("){s+=1,n+=l;continue}if(l===")"&&s>0){s-=1,n+=l;continue}if(l===";"&&s===0){e.push(n),n="";continue}}n+=l}return n&&e.push(n),e}function Sb(t){const e=[],n=kW(t||""),r=n.length;for(let i=0;i<r;i+=1){const s=n[i],o=s.indexOf(":");if(o===-1)continue;const a=s.slice(0,o).trim(),l=s.slice(o+1).trim();a&&l&&e.push([a,l])}return e}function Ut(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const a=s?String(s).split(" "):[],l=r[i]?r[i].split(" "):[],d=a.filter(h=>!l.includes(h));r[i]=[...l,...d].join(" ")}else if(i==="style"){const a=new Map([...Sb(r[i]),...Sb(s)]);r[i]=Array.from(a.entries()).map(([l,d])=>`${l}: ${d}`).join("; ")}else r[i]=s}),r},{})}function qd(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Ut(n,r),{})}function CW(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function wb(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(n):CW(n.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...r,...i}}}}function kb(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&wW(n)?!1:n!=null))}function Cb(t){var e,n;const r={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function bW(t,e){var n;const r=tT(t),{nodeExtensions:i,markExtensions:s}=Ou(t),o=(n=i.find(d=>pe(d,"topNode")))==null?void 0:n.name,a=Object.fromEntries(i.map(d=>{const h=r.filter(C=>C.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=t.reduce((C,E)=>{const w=pe(E,"extendNodeSchema",f);return{...C,...w?w(d):{}}},{}),y=kb({...p,content:Ke(pe(d,"content",f)),marks:Ke(pe(d,"marks",f)),group:Ke(pe(d,"group",f)),inline:Ke(pe(d,"inline",f)),atom:Ke(pe(d,"atom",f)),selectable:Ke(pe(d,"selectable",f)),draggable:Ke(pe(d,"draggable",f)),code:Ke(pe(d,"code",f)),whitespace:Ke(pe(d,"whitespace",f)),linebreakReplacement:Ke(pe(d,"linebreakReplacement",f)),defining:Ke(pe(d,"defining",f)),isolating:Ke(pe(d,"isolating",f)),attrs:Object.fromEntries(h.map(Cb))}),g=Ke(pe(d,"parseHTML",f));g&&(y.parseDOM=g.map(C=>wb(C,h)));const x=pe(d,"renderHTML",f);x&&(y.toDOM=C=>x({node:C,HTMLAttributes:qd(C,h)}));const S=pe(d,"renderText",f);return S&&(y.toText=S),[d.name,y]})),l=Object.fromEntries(s.map(d=>{const h=r.filter(S=>S.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=t.reduce((S,C)=>{const E=pe(C,"extendMarkSchema",f);return{...S,...E?E(d):{}}},{}),y=kb({...p,inclusive:Ke(pe(d,"inclusive",f)),excludes:Ke(pe(d,"excludes",f)),group:Ke(pe(d,"group",f)),spanning:Ke(pe(d,"spanning",f)),code:Ke(pe(d,"code",f)),attrs:Object.fromEntries(h.map(Cb))}),g=Ke(pe(d,"parseHTML",f));g&&(y.parseDOM=g.map(S=>wb(S,h)));const x=pe(d,"renderHTML",f);return x&&(y.toDOM=S=>x({mark:S,HTMLAttributes:qd(S,h)})),[d.name,y]}));return new R9({topNode:o,nodes:a,marks:l})}function EW(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function ad(t){return t.sort((n,r)=>{const i=pe(n,"priority")||100,s=pe(r,"priority")||100;return i>s?-1:i<s?1:0})}function nT(t){const e=ad(fw(t)),n=EW(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function rT(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
`,textSerializers:o={}}=n||{};let a="";return t.nodesBetween(r,i,(l,d,h,f)=>{var p;l.isBlock&&d>r&&(a+=s);const y=o==null?void 0:o[l.type.name];if(y)return h&&(a+=y({node:l,pos:d,parent:h,index:f,range:e})),!1;l.isText&&(a+=(p=l==null?void 0:l.text)==null?void 0:p.slice(Math.max(r,d)-d,i-d))}),a}function _W(t,e){const n={from:0,to:t.content.size};return rT(t,n,e)}function iT(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function NW(t,e){const n=Bt(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===n.name);return o?{...o.attrs}:{}}function sT(t,e){const n=b0(typeof e=="string"?e:e.name,t.schema);return n==="node"?NW(t,e):n==="mark"?XN(t,e):{}}function TW(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function MW(t){const e=TW(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,o)=>o!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function oT(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=n[s];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const d=e.slice(s).map(a,-1),h=e.slice(s).map(l),f=e.invert().map(d,-1),p=e.invert().map(h);r.push({oldRange:{from:f,to:p},newRange:{from:d,to:h}})})}),MW(r)}function mw(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),o=hw(s,i.type);o&&r.push({mark:i,...o})}):n.nodesBetween(t,e,(i,s)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}var PW=(t,e,n,r=20)=>{const i=t.doc.resolve(n);let s=r,o=null;for(;s>0&&o===null;){const a=i.node(s);(a==null?void 0:a.type.name)===e?o=a:s-=1}return[o,s]};function Pc(t,e){return e.nodes[t]||e.marks[t]||null}function kp(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}var OW=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,a)=>{var l,d;const h=((d=(l=i.type.spec).toText)==null?void 0:d.call(l,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?h:h.slice(0,Math.max(0,r-s))}),n};function rx(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?bs(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>s?s.name===f.type.name:!0).find(f=>ym(f.attrs,n,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:f,$to:p})=>{const y=f.pos,g=p.pos;t.doc.nodesBetween(y,g,(x,S)=>{if(s&&x.inlineContent&&!x.type.allowsMarkType(s))return!1;if(!x.isText&&!x.marks.length)return;const C=Math.max(y,S),E=Math.min(g,S+x.nodeSize),w=E-C;o+=w,a.push(...x.marks.map(b=>({mark:b,from:C,to:E})))})}),o===0)return!1;const l=a.filter(f=>s?s.name===f.mark.type.name:!0).filter(f=>ym(f.mark.attrs,n,{strict:!1})).reduce((f,p)=>f+p.to-p.from,0),d=a.filter(f=>s?f.mark.type!==s&&f.mark.type.excludes(s):!0).reduce((f,p)=>f+p.to-p.from,0);return(l>0?l+d:l)>=o}function AW(t,e,n={}){if(!e)return Oo(t,null,n)||rx(t,null,n);const r=b0(e,t.schema);return r==="node"?Oo(t,e,n):r==="mark"?rx(t,e,n):!1}var RW=(t,e)=>{const{$from:n,$to:r,$anchor:i}=t.selection;if(e){const s=E0(a=>a.type.name===e)(t.selection);if(!s)return!1;const o=t.doc.resolve(s.pos+1);return i.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},LW=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function bb(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Zy(t,e){const{nodeExtensions:n}=Ou(e),r=n.find(o=>o.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=Ke(pe(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function _0(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return!/\S/.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(s=>{i!==!1&&(_0(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function aT(t){return t instanceof ye}var lT=class uT{constructor(e){this.position=e}static fromJSON(e){return new uT(e.position)}toJSON(){return{position:this.position}}};function IW(t,e){const n=e.mapping.mapResult(t.position);return{position:new lT(n.pos),mapResult:n}}function DW(t){return new lT(t)}function FW(t,e,n){var r;const{selection:i}=e;let s=null;if(qN(i)&&(s=i.$cursor),s){const a=(r=t.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(n)&&(!!n.isInSet(a)||!a.some(d=>d.type.excludes(n)))}const{ranges:o}=i;return o.some(({$from:a,$to:l})=>{let d=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(h,f,p)=>{if(d)return!1;if(h.isInline){const y=!p||p.type.allowsMarkType(n),g=!!n.isInSet(h.marks)||!h.marks.some(x=>x.type.excludes(n));d=y&&g}return!d}),d})}var jW=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:a}=s,l=bs(t,r.schema);if(i)if(o){const d=XN(r,l);n.addStoredMark(l.create({...d,...e}))}else a.forEach(d=>{const h=d.$from.pos,f=d.$to.pos;r.doc.nodesBetween(h,f,(p,y)=>{const g=Math.max(y,h),x=Math.min(y+p.nodeSize,f);p.marks.find(C=>C.type===l)?p.marks.forEach(C=>{l===C.type&&n.addMark(g,x,l.create({...C.attrs,...e}))}):n.addMark(g,x,l.create(e))})});return FW(r,n,l)},zW=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),BW=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=Bt(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:a})=>FC(s,{...o,...e})(n)?!0:a.clearNodes()).command(({state:a})=>FC(s,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},UW=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=ma(t,0,r.content.size),s=ye.create(r,i);e.setSelection(s)}return!0},HW=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=r;let o,a;return typeof e=="number"?(o=e,a=e):e&&"from"in e&&"to"in e?(o=e.from,a=e.to):(o=s.from,a=s.to),i&&n.doc.nodesBetween(o,a,(l,d)=>{l.isText||n.setNodeMarkup(d,void 0,{...l.attrs,dir:t})}),!0},VW=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,o=we.atStart(r).from,a=we.atEnd(r).to,l=ma(i,o,a),d=ma(s,o,a),h=we.create(r,l,d);e.setSelection(h)}return!0},GW=t=>({state:e,dispatch:n})=>{const r=Bt(t,e.schema);return DV(r)(e,n)};function Eb(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e==null?void 0:e.includes(i.type.name));t.tr.ensureMarks(r)}}var $W=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,d=i.extensionManager.attributes,h=kp(d,a.node().type.name,a.node().attrs);if(s instanceof ye&&s.node.isBlock)return!a.parentOffset||!ds(o,a.pos)?!1:(r&&(t&&Eb(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const f=l.parentOffset===l.parent.content.size,p=a.depth===0?void 0:vW(a.node(-1).contentMatchAt(a.indexAfter(-1)));let y=f&&p?[{type:p,attrs:h}]:void 0,g=ds(e.doc,e.mapping.map(a.pos),1,y);if(!y&&!g&&ds(e.doc,e.mapping.map(a.pos),1,p?[{type:p}]:void 0)&&(g=!0,y=p?[{type:p,attrs:h}]:void 0),r){if(g&&(s instanceof we&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,y),p&&!f&&!a.parentOffset&&a.parent.type!==p)){const x=e.mapping.map(a.before()),S=e.doc.resolve(x);a.node(-1).canReplaceWith(S.index(),S.index()+1,p)&&e.setNodeMarkup(e.mapping.map(a.before()),p)}t&&Eb(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return g},WW=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var o;const a=Bt(t,r.schema),{$from:l,$to:d}=r.selection,h=r.selection.node;if(h&&h.isBlock||l.depth<2||!l.sameParent(d))return!1;const f=l.node(-1);if(f.type!==a)return!1;const p=s.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let C=J.empty;const E=l.index(-1)?1:l.index(-2)?2:3;for(let M=l.depth-E;M>=l.depth-3;M-=1)C=J.from(l.node(M).copy(C));const w=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,b={...kp(p,l.node().type.name,l.node().attrs),...e},T=((o=a.contentMatch.defaultType)==null?void 0:o.createAndFill(b))||void 0;C=C.append(J.from(a.createAndFill(null,T)||void 0));const P=l.before(l.depth-(E-1));n.replace(P,l.after(-w),new ue(C,4-E,0));let A=-1;n.doc.nodesBetween(P,n.doc.content.size,(M,I)=>{if(A>-1)return!1;M.isTextblock&&M.content.size===0&&(A=I+1)}),A>-1&&n.setSelection(we.near(n.doc.resolve(A))),n.scrollIntoView()}return!0}const y=d.pos===l.end()?f.contentMatchAt(0).defaultType:null,g={...kp(p,f.type.name,f.attrs),...e},x={...kp(p,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,d.pos);const S=y?[{type:a,attrs:g},{type:y,attrs:x}]:[{type:a,attrs:g}];if(!ds(n.doc,l.pos,2))return!1;if(i){const{selection:C,storedMarks:E}=r,{splittableMarks:w}=s.extensionManager,b=E||C.$to.parentOffset&&C.$from.marks();if(n.split(l.pos,2,S).scrollIntoView(),!b||!i)return!0;const T=b.filter(P=>w.includes(P.type.name));n.ensureMarks(T)}return!0},e2=(t,e)=>{const n=E0(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Ho(t.doc,n.pos)&&t.join(n.pos),!0},t2=(t,e)=>{const n=E0(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Ho(t.doc,r)&&t.join(r),!0};function KW(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=1,i=n.nodeSize-1;return we.create(e,r,i)}var qW=(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:d,can:h})=>{const{extensions:f,splittableMarks:p}=i.extensionManager,y=Bt(t,o.schema),g=Bt(e,o.schema),{selection:x,storedMarks:S}=o,{$from:C,$to:E}=x,w=C.blockRange(E),b=S||x.$to.parentOffset&&x.$from.marks();if(!w)return!1;const T=E0($=>Zy($.type.name,f))(x),P=x.from===0&&x.to===o.doc.content.size,A=o.doc.content.content,M=A.length===1?A[0]:null,I=P&&M&&Zy(M.type.name,f)?{node:M,pos:0}:null,R=T??I,U=!!T&&w.depth>=1&&w.depth-T.depth<=1,B=!!I;if((U||B)&&R){if(R.node.type===y)return P&&B?l().command(({tr:$,dispatch:Q})=>{const q=KW($);return q?($.setSelection(q),Q&&Q($),!0):!1}).liftListItem(g).run():d.liftListItem(g);if(Zy(R.node.type.name,f)&&y.validContent(R.node.content))return l().command(()=>(s.setNodeMarkup(R.pos,y),!0)).command(()=>e2(s,y)).command(()=>t2(s,y)).run()}return!n||!b||!a?l().command(()=>h().wrapInList(y,r)?!0:d.clearNodes()).wrapInList(y,r).command(()=>e2(s,y)).command(()=>t2(s,y)).run():l().command(()=>{const $=h().wrapInList(y,r),Q=b.filter(q=>p.includes(q.type.name));return s.ensureMarks(Q),$?!0:d.clearNodes()}).wrapInList(y,r).command(()=>e2(s,y)).command(()=>t2(s,y)).run()},QW=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=bs(t,r.schema);return rx(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},YW=(t,e,n={})=>({state:r,commands:i})=>{const s=Bt(t,r.schema),o=Bt(e,r.schema),a=Oo(r,s,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?i.setNode(o,l):i.setNode(s,{...l,...n})},JW=(t,e={})=>({state:n,commands:r})=>{const i=Bt(t,n.schema);return Oo(n,i,e)?r.lift(i):r.wrapIn(i,e)},XW=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const o=t.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},ZW=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},eK=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=n,l=bs(t,r.schema),{$from:d,empty:h,ranges:f}=a;if(!i)return!0;if(h&&o){let{from:p,to:y}=a;const g=(s=d.marks().find(S=>S.type===l))==null?void 0:s.attrs,x=hw(d,l,g);x&&(p=x.from,y=x.to),n.removeMark(p,y,l)}else f.forEach(p=>{n.removeMark(p.$from.pos,p.$to.pos,l)});return n.removeStoredMark(l),!0},tK=t=>({tr:e,state:n,dispatch:r})=>{const{selection:i}=n;let s,o;return typeof t=="number"?(s=t,o=t):t&&"from"in t&&"to"in t?(s=t.from,o=t.to):(s=i.from,o=i.to),r&&e.doc.nodesBetween(s,o,(a,l)=>{if(a.isText)return;const d={...a.attrs};delete d.dir,e.setNodeMarkup(l,void 0,d)}),!0},nK=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=b0(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(s=Bt(t,r.schema)),a==="mark"&&(o=bs(t,r.schema));let l=!1;return n.selection.ranges.forEach(d=>{const h=d.$from.pos,f=d.$to.pos;let p,y,g,x;n.selection.empty?r.doc.nodesBetween(h,f,(S,C)=>{s&&s===S.type&&(l=!0,g=Math.max(C,h),x=Math.min(C+S.nodeSize,f),p=C,y=S)}):r.doc.nodesBetween(h,f,(S,C)=>{C<h&&s&&s===S.type&&(l=!0,g=Math.max(C,h),x=Math.min(C+S.nodeSize,f),p=C,y=S),C>=h&&C<=f&&(s&&s===S.type&&(l=!0,i&&n.setNodeMarkup(C,void 0,{...S.attrs,...e})),o&&S.marks.length&&S.marks.forEach(E=>{if(o===E.type&&(l=!0,i)){const w=Math.max(C,h),b=Math.min(C+S.nodeSize,f);n.addMark(w,b,o.create({...E.attrs,...e}))}}))}),y&&(p!==void 0&&i&&n.setNodeMarkup(p,void 0,{...y.attrs,...e}),o&&y.marks.length&&y.marks.forEach(S=>{o===S.type&&i&&n.addMark(g,x,o.create({...S.attrs,...e}))}))}),l},rK=(t,e={})=>({state:n,dispatch:r})=>{const i=Bt(t,n.schema);return MV(i,e)(n,r)},iK=(t,e={})=>({state:n,dispatch:r})=>{const i=Bt(t,n.schema);return PV(i,e)(n,r)},sK=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},N0=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},oK=(t,e)=>{if(dw(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function Wf(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const d=l.state.doc.resolve(r);if(d.parent.type.spec.code||(e=d.nodeBefore||d.nodeAfter)!=null&&e.marks.find(p=>p.type.spec.code))return!1;let h=!1;const f=OW(d)+s;return o.forEach(p=>{if(h)return;const y=oK(f,p.find);if(!y)return;const g=l.state.tr,x=k0({state:l.state,transaction:g}),S={from:r-(y[0].length-s.length),to:i},{commands:C,chain:E,can:w}=new C0({editor:n,state:x});p.handler({state:x,range:S,match:y,commands:C,chain:E,can:w})===null||!g.steps.length||(p.undoable&&g.setMeta(a,{transform:g,from:r,to:i,text:s}),l.dispatch(g),h=!0)}),h}function aK(t){const{editor:e,rules:n}=t,r=new Et({state:{init(){return null},apply(i,s,o){const a=i.getMeta(r);if(a)return a;const l=i.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:h}=l;typeof h=="string"?h=h:h=pw(J.from(h),o.schema);const{from:f}=l,p=f+h.length;Wf({editor:e,from:f,to:p,text:h,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return Wf({editor:e,from:s,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Wf({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?Wf({editor:e,from:o.pos,to:o.pos,text:`
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function lK(t){return Object.prototype.toString.call(t).slice(8,-1)}function Kf(t){return lK(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function cT(t,e){const n={...t};return Kf(t)&&Kf(e)&&Object.keys(e).forEach(r=>{Kf(e[r])&&Kf(t[r])?n[r]=cT(t[r],e[r]):n[r]=e[r]}),n}var gw=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...Ke(pe(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Ke(pe(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>cT(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},al=class dT extends gw{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new dT(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(d=>(d==null?void 0:d.type.name)===n.name))return!1;const l=o.find(d=>(d==null?void 0:d.type.name)===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function uK(t){return typeof t=="number"}var cK=class{constructor(t){this.find=t.find,this.handler=t.handler}},dK=(t,e,n)=>{if(dw(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=t,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function hK(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:a}=t,{commands:l,chain:d,can:h}=new C0({editor:e,state:n}),f=[];return n.doc.nodesBetween(r,i,(y,g)=>{var x,S,C,E,w;if((S=(x=y.type)==null?void 0:x.spec)!=null&&S.code||!(y.isText||y.isTextblock||y.isInline))return;const b=(w=(E=(C=y.content)==null?void 0:C.size)!=null?E:y.nodeSize)!=null?w:0,T=Math.max(r,g),P=Math.min(i,g+b);if(T>=P)return;const A=y.isText?y.text||"":y.textBetween(T-g,P-g,void 0,"");dK(A,s.find,o).forEach(I=>{if(I.index===void 0)return;const R=T+I.index+1,U=R+I[0].length,B={from:n.tr.mapping.map(R),to:n.tr.mapping.map(U)},$=s.handler({state:n,range:B,match:I,commands:l,chain:d,can:h,pasteEvent:o,dropEvent:a});f.push($)})}),f.every(y=>y!==null)}var qf=null,fK=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function pK(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:h,from:f,to:p,rule:y,pasteEvt:g})=>{const x=h.tr,S=k0({state:h,transaction:x});if(!(!hK({editor:e,state:S,from:Math.max(f-1,0),to:p.b-1,rule:y,pasteEvent:g,dropEvent:a})||!x.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,x}};return n.map(h=>new Et({view(f){const p=g=>{var x;r=(x=f.dom.parentElement)!=null&&x.contains(g.target)?f.dom.parentElement:null,r&&(qf=e)},y=()=>{qf&&(qf=null)};return window.addEventListener("dragstart",p),window.addEventListener("dragend",y),{destroy(){window.removeEventListener("dragstart",p),window.removeEventListener("dragend",y)}}},props:{handleDOMEvents:{drop:(f,p)=>{if(s=r===f.dom.parentElement,a=p,!s){const y=qf;y!=null&&y.isEditable&&setTimeout(()=>{const g=y.state.selection;g&&y.commands.deleteRange({from:g.from,to:g.to})},10)}return!1},paste:(f,p)=>{var y;const g=(y=p.clipboardData)==null?void 0:y.getData("text/html");return o=p,i=!!(g!=null&&g.includes("data-pm-slice")),!1}}},appendTransaction:(f,p,y)=>{const g=f[0],x=g.getMeta("uiEvent")==="paste"&&!i,S=g.getMeta("uiEvent")==="drop"&&!s,C=g.getMeta("applyPasteRules"),E=!!C;if(!x&&!S&&!E)return;if(E){let{text:T}=C;typeof T=="string"?T=T:T=pw(J.from(T),y.schema);const{from:P}=C,A=P+T.length,M=fK(T);return l({rule:h,state:y,from:P,to:{b:A},pasteEvt:M})}const w=p.doc.content.findDiffStart(y.doc.content),b=p.doc.content.findDiffEnd(y.doc.content);if(!(!uK(w)||!b||w===b.b))return l({rule:h,state:y,from:w,to:b,pasteEvt:o})}}))}var T0=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=nT(t),this.schema=bW(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Pc(e.name,this.schema)},r=pe(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return ad([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Pc(r.name,this.schema)},s=[],o=pe(r,"addKeyboardShortcuts",i);let a={};if(r.type==="mark"&&pe(r,"exitable",i)&&(a.ArrowRight=()=>al.handleExit({editor:t,mark:r})),o){const p=Object.fromEntries(Object.entries(o()).map(([y,g])=>[y,()=>g({editor:t})]));a={...a,...p}}const l=_$(a);s.push(l);const d=pe(r,"addInputRules",i);if(bb(r,t.options.enableInputRules)&&d){const p=d();if(p&&p.length){const y=aK({editor:t,rules:p}),g=Array.isArray(y)?y:[y];s.push(...g)}}const h=pe(r,"addPasteRules",i);if(bb(r,t.options.enablePasteRules)&&h){const p=h();if(p&&p.length){const y=pK({editor:t,rules:p});s.push(...y)}}const f=pe(r,"addProseMirrorPlugins",i);if(f){const p=f();s.push(...p)}return s})}get attributes(){return tT(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Ou(this.extensions);return Object.fromEntries(e.filter(n=>!!pe(n,"addNodeView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Bt(n.name,this.schema)},s=pe(n,"addNodeView",i);if(!s)return[];const o=s();if(!o)return[];const a=(l,d,h,f,p)=>{const y=qd(l,r);return o({node:l,view:d,getPos:h,decorations:f,innerDecorations:p,editor:t,extension:n,HTMLAttributes:y})};return[n.name,a]}))}dispatchTransaction(t){const{editor:e}=this;return ad([...this.extensions].reverse()).reduceRight((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Pc(i.name,this.schema)},o=pe(i,"dispatchTransaction",s);return o?a=>{o.call(s,{transaction:a,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return ad([...this.extensions]).reduce((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Pc(i.name,this.schema)},o=pe(i,"transformPastedHTML",s);return o?(a,l)=>{const d=r(a,l);return o.call(s,d)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=Ou(this.extensions);return Object.fromEntries(e.filter(n=>!!pe(n,"addMarkView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:bs(n.name,this.schema)},s=pe(n,"addMarkView",i);if(!s)return[];const o=(a,l,d)=>{const h=qd(a,r);return s()({mark:a,view:l,inline:d,editor:t,extension:n,HTMLAttributes:h,updateAttributes:f=>{TK(a,t,f)}})};return[n.name,o]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Pc(e.name,this.schema)};e.type==="mark"&&((n=Ke(pe(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const i=pe(e,"onBeforeCreate",r),s=pe(e,"onCreate",r),o=pe(e,"onUpdate",r),a=pe(e,"onSelectionUpdate",r),l=pe(e,"onTransaction",r),d=pe(e,"onFocus",r),h=pe(e,"onBlur",r),f=pe(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),d&&this.editor.on("focus",d),h&&this.editor.on("blur",h),f&&this.editor.on("destroy",f)})}};T0.resolve=nT;T0.sort=ad;T0.flatten=fw;var mK={};cw(mK,{ClipboardTextSerializer:()=>fT,Commands:()=>pT,Delete:()=>mT,Drop:()=>gT,Editable:()=>yT,FocusEvents:()=>xT,Keymap:()=>ST,Paste:()=>wT,Tabindex:()=>kT,TextDirection:()=>CT,focusEventsPluginKey:()=>vT});var At=class hT extends gw{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new hT(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},fT=At.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Et({key:new Jt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(h=>h.$from.pos)),a=Math.max(...s.map(h=>h.$to.pos)),l=iT(n);return rT(r,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),pT=At.create({name:"commands",addCommands(){return{...WN}}}),mT=At.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,i;const s=()=>{var o,a,l,d;if((d=(l=(a=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,t))!=null?d:t.getMeta("y-sync$"))return;const h=ZN(t.before,[t,...e]);oT(h).forEach(y=>{h.mapping.mapResult(y.oldRange.from).deletedAfter&&h.mapping.mapResult(y.oldRange.to).deletedBefore&&h.before.nodesBetween(y.oldRange.from,y.oldRange.to,(g,x)=>{const S=x+g.nodeSize-2,C=y.oldRange.from<=x&&S<=y.oldRange.to;this.editor.emit("delete",{type:"node",node:g,from:x,to:S,newFrom:h.mapping.map(x),newTo:h.mapping.map(S),deletedRange:y.oldRange,newRange:y.newRange,partial:!C,editor:this.editor,transaction:t,combinedTransform:h})})});const p=h.mapping;h.steps.forEach((y,g)=>{var x,S;if(y instanceof ii){const C=p.slice(g).map(y.from,-1),E=p.slice(g).map(y.to),w=p.invert().map(C,-1),b=p.invert().map(E),T=C>0?(x=h.doc.nodeAt(C-1))==null?void 0:x.marks.some(A=>A.eq(y.mark)):!1,P=(S=h.doc.nodeAt(E))==null?void 0:S.marks.some(A=>A.eq(y.mark));this.editor.emit("delete",{type:"mark",mark:y.mark,from:y.from,to:y.to,deletedRange:{from:w,to:b},newRange:{from:C,to:E},partial:!!(P||T),editor:this.editor,transaction:t,combinedTransform:h})}})};(i=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||i?setTimeout(s,0):s()}}),gT=At.create({name:"drop",addProseMirrorPlugins(){return[new Et({key:new Jt("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),yT=At.create({name:"editable",addProseMirrorPlugins(){return[new Et({key:new Jt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),vT=new Jt("focusEvents"),xT=At.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Et({key:vT,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),ST=At.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:d}=a,{empty:h,$anchor:f}=l,{pos:p,parent:y}=f,g=f.parent.isTextblock&&p>0?a.doc.resolve(p-1):f,x=g.parent.type.spec.isolating,S=f.pos-f.parentOffset,C=x&&g.parent.childCount===1?S===f.pos:Oe.atStart(d).from===p;return!h||!y.type.isTextblock||y.textContent.length||!C||C&&f.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return vm()||JN()?s:i},addProseMirrorPlugins(){return[new Et({key:new Jt("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(x=>x.getMeta("composition")))return;const r=t.some(x=>x.docChanged)&&!e.doc.eq(n.doc),i=t.some(x=>x.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:a}=e.selection,l=Oe.atStart(e.doc).from,d=Oe.atEnd(e.doc).to;if(s||!(o===l&&a===d)||!_0(n.doc))return;const p=n.tr,y=k0({state:n,transaction:p}),{commands:g}=new C0({editor:this.editor,state:y});if(g.clearNodes(),!!p.steps.length)return p}})]}}),wT=At.create({name:"paste",addProseMirrorPlugins(){return[new Et({key:new Jt("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),kT=At.create({name:"tabindex",addProseMirrorPlugins(){return[new Et({key:new Jt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),CT=At.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Ou(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Et({key:new Jt("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),gK=class Vc{constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You cant set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Vc(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Vc(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Vc(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,o=n.isInline,a=this.pos+r+(s?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!i&&!o&&l.depth<=this.depth)return;const d=new Vc(l,this.editor,i,i||o?n:null);i&&(d.actualDepth=this.depth+1),e.push(d)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,o=Object.keys(n);for(let a=0;a<o.length;a+=1){const l=o[a];if(s[l]!==n[l])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(l=>n[l]===o.node.attrs[l])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},yK=`.ProseMirror {
position: relative;
}
.ProseMirror {
word-wrap: break-word;
white-space: pre-wrap;
white-space: break-spaces;
-webkit-font-variant-ligatures: none;
font-variant-ligatures: none;
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
}
.ProseMirror [contenteditable="false"] {
white-space: normal;
}
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
white-space: pre-wrap;
}
.ProseMirror pre {
white-space: pre-wrap;
}
img.ProseMirror-separator {
display: inline !important;
border: none !important;
margin: 0 !important;
width: 0 !important;
height: 0 !important;
}
.ProseMirror-gapcursor {
display: none;
pointer-events: none;
position: absolute;
margin: 0;
}
.ProseMirror-gapcursor:after {
content: "";
display: block;
position: absolute;
top: -2px;
width: 20px;
border-top: 1px solid black;
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
}
@keyframes ProseMirror-cursor-blink {
to {
visibility: hidden;
}
}
.ProseMirror-hideselection *::selection {
background: transparent;
}
.ProseMirror-hideselection *::-moz-selection {
background: transparent;
}
.ProseMirror-hideselection * {
caret-color: transparent;
}
.ProseMirror-focused .ProseMirror-gapcursor {
display: block;
}`;function vK(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}var xK=class extends sK{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:IW,createMappablePosition:DW},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:i,moved:s})=>this.options.onDrop(r,i,s)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=QN(e,this.options.autofocus);this.editorState=Kl.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t!=null&&t.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=vK(yK,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=eT(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;n=n.filter(o=>!o.key.startsWith(s))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[yT,fT.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),pT,xT,ST,kT,gT,wT,mT,CT.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i==null?void 0:i.type));this.extensionManager=new T0(r,this)}createCommandManager(){this.commandManager=new C0({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=nx(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=nx(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,s=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(s);this.editorView=new GN(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS();const l=this.view.dom;l.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(d=>{var h;return(h=this.capturedTransaction)==null?void 0:h.step(d)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),i=n.includes(t),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(d=>d.getMeta("focus")||d.getMeta("blur")),a=o==null?void 0:o.getMeta("focus"),l=o==null?void 0:o.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(d=>d.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return sT(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return AW(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return pw(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
`,textSerializers:n={}}=t||{};return _W(this.state.doc,{blockSeparator:e,textSerializers:{...iT(this.schema),...n}})}get isEmpty(){return _0(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new gK(e,this)}get $doc(){return this.$pos(0)}};function Au(t){return new N0({find:t.find,handler:({state:e,range:n,match:r})=>{const i=Ke(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),d=n.from+a.indexOf(o),h=d+o.length;if(mw(n.from,n.to,e.doc).filter(y=>y.mark.type.excluded.find(x=>x===t.type&&x!==y.mark.type)).filter(y=>y.to>d).length)return null;h<n.to&&s.delete(h,n.to),d>n.from&&s.delete(n.from+l,d);const p=n.from+l+o.length;s.addMark(n.from+l,p,t.type.create(i||{})),s.removeStoredMark(t.type)}},undoable:t.undoable})}function SK(t){return new N0({find:t.find,handler:({state:e,range:n,match:r})=>{const i=Ke(t.getAttributes,void 0,r)||{},{tr:s}=e,o=n.from;let a=n.to;const l=t.type.create(i);if(r[1]){const d=r[0].lastIndexOf(r[1]);let h=o+d;h>a?h=a:a=h+r[1].length;const f=r[0][r[0].length-1];s.insertText(f,o+r[0].length-1),s.replaceWith(h,a,l)}else if(r[0]){const d=t.type.isInline?o:o-1;s.insert(d,t.type.create(i)).delete(s.mapping.map(o),s.mapping.map(a))}s.scrollIntoView()},undoable:t.undoable})}function ix(t){return new N0({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=Ke(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)},undoable:t.undoable})}function Ru(t){return new N0({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=Ke(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),l=o.doc.resolve(n.from).blockRange(),d=l&&qS(l,t.type,s);if(!d)return null;if(o.wrap(l,d),t.keepMarks&&t.editor){const{selection:f,storedMarks:p}=e,{splittableMarks:y}=t.editor.extensionManager,g=p||f.$to.parentOffset&&f.$from.marks();if(g){const x=g.filter(S=>y.includes(S.type.name));o.ensureMarks(x)}}if(t.keepAttributes){const f=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(f,s).run()}const h=o.doc.resolve(n.from-1).nodeBefore;h&&h.type===t.type&&Ho(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,h))&&o.join(n.from-1)},undoable:t.undoable})}function wK(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof ye){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}var kK={};cw(kK,{createAtomBlockMarkdownSpec:()=>CK,createBlockMarkdownSpec:()=>bK,createInlineMarkdownSpec:()=>NK,parseAttributes:()=>yw,parseIndentedBlocks:()=>sx,renderNestedMarkdownContent:()=>xw,serializeAttributes:()=>vw});function yw(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,d=>(n.push(d),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const d=i.map(h=>h.trim().slice(1));e.class=d.join(" ")}const s=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,d,h])=>{var f;const p=parseInt(((f=h.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),y=n[p];y&&(e[d]=y.slice(1,-1))});const l=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(h=>{h.match(/^[a-zA-Z][\w-]*$/)&&(e[h]=!0)}),e}function vw(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function CK(t){const{nodeName:e,name:n,parseAttributes:r=yw,serializeAttributes:i=vw,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:a}=t,l=n||e,d=h=>{if(!a)return h;const f={};return a.forEach(p=>{p in h&&(f[p]=h[p])}),f};return{parseMarkdown:(h,f)=>{const p={...s,...h.attributes};return f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"block",start(h){var f;const p=new RegExp(`^:::${l}(?:\\s|$)`,"m"),y=(f=h.match(p))==null?void 0:f.index;return y!==void 0?y:-1},tokenize(h,f,p){const y=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),g=h.match(y);if(!g)return;const x=g[1]||"",S=r(x);if(!o.find(E=>!(E in S)))return{type:e,raw:g[0],attributes:S}}},renderMarkdown:h=>{const f=d(h.attrs||{}),p=i(f),y=p?` {${p}}`:"";return`:::${l}${y} :::`}}}function bK(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=yw,serializeAttributes:s=vw,defaultAttributes:o={},content:a="block",allowedAttributes:l}=t,d=n||e,h=f=>{if(!l)return f;const p={};return l.forEach(y=>{y in f&&(p[y]=f[y])}),p};return{parseMarkdown:(f,p)=>{let y;if(r){const x=r(f);y=typeof x=="string"?[{type:"text",text:x}]:x}else a==="block"?y=p.parseChildren(f.tokens||[]):y=p.parseInline(f.tokens||[]);const g={...o,...f.attributes};return p.createNode(e,g,y)},markdownTokenizer:{name:e,level:"block",start(f){var p;const y=new RegExp(`^:::${d}`,"m"),g=(p=f.match(y))==null?void 0:p.index;return g!==void 0?g:-1},tokenize(f,p,y){var g;const x=new RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),S=f.match(x);if(!S)return;const[C,E=""]=S,w=i(E);let b=1;const T=C.length;let P="";const A=/^:::([\w-]*)(\s.*)?/gm,M=f.slice(T);for(A.lastIndex=0;;){const I=A.exec(M);if(I===null)break;const R=I.index,U=I[1];if(!((g=I[2])!=null&&g.endsWith(":::"))){if(U)b+=1;else if(b-=1,b===0){const B=M.slice(0,R);P=B.trim();const $=f.slice(0,T+R+I[0].length);let Q=[];if(P)if(a==="block")for(Q=y.blockTokens(B),Q.forEach(q=>{q.text&&(!q.tokens||q.tokens.length===0)&&(q.tokens=y.inlineTokens(q.text))});Q.length>0;){const q=Q[Q.length-1];if(q.type==="paragraph"&&(!q.text||q.text.trim()===""))Q.pop();else break}else Q=y.inlineTokens(P);return{type:e,raw:$,attributes:w,content:P,tokens:Q}}}}}},renderMarkdown:(f,p)=>{const y=h(f.attrs||{}),g=s(y),x=g?` {${g}}`:"",S=p.renderChildren(f.content||[],`
`);return`:::${d}${x}
${S}
:::`}}}function EK(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,i,s,o]=r;e[i]=s||o,r=n.exec(t)}return e}function _K(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function NK(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=EK,serializeAttributes:s=_K,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:l}=t,d=n||e,h=p=>{if(!l)return p;const y={};return l.forEach(g=>{const x=typeof g=="string"?g:g.name,S=typeof g=="string"?void 0:g.skipIfDefault;if(x in p){const C=p[x];if(S!==void 0&&C===S)return;y[x]=C}}),y},f=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(p,y)=>{const g={...o,...p.attributes};if(a)return y.createNode(e,g);const x=r?r(p):p.content||"";return x?y.createNode(e,g,[y.createTextNode(x)]):y.createNode(e,g,[])},markdownTokenizer:{name:e,level:"inline",start(p){const y=a?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),g=p.match(y),x=g==null?void 0:g.index;return x!==void 0?x:-1},tokenize(p,y,g){const x=a?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),S=p.match(x);if(!S)return;let C="",E="";if(a){const[,b]=S;E=b}else{const[,b,T]=S;E=b,C=T||""}const w=i(E.trim());return{type:e,raw:S[0],content:C.trim(),attributes:w}}},renderMarkdown:p=>{let y="";r?y=r(p):p.content&&p.content.length>0&&(y=p.content.filter(C=>C.type==="text").map(C=>C.text).join(""));const g=h(p.attrs||{}),x=s(g),S=x?` ${x}`:"";return a?`[${d}${S}]`:`[${d}${S}]${y}[/${d}]`}}}function sx(t,e,n){var r,i,s,o;const a=t.split(`
`),l=[];let d="",h=0;const f=e.baseIndentSize||2;for(;h<a.length;){const p=a[h],y=p.match(e.itemPattern);if(!y){if(l.length>0)break;if(p.trim()===""){h+=1,d=`${d}${p}
`;continue}else return}const g=e.extractItemData(y),{indentLevel:x,mainContent:S}=g;d=`${d}${p}
`;const C=[S];for(h+=1;h<a.length;){const T=a[h];if(T.trim()===""){const A=a.slice(h+1).findIndex(R=>R.trim()!=="");if(A===-1)break;if((((i=(r=a[h+1+A].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>x){C.push(T),d=`${d}${T}
`,h+=1;continue}else break}if((((o=(s=T.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:o.length)||0)>x)C.push(T),d=`${d}${T}
`,h+=1;else break}let E;const w=C.slice(1);if(w.length>0){const T=w.map(P=>P.slice(x+f)).join(`
`);T.trim()&&(e.customNestedParser?E=e.customNestedParser(T):E=n.blockTokens(T))}const b=e.createToken(g,E);l.push(b)}if(l.length!==0)return{items:l,raw:d}}function xw(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const i=typeof n=="function"?n(r):n,[s,...o]=t.content,a=e.renderChildren([s]);let l=`${i}${a}`;return o&&o.length>0&&o.forEach((d,h)=>{var f,p;const y=(p=(f=e.renderChild)==null?void 0:f.call(e,d,h+1))!=null?p:e.renderChildren([d]);if(y!=null){const g=y.split(`
`).map(x=>x?e.indent(x):e.indent("")).join(`
`);l+=d.type==="paragraph"?`
${g}`:`
${g}`}}),l}function TK(t,e,n={}){const{state:r}=e,{doc:i,tr:s}=r,o=t;i.descendants((a,l)=>{const d=s.mapping.map(l),h=s.mapping.map(l)+a.nodeSize;let f=null;if(a.marks.forEach(y=>{if(y!==o)return!1;f=y}),!f)return;let p=!1;if(Object.keys(n).forEach(y=>{n[y]!==f.attrs[y]&&(p=!0)}),p){const y=t.type.create({...t.attrs,...n});s.removeMark(d,h,t.type),s.addMark(d,h,y)}}),s.docChanged&&e.view.dispatch(s)}var xr=class bT extends gw{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new bT(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function qa(t){return new cK({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=Ke(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let d=n.to;if(a){const h=l.search(/\S/),f=n.from+l.indexOf(a),p=f+a.length;if(mw(n.from,n.to,e.doc).filter(x=>x.mark.type.excluded.find(C=>C===t.type&&C!==x.mark.type)).filter(x=>x.to>f).length)return null;p<n.to&&o.delete(p,n.to),f>n.from&&o.delete(n.from+h,f),d=n.from+h+a.length,o.addMark(n.from+h,d,t.type.create(s||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:MK,getOwnPropertySymbols:PK}=Object,{hasOwnProperty:OK}=Object.prototype;function n2(t,e){return function(r,i,s){return t(r,i,s)&&e(r,i,s)}}function Qf(t){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i);const{cache:s}=i,o=s.get(n),a=s.get(r);if(o&&a)return o===r&&a===n;s.set(n,r),s.set(r,n);const l=t(n,r,i);return s.delete(n),s.delete(r),l}}function AK(t){return t!=null?t[Symbol.toStringTag]:void 0}function _b(t){return MK(t).concat(PK(t))}const RK=Object.hasOwn||((t,e)=>OK.call(t,e));function ll(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const LK="__v",IK="__o",DK="_owner",{getOwnPropertyDescriptor:Nb,keys:Tb}=Object;function FK(t,e){return t.byteLength===e.byteLength&&xm(new Uint8Array(t),new Uint8Array(e))}function jK(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function zK(t,e){return t.byteLength===e.byteLength&&xm(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function BK(t,e){return ll(t.getTime(),e.getTime())}function UK(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function HK(t,e){return t===e}function Mb(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=t.entries();let o,a,l=0;for(;(o=s.next())&&!o.done;){const d=e.entries();let h=!1,f=0;for(;(a=d.next())&&!a.done;){if(i[f]){f++;continue}const p=o.value,y=a.value;if(n.equals(p[0],y[0],l,f,t,e,n)&&n.equals(p[1],y[1],p[0],y[0],t,e,n)){h=i[f]=!0;break}f++}if(!h)return!1;l++}return!0}const VK=ll;function GK(t,e,n){const r=Tb(t);let i=r.length;if(Tb(e).length!==i)return!1;for(;i-- >0;)if(!ET(t,e,n,r[i]))return!1;return!0}function Oc(t,e,n){const r=_b(t);let i=r.length;if(_b(e).length!==i)return!1;let s,o,a;for(;i-- >0;)if(s=r[i],!ET(t,e,n,s)||(o=Nb(t,s),a=Nb(e,s),(o||a)&&(!o||!a||o.configurable!==a.configurable||o.enumerable!==a.enumerable||o.writable!==a.writable)))return!1;return!0}function $K(t,e){return ll(t.valueOf(),e.valueOf())}function WK(t,e){return t.source===e.source&&t.flags===e.flags}function Pb(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=t.values();let o,a;for(;(o=s.next())&&!o.done;){const l=e.values();let d=!1,h=0;for(;(a=l.next())&&!a.done;){if(!i[h]&&n.equals(o.value,a.value,o.value,a.value,t,e,n)){d=i[h]=!0;break}h++}if(!d)return!1}return!0}function xm(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function KK(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function ET(t,e,n,r){return(r===DK||r===IK||r===LK)&&(t.$$typeof||e.$$typeof)?!0:RK(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const qK="[object ArrayBuffer]",QK="[object Arguments]",YK="[object Boolean]",JK="[object DataView]",XK="[object Date]",ZK="[object Error]",eq="[object Map]",tq="[object Number]",nq="[object Object]",rq="[object RegExp]",iq="[object Set]",sq="[object String]",oq={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},aq="[object URL]",lq=Object.prototype.toString;function uq({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:s,areMapsEqual:o,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:d,areRegExpsEqual:h,areSetsEqual:f,areTypedArraysEqual:p,areUrlsEqual:y,unknownTagComparators:g}){return function(S,C,E){if(S===C)return!0;if(S==null||C==null)return!1;const w=typeof S;if(w!==typeof C)return!1;if(w!=="object")return w==="number"?a(S,C,E):w==="function"?s(S,C,E):!1;const b=S.constructor;if(b!==C.constructor)return!1;if(b===Object)return l(S,C,E);if(Array.isArray(S))return e(S,C,E);if(b===Date)return r(S,C,E);if(b===RegExp)return h(S,C,E);if(b===Map)return o(S,C,E);if(b===Set)return f(S,C,E);const T=lq.call(S);if(T===XK)return r(S,C,E);if(T===rq)return h(S,C,E);if(T===eq)return o(S,C,E);if(T===iq)return f(S,C,E);if(T===nq)return typeof S.then!="function"&&typeof C.then!="function"&&l(S,C,E);if(T===aq)return y(S,C,E);if(T===ZK)return i(S,C,E);if(T===QK)return l(S,C,E);if(oq[T])return p(S,C,E);if(T===qK)return t(S,C,E);if(T===JK)return n(S,C,E);if(T===YK||T===tq||T===sq)return d(S,C,E);if(g){let P=g[T];if(!P){const A=AK(S);A&&(P=g[A])}if(P)return P(S,C,E)}return!1}}function cq({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:FK,areArraysEqual:n?Oc:jK,areDataViewsEqual:zK,areDatesEqual:BK,areErrorsEqual:UK,areFunctionsEqual:HK,areMapsEqual:n?n2(Mb,Oc):Mb,areNumbersEqual:VK,areObjectsEqual:n?Oc:GK,arePrimitiveWrappersEqual:$K,areRegExpsEqual:WK,areSetsEqual:n?n2(Pb,Oc):Pb,areTypedArraysEqual:n?n2(xm,Oc):xm,areUrlsEqual:KK,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const i=Qf(r.areArraysEqual),s=Qf(r.areMapsEqual),o=Qf(r.areObjectsEqual),a=Qf(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:s,areObjectsEqual:o,areSetsEqual:a})}return r}function dq(t){return function(e,n,r,i,s,o,a){return t(e,n,a)}}function hq({circular:t,comparator:e,createState:n,equals:r,strict:i}){if(n)return function(a,l){const{cache:d=t?new WeakMap:void 0,meta:h}=n();return e(a,l,{cache:d,equals:r,meta:h,strict:i})};if(t)return function(a,l){return e(a,l,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const s={cache:void 0,equals:r,meta:void 0,strict:i};return function(a,l){return e(a,l,s)}}const fq=Go();Go({strict:!0});Go({circular:!0});Go({circular:!0,strict:!0});Go({createInternalComparator:()=>ll});Go({strict:!0,createInternalComparator:()=>ll});Go({circular:!0,createInternalComparator:()=>ll});Go({circular:!0,createInternalComparator:()=>ll,strict:!0});function Go(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:i=!1}=t,s=cq(t),o=uq(s),a=n?n(o):dq(o);return hq({circular:e,comparator:o,createState:r,equals:a,strict:i})}var pq=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},mq=({contentComponent:t})=>{const e=mg.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return N.jsx(N.Fragment,{children:Object.values(e)})};function gq(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:dA.createPortal(r.reactElement,r.element,n)},t.forEach(i=>i())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(i=>i())}}}var yq=class extends ct.Component{constructor(t){super(t),this.editorContentRef=ct.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=gq(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var t;const e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return N.jsxs(N.Fragment,{children:[N.jsx("div",{ref:pq(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&N.jsx(mq,{contentComponent:t.contentComponent})]})}},vq=z.forwardRef((t,e)=>{const n=ct.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return ct.createElement(yq,{key:n,innerRef:e,...t})}),_T=ct.memo(vq),xq=typeof window<"u"?z.useLayoutEffect:z.useEffect,Sq=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function wq(t){var e;const[n]=z.useState(()=>new Sq(t.editor)),r=r_.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:fq);return xq(()=>n.watch(t.editor),[t.editor,n]),z.useDebugValue(r),r}var kq=!1,ox=typeof window>"u",Cq=ox||!!(typeof window<"u"&&window.next),bq=class NT{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?ox||Cq?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onBeforeCreate)==null?void 0:s.call(i,...r)},onBlur:(...r)=>{var i,s;return(s=(i=this.options.current).onBlur)==null?void 0:s.call(i,...r)},onCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onCreate)==null?void 0:s.call(i,...r)},onDestroy:(...r)=>{var i,s;return(s=(i=this.options.current).onDestroy)==null?void 0:s.call(i,...r)},onFocus:(...r)=>{var i,s;return(s=(i=this.options.current).onFocus)==null?void 0:s.call(i,...r)},onSelectionUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onSelectionUpdate)==null?void 0:s.call(i,...r)},onTransaction:(...r)=>{var i,s;return(s=(i=this.options.current).onTransaction)==null?void 0:s.call(i,...r)},onUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onUpdate)==null?void 0:s.call(i,...r)},onContentError:(...r)=>{var i,s;return(s=(i=this.options.current).onContentError)==null?void 0:s.call(i,...r)},onDrop:(...r)=>{var i,s;return(s=(i=this.options.current).onDrop)==null?void 0:s.call(i,...r)},onPaste:(...r)=>{var i,s;return(s=(i=this.options.current).onPaste)==null?void 0:s.call(i,...r)},onDelete:(...r)=>{var i,s;return(s=(i=this.options.current).onDelete)==null?void 0:s.call(i,...r)}};return new xK(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((i,s)=>{var o;return i===((o=n.extensions)==null?void 0:o[s])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?NT.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,i)=>r===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Eq(t={},e=[]){const n=z.useRef(t);n.current=t;const[r]=z.useState(()=>new bq(n)),i=mg.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return z.useDebugValue(i),z.useEffect(r.onRender(e)),wq({editor:i,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&s===0?0:s+1}),i}var TT=z.createContext({editor:null});TT.Consumer;var _q=z.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Nq=()=>z.useContext(_q);ct.forwardRef((t,e)=>{const{onDragStart:n}=Nq(),r=t.as||"div";return N.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});ct.createContext({markViewContentRef:()=>{}});var Sw=z.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Sw.displayName="TiptapContext";var Tq=()=>z.useContext(Sw);function MT({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const i=z.useMemo(()=>({editor:r}),[r]),s=z.useMemo(()=>({editor:r}),[r]);return N.jsx(TT.Provider,{value:s,children:N.jsx(Sw.Provider,{value:i,children:n})})}MT.displayName="Tiptap";function PT({...t}){const{editor:e}=Tq();return N.jsx(_T,{editor:e,...t})}PT.displayName="Tiptap.Content";Object.assign(MT,{Content:PT});var Sm=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},Mq=/^\s*>\s$/,Pq=xr.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Sm("blockquote",{...Ut(this.options.HTMLAttributes,t),children:Sm("slot",{})})},parseMarkdown:(t,e)=>{var n;const r=(n=e.parseBlockChildren)!=null?n:e.parseChildren;return e.createNode("blockquote",void 0,r(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach((i,s)=>{var o,a;const h=((a=(o=e.renderChild)==null?void 0:o.call(e,i,s))!=null?a:e.renderChildren([i])).split(`
`).map(f=>f.trim()===""?n:`${n} ${f}`);r.push(h.join(`
`))}),r.join(`
${n}
`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Ru({find:Mq,type:this.type})]}}),Oq=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Aq=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Rq=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Lq=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Iq=al.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return Sm("strong",{...Ut(this.options.HTMLAttributes,t),children:Sm("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Au({find:Oq,type:this.type}),Au({find:Rq,type:this.type})]},addPasteRules(){return[qa({find:Aq,type:this.type}),qa({find:Lq,type:this.type})]}}),Dq=/(^|[^`])`([^`]+)`(?!`)$/,Fq=/(^|[^`])`([^`]+)`(?!`)/g,jq=al.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Ut(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Au({find:Dq,type:this.type})]},addPasteRules(){return[qa({find:Fq,type:this.type})]}}),r2=4,zq=/^```([a-z]+)?[\s\n]$/,Bq=/^~~~([a-z]+)?[\s\n]$/,Uq=xr.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:r2,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const s=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Ut(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&((r=t.raw)==null?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const i=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${i}`,e.renderChildren(t.content),"```"].join(`
`):r=`\`\`\`${i}
\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:r2,{state:r}=t,{selection:i}=r,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;const a=" ".repeat(n);return o?t.commands.insertContent(a):t.commands.command(({tr:l})=>{const{from:d,to:h}=i,y=r.doc.textBetween(d,h,`
`,`
`).split(`
`).map(g=>a+g).join(`
`);return l.replaceWith(d,h,r.schema.text(y)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:r2,{state:r}=t,{selection:i}=r,{$from:s,empty:o}=i;return s.parent.type!==this.type?!1:o?t.commands.command(({tr:a})=>{var l;const{pos:d}=s,h=s.start(),f=s.end(),y=r.doc.textBetween(h,f,`
`,`
`).split(`
`);let g=0,x=0;const S=d-h;for(let P=0;P<y.length;P+=1){if(x+y[P].length>=S){g=P;break}x+=y[P].length+1}const E=((l=y[g].match(/^ */))==null?void 0:l[0])||"",w=Math.min(E.length,n);if(w===0)return!0;let b=h;for(let P=0;P<g;P+=1)b+=y[P].length+1;return a.delete(b,b+w),d-b<=w&&a.setSelection(we.create(a.doc,b)),!0}):t.commands.command(({tr:a})=>{const{from:l,to:d}=i,p=r.doc.textBetween(l,d,`
`,`
`).split(`
`).map(y=>{var g;const x=((g=y.match(/^ */))==null?void 0:g[0])||"",S=Math.min(x.length,n);return y.slice(S)}).join(`
`);return a.replaceWith(l,d,r.schema.text(p)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
`);return!s||!o?!1:t.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const a=i.after();return a===void 0?!1:r.nodeAt(a)?t.commands.command(({tr:d})=>(d.setSelection(Oe.near(r.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return[ix({find:zq,type:this.type,getAttributes:t=>({language:t[1]})}),ix({find:Bq,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Et({key:new Jt("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i==null?void 0:i.mode;if(!n||!s)return!1;const{tr:o,schema:a}=t.state,l=a.text(n.replace(/\r\n?/g,`
`));return o.replaceSelectionWith(this.type.create({language:s},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(we.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),Hq=xr.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
`):""}),Vq=xr.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Ut(this.options.HTMLAttributes,t)]},renderText(){return`
`},renderMarkdown:()=>`
`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:s}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,l=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:h})=>{if(h&&l&&o){const f=l.filter(p=>a.includes(p.type.name));d.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Gq=xr.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Ut(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,i="#".repeat(r);return t.content?`${i} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>ix({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),$q=xr.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Ut(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!wK(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,i=t();return aT(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:s,tr:o,dispatch:a})=>{if(a){const{$to:l}=o.selection,d=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?o.setSelection(we.create(o.doc,l.pos+1)):l.nodeAfter.isBlock?o.setSelection(ye.create(o.doc,l.pos)):o.setSelection(we.create(o.doc,l.pos));else{const h=s.schema.nodes[this.options.nextNodeType]||l.parent.type.contentMatch.defaultType,f=h==null?void 0:h.create();f&&(o.insert(d,f),o.setSelection(we.create(o.doc,d+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[SK({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Wq=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Kq=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,qq=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Qq=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Yq=al.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Ut(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Au({find:Wq,type:this.type}),Au({find:qq,type:this.type})]},addPasteRules(){return[qa({find:Kq,type:this.type}),qa({find:Qq,type:this.type})]}});const Jq="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Xq="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3украз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراهاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരത5ලකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",ax="numeric",lx="ascii",ux="alpha",ld="asciinumeric",Gc="alphanumeric",cx="domain",OT="emoji",Zq="scheme",eQ="slashscheme",i2="whitespace";function tQ(t,e){return t in e||(e[t]=[]),e[t]}function ga(t,e,n){e[ax]&&(e[ld]=!0,e[Gc]=!0),e[lx]&&(e[ld]=!0,e[ux]=!0),e[ld]&&(e[Gc]=!0),e[ux]&&(e[Gc]=!0),e[Gc]&&(e[cx]=!0),e[OT]&&(e[cx]=!0);for(const r in e){const i=tQ(r,n);i.indexOf(t)<0&&i.push(t)}}function nQ(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Zn(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Zn.groups={};Zn.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],s=e.jr[r][1];if(s&&i.test(t))return s}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){r=r||Zn.groups;let i;return e&&e.j?i=e:(i=new Zn(e),n&&r&&ga(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const s=t.length;if(!s)return i;for(let o=0;o<s-1;o++)i=i.tt(t[o]);return i.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||Zn.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const s=e;let o,a=i.go(t);if(a?(o=new Zn,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new Zn,s){if(r)if(o.t&&typeof o.t=="string"){const l=Object.assign(nQ(o.t,r),n);ga(s,l,r)}else n&&ga(s,n,r);o.t=s}return i.j[t]=o,o}};const Pe=(t,e,n,r,i)=>t.ta(e,n,r,i),_t=(t,e,n,r,i)=>t.tr(e,n,r,i),Ob=(t,e,n,r,i)=>t.ts(e,n,r,i),Z=(t,e,n,r,i)=>t.tt(e,n,r,i),Ji="WORD",dx="UWORD",AT="ASCIINUMERICAL",RT="ALPHANUMERICAL",Qd="LOCALHOST",hx="TLD",fx="UTLD",Cp="SCHEME",Ll="SLASH_SCHEME",ww="NUM",px="WS",kw="NL",ud="OPENBRACE",cd="CLOSEBRACE",wm="OPENBRACKET",km="CLOSEBRACKET",Cm="OPENPAREN",bm="CLOSEPAREN",Em="OPENANGLEBRACKET",_m="CLOSEANGLEBRACKET",Nm="FULLWIDTHLEFTPAREN",Tm="FULLWIDTHRIGHTPAREN",Mm="LEFTCORNERBRACKET",Pm="RIGHTCORNERBRACKET",Om="LEFTWHITECORNERBRACKET",Am="RIGHTWHITECORNERBRACKET",Rm="FULLWIDTHLESSTHAN",Lm="FULLWIDTHGREATERTHAN",Im="AMPERSAND",Dm="APOSTROPHE",Fm="ASTERISK",Ws="AT",jm="BACKSLASH",zm="BACKTICK",Bm="CARET",Js="COLON",Cw="COMMA",Um="DOLLAR",Ci="DOT",Hm="EQUALS",bw="EXCLAMATION",Or="HYPHEN",dd="PERCENT",Vm="PIPE",Gm="PLUS",$m="POUND",hd="QUERY",Ew="QUOTE",LT="FULLWIDTHMIDDLEDOT",_w="SEMI",bi="SLASH",fd="TILDE",Wm="UNDERSCORE",IT="EMOJI",Km="SYM";var DT=Object.freeze({__proto__:null,ALPHANUMERICAL:RT,AMPERSAND:Im,APOSTROPHE:Dm,ASCIINUMERICAL:AT,ASTERISK:Fm,AT:Ws,BACKSLASH:jm,BACKTICK:zm,CARET:Bm,CLOSEANGLEBRACKET:_m,CLOSEBRACE:cd,CLOSEBRACKET:km,CLOSEPAREN:bm,COLON:Js,COMMA:Cw,DOLLAR:Um,DOT:Ci,EMOJI:IT,EQUALS:Hm,EXCLAMATION:bw,FULLWIDTHGREATERTHAN:Lm,FULLWIDTHLEFTPAREN:Nm,FULLWIDTHLESSTHAN:Rm,FULLWIDTHMIDDLEDOT:LT,FULLWIDTHRIGHTPAREN:Tm,HYPHEN:Or,LEFTCORNERBRACKET:Mm,LEFTWHITECORNERBRACKET:Om,LOCALHOST:Qd,NL:kw,NUM:ww,OPENANGLEBRACKET:Em,OPENBRACE:ud,OPENBRACKET:wm,OPENPAREN:Cm,PERCENT:dd,PIPE:Vm,PLUS:Gm,POUND:$m,QUERY:hd,QUOTE:Ew,RIGHTCORNERBRACKET:Pm,RIGHTWHITECORNERBRACKET:Am,SCHEME:Cp,SEMI:_w,SLASH:bi,SLASH_SCHEME:Ll,SYM:Km,TILDE:fd,TLD:hx,UNDERSCORE:Wm,UTLD:fx,UWORD:dx,WORD:Ji,WS:px});const Ki=/[a-z]/,Ac=new RegExp("\\p{L}","u"),s2=new RegExp("\\p{Emoji}","u"),qi=/\d/,o2=/\s/,Ab="\r",a2=`
`,rQ="",iQ="",l2="";let Yf=null,Jf=null;function sQ(t=[]){const e={};Zn.groups=e;const n=new Zn;Yf==null&&(Yf=Rb(Jq)),Jf==null&&(Jf=Rb(Xq)),Z(n,"'",Dm),Z(n,"{",ud),Z(n,"}",cd),Z(n,"[",wm),Z(n,"]",km),Z(n,"(",Cm),Z(n,")",bm),Z(n,"<",Em),Z(n,">",_m),Z(n,"",Nm),Z(n,"",Tm),Z(n,"",Mm),Z(n,"",Pm),Z(n,"",Om),Z(n,"",Am),Z(n,"",Rm),Z(n,"",Lm),Z(n,"&",Im),Z(n,"*",Fm),Z(n,"@",Ws),Z(n,"`",zm),Z(n,"^",Bm),Z(n,":",Js),Z(n,",",Cw),Z(n,"$",Um),Z(n,".",Ci),Z(n,"=",Hm),Z(n,"!",bw),Z(n,"-",Or),Z(n,"%",dd),Z(n,"|",Vm),Z(n,"+",Gm),Z(n,"#",$m),Z(n,"?",hd),Z(n,'"',Ew),Z(n,"/",bi),Z(n,";",_w),Z(n,"~",fd),Z(n,"_",Wm),Z(n,"\\",jm),Z(n,"・",LT);const r=_t(n,qi,ww,{[ax]:!0});_t(r,qi,r);const i=_t(r,Ki,AT,{[ld]:!0}),s=_t(r,Ac,RT,{[Gc]:!0}),o=_t(n,Ki,Ji,{[lx]:!0});_t(o,qi,i),_t(o,Ki,o),_t(i,qi,i),_t(i,Ki,i);const a=_t(n,Ac,dx,{[ux]:!0});_t(a,Ki),_t(a,qi,s),_t(a,Ac,a),_t(s,qi,s),_t(s,Ki),_t(s,Ac,s);const l=Z(n,a2,kw,{[i2]:!0}),d=Z(n,Ab,px,{[i2]:!0}),h=_t(n,o2,px,{[i2]:!0});Z(n,l2,h),Z(d,a2,l),Z(d,l2,h),_t(d,o2,h),Z(h,Ab),Z(h,a2),_t(h,o2,h),Z(h,l2,h);const f=_t(n,s2,IT,{[OT]:!0});Z(f,"#"),_t(f,s2,f),Z(f,rQ,f);const p=Z(f,iQ);Z(p,"#"),_t(p,s2,f);const y=[[Ki,o],[qi,i]],g=[[Ki,null],[Ac,a],[qi,s]];for(let x=0;x<Yf.length;x++)zs(n,Yf[x],hx,Ji,y);for(let x=0;x<Jf.length;x++)zs(n,Jf[x],fx,dx,g);ga(hx,{tld:!0,ascii:!0},e),ga(fx,{utld:!0,alpha:!0},e),zs(n,"file",Cp,Ji,y),zs(n,"mailto",Cp,Ji,y),zs(n,"http",Ll,Ji,y),zs(n,"https",Ll,Ji,y),zs(n,"ftp",Ll,Ji,y),zs(n,"ftps",Ll,Ji,y),ga(Cp,{scheme:!0,ascii:!0},e),ga(Ll,{slashscheme:!0,ascii:!0},e),t=t.sort((x,S)=>x[0]>S[0]?1:-1);for(let x=0;x<t.length;x++){const S=t[x][0],E=t[x][1]?{[Zq]:!0}:{[eQ]:!0};S.indexOf("-")>=0?E[cx]=!0:Ki.test(S)?qi.test(S)?E[ld]=!0:E[lx]=!0:E[ax]=!0,Ob(n,S,S,E)}return Ob(n,"localhost",Qd,{ascii:!0}),n.jd=new Zn(Km),{start:n,tokens:Object.assign({groups:e},DT)}}function FT(t,e){const n=oQ(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,i=[];let s=0,o=0;for(;o<r;){let a=t,l=null,d=0,h=null,f=-1,p=-1;for(;o<r&&(l=a.go(n[o]));)a=l,a.accepts()?(f=0,p=0,h=a):f>=0&&(f+=n[o].length,p++),d+=n[o].length,s+=n[o].length,o++;s-=f,o-=p,d-=f,i.push({t:h.t,v:e.slice(s-d,s),s:s-d,e:s})}return i}function oQ(t){const e=[],n=t.length;let r=0;for(;r<n;){let i=t.charCodeAt(r),s,o=i<55296||i>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function zs(t,e,n,r,i){let s;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];t.j[l]?s=t.j[l]:(s=new Zn(r),s.jr=i.slice(),t.j[l]=s),t=s}return s=new Zn(n),s.jr=i.slice(),t.j[e[o-1]]=s,s}function Rb(t){const e=[],n=[];let r=0,i="0123456789";for(;r<t.length;){let s=0;for(;i.indexOf(t[r+s])>=0;)s++;if(s>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+s),10);o>0;o--)n.pop();r+=s}else n.push(t[r]),r++}return e}const Yd={defaultProtocol:"http",events:null,format:Lb,formatHref:Lb,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Nw(t,e=null){let n=Object.assign({},Yd);t&&(n=Object.assign(n,t instanceof Nw?t.o:t));const r=n.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i}Nw.prototype={o:Yd,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let i=this.o[t];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:Yd[t],typeof i=="function"&&r&&(i=i(e,n))):typeof i=="function"&&r&&(i=i(e,n.t,n)),i)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function Lb(t){return t}function jT(t,e){this.t="token",this.v=t,this.tk=e}jT.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Yd.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),s=this.toFormattedString(t),o={},a=t.get("className",n,e),l=t.get("target",n,e),d=t.get("rel",n,e),h=t.getObj("attributes",n,e),f=t.getObj("events",n,e);return o.href=r,a&&(o.class=a),l&&(o.target=l),d&&(o.rel=d),h&&Object.assign(o,h),{tagName:i,attributes:o,content:s,eventListeners:f}}};function M0(t,e){class n extends jT{constructor(i,s){super(i,s),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const Ib=M0("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Db=M0("text"),aQ=M0("nl"),Xf=M0("url",{isLink:!0,toHref(t=Yd.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Qd&&t[1].t===Js}}),Pr=t=>new Zn(t);function lQ({groups:t}){const e=t.domain.concat([Im,Fm,Ws,jm,zm,Bm,Um,Hm,Or,ww,dd,Vm,Gm,$m,bi,Km,fd,Wm]),n=[Dm,Js,Cw,Ci,bw,dd,hd,Ew,_w,Em,_m,ud,cd,km,wm,Cm,bm,Nm,Tm,Mm,Pm,Om,Am,Rm,Lm],r=[Im,Dm,Fm,jm,zm,Bm,Um,Hm,Or,ud,cd,dd,Vm,Gm,$m,hd,bi,Km,fd,Wm],i=Pr(),s=Z(i,fd);Pe(s,r,s),Pe(s,t.domain,s);const o=Pr(),a=Pr(),l=Pr();Pe(i,t.domain,o),Pe(i,t.scheme,a),Pe(i,t.slashscheme,l),Pe(o,r,s),Pe(o,t.domain,o);const d=Z(o,Ws);Z(s,Ws,d),Z(a,Ws,d),Z(l,Ws,d);const h=Z(s,Ci);Pe(h,r,s),Pe(h,t.domain,s);const f=Pr();Pe(d,t.domain,f),Pe(f,t.domain,f);const p=Z(f,Ci);Pe(p,t.domain,f);const y=Pr(Ib);Pe(p,t.tld,y),Pe(p,t.utld,y),Z(d,Qd,y);const g=Z(f,Or);Z(g,Or,g),Pe(g,t.domain,f),Pe(y,t.domain,f),Z(y,Ci,p),Z(y,Or,g);const x=Z(y,Js);Pe(x,t.numeric,Ib);const S=Z(o,Or),C=Z(o,Ci);Z(S,Or,S),Pe(S,t.domain,o),Pe(C,r,s),Pe(C,t.domain,o);const E=Pr(Xf);Pe(C,t.tld,E),Pe(C,t.utld,E),Pe(E,t.domain,o),Pe(E,r,s),Z(E,Ci,C),Z(E,Or,S),Z(E,Ws,d);const w=Z(E,Js),b=Pr(Xf);Pe(w,t.numeric,b);const T=Pr(Xf),P=Pr();Pe(T,e,T),Pe(T,n,P),Pe(P,e,T),Pe(P,n,P),Z(E,bi,T),Z(b,bi,T);const A=Z(a,Js),M=Z(l,Js),I=Z(M,bi),R=Z(I,bi);Pe(a,t.domain,o),Z(a,Ci,C),Z(a,Or,S),Pe(l,t.domain,o),Z(l,Ci,C),Z(l,Or,S),Pe(A,t.domain,T),Z(A,bi,T),Z(A,hd,T),Pe(R,t.domain,T),Pe(R,e,T),Z(R,bi,T);const U=[[ud,cd],[wm,km],[Cm,bm],[Em,_m],[Nm,Tm],[Mm,Pm],[Om,Am],[Rm,Lm]];for(let B=0;B<U.length;B++){const[$,Q]=U[B],q=Z(T,$);Z(P,$,q),Z(q,Q,T);const ie=Pr(Xf);Pe(q,e,ie);const fe=Pr();Pe(q,n),Pe(ie,e,ie),Pe(ie,n,fe),Pe(fe,e,ie),Pe(fe,n,fe),Z(ie,Q,T),Z(fe,Q,T)}return Z(i,Qd,E),Z(i,kw,aQ),{start:i,tokens:DT}}function uQ(t,e,n){let r=n.length,i=0,s=[],o=[];for(;i<r;){let a=t,l=null,d=null,h=0,f=null,p=-1;for(;i<r&&!(l=a.go(n[i].t));)o.push(n[i++]);for(;i<r&&(d=l||a.go(n[i].t));)l=null,a=d,a.accepts()?(p=0,f=a):p>=0&&p++,i++,h++;if(p<0)i-=h,i<r&&(o.push(n[i]),i++);else{o.length>0&&(s.push(u2(Db,e,o)),o=[]),i-=p,h-=p;const y=f.t,g=n.slice(i-h,i);s.push(u2(y,e,g))}}return o.length>0&&s.push(u2(Db,e,o)),s}function u2(t,e,n){const r=n[0].s,i=n[n.length-1].e,s=e.slice(r,i);return new t(s,n)}const cQ=typeof console<"u"&&console&&console.warn||(()=>{}),dQ="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ut={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function hQ(){return Zn.groups={},ut.scanner=null,ut.parser=null,ut.tokenQueue=[],ut.pluginQueue=[],ut.customSchemes=[],ut.initialized=!1,ut}function Fb(t,e=!1){if(ut.initialized&&cQ(`linkifyjs: already initialized - will not register custom scheme "${t}" ${dQ}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
1. Must only contain digits, lowercase ASCII letters or "-"
2. Cannot start or end with "-"
3. "-" cannot repeat`);ut.customSchemes.push([t,e])}function fQ(){ut.scanner=sQ(ut.customSchemes);for(let t=0;t<ut.tokenQueue.length;t++)ut.tokenQueue[t][1]({scanner:ut.scanner});ut.parser=lQ(ut.scanner.tokens);for(let t=0;t<ut.pluginQueue.length;t++)ut.pluginQueue[t][1]({scanner:ut.scanner,parser:ut.parser});return ut.initialized=!0,ut}function Tw(t){return ut.initialized||fQ(),uQ(ut.parser.start,t,FT(ut.scanner.start,t))}Tw.scan=FT;function zT(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new Nw(n),i=Tw(t),s=[];for(let o=0;o<i.length;o++){const a=i[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&s.push(a.toFormattedObject(r))}return s}var Mw="[\0-   -\u2029 ]",pQ=new RegExp(Mw),mQ=new RegExp(`${Mw}$`),gQ=new RegExp(Mw,"g");function yQ(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function vQ(t){return new Et({key:new Jt("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(d=>d.docChanged)&&!n.doc.eq(r.doc),s=e.some(d=>d.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,a=ZN(n.doc,[...e]);if(oT(a).forEach(({newRange:d})=>{const h=xW(r.doc,d,y=>y.isTextblock);let f,p;if(h.length>1)f=h[0],p=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(h.length){const y=r.doc.textBetween(d.from,d.to," "," ");if(!mQ.test(y))return;f=h[0],p=r.doc.textBetween(f.pos,d.to,void 0," ")}if(f&&p){const y=p.split(pQ).filter(Boolean);if(y.length<=0)return!1;const g=y[y.length-1],x=f.pos+p.lastIndexOf(g);if(!g)return!1;const S=Tw(g).map(C=>C.toObject(t.defaultProtocol));if(!yQ(S))return!1;S.filter(C=>C.isLink).map(C=>({...C,from:x+C.start+1,to:x+C.end+1})).filter(C=>r.schema.marks.code?!r.doc.rangeHasMark(C.from,C.to,r.schema.marks.code):!0).filter(C=>t.validate(C.value)).filter(C=>t.shouldAutoLink(C.value)).forEach(C=>{mw(C.from,C.to,r.doc).some(E=>E.mark.type===t.type)||o.addMark(C.from,C.to,t.type.create({href:C.href}))})}}),!!o.steps.length)return o}})}function xQ(t){return new Et({key:new Jt("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const l=r.target;if(!l)return!1;const d=t.editor.view.dom;o=l.closest("a"),o&&!d.contains(o)&&(o=null)}if(!o)return!1;let a=!1;if(t.enableClickSelection&&(a=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const l=sT(e.state,t.type.name),d=(i=o.href)!=null?i:l.href,h=(s=o.target)!=null?s:l.target;d&&(window.open(d,h),a=!0)}return a}}})}function SQ(t){return new Et({key:new Jt("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:i}=t,{state:s}=e,{selection:o}=s,{empty:a}=o;if(a)return!1;let l="";r.content.forEach(h=>{l+=h.textContent});const d=zT(l,{defaultProtocol:t.defaultProtocol}).find(h=>h.isLink&&h.value===l);return!l||!d||i!==void 0&&!i(d.value)?!1:t.editor.commands.setMark(t.type,{href:d.href})}}})}function ra(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(gQ,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var wQ=al.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){Fb(t);return}Fb(t.scheme,t.optionalSlashes)})},onDestroy(){hQ()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!ra(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const i=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!ra(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!ra(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ut(this.options.HTMLAttributes,t),0]:["a",Ut(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,i,s;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",a=(s=(i=t.attrs)==null?void 0:i.title)!=null?s:"",l=e.renderChildren(t);return a?`[${l}](${o} "${a}")`:`[${l}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!ra(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!ra(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[qa({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=zT(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!ra(o,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(s=>{this.options.shouldAutoLink(s.value)&&e.push({text:s.value,data:{href:s.href},index:s.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(vQ({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!ra(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(xQ({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(SQ({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),kQ=Object.defineProperty,CQ=(t,e)=>{for(var n in e)kQ(t,n,{get:e[n],enumerable:!0})},bQ="listItem",jb="textStyle",zb=/^\s*([-+*])\s$/,BT=xr.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Ut(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(bQ,this.editor.getAttributes(jb)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Ru({find:zb,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ru({find:zb,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(jb),editor:this.editor})),[t]}}),UT=xr.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ut(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{var n;if(t.type!=="list_item")return[];const r=(n=e.parseBlockChildren)!=null?n:e.parseChildren;let i=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(o=>o.type==="paragraph"))i=r(t.tokens);else{const o=t.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(i=[{type:"paragraph",content:e.parseInline(o.tokens)}],t.tokens.length>1){const l=t.tokens.slice(1),d=r(l);i.push(...d)}}else i=r(t.tokens)}return i.length===0&&(i=[{type:"paragraph",content:[]}]),{type:"listItem",content:i}},renderMarkdown:(t,e,n)=>xw(t,e,r=>{var i,s;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((s=(i=r.meta)==null?void 0:i.parentAttrs)==null?void 0:s.start)||1)+r.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),EQ={};CQ(EQ,{findListItemPos:()=>kh,getNextListDepth:()=>Pw,handleBackspace:()=>mx,handleDelete:()=>gx,hasListBefore:()=>HT,hasListItemAfter:()=>_Q,hasListItemBefore:()=>VT,listItemHasSubList:()=>GT,nextListIsDeeper:()=>$T,nextListIsHigher:()=>WT});var kh=(t,e)=>{const{$from:n}=e.selection,r=Bt(t,e.schema);let i=null,s=n.depth,o=n.pos,a=null;for(;s>0&&a===null;)i=n.node(s),i.type===r?a=s:(s-=1,o-=1);return a===null?null:{$pos:e.doc.resolve(o),depth:a}},Pw=(t,e)=>{const n=kh(t,e);if(!n)return!1;const[,r]=PW(e,t,n.$pos.pos+4);return r},HT=(t,e,n)=>{const{$anchor:r}=t.selection,i=Math.max(0,r.pos-2),s=t.doc.resolve(i).node();return!(!s||!n.includes(s.type.name))},VT=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((n=i.nodeBefore)==null?void 0:n.type.name)!==t)},GT=(t,e,n)=>{if(!n)return!1;const r=Bt(t,e.schema);let i=!1;return n.descendants(s=>{s.type===r&&(i=!0)}),i},mx=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Oo(t.state,e)&&HT(t.state,e,n)){const{$anchor:a}=t.state.selection,l=t.state.doc.resolve(a.before()-1),d=[];l.node().descendants((p,y)=>{p.type.name===e&&d.push({node:p,pos:y})});const h=d.at(-1);if(!h)return!1;const f=t.state.doc.resolve(l.start()+h.pos+1);return t.chain().cut({from:a.start()-1,to:a.end()+1},f.end()).joinForward().run()}if(!Oo(t.state,e)||!LW(t.state))return!1;const r=kh(e,t.state);if(!r)return!1;const s=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=GT(e,t.state,s);return VT(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},$T=(t,e)=>{const n=Pw(t,e),r=kh(t,e);return!r||!n?!1:n>r.depth},WT=(t,e)=>{const n=Pw(t,e),r=kh(t,e);return!r||!n?!1:n<r.depth},gx=(t,e)=>{if(!Oo(t.state,e)||!RW(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:$T(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():WT(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},_Q=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((n=i.nodeAfter)==null?void 0:n.type.name)!==t)},KT=At.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&gx(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&gx(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&mx(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&mx(t,n,r)&&(e=!0)}),e}}}}),Bb=/^(\s*)(\d+)\.\s+(.*)$/,NQ=/^\s/;function TQ(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n],s=i.match(Bb);if(!s)break;const[,o,a,l]=s,d=o.length;let h=l,f=n+1;const p=[i];for(;f<t.length;){const y=t[f];if(y.match(Bb))break;if(y.trim()==="")p.push(y),h+=`
`,f+=1;else if(y.match(NQ))p.push(y),h+=`
${y.slice(d+2)}`,f+=1;else break}e.push({indent:d,number:parseInt(a,10),content:h.trim(),raw:p.join(`
`)}),r=f,n=f}return[e,r]}function qT(t,e,n){var r;const i=[];let s=0;for(;s<t.length;){const o=t[s];if(o.indent===e){const a=o.content.split(`
`),l=((r=a[0])==null?void 0:r.trim())||"",d=[];l&&d.push({type:"paragraph",raw:l,tokens:n.inlineTokens(l)});const h=a.slice(1).join(`
`).trim();if(h){const y=n.blockTokens(h);d.push(...y)}let f=s+1;const p=[];for(;f<t.length&&t[f].indent>e;)p.push(t[f]),f+=1;if(p.length>0){const y=Math.min(...p.map(x=>x.indent)),g=qT(p,y,n);d.push({type:"list",ordered:!0,start:p[0].number,items:g,raw:p.map(x=>x.raw).join(`
`)})}i.push({type:"list_item",raw:o.raw,tokens:d}),s=f}else s+=1}return i}function MQ(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const s=e.parseChildren([i]);r.push({type:"paragraph",content:s})}else{const s=e.parseChildren([i]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}var PQ="listItem",Ub="textStyle",Hb=/^(\d+)\.\s$/,QT=xr.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Ut(this.options.HTMLAttributes,n),0]:["ol",Ut(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?MQ(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e==null?void 0:e.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const i=t.split(`
`),[s,o]=TQ(i);if(s.length===0)return;const a=qT(s,0,n);return a.length===0?void 0:{type:"list",ordered:!0,start:((r=s[0])==null?void 0:r.number)||1,items:a,raw:i.slice(0,o).join(`
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(PQ,this.editor.getAttributes(Ub)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Ru({find:Hb,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ru({find:Hb,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Ub)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),OQ=/^\s*(\[([( |x])?\])\s$/,AQ=xr.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Ut(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const i=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return xw(t,e,i)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),d=f=>{var p,y;a.ariaLabel=((y=(p=this.options.a11y)==null?void 0:p.checkboxLabel)==null?void 0:y.call(p,f,a.checked))||`Task item checkbox for ${f.textContent||"empty task item"}`};d(t),s.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",f=>f.preventDefault()),a.addEventListener("change",f=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:p}=f.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:y})=>{const g=n();if(typeof g!="number")return!1;const x=y.doc.nodeAt(g);return y.setNodeMarkup(g,void 0,{...x==null?void 0:x.attrs,checked:p}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,p)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,p])=>{i.setAttribute(f,p)}),i.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,s.append(a,o),i.append(s,l),Object.entries(e).forEach(([f,p])=>{i.setAttribute(f,p)});let h=new Set(Object.keys(e));return{dom:i,contentDOM:l,update:f=>{if(f.type!==this.type)return!1;i.dataset.checked=f.attrs.checked,a.checked=f.attrs.checked,d(f);const p=r.extensionManager.attributes,y=qd(f,p),g=new Set(Object.keys(y)),x=this.options.HTMLAttributes;return h.forEach(S=>{g.has(S)||(S in x?i.setAttribute(S,x[S]):i.removeAttribute(S))}),Object.entries(y).forEach(([S,C])=>{C==null?S in x?i.setAttribute(S,x[S]):i.removeAttribute(S):i.setAttribute(S,C)}),h=g,!0}}}},addInputRules(){return[Ru({find:OQ,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),RQ=xr.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",Ut(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=s=>{const o=sx(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:n.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:r},n);return o?[{type:"taskList",raw:o.raw,items:o.items}]:n.blockTokens(s)},i=sx(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,o)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:n.inlineTokens(s.mainContent),nestedTokens:o}),customNestedParser:r},n);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});At.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(BT.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(UT.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(KT.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(QT.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(AQ.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(RQ.configure(this.options.taskList)),t}});var Zf="&nbsp;",c2=" ",LQ=xr.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Ut(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===Zf||n[0].text===Zf||n[0].raw===c2||n[0].text===c2)&&r.length===1&&r[0].type==="text"&&(r[0].text===Zf||r[0].text===c2)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{var r,i;if(!t)return"";const s=Array.isArray(t.content)?t.content:[];if(s.length===0){const o=Array.isArray((r=n==null?void 0:n.previousNode)==null?void 0:r.content)?n.previousNode.content:[];return((i=n==null?void 0:n.previousNode)==null?void 0:i.type)==="paragraph"&&o.length===0?Zf:""}return e.renderChildren(s)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),IQ=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,DQ=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,FQ=al.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Ut(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Au({find:IQ,type:this.type})]},addPasteRules(){return[qa({find:DQ,type:this.type})]}}),jQ=xr.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),YT=al.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Ut(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!i)return;const s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:n.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),zQ=YT;function BQ(t={}){return new Et({view(e){return new UQ(e,t)}})}class UQ{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,a=s.height/i.offsetHeight;if(n){let f=e.nodeBefore,p=e.nodeAfter;if(f||p){let y=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(y){let g=y.getBoundingClientRect(),x=f?g.bottom:g.top;f&&p&&(x=(x+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let S=this.width/2*a;r={left:g.left,right:g.right,top:x-S,bottom:x+S}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*o;r={left:f.left-p,right:f.left+p,top:f.top,bottom:f.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.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 d,h;if(!l||l==document.body&&getComputedStyle(l).position=="static")d=-pageXOffset,h=-pageYOffset;else{let f=l.getBoundingClientRect(),p=f.width/l.offsetWidth,y=f.height/l.offsetHeight;d=f.left-l.scrollLeft*p,h=f.top-l.scrollTop*y}this.element.style.left=(r.left-d)/o+"px",this.element.style.top=(r.top-h)/a+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!s){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=G9(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Mt extends Oe{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Mt.valid(r)?new Mt(r):Oe.near(r)}content(){return ue.empty}eq(e){return e instanceof Mt&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Mt(e.resolve(n.pos))}getBookmark(){return new Ow(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!HQ(e)||!VQ(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Mt.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let a=e.node(o);if(n>0?e.indexAfter(o)<a.childCount:e.index(o)>0){s=a.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=n;let l=e.doc.resolve(i);if(Mt.valid(l))return l}for(;;){let o=n>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!ye.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=o,i+=n;let a=e.doc.resolve(i);if(Mt.valid(a))return a}return null}}}Mt.prototype.visible=!1;Mt.findFrom=Mt.findGapCursorFrom;Oe.jsonID("gapcursor",Mt);class Ow{constructor(e){this.pos=e}map(e){return new Ow(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Mt.valid(n)?new Mt(n):Oe.near(n)}}function JT(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function HQ(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||JT(i.type))return!0;if(i.inlineContent)return!1}}return!0}function VQ(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||JT(i.type))return!0;if(i.inlineContent)return!1}}return!0}function GQ(){return new Et({props:{decorations:qQ,createSelectionBetween(t,e,n){return e.pos==n.pos&&Mt.valid(n)?new Mt(n):null},handleClick:WQ,handleKeyDown:$Q,handleDOMEvents:{beforeinput:KQ}}})}const $Q=$N({ArrowLeft:ep("horiz",-1),ArrowRight:ep("horiz",1),ArrowUp:ep("vert",-1),ArrowDown:ep("vert",1)});function ep(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof we){if(!s.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let d=Mt.findGapCursorFrom(a,e,l);return d?(i&&i(r.tr.setSelection(new Mt(d))),!0):!1}}function WQ(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Mt.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&ye.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Mt(r))),!0)}function KQ(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Mt))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=J.empty;for(let o=r.length-1;o>=0;o--)i=J.from(r[o].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new ue(i,0,0));return s.setSelection(we.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function qQ(t){if(!(t.selection instanceof Mt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",wt.create(t.doc,[Fn.widget(t.selection.head,e,{key:"gapcursor"})])}var qm=200,an=function(){};an.prototype.append=function(e){return e.length?(e=an.from(e),!this.length&&e||e.length<qm&&this.leafAppend(e)||this.length<qm&&e.leafPrepend(this)||this.appendInner(e)):this};an.prototype.prepend=function(e){return e.length?an.from(e).append(this):this};an.prototype.appendInner=function(e){return new QQ(this,e)};an.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?an.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};an.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};an.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};an.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},n,r),i};an.from=function(e){return e instanceof an?e:e&&e.length?new XT(e):an.empty};var XT=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l<o;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var l=s-1;l>=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=qm)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=qm)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(an);an.empty=new XT([]);var QQ=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(an);const YQ=500;class ri{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,a,l,d=[],h=[];return this.items.forEach((f,p)=>{if(!f.step){i||(i=this.remapping(r,p+1),s=i.maps.length),s--,h.push(f);return}if(i){h.push(new Ei(f.map));let y=f.step.map(i.slice(s)),g;y&&o.maybeStep(y).doc&&(g=o.mapping.maps[o.mapping.maps.length-1],d.push(new Ei(g,void 0,void 0,d.length+h.length))),s--,g&&i.appendMap(g,s)}else o.maybeStep(f.step);if(f.selection)return a=i?f.selection.map(i.slice(s)):f.selection,l=new ri(this.items.slice(0,r).append(h.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,n,r,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let h=0;h<e.steps.length;h++){let f=e.steps[h].invert(e.docs[h]),p=new Ei(e.mapping.maps[h],f,n),y;(y=l&&l.merge(p))&&(p=y,h?s.pop():a=a.slice(0,a.length-1)),s.push(p),n&&(o++,n=void 0),i||(l=p)}let d=o-r.depth;return d>XQ&&(a=JQ(a,d),o-=d),new ri(a.append(s),o)}remapping(e,n){let r=new Hd;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new ri(this.items.append(e.map(n=>new Ei(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(p=>{p.selection&&a--},i);let l=n;this.items.forEach(p=>{let y=s.getMirror(--l);if(y==null)return;o=Math.min(o,y);let g=s.maps[y];if(p.step){let x=e.steps[y].invert(e.docs[y]),S=p.selection&&p.selection.map(s.slice(l+1,y));S&&a++,r.push(new Ei(g,x,S))}else r.push(new Ei(g))},i);let d=[];for(let p=n;p<o;p++)d.push(new Ei(s.maps[p]));let h=this.items.slice(0,i).append(d).append(r),f=new ri(h,a);return f.emptyItemCount()>YQ&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(n.slice(r)),d=l&&l.getMap();if(r--,d&&n.appendMap(d,r),l){let h=o.selection&&o.selection.map(n.slice(r));h&&s++;let f=new Ei(d.invert(),l,h),p,y=i.length-1;(p=i.length&&i[y].merge(f))?i[y]=p:i.push(f)}}else o.map&&r--},this.items.length,0),new ri(an.from(i.reverse()),s)}}ri.empty=new ri(an.empty,0);function JQ(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class Ei{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Ei(n.getMap().invert(),n,this.selection)}}}class Ks{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const XQ=20;function ZQ(t,e,n,r){let i=n.getMeta(La),s;if(i)return i.historyState;n.getMeta(nY)&&(t=new Ks(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(La))return o.getMeta(La).redo?new Ks(t.done.addTransform(n,void 0,r,bp(e)),t.undone,Vb(n.mapping.maps),t.prevTime,t.prevComposition):new Ks(t.done,t.undone.addTransform(n,void 0,r,bp(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!o&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!eY(n,t.prevRanges)),d=o?d2(t.prevRanges,n.mapping):Vb(n.mapping.maps);return new Ks(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,bp(e)),ri.empty,d,n.time,a??t.prevComposition)}else return(s=n.getMeta("rebased"))?new Ks(t.done.rebased(n,s),t.undone.rebased(n,s),d2(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Ks(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),d2(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function eY(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function Vb(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,o)=>e.push(s,o));return e}function d2(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function tY(t,e,n){let r=bp(e),i=La.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),l=new Ks(n?a:s.remaining,n?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(La,{redo:n,historyState:l})}let h2=!1,Gb=null;function bp(t){let e=t.plugins;if(Gb!=e){h2=!1,Gb=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){h2=!0;break}}return h2}const La=new Jt("history"),nY=new Jt("closeHistory");function rY(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Et({key:La,state:{init(){return new Ks(ri.empty,ri.empty,null,0,-1)},apply(e,n,r){return ZQ(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?e7:r=="historyRedo"?t7:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function ZT(t,e){return(n,r)=>{let i=La.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=tY(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const e7=ZT(!1,!0),t7=ZT(!0,!0);At.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Et({key:new Jt("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const i=this.options.limit;if(i==null||i===0){t=!0;return}const s=this.storage.characters({node:r.doc});if(s>i){const o=s-i,a=0,l=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(a,l);return t=!0,d}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:n.doc}),s=this.storage.characters({node:e.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,l=s-r,d=a-l,h=a;return e.deleteRange(d,h),!(this.storage.characters({node:e.doc})>r)}})]}});var iY=At.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[BQ(this.options)]}});At.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Et({key:new Jt("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!n||!r)return wt.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((l,d)=>{if(l.isText)return;if(!(i>=d&&i<=d+l.nodeSize-1))return!1;o+=1});let a=0;return t.descendants((l,d)=>{if(l.isText||!(i>=d&&i<=d+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";s.push(Fn.node(d,d+l.nodeSize,{class:this.options.className}))}),wt.create(t,s)}}})]}});var sY=At.create({name:"gapCursor",addProseMirrorPlugins(){return[GQ()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Ke(pe(t,"allowGapCursor",n)))!=null?e:null}}}),$b="placeholder";function oY(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var aY=At.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:$b,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${oY(this.options.dataAttribute)}`:`data-${$b}`;return[new Et({key:new Jt("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,s=[];if(!r)return null;const o=this.editor.isEmpty;return e.descendants((a,l)=>{const d=i>=l&&i<=l+a.nodeSize,h=!a.isLeaf&&_0(a);if(!a.type.isTextblock)return this.options.includeChildren;if((d||!this.options.showOnlyCurrent)&&h){const f=[this.options.emptyNodeClass];o&&f.push(this.options.emptyEditorClass);const p=Fn.node(l,l+a.nodeSize,{class:f.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:a,pos:l,hasAnchor:d}):this.options.placeholder});s.push(p)}return this.options.includeChildren}),wt.create(e,s)}}})]}});At.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Et({key:new Jt("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||aT(n.selection)||t.view.dragging?null:wt.create(n.doc,[Fn.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});var lY="skipTrailingNode";function Wb({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var uY=At.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Jt(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(n).includes(i.name));return[new Et({key:e,appendTransaction:(i,s,o)=>{const{doc:a,tr:l,schema:d}=o,h=e.getState(o),f=a.content.size,p=d.nodes[n];if(!i.some(y=>y.getMeta(lY))&&h)return l.insert(f,p.create())},state:{init:(i,s)=>{const o=s.tr.doc.lastChild;return!Wb({node:o,types:r})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const o=i.doc.lastChild;return!Wb({node:o,types:r})}}})]}}),cY=At.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>e7(t,e),redo:()=>({state:t,dispatch:e})=>t7(t,e)}},addProseMirrorPlugins(){return[rY(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),dY=At.create({name:"starterKit",addExtensions(){var t,e,n,r;const i=[];return this.options.bold!==!1&&i.push(Iq.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(Pq.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(BT.configure(this.options.bulletList)),this.options.code!==!1&&i.push(jq.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(Uq.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(Hq.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(iY.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(sY.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(Vq.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(Gq.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(cY.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push($q.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(Yq.configure(this.options.italic)),this.options.listItem!==!1&&i.push(UT.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(KT.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&i.push(wQ.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(QT.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(LQ.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(FQ.configure(this.options.strike)),this.options.text!==!1&&i.push(jQ.configure(this.options.text)),this.options.underline!==!1&&i.push(YT.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&i.push(uY.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),hY=dY,fY=At.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).some(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),pY=fY,mY=aY;function bn({onClick:t,active:e,children:n,title:r}){return N.jsx("button",{type:"button",onClick:t,title:r,className:`p-1.5 rounded transition-colors ${e?"bg-primary-100 text-primary-700":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"}`,children:n})}function gY({content:t,onChange:e,placeholder:n}){const r=Eq({extensions:[hY.configure({heading:{levels:[1,2,3]}}),zQ,pY.configure({types:["heading","paragraph"]}),mY.configure({placeholder:n||"Start writing..."})],content:t,onUpdate:({editor:i})=>{e(i.getHTML())},editorProps:{attributes:{class:"prose prose-lg max-w-none min-h-[500px] focus:outline-none p-6 font-serif leading-relaxed text-center"}},onCreate:({editor:i})=>{(!t||t.trim()===""||t.trim()==="<p></p>")&&i.chain().focus().setTextAlign("center").run()}});return z.useEffect(()=>{r&&t!==r.getHTML()&&r.commands.setContent(t)},[t]),r?N.jsxs("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:[N.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 px-3 py-2 bg-gray-50 border-b border-gray-200",children:[N.jsx(bn,{onClick:()=>r.chain().focus().undo().run(),title:"Undo",children:N.jsx(SL,{className:"w-4 h-4"})}),N.jsx(bn,{onClick:()=>r.chain().focus().redo().run(),title:"Redo",children:N.jsx(pL,{className:"w-4 h-4"})}),N.jsx("div",{className:"w-px h-5 bg-gray-300 mx-1"}),N.jsx(bn,{onClick:()=>r.chain().focus().toggleHeading({level:1}).run(),active:r.isActive("heading",{level:1}),title:"Heading 1",children:N.jsx(sL,{className:"w-4 h-4"})}),N.jsx(bn,{onClick:()=>r.chain().focus().toggleHeading({level:2}).run(),active:r.isActive("heading",{level:2}),title:"Heading 2",children:N.jsx(oL,{className:"w-4 h-4"})}),N.jsx(bn,{onClick:()=>r.chain().focus().toggleHeading({level:3}).run(),active:r.isActive("heading",{level:3}),title:"Heading 3",children:N.jsx(aL,{className:"w-4 h-4"})}),N.jsx("div",{className:"w-px h-5 bg-gray-300 mx-1"}),N.jsx(bn,{onClick:()=>r.chain().focus().toggleBold().run(),active:r.isActive("bold"),title:"Bold",children:N.jsx(XR,{className:"w-4 h-4"})}),N.jsx(bn,{onClick:()=>r.chain().focus().toggleItalic().run(),active:r.isActive("italic"),title:"Italic",children:N.jsx(lL,{className:"w-4 h-4"})}),N.jsx(bn,{onClick:()=>r.chain().focus().toggleUnderline().run(),active:r.isActive("underline"),title:"Underline",children:N.jsx(xL,{className:"w-4 h-4"})}),N.jsx(bn,{onClick:()=>r.chain().focus().toggleStrike().run(),active:r.isActive("strike"),title:"Strikethrough",children:N.jsx(yL,{className:"w-4 h-4"})}),N.jsx("div",{className:"w-px h-5 bg-gray-300 mx-1"}),N.jsx(bn,{onClick:()=>r.chain().focus().toggleBulletList().run(),active:r.isActive("bulletList"),title:"Bullet List",children:N.jsx(cL,{className:"w-4 h-4"})}),N.jsx(bn,{onClick:()=>r.chain().focus().toggleOrderedList().run(),active:r.isActive("orderedList"),title:"Ordered List",children:N.jsx(uL,{className:"w-4 h-4"})}),N.jsx("div",{className:"w-px h-5 bg-gray-300 mx-1"}),N.jsx(bn,{onClick:()=>r.chain().focus().setTextAlign("left").run(),active:r.isActive({textAlign:"left"}),title:"Align Left",children:N.jsx(YR,{className:"w-4 h-4"})}),N.jsx(bn,{onClick:()=>r.chain().focus().setTextAlign("center").run(),active:r.isActive({textAlign:"center"}),title:"Align Center",children:N.jsx(QR,{className:"w-4 h-4"})}),N.jsx(bn,{onClick:()=>r.chain().focus().setTextAlign("right").run(),active:r.isActive({textAlign:"right"}),title:"Align Right",children:N.jsx(JR,{className:"w-4 h-4"})}),N.jsx("div",{className:"w-px h-5 bg-gray-300 mx-1"}),N.jsx(bn,{onClick:()=>r.chain().focus().toggleBlockquote().run(),active:r.isActive("blockquote"),title:"Blockquote",children:N.jsx(fL,{className:"w-4 h-4"})}),N.jsx(bn,{onClick:()=>r.chain().focus().setHorizontalRule().run(),title:"Horizontal Rule",children:N.jsx(hL,{className:"w-4 h-4"})})]}),N.jsx(_T,{editor:r})]}):null}function yY(){const{activeBook:t,updateChapterContent:e,setCurrentChapter:n}=p0(),[r,i]=z.useState(!1),[s,o]=z.useState(!1),{t:a}=xs();if(!t||!t.outline)return N.jsx("div",{className:"card text-center py-12",children:N.jsx("p",{className:"text-gray-500",children:a("bookEditor.noOutline")})});const l=t.outline.chapters.find(y=>y.number===t.currentChapter),d=()=>{t.currentChapter>1&&n(t.currentChapter-1)},h=()=>{const y=t.outline.chapters.length;t.currentChapter<y&&n(t.currentChapter+1)},f=async()=>{var y;if(!(!l||!t)){i(!0);try{const g=(y=t.outline)==null?void 0:y.chapters.find(S=>S.number===t.currentChapter-1),x=await vh.generateChapter(t.genre,l.title,l.summary,g==null?void 0:g.content);console.log("Chapter generation response:",x.data),e(t.currentChapter,x.data.content)}catch(g){console.error("Failed to generate chapter:",g)}finally{i(!1)}}},p=async()=>{alert("Expand feature coming soon!")};return N.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6",children:[N.jsxs("div",{className:"space-y-4",children:[N.jsxs("div",{className:"card",children:[N.jsx("h3",{className:"font-semibold text-gray-900 mb-4",children:a("bookEditor.chapters")}),N.jsx("div",{className:"space-y-2",children:t.outline.chapters.map(y=>N.jsx("button",{onClick:()=>n(y.number),className:`w-full text-left p-3 rounded-lg transition-colors ${y.number===t.currentChapter?"bg-primary-100 text-primary-700":"hover:bg-gray-50"}`,children:N.jsxs("div",{className:"flex items-center gap-2",children:[N.jsx("span",{className:"flex-shrink-0 w-6 h-6 bg-white rounded-full flex items-center justify-center text-xs font-medium border",children:y.number}),N.jsxs("div",{className:"flex-1 min-w-0",children:[N.jsx("p",{className:"text-sm font-medium truncate",children:y.title}),y.content&&N.jsxs("span",{className:"text-xs text-green-600",children:["✓ ",a("bookEditor.written")]})]})]})},y.number))})]}),N.jsxs("div",{className:"card",children:[N.jsx("h4",{className:"font-medium text-gray-900 mb-2",children:a("bookEditor.chapterSummary")}),N.jsx("p",{className:"text-sm text-gray-600",children:l==null?void 0:l.summary})]})]}),N.jsx("div",{className:"lg:col-span-3",children:N.jsxs("div",{className:"card",children:[N.jsxs("div",{className:"flex items-center justify-between mb-6 pb-4 border-b border-gray-200",children:[N.jsxs("div",{className:"flex items-center gap-4",children:[N.jsx("button",{onClick:d,disabled:t.currentChapter<=1,className:"p-2 rounded-lg hover:bg-gray-100 disabled:opacity-50 disabled:cursor-not-allowed",children:N.jsx(eL,{className:"w-5 h-5"})}),N.jsxs("div",{children:[N.jsx("h2",{className:"text-xl font-bold text-gray-900",children:l==null?void 0:l.title}),N.jsx("p",{className:"text-sm text-gray-500",children:a("bookEditor.chapterOf",{current:t.currentChapter,total:t.outline.chapters.length})})]}),N.jsx("button",{onClick:h,disabled:t.currentChapter>=t.outline.chapters.length,className:"p-2 rounded-lg hover:bg-gray-100 disabled:opacity-50 disabled:cursor-not-allowed",children:N.jsx(tL,{className:"w-5 h-5"})})]}),N.jsxs("div",{className:"flex items-center gap-2",children:[N.jsxs("button",{onClick:()=>o(!s),className:"btn-secondary flex items-center gap-2",children:[N.jsx(W8,{className:"w-4 h-4"}),a("bookEditor.aiAssist")]}),N.jsxs("button",{onClick:f,disabled:r||!l,className:"btn-primary flex items-center gap-2",children:[N.jsx(Ua,{className:"w-4 h-4"}),a(r?"bookEditor.generating":"bookEditor.generateChapter")]})]})]}),s&&N.jsxs("div",{className:"mb-6 bg-gradient-to-r from-accent-50 to-primary-50 rounded-lg p-4 border border-accent-200",children:[N.jsx("h4",{className:"font-medium text-gray-900 mb-3",children:a("bookEditor.aiWritingAssistant")}),N.jsxs("div",{className:"flex flex-wrap gap-2",children:[N.jsxs("button",{onClick:p,className:"text-sm px-3 py-1.5 bg-white rounded-lg border border-gray-200 hover:border-accent-300 transition-colors",children:["✨ ",a("bookEditor.expandSection")]}),N.jsxs("button",{className:"text-sm px-3 py-1.5 bg-white rounded-lg border border-gray-200 hover:border-accent-300 transition-colors",children:["📝 ",a("bookEditor.improveProse")]}),N.jsxs("button",{className:"text-sm px-3 py-1.5 bg-white rounded-lg border border-gray-200 hover:border-accent-300 transition-colors",children:["💡 ",a("bookEditor.addDescription")]}),N.jsxs("button",{className:"text-sm px-3 py-1.5 bg-white rounded-lg border border-gray-200 hover:border-accent-300 transition-colors",children:["🔄 ",a("bookEditor.rewriteParagraph")]})]})]}),N.jsx("div",{className:"min-h-[500px]",children:N.jsx(gY,{content:(l==null?void 0:l.content)||"",onChange:y=>e(t.currentChapter,y),placeholder:a("bookEditor.editorPlaceholder")})}),N.jsxs("div",{className:"mt-4 pt-4 border-t border-gray-200 flex items-center justify-between text-sm text-gray-500",children:[N.jsxs("span",{children:[l!=null&&l.content?l.content.split(/\s+/).length:0," ",a("bookEditor.words")]}),N.jsxs("span",{children:[a("bookEditor.lastUpdated")," ",new Date(t.updatedAt).toLocaleDateString()]})]})]})})]})}function vY(){const[t,e]=z.useState("genre"),{activeBook:n,setActiveBook:r,setOutline:i}=p0(),s=pS(),{t:o}=xs();z.useEffect(()=>{const h=s.state;if(h!=null&&h.autoBook){const{idea:f,genre:p,useAI:y}=h.autoBook,g={id:`book-${Date.now()}`,title:f.substring(0,50)||"Untitled",genre:p,idea:f,outline:null,characters:[],currentChapter:1,createdAt:new Date,updatedAt:new Date};r(g),e(y?"outline":"editor"),window.history.replaceState({},document.title)}},[]);const{data:a}=wS({queryKey:["genres"],queryFn:async()=>(await vh.getGenres()).data.genres}),l=(h,f,p)=>{const y={id:`book-${Date.now()}`,title:p,genre:h,idea:f,outline:null,characters:[],currentChapter:1,createdAt:new Date,updatedAt:new Date};r(y),e("outline")},d=h=>{n&&h&&(i(h),e("editor"))};return N.jsxs("div",{className:"space-y-6",children:[N.jsxs("div",{className:"flex items-center justify-between",children:[N.jsxs("div",{children:[N.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:o("bookGenerator.title")}),N.jsx("p",{className:"text-gray-500 mt-1",children:o("bookGenerator.subtitle")})]}),N.jsxs("div",{className:"flex bg-white rounded-lg p-1 border border-gray-200",children:[N.jsxs("button",{onClick:()=>e("genre"),className:`flex items-center gap-2 px-4 py-2 rounded-md transition-colors ${t==="genre"||!n?"bg-primary-100 text-primary-700":"text-gray-600 hover:bg-gray-100"}`,disabled:!n&&t!=="genre",children:[N.jsx(Id,{className:"w-4 h-4"}),N.jsx("span",{className:"hidden sm:inline",children:o("bookGenerator.tabGenre")})]}),N.jsxs("button",{onClick:()=>e("outline"),disabled:!n,className:`flex items-center gap-2 px-4 py-2 rounded-md transition-colors ${t==="outline"?"bg-primary-100 text-primary-700":"text-gray-600 hover:bg-gray-100 disabled:opacity-50"}`,children:[N.jsx(iL,{className:"w-4 h-4"}),N.jsx("span",{className:"hidden sm:inline",children:o("bookGenerator.tabOutline")})]}),N.jsxs("button",{onClick:()=>e("editor"),disabled:!n,className:`flex items-center gap-2 px-4 py-2 rounded-md transition-colors ${t==="editor"?"bg-primary-100 text-primary-700":"text-gray-600 hover:bg-gray-100"}`,children:[N.jsx($8,{className:"w-4 h-4"}),N.jsx("span",{className:"hidden sm:inline",children:o("bookGenerator.tabWrite")})]}),N.jsxs("button",{onClick:()=>e("characters"),disabled:!n,className:`flex items-center gap-2 px-4 py-2 rounded-md transition-colors ${t==="characters"?"bg-primary-100 text-primary-700":"text-gray-600 hover:bg-gray-100"}`,children:[N.jsx(K8,{className:"w-4 h-4"}),N.jsx("span",{className:"hidden sm:inline",children:o("bookGenerator.tabCharacters")})]})]})]}),t==="genre"&&N.jsx(SH,{genres:a||[],onSelect:l}),t==="outline"&&n&&N.jsx(wH,{book:n,onComplete:d}),t==="editor"&&n&&N.jsx(yY,{}),t==="characters"&&n&&N.jsx(xY,{})]})}function xY(){const{activeBook:t,addCharacter:e}=p0(),[n,r]=z.useState(!1),{t:i}=xs(),s=async()=>{if(t){r(!0);try{const a=(await vh.generateCharacters(t.genre,t.idea)).data.characters;Array.isArray(a)&&a.forEach(l=>{e({name:l.name||"Unknown",role:l.role||"Supporting",traits:l.traits||[],motivation:l.motivation||"",backstory:l.backstory||""})})}catch(o){console.error("Failed to generate characters:",o)}finally{r(!1)}}};return t?N.jsxs("div",{className:"card",children:[N.jsxs("div",{className:"flex items-center justify-between mb-6",children:[N.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:i("characters.title")}),N.jsxs("button",{onClick:s,disabled:n,className:"btn-primary flex items-center gap-2",children:[N.jsx(Ua,{className:"w-4 h-4"}),i(n?"characters.generating":"characters.generate")]})]}),t.characters.length===0?N.jsxs("div",{className:"text-center py-8",children:[N.jsx(K8,{className:"w-12 h-12 text-gray-300 mx-auto mb-3"}),N.jsx("p",{className:"text-gray-500",children:i("characters.empty")})]}):N.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:t.characters.map((o,a)=>{var l;return N.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 hover:border-primary-300 transition-colors",children:[N.jsxs("div",{className:"flex items-start justify-between mb-2",children:[N.jsx("h4",{className:"font-semibold text-gray-900",children:o.name}),N.jsx("span",{className:`text-xs px-2 py-1 rounded-full ${o.role==="protagonist"?"bg-green-100 text-green-700":o.role==="antagonist"?"bg-red-100 text-red-700":"bg-gray-100 text-gray-600"}`,children:o.role})]}),N.jsxs("div",{className:"space-y-2 text-sm",children:[N.jsxs("div",{children:[N.jsxs("span",{className:"text-gray-500",children:[i("characters.traits"),":"]}),N.jsx("p",{className:"text-gray-700",children:((l=o.traits)==null?void 0:l.join(", "))||"N/A"})]}),N.jsxs("div",{children:[N.jsxs("span",{className:"text-gray-500",children:[i("characters.motivation"),":"]}),N.jsx("p",{className:"text-gray-700",children:o.motivation||"N/A"})]})]})]},a)})})]}):null}function SY(){const[t]=z.useState("gpt-4o-mini"),[e]=z.useState("stable-diffusion-v1-6"),{t:n,i18n:r}=xs(),i=o=>{r.changeLanguage(o.target.value)},s=()=>{alert("Cloud AI models are configured automatically!")};return N.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[N.jsxs("div",{children:[N.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:n("settings.title")}),N.jsx("p",{className:"text-gray-500 mt-1",children:"Cloud AI configuration and application preferences"})]}),N.jsxs("div",{className:"card",children:[N.jsxs("h3",{className:"text-lg font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[N.jsx(G8,{className:"w-5 h-5"}),n("settings.language")]}),N.jsx("div",{className:"space-y-4",children:N.jsxs("div",{children:[N.jsx("label",{className:"label",children:n("settings.languageSelect")}),N.jsxs("select",{value:r.language,onChange:i,className:"input bg-white",children:[N.jsx("option",{value:"en",children:n("settings.english")}),N.jsx("option",{value:"es",children:n("settings.spanish")})]})]})})]}),N.jsxs("div",{className:"card",children:[N.jsxs("h3",{className:"text-lg font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[N.jsx(nL,{className:"w-5 h-5"}),"Cloud AI Settings"]}),N.jsxs("div",{className:"space-y-4",children:[N.jsxs("div",{children:[N.jsx("label",{className:"label",children:"Text Generation Model"}),N.jsx("select",{value:t,disabled:!0,className:"input bg-gray-100",children:N.jsx("option",{value:"gpt-4o-mini",children:"OpenAI GPT-4o Mini (via OpenRouter)"})}),N.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Used for book outlines, chapters, and text generation (free tier)"})]}),N.jsxs("div",{children:[N.jsx("label",{className:"label",children:"Image Generation Model"}),N.jsx("select",{value:e,disabled:!0,className:"input bg-gray-100",children:N.jsx("option",{value:"stable-diffusion-v1-6",children:"Stability AI Stable Diffusion v1.6"})}),N.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Used for AI book cover generation (free credits available)"})]})]})]}),N.jsxs("div",{className:"card bg-blue-50 border-blue-200",children:[N.jsx("h3",{className:"font-medium text-blue-900 mb-2",children:"API Key Setup"}),N.jsx("p",{className:"text-sm text-blue-700 mb-3",children:"Configure your API key in the server/.env file:"}),N.jsx("code",{className:"block bg-white rounded p-3 text-sm font-mono text-blue-800",children:"OPENROUTER_API_KEY=your_openrouter_api_key_here"}),N.jsxs("p",{className:"text-sm text-blue-700 mt-2",children:["Get a free API key from: ",N.jsx("a",{href:"https://openrouter.ai/keys",className:"underline",target:"_blank",rel:"noopener noreferrer",children:"OpenRouter"})]})]}),N.jsx("div",{className:"flex justify-end",children:N.jsxs("button",{onClick:s,className:"btn-primary flex items-center gap-2",children:[N.jsx(mL,{className:"w-4 h-4"}),"Save Settings"]})})]})}function wY(){const{t,i18n:e}=xs(),n=HA(),[r,i]=z.useState(""),[s,o]=z.useState("fiction"),{data:a}=wS({queryKey:["genres"],queryFn:async()=>(await vh.getGenres()).data.genres}),l=h=>{e.changeLanguage(h)},d=h=>{n("/books",{state:{autoBook:{idea:r,genre:s,useAI:h}}})};return N.jsxs("div",{className:"max-w-3xl mx-auto py-12 px-6",children:[N.jsxs("div",{className:"text-center mb-12",children:[N.jsx("h1",{className:"text-4xl font-extrabold text-gray-900 mb-4",children:t("onboarding.title")}),N.jsx("p",{className:"text-lg text-gray-600",children:t("onboarding.subtitle")})]}),N.jsxs("div",{className:"space-y-12",children:[N.jsxs("section",{className:"card",children:[N.jsxs("h2",{className:"text-xl font-bold flex items-center gap-2 mb-4",children:[N.jsx(G8,{className:"text-primary-500 w-6 h-6"}),t("onboarding.step1")]}),N.jsxs("div",{className:"flex gap-4",children:[N.jsx("button",{onClick:()=>l("en"),className:`flex-1 py-3 px-4 rounded-lg font-medium transition-all ${e.language==="en"?"bg-primary-500 text-white shadow-md":"bg-white text-gray-700 border border-gray-200 hover:bg-gray-50"}`,children:"English"}),N.jsx("button",{onClick:()=>l("es"),className:`flex-1 py-3 px-4 rounded-lg font-medium transition-all ${e.language==="es"?"bg-primary-500 text-white shadow-md":"bg-white text-gray-700 border border-gray-200 hover:bg-gray-50"}`,children:"Español"})]})]}),N.jsxs("section",{className:"card",children:[N.jsxs("h2",{className:"text-xl font-bold flex items-center gap-2 mb-4",children:[N.jsx(Id,{className:"text-primary-500 w-6 h-6"}),t("onboarding.step2")]}),N.jsxs("div",{className:"space-y-4",children:[N.jsxs("div",{children:[N.jsx("label",{className:"label",children:t("onboarding.genreLabel")}),N.jsx("select",{value:s,onChange:h=>o(h.target.value),className:"input bg-white",children:a==null?void 0:a.map(h=>N.jsx("option",{value:h.id,children:String(t(`genres.${h.id}.name`,h.name))},h.id))})]}),N.jsx("div",{children:N.jsx("textarea",{rows:4,value:r,onChange:h=>i(h.target.value),placeholder:t("onboarding.ideaPlaceholder"),className:"input text-lg resize-none"})})]})]}),N.jsxs("section",{className:"text-center pt-4",children:[N.jsx("h2",{className:"text-xl font-bold mb-6",children:t("onboarding.step3")}),N.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[N.jsxs("button",{onClick:()=>d(!1),className:"flex flex-col items-center justify-center p-6 bg-white border-2 border-gray-200 hover:border-gray-400 rounded-xl transition-all",children:[N.jsx($8,{className:"w-10 h-10 text-gray-500 mb-3"}),N.jsx("span",{className:"font-semibold text-gray-800 text-lg",children:t("onboarding.btnFree")})]}),N.jsxs("button",{onClick:()=>d(!0),className:"flex flex-col items-center justify-center p-6 bg-primary-50 border-2 border-primary-500 hover:bg-primary-100 rounded-xl transition-all transform hover:scale-[1.02]",children:[N.jsx(Ua,{className:"w-10 h-10 text-primary-600 mb-3"}),N.jsx("span",{className:"font-semibold text-primary-800 text-lg",children:t("onboarding.btnAI")})]})]})]})]})]})}function kY(){const{t}=xs(),{user:e,isAuthenticated:n,logout:r,checkAuth:i}=N_(),[s,o]=z.useState(!1);return z.useEffect(()=>{i()},[]),N.jsxs("div",{className:"min-h-screen bg-gray-50",children:[N.jsx("header",{className:"bg-white border-b border-gray-200 sticky top-0 z-50",children:N.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:N.jsxs("div",{className:"flex items-center justify-between h-16",children:[N.jsxs("a",{href:"/",className:"flex items-center gap-2 no-underline",children:[N.jsx("div",{className:"w-8 h-8 bg-gradient-to-br from-primary-500 to-accent-500 rounded-lg flex items-center justify-center",children:N.jsx(Id,{className:"w-5 h-5 text-white"})}),N.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"CreaBook"})]}),N.jsxs("nav",{className:"flex items-center gap-1",children:[N.jsxs("a",{href:"/covers",className:"flex items-center gap-2 px-4 py-2 rounded-lg text-gray-600 hover:bg-gray-100 transition-colors",children:[N.jsx(kS,{className:"w-5 h-5"}),N.jsx("span",{className:"hidden sm:inline",children:t("nav.coverDesigner")})]}),N.jsxs("a",{href:"/books",className:"flex items-center gap-2 px-4 py-2 rounded-lg text-gray-600 hover:bg-gray-100 transition-colors",children:[N.jsx(Id,{className:"w-5 h-5"}),N.jsx("span",{className:"hidden sm:inline",children:t("nav.bookGenerator")})]}),(e==null?void 0:e.role)==="ADMIN"&&N.jsxs("a",{href:"/settings",className:"flex items-center gap-2 px-4 py-2 rounded-lg text-gray-600 hover:bg-gray-100 transition-colors",children:[N.jsx(gL,{className:"w-5 h-5"}),N.jsx("span",{className:"hidden sm:inline",children:t("nav.settings")})]}),N.jsx("div",{className:"w-px h-6 bg-gray-200 mx-2"}),n?N.jsxs("div",{className:"flex items-center gap-4 ml-2",children:[N.jsx("span",{className:"text-sm font-medium text-gray-700",children:(e==null?void 0:e.name)||(e==null?void 0:e.email)}),N.jsx("button",{onClick:r,className:"text-sm text-red-600 hover:text-red-700 font-medium",children:t("nav.logout")})]}):N.jsx("button",{onClick:()=>o(!0),className:"btn-primary ml-2 py-2",children:t("nav.loginRegister")})]})]})})}),N.jsx("main",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:N.jsxs(sR,{children:[N.jsx(Fc,{path:"/",element:N.jsx(wY,{})}),N.jsx(Fc,{path:"/covers",element:N.jsx(vH,{})}),N.jsx(Fc,{path:"/books",element:N.jsx(vY,{})}),N.jsx(Fc,{path:"/settings",element:N.jsx(SY,{})})]})}),N.jsx(oF,{isOpen:s,onClose:()=>o(!1)})]})}const{slice:CY,forEach:bY}=[];function EY(t){return bY.call(CY.call(arguments,1),e=>{if(e)for(const n in e)t[n]===void 0&&(t[n]=e[n])}),t}function _Y(t){return typeof t!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(n=>n.test(t))}const Kb=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,NY=function(t,e){const r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},i=encodeURIComponent(e);let s=`${t}=${i}`;if(r.maxAge>0){const o=r.maxAge-0;if(Number.isNaN(o))throw new Error("maxAge should be a Number");s+=`; Max-Age=${Math.floor(o)}`}if(r.domain){if(!Kb.test(r.domain))throw new TypeError("option domain is invalid");s+=`; Domain=${r.domain}`}if(r.path){if(!Kb.test(r.path))throw new TypeError("option path is invalid");s+=`; Path=${r.path}`}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");s+=`; Expires=${r.expires.toUTCString()}`}if(r.httpOnly&&(s+="; HttpOnly"),r.secure&&(s+="; Secure"),r.sameSite)switch(typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return r.partitioned&&(s+="; Partitioned"),s},qb={create(t,e,n,r){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+n*60*1e3)),r&&(i.domain=r),document.cookie=NY(t,e,i)},read(t){const e=`${t}=`,n=document.cookie.split(";");for(let r=0;r<n.length;r++){let i=n[r];for(;i.charAt(0)===" ";)i=i.substring(1,i.length);if(i.indexOf(e)===0)return i.substring(e.length,i.length)}return null},remove(t,e){this.create(t,"",-1,e)}};var TY={name:"cookie",lookup(t){let{lookupCookie:e}=t;if(e&&typeof document<"u")return qb.read(e)||void 0},cacheUserLanguage(t,e){let{lookupCookie:n,cookieMinutes:r,cookieDomain:i,cookieOptions:s}=e;n&&typeof document<"u"&&qb.create(n,t,r,i,s)}},MY={name:"querystring",lookup(t){var r;let{lookupQuerystring:e}=t,n;if(typeof window<"u"){let{search:i}=window.location;!window.location.search&&((r=window.location.hash)==null?void 0:r.indexOf("?"))>-1&&(i=window.location.hash.substring(window.location.hash.indexOf("?")));const o=i.substring(1).split("&");for(let a=0;a<o.length;a++){const l=o[a].indexOf("=");l>0&&o[a].substring(0,l)===e&&(n=o[a].substring(l+1))}}return n}},PY={name:"hash",lookup(t){var i;let{lookupHash:e,lookupFromHashIndex:n}=t,r;if(typeof window<"u"){const{hash:s}=window.location;if(s&&s.length>2){const o=s.substring(1);if(e){const a=o.split("&");for(let l=0;l<a.length;l++){const d=a[l].indexOf("=");d>0&&a[l].substring(0,d)===e&&(r=a[l].substring(d+1))}}if(r)return r;if(!r&&n>-1){const a=s.match(/\/([a-zA-Z-]*)/g);return Array.isArray(a)?(i=a[typeof n=="number"?n:0])==null?void 0:i.replace("/",""):void 0}}}return r}};let Pl=null;const Qb=()=>{if(Pl!==null)return Pl;try{if(Pl=typeof window<"u"&&window.localStorage!==null,!Pl)return!1;const t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{Pl=!1}return Pl};var OY={name:"localStorage",lookup(t){let{lookupLocalStorage:e}=t;if(e&&Qb())return window.localStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupLocalStorage:n}=e;n&&Qb()&&window.localStorage.setItem(n,t)}};let Ol=null;const Yb=()=>{if(Ol!==null)return Ol;try{if(Ol=typeof window<"u"&&window.sessionStorage!==null,!Ol)return!1;const t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Ol=!1}return Ol};var AY={name:"sessionStorage",lookup(t){let{lookupSessionStorage:e}=t;if(e&&Yb())return window.sessionStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupSessionStorage:n}=e;n&&Yb()&&window.sessionStorage.setItem(n,t)}},RY={name:"navigator",lookup(t){const e=[];if(typeof navigator<"u"){const{languages:n,userLanguage:r,language:i}=navigator;if(n)for(let s=0;s<n.length;s++)e.push(n[s]);r&&e.push(r),i&&e.push(i)}return e.length>0?e:void 0}},LY={name:"htmlTag",lookup(t){let{htmlTag:e}=t,n;const r=e||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},IY={name:"path",lookup(t){var i;let{lookupFromPathIndex:e}=t;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?(i=n[typeof e=="number"?e:0])==null?void 0:i.replace("/",""):void 0}},DY={name:"subdomain",lookup(t){var i,s;let{lookupFromSubdomainIndex:e}=t;const n=typeof e=="number"?e+1:1,r=typeof window<"u"&&((s=(i=window.location)==null?void 0:i.hostname)==null?void 0:s.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(r)return r[n]}};let n7=!1;try{document.cookie,n7=!0}catch{}const r7=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];n7||r7.splice(1,1);const FY=()=>({order:r7,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:t=>t});class i7{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(e,n)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e,this.options=EY(n,this.options||{},FY()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=i=>i.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(TY),this.addDetector(MY),this.addDetector(OY),this.addDetector(AY),this.addDetector(RY),this.addDetector(LY),this.addDetector(IY),this.addDetector(DY),this.addDetector(PY)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,n=[];return e.forEach(r=>{if(this.detectors[r]){let i=this.detectors[r].lookup(this.options);i&&typeof i=="string"&&(i=[i]),i&&(n=n.concat(i))}}),n=n.filter(r=>r!=null&&!_Y(r)).map(r=>this.options.convertDetectedLanguage(r)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||n.forEach(r=>{this.detectors[r]&&this.detectors[r].cacheUserLanguage(e,this.options)}))}}i7.type="languageDetector";const jY={coverDesigner:"Cover Designer",bookGenerator:"Book Generator",settings:"Settings",loginRegister:"Login / Register",logout:"Logout"},zY={welcomeBack:"Welcome Back",createAccount:"Create an Account",name:"Name",email:"Email",password:"Password",login:"Login",signUp:"Sign Up",pleaseWait:"Please wait...",dontHaveAccount:"Don't have an account? ",alreadyHaveAccount:"Already have an account? "},BY={title:"Settings",language:"Language",languageSelect:"Select your preferred language",english:"English",spanish:"Español"},UY={title:"Welcome to CreaBook",subtitle:"Let's personalize your creative journey.",step1:"1. Select your language",step2:"2. What kind of book do you want to create?",ideaPlaceholder:"E.g., A sci-fi thriller about a detective on Mars...",genreLabel:"Genre (optional)",step3:"3. How do you want to start?",btnFree:"Move Freely (Blank Canvas)",btnAI:"Use AI to Generate Outline"},HY={fiction:{name:"Fiction",description:"General literary fiction with focus on character development and narrative"},mystery:{name:"Mystery",description:"Puzzle-driven narratives with clues, suspects, and a satisfying reveal"},romance:{name:"Romance",description:"Love-centered stories with emotional intimacy and satisfying relationship resolution"},scifi:{name:"Science Fiction",description:"Speculative fiction exploring technology, space, time, and their impact on humanity"},fantasy:{name:"Fantasy",description:"Magical worlds with supernatural elements, quests, and epic stakes"},horror:{name:"Horror",description:"Fear-driven narratives designed to unsettle, frighten, and provoke dread"},thriller:{name:"Thriller",description:"High-stakes, fast-paced narratives with constant tension and danger"},children:{name:"Children's Book",description:"Age-appropriate stories with clear morals, simple language, and engaging characters"},nonfiction:{name:"Non-Fiction",description:"Factual, informative content organized around a central topic or argument"},selfhelp:{name:"Self-Help",description:"Practical guidance for personal improvement and growth"},business:{name:"Business",description:"Professional insights, strategies, and case studies for business success"},memoir:{name:"Memoir",description:"Personal life stories focused on transformation and universal themes"}},VY={selectGenre:"Select Your Genre",bookDetails:"Book Details",bookTitle:"Book Title (optional)",bookTitlePlaceholder:"My Amazing Book",coreIdea:"Core Idea",coreIdeaPlaceholder:"Describe your book idea... What's the story about? Who are the main characters? What conflict drives the narrative?",tip:"The more details you provide, the better the AI can generate your outline and content.",generateOutline:"Generate Outline"},GY={title:"Book Generator",subtitle:"Generate book ideas and write with AI assistance",tabGenre:"Genre",tabOutline:"Outline",tabWrite:"Write",tabCharacters:"Characters"},$Y={chapters:"Chapters",written:"Written",chapterSummary:"Chapter Summary",chapterOf:"Chapter {{current}} of {{total}}",aiAssist:"AI Assist",generating:"Generating...",generateChapter:"Generate Chapter",aiWritingAssistant:"AI Writing Assistant",expandSection:"Expand this section",improveProse:"Improve prose",addDescription:"Add description",rewriteParagraph:"Rewrite paragraph",words:"words",lastUpdated:"Last updated",noOutline:"Generate an outline first to start writing your book.",editorPlaceholder:"Start writing or use AI to generate this chapter..."},WY={untitledBook:"Untitled Book",genre:"Genre",generatingOutline:"Generating...",generateOutline:"Generate Outline",generatedOutline:"Generated Outline",logline:"Logline",chapterOutline:"Chapter Outline",chapter:"Chapter",noSummary:"No summary available",readyToWrite:"Ready to start writing! Navigate to the Write tab to begin.",readyToGenerate:"Ready to Generate",readyToGenerateDesc:'Click "Generate Outline" to create a detailed chapter outline based on your genre and book idea. The AI will create a structure following genre-specific patterns.',failedToGenerate:"Failed to generate outline"},KY={title:"Character Development",generating:"Generating...",generate:"Generate Characters",empty:'No characters yet. Click "Generate Characters" to create AI-suggested characters.',traits:"Traits",motivation:"Motivation"},qY={nav:jY,auth:zY,settings:BY,onboarding:UY,genres:HY,genreSelector:VY,bookGenerator:GY,bookEditor:$Y,bookOutline:WY,characters:KY},QY={coverDesigner:"Diseñador de Portadas",bookGenerator:"Generador de Libros",settings:"Ajustes",loginRegister:"Entrar / Registrarse",logout:"Cerrar Sesión"},YY={welcomeBack:"Bienvenido de nuevo",createAccount:"Crea una cuenta",name:"Nombre",email:"Correo electrónico",password:"Contraseña",login:"Entrar",signUp:"Registrarse",pleaseWait:"Por favor espera...",dontHaveAccount:"¿No tienes una cuenta? ",alreadyHaveAccount:"¿Ya tienes una cuenta? "},JY={title:"Ajustes",language:"Idioma",languageSelect:"Selecciona tu idioma preferido",english:"Inglés",spanish:"Español"},XY={title:"Bienvenido a CreaBook",subtitle:"Vamos a personalizar tu viaje creativo.",step1:"1. Selecciona tu idioma",step2:"2. ¿Qué tipo de libro quieres crear?",ideaPlaceholder:"Ej. Un thriller de ciencia ficción sobre un detective en Marte...",genreLabel:"Género (opcional)",step3:"3. ¿Cómo quieres empezar?",btnFree:"Moverse libremente (Lienzo en blanco)",btnAI:"Usar IA para generar tu esquema"},ZY={fiction:{name:"Ficción",description:"Ficción literaria general centrada en el desarrollo de personajes y la narrativa"},mystery:{name:"Misterio",description:"Narrativas basadas en enigmas con pistas, sospechosos y una revelación satisfactoria"},romance:{name:"Romance",description:"Historias centradas en el amor con intimidad emocional y una resolución satisfactoria"},scifi:{name:"Ciencia Ficción",description:"Ficción especulativa que explora la tecnología, el espacio, el tiempo y su impacto en la humanidad"},fantasy:{name:"Fantasía",description:"Mundos mágicos con elementos sobrenaturales, misiones y grandes desafíos"},horror:{name:"Terror",description:"Narrativas de miedo diseñadas para inquietar, asustar y provocar pavor"},thriller:{name:"Thriller",description:"Narrativas de alto riesgo y ritmo rápido con tensión y peligro constantes"},children:{name:"Libro Infantil",description:"Historias apropiadas para niños con moralejas claras, lenguaje sencillo y personajes atractivos"},nonfiction:{name:"No Ficción",description:"Contenido informativo y factual organizado en torno a un tema o argumento central"},selfhelp:{name:"Autoayuda",description:"Guía práctica para la mejora y el crecimiento personal"},business:{name:"Negocios",description:"Perspectivas profesionales, estrategias y casos de estudio para el éxito empresarial"},memoir:{name:"Memorias",description:"Historias de vida personales centradas en la transformación y temas universales"}},eJ={selectGenre:"Selecciona tu Género",bookDetails:"Detalles del Libro",bookTitle:"Título del Libro (opcional)",bookTitlePlaceholder:"Mi Libro Increíble",coreIdea:"Idea Principal",coreIdeaPlaceholder:"Describe tu idea para el libro... ¿De qué trata la historia? ¿Quiénes son los personajes principales? ¿Qué conflicto impulsa la narrativa?",tip:"Cuantos más detalles proporciones, mejor podrá la IA generar tu esquema y contenido.",generateOutline:"Generar Esquema"},tJ={title:"Generador de Libros",subtitle:"Genera ideas de libros y escribe con asistencia de IA",tabGenre:"Género",tabOutline:"Esquema",tabWrite:"Escribir",tabCharacters:"Personajes"},nJ={chapters:"Capítulos",written:"Escrito",chapterSummary:"Resumen del Capítulo",chapterOf:"Capítulo {{current}} de {{total}}",aiAssist:"Asistente IA",generating:"Generando...",generateChapter:"Generar Capítulo",aiWritingAssistant:"Asistente de Escritura IA",expandSection:"Expandir esta sección",improveProse:"Mejorar prosa",addDescription:"Añadir descripción",rewriteParagraph:"Reescribir párrafo",words:"palabras",lastUpdated:"Última actualización",noOutline:"Genera un esquema primero para empezar a escribir tu libro.",editorPlaceholder:"Empieza a escribir o usa la IA para generar este capítulo..."},rJ={untitledBook:"Libro sin título",genre:"Género",generatingOutline:"Generando...",generateOutline:"Generar Esquema",generatedOutline:"Esquema Generado",logline:"Sinopsis",chapterOutline:"Esquema de Capítulos",chapter:"Capítulo",noSummary:"Sin resumen disponible",readyToWrite:"¡Listo para escribir! Navega a la pestaña Escribir para comenzar.",readyToGenerate:"Listo para Generar",readyToGenerateDesc:'Haz clic en "Generar Esquema" para crear un esquema detallado de capítulos basado en tu género e idea. La IA creará una estructura siguiendo patrones específicos del género.',failedToGenerate:"Error al generar el esquema"},iJ={title:"Desarrollo de Personajes",generating:"Generando...",generate:"Generar Personajes",empty:'Aún no hay personajes. Haz clic en "Generar Personajes" para crear personajes sugeridos por la IA.',traits:"Rasgos",motivation:"Motivación"},sJ={nav:QY,auth:YY,settings:JY,onboarding:XY,genres:ZY,genreSelector:eJ,bookGenerator:tJ,bookEditor:nJ,bookOutline:rJ,characters:iJ};Vn.use(i7).use(XL).init({resources:{en:{translation:qY},es:{translation:sJ}},fallbackLng:"en",interpolation:{escapeValue:!1}});const oJ=new RR({defaultOptions:{queries:{staleTime:5*60*1e3,retry:1}}});f2.createRoot(document.getElementById("root")).render(N.jsx(ct.StrictMode,{children:N.jsx(LR,{client:oJ,children:N.jsx(lR,{children:N.jsx(kY,{})})})}));