From 6cd1bf305dd7d6c81b98b709137c732558e8b1c5 Mon Sep 17 00:00:00 2001 From: Ichitux Date: Sun, 5 Apr 2026 03:56:31 +0200 Subject: [PATCH] Multi lingua, hotfixes and design --- client/dist/assets/index-9IOnhCkb.js | 232 ----- client/dist/assets/index-CZFZrYeL.css | 1 + client/dist/assets/index-D3_QgWye.js | 453 ++++++++++ client/dist/assets/index-DS0xE7Ko.css | 1 - client/dist/index.html | 4 +- client/node_modules/.vite/deps/_metadata.json | 86 +- .../node_modules/.vite/deps/react-i18next.js | 6 +- client/node_modules/.vite/deps/zustand.js | 98 +-- client/node_modules/.vite/deps/zustand.js.map | 8 +- client/package.json | 6 + client/src/App.tsx | 9 +- client/src/components/OnboardingPage.tsx | 124 +++ client/src/components/RichTextEditor.tsx | 219 +++++ .../components/book-generator/BookEditor.tsx | 57 +- .../book-generator/BookGenerator.tsx | 52 +- .../book-generator/BookOutlineGenerator.tsx | 119 +-- .../book-generator/GenreSelector.tsx | 24 +- .../cover-designer/CoverDesigner.tsx | 62 +- .../components/cover-designer/CoverEditor.tsx | 42 +- .../cover-designer/CoverGallery.tsx | 13 +- client/src/index.css | 68 ++ client/src/locales/en.json | 143 +++ client/src/locales/es.json | 143 +++ client/src/stores/bookStore.ts | 3 + node_modules/.package-lock.json | 812 +++++++++++++++++- package-lock.json | 812 +++++++++++++++++- server/dist/api/books.js | 59 +- server/dist/api/books.js.map | 2 +- server/src/api/books.ts | 61 +- 29 files changed, 3157 insertions(+), 562 deletions(-) delete mode 100644 client/dist/assets/index-9IOnhCkb.js create mode 100644 client/dist/assets/index-CZFZrYeL.css create mode 100644 client/dist/assets/index-D3_QgWye.js delete mode 100644 client/dist/assets/index-DS0xE7Ko.css create mode 100644 client/src/components/OnboardingPage.tsx create mode 100644 client/src/components/RichTextEditor.tsx diff --git a/client/dist/assets/index-9IOnhCkb.js b/client/dist/assets/index-9IOnhCkb.js deleted file mode 100644 index 556ee8f6..00000000 --- a/client/dist/assets/index-9IOnhCkb.js +++ /dev/null @@ -1,232 +0,0 @@ -var fy=t=>{throw TypeError(t)};var Op=(t,e,n)=>e.has(t)||fy("Cannot "+n);var F=(t,e,n)=>(Op(t,e,"read from private field"),n?n.call(t):e.get(t)),de=(t,e,n)=>e.has(t)?fy("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),ne=(t,e,n,r)=>(Op(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),_e=(t,e,n)=>(Op(t,e,"access private method"),n);var Cc=(t,e,n,r)=>({set _(i){ne(t,e,i,n)},get _(){return F(t,e,r)}});function x9(t,e){for(var n=0;nr[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 l of s.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).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 py=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Yd(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var N3={exports:{}},Xd={},R3={exports:{}},Ne={};/** - * @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 pu=Symbol.for("react.element"),w9=Symbol.for("react.portal"),_9=Symbol.for("react.fragment"),C9=Symbol.for("react.strict_mode"),k9=Symbol.for("react.profiler"),E9=Symbol.for("react.provider"),P9=Symbol.for("react.context"),N9=Symbol.for("react.forward_ref"),R9=Symbol.for("react.suspense"),T9=Symbol.for("react.memo"),O9=Symbol.for("react.lazy"),gy=Symbol.iterator;function b9(t){return t===null||typeof t!="object"?null:(t=gy&&t[gy]||t["@@iterator"],typeof t=="function"?t:null)}var T3={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},O3=Object.assign,b3={};function Pa(t,e,n){this.props=t,this.context=e,this.refs=b3,this.updater=n||T3}Pa.prototype.isReactComponent={};Pa.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")};Pa.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function L3(){}L3.prototype=Pa.prototype;function Jg(t,e,n){this.props=t,this.context=e,this.refs=b3,this.updater=n||T3}var Zg=Jg.prototype=new L3;Zg.constructor=Jg;O3(Zg,Pa.prototype);Zg.isPureReactComponent=!0;var my=Array.isArray,F3=Object.prototype.hasOwnProperty,e1={current:null},A3={key:!0,ref:!0,__self:!0,__source:!0};function M3(t,e,n){var r,i={},s=null,l=null;if(e!=null)for(r in e.ref!==void 0&&(l=e.ref),e.key!==void 0&&(s=""+e.key),e)F3.call(e,r)&&!A3.hasOwnProperty(r)&&(i[r]=e[r]);var u=arguments.length-2;if(u===1)i.children=n;else if(1>>1,ie=W[Y];if(0>>1;Yi(it,Z))$ei(D,it)?(W[Y]=D,W[$e]=Z,Y=$e):(W[Y]=it,W[Ke]=Z,Y=Ke);else if($ei(D,Z))W[Y]=D,W[$e]=Z,Y=$e;else break e}}return te}function i(W,te){var Z=W.sortIndex-te.sortIndex;return Z!==0?Z:W.id-te.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var l=Date,u=l.now();t.unstable_now=function(){return l.now()-u}}var c=[],h=[],p=1,y=null,S=3,x=!1,m=!1,C=!1,P=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(W){for(var te=n(h);te!==null;){if(te.callback===null)r(h);else if(te.startTime<=W)r(h),te.sortIndex=te.expirationTime,e(c,te);else break;te=n(h)}}function _(W){if(C=!1,v(W),!m)if(n(c)!==null)m=!0,re(R);else{var te=n(h);te!==null&&he(_,te.startTime-W)}}function R(W,te){m=!1,C&&(C=!1,E(O),O=-1),x=!0;var Z=S;try{for(v(te),y=n(c);y!==null&&(!(y.expirationTime>te)||W&&!H());){var Y=y.callback;if(typeof Y=="function"){y.callback=null,S=y.priorityLevel;var ie=Y(y.expirationTime<=te);te=t.unstable_now(),typeof ie=="function"?y.callback=ie:y===n(c)&&r(c),v(te)}else r(c);y=n(c)}if(y!==null)var xe=!0;else{var Ke=n(h);Ke!==null&&he(_,Ke.startTime-te),xe=!1}return xe}finally{y=null,S=Z,x=!1}}var b=!1,A=null,O=-1,I=5,L=-1;function H(){return!(t.unstable_now()-LW||125Y?(W.sortIndex=Z,e(h,W),n(c)===null&&W===n(h)&&(C?(E(O),O=-1):C=!0,he(_,Z-Y))):(W.sortIndex=ie,e(c,W),m||x||(m=!0,re(R))),W},t.unstable_shouldYield=H,t.unstable_wrapCallback=function(W){var te=S;return function(){var Z=S;S=te;try{return W.apply(this,arguments)}finally{S=Z}}}})(z3);U3.exports=z3;var Pl=U3.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 H9=V,Ln=Pl;function J(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),E0=Object.prototype.hasOwnProperty,V9=/^[: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]*$/,vy={},Sy={};function W9(t){return E0.call(Sy,t)?!0:E0.call(vy,t)?!1:V9.test(t)?Sy[t]=!0:(vy[t]=!0,!1)}function K9(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 $9(t,e,n,r){if(e===null||typeof e>"u"||K9(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 ln(t,e,n,r,i,s,l){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=l}var Gt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Gt[t]=new ln(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Gt[e]=new ln(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Gt[t]=new ln(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Gt[t]=new ln(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){Gt[t]=new ln(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Gt[t]=new ln(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Gt[t]=new ln(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Gt[t]=new ln(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Gt[t]=new ln(t,5,!1,t.toLowerCase(),null,!1,!1)});var n1=/[\-:]([a-z])/g;function r1(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(n1,r1);Gt[e]=new ln(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(n1,r1);Gt[e]=new ln(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(n1,r1);Gt[e]=new ln(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Gt[t]=new ln(t,1,!1,t.toLowerCase(),null,!1,!1)});Gt.xlinkHref=new ln("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Gt[t]=new ln(t,1,!1,t.toLowerCase(),null,!0,!0)});function i1(t,e,n,r){var i=Gt.hasOwnProperty(e)?Gt[e]:null;(i!==null?i.type!==0:r||!(2u||i[l]!==s[u]){var c=` -`+i[l].replace(" at new "," at ");return t.displayName&&c.includes("")&&(c=c.replace("",t.displayName)),c}while(1<=l&&0<=u);break}}}finally{Fp=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Sl(t):""}function Q9(t){switch(t.tag){case 5:return Sl(t.type);case 16:return Sl("Lazy");case 13:return Sl("Suspense");case 19:return Sl("SuspenseList");case 0:case 2:case 15:return t=Ap(t.type,!1),t;case 11:return t=Ap(t.type.render,!1),t;case 1:return t=Ap(t.type,!0),t;default:return""}}function T0(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 jo:return"Fragment";case Do:return"Portal";case P0:return"Profiler";case s1:return"StrictMode";case N0:return"Suspense";case R0:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case H3:return(t.displayName||"Context")+".Consumer";case G3:return(t._context.displayName||"Context")+".Provider";case o1:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case a1:return e=t.displayName||null,e!==null?e:T0(t.type)||"Memo";case bi:e=t._payload,t=t._init;try{return T0(t(e))}catch{}}return null}function q9(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 T0(e);case 8:return e===s1?"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 ns(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function W3(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Y9(t){var e=W3(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(l){r=""+l,s.call(this,l)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(l){r=""+l},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Pc(t){t._valueTracker||(t._valueTracker=Y9(t))}function K3(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=W3(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function pd(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 O0(t,e){var n=e.checked;return ut({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function wy(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=ns(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 $3(t,e){e=e.checked,e!=null&&i1(t,"checked",e,!1)}function b0(t,e){$3(t,e);var n=ns(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")?L0(t,e.type,n):e.hasOwnProperty("defaultValue")&&L0(t,e.type,ns(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function _y(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 L0(t,e,n){(e!=="number"||pd(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var xl=Array.isArray;function qo(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Nc.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ul(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Nl={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},X9=["Webkit","ms","Moz","O"];Object.keys(Nl).forEach(function(t){X9.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Nl[e]=Nl[t]})});function X3(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Nl.hasOwnProperty(t)&&Nl[t]?(""+e).trim():e+"px"}function J3(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=X3(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var J9=ut({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 M0(t,e){if(e){if(J9[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(J(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(J(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(J(61))}if(e.style!=null&&typeof e.style!="object")throw Error(J(62))}}function I0(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 D0=null;function l1(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var j0=null,Yo=null,Xo=null;function Ey(t){if(t=yu(t)){if(typeof j0!="function")throw Error(J(280));var e=t.stateNode;e&&(e=nh(e),j0(t.stateNode,t.type,e))}}function Z3(t){Yo?Xo?Xo.push(t):Xo=[t]:Yo=t}function e5(){if(Yo){var t=Yo,e=Xo;if(Xo=Yo=null,Ey(t),e)for(t=0;t>>=0,t===0?32:31-(u7(t)/c7|0)|0}var Rc=64,Tc=4194304;function wl(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 vd(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,s=t.pingedLanes,l=n&268435455;if(l!==0){var u=l&~i;u!==0?r=wl(u):(s&=l,s!==0&&(r=wl(s)))}else l=n&~i,l!==0?r=wl(l):s!==0&&(r=wl(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;0n;n++)e.push(t);return e}function gu(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-hr(e),t[e]=n}function p7(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=Tl),Ay=" ",My=!1;function x5(t,e){switch(t){case"keyup":return G7.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function w5(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Uo=!1;function V7(t,e){switch(t){case"compositionend":return w5(e);case"keypress":return e.which!==32?null:(My=!0,Ay);case"textInput":return t=e.data,t===Ay&&My?null:t;default:return null}}function W7(t,e){if(Uo)return t==="compositionend"||!m1&&x5(t,e)?(t=v5(),Jc=f1=Vi=null,Uo=!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)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=Uy(n)}}function E5(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?E5(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function P5(){for(var t=window,e=pd();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=pd(t.document)}return e}function y1(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 ew(t){var e=P5(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&E5(n.ownerDocument.documentElement,n)){if(r!==null&&y1(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=zy(n,s);var l=zy(n,r);i&&l&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==l.node||t.focusOffset!==l.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>r?(t.addRange(e),t.extend(l.node,l.offset)):(e.setEnd(l.node,l.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=document.documentMode,zo=null,V0=null,bl=null,W0=!1;function By(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;W0||zo==null||zo!==pd(r)||(r=zo,"selectionStart"in r&&y1(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}),bl&&Wl(bl,r)||(bl=r,r=wd(V0,"onSelect"),0Ho||(t.current=X0[Ho],X0[Ho]=null,Ho--)}function We(t,e){Ho++,X0[Ho]=t.current,t.current=e}var rs={},Zt=os(rs),xn=os(!1),Qs=rs;function ga(t,e){var n=t.type.contextTypes;if(!n)return rs;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 wn(t){return t=t.childContextTypes,t!=null}function Cd(){Je(xn),Je(Zt)}function Qy(t,e,n){if(Zt.current!==rs)throw Error(J(168));We(Zt,e),We(xn,n)}function M5(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(J(108,q9(t)||"Unknown",i));return ut({},n,r)}function kd(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||rs,Qs=Zt.current,We(Zt,t),We(xn,xn.current),!0}function qy(t,e,n){var r=t.stateNode;if(!r)throw Error(J(169));n?(t=M5(t,e,Qs),r.__reactInternalMemoizedMergedChildContext=t,Je(xn),Je(Zt),We(Zt,t)):Je(xn),We(xn,n)}var Yr=null,rh=!1,Qp=!1;function I5(t){Yr===null?Yr=[t]:Yr.push(t)}function hw(t){rh=!0,I5(t)}function as(){if(!Qp&&Yr!==null){Qp=!0;var t=0,e=je;try{var n=Yr;for(je=1;t>=l,i-=l,ti=1<<32-hr(e)+i|n<O?(I=A,A=null):I=A.sibling;var L=S(E,A,v[O],_);if(L===null){A===null&&(A=I);break}t&&A&&L.alternate===null&&e(E,A),k=s(L,k,O),b===null?R=L:b.sibling=L,b=L,A=I}if(O===v.length)return n(E,A),tt&&Ns(E,O),R;if(A===null){for(;OO?(I=A,A=null):I=A.sibling;var H=S(E,A,L.value,_);if(H===null){A===null&&(A=I);break}t&&A&&H.alternate===null&&e(E,A),k=s(H,k,O),b===null?R=H:b.sibling=H,b=H,A=I}if(L.done)return n(E,A),tt&&Ns(E,O),R;if(A===null){for(;!L.done;O++,L=v.next())L=y(E,L.value,_),L!==null&&(k=s(L,k,O),b===null?R=L:b.sibling=L,b=L);return tt&&Ns(E,O),R}for(A=r(E,A);!L.done;O++,L=v.next())L=x(A,E,O,L.value,_),L!==null&&(t&&L.alternate!==null&&A.delete(L.key===null?O:L.key),k=s(L,k,O),b===null?R=L:b.sibling=L,b=L);return t&&A.forEach(function(B){return e(E,B)}),tt&&Ns(E,O),R}function P(E,k,v,_){if(typeof v=="object"&&v!==null&&v.type===jo&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case Ec:e:{for(var R=v.key,b=k;b!==null;){if(b.key===R){if(R=v.type,R===jo){if(b.tag===7){n(E,b.sibling),k=i(b,v.props.children),k.return=E,E=k;break e}}else if(b.elementType===R||typeof R=="object"&&R!==null&&R.$$typeof===bi&&Jy(R)===b.type){n(E,b.sibling),k=i(b,v.props),k.ref=dl(E,b,v),k.return=E,E=k;break e}n(E,b);break}else e(E,b);b=b.sibling}v.type===jo?(k=Ws(v.props.children,E.mode,_,v.key),k.return=E,E=k):(_=od(v.type,v.key,v.props,null,E.mode,_),_.ref=dl(E,k,v),_.return=E,E=_)}return l(E);case Do:e:{for(b=v.key;k!==null;){if(k.key===b)if(k.tag===4&&k.stateNode.containerInfo===v.containerInfo&&k.stateNode.implementation===v.implementation){n(E,k.sibling),k=i(k,v.children||[]),k.return=E,E=k;break e}else{n(E,k);break}else e(E,k);k=k.sibling}k=n0(v,E.mode,_),k.return=E,E=k}return l(E);case bi:return b=v._init,P(E,k,b(v._payload),_)}if(xl(v))return m(E,k,v,_);if(ol(v))return C(E,k,v,_);Ic(E,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,k!==null&&k.tag===6?(n(E,k.sibling),k=i(k,v),k.return=E,E=k):(n(E,k),k=t0(v,E.mode,_),k.return=E,E=k),l(E)):n(E,k)}return P}var ya=z5(!0),B5=z5(!1),Nd=os(null),Rd=null,Ko=null,w1=null;function _1(){w1=Ko=Rd=null}function C1(t){var e=Nd.current;Je(Nd),t._currentValue=e}function eg(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 Zo(t,e){Rd=t,w1=Ko=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Sn=!0),t.firstContext=null)}function Xn(t){var e=t._currentValue;if(w1!==t)if(t={context:t,memoizedValue:e,next:null},Ko===null){if(Rd===null)throw Error(J(308));Ko=t,Rd.dependencies={lanes:0,firstContext:t}}else Ko=Ko.next=t;return e}var bs=null;function k1(t){bs===null?bs=[t]:bs.push(t)}function G5(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,k1(e)):(n.next=i.next,i.next=n),e.interleaved=n,li(t,r)}function li(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 Li=!1;function E1(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function H5(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 ri(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Xi(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,li(t,n)}return i=r.interleaved,i===null?(e.next=e,k1(r)):(e.next=i.next,i.next=e),r.interleaved=e,li(t,n)}function ed(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,c1(t,n)}}function Zy(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 l={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=l:s=s.next=l,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 Td(t,e,n,r){var i=t.updateQueue;Li=!1;var s=i.firstBaseUpdate,l=i.lastBaseUpdate,u=i.shared.pending;if(u!==null){i.shared.pending=null;var c=u,h=c.next;c.next=null,l===null?s=h:l.next=h,l=c;var p=t.alternate;p!==null&&(p=p.updateQueue,u=p.lastBaseUpdate,u!==l&&(u===null?p.firstBaseUpdate=h:u.next=h,p.lastBaseUpdate=c))}if(s!==null){var y=i.baseState;l=0,p=h=c=null,u=s;do{var S=u.lane,x=u.eventTime;if((r&S)===S){p!==null&&(p=p.next={eventTime:x,lane:0,tag:u.tag,payload:u.payload,callback:u.callback,next:null});e:{var m=t,C=u;switch(S=e,x=n,C.tag){case 1:if(m=C.payload,typeof m=="function"){y=m.call(x,y,S);break e}y=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=C.payload,S=typeof m=="function"?m.call(x,y,S):m,S==null)break e;y=ut({},y,S);break e;case 2:Li=!0}}u.callback!==null&&u.lane!==0&&(t.flags|=64,S=i.effects,S===null?i.effects=[u]:S.push(u))}else x={eventTime:x,lane:S,tag:u.tag,payload:u.payload,callback:u.callback,next:null},p===null?(h=p=x,c=y):p=p.next=x,l|=S;if(u=u.next,u===null){if(u=i.shared.pending,u===null)break;S=u,u=S.next,S.next=null,i.lastBaseUpdate=S,i.shared.pending=null}}while(!0);if(p===null&&(c=y),i.baseState=c,i.firstBaseUpdate=h,i.lastBaseUpdate=p,e=i.shared.interleaved,e!==null){i=e;do l|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);Xs|=l,t.lanes=l,t.memoizedState=y}}function ev(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var r=Yp.transition;Yp.transition={};try{t(!1),e()}finally{je=n,Yp.transition=r}}function o6(){return Jn().memoizedState}function mw(t,e,n){var r=Zi(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},a6(t))l6(e,n);else if(n=G5(t,e,n,r),n!==null){var i=on();fr(n,t,r,i),u6(n,e,r)}}function yw(t,e,n){var r=Zi(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(a6(t))l6(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var l=e.lastRenderedState,u=s(l,n);if(i.hasEagerState=!0,i.eagerState=u,gr(u,l)){var c=e.interleaved;c===null?(i.next=i,k1(e)):(i.next=c.next,c.next=i),e.interleaved=i;return}}catch{}finally{}n=G5(t,e,i,r),n!==null&&(i=on(),fr(n,t,r,i),u6(n,e,r))}}function a6(t){var e=t.alternate;return t===lt||e!==null&&e===lt}function l6(t,e){Ll=bd=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function u6(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,c1(t,n)}}var Ld={readContext:Xn,useCallback:Qt,useContext:Qt,useEffect:Qt,useImperativeHandle:Qt,useInsertionEffect:Qt,useLayoutEffect:Qt,useMemo:Qt,useReducer:Qt,useRef:Qt,useState:Qt,useDebugValue:Qt,useDeferredValue:Qt,useTransition:Qt,useMutableSource:Qt,useSyncExternalStore:Qt,useId:Qt,unstable_isNewReconciler:!1},vw={readContext:Xn,useCallback:function(t,e){return Rr().memoizedState=[t,e===void 0?null:e],t},useContext:Xn,useEffect:nv,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,nd(4194308,4,t6.bind(null,e,t),n)},useLayoutEffect:function(t,e){return nd(4194308,4,t,e)},useInsertionEffect:function(t,e){return nd(4,2,t,e)},useMemo:function(t,e){var n=Rr();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Rr();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=mw.bind(null,lt,t),[r.memoizedState,t]},useRef:function(t){var e=Rr();return t={current:t},e.memoizedState=t},useState:tv,useDebugValue:F1,useDeferredValue:function(t){return Rr().memoizedState=t},useTransition:function(){var t=tv(!1),e=t[0];return t=gw.bind(null,t[1]),Rr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=lt,i=Rr();if(tt){if(n===void 0)throw Error(J(407));n=n()}else{if(n=e(),Dt===null)throw Error(J(349));Ys&30||$5(r,e,n)}i.memoizedState=n;var s={value:n,getSnapshot:e};return i.queue=s,nv(q5.bind(null,r,s,t),[t]),r.flags|=2048,Zl(9,Q5.bind(null,r,s,n,e),void 0,null),n},useId:function(){var t=Rr(),e=Dt.identifierPrefix;if(tt){var n=ni,r=ti;n=(r&~(1<<32-hr(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Xl++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=l.createElement(n,{is:r.is}):(t=l.createElement(n),n==="select"&&(l=t,r.multiple?l.multiple=!0:r.size&&(l.size=r.size))):t=l.createElementNS(t,n),t[Lr]=e,t[Ql]=r,S6(t,e,!1,!1),e.stateNode=t;e:{switch(l=I0(n,r),n){case"dialog":Xe("cancel",t),Xe("close",t),i=r;break;case"iframe":case"object":case"embed":Xe("load",t),i=r;break;case"video":case"audio":for(i=0;i<_l.length;i++)Xe(_l[i],t);i=r;break;case"source":Xe("error",t),i=r;break;case"img":case"image":case"link":Xe("error",t),Xe("load",t),i=r;break;case"details":Xe("toggle",t),i=r;break;case"input":wy(t,r),i=O0(t,r),Xe("invalid",t);break;case"option":i=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},i=ut({},r,{value:void 0}),Xe("invalid",t);break;case"textarea":Cy(t,r),i=F0(t,r),Xe("invalid",t);break;default:i=r}M0(n,i),u=i;for(s in u)if(u.hasOwnProperty(s)){var c=u[s];s==="style"?J3(t,c):s==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&Y3(t,c)):s==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Ul(t,c):typeof c=="number"&&Ul(t,""+c):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(jl.hasOwnProperty(s)?c!=null&&s==="onScroll"&&Xe("scroll",t):c!=null&&i1(t,s,c,l))}switch(n){case"input":Pc(t),_y(t,r,!1);break;case"textarea":Pc(t),ky(t);break;case"option":r.value!=null&&t.setAttribute("value",""+ns(r.value));break;case"select":t.multiple=!!r.multiple,s=r.value,s!=null?qo(t,!!r.multiple,s,!1):r.defaultValue!=null&&qo(t,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(t.onclick=_d)}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 qt(e),null;case 6:if(t&&e.stateNode!=null)w6(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(J(166));if(n=Ls(Yl.current),Ls(Ir.current),Mc(e)){if(r=e.stateNode,n=e.memoizedProps,r[Lr]=e,(s=r.nodeValue!==n)&&(t=bn,t!==null))switch(t.tag){case 3:Ac(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Ac(r.nodeValue,n,(t.mode&1)!==0)}s&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Lr]=e,e.stateNode=r}return qt(e),null;case 13:if(Je(at),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(tt&&On!==null&&e.mode&1&&!(e.flags&128))U5(),ma(),e.flags|=98560,s=!1;else if(s=Mc(e),r!==null&&r.dehydrated!==null){if(t===null){if(!s)throw Error(J(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(J(317));s[Lr]=e}else ma(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;qt(e),s=!1}else dr!==null&&(mg(dr),dr=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||at.current&1?Nt===0&&(Nt=3):z1())),e.updateQueue!==null&&(e.flags|=4),qt(e),null);case 4:return va(),lg(t,e),t===null&&Kl(e.stateNode.containerInfo),qt(e),null;case 10:return C1(e.type._context),qt(e),null;case 17:return wn(e.type)&&Cd(),qt(e),null;case 19:if(Je(at),s=e.memoizedState,s===null)return qt(e),null;if(r=(e.flags&128)!==0,l=s.rendering,l===null)if(r)hl(s,!1);else{if(Nt!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(l=Od(t),l!==null){for(e.flags|=128,hl(s,!1),r=l.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,l=s.alternate,l===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=l.childLanes,s.lanes=l.lanes,s.child=l.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=l.memoizedProps,s.memoizedState=l.memoizedState,s.updateQueue=l.updateQueue,s.type=l.type,t=l.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return We(at,at.current&1|2),e.child}t=t.sibling}s.tail!==null&&mt()>xa&&(e.flags|=128,r=!0,hl(s,!1),e.lanes=4194304)}else{if(!r)if(t=Od(l),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),hl(s,!0),s.tail===null&&s.tailMode==="hidden"&&!l.alternate&&!tt)return qt(e),null}else 2*mt()-s.renderingStartTime>xa&&n!==1073741824&&(e.flags|=128,r=!0,hl(s,!1),e.lanes=4194304);s.isBackwards?(l.sibling=e.child,e.child=l):(n=s.last,n!==null?n.sibling=l:e.child=l,s.last=l)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=mt(),e.sibling=null,n=at.current,We(at,r?n&1|2:n&1),e):(qt(e),null);case 22:case 23:return U1(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Nn&1073741824&&(qt(e),e.subtreeFlags&6&&(e.flags|=8192)):qt(e),null;case 24:return null;case 25:return null}throw Error(J(156,e.tag))}function Pw(t,e){switch(S1(e),e.tag){case 1:return wn(e.type)&&Cd(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return va(),Je(xn),Je(Zt),R1(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return N1(e),null;case 13:if(Je(at),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(J(340));ma()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Je(at),null;case 4:return va(),null;case 10:return C1(e.type._context),null;case 22:case 23:return U1(),null;case 24:return null;default:return null}}var jc=!1,Xt=!1,Nw=typeof WeakSet=="function"?WeakSet:Set,le=null;function $o(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ht(t,e,r)}else n.current=null}function ug(t,e,n){try{n()}catch(r){ht(t,e,r)}}var fv=!1;function Rw(t,e){if(K0=Sd,t=P5(),y1(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 l=0,u=-1,c=-1,h=0,p=0,y=t,S=null;t:for(;;){for(var x;y!==n||i!==0&&y.nodeType!==3||(u=l+i),y!==s||r!==0&&y.nodeType!==3||(c=l+r),y.nodeType===3&&(l+=y.nodeValue.length),(x=y.firstChild)!==null;)S=y,y=x;for(;;){if(y===t)break t;if(S===n&&++h===i&&(u=l),S===s&&++p===r&&(c=l),(x=y.nextSibling)!==null)break;y=S,S=y.parentNode}y=x}n=u===-1||c===-1?null:{start:u,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for($0={focusedElem:t,selectionRange:n},Sd=!1,le=e;le!==null;)if(e=le,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,le=t;else for(;le!==null;){e=le;try{var m=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var C=m.memoizedProps,P=m.memoizedState,E=e.stateNode,k=E.getSnapshotBeforeUpdate(e.elementType===e.type?C:lr(e.type,C),P);E.__reactInternalSnapshotBeforeUpdate=k}break;case 3:var v=e.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(J(163))}}catch(_){ht(e,e.return,_)}if(t=e.sibling,t!==null){t.return=e.return,le=t;break}le=e.return}return m=fv,fv=!1,m}function Fl(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&&ug(e,n,s)}i=i.next}while(i!==r)}}function oh(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 cg(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 _6(t){var e=t.alternate;e!==null&&(t.alternate=null,_6(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Lr],delete e[Ql],delete e[Y0],delete e[cw],delete e[dw])),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 C6(t){return t.tag===5||t.tag===3||t.tag===4}function pv(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||C6(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 dg(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=_d));else if(r!==4&&(t=t.child,t!==null))for(dg(t,e,n),t=t.sibling;t!==null;)dg(t,e,n),t=t.sibling}function hg(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(hg(t,e,n),t=t.sibling;t!==null;)hg(t,e,n),t=t.sibling}var zt=null,cr=!1;function Ni(t,e,n){for(n=n.child;n!==null;)k6(t,e,n),n=n.sibling}function k6(t,e,n){if(Mr&&typeof Mr.onCommitFiberUnmount=="function")try{Mr.onCommitFiberUnmount(Jd,n)}catch{}switch(n.tag){case 5:Xt||$o(n,e);case 6:var r=zt,i=cr;zt=null,Ni(t,e,n),zt=r,cr=i,zt!==null&&(cr?(t=zt,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):zt.removeChild(n.stateNode));break;case 18:zt!==null&&(cr?(t=zt,n=n.stateNode,t.nodeType===8?$p(t.parentNode,n):t.nodeType===1&&$p(t,n),Hl(t)):$p(zt,n.stateNode));break;case 4:r=zt,i=cr,zt=n.stateNode.containerInfo,cr=!0,Ni(t,e,n),zt=r,cr=i;break;case 0:case 11:case 14:case 15:if(!Xt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,l=s.destroy;s=s.tag,l!==void 0&&(s&2||s&4)&&ug(n,e,l),i=i.next}while(i!==r)}Ni(t,e,n);break;case 1:if(!Xt&&($o(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){ht(n,e,u)}Ni(t,e,n);break;case 21:Ni(t,e,n);break;case 22:n.mode&1?(Xt=(r=Xt)||n.memoizedState!==null,Ni(t,e,n),Xt=r):Ni(t,e,n);break;default:Ni(t,e,n)}}function gv(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new Nw),e.forEach(function(r){var i=Dw.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function or(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=l),r&=~s}if(r=i,r=mt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Ow(r/1960))-r,10t?16:t,Wi===null)var r=!1;else{if(t=Wi,Wi=null,Md=0,be&6)throw Error(J(331));var i=be;for(be|=4,le=t.current;le!==null;){var s=le,l=s.child;if(le.flags&16){var u=s.deletions;if(u!==null){for(var c=0;cmt()-D1?Vs(t,0):I1|=n),_n(t,e)}function L6(t,e){e===0&&(t.mode&1?(e=Tc,Tc<<=1,!(Tc&130023424)&&(Tc=4194304)):e=1);var n=on();t=li(t,e),t!==null&&(gu(t,e,n),_n(t,n))}function Iw(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),L6(t,n)}function Dw(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(J(314))}r!==null&&r.delete(e),L6(t,n)}var F6;F6=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||xn.current)Sn=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Sn=!1,kw(t,e,n);Sn=!!(t.flags&131072)}else Sn=!1,tt&&e.flags&1048576&&D5(e,Pd,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;rd(t,e),t=e.pendingProps;var i=ga(e,Zt.current);Zo(e,n),i=O1(null,e,r,t,i,n);var s=b1();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,wn(r)?(s=!0,kd(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,E1(e),i.updater=sh,e.stateNode=i,i._reactInternals=e,ng(e,r,t,n),e=sg(null,e,r,!0,s,n)):(e.tag=0,tt&&s&&v1(e),rn(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(rd(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=Uw(r),t=lr(r,t),i){case 0:e=ig(null,e,r,t,n);break e;case 1:e=cv(null,e,r,t,n);break e;case 11:e=lv(null,e,r,t,n);break e;case 14:e=uv(null,e,r,lr(r.type,t),n);break e}throw Error(J(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:lr(r,i),ig(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:lr(r,i),cv(t,e,r,i,n);case 3:e:{if(m6(e),t===null)throw Error(J(387));r=e.pendingProps,s=e.memoizedState,i=s.element,H5(t,e),Td(e,r,null,n);var l=e.memoizedState;if(r=l.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:l.cache,pendingSuspenseBoundaries:l.pendingSuspenseBoundaries,transitions:l.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=Sa(Error(J(423)),e),e=dv(t,e,r,n,i);break e}else if(r!==i){i=Sa(Error(J(424)),e),e=dv(t,e,r,n,i);break e}else for(On=Yi(e.stateNode.containerInfo.firstChild),bn=e,tt=!0,dr=null,n=B5(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ma(),r===i){e=ui(t,e,n);break e}rn(t,e,r,n)}e=e.child}return e;case 5:return V5(e),t===null&&Z0(e),r=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,l=i.children,Q0(r,i)?l=null:s!==null&&Q0(r,s)&&(e.flags|=32),g6(t,e),rn(t,e,l,n),e.child;case 6:return t===null&&Z0(e),null;case 13:return y6(t,e,n);case 4:return P1(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=ya(e,null,r,n):rn(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:lr(r,i),lv(t,e,r,i,n);case 7:return rn(t,e,e.pendingProps,n),e.child;case 8:return rn(t,e,e.pendingProps.children,n),e.child;case 12:return rn(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,l=i.value,We(Nd,r._currentValue),r._currentValue=l,s!==null)if(gr(s.value,l)){if(s.children===i.children&&!xn.current){e=ui(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var u=s.dependencies;if(u!==null){l=s.child;for(var c=u.firstContext;c!==null;){if(c.context===r){if(s.tag===1){c=ri(-1,n&-n),c.tag=2;var h=s.updateQueue;if(h!==null){h=h.shared;var p=h.pending;p===null?c.next=c:(c.next=p.next,p.next=c),h.pending=c}}s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),eg(s.return,n,e),u.lanes|=n;break}c=c.next}}else if(s.tag===10)l=s.type===e.type?null:s.child;else if(s.tag===18){if(l=s.return,l===null)throw Error(J(341));l.lanes|=n,u=l.alternate,u!==null&&(u.lanes|=n),eg(l,n,e),l=s.sibling}else l=s.child;if(l!==null)l.return=s;else for(l=s;l!==null;){if(l===e){l=null;break}if(s=l.sibling,s!==null){s.return=l.return,l=s;break}l=l.return}s=l}rn(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,Zo(e,n),i=Xn(i),r=r(i),e.flags|=1,rn(t,e,r,n),e.child;case 14:return r=e.type,i=lr(r,e.pendingProps),i=lr(r.type,i),uv(t,e,r,i,n);case 15:return f6(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:lr(r,i),rd(t,e),e.tag=1,wn(r)?(t=!0,kd(e)):t=!1,Zo(e,n),c6(e,r,i),ng(e,r,i,n),sg(null,e,r,!0,t,n);case 19:return v6(t,e,n);case 22:return p6(t,e,n)}throw Error(J(156,e.tag))};function A6(t,e){return a5(t,e)}function jw(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 qn(t,e,n,r){return new jw(t,e,n,r)}function B1(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Uw(t){if(typeof t=="function")return B1(t)?1:0;if(t!=null){if(t=t.$$typeof,t===o1)return 11;if(t===a1)return 14}return 2}function es(t,e){var n=t.alternate;return n===null?(n=qn(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 od(t,e,n,r,i,s){var l=2;if(r=t,typeof t=="function")B1(t)&&(l=1);else if(typeof t=="string")l=5;else e:switch(t){case jo:return Ws(n.children,i,s,e);case s1:l=8,i|=8;break;case P0:return t=qn(12,n,e,i|2),t.elementType=P0,t.lanes=s,t;case N0:return t=qn(13,n,e,i),t.elementType=N0,t.lanes=s,t;case R0:return t=qn(19,n,e,i),t.elementType=R0,t.lanes=s,t;case V3:return lh(n,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case G3:l=10;break e;case H3:l=9;break e;case o1:l=11;break e;case a1:l=14;break e;case bi:l=16,r=null;break e}throw Error(J(130,t==null?t:typeof t,""))}return e=qn(l,n,e,i),e.elementType=t,e.type=r,e.lanes=s,e}function Ws(t,e,n,r){return t=qn(7,t,r,e),t.lanes=n,t}function lh(t,e,n,r){return t=qn(22,t,r,e),t.elementType=V3,t.lanes=n,t.stateNode={isHidden:!1},t}function t0(t,e,n){return t=qn(6,t,null,e),t.lanes=n,t}function n0(t,e,n){return e=qn(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function zw(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=Ip(0),this.expirationTimes=Ip(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ip(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function G1(t,e,n,r,i,s,l,u,c){return t=new zw(t,e,n,u,c),e===1?(e=1,s===!0&&(e|=8)):e=0,s=qn(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},E1(s),t}function Bw(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(j6)}catch(t){console.error(t)}}j6(),j3.exports=Fn;var Kw=j3.exports,Cv=Kw;k0.createRoot=Cv.createRoot,k0.hydrateRoot=Cv.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 tu(){return tu=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function K1(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function Qw(){return Math.random().toString(36).substr(2,8)}function Ev(t,e){return{usr:t.state,key:t.key,idx:e}}function yg(t,e,n,r){return n===void 0&&(n=null),tu({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Ta(e):e,{state:n,key:e&&e.key||r||Qw()})}function U6(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 Ta(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 qw(t,e,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,l=i.history,u=Ki.Pop,c=null,h=p();h==null&&(h=0,l.replaceState(tu({},l.state,{idx:h}),""));function p(){return(l.state||{idx:null}).idx}function y(){u=Ki.Pop;let P=p(),E=P==null?null:P-h;h=P,c&&c({action:u,location:C.location,delta:E})}function S(P,E){u=Ki.Push;let k=yg(C.location,P,E);h=p()+1;let v=Ev(k,h),_=C.createHref(k);try{l.pushState(v,"",_)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;i.location.assign(_)}s&&c&&c({action:u,location:C.location,delta:1})}function x(P,E){u=Ki.Replace;let k=yg(C.location,P,E);h=p();let v=Ev(k,h),_=C.createHref(k);l.replaceState(v,"",_),s&&c&&c({action:u,location:C.location,delta:0})}function m(P){let E=i.location.origin!=="null"?i.location.origin:i.location.href,k=typeof P=="string"?P:U6(P);return k=k.replace(/ $/,"%20"),xt(E,"No window.location.(origin|href) available to create URL for href: "+k),new URL(k,E)}let C={get action(){return u},get location(){return t(i,l)},listen(P){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(kv,y),c=P,()=>{i.removeEventListener(kv,y),c=null}},createHref(P){return e(i,P)},createURL:m,encodeLocation(P){let E=m(P);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:S,replace:x,go(P){return l.go(P)}};return C}var Pv;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Pv||(Pv={}));function Yw(t,e,n){return n===void 0&&(n="/"),Xw(t,e,n)}function Xw(t,e,n,r){let i=typeof e=="string"?Ta(e):e,s=G6(i.pathname||"/",n);if(s==null)return null;let l=z6(t);Jw(l);let u=null;for(let c=0;u==null&&c{let c={relativePath:u===void 0?s.path||"":u,caseSensitive:s.caseSensitive===!0,childrenIndex:l,route:s};c.relativePath.startsWith("/")&&(xt(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let h=Ks([r,c.relativePath]),p=n.concat(c);s.children&&s.children.length>0&&(xt(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+h+'".')),z6(s.children,e,p,h)),!(s.path==null&&!s.index)&&e.push({path:h,score:s_(h,s.index),routesMeta:p})};return t.forEach((s,l)=>{var u;if(s.path===""||!((u=s.path)!=null&&u.includes("?")))i(s,l);else for(let c of B6(s.path))i(s,l,c)}),e}function B6(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 l=B6(r.join("/")),u=[];return u.push(...l.map(c=>c===""?s:[s,c].join("/"))),i&&u.push(...l),u.map(c=>t.startsWith("/")&&c===""?"/":c)}function Jw(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:o_(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const Zw=/^:[\w-]+$/,e_=3,t_=2,n_=1,r_=10,i_=-2,Nv=t=>t==="*";function s_(t,e){let n=t.split("/"),r=n.length;return n.some(Nv)&&(r+=i_),e&&(r+=t_),n.filter(i=>!Nv(i)).reduce((i,s)=>i+(Zw.test(s)?e_:s===""?n_:r_),r)}function o_(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="/",l=[];for(let u=0;u{let{paramName:S,isOptional:x}=p;if(S==="*"){let C=u[y]||"";l=s.slice(0,s.length-C.length).replace(/(.)\/+$/,"$1")}const m=u[y];return x&&!m?h[S]=void 0:h[S]=(m||"").replace(/%2F/g,"/"),h},{}),pathname:s,pathnameBase:l,pattern:t}}function u_(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),K1(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,(l,u,c)=>(r.push({paramName:u,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function c_(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return K1(!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 G6(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 d_=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,h_=t=>d_.test(t);function f_(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?Ta(t):t,s;if(n)if(h_(n))s=n;else{if(n.includes("//")){let l=n;n=n.replace(/\/\/+/g,"/"),K1(!1,"Pathnames cannot have embedded double slashes - normalizing "+(l+" -> "+n))}n.startsWith("/")?s=Rv(n.substring(1),"/"):s=Rv(n,e)}else s=e;return{pathname:s,search:m_(r),hash:y_(i)}}function Rv(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 r0(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 and the router will parse it for you.'}function p_(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function H6(t,e){let n=p_(t);return e?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function V6(t,e,n,r){r===void 0&&(r=!1);let i;typeof t=="string"?i=Ta(t):(i=tu({},t),xt(!i.pathname||!i.pathname.includes("?"),r0("?","pathname","search",i)),xt(!i.pathname||!i.pathname.includes("#"),r0("#","pathname","hash",i)),xt(!i.search||!i.search.includes("#"),r0("#","search","hash",i)));let s=t===""||i.pathname==="",l=s?"/":i.pathname,u;if(l==null)u=n;else{let y=e.length-1;if(!r&&l.startsWith("..")){let S=l.split("/");for(;S[0]==="..";)S.shift(),y-=1;i.pathname=S.join("/")}u=y>=0?e[y]:"/"}let c=f_(i,u),h=l&&l!=="/"&&l.endsWith("/"),p=(s||l===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(h||p)&&(c.pathname+="/"),c}const Ks=t=>t.join("/").replace(/\/\/+/g,"/"),g_=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),m_=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,y_=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function v_(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const W6=["post","put","patch","delete"];new Set(W6);const S_=["get",...W6];new Set(S_);/** - * 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 nu(){return nu=Object.assign?Object.assign.bind():function(t){for(var e=1;e{u.current=!0}),V.useCallback(function(h,p){if(p===void 0&&(p={}),!u.current)return;if(typeof h=="number"){r.go(h);return}let y=V6(h,JSON.parse(l),s,p.relative==="path");t==null&&e!=="/"&&(y.pathname=y.pathname==="/"?e:Ks([e,y.pathname])),(p.replace?r.replace:r.push)(y,p.state,p)},[e,r,l,s,t])}function C_(t,e){return k_(t,e)}function k_(t,e,n,r){xu()||xt(!1);let{navigator:i}=V.useContext(Su),{matches:s}=V.useContext(so),l=s[s.length-1],u=l?l.params:{};l&&l.pathname;let c=l?l.pathnameBase:"/";l&&l.route;let h=Q1(),p;if(e){var y;let P=typeof e=="string"?Ta(e):e;c==="/"||(y=P.pathname)!=null&&y.startsWith(c)||xt(!1),p=P}else p=h;let S=p.pathname||"/",x=S;if(c!=="/"){let P=c.replace(/^\//,"").split("/");x="/"+S.replace(/^\//,"").split("/").slice(P.length).join("/")}let m=Yw(t,{pathname:x}),C=T_(m&&m.map(P=>Object.assign({},P,{params:Object.assign({},u,P.params),pathname:Ks([c,i.encodeLocation?i.encodeLocation(P.pathname).pathname:P.pathname]),pathnameBase:P.pathnameBase==="/"?c:Ks([c,i.encodeLocation?i.encodeLocation(P.pathnameBase).pathname:P.pathnameBase])})),s,n,r);return e&&C?V.createElement(fh.Provider,{value:{location:nu({pathname:"/",search:"",hash:"",state:null,key:"default"},p),navigationType:Ki.Pop}},C):C}function E_(){let t=F_(),e=v_(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 V.createElement(V.Fragment,null,V.createElement("h2",null,"Unexpected Application Error!"),V.createElement("h3",{style:{fontStyle:"italic"}},e),n?V.createElement("pre",{style:i},n):null,null)}const P_=V.createElement(E_,null);class N_ extends V.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?V.createElement(so.Provider,{value:this.props.routeContext},V.createElement(K6.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function R_(t){let{routeContext:e,match:n,children:r}=t,i=V.useContext($1);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),V.createElement(so.Provider,{value:e},r)}function T_(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 l=t,u=(i=n)==null?void 0:i.errors;if(u!=null){let p=l.findIndex(y=>y.route.id&&(u==null?void 0:u[y.route.id])!==void 0);p>=0||xt(!1),l=l.slice(0,Math.min(l.length,p+1))}let c=!1,h=-1;if(n&&r&&r.v7_partialHydration)for(let p=0;p=0?l=l.slice(0,h+1):l=[l[0]];break}}}return l.reduceRight((p,y,S)=>{let x,m=!1,C=null,P=null;n&&(x=u&&y.route.id?u[y.route.id]:void 0,C=y.route.errorElement||P_,c&&(h<0&&S===0?(M_("route-fallback"),m=!0,P=null):h===S&&(m=!0,P=y.route.hydrateFallbackElement||null)));let E=e.concat(l.slice(0,S+1)),k=()=>{let v;return x?v=C:m?v=P:y.route.Component?v=V.createElement(y.route.Component,null):y.route.element?v=y.route.element:v=p,V.createElement(R_,{match:y,routeContext:{outlet:p,matches:E,isDataRoute:n!=null},children:v})};return n&&(y.route.ErrorBoundary||y.route.errorElement||S===0)?V.createElement(N_,{location:n.location,revalidation:n.revalidation,component:C,error:x,children:k(),routeContext:{outlet:null,matches:E,isDataRoute:!0}}):k()},null)}var Q6=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(Q6||{}),q6=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}(q6||{});function O_(t){let e=V.useContext($1);return e||xt(!1),e}function b_(t){let e=V.useContext(x_);return e||xt(!1),e}function L_(t){let e=V.useContext(so);return e||xt(!1),e}function Y6(t){let e=L_(),n=e.matches[e.matches.length-1];return n.route.id||xt(!1),n.route.id}function F_(){var t;let e=V.useContext(K6),n=b_(),r=Y6();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function A_(){let{router:t}=O_(Q6.UseNavigateStable),e=Y6(q6.UseNavigateStable),n=V.useRef(!1);return $6(()=>{n.current=!0}),V.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,nu({fromRouteId:e},s)))},[t,e])}const Tv={};function M_(t,e,n){Tv[t]||(Tv[t]=!0)}function I_(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function D_(t){let{to:e,replace:n,state:r,relative:i}=t;xu()||xt(!1);let{future:s,static:l}=V.useContext(Su),{matches:u}=V.useContext(so),{pathname:c}=Q1(),h=w_(),p=V6(e,H6(u,s.v7_relativeSplatPath),c,i==="path"),y=JSON.stringify(p);return V.useEffect(()=>h(JSON.parse(y),{replace:n,state:r,relative:i}),[h,y,i,n,r]),null}function Cl(t){xt(!1)}function j_(t){let{basename:e="/",children:n=null,location:r,navigationType:i=Ki.Pop,navigator:s,static:l=!1,future:u}=t;xu()&&xt(!1);let c=e.replace(/^\/*/,"/"),h=V.useMemo(()=>({basename:c,navigator:s,static:l,future:nu({v7_relativeSplatPath:!1},u)}),[c,u,s,l]);typeof r=="string"&&(r=Ta(r));let{pathname:p="/",search:y="",hash:S="",state:x=null,key:m="default"}=r,C=V.useMemo(()=>{let P=G6(p,c);return P==null?null:{location:{pathname:P,search:y,hash:S,state:x,key:m},navigationType:i}},[c,p,y,S,x,m,i]);return C==null?null:V.createElement(Su.Provider,{value:h},V.createElement(fh.Provider,{children:n,value:C}))}function U_(t){let{children:e,location:n}=t;return C_(vg(e),n)}new Promise(()=>{});function vg(t,e){e===void 0&&(e=[]);let n=[];return V.Children.forEach(t,(r,i)=>{if(!V.isValidElement(r))return;let s=[...e,i];if(r.type===V.Fragment){n.push.apply(n,vg(r.props.children,s));return}r.type!==Cl&&xt(!1),!r.props.index||!r.props.children||xt(!1);let l={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&&(l.children=vg(r.props.children,s)),n.push(l)}),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 z_="6";try{window.__reactRouterVersion=z_}catch{}const B_="startTransition",Ov=I9[B_];function G_(t){let{basename:e,children:n,future:r,window:i}=t,s=V.useRef();s.current==null&&(s.current=$w({window:i,v5Compat:!0}));let l=s.current,[u,c]=V.useState({action:l.action,location:l.location}),{v7_startTransition:h}=r||{},p=V.useCallback(y=>{h&&Ov?Ov(()=>c(y)):c(y)},[c,h]);return V.useLayoutEffect(()=>l.listen(p),[l,p]),V.useEffect(()=>I_(r),[r]),V.createElement(j_,{basename:e,children:n,location:u.location,navigationType:u.action,navigator:l,future:r})}var bv;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(bv||(bv={}));var Lv;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(Lv||(Lv={}));var Oa=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(){}},Ms,Mi,na,m3,H_=(m3=class extends Oa{constructor(){super();de(this,Ms);de(this,Mi);de(this,na);ne(this,na,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){F(this,Mi)||this.setEventListener(F(this,na))}onUnsubscribe(){var e;this.hasListeners()||((e=F(this,Mi))==null||e.call(this),ne(this,Mi,void 0))}setEventListener(e){var n;ne(this,na,e),(n=F(this,Mi))==null||n.call(this),ne(this,Mi,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){F(this,Ms)!==e&&(ne(this,Ms,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof F(this,Ms)=="boolean"?F(this,Ms):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Ms=new WeakMap,Mi=new WeakMap,na=new WeakMap,m3),q1=new H_,V_={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Ii,Xg,y3,W_=(y3=class{constructor(){de(this,Ii,V_);de(this,Xg,!1)}setTimeoutProvider(t){ne(this,Ii,t)}setTimeout(t,e){return F(this,Ii).setTimeout(t,e)}clearTimeout(t){F(this,Ii).clearTimeout(t)}setInterval(t,e){return F(this,Ii).setInterval(t,e)}clearInterval(t){F(this,Ii).clearInterval(t)}},Ii=new WeakMap,Xg=new WeakMap,y3),Fs=new W_;function K_(t){setTimeout(t,0)}var $_=typeof window>"u"||"Deno"in globalThis;function sn(){}function Q_(t,e){return typeof t=="function"?t(e):t}function Sg(t){return typeof t=="number"&&t>=0&&t!==1/0}function X6(t,e){return Math.max(t+(e||0)-Date.now(),0)}function ts(t,e){return typeof t=="function"?t(e):t}function Kn(t,e){return typeof t=="function"?t(e):t}function Fv(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:l,stale:u}=t;if(l){if(r){if(e.queryHash!==Y1(l,e.options))return!1}else if(!ru(e.queryKey,l))return!1}if(n!=="all"){const c=e.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof u=="boolean"&&e.isStale()!==u||i&&i!==e.state.fetchStatus||s&&!s(e))}function Av(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(Zs(e.options.mutationKey)!==Zs(s))return!1}else if(!ru(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function Y1(t,e){return((e==null?void 0:e.queryKeyHashFn)||Zs)(t)}function Zs(t){return JSON.stringify(t,(e,n)=>xg(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function ru(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>ru(t[n],e[n])):!1}var q_=Object.prototype.hasOwnProperty;function J6(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=Mv(t)&&Mv(e);if(!r&&!(xg(t)&&xg(e)))return e;const s=(r?t:Object.keys(t)).length,l=r?e:Object.keys(e),u=l.length,c=r?new Array(u):{};let h=0;for(let p=0;p{Fs.setTimeout(e,t)})}function wg(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?J6(t,e):e}function X_(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function J_(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var X1=Symbol();function Z6(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===X1?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function J1(t,e){return typeof t=="function"?t(...e):!!t}function Z_(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 iu=(()=>{let t=()=>$_;return{isServer(){return t()},setIsServer(e){t=e}}})();function _g(){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 eC=K_;function tC(){let t=[],e=0,n=u=>{u()},r=u=>{u()},i=eC;const s=u=>{e?t.push(u):i(()=>{n(u)})},l=()=>{const u=t;t=[],u.length&&i(()=>{r(()=>{u.forEach(c=>{n(c)})})})};return{batch:u=>{let c;e++;try{c=u()}finally{e--,e||l()}return c},batchCalls:u=>(...c)=>{s(()=>{u(...c)})},schedule:s,setNotifyFunction:u=>{n=u},setBatchNotifyFunction:u=>{r=u},setScheduler:u=>{i=u}}}var Pt=tC(),ra,Di,ia,v3,nC=(v3=class extends Oa{constructor(){super();de(this,ra,!0);de(this,Di);de(this,ia);ne(this,ia,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(){F(this,Di)||this.setEventListener(F(this,ia))}onUnsubscribe(){var e;this.hasListeners()||((e=F(this,Di))==null||e.call(this),ne(this,Di,void 0))}setEventListener(e){var n;ne(this,ia,e),(n=F(this,Di))==null||n.call(this),ne(this,Di,e(this.setOnline.bind(this)))}setOnline(e){F(this,ra)!==e&&(ne(this,ra,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return F(this,ra)}},ra=new WeakMap,Di=new WeakMap,ia=new WeakMap,v3),Ud=new nC;function rC(t){return Math.min(1e3*2**t,3e4)}function e8(t){return(t??"online")==="online"?Ud.isOnline():!0}var Cg=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function t8(t){let e=!1,n=0,r;const i=_g(),s=()=>i.status!=="pending",l=C=>{var P;if(!s()){const E=new Cg(C);S(E),(P=t.onCancel)==null||P.call(t,E)}},u=()=>{e=!0},c=()=>{e=!1},h=()=>q1.isFocused()&&(t.networkMode==="always"||Ud.isOnline())&&t.canRun(),p=()=>e8(t.networkMode)&&t.canRun(),y=C=>{s()||(r==null||r(),i.resolve(C))},S=C=>{s()||(r==null||r(),i.reject(C))},x=()=>new Promise(C=>{var P;r=E=>{(s()||h())&&C(E)},(P=t.onPause)==null||P.call(t)}).then(()=>{var C;r=void 0,s()||(C=t.onContinue)==null||C.call(t)}),m=()=>{if(s())return;let C;const P=n===0?t.initialPromise:void 0;try{C=P??t.fn()}catch(E){C=Promise.reject(E)}Promise.resolve(C).then(y).catch(E=>{var b;if(s())return;const k=t.retry??(iu.isServer()?0:3),v=t.retryDelay??rC,_=typeof v=="function"?v(n,E):v,R=k===!0||typeof k=="number"&&nh()?void 0:x()).then(()=>{e?S(E):m()})})};return{promise:i,status:()=>i.status,cancel:l,continue:()=>(r==null||r(),i),cancelRetry:u,continueRetry:c,canStart:p,start:()=>(p()?m():x().then(m),i)}}var Is,S3,n8=(S3=class{constructor(){de(this,Is)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Sg(this.gcTime)&&ne(this,Is,Fs.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(iu.isServer()?1/0:5*60*1e3))}clearGcTimeout(){F(this,Is)&&(Fs.clearTimeout(F(this,Is)),ne(this,Is,void 0))}},Is=new WeakMap,S3),Ds,sa,Wn,js,At,uu,Us,Rn,r8,$r,x3,iC=(x3=class extends n8{constructor(e){super();de(this,Rn);de(this,Ds);de(this,sa);de(this,Wn);de(this,js);de(this,At);de(this,uu);de(this,Us);ne(this,Us,!1),ne(this,uu,e.defaultOptions),this.setOptions(e.options),this.observers=[],ne(this,js,e.client),ne(this,Wn,F(this,js).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,ne(this,Ds,jv(this.options)),this.state=e.state??F(this,Ds),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=F(this,At))==null?void 0:e.promise}setOptions(e){if(this.options={...F(this,uu),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=jv(this.options);n.data!==void 0&&(this.setState(Dv(n.data,n.dataUpdatedAt)),ne(this,Ds,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&F(this,Wn).remove(this)}setData(e,n){const r=wg(this.state.data,e,this.options);return _e(this,Rn,$r).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){_e(this,Rn,$r).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,i;const n=(r=F(this,At))==null?void 0:r.promise;return(i=F(this,At))==null||i.cancel(e),n?n.then(sn).catch(sn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return F(this,Ds)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Kn(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===X1||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>ts(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:!X6(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=F(this,At))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=F(this,At))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),F(this,Wn).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(F(this,At)&&(F(this,Us)||_e(this,Rn,r8).call(this)?F(this,At).cancel({revert:!0}):F(this,At).cancelRetry()),this.scheduleGc()),F(this,Wn).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||_e(this,Rn,$r).call(this,{type:"invalidate"})}async fetch(e,n){var c,h,p,y,S,x,m,C,P,E,k,v;if(this.state.fetchStatus!=="idle"&&((c=F(this,At))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(F(this,At))return F(this,At).continueRetry(),F(this,At).promise}if(e&&this.setOptions(e),!this.options.queryFn){const _=this.observers.find(R=>R.options.queryFn);_&&this.setOptions(_.options)}const r=new AbortController,i=_=>{Object.defineProperty(_,"signal",{enumerable:!0,get:()=>(ne(this,Us,!0),r.signal)})},s=()=>{const _=Z6(this.options,n),b=(()=>{const A={client:F(this,js),queryKey:this.queryKey,meta:this.meta};return i(A),A})();return ne(this,Us,!1),this.options.persister?this.options.persister(_,b,this):_(b)},u=(()=>{const _={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:F(this,js),state:this.state,fetchFn:s};return i(_),_})();(h=this.options.behavior)==null||h.onFetch(u,this),ne(this,sa,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((p=u.fetchOptions)==null?void 0:p.meta))&&_e(this,Rn,$r).call(this,{type:"fetch",meta:(y=u.fetchOptions)==null?void 0:y.meta}),ne(this,At,t8({initialPromise:n==null?void 0:n.initialPromise,fn:u.fetchFn,onCancel:_=>{_ instanceof Cg&&_.revert&&this.setState({...F(this,sa),fetchStatus:"idle"}),r.abort()},onFail:(_,R)=>{_e(this,Rn,$r).call(this,{type:"failed",failureCount:_,error:R})},onPause:()=>{_e(this,Rn,$r).call(this,{type:"pause"})},onContinue:()=>{_e(this,Rn,$r).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0}));try{const _=await F(this,At).start();if(_===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(_),(x=(S=F(this,Wn).config).onSuccess)==null||x.call(S,_,this),(C=(m=F(this,Wn).config).onSettled)==null||C.call(m,_,this.state.error,this),_}catch(_){if(_ instanceof Cg){if(_.silent)return F(this,At).promise;if(_.revert){if(this.state.data===void 0)throw _;return this.state.data}}throw _e(this,Rn,$r).call(this,{type:"error",error:_}),(E=(P=F(this,Wn).config).onError)==null||E.call(P,_,this),(v=(k=F(this,Wn).config).onSettled)==null||v.call(k,this.state.data,_,this),_}finally{this.scheduleGc()}}},Ds=new WeakMap,sa=new WeakMap,Wn=new WeakMap,js=new WeakMap,At=new WeakMap,uu=new WeakMap,Us=new WeakMap,Rn=new WeakSet,r8=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},$r=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,...i8(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...Dv(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ne(this,sa,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),Pt.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),F(this,Wn).notify({query:this,type:"updated",action:e})})},x3);function i8(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:e8(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function Dv(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function jv(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 mn,Te,cu,nn,zs,oa,Xr,ji,du,aa,la,Bs,Gs,Ui,ua,Ie,kl,kg,Eg,Pg,Ng,Rg,Tg,Og,s8,w3,sC=(w3=class extends Oa{constructor(e,n){super();de(this,Ie);de(this,mn);de(this,Te);de(this,cu);de(this,nn);de(this,zs);de(this,oa);de(this,Xr);de(this,ji);de(this,du);de(this,aa);de(this,la);de(this,Bs);de(this,Gs);de(this,Ui);de(this,ua,new Set);this.options=n,ne(this,mn,e),ne(this,ji,null),ne(this,Xr,_g()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(F(this,Te).addObserver(this),Uv(F(this,Te),this.options)?_e(this,Ie,kl).call(this):this.updateResult(),_e(this,Ie,Ng).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return bg(F(this,Te),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return bg(F(this,Te),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,_e(this,Ie,Rg).call(this),_e(this,Ie,Tg).call(this),F(this,Te).removeObserver(this)}setOptions(e){const n=this.options,r=F(this,Te);if(this.options=F(this,mn).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Kn(this.options.enabled,F(this,Te))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");_e(this,Ie,Og).call(this),F(this,Te).setOptions(this.options),n._defaulted&&!jd(this.options,n)&&F(this,mn).getQueryCache().notify({type:"observerOptionsUpdated",query:F(this,Te),observer:this});const i=this.hasListeners();i&&zv(F(this,Te),r,this.options,n)&&_e(this,Ie,kl).call(this),this.updateResult(),i&&(F(this,Te)!==r||Kn(this.options.enabled,F(this,Te))!==Kn(n.enabled,F(this,Te))||ts(this.options.staleTime,F(this,Te))!==ts(n.staleTime,F(this,Te)))&&_e(this,Ie,kg).call(this);const s=_e(this,Ie,Eg).call(this);i&&(F(this,Te)!==r||Kn(this.options.enabled,F(this,Te))!==Kn(n.enabled,F(this,Te))||s!==F(this,Ui))&&_e(this,Ie,Pg).call(this,s)}getOptimisticResult(e){const n=F(this,mn).getQueryCache().build(F(this,mn),e),r=this.createResult(n,e);return aC(this,r)&&(ne(this,nn,r),ne(this,oa,this.options),ne(this,zs,F(this,Te).state)),r}getCurrentResult(){return F(this,nn)}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&&F(this,Xr).status==="pending"&&F(this,Xr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){F(this,ua).add(e)}getCurrentQuery(){return F(this,Te)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=F(this,mn).defaultQueryOptions(e),r=F(this,mn).getQueryCache().build(F(this,mn),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return _e(this,Ie,kl).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),F(this,nn)))}createResult(e,n){var I;const r=F(this,Te),i=this.options,s=F(this,nn),l=F(this,zs),u=F(this,oa),h=e!==r?e.state:F(this,cu),{state:p}=e;let y={...p},S=!1,x;if(n._optimisticResults){const L=this.hasListeners(),H=!L&&Uv(e,n),B=L&&zv(e,r,n,i);(H||B)&&(y={...y,...i8(p.data,e.options)}),n._optimisticResults==="isRestoring"&&(y.fetchStatus="idle")}let{error:m,errorUpdatedAt:C,status:P}=y;x=y.data;let E=!1;if(n.placeholderData!==void 0&&x===void 0&&P==="pending"){let L;s!=null&&s.isPlaceholderData&&n.placeholderData===(u==null?void 0:u.placeholderData)?(L=s.data,E=!0):L=typeof n.placeholderData=="function"?n.placeholderData((I=F(this,la))==null?void 0:I.state.data,F(this,la)):n.placeholderData,L!==void 0&&(P="success",x=wg(s==null?void 0:s.data,L,n),S=!0)}if(n.select&&x!==void 0&&!E)if(s&&x===(l==null?void 0:l.data)&&n.select===F(this,du))x=F(this,aa);else try{ne(this,du,n.select),x=n.select(x),x=wg(s==null?void 0:s.data,x,n),ne(this,aa,x),ne(this,ji,null)}catch(L){ne(this,ji,L)}F(this,ji)&&(m=F(this,ji),x=F(this,aa),C=Date.now(),P="error");const k=y.fetchStatus==="fetching",v=P==="pending",_=P==="error",R=v&&k,b=x!==void 0,O={status:P,fetchStatus:y.fetchStatus,isPending:v,isSuccess:P==="success",isError:_,isInitialLoading:R,isLoading:R,data:x,dataUpdatedAt:y.dataUpdatedAt,error:m,errorUpdatedAt:C,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:y.dataUpdateCount>h.dataUpdateCount||y.errorUpdateCount>h.errorUpdateCount,isFetching:k,isRefetching:k&&!v,isLoadingError:_&&!b,isPaused:y.fetchStatus==="paused",isPlaceholderData:S,isRefetchError:_&&b,isStale:Z1(e,n),refetch:this.refetch,promise:F(this,Xr),isEnabled:Kn(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const L=O.data!==void 0,H=O.status==="error"&&!L,B=Q=>{H?Q.reject(O.error):L&&Q.resolve(O.data)},$=()=>{const Q=ne(this,Xr,O.promise=_g());B(Q)},q=F(this,Xr);switch(q.status){case"pending":e.queryHash===r.queryHash&&B(q);break;case"fulfilled":(H||O.data!==q.value)&&$();break;case"rejected":(!H||O.error!==q.reason)&&$();break}}return O}updateResult(){const e=F(this,nn),n=this.createResult(F(this,Te),this.options);if(ne(this,zs,F(this,Te).state),ne(this,oa,this.options),F(this,zs).data!==void 0&&ne(this,la,F(this,Te)),jd(n,e))return;ne(this,nn,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!F(this,ua).size)return!0;const l=new Set(s??F(this,ua));return this.options.throwOnError&&l.add("error"),Object.keys(F(this,nn)).some(u=>{const c=u;return F(this,nn)[c]!==e[c]&&l.has(c)})};_e(this,Ie,s8).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&_e(this,Ie,Ng).call(this)}},mn=new WeakMap,Te=new WeakMap,cu=new WeakMap,nn=new WeakMap,zs=new WeakMap,oa=new WeakMap,Xr=new WeakMap,ji=new WeakMap,du=new WeakMap,aa=new WeakMap,la=new WeakMap,Bs=new WeakMap,Gs=new WeakMap,Ui=new WeakMap,ua=new WeakMap,Ie=new WeakSet,kl=function(e){_e(this,Ie,Og).call(this);let n=F(this,Te).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(sn)),n},kg=function(){_e(this,Ie,Rg).call(this);const e=ts(this.options.staleTime,F(this,Te));if(iu.isServer()||F(this,nn).isStale||!Sg(e))return;const r=X6(F(this,nn).dataUpdatedAt,e)+1;ne(this,Bs,Fs.setTimeout(()=>{F(this,nn).isStale||this.updateResult()},r))},Eg=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(F(this,Te)):this.options.refetchInterval)??!1},Pg=function(e){_e(this,Ie,Tg).call(this),ne(this,Ui,e),!(iu.isServer()||Kn(this.options.enabled,F(this,Te))===!1||!Sg(F(this,Ui))||F(this,Ui)===0)&&ne(this,Gs,Fs.setInterval(()=>{(this.options.refetchIntervalInBackground||q1.isFocused())&&_e(this,Ie,kl).call(this)},F(this,Ui)))},Ng=function(){_e(this,Ie,kg).call(this),_e(this,Ie,Pg).call(this,_e(this,Ie,Eg).call(this))},Rg=function(){F(this,Bs)&&(Fs.clearTimeout(F(this,Bs)),ne(this,Bs,void 0))},Tg=function(){F(this,Gs)&&(Fs.clearInterval(F(this,Gs)),ne(this,Gs,void 0))},Og=function(){const e=F(this,mn).getQueryCache().build(F(this,mn),this.options);if(e===F(this,Te))return;const n=F(this,Te);ne(this,Te,e),ne(this,cu,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},s8=function(e){Pt.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(F(this,nn))}),F(this,mn).getQueryCache().notify({query:F(this,Te),type:"observerResultsUpdated"})})},w3);function oC(t,e){return Kn(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function Uv(t,e){return oC(t,e)||t.state.data!==void 0&&bg(t,e,e.refetchOnMount)}function bg(t,e,n){if(Kn(e.enabled,t)!==!1&&ts(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&Z1(t,e)}return!1}function zv(t,e,n,r){return(t!==e||Kn(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&Z1(t,n)}function Z1(t,e){return Kn(e.enabled,t)!==!1&&t.isStaleByTime(ts(e.staleTime,t))}function aC(t,e){return!jd(t.getCurrentResult(),e)}function Bv(t){return{onFetch:(e,n)=>{var p,y,S,x,m;const r=e.options,i=(S=(y=(p=e.fetchOptions)==null?void 0:p.meta)==null?void 0:y.fetchMore)==null?void 0:S.direction,s=((x=e.state.data)==null?void 0:x.pages)||[],l=((m=e.state.data)==null?void 0:m.pageParams)||[];let u={pages:[],pageParams:[]},c=0;const h=async()=>{let C=!1;const P=v=>{Z_(v,()=>e.signal,()=>C=!0)},E=Z6(e.options,e.fetchOptions),k=async(v,_,R)=>{if(C)return Promise.reject();if(_==null&&v.pages.length)return Promise.resolve(v);const A=(()=>{const H={client:e.client,queryKey:e.queryKey,pageParam:_,direction:R?"backward":"forward",meta:e.options.meta};return P(H),H})(),O=await E(A),{maxPages:I}=e.options,L=R?J_:X_;return{pages:L(v.pages,O,I),pageParams:L(v.pageParams,_,I)}};if(i&&s.length){const v=i==="backward",_=v?lC:Gv,R={pages:s,pageParams:l},b=_(r,R);u=await k(R,b,v)}else{const v=t??s.length;do{const _=c===0?l[0]??r.initialPageParam:Gv(r,u);if(c>0&&_==null)break;u=await k(u,_),c++}while(c{var C,P;return(P=(C=e.options).persister)==null?void 0:P.call(C,h,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=h}}}function Gv(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 lC(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 hu,Tr,Yt,Hs,Or,Ti,_3,uC=(_3=class extends n8{constructor(e){super();de(this,Or);de(this,hu);de(this,Tr);de(this,Yt);de(this,Hs);ne(this,hu,e.client),this.mutationId=e.mutationId,ne(this,Yt,e.mutationCache),ne(this,Tr,[]),this.state=e.state||o8(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){F(this,Tr).includes(e)||(F(this,Tr).push(e),this.clearGcTimeout(),F(this,Yt).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){ne(this,Tr,F(this,Tr).filter(n=>n!==e)),this.scheduleGc(),F(this,Yt).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){F(this,Tr).length||(this.state.status==="pending"?this.scheduleGc():F(this,Yt).remove(this))}continue(){var e;return((e=F(this,Hs))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var l,u,c,h,p,y,S,x,m,C,P,E,k,v,_,R,b,A;const n=()=>{_e(this,Or,Ti).call(this,{type:"continue"})},r={client:F(this,hu),meta:this.options.meta,mutationKey:this.options.mutationKey};ne(this,Hs,t8({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(O,I)=>{_e(this,Or,Ti).call(this,{type:"failed",failureCount:O,error:I})},onPause:()=>{_e(this,Or,Ti).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>F(this,Yt).canRun(this)}));const i=this.state.status==="pending",s=!F(this,Hs).canStart();try{if(i)n();else{_e(this,Or,Ti).call(this,{type:"pending",variables:e,isPaused:s}),F(this,Yt).config.onMutate&&await F(this,Yt).config.onMutate(e,this,r);const I=await((u=(l=this.options).onMutate)==null?void 0:u.call(l,e,r));I!==this.state.context&&_e(this,Or,Ti).call(this,{type:"pending",context:I,variables:e,isPaused:s})}const O=await F(this,Hs).start();return await((h=(c=F(this,Yt).config).onSuccess)==null?void 0:h.call(c,O,e,this.state.context,this,r)),await((y=(p=this.options).onSuccess)==null?void 0:y.call(p,O,e,this.state.context,r)),await((x=(S=F(this,Yt).config).onSettled)==null?void 0:x.call(S,O,null,this.state.variables,this.state.context,this,r)),await((C=(m=this.options).onSettled)==null?void 0:C.call(m,O,null,e,this.state.context,r)),_e(this,Or,Ti).call(this,{type:"success",data:O}),O}catch(O){try{await((E=(P=F(this,Yt).config).onError)==null?void 0:E.call(P,O,e,this.state.context,this,r))}catch(I){Promise.reject(I)}try{await((v=(k=this.options).onError)==null?void 0:v.call(k,O,e,this.state.context,r))}catch(I){Promise.reject(I)}try{await((R=(_=F(this,Yt).config).onSettled)==null?void 0:R.call(_,void 0,O,this.state.variables,this.state.context,this,r))}catch(I){Promise.reject(I)}try{await((A=(b=this.options).onSettled)==null?void 0:A.call(b,void 0,O,e,this.state.context,r))}catch(I){Promise.reject(I)}throw _e(this,Or,Ti).call(this,{type:"error",error:O}),O}finally{F(this,Yt).runNext(this)}}},hu=new WeakMap,Tr=new WeakMap,Yt=new WeakMap,Hs=new WeakMap,Or=new WeakSet,Ti=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),Pt.batch(()=>{F(this,Tr).forEach(r=>{r.onMutationUpdate(e)}),F(this,Yt).notify({mutation:this,type:"updated",action:e})})},_3);function o8(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Jr,ur,fu,C3,cC=(C3=class extends Oa{constructor(e={}){super();de(this,Jr);de(this,ur);de(this,fu);this.config=e,ne(this,Jr,new Set),ne(this,ur,new Map),ne(this,fu,0)}build(e,n,r){const i=new uC({client:e,mutationCache:this,mutationId:++Cc(this,fu)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){F(this,Jr).add(e);const n=Bc(e);if(typeof n=="string"){const r=F(this,ur).get(n);r?r.push(e):F(this,ur).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(F(this,Jr).delete(e)){const n=Bc(e);if(typeof n=="string"){const r=F(this,ur).get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&F(this,ur).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=Bc(e);if(typeof n=="string"){const r=F(this,ur).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=Bc(e);if(typeof n=="string"){const i=(r=F(this,ur).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(){Pt.batch(()=>{F(this,Jr).forEach(e=>{this.notify({type:"removed",mutation:e})}),F(this,Jr).clear(),F(this,ur).clear()})}getAll(){return Array.from(F(this,Jr))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>Av(n,r))}findAll(e={}){return this.getAll().filter(n=>Av(e,n))}notify(e){Pt.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Pt.batch(()=>Promise.all(e.map(n=>n.continue().catch(sn))))}},Jr=new WeakMap,ur=new WeakMap,fu=new WeakMap,C3);function Bc(t){var e;return(e=t.options.scope)==null?void 0:e.id}var Zr,zi,yn,ei,si,ad,Lg,k3,dC=(k3=class extends Oa{constructor(n,r){super();de(this,si);de(this,Zr);de(this,zi);de(this,yn);de(this,ei);ne(this,Zr,n),this.setOptions(r),this.bindMethods(),_e(this,si,ad).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=F(this,Zr).defaultMutationOptions(n),jd(this.options,r)||F(this,Zr).getMutationCache().notify({type:"observerOptionsUpdated",mutation:F(this,yn),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Zs(r.mutationKey)!==Zs(this.options.mutationKey)?this.reset():((i=F(this,yn))==null?void 0:i.state.status)==="pending"&&F(this,yn).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=F(this,yn))==null||n.removeObserver(this)}onMutationUpdate(n){_e(this,si,ad).call(this),_e(this,si,Lg).call(this,n)}getCurrentResult(){return F(this,zi)}reset(){var n;(n=F(this,yn))==null||n.removeObserver(this),ne(this,yn,void 0),_e(this,si,ad).call(this),_e(this,si,Lg).call(this)}mutate(n,r){var i;return ne(this,ei,r),(i=F(this,yn))==null||i.removeObserver(this),ne(this,yn,F(this,Zr).getMutationCache().build(F(this,Zr),this.options)),F(this,yn).addObserver(this),F(this,yn).execute(n)}},Zr=new WeakMap,zi=new WeakMap,yn=new WeakMap,ei=new WeakMap,si=new WeakSet,ad=function(){var r;const n=((r=F(this,yn))==null?void 0:r.state)??o8();ne(this,zi,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Lg=function(n){Pt.batch(()=>{var r,i,s,l,u,c,h,p;if(F(this,ei)&&this.hasListeners()){const y=F(this,zi).variables,S=F(this,zi).context,x={client:F(this,Zr),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(i=(r=F(this,ei)).onSuccess)==null||i.call(r,n.data,y,S,x)}catch(m){Promise.reject(m)}try{(l=(s=F(this,ei)).onSettled)==null||l.call(s,n.data,null,y,S,x)}catch(m){Promise.reject(m)}}else if((n==null?void 0:n.type)==="error"){try{(c=(u=F(this,ei)).onError)==null||c.call(u,n.error,y,S,x)}catch(m){Promise.reject(m)}try{(p=(h=F(this,ei)).onSettled)==null||p.call(h,void 0,n.error,y,S,x)}catch(m){Promise.reject(m)}}}this.listeners.forEach(y=>{y(F(this,zi))})})},k3),br,E3,hC=(E3=class extends Oa{constructor(e={}){super();de(this,br);this.config=e,ne(this,br,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??Y1(i,n);let l=this.get(s);return l||(l=new iC({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(l)),l}add(e){F(this,br).has(e.queryHash)||(F(this,br).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=F(this,br).get(e.queryHash);n&&(e.destroy(),n===e&&F(this,br).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Pt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return F(this,br).get(e)}getAll(){return[...F(this,br).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>Fv(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>Fv(e,r)):n}notify(e){Pt.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Pt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Pt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},br=new WeakMap,E3),dt,Bi,Gi,ca,da,Hi,ha,fa,P3,fC=(P3=class{constructor(t={}){de(this,dt);de(this,Bi);de(this,Gi);de(this,ca);de(this,da);de(this,Hi);de(this,ha);de(this,fa);ne(this,dt,t.queryCache||new hC),ne(this,Bi,t.mutationCache||new cC),ne(this,Gi,t.defaultOptions||{}),ne(this,ca,new Map),ne(this,da,new Map),ne(this,Hi,0)}mount(){Cc(this,Hi)._++,F(this,Hi)===1&&(ne(this,ha,q1.subscribe(async t=>{t&&(await this.resumePausedMutations(),F(this,dt).onFocus())})),ne(this,fa,Ud.subscribe(async t=>{t&&(await this.resumePausedMutations(),F(this,dt).onOnline())})))}unmount(){var t,e;Cc(this,Hi)._--,F(this,Hi)===0&&((t=F(this,ha))==null||t.call(this),ne(this,ha,void 0),(e=F(this,fa))==null||e.call(this),ne(this,fa,void 0))}isFetching(t){return F(this,dt).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return F(this,Bi).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=F(this,dt).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=F(this,dt).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(ts(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return F(this,dt).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=F(this,dt).get(r.queryHash),s=i==null?void 0:i.state.data,l=Q_(e,s);if(l!==void 0)return F(this,dt).build(this,r).setData(l,{...n,manual:!0})}setQueriesData(t,e,n){return Pt.batch(()=>F(this,dt).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=F(this,dt).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=F(this,dt);Pt.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=F(this,dt);return Pt.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Pt.batch(()=>F(this,dt).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(sn).catch(sn)}invalidateQueries(t,e={}){return Pt.batch(()=>(F(this,dt).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=Pt.batch(()=>F(this,dt).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(sn)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(sn)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=F(this,dt).build(this,e);return n.isStaleByTime(ts(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(sn).catch(sn)}fetchInfiniteQuery(t){return t.behavior=Bv(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(sn).catch(sn)}ensureInfiniteQueryData(t){return t.behavior=Bv(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Ud.isOnline()?F(this,Bi).resumePausedMutations():Promise.resolve()}getQueryCache(){return F(this,dt)}getMutationCache(){return F(this,Bi)}getDefaultOptions(){return F(this,Gi)}setDefaultOptions(t){ne(this,Gi,t)}setQueryDefaults(t,e){F(this,ca).set(Zs(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...F(this,ca).values()],n={};return e.forEach(r=>{ru(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){F(this,da).set(Zs(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...F(this,da).values()],n={};return e.forEach(r=>{ru(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...F(this,Gi).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Y1(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===X1&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...F(this,Gi).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){F(this,dt).clear(),F(this,Bi).clear()}},dt=new WeakMap,Bi=new WeakMap,Gi=new WeakMap,ca=new WeakMap,da=new WeakMap,Hi=new WeakMap,ha=new WeakMap,fa=new WeakMap,P3),a8=V.createContext(void 0),em=t=>{const e=V.useContext(a8);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},pC=({client:t,children:e})=>(V.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),N.jsx(a8.Provider,{value:t,children:e})),l8=V.createContext(!1),gC=()=>V.useContext(l8);l8.Provider;function mC(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var yC=V.createContext(mC()),vC=()=>V.useContext(yC),SC=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?J1(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},xC=t=>{V.useEffect(()=>{t.clearReset()},[t])},wC=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||J1(n,[t.error,r])),_C=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))}},CC=(t,e)=>t.isLoading&&t.isFetching&&!e,kC=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,Hv=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function EC(t,e,n){var S,x,m,C;const r=gC(),i=vC(),s=em(),l=s.defaultQueryOptions(t);(x=(S=s.getDefaultOptions().queries)==null?void 0:S._experimental_beforeQuery)==null||x.call(S,l);const u=s.getQueryCache().get(l.queryHash);l._optimisticResults=r?"isRestoring":"optimistic",_C(l),SC(l,i,u),xC(i);const c=!s.getQueryCache().get(l.queryHash),[h]=V.useState(()=>new e(s,l)),p=h.getOptimisticResult(l),y=!r&&t.subscribed!==!1;if(V.useSyncExternalStore(V.useCallback(P=>{const E=y?h.subscribe(Pt.batchCalls(P)):sn;return h.updateResult(),E},[h,y]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),V.useEffect(()=>{h.setOptions(l)},[l,h]),kC(l,p))throw Hv(l,h,i);if(wC({result:p,errorResetBoundary:i,throwOnError:l.throwOnError,query:u,suspense:l.suspense}))throw p.error;if((C=(m=s.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||C.call(m,l,p),l.experimental_prefetchInRender&&!iu.isServer()&&CC(p,r)){const P=c?Hv(l,h,i):u==null?void 0:u.promise;P==null||P.catch(sn).finally(()=>{h.updateResult()})}return l.notifyOnChangeProps?p:h.trackResult(p)}function u8(t,e){return EC(t,sC)}function PC(t,e){const n=em(),[r]=V.useState(()=>new dC(n,t));V.useEffect(()=>{r.setOptions(t)},[r,t]);const i=V.useSyncExternalStore(V.useCallback(l=>r.subscribe(Pt.batchCalls(l)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=V.useCallback((l,u)=>{r.mutate(l,u).catch(sn)},[r]);if(i.error&&J1(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 NC={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 RC=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),wt=(t,e)=>{const n=V.forwardRef(({color:r="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:l,className:u="",children:c,...h},p)=>V.createElement("svg",{ref:p,...NC,width:i,height:i,stroke:r,strokeWidth:l?Number(s)*24/Number(i):s,className:["lucide",`lucide-${RC(t)}`,u].join(" "),...h},[...e.map(([y,S])=>V.createElement(y,S)),...Array.isArray(c)?c:[c]]));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 zd=wt("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 TC=wt("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 OC=wt("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 bC=wt("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 LC=wt("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 c8=wt("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 FC=wt("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 AC=wt("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 MC=wt("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 tm=wt("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 IC=wt("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 DC=wt("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 jC=wt("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 UC=wt("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 d8=wt("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 zC=wt("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 ld=wt("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 h8=wt("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 eo=wt("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 BC=wt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),me=t=>typeof t=="string",pl=()=>{let t,e;const n=new Promise((r,i)=>{t=r,e=i});return n.resolve=t,n.reject=e,n},Vv=t=>t==null?"":String(t),GC=(t,e,n)=>{t.forEach(r=>{e[r]&&(n[r]=e[r])})},HC=/###/g,Wv=t=>t&&t.includes("###")?t.replace(HC,"."):t,Kv=t=>!t||me(t),Il=(t,e,n)=>{const r=me(e)?e.split("."):e;let i=0;for(;i{const{obj:r,k:i}=Il(t,e,Object);if(r!==void 0||e.length===1){r[i]=n;return}let s=e[e.length-1],l=e.slice(0,e.length-1),u=Il(t,l,Object);for(;u.obj===void 0&&l.length;)s=`${l[l.length-1]}.${s}`,l=l.slice(0,l.length-1),u=Il(t,l,Object),u!=null&&u.obj&&typeof u.obj[`${u.k}.${s}`]<"u"&&(u.obj=void 0);u.obj[`${u.k}.${s}`]=n},VC=(t,e,n,r)=>{const{obj:i,k:s}=Il(t,e,Object);i[s]=i[s]||[],i[s].push(n)},Bd=(t,e)=>{const{obj:n,k:r}=Il(t,e);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},WC=(t,e,n)=>{const r=Bd(t,n);return r!==void 0?r:Bd(e,n)},f8=(t,e,n)=>{for(const r in e)r!=="__proto__"&&r!=="constructor"&&(r in t?me(t[r])||t[r]instanceof String||me(e[r])||e[r]instanceof String?n&&(t[r]=e[r]):f8(t[r],e[r],n):t[r]=e[r]);return t},Es=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),KC={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},$C=t=>me(t)?t.replace(/[&<>"'\/]/g,e=>KC[e]):t;class QC{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 qC=[" ",",","?","!",";"],YC=new QC(20),XC=(t,e,n)=>{e=e||"",n=n||"";const r=qC.filter(l=>!e.includes(l)&&!n.includes(l));if(r.length===0)return!0;const i=YC.getRegExp(`(${r.map(l=>l==="?"?"\\?":l).join("|")})`);let s=!i.test(t);if(!s){const l=t.indexOf(n);l>0&&!i.test(t.substring(0,l))&&(s=!0)}return s},Fg=(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;st==null?void 0:t.replace(/_/g,"-"),JC={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 Gd{constructor(e,n={}){this.init(e,n)}init(e,n={}){this.prefix=n.prefix||"i18next:",this.logger=e||JC,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:(me(e[0])&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new Gd(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new Gd(this.logger,e)}}var Ar=new Gd;class ph{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 l=0;l{for(let l=0;l-1&&this.options.ns.splice(n,1)}getResource(e,n,r,i={}){var h,p;const s=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,l=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let u;e.includes(".")?u=e.split("."):(u=[e,n],r&&(Array.isArray(r)?u.push(...r):me(r)&&s?u.push(...r.split(s)):u.push(r)));const c=Bd(this.data,u);return!c&&!n&&!r&&e.includes(".")&&(e=u[0],n=u[1],r=u.slice(2).join(".")),c||!l||!me(r)?c:Fg((p=(h=this.data)==null?void 0:h[e])==null?void 0:p[n],r,s)}addResource(e,n,r,i,s={silent:!1}){const l=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let u=[e,n];r&&(u=u.concat(l?r.split(l):r)),e.includes(".")&&(u=e.split("."),i=n,n=u[1]),this.addNamespaces(n),$v(this.data,u,i),s.silent||this.emit("added",e,n,r,i)}addResources(e,n,r,i={silent:!1}){for(const s in r)(me(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,l={silent:!1,skipCopy:!1}){let u=[e,n];e.includes(".")&&(u=e.split("."),i=r,r=n,n=u[1]),this.addNamespaces(n);let c=Bd(this.data,u)||{};l.skipCopy||(r=JSON.parse(JSON.stringify(r))),i?f8(c,r,s):c={...c,...r},$v(this.data,u,c),l.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 p8={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,r,i){return t.forEach(s=>{var l;e=((l=this.processors[s])==null?void 0:l.process(e,n,r,i))??e}),e}};const g8=Symbol("i18next/PATH_KEY");function ZC(){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===g8?t:(t.push(i),n=Proxy.revocable(r,e),n.proxy)},Proxy.revocable(Object.create(null),e).proxy}function ta(t,e){const{[g8]:n}=t(ZC()),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,l=Array.isArray(s)?s:null;if(l&&l.length>1&&l.slice(1).includes(n[0]))return`${n[0]}${i}${n.slice(1).join(r)}`}return n.join(r)}const i0=t=>!me(t)&&typeof t!="boolean"&&typeof t!="number";class Hd extends ph{constructor(e,n={}){super(),GC(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Ar.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=i0(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 l=r&&e.includes(r),u=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!XC(e,r,i);if(l&&!u){const c=e.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:e,namespaces:me(s)?[s]:s};const h=e.split(r);(r!==i||r===i&&this.options.ns.includes(h[0]))&&(s=h.shift()),e=h.join(i)}return{key:e,namespaces:me(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=ta(e,{...this.options,...i})),Array.isArray(e)||(e=[String(e)]),e=e.map($=>typeof $=="function"?ta($,{...this.options,...i}):String($));const s=i.returnDetails!==void 0?i.returnDetails:this.options.returnDetails,l=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,{key:u,namespaces:c}=this.extractFromKey(e[e.length-1],i),h=c[c.length-1];let p=i.nsSeparator!==void 0?i.nsSeparator:this.options.nsSeparator;p===void 0&&(p=":");const y=i.lng||this.language,S=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((y==null?void 0:y.toLowerCase())==="cimode")return S?s?{res:`${h}${p}${u}`,usedKey:u,exactUsedKey:u,usedLng:y,usedNS:h,usedParams:this.getUsedParamsDetails(i)}:`${h}${p}${u}`:s?{res:u,usedKey:u,exactUsedKey:u,usedLng:y,usedNS:h,usedParams:this.getUsedParamsDetails(i)}:u;const x=this.resolve(e,i);let m=x==null?void 0:x.res;const C=(x==null?void 0:x.usedKey)||u,P=(x==null?void 0:x.exactUsedKey)||u,E=["[object Number]","[object Function]","[object RegExp]"],k=i.joinArrays!==void 0?i.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,_=i.count!==void 0&&!me(i.count),R=Hd.hasDefaultValue(i),b=_?this.pluralResolver.getSuffix(y,i.count,i):"",A=i.ordinal&&_?this.pluralResolver.getSuffix(y,i.count,{ordinal:!1}):"",O=_&&!i.ordinal&&i.count===0,I=O&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${b}`]||i[`defaultValue${A}`]||i.defaultValue;let L=m;v&&!m&&R&&(L=I);const H=i0(L),B=Object.prototype.toString.apply(L);if(v&&L&&H&&!E.includes(B)&&!(me(k)&&Array.isArray(L))){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(C,L,{...i,ns:c}):`key '${u} (${this.language})' returned an object instead of string.`;return s?(x.res=$,x.usedParams=this.getUsedParamsDetails(i),x):$}if(l){const $=Array.isArray(L),q=$?[]:{},Q=$?P:C;for(const re in L)if(Object.prototype.hasOwnProperty.call(L,re)){const he=`${Q}${l}${re}`;R&&!m?q[re]=this.translate(he,{...i,defaultValue:i0(I)?I[re]:void 0,joinArrays:!1,ns:c}):q[re]=this.translate(he,{...i,joinArrays:!1,ns:c}),q[re]===he&&(q[re]=L[re])}m=q}}else if(v&&me(k)&&Array.isArray(m))m=m.join(k),m&&(m=this.extendTranslation(m,e,i,r));else{let $=!1,q=!1;!this.isValidLookup(m)&&R&&($=!0,m=I),this.isValidLookup(m)||(q=!0,m=u);const re=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&q?void 0:m,he=R&&I!==m&&this.options.updateMissing;if(q||$||he){if(this.logger.log(he?"updateKey":"missingKey",y,h,u,he?I:m),l){const Y=this.resolve(u,{...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 te=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&te&&te[0])for(let Y=0;Y{var it;const Ke=R&&xe!==m?xe:re;this.options.missingKeyHandler?this.options.missingKeyHandler(Y,h,ie,Ke,he,i):(it=this.backendConnector)!=null&&it.saveMissing&&this.backendConnector.saveMissing(Y,h,ie,Ke,he,i),this.emit("missingKey",Y,h,ie,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&_?W.forEach(Y=>{const ie=this.pluralResolver.getSuffixes(Y,i);O&&i[`defaultValue${this.options.pluralSeparator}zero`]&&!ie.includes(`${this.options.pluralSeparator}zero`)&&ie.push(`${this.options.pluralSeparator}zero`),ie.forEach(xe=>{Z([Y],u+xe,i[`defaultValue${xe}`]||I)})}):Z(W,u,I))}m=this.extendTranslation(m,e,i,x,r),q&&m===u&&this.options.appendNamespaceToMissingKey&&(m=`${h}${p}${u}`),(q||$)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${h}${p}${u}`:u,$?m:void 0,i))}return s?(x.res=m,x.usedParams=this.getUsedParamsDetails(i),x):m}extendTranslation(e,n,r,i,s){var c,h;if((c=this.i18nFormat)!=null&&c.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 p=me(e)&&(((h=r==null?void 0:r.interpolation)==null?void 0:h.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let y;if(p){const x=e.match(this.interpolator.nestingRegexp);y=x&&x.length}let S=r.replace&&!me(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(S={...this.options.interpolation.defaultVariables,...S}),e=this.interpolator.interpolate(e,S,r.lng||this.language||i.usedLng,r),p){const x=e.match(this.interpolator.nestingRegexp),m=x&&x.length;y(s==null?void 0:s[0])===x[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${x[0]} in key: ${n[0]}`),null):this.translate(...x,n),r)),r.interpolation&&this.interpolator.reset()}const l=r.postProcess||this.options.postProcess,u=me(l)?[l]:l;return e!=null&&(u!=null&&u.length)&&r.applyPostProcessor!==!1&&(e=p8.handle(u,e,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),e}resolve(e,n={}){let r,i,s,l,u;return me(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(c=>typeof c=="function"?ta(c,{...this.options,...n}):c)),e.forEach(c=>{if(this.isValidLookup(r))return;const h=this.extractFromKey(c,n),p=h.key;i=p;let y=h.namespaces;this.options.fallbackNS&&(y=y.concat(this.options.fallbackNS));const S=n.count!==void 0&&!me(n.count),x=S&&!n.ordinal&&n.count===0,m=n.context!==void 0&&(me(n.context)||typeof n.context=="number")&&n.context!=="",C=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);y.forEach(P=>{var E,k;this.isValidLookup(r)||(u=P,!this.checkedLoadedFor[`${C[0]}-${P}`]&&((E=this.utils)!=null&&E.hasLoadedNamespace)&&!((k=this.utils)!=null&&k.hasLoadedNamespace(u))&&(this.checkedLoadedFor[`${C[0]}-${P}`]=!0,this.logger.warn(`key "${i}" for languages "${C.join(", ")}" won't get resolved as namespace "${u}" 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!!!")),C.forEach(v=>{var b;if(this.isValidLookup(r))return;l=v;const _=[p];if((b=this.i18nFormat)!=null&&b.addLookupKeys)this.i18nFormat.addLookupKeys(_,p,v,P,n);else{let A;S&&(A=this.pluralResolver.getSuffix(v,n.count,n));const O=`${this.options.pluralSeparator}zero`,I=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(S&&(n.ordinal&&A.startsWith(I)&&_.push(p+A.replace(I,this.options.pluralSeparator)),_.push(p+A),x&&_.push(p+O)),m){const L=`${p}${this.options.contextSeparator||"_"}${n.context}`;_.push(L),S&&(n.ordinal&&A.startsWith(I)&&_.push(L+A.replace(I,this.options.pluralSeparator)),_.push(L+A),x&&_.push(L+O))}}let R;for(;R=_.pop();)this.isValidLookup(r)||(s=R,r=this.getResource(v,P,R,n))}))})}),{res:r,usedKey:i,exactUsedKey:s,usedLng:l,usedNS:u}}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&&!me(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 qv{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ar.create("languageUtils")}getScriptPartFromCode(e){if(e=su(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=su(e),!e||!e.includes("-"))return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(me(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(l=>l===s?!0:!l.includes("-")&&!s.includes("-")?!1:!!(l.includes("-")&&!s.includes("-")&&l.slice(0,l.indexOf("-"))===s||l.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)),me(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=l=>{l&&(this.isSupportedCode(l)?i.push(l):this.logger.warn(`rejecting language code not found in supportedLngs: ${l}`))};return me(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))):me(e)&&s(this.formatLanguageCode(e)),r.forEach(l=>{i.includes(l)||s(this.formatLanguageCode(l))}),i}}const Yv={zero:0,one:1,two:2,few:3,many:4,other:5},Xv={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class ek{constructor(e,n={}){this.languageUtils=e,this.options=n,this.logger=Ar.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,n={}){const r=su(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 l;try{l=new Intl.PluralRules(r,{type:i})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),Xv;if(!e.match(/-|_/))return Xv;const c=this.languageUtils.getLanguagePartFromCode(e);l=this.getRule(c,n)}return this.pluralRulesCache[s]=l,l}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)=>Yv[i]-Yv[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 Jv=(t,e,n,r=".",i=!0)=>{let s=WC(t,e,n);return!s&&i&&me(n)&&(s=Fg(t,n,r),s===void 0&&(s=Fg(e,n,r))),s},s0=t=>t.replace(/\$/g,"$$$$");class Zv{constructor(e={}){var n;this.logger=Ar.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:l,suffix:u,suffixEscaped:c,formatSeparator:h,unescapeSuffix:p,unescapePrefix:y,nestingPrefix:S,nestingPrefixEscaped:x,nestingSuffix:m,nestingSuffixEscaped:C,nestingOptionsSeparator:P,maxReplaces:E,alwaysFormat:k}=e.interpolation;this.escape=n!==void 0?n:$C,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=s?Es(s):l||"{{",this.suffix=u?Es(u):c||"}}",this.formatSeparator=h||",",this.unescapePrefix=p?"":y||"-",this.unescapeSuffix=this.unescapePrefix?"":p||"",this.nestingPrefix=S?Es(S):x||Es("$t("),this.nestingSuffix=m?Es(m):C||Es(")"),this.nestingOptionsSeparator=P||",",this.maxReplaces=E||1e3,this.alwaysFormat=k!==void 0?k:!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 x;let s,l,u;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},h=m=>{if(!m.includes(this.formatSeparator)){const k=Jv(n,c,m,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(k,void 0,r,{...i,...n,interpolationkey:m}):k}const C=m.split(this.formatSeparator),P=C.shift().trim(),E=C.join(this.formatSeparator).trim();return this.format(Jv(n,c,P,this.options.keySeparator,this.options.ignoreJSONStructure),E,r,{...i,...n,interpolationkey:P})};this.resetRegExp();const p=(i==null?void 0:i.missingInterpolationHandler)||this.options.missingInterpolationHandler,y=((x=i==null?void 0:i.interpolation)==null?void 0:x.skipOnVariables)!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:m=>s0(m)},{regex:this.regexp,safeValue:m=>this.escapeValue?s0(this.escape(m)):s0(m)}].forEach(m=>{for(u=0;s=m.regex.exec(e);){const C=s[1].trim();if(l=h(C),l===void 0)if(typeof p=="function"){const E=p(e,s,i);l=me(E)?E:""}else if(i&&Object.prototype.hasOwnProperty.call(i,C))l="";else if(y){l=s[0];continue}else this.logger.warn(`missed to pass in variable ${C} for interpolating ${e}`),l="";else!me(l)&&!this.useRawValueToEscape&&(l=Vv(l));const P=m.safeValue(l);if(e=e.replace(s[0],P),y?(m.regex.lastIndex+=l.length,m.regex.lastIndex-=s[0].length):m.regex.lastIndex=0,u++,u>=this.maxReplaces)break}}),e}nest(e,n,r={}){let i,s,l;const u=(c,h)=>{const p=this.nestingOptionsSeparator;if(!c.includes(p))return c;const y=c.split(new RegExp(`${Es(p)}[ ]*{`));let S=`{${y[1]}`;c=y[0],S=this.interpolate(S,l);const x=S.match(/'/g),m=S.match(/"/g);(((x==null?void 0:x.length)??0)%2===0&&!m||((m==null?void 0:m.length)??0)%2!==0)&&(S=S.replace(/'/g,'"'));try{l=JSON.parse(S),h&&(l={...h,...l})}catch(C){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,C),`${c}${p}${S}`}return l.defaultValue&&l.defaultValue.includes(this.prefix)&&delete l.defaultValue,c};for(;i=this.nestingRegexp.exec(e);){let c=[];l={...r},l=l.replace&&!me(l.replace)?l.replace:l,l.applyPostProcessor=!1,delete l.defaultValue;const h=/{.*}/.test(i[1])?i[1].lastIndexOf("}")+1:i[1].indexOf(this.formatSeparator);if(h!==-1&&(c=i[1].slice(h).split(this.formatSeparator).map(p=>p.trim()).filter(Boolean),i[1]=i[1].slice(0,h)),s=n(u.call(this,i[1].trim(),l),l),s&&i[0]===e&&!me(s))return s;me(s)||(s=Vv(s)),s||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),s=""),c.length&&(s=c.reduce((p,y)=>this.format(p,y,r.lng,{...r,interpolationkey:i[1].trim()}),s.trim())),e=e.replace(i[0],s),this.regexp.lastIndex=0}return e}}const tk=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(l=>{if(l){const[u,...c]=l.split(":"),h=c.join(":").trim().replace(/^'+|'+$/g,""),p=u.trim();n[p]||(n[p]=h),h==="false"&&(n[p]=!1),h==="true"&&(n[p]=!0),isNaN(h)||(n[p]=parseInt(h,10))}})}return{formatName:e,formatOptions:n}},e4=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 l=r+JSON.stringify(s);let u=e[l];return u||(u=t(su(r),i),e[l]=u),u(n)}},nk=t=>(e,n,r)=>t(su(n),r)(e);class rk{constructor(e={}){this.logger=Ar.create("formatter"),this.options=e,this.init(e)}init(e,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const r=n.cacheInBuiltFormats?e4:nk;this.formats={number:r((i,s)=>{const l=new Intl.NumberFormat(i,{...s});return u=>l.format(u)}),currency:r((i,s)=>{const l=new Intl.NumberFormat(i,{...s,style:"currency"});return u=>l.format(u)}),datetime:r((i,s)=>{const l=new Intl.DateTimeFormat(i,{...s});return u=>l.format(u)}),relativetime:r((i,s)=>{const l=new Intl.RelativeTimeFormat(i,{...s});return u=>l.format(u,s.range||"day")}),list:r((i,s)=>{const l=new Intl.ListFormat(i,{...s});return u=>l.format(u)})}}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=e4(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(u=>u.includes(")"))){const u=s.findIndex(c=>c.includes(")"));s[0]=[s[0],...s.splice(1,u)].join(this.formatSeparator)}return s.reduce((u,c)=>{var y;const{formatName:h,formatOptions:p}=tk(c);if(this.formats[h]){let S=u;try{const x=((y=i==null?void 0:i.formatParams)==null?void 0:y[i.interpolationkey])||{},m=x.locale||x.lng||i.locale||i.lng||r;S=this.formats[h](u,m,{...p,...i,...x})}catch(x){this.logger.warn(x)}return S}else this.logger.warn(`there was no format function for ${h}`);return u},e)}}const ik=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class sk extends ph{constructor(e,n,r,i={}){var s,l;super(),this.backend=e,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=i,this.logger=Ar.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=[],(l=(s=this.backend)==null?void 0:s.init)==null||l.call(s,r,i.backend,i)}queueLoad(e,n,r,i){const s={},l={},u={},c={};return e.forEach(h=>{let p=!0;n.forEach(y=>{const S=`${h}|${y}`;!r.reload&&this.store.hasResourceBundle(h,y)?this.state[S]=2:this.state[S]<0||(this.state[S]===1?l[S]===void 0&&(l[S]=!0):(this.state[S]=1,p=!1,l[S]===void 0&&(l[S]=!0),s[S]===void 0&&(s[S]=!0),c[y]===void 0&&(c[y]=!0)))}),p||(u[h]=!0)}),(Object.keys(s).length||Object.keys(l).length)&&this.queue.push({pending:l,pendingCount:Object.keys(l).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(s),pending:Object.keys(l),toLoadLanguages:Object.keys(u),toLoadNamespaces:Object.keys(c)}}loaded(e,n,r){const i=e.split("|"),s=i[0],l=i[1];n&&this.emit("failedLoading",s,l,n),!n&&r&&this.store.addResourceBundle(s,l,r,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2,n&&r&&(this.state[e]=0);const u={};this.queue.forEach(c=>{VC(c.loaded,[s],l),ik(c,e),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(h=>{u[h]||(u[h]={});const p=c.loaded[h];p.length&&p.forEach(y=>{u[h][y]===void 0&&(u[h][y]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",u),this.queue=this.queue.filter(c=>!c.done)}read(e,n,r,i=0,s=this.retryTimeout,l){if(!e.length)return l(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:r,tried:i,wait:s,callback:l});return}this.readingCalls++;const u=(h,p)=>{if(this.readingCalls--,this.waitingReads.length>0){const y=this.waitingReads.shift();this.read(y.lng,y.ns,y.fcName,y.tried,y.wait,y.callback)}if(h&&p&&i{this.read(e,n,r,i+1,s*2,l)},s);return}l(h,p)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const h=c(e,n);h&&typeof h.then=="function"?h.then(p=>u(null,p)).catch(u):u(null,h)}catch(h){u(h)}return}return c(e,n,u)}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();me(e)&&(e=this.languageUtils.toResolveHierarchy(e)),me(n)&&(n=[n]);const s=this.queueLoad(e,n,r,i);if(!s.toLoad.length)return s.pending.length||i(),null;s.toLoad.forEach(l=>{this.loadOne(l)})}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,(l,u)=>{l&&this.logger.warn(`${n}loading namespace ${s} for language ${i} failed`,l),!l&&u&&this.logger.log(`${n}loaded namespace ${s} for language ${i}`,u),this.loaded(e,l,u)})}saveMissing(e,n,r,i,s,l={},u=()=>{}){var c,h,p,y,S;if((h=(c=this.services)==null?void 0:c.utils)!=null&&h.hasLoadedNamespace&&!((y=(p=this.services)==null?void 0:p.utils)!=null&&y.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((S=this.backend)!=null&&S.create){const x={...l,isUpdate:s},m=this.backend.create.bind(this.backend);if(m.length<6)try{let C;m.length===5?C=m(e,n,r,i,x):C=m(e,n,r,i),C&&typeof C.then=="function"?C.then(P=>u(null,P)).catch(u):u(null,C)}catch(C){u(C)}else m(e,n,r,i,u,x)}!e||!e[0]||this.store.addResource(e[0],n,r,i)}}}const o0=()=>({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]),me(t[1])&&(e.defaultValue=t[1]),me(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}),t4=t=>(me(t.ns)&&(t.ns=[t.ns]),me(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),me(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs&&!t.supportedLngs.includes("cimode")&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t),Gc=()=>{},ok=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})};class Dl extends ph{constructor(e={},n){if(super(),this.options=t4(e),this.services={},this.logger=Ar,this.modules={external:[]},ok(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&&(me(e.ns)?e.defaultNS=e.ns:e.ns.includes("translation")||(e.defaultNS=e.ns[0]));const r=o0();this.options={...r,...this.options,...t4(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=h=>h?typeof h=="function"?new h:h:null;if(!this.options.isClone){this.modules.logger?Ar.init(i(this.modules.logger),this.options):Ar.init(null,this.options);let h;this.modules.formatter?h=this.modules.formatter:h=rk;const p=new qv(this.options);this.store=new Qv(this.options.resources,this.options);const y=this.services;y.logger=Ar,y.resourceStore=this.store,y.languageUtils=p,y.pluralResolver=new ek(p,{prepend:this.options.pluralSeparator}),h&&(y.formatter=i(h),y.formatter.init&&y.formatter.init(y,this.options),this.options.interpolation.format=y.formatter.format.bind(y.formatter)),y.interpolator=new Zv(this.options),y.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},y.backendConnector=new sk(i(this.modules.backend),y.resourceStore,y,this.options),y.backendConnector.on("*",(S,...x)=>{this.emit(S,...x)}),this.modules.languageDetector&&(y.languageDetector=i(this.modules.languageDetector),y.languageDetector.init&&y.languageDetector.init(y,this.options.detection,this.options)),this.modules.i18nFormat&&(y.i18nFormat=i(this.modules.i18nFormat),y.i18nFormat.init&&y.i18nFormat.init(this)),this.translator=new Hd(this.services,this.options),this.translator.on("*",(S,...x)=>{this.emit(S,...x)}),this.modules.external.forEach(S=>{S.init&&S.init(this)})}if(this.format=this.options.interpolation.format,n||(n=Gc),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const h=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);h.length>0&&h[0]!=="dev"&&(this.options.lng=h[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(h=>{this[h]=(...p)=>this.store[h](...p)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(h=>{this[h]=(...p)=>(this.store[h](...p),this)});const u=pl(),c=()=>{const h=(p,y)=>{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),u.resolve(y),n(p,y)};if(this.languages&&!this.isInitialized)return h(null,this.t.bind(this));this.changeLanguage(this.options.lng,h)};return this.options.resources||!this.options.initAsync?c():setTimeout(c,0),u}loadResources(e,n=Gc){var s,l;let r=n;const i=me(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 u=[],c=h=>{if(!h||h==="cimode")return;this.services.languageUtils.toResolveHierarchy(h).forEach(y=>{y!=="cimode"&&(u.includes(y)||u.push(y))})};i?c(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(p=>c(p)),(l=(s=this.options.preload)==null?void 0:s.forEach)==null||l.call(s,h=>c(h)),this.services.backendConnector.load(u,this.options.ns,h=>{!h&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(h)})}else r(null)}reloadResources(e,n,r){const i=pl();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=Gc),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"&&p8.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.language=u,this.languages=this.services.languageUtils.toResolveHierarchy(u),this.resolvedLanguage=void 0,this.setResolvedLanguage(u)},s=(u,c)=>{c?this.isLanguageChangingTo===e&&(i(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,r.resolve((...h)=>this.t(...h)),n&&n(u,(...h)=>this.t(...h))},l=u=>{var p,y;!e&&!u&&this.services.languageDetector&&(u=[]);const c=me(u)?u:u&&u[0],h=this.store.hasLanguageSomeTranslations(c)?c:this.services.languageUtils.getBestMatchFromCodes(me(u)?[u]:u);h&&(this.language||i(h),this.translator.language||this.translator.changeLanguage(h),(y=(p=this.services.languageDetector)==null?void 0:p.cacheUserLanguage)==null||y.call(p,h)),this.loadResources(h,S=>{s(S,h)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?l(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(l):this.services.languageDetector.detect(l):l(e),r}getFixedT(e,n,r){const i=(s,l,...u)=>{let c;typeof l!="object"?c=this.options.overloadTranslationOptionHandler([s,l].concat(u)):c={...l},c.lng=c.lng||i.lng,c.lngs=c.lngs||i.lngs,c.ns=c.ns||i.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||r||i.keyPrefix);const h={...this.options,...c};typeof c.keyPrefix=="function"&&(c.keyPrefix=ta(c.keyPrefix,h));const p=this.options.keySeparator||".";let y;return c.keyPrefix&&Array.isArray(s)?y=s.map(S=>(typeof S=="function"&&(S=ta(S,h)),`${c.keyPrefix}${p}${S}`)):(typeof s=="function"&&(s=ta(s,h)),y=c.keyPrefix?`${c.keyPrefix}${p}${s}`:s),this.t(y,c)};return me(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 l=(u,c)=>{const h=this.services.backendConnector.state[`${u}|${c}`];return h===-1||h===0||h===2};if(n.precheck){const u=n.precheck(this,l);if(u!==void 0)return u}return!!(this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||l(r,e)&&(!i||l(s,e)))}loadNamespaces(e,n){const r=pl();return this.options.ns?(me(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=pl();me(e)&&(e=[e]);const i=this.options.preload||[],s=e.filter(l=>!i.includes(l)&&this.services.languageUtils.isSupportedCode(l));return s.length?(this.options.preload=i.concat(s),this.loadResources(l=>{r.resolve(),n&&n(l)}),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 l=new Intl.Locale(e);if(l&&l.getTextInfo){const u=l.getTextInfo();if(u&&u.direction)return u.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 qv(o0());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 Dl(e,n);return r.createInstance=Dl.createInstance,r}cloneInstance(e={},n=Gc){const r=e.forkResourceStore;r&&delete e.forkResourceStore;const i={...this.options,...e,isClone:!0},s=new Dl(i);if((e.debug!==void 0||e.prefix!==void 0)&&(s.logger=s.logger.clone(e)),["store","services","language"].forEach(u=>{s[u]=this[u]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},r){const u=Object.keys(this.store.data).reduce((c,h)=>(c[h]={...this.store.data[h]},c[h]=Object.keys(c[h]).reduce((p,y)=>(p[y]={...c[h][y]},p),c[h]),c),{});s.store=new Qv(u,i),s.services.resourceStore=s.store}if(e.interpolation){const c={...o0().interpolation,...this.options.interpolation,...e.interpolation},h={...i,interpolation:c};s.services.interpolator=new Zv(h)}return s.translator=new Hd(s.services,i),s.translator.on("*",(u,...c)=>{s.emit(u,...c)}),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 un=Dl.createInstance();un.createInstance;un.dir;un.init;un.loadResources;un.reloadResources;un.use;un.changeLanguage;un.getFixedT;un.t;un.exists;un.setDefaultNamespace;un.hasLoadedNamespace;un.loadNamespaces;un.loadLanguages;const ak=(t,e,n,r)=>{var s,l,u,c;const i=[n,{code:e,...r||{}}];if((l=(s=t==null?void 0:t.services)==null?void 0:s.logger)!=null&&l.forward)return t.services.logger.forward(i,"warn","react-i18next::",!0);to(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),(c=(u=t==null?void 0:t.services)==null?void 0:u.logger)!=null&&c.warn?t.services.logger.warn(...i):console!=null&&console.warn&&console.warn(...i)},n4={},Ag=(t,e,n,r)=>{to(n)&&n4[n]||(to(n)&&(n4[n]=new Date),ak(t,e,n,r))},m8=(t,e)=>()=>{if(t.isInitialized)e();else{const n=()=>{setTimeout(()=>{t.off("initialized",n)},0),e()};t.on("initialized",n)}},Mg=(t,e,n)=>{t.loadNamespaces(e,m8(t,n))},r4=(t,e,n,r)=>{if(to(n)&&(n=[n]),t.options.preload&&t.options.preload.indexOf(e)>-1)return Mg(t,n,r);n.forEach(i=>{t.options.ns.indexOf(i)<0&&t.options.ns.push(i)}),t.loadLanguages(e,m8(t,r))},lk=(t,e,n={})=>!e.languages||!e.languages.length?(Ag(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}}),to=t=>typeof t=="string",uk=t=>typeof t=="object"&&t!==null,ck=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,dk={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},hk=t=>dk[t],fk=t=>t.replace(ck,hk);let Ig={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:fk,transDefaultProps:void 0};const pk=(t={})=>{Ig={...Ig,...t}},gk=()=>Ig;let y8;const mk=t=>{y8=t},yk=()=>y8,vk={type:"3rdParty",init(t){pk(t.options.react),mk(t)}},Sk=V.createContext();class xk{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var v8={exports:{}},S8={};/** - * @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 wa=V;function wk(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var _k=typeof Object.is=="function"?Object.is:wk,Ck=wa.useState,kk=wa.useEffect,Ek=wa.useLayoutEffect,Pk=wa.useDebugValue;function Nk(t,e){var n=e(),r=Ck({inst:{value:n,getSnapshot:e}}),i=r[0].inst,s=r[1];return Ek(function(){i.value=n,i.getSnapshot=e,a0(i)&&s({inst:i})},[t,n,e]),kk(function(){return a0(i)&&s({inst:i}),t(function(){a0(i)&&s({inst:i})})},[t]),Pk(n),n}function a0(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!_k(t,n)}catch{return!0}}function Rk(t,e){return e()}var Tk=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Rk:Nk;S8.useSyncExternalStore=wa.useSyncExternalStore!==void 0?wa.useSyncExternalStore:Tk;v8.exports=S8;var x8=v8.exports;const Ok=(t,e)=>{if(to(e))return e;if(uk(e)&&to(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},bk={t:Ok,ready:!1},Lk=()=>()=>{},nm=(t,e={})=>{var I,L,H;const{i18n:n}=e,{i18n:r,defaultNS:i}=V.useContext(Sk)||{},s=n||r||yk();s&&!s.reportNamespaces&&(s.reportNamespaces=new xk),s||Ag(s,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const l=V.useMemo(()=>{var B;return{...gk(),...(B=s==null?void 0:s.options)==null?void 0:B.react,...e}},[s,e]),{useSuspense:u,keyPrefix:c}=l,h=i||((I=s==null?void 0:s.options)==null?void 0:I.defaultNS),p=to(h)?[h]:h||["translation"],y=V.useMemo(()=>p,p);(H=(L=s==null?void 0:s.reportNamespaces)==null?void 0:L.addUsedNamespaces)==null||H.call(L,y);const S=V.useRef(0),x=V.useCallback(B=>{if(!s)return Lk;const{bindI18n:$,bindI18nStore:q}=l,Q=()=>{S.current+=1,B()};return $&&s.on($,Q),q&&s.store.on(q,Q),()=>{$&&$.split(" ").forEach(re=>s.off(re,Q)),q&&q.split(" ").forEach(re=>s.store.off(re,Q))}},[s,l]),m=V.useRef(),C=V.useCallback(()=>{if(!s)return bk;const B=!!(s.isInitialized||s.initializedStoreOnce)&&y.every(W=>lk(W,s,l)),$=e.lng||s.language,q=S.current,Q=m.current;if(Q&&Q.ready===B&&Q.lng===$&&Q.keyPrefix===c&&Q.revision===q)return Q;const he={t:s.getFixedT($,l.nsMode==="fallback"?y:y[0],c),ready:B,lng:$,keyPrefix:c,revision:q};return m.current=he,he},[s,y,c,l,e.lng]),[P,E]=V.useState(0),{t:k,ready:v}=x8.useSyncExternalStore(x,C,C);V.useEffect(()=>{if(s&&!v&&!u){const B=()=>E($=>$+1);e.lng?r4(s,e.lng,y,B):Mg(s,y,B)}},[s,e.lng,y,v,u,P]);const _=s||{},R=V.useRef(null),b=V.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},O=V.useMemo(()=>{const B=_,$=B==null?void 0:B.language;let q=B;B&&(R.current&&R.current.__original===B?b.current!==$?(q=A(B),R.current=q,b.current=$):q=R.current:(q=A(B),R.current=q,b.current=$));const Q=!v&&!u?(...he)=>(Ag(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."),k(...he)):k,re=[Q,q,v];return re.t=Q,re.i18n=q,re.ready=v,re},[k,_,v,_.resolvedLanguage,_.language,_.languages]);if(s&&u&&!v)throw new Promise(B=>{const $=()=>B();e.lng?r4(s,e.lng,y,$):Mg(s,y,$)});return O},Fk={},i4=t=>{let e;const n=new Set,r=(p,y)=>{const S=typeof p=="function"?p(e):p;if(!Object.is(S,e)){const x=e;e=y??(typeof S!="object"||S===null)?S:Object.assign({},e,S),n.forEach(m=>m(e,x))}},i=()=>e,c={setState:r,getState:i,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(Fk?"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()}},h=e=t(r,i,c);return c},Ak=t=>t?i4(t):i4;var w8={exports:{}},_8={};/** - * @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 gh=V,Mk=x8;function Ik(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Dk=typeof Object.is=="function"?Object.is:Ik,jk=Mk.useSyncExternalStore,Uk=gh.useRef,zk=gh.useEffect,Bk=gh.useMemo,Gk=gh.useDebugValue;_8.useSyncExternalStoreWithSelector=function(t,e,n,r,i){var s=Uk(null);if(s.current===null){var l={hasValue:!1,value:null};s.current=l}else l=s.current;s=Bk(function(){function c(x){if(!h){if(h=!0,p=x,x=r(x),i!==void 0&&l.hasValue){var m=l.value;if(i(m,x))return y=m}return y=x}if(m=y,Dk(p,x))return m;var C=r(x);return i!==void 0&&i(m,C)?(p=x,m):(p=x,y=C)}var h=!1,p,y,S=n===void 0?null:n;return[function(){return c(e())},S===null?void 0:function(){return c(S())}]},[e,n,r,i]);var u=jk(t,s[0],s[1]);return zk(function(){l.hasValue=!0,l.value=u},[u]),Gk(u),u};w8.exports=_8;var Hk=w8.exports;const Vk=Yd(Hk),C8={},{useDebugValue:Wk}=Mt,{useSyncExternalStoreWithSelector:Kk}=Vk;let s4=!1;const $k=t=>t;function Qk(t,e=$k,n){(C8?"production":void 0)!=="production"&&n&&!s4&&(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"),s4=!0);const r=Kk(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return Wk(r),r}const o4=t=>{(C8?"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"?Ak(t):t,n=(r,i)=>Qk(e,r,i);return Object.assign(n,e),n},rm=t=>t?o4(t):o4;function k8(t,e){return function(){return t.apply(e,arguments)}}const{toString:qk}=Object.prototype,{getPrototypeOf:im}=Object,{iterator:mh,toStringTag:E8}=Symbol,yh=(t=>e=>{const n=qk.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),mr=t=>(t=t.toLowerCase(),e=>yh(e)===t),vh=t=>e=>typeof e===t,{isArray:ba}=Array,_a=vh("undefined");function wu(t){return t!==null&&!_a(t)&&t.constructor!==null&&!_a(t.constructor)&&Cn(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const P8=mr("ArrayBuffer");function Yk(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&P8(t.buffer),e}const Xk=vh("string"),Cn=vh("function"),N8=vh("number"),_u=t=>t!==null&&typeof t=="object",Jk=t=>t===!0||t===!1,ud=t=>{if(yh(t)!=="object")return!1;const e=im(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(E8 in t)&&!(mh in t)},Zk=t=>{if(!_u(t)||wu(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},eE=mr("Date"),tE=mr("File"),nE=t=>!!(t&&typeof t.uri<"u"),rE=t=>t&&typeof t.getParts<"u",iE=mr("Blob"),sE=mr("FileList"),oE=t=>_u(t)&&Cn(t.pipe);function aE(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const a4=aE(),l4=typeof a4.FormData<"u"?a4.FormData:void 0,lE=t=>{let e;return t&&(l4&&t instanceof l4||Cn(t.append)&&((e=yh(t))==="formdata"||e==="object"&&Cn(t.toString)&&t.toString()==="[object FormData]"))},uE=mr("URLSearchParams"),[cE,dE,hE,fE]=["ReadableStream","Request","Response","Headers"].map(mr),pE=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Cu(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,i;if(typeof t!="object"&&(t=[t]),ba(t))for(r=0,i=t.length;r0;)if(i=n[r],e===i.toLowerCase())return i;return null}const As=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,T8=t=>!_a(t)&&t!==As;function Dg(){const{caseless:t,skipUndefined:e}=T8(this)&&this||{},n={},r=(i,s)=>{if(s==="__proto__"||s==="constructor"||s==="prototype")return;const l=t&&R8(n,s)||s;ud(n[l])&&ud(i)?n[l]=Dg(n[l],i):ud(i)?n[l]=Dg({},i):ba(i)?n[l]=i.slice():(!e||!_a(i))&&(n[l]=i)};for(let i=0,s=arguments.length;i(Cu(e,(i,s)=>{n&&Cn(i)?Object.defineProperty(t,s,{value:k8(i,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,s,{value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),t),mE=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),yE=(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)},vE=(t,e,n,r)=>{let i,s,l;const u={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)l=i[s],(!r||r(l,t,e))&&!u[l]&&(e[l]=t[l],u[l]=!0);t=n!==!1&&im(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},SE=(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},xE=t=>{if(!t)return null;if(ba(t))return t;let e=t.length;if(!N8(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},wE=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&im(Uint8Array)),_E=(t,e)=>{const r=(t&&t[mh]).call(t);let i;for(;(i=r.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},CE=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},kE=mr("HTMLFormElement"),EE=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),u4=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),PE=mr("RegExp"),O8=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};Cu(n,(i,s)=>{let l;(l=e(i,s,t))!==!1&&(r[s]=l||i)}),Object.defineProperties(t,r)},NE=t=>{O8(t,(e,n)=>{if(Cn(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(Cn(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+"'")})}})},RE=(t,e)=>{const n={},r=i=>{i.forEach(s=>{n[s]=!0})};return ba(t)?r(t):r(String(t).split(e)),n},TE=()=>{},OE=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function bE(t){return!!(t&&Cn(t.append)&&t[E8]==="FormData"&&t[mh])}const LE=t=>{const e=new Array(10),n=(r,i)=>{if(_u(r)){if(e.indexOf(r)>=0)return;if(wu(r))return r;if(!("toJSON"in r)){e[i]=r;const s=ba(r)?[]:{};return Cu(r,(l,u)=>{const c=n(l,i+1);!_a(c)&&(s[u]=c)}),e[i]=void 0,s}}return r};return n(t,0)},FE=mr("AsyncFunction"),AE=t=>t&&(_u(t)||Cn(t))&&Cn(t.then)&&Cn(t.catch),b8=((t,e)=>t?setImmediate:e?((n,r)=>(As.addEventListener("message",({source:i,data:s})=>{i===As&&s===n&&r.length&&r.shift()()},!1),i=>{r.push(i),As.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Cn(As.postMessage)),ME=typeof queueMicrotask<"u"?queueMicrotask.bind(As):typeof process<"u"&&process.nextTick||b8,IE=t=>t!=null&&Cn(t[mh]),z={isArray:ba,isArrayBuffer:P8,isBuffer:wu,isFormData:lE,isArrayBufferView:Yk,isString:Xk,isNumber:N8,isBoolean:Jk,isObject:_u,isPlainObject:ud,isEmptyObject:Zk,isReadableStream:cE,isRequest:dE,isResponse:hE,isHeaders:fE,isUndefined:_a,isDate:eE,isFile:tE,isReactNativeBlob:nE,isReactNative:rE,isBlob:iE,isRegExp:PE,isFunction:Cn,isStream:oE,isURLSearchParams:uE,isTypedArray:wE,isFileList:sE,forEach:Cu,merge:Dg,extend:gE,trim:pE,stripBOM:mE,inherits:yE,toFlatObject:vE,kindOf:yh,kindOfTest:mr,endsWith:SE,toArray:xE,forEachEntry:_E,matchAll:CE,isHTMLForm:kE,hasOwnProperty:u4,hasOwnProp:u4,reduceDescriptors:O8,freezeMethods:NE,toObjectSet:RE,toCamelCase:EE,noop:TE,toFiniteNumber:OE,findKey:R8,global:As,isContextDefined:T8,isSpecCompliantForm:bE,toJSONObject:LE,isAsyncFn:FE,isThenable:AE,setImmediate:b8,asap:ME,isIterable:IE};let pe=class L8 extends Error{static from(e,n,r,i,s,l){const u=new L8(e.message,n||e.code,r,i,s);return u.cause=e,u.name=e.name,e.status!=null&&u.status==null&&(u.status=e.status),l&&Object.assign(u,l),u}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:z.toJSONObject(this.config),code:this.code,status:this.status}}};pe.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";pe.ERR_BAD_OPTION="ERR_BAD_OPTION";pe.ECONNABORTED="ECONNABORTED";pe.ETIMEDOUT="ETIMEDOUT";pe.ERR_NETWORK="ERR_NETWORK";pe.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";pe.ERR_DEPRECATED="ERR_DEPRECATED";pe.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";pe.ERR_BAD_REQUEST="ERR_BAD_REQUEST";pe.ERR_CANCELED="ERR_CANCELED";pe.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";pe.ERR_INVALID_URL="ERR_INVALID_URL";const DE=null;function jg(t){return z.isPlainObject(t)||z.isArray(t)}function F8(t){return z.endsWith(t,"[]")?t.slice(0,-2):t}function l0(t,e,n){return t?t.concat(e).map(function(i,s){return i=F8(i),!n&&s?"["+i+"]":i}).join(n?".":""):e}function jE(t){return z.isArray(t)&&!t.some(jg)}const UE=z.toFlatObject(z,{},null,function(e){return/^is[A-Z]/.test(e)});function Sh(t,e,n){if(!z.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=z.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,P){return!z.isUndefined(P[C])});const r=n.metaTokens,i=n.visitor||p,s=n.dots,l=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&z.isSpecCompliantForm(e);if(!z.isFunction(i))throw new TypeError("visitor must be a function");function h(m){if(m===null)return"";if(z.isDate(m))return m.toISOString();if(z.isBoolean(m))return m.toString();if(!c&&z.isBlob(m))throw new pe("Blob is not supported. Use a Buffer instead.");return z.isArrayBuffer(m)||z.isTypedArray(m)?c&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function p(m,C,P){let E=m;if(z.isReactNative(e)&&z.isReactNativeBlob(m))return e.append(l0(P,C,s),h(m)),!1;if(m&&!P&&typeof m=="object"){if(z.endsWith(C,"{}"))C=r?C:C.slice(0,-2),m=JSON.stringify(m);else if(z.isArray(m)&&jE(m)||(z.isFileList(m)||z.endsWith(C,"[]"))&&(E=z.toArray(m)))return C=F8(C),E.forEach(function(v,_){!(z.isUndefined(v)||v===null)&&e.append(l===!0?l0([C],_,s):l===null?C:C+"[]",h(v))}),!1}return jg(m)?!0:(e.append(l0(P,C,s),h(m)),!1)}const y=[],S=Object.assign(UE,{defaultVisitor:p,convertValue:h,isVisitable:jg});function x(m,C){if(!z.isUndefined(m)){if(y.indexOf(m)!==-1)throw Error("Circular reference detected in "+C.join("."));y.push(m),z.forEach(m,function(E,k){(!(z.isUndefined(E)||E===null)&&i.call(e,E,z.isString(k)?k.trim():k,C,S))===!0&&x(E,C?C.concat(k):[k])}),y.pop()}}if(!z.isObject(t))throw new TypeError("data must be an object");return x(t),e}function c4(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function sm(t,e){this._pairs=[],t&&Sh(t,this,e)}const A8=sm.prototype;A8.append=function(e,n){this._pairs.push([e,n])};A8.toString=function(e){const n=e?function(r){return e.call(this,r,c4)}:c4;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function zE(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function M8(t,e,n){if(!e)return t;const r=n&&n.encode||zE,i=z.isFunction(n)?{serialize:n}:n,s=i&&i.serialize;let l;if(s?l=s(e,i):l=z.isURLSearchParams(e)?e.toString():new sm(e,i).toString(r),l){const u=t.indexOf("#");u!==-1&&(t=t.slice(0,u)),t+=(t.indexOf("?")===-1?"?":"&")+l}return t}class d4{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){z.forEach(this.handlers,function(r){r!==null&&e(r)})}}const om={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},BE=typeof URLSearchParams<"u"?URLSearchParams:sm,GE=typeof FormData<"u"?FormData:null,HE=typeof Blob<"u"?Blob:null,VE={isBrowser:!0,classes:{URLSearchParams:BE,FormData:GE,Blob:HE},protocols:["http","https","file","blob","url","data"]},am=typeof window<"u"&&typeof document<"u",Ug=typeof navigator=="object"&&navigator||void 0,WE=am&&(!Ug||["ReactNative","NativeScript","NS"].indexOf(Ug.product)<0),KE=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",$E=am&&window.location.href||"http://localhost",QE=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:am,hasStandardBrowserEnv:WE,hasStandardBrowserWebWorkerEnv:KE,navigator:Ug,origin:$E},Symbol.toStringTag,{value:"Module"})),Jt={...QE,...VE};function qE(t,e){return Sh(t,new Jt.classes.URLSearchParams,{visitor:function(n,r,i,s){return Jt.isNode&&z.isBuffer(n)?(this.append(r,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},...e})}function YE(t){return z.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function XE(t){const e={},n=Object.keys(t);let r;const i=n.length;let s;for(r=0;r=n.length;return l=!l&&z.isArray(i)?i.length:l,c?(z.hasOwnProp(i,l)?i[l]=[i[l],r]:i[l]=r,!u):((!i[l]||!z.isObject(i[l]))&&(i[l]=[]),e(n,r,i[l],s)&&z.isArray(i[l])&&(i[l]=XE(i[l])),!u)}if(z.isFormData(t)&&z.isFunction(t.entries)){const n={};return z.forEachEntry(t,(r,i)=>{e(YE(r),i,n,0)}),n}return null}function JE(t,e,n){if(z.isString(t))try{return(e||JSON.parse)(t),z.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const ku={transitional:om,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,s=z.isObject(e);if(s&&z.isHTMLForm(e)&&(e=new FormData(e)),z.isFormData(e))return i?JSON.stringify(I8(e)):e;if(z.isArrayBuffer(e)||z.isBuffer(e)||z.isStream(e)||z.isFile(e)||z.isBlob(e)||z.isReadableStream(e))return e;if(z.isArrayBufferView(e))return e.buffer;if(z.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let u;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return qE(e,this.formSerializer).toString();if((u=z.isFileList(e))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Sh(u?{"files[]":e}:e,c&&new c,this.formSerializer)}}return s||i?(n.setContentType("application/json",!1),JE(e)):e}],transformResponse:[function(e){const n=this.transitional||ku.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(z.isResponse(e)||z.isReadableStream(e))return e;if(e&&z.isString(e)&&(r&&!this.responseType||i)){const l=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(e,this.parseReviver)}catch(u){if(l)throw u.name==="SyntaxError"?pe.from(u,pe.ERR_BAD_RESPONSE,this,null,this.response):u}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Jt.classes.FormData,Blob:Jt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};z.forEach(["delete","get","head","post","put","patch"],t=>{ku.headers[t]={}});const ZE=z.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"]),eP=t=>{const e={};let n,r,i;return t&&t.split(` -`).forEach(function(l){i=l.indexOf(":"),n=l.substring(0,i).trim().toLowerCase(),r=l.substring(i+1).trim(),!(!n||e[n]&&ZE[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},h4=Symbol("internals");function gl(t){return t&&String(t).trim().toLowerCase()}function cd(t){return t===!1||t==null?t:z.isArray(t)?t.map(cd):String(t).replace(/[\r\n]+$/,"")}function tP(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 nP=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function u0(t,e,n,r,i){if(z.isFunction(r))return r.call(this,e,n);if(i&&(e=n),!!z.isString(e)){if(z.isString(r))return e.indexOf(r)!==-1;if(z.isRegExp(r))return r.test(e)}}function rP(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function iP(t,e){const n=z.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(i,s,l){return this[r].call(this,e,i,s,l)},configurable:!0})})}let kn=class{constructor(e){e&&this.set(e)}set(e,n,r){const i=this;function s(u,c,h){const p=gl(c);if(!p)throw new Error("header name must be a non-empty string");const y=z.findKey(i,p);(!y||i[y]===void 0||h===!0||h===void 0&&i[y]!==!1)&&(i[y||c]=cd(u))}const l=(u,c)=>z.forEach(u,(h,p)=>s(h,p,c));if(z.isPlainObject(e)||e instanceof this.constructor)l(e,n);else if(z.isString(e)&&(e=e.trim())&&!nP(e))l(eP(e),n);else if(z.isObject(e)&&z.isIterable(e)){let u={},c,h;for(const p of e){if(!z.isArray(p))throw TypeError("Object iterator must return a key-value pair");u[h=p[0]]=(c=u[h])?z.isArray(c)?[...c,p[1]]:[c,p[1]]:p[1]}l(u,n)}else e!=null&&s(n,e,r);return this}get(e,n){if(e=gl(e),e){const r=z.findKey(this,e);if(r){const i=this[r];if(!n)return i;if(n===!0)return tP(i);if(z.isFunction(n))return n.call(this,i,r);if(z.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=gl(e),e){const r=z.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||u0(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let i=!1;function s(l){if(l=gl(l),l){const u=z.findKey(r,l);u&&(!n||u0(r,r[u],u,n))&&(delete r[u],i=!0)}}return z.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||u0(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const n=this,r={};return z.forEach(this,(i,s)=>{const l=z.findKey(r,s);if(l){n[l]=cd(i),delete n[s];return}const u=e?rP(s):String(s).trim();u!==s&&delete n[s],n[u]=cd(i),r[u]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return z.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=e&&z.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[h4]=this[h4]={accessors:{}}).accessors,i=this.prototype;function s(l){const u=gl(l);r[u]||(iP(i,l),r[u]=!0)}return z.isArray(e)?e.forEach(s):s(e),this}};kn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);z.reduceDescriptors(kn.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});z.freezeMethods(kn);function c0(t,e){const n=this||ku,r=e||n,i=kn.from(r.headers);let s=r.data;return z.forEach(t,function(u){s=u.call(n,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function D8(t){return!!(t&&t.__CANCEL__)}let Eu=class extends pe{constructor(e,n,r){super(e??"canceled",pe.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function j8(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new pe("Request failed with status code "+n.status,[pe.ERR_BAD_REQUEST,pe.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function sP(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function oP(t,e){t=t||10;const n=new Array(t),r=new Array(t);let i=0,s=0,l;return e=e!==void 0?e:1e3,function(c){const h=Date.now(),p=r[s];l||(l=h),n[i]=c,r[i]=h;let y=s,S=0;for(;y!==i;)S+=n[y++],y=y%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),h-l{n=p,i=null,s&&(clearTimeout(s),s=null),t(...h)};return[(...h)=>{const p=Date.now(),y=p-n;y>=r?l(h,p):(i=h,s||(s=setTimeout(()=>{s=null,l(i)},r-y)))},()=>i&&l(i)]}const Vd=(t,e,n=3)=>{let r=0;const i=oP(50,250);return aP(s=>{const l=s.loaded,u=s.lengthComputable?s.total:void 0,c=l-r,h=i(c),p=l<=u;r=l;const y={loaded:l,total:u,progress:u?l/u:void 0,bytes:c,rate:h||void 0,estimated:h&&u&&p?(u-l)/h:void 0,event:s,lengthComputable:u!=null,[e?"download":"upload"]:!0};t(y)},n)},f4=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},p4=t=>(...e)=>z.asap(()=>t(...e)),lP=Jt.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,Jt.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(Jt.origin),Jt.navigator&&/(msie|trident)/i.test(Jt.navigator.userAgent)):()=>!0,uP=Jt.hasStandardBrowserEnv?{write(t,e,n,r,i,s,l){if(typeof document>"u")return;const u=[`${t}=${encodeURIComponent(e)}`];z.isNumber(n)&&u.push(`expires=${new Date(n).toUTCString()}`),z.isString(r)&&u.push(`path=${r}`),z.isString(i)&&u.push(`domain=${i}`),s===!0&&u.push("secure"),z.isString(l)&&u.push(`SameSite=${l}`),document.cookie=u.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 cP(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function dP(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function U8(t,e,n){let r=!cP(e);return t&&(r||n==!1)?dP(t,e):e}const g4=t=>t instanceof kn?{...t}:t;function no(t,e){e=e||{};const n={};function r(h,p,y,S){return z.isPlainObject(h)&&z.isPlainObject(p)?z.merge.call({caseless:S},h,p):z.isPlainObject(p)?z.merge({},p):z.isArray(p)?p.slice():p}function i(h,p,y,S){if(z.isUndefined(p)){if(!z.isUndefined(h))return r(void 0,h,y,S)}else return r(h,p,y,S)}function s(h,p){if(!z.isUndefined(p))return r(void 0,p)}function l(h,p){if(z.isUndefined(p)){if(!z.isUndefined(h))return r(void 0,h)}else return r(void 0,p)}function u(h,p,y){if(y in e)return r(h,p);if(y in t)return r(void 0,h)}const c={url:s,method:s,data:s,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,withXSRFToken:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,beforeRedirect:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:u,headers:(h,p,y)=>i(g4(h),g4(p),y,!0)};return z.forEach(Object.keys({...t,...e}),function(p){if(p==="__proto__"||p==="constructor"||p==="prototype")return;const y=z.hasOwnProp(c,p)?c[p]:i,S=y(t[p],e[p],p);z.isUndefined(S)&&y!==u||(n[p]=S)}),n}const z8=t=>{const e=no({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:s,headers:l,auth:u}=e;if(e.headers=l=kn.from(l),e.url=M8(U8(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),u&&l.set("Authorization","Basic "+btoa((u.username||"")+":"+(u.password?unescape(encodeURIComponent(u.password)):""))),z.isFormData(n)){if(Jt.hasStandardBrowserEnv||Jt.hasStandardBrowserWebWorkerEnv)l.setContentType(void 0);else if(z.isFunction(n.getHeaders)){const c=n.getHeaders(),h=["content-type","content-length"];Object.entries(c).forEach(([p,y])=>{h.includes(p.toLowerCase())&&l.set(p,y)})}}if(Jt.hasStandardBrowserEnv&&(r&&z.isFunction(r)&&(r=r(e)),r||r!==!1&&lP(e.url))){const c=i&&s&&uP.read(s);c&&l.set(i,c)}return e},hP=typeof XMLHttpRequest<"u",fP=hP&&function(t){return new Promise(function(n,r){const i=z8(t);let s=i.data;const l=kn.from(i.headers).normalize();let{responseType:u,onUploadProgress:c,onDownloadProgress:h}=i,p,y,S,x,m;function C(){x&&x(),m&&m(),i.cancelToken&&i.cancelToken.unsubscribe(p),i.signal&&i.signal.removeEventListener("abort",p)}let P=new XMLHttpRequest;P.open(i.method.toUpperCase(),i.url,!0),P.timeout=i.timeout;function E(){if(!P)return;const v=kn.from("getAllResponseHeaders"in P&&P.getAllResponseHeaders()),R={data:!u||u==="text"||u==="json"?P.responseText:P.response,status:P.status,statusText:P.statusText,headers:v,config:t,request:P};j8(function(A){n(A),C()},function(A){r(A),C()},R),P=null}"onloadend"in P?P.onloadend=E:P.onreadystatechange=function(){!P||P.readyState!==4||P.status===0&&!(P.responseURL&&P.responseURL.indexOf("file:")===0)||setTimeout(E)},P.onabort=function(){P&&(r(new pe("Request aborted",pe.ECONNABORTED,t,P)),P=null)},P.onerror=function(_){const R=_&&_.message?_.message:"Network Error",b=new pe(R,pe.ERR_NETWORK,t,P);b.event=_||null,r(b),P=null},P.ontimeout=function(){let _=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const R=i.transitional||om;i.timeoutErrorMessage&&(_=i.timeoutErrorMessage),r(new pe(_,R.clarifyTimeoutError?pe.ETIMEDOUT:pe.ECONNABORTED,t,P)),P=null},s===void 0&&l.setContentType(null),"setRequestHeader"in P&&z.forEach(l.toJSON(),function(_,R){P.setRequestHeader(R,_)}),z.isUndefined(i.withCredentials)||(P.withCredentials=!!i.withCredentials),u&&u!=="json"&&(P.responseType=i.responseType),h&&([S,m]=Vd(h,!0),P.addEventListener("progress",S)),c&&P.upload&&([y,x]=Vd(c),P.upload.addEventListener("progress",y),P.upload.addEventListener("loadend",x)),(i.cancelToken||i.signal)&&(p=v=>{P&&(r(!v||v.type?new Eu(null,t,P):v),P.abort(),P=null)},i.cancelToken&&i.cancelToken.subscribe(p),i.signal&&(i.signal.aborted?p():i.signal.addEventListener("abort",p)));const k=sP(i.url);if(k&&Jt.protocols.indexOf(k)===-1){r(new pe("Unsupported protocol "+k+":",pe.ERR_BAD_REQUEST,t));return}P.send(s||null)})},pP=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,i;const s=function(h){if(!i){i=!0,u();const p=h instanceof Error?h:this.reason;r.abort(p instanceof pe?p:new Eu(p instanceof Error?p.message:p))}};let l=e&&setTimeout(()=>{l=null,s(new pe(`timeout of ${e}ms exceeded`,pe.ETIMEDOUT))},e);const u=()=>{t&&(l&&clearTimeout(l),l=null,t.forEach(h=>{h.unsubscribe?h.unsubscribe(s):h.removeEventListener("abort",s)}),t=null)};t.forEach(h=>h.addEventListener("abort",s));const{signal:c}=r;return c.unsubscribe=()=>z.asap(u),c}},gP=function*(t,e){let n=t.byteLength;if(n{const i=mP(t,e);let s=0,l,u=c=>{l||(l=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:h,value:p}=await i.next();if(h){u(),c.close();return}let y=p.byteLength;if(n){let S=s+=y;n(S)}c.enqueue(new Uint8Array(p))}catch(h){throw u(h),h}},cancel(c){return u(c),i.return()}},{highWaterMark:2})},y4=64*1024,{isFunction:Hc}=z,vP=(({Request:t,Response:e})=>({Request:t,Response:e}))(z.global),{ReadableStream:v4,TextEncoder:S4}=z.global,x4=(t,...e)=>{try{return!!t(...e)}catch{return!1}},SP=t=>{t=z.merge.call({skipUndefined:!0},vP,t);const{fetch:e,Request:n,Response:r}=t,i=e?Hc(e):typeof fetch=="function",s=Hc(n),l=Hc(r);if(!i)return!1;const u=i&&Hc(v4),c=i&&(typeof S4=="function"?(m=>C=>m.encode(C))(new S4):async m=>new Uint8Array(await new n(m).arrayBuffer())),h=s&&u&&x4(()=>{let m=!1;const C=new v4,P=new n(Jt.origin,{body:C,method:"POST",get duplex(){return m=!0,"half"}}).headers.has("Content-Type");return C.cancel(),m&&!P}),p=l&&u&&x4(()=>z.isReadableStream(new r("").body)),y={stream:p&&(m=>m.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!y[m]&&(y[m]=(C,P)=>{let E=C&&C[m];if(E)return E.call(C);throw new pe(`Response type '${m}' is not supported`,pe.ERR_NOT_SUPPORT,P)})});const S=async m=>{if(m==null)return 0;if(z.isBlob(m))return m.size;if(z.isSpecCompliantForm(m))return(await new n(Jt.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(z.isArrayBufferView(m)||z.isArrayBuffer(m))return m.byteLength;if(z.isURLSearchParams(m)&&(m=m+""),z.isString(m))return(await c(m)).byteLength},x=async(m,C)=>{const P=z.toFiniteNumber(m.getContentLength());return P??S(C)};return async m=>{let{url:C,method:P,data:E,signal:k,cancelToken:v,timeout:_,onDownloadProgress:R,onUploadProgress:b,responseType:A,headers:O,withCredentials:I="same-origin",fetchOptions:L}=z8(m),H=e||fetch;A=A?(A+"").toLowerCase():"text";let B=pP([k,v&&v.toAbortSignal()],_),$=null;const q=B&&B.unsubscribe&&(()=>{B.unsubscribe()});let Q;try{if(b&&h&&P!=="get"&&P!=="head"&&(Q=await x(O,E))!==0){let Y=new n(C,{method:"POST",body:E,duplex:"half"}),ie;if(z.isFormData(E)&&(ie=Y.headers.get("content-type"))&&O.setContentType(ie),Y.body){const[xe,Ke]=f4(Q,Vd(p4(b)));E=m4(Y.body,y4,xe,Ke)}}z.isString(I)||(I=I?"include":"omit");const re=s&&"credentials"in n.prototype,he={...L,signal:B,method:P.toUpperCase(),headers:O.normalize().toJSON(),body:E,duplex:"half",credentials:re?I:void 0};$=s&&new n(C,he);let W=await(s?H($,L):H(C,he));const te=p&&(A==="stream"||A==="response");if(p&&(R||te&&q)){const Y={};["status","statusText","headers"].forEach(it=>{Y[it]=W[it]});const ie=z.toFiniteNumber(W.headers.get("content-length")),[xe,Ke]=R&&f4(ie,Vd(p4(R),!0))||[];W=new r(m4(W.body,y4,xe,()=>{Ke&&Ke(),q&&q()}),Y)}A=A||"text";let Z=await y[z.findKey(y,A)||"text"](W,m);return!te&&q&&q(),await new Promise((Y,ie)=>{j8(Y,ie,{data:Z,headers:kn.from(W.headers),status:W.status,statusText:W.statusText,config:m,request:$})})}catch(re){throw q&&q(),re&&re.name==="TypeError"&&/Load failed|fetch/i.test(re.message)?Object.assign(new pe("Network Error",pe.ERR_NETWORK,m,$,re&&re.response),{cause:re.cause||re}):pe.from(re,re&&re.code,m,$,re&&re.response)}}},xP=new Map,B8=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:i}=e,s=[r,i,n];let l=s.length,u=l,c,h,p=xP;for(;u--;)c=s[u],h=p.get(c),h===void 0&&p.set(c,h=u?new Map:SP(e)),p=h;return h};B8();const lm={http:DE,xhr:fP,fetch:{get:B8}};z.forEach(lm,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const w4=t=>`- ${t}`,wP=t=>z.isFunction(t)||t===null||t===!1;function _P(t,e){t=z.isArray(t)?t:[t];const{length:n}=t;let r,i;const s={};for(let l=0;l`adapter ${c} `+(h===!1?"is not supported by the environment":"is not available in the build"));let u=n?l.length>1?`since : -`+l.map(w4).join(` -`):" "+w4(l[0]):"as no adapter specified";throw new pe("There is no suitable adapter to dispatch the request "+u,"ERR_NOT_SUPPORT")}return i}const G8={getAdapter:_P,adapters:lm};function d0(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Eu(null,t)}function _4(t){return d0(t),t.headers=kn.from(t.headers),t.data=c0.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),G8.getAdapter(t.adapter||ku.adapter,t)(t).then(function(r){return d0(t),r.data=c0.call(t,t.transformResponse,r),r.headers=kn.from(r.headers),r},function(r){return D8(r)||(d0(t),r&&r.response&&(r.response.data=c0.call(t,t.transformResponse,r.response),r.response.headers=kn.from(r.response.headers))),Promise.reject(r)})}const H8="1.14.0",xh={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{xh[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const C4={};xh.transitional=function(e,n,r){function i(s,l){return"[Axios v"+H8+"] Transitional option '"+s+"'"+l+(r?". "+r:"")}return(s,l,u)=>{if(e===!1)throw new pe(i(l," has been removed"+(n?" in "+n:"")),pe.ERR_DEPRECATED);return n&&!C4[l]&&(C4[l]=!0,console.warn(i(l," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(s,l,u):!0}};xh.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function CP(t,e,n){if(typeof t!="object")throw new pe("options must be an object",pe.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let i=r.length;for(;i-- >0;){const s=r[i],l=e[s];if(l){const u=t[s],c=u===void 0||l(u,s,t);if(c!==!0)throw new pe("option "+s+" must be "+c,pe.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new pe("Unknown option "+s,pe.ERR_BAD_OPTION)}}const dd={assertOptions:CP,validators:xh},Hn=dd.validators;let $s=class{constructor(e){this.defaults=e||{},this.interceptors={request:new d4,response:new d4}}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=no(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:s}=n;r!==void 0&&dd.assertOptions(r,{silentJSONParsing:Hn.transitional(Hn.boolean),forcedJSONParsing:Hn.transitional(Hn.boolean),clarifyTimeoutError:Hn.transitional(Hn.boolean),legacyInterceptorReqResOrdering:Hn.transitional(Hn.boolean)},!1),i!=null&&(z.isFunction(i)?n.paramsSerializer={serialize:i}:dd.assertOptions(i,{encode:Hn.function,serialize:Hn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),dd.assertOptions(n,{baseUrl:Hn.spelling("baseURL"),withXsrfToken:Hn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let l=s&&z.merge(s.common,s[n.method]);s&&z.forEach(["delete","get","head","post","put","patch","common"],m=>{delete s[m]}),n.headers=kn.concat(l,s);const u=[];let c=!0;this.interceptors.request.forEach(function(C){if(typeof C.runWhen=="function"&&C.runWhen(n)===!1)return;c=c&&C.synchronous;const P=n.transitional||om;P&&P.legacyInterceptorReqResOrdering?u.unshift(C.fulfilled,C.rejected):u.push(C.fulfilled,C.rejected)});const h=[];this.interceptors.response.forEach(function(C){h.push(C.fulfilled,C.rejected)});let p,y=0,S;if(!c){const m=[_4.bind(this),void 0];for(m.unshift(...u),m.push(...h),S=m.length,p=Promise.resolve(n);y{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 l=new Promise(u=>{r.subscribe(u),s=u}).then(i);return l.cancel=function(){r.unsubscribe(s)},l},e(function(s,l,u){r.reason||(r.reason=new Eu(s,l,u),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 V8(function(i){e=i}),cancel:e}}};function EP(t){return function(n){return t.apply(null,n)}}function PP(t){return z.isObject(t)&&t.isAxiosError===!0}const zg={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(zg).forEach(([t,e])=>{zg[e]=t});function W8(t){const e=new $s(t),n=k8($s.prototype.request,e);return z.extend(n,$s.prototype,e,{allOwnKeys:!0}),z.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return W8(no(t,i))},n}const nt=W8(ku);nt.Axios=$s;nt.CanceledError=Eu;nt.CancelToken=kP;nt.isCancel=D8;nt.VERSION=H8;nt.toFormData=Sh;nt.AxiosError=pe;nt.Cancel=nt.CanceledError;nt.all=function(e){return Promise.all(e)};nt.spread=EP;nt.isAxiosError=PP;nt.mergeConfig=no;nt.AxiosHeaders=kn;nt.formToJSON=t=>I8(z.isHTMLForm(t)?new FormData(t):t);nt.getAdapter=G8.getAdapter;nt.HttpStatusCode=zg;nt.default=nt;const{Axios:CL,AxiosError:kL,CanceledError:EL,isCancel:PL,CancelToken:NL,VERSION:RL,all:TL,Cancel:OL,isAxiosError:bL,spread:LL,toFormData:FL,AxiosHeaders:AL,HttpStatusCode:ML,formToJSON:IL,getAdapter:DL,mergeConfig:jL}=nt,K8=rm(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 nt.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 nt.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 NP({isOpen:t,onClose:e}){const[n,r]=V.useState(!0),[i,s]=V.useState(""),[l,u]=V.useState(""),[c,h]=V.useState(""),[p,y]=V.useState(""),[S,x]=V.useState(!1),{t:m}=nm(),{setAuth:C}=K8();if(!t)return null;const P=async E=>{var k,v;E.preventDefault(),y(""),x(!0);try{const _=n?"/api/auth/login":"/api/auth/register",R=n?{email:i,password:c}:{email:i,password:c,name:l},b=await nt.post(_,R);C(b.data.user,b.data.token),e()}catch(_){y(((v=(k=_.response)==null?void 0:k.data)==null?void 0:v.error)||"Authentication failed")}finally{x(!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(BC,{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:m(n?"auth.welcomeBack":"auth.createAccount")}),p&&N.jsx("div",{className:"bg-red-50 text-red-600 p-3 rounded-lg mb-4 text-sm",children:p}),N.jsxs("form",{onSubmit:P,className:"space-y-4",children:[!n&&N.jsxs("div",{children:[N.jsx("label",{className:"label",children:m("auth.name")}),N.jsx("input",{type:"text",value:l,onChange:E=>u(E.target.value),className:"input",placeholder:m("auth.name")})]}),N.jsxs("div",{children:[N.jsx("label",{className:"label",children:m("auth.email")}),N.jsx("input",{type:"email",value:i,onChange:E=>s(E.target.value),required:!0,className:"input",placeholder:"you@example.com"})]}),N.jsxs("div",{children:[N.jsx("label",{className:"label",children:m("auth.password")}),N.jsx("input",{type:"password",value:c,onChange:E=>h(E.target.value),required:!0,className:"input",placeholder:"••••••••"})]}),N.jsx("button",{type:"submit",disabled:S,className:"btn-primary w-full py-2.5 mt-2",children:m(S?"auth.pleaseWait":n?"auth.login":"auth.signUp")})]}),N.jsxs("div",{className:"mt-6 text-center text-sm text-gray-500",children:[m(n?"auth.dontHaveAccount":"auth.alreadyHaveAccount"),N.jsx("button",{type:"button",onClick:()=>{r(!n),y("")},className:"text-primary-600 font-semibold hover:underline",children:m(n?"auth.signUp":"auth.login")})]})]})]})})}function RP({covers:t,onSelect:e,onDelete:n}){return t.length===0?N.jsxs("div",{className:"card text-center py-12",children:[N.jsx(tm,{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(FC,{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(c8,{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(zC,{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 $8={exports:{}},wh={},Wd={},ke={};(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 py<"u"?py: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)})(ke);var ct={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Util=t.Transform=void 0;const e=ke;class n{constructor(_=[1,0,0,1,0,0]){this.dirty=!1,this.m=_&&_.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(_){_.m[0]=this.m[0],_.m[1]=this.m[1],_.m[2]=this.m[2],_.m[3]=this.m[3],_.m[4]=this.m[4],_.m[5]=this.m[5]}point(_){const R=this.m;return{x:R[0]*_.x+R[2]*_.y+R[4],y:R[1]*_.x+R[3]*_.y+R[5]}}translate(_,R){return this.m[4]+=this.m[0]*_+this.m[2]*R,this.m[5]+=this.m[1]*_+this.m[3]*R,this}scale(_,R){return this.m[0]*=_,this.m[1]*=_,this.m[2]*=R,this.m[3]*=R,this}rotate(_){const R=Math.cos(_),b=Math.sin(_),A=this.m[0]*R+this.m[2]*b,O=this.m[1]*R+this.m[3]*b,I=this.m[0]*-b+this.m[2]*R,L=this.m[1]*-b+this.m[3]*R;return this.m[0]=A,this.m[1]=O,this.m[2]=I,this.m[3]=L,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(_,R){const b=this.m[0]+this.m[2]*R,A=this.m[1]+this.m[3]*R,O=this.m[2]+this.m[0]*_,I=this.m[3]+this.m[1]*_;return this.m[0]=b,this.m[1]=A,this.m[2]=O,this.m[3]=I,this}multiply(_){const R=this.m[0]*_.m[0]+this.m[2]*_.m[1],b=this.m[1]*_.m[0]+this.m[3]*_.m[1],A=this.m[0]*_.m[2]+this.m[2]*_.m[3],O=this.m[1]*_.m[2]+this.m[3]*_.m[3],I=this.m[0]*_.m[4]+this.m[2]*_.m[5]+this.m[4],L=this.m[1]*_.m[4]+this.m[3]*_.m[5]+this.m[5];return this.m[0]=R,this.m[1]=b,this.m[2]=A,this.m[3]=O,this.m[4]=I,this.m[5]=L,this}invert(){const _=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),R=this.m[3]*_,b=-this.m[1]*_,A=-this.m[2]*_,O=this.m[0]*_,I=_*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),L=_*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=R,this.m[1]=b,this.m[2]=A,this.m[3]=O,this.m[4]=I,this.m[5]=L,this}getMatrix(){return this.m}decompose(){const _=this.m[0],R=this.m[1],b=this.m[2],A=this.m[3],O=this.m[4],I=this.m[5],L=_*A-R*b,H={x:O,y:I,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(_!=0||R!=0){const B=Math.sqrt(_*_+R*R);H.rotation=R>0?Math.acos(_/B):-Math.acos(_/B),H.scaleX=B,H.scaleY=L/B,H.skewX=(_*b+R*A)/L,H.skewY=0}else if(b!=0||A!=0){const B=Math.sqrt(b*b+A*A);H.rotation=Math.PI/2-(A>0?Math.acos(-b/B):-Math.acos(b/B)),H.scaleX=L/B,H.scaleY=B,H.skewX=0,H.skewY=(_*b+R*A)/L}return H.rotation=t.Util._getRotation(H.rotation),H}}t.Transform=n;const r="[object Array]",i="[object Number]",s="[object String]",l="[object Boolean]",u=Math.PI/180,c=180/Math.PI,h="#",p="",y="0",S="Konva warning: ",x="Konva error: ",m="rgb(",C={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]},P=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;let E=[];const k=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(v){setTimeout(v,60)};t.Util={_isElement(v){return!!(v&&v.nodeType==1)},_isFunction(v){return!!(v&&v.constructor&&v.call&&v.apply)},_isPlainObject(v){return!!v&&v.constructor===Object},_isArray(v){return Object.prototype.toString.call(v)===r},_isNumber(v){return Object.prototype.toString.call(v)===i&&!isNaN(v)&&isFinite(v)},_isString(v){return Object.prototype.toString.call(v)===s},_isBoolean(v){return Object.prototype.toString.call(v)===l},isObject(v){return v instanceof Object},isValidSelector(v){if(typeof v!="string")return!1;const _=v[0];return _==="#"||_==="."||_===_.toUpperCase()},_sign(v){return v===0||v>0?1:-1},requestAnimFrame(v){E.push(v),E.length===1&&k(function(){const _=E;E=[],_.forEach(function(R){R()})})},createCanvasElement(){const v=document.createElement("canvas");try{v.style=v.style||{}}catch{}return v},createImageElement(){return document.createElement("img")},_isInDocument(v){for(;v=v.parentNode;)if(v==document)return!0;return!1},_urlToImage(v,_){const R=t.Util.createImageElement();R.onload=function(){_(R)},R.src=v},_rgbToHex(v,_,R){return((1<<24)+(v<<16)+(_<<8)+R).toString(16).slice(1)},_hexToRgb(v){v=v.replace(h,p);const _=parseInt(v,16);return{r:_>>16&255,g:_>>8&255,b:_&255}},getRandomColor(){let v=(Math.random()*16777215<<0).toString(16);for(;v.length<6;)v=y+v;return h+v},getRGB(v){let _;return v in C?(_=C[v],{r:_[0],g:_[1],b:_[2]}):v[0]===h?this._hexToRgb(v.substring(1)):v.substr(0,4)===m?(_=P.exec(v.replace(/ /g,"")),{r:parseInt(_[1],10),g:parseInt(_[2],10),b:parseInt(_[3],10)}):{r:0,g:0,b:0}},colorToRGBA(v){return v=v||"black",t.Util._namedColorToRBA(v)||t.Util._hex3ColorToRGBA(v)||t.Util._hex4ColorToRGBA(v)||t.Util._hex6ColorToRGBA(v)||t.Util._hex8ColorToRGBA(v)||t.Util._rgbColorToRGBA(v)||t.Util._rgbaColorToRGBA(v)||t.Util._hslColorToRGBA(v)},_namedColorToRBA(v){const _=C[v.toLowerCase()];return _?{r:_[0],g:_[1],b:_[2],a:1}:null},_rgbColorToRGBA(v){if(v.indexOf("rgb(")===0){v=v.match(/rgb\(([^)]+)\)/)[1];const _=v.split(/ *, */).map(Number);return{r:_[0],g:_[1],b:_[2],a:1}}},_rgbaColorToRGBA(v){if(v.indexOf("rgba(")===0){v=v.match(/rgba\(([^)]+)\)/)[1];const _=v.split(/ *, */).map((R,b)=>R.slice(-1)==="%"?b===3?parseInt(R)/100:parseInt(R)/100*255:Number(R));return{r:_[0],g:_[1],b:_[2],a:_[3]}}},_hex8ColorToRGBA(v){if(v[0]==="#"&&v.length===9)return{r:parseInt(v.slice(1,3),16),g:parseInt(v.slice(3,5),16),b:parseInt(v.slice(5,7),16),a:parseInt(v.slice(7,9),16)/255}},_hex6ColorToRGBA(v){if(v[0]==="#"&&v.length===7)return{r:parseInt(v.slice(1,3),16),g:parseInt(v.slice(3,5),16),b:parseInt(v.slice(5,7),16),a:1}},_hex4ColorToRGBA(v){if(v[0]==="#"&&v.length===5)return{r:parseInt(v[1]+v[1],16),g:parseInt(v[2]+v[2],16),b:parseInt(v[3]+v[3],16),a:parseInt(v[4]+v[4],16)/255}},_hex3ColorToRGBA(v){if(v[0]==="#"&&v.length===4)return{r:parseInt(v[1]+v[1],16),g:parseInt(v[2]+v[2],16),b:parseInt(v[3]+v[3],16),a:1}},_hslColorToRGBA(v){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(v)){const[_,...R]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(v),b=Number(R[0])/360,A=Number(R[1])/100,O=Number(R[2])/100;let I,L,H;if(A===0)return H=O*255,{r:Math.round(H),g:Math.round(H),b:Math.round(H),a:1};O<.5?I=O*(1+A):I=O+A-O*A;const B=2*O-I,$=[0,0,0];for(let q=0;q<3;q++)L=b+1/3*-(q-1),L<0&&L++,L>1&&L--,6*L<1?H=B+(I-B)*6*L:2*L<1?H=I:3*L<2?H=B+(I-B)*(2/3-L)*6:H=B,$[q]=H*255;return{r:Math.round($[0]),g:Math.round($[1]),b:Math.round($[2]),a:1}}},haveIntersection(v,_){return!(_.x>v.x+v.width||_.x+_.widthv.y+v.height||_.y+_.height1?(I=R,L=b,H=(R-A)*(R-A)+(b-O)*(b-O)):(I=v+$*(R-v),L=_+$*(b-_),H=(I-A)*(I-A)+(L-O)*(L-O))}return[I,L,H]},_getProjectionToLine(v,_,R){const b=t.Util.cloneObject(v);let A=Number.MAX_VALUE;return _.forEach(function(O,I){if(!R&&I===_.length-1)return;const L=_[(I+1)%_.length],H=t.Util._getProjectionToSegment(O.x,O.y,L.x,L.y,v.x,v.y),B=H[0],$=H[1],q=H[2];q_.length){const I=_;_=v,v=I}for(let I=0;I{_.width=0,_.height=0})},drawRoundedRectPath(v,_,R,b){let A=0,O=0,I=0,L=0;typeof b=="number"?A=O=I=L=Math.min(b,_/2,R/2):(A=Math.min(b[0]||0,_/2,R/2),O=Math.min(b[1]||0,_/2,R/2),L=Math.min(b[2]||0,_/2,R/2),I=Math.min(b[3]||0,_/2,R/2)),v.moveTo(A,0),v.lineTo(_-O,0),v.arc(_-O,O,O,Math.PI*3/2,0,!1),v.lineTo(_,R-L),v.arc(_-L,R-L,L,0,Math.PI/2,!1),v.lineTo(I,R),v.arc(I,R-I,I,Math.PI/2,Math.PI,!1),v.lineTo(0,A),v.arc(A,A,A,Math.PI,Math.PI*3/2,!1)}}})(ct);var rt={},pr={},ii={};Object.defineProperty(ii,"__esModule",{value:!0});ii.HitContext=ii.SceneContext=ii.Context=void 0;const Q8=ct,TP=ke;function OP(t){const e=[],n=t.length,r=Q8.Util;for(let i=0;itypeof p=="number"?Math.floor(p):p)),s+=bP+h.join(k4)+LP)):(s+=u.property,e||(s+=DP+u.val)),s+=MP;return s}clearTrace(){this.traceArr=[]}_trace(e){let n=this.traceArr,r;n.push(e),r=n.length,r>=UP&&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,l){this._context.arc(e,n,r,i,s,l)}arcTo(e,n,r,i,s){this._context.arcTo(e,n,r,i,s)}beginPath(){this._context.beginPath()}bezierCurveTo(e,n,r,i,s,l){this._context.bezierCurveTo(e,n,r,i,s,l)}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,l){return this._context.createRadialGradient(e,n,r,i,s,l)}drawImage(e,n,r,i,s,l,u,c,h){const p=arguments,y=this._context;p.length===3?y.drawImage(e,n,r):p.length===5?y.drawImage(e,n,r,i,s):p.length===9&&y.drawImage(e,n,r,i,s,l,u,c,h)}ellipse(e,n,r,i,s,l,u,c){this._context.ellipse(e,n,r,i,s,l,u,c)}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,l){this._context.setTransform(e,n,r,i,s,l)}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,l){this._context.transform(e,n,r,i,s,l)}translate(e,n){this._context.translate(e,n)}_enableTrace(){let e=this,n=E4.length,r=this.setAttr,i,s;const l=function(u){let c=e[u],h;e[u]=function(){return s=OP(Array.prototype.slice.call(arguments,0)),h=c.apply(e,arguments),e._trace({method:u,args:s}),h}};for(i=0;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,l)=>{const{node:u}=s,c=u.getStage();c.setPointersPositions(r),s.pointerId===void 0&&(s.pointerId=n.Util._getFirstPointerId(r));const h=c._changedPointerPositions.find(p=>p.id===s.pointerId);if(h){if(s.dragStatus!=="dragging"){const p=u.dragDistance();if(Math.max(Math.abs(h.x-s.startPointerPos.x),Math.abs(h.y-s.startPointerPos.y)){s.fire("dragmove",{type:"dragmove",target:s,evt:r},!0)})},_endDragBefore(r){const i=[];t.DD._dragElements.forEach(s=>{const{node:l}=s,u=l.getStage();if(r&&u.setPointersPositions(r),!u._changedPointerPositions.find(p=>p.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 h=s.node.getLayer()||s.node instanceof e.Konva.Stage&&s.node;h&&i.indexOf(h)===-1&&i.push(h)}),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))})(Ch);var Pe={},ge={};Object.defineProperty(ge,"__esModule",{value:!0});ge.RGBComponent=WP;ge.alphaComponent=KP;ge.getNumberValidator=$P;ge.getNumberOrArrayOfNumbersValidator=QP;ge.getNumberOrAutoValidator=qP;ge.getStringValidator=YP;ge.getStringOrGradientValidator=XP;ge.getFunctionValidator=JP;ge.getNumberArrayValidator=ZP;ge.getBooleanValidator=eN;ge.getComponentValidator=tN;const di=ke,ft=ct;function hi(t){return ft.Util._isString(t)?'"'+t+'"':Object.prototype.toString.call(t)==="[object Number]"||ft.Util._isBoolean(t)?t:Object.prototype.toString.call(t)}function WP(t){return t>255?255:t<0?0:Math.round(t)}function KP(t){return t>1?1:t<1e-4?1e-4:t}function $P(){if(di.Konva.isUnminified)return function(t,e){return ft.Util._isNumber(t)||ft.Util.warn(hi(t)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),t}}function QP(t){if(di.Konva.isUnminified)return function(e,n){let r=ft.Util._isNumber(e),i=ft.Util._isArray(e)&&e.length==t;return!r&&!i&&ft.Util.warn(hi(e)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+t+")"),e}}function qP(){if(di.Konva.isUnminified)return function(t,e){return ft.Util._isNumber(t)||t==="auto"||ft.Util.warn(hi(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),t}}function YP(){if(di.Konva.isUnminified)return function(t,e){return ft.Util._isString(t)||ft.Util.warn(hi(t)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),t}}function XP(){if(di.Konva.isUnminified)return function(t,e){const n=ft.Util._isString(t),r=Object.prototype.toString.call(t)==="[object CanvasGradient]"||t&&t.addColorStop;return n||r||ft.Util.warn(hi(t)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),t}}function JP(){if(di.Konva.isUnminified)return function(t,e){return ft.Util._isFunction(t)||ft.Util.warn(hi(t)+' is a not valid value for "'+e+'" attribute. The value should be a function.'),t}}function ZP(){if(di.Konva.isUnminified)return function(t,e){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&t instanceof n||(ft.Util._isArray(t)?t.forEach(function(r){ft.Util._isNumber(r)||ft.Util.warn('"'+e+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):ft.Util.warn(hi(t)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),t}}function eN(){if(di.Konva.isUnminified)return function(t,e){return t===!0||t===!1||ft.Util.warn(hi(t)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),t}}function tN(t){if(di.Konva.isUnminified)return function(e,n){return e==null||ft.Util.isObject(e)||ft.Util.warn(hi(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=ct,n=ge,r="get",i="set";t.Factory={addGetterSetter(s,l,u,c,h){t.Factory.addGetter(s,l,u),t.Factory.addSetter(s,l,c,h),t.Factory.addOverloadedGetterSetter(s,l)},addGetter(s,l,u){const c=r+e.Util._capitalize(l);s.prototype[c]=s.prototype[c]||function(){const h=this.attrs[l];return h===void 0?u:h}},addSetter(s,l,u,c){const h=i+e.Util._capitalize(l);s.prototype[h]||t.Factory.overWriteSetter(s,l,u,c)},overWriteSetter(s,l,u,c){const h=i+e.Util._capitalize(l);s.prototype[h]=function(p){return u&&p!==void 0&&p!==null&&(p=u.call(this,p,l)),this._setAttr(l,p),c&&c.call(this),this}},addComponentsGetterSetter(s,l,u,c,h){const p=u.length,y=e.Util._capitalize,S=r+y(l),x=i+y(l);s.prototype[S]=function(){const C={};for(let P=0;P{this._setAttr(l+y(E),void 0)}),this._fireChangeEvent(l,P,C),h&&h.call(this),this},t.Factory.addOverloadedGetterSetter(s,l)},addOverloadedGetterSetter(s,l){const u=e.Util._capitalize(l),c=i+u,h=r+u;s.prototype[l]=function(){return arguments.length?(this[c](arguments[0]),this):this[h]()}},addDeprecatedGetterSetter(s,l,u,c){e.Util.error("Adding deprecated "+l);const h=r+e.Util._capitalize(l),p=l+" property is deprecated and will be removed soon. Look at Konva change log for more information.";s.prototype[h]=function(){e.Util.error(p);const y=this.attrs[l];return y===void 0?u:y},t.Factory.addSetter(s,l,c,function(){e.Util.error(p)}),t.Factory.addOverloadedGetterSetter(s,l)},backCompat(s,l){e.Util.each(l,function(u,c){const h=s.prototype[c],p=r+e.Util._capitalize(u),y=i+e.Util._capitalize(u);function S(){h.apply(this,arguments),e.Util.error('"'+u+'" method is deprecated and will be removed soon. Use ""'+c+'" instead.')}s.prototype[u]=S,s.prototype[p]=S,s.prototype[y]=S})},afterSetFilter(){this._filterUpToDate=!1}}})(Pe);Object.defineProperty(rt,"__esModule",{value:!0});rt.Node=void 0;const bo=pr,Vn=Ch,Pu=Pe,Ri=ke,Re=ct,yt=ge,hd="absoluteOpacity",Wc="allEventListeners",Qr="absoluteTransform",P4="absoluteScale",Ps="canvas",nN="Change",rN="children",iN="konva",Bg="listening",sN="mouseenter",oN="mouseleave",aN="pointerenter",lN="pointerleave",uN="touchenter",cN="touchleave",N4="set",R4="Shape",fd=" ",T4="stage",Oi="transform",dN="Stage",Gg="visible",hN=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(fd);let fN=1;class ye{constructor(e){this._id=fN++,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===Oi||e===Qr)&&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===Oi||e===Qr)&&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(fd);this.on(i,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,r)}_getCanvasCache(){return this._cache.get(Ps)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===Qr&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(Ps)){const{scene:e,filter:n,hit:r,buffer:i}=this._cache.get(Ps);Re.Util.releaseCanvas(e,n,r,i),this._cache.delete(Ps)}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),l=n.pixelRatio,u=n.x===void 0?Math.floor(r.x):n.x,c=n.y===void 0?Math.floor(r.y):n.y,h=n.offset||0,p=n.drawBorder||!1,y=n.hitCanvasPixelRatio||1;if(!i||!s){Re.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}const S=Math.abs(Math.round(r.x)-u)>.5?1:0,x=Math.abs(Math.round(r.y)-c)>.5?1:0;i+=h*2+S,s+=h*2+x,u-=h,c-=h;const m=new bo.SceneCanvas({pixelRatio:l,width:i,height:s}),C=new bo.SceneCanvas({pixelRatio:l,width:0,height:0,willReadFrequently:!0}),P=new bo.HitCanvas({pixelRatio:y,width:i,height:s}),E=m.getContext(),k=P.getContext(),v=new bo.SceneCanvas({width:m.width/m.pixelRatio+Math.abs(u),height:m.height/m.pixelRatio+Math.abs(c),pixelRatio:m.pixelRatio}),_=v.getContext();return P.isCache=!0,m.isCache=!0,this._cache.delete(Ps),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(m.getContext()._context.imageSmoothingEnabled=!1,C.getContext()._context.imageSmoothingEnabled=!1),E.save(),k.save(),_.save(),E.translate(-u,-c),k.translate(-u,-c),_.translate(-u,-c),v.x=u,v.y=c,this._isUnderCache=!0,this._clearSelfAndDescendantCache(hd),this._clearSelfAndDescendantCache(P4),this.drawScene(m,this,v),this.drawHit(P,this),this._isUnderCache=!1,E.restore(),k.restore(),p&&(E.save(),E.beginPath(),E.rect(0,0,i,s),E.closePath(),E.setAttr("strokeStyle","red"),E.setAttr("lineWidth",5),E.stroke(),E.restore()),this._cache.set(Ps,{scene:m,filter:C,hit:P,buffer:v,x:u,y:c}),this._requestDraw(),this}isCached(){return this._cache.has(Ps)}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,l=-1/0,u=-1/0;const c=this.getAbsoluteTransform(n);return r.forEach(function(h){const p=c.point(h);i===void 0&&(i=l=p.x,s=u=p.y),i=Math.min(i,p.x),s=Math.min(s,p.y),l=Math.max(l,p.x),u=Math.max(u,p.y)}),{x:i,y:s,width:l-i,height:u-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(),l,u,c,h;if(e){if(!this._filterUpToDate){const p=r.pixelRatio;i.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio);try{for(l=e.length,s.clear(),s.drawImage(r._canvas,0,0,r.getWidth()/p,r.getHeight()/p),u=s.getImageData(0,0,i.getWidth(),i.getHeight()),c=0;c{let n,r;if(!e)return this;for(n in e)n!==rN&&(r=N4+Re.Util._capitalize(n),Re.Util._isFunction(this[r])?this[r](e[n]):this._setAttr(n,e[n]))}),this}isListening(){return this._getCache(Bg,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(Gg,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;Vn.DD._dragElements.forEach(l=>{l.dragStatus==="dragging"&&(l.node.nodeType==="Stage"||l.node.getLayer()===r)&&(i=!0)});const s=!n&&!Ri.Konva.hitOnDragEnabled&&(i||Ri.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,l,u;function c(p){for(i=[],s=p.length,l=0;l0&&i[0].getDepth()<=e&&c(i)}const h=this.getStage();return n.nodeType!==dN&&h&&c(h.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(Oi),this._clearSelfAndDescendantCache(Qr)),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 Re.Transform,l=this.offset();return s.m=i.slice(),s.translate(l.x,l.y),s.getTranslation()}setAbsolutePosition(e){const{x:n,y:r,...i}=this._clearTransform();this.attrs.x=n,this.attrs.y=r,this._clearCache(Oi);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(Oi),this._clearSelfAndDescendantCache(Qr),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,l;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,l=0;l0?(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return Re.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 Re.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&Re.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(hd,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,l;const u={attrs:{},className:this.getClassName()};for(n in e)r=e[n],l=Re.Util.isObject(r)&&!Re.Util._isPlainObject(r)&&!Re.Util._isArray(r),!l&&(i=typeof this[n]=="function"&&this[n],delete e[n],s=i?i.call(this):null,e[n]=r,s!==r&&(u.attrs[n]=r));return Re.Util._prepareToStringify(u)}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{try{const i=e==null?void 0:e.callback;i&&delete e.callback,Re.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():Ri.Konva.dragDistance}_off(e,n,r){let i=this.eventListeners[e],s,l,u;for(s=0;s=0)||this.isDragging())return;let i=!1;Vn.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=Vn.DD._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";r?this.stopDrag():i&&Vn.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 Re.Util.haveIntersection(r,this.getClientRect())}static create(e,n){return Re.Util._isString(e)&&(e=JSON.parse(e)),this._createNode(e,n)}static _createNode(e,n){let r=ye.prototype.getClassName.call(e),i=e.children,s,l,u;n&&(e.attrs.container=n),Ri.Konva[r]||(Re.Util.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const c=Ri.Konva[r];if(s=new c(e.attrs),i)for(l=i.length,u=0;u0}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;r0?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=h0.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=h0.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(),l=s&&s.getContext(),u=this._getCanvasCache(),c=u&&u.scene,h=s&&s.isCache;if(!this.isVisible()&&!h)return this;if(c){l.save();const p=this.getAbsoluteTransform(n).getMatrix();l.transform(p[0],p[1],p[2],p[3],p[4],p[5]),this._drawCachedSceneCanvas(l),l.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(),l=this._getCanvasCache();if(l&&l.hit){s.save();const c=this.getAbsoluteTransform(n).getMatrix();s.transform(c[0],c[1],c[2],c[3],c[4],c[5]),this._drawCachedHitCanvas(s),s.restore()}else this._drawChildren("drawHit",i,n);return this}_drawChildren(e,n,r,i){var s;const l=n&&n.getContext(),u=this.clipWidth(),c=this.clipHeight(),h=this.clipFunc(),p=typeof u=="number"&&typeof c=="number"||h,y=r===this;if(p){l.save();const x=this.getAbsoluteTransform(r);let m=x.getMatrix();l.transform(m[0],m[1],m[2],m[3],m[4],m[5]),l.beginPath();let C;if(h)C=h.call(this,l,this);else{const P=this.clipX(),E=this.clipY();l.rect(P||0,E||0,u,c)}l.clip.apply(l,C),m=x.copy().invert().getMatrix(),l.transform(m[0],m[1],m[2],m[3],m[4],m[5])}const S=!y&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";S&&(l.save(),l._applyGlobalCompositeOperation(this)),(s=this.children)===null||s===void 0||s.forEach(function(x){x[e](n,r,i)}),S&&l.restore(),p&&l.restore()}getClientRect(e={}){var n;const r=e.skipTransform,i=e.relativeTo;let s,l,u,c,h={x:1/0,y:1/0,width:0,height:0};const p=this;(n=this.children)===null||n===void 0||n.forEach(function(x){if(!x.visible())return;const m=x.getClientRect({relativeTo:p,skipShadow:e.skipShadow,skipStroke:e.skipStroke});m.width===0&&m.height===0||(s===void 0?(s=m.x,l=m.y,u=m.x+m.width,c=m.y+m.height):(s=Math.min(s,m.x),l=Math.min(l,m.y),u=Math.max(u,m.x+m.width),c=Math.max(c,m.y+m.height)))});const y=this.find("Shape");let S=!1;for(let x=0;x$e.indexOf("pointer")>=0?"pointer":$e.indexOf("touch")>=0?"touch":"mouse",ie=$e=>{const D=Y($e);if(D==="pointer")return i.Konva.pointerEventsEnabled&&Z.pointer;if(D==="touch")return Z.touch;if(D==="mouse")return Z.mouse};function xe($e={}){return($e.clipFunc||$e.clipWidth||$e.clipHeight)&&e.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),$e}const Ke="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 it extends r.Container{constructor(D){super(xe(D)),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",()=>{xe(this.attrs)}),this._checkVisibility()}_validateAdd(D){const X=D.getType()==="Layer",ce=D.getType()==="FastLayer";X||ce||e.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const D=this.visible()?"":"none";this.content.style.display=D}setContainer(D){if(typeof D===p){let X;if(D.charAt(0)==="."){const ce=D.slice(1);D=document.getElementsByClassName(ce)[0]}else D.charAt(0)!=="#"?X=D:X=D.slice(1),D=document.getElementById(X);if(!D)throw"Can not find container in document with id "+X}return this._setAttr("container",D),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),D.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){const D=this.children,X=D.length;for(let ce=0;ce-1&&t.stages.splice(X,1),e.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const D=this._pointerPositions[0]||this._changedPointerPositions[0];return D?{x:D.x,y:D.y}:(e.Util.warn(Ke),null)}_getPointerById(D){return this._pointerPositions.find(X=>X.id===D)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(D){D=D||{},D.x=D.x||0,D.y=D.y||0,D.width=D.width||this.width(),D.height=D.height||this.height();const X=new s.SceneCanvas({width:D.width,height:D.height,pixelRatio:D.pixelRatio||1}),ce=X.getContext()._context,De=this.children;return(D.x||D.y)&&ce.translate(-1*D.x,-1*D.y),De.forEach(function(we){if(!we.isVisible())return;const He=we._toKonvaCanvas(D);ce.drawImage(He._canvas,D.x,D.y,He.getWidth()/He.getPixelRatio(),He.getHeight()/He.getPixelRatio())}),X}getIntersection(D){if(!D)return null;const X=this.children,ce=X.length,De=ce-1;for(let we=De;we>=0;we--){const He=X[we].getIntersection(D);if(He)return He}return null}_resizeDOM(){const D=this.width(),X=this.height();this.content&&(this.content.style.width=D+y,this.content.style.height=X+y),this.bufferCanvas.setSize(D,X),this.bufferHitCanvas.setSize(D,X),this.children.forEach(ce=>{ce.setSize({width:D,height:X}),ce.draw()})}add(D,...X){if(arguments.length>1){for(let De=0;DeW&&e.Util.warn("The stage has "+ce+" 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."),D.setSize({width:this.width(),height:this.height()}),D.draw(),i.Konva.isBrowser&&this.content.appendChild(D.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(D){return c.hasPointerCapture(D,this)}setPointerCapture(D){c.setPointerCapture(D,this)}releaseCapture(D){c.releaseCapture(D,this)}getLayers(){return this.children}_bindContentEvents(){i.Konva.isBrowser&&te.forEach(([D,X])=>{this.content.addEventListener(D,ce=>{this[X](ce)},{passive:!1})})}_pointerenter(D){this.setPointersPositions(D);const X=ie(D.type);X&&this._fire(X.pointerenter,{evt:D,target:this,currentTarget:this})}_pointerover(D){this.setPointersPositions(D);const X=ie(D.type);X&&this._fire(X.pointerover,{evt:D,target:this,currentTarget:this})}_getTargetShape(D){let X=this[D+"targetShape"];return X&&!X.getStage()&&(X=null),X}_pointerleave(D){const X=ie(D.type),ce=Y(D.type);if(!X)return;this.setPointersPositions(D);const De=this._getTargetShape(ce),we=!(i.Konva.isDragging()||i.Konva.isTransforming())||i.Konva.hitOnDragEnabled;De&&we?(De._fireAndBubble(X.pointerout,{evt:D}),De._fireAndBubble(X.pointerleave,{evt:D}),this._fire(X.pointerleave,{evt:D,target:this,currentTarget:this}),this[ce+"targetShape"]=null):we&&(this._fire(X.pointerleave,{evt:D,target:this,currentTarget:this}),this._fire(X.pointerout,{evt:D,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(D){const X=ie(D.type),ce=Y(D.type);if(!X)return;this.setPointersPositions(D);let De=!1;this._changedPointerPositions.forEach(we=>{const He=this.getIntersection(we);if(l.DD.justDragged=!1,i.Konva["_"+ce+"ListenClick"]=!0,!He||!He.isListening()){this[ce+"ClickStartShape"]=void 0;return}i.Konva.capturePointerEventsEnabled&&He.setPointerCapture(we.id),this[ce+"ClickStartShape"]=He,He._fireAndBubble(X.pointerdown,{evt:D,pointerId:we.id}),De=!0;const Qe=D.type.indexOf("touch")>=0;He.preventDefault()&&D.cancelable&&Qe&&D.preventDefault()}),De||this._fire(X.pointerdown,{evt:D,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(D){const X=ie(D.type),ce=Y(D.type);if(!X||(i.Konva.isDragging()&&l.DD.node.preventDefault()&&D.cancelable&&D.preventDefault(),this.setPointersPositions(D),!(!(i.Konva.isDragging()||i.Konva.isTransforming())||i.Konva.hitOnDragEnabled)))return;const we={};let He=!1;const Qe=this._getTargetShape(ce);this._changedPointerPositions.forEach(vr=>{const ze=c.getCapturedShape(vr.id)||this.getIntersection(vr),gi=vr.id,Zn={evt:D,pointerId:gi},mi=Qe!==ze;if(mi&&Qe&&(Qe._fireAndBubble(X.pointerout,{...Zn},ze),Qe._fireAndBubble(X.pointerleave,{...Zn},ze)),ze){if(we[ze._id])return;we[ze._id]=!0}ze&&ze.isListening()?(He=!0,mi&&(ze._fireAndBubble(X.pointerover,{...Zn},Qe),ze._fireAndBubble(X.pointerenter,{...Zn},Qe),this[ce+"targetShape"]=ze),ze._fireAndBubble(X.pointermove,{...Zn})):Qe&&(this._fire(X.pointerover,{evt:D,target:this,currentTarget:this,pointerId:gi}),this[ce+"targetShape"]=null)}),He||this._fire(X.pointermove,{evt:D,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(D){const X=ie(D.type),ce=Y(D.type);if(!X)return;this.setPointersPositions(D);const De=this[ce+"ClickStartShape"],we=this[ce+"ClickEndShape"],He={};let Qe=!1;this._changedPointerPositions.forEach(vr=>{const ze=c.getCapturedShape(vr.id)||this.getIntersection(vr);if(ze){if(ze.releaseCapture(vr.id),He[ze._id])return;He[ze._id]=!0}const gi=vr.id,Zn={evt:D,pointerId:gi};let mi=!1;i.Konva["_"+ce+"InDblClickWindow"]?(mi=!0,clearTimeout(this[ce+"DblTimeout"])):l.DD.justDragged||(i.Konva["_"+ce+"InDblClickWindow"]=!0,clearTimeout(this[ce+"DblTimeout"])),this[ce+"DblTimeout"]=setTimeout(function(){i.Konva["_"+ce+"InDblClickWindow"]=!1},i.Konva.dblClickWindow),ze&&ze.isListening()?(Qe=!0,this[ce+"ClickEndShape"]=ze,ze._fireAndBubble(X.pointerup,{...Zn}),i.Konva["_"+ce+"ListenClick"]&&De&&De===ze&&(ze._fireAndBubble(X.pointerclick,{...Zn}),mi&&we&&we===ze&&ze._fireAndBubble(X.pointerdblclick,{...Zn}))):(this[ce+"ClickEndShape"]=null,i.Konva["_"+ce+"ListenClick"]&&this._fire(X.pointerclick,{evt:D,target:this,currentTarget:this,pointerId:gi}),mi&&this._fire(X.pointerdblclick,{evt:D,target:this,currentTarget:this,pointerId:gi}))}),Qe||this._fire(X.pointerup,{evt:D,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),i.Konva["_"+ce+"ListenClick"]=!1,D.cancelable&&ce!=="touch"&&ce!=="pointer"&&D.preventDefault()}_contextmenu(D){this.setPointersPositions(D);const X=this.getIntersection(this.getPointerPosition());X&&X.isListening()?X._fireAndBubble(B,{evt:D}):this._fire(B,{evt:D,target:this,currentTarget:this})}_wheel(D){this.setPointersPositions(D);const X=this.getIntersection(this.getPointerPosition());X&&X.isListening()?X._fireAndBubble(he,{evt:D}):this._fire(he,{evt:D,target:this,currentTarget:this})}_pointercancel(D){this.setPointersPositions(D);const X=c.getCapturedShape(D.pointerId)||this.getIntersection(this.getPointerPosition());X&&X._fireAndBubble(R,c.createEvent(D)),c.releaseCapture(D.pointerId)}_lostpointercapture(D){c.releaseCapture(D.pointerId)}setPointersPositions(D){const X=this._getContentPosition();let ce=null,De=null;D=D||window.event,D.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(D.touches,we=>{this._pointerPositions.push({id:we.identifier,x:(we.clientX-X.left)/X.scaleX,y:(we.clientY-X.top)/X.scaleY})}),Array.prototype.forEach.call(D.changedTouches||D.touches,we=>{this._changedPointerPositions.push({id:we.identifier,x:(we.clientX-X.left)/X.scaleX,y:(we.clientY-X.top)/X.scaleY})})):(ce=(D.clientX-X.left)/X.scaleX,De=(D.clientY-X.top)/X.scaleY,this.pointerPos={x:ce,y:De},this._pointerPositions=[{x:ce,y:De,id:e.Util._getFirstPointerId(D)}],this._changedPointerPositions=[{x:ce,y:De,id:e.Util._getFirstPointerId(D)}])}_setPointerPosition(D){e.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(D)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};const D=this.content.getBoundingClientRect();return{top:D.top,left:D.left,scaleX:D.width/this.content.clientWidth||1,scaleY:D.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 D=this.container();if(!D)throw"Stage has no container. A container is required.";D.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"),D.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(D){D.batchDraw()}),this}}t.Stage=it,it.prototype.nodeType=h,(0,u._registerNode)(it),n.Factory.addGetterSetter(it,"container"),i.Konva.isBrowser&&document.addEventListener("visibilitychange",()=>{t.stages.forEach($e=>{$e.batchDraw()})})})(X8);var Nu={},Rt={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Shape=t.shapes=void 0;const e=ke,n=ct,r=Pe,i=rt,s=ge,l=ke,u=ls,c="hasShadow",h="shadowRGBA",p="patternImage",y="linearGradient",S="radialGradient";let x;function m(){return x||(x=n.Util.createCanvasElement().getContext("2d"),x)}t.shapes={};function C(I){const L=this.attrs.fillRule;L?I.fill(L):I.fill()}function P(I){I.stroke()}function E(I){const L=this.attrs.fillRule;L?I.fill(L):I.fill()}function k(I){I.stroke()}function v(){this._clearCache(c)}function _(){this._clearCache(h)}function R(){this._clearCache(p)}function b(){this._clearCache(y)}function A(){this._clearCache(S)}class O extends i.Node{constructor(L){super(L);let H;for(;H=n.Util.getRandomColor(),!(H&&!(H in t.shapes)););this.colorKey=H,t.shapes[H]=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(c,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(p,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const H=m().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(H&&H.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($);H.setTransform(q)}return H}}_getLinearGradient(){return this._getCache(y,this.__getLinearGradient)}__getLinearGradient(){const L=this.fillLinearGradientColorStops();if(L){const H=m(),B=this.fillLinearGradientStartPoint(),$=this.fillLinearGradientEndPoint(),q=H.createLinearGradient(B.x,B.y,$.x,$.y);for(let Q=0;Qthis.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 L=this.hitStrokeWidth();return L==="auto"?this.hasStroke():this.strokeEnabled()&&!!L}intersects(L){const H=this.getStage();if(!H)return!1;const B=H.bufferHitCanvas;return B.getContext().clear(),this.drawHit(B,void 0,!0),B.context.getImageData(Math.round(L.x),Math.round(L.y),1,1).data[3]>0}destroy(){return i.Node.prototype.destroy.call(this),delete t.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(L){var H;if(!((H=this.attrs.perfectDrawEnabled)!==null&&H!==void 0?H:!0))return!1;const $=L||this.hasFill(),q=this.hasStroke(),Q=this.getAbsoluteOpacity()!==1;if($&&q&&Q)return!0;const re=this.hasShadow(),he=this.shadowForStrokeEnabled();return!!($&&q&&re&&he)}setStrokeHitEnabled(L){n.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),L?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){const L=this.size();return{x:this._centroid?-L.width/2:0,y:this._centroid?-L.height/2:0,width:L.width,height:L.height}}getClientRect(L={}){let H=!1,B=this.getParent();for(;B;){if(B.isCached()){H=!0;break}B=B.getParent()}const $=L.skipTransform,q=L.relativeTo||H&&this.getStage()||void 0,Q=this.getSelfRect(),he=!L.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,W=Q.width+he,te=Q.height+he,Z=!L.skipShadow&&this.hasShadow(),Y=Z?this.shadowOffsetX():0,ie=Z?this.shadowOffsetY():0,xe=W+Math.abs(Y),Ke=te+Math.abs(ie),it=Z&&this.shadowBlur()||0,$e=xe+it*2,D=Ke+it*2,X={width:$e,height:D,x:-(he/2+it)+Math.min(Y,0)+Q.x,y:-(he/2+it)+Math.min(ie,0)+Q.y};return $?X:this._transformedRect(X,q)}drawScene(L,H,B){const $=this.getLayer(),q=L||$.getCanvas(),Q=q.getContext(),re=this._getCanvasCache(),he=this.getSceneFunc(),W=this.hasShadow();let te;const Z=H===this;if(!this.isVisible()&&!Z)return this;if(re){Q.save();const Y=this.getAbsoluteTransform(H).getMatrix();return Q.transform(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5]),this._drawCachedSceneCanvas(Q),Q.restore(),this}if(!he)return this;if(Q.save(),this._useBufferCanvas()){te=this.getStage();const Y=B||te.bufferCanvas,ie=Y.getContext();ie.clear(),ie.save(),ie._applyLineJoin(this);const xe=this.getAbsoluteTransform(H).getMatrix();ie.transform(xe[0],xe[1],xe[2],xe[3],xe[4],xe[5]),he.call(this,ie,this),ie.restore();const Ke=Y.pixelRatio;W&&Q._applyShadow(this),Q._applyOpacity(this),Q._applyGlobalCompositeOperation(this),Q.drawImage(Y._canvas,Y.x||0,Y.y||0,Y.width/Ke,Y.height/Ke)}else{if(Q._applyLineJoin(this),!Z){const Y=this.getAbsoluteTransform(H).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),he.call(this,Q,this)}return Q.restore(),this}drawHit(L,H,B=!1){if(!this.shouldDrawHit(H,B))return this;const $=this.getLayer(),q=L||$.hitCanvas,Q=q&&q.getContext(),re=this.hitFunc()||this.sceneFunc(),he=this._getCanvasCache(),W=he&&he.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 Z=this.getAbsoluteTransform(H).getMatrix();return Q.transform(Z[0],Z[1],Z[2],Z[3],Z[4],Z[5]),this._drawCachedHitCanvas(Q),Q.restore(),this}if(!re)return this;if(Q.save(),Q._applyLineJoin(this),!(this===H)){const Z=this.getAbsoluteTransform(H).getMatrix();Q.transform(Z[0],Z[1],Z[2],Z[3],Z[4],Z[5])}return re.call(this,Q,this),Q.restore(),this}drawHitFromCache(L=0){const H=this._getCanvasCache(),B=this._getCachedSceneCanvas(),$=H.hit,q=$.getContext(),Q=$.getWidth(),re=$.getHeight();q.clear(),q.drawImage(B._canvas,0,0,Q,re);try{const he=q.getImageData(0,0,Q,re),W=he.data,te=W.length,Z=n.Util._hexToRgb(this.colorKey);for(let Y=0;YL?(W[Y]=Z.r,W[Y+1]=Z.g,W[Y+2]=Z.b,W[Y+3]=255):W[Y+3]=0;q.putImageData(he,0,0)}catch(he){n.Util.error("Unable to draw hit graph from cached scene canvas. "+he.message)}return this}hasPointerCapture(L){return u.hasPointerCapture(L,this)}setPointerCapture(L){u.setPointerCapture(L,this)}releaseCapture(L){u.releaseCapture(L,this)}}t.Shape=O,O.prototype._fillFunc=C,O.prototype._strokeFunc=P,O.prototype._fillFuncHit=E,O.prototype._strokeFuncHit=k,O.prototype._centroid=!1,O.prototype.nodeType="Shape",(0,l._registerNode)(O),O.prototype.eventListeners={},O.prototype.on.call(O.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",v),O.prototype.on.call(O.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",_),O.prototype.on.call(O.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",R),O.prototype.on.call(O.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",b),O.prototype.on.call(O.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",A),r.Factory.addGetterSetter(O,"stroke",void 0,(0,s.getStringOrGradientValidator)()),r.Factory.addGetterSetter(O,"strokeWidth",2,(0,s.getNumberValidator)()),r.Factory.addGetterSetter(O,"fillAfterStrokeEnabled",!1),r.Factory.addGetterSetter(O,"hitStrokeWidth","auto",(0,s.getNumberOrAutoValidator)()),r.Factory.addGetterSetter(O,"strokeHitEnabled",!0,(0,s.getBooleanValidator)()),r.Factory.addGetterSetter(O,"perfectDrawEnabled",!0,(0,s.getBooleanValidator)()),r.Factory.addGetterSetter(O,"shadowForStrokeEnabled",!0,(0,s.getBooleanValidator)()),r.Factory.addGetterSetter(O,"lineJoin"),r.Factory.addGetterSetter(O,"lineCap"),r.Factory.addGetterSetter(O,"sceneFunc"),r.Factory.addGetterSetter(O,"hitFunc"),r.Factory.addGetterSetter(O,"dash"),r.Factory.addGetterSetter(O,"dashOffset",0,(0,s.getNumberValidator)()),r.Factory.addGetterSetter(O,"shadowColor",void 0,(0,s.getStringValidator)()),r.Factory.addGetterSetter(O,"shadowBlur",0,(0,s.getNumberValidator)()),r.Factory.addGetterSetter(O,"shadowOpacity",1,(0,s.getNumberValidator)()),r.Factory.addComponentsGetterSetter(O,"shadowOffset",["x","y"]),r.Factory.addGetterSetter(O,"shadowOffsetX",0,(0,s.getNumberValidator)()),r.Factory.addGetterSetter(O,"shadowOffsetY",0,(0,s.getNumberValidator)()),r.Factory.addGetterSetter(O,"fillPatternImage"),r.Factory.addGetterSetter(O,"fill",void 0,(0,s.getStringOrGradientValidator)()),r.Factory.addGetterSetter(O,"fillPatternX",0,(0,s.getNumberValidator)()),r.Factory.addGetterSetter(O,"fillPatternY",0,(0,s.getNumberValidator)()),r.Factory.addGetterSetter(O,"fillLinearGradientColorStops"),r.Factory.addGetterSetter(O,"strokeLinearGradientColorStops"),r.Factory.addGetterSetter(O,"fillRadialGradientStartRadius",0),r.Factory.addGetterSetter(O,"fillRadialGradientEndRadius",0),r.Factory.addGetterSetter(O,"fillRadialGradientColorStops"),r.Factory.addGetterSetter(O,"fillPatternRepeat","repeat"),r.Factory.addGetterSetter(O,"fillEnabled",!0),r.Factory.addGetterSetter(O,"strokeEnabled",!0),r.Factory.addGetterSetter(O,"shadowEnabled",!0),r.Factory.addGetterSetter(O,"dashEnabled",!0),r.Factory.addGetterSetter(O,"strokeScaleEnabled",!0),r.Factory.addGetterSetter(O,"fillPriority","color"),r.Factory.addComponentsGetterSetter(O,"fillPatternOffset",["x","y"]),r.Factory.addGetterSetter(O,"fillPatternOffsetX",0,(0,s.getNumberValidator)()),r.Factory.addGetterSetter(O,"fillPatternOffsetY",0,(0,s.getNumberValidator)()),r.Factory.addComponentsGetterSetter(O,"fillPatternScale",["x","y"]),r.Factory.addGetterSetter(O,"fillPatternScaleX",1,(0,s.getNumberValidator)()),r.Factory.addGetterSetter(O,"fillPatternScaleY",1,(0,s.getNumberValidator)()),r.Factory.addComponentsGetterSetter(O,"fillLinearGradientStartPoint",["x","y"]),r.Factory.addComponentsGetterSetter(O,"strokeLinearGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(O,"fillLinearGradientStartPointX",0),r.Factory.addGetterSetter(O,"strokeLinearGradientStartPointX",0),r.Factory.addGetterSetter(O,"fillLinearGradientStartPointY",0),r.Factory.addGetterSetter(O,"strokeLinearGradientStartPointY",0),r.Factory.addComponentsGetterSetter(O,"fillLinearGradientEndPoint",["x","y"]),r.Factory.addComponentsGetterSetter(O,"strokeLinearGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(O,"fillLinearGradientEndPointX",0),r.Factory.addGetterSetter(O,"strokeLinearGradientEndPointX",0),r.Factory.addGetterSetter(O,"fillLinearGradientEndPointY",0),r.Factory.addGetterSetter(O,"strokeLinearGradientEndPointY",0),r.Factory.addComponentsGetterSetter(O,"fillRadialGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(O,"fillRadialGradientStartPointX",0),r.Factory.addGetterSetter(O,"fillRadialGradientStartPointY",0),r.Factory.addComponentsGetterSetter(O,"fillRadialGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(O,"fillRadialGradientEndPointX",0),r.Factory.addGetterSetter(O,"fillRadialGradientEndPointY",0),r.Factory.addGetterSetter(O,"fillPatternRotation",0),r.Factory.addGetterSetter(O,"fillRule",void 0,(0,s.getStringValidator)()),r.Factory.backCompat(O,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(Rt);Object.defineProperty(Nu,"__esModule",{value:!0});Nu.Layer=void 0;const Kr=ct,f0=oo,Lo=rt,dm=Pe,O4=pr,vN=ge,SN=Rt,xN=ke,wN="#",_N="beforeDraw",CN="draw",eS=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],kN=eS.length;let Fa=class extends f0.Container{constructor(e){super(e),this.canvas=new O4.SceneCanvas,this.hitCanvas=new O4.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{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;i0)return{antialiased:!0};return{}}drawScene(e,n,r){const i=this.getLayer(),s=e||i&&i.getCanvas();return this._fire(_N,{node:this}),this.clearBeforeDraw()&&s.getContext().clear(),f0.Container.prototype.drawScene.call(this,s,n,r),this._fire(CN,{node:this}),this}drawHit(e,n){const r=this.getLayer(),i=e||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),f0.Container.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){Kr.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return Kr.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 Kr.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};Nu.Layer=Fa;Fa.prototype.nodeType="Layer";(0,xN._registerNode)(Fa);dm.Factory.addGetterSetter(Fa,"imageSmoothingEnabled",!0);dm.Factory.addGetterSetter(Fa,"clearBeforeDraw",!0);dm.Factory.addGetterSetter(Fa,"hitGraphEnabled",!0,(0,vN.getBooleanValidator)());var Eh={};Object.defineProperty(Eh,"__esModule",{value:!0});Eh.FastLayer=void 0;const EN=ct,PN=Nu,NN=ke;class hm extends PN.Layer{constructor(e){super(e),this.listening(!1),EN.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}Eh.FastLayer=hm;hm.prototype.nodeType="FastLayer";(0,NN._registerNode)(hm);var Aa={};Object.defineProperty(Aa,"__esModule",{value:!0});Aa.Group=void 0;const RN=ct,TN=oo,ON=ke;class fm extends TN.Container{_validateAdd(e){const n=e.getType();n!=="Group"&&n!=="Shape"&&RN.Util.throw("You may only add groups and shapes to groups.")}}Aa.Group=fm;fm.prototype.nodeType="Group";(0,ON._registerNode)(fm);var Ma={};Object.defineProperty(Ma,"__esModule",{value:!0});Ma.Animation=void 0;const p0=ke,b4=ct,g0=function(){return p0.glob.performance&&p0.glob.performance.now?function(){return p0.glob.performance.now()}:function(){return new Date().getTime()}}();class Fr{constructor(e,n){this.id=Fr.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:g0(),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;ithis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():m<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=m,this.update())}getTime(){return this._time}setPosition(m){this.prevPos=this._pos,this.propFunc(m),this._pos=m}getPosition(m){return m===void 0&&(m=this._time),this.func(m,this.begin,this._change,this.duration)}play(){this.state=u,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=c,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(m){this.pause(),this._time=m,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 m=this.getTimer()-this._startTime;this.state===u?this.setTime(m):this.state===c&&this.setTime(this.duration-m)}pause(){this.state=l,this.fire("onPause")}getTimer(){return new Date().getTime()}}class S{constructor(m){const C=this,P=m.node,E=P._id,k=m.easing||t.Easings.Linear,v=!!m.yoyo;let _,R;typeof m.duration>"u"?_=.3:m.duration===0?_=.001:_=m.duration,this.node=P,this._id=p++;const b=P.getLayer()||(P instanceof i.Konva.Stage?P.getLayers():null);b||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(){C.tween.onEnterFrame()},b),this.tween=new y(R,function(A){C._tweenFunc(A)},k,0,1,_*1e3,v),this._addListeners(),S.attrs[E]||(S.attrs[E]={}),S.attrs[E][this._id]||(S.attrs[E][this._id]={}),S.tweens[E]||(S.tweens[E]={});for(R in m)s[R]===void 0&&this._addAttr(R,m[R]);this.reset(),this.onFinish=m.onFinish,this.onReset=m.onReset,this.onUpdate=m.onUpdate}_addAttr(m,C){const P=this.node,E=P._id;let k,v,_,R,b;const A=S.tweens[E][m];A&&delete S.attrs[E][A][m];let O=P.getAttr(m);if(e.Util._isArray(C))if(k=[],v=Math.max(C.length,O.length),m==="points"&&C.length!==O.length&&(C.length>O.length?(R=O,O=e.Util._prepareArrayForTween(O,C,P.closed())):(_=C,C=e.Util._prepareArrayForTween(C,O,P.closed()))),m.indexOf("fill")===0)for(let I=0;I{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{const m=this.node,C=S.attrs[m._id][this._id];C.points&&C.points.trueEnd&&m.setAttr("points",C.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{const m=this.node,C=S.attrs[m._id][this._id];C.points&&C.points.trueStart&&m.points(C.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(m){return this.tween.seek(m*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){const m=this.node._id,C=this._id,P=S.tweens[m];this.pause(),this.anim&&this.anim.stop();for(const E in P)delete S.tweens[m][E];delete S.attrs[m][C],S.tweens[m]&&(Object.keys(S.tweens[m]).length===0&&delete S.tweens[m],Object.keys(S.attrs[m]).length===0&&delete S.attrs[m])}}t.Tween=S,S.attrs={},S.tweens={},r.Node.prototype.to=function(x){const m=x.onFinish;x.node=this,x.onFinish=function(){this.destroy(),m&&m()},new S(x).play()},t.Easings={BackEaseIn(x,m,C,P){return C*(x/=P)*x*((1.70158+1)*x-1.70158)+m},BackEaseOut(x,m,C,P){return C*((x=x/P-1)*x*((1.70158+1)*x+1.70158)+1)+m},BackEaseInOut(x,m,C,P){let E=1.70158;return(x/=P/2)<1?C/2*(x*x*(((E*=1.525)+1)*x-E))+m:C/2*((x-=2)*x*(((E*=1.525)+1)*x+E)+2)+m},ElasticEaseIn(x,m,C,P,E,k){let v=0;return x===0?m:(x/=P)===1?m+C:(k||(k=P*.3),!E||E0?e:n),p=l*n,y=u*(u>0?e:n),S=c*(c>0?n:e);return{x:h,y:r?-1*S:y,width:p-h,height:S-y}}}Ph.Arc=fi;fi.prototype._centroid=!0;fi.prototype.className="Arc";fi.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"];(0,LN._registerNode)(fi);Nh.Factory.addGetterSetter(fi,"innerRadius",0,(0,Rh.getNumberValidator)());Nh.Factory.addGetterSetter(fi,"outerRadius",0,(0,Rh.getNumberValidator)());Nh.Factory.addGetterSetter(fi,"angle",0,(0,Rh.getNumberValidator)());Nh.Factory.addGetterSetter(fi,"clockwise",!1,(0,Rh.getBooleanValidator)());var Th={},Ru={};Object.defineProperty(Ru,"__esModule",{value:!0});Ru.Line=void 0;const Oh=Pe,FN=ke,AN=Rt,nS=ge;function Hg(t,e,n,r,i,s,l){const u=Math.sqrt(Math.pow(n-t,2)+Math.pow(r-e,2)),c=Math.sqrt(Math.pow(i-n,2)+Math.pow(s-r,2)),h=l*u/(u+c),p=l*c/(u+c),y=n-h*(i-t),S=r-h*(s-e),x=n+p*(i-t),m=r+p*(s-e);return[y,S,x,m]}function F4(t,e){const n=t.length,r=[];for(let i=2;i4){const c=this.getTensionPoints(),h=c.length;for(u=s?0:4,s||e.quadraticCurveTo(c[0],c[1],c[2],c[3]);u{let h,p;const S=c/2;h=0;for(let x=0;x<20;x++)p=S*t.tValues[20][x]+S,h+=t.cValues[20][x]*r(l,u,p);return S*h};t.getCubicArcLength=e;const n=(l,u,c)=>{c===void 0&&(c=1);const h=l[0]-2*l[1]+l[2],p=u[0]-2*u[1]+u[2],y=2*l[1]-2*l[0],S=2*u[1]-2*u[0],x=4*(h*h+p*p),m=4*(h*y+p*S),C=y*y+S*S;if(x===0)return c*Math.sqrt(Math.pow(l[2]-l[0],2)+Math.pow(u[2]-u[0],2));const P=m/(2*x),E=C/x,k=c+P,v=E-P*P,_=k*k+v>0?Math.sqrt(k*k+v):0,R=P*P+v>0?Math.sqrt(P*P+v):0,b=P+Math.sqrt(P*P+v)!==0?v*Math.log(Math.abs((k+_)/(P+R))):0;return Math.sqrt(x)/2*(k*_-P*R+b)};t.getQuadraticArcLength=n;function r(l,u,c){const h=i(1,c,l),p=i(1,c,u),y=h*h+p*p;return Math.sqrt(y)}const i=(l,u,c)=>{const h=c.length-1;let p,y;if(h===0)return 0;if(l===0){y=0;for(let S=0;S<=h;S++)y+=t.binomialCoefficients[h][S]*Math.pow(1-u,h-S)*Math.pow(u,S)*c[S];return y}else{p=new Array(h);for(let S=0;S{let h=1,p=l/u,y=(l-c(p))/u,S=0;for(;h>.001;){const x=c(p+y),m=Math.abs(l-x)/u;if(m500)break}return p};t.t2length=s})(rS);Object.defineProperty(Ia,"__esModule",{value:!0});Ia.Path=void 0;const MN=Pe,IN=ke,DN=Rt,Fo=rS;class kt extends DN.Shape{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=kt.parsePathData(this.data()),this.pathLength=kt.getPathLength(this.dataArray)}_sceneFunc(e){const n=this.dataArray;e.beginPath();let r=!1;for(let i=0;ip?h:p,P=h>p?1:h/p,E=h>p?p/h:1;e.translate(u,c),e.rotate(x),e.scale(P,E),e.arc(0,0,C,y,y+S,1-m),e.scale(1/P,1/E),e.rotate(-x),e.translate(-u,-c);break;case"z":r=!0,e.closePath();break}}!r&&!this.hasFill()?e.strokeShape(this):e.fillStrokeShape(this)}getSelfRect(){let e=[];this.dataArray.forEach(function(c){if(c.command==="A"){const h=c.points[4],p=c.points[5],y=c.points[4]+p;let S=Math.PI/180;if(Math.abs(h-y)y;x-=S){const m=kt.getPointOnEllipticalArc(c.points[0],c.points[1],c.points[2],c.points[3],x,0);e.push(m.x,m.y)}else for(let x=h+S;xn[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 l=n[i],u=l.points;switch(l.command){case"L":return kt.getPointOnLine(e,l.start.x,l.start.y,u[0],u[1]);case"C":return kt.getPointOnCubicBezier((0,Fo.t2length)(e,kt.getPathLength(n),C=>(0,Fo.getCubicArcLength)([l.start.x,u[0],u[2],u[4]],[l.start.y,u[1],u[3],u[5]],C)),l.start.x,l.start.y,u[0],u[1],u[2],u[3],u[4],u[5]);case"Q":return kt.getPointOnQuadraticBezier((0,Fo.t2length)(e,kt.getPathLength(n),C=>(0,Fo.getQuadraticArcLength)([l.start.x,u[0],u[2]],[l.start.y,u[1],u[3]],C)),l.start.x,l.start.y,u[0],u[1],u[2],u[3]);case"A":const c=u[0],h=u[1],p=u[2],y=u[3],S=u[5],x=u[6];let m=u[4];return m+=S*e/l.pathLength,kt.getPointOnEllipticalArc(c,h,p,y,m,x)}return null}static getPointOnLine(e,n,r,i,s,l,u){l=l??n,u=u??r;const c=this.getLineLength(n,r,i,s);if(c<1e-10)return{x:n,y:r};if(i===n)return{x:l,y:u+(s>r?e:-e)};const h=(s-r)/(i-n),p=Math.sqrt(e*e/(1+h*h))*(i0&&!isNaN(m[0]);){let C="",P=[];const E=u,k=c;let v,_,R,b,A,O,I,L,H,B;switch(x){case"l":u+=m.shift(),c+=m.shift(),C="L",P.push(u,c);break;case"L":u=m.shift(),c=m.shift(),P.push(u,c);break;case"m":const $=m.shift(),q=m.shift();if(u+=$,c+=q,C="M",s.length>2&&s[s.length-1].command==="z"){for(let Q=s.length-2;Q>=0;Q--)if(s[Q].command==="M"){u=s[Q].points[0]+$,c=s[Q].points[1]+q;break}}P.push(u,c),x="l";break;case"M":u=m.shift(),c=m.shift(),C="M",P.push(u,c),x="L";break;case"h":u+=m.shift(),C="L",P.push(u,c);break;case"H":u=m.shift(),C="L",P.push(u,c);break;case"v":c+=m.shift(),C="L",P.push(u,c);break;case"V":c=m.shift(),C="L",P.push(u,c);break;case"C":P.push(m.shift(),m.shift(),m.shift(),m.shift()),u=m.shift(),c=m.shift(),P.push(u,c);break;case"c":P.push(u+m.shift(),c+m.shift(),u+m.shift(),c+m.shift()),u+=m.shift(),c+=m.shift(),C="C",P.push(u,c);break;case"S":_=u,R=c,v=s[s.length-1],v.command==="C"&&(_=u+(u-v.points[2]),R=c+(c-v.points[3])),P.push(_,R,m.shift(),m.shift()),u=m.shift(),c=m.shift(),C="C",P.push(u,c);break;case"s":_=u,R=c,v=s[s.length-1],v.command==="C"&&(_=u+(u-v.points[2]),R=c+(c-v.points[3])),P.push(_,R,u+m.shift(),c+m.shift()),u+=m.shift(),c+=m.shift(),C="C",P.push(u,c);break;case"Q":P.push(m.shift(),m.shift()),u=m.shift(),c=m.shift(),P.push(u,c);break;case"q":P.push(u+m.shift(),c+m.shift()),u+=m.shift(),c+=m.shift(),C="Q",P.push(u,c);break;case"T":_=u,R=c,v=s[s.length-1],v.command==="Q"&&(_=u+(u-v.points[0]),R=c+(c-v.points[1])),u=m.shift(),c=m.shift(),C="Q",P.push(_,R,u,c);break;case"t":_=u,R=c,v=s[s.length-1],v.command==="Q"&&(_=u+(u-v.points[0]),R=c+(c-v.points[1])),u+=m.shift(),c+=m.shift(),C="Q",P.push(_,R,u,c);break;case"A":b=m.shift(),A=m.shift(),O=m.shift(),I=m.shift(),L=m.shift(),H=u,B=c,u=m.shift(),c=m.shift(),C="A",P=this.convertEndpointToCenterParameterization(H,B,u,c,I,L,b,A,O);break;case"a":b=m.shift(),A=m.shift(),O=m.shift(),I=m.shift(),L=m.shift(),H=u,B=c,u+=m.shift(),c+=m.shift(),C="A",P=this.convertEndpointToCenterParameterization(H,B,u,c,I,L,b,A,O);break}s.push({command:C||x,points:P,start:{x:E,y:k},pathLength:this.calcLength(E,k,C||x,P)})}(x==="z"||x==="Z")&&s.push({command:"z",points:[],start:void 0,pathLength:0})}return s}static calcLength(e,n,r,i){let s,l,u,c;const h=kt;switch(r){case"L":return h.getLineLength(e,n,i[0],i[1]);case"C":return(0,Fo.getCubicArcLength)([e,i[0],i[2],i[4]],[n,i[1],i[3],i[5]],1);case"Q":return(0,Fo.getQuadraticArcLength)([e,i[0],i[2]],[n,i[1],i[3]],1);case"A":s=0;const p=i[4],y=i[5],S=i[4]+y;let x=Math.PI/180;if(Math.abs(p-S)S;c-=x)u=h.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],c,0),s+=h.getLineLength(l.x,l.y,u.x,u.y),l=u;else for(c=p+x;c1&&(u*=Math.sqrt(x),c*=Math.sqrt(x));let m=Math.sqrt((u*u*(c*c)-u*u*(S*S)-c*c*(y*y))/(u*u*(S*S)+c*c*(y*y)));s===l&&(m*=-1),isNaN(m)&&(m=0);const C=m*u*S/c,P=m*-c*y/u,E=(e+r)/2+Math.cos(p)*C-Math.sin(p)*P,k=(n+i)/2+Math.sin(p)*C+Math.cos(p)*P,v=function(L){return Math.sqrt(L[0]*L[0]+L[1]*L[1])},_=function(L,H){return(L[0]*H[0]+L[1]*H[1])/(v(L)*v(H))},R=function(L,H){return(L[0]*H[1]=1&&(I=0),l===0&&I>0&&(I=I-2*Math.PI),l===1&&I<0&&(I=I+2*Math.PI),[E,k,u,c,b,I,p,l]}}Ia.Path=kt;kt.prototype.className="Path";kt.prototype._attrsAffectingSize=["data"];(0,IN._registerNode)(kt);MN.Factory.addGetterSetter(kt,"data");Object.defineProperty(Th,"__esModule",{value:!0});Th.Arrow=void 0;const bh=Pe,jN=Ru,iS=ge,UN=ke,A4=Ia;class lo extends jN.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 l=this.pointerLength(),u=r.length;let c,h;if(s){const S=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[u-2],r[u-1]],x=A4.Path.calcLength(i[i.length-4],i[i.length-3],"C",S),m=A4.Path.getPointOnQuadraticBezier(Math.min(1,1-l/x),S[0],S[1],S[2],S[3],S[4],S[5]);c=r[u-2]-m.x,h=r[u-1]-m.y}else c=r[u-2]-r[u-4],h=r[u-1]-r[u-3];const p=(Math.atan2(h,c)+n)%n,y=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(r[u-2],r[u-1]),e.rotate(p),e.moveTo(0,0),e.lineTo(-l,y/2),e.lineTo(-l,-y/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(r[0],r[1]),s?(c=(i[0]+i[2])/2-r[0],h=(i[1]+i[3])/2-r[1]):(c=r[2]-r[0],h=r[3]-r[1]),e.rotate((Math.atan2(-h,-c)+n)%n),e.moveTo(0,0),e.lineTo(-l,y/2),e.lineTo(-l,-y/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}}}Th.Arrow=lo;lo.prototype.className="Arrow";(0,UN._registerNode)(lo);bh.Factory.addGetterSetter(lo,"pointerLength",10,(0,iS.getNumberValidator)());bh.Factory.addGetterSetter(lo,"pointerWidth",10,(0,iS.getNumberValidator)());bh.Factory.addGetterSetter(lo,"pointerAtBeginning",!1);bh.Factory.addGetterSetter(lo,"pointerAtEnding",!0);var Lh={};Object.defineProperty(Lh,"__esModule",{value:!0});Lh.Circle=void 0;const zN=Pe,BN=Rt,GN=ge,HN=ke;class Da extends BN.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)}}Lh.Circle=Da;Da.prototype._centroid=!0;Da.prototype.className="Circle";Da.prototype._attrsAffectingSize=["radius"];(0,HN._registerNode)(Da);zN.Factory.addGetterSetter(Da,"radius",0,(0,GN.getNumberValidator)());var Fh={};Object.defineProperty(Fh,"__esModule",{value:!0});Fh.Ellipse=void 0;const pm=Pe,VN=Rt,sS=ge,WN=ke;class cs extends VN.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)}}Fh.Ellipse=cs;cs.prototype.className="Ellipse";cs.prototype._centroid=!0;cs.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,WN._registerNode)(cs);pm.Factory.addComponentsGetterSetter(cs,"radius",["x","y"]);pm.Factory.addGetterSetter(cs,"radiusX",0,(0,sS.getNumberValidator)());pm.Factory.addGetterSetter(cs,"radiusY",0,(0,sS.getNumberValidator)());var Ah={};Object.defineProperty(Ah,"__esModule",{value:!0});Ah.Image=void 0;const m0=ct,uo=Pe,KN=Rt,$N=ke,Tu=ge;let Dr=class oS extends KN.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 l;if(s){const u=this.attrs.cropWidth,c=this.attrs.cropHeight;u&&c?l=[s,this.cropX(),this.cropY(),u,c,0,0,n,r]:l=[s,0,0,n,r]}(this.hasFill()||this.hasStroke()||i)&&(e.beginPath(),i?m0.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,l))}_hitFunc(e){const n=this.width(),r=this.height(),i=this.cornerRadius();e.beginPath(),i?m0.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=m0.Util.createImageElement();i.onload=function(){const s=new oS({image:i});n(s)},i.onerror=r,i.crossOrigin="Anonymous",i.src=e}};Ah.Image=Dr;Dr.prototype.className="Image";(0,$N._registerNode)(Dr);uo.Factory.addGetterSetter(Dr,"cornerRadius",0,(0,Tu.getNumberOrArrayOfNumbersValidator)(4));uo.Factory.addGetterSetter(Dr,"image");uo.Factory.addComponentsGetterSetter(Dr,"crop",["x","y","width","height"]);uo.Factory.addGetterSetter(Dr,"cropX",0,(0,Tu.getNumberValidator)());uo.Factory.addGetterSetter(Dr,"cropY",0,(0,Tu.getNumberValidator)());uo.Factory.addGetterSetter(Dr,"cropWidth",0,(0,Tu.getNumberValidator)());uo.Factory.addGetterSetter(Dr,"cropHeight",0,(0,Tu.getNumberValidator)());var Ca={};Object.defineProperty(Ca,"__esModule",{value:!0});Ca.Tag=Ca.Label=void 0;const Mh=Pe,QN=Rt,qN=Aa,gm=ge,aS=ke,lS=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],YN="Change.konva",XN="none",Vg="up",Wg="right",Kg="down",$g="left",JN=lS.length;class mm extends qN.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{n=Math.min(n,l.x),r=Math.max(r,l.x),i=Math.min(i,l.y),s=Math.max(s,l.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)}}Dh.RegularPolygon=ho;ho.prototype.className="RegularPolygon";ho.prototype._centroid=!0;ho.prototype._attrsAffectingSize=["radius"];(0,sR._registerNode)(ho);uS.Factory.addGetterSetter(ho,"radius",0,(0,cS.getNumberValidator)());uS.Factory.addGetterSetter(ho,"sides",0,(0,cS.getNumberValidator)());var jh={};Object.defineProperty(jh,"__esModule",{value:!0});jh.Ring=void 0;const dS=Pe,oR=Rt,hS=ge,aR=ke,M4=Math.PI*2;class fo extends oR.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,M4,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),M4,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)}}jh.Ring=fo;fo.prototype.className="Ring";fo.prototype._centroid=!0;fo.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,aR._registerNode)(fo);dS.Factory.addGetterSetter(fo,"innerRadius",0,(0,hS.getNumberValidator)());dS.Factory.addGetterSetter(fo,"outerRadius",0,(0,hS.getNumberValidator)());var Uh={};Object.defineProperty(Uh,"__esModule",{value:!0});Uh.Sprite=void 0;const po=Pe,lR=Rt,uR=Ma,fS=ge,cR=ke;class jr extends lR.Shape{constructor(e){super(e),this._updated=!0,this.anim=new uR.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],l=this.frameOffsets(),u=s[i+0],c=s[i+1],h=s[i+2],p=s[i+3],y=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,h,p),e.closePath(),e.fillStrokeShape(this)),y)if(l){const S=l[n],x=r*2;e.drawImage(y,u,c,h,p,S[x+0],S[x+1],h,p)}else e.drawImage(y,u,c,h,p,0,0,h,p)}_hitFunc(e){const n=this.animation(),r=this.frameIndex(),i=r*4,s=this.animations()[n],l=this.frameOffsets(),u=s[i+2],c=s[i+3];if(e.beginPath(),l){const h=l[n],p=r*2;e.rect(h[p+0],h[p+1],u,c)}else e.rect(0,0,u,c);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{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 Ao="auto",gR="center",pS="inherit",ml="justify",mR="Change.konva",yR="2d",I4="-",gS="left",vR="text",SR="Text",xR="top",wR="bottom",D4="middle",mS="normal",_R="px ",Kc=" ",CR="right",j4="rtl",kR="word",ER="char",U4="none",v0="…",yS=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],PR=yS.length;function NR(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 $c;function S0(){return $c||($c=Qg.Util.createCanvasElement().getContext(yR),$c)}function RR(t){t.fillText(this._partialText,this._partialTextX,this._partialTextY)}function TR(t){t.setAttr("miterLimit",2),t.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function OR(t){return t=t||{},!t.fillLinearGradientColorStops&&!t.fillRadialGradientColorStops&&!t.fillPatternImage&&(t.fill=t.fill||"black"),t}let pt=class extends fR.Shape{constructor(e){super(OR(e)),this._partialTextX=0,this._partialTextY=0;for(let n=0;n1&&(k+=l)}}_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=Qg.Util._isString(e)?e:e==null?"":e+"";return this._setAttr(vR,n),this}getWidth(){return this.attrs.width===Ao||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===Ao||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return Qg.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,l,u,c,h,p,y,S;let x=S0(),m=this.fontSize(),C;x.save(),x.font=this._getContextFont(),C=x.measureText(e),x.restore();const P=m/100;return{actualBoundingBoxAscent:(n=C.actualBoundingBoxAscent)!==null&&n!==void 0?n:71.58203125*P,actualBoundingBoxDescent:(r=C.actualBoundingBoxDescent)!==null&&r!==void 0?r:0,actualBoundingBoxLeft:(i=C.actualBoundingBoxLeft)!==null&&i!==void 0?i:-7.421875*P,actualBoundingBoxRight:(s=C.actualBoundingBoxRight)!==null&&s!==void 0?s:75.732421875*P,alphabeticBaseline:(l=C.alphabeticBaseline)!==null&&l!==void 0?l:0,emHeightAscent:(u=C.emHeightAscent)!==null&&u!==void 0?u:100*P,emHeightDescent:(c=C.emHeightDescent)!==null&&c!==void 0?c:-20*P,fontBoundingBoxAscent:(h=C.fontBoundingBoxAscent)!==null&&h!==void 0?h:91*P,fontBoundingBoxDescent:(p=C.fontBoundingBoxDescent)!==null&&p!==void 0?p:21*P,hangingBaseline:(y=C.hangingBaseline)!==null&&y!==void 0?y:72.80000305175781*P,ideographicBaseline:(S=C.ideographicBaseline)!==null&&S!==void 0?S:-21*P,width:C.width,height:m}}_getContextFont(){return this.fontStyle()+Kc+this.fontVariant()+Kc+(this.fontSize()+_R)+NR(this.fontFamily())}_addTextLine(e){this.align()===ml&&(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 S0().measureText(e).width+n*r}_setTextData(){let e=this.text().split(` -`),n=+this.fontSize(),r=0,i=this.lineHeight()*n,s=this.attrs.width,l=this.attrs.height,u=s!==Ao&&s!==void 0,c=l!==Ao&&l!==void 0,h=this.padding(),p=s-h*2,y=l-h*2,S=0,x=this.wrap(),m=x!==U4,C=x!==ER&&m,P=this.ellipsis();this.textArr=[],S0().font=this._getContextFont();const E=P?this._getTextWidth(v0):0;for(let k=0,v=e.length;kp)for(;_.length>0;){let b=0,A=Ts(_).length,O="",I=0;for(;b>>1,H=Ts(_),B=H.slice(0,L+1).join(""),$=this._getTextWidth(B);(P&&c&&S+i>y?$+E:$)<=p?(b=L+1,O=B,I=$):A=L}if(O){if(C){const B=Ts(_),$=Ts(O),q=B[$.length],Q=q===Kc||q===I4;let re;if(Q&&I<=p)re=$.length;else{const he=$.lastIndexOf(Kc),W=$.lastIndexOf(I4);re=Math.max(he,W)+1}re>0&&(b=re,O=B.slice(0,b).join(""),I=this._getTextWidth(O))}if(O=O.trimRight(),this._addTextLine(O),r=Math.max(r,I),S+=i,this._shouldHandleEllipsis(S)){this._tryToAddEllipsisToLastLine();break}if(_=Ts(_).slice(b).join("").trimLeft(),_.length>0&&(R=this._getTextWidth(_),R<=p)){this._addTextLine(_),S+=i,r=Math.max(r,R);break}}else break}else this._addTextLine(_),S+=i,r=Math.max(r,R),this._shouldHandleEllipsis(S)&&ky)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(e){const n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,s=i!==Ao&&i!==void 0,l=this.padding(),u=i-l*2;return!(this.wrap()!==U4)||s&&e+r>u}_tryToAddEllipsisToLastLine(){const e=this.attrs.width,n=e!==Ao&&e!==void 0,r=this.padding(),i=e-r*2,s=this.ellipsis(),l=this.textArr[this.textArr.length-1];!l||!s||(n&&(this._getTextWidth(l.text+v0)n?null:yl.Path.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=yl.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 l=0;l=1){const r=n[0].p0;e.moveTo(r.x,r.y)}for(let r=0;rt+`.${_S}`).join(" "),G4="nodesRect",jR=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],UR={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},zR="ontouchstart"in ar.Konva._global;function BR(t,e,n){if(t==="rotater")return n;e+=Ue.Util.degToRad(UR[t]||0);const r=(Ue.Util.radToDeg(e)%360+360)%360;return Ue.Util._inRange(r,315+22.5,360)||Ue.Util._inRange(r,0,22.5)?"ns-resize":Ue.Util._inRange(r,45-22.5,45+22.5)?"nesw-resize":Ue.Util._inRange(r,90-22.5,90+22.5)?"ew-resize":Ue.Util._inRange(r,135-22.5,135+22.5)?"nwse-resize":Ue.Util._inRange(r,180-22.5,180+22.5)?"ns-resize":Ue.Util._inRange(r,225-22.5,225+22.5)?"nesw-resize":Ue.Util._inRange(r,270-22.5,270+22.5)?"ew-resize":Ue.Util._inRange(r,315-22.5,315+22.5)?"nwse-resize":(Ue.Util.error("Transformer has unknown angle for cursor detection: "+r),"pointer")}const $d=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function GR(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 CS(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 HR(t,e){const n=GR(t);return CS(t,e,n)}function VR(t,e,n){let r=e;for(let i=0;ii.isAncestorOf(this)?(Ue.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 l=i._attrsAffectingSize.map(u=>u+"Change."+this._getEventNamespace()).join(" ");i.on(l,s)}i.on(jR.map(l=>l+`.${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,l=i.y-n.y;this.nodes().forEach(u=>{if(u===e||u.isDragging())return;const c=u.getAbsolutePosition();u.setAbsolutePosition({x:c.x+s,y:c.y+l}),u.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(G4),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(G4,this.__getNodeRect)}__getNodeShape(e,n=this.rotation(),r){const i=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),s=e.getAbsoluteScale(r),l=e.getAbsolutePosition(r),u=i.x*s.x-e.offsetX()*s.x,c=i.y*s.y-e.offsetY()*s.y,h=(ar.Konva.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),p={x:l.x+u*Math.cos(h)+c*Math.sin(-h),y:l.y+c*Math.cos(h)+u*Math.sin(h),width:i.width*s.x,height:i.height*s.y,rotation:h};return CS(p,-ar.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(h=>{const p=h.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),y=[{x:p.x,y:p.y},{x:p.x+p.width,y:p.y},{x:p.x+p.width,y:p.y+p.height},{x:p.x,y:p.y+p.height}],S=h.getAbsoluteTransform();y.forEach(function(x){const m=S.point(x);n.push(m)})});const r=new Ue.Transform;r.rotate(-ar.Konva.getAngle(this.rotation()));let i=1/0,s=1/0,l=-1/0,u=-1/0;n.forEach(function(h){const p=r.point(h);i===void 0&&(i=l=p.x,s=u=p.y),i=Math.min(i,p.x),s=Math.min(s,p.y),l=Math.max(l,p.x),u=Math.max(u,p.y)}),r.invert();const c=r.point({x:i,y:s});return{x:c.x,y:c.y,width:l-i,height:u-s,rotation:ar.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(),$d.forEach(e=>{this._createAnchor(e)}),this._createAnchor("rotater")}_createAnchor(e){const n=new MR.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:zR?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=ar.Konva.getAngle(this.rotation()),s=this.rotateAnchorCursor(),l=BR(e,i,s);n.getStage().content&&(n.getStage().content.style.cursor=l),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){const e=new AR.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()*Ue.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 l=e.target.getAbsolutePosition(),u=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:u.x-l.x,y:u.y-l.y},qg++,this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach(c=>{c._fire("transformstart",{evt:e.evt,target:c})})}_handleMouseMove(e){let n,r,i;const s=this.findOne("."+this._movingAnchorName),l=s.getStage();l.setPointersPositions(e);const u=l.getPointerPosition();let c={x:u.x-this._anchorDragOffset.x,y:u.y-this._anchorDragOffset.y};const h=s.getAbsolutePosition();this.anchorDragBoundFunc()&&(c=this.anchorDragBoundFunc()(h,c,e)),s.setAbsolutePosition(c);const p=s.getAbsolutePosition();if(h.x===p.x&&h.y===p.y)return;if(this._movingAnchorName==="rotater"){const k=this._getNodeRect();n=s.x()-k.width/2,r=-s.y()+k.height/2;let v=Math.atan2(-r,n)+Math.PI/2;k.height<0&&(v-=Math.PI);const R=ar.Konva.getAngle(this.rotation())+v,b=ar.Konva.getAngle(this.rotationSnapTolerance()),O=VR(this.rotationSnaps(),R,b)-k.rotation,I=HR(k,O);this._fitNodesInto(I,e);return}const y=this.shiftBehavior();let S;y==="inverted"?S=this.keepRatio()&&!e.shiftKey:y==="none"?S=this.keepRatio():S=this.keepRatio()||e.shiftKey;let x=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(S){const k=x?{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(k.x-s.x(),2)+Math.pow(k.y-s.y(),2));const v=this.findOne(".top-left").x()>k.x?-1:1,_=this.findOne(".top-left").y()>k.y?-1:1;n=i*this.cos*v,r=i*this.sin*_,this.findOne(".top-left").x(k.x-n),this.findOne(".top-left").y(k.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(s.y());else if(this._movingAnchorName==="top-right"){if(S){const k=x?{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()-k.x,2)+Math.pow(k.y-s.y(),2));const v=this.findOne(".top-right").x()k.y?-1:1;n=i*this.cos*v,r=i*this.sin*_,this.findOne(".top-right").x(k.x+n),this.findOne(".top-right").y(k.y-r)}var m=s.position();this.findOne(".top-left").y(m.y),this.findOne(".bottom-right").x(m.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(S){const k=x?{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(k.x-s.x(),2)+Math.pow(s.y()-k.y,2));const v=k.x{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(Ue.Util._inRange(e.width,-this.padding()*2-i,i)){this.update();return}if(Ue.Util._inRange(e.height,-this.padding()*2-i,i)){this.update();return}const s=new Ue.Transform;if(s.rotate(ar.Konva.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const S=s.point({x:-this.padding()*2,y:0});e.x+=S.x,e.y+=S.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=S.x,this._anchorDragOffset.y-=S.y}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const S=s.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=S.x,this._anchorDragOffset.y-=S.y,e.width+=this.padding()*2}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const S=s.point({x:0,y:-this.padding()*2});e.x+=S.x,e.y+=S.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=S.x,this._anchorDragOffset.y-=S.y,e.height+=this.padding()*2}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const S=s.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=S.x,this._anchorDragOffset.y-=S.y,e.height+=this.padding()*2}if(this.boundBoxFunc()){const S=this.boundBoxFunc()(r,e);S?e=S:Ue.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const l=1e7,u=new Ue.Transform;u.translate(r.x,r.y),u.rotate(r.rotation),u.scale(r.width/l,r.height/l);const c=new Ue.Transform,h=e.width/l,p=e.height/l;this.flipEnabled()===!1?(c.translate(e.x,e.y),c.rotate(e.rotation),c.translate(e.width<0?e.width:0,e.height<0?e.height:0),c.scale(Math.abs(h),Math.abs(p))):(c.translate(e.x,e.y),c.rotate(e.rotation),c.scale(h,p));const y=c.multiply(u.invert());this._nodes.forEach(S=>{var x;const m=S.getParent().getAbsoluteTransform(),C=S.getTransform().copy();C.translate(S.offsetX(),S.offsetY());const P=new Ue.Transform;P.multiply(m.copy().invert()).multiply(y).multiply(m).multiply(C);const E=P.decompose();S.setAttrs(E),(x=S.getLayer())===null||x===void 0||x.batchDraw()}),this.rotation(Ue.Util._getRotation(e.rotation)),this._nodes.forEach(S=>{this._fire("transform",{evt:n,target:S}),S._fire("transform",{evt:n,target:S})}),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(Ue.Util._getRotation(n.rotation));const r=n.width,i=n.height,s=this.enabledAnchors(),l=this.resizeEnabled(),u=this.padding(),c=this.anchorSize(),h=this.find("._anchor");h.forEach(y=>{y.setAttrs({width:c,height:c,offsetX:c/2,offsetY:c/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:c/2+u,offsetY:c/2+u,visible:l&&s.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:c/2+u,visible:l&&s.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:c/2-u,offsetY:c/2+u,visible:l&&s.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:c/2+u,visible:l&&s.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:c/2-u,visible:l&&s.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:c/2+u,offsetY:c/2-u,visible:l&&s.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:c/2-u,visible:l&&s.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:c/2-u,offsetY:c/2-u,visible:l&&s.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*Ue.Util._sign(i)-u,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 p=this.anchorStyleFunc();p&&h.forEach(y=>{p(y)}),(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=""),B4.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return z4.Node.prototype.toObject.call(this)}clone(e){return z4.Node.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};Gh.Transformer=Oe;Oe.isTransforming=()=>qg>0;function WR(t){return t instanceof Array||Ue.Util.warn("enabledAnchors value should be an array"),t instanceof Array&&t.forEach(function(e){$d.indexOf(e)===-1&&Ue.Util.warn("Unknown anchor name: "+e+". Available names are: "+$d.join(", "))}),t||[]}Oe.prototype.className="Transformer";(0,IR._registerNode)(Oe);Me.Factory.addGetterSetter(Oe,"enabledAnchors",$d,WR);Me.Factory.addGetterSetter(Oe,"flipEnabled",!0,(0,fs.getBooleanValidator)());Me.Factory.addGetterSetter(Oe,"resizeEnabled",!0);Me.Factory.addGetterSetter(Oe,"anchorSize",10,(0,fs.getNumberValidator)());Me.Factory.addGetterSetter(Oe,"rotateEnabled",!0);Me.Factory.addGetterSetter(Oe,"rotateLineVisible",!0);Me.Factory.addGetterSetter(Oe,"rotationSnaps",[]);Me.Factory.addGetterSetter(Oe,"rotateAnchorOffset",50,(0,fs.getNumberValidator)());Me.Factory.addGetterSetter(Oe,"rotateAnchorCursor","crosshair");Me.Factory.addGetterSetter(Oe,"rotationSnapTolerance",5,(0,fs.getNumberValidator)());Me.Factory.addGetterSetter(Oe,"borderEnabled",!0);Me.Factory.addGetterSetter(Oe,"anchorStroke","rgb(0, 161, 255)");Me.Factory.addGetterSetter(Oe,"anchorStrokeWidth",1,(0,fs.getNumberValidator)());Me.Factory.addGetterSetter(Oe,"anchorFill","white");Me.Factory.addGetterSetter(Oe,"anchorCornerRadius",0,(0,fs.getNumberValidator)());Me.Factory.addGetterSetter(Oe,"borderStroke","rgb(0, 161, 255)");Me.Factory.addGetterSetter(Oe,"borderStrokeWidth",1,(0,fs.getNumberValidator)());Me.Factory.addGetterSetter(Oe,"borderDash");Me.Factory.addGetterSetter(Oe,"keepRatio",!0);Me.Factory.addGetterSetter(Oe,"shiftBehavior","default");Me.Factory.addGetterSetter(Oe,"centeredScaling",!1);Me.Factory.addGetterSetter(Oe,"ignoreStroke",!1);Me.Factory.addGetterSetter(Oe,"padding",0,(0,fs.getNumberValidator)());Me.Factory.addGetterSetter(Oe,"nodes");Me.Factory.addGetterSetter(Oe,"node");Me.Factory.addGetterSetter(Oe,"boundBoxFunc");Me.Factory.addGetterSetter(Oe,"anchorDragBoundFunc");Me.Factory.addGetterSetter(Oe,"anchorStyleFunc");Me.Factory.addGetterSetter(Oe,"shouldOverdrawWholeArea",!1);Me.Factory.addGetterSetter(Oe,"useSingleNodeRotation",!0);Me.Factory.backCompat(Oe,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var Hh={};Object.defineProperty(Hh,"__esModule",{value:!0});Hh.Wedge=void 0;const Vh=Pe,KR=Rt,$R=ke,kS=ge,QR=ke;class pi extends KR.Shape{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,$R.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)}}Hh.Wedge=pi;pi.prototype.className="Wedge";pi.prototype._centroid=!0;pi.prototype._attrsAffectingSize=["radius"];(0,QR._registerNode)(pi);Vh.Factory.addGetterSetter(pi,"radius",0,(0,kS.getNumberValidator)());Vh.Factory.addGetterSetter(pi,"angle",0,(0,kS.getNumberValidator)());Vh.Factory.addGetterSetter(pi,"clockwise",!1);Vh.Factory.backCompat(pi,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var Wh={};Object.defineProperty(Wh,"__esModule",{value:!0});Wh.Blur=void 0;const H4=Pe,qR=rt,YR=ge;function V4(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}const XR=[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],JR=[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 ZR(t,e){const n=t.data,r=t.width,i=t.height;let s,l,u,c,h,p,y,S,x,m,C,P,E,k,v,_,R,b,A,O;const I=e+e+1,L=r-1,H=i-1,B=e+1,$=B*(B+1)/2,q=new V4,Q=XR[e],re=JR[e];let he=null,W=q,te=null,Z=null;for(let Y=1;Y>re,A!==0?(A=255/A,n[l]=(c*Q>>re)*A,n[l+1]=(h*Q>>re)*A,n[l+2]=(p*Q>>re)*A):n[l]=n[l+1]=n[l+2]=0,c-=S,h-=x,p-=m,y-=C,S-=te.r,x-=te.g,m-=te.b,C-=te.a,s=u+((s=ie+e+1)>re,A>0?(A=255/A,n[s]=(c*Q>>re)*A,n[s+1]=(h*Q>>re)*A,n[s+2]=(p*Q>>re)*A):n[s]=n[s+1]=n[s+2]=0,c-=S,h-=x,p-=m,y-=C,S-=te.r,x-=te.g,m-=te.b,C-=te.a,s=Y+((s=xe+B)0&&ZR(e,n)};Wh.Blur=eT;H4.Factory.addGetterSetter(qR.Node,"blurRadius",0,(0,YR.getNumberValidator)(),H4.Factory.afterSetFilter);var Kh={};Object.defineProperty(Kh,"__esModule",{value:!0});Kh.Brighten=void 0;const W4=Pe,tT=rt,nT=ge,rT=function(t){const e=this.brightness()*255,n=t.data,r=n.length;for(let i=0;i255?255:i,s=s<0?0:s>255?255:s,l=l<0?0:l>255?255:l,n[u]=i,n[u+1]=s,n[u+2]=l};$h.Contrast=oT;K4.Factory.addGetterSetter(iT.Node,"contrast",0,(0,sT.getNumberValidator)(),K4.Factory.afterSetFilter);var Qh={};Object.defineProperty(Qh,"__esModule",{value:!0});Qh.Emboss=void 0;const is=Pe,qh=rt,aT=ct,ES=ge,lT=function(t){const e=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),s=t.data,l=t.width,u=t.height,c=l*4;let h=0,p=0,y=u;switch(r){case"top-left":h=-1,p=-1;break;case"top":h=-1,p=0;break;case"top-right":h=-1,p=1;break;case"right":h=0,p=1;break;case"bottom-right":h=1,p=1;break;case"bottom":h=1,p=0;break;case"bottom-left":h=1,p=-1;break;case"left":h=0,p=-1;break;default:aT.Util.error("Unknown emboss direction: "+r)}do{const S=(y-1)*c;let x=h;y+x<1&&(x=0),y+x>u&&(x=0);const m=(y-1+x)*l*4;let C=l;do{const P=S+(C-1)*4;let E=p;C+E<1&&(E=0),C+E>l&&(E=0);const k=m+(C-1+E)*4,v=s[P]-s[k],_=s[P+1]-s[k+1],R=s[P+2]-s[k+2];let b=v;const A=b>0?b:-b,O=_>0?_:-_,I=R>0?R:-R;if(O>A&&(b=_),I>A&&(b=R),b*=e,i){const L=s[P]+b,H=s[P+1]+b,B=s[P+2]+b;s[P]=L>255?255:L<0?0:L,s[P+1]=H>255?255:H<0?0:H,s[P+2]=B>255?255:B<0?0:B}else{let L=n-b;L<0?L=0:L>255&&(L=255),s[P]=s[P+1]=s[P+2]=L}}while(--C)}while(--y)};Qh.Emboss=lT;is.Factory.addGetterSetter(qh.Node,"embossStrength",.5,(0,ES.getNumberValidator)(),is.Factory.afterSetFilter);is.Factory.addGetterSetter(qh.Node,"embossWhiteLevel",.5,(0,ES.getNumberValidator)(),is.Factory.afterSetFilter);is.Factory.addGetterSetter(qh.Node,"embossDirection","top-left",void 0,is.Factory.afterSetFilter);is.Factory.addGetterSetter(qh.Node,"embossBlend",!1,void 0,is.Factory.afterSetFilter);var Yh={};Object.defineProperty(Yh,"__esModule",{value:!0});Yh.Enhance=void 0;const $4=Pe,uT=rt,cT=ge;function _0(t,e,n,r,i){const s=n-e,l=i-r;if(s===0)return r+l/2;if(l===0)return r;let u=(t-e)/s;return u=l*u+r,u}const dT=function(t){const e=t.data,n=e.length;let r=e[0],i=r,s,l=e[1],u=l,c,h=e[2],p=h,y;const S=this.enhance();if(S===0)return;for(let v=0;vi&&(i=s),c=e[v+1],cu&&(u=c),y=e[v+2],yp&&(p=y);i===r&&(i=255,r=0),u===l&&(u=255,l=0),p===h&&(p=255,h=0);let x,m,C,P,E,k;if(S>0)x=i+S*(255-i),m=r-S*(r-0),C=u+S*(255-u),P=l-S*(l-0),E=p+S*(255-p),k=h-S*(h-0);else{const v=(i+r)*.5;x=i+S*(i-v),m=r+S*(r-v);const _=(u+l)*.5;C=u+S*(u-_),P=l+S*(l-_);const R=(p+h)*.5;E=p+S*(p-R),k=h+S*(h-R)}for(let v=0;vh?S:h;const x=l,m=s,C=360/m*Math.PI/180;for(let P=0;Ph?S:h;const x=l,m=s,C=0;let P,E;for(p=0;pe&&(_=v,R=0,b=-1),i=0;i=0&&x=0&&m=0&&x=0&&m=255*4?255:0}return l}function PT(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),l=[];for(let u=0;u=0&&x=0&&m=n))for(let v=C;v=r)continue;const _=(n*v+k)*4;h+=l[_+0],p+=l[_+1],y+=l[_+2],S+=l[_+3],E+=1}h=h/E,p=p/E,y=y/E,S=S/E;for(let k=x;k=n))for(let v=C;v=r)continue;const _=(n*v+k)*4;l[_+0]=h,l[_+1]=p,l[_+2]=y,l[_+3]=S}}};sf.Pixelate=AT;X4.Factory.addGetterSetter(LT.Node,"pixelSize",8,(0,FT.getNumberValidator)(),X4.Factory.afterSetFilter);var of={};Object.defineProperty(of,"__esModule",{value:!0});of.Posterize=void 0;const J4=Pe,MT=rt,IT=ge,DT=function(t){const e=Math.round(this.levels()*254)+1,n=t.data,r=n.length,i=255/e;for(let s=0;s255?255:t<0?0:Math.round(t)});qd.Factory.addGetterSetter(Cm.Node,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});qd.Factory.addGetterSetter(Cm.Node,"blue",0,jT.RGBComponent,qd.Factory.afterSetFilter);var lf={};Object.defineProperty(lf,"__esModule",{value:!0});lf.RGBA=void 0;const au=Pe,uf=rt,zT=ge,BT=function(t){const e=t.data,n=e.length,r=this.red(),i=this.green(),s=this.blue(),l=this.alpha();for(let u=0;u255?255:t<0?0:Math.round(t)});au.Factory.addGetterSetter(uf.Node,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});au.Factory.addGetterSetter(uf.Node,"blue",0,zT.RGBComponent,au.Factory.afterSetFilter);au.Factory.addGetterSetter(uf.Node,"alpha",1,function(t){return this._filterUpToDate=!1,t>1?1:t<0?0:t});var cf={};Object.defineProperty(cf,"__esModule",{value:!0});cf.Sepia=void 0;const GT=function(t){const e=t.data,n=e.length;for(let r=0;r127&&(h=255-h),p>127&&(p=255-p),y>127&&(y=255-y),e[c]=h,e[c+1]=p,e[c+2]=y}while(--u)}while(--s)};df.Solarize=HT;var hf={};Object.defineProperty(hf,"__esModule",{value:!0});hf.Threshold=void 0;const Z4=Pe,VT=rt,WT=ge,KT=function(t){const e=this.threshold()*255,n=t.data,r=n.length;for(let i=0;iM||g[T]!==w[M]){var G=` -`+g[T].replace(" at new "," at ");return o.displayName&&G.includes("")&&(G=G.replace("",o.displayName)),G}while(1<=T&&0<=M);break}}}finally{Sf=!1,Error.prepareStackTrace=d}return(o=o?o.displayName||o.name:"")?Ba(o):""}var Rx=Object.prototype.hasOwnProperty,wf=[],mo=-1;function yi(o){return{current:o}}function qe(o){0>mo||(o.current=wf[mo],wf[mo]=null,mo--)}function Ve(o,a){mo++,wf[mo]=o.current,o.current=a}var vi={},Ht=yi(vi),cn=yi(!1),gs=vi;function yo(o,a){var d=o.type.contextTypes;if(!d)return vi;var f=o.stateNode;if(f&&f.__reactInternalMemoizedUnmaskedChildContext===a)return f.__reactInternalMemoizedMaskedChildContext;var g={},w;for(w in d)g[w]=a[w];return f&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=a,o.__reactInternalMemoizedMaskedChildContext=g),g}function dn(o){return o=o.childContextTypes,o!=null}function Lu(){qe(cn),qe(Ht)}function Lm(o,a,d){if(Ht.current!==vi)throw Error(l(168));Ve(Ht,a),Ve(cn,d)}function Fm(o,a,d){var f=o.stateNode;if(a=a.childContextTypes,typeof f.getChildContext!="function")return d;f=f.getChildContext();for(var g in f)if(!(g in a))throw Error(l(108,O(o)||"Unknown",g));return s({},d,f)}function Fu(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||vi,gs=Ht.current,Ve(Ht,o),Ve(cn,cn.current),!0}function Am(o,a,d){var f=o.stateNode;if(!f)throw Error(l(169));d?(o=Fm(o,a,gs),f.__reactInternalMemoizedMergedChildContext=o,qe(cn),qe(Ht),Ve(Ht,o)):qe(cn),Ve(cn,d)}var er=Math.clz32?Math.clz32:bx,Tx=Math.log,Ox=Math.LN2;function bx(o){return o>>>=0,o===0?32:31-(Tx(o)/Ox|0)|0}var Au=64,Mu=4194304;function Ga(o){switch(o&-o){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 o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function Iu(o,a){var d=o.pendingLanes;if(d===0)return 0;var f=0,g=o.suspendedLanes,w=o.pingedLanes,T=d&268435455;if(T!==0){var M=T&~g;M!==0?f=Ga(M):(w&=T,w!==0&&(f=Ga(w)))}else T=d&~g,T!==0?f=Ga(T):w!==0&&(f=Ga(w));if(f===0)return 0;if(a!==0&&a!==f&&!(a&g)&&(g=f&-f,w=a&-a,g>=w||g===16&&(w&4194240)!==0))return a;if(f&4&&(f|=d&16),a=o.entangledLanes,a!==0)for(o=o.entanglements,a&=f;0d;d++)a.push(o);return a}function Ha(o,a,d){o.pendingLanes|=a,a!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,a=31-er(a),o[a]=d}function Ax(o,a){var d=o.pendingLanes&~a;o.pendingLanes=a,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=a,o.mutableReadLanes&=a,o.entangledLanes&=a,a=o.entanglements;var f=o.eventTimes;for(o=o.expirationTimes;0>=T,g-=T,zr=1<<32-er(a)+g|d<Fe?(Ft=Se,Se=null):Ft=Se.sibling;var Ae=se(U,Se,K[Fe],oe);if(Ae===null){Se===null&&(Se=Ft);break}o&&Se&&Ae.alternate===null&&a(U,Se),j=w(Ae,j,Fe),Ce===null?fe=Ae:Ce.sibling=Ae,Ce=Ae,Se=Ft}if(Fe===K.length)return d(U,Se),Ze&&ys(U,Fe),fe;if(Se===null){for(;FeFe?(Ft=Se,Se=null):Ft=Se.sibling;var Pi=se(U,Se,Ae.value,oe);if(Pi===null){Se===null&&(Se=Ft);break}o&&Se&&Pi.alternate===null&&a(U,Se),j=w(Pi,j,Fe),Ce===null?fe=Pi:Ce.sibling=Pi,Ce=Pi,Se=Ft}if(Ae.done)return d(U,Se),Ze&&ys(U,Fe),fe;if(Se===null){for(;!Ae.done;Fe++,Ae=K.next())Ae=ve(U,Ae.value,oe),Ae!==null&&(j=w(Ae,j,Fe),Ce===null?fe=Ae:Ce.sibling=Ae,Ce=Ae);return Ze&&ys(U,Fe),fe}for(Se=f(U,Se);!Ae.done;Fe++,Ae=K.next())Ae=Ye(Se,U,Fe,Ae.value,oe),Ae!==null&&(o&&Ae.alternate!==null&&Se.delete(Ae.key===null?Fe:Ae.key),j=w(Ae,j,Fe),Ce===null?fe=Ae:Ce.sibling=Ae,Ce=Ae);return o&&Se.forEach(function(S9){return a(U,S9)}),Ze&&ys(U,Fe),fe}function Wr(U,j,K,oe){if(typeof K=="object"&&K!==null&&K.type===p&&K.key===null&&(K=K.props.children),typeof K=="object"&&K!==null){switch(K.$$typeof){case c:e:{for(var fe=K.key,Ce=j;Ce!==null;){if(Ce.key===fe){if(fe=K.type,fe===p){if(Ce.tag===7){d(U,Ce.sibling),j=g(Ce,K.props.children),j.return=U,U=j;break e}}else if(Ce.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===v&&Vm(fe)===Ce.type){d(U,Ce.sibling),j=g(Ce,K.props),j.ref=Wa(U,Ce,K),j.return=U,U=j;break e}d(U,Ce);break}else a(U,Ce);Ce=Ce.sibling}K.type===p?(j=ks(K.props.children,U.mode,oe,K.key),j.return=U,U=j):(oe=xc(K.type,K.key,K.props,null,U.mode,oe),oe.ref=Wa(U,j,K),oe.return=U,U=oe)}return T(U);case h:e:{for(Ce=K.key;j!==null;){if(j.key===Ce)if(j.tag===4&&j.stateNode.containerInfo===K.containerInfo&&j.stateNode.implementation===K.implementation){d(U,j.sibling),j=g(j,K.children||[]),j.return=U,U=j;break e}else{d(U,j);break}else a(U,j);j=j.sibling}j=Tp(K,U.mode,oe),j.return=U,U=j}return T(U);case v:return Ce=K._init,Wr(U,j,Ce(K._payload),oe)}if(Q(K))return Be(U,j,K,oe);if(b(K))return gn(U,j,K,oe);Hu(U,K)}return typeof K=="string"&&K!==""||typeof K=="number"?(K=""+K,j!==null&&j.tag===6?(d(U,j.sibling),j=g(j,K),j.return=U,U=j):(d(U,j),j=Rp(K,U.mode,oe),j.return=U,U=j),T(U)):d(U,j)}return Wr}var wo=Wm(!0),Km=Wm(!1),Vu=yi(null),Wu=null,_o=null,Af=null;function Mf(){Af=_o=Wu=null}function $m(o,a,d){De?(Ve(Vu,a._currentValue),a._currentValue=d):(Ve(Vu,a._currentValue2),a._currentValue2=d)}function If(o){var a=Vu.current;qe(Vu),De?o._currentValue=a:o._currentValue2=a}function Df(o,a,d){for(;o!==null;){var f=o.alternate;if((o.childLanes&a)!==a?(o.childLanes|=a,f!==null&&(f.childLanes|=a)):f!==null&&(f.childLanes&a)!==a&&(f.childLanes|=a),o===d)break;o=o.return}}function Co(o,a){Wu=o,Af=_o=null,o=o.dependencies,o!==null&&o.firstContext!==null&&(o.lanes&a&&(hn=!0),o.firstContext=null)}function jn(o){var a=De?o._currentValue:o._currentValue2;if(Af!==o)if(o={context:o,memoizedValue:a,next:null},_o===null){if(Wu===null)throw Error(l(308));_o=o,Wu.dependencies={lanes:0,firstContext:o}}else _o=_o.next=o;return a}var vs=null;function jf(o){vs===null?vs=[o]:vs.push(o)}function Qm(o,a,d,f){var g=a.interleaved;return g===null?(d.next=d,jf(a)):(d.next=g.next,g.next=d),a.interleaved=d,wr(o,f)}function wr(o,a){o.lanes|=a;var d=o.alternate;for(d!==null&&(d.lanes|=a),d=o,o=o.return;o!==null;)o.childLanes|=a,d=o.alternate,d!==null&&(d.childLanes|=a),d=o,o=o.return;return d.tag===3?d.stateNode:null}var Si=!1;function Uf(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function qm(o,a){o=o.updateQueue,a.updateQueue===o&&(a.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function Gr(o,a){return{eventTime:o,lane:a,tag:0,payload:null,callback:null,next:null}}function xi(o,a,d){var f=o.updateQueue;if(f===null)return null;if(f=f.shared,Ee&2){var g=f.pending;return g===null?a.next=a:(a.next=g.next,g.next=a),f.pending=a,wr(o,d)}return g=f.interleaved,g===null?(a.next=a,jf(f)):(a.next=g.next,g.next=a),f.interleaved=a,wr(o,d)}function Ku(o,a,d){if(a=a.updateQueue,a!==null&&(a=a.shared,(d&4194240)!==0)){var f=a.lanes;f&=o.pendingLanes,d|=f,a.lanes=d,kf(o,d)}}function Ym(o,a){var d=o.updateQueue,f=o.alternate;if(f!==null&&(f=f.updateQueue,d===f)){var g=null,w=null;if(d=d.firstBaseUpdate,d!==null){do{var T={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};w===null?g=w=T:w=w.next=T,d=d.next}while(d!==null);w===null?g=w=a:w=w.next=a}else g=w=a;d={baseState:f.baseState,firstBaseUpdate:g,lastBaseUpdate:w,shared:f.shared,effects:f.effects},o.updateQueue=d;return}o=d.lastBaseUpdate,o===null?d.firstBaseUpdate=a:o.next=a,d.lastBaseUpdate=a}function $u(o,a,d,f){var g=o.updateQueue;Si=!1;var w=g.firstBaseUpdate,T=g.lastBaseUpdate,M=g.shared.pending;if(M!==null){g.shared.pending=null;var G=M,ee=G.next;G.next=null,T===null?w=ee:T.next=ee,T=G;var ue=o.alternate;ue!==null&&(ue=ue.updateQueue,M=ue.lastBaseUpdate,M!==T&&(M===null?ue.firstBaseUpdate=ee:M.next=ee,ue.lastBaseUpdate=G))}if(w!==null){var ve=g.baseState;T=0,ue=ee=G=null,M=w;do{var se=M.lane,Ye=M.eventTime;if((f&se)===se){ue!==null&&(ue=ue.next={eventTime:Ye,lane:0,tag:M.tag,payload:M.payload,callback:M.callback,next:null});e:{var Be=o,gn=M;switch(se=a,Ye=d,gn.tag){case 1:if(Be=gn.payload,typeof Be=="function"){ve=Be.call(Ye,ve,se);break e}ve=Be;break e;case 3:Be.flags=Be.flags&-65537|128;case 0:if(Be=gn.payload,se=typeof Be=="function"?Be.call(Ye,ve,se):Be,se==null)break e;ve=s({},ve,se);break e;case 2:Si=!0}}M.callback!==null&&M.lane!==0&&(o.flags|=64,se=g.effects,se===null?g.effects=[M]:se.push(M))}else Ye={eventTime:Ye,lane:se,tag:M.tag,payload:M.payload,callback:M.callback,next:null},ue===null?(ee=ue=Ye,G=ve):ue=ue.next=Ye,T|=se;if(M=M.next,M===null){if(M=g.shared.pending,M===null)break;se=M,M=se.next,se.next=null,g.lastBaseUpdate=se,g.shared.pending=null}}while(!0);if(ue===null&&(G=ve),g.baseState=G,g.firstBaseUpdate=ee,g.lastBaseUpdate=ue,a=g.shared.interleaved,a!==null){g=a;do T|=g.lane,g=g.next;while(g!==a)}else w===null&&(g.shared.lanes=0);xs|=T,o.lanes=T,o.memoizedState=ve}}function Xm(o,a,d){if(o=a.effects,a.effects=null,o!==null)for(a=0;ad?d:4,o(!0);var f=Vf.transition;Vf.transition={};try{o(!1),a()}finally{Le=d,Vf.transition=f}}function m2(){return zn().memoizedState}function Kx(o,a,d){var f=Ci(o);if(d={lane:f,action:d,hasEagerState:!1,eagerState:null,next:null},y2(o))v2(a,d);else if(d=Qm(o,a,d,f),d!==null){var g=$t();Bn(d,o,f,g),S2(d,a,f)}}function $x(o,a,d){var f=Ci(o),g={lane:f,action:d,hasEagerState:!1,eagerState:null,next:null};if(y2(o))v2(a,g);else{var w=o.alternate;if(o.lanes===0&&(w===null||w.lanes===0)&&(w=a.lastRenderedReducer,w!==null))try{var T=a.lastRenderedState,M=w(T,d);if(g.hasEagerState=!0,g.eagerState=M,tr(M,T)){var G=a.interleaved;G===null?(g.next=g,jf(a)):(g.next=G.next,G.next=g),a.interleaved=g;return}}catch{}finally{}d=Qm(o,a,g,f),d!==null&&(g=$t(),Bn(d,o,f,g),S2(d,a,f))}}function y2(o){var a=o.alternate;return o===ot||a!==null&&a===ot}function v2(o,a){Qa=Yu=!0;var d=o.pending;d===null?a.next=a:(a.next=d.next,d.next=a),o.pending=a}function S2(o,a,d){if(d&4194240){var f=a.lanes;f&=o.pendingLanes,d|=f,a.lanes=d,kf(o,d)}}var Zu={readContext:jn,useCallback:Vt,useContext:Vt,useEffect:Vt,useImperativeHandle:Vt,useInsertionEffect:Vt,useLayoutEffect:Vt,useMemo:Vt,useReducer:Vt,useRef:Vt,useState:Vt,useDebugValue:Vt,useDeferredValue:Vt,useTransition:Vt,useMutableSource:Vt,useSyncExternalStore:Vt,useId:Vt,unstable_isNewReconciler:!1},Qx={readContext:jn,useCallback:function(o,a){return Cr().memoizedState=[o,a===void 0?null:a],o},useContext:jn,useEffect:l2,useImperativeHandle:function(o,a,d){return d=d!=null?d.concat([o]):null,Xu(4194308,4,d2.bind(null,a,o),d)},useLayoutEffect:function(o,a){return Xu(4194308,4,o,a)},useInsertionEffect:function(o,a){return Xu(4,2,o,a)},useMemo:function(o,a){var d=Cr();return a=a===void 0?null:a,o=o(),d.memoizedState=[o,a],o},useReducer:function(o,a,d){var f=Cr();return a=d!==void 0?d(a):a,f.memoizedState=f.baseState=a,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:a},f.queue=o,o=o.dispatch=Kx.bind(null,ot,o),[f.memoizedState,o]},useRef:function(o){var a=Cr();return o={current:o},a.memoizedState=o},useState:o2,useDebugValue:Xf,useDeferredValue:function(o){return Cr().memoizedState=o},useTransition:function(){var o=o2(!1),a=o[0];return o=Wx.bind(null,o[1]),Cr().memoizedState=o,[a,o]},useMutableSource:function(){},useSyncExternalStore:function(o,a,d){var f=ot,g=Cr();if(Ze){if(d===void 0)throw Error(l(407));d=d()}else{if(d=a(),Lt===null)throw Error(l(349));Ss&30||t2(f,a,d)}g.memoizedState=d;var w={value:d,getSnapshot:a};return g.queue=w,l2(r2.bind(null,f,w,o),[o]),f.flags|=2048,Xa(9,n2.bind(null,f,w,d,a),void 0,null),d},useId:function(){var o=Cr(),a=Lt.identifierPrefix;if(Ze){var d=Br,f=zr;d=(f&~(1<<32-er(f)-1)).toString(32)+d,a=":"+a+"R"+d,d=qa++,0xp&&(a.flags|=128,f=!0,el(g,!1),a.lanes=4194304)}else{if(!f)if(o=Qu(w),o!==null){if(a.flags|=128,f=!0,o=o.updateQueue,o!==null&&(a.updateQueue=o,a.flags|=4),el(g,!0),g.tail===null&&g.tailMode==="hidden"&&!w.alternate&&!Ze)return Wt(a),null}else 2*Ot()-g.renderingStartTime>xp&&d!==1073741824&&(a.flags|=128,f=!0,el(g,!1),a.lanes=4194304);g.isBackwards?(w.sibling=a.child,a.child=w):(o=g.last,o!==null?o.sibling=w:a.child=w,g.last=w)}return g.tail!==null?(a=g.tail,g.rendering=a,g.tail=a.sibling,g.renderingStartTime=Ot(),a.sibling=null,o=st.current,Ve(st,f?o&1|2:o&1),a):(Wt(a),null);case 22:case 23:return Ep(),d=a.memoizedState!==null,o!==null&&o.memoizedState!==null!==d&&(a.flags|=8192),d&&a.mode&1?Pn&1073741824&&(Wt(a),we&&a.subtreeFlags&6&&(a.flags|=8192)):Wt(a),null;case 24:return null;case 25:return null}throw Error(l(156,a.tag))}function n9(o,a){switch(Of(a),a.tag){case 1:return dn(a.type)&&Lu(),o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 3:return Eo(),qe(cn),qe(Ht),Hf(),o=a.flags,o&65536&&!(o&128)?(a.flags=o&-65537|128,a):null;case 5:return Bf(a),null;case 13:if(qe(st),o=a.memoizedState,o!==null&&o.dehydrated!==null){if(a.alternate===null)throw Error(l(340));xo()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 19:return qe(st),null;case 4:return Eo(),null;case 10:return If(a.type._context),null;case 22:case 23:return Ep(),null;case 24:return null;default:return null}}var sc=!1,Kt=!1,r9=typeof WeakSet=="function"?WeakSet:Set,ae=null;function No(o,a){var d=o.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(f){et(o,a,f)}else d.current=null}function lp(o,a,d){try{d()}catch(f){et(o,a,f)}}var B2=!1;function i9(o,a){for(te(o.containerInfo),ae=a;ae!==null;)if(o=ae,a=o.child,(o.subtreeFlags&1028)!==0&&a!==null)a.return=o,ae=a;else for(;ae!==null;){o=ae;try{var d=o.alternate;if(o.flags&1024)switch(o.tag){case 0:case 11:case 15:break;case 1:if(d!==null){var f=d.memoizedProps,g=d.memoizedState,w=o.stateNode,T=w.getSnapshotBeforeUpdate(o.elementType===o.type?f:rr(o.type,f),g);w.__reactInternalSnapshotBeforeUpdate=T}break;case 3:we&&ox(o.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(l(163))}}catch(M){et(o,o.return,M)}if(a=o.sibling,a!==null){a.return=o.return,ae=a;break}ae=o.return}return d=B2,B2=!1,d}function tl(o,a,d){var f=a.updateQueue;if(f=f!==null?f.lastEffect:null,f!==null){var g=f=f.next;do{if((g.tag&o)===o){var w=g.destroy;g.destroy=void 0,w!==void 0&&lp(a,d,w)}g=g.next}while(g!==f)}}function oc(o,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var d=a=a.next;do{if((d.tag&o)===o){var f=d.create;d.destroy=f()}d=d.next}while(d!==a)}}function up(o){var a=o.ref;if(a!==null){var d=o.stateNode;switch(o.tag){case 5:o=re(d);break;default:o=d}typeof a=="function"?a(o):a.current=o}}function G2(o){var a=o.alternate;a!==null&&(o.alternate=null,G2(a)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(a=o.stateNode,a!==null&&Zn(a)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function H2(o){return o.tag===5||o.tag===3||o.tag===4}function V2(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||H2(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function cp(o,a,d){var f=o.tag;if(f===5||f===6)o=o.stateNode,a?ZS(d,o,a):QS(d,o);else if(f!==4&&(o=o.child,o!==null))for(cp(o,a,d),o=o.sibling;o!==null;)cp(o,a,d),o=o.sibling}function dp(o,a,d){var f=o.tag;if(f===5||f===6)o=o.stateNode,a?JS(d,o,a):$S(d,o);else if(f!==4&&(o=o.child,o!==null))for(dp(o,a,d),o=o.sibling;o!==null;)dp(o,a,d),o=o.sibling}var jt=null,ir=!1;function Er(o,a,d){for(d=d.child;d!==null;)hp(o,a,d),d=d.sibling}function hp(o,a,d){if(Sr&&typeof Sr.onCommitFiberUnmount=="function")try{Sr.onCommitFiberUnmount(Du,d)}catch{}switch(d.tag){case 5:Kt||No(d,a);case 6:if(we){var f=jt,g=ir;jt=null,Er(o,a,d),jt=f,ir=g,jt!==null&&(ir?tx(jt,d.stateNode):ex(jt,d.stateNode))}else Er(o,a,d);break;case 18:we&&jt!==null&&(ir?kx(jt,d.stateNode):Cx(jt,d.stateNode));break;case 4:we?(f=jt,g=ir,jt=d.stateNode.containerInfo,ir=!0,Er(o,a,d),jt=f,ir=g):(He&&(f=d.stateNode.containerInfo,g=Nm(f),mf(f,g)),Er(o,a,d));break;case 0:case 11:case 14:case 15:if(!Kt&&(f=d.updateQueue,f!==null&&(f=f.lastEffect,f!==null))){g=f=f.next;do{var w=g,T=w.destroy;w=w.tag,T!==void 0&&(w&2||w&4)&&lp(d,a,T),g=g.next}while(g!==f)}Er(o,a,d);break;case 1:if(!Kt&&(No(d,a),f=d.stateNode,typeof f.componentWillUnmount=="function"))try{f.props=d.memoizedProps,f.state=d.memoizedState,f.componentWillUnmount()}catch(M){et(d,a,M)}Er(o,a,d);break;case 21:Er(o,a,d);break;case 22:d.mode&1?(Kt=(f=Kt)||d.memoizedState!==null,Er(o,a,d),Kt=f):Er(o,a,d);break;default:Er(o,a,d)}}function W2(o){var a=o.updateQueue;if(a!==null){o.updateQueue=null;var d=o.stateNode;d===null&&(d=o.stateNode=new r9),a.forEach(function(f){var g=f9.bind(null,o,f);d.has(f)||(d.add(f),f.then(g,g))})}}function sr(o,a){var d=a.deletions;if(d!==null)for(var f=0;f";case lc:return":has("+(gp(o)||"")+")";case uc:return'[role="'+o.value+'"]';case dc:return'"'+o.value+'"';case cc:return'[data-testname="'+o.value+'"]';default:throw Error(l(365))}}function X2(o,a){var d=[];o=[o,0];for(var f=0;fg&&(g=T),f&=~w}if(f=g,f=Ot()-f,f=(120>f?120:480>f?480:1080>f?1080:1920>f?1920:3e3>f?3e3:4320>f?4320:1960*o9(f/1960))-f,10o?16:o,_i===null)var f=!1;else{if(o=_i,_i=null,mc=0,Ee&6)throw Error(l(331));var g=Ee;for(Ee|=4,ae=o.current;ae!==null;){var w=ae,T=w.child;if(ae.flags&16){var M=w.deletions;if(M!==null){for(var G=0;GOt()-Sp?ws(o,0):vp|=d),pn(o,a)}function oy(o,a){a===0&&(o.mode&1?(a=Mu,Mu<<=1,!(Mu&130023424)&&(Mu=4194304)):a=1);var d=$t();o=wr(o,a),o!==null&&(Ha(o,a,d),pn(o,d))}function h9(o){var a=o.memoizedState,d=0;a!==null&&(d=a.retryLane),oy(o,d)}function f9(o,a){var d=0;switch(o.tag){case 13:var f=o.stateNode,g=o.memoizedState;g!==null&&(d=g.retryLane);break;case 19:f=o.stateNode;break;default:throw Error(l(314))}f!==null&&f.delete(a),oy(o,d)}var ay;ay=function(o,a,d){if(o!==null)if(o.memoizedProps!==a.pendingProps||cn.current)hn=!0;else{if(!(o.lanes&d)&&!(a.flags&128))return hn=!1,e9(o,a,d);hn=!!(o.flags&131072)}else hn=!1,Ze&&a.flags&1048576&&Um(a,zu,a.index);switch(a.lanes=0,a.tag){case 2:var f=a.type;nc(o,a),o=a.pendingProps;var g=yo(a,Ht.current);Co(a,d),g=Kf(null,a,f,o,g,d);var w=$f();return a.flags|=1,typeof g=="object"&&g!==null&&typeof g.render=="function"&&g.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,dn(f)?(w=!0,Fu(a)):w=!1,a.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,Uf(a),g.updater=ec,a.stateNode=g,g._reactInternals=a,Zf(a,f,o,d),a=rp(null,a,f,!0,w,d)):(a.tag=0,Ze&&w&&Tf(a),tn(null,a,g,d),a=a.child),a;case 16:f=a.elementType;e:{switch(nc(o,a),o=a.pendingProps,g=f._init,f=g(f._payload),a.type=f,g=a.tag=g9(f),o=rr(f,o),g){case 0:a=np(null,a,f,o,d);break e;case 1:a=F2(null,a,f,o,d);break e;case 11:a=R2(null,a,f,o,d);break e;case 14:a=T2(null,a,f,rr(f.type,o),d);break e}throw Error(l(306,f,""))}return a;case 0:return f=a.type,g=a.pendingProps,g=a.elementType===f?g:rr(f,g),np(o,a,f,g,d);case 1:return f=a.type,g=a.pendingProps,g=a.elementType===f?g:rr(f,g),F2(o,a,f,g,d);case 3:e:{if(A2(a),o===null)throw Error(l(387));f=a.pendingProps,w=a.memoizedState,g=w.element,qm(o,a),$u(a,f,null,d);var T=a.memoizedState;if(f=T.element,Qe&&w.isDehydrated)if(w={element:f,isDehydrated:!1,cache:T.cache,pendingSuspenseBoundaries:T.pendingSuspenseBoundaries,transitions:T.transitions},a.updateQueue.baseState=w,a.memoizedState=w,a.flags&256){g=Po(Error(l(423)),a),a=M2(o,a,f,d,g);break e}else if(f!==g){g=Po(Error(l(424)),a),a=M2(o,a,f,d,g);break e}else for(Qe&&(Dn=gx(a.stateNode.containerInfo),En=a,Ze=!0,nr=null,Va=!1),d=Km(a,null,f,d),a.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(xo(),f===g){a=Hr(o,a,d);break e}tn(o,a,f,d)}a=a.child}return a;case 5:return Jm(a),o===null&&Lf(a),f=a.type,g=a.pendingProps,w=o!==null?o.memoizedProps:null,T=g.children,it(f,g)?T=null:w!==null&&it(f,w)&&(a.flags|=32),L2(o,a),tn(o,a,T,d),a.child;case 6:return o===null&&Lf(a),null;case 13:return I2(o,a,d);case 4:return zf(a,a.stateNode.containerInfo),f=a.pendingProps,o===null?a.child=wo(a,null,f,d):tn(o,a,f,d),a.child;case 11:return f=a.type,g=a.pendingProps,g=a.elementType===f?g:rr(f,g),R2(o,a,f,g,d);case 7:return tn(o,a,a.pendingProps,d),a.child;case 8:return tn(o,a,a.pendingProps.children,d),a.child;case 12:return tn(o,a,a.pendingProps.children,d),a.child;case 10:e:{if(f=a.type._context,g=a.pendingProps,w=a.memoizedProps,T=g.value,$m(a,f,T),w!==null)if(tr(w.value,T)){if(w.children===g.children&&!cn.current){a=Hr(o,a,d);break e}}else for(w=a.child,w!==null&&(w.return=a);w!==null;){var M=w.dependencies;if(M!==null){T=w.child;for(var G=M.firstContext;G!==null;){if(G.context===f){if(w.tag===1){G=Gr(-1,d&-d),G.tag=2;var ee=w.updateQueue;if(ee!==null){ee=ee.shared;var ue=ee.pending;ue===null?G.next=G:(G.next=ue.next,ue.next=G),ee.pending=G}}w.lanes|=d,G=w.alternate,G!==null&&(G.lanes|=d),Df(w.return,d,a),M.lanes|=d;break}G=G.next}}else if(w.tag===10)T=w.type===a.type?null:w.child;else if(w.tag===18){if(T=w.return,T===null)throw Error(l(341));T.lanes|=d,M=T.alternate,M!==null&&(M.lanes|=d),Df(T,d,a),T=w.sibling}else T=w.child;if(T!==null)T.return=w;else for(T=w;T!==null;){if(T===a){T=null;break}if(w=T.sibling,w!==null){w.return=T.return,T=w;break}T=T.return}w=T}tn(o,a,g.children,d),a=a.child}return a;case 9:return g=a.type,f=a.pendingProps.children,Co(a,d),g=jn(g),f=f(g),a.flags|=1,tn(o,a,f,d),a.child;case 14:return f=a.type,g=rr(f,a.pendingProps),g=rr(f.type,g),T2(o,a,f,g,d);case 15:return O2(o,a,a.type,a.pendingProps,d);case 17:return f=a.type,g=a.pendingProps,g=a.elementType===f?g:rr(f,g),nc(o,a),a.tag=1,dn(f)?(o=!0,Fu(a)):o=!1,Co(a,d),w2(a,f,g),Zf(a,f,g,d),rp(null,a,f,!0,o,d);case 19:return j2(o,a,d);case 22:return b2(o,a,d)}throw Error(l(156,a.tag))};function ly(o,a){return Ef(o,a)}function p9(o,a,d,f){this.tag=o,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Gn(o,a,d,f){return new p9(o,a,d,f)}function Np(o){return o=o.prototype,!(!o||!o.isReactComponent)}function g9(o){if(typeof o=="function")return Np(o)?1:0;if(o!=null){if(o=o.$$typeof,o===C)return 11;if(o===k)return 14}return 2}function Ei(o,a){var d=o.alternate;return d===null?(d=Gn(o.tag,a,o.key,o.mode),d.elementType=o.elementType,d.type=o.type,d.stateNode=o.stateNode,d.alternate=o,o.alternate=d):(d.pendingProps=a,d.type=o.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=o.flags&14680064,d.childLanes=o.childLanes,d.lanes=o.lanes,d.child=o.child,d.memoizedProps=o.memoizedProps,d.memoizedState=o.memoizedState,d.updateQueue=o.updateQueue,a=o.dependencies,d.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},d.sibling=o.sibling,d.index=o.index,d.ref=o.ref,d}function xc(o,a,d,f,g,w){var T=2;if(f=o,typeof o=="function")Np(o)&&(T=1);else if(typeof o=="string")T=5;else e:switch(o){case p:return ks(d.children,g,w,a);case y:T=8,g|=8;break;case S:return o=Gn(12,d,a,g|2),o.elementType=S,o.lanes=w,o;case P:return o=Gn(13,d,a,g),o.elementType=P,o.lanes=w,o;case E:return o=Gn(19,d,a,g),o.elementType=E,o.lanes=w,o;case _:return wc(d,g,w,a);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case x:T=10;break e;case m:T=9;break e;case C:T=11;break e;case k:T=14;break e;case v:T=16,f=null;break e}throw Error(l(130,o==null?o:typeof o,""))}return a=Gn(T,d,a,g),a.elementType=o,a.type=f,a.lanes=w,a}function ks(o,a,d,f){return o=Gn(7,o,f,a),o.lanes=d,o}function wc(o,a,d,f){return o=Gn(22,o,f,a),o.elementType=_,o.lanes=d,o.stateNode={isHidden:!1},o}function Rp(o,a,d){return o=Gn(6,o,null,a),o.lanes=d,o}function Tp(o,a,d){return a=Gn(4,o.children!==null?o.children:[],o.key,a),a.lanes=d,a.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},a}function m9(o,a,d,f,g){this.tag=a,this.containerInfo=o,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=ce,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Cf(0),this.expirationTimes=Cf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Cf(0),this.identifierPrefix=f,this.onRecoverableError=g,Qe&&(this.mutableSourceEagerHydrationData=null)}function uy(o,a,d,f,g,w,T,M,G){return o=new m9(o,a,d,M,G),a===1?(a=1,w===!0&&(a|=8)):a=0,w=Gn(3,null,null,a),o.current=w,w.stateNode=o,w.memoizedState={element:f,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},Uf(w),o}function cy(o){if(!o)return vi;o=o._reactInternals;e:{if(I(o)!==o||o.tag!==1)throw Error(l(170));var a=o;do{switch(a.tag){case 3:a=a.stateNode.context;break e;case 1:if(dn(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break e}}a=a.return}while(a!==null);throw Error(l(171))}if(o.tag===1){var d=o.type;if(dn(d))return Fm(o,d,a)}return a}function dy(o){var a=o._reactInternals;if(a===void 0)throw typeof o.render=="function"?Error(l(188)):(o=Object.keys(o).join(","),Error(l(268,o)));return o=B(a),o===null?null:o.stateNode}function hy(o,a){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var d=o.retryLane;o.retryLane=d!==0&&d=ee&&w>=ve&&g<=ue&&T<=se){o.splice(a,1);break}else if(f!==ee||d.width!==G.width||seT){if(!(w!==ve||d.height!==G.height||ueg)){ee>f&&(G.width+=ee-f,G.x=f),uew&&(G.height+=ve-w,G.y=w),sed&&(d=T)),T ")+` - -No matching component was found for: - `)+o.join(" > ")}return null},n.getPublicRootInstance=function(o){if(o=o.current,!o.child)return null;switch(o.child.tag){case 5:return re(o.child.stateNode);default:return o.child.stateNode}},n.injectIntoDevTools=function(o){if(o={bundleType:o.bundleType,version:o.version,rendererPackageName:o.rendererPackageName,rendererConfig:o.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:u.ReactCurrentDispatcher,findHostInstanceByFiber:y9,findFiberByHostInstance:o.findFiberByHostInstance||v9,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")o=!1;else{var a=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(a.isDisabled||!a.supportsFiber)o=!0;else{try{Du=a.inject(o),Sr=a}catch{}o=!!a.checkDCE}}return o},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(o,a,d,f){if(!Ua)throw Error(l(363));o=mp(o,a);var g=KS(o,d,f).disconnect;return{disconnect:function(){g()}}},n.registerMutableSourceForHydration=function(o,a){var d=a._getVersion;d=d(a._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[a,d]:o.mutableSourceEagerHydrationData.push(a,d)},n.runWithPriority=function(o,a){var d=Le;try{return Le=o,a()}finally{Le=d}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(o,a,d,f){var g=a.current,w=$t(),T=Ci(g);return d=cy(d),a.context===null?a.context=d:a.pendingContext=d,a=Gr(w,T),a.payload={element:o},f=f===void 0?null:f,f!==null&&(a.callback=f),o=xi(g,a,T),o!==null&&(Bn(o,g,T,w),Ku(o,g,T)),T},n};RS.exports=bO;var LO=RS.exports;const FO=Yd(LO);var TS={exports:{}},go={};/** - * @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. - */go.ConcurrentRoot=1;go.ContinuousEventPriority=4;go.DefaultEventPriority=16;go.DiscreteEventPriority=1;go.IdleEventPriority=536870912;go.LegacyRoot=0;TS.exports=go;var OS=TS.exports;const n3={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let r3=!1,i3=!1;const km=".react-konva-event",AO=`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 -`,MO=`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 -`,IO={};function ff(t,e,n=IO){if(!r3&&"zIndex"in e&&(console.warn(MO),r3=!0),!i3&&e.draggable){var r=e.x!==void 0||e.y!==void 0,i=e.onDragEnd||e.onDragMove;r&&!i&&(console.warn(AO),i3=!0)}for(var s in n)if(!n3[s]){var l=s.slice(0,2)==="on",u=n[s]!==e[s];if(l&&u){var c=s.substr(2).toLowerCase();c.substr(0,7)==="content"&&(c="content"+c.substr(7,1).toUpperCase()+c.substr(8)),t.off(c,n[s])}var h=!e.hasOwnProperty(s);h&&t.setAttr(s,void 0)}var p=e._useStrictMode,y={},S=!1;const x={};for(var s in e)if(!n3[s]){var l=s.slice(0,2)==="on",m=n[s]!==e[s];if(l&&m){var c=s.substr(2).toLowerCase();c.substr(0,7)==="content"&&(c="content"+c.substr(7,1).toUpperCase()+c.substr(8)),e[s]&&(x[c]=e[s])}!l&&(e[s]!==n[s]||p&&e[s]!==t.getAttr(s))&&(S=!0,y[s]=e[s])}S&&(t.setAttrs(y),ps(t));for(var c in x)t.on(c+km,x[c])}function ps(t){if(!ke.Konva.autoDrawEnabled){var e=t.getLayer()||t.getStage();e&&e.batchDraw()}}const bS={},DO={};lu.Node.prototype._applyProps=ff;function jO(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),ps(t)}function UO(t,e,n){let r=lu[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=lu.Group);const i={},s={};for(var l in e){var u=l.slice(0,2)==="on";u?s[l]=e[l]:i[l]=e[l]}const c=new r(i);return ff(c,s),c}function zO(t,e,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${t}"`)}function BO(t,e,n){return!1}function GO(t){return t}function HO(){return null}function VO(){return null}function WO(t,e,n,r){return DO}function KO(){}function $O(t){}function QO(t,e){return!1}function qO(){return bS}function YO(){return bS}const XO=setTimeout,JO=clearTimeout,ZO=-1;function eb(t,e){return!1}const tb=!1,nb=!0,rb=!0;function ib(t,e){e.parent===t?e.moveToTop():t.add(e),ps(t)}function sb(t,e){e.parent===t?e.moveToTop():t.add(e),ps(t)}function LS(t,e,n){e._remove(),t.add(e),e.setZIndex(n.getZIndex()),ps(t)}function ob(t,e,n){LS(t,e,n)}function ab(t,e){e.destroy(),e.off(km),ps(t)}function lb(t,e){e.destroy(),e.off(km),ps(t)}function ub(t,e,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function cb(t,e,n){}function db(t,e,n,r,i){ff(t,i,r)}function hb(t){t.hide(),ps(t)}function fb(t){}function pb(t,e){(e.visible==null||e.visible)&&t.show()}function gb(t,e){}function mb(t){}function yb(){}const vb=()=>OS.DefaultEventPriority,Sb=Object.freeze(Object.defineProperty({__proto__:null,appendChild:ib,appendChildToContainer:sb,appendInitialChild:jO,cancelTimeout:JO,clearContainer:mb,commitMount:cb,commitTextUpdate:ub,commitUpdate:db,createInstance:UO,createTextInstance:zO,detachDeletedInstance:yb,finalizeInitialChildren:BO,getChildHostContext:YO,getCurrentEventPriority:vb,getPublicInstance:GO,getRootHostContext:qO,hideInstance:hb,hideTextInstance:fb,idlePriority:Pl.unstable_IdlePriority,insertBefore:LS,insertInContainerBefore:ob,isPrimaryRenderer:tb,noTimeout:ZO,now:Pl.unstable_now,prepareForCommit:HO,preparePortalMount:VO,prepareUpdate:WO,removeChild:ab,removeChildFromContainer:lb,resetAfterCommit:KO,resetTextContent:$O,run:Pl.unstable_runWithPriority,scheduleTimeout:XO,shouldDeprioritizeSubtree:QO,shouldSetTextContent:eb,supportsMutation:rb,unhideInstance:pb,unhideTextInstance:gb,warnsIfNotActing:nb},Symbol.toStringTag,{value:"Module"}));var xb=Object.defineProperty,wb=Object.defineProperties,_b=Object.getOwnPropertyDescriptors,s3=Object.getOwnPropertySymbols,Cb=Object.prototype.hasOwnProperty,kb=Object.prototype.propertyIsEnumerable,o3=(t,e,n)=>e in t?xb(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,a3=(t,e)=>{for(var n in e||(e={}))Cb.call(e,n)&&o3(t,n,e[n]);if(s3)for(var n of s3(e))kb.call(e,n)&&o3(t,n,e[n]);return t},Eb=(t,e)=>wb(t,_b(e)),l3,u3;typeof window<"u"&&((l3=window.document)!=null&&l3.createElement||((u3=window.navigator)==null?void 0:u3.product)==="ReactNative")?V.useLayoutEffect:V.useEffect;function FS(t,e,n){if(!t)return;if(n(t)===!0)return t;let r=t.child;for(;r;){const i=FS(r,e,n);if(i)return i;r=r.sibling}}function AS(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const c3=console.error;console.error=function(){const t=[...arguments].join("");if(t!=null&&t.startsWith("Warning:")&&t.includes("useContext")){console.error=c3;return}return c3.apply(this,arguments)};const Em=AS(V.createContext(null));class MS extends V.Component{render(){return V.createElement(Em.Provider,{value:this._reactInternals},this.props.children)}}function Pb(){const t=V.useContext(Em);if(t===null)throw new Error("its-fine: useFiber must be called within a !");const e=V.useId();return V.useMemo(()=>{for(const r of[t,t==null?void 0:t.alternate]){if(!r)continue;const i=FS(r,!1,s=>{let l=s.memoizedState;for(;l;){if(l.memoizedState===e)return!0;l=l.next}});if(i)return i}},[t,e])}function Nb(){const t=Pb(),[e]=V.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!==Em&&!e.has(i)&&e.set(i,V.useContext(AS(i)))}n=n.return}return e}function Rb(){const t=Nb();return V.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>r=>V.createElement(e,null,V.createElement(n.Provider,Eb(a3({},r),{value:t.get(n)}))),e=>V.createElement(MS,a3({},e))),[t])}function Tb(t){const e=Mt.useRef({});return Mt.useLayoutEffect(()=>{e.current=t}),Mt.useLayoutEffect(()=>()=>{e.current={}},[]),e.current}const Ob=t=>{const e=Mt.useRef(null),n=Mt.useRef(null),r=Mt.useRef(null),i=Tb(t),s=Rb(),l=u=>{const{forwardedRef:c}=t;c&&(typeof c=="function"?c(u):c.current=u)};return Mt.useLayoutEffect(()=>(n.current=new lu.Stage({width:t.width,height:t.height,container:e.current}),l(n.current),r.current=El.createContainer(n.current,OS.LegacyRoot,!1,null),El.updateContainer(Mt.createElement(s,{},t.children),r.current),()=>{lu.isBrowser&&(l(null),El.updateContainer(null,r.current,null),n.current.destroy())}),[]),Mt.useLayoutEffect(()=>{l(n.current),ff(n.current,t,i),El.updateContainer(Mt.createElement(s,{},t.children),r.current,null)}),Mt.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})},bb="Layer",Lb="Rect",Fb="Image",Ab="Text",Mb="Transformer",El=FO(Sb);El.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:Mt.version,rendererPackageName:"react-konva"});const Ib=Mt.forwardRef((t,e)=>Mt.createElement(MS,{},Mt.createElement(Ob,{...t,forwardedRef:e}))),IS=rm(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}})})),Db=({url:t,width:e,height:n})=>{const[r,i]=V.useState(null);return V.useEffect(()=>{const s=new window.Image;s.crossOrigin="Anonymous",s.src=t,s.onload=()=>{i(s)}},[t]),r?N.jsx(Fb,{image:r,x:0,y:0,width:e,height:n}):null},d3=[{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 jb(){var v,_;const{activeCover:t,addLayer:e,updateLayer:n,deleteLayer:r,selectedLayer:i,setSelectedLayer:s}=IS(),l=V.useRef(null),[u,c]=V.useState(.5),[h,p]=V.useState("title"),[y,S]=V.useState(""),[x,m]=V.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 C=()=>{if(!y.trim())return;const R={id:`text-${Date.now()}`,type:"text",x:t.width/2,y:t.height/2,content:y,fontSize:h==="title"?72:36,fontFamily:x,fill:h==="title"?"#ffffff":"#f0f0f0",rotation:0,opacity:1};e(R),S("")},P=()=>{const R=l.current;if(R){const b=R.toDataURL({pixelRatio:2}),A=document.createElement("a");A.download=`${t.title.replace(/\s+/g,"-")}-cover.png`,A.href=b,A.click()}},E=800,k=t.height/t.width*E;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:P,className:"btn-primary flex items-center gap-2",children:[N.jsx(c8,{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(Ib,{ref:l,width:E,height:k,scaleX:u,scaleY:u,children:N.jsxs(bb,{children:[N.jsx(Lb,{x:0,y:0,width:t.width,height:t.height,fill:t.backgroundColor}),t.backgroundImage&&N.jsx(Db,{url:t.backgroundImage,width:t.width,height:t.height}),t.layers.map(R=>N.jsx(Ab,{id:R.id,x:R.x,y:R.y,text:R.content,fontSize:R.fontSize,fontFamily:R.fontFamily,fill:R.fill,rotation:R.rotation,opacity:R.opacity,draggable:!0,onClick:()=>s(R.id),onTap:()=>s(R.id)},R.id)),i&&N.jsx(Mb,{nodes:t.layers.filter(R=>R.id===i).map(R=>document.getElementById(R.id))})]})})}),N.jsxs("div",{className:"mt-4 flex items-center justify-center gap-4",children:[N.jsx("button",{onClick:()=>c(Math.max(.2,u-.1)),className:"btn-secondary px-3",children:"-"}),N.jsxs("span",{className:"text-sm text-gray-600",children:[Math.round(u*100),"%"]}),N.jsx("button",{onClick:()=>c(Math.min(1,u+.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(ld,{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:()=>p("title"),className:`flex-1 py-2 rounded-lg text-sm font-medium transition-colors ${h==="title"?"bg-primary-100 text-primary-700":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:"Title"}),N.jsx("button",{onClick:()=>p("author"),className:`flex-1 py-2 rounded-lg text-sm font-medium transition-colors ${h==="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:x,onChange:R=>m(R.target.value),className:"input",children:d3.map(R=>N.jsx("option",{value:R.name,children:R.label},R.name))})]}),N.jsxs("div",{children:[N.jsx("label",{className:"label",children:"Text Content"}),N.jsx("input",{type:"text",value:y,onChange:R=>S(R.target.value),placeholder:h==="title"?"Book Title":"Author Name",className:"input",onKeyPress:R=>R.key==="Enter"&&C()})]}),N.jsx("button",{onClick:C,disabled:!y.trim(),className:"btn-primary w-full",children:"Add Text Layer"})]})]}),i&&((v=t.layers.find(R=>R.id===i))==null?void 0:v.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(ld,{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:((_=t.layers.find(R=>R.id===i))==null?void 0:_.fontFamily)||"Roboto",onChange:R=>n(i,{fontFamily:R.target.value}),className:"input",children:d3.map(R=>N.jsx("option",{value:R.name,children:R.label},R.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((R,b)=>{var A;return N.jsxs("div",{className:`flex items-center justify-between p-2 rounded-lg border cursor-pointer transition-colors ${i===R.id?"border-primary-500 bg-primary-50":"border-gray-200 hover:bg-gray-50"}`,onClick:()=>s(R.id),children:[N.jsxs("div",{className:"flex items-center gap-2",children:[N.jsx(ld,{className:"w-4 h-4 text-gray-400"}),N.jsx("span",{className:"text-sm truncate max-w-[150px]",children:((A=R.content)==null?void 0:A.substring(0,20))||`Layer ${b+1}`})]}),N.jsx("button",{onClick:O=>{O.stopPropagation(),r(R.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"})})})]},R.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 Tn=nt.create({baseURL:"/api",headers:{"Content-Type":"application/json"}});Tn.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 C0={getAll:()=>Tn.get("/covers"),upload:t=>{const e=new FormData;return e.append("image",t),Tn.post("/covers/upload",e,{headers:{"Content-Type":"multipart/form-data"}})},delete:t=>Tn.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)}),Tn.post("/covers/process",n,{headers:{"Content-Type":"multipart/form-data"}})},generate:(t,e)=>Tn.post("/covers/generate",{prompt:t,genre:e})},pf={getGenres:()=>Tn.get("/books/genres"),getGenre:t=>Tn.get(`/books/genres/${t}`),generateOutline:(t,e,n)=>Tn.post("/books/outline",{genre:t,idea:e,title:n}),generateChapter:(t,e,n,r)=>Tn.post("/books/chapter",{genre:t,chapterTitle:e,chapterSummary:n,previousContent:r}),expand:(t,e)=>Tn.post("/books/expand",{text:t,instruction:e}),generateCharacters:(t,e)=>Tn.post("/books/characters",{genre:t,storyIdea:e}),generatePlot:(t,e,n)=>Tn.post("/books/plot",{genre:t,currentPlot:e,issue:n})};function Ub(){const[t,e]=V.useState("gallery"),{activeCover:n,setActiveCover:r}=IS(),i=em(),{data:s}=u8({queryKey:["covers"],queryFn:async()=>(await C0.getAll()).data.covers}),l=PC({mutationFn:async h=>(await C0.generate(h)).data,onSuccess:()=>{i.invalidateQueries({queryKey:["covers"]}),e("gallery")}}),u=h=>{l.mutate(h)},c=h=>{const p={id:`cover-${Date.now()}`,title:"New Book",author:"Author Name",backgroundImage:h,backgroundColor:"#ffffff",width:1600,height:2400,layers:[],createdAt:new Date,updatedAt:new Date};r(p),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(tm,{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(ld,{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(eo,{className:"w-4 h-4"}),"AI Generate"]})]})]}),t==="gallery"&&N.jsx(RP,{covers:s||[],onSelect:c,onDelete:h=>{C0.delete(h).then(()=>{i.invalidateQueries({queryKey:["covers"]})})}}),t==="editor"&&n&&N.jsx(jb,{}),t==="ai"&&N.jsx(zb,{onGenerate:u,isGenerating:l.isPending})]})}function zb({onGenerate:t,isGenerating:e}){const[n,r]=V.useState(""),[i,s]=V.useState("modern"),l=[{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:"🎨"}],u=[{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"}],c=p=>{r(p)},h=()=>{if(n.trim()){const p=`${n}, ${i} style, professional book cover design, high quality, detailed`;t(p)}};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:l.map(p=>N.jsxs("button",{onClick:()=>s(p.id),className:`p-3 rounded-lg border text-center transition-colors ${i===p.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:p.icon}),N.jsx("p",{className:"text-xs mt-1",children:p.name})]},p.id))})]}),N.jsxs("div",{className:"mb-6",children:[N.jsx("label",{className:"label",children:"Describe Your Cover"}),N.jsx("textarea",{value:n,onChange:p=>r(p.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:u.map(p=>N.jsxs("button",{onClick:()=>c(p.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:p.genre}),N.jsx("p",{className:"text-sm text-gray-500 truncate",children:p.prompt})]},p.genre))})]}),N.jsxs("button",{onClick:h,disabled:!n.trim()||e,className:"btn-primary w-full py-3 flex items-center justify-center gap-2",children:[N.jsx(eo,{className:"w-5 h-5"}),e?"Generating...":"Generate Cover"]})]})})}function Bb({genres:t,onSelect:e}){const[n,r]=V.useState(""),[i,s]=V.useState(""),[l,u]=V.useState(""),c=h=>{h.preventDefault(),n&&l.trim()&&e(n,l.trim(),i.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(zd,{className:"w-5 h-5"}),"Select Your Genre"]}),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:()=>r(h.id),className:`p-4 rounded-xl border-2 text-left transition-all ${n===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:h.name}),N.jsx("p",{className:"text-xs text-gray-500 mt-1 line-clamp-2",children: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(d8,{className:"w-5 h-5"}),"Book Details"]}),N.jsxs("form",{onSubmit:c,className:"space-y-4",children:[N.jsxs("div",{children:[N.jsx("label",{className:"label",children:"Book Title (optional)"}),N.jsx("input",{type:"text",value:i,onChange:h=>s(h.target.value),placeholder:"My Amazing Book",className:"input"})]}),N.jsxs("div",{children:[N.jsxs("label",{className:"label",children:["Core Idea ",N.jsx("span",{className:"text-red-500",children:"*"})]}),N.jsx("textarea",{value:l,onChange:h=>u(h.target.value),placeholder:"Describe your book idea... What's the story about? Who are the main characters? What conflict drives the narrative?",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:"})," The more details you provide, the better the AI can generate your outline and content."]})}),N.jsx("button",{type:"submit",disabled:!n||!l.trim(),className:"btn-primary w-full py-3",children:"Generate Outline"})]})]})})]})}const gf=rm(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(l=>l.number===e?{...l,content:n,isGenerated:!0}:l)},s={...r.activeBook,outline:i,updatedAt:new Date};return{activeBook:s,books:r.books.map(l=>l.id===r.activeBook.id?s:l)}}),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 Gb({book:t,onComplete:e}){var h;const{activeBook:n}=gf(),[r,i]=V.useState(!1),[s,l]=V.useState(""),u=n==null?void 0:n.outline,c=async()=>{var p,y;i(!0),l("");try{const x=(await pf.generateOutline(t.genre,t.idea,t.title)).data.outline;e(x)}catch(S){l(((y=(p=S.response)==null?void 0:p.data)==null?void 0:y.error)||"Failed to generate outline")}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||"Untitled Book"}),N.jsxs("p",{className:"text-sm text-gray-600 mt-1 capitalize",children:["Genre: ",t.genre]}),N.jsx("p",{className:"text-sm text-gray-500 mt-2 line-clamp-2",children:t.idea})]}),!u&&N.jsx("button",{onClick:c,disabled:r,className:"btn-primary flex items-center gap-2",children:r?N.jsxs(N.Fragment,{children:[N.jsx(IC,{className:"w-4 h-4 animate-spin"}),"Generating..."]}):N.jsxs(N.Fragment,{children:[N.jsx(eo,{className:"w-4 h-4"}),"Generate Outline"]})})]})}),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})}),u&&N.jsxs("div",{className:"card",children:[N.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[N.jsx(TC,{className:"w-5 h-5 text-green-500"}),N.jsxs("h3",{className:"text-lg font-semibold text-gray-900",children:["Generated Outline: ",u.title||t.title]})]}),u.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:"Logline"}),N.jsx("p",{className:"text-gray-900 italic",children:u.logline})]}),N.jsxs("div",{children:[N.jsx("h4",{className:"text-sm font-medium text-gray-500 mb-4",children:"Chapter Outline"}),N.jsx("div",{className:"space-y-3",children:(h=u.chapters)==null?void 0:h.map((p,y)=>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:p.number||y+1}),N.jsxs("div",{className:"flex-1",children:[N.jsx("h5",{className:"font-medium text-gray-900",children:p.title||`Chapter ${p.number||y+1}`}),N.jsx("p",{className:"text-sm text-gray-600 mt-1",children:p.summary||"No summary available"})]})]})},y))})]}),N.jsx("div",{className:"mt-6 flex items-center justify-end gap-3",children:N.jsx("p",{className:"text-sm text-gray-500",children:"Ready to start writing! Navigate to the Write tab to begin."})})]}),!u&&!r&&N.jsxs("div",{className:"card text-center py-12",children:[N.jsx(eo,{className:"w-12 h-12 text-gray-300 mx-auto mb-4"}),N.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Ready to Generate"}),N.jsx("p",{className:"text-gray-500 mt-2 max-w-md mx-auto",children:'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.'})]})]})}function Hb(){const{activeBook:t,updateChapterContent:e,setCurrentChapter:n}=gf(),[r,i]=V.useState(!1),[s,l]=V.useState(!1);if(!t||!t.outline)return N.jsx("div",{className:"card text-center py-12",children:N.jsx("p",{className:"text-gray-500",children:"Generate an outline first to start writing your book."})});const u=t.outline.chapters.find(S=>S.number===t.currentChapter),c=()=>{t.currentChapter>1&&n(t.currentChapter-1)},h=()=>{const S=t.outline.chapters.length;t.currentChapter{var S;if(!(!u||!t)){i(!0);try{const x=(S=t.outline)==null?void 0:S.chapters.find(C=>C.number===t.currentChapter-1),m=await pf.generateChapter(t.genre,u.title,u.summary,x==null?void 0:x.content);e(t.currentChapter,m.data.content)}catch(x){console.error("Failed to generate chapter:",x)}finally{i(!1)}}},y=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:"Chapters"}),N.jsx("div",{className:"space-y-2",children:t.outline.chapters.map(S=>N.jsx("button",{onClick:()=>n(S.number),className:`w-full text-left p-3 rounded-lg transition-colors ${S.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:S.number}),N.jsxs("div",{className:"flex-1 min-w-0",children:[N.jsx("p",{className:"text-sm font-medium truncate",children:S.title}),S.content&&N.jsx("span",{className:"text-xs text-green-600",children:"✓ Written"})]})]})},S.number))})]}),N.jsxs("div",{className:"card",children:[N.jsx("h4",{className:"font-medium text-gray-900 mb-2",children:"Chapter Summary"}),N.jsx("p",{className:"text-sm text-gray-600",children:u==null?void 0:u.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:c,disabled:t.currentChapter<=1,className:"p-2 rounded-lg hover:bg-gray-100 disabled:opacity-50 disabled:cursor-not-allowed",children:N.jsx(OC,{className:"w-5 h-5"})}),N.jsxs("div",{children:[N.jsx("h2",{className:"text-xl font-bold text-gray-900",children:u==null?void 0:u.title}),N.jsxs("p",{className:"text-sm text-gray-500",children:["Chapter ",t.currentChapter," of ",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(bC,{className:"w-5 h-5"})})]}),N.jsxs("div",{className:"flex items-center gap-2",children:[N.jsxs("button",{onClick:()=>l(!s),className:"btn-secondary flex items-center gap-2",children:[N.jsx(d8,{className:"w-4 h-4"}),"AI Assist"]}),N.jsxs("button",{onClick:p,disabled:r||!u,className:"btn-primary flex items-center gap-2",children:[N.jsx(eo,{className:"w-4 h-4"}),r?"Generating...":"Generate Chapter"]})]})]}),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:"AI Writing Assistant"}),N.jsxs("div",{className:"flex flex-wrap gap-2",children:[N.jsx("button",{onClick:y,className:"text-sm px-3 py-1.5 bg-white rounded-lg border border-gray-200 hover:border-accent-300 transition-colors",children:"✨ Expand this section"}),N.jsx("button",{className:"text-sm px-3 py-1.5 bg-white rounded-lg border border-gray-200 hover:border-accent-300 transition-colors",children:"📝 Improve prose"}),N.jsx("button",{className:"text-sm px-3 py-1.5 bg-white rounded-lg border border-gray-200 hover:border-accent-300 transition-colors",children:"💡 Add description"}),N.jsx("button",{className:"text-sm px-3 py-1.5 bg-white rounded-lg border border-gray-200 hover:border-accent-300 transition-colors",children:"🔄 Rewrite paragraph"})]})]}),N.jsx("div",{className:"min-h-[500px]",children:u!=null&&u.content?N.jsx("textarea",{value:u.content,onChange:S=>e(t.currentChapter,S.target.value),className:"w-full h-[600px] p-6 font-serif text-lg leading-relaxed border-0 focus:ring-0 resize-y outline-none",placeholder:"Start writing or use AI to generate this chapter..."}):N.jsx("div",{className:"h-[500px] flex items-center justify-center text-gray-400",children:N.jsxs("div",{className:"text-center",children:[N.jsx(eo,{className:"w-12 h-12 mx-auto mb-3 opacity-50"}),N.jsx("p",{children:'Click "Generate Chapter" to create content with AI'}),N.jsx("p",{className:"text-sm mt-1",children:"Or start writing manually"})]})})}),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:[u!=null&&u.content?u.content.split(/\s+/).length:0," ","words"]}),N.jsxs("span",{children:["Last updated:"," ",new Date(t.updatedAt).toLocaleDateString()]})]})]})})]})}function Vb(){const[t,e]=V.useState("genre"),{activeBook:n,setActiveBook:r,setOutline:i}=gf(),{data:s}=u8({queryKey:["genres"],queryFn:async()=>(await pf.getGenres()).data.genres}),l=(c,h,p)=>{const y={id:`book-${Date.now()}`,title:p,genre:c,idea:h,outline:null,characters:[],currentChapter:1,createdAt:new Date,updatedAt:new Date};r(y),e("outline")},u=c=>{n&&c&&(i(c),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:"Book Generator"}),N.jsx("p",{className:"text-gray-500 mt-1",children:"Generate book ideas and write with AI assistance"})]}),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(zd,{className:"w-4 h-4"}),N.jsx("span",{className:"hidden sm:inline",children:"Genre"})]}),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(AC,{className:"w-4 h-4"}),N.jsx("span",{className:"hidden sm:inline",children:"Outline"})]}),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(DC,{className:"w-4 h-4"}),N.jsx("span",{className:"hidden sm:inline",children:"Write"})]}),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(h8,{className:"w-4 h-4"}),N.jsx("span",{className:"hidden sm:inline",children:"Characters"})]})]})]}),t==="genre"&&N.jsx(Bb,{genres:s||[],onSelect:l}),t==="outline"&&n&&N.jsx(Gb,{book:n,onComplete:u}),t==="editor"&&n&&N.jsx(Hb,{}),t==="characters"&&n&&N.jsx(Wb,{})]})}function Wb(){const{activeBook:t,addCharacter:e}=gf(),[n,r]=V.useState(!1),i=async()=>{if(t){r(!0);try{const l=(await pf.generateCharacters(t.genre,t.idea)).data.characters;Array.isArray(l)&&l.forEach(u=>{e({name:u.name||"Unknown",role:u.role||"Supporting",traits:u.traits||[],motivation:u.motivation||"",backstory:u.backstory||""})})}catch(s){console.error("Failed to generate characters:",s)}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:"Character Development"}),N.jsxs("button",{onClick:i,disabled:n,className:"btn-primary flex items-center gap-2",children:[N.jsx(eo,{className:"w-4 h-4"}),n?"Generating...":"Generate Characters"]})]}),t.characters.length===0?N.jsxs("div",{className:"text-center py-8",children:[N.jsx(h8,{className:"w-12 h-12 text-gray-300 mx-auto mb-3"}),N.jsx("p",{className:"text-gray-500",children:'No characters yet. Click "Generate Characters" to create AI-suggested characters.'})]}):N.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:t.characters.map((s,l)=>{var u;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:s.name}),N.jsx("span",{className:`text-xs px-2 py-1 rounded-full ${s.role==="protagonist"?"bg-green-100 text-green-700":s.role==="antagonist"?"bg-red-100 text-red-700":"bg-gray-100 text-gray-600"}`,children:s.role})]}),N.jsxs("div",{className:"space-y-2 text-sm",children:[N.jsxs("div",{children:[N.jsx("span",{className:"text-gray-500",children:"Traits:"}),N.jsx("p",{className:"text-gray-700",children:((u=s.traits)==null?void 0:u.join(", "))||"N/A"})]}),N.jsxs("div",{children:[N.jsx("span",{className:"text-gray-500",children:"Motivation:"}),N.jsx("p",{className:"text-gray-700",children:s.motivation||"N/A"})]})]})]},l)})})]}):null}function Kb(){const[t]=V.useState("gpt-4o-mini"),[e]=V.useState("stable-diffusion-v1-6"),{t:n,i18n:r}=nm(),i=l=>{r.changeLanguage(l.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(MC,{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(LC,{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(jC,{className:"w-4 h-4"}),"Save Settings"]})})]})}function $b(){const{t}=nm(),{user:e,isAuthenticated:n,logout:r,checkAuth:i}=K8(),[s,l]=V.useState(!1);return V.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("div",{className:"flex items-center gap-2",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(zd,{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(tm,{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(zd,{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(UC,{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:()=>l(!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(U_,{children:[N.jsx(Cl,{path:"/",element:N.jsx(D_,{to:"/covers",replace:!0})}),N.jsx(Cl,{path:"/covers",element:N.jsx(Ub,{})}),N.jsx(Cl,{path:"/books",element:N.jsx(Vb,{})}),N.jsx(Cl,{path:"/settings",element:N.jsx(Kb,{})})]})}),N.jsx(NP,{isOpen:s,onClose:()=>l(!1)})]})}const{slice:Qb,forEach:qb}=[];function Yb(t){return qb.call(Qb.call(arguments,1),e=>{if(e)for(const n in e)t[n]===void 0&&(t[n]=e[n])}),t}function Xb(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 h3=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Jb=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 l=r.maxAge-0;if(Number.isNaN(l))throw new Error("maxAge should be a Number");s+=`; Max-Age=${Math.floor(l)}`}if(r.domain){if(!h3.test(r.domain))throw new TypeError("option domain is invalid");s+=`; Domain=${r.domain}`}if(r.path){if(!h3.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},f3={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=Jb(t,e,i)},read(t){const e=`${t}=`,n=document.cookie.split(";");for(let r=0;r-1&&(i=window.location.hash.substring(window.location.hash.indexOf("?")));const l=i.substring(1).split("&");for(let u=0;u0&&l[u].substring(0,c)===e&&(n=l[u].substring(c+1))}}return n}},tL={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 l=s.substring(1);if(e){const u=l.split("&");for(let c=0;c0&&u[c].substring(0,h)===e&&(r=u[c].substring(h+1))}}if(r)return r;if(!r&&n>-1){const u=s.match(/\/([a-zA-Z-]*)/g);return Array.isArray(u)?(i=u[typeof n=="number"?n:0])==null?void 0:i.replace("/",""):void 0}}}return r}};let Mo=null;const p3=()=>{if(Mo!==null)return Mo;try{if(Mo=typeof window<"u"&&window.localStorage!==null,!Mo)return!1;const t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{Mo=!1}return Mo};var nL={name:"localStorage",lookup(t){let{lookupLocalStorage:e}=t;if(e&&p3())return window.localStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupLocalStorage:n}=e;n&&p3()&&window.localStorage.setItem(n,t)}};let Io=null;const g3=()=>{if(Io!==null)return Io;try{if(Io=typeof window<"u"&&window.sessionStorage!==null,!Io)return!1;const t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Io=!1}return Io};var rL={name:"sessionStorage",lookup(t){let{lookupSessionStorage:e}=t;if(e&&g3())return window.sessionStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupSessionStorage:n}=e;n&&g3()&&window.sessionStorage.setItem(n,t)}},iL={name:"navigator",lookup(t){const e=[];if(typeof navigator<"u"){const{languages:n,userLanguage:r,language:i}=navigator;if(n)for(let s=0;s0?e:void 0}},sL={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}},oL={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}},aL={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 DS=!1;try{document.cookie,DS=!0}catch{}const jS=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];DS||jS.splice(1,1);const lL=()=>({order:jS,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:t=>t});class US{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=Yb(n,this.options||{},lL()),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(Zb),this.addDetector(eL),this.addDetector(nL),this.addDetector(rL),this.addDetector(iL),this.addDetector(sL),this.addDetector(oL),this.addDetector(aL),this.addDetector(tL)}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&&!Xb(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)}))}}US.type="languageDetector";const uL={coverDesigner:"Cover Designer",bookGenerator:"Book Generator",settings:"Settings",loginRegister:"Login / Register",logout:"Logout"},cL={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? "},dL={title:"Settings",language:"Language",languageSelect:"Select your preferred language",english:"English",spanish:"Español"},hL={nav:uL,auth:cL,settings:dL},fL={coverDesigner:"Diseñador de Portadas",bookGenerator:"Generador de Libros",settings:"Ajustes",loginRegister:"Entrar / Registrarse",logout:"Cerrar Sesión"},pL={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? "},gL={title:"Ajustes",language:"Idioma",languageSelect:"Selecciona tu idioma preferido",english:"Inglés",spanish:"Español"},mL={nav:fL,auth:pL,settings:gL};un.use(US).use(vk).init({resources:{en:{translation:hL},es:{translation:mL}},fallbackLng:"en",interpolation:{escapeValue:!1}});const yL=new fC({defaultOptions:{queries:{staleTime:5*60*1e3,retry:1}}});k0.createRoot(document.getElementById("root")).render(N.jsx(Mt.StrictMode,{children:N.jsx(pC,{client:yL,children:N.jsx(G_,{children:N.jsx($b,{})})})})); diff --git a/client/dist/assets/index-CZFZrYeL.css b/client/dist/assets/index-CZFZrYeL.css new file mode 100644 index 00000000..110e6d1e --- /dev/null +++ b/client/dist/assets/index-CZFZrYeL.css @@ -0,0 +1 @@ +*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.btn-primary{border-radius:.5rem;--tw-bg-opacity: 1;background-color:rgb(2 132 199 / var(--tw-bg-opacity, 1));padding:.5rem 1rem;font-weight:500;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1));transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.btn-primary:hover{--tw-bg-opacity: 1;background-color:rgb(3 105 161 / var(--tw-bg-opacity, 1))}.btn-secondary{border-radius:.5rem;border-width:1px;--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:.5rem 1rem;font-weight:500;--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1));transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.btn-secondary:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.card{border-radius:.75rem;border-width:1px;--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:1.5rem;--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.input{width:100%;border-radius:.5rem;border-width:1px;--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));padding:.5rem 1rem;outline:2px solid transparent;outline-offset:2px;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.input:focus{border-color:transparent;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-opacity: 1;--tw-ring-color: rgb(14 165 233 / var(--tw-ring-opacity, 1))}.label{margin-bottom:.25rem;display:block;font-size:.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.right-4{right:1rem}.top-0{top:0}.top-4{top:1rem}.top-6{top:1.5rem}.z-50{z-index:50}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-auto{margin-left:auto;margin-right:auto}.mb-12{margin-bottom:3rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.ml-2{margin-left:.5rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.aspect-\[2\/3\]{aspect-ratio:2/3}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-full{height:100%}.min-h-\[120px\]{min-height:120px}.min-h-\[150px\]{min-height:150px}.min-h-\[500px\]{min-height:500px}.min-h-screen{min-height:100vh}.w-10{width:2.5rem}.w-12{width:3rem}.w-16{width:4rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-8{width:2rem}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-7xl{max-width:80rem}.max-w-\[150px\]{max-width:150px}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.resize-y{resize:vertical}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-y-12>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(3rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(3rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-accent-200{--tw-border-opacity: 1;border-color:rgb(245 208 254 / var(--tw-border-opacity, 1))}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-primary-500{--tw-border-opacity: 1;border-color:rgb(14 165 233 / var(--tw-border-opacity, 1))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.bg-gray-300{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-primary-100{--tw-bg-opacity: 1;background-color:rgb(224 242 254 / var(--tw-bg-opacity, 1))}.bg-primary-50{--tw-bg-opacity: 1;background-color:rgb(240 249 255 / var(--tw-bg-opacity, 1))}.bg-primary-500{--tw-bg-opacity: 1;background-color:rgb(14 165 233 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-accent-50{--tw-gradient-from: #fdf4ff var(--tw-gradient-from-position);--tw-gradient-to: rgb(253 244 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary-50{--tw-gradient-from: #f0f9ff var(--tw-gradient-from-position);--tw-gradient-to: rgb(240 249 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary-500{--tw-gradient-from: #0ea5e9 var(--tw-gradient-from-position);--tw-gradient-to: rgb(14 165 233 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-accent-50{--tw-gradient-to: #fdf4ff var(--tw-gradient-to-position)}.to-accent-500{--tw-gradient-to: #d946ef var(--tw-gradient-to-position)}.to-primary-50{--tw-gradient-to: #f0f9ff var(--tw-gradient-to-position)}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-4{padding-bottom:1rem}.pb-6{padding-bottom:1.5rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-serif{font-family:ui-serif,Georgia,Cambria,Times New Roman,Times,serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-extrabold{font-weight:800}.font-medium{font-weight:500}.font-semibold{font-weight:600}.capitalize{text-transform:capitalize}.italic{font-style:italic}.leading-relaxed{line-height:1.625}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-primary-500{--tw-text-opacity: 1;color:rgb(14 165 233 / var(--tw-text-opacity, 1))}.text-primary-600{--tw-text-opacity: 1;color:rgb(2 132 199 / var(--tw-text-opacity, 1))}.text-primary-700{--tw-text-opacity: 1;color:rgb(3 105 161 / var(--tw-text-opacity, 1))}.text-primary-800{--tw-text-opacity: 1;color:rgb(7 89 133 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-red-800{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.no-underline{text-decoration-line:none}.opacity-0{opacity:0}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.\!outline{outline-style:solid!important}.outline{outline-style:solid}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}:root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400}body{margin:0;min-height:100vh;background-color:#f8fafc}.tiptap{min-height:500px}.tiptap p.is-editor-empty:first-child:before{content:attr(data-placeholder);float:left;color:#adb5bd;pointer-events:none;height:0}.tiptap p{text-indent:2rem;margin-bottom:1.5rem;line-height:1.8}.tiptap p:first-child{text-indent:0}.tiptap h1,.tiptap h2,.tiptap h3{text-align:center;text-indent:0;margin-top:2rem;margin-bottom:1rem}.tiptap blockquote{text-align:left;text-indent:0;margin-left:2rem;margin-right:2rem}.tiptap ul,.tiptap ol{text-align:left;text-indent:0;margin-left:2rem}.tiptap h1{font-size:2em;font-weight:700;margin:.67em 0}.tiptap h2{font-size:1.5em;font-weight:600;margin:.75em 0}.tiptap h3{font-size:1.25em;font-weight:600;margin:.83em 0}.tiptap ul{list-style:disc;padding-left:1.5em;margin:.5em 0}.tiptap ol{list-style:decimal;padding-left:1.5em;margin:.5em 0}.tiptap li{margin:.25em 0}.tiptap blockquote{border-left:3px solid #e5e7eb;padding-left:1em;margin:1em 0;color:#6b7280;font-style:italic}.tiptap hr{border:none;border-top:2px solid #e5e7eb;margin:1.5em 0}.tiptap p{margin:.5em 0}.hover\:scale-\[1\.02\]:hover{--tw-scale-x: 1.02;--tw-scale-y: 1.02;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-accent-300:hover{--tw-border-opacity: 1;border-color:rgb(240 171 252 / var(--tw-border-opacity, 1))}.hover\:border-gray-300:hover{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.hover\:border-gray-400:hover{--tw-border-opacity: 1;border-color:rgb(156 163 175 / var(--tw-border-opacity, 1))}.hover\:border-primary-300:hover{--tw-border-opacity: 1;border-color:rgb(125 211 252 / var(--tw-border-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-200:hover{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.hover\:bg-primary-100:hover{--tw-bg-opacity: 1;background-color:rgb(224 242 254 / var(--tw-bg-opacity, 1))}.hover\:bg-primary-50:hover{--tw-bg-opacity: 1;background-color:rgb(240 249 255 / var(--tw-bg-opacity, 1))}.hover\:bg-red-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:text-gray-700:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.hover\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:opacity-100{opacity:1}@media (min-width: 640px){.sm\:inline{display:inline}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}}@media (min-width: 768px){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width: 1024px){.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:col-span-3{grid-column:span 3 / span 3}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:px-8{padding-left:2rem;padding-right:2rem}}@media (min-width: 1280px){.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}} diff --git a/client/dist/assets/index-D3_QgWye.js b/client/dist/assets/index-D3_QgWye.js new file mode 100644 index 00000000..dee4849d --- /dev/null +++ b/client/dist/assets/index-D3_QgWye.js @@ -0,0 +1,453 @@ +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;nr[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>>1,oe=W[Y];if(0>>1;Y<_e;){var rt=2*(Y+1)-1,yt=W[rt],it=rt+1,F=W[it];if(0>i(yt,te))iti(F,yt)?(W[Y]=F,W[it]=te,Y=it):(W[Y]=yt,W[rt]=te,Y=rt);else if(iti(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()-RW||125Y?(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"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||!(2a||i[o]!==s[a]){var l=` +`+i[o].replace(" at new "," at ");return t.displayName&&l.includes("")&&(l=l.replace("",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"+e.valueOf().toString()+"",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>>=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;0n;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=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)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=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"),0Ul||(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>=o,i-=o,ss=1<<32-si(e)+i|n<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(;MM?(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;en?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<\/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;iwu&&(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;ri&&(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,10t?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;lLt()-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"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"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{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{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 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{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=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{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"&&nd()?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{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{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={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},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;st==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{for(let o=0;o-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{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(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.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.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={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},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;r0;)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(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=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{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{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`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{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.widthw.y+w.height||b.y+b.height1?(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];Qb.length){const I=b;b=w,w=I}for(let I=0;I{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;itypeof 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{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)){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('+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{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{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;o0&&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;o0?(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{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=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;a0}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;r0?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;yit.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-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;WeW&&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;qthis.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;YR?(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{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;i0)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;ithis.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{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||C0?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;i4){const l=this.getTensionPoints(),d=l.length;for(a=s?0:4,s||e.quadraticCurveTo(l[0],l[1],l[2],l[3]);a{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{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(g500)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;ih?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)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;yn[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))*(i0&&!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)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;l1&&(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]=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{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{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;n1&&(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;Eh)for(;b.length>0;){let P=0,A=oa(b).length,M="",I=0;for(;P>>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)&&Ef)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)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=1){const r=n[0].p0;e.moveTo(r.x,r.y)}for(let r=0;rt+`.${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;ii.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.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{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>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)>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)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;i255?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;wi&&(i=s),l=e[w+1],la&&(a=l),f=e[w+2],fh&&(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;wd?p:d;const y=o,g=s,x=360/g*Math.PI/180;for(let S=0;Sd?p:d;const y=o,g=s,x=0;let S,C;for(h=0;he&&(b=w,T=0,P=-1),i=0;i=0&&y=0&&g=0&&y=0&&g=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=0&&y=0&&g=n))for(let w=x;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=n))for(let w=x;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;s255?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;a255?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;r127&&(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;iD||k[O]!==_[D]){var G=` +`+k[O].replace(" at new "," at ");return u.displayName&&G.includes("")&&(G=G.replace("",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;0m;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>=O,k-=O,zi=1<<32-$r(c)+k|m<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(;HeHe?(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;cm?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++,0L1&&(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";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;vk&&(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,10u?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;GXt()-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=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||hek)){ne>v&&(G.width+=ne-v,G.x=v),he_&&(G.height+=Ce-_,G.y=_),aem&&(m=O)),O ")+` + +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 !");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>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(;de&&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);se)for(let s=0,o=0;oe&&((on)&&(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;nthis.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;ithis.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;nr.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=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;ai&&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;s0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos=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=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;se&&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;ln.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;nd.createAndFill()));for(let d=0;d=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{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o"+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{t[o].forEach(({term:a,to:l})=>{if(!a)return;let d;for(let h=0;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-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-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;nr[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-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-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;ie.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{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!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(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-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{if(s.length||o.marks.length){let a=0,l=0;for(;a=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-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;fh)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;ie)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;ae)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=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;rs&&l!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;ir.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;xt.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;ht.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=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(rn;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)=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;i0?(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=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;r1&&(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;x1||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;x1&&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=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;n1&&(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;r0;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=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(er){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;o0&&(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(se.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{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=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.pos0?0:1);i>0?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{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.curSelectionFor0}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;rr.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.size1)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{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{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=0;e--){let n=t.node(e);if(t.index(e)+1{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{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(){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{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=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=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;ho.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);sx;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&&e2),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.topd.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.leftd.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=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=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=(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=(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(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-1?i:t.docView.posFromDOM(e,n,-1)}function gN(t,e,n){let r=t.childNodes.length;if(r&&n.tope.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=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=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=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;dh.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;nhn(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;ne||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=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;hg&&on){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=r:er){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{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.dirty0&&(s=Jv(s,0,e,r));for(let a=0;a{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-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)||rn+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>1,a=Math.min(o,e.length);for(;s-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);a0;){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;ds;)a.push(i[o++]);let g=s+p.nodeSize;if(p.isText){let S=g;o!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=n){if(s>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let d=a=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=n||h<=e?s.push(l):(dn&&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.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&&r0){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{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&&o1)return s.lefti.top&&o1)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=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(i1&&(s=0),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 en})),qy.createHTML(t)):t}function TG(t){let e=/^(\s*]*>)*/.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=>"").reverse().join("")),n.innerHTML=NG(t),i)for(let s=0;s=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=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;oe){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{let d=l+r,h;if(h=HN(n,a,d)){for(i||(i=this.children.slice());sa&&f.to=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,o=s+n.content.size;for(let a=0;as&&l.type instanceof _o){let d=Math.max(s,l.from)-s,h=Math.min(o,l.to)-s;di.map(e,n,Aa));return Ys.from(r)}forChild(e,n){if(n.isLeaf)return wt.empty;let r=[];for(let i=0;in instanceof wt)?e:e.reduce((n,r)=>n.concat(r instanceof wt?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let S=x-g-(y-p);for(let C=0;CE+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=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;fn&&o.to{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;a0;)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;ii.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;nthis.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;hh.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)-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;hi;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()-100R(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()-100Date.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.fromt.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-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.posA(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.lastChromeDeletehs(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;hh.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;hn||Yy(o,!0,!1)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=o?s-r:0;s-=l,s&&s=a?s-r:0;s-=l,s&&s=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;n0&&sn.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{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({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({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=`${t}`,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{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({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{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;a0){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!!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:ir.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{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){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=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&&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 can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new 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{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;hn.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(;h0)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;hR.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;pn.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 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:"",close:""}},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=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{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:"",close:""}},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հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",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;rt.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;xx[0]>S[0]?1:-1);for(let x=0;x=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=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(;r56319||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=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;sn?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=0&&p++,i++,h++;if(p<0)i-=h,i0&&(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{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{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(;ne;)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=" ",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)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=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.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 ra&&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=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;hXQ&&(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;pYQ&&(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[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{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()==="

")&&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{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-1&&(i=window.location.hash.substring(window.location.hash.indexOf("?")));const o=i.substring(1).split("&");for(let a=0;a0&&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;l0&&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;s0?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,{})})})})); diff --git a/client/dist/assets/index-DS0xE7Ko.css b/client/dist/assets/index-DS0xE7Ko.css deleted file mode 100644 index 90bedf00..00000000 --- a/client/dist/assets/index-DS0xE7Ko.css +++ /dev/null @@ -1 +0,0 @@ -*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.btn-primary{border-radius:.5rem;--tw-bg-opacity: 1;background-color:rgb(2 132 199 / var(--tw-bg-opacity, 1));padding:.5rem 1rem;font-weight:500;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1));transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.btn-primary:hover{--tw-bg-opacity: 1;background-color:rgb(3 105 161 / var(--tw-bg-opacity, 1))}.btn-secondary{border-radius:.5rem;border-width:1px;--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:.5rem 1rem;font-weight:500;--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1));transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.btn-secondary:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.card{border-radius:.75rem;border-width:1px;--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:1.5rem;--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.input{width:100%;border-radius:.5rem;border-width:1px;--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));padding:.5rem 1rem;outline:2px solid transparent;outline-offset:2px;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.input:focus{border-color:transparent;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-opacity: 1;--tw-ring-color: rgb(14 165 233 / var(--tw-ring-opacity, 1))}.label{margin-bottom:.25rem;display:block;font-size:.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.right-4{right:1rem}.top-0{top:0}.top-4{top:1rem}.top-6{top:1.5rem}.z-50{z-index:50}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-auto{margin-left:auto;margin-right:auto}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.ml-2{margin-left:.5rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.aspect-\[2\/3\]{aspect-ratio:2/3}.h-12{height:3rem}.h-16{height:4rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-\[500px\]{height:500px}.h-\[600px\]{height:600px}.h-full{height:100%}.min-h-\[120px\]{min-height:120px}.min-h-\[150px\]{min-height:150px}.min-h-\[500px\]{min-height:500px}.min-h-screen{min-height:100vh}.w-12{width:3rem}.w-16{width:4rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-8{width:2rem}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.max-w-2xl{max-width:42rem}.max-w-7xl{max-width:80rem}.max-w-\[150px\]{max-width:150px}.max-w-md{max-width:28rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-pointer{cursor:pointer}.resize-y{resize:vertical}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-accent-200{--tw-border-opacity: 1;border-color:rgb(245 208 254 / var(--tw-border-opacity, 1))}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-primary-500{--tw-border-opacity: 1;border-color:rgb(14 165 233 / var(--tw-border-opacity, 1))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-primary-100{--tw-bg-opacity: 1;background-color:rgb(224 242 254 / var(--tw-bg-opacity, 1))}.bg-primary-50{--tw-bg-opacity: 1;background-color:rgb(240 249 255 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-accent-50{--tw-gradient-from: #fdf4ff var(--tw-gradient-from-position);--tw-gradient-to: rgb(253 244 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary-50{--tw-gradient-from: #f0f9ff var(--tw-gradient-from-position);--tw-gradient-to: rgb(240 249 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary-500{--tw-gradient-from: #0ea5e9 var(--tw-gradient-from-position);--tw-gradient-to: rgb(14 165 233 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-accent-50{--tw-gradient-to: #fdf4ff var(--tw-gradient-to-position)}.to-accent-500{--tw-gradient-to: #d946ef var(--tw-gradient-to-position)}.to-primary-50{--tw-gradient-to: #f0f9ff var(--tw-gradient-to-position)}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-4{padding-bottom:1rem}.pb-6{padding-bottom:1.5rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-serif{font-family:ui-serif,Georgia,Cambria,Times New Roman,Times,serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.capitalize{text-transform:capitalize}.italic{font-style:italic}.leading-relaxed{line-height:1.625}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-primary-600{--tw-text-opacity: 1;color:rgb(2 132 199 / var(--tw-text-opacity, 1))}.text-primary-700{--tw-text-opacity: 1;color:rgb(3 105 161 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.opacity-0{opacity:0}.opacity-50{opacity:.5}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.\!outline{outline-style:solid!important}.outline{outline-style:solid}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}:root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400}body{margin:0;min-height:100vh;background-color:#f8fafc}.hover\:border-accent-300:hover{--tw-border-opacity: 1;border-color:rgb(240 171 252 / var(--tw-border-opacity, 1))}.hover\:border-gray-300:hover{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.hover\:border-primary-300:hover{--tw-border-opacity: 1;border-color:rgb(125 211 252 / var(--tw-border-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-200:hover{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.hover\:bg-primary-50:hover{--tw-bg-opacity: 1;background-color:rgb(240 249 255 / var(--tw-bg-opacity, 1))}.hover\:bg-red-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:ring-0:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:opacity-100{opacity:1}@media (min-width: 640px){.sm\:inline{display:inline}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}}@media (min-width: 768px){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width: 1024px){.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:col-span-3{grid-column:span 3 / span 3}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:px-8{padding-left:2rem;padding-right:2rem}}@media (min-width: 1280px){.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}} diff --git a/client/dist/index.html b/client/dist/index.html index 51e3bd4f..f5ca7896 100644 --- a/client/dist/index.html +++ b/client/dist/index.html @@ -8,8 +8,8 @@ - - + +
diff --git a/client/node_modules/.vite/deps/_metadata.json b/client/node_modules/.vite/deps/_metadata.json index 6c8a5d62..80e46ef3 100644 --- a/client/node_modules/.vite/deps/_metadata.json +++ b/client/node_modules/.vite/deps/_metadata.json @@ -1,100 +1,145 @@ { - "hash": "deb88d1e", + "hash": "e20034a6", "configHash": "e64eb32e", - "lockfileHash": "fe4eb8a2", - "browserHash": "c9f0ad5b", + "lockfileHash": "b223a39a", + "browserHash": "4e2530e7", "optimized": { "react": { "src": "../../../../node_modules/react/index.js", "file": "react.js", - "fileHash": "80d72dea", + "fileHash": "bc47155f", "needsInterop": true }, "react-dom": { "src": "../../../../node_modules/react-dom/index.js", "file": "react-dom.js", - "fileHash": "3f8ff889", + "fileHash": "f3537af4", "needsInterop": true }, "react/jsx-dev-runtime": { "src": "../../../../node_modules/react/jsx-dev-runtime.js", "file": "react_jsx-dev-runtime.js", - "fileHash": "05119472", + "fileHash": "dd4d0058", "needsInterop": true }, "react/jsx-runtime": { "src": "../../../../node_modules/react/jsx-runtime.js", "file": "react_jsx-runtime.js", - "fileHash": "e0024c91", + "fileHash": "49f980be", "needsInterop": true }, "@tanstack/react-query": { "src": "../../../../node_modules/@tanstack/react-query/build/modern/index.js", "file": "@tanstack_react-query.js", - "fileHash": "4d070117", + "fileHash": "cb583fa8", "needsInterop": false }, "axios": { "src": "../../../../node_modules/axios/index.js", "file": "axios.js", - "fileHash": "a4419c2e", + "fileHash": "b1a573d1", "needsInterop": false }, "lucide-react": { "src": "../../../../node_modules/lucide-react/dist/esm/lucide-react.js", "file": "lucide-react.js", - "fileHash": "92a1456b", + "fileHash": "14fb8e72", "needsInterop": false }, "react-dom/client": { "src": "../../../../node_modules/react-dom/client.js", "file": "react-dom_client.js", - "fileHash": "86bf4335", + "fileHash": "5d2ebd48", "needsInterop": true }, "react-konva": { "src": "../../../../node_modules/react-konva/es/ReactKonva.js", "file": "react-konva.js", - "fileHash": "56221f90", + "fileHash": "a0e0f67f", "needsInterop": false }, "react-router-dom": { "src": "../../../../node_modules/react-router-dom/dist/index.js", "file": "react-router-dom.js", - "fileHash": "457f2587", + "fileHash": "fec8af05", "needsInterop": false }, "zustand": { "src": "../../../../node_modules/zustand/esm/index.mjs", "file": "zustand.js", - "fileHash": "848a6c38", + "fileHash": "35ad42af", "needsInterop": false }, "i18next": { "src": "../../../../node_modules/i18next/dist/esm/i18next.js", "file": "i18next.js", - "fileHash": "3d2d9026", + "fileHash": "9acaef61", "needsInterop": false }, "react-i18next": { "src": "../../../../node_modules/react-i18next/dist/es/index.js", "file": "react-i18next.js", - "fileHash": "78d9a217", + "fileHash": "b0e3e0fb", "needsInterop": false }, "i18next-browser-languagedetector": { "src": "../../../../node_modules/i18next-browser-languagedetector/dist/esm/i18nextBrowserLanguageDetector.js", "file": "i18next-browser-languagedetector.js", - "fileHash": "09be5c13", + "fileHash": "4cc94160", + "needsInterop": false + }, + "@tiptap/react": { + "src": "../../../../node_modules/@tiptap/react/dist/index.js", + "file": "@tiptap_react.js", + "fileHash": "b3a13a61", + "needsInterop": false + }, + "@tiptap/starter-kit": { + "src": "../../../../node_modules/@tiptap/starter-kit/dist/index.js", + "file": "@tiptap_starter-kit.js", + "fileHash": "a44103b6", + "needsInterop": false + }, + "@tiptap/extension-underline": { + "src": "../../../../node_modules/@tiptap/extension-underline/dist/index.js", + "file": "@tiptap_extension-underline.js", + "fileHash": "1e7a61a1", + "needsInterop": false + }, + "@tiptap/extension-text-align": { + "src": "../../../../node_modules/@tiptap/extension-text-align/dist/index.js", + "file": "@tiptap_extension-text-align.js", + "fileHash": "cd5adcf1", + "needsInterop": false + }, + "@tiptap/extension-placeholder": { + "src": "../../../../node_modules/@tiptap/extension-placeholder/dist/index.js", + "file": "@tiptap_extension-placeholder.js", + "fileHash": "8fd72abc", "needsInterop": false } }, "chunks": { + "chunk-DRQXKEUS": { + "file": "chunk-DRQXKEUS.js" + }, + "chunk-JYSI5OBP": { + "file": "chunk-JYSI5OBP.js" + }, + "chunk-6FQSNAE3": { + "file": "chunk-6FQSNAE3.js" + }, "chunk-CITXGXPZ": { "file": "chunk-CITXGXPZ.js" }, - "chunk-DRQXKEUS": { - "file": "chunk-DRQXKEUS.js" + "chunk-KMJOTAPQ": { + "file": "chunk-KMJOTAPQ.js" + }, + "chunk-N2AN2IIV": { + "file": "chunk-N2AN2IIV.js" + }, + "chunk-DBGWLXJ5": { + "file": "chunk-DBGWLXJ5.js" }, "chunk-TJ6I66L4": { "file": "chunk-TJ6I66L4.js" @@ -102,9 +147,6 @@ "chunk-RMSUKPN2": { "file": "chunk-RMSUKPN2.js" }, - "chunk-JYSI5OBP": { - "file": "chunk-JYSI5OBP.js" - }, "chunk-7URR3GLA": { "file": "chunk-7URR3GLA.js" }, diff --git a/client/node_modules/.vite/deps/react-i18next.js b/client/node_modules/.vite/deps/react-i18next.js index e82f0152..029644de 100644 --- a/client/node_modules/.vite/deps/react-i18next.js +++ b/client/node_modules/.vite/deps/react-i18next.js @@ -1,9 +1,9 @@ -import { - require_shim -} from "./chunk-CITXGXPZ.js"; import { keysFromSelector } from "./chunk-DRQXKEUS.js"; +import { + require_shim +} from "./chunk-CITXGXPZ.js"; import { require_react } from "./chunk-7URR3GLA.js"; diff --git a/client/node_modules/.vite/deps/zustand.js b/client/node_modules/.vite/deps/zustand.js index 3e1536d7..91c45148 100644 --- a/client/node_modules/.vite/deps/zustand.js +++ b/client/node_modules/.vite/deps/zustand.js @@ -1,93 +1,14 @@ import { - require_shim -} from "./chunk-CITXGXPZ.js"; + require_with_selector +} from "./chunk-6FQSNAE3.js"; +import "./chunk-CITXGXPZ.js"; import { require_react } from "./chunk-7URR3GLA.js"; import { - __commonJS, __toESM } from "./chunk-4MBMRILA.js"; -// ../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js -var require_with_selector_development = __commonJS({ - "../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) { - "use strict"; - (function() { - function is(x, y) { - return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; - } - "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); - var React = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore = shim.useSyncExternalStore, useRef = React.useRef, useEffect = React.useEffect, useMemo = React.useMemo, useDebugValue2 = React.useDebugValue; - exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) { - var instRef = useRef(null); - if (null === instRef.current) { - var inst = { hasValue: false, value: null }; - instRef.current = inst; - } else inst = instRef.current; - instRef = useMemo( - function() { - function memoizedSelector(nextSnapshot) { - if (!hasMemo) { - hasMemo = true; - memoizedSnapshot = nextSnapshot; - nextSnapshot = selector(nextSnapshot); - if (void 0 !== isEqual && inst.hasValue) { - var currentSelection = inst.value; - if (isEqual(currentSelection, nextSnapshot)) - return memoizedSelection = currentSelection; - } - return memoizedSelection = nextSnapshot; - } - currentSelection = memoizedSelection; - if (objectIs(memoizedSnapshot, nextSnapshot)) - return currentSelection; - var nextSelection = selector(nextSnapshot); - if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) - return memoizedSnapshot = nextSnapshot, currentSelection; - memoizedSnapshot = nextSnapshot; - return memoizedSelection = nextSelection; - } - var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot; - return [ - function() { - return memoizedSelector(getSnapshot()); - }, - null === maybeGetServerSnapshot ? void 0 : function() { - return memoizedSelector(maybeGetServerSnapshot()); - } - ]; - }, - [getSnapshot, getServerSnapshot, selector, isEqual] - ); - var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]); - useEffect( - function() { - inst.hasValue = true; - inst.value = value; - }, - [value] - ); - useDebugValue2(value); - return value; - }; - "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); - })(); - } -}); - -// ../node_modules/use-sync-external-store/shim/with-selector.js -var require_with_selector = __commonJS({ - "../node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) { - "use strict"; - if (false) { - module.exports = null; - } else { - module.exports = require_with_selector_development(); - } - } -}); - // ../node_modules/zustand/esm/vanilla.mjs var createStoreImpl = (createState) => { let state; @@ -170,17 +91,4 @@ export { react as default, useStore }; -/*! Bundled license information: - -use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js: - (** - * @license React - * use-sync-external-store-shim/with-selector.development.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. - *) -*/ //# sourceMappingURL=zustand.js.map diff --git a/client/node_modules/.vite/deps/zustand.js.map b/client/node_modules/.vite/deps/zustand.js.map index c9825bbc..d6b322c2 100644 --- a/client/node_modules/.vite/deps/zustand.js.map +++ b/client/node_modules/.vite/deps/zustand.js.map @@ -1,7 +1,7 @@ { "version": 3, - "sources": ["../../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js", "../../../../node_modules/use-sync-external-store/shim/with-selector.js", "../../../../node_modules/zustand/esm/vanilla.mjs", "../../../../node_modules/zustand/esm/index.mjs"], - "sourcesContent": ["/**\n * @license React\n * use-sync-external-store-shim/with-selector.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n }\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());\n var React = require(\"react\"),\n shim = require(\"use-sync-external-store/shim\"),\n objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useSyncExternalStore = shim.useSyncExternalStore,\n useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue;\n exports.useSyncExternalStoreWithSelector = function (\n subscribe,\n getSnapshot,\n getServerSnapshot,\n selector,\n isEqual\n ) {\n var instRef = useRef(null);\n if (null === instRef.current) {\n var inst = { hasValue: !1, value: null };\n instRef.current = inst;\n } else inst = instRef.current;\n instRef = useMemo(\n function () {\n function memoizedSelector(nextSnapshot) {\n if (!hasMemo) {\n hasMemo = !0;\n memoizedSnapshot = nextSnapshot;\n nextSnapshot = selector(nextSnapshot);\n if (void 0 !== isEqual && inst.hasValue) {\n var currentSelection = inst.value;\n if (isEqual(currentSelection, nextSnapshot))\n return (memoizedSelection = currentSelection);\n }\n return (memoizedSelection = nextSnapshot);\n }\n currentSelection = memoizedSelection;\n if (objectIs(memoizedSnapshot, nextSnapshot))\n return currentSelection;\n var nextSelection = selector(nextSnapshot);\n if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))\n return (memoizedSnapshot = nextSnapshot), currentSelection;\n memoizedSnapshot = nextSnapshot;\n return (memoizedSelection = nextSelection);\n }\n var hasMemo = !1,\n memoizedSnapshot,\n memoizedSelection,\n maybeGetServerSnapshot =\n void 0 === getServerSnapshot ? null : getServerSnapshot;\n return [\n function () {\n return memoizedSelector(getSnapshot());\n },\n null === maybeGetServerSnapshot\n ? void 0\n : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n }\n ];\n },\n [getSnapshot, getServerSnapshot, selector, isEqual]\n );\n var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);\n useEffect(\n function () {\n inst.hasValue = !0;\n inst.value = value;\n },\n [value]\n );\n useDebugValue(value);\n return value;\n };\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());\n })();\n", "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.development.js');\n}\n", "const createStoreImpl = (createState) => {\n let state;\n const listeners = /* @__PURE__ */ new Set();\n const setState = (partial, replace) => {\n const nextState = typeof partial === \"function\" ? partial(state) : partial;\n if (!Object.is(nextState, state)) {\n const previousState = state;\n state = (replace != null ? replace : typeof nextState !== \"object\" || nextState === null) ? nextState : Object.assign({}, state, nextState);\n listeners.forEach((listener) => listener(state, previousState));\n }\n };\n const getState = () => state;\n const getInitialState = () => initialState;\n const subscribe = (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const destroy = () => {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n console.warn(\n \"[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 );\n }\n listeners.clear();\n };\n const api = { setState, getState, getInitialState, subscribe, destroy };\n const initialState = state = createState(setState, getState, api);\n return api;\n};\nconst createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;\nvar vanilla = (createState) => {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n console.warn(\n \"[DEPRECATED] Default export is deprecated. Instead use import { createStore } from 'zustand/vanilla'.\"\n );\n }\n return createStore(createState);\n};\n\nexport { createStore, vanilla as default };\n", "import { createStore } from 'zustand/vanilla';\nexport * from 'zustand/vanilla';\nimport ReactExports from 'react';\nimport useSyncExternalStoreExports from 'use-sync-external-store/shim/with-selector.js';\n\nconst { useDebugValue } = ReactExports;\nconst { useSyncExternalStoreWithSelector } = useSyncExternalStoreExports;\nlet didWarnAboutEqualityFn = false;\nconst identity = (arg) => arg;\nfunction useStore(api, selector = identity, equalityFn) {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\" && equalityFn && !didWarnAboutEqualityFn) {\n console.warn(\n \"[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\"\n );\n didWarnAboutEqualityFn = true;\n }\n const slice = useSyncExternalStoreWithSelector(\n api.subscribe,\n api.getState,\n api.getServerState || api.getInitialState,\n selector,\n equalityFn\n );\n useDebugValue(slice);\n return slice;\n}\nconst createImpl = (createState) => {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\" && typeof createState !== \"function\") {\n console.warn(\n \"[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.\"\n );\n }\n const api = typeof createState === \"function\" ? createStore(createState) : createState;\n const useBoundStore = (selector, equalityFn) => useStore(api, selector, equalityFn);\n Object.assign(useBoundStore, api);\n return useBoundStore;\n};\nconst create = (createState) => createState ? createImpl(createState) : createImpl;\nvar react = (createState) => {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n console.warn(\n \"[DEPRECATED] Default export is deprecated. Instead use `import { create } from 'zustand'`.\"\n );\n }\n return create(createState);\n};\n\nexport { create, react as default, useStore };\n"], - "mappings": ";;;;;;;;;;;;AAAA;AAAA;AAAA;AAWA,KACG,WAAY;AACX,eAAS,GAAG,GAAG,GAAG;AAChB,eAAQ,MAAM,MAAM,MAAM,KAAK,IAAI,MAAM,IAAI,MAAQ,MAAM,KAAK,MAAM;AAAA,MACxE;AACA,sBAAgB,OAAO,kCACrB,eACE,OAAO,+BAA+B,+BACxC,+BAA+B,4BAA4B,MAAM,CAAC;AACpE,UAAI,QAAQ,iBACV,OAAO,gBACP,WAAW,eAAe,OAAO,OAAO,KAAK,OAAO,KAAK,IACzD,uBAAuB,KAAK,sBAC5B,SAAS,MAAM,QACf,YAAY,MAAM,WAClB,UAAU,MAAM,SAChBA,iBAAgB,MAAM;AACxB,cAAQ,mCAAmC,SACzC,WACA,aACA,mBACA,UACA,SACA;AACA,YAAI,UAAU,OAAO,IAAI;AACzB,YAAI,SAAS,QAAQ,SAAS;AAC5B,cAAI,OAAO,EAAE,UAAU,OAAI,OAAO,KAAK;AACvC,kBAAQ,UAAU;AAAA,QACpB,MAAO,QAAO,QAAQ;AACtB,kBAAU;AAAA,UACR,WAAY;AACV,qBAAS,iBAAiB,cAAc;AACtC,kBAAI,CAAC,SAAS;AACZ,0BAAU;AACV,mCAAmB;AACnB,+BAAe,SAAS,YAAY;AACpC,oBAAI,WAAW,WAAW,KAAK,UAAU;AACvC,sBAAI,mBAAmB,KAAK;AAC5B,sBAAI,QAAQ,kBAAkB,YAAY;AACxC,2BAAQ,oBAAoB;AAAA,gBAChC;AACA,uBAAQ,oBAAoB;AAAA,cAC9B;AACA,iCAAmB;AACnB,kBAAI,SAAS,kBAAkB,YAAY;AACzC,uBAAO;AACT,kBAAI,gBAAgB,SAAS,YAAY;AACzC,kBAAI,WAAW,WAAW,QAAQ,kBAAkB,aAAa;AAC/D,uBAAQ,mBAAmB,cAAe;AAC5C,iCAAmB;AACnB,qBAAQ,oBAAoB;AAAA,YAC9B;AACA,gBAAI,UAAU,OACZ,kBACA,mBACA,yBACE,WAAW,oBAAoB,OAAO;AAC1C,mBAAO;AAAA,cACL,WAAY;AACV,uBAAO,iBAAiB,YAAY,CAAC;AAAA,cACvC;AAAA,cACA,SAAS,yBACL,SACA,WAAY;AACV,uBAAO,iBAAiB,uBAAuB,CAAC;AAAA,cAClD;AAAA,YACN;AAAA,UACF;AAAA,UACA,CAAC,aAAa,mBAAmB,UAAU,OAAO;AAAA,QACpD;AACA,YAAI,QAAQ,qBAAqB,WAAW,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC;AAClE;AAAA,UACE,WAAY;AACV,iBAAK,WAAW;AAChB,iBAAK,QAAQ;AAAA,UACf;AAAA,UACA,CAAC,KAAK;AAAA,QACR;AACA,QAAAA,eAAc,KAAK;AACnB,eAAO;AAAA,MACT;AACA,sBAAgB,OAAO,kCACrB,eACE,OAAO,+BAA+B,8BACxC,+BAA+B,2BAA2B,MAAM,CAAC;AAAA,IACrE,GAAG;AAAA;AAAA;;;AChGL;AAAA;AAAA;AAEA,QAAI,OAAuC;AACzC,aAAO,UAAU;AAAA,IACnB,OAAO;AACL,aAAO,UAAU;AAAA,IACnB;AAAA;AAAA;;;ACNA,IAAM,kBAAkB,CAAC,gBAAgB;AACvC,MAAI;AACJ,QAAM,YAA4B,oBAAI,IAAI;AAC1C,QAAM,WAAW,CAAC,SAAS,YAAY;AACrC,UAAM,YAAY,OAAO,YAAY,aAAa,QAAQ,KAAK,IAAI;AACnE,QAAI,CAAC,OAAO,GAAG,WAAW,KAAK,GAAG;AAChC,YAAM,gBAAgB;AACtB,eAAS,WAAW,OAAO,UAAU,OAAO,cAAc,YAAY,cAAc,QAAQ,YAAY,OAAO,OAAO,CAAC,GAAG,OAAO,SAAS;AAC1I,gBAAU,QAAQ,CAAC,aAAa,SAAS,OAAO,aAAa,CAAC;AAAA,IAChE;AAAA,EACF;AACA,QAAM,WAAW,MAAM;AACvB,QAAM,kBAAkB,MAAM;AAC9B,QAAM,YAAY,CAAC,aAAa;AAC9B,cAAU,IAAI,QAAQ;AACtB,WAAO,MAAM,UAAU,OAAO,QAAQ;AAAA,EACxC;AACA,QAAM,UAAU,MAAM;AACpB,SAAK,YAAY,MAAM,YAAY,IAAI,OAAO,YAAY,cAAc;AACtE,cAAQ;AAAA,QACN;AAAA,MACF;AAAA,IACF;AACA,cAAU,MAAM;AAAA,EAClB;AACA,QAAM,MAAM,EAAE,UAAU,UAAU,iBAAiB,WAAW,QAAQ;AACtE,QAAM,eAAe,QAAQ,YAAY,UAAU,UAAU,GAAG;AAChE,SAAO;AACT;AACA,IAAM,cAAc,CAAC,gBAAgB,cAAc,gBAAgB,WAAW,IAAI;;;AC3BlF,mBAAyB;AACzB,2BAAwC;AAExC,IAAM,EAAE,cAAc,IAAI,aAAAC;AAC1B,IAAM,EAAE,iCAAiC,IAAI,qBAAAC;AAC7C,IAAI,yBAAyB;AAC7B,IAAM,WAAW,CAAC,QAAQ;AAC1B,SAAS,SAAS,KAAK,WAAW,UAAU,YAAY;AACtD,OAAK,YAAY,MAAM,YAAY,IAAI,OAAO,YAAY,gBAAgB,cAAc,CAAC,wBAAwB;AAC/G,YAAQ;AAAA,MACN;AAAA,IACF;AACA,6BAAyB;AAAA,EAC3B;AACA,QAAM,QAAQ;AAAA,IACZ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI,kBAAkB,IAAI;AAAA,IAC1B;AAAA,IACA;AAAA,EACF;AACA,gBAAc,KAAK;AACnB,SAAO;AACT;AACA,IAAM,aAAa,CAAC,gBAAgB;AAClC,OAAK,YAAY,MAAM,YAAY,IAAI,OAAO,YAAY,gBAAgB,OAAO,gBAAgB,YAAY;AAC3G,YAAQ;AAAA,MACN;AAAA,IACF;AAAA,EACF;AACA,QAAM,MAAM,OAAO,gBAAgB,aAAa,YAAY,WAAW,IAAI;AAC3E,QAAM,gBAAgB,CAAC,UAAU,eAAe,SAAS,KAAK,UAAU,UAAU;AAClF,SAAO,OAAO,eAAe,GAAG;AAChC,SAAO;AACT;AACA,IAAM,SAAS,CAAC,gBAAgB,cAAc,WAAW,WAAW,IAAI;AACxE,IAAI,QAAQ,CAAC,gBAAgB;AAC3B,OAAK,YAAY,MAAM,YAAY,IAAI,OAAO,YAAY,cAAc;AACtE,YAAQ;AAAA,MACN;AAAA,IACF;AAAA,EACF;AACA,SAAO,OAAO,WAAW;AAC3B;", - "names": ["useDebugValue", "ReactExports", "useSyncExternalStoreExports"] + "sources": ["../../../../node_modules/zustand/esm/vanilla.mjs", "../../../../node_modules/zustand/esm/index.mjs"], + "sourcesContent": ["const createStoreImpl = (createState) => {\n let state;\n const listeners = /* @__PURE__ */ new Set();\n const setState = (partial, replace) => {\n const nextState = typeof partial === \"function\" ? partial(state) : partial;\n if (!Object.is(nextState, state)) {\n const previousState = state;\n state = (replace != null ? replace : typeof nextState !== \"object\" || nextState === null) ? nextState : Object.assign({}, state, nextState);\n listeners.forEach((listener) => listener(state, previousState));\n }\n };\n const getState = () => state;\n const getInitialState = () => initialState;\n const subscribe = (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const destroy = () => {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n console.warn(\n \"[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 );\n }\n listeners.clear();\n };\n const api = { setState, getState, getInitialState, subscribe, destroy };\n const initialState = state = createState(setState, getState, api);\n return api;\n};\nconst createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;\nvar vanilla = (createState) => {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n console.warn(\n \"[DEPRECATED] Default export is deprecated. Instead use import { createStore } from 'zustand/vanilla'.\"\n );\n }\n return createStore(createState);\n};\n\nexport { createStore, vanilla as default };\n", "import { createStore } from 'zustand/vanilla';\nexport * from 'zustand/vanilla';\nimport ReactExports from 'react';\nimport useSyncExternalStoreExports from 'use-sync-external-store/shim/with-selector.js';\n\nconst { useDebugValue } = ReactExports;\nconst { useSyncExternalStoreWithSelector } = useSyncExternalStoreExports;\nlet didWarnAboutEqualityFn = false;\nconst identity = (arg) => arg;\nfunction useStore(api, selector = identity, equalityFn) {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\" && equalityFn && !didWarnAboutEqualityFn) {\n console.warn(\n \"[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\"\n );\n didWarnAboutEqualityFn = true;\n }\n const slice = useSyncExternalStoreWithSelector(\n api.subscribe,\n api.getState,\n api.getServerState || api.getInitialState,\n selector,\n equalityFn\n );\n useDebugValue(slice);\n return slice;\n}\nconst createImpl = (createState) => {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\" && typeof createState !== \"function\") {\n console.warn(\n \"[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.\"\n );\n }\n const api = typeof createState === \"function\" ? createStore(createState) : createState;\n const useBoundStore = (selector, equalityFn) => useStore(api, selector, equalityFn);\n Object.assign(useBoundStore, api);\n return useBoundStore;\n};\nconst create = (createState) => createState ? createImpl(createState) : createImpl;\nvar react = (createState) => {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n console.warn(\n \"[DEPRECATED] Default export is deprecated. Instead use `import { create } from 'zustand'`.\"\n );\n }\n return create(createState);\n};\n\nexport { create, react as default, useStore };\n"], + "mappings": ";;;;;;;;;;;;AAAA,IAAM,kBAAkB,CAAC,gBAAgB;AACvC,MAAI;AACJ,QAAM,YAA4B,oBAAI,IAAI;AAC1C,QAAM,WAAW,CAAC,SAAS,YAAY;AACrC,UAAM,YAAY,OAAO,YAAY,aAAa,QAAQ,KAAK,IAAI;AACnE,QAAI,CAAC,OAAO,GAAG,WAAW,KAAK,GAAG;AAChC,YAAM,gBAAgB;AACtB,eAAS,WAAW,OAAO,UAAU,OAAO,cAAc,YAAY,cAAc,QAAQ,YAAY,OAAO,OAAO,CAAC,GAAG,OAAO,SAAS;AAC1I,gBAAU,QAAQ,CAAC,aAAa,SAAS,OAAO,aAAa,CAAC;AAAA,IAChE;AAAA,EACF;AACA,QAAM,WAAW,MAAM;AACvB,QAAM,kBAAkB,MAAM;AAC9B,QAAM,YAAY,CAAC,aAAa;AAC9B,cAAU,IAAI,QAAQ;AACtB,WAAO,MAAM,UAAU,OAAO,QAAQ;AAAA,EACxC;AACA,QAAM,UAAU,MAAM;AACpB,SAAK,YAAY,MAAM,YAAY,IAAI,OAAO,YAAY,cAAc;AACtE,cAAQ;AAAA,QACN;AAAA,MACF;AAAA,IACF;AACA,cAAU,MAAM;AAAA,EAClB;AACA,QAAM,MAAM,EAAE,UAAU,UAAU,iBAAiB,WAAW,QAAQ;AACtE,QAAM,eAAe,QAAQ,YAAY,UAAU,UAAU,GAAG;AAChE,SAAO;AACT;AACA,IAAM,cAAc,CAAC,gBAAgB,cAAc,gBAAgB,WAAW,IAAI;;;AC3BlF,mBAAyB;AACzB,2BAAwC;AAExC,IAAM,EAAE,cAAc,IAAI,aAAAA;AAC1B,IAAM,EAAE,iCAAiC,IAAI,qBAAAC;AAC7C,IAAI,yBAAyB;AAC7B,IAAM,WAAW,CAAC,QAAQ;AAC1B,SAAS,SAAS,KAAK,WAAW,UAAU,YAAY;AACtD,OAAK,YAAY,MAAM,YAAY,IAAI,OAAO,YAAY,gBAAgB,cAAc,CAAC,wBAAwB;AAC/G,YAAQ;AAAA,MACN;AAAA,IACF;AACA,6BAAyB;AAAA,EAC3B;AACA,QAAM,QAAQ;AAAA,IACZ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI,kBAAkB,IAAI;AAAA,IAC1B;AAAA,IACA;AAAA,EACF;AACA,gBAAc,KAAK;AACnB,SAAO;AACT;AACA,IAAM,aAAa,CAAC,gBAAgB;AAClC,OAAK,YAAY,MAAM,YAAY,IAAI,OAAO,YAAY,gBAAgB,OAAO,gBAAgB,YAAY;AAC3G,YAAQ;AAAA,MACN;AAAA,IACF;AAAA,EACF;AACA,QAAM,MAAM,OAAO,gBAAgB,aAAa,YAAY,WAAW,IAAI;AAC3E,QAAM,gBAAgB,CAAC,UAAU,eAAe,SAAS,KAAK,UAAU,UAAU;AAClF,SAAO,OAAO,eAAe,GAAG;AAChC,SAAO;AACT;AACA,IAAM,SAAS,CAAC,gBAAgB,cAAc,WAAW,WAAW,IAAI;AACxE,IAAI,QAAQ,CAAC,gBAAgB;AAC3B,OAAK,YAAY,MAAM,YAAY,IAAI,OAAO,YAAY,cAAc;AACtE,YAAQ;AAAA,MACN;AAAA,IACF;AAAA,EACF;AACA,SAAO,OAAO,WAAW;AAC3B;", + "names": ["ReactExports", "useSyncExternalStoreExports"] } diff --git a/client/package.json b/client/package.json index 7bd4b047..bbdc9553 100644 --- a/client/package.json +++ b/client/package.json @@ -14,6 +14,12 @@ "@radix-ui/react-tabs": "^1.0.4", "@radix-ui/react-toast": "^1.1.5", "@tanstack/react-query": "^5.17.0", + "@tiptap/extension-placeholder": "^3.22.2", + "@tiptap/extension-text-align": "^3.22.2", + "@tiptap/extension-underline": "^3.22.2", + "@tiptap/pm": "^3.22.2", + "@tiptap/react": "^3.22.2", + "@tiptap/starter-kit": "^3.22.2", "axios": "^1.6.5", "clsx": "^2.1.0", "i18next": "^26.0.3", diff --git a/client/src/App.tsx b/client/src/App.tsx index e1ab8e34..46a93cbc 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -1,4 +1,4 @@ -import { Routes, Route, Navigate } from 'react-router-dom'; +import { Routes, Route } from 'react-router-dom'; import { BookOpen, Image, Settings } from 'lucide-react'; import { useState, useEffect } from 'react'; import { useTranslation } from 'react-i18next'; @@ -7,6 +7,7 @@ import AuthModal from './components/auth/AuthModal'; import CoverDesigner from './components/cover-designer/CoverDesigner'; import BookGenerator from './components/book-generator/BookGenerator'; import SettingsPage from './components/SettingsPage'; +import OnboardingPage from './components/OnboardingPage'; function App() { const { t } = useTranslation(); @@ -23,12 +24,12 @@ function App() {
- + {/* Navigation */}