@valbuild/ui 0.84.3 → 0.85.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/valbuild-ui.cjs.js +1 -1
- package/dist/valbuild-ui.esm.js +1 -1
- package/package.json +3 -3
- package/server/.tmp/assets/index-DYsqDaHm.js +532 -0
- package/server/.tmp/index.html +1 -1
- package/server/dist/valbuild-ui-server.cjs.js +2 -2
- package/server/dist/valbuild-ui-server.esm.js +2 -2
- package/server/.tmp/assets/index-ClmF8Ug0.js +0 -532
|
@@ -1,532 +0,0 @@
|
|
|
1
|
-
var OF=Object.defineProperty;var OE=e=>{throw TypeError(e)};var MF=(e,t,n)=>t in e?OF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Vt=(e,t,n)=>MF(e,typeof t!="symbol"?t+"":t,n),ME=(e,t,n)=>t.has(e)||OE("Cannot "+n);var ue=(e,t,n)=>(ME(e,t,"read from private field"),n?n.call(e):t.get(e)),Ln=(e,t,n)=>t.has(e)?OE("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Qe=(e,t,n,r)=>(ME(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);function RF(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const i=Object.getOwnPropertyDescriptor(r,o);i&&Object.defineProperty(e,o,i.get?i:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();var AF=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Da(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var hj={exports:{}},Je={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Uh=Symbol.for("react.element"),IF=Symbol.for("react.portal"),DF=Symbol.for("react.fragment"),LF=Symbol.for("react.strict_mode"),FF=Symbol.for("react.profiler"),zF=Symbol.for("react.provider"),$F=Symbol.for("react.context"),BF=Symbol.for("react.forward_ref"),VF=Symbol.for("react.suspense"),UF=Symbol.for("react.memo"),WF=Symbol.for("react.lazy"),RE=Symbol.iterator;function HF(e){return e===null||typeof e!="object"?null:(e=RE&&e[RE]||e["@@iterator"],typeof e=="function"?e:null)}var pj={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},mj=Object.assign,gj={};function Fu(e,t,n){this.props=e,this.context=t,this.refs=gj,this.updater=n||pj}Fu.prototype.isReactComponent={};Fu.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Fu.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function vj(){}vj.prototype=Fu.prototype;function Qw(e,t,n){this.props=e,this.context=t,this.refs=gj,this.updater=n||pj}var e1=Qw.prototype=new vj;e1.constructor=Qw;mj(e1,Fu.prototype);e1.isPureReactComponent=!0;var AE=Array.isArray,yj=Object.prototype.hasOwnProperty,t1={current:null},xj={key:!0,ref:!0,__self:!0,__source:!0};function bj(e,t,n){var r,o={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)yj.call(t,r)&&!xj.hasOwnProperty(r)&&(o[r]=t[r]);var a=arguments.length-2;if(a===1)o.children=n;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];o.children=l}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)o[r]===void 0&&(o[r]=a[r]);return{$$typeof:Uh,type:e,key:i,ref:s,props:o,_owner:t1.current}}function KF(e,t){return{$$typeof:Uh,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function n1(e){return typeof e=="object"&&e!==null&&e.$$typeof===Uh}function GF(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var IE=/\/+/g;function ex(e,t){return typeof e=="object"&&e!==null&&e.key!=null?GF(""+e.key):t.toString(36)}function fm(e,t,n,r,o){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var s=!1;if(e===null)s=!0;else switch(i){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case Uh:case IF:s=!0}}if(s)return s=e,o=o(s),e=r===""?"."+ex(s,0):r,AE(o)?(n="",e!=null&&(n=e.replace(IE,"$&/")+"/"),fm(o,t,n,"",function(c){return c})):o!=null&&(n1(o)&&(o=KF(o,n+(!o.key||s&&s.key===o.key?"":(""+o.key).replace(IE,"$&/")+"/")+e)),t.push(o)),1;if(s=0,r=r===""?".":r+":",AE(e))for(var a=0;a<e.length;a++){i=e[a];var l=r+ex(i,a);s+=fm(i,t,n,l,o)}else if(l=HF(e),typeof l=="function")for(e=l.call(e),a=0;!(i=e.next()).done;)i=i.value,l=r+ex(i,a++),s+=fm(i,t,n,l,o);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return s}function Op(e,t,n){if(e==null)return e;var r=[],o=0;return fm(e,r,"","",function(i){return t.call(n,i,o++)}),r}function qF(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var ir={current:null},hm={transition:null},YF={ReactCurrentDispatcher:ir,ReactCurrentBatchConfig:hm,ReactCurrentOwner:t1};function wj(){throw Error("act(...) is not supported in production builds of React.")}Je.Children={map:Op,forEach:function(e,t,n){Op(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Op(e,function(){t++}),t},toArray:function(e){return Op(e,function(t){return t})||[]},only:function(e){if(!n1(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Je.Component=Fu;Je.Fragment=DF;Je.Profiler=FF;Je.PureComponent=Qw;Je.StrictMode=LF;Je.Suspense=VF;Je.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=YF;Je.act=wj;Je.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=mj({},e.props),o=e.key,i=e.ref,s=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,s=t1.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)yj.call(t,l)&&!xj.hasOwnProperty(l)&&(r[l]=t[l]===void 0&&a!==void 0?a[l]:t[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];r.children=a}return{$$typeof:Uh,type:e.type,key:o,ref:i,props:r,_owner:s}};Je.createContext=function(e){return e={$$typeof:$F,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:zF,_context:e},e.Consumer=e};Je.createElement=bj;Je.createFactory=function(e){var t=bj.bind(null,e);return t.type=e,t};Je.createRef=function(){return{current:null}};Je.forwardRef=function(e){return{$$typeof:BF,render:e}};Je.isValidElement=n1;Je.lazy=function(e){return{$$typeof:WF,_payload:{_status:-1,_result:e},_init:qF}};Je.memo=function(e,t){return{$$typeof:UF,type:e,compare:t===void 0?null:t}};Je.startTransition=function(e){var t=hm.transition;hm.transition={};try{e()}finally{hm.transition=t}};Je.unstable_act=wj;Je.useCallback=function(e,t){return ir.current.useCallback(e,t)};Je.useContext=function(e){return ir.current.useContext(e)};Je.useDebugValue=function(){};Je.useDeferredValue=function(e){return ir.current.useDeferredValue(e)};Je.useEffect=function(e,t){return ir.current.useEffect(e,t)};Je.useId=function(){return ir.current.useId()};Je.useImperativeHandle=function(e,t,n){return ir.current.useImperativeHandle(e,t,n)};Je.useInsertionEffect=function(e,t){return ir.current.useInsertionEffect(e,t)};Je.useLayoutEffect=function(e,t){return ir.current.useLayoutEffect(e,t)};Je.useMemo=function(e,t){return ir.current.useMemo(e,t)};Je.useReducer=function(e,t,n){return ir.current.useReducer(e,t,n)};Je.useRef=function(e){return ir.current.useRef(e)};Je.useState=function(e){return ir.current.useState(e)};Je.useSyncExternalStore=function(e,t,n){return ir.current.useSyncExternalStore(e,t,n)};Je.useTransition=function(){return ir.current.useTransition()};Je.version="18.3.1";hj.exports=Je;var g=hj.exports;const Ee=Da(g),JF=RF({__proto__:null,default:Ee},[g]);var Gm={},Sj={exports:{}},Jr={},kj={exports:{}},Ej={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* scheduler.production.min.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/(function(e){function t(j,L){var $=j.length;j.push(L);e:for(;0<$;){var W=$-1>>>1,G=j[W];if(0<o(G,L))j[W]=L,j[$]=G,$=W;else break e}}function n(j){return j.length===0?null:j[0]}function r(j){if(j.length===0)return null;var L=j[0],$=j.pop();if($!==L){j[0]=$;e:for(var W=0,G=j.length,_e=G>>>1;W<_e;){var ke=2*(W+1)-1,Ve=j[ke],Z=ke+1,J=j[Z];if(0>o(Ve,$))Z<G&&0>o(J,Ve)?(j[W]=J,j[Z]=$,W=Z):(j[W]=Ve,j[ke]=$,W=ke);else if(Z<G&&0>o(J,$))j[W]=J,j[Z]=$,W=Z;else break e}}return L}function o(j,L){var $=j.sortIndex-L.sortIndex;return $!==0?$:j.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var l=[],c=[],u=1,f=null,h=3,p=!1,m=!1,v=!1,x=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(j){for(var L=n(c);L!==null;){if(L.callback===null)r(c);else if(L.startTime<=j)r(c),L.sortIndex=L.expirationTime,t(l,L);else break;L=n(c)}}function C(j){if(v=!1,S(j),!m)if(n(l)!==null)m=!0,I(N);else{var L=n(c);L!==null&&A(C,L.startTime-j)}}function N(j,L){m=!1,v&&(v=!1,b(O),O=-1),p=!0;var $=h;try{for(S(L),f=n(l);f!==null&&(!(f.expirationTime>L)||j&&!U());){var W=f.callback;if(typeof W=="function"){f.callback=null,h=f.priorityLevel;var G=W(f.expirationTime<=L);L=e.unstable_now(),typeof G=="function"?f.callback=G:f===n(l)&&r(l),S(L)}else r(l);f=n(l)}if(f!==null)var _e=!0;else{var ke=n(c);ke!==null&&A(C,ke.startTime-L),_e=!1}return _e}finally{f=null,h=$,p=!1}}var P=!1,_=null,O=-1,M=5,D=-1;function U(){return!(e.unstable_now()-D<M)}function z(){if(_!==null){var j=e.unstable_now();D=j;var L=!0;try{L=_(!0,j)}finally{L?H():(P=!1,_=null)}}else P=!1}var H;if(typeof w=="function")H=function(){w(z)};else if(typeof MessageChannel<"u"){var K=new MessageChannel,V=K.port2;K.port1.onmessage=z,H=function(){V.postMessage(null)}}else H=function(){x(z,0)};function I(j){_=j,P||(P=!0,H())}function A(j,L){O=x(function(){j(e.unstable_now())},L)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(j){j.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,I(N))},e.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<j?Math.floor(1e3/j):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(j){switch(h){case 1:case 2:case 3:var L=3;break;default:L=h}var $=h;h=L;try{return j()}finally{h=$}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(j,L){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var $=h;h=j;try{return L()}finally{h=$}},e.unstable_scheduleCallback=function(j,L,$){var W=e.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?W+$:W):$=W,j){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=$+G,j={id:u++,callback:L,priorityLevel:j,startTime:$,expirationTime:G,sortIndex:-1},$>W?(j.sortIndex=$,t(c,j),n(l)===null&&j===n(c)&&(v?(b(O),O=-1):v=!0,A(C,$-W))):(j.sortIndex=G,t(l,j),m||p||(m=!0,I(N))),j},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(j){var L=h;return function(){var $=h;h=L;try{return j.apply(this,arguments)}finally{h=$}}}})(Ej);kj.exports=Ej;var XF=kj.exports;/**
|
|
18
|
-
* @license React
|
|
19
|
-
* react-dom.production.min.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/var ZF=g,Wr=XF;function te(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Cj=new Set,Af={};function Yl(e,t){iu(e,t),iu(e+"Capture",t)}function iu(e,t){for(Af[e]=t,e=0;e<t.length;e++)Cj.add(t[e])}var ns=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),O0=Object.prototype.hasOwnProperty,QF=/^[: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]*$/,DE={},LE={};function e5(e){return O0.call(LE,e)?!0:O0.call(DE,e)?!1:QF.test(e)?LE[e]=!0:(DE[e]=!0,!1)}function t5(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function n5(e,t,n,r){if(t===null||typeof t>"u"||t5(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function sr(e,t,n,r,o,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var Tn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Tn[e]=new sr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Tn[t]=new sr(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Tn[e]=new sr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Tn[e]=new sr(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Tn[e]=new sr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Tn[e]=new sr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Tn[e]=new sr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Tn[e]=new sr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Tn[e]=new sr(e,5,!1,e.toLowerCase(),null,!1,!1)});var r1=/[\-:]([a-z])/g;function o1(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(r1,o1);Tn[t]=new sr(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(r1,o1);Tn[t]=new sr(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(r1,o1);Tn[t]=new sr(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Tn[e]=new sr(e,1,!1,e.toLowerCase(),null,!1,!1)});Tn.xlinkHref=new sr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Tn[e]=new sr(e,1,!1,e.toLowerCase(),null,!0,!0)});function i1(e,t,n,r){var o=Tn.hasOwnProperty(t)?Tn[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(n5(t,n,o,r)&&(n=null),r||o===null?e5(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=n===null?o.type===3?!1:"":n:(t=o.attributeName,r=o.attributeNamespace,n===null?e.removeAttribute(t):(o=o.type,n=o===3||o===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var hs=ZF.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Mp=Symbol.for("react.element"),_c=Symbol.for("react.portal"),jc=Symbol.for("react.fragment"),s1=Symbol.for("react.strict_mode"),M0=Symbol.for("react.profiler"),Nj=Symbol.for("react.provider"),Pj=Symbol.for("react.context"),a1=Symbol.for("react.forward_ref"),R0=Symbol.for("react.suspense"),A0=Symbol.for("react.suspense_list"),l1=Symbol.for("react.memo"),Fs=Symbol.for("react.lazy"),_j=Symbol.for("react.offscreen"),FE=Symbol.iterator;function hd(e){return e===null||typeof e!="object"?null:(e=FE&&e[FE]||e["@@iterator"],typeof e=="function"?e:null)}var Lt=Object.assign,tx;function Md(e){if(tx===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);tx=t&&t[1]||""}return`
|
|
26
|
-
`+tx+e}var nx=!1;function rx(e,t){if(!e||nx)return"";nx=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var o=c.stack.split(`
|
|
27
|
-
`),i=r.stack.split(`
|
|
28
|
-
`),s=o.length-1,a=i.length-1;1<=s&&0<=a&&o[s]!==i[a];)a--;for(;1<=s&&0<=a;s--,a--)if(o[s]!==i[a]){if(s!==1||a!==1)do if(s--,a--,0>a||o[s]!==i[a]){var l=`
|
|
29
|
-
`+o[s].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}while(1<=s&&0<=a);break}}}finally{nx=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Md(e):""}function r5(e){switch(e.tag){case 5:return Md(e.type);case 16:return Md("Lazy");case 13:return Md("Suspense");case 19:return Md("SuspenseList");case 0:case 2:case 15:return e=rx(e.type,!1),e;case 11:return e=rx(e.type.render,!1),e;case 1:return e=rx(e.type,!0),e;default:return""}}function I0(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case jc:return"Fragment";case _c:return"Portal";case M0:return"Profiler";case s1:return"StrictMode";case R0:return"Suspense";case A0:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Pj:return(e.displayName||"Context")+".Consumer";case Nj:return(e._context.displayName||"Context")+".Provider";case a1:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case l1:return t=e.displayName||null,t!==null?t:I0(e.type)||"Memo";case Fs:t=e._payload,e=e._init;try{return I0(e(t))}catch{}}return null}function o5(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return I0(t);case 8:return t===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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ya(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function jj(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function i5(e){var t=jj(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Rp(e){e._valueTracker||(e._valueTracker=i5(e))}function Tj(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=jj(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function qm(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function D0(e,t){var n=t.checked;return Lt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function zE(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ya(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Oj(e,t){t=t.checked,t!=null&&i1(e,"checked",t,!1)}function L0(e,t){Oj(e,t);var n=ya(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?F0(e,t.type,n):t.hasOwnProperty("defaultValue")&&F0(e,t.type,ya(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function $E(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function F0(e,t,n){(t!=="number"||qm(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Rd=Array.isArray;function Bc(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+ya(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,r&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function z0(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(te(91));return Lt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function BE(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(te(92));if(Rd(n)){if(1<n.length)throw Error(te(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:ya(n)}}function Mj(e,t){var n=ya(t.value),r=ya(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function VE(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Rj(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function $0(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Rj(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Ap,Aj=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,o)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Ap=Ap||document.createElement("div"),Ap.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Ap.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function If(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ff={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},s5=["Webkit","ms","Moz","O"];Object.keys(ff).forEach(function(e){s5.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ff[t]=ff[e]})});function Ij(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ff.hasOwnProperty(e)&&ff[e]?(""+t).trim():t+"px"}function Dj(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=Ij(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var a5=Lt({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 B0(e,t){if(t){if(a5[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(te(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(te(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(te(61))}if(t.style!=null&&typeof t.style!="object")throw Error(te(62))}}function V0(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var U0=null;function c1(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var W0=null,Vc=null,Uc=null;function UE(e){if(e=Kh(e)){if(typeof W0!="function")throw Error(te(280));var t=e.stateNode;t&&(t=Ov(t),W0(e.stateNode,e.type,t))}}function Lj(e){Vc?Uc?Uc.push(e):Uc=[e]:Vc=e}function Fj(){if(Vc){var e=Vc,t=Uc;if(Uc=Vc=null,UE(e),t)for(e=0;e<t.length;e++)UE(t[e])}}function zj(e,t){return e(t)}function $j(){}var ox=!1;function Bj(e,t,n){if(ox)return e(t,n);ox=!0;try{return zj(e,t,n)}finally{ox=!1,(Vc!==null||Uc!==null)&&($j(),Fj())}}function Df(e,t){var n=e.stateNode;if(n===null)return null;var r=Ov(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(te(231,t,typeof n));return n}var H0=!1;if(ns)try{var pd={};Object.defineProperty(pd,"passive",{get:function(){H0=!0}}),window.addEventListener("test",pd,pd),window.removeEventListener("test",pd,pd)}catch{H0=!1}function l5(e,t,n,r,o,i,s,a,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(u){this.onError(u)}}var hf=!1,Ym=null,Jm=!1,K0=null,c5={onError:function(e){hf=!0,Ym=e}};function u5(e,t,n,r,o,i,s,a,l){hf=!1,Ym=null,l5.apply(c5,arguments)}function d5(e,t,n,r,o,i,s,a,l){if(u5.apply(this,arguments),hf){if(hf){var c=Ym;hf=!1,Ym=null}else throw Error(te(198));Jm||(Jm=!0,K0=c)}}function Jl(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Vj(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function WE(e){if(Jl(e)!==e)throw Error(te(188))}function f5(e){var t=e.alternate;if(!t){if(t=Jl(e),t===null)throw Error(te(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(o===null)break;var i=o.alternate;if(i===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===n)return WE(o),e;if(i===r)return WE(o),t;i=i.sibling}throw Error(te(188))}if(n.return!==r.return)n=o,r=i;else{for(var s=!1,a=o.child;a;){if(a===n){s=!0,n=o,r=i;break}if(a===r){s=!0,r=o,n=i;break}a=a.sibling}if(!s){for(a=i.child;a;){if(a===n){s=!0,n=i,r=o;break}if(a===r){s=!0,r=i,n=o;break}a=a.sibling}if(!s)throw Error(te(189))}}if(n.alternate!==r)throw Error(te(190))}if(n.tag!==3)throw Error(te(188));return n.stateNode.current===n?e:t}function Uj(e){return e=f5(e),e!==null?Wj(e):null}function Wj(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Wj(e);if(t!==null)return t;e=e.sibling}return null}var Hj=Wr.unstable_scheduleCallback,HE=Wr.unstable_cancelCallback,h5=Wr.unstable_shouldYield,p5=Wr.unstable_requestPaint,Ut=Wr.unstable_now,m5=Wr.unstable_getCurrentPriorityLevel,u1=Wr.unstable_ImmediatePriority,Kj=Wr.unstable_UserBlockingPriority,Xm=Wr.unstable_NormalPriority,g5=Wr.unstable_LowPriority,Gj=Wr.unstable_IdlePriority,Pv=null,pi=null;function v5(e){if(pi&&typeof pi.onCommitFiberRoot=="function")try{pi.onCommitFiberRoot(Pv,e,void 0,(e.current.flags&128)===128)}catch{}}var Ho=Math.clz32?Math.clz32:b5,y5=Math.log,x5=Math.LN2;function b5(e){return e>>>=0,e===0?32:31-(y5(e)/x5|0)|0}var Ip=64,Dp=4194304;function Ad(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Zm(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var a=s&~o;a!==0?r=Ad(a):(i&=s,i!==0&&(r=Ad(i)))}else s=n&~o,s!==0?r=Ad(s):i!==0&&(r=Ad(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Ho(t),o=1<<n,r|=e[n],t&=~o;return r}function w5(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function S5(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes;0<i;){var s=31-Ho(i),a=1<<s,l=o[s];l===-1?(!(a&n)||a&r)&&(o[s]=w5(a,t)):l<=t&&(e.expiredLanes|=a),i&=~a}}function G0(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function qj(){var e=Ip;return Ip<<=1,!(Ip&4194240)&&(Ip=64),e}function ix(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Wh(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ho(t),e[t]=n}function k5(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var o=31-Ho(n),i=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~i}}function d1(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ho(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var pt=0;function Yj(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Jj,f1,Xj,Zj,Qj,q0=!1,Lp=[],ra=null,oa=null,ia=null,Lf=new Map,Ff=new Map,Us=[],E5="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function KE(e,t){switch(e){case"focusin":case"focusout":ra=null;break;case"dragenter":case"dragleave":oa=null;break;case"mouseover":case"mouseout":ia=null;break;case"pointerover":case"pointerout":Lf.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ff.delete(t.pointerId)}}function md(e,t,n,r,o,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[o]},t!==null&&(t=Kh(t),t!==null&&f1(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function C5(e,t,n,r,o){switch(t){case"focusin":return ra=md(ra,e,t,n,r,o),!0;case"dragenter":return oa=md(oa,e,t,n,r,o),!0;case"mouseover":return ia=md(ia,e,t,n,r,o),!0;case"pointerover":var i=o.pointerId;return Lf.set(i,md(Lf.get(i)||null,e,t,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,Ff.set(i,md(Ff.get(i)||null,e,t,n,r,o)),!0}return!1}function eT(e){var t=il(e.target);if(t!==null){var n=Jl(t);if(n!==null){if(t=n.tag,t===13){if(t=Vj(n),t!==null){e.blockedOn=t,Qj(e.priority,function(){Xj(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function pm(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Y0(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);U0=r,n.target.dispatchEvent(r),U0=null}else return t=Kh(n),t!==null&&f1(t),e.blockedOn=n,!1;t.shift()}return!0}function GE(e,t,n){pm(e)&&n.delete(t)}function N5(){q0=!1,ra!==null&&pm(ra)&&(ra=null),oa!==null&&pm(oa)&&(oa=null),ia!==null&&pm(ia)&&(ia=null),Lf.forEach(GE),Ff.forEach(GE)}function gd(e,t){e.blockedOn===t&&(e.blockedOn=null,q0||(q0=!0,Wr.unstable_scheduleCallback(Wr.unstable_NormalPriority,N5)))}function zf(e){function t(o){return gd(o,e)}if(0<Lp.length){gd(Lp[0],e);for(var n=1;n<Lp.length;n++){var r=Lp[n];r.blockedOn===e&&(r.blockedOn=null)}}for(ra!==null&&gd(ra,e),oa!==null&&gd(oa,e),ia!==null&&gd(ia,e),Lf.forEach(t),Ff.forEach(t),n=0;n<Us.length;n++)r=Us[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Us.length&&(n=Us[0],n.blockedOn===null);)eT(n),n.blockedOn===null&&Us.shift()}var Wc=hs.ReactCurrentBatchConfig,Qm=!0;function P5(e,t,n,r){var o=pt,i=Wc.transition;Wc.transition=null;try{pt=1,h1(e,t,n,r)}finally{pt=o,Wc.transition=i}}function _5(e,t,n,r){var o=pt,i=Wc.transition;Wc.transition=null;try{pt=4,h1(e,t,n,r)}finally{pt=o,Wc.transition=i}}function h1(e,t,n,r){if(Qm){var o=Y0(e,t,n,r);if(o===null)mx(e,t,r,eg,n),KE(e,r);else if(C5(o,e,t,n,r))r.stopPropagation();else if(KE(e,r),t&4&&-1<E5.indexOf(e)){for(;o!==null;){var i=Kh(o);if(i!==null&&Jj(i),i=Y0(e,t,n,r),i===null&&mx(e,t,r,eg,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else mx(e,t,r,null,n)}}var eg=null;function Y0(e,t,n,r){if(eg=null,e=c1(r),e=il(e),e!==null)if(t=Jl(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Vj(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return eg=e,null}function tT(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(m5()){case u1:return 1;case Kj:return 4;case Xm:case g5:return 16;case Gj:return 536870912;default:return 16}default:return 16}}var Xs=null,p1=null,mm=null;function nT(){if(mm)return mm;var e,t=p1,n=t.length,r,o="value"in Xs?Xs.value:Xs.textContent,i=o.length;for(e=0;e<n&&t[e]===o[e];e++);var s=n-e;for(r=1;r<=s&&t[n-r]===o[i-r];r++);return mm=o.slice(e,1<r?1-r:void 0)}function gm(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Fp(){return!0}function qE(){return!1}function Xr(e){function t(n,r,o,i,s){this._reactName=n,this._targetInst=o,this.type=r,this.nativeEvent=i,this.target=s,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Fp:qE,this.isPropagationStopped=qE,this}return Lt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Fp)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Fp)},persist:function(){},isPersistent:Fp}),t}var zu={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},m1=Xr(zu),Hh=Lt({},zu,{view:0,detail:0}),j5=Xr(Hh),sx,ax,vd,_v=Lt({},Hh,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:g1,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==vd&&(vd&&e.type==="mousemove"?(sx=e.screenX-vd.screenX,ax=e.screenY-vd.screenY):ax=sx=0,vd=e),sx)},movementY:function(e){return"movementY"in e?e.movementY:ax}}),YE=Xr(_v),T5=Lt({},_v,{dataTransfer:0}),O5=Xr(T5),M5=Lt({},Hh,{relatedTarget:0}),lx=Xr(M5),R5=Lt({},zu,{animationName:0,elapsedTime:0,pseudoElement:0}),A5=Xr(R5),I5=Lt({},zu,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),D5=Xr(I5),L5=Lt({},zu,{data:0}),JE=Xr(L5),F5={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},z5={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},$5={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function B5(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=$5[e])?!!t[e]:!1}function g1(){return B5}var V5=Lt({},Hh,{key:function(e){if(e.key){var t=F5[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=gm(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?z5[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:g1,charCode:function(e){return e.type==="keypress"?gm(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?gm(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),U5=Xr(V5),W5=Lt({},_v,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),XE=Xr(W5),H5=Lt({},Hh,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:g1}),K5=Xr(H5),G5=Lt({},zu,{propertyName:0,elapsedTime:0,pseudoElement:0}),q5=Xr(G5),Y5=Lt({},_v,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),J5=Xr(Y5),X5=[9,13,27,32],v1=ns&&"CompositionEvent"in window,pf=null;ns&&"documentMode"in document&&(pf=document.documentMode);var Z5=ns&&"TextEvent"in window&&!pf,rT=ns&&(!v1||pf&&8<pf&&11>=pf),ZE=" ",QE=!1;function oT(e,t){switch(e){case"keyup":return X5.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function iT(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Tc=!1;function Q5(e,t){switch(e){case"compositionend":return iT(t);case"keypress":return t.which!==32?null:(QE=!0,ZE);case"textInput":return e=t.data,e===ZE&&QE?null:e;default:return null}}function ez(e,t){if(Tc)return e==="compositionend"||!v1&&oT(e,t)?(e=nT(),mm=p1=Xs=null,Tc=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return rT&&t.locale!=="ko"?null:t.data;default:return null}}var tz={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function eC(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!tz[e.type]:t==="textarea"}function sT(e,t,n,r){Lj(r),t=tg(t,"onChange"),0<t.length&&(n=new m1("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var mf=null,$f=null;function nz(e){vT(e,0)}function jv(e){var t=Rc(e);if(Tj(t))return e}function rz(e,t){if(e==="change")return t}var aT=!1;if(ns){var cx;if(ns){var ux="oninput"in document;if(!ux){var tC=document.createElement("div");tC.setAttribute("oninput","return;"),ux=typeof tC.oninput=="function"}cx=ux}else cx=!1;aT=cx&&(!document.documentMode||9<document.documentMode)}function nC(){mf&&(mf.detachEvent("onpropertychange",lT),$f=mf=null)}function lT(e){if(e.propertyName==="value"&&jv($f)){var t=[];sT(t,$f,e,c1(e)),Bj(nz,t)}}function oz(e,t,n){e==="focusin"?(nC(),mf=t,$f=n,mf.attachEvent("onpropertychange",lT)):e==="focusout"&&nC()}function iz(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return jv($f)}function sz(e,t){if(e==="click")return jv(t)}function az(e,t){if(e==="input"||e==="change")return jv(t)}function lz(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Yo=typeof Object.is=="function"?Object.is:lz;function Bf(e,t){if(Yo(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var o=n[r];if(!O0.call(t,o)||!Yo(e[o],t[o]))return!1}return!0}function rC(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function oC(e,t){var n=rC(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=rC(n)}}function cT(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?cT(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function uT(){for(var e=window,t=qm();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=qm(e.document)}return t}function y1(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function cz(e){var t=uT(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&cT(n.ownerDocument.documentElement,n)){if(r!==null&&y1(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!e.extend&&i>r&&(o=r,r=i,i=o),o=oC(n,i);var s=oC(n,r);o&&s&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var uz=ns&&"documentMode"in document&&11>=document.documentMode,Oc=null,J0=null,gf=null,X0=!1;function iC(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;X0||Oc==null||Oc!==qm(r)||(r=Oc,"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}),gf&&Bf(gf,r)||(gf=r,r=tg(J0,"onSelect"),0<r.length&&(t=new m1("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Oc)))}function zp(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Mc={animationend:zp("Animation","AnimationEnd"),animationiteration:zp("Animation","AnimationIteration"),animationstart:zp("Animation","AnimationStart"),transitionend:zp("Transition","TransitionEnd")},dx={},dT={};ns&&(dT=document.createElement("div").style,"AnimationEvent"in window||(delete Mc.animationend.animation,delete Mc.animationiteration.animation,delete Mc.animationstart.animation),"TransitionEvent"in window||delete Mc.transitionend.transition);function Tv(e){if(dx[e])return dx[e];if(!Mc[e])return e;var t=Mc[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in dT)return dx[e]=t[n];return e}var fT=Tv("animationend"),hT=Tv("animationiteration"),pT=Tv("animationstart"),mT=Tv("transitionend"),gT=new Map,sC="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function La(e,t){gT.set(e,t),Yl(t,[e])}for(var fx=0;fx<sC.length;fx++){var hx=sC[fx],dz=hx.toLowerCase(),fz=hx[0].toUpperCase()+hx.slice(1);La(dz,"on"+fz)}La(fT,"onAnimationEnd");La(hT,"onAnimationIteration");La(pT,"onAnimationStart");La("dblclick","onDoubleClick");La("focusin","onFocus");La("focusout","onBlur");La(mT,"onTransitionEnd");iu("onMouseEnter",["mouseout","mouseover"]);iu("onMouseLeave",["mouseout","mouseover"]);iu("onPointerEnter",["pointerout","pointerover"]);iu("onPointerLeave",["pointerout","pointerover"]);Yl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Yl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Yl("onBeforeInput",["compositionend","keypress","textInput","paste"]);Yl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Yl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Yl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Id="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),hz=new Set("cancel close invalid load scroll toggle".split(" ").concat(Id));function aC(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,d5(r,t,void 0,e),e.currentTarget=null}function vT(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var s=r.length-1;0<=s;s--){var a=r[s],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==i&&o.isPropagationStopped())break e;aC(o,a,c),i=l}else for(s=0;s<r.length;s++){if(a=r[s],l=a.instance,c=a.currentTarget,a=a.listener,l!==i&&o.isPropagationStopped())break e;aC(o,a,c),i=l}}}if(Jm)throw e=K0,Jm=!1,K0=null,e}function Ct(e,t){var n=t[nb];n===void 0&&(n=t[nb]=new Set);var r=e+"__bubble";n.has(r)||(yT(t,e,2,!1),n.add(r))}function px(e,t,n){var r=0;t&&(r|=4),yT(n,e,r,t)}var $p="_reactListening"+Math.random().toString(36).slice(2);function Vf(e){if(!e[$p]){e[$p]=!0,Cj.forEach(function(n){n!=="selectionchange"&&(hz.has(n)||px(n,!1,e),px(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[$p]||(t[$p]=!0,px("selectionchange",!1,t))}}function yT(e,t,n,r){switch(tT(t)){case 1:var o=P5;break;case 4:o=_5;break;default:o=h1}n=o.bind(null,t,n,e),o=void 0,!H0||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),r?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function mx(e,t,n,r,o){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var a=r.stateNode.containerInfo;if(a===o||a.nodeType===8&&a.parentNode===o)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&(l=s.stateNode.containerInfo,l===o||l.nodeType===8&&l.parentNode===o))return;s=s.return}for(;a!==null;){if(s=il(a),s===null)return;if(l=s.tag,l===5||l===6){r=i=s;continue e}a=a.parentNode}}r=r.return}Bj(function(){var c=i,u=c1(n),f=[];e:{var h=gT.get(e);if(h!==void 0){var p=m1,m=e;switch(e){case"keypress":if(gm(n)===0)break e;case"keydown":case"keyup":p=U5;break;case"focusin":m="focus",p=lx;break;case"focusout":m="blur",p=lx;break;case"beforeblur":case"afterblur":p=lx;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=YE;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=O5;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=K5;break;case fT:case hT:case pT:p=A5;break;case mT:p=q5;break;case"scroll":p=j5;break;case"wheel":p=J5;break;case"copy":case"cut":case"paste":p=D5;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=XE}var v=(t&4)!==0,x=!v&&e==="scroll",b=v?h!==null?h+"Capture":null:h;v=[];for(var w=c,S;w!==null;){S=w;var C=S.stateNode;if(S.tag===5&&C!==null&&(S=C,b!==null&&(C=Df(w,b),C!=null&&v.push(Uf(w,C,S)))),x)break;w=w.return}0<v.length&&(h=new p(h,m,null,n,u),f.push({event:h,listeners:v}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",h&&n!==U0&&(m=n.relatedTarget||n.fromElement)&&(il(m)||m[rs]))break e;if((p||h)&&(h=u.window===u?u:(h=u.ownerDocument)?h.defaultView||h.parentWindow:window,p?(m=n.relatedTarget||n.toElement,p=c,m=m?il(m):null,m!==null&&(x=Jl(m),m!==x||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=c),p!==m)){if(v=YE,C="onMouseLeave",b="onMouseEnter",w="mouse",(e==="pointerout"||e==="pointerover")&&(v=XE,C="onPointerLeave",b="onPointerEnter",w="pointer"),x=p==null?h:Rc(p),S=m==null?h:Rc(m),h=new v(C,w+"leave",p,n,u),h.target=x,h.relatedTarget=S,C=null,il(u)===c&&(v=new v(b,w+"enter",m,n,u),v.target=S,v.relatedTarget=x,C=v),x=C,p&&m)t:{for(v=p,b=m,w=0,S=v;S;S=sc(S))w++;for(S=0,C=b;C;C=sc(C))S++;for(;0<w-S;)v=sc(v),w--;for(;0<S-w;)b=sc(b),S--;for(;w--;){if(v===b||b!==null&&v===b.alternate)break t;v=sc(v),b=sc(b)}v=null}else v=null;p!==null&&lC(f,h,p,v,!1),m!==null&&x!==null&&lC(f,x,m,v,!0)}}e:{if(h=c?Rc(c):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var N=rz;else if(eC(h))if(aT)N=az;else{N=iz;var P=oz}else(p=h.nodeName)&&p.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(N=sz);if(N&&(N=N(e,c))){sT(f,N,n,u);break e}P&&P(e,h,c),e==="focusout"&&(P=h._wrapperState)&&P.controlled&&h.type==="number"&&F0(h,"number",h.value)}switch(P=c?Rc(c):window,e){case"focusin":(eC(P)||P.contentEditable==="true")&&(Oc=P,J0=c,gf=null);break;case"focusout":gf=J0=Oc=null;break;case"mousedown":X0=!0;break;case"contextmenu":case"mouseup":case"dragend":X0=!1,iC(f,n,u);break;case"selectionchange":if(uz)break;case"keydown":case"keyup":iC(f,n,u)}var _;if(v1)e:{switch(e){case"compositionstart":var O="onCompositionStart";break e;case"compositionend":O="onCompositionEnd";break e;case"compositionupdate":O="onCompositionUpdate";break e}O=void 0}else Tc?oT(e,n)&&(O="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(O="onCompositionStart");O&&(rT&&n.locale!=="ko"&&(Tc||O!=="onCompositionStart"?O==="onCompositionEnd"&&Tc&&(_=nT()):(Xs=u,p1="value"in Xs?Xs.value:Xs.textContent,Tc=!0)),P=tg(c,O),0<P.length&&(O=new JE(O,e,null,n,u),f.push({event:O,listeners:P}),_?O.data=_:(_=iT(n),_!==null&&(O.data=_)))),(_=Z5?Q5(e,n):ez(e,n))&&(c=tg(c,"onBeforeInput"),0<c.length&&(u=new JE("onBeforeInput","beforeinput",null,n,u),f.push({event:u,listeners:c}),u.data=_))}vT(f,t)})}function Uf(e,t,n){return{instance:e,listener:t,currentTarget:n}}function tg(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=Df(e,n),i!=null&&r.unshift(Uf(e,i,o)),i=Df(e,t),i!=null&&r.push(Uf(e,i,o))),e=e.return}return r}function sc(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function lC(e,t,n,r,o){for(var i=t._reactName,s=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&c!==null&&(a=c,o?(l=Df(n,i),l!=null&&s.unshift(Uf(n,l,a))):o||(l=Df(n,i),l!=null&&s.push(Uf(n,l,a)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var pz=/\r\n?/g,mz=/\u0000|\uFFFD/g;function cC(e){return(typeof e=="string"?e:""+e).replace(pz,`
|
|
30
|
-
`).replace(mz,"")}function Bp(e,t,n){if(t=cC(t),cC(e)!==t&&n)throw Error(te(425))}function ng(){}var Z0=null,Q0=null;function eb(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var tb=typeof setTimeout=="function"?setTimeout:void 0,gz=typeof clearTimeout=="function"?clearTimeout:void 0,uC=typeof Promise=="function"?Promise:void 0,vz=typeof queueMicrotask=="function"?queueMicrotask:typeof uC<"u"?function(e){return uC.resolve(null).then(e).catch(yz)}:tb;function yz(e){setTimeout(function(){throw e})}function gx(e,t){var n=t,r=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"){if(r===0){e.removeChild(o),zf(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);zf(t)}function sa(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function dC(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var $u=Math.random().toString(36).slice(2),di="__reactFiber$"+$u,Wf="__reactProps$"+$u,rs="__reactContainer$"+$u,nb="__reactEvents$"+$u,xz="__reactListeners$"+$u,bz="__reactHandles$"+$u;function il(e){var t=e[di];if(t)return t;for(var n=e.parentNode;n;){if(t=n[rs]||n[di]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=dC(e);e!==null;){if(n=e[di])return n;e=dC(e)}return t}e=n,n=e.parentNode}return null}function Kh(e){return e=e[di]||e[rs],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Rc(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(te(33))}function Ov(e){return e[Wf]||null}var rb=[],Ac=-1;function Fa(e){return{current:e}}function Nt(e){0>Ac||(e.current=rb[Ac],rb[Ac]=null,Ac--)}function St(e,t){Ac++,rb[Ac]=e.current,e.current=t}var xa={},Wn=Fa(xa),mr=Fa(!1),Sl=xa;function su(e,t){var n=e.type.contextTypes;if(!n)return xa;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function gr(e){return e=e.childContextTypes,e!=null}function rg(){Nt(mr),Nt(Wn)}function fC(e,t,n){if(Wn.current!==xa)throw Error(te(168));St(Wn,t),St(mr,n)}function xT(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(te(108,o5(e)||"Unknown",o));return Lt({},n,r)}function og(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||xa,Sl=Wn.current,St(Wn,e),St(mr,mr.current),!0}function hC(e,t,n){var r=e.stateNode;if(!r)throw Error(te(169));n?(e=xT(e,t,Sl),r.__reactInternalMemoizedMergedChildContext=e,Nt(mr),Nt(Wn),St(Wn,e)):Nt(mr),St(mr,n)}var Vi=null,Mv=!1,vx=!1;function bT(e){Vi===null?Vi=[e]:Vi.push(e)}function wz(e){Mv=!0,bT(e)}function za(){if(!vx&&Vi!==null){vx=!0;var e=0,t=pt;try{var n=Vi;for(pt=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Vi=null,Mv=!1}catch(o){throw Vi!==null&&(Vi=Vi.slice(e+1)),Hj(u1,za),o}finally{pt=t,vx=!1}}return null}var Ic=[],Dc=0,ig=null,sg=0,ao=[],lo=0,kl=null,Ki=1,Gi="";function Ya(e,t){Ic[Dc++]=sg,Ic[Dc++]=ig,ig=e,sg=t}function wT(e,t,n){ao[lo++]=Ki,ao[lo++]=Gi,ao[lo++]=kl,kl=e;var r=Ki;e=Gi;var o=32-Ho(r)-1;r&=~(1<<o),n+=1;var i=32-Ho(t)+o;if(30<i){var s=o-o%5;i=(r&(1<<s)-1).toString(32),r>>=s,o-=s,Ki=1<<32-Ho(t)+o|n<<o|r,Gi=i+e}else Ki=1<<i|n<<o|r,Gi=e}function x1(e){e.return!==null&&(Ya(e,1),wT(e,1,0))}function b1(e){for(;e===ig;)ig=Ic[--Dc],Ic[Dc]=null,sg=Ic[--Dc],Ic[Dc]=null;for(;e===kl;)kl=ao[--lo],ao[lo]=null,Gi=ao[--lo],ao[lo]=null,Ki=ao[--lo],ao[lo]=null}var $r=null,Lr=null,Pt=!1,Lo=null;function ST(e,t){var n=fo(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function pC(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,$r=e,Lr=sa(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,$r=e,Lr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=kl!==null?{id:Ki,overflow:Gi}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=fo(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,$r=e,Lr=null,!0):!1;default:return!1}}function ob(e){return(e.mode&1)!==0&&(e.flags&128)===0}function ib(e){if(Pt){var t=Lr;if(t){var n=t;if(!pC(e,t)){if(ob(e))throw Error(te(418));t=sa(n.nextSibling);var r=$r;t&&pC(e,t)?ST(r,n):(e.flags=e.flags&-4097|2,Pt=!1,$r=e)}}else{if(ob(e))throw Error(te(418));e.flags=e.flags&-4097|2,Pt=!1,$r=e}}}function mC(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;$r=e}function Vp(e){if(e!==$r)return!1;if(!Pt)return mC(e),Pt=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!eb(e.type,e.memoizedProps)),t&&(t=Lr)){if(ob(e))throw kT(),Error(te(418));for(;t;)ST(e,t),t=sa(t.nextSibling)}if(mC(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(te(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Lr=sa(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Lr=null}}else Lr=$r?sa(e.stateNode.nextSibling):null;return!0}function kT(){for(var e=Lr;e;)e=sa(e.nextSibling)}function au(){Lr=$r=null,Pt=!1}function w1(e){Lo===null?Lo=[e]:Lo.push(e)}var Sz=hs.ReactCurrentBatchConfig;function yd(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(te(309));var r=n.stateNode}if(!r)throw Error(te(147,e));var o=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(s){var a=o.refs;s===null?delete a[i]:a[i]=s},t._stringRef=i,t)}if(typeof e!="string")throw Error(te(284));if(!n._owner)throw Error(te(290,e))}return e}function Up(e,t){throw e=Object.prototype.toString.call(t),Error(te(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function gC(e){var t=e._init;return t(e._payload)}function ET(e){function t(b,w){if(e){var S=b.deletions;S===null?(b.deletions=[w],b.flags|=16):S.push(w)}}function n(b,w){if(!e)return null;for(;w!==null;)t(b,w),w=w.sibling;return null}function r(b,w){for(b=new Map;w!==null;)w.key!==null?b.set(w.key,w):b.set(w.index,w),w=w.sibling;return b}function o(b,w){return b=ua(b,w),b.index=0,b.sibling=null,b}function i(b,w,S){return b.index=S,e?(S=b.alternate,S!==null?(S=S.index,S<w?(b.flags|=2,w):S):(b.flags|=2,w)):(b.flags|=1048576,w)}function s(b){return e&&b.alternate===null&&(b.flags|=2),b}function a(b,w,S,C){return w===null||w.tag!==6?(w=Ex(S,b.mode,C),w.return=b,w):(w=o(w,S),w.return=b,w)}function l(b,w,S,C){var N=S.type;return N===jc?u(b,w,S.props.children,C,S.key):w!==null&&(w.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===Fs&&gC(N)===w.type)?(C=o(w,S.props),C.ref=yd(b,w,S),C.return=b,C):(C=km(S.type,S.key,S.props,null,b.mode,C),C.ref=yd(b,w,S),C.return=b,C)}function c(b,w,S,C){return w===null||w.tag!==4||w.stateNode.containerInfo!==S.containerInfo||w.stateNode.implementation!==S.implementation?(w=Cx(S,b.mode,C),w.return=b,w):(w=o(w,S.children||[]),w.return=b,w)}function u(b,w,S,C,N){return w===null||w.tag!==7?(w=ml(S,b.mode,C,N),w.return=b,w):(w=o(w,S),w.return=b,w)}function f(b,w,S){if(typeof w=="string"&&w!==""||typeof w=="number")return w=Ex(""+w,b.mode,S),w.return=b,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Mp:return S=km(w.type,w.key,w.props,null,b.mode,S),S.ref=yd(b,null,w),S.return=b,S;case _c:return w=Cx(w,b.mode,S),w.return=b,w;case Fs:var C=w._init;return f(b,C(w._payload),S)}if(Rd(w)||hd(w))return w=ml(w,b.mode,S,null),w.return=b,w;Up(b,w)}return null}function h(b,w,S,C){var N=w!==null?w.key:null;if(typeof S=="string"&&S!==""||typeof S=="number")return N!==null?null:a(b,w,""+S,C);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case Mp:return S.key===N?l(b,w,S,C):null;case _c:return S.key===N?c(b,w,S,C):null;case Fs:return N=S._init,h(b,w,N(S._payload),C)}if(Rd(S)||hd(S))return N!==null?null:u(b,w,S,C,null);Up(b,S)}return null}function p(b,w,S,C,N){if(typeof C=="string"&&C!==""||typeof C=="number")return b=b.get(S)||null,a(w,b,""+C,N);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case Mp:return b=b.get(C.key===null?S:C.key)||null,l(w,b,C,N);case _c:return b=b.get(C.key===null?S:C.key)||null,c(w,b,C,N);case Fs:var P=C._init;return p(b,w,S,P(C._payload),N)}if(Rd(C)||hd(C))return b=b.get(S)||null,u(w,b,C,N,null);Up(w,C)}return null}function m(b,w,S,C){for(var N=null,P=null,_=w,O=w=0,M=null;_!==null&&O<S.length;O++){_.index>O?(M=_,_=null):M=_.sibling;var D=h(b,_,S[O],C);if(D===null){_===null&&(_=M);break}e&&_&&D.alternate===null&&t(b,_),w=i(D,w,O),P===null?N=D:P.sibling=D,P=D,_=M}if(O===S.length)return n(b,_),Pt&&Ya(b,O),N;if(_===null){for(;O<S.length;O++)_=f(b,S[O],C),_!==null&&(w=i(_,w,O),P===null?N=_:P.sibling=_,P=_);return Pt&&Ya(b,O),N}for(_=r(b,_);O<S.length;O++)M=p(_,b,O,S[O],C),M!==null&&(e&&M.alternate!==null&&_.delete(M.key===null?O:M.key),w=i(M,w,O),P===null?N=M:P.sibling=M,P=M);return e&&_.forEach(function(U){return t(b,U)}),Pt&&Ya(b,O),N}function v(b,w,S,C){var N=hd(S);if(typeof N!="function")throw Error(te(150));if(S=N.call(S),S==null)throw Error(te(151));for(var P=N=null,_=w,O=w=0,M=null,D=S.next();_!==null&&!D.done;O++,D=S.next()){_.index>O?(M=_,_=null):M=_.sibling;var U=h(b,_,D.value,C);if(U===null){_===null&&(_=M);break}e&&_&&U.alternate===null&&t(b,_),w=i(U,w,O),P===null?N=U:P.sibling=U,P=U,_=M}if(D.done)return n(b,_),Pt&&Ya(b,O),N;if(_===null){for(;!D.done;O++,D=S.next())D=f(b,D.value,C),D!==null&&(w=i(D,w,O),P===null?N=D:P.sibling=D,P=D);return Pt&&Ya(b,O),N}for(_=r(b,_);!D.done;O++,D=S.next())D=p(_,b,O,D.value,C),D!==null&&(e&&D.alternate!==null&&_.delete(D.key===null?O:D.key),w=i(D,w,O),P===null?N=D:P.sibling=D,P=D);return e&&_.forEach(function(z){return t(b,z)}),Pt&&Ya(b,O),N}function x(b,w,S,C){if(typeof S=="object"&&S!==null&&S.type===jc&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case Mp:e:{for(var N=S.key,P=w;P!==null;){if(P.key===N){if(N=S.type,N===jc){if(P.tag===7){n(b,P.sibling),w=o(P,S.props.children),w.return=b,b=w;break e}}else if(P.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===Fs&&gC(N)===P.type){n(b,P.sibling),w=o(P,S.props),w.ref=yd(b,P,S),w.return=b,b=w;break e}n(b,P);break}else t(b,P);P=P.sibling}S.type===jc?(w=ml(S.props.children,b.mode,C,S.key),w.return=b,b=w):(C=km(S.type,S.key,S.props,null,b.mode,C),C.ref=yd(b,w,S),C.return=b,b=C)}return s(b);case _c:e:{for(P=S.key;w!==null;){if(w.key===P)if(w.tag===4&&w.stateNode.containerInfo===S.containerInfo&&w.stateNode.implementation===S.implementation){n(b,w.sibling),w=o(w,S.children||[]),w.return=b,b=w;break e}else{n(b,w);break}else t(b,w);w=w.sibling}w=Cx(S,b.mode,C),w.return=b,b=w}return s(b);case Fs:return P=S._init,x(b,w,P(S._payload),C)}if(Rd(S))return m(b,w,S,C);if(hd(S))return v(b,w,S,C);Up(b,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,w!==null&&w.tag===6?(n(b,w.sibling),w=o(w,S),w.return=b,b=w):(n(b,w),w=Ex(S,b.mode,C),w.return=b,b=w),s(b)):n(b,w)}return x}var lu=ET(!0),CT=ET(!1),ag=Fa(null),lg=null,Lc=null,S1=null;function k1(){S1=Lc=lg=null}function E1(e){var t=ag.current;Nt(ag),e._currentValue=t}function sb(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Hc(e,t){lg=e,S1=Lc=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ur=!0),e.firstContext=null)}function vo(e){var t=e._currentValue;if(S1!==e)if(e={context:e,memoizedValue:t,next:null},Lc===null){if(lg===null)throw Error(te(308));Lc=e,lg.dependencies={lanes:0,firstContext:e}}else Lc=Lc.next=e;return t}var sl=null;function C1(e){sl===null?sl=[e]:sl.push(e)}function NT(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,C1(t)):(n.next=o.next,o.next=n),t.interleaved=n,is(e,r)}function is(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var zs=!1;function N1(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function PT(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Zi(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function aa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,rt&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,is(e,n)}return o=r.interleaved,o===null?(t.next=t,C1(r)):(t.next=o.next,o.next=t),r.interleaved=t,is(e,n)}function vm(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,d1(e,n)}}function vC(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?o=i=t:i=i.next=t}else o=i=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function cg(e,t,n,r){var o=e.updateQueue;zs=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,a=o.shared.pending;if(a!==null){o.shared.pending=null;var l=a,c=l.next;l.next=null,s===null?i=c:s.next=c,s=l;var u=e.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==s&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(i!==null){var f=o.baseState;s=0,u=c=l=null,a=i;do{var h=a.lane,p=a.eventTime;if((r&h)===h){u!==null&&(u=u.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var m=e,v=a;switch(h=t,p=n,v.tag){case 1:if(m=v.payload,typeof m=="function"){f=m.call(p,f,h);break e}f=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=v.payload,h=typeof m=="function"?m.call(p,f,h):m,h==null)break e;f=Lt({},f,h);break e;case 2:zs=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,h=o.effects,h===null?o.effects=[a]:h.push(a))}else p={eventTime:p,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=p,l=f):u=u.next=p,s|=h;if(a=a.next,a===null){if(a=o.shared.pending,a===null)break;h=a,a=h.next,h.next=null,o.lastBaseUpdate=h,o.shared.pending=null}}while(!0);if(u===null&&(l=f),o.baseState=l,o.firstBaseUpdate=c,o.lastBaseUpdate=u,t=o.shared.interleaved,t!==null){o=t;do s|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);Cl|=s,e.lanes=s,e.memoizedState=f}}function yC(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],o=r.callback;if(o!==null){if(r.callback=null,r=n,typeof o!="function")throw Error(te(191,o));o.call(r)}}}var Gh={},mi=Fa(Gh),Hf=Fa(Gh),Kf=Fa(Gh);function al(e){if(e===Gh)throw Error(te(174));return e}function P1(e,t){switch(St(Kf,t),St(Hf,e),St(mi,Gh),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:$0(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=$0(t,e)}Nt(mi),St(mi,t)}function cu(){Nt(mi),Nt(Hf),Nt(Kf)}function _T(e){al(Kf.current);var t=al(mi.current),n=$0(t,e.type);t!==n&&(St(Hf,e),St(mi,n))}function _1(e){Hf.current===e&&(Nt(mi),Nt(Hf))}var At=Fa(0);function ug(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var yx=[];function j1(){for(var e=0;e<yx.length;e++)yx[e]._workInProgressVersionPrimary=null;yx.length=0}var ym=hs.ReactCurrentDispatcher,xx=hs.ReactCurrentBatchConfig,El=0,Dt=null,en=null,dn=null,dg=!1,vf=!1,Gf=0,kz=0;function Fn(){throw Error(te(321))}function T1(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Yo(e[n],t[n]))return!1;return!0}function O1(e,t,n,r,o,i){if(El=i,Dt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ym.current=e===null||e.memoizedState===null?Pz:_z,e=n(r,o),vf){i=0;do{if(vf=!1,Gf=0,25<=i)throw Error(te(301));i+=1,dn=en=null,t.updateQueue=null,ym.current=jz,e=n(r,o)}while(vf)}if(ym.current=fg,t=en!==null&&en.next!==null,El=0,dn=en=Dt=null,dg=!1,t)throw Error(te(300));return e}function M1(){var e=Gf!==0;return Gf=0,e}function ci(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dn===null?Dt.memoizedState=dn=e:dn=dn.next=e,dn}function yo(){if(en===null){var e=Dt.alternate;e=e!==null?e.memoizedState:null}else e=en.next;var t=dn===null?Dt.memoizedState:dn.next;if(t!==null)dn=t,en=e;else{if(e===null)throw Error(te(310));en=e,e={memoizedState:en.memoizedState,baseState:en.baseState,baseQueue:en.baseQueue,queue:en.queue,next:null},dn===null?Dt.memoizedState=dn=e:dn=dn.next=e}return dn}function qf(e,t){return typeof t=="function"?t(e):t}function bx(e){var t=yo(),n=t.queue;if(n===null)throw Error(te(311));n.lastRenderedReducer=e;var r=en,o=r.baseQueue,i=n.pending;if(i!==null){if(o!==null){var s=o.next;o.next=i.next,i.next=s}r.baseQueue=o=i,n.pending=null}if(o!==null){i=o.next,r=r.baseState;var a=s=null,l=null,c=i;do{var u=c.lane;if((El&u)===u)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var f={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=f,s=r):l=l.next=f,Dt.lanes|=u,Cl|=u}c=c.next}while(c!==null&&c!==i);l===null?s=r:l.next=a,Yo(r,t.memoizedState)||(ur=!0),t.memoizedState=r,t.baseState=s,t.baseQueue=l,n.lastRenderedState=r}if(e=n.interleaved,e!==null){o=e;do i=o.lane,Dt.lanes|=i,Cl|=i,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function wx(e){var t=yo(),n=t.queue;if(n===null)throw Error(te(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,i=t.memoizedState;if(o!==null){n.pending=null;var s=o=o.next;do i=e(i,s.action),s=s.next;while(s!==o);Yo(i,t.memoizedState)||(ur=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function jT(){}function TT(e,t){var n=Dt,r=yo(),o=t(),i=!Yo(r.memoizedState,o);if(i&&(r.memoizedState=o,ur=!0),r=r.queue,R1(RT.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||dn!==null&&dn.memoizedState.tag&1){if(n.flags|=2048,Yf(9,MT.bind(null,n,r,o,t),void 0,null),mn===null)throw Error(te(349));El&30||OT(n,t,o)}return o}function OT(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Dt.updateQueue,t===null?(t={lastEffect:null,stores:null},Dt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function MT(e,t,n,r){t.value=n,t.getSnapshot=r,AT(t)&&IT(e)}function RT(e,t,n){return n(function(){AT(t)&&IT(e)})}function AT(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Yo(e,n)}catch{return!0}}function IT(e){var t=is(e,1);t!==null&&Ko(t,e,1,-1)}function xC(e){var t=ci();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:qf,lastRenderedState:e},t.queue=e,e=e.dispatch=Nz.bind(null,Dt,e),[t.memoizedState,e]}function Yf(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Dt.updateQueue,t===null?(t={lastEffect:null,stores:null},Dt.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function DT(){return yo().memoizedState}function xm(e,t,n,r){var o=ci();Dt.flags|=e,o.memoizedState=Yf(1|t,n,void 0,r===void 0?null:r)}function Rv(e,t,n,r){var o=yo();r=r===void 0?null:r;var i=void 0;if(en!==null){var s=en.memoizedState;if(i=s.destroy,r!==null&&T1(r,s.deps)){o.memoizedState=Yf(t,n,i,r);return}}Dt.flags|=e,o.memoizedState=Yf(1|t,n,i,r)}function bC(e,t){return xm(8390656,8,e,t)}function R1(e,t){return Rv(2048,8,e,t)}function LT(e,t){return Rv(4,2,e,t)}function FT(e,t){return Rv(4,4,e,t)}function zT(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function $T(e,t,n){return n=n!=null?n.concat([e]):null,Rv(4,4,zT.bind(null,t,e),n)}function A1(){}function BT(e,t){var n=yo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&T1(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function VT(e,t){var n=yo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&T1(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function UT(e,t,n){return El&21?(Yo(n,t)||(n=qj(),Dt.lanes|=n,Cl|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,ur=!0),e.memoizedState=n)}function Ez(e,t){var n=pt;pt=n!==0&&4>n?n:4,e(!0);var r=xx.transition;xx.transition={};try{e(!1),t()}finally{pt=n,xx.transition=r}}function WT(){return yo().memoizedState}function Cz(e,t,n){var r=ca(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},HT(e))KT(t,n);else if(n=NT(e,t,n,r),n!==null){var o=Zn();Ko(n,e,r,o),GT(n,t,r)}}function Nz(e,t,n){var r=ca(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(HT(e))KT(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,a=i(s,n);if(o.hasEagerState=!0,o.eagerState=a,Yo(a,s)){var l=t.interleaved;l===null?(o.next=o,C1(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}n=NT(e,t,o,r),n!==null&&(o=Zn(),Ko(n,e,r,o),GT(n,t,r))}}function HT(e){var t=e.alternate;return e===Dt||t!==null&&t===Dt}function KT(e,t){vf=dg=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function GT(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,d1(e,n)}}var fg={readContext:vo,useCallback:Fn,useContext:Fn,useEffect:Fn,useImperativeHandle:Fn,useInsertionEffect:Fn,useLayoutEffect:Fn,useMemo:Fn,useReducer:Fn,useRef:Fn,useState:Fn,useDebugValue:Fn,useDeferredValue:Fn,useTransition:Fn,useMutableSource:Fn,useSyncExternalStore:Fn,useId:Fn,unstable_isNewReconciler:!1},Pz={readContext:vo,useCallback:function(e,t){return ci().memoizedState=[e,t===void 0?null:t],e},useContext:vo,useEffect:bC,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,xm(4194308,4,zT.bind(null,t,e),n)},useLayoutEffect:function(e,t){return xm(4194308,4,e,t)},useInsertionEffect:function(e,t){return xm(4,2,e,t)},useMemo:function(e,t){var n=ci();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ci();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Cz.bind(null,Dt,e),[r.memoizedState,e]},useRef:function(e){var t=ci();return e={current:e},t.memoizedState=e},useState:xC,useDebugValue:A1,useDeferredValue:function(e){return ci().memoizedState=e},useTransition:function(){var e=xC(!1),t=e[0];return e=Ez.bind(null,e[1]),ci().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Dt,o=ci();if(Pt){if(n===void 0)throw Error(te(407));n=n()}else{if(n=t(),mn===null)throw Error(te(349));El&30||OT(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,bC(RT.bind(null,r,i,e),[e]),r.flags|=2048,Yf(9,MT.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=ci(),t=mn.identifierPrefix;if(Pt){var n=Gi,r=Ki;n=(r&~(1<<32-Ho(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Gf++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=kz++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},_z={readContext:vo,useCallback:BT,useContext:vo,useEffect:R1,useImperativeHandle:$T,useInsertionEffect:LT,useLayoutEffect:FT,useMemo:VT,useReducer:bx,useRef:DT,useState:function(){return bx(qf)},useDebugValue:A1,useDeferredValue:function(e){var t=yo();return UT(t,en.memoizedState,e)},useTransition:function(){var e=bx(qf)[0],t=yo().memoizedState;return[e,t]},useMutableSource:jT,useSyncExternalStore:TT,useId:WT,unstable_isNewReconciler:!1},jz={readContext:vo,useCallback:BT,useContext:vo,useEffect:R1,useImperativeHandle:$T,useInsertionEffect:LT,useLayoutEffect:FT,useMemo:VT,useReducer:wx,useRef:DT,useState:function(){return wx(qf)},useDebugValue:A1,useDeferredValue:function(e){var t=yo();return en===null?t.memoizedState=e:UT(t,en.memoizedState,e)},useTransition:function(){var e=wx(qf)[0],t=yo().memoizedState;return[e,t]},useMutableSource:jT,useSyncExternalStore:TT,useId:WT,unstable_isNewReconciler:!1};function Ao(e,t){if(e&&e.defaultProps){t=Lt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function ab(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Lt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Av={isMounted:function(e){return(e=e._reactInternals)?Jl(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Zn(),o=ca(e),i=Zi(r,o);i.payload=t,n!=null&&(i.callback=n),t=aa(e,i,o),t!==null&&(Ko(t,e,o,r),vm(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Zn(),o=ca(e),i=Zi(r,o);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=aa(e,i,o),t!==null&&(Ko(t,e,o,r),vm(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Zn(),r=ca(e),o=Zi(n,r);o.tag=2,t!=null&&(o.callback=t),t=aa(e,o,r),t!==null&&(Ko(t,e,r,n),vm(t,e,r))}};function wC(e,t,n,r,o,i,s){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,s):t.prototype&&t.prototype.isPureReactComponent?!Bf(n,r)||!Bf(o,i):!0}function qT(e,t,n){var r=!1,o=xa,i=t.contextType;return typeof i=="object"&&i!==null?i=vo(i):(o=gr(t)?Sl:Wn.current,r=t.contextTypes,i=(r=r!=null)?su(e,o):xa),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Av,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function SC(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Av.enqueueReplaceState(t,t.state,null)}function lb(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},N1(e);var i=t.contextType;typeof i=="object"&&i!==null?o.context=vo(i):(i=gr(t)?Sl:Wn.current,o.context=su(e,i)),o.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(ab(e,t,i,n),o.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(t=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),t!==o.state&&Av.enqueueReplaceState(o,o.state,null),cg(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function uu(e,t){try{var n="",r=t;do n+=r5(r),r=r.return;while(r);var o=n}catch(i){o=`
|
|
31
|
-
Error generating stack: `+i.message+`
|
|
32
|
-
`+i.stack}return{value:e,source:t,stack:o,digest:null}}function Sx(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function cb(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Tz=typeof WeakMap=="function"?WeakMap:Map;function YT(e,t,n){n=Zi(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){pg||(pg=!0,xb=r),cb(e,t)},n}function JT(e,t,n){n=Zi(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){cb(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){cb(e,t),typeof r!="function"&&(la===null?la=new Set([this]):la.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function kC(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Tz;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=Wz.bind(null,e,t,n),t.then(e,e))}function EC(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function CC(e,t,n,r,o){return e.mode&1?(e.flags|=65536,e.lanes=o,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Zi(-1,1),t.tag=2,aa(n,t,1))),n.lanes|=1),e)}var Oz=hs.ReactCurrentOwner,ur=!1;function Jn(e,t,n,r){t.child=e===null?CT(t,null,n,r):lu(t,e.child,n,r)}function NC(e,t,n,r,o){n=n.render;var i=t.ref;return Hc(t,o),r=O1(e,t,n,r,i,o),n=M1(),e!==null&&!ur?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,ss(e,t,o)):(Pt&&n&&x1(t),t.flags|=1,Jn(e,t,r,o),t.child)}function PC(e,t,n,r,o){if(e===null){var i=n.type;return typeof i=="function"&&!V1(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,XT(e,t,i,r,o)):(e=km(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&o)){var s=i.memoizedProps;if(n=n.compare,n=n!==null?n:Bf,n(s,r)&&e.ref===t.ref)return ss(e,t,o)}return t.flags|=1,e=ua(i,r),e.ref=t.ref,e.return=t,t.child=e}function XT(e,t,n,r,o){if(e!==null){var i=e.memoizedProps;if(Bf(i,r)&&e.ref===t.ref)if(ur=!1,t.pendingProps=r=i,(e.lanes&o)!==0)e.flags&131072&&(ur=!0);else return t.lanes=e.lanes,ss(e,t,o)}return ub(e,t,n,r,o)}function ZT(e,t,n){var r=t.pendingProps,o=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},St(zc,Rr),Rr|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,St(zc,Rr),Rr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,St(zc,Rr),Rr|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,St(zc,Rr),Rr|=r;return Jn(e,t,o,n),t.child}function QT(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function ub(e,t,n,r,o){var i=gr(n)?Sl:Wn.current;return i=su(t,i),Hc(t,o),n=O1(e,t,n,r,i,o),r=M1(),e!==null&&!ur?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,ss(e,t,o)):(Pt&&r&&x1(t),t.flags|=1,Jn(e,t,n,o),t.child)}function _C(e,t,n,r,o){if(gr(n)){var i=!0;og(t)}else i=!1;if(Hc(t,o),t.stateNode===null)bm(e,t),qT(t,n,r),lb(t,n,r,o),r=!0;else if(e===null){var s=t.stateNode,a=t.memoizedProps;s.props=a;var l=s.context,c=n.contextType;typeof c=="object"&&c!==null?c=vo(c):(c=gr(n)?Sl:Wn.current,c=su(t,c));var u=n.getDerivedStateFromProps,f=typeof u=="function"||typeof s.getSnapshotBeforeUpdate=="function";f||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==r||l!==c)&&SC(t,s,r,c),zs=!1;var h=t.memoizedState;s.state=h,cg(t,r,s,o),l=t.memoizedState,a!==r||h!==l||mr.current||zs?(typeof u=="function"&&(ab(t,n,u,r),l=t.memoizedState),(a=zs||wC(t,n,a,r,h,l,c))?(f||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),s.props=r,s.state=l,s.context=c,r=a):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,PT(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:Ao(t.type,a),s.props=c,f=t.pendingProps,h=s.context,l=n.contextType,typeof l=="object"&&l!==null?l=vo(l):(l=gr(n)?Sl:Wn.current,l=su(t,l));var p=n.getDerivedStateFromProps;(u=typeof p=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==f||h!==l)&&SC(t,s,r,l),zs=!1,h=t.memoizedState,s.state=h,cg(t,r,s,o);var m=t.memoizedState;a!==f||h!==m||mr.current||zs?(typeof p=="function"&&(ab(t,n,p,r),m=t.memoizedState),(c=zs||wC(t,n,c,r,h,m,l)||!1)?(u||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,m,l),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,m,l)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),s.props=r,s.state=m,s.context=l,r=c):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return db(e,t,n,r,i,o)}function db(e,t,n,r,o,i){QT(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return o&&hC(t,n,!1),ss(e,t,i);r=t.stateNode,Oz.current=t;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=lu(t,e.child,null,i),t.child=lu(t,null,a,i)):Jn(e,t,a,i),t.memoizedState=r.state,o&&hC(t,n,!0),t.child}function eO(e){var t=e.stateNode;t.pendingContext?fC(e,t.pendingContext,t.pendingContext!==t.context):t.context&&fC(e,t.context,!1),P1(e,t.containerInfo)}function jC(e,t,n,r,o){return au(),w1(o),t.flags|=256,Jn(e,t,n,r),t.child}var fb={dehydrated:null,treeContext:null,retryLane:0};function hb(e){return{baseLanes:e,cachePool:null,transitions:null}}function tO(e,t,n){var r=t.pendingProps,o=At.current,i=!1,s=(t.flags&128)!==0,a;if((a=s)||(a=e!==null&&e.memoizedState===null?!1:(o&2)!==0),a?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),St(At,o&1),e===null)return ib(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(s=r.children,e=r.fallback,i?(r=t.mode,i=t.child,s={mode:"hidden",children:s},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=s):i=Lv(s,r,0,null),e=ml(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=hb(n),t.memoizedState=fb,e):I1(t,s));if(o=e.memoizedState,o!==null&&(a=o.dehydrated,a!==null))return Mz(e,t,s,r,a,o,n);if(i){i=r.fallback,s=t.mode,o=e.child,a=o.sibling;var l={mode:"hidden",children:r.children};return!(s&1)&&t.child!==o?(r=t.child,r.childLanes=0,r.pendingProps=l,t.deletions=null):(r=ua(o,l),r.subtreeFlags=o.subtreeFlags&14680064),a!==null?i=ua(a,i):(i=ml(i,s,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,s=e.child.memoizedState,s=s===null?hb(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=fb,r}return i=e.child,e=i.sibling,r=ua(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function I1(e,t){return t=Lv({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Wp(e,t,n,r){return r!==null&&w1(r),lu(t,e.child,null,n),e=I1(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Mz(e,t,n,r,o,i,s){if(n)return t.flags&256?(t.flags&=-257,r=Sx(Error(te(422))),Wp(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,o=t.mode,r=Lv({mode:"visible",children:r.children},o,0,null),i=ml(i,o,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&lu(t,e.child,null,s),t.child.memoizedState=hb(s),t.memoizedState=fb,i);if(!(t.mode&1))return Wp(e,t,s,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(te(419)),r=Sx(i,r,void 0),Wp(e,t,s,r)}if(a=(s&e.childLanes)!==0,ur||a){if(r=mn,r!==null){switch(s&-s){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|s)?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,is(e,o),Ko(r,e,o,-1))}return B1(),r=Sx(Error(te(421))),Wp(e,t,s,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=Hz.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,Lr=sa(o.nextSibling),$r=t,Pt=!0,Lo=null,e!==null&&(ao[lo++]=Ki,ao[lo++]=Gi,ao[lo++]=kl,Ki=e.id,Gi=e.overflow,kl=t),t=I1(t,r.children),t.flags|=4096,t)}function TC(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),sb(e.return,t,n)}function kx(e,t,n,r,o){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=o)}function nO(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(Jn(e,t,r.children,n),r=At.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&TC(e,n,t);else if(e.tag===19)TC(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(St(At,r),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&ug(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),kx(t,!1,o,n,i);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&ug(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}kx(t,!0,n,null,i);break;case"together":kx(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function bm(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ss(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Cl|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(te(153));if(t.child!==null){for(e=t.child,n=ua(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ua(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Rz(e,t,n){switch(t.tag){case 3:eO(t),au();break;case 5:_T(t);break;case 1:gr(t.type)&&og(t);break;case 4:P1(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;St(ag,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(St(At,At.current&1),t.flags|=128,null):n&t.child.childLanes?tO(e,t,n):(St(At,At.current&1),e=ss(e,t,n),e!==null?e.sibling:null);St(At,At.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return nO(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),St(At,At.current),r)break;return null;case 22:case 23:return t.lanes=0,ZT(e,t,n)}return ss(e,t,n)}var rO,pb,oO,iO;rO=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};pb=function(){};oO=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,al(mi.current);var i=null;switch(n){case"input":o=D0(e,o),r=D0(e,r),i=[];break;case"select":o=Lt({},o,{value:void 0}),r=Lt({},r,{value:void 0}),i=[];break;case"textarea":o=z0(e,o),r=z0(e,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=ng)}B0(n,r);var s;n=null;for(c in o)if(!r.hasOwnProperty(c)&&o.hasOwnProperty(c)&&o[c]!=null)if(c==="style"){var a=o[c];for(s in a)a.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Af.hasOwnProperty(c)?i||(i=[]):(i=i||[]).push(c,null));for(c in r){var l=r[c];if(a=o!=null?o[c]:void 0,r.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(s in a)!a.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in l)l.hasOwnProperty(s)&&a[s]!==l[s]&&(n||(n={}),n[s]=l[s])}else n||(i||(i=[]),i.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(i=i||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(i=i||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Af.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&Ct("scroll",e),i||a===l||(i=[])):(i=i||[]).push(c,l))}n&&(i=i||[]).push("style",n);var c=i;(t.updateQueue=c)&&(t.flags|=4)}};iO=function(e,t,n,r){n!==r&&(t.flags|=4)};function xd(e,t){if(!Pt)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function zn(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Az(e,t,n){var r=t.pendingProps;switch(b1(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return zn(t),null;case 1:return gr(t.type)&&rg(),zn(t),null;case 3:return r=t.stateNode,cu(),Nt(mr),Nt(Wn),j1(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Vp(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Lo!==null&&(Sb(Lo),Lo=null))),pb(e,t),zn(t),null;case 5:_1(t);var o=al(Kf.current);if(n=t.type,e!==null&&t.stateNode!=null)oO(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(te(166));return zn(t),null}if(e=al(mi.current),Vp(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[di]=t,r[Wf]=i,e=(t.mode&1)!==0,n){case"dialog":Ct("cancel",r),Ct("close",r);break;case"iframe":case"object":case"embed":Ct("load",r);break;case"video":case"audio":for(o=0;o<Id.length;o++)Ct(Id[o],r);break;case"source":Ct("error",r);break;case"img":case"image":case"link":Ct("error",r),Ct("load",r);break;case"details":Ct("toggle",r);break;case"input":zE(r,i),Ct("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Ct("invalid",r);break;case"textarea":BE(r,i),Ct("invalid",r)}B0(n,i),o=null;for(var s in i)if(i.hasOwnProperty(s)){var a=i[s];s==="children"?typeof a=="string"?r.textContent!==a&&(i.suppressHydrationWarning!==!0&&Bp(r.textContent,a,e),o=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&Bp(r.textContent,a,e),o=["children",""+a]):Af.hasOwnProperty(s)&&a!=null&&s==="onScroll"&&Ct("scroll",r)}switch(n){case"input":Rp(r),$E(r,i,!0);break;case"textarea":Rp(r),VE(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=ng)}r=o,t.updateQueue=r,r!==null&&(t.flags|=4)}else{s=o.nodeType===9?o:o.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Rj(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=s.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[di]=t,e[Wf]=r,rO(e,t,!1,!1),t.stateNode=e;e:{switch(s=V0(n,r),n){case"dialog":Ct("cancel",e),Ct("close",e),o=r;break;case"iframe":case"object":case"embed":Ct("load",e),o=r;break;case"video":case"audio":for(o=0;o<Id.length;o++)Ct(Id[o],e);o=r;break;case"source":Ct("error",e),o=r;break;case"img":case"image":case"link":Ct("error",e),Ct("load",e),o=r;break;case"details":Ct("toggle",e),o=r;break;case"input":zE(e,r),o=D0(e,r),Ct("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=Lt({},r,{value:void 0}),Ct("invalid",e);break;case"textarea":BE(e,r),o=z0(e,r),Ct("invalid",e);break;default:o=r}B0(n,o),a=o;for(i in a)if(a.hasOwnProperty(i)){var l=a[i];i==="style"?Dj(e,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&Aj(e,l)):i==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&If(e,l):typeof l=="number"&&If(e,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Af.hasOwnProperty(i)?l!=null&&i==="onScroll"&&Ct("scroll",e):l!=null&&i1(e,i,l,s))}switch(n){case"input":Rp(e),$E(e,r,!1);break;case"textarea":Rp(e),VE(e);break;case"option":r.value!=null&&e.setAttribute("value",""+ya(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Bc(e,!!r.multiple,i,!1):r.defaultValue!=null&&Bc(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=ng)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return zn(t),null;case 6:if(e&&t.stateNode!=null)iO(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(te(166));if(n=al(Kf.current),al(mi.current),Vp(t)){if(r=t.stateNode,n=t.memoizedProps,r[di]=t,(i=r.nodeValue!==n)&&(e=$r,e!==null))switch(e.tag){case 3:Bp(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Bp(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[di]=t,t.stateNode=r}return zn(t),null;case 13:if(Nt(At),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Pt&&Lr!==null&&t.mode&1&&!(t.flags&128))kT(),au(),t.flags|=98560,i=!1;else if(i=Vp(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(te(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(te(317));i[di]=t}else au(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;zn(t),i=!1}else Lo!==null&&(Sb(Lo),Lo=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||At.current&1?rn===0&&(rn=3):B1())),t.updateQueue!==null&&(t.flags|=4),zn(t),null);case 4:return cu(),pb(e,t),e===null&&Vf(t.stateNode.containerInfo),zn(t),null;case 10:return E1(t.type._context),zn(t),null;case 17:return gr(t.type)&&rg(),zn(t),null;case 19:if(Nt(At),i=t.memoizedState,i===null)return zn(t),null;if(r=(t.flags&128)!==0,s=i.rendering,s===null)if(r)xd(i,!1);else{if(rn!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=ug(e),s!==null){for(t.flags|=128,xd(i,!1),r=s.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,s=i.alternate,s===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=s.childLanes,i.lanes=s.lanes,i.child=s.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=s.memoizedProps,i.memoizedState=s.memoizedState,i.updateQueue=s.updateQueue,i.type=s.type,e=s.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return St(At,At.current&1|2),t.child}e=e.sibling}i.tail!==null&&Ut()>du&&(t.flags|=128,r=!0,xd(i,!1),t.lanes=4194304)}else{if(!r)if(e=ug(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),xd(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Pt)return zn(t),null}else 2*Ut()-i.renderingStartTime>du&&n!==1073741824&&(t.flags|=128,r=!0,xd(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Ut(),t.sibling=null,n=At.current,St(At,r?n&1|2:n&1),t):(zn(t),null);case 22:case 23:return $1(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Rr&1073741824&&(zn(t),t.subtreeFlags&6&&(t.flags|=8192)):zn(t),null;case 24:return null;case 25:return null}throw Error(te(156,t.tag))}function Iz(e,t){switch(b1(t),t.tag){case 1:return gr(t.type)&&rg(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return cu(),Nt(mr),Nt(Wn),j1(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return _1(t),null;case 13:if(Nt(At),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(te(340));au()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Nt(At),null;case 4:return cu(),null;case 10:return E1(t.type._context),null;case 22:case 23:return $1(),null;case 24:return null;default:return null}}var Hp=!1,Vn=!1,Dz=typeof WeakSet=="function"?WeakSet:Set,ve=null;function Fc(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){zt(e,t,r)}else n.current=null}function mb(e,t,n){try{n()}catch(r){zt(e,t,r)}}var OC=!1;function Lz(e,t){if(Z0=Qm,e=uT(),y1(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,c=0,u=0,f=e,h=null;t:for(;;){for(var p;f!==n||o!==0&&f.nodeType!==3||(a=s+o),f!==i||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++c===o&&(a=s),h===i&&++u===r&&(l=s),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Q0={focusedElem:e,selectionRange:n},Qm=!1,ve=t;ve!==null;)if(t=ve,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ve=e;else for(;ve!==null;){t=ve;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var v=m.memoizedProps,x=m.memoizedState,b=t.stateNode,w=b.getSnapshotBeforeUpdate(t.elementType===t.type?v:Ao(t.type,v),x);b.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var S=t.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(te(163))}}catch(C){zt(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,ve=e;break}ve=t.return}return m=OC,OC=!1,m}function yf(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&mb(t,n,i)}o=o.next}while(o!==r)}}function Iv(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function gb(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function sO(e){var t=e.alternate;t!==null&&(e.alternate=null,sO(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[di],delete t[Wf],delete t[nb],delete t[xz],delete t[bz])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function aO(e){return e.tag===5||e.tag===3||e.tag===4}function MC(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||aO(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function vb(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ng));else if(r!==4&&(e=e.child,e!==null))for(vb(e,t,n),e=e.sibling;e!==null;)vb(e,t,n),e=e.sibling}function yb(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(yb(e,t,n),e=e.sibling;e!==null;)yb(e,t,n),e=e.sibling}var kn=null,Do=!1;function ks(e,t,n){for(n=n.child;n!==null;)lO(e,t,n),n=n.sibling}function lO(e,t,n){if(pi&&typeof pi.onCommitFiberUnmount=="function")try{pi.onCommitFiberUnmount(Pv,n)}catch{}switch(n.tag){case 5:Vn||Fc(n,t);case 6:var r=kn,o=Do;kn=null,ks(e,t,n),kn=r,Do=o,kn!==null&&(Do?(e=kn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):kn.removeChild(n.stateNode));break;case 18:kn!==null&&(Do?(e=kn,n=n.stateNode,e.nodeType===8?gx(e.parentNode,n):e.nodeType===1&&gx(e,n),zf(e)):gx(kn,n.stateNode));break;case 4:r=kn,o=Do,kn=n.stateNode.containerInfo,Do=!0,ks(e,t,n),kn=r,Do=o;break;case 0:case 11:case 14:case 15:if(!Vn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&mb(n,t,s),o=o.next}while(o!==r)}ks(e,t,n);break;case 1:if(!Vn&&(Fc(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){zt(n,t,a)}ks(e,t,n);break;case 21:ks(e,t,n);break;case 22:n.mode&1?(Vn=(r=Vn)||n.memoizedState!==null,ks(e,t,n),Vn=r):ks(e,t,n);break;default:ks(e,t,n)}}function RC(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Dz),t.forEach(function(r){var o=Kz.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function _o(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];try{var i=e,s=t,a=s;e:for(;a!==null;){switch(a.tag){case 5:kn=a.stateNode,Do=!1;break e;case 3:kn=a.stateNode.containerInfo,Do=!0;break e;case 4:kn=a.stateNode.containerInfo,Do=!0;break e}a=a.return}if(kn===null)throw Error(te(160));lO(i,s,o),kn=null,Do=!1;var l=o.alternate;l!==null&&(l.return=null),o.return=null}catch(c){zt(o,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)cO(t,e),t=t.sibling}function cO(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(_o(t,e),li(e),r&4){try{yf(3,e,e.return),Iv(3,e)}catch(v){zt(e,e.return,v)}try{yf(5,e,e.return)}catch(v){zt(e,e.return,v)}}break;case 1:_o(t,e),li(e),r&512&&n!==null&&Fc(n,n.return);break;case 5:if(_o(t,e),li(e),r&512&&n!==null&&Fc(n,n.return),e.flags&32){var o=e.stateNode;try{If(o,"")}catch(v){zt(e,e.return,v)}}if(r&4&&(o=e.stateNode,o!=null)){var i=e.memoizedProps,s=n!==null?n.memoizedProps:i,a=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{a==="input"&&i.type==="radio"&&i.name!=null&&Oj(o,i),V0(a,s);var c=V0(a,i);for(s=0;s<l.length;s+=2){var u=l[s],f=l[s+1];u==="style"?Dj(o,f):u==="dangerouslySetInnerHTML"?Aj(o,f):u==="children"?If(o,f):i1(o,u,f,c)}switch(a){case"input":L0(o,i);break;case"textarea":Mj(o,i);break;case"select":var h=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?Bc(o,!!i.multiple,p,!1):h!==!!i.multiple&&(i.defaultValue!=null?Bc(o,!!i.multiple,i.defaultValue,!0):Bc(o,!!i.multiple,i.multiple?[]:"",!1))}o[Wf]=i}catch(v){zt(e,e.return,v)}}break;case 6:if(_o(t,e),li(e),r&4){if(e.stateNode===null)throw Error(te(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(v){zt(e,e.return,v)}}break;case 3:if(_o(t,e),li(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{zf(t.containerInfo)}catch(v){zt(e,e.return,v)}break;case 4:_o(t,e),li(e);break;case 13:_o(t,e),li(e),o=e.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(F1=Ut())),r&4&&RC(e);break;case 22:if(u=n!==null&&n.memoizedState!==null,e.mode&1?(Vn=(c=Vn)||u,_o(t,e),Vn=c):_o(t,e),li(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!u&&e.mode&1)for(ve=e,u=e.child;u!==null;){for(f=ve=u;ve!==null;){switch(h=ve,p=h.child,h.tag){case 0:case 11:case 14:case 15:yf(4,h,h.return);break;case 1:Fc(h,h.return);var m=h.stateNode;if(typeof m.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(v){zt(r,n,v)}}break;case 5:Fc(h,h.return);break;case 22:if(h.memoizedState!==null){IC(f);continue}}p!==null?(p.return=h,ve=p):IC(f)}u=u.sibling}e:for(u=null,f=e;;){if(f.tag===5){if(u===null){u=f;try{o=f.stateNode,c?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(a=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=Ij("display",s))}catch(v){zt(e,e.return,v)}}}else if(f.tag===6){if(u===null)try{f.stateNode.nodeValue=c?"":f.memoizedProps}catch(v){zt(e,e.return,v)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;u===f&&(u=null),f=f.return}u===f&&(u=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:_o(t,e),li(e),r&4&&RC(e);break;case 21:break;default:_o(t,e),li(e)}}function li(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(aO(n)){var r=n;break e}n=n.return}throw Error(te(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(If(o,""),r.flags&=-33);var i=MC(e);yb(e,i,o);break;case 3:case 4:var s=r.stateNode.containerInfo,a=MC(e);vb(e,a,s);break;default:throw Error(te(161))}}catch(l){zt(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Fz(e,t,n){ve=e,uO(e)}function uO(e,t,n){for(var r=(e.mode&1)!==0;ve!==null;){var o=ve,i=o.child;if(o.tag===22&&r){var s=o.memoizedState!==null||Hp;if(!s){var a=o.alternate,l=a!==null&&a.memoizedState!==null||Vn;a=Hp;var c=Vn;if(Hp=s,(Vn=l)&&!c)for(ve=o;ve!==null;)s=ve,l=s.child,s.tag===22&&s.memoizedState!==null?DC(o):l!==null?(l.return=s,ve=l):DC(o);for(;i!==null;)ve=i,uO(i),i=i.sibling;ve=o,Hp=a,Vn=c}AC(e)}else o.subtreeFlags&8772&&i!==null?(i.return=o,ve=i):AC(e)}}function AC(e){for(;ve!==null;){var t=ve;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Vn||Iv(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Vn)if(n===null)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:Ao(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&yC(t,i,r);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}yC(t,s,n)}break;case 5:var a=t.stateNode;if(n===null&&t.flags&4){n=a;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var u=c.memoizedState;if(u!==null){var f=u.dehydrated;f!==null&&zf(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(te(163))}Vn||t.flags&512&&gb(t)}catch(h){zt(t,t.return,h)}}if(t===e){ve=null;break}if(n=t.sibling,n!==null){n.return=t.return,ve=n;break}ve=t.return}}function IC(e){for(;ve!==null;){var t=ve;if(t===e){ve=null;break}var n=t.sibling;if(n!==null){n.return=t.return,ve=n;break}ve=t.return}}function DC(e){for(;ve!==null;){var t=ve;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Iv(4,t)}catch(l){zt(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(l){zt(t,o,l)}}var i=t.return;try{gb(t)}catch(l){zt(t,i,l)}break;case 5:var s=t.return;try{gb(t)}catch(l){zt(t,s,l)}}}catch(l){zt(t,t.return,l)}if(t===e){ve=null;break}var a=t.sibling;if(a!==null){a.return=t.return,ve=a;break}ve=t.return}}var zz=Math.ceil,hg=hs.ReactCurrentDispatcher,D1=hs.ReactCurrentOwner,po=hs.ReactCurrentBatchConfig,rt=0,mn=null,Jt=null,Pn=0,Rr=0,zc=Fa(0),rn=0,Jf=null,Cl=0,Dv=0,L1=0,xf=null,cr=null,F1=0,du=1/0,$i=null,pg=!1,xb=null,la=null,Kp=!1,Zs=null,mg=0,bf=0,bb=null,wm=-1,Sm=0;function Zn(){return rt&6?Ut():wm!==-1?wm:wm=Ut()}function ca(e){return e.mode&1?rt&2&&Pn!==0?Pn&-Pn:Sz.transition!==null?(Sm===0&&(Sm=qj()),Sm):(e=pt,e!==0||(e=window.event,e=e===void 0?16:tT(e.type)),e):1}function Ko(e,t,n,r){if(50<bf)throw bf=0,bb=null,Error(te(185));Wh(e,n,r),(!(rt&2)||e!==mn)&&(e===mn&&(!(rt&2)&&(Dv|=n),rn===4&&Ws(e,Pn)),vr(e,r),n===1&&rt===0&&!(t.mode&1)&&(du=Ut()+500,Mv&&za()))}function vr(e,t){var n=e.callbackNode;S5(e,t);var r=Zm(e,e===mn?Pn:0);if(r===0)n!==null&&HE(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&HE(n),t===1)e.tag===0?wz(LC.bind(null,e)):bT(LC.bind(null,e)),vz(function(){!(rt&6)&&za()}),n=null;else{switch(Yj(r)){case 1:n=u1;break;case 4:n=Kj;break;case 16:n=Xm;break;case 536870912:n=Gj;break;default:n=Xm}n=yO(n,dO.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function dO(e,t){if(wm=-1,Sm=0,rt&6)throw Error(te(327));var n=e.callbackNode;if(Kc()&&e.callbackNode!==n)return null;var r=Zm(e,e===mn?Pn:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=gg(e,r);else{t=r;var o=rt;rt|=2;var i=hO();(mn!==e||Pn!==t)&&($i=null,du=Ut()+500,pl(e,t));do try{Vz();break}catch(a){fO(e,a)}while(!0);k1(),hg.current=i,rt=o,Jt!==null?t=0:(mn=null,Pn=0,t=rn)}if(t!==0){if(t===2&&(o=G0(e),o!==0&&(r=o,t=wb(e,o))),t===1)throw n=Jf,pl(e,0),Ws(e,r),vr(e,Ut()),n;if(t===6)Ws(e,r);else{if(o=e.current.alternate,!(r&30)&&!$z(o)&&(t=gg(e,r),t===2&&(i=G0(e),i!==0&&(r=i,t=wb(e,i))),t===1))throw n=Jf,pl(e,0),Ws(e,r),vr(e,Ut()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(te(345));case 2:Ja(e,cr,$i);break;case 3:if(Ws(e,r),(r&130023424)===r&&(t=F1+500-Ut(),10<t)){if(Zm(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){Zn(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=tb(Ja.bind(null,e,cr,$i),t);break}Ja(e,cr,$i);break;case 4:if(Ws(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var s=31-Ho(r);i=1<<s,s=t[s],s>o&&(o=s),r&=~i}if(r=o,r=Ut()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*zz(r/1960))-r,10<r){e.timeoutHandle=tb(Ja.bind(null,e,cr,$i),r);break}Ja(e,cr,$i);break;case 5:Ja(e,cr,$i);break;default:throw Error(te(329))}}}return vr(e,Ut()),e.callbackNode===n?dO.bind(null,e):null}function wb(e,t){var n=xf;return e.current.memoizedState.isDehydrated&&(pl(e,t).flags|=256),e=gg(e,t),e!==2&&(t=cr,cr=n,t!==null&&Sb(t)),e}function Sb(e){cr===null?cr=e:cr.push.apply(cr,e)}function $z(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var o=n[r],i=o.getSnapshot;o=o.value;try{if(!Yo(i(),o))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ws(e,t){for(t&=~L1,t&=~Dv,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Ho(t),r=1<<n;e[n]=-1,t&=~r}}function LC(e){if(rt&6)throw Error(te(327));Kc();var t=Zm(e,0);if(!(t&1))return vr(e,Ut()),null;var n=gg(e,t);if(e.tag!==0&&n===2){var r=G0(e);r!==0&&(t=r,n=wb(e,r))}if(n===1)throw n=Jf,pl(e,0),Ws(e,t),vr(e,Ut()),n;if(n===6)throw Error(te(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Ja(e,cr,$i),vr(e,Ut()),null}function z1(e,t){var n=rt;rt|=1;try{return e(t)}finally{rt=n,rt===0&&(du=Ut()+500,Mv&&za())}}function Nl(e){Zs!==null&&Zs.tag===0&&!(rt&6)&&Kc();var t=rt;rt|=1;var n=po.transition,r=pt;try{if(po.transition=null,pt=1,e)return e()}finally{pt=r,po.transition=n,rt=t,!(rt&6)&&za()}}function $1(){Rr=zc.current,Nt(zc)}function pl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,gz(n)),Jt!==null)for(n=Jt.return;n!==null;){var r=n;switch(b1(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&rg();break;case 3:cu(),Nt(mr),Nt(Wn),j1();break;case 5:_1(r);break;case 4:cu();break;case 13:Nt(At);break;case 19:Nt(At);break;case 10:E1(r.type._context);break;case 22:case 23:$1()}n=n.return}if(mn=e,Jt=e=ua(e.current,null),Pn=Rr=t,rn=0,Jf=null,L1=Dv=Cl=0,cr=xf=null,sl!==null){for(t=0;t<sl.length;t++)if(n=sl[t],r=n.interleaved,r!==null){n.interleaved=null;var o=r.next,i=n.pending;if(i!==null){var s=i.next;i.next=o,r.next=s}n.pending=r}sl=null}return e}function fO(e,t){do{var n=Jt;try{if(k1(),ym.current=fg,dg){for(var r=Dt.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}dg=!1}if(El=0,dn=en=Dt=null,vf=!1,Gf=0,D1.current=null,n===null||n.return===null){rn=1,Jf=t,Jt=null;break}e:{var i=e,s=n.return,a=n,l=t;if(t=Pn,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,u=a,f=u.tag;if(!(u.mode&1)&&(f===0||f===11||f===15)){var h=u.alternate;h?(u.updateQueue=h.updateQueue,u.memoizedState=h.memoizedState,u.lanes=h.lanes):(u.updateQueue=null,u.memoizedState=null)}var p=EC(s);if(p!==null){p.flags&=-257,CC(p,s,a,i,t),p.mode&1&&kC(i,c,t),t=p,l=c;var m=t.updateQueue;if(m===null){var v=new Set;v.add(l),t.updateQueue=v}else m.add(l);break e}else{if(!(t&1)){kC(i,c,t),B1();break e}l=Error(te(426))}}else if(Pt&&a.mode&1){var x=EC(s);if(x!==null){!(x.flags&65536)&&(x.flags|=256),CC(x,s,a,i,t),w1(uu(l,a));break e}}i=l=uu(l,a),rn!==4&&(rn=2),xf===null?xf=[i]:xf.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var b=YT(i,l,t);vC(i,b);break e;case 1:a=l;var w=i.type,S=i.stateNode;if(!(i.flags&128)&&(typeof w.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(la===null||!la.has(S)))){i.flags|=65536,t&=-t,i.lanes|=t;var C=JT(i,a,t);vC(i,C);break e}}i=i.return}while(i!==null)}mO(n)}catch(N){t=N,Jt===n&&n!==null&&(Jt=n=n.return);continue}break}while(!0)}function hO(){var e=hg.current;return hg.current=fg,e===null?fg:e}function B1(){(rn===0||rn===3||rn===2)&&(rn=4),mn===null||!(Cl&268435455)&&!(Dv&268435455)||Ws(mn,Pn)}function gg(e,t){var n=rt;rt|=2;var r=hO();(mn!==e||Pn!==t)&&($i=null,pl(e,t));do try{Bz();break}catch(o){fO(e,o)}while(!0);if(k1(),rt=n,hg.current=r,Jt!==null)throw Error(te(261));return mn=null,Pn=0,rn}function Bz(){for(;Jt!==null;)pO(Jt)}function Vz(){for(;Jt!==null&&!h5();)pO(Jt)}function pO(e){var t=vO(e.alternate,e,Rr);e.memoizedProps=e.pendingProps,t===null?mO(e):Jt=t,D1.current=null}function mO(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Iz(n,t),n!==null){n.flags&=32767,Jt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{rn=6,Jt=null;return}}else if(n=Az(n,t,Rr),n!==null){Jt=n;return}if(t=t.sibling,t!==null){Jt=t;return}Jt=t=e}while(t!==null);rn===0&&(rn=5)}function Ja(e,t,n){var r=pt,o=po.transition;try{po.transition=null,pt=1,Uz(e,t,n,r)}finally{po.transition=o,pt=r}return null}function Uz(e,t,n,r){do Kc();while(Zs!==null);if(rt&6)throw Error(te(327));n=e.finishedWork;var o=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(te(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(k5(e,i),e===mn&&(Jt=mn=null,Pn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Kp||(Kp=!0,yO(Xm,function(){return Kc(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=po.transition,po.transition=null;var s=pt;pt=1;var a=rt;rt|=4,D1.current=null,Lz(e,n),cO(n,e),cz(Q0),Qm=!!Z0,Q0=Z0=null,e.current=n,Fz(n),p5(),rt=a,pt=s,po.transition=i}else e.current=n;if(Kp&&(Kp=!1,Zs=e,mg=o),i=e.pendingLanes,i===0&&(la=null),v5(n.stateNode),vr(e,Ut()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)o=t[n],r(o.value,{componentStack:o.stack,digest:o.digest});if(pg)throw pg=!1,e=xb,xb=null,e;return mg&1&&e.tag!==0&&Kc(),i=e.pendingLanes,i&1?e===bb?bf++:(bf=0,bb=e):bf=0,za(),null}function Kc(){if(Zs!==null){var e=Yj(mg),t=po.transition,n=pt;try{if(po.transition=null,pt=16>e?16:e,Zs===null)var r=!1;else{if(e=Zs,Zs=null,mg=0,rt&6)throw Error(te(331));var o=rt;for(rt|=4,ve=e.current;ve!==null;){var i=ve,s=i.child;if(ve.flags&16){var a=i.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(ve=c;ve!==null;){var u=ve;switch(u.tag){case 0:case 11:case 15:yf(8,u,i)}var f=u.child;if(f!==null)f.return=u,ve=f;else for(;ve!==null;){u=ve;var h=u.sibling,p=u.return;if(sO(u),u===c){ve=null;break}if(h!==null){h.return=p,ve=h;break}ve=p}}}var m=i.alternate;if(m!==null){var v=m.child;if(v!==null){m.child=null;do{var x=v.sibling;v.sibling=null,v=x}while(v!==null)}}ve=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,ve=s;else e:for(;ve!==null;){if(i=ve,i.flags&2048)switch(i.tag){case 0:case 11:case 15:yf(9,i,i.return)}var b=i.sibling;if(b!==null){b.return=i.return,ve=b;break e}ve=i.return}}var w=e.current;for(ve=w;ve!==null;){s=ve;var S=s.child;if(s.subtreeFlags&2064&&S!==null)S.return=s,ve=S;else e:for(s=w;ve!==null;){if(a=ve,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Iv(9,a)}}catch(N){zt(a,a.return,N)}if(a===s){ve=null;break e}var C=a.sibling;if(C!==null){C.return=a.return,ve=C;break e}ve=a.return}}if(rt=o,za(),pi&&typeof pi.onPostCommitFiberRoot=="function")try{pi.onPostCommitFiberRoot(Pv,e)}catch{}r=!0}return r}finally{pt=n,po.transition=t}}return!1}function FC(e,t,n){t=uu(n,t),t=YT(e,t,1),e=aa(e,t,1),t=Zn(),e!==null&&(Wh(e,1,t),vr(e,t))}function zt(e,t,n){if(e.tag===3)FC(e,e,n);else for(;t!==null;){if(t.tag===3){FC(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(la===null||!la.has(r))){e=uu(n,e),e=JT(t,e,1),t=aa(t,e,1),e=Zn(),t!==null&&(Wh(t,1,e),vr(t,e));break}}t=t.return}}function Wz(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Zn(),e.pingedLanes|=e.suspendedLanes&n,mn===e&&(Pn&n)===n&&(rn===4||rn===3&&(Pn&130023424)===Pn&&500>Ut()-F1?pl(e,0):L1|=n),vr(e,t)}function gO(e,t){t===0&&(e.mode&1?(t=Dp,Dp<<=1,!(Dp&130023424)&&(Dp=4194304)):t=1);var n=Zn();e=is(e,t),e!==null&&(Wh(e,t,n),vr(e,n))}function Hz(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),gO(e,n)}function Kz(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(te(314))}r!==null&&r.delete(t),gO(e,n)}var vO;vO=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||mr.current)ur=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ur=!1,Rz(e,t,n);ur=!!(e.flags&131072)}else ur=!1,Pt&&t.flags&1048576&&wT(t,sg,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;bm(e,t),e=t.pendingProps;var o=su(t,Wn.current);Hc(t,n),o=O1(null,t,r,e,o,n);var i=M1();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,gr(r)?(i=!0,og(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,N1(t),o.updater=Av,t.stateNode=o,o._reactInternals=t,lb(t,r,e,n),t=db(null,t,r,!0,i,n)):(t.tag=0,Pt&&i&&x1(t),Jn(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(bm(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=qz(r),e=Ao(r,e),o){case 0:t=ub(null,t,r,e,n);break e;case 1:t=_C(null,t,r,e,n);break e;case 11:t=NC(null,t,r,e,n);break e;case 14:t=PC(null,t,r,Ao(r.type,e),n);break e}throw Error(te(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Ao(r,o),ub(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Ao(r,o),_C(e,t,r,o,n);case 3:e:{if(eO(t),e===null)throw Error(te(387));r=t.pendingProps,i=t.memoizedState,o=i.element,PT(e,t),cg(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=uu(Error(te(423)),t),t=jC(e,t,r,n,o);break e}else if(r!==o){o=uu(Error(te(424)),t),t=jC(e,t,r,n,o);break e}else for(Lr=sa(t.stateNode.containerInfo.firstChild),$r=t,Pt=!0,Lo=null,n=CT(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(au(),r===o){t=ss(e,t,n);break e}Jn(e,t,r,n)}t=t.child}return t;case 5:return _T(t),e===null&&ib(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,eb(r,o)?s=null:i!==null&&eb(r,i)&&(t.flags|=32),QT(e,t),Jn(e,t,s,n),t.child;case 6:return e===null&&ib(t),null;case 13:return tO(e,t,n);case 4:return P1(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=lu(t,null,r,n):Jn(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Ao(r,o),NC(e,t,r,o,n);case 7:return Jn(e,t,t.pendingProps,n),t.child;case 8:return Jn(e,t,t.pendingProps.children,n),t.child;case 12:return Jn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,i=t.memoizedProps,s=o.value,St(ag,r._currentValue),r._currentValue=s,i!==null)if(Yo(i.value,s)){if(i.children===o.children&&!mr.current){t=ss(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){s=i.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=Zi(-1,n&-n),l.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),sb(i.return,n,t),a.lanes|=n;break}l=l.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(te(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),sb(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}Jn(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,Hc(t,n),o=vo(o),r=r(o),t.flags|=1,Jn(e,t,r,n),t.child;case 14:return r=t.type,o=Ao(r,t.pendingProps),o=Ao(r.type,o),PC(e,t,r,o,n);case 15:return XT(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Ao(r,o),bm(e,t),t.tag=1,gr(r)?(e=!0,og(t)):e=!1,Hc(t,n),qT(t,r,o),lb(t,r,o,n),db(null,t,r,!0,e,n);case 19:return nO(e,t,n);case 22:return ZT(e,t,n)}throw Error(te(156,t.tag))};function yO(e,t){return Hj(e,t)}function Gz(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function fo(e,t,n,r){return new Gz(e,t,n,r)}function V1(e){return e=e.prototype,!(!e||!e.isReactComponent)}function qz(e){if(typeof e=="function")return V1(e)?1:0;if(e!=null){if(e=e.$$typeof,e===a1)return 11;if(e===l1)return 14}return 2}function ua(e,t){var n=e.alternate;return n===null?(n=fo(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function km(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")V1(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case jc:return ml(n.children,o,i,t);case s1:s=8,o|=8;break;case M0:return e=fo(12,n,t,o|2),e.elementType=M0,e.lanes=i,e;case R0:return e=fo(13,n,t,o),e.elementType=R0,e.lanes=i,e;case A0:return e=fo(19,n,t,o),e.elementType=A0,e.lanes=i,e;case _j:return Lv(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Nj:s=10;break e;case Pj:s=9;break e;case a1:s=11;break e;case l1:s=14;break e;case Fs:s=16,r=null;break e}throw Error(te(130,e==null?e:typeof e,""))}return t=fo(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function ml(e,t,n,r){return e=fo(7,e,r,t),e.lanes=n,e}function Lv(e,t,n,r){return e=fo(22,e,r,t),e.elementType=_j,e.lanes=n,e.stateNode={isHidden:!1},e}function Ex(e,t,n){return e=fo(6,e,null,t),e.lanes=n,e}function Cx(e,t,n){return t=fo(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Yz(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ix(0),this.expirationTimes=ix(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ix(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function U1(e,t,n,r,o,i,s,a,l){return e=new Yz(e,t,n,a,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=fo(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},N1(i),e}function Jz(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:_c,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function xO(e){if(!e)return xa;e=e._reactInternals;e:{if(Jl(e)!==e||e.tag!==1)throw Error(te(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(gr(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(te(171))}if(e.tag===1){var n=e.type;if(gr(n))return xT(e,n,t)}return t}function bO(e,t,n,r,o,i,s,a,l){return e=U1(n,r,!0,e,o,i,s,a,l),e.context=xO(null),n=e.current,r=Zn(),o=ca(n),i=Zi(r,o),i.callback=t??null,aa(n,i,o),e.current.lanes=o,Wh(e,o,r),vr(e,r),e}function Fv(e,t,n,r){var o=t.current,i=Zn(),s=ca(o);return n=xO(n),t.context===null?t.context=n:t.pendingContext=n,t=Zi(i,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=aa(o,t,s),e!==null&&(Ko(e,o,s,i),vm(e,o,s)),s}function vg(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function zC(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function W1(e,t){zC(e,t),(e=e.alternate)&&zC(e,t)}function Xz(){return null}var wO=typeof reportError=="function"?reportError:function(e){console.error(e)};function H1(e){this._internalRoot=e}zv.prototype.render=H1.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(te(409));Fv(e,t,null,null)};zv.prototype.unmount=H1.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Nl(function(){Fv(null,e,null,null)}),t[rs]=null}};function zv(e){this._internalRoot=e}zv.prototype.unstable_scheduleHydration=function(e){if(e){var t=Zj();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Us.length&&t!==0&&t<Us[n].priority;n++);Us.splice(n,0,e),n===0&&eT(e)}};function K1(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function $v(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function $C(){}function Zz(e,t,n,r,o){if(o){if(typeof r=="function"){var i=r;r=function(){var c=vg(s);i.call(c)}}var s=bO(t,r,e,0,null,!1,!1,"",$C);return e._reactRootContainer=s,e[rs]=s.current,Vf(e.nodeType===8?e.parentNode:e),Nl(),s}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var a=r;r=function(){var c=vg(l);a.call(c)}}var l=U1(e,0,!1,null,null,!1,!1,"",$C);return e._reactRootContainer=l,e[rs]=l.current,Vf(e.nodeType===8?e.parentNode:e),Nl(function(){Fv(t,l,n,r)}),l}function Bv(e,t,n,r,o){var i=n._reactRootContainer;if(i){var s=i;if(typeof o=="function"){var a=o;o=function(){var l=vg(s);a.call(l)}}Fv(t,s,e,o)}else s=Zz(n,t,e,o,r);return vg(s)}Jj=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Ad(t.pendingLanes);n!==0&&(d1(t,n|1),vr(t,Ut()),!(rt&6)&&(du=Ut()+500,za()))}break;case 13:Nl(function(){var r=is(e,1);if(r!==null){var o=Zn();Ko(r,e,1,o)}}),W1(e,1)}};f1=function(e){if(e.tag===13){var t=is(e,134217728);if(t!==null){var n=Zn();Ko(t,e,134217728,n)}W1(e,134217728)}};Xj=function(e){if(e.tag===13){var t=ca(e),n=is(e,t);if(n!==null){var r=Zn();Ko(n,e,t,r)}W1(e,t)}};Zj=function(){return pt};Qj=function(e,t){var n=pt;try{return pt=e,t()}finally{pt=n}};W0=function(e,t,n){switch(t){case"input":if(L0(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=Ov(r);if(!o)throw Error(te(90));Tj(r),L0(r,o)}}}break;case"textarea":Mj(e,n);break;case"select":t=n.value,t!=null&&Bc(e,!!n.multiple,t,!1)}};zj=z1;$j=Nl;var Qz={usingClientEntryPoint:!1,Events:[Kh,Rc,Ov,Lj,Fj,z1]},bd={findFiberByHostInstance:il,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},e$={bundleType:bd.bundleType,version:bd.version,rendererPackageName:bd.rendererPackageName,rendererConfig:bd.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:hs.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Uj(e),e===null?null:e.stateNode},findFiberByHostInstance:bd.findFiberByHostInstance||Xz,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Gp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Gp.isDisabled&&Gp.supportsFiber)try{Pv=Gp.inject(e$),pi=Gp}catch{}}Jr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Qz;Jr.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!K1(t))throw Error(te(200));return Jz(e,t,null,n)};Jr.createRoot=function(e,t){if(!K1(e))throw Error(te(299));var n=!1,r="",o=wO;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=U1(e,1,!1,null,null,n,!1,r,o),e[rs]=t.current,Vf(e.nodeType===8?e.parentNode:e),new H1(t)};Jr.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(te(188)):(e=Object.keys(e).join(","),Error(te(268,e)));return e=Uj(t),e=e===null?null:e.stateNode,e};Jr.flushSync=function(e){return Nl(e)};Jr.hydrate=function(e,t,n){if(!$v(t))throw Error(te(200));return Bv(null,e,t,!0,n)};Jr.hydrateRoot=function(e,t,n){if(!K1(e))throw Error(te(405));var r=n!=null&&n.hydratedSources||null,o=!1,i="",s=wO;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=bO(t,null,e,1,n??null,o,!1,i,s),e[rs]=t.current,Vf(e),r)for(e=0;e<r.length;e++)n=r[e],o=n._getVersion,o=o(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new zv(t)};Jr.render=function(e,t,n){if(!$v(t))throw Error(te(200));return Bv(null,e,t,!1,n)};Jr.unmountComponentAtNode=function(e){if(!$v(e))throw Error(te(40));return e._reactRootContainer?(Nl(function(){Bv(null,null,e,!1,function(){e._reactRootContainer=null,e[rs]=null})}),!0):!1};Jr.unstable_batchedUpdates=z1;Jr.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!$v(n))throw Error(te(200));if(e==null||e._reactInternals===void 0)throw Error(te(38));return Bv(e,t,n,!1,r)};Jr.version="18.3.1-next-f1338f8080-20240426";function SO(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(SO)}catch(e){console.error(e)}}SO(),Sj.exports=Jr;var Fr=Sj.exports;const t$=Da(Fr);var BC=Fr;Gm.createRoot=BC.createRoot,Gm.hydrateRoot=BC.hydrateRoot;var kO={exports:{}},Vv={};/**
|
|
33
|
-
* @license React
|
|
34
|
-
* react-jsx-runtime.production.min.js
|
|
35
|
-
*
|
|
36
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
37
|
-
*
|
|
38
|
-
* This source code is licensed under the MIT license found in the
|
|
39
|
-
* LICENSE file in the root directory of this source tree.
|
|
40
|
-
*/var n$=g,r$=Symbol.for("react.element"),o$=Symbol.for("react.fragment"),i$=Object.prototype.hasOwnProperty,s$=n$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a$={key:!0,ref:!0,__self:!0,__source:!0};function EO(e,t,n){var r,o={},i=null,s=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(s=t.ref);for(r in t)i$.call(t,r)&&!a$.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:r$,type:e,key:i,ref:s,props:o,_owner:s$.current}}Vv.Fragment=o$;Vv.jsx=EO;Vv.jsxs=EO;kO.exports=Vv;var d=kO.exports;function kb(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function G1(e,t){if(e){if(typeof e=="string")return kb(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?kb(e,t):void 0}}function gi(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=G1(e))||t){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(l){throw l},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
41
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return s=l.done,l},e:function(l){a=!0,i=l},f:function(){try{s||n.return==null||n.return()}finally{if(a)throw i}}}}function q1(e){return e.length>0}var qh=Object.freeze({kind:"ok",value:void 0});function _n(e){return e===void 0?qh:{kind:"ok",value:e}}function Hn(e){return{kind:"err",error:e}}function Bu(e){return e===qh||e.kind==="ok"}function Uv(e){return e!==qh&&e.kind==="err"}function CO(e){var t=[],n=[],r=gi(e),o;try{for(r.s();!(o=r.n()).done;){var i=o.value;Bu(i)?t.push(i.value):n.push(i.error)}}catch(s){r.e(s)}finally{r.f()}return q1(n)?Hn(n):_n(t)}function l$(e){return CO(e)}function c$(e){var t=[],n=gi(e),r;try{for(n.s();!(r=n.n()).done;){var o=r.value;Uv(o)&&t.push(o.error)}}catch(i){n.e(i)}finally{n.f()}return q1(t)?Hn(t):qh}function Y1(e,t){return function(n){for(var r=_n(t),o=0;o<n.length&&Bu(r);++o)r=e(r.value,n[o],o);return r}}function co(e){return function(t){return Bu(t)?_n(e(t.value)):t}}function Pl(e){return function(t){return Bu(t)?e(t.value):t}}function u$(e){return function(t){return Uv(t)?Hn(e(t.error)):t}}function d$(e,t){return function(n){return e(n)?_n(n):Hn(t(n))}}var Wv=function(t,n){return function(r){return Bu(r)?t(r.value)?r:Hn(n(r.value)):r}},f$=Object.freeze({__proto__:null,voidOk:qh,ok:_n,err:Hn,isOk:Bu,isErr:Uv,allT:CO,all:l$,allV:c$,flatMapReduce:Y1,map:co,flatMap:Pl,mapErr:u$,fromPredicate:d$,filterOrElse:Wv});function h$(e){if(Array.isArray(e))return e}function p$(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,s,a=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(u){c=!0,o=u}finally{try{if(!l&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return a}}function m$(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
42
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jn(e,t){return h$(e)||p$(e,t)||G1(e,t)||m$()}function g$(e){if(Array.isArray(e))return kb(e)}function v$(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function y$(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
43
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ge(e){return g$(e)||v$(e)||G1(e)||y$()}function ie(e){"@babel/helpers - typeof";return ie=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ie(e)}function x$(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function NO(e){var t=x$(e,"string");return typeof t=="symbol"?t:t+""}function B(e,t,n){return(t=NO(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function VC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function xt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?VC(Object(n),!0).forEach(function(r){B(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):VC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Rn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b$(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,NO(r.key),r)}}function An(e,t,n){return t&&b$(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function yg(e){return yg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},yg(e)}function PO(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(PO=function(){return!!e})()}function w$(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function S$(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return w$(e)}function Zr(e,t,n){return t=yg(t),S$(e,PO()?Reflect.construct(t,[],yg(e).constructor):t.apply(e,n))}function Eb(e,t){return Eb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Eb(e,t)}function Qr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Eb(e,t)}var eo=function(){function e(){Rn(this,e)}return An(e,[{key:"executeCustomValidateFunctions",value:function(n,r,o){var i=[],s=gi(r),a;try{for(s.s();!(a=s.n()).done;){var l=a.value;try{var c=l(n,o);c&&i.push({message:c,value:n})}catch(u){i.push({message:"Error in custom validate function: ".concat(u instanceof Error?u.message:String(u)),value:n,schemaError:!0})}}}catch(u){s.e(u)}finally{s.f()}return i}},{key:"appendValidationError",value:function(n,r,o,i,s){return n?(n[r]?n[r].push({message:o,value:i,schemaError:s}):n[r]=[{message:o,value:i,schemaError:s}],n):B({},r,[{message:o,value:i,schemaError:s}])}}])}(),_O=Symbol("GetSchema"),jO=Symbol("Path"),k$=Symbol("GetSource");function UC(e){return e[_O]}var De="_type",bt="_ref",Cb="_tag";function E$(e){return ie(e)==="object"&&e!==null&&De in e&&e[De]==="file"&&bt in e&&typeof e[bt]=="string"}var C$=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:[];return Rn(this,t),r=Zr(this,t),r.options=n,r.opt=o,r.isRemote=i,r.customValidateFunctions=s,r}return Qr(t,e),An(t,[{key:"remote",value:function(){return new t(this.options,this.opt,!0)}},{key:"validate",value:function(r){return new t(this.options,this.opt,this.isRemote,[].concat(ge(this.customValidateFunctions),[r]))}},{key:"executeValidate",value:function(r,o){var i=this.executeCustomValidateFunctions(o,this.customValidateFunctions,{path:r});if(this.opt&&o==null)return i.length>0?B({},r,i):!1;if(o==null)return B({},r,[].concat(ge(i),[{message:"Non-optional file was null or undefined.",value:o}]));if(typeof o[bt]!="string")return B({},r,[].concat(ge(i),[{message:"File did not have a file reference string. Got: ".concat(ie(o[bt])),value:o}]));if(this.isRemote&&o[De]!=="remote")return B({},r,[].concat(ge(i),[{message:"Expected a remote file, but got a local file.",value:o,fixes:["file:upload-remote"]}]));if(this.isRemote&&o[De]==="remote")return B({},r,[].concat(ge(i),[{message:"Remote file was not checked.",value:o,fixes:["file:check-remote"]}]));if(!this.isRemote&&o[De]==="remote")return B({},r,[].concat(ge(i),[{message:"Expected locale file, but found remote.",value:o,fixes:["file:download-remote"]}]));if(o[De]!=="file")return B({},r,[].concat(ge(i),[{message:"File did not have the valid file extension type. Got: ".concat(o[De]),value:o,fixes:["file:change-extension","file:check-metadata"]}]));var s=this.options||{},a=s.accept,l=o.metadata||{},c=l.mimeType;if(a&&c&&!c.includes("/"))return B({},r,[].concat(ge(i),[{message:"Invalid mime type format. Got: ".concat(c),value:o,fixes:["file:change-extension","file:check-metadata"]}]));if(a&&c&&c.includes("/")){var u=a.split(",").map(function(p){return p.trim()}),f=u.some(function(p){if(p==="*/*")return!0;if(p.endsWith("/*")){var m=p.slice(0,-2);return c.startsWith(m)}return p===c});if(!f)return B({},r,[].concat(ge(i),[{message:"Mime type mismatch. Found '".concat(c,"' but schema accepts '").concat(a,"'"),value:o,fixes:["file:change-extension","file:check-metadata"]}]))}var h=Y.filenameToMimeType(o[bt]);return h?h!==c?B({},r,[].concat(ge(i),[{message:"Mime type and file extension not matching. Mime type is '".concat(c,"' but file extension is '").concat(h,"'"),value:o,fixes:["file:change-extension","file:check-metadata"]}])):o.metadata?B({},r,[].concat(ge(i),[{message:"Found metadata, but it could not be validated. File metadata must be an object with the mimeType.",value:o,fixes:["file:check-metadata"]}])):B({},r,[].concat(ge(i),[{message:"Missing File metadata.",value:o,fixes:["file:add-metadata"]}])):B({},r,[].concat(ge(i),[{message:"Could not determine mime type from file extension. Got: ".concat(o[bt]),value:o,fixes:["file:change-extension","file:check-metadata"]}]))}},{key:"executeAssert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:B({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])}:ie(o)!=="object"?{success:!1,errors:B({},r,[{message:"Expected object, got '".concat(ie(o),"'"),typeError:!0}])}:bt in o?De in o&&o[De]==="file"?{success:!0,data:o}:{success:!1,errors:B({},r,[{message:"Value of this schema must use: 'c.file' (error type: missing_file_extension)",typeError:!0}])}:{success:!1,errors:B({},r,[{message:"Value of this schema must use: 'c.file' (error type: missing_ref_prop)",typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"executeSerialize",value:function(){var r;return{type:"file",options:this.options,opt:this.opt,remote:this.isRemote,customValidate:this.customValidateFunctions&&((r=this.customValidateFunctions)===null||r===void 0?void 0:r.length)>0}}},{key:"executeRender",value:function(){return{}}}])}(eo),N$=function(t){return new C$(t)};function P$(e){return e[bt].startsWith("/public")?e.patch_id?{url:"/api/val/files"+e[bt]+"?patch_id=".concat(e.patch_id),metadata:e.metadata}:{url:e[bt].slice(7),metadata:e.metadata}:{url:e[bt]+(e.patch_id?"?patch_id=".concat(e.patch_id):""),metadata:e.metadata}}function _$(e){return ie(e)==="object"&&e!==null&&e!==void 0&&jO in e&&"val"in e}function TO(e){return e[jO]}function fu(e,t){if(ie(t)==="symbol")throw Error("Cannot create val path of array item with symbol prop: ".concat(t.toString()));if(e)return e.includes(Y.ModuleFilePathSep)?"".concat(e,".").concat(JSON.stringify(t)):"".concat(e).concat(Y.ModuleFilePathSep).concat(JSON.stringify(t))}function Mr(e,t){if(ie(t)==="symbol")throw Error("Cannot create val path of array item with symbol prop: ".concat(t.toString()));if(!e)throw Error("Cannot create val path of array item of empty or missing path: ".concat(e,". Item: ").concat(t));return e.includes(Y.ModuleFilePathSep)?"".concat(e,".").concat(JSON.stringify(t)):"".concat(e).concat(Y.ModuleFilePathSep).concat(JSON.stringify(t))}var j$=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:[];return Rn(this,t),r=Zr(this,t),r.options=n,r.opt=o,r.isRaw=i,r.customValidateFunctions=s,r}return Qr(t,e),An(t,[{key:"min",value:function(r){return this.minLength(r)}},{key:"minLength",value:function(r){return new t(xt(xt({},this.options),{},{minLength:r}),this.opt,this.isRaw)}},{key:"max",value:function(r){return this.maxLength(r)}},{key:"maxLength",value:function(r){return new t(xt(xt({},this.options),{},{maxLength:r}),this.opt,this.isRaw)}},{key:"regexp",value:function(r,o){return new t(xt(xt({},this.options),{},{regexp:r,regExpMessage:o}),this.opt,this.isRaw)}},{key:"validate",value:function(r){return new t(this.options,this.opt,this.isRaw,this.customValidateFunctions.concat(r))}},{key:"executeValidate",value:function(r,o){var i,s,a,l=this.executeCustomValidateFunctions(o,this.customValidateFunctions,{path:r});return this.opt&&o==null?l.length>0?B({},r,l):!1:typeof o!="string"?B({},r,[{message:"Expected 'string', got '".concat(ie(o),"'"),value:o}]):((i=this.options)!==null&&i!==void 0&&i.maxLength&&o.length>this.options.maxLength&&l.push({message:"Expected string to be at most ".concat(this.options.maxLength," characters long, got ").concat(o.length),value:o}),(s=this.options)!==null&&s!==void 0&&s.minLength&&o.length<this.options.minLength&&l.push({message:"Expected string to be at least ".concat(this.options.minLength," characters long, got ").concat(o.length),value:o}),(a=this.options)!==null&&a!==void 0&&a.regexp&&!this.options.regexp.test(o)&&l.push({message:this.options.regExpMessage||"Expected string to match reg exp: ".concat(this.options.regexp.toString(),", got '").concat(o,"'"),value:o}),l.length>0?B({},r,l):!1)}},{key:"executeAssert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:typeof o=="string"?{success:!0,data:o}:{success:!1,errors:B({},r,[{message:"Expected 'string', got '".concat(ie(o),"'"),typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.options,!0,this.isRaw)}},{key:"raw",value:function(){return new t(this.options,this.opt,!0)}},{key:"executeSerialize",value:function(){var r,o,i,s,a;return{type:"string",options:{maxLength:(r=this.options)===null||r===void 0?void 0:r.maxLength,minLength:(o=this.options)===null||o===void 0?void 0:o.minLength,regexp:((i=this.options)===null||i===void 0?void 0:i.regexp)&&{message:this.options.regExpMessage,source:this.options.regexp.source,flags:this.options.regexp.flags},customValidate:this.customValidateFunctions&&((s=this.customValidateFunctions)===null||s===void 0?void 0:s.length)>0},opt:this.opt,raw:this.isRaw,customValidate:this.customValidateFunctions&&((a=this.customValidateFunctions)===null||a===void 0?void 0:a.length)>0}}},{key:"executeRender",value:function(){return{}}}])}(eo),OO=function(t){return new j$(t)},_l=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return Rn(this,t),r=Zr(this,t),r.items=n,r.opt=o,r.customValidateFunctions=i,r}return Qr(t,e),An(t,[{key:"validate",value:function(r){return new t(this.items,this.opt,[].concat(ge(this.customValidateFunctions),[r]))}},{key:"executeValidate",value:function(r,o){var i=!1,s=this.executeCustomValidateFunctions(o,this.customValidateFunctions,{path:r});if(this.opt&&o==null)return s.length>0?B({},r,s):!1;if(o===null)return B({},r,[{message:"Expected 'object', got 'null'"}]);if(ie(o)!=="object")return B({},r,[{message:"Expected 'object', got '".concat(ie(o),"'")}]);if(Array.isArray(o))return B({},r,[{message:"Expected 'object', got 'array'"}]);var a=gi(s),l;try{for(a.s();!(l=a.n()).done;){var c=l.value;i=this.appendValidationError(i,r,c.message,o,c.schemaError)}}catch(b){a.e(b)}finally{a.f()}for(var u=0,f=Object.entries(this.items);u<f.length;u++){var h=jn(f[u],2),p=h[0],m=h[1],v=fu(r,p);if(!v)i=this.appendValidationError(i,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(p),o);else{var x=m.executeValidate(v,o[p]);x&&i?i=xt(xt({},x),i):x&&(i=x)}}return i}},{key:"executeAssert",value:function(r,o){if(this.opt&&o===null)return{success:!0,data:o};if(o===null)return{success:!1,errors:B({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])};if(ie(o)!=="object")return{success:!1,errors:B({},r,[{message:"Expected 'object', got '".concat(ie(o),"'"),typeError:!0}])};if(Array.isArray(o))return{success:!1,errors:B({},r,[{message:"Expected 'object', got 'array'",typeError:!0}])};for(var i=[],s=0,a=Object.keys(this.items);s<a.length;s++){var l=a[s],c=fu(r,l);c?l in o||i.push({message:"Expected key '".concat(l,"' not found in object"),typeError:!0}):i.push({message:"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(l),internalError:!0})}return i.length>0?{success:!1,errors:B({},r,i)}:{success:!0,data:o}}},{key:"nullable",value:function(){return new t(this.items,!0)}},{key:"executeSerialize",value:function(){var r;return{type:"object",items:Object.fromEntries(Object.entries(this.items).map(function(o){var i=jn(o,2),s=i[0],a=i[1];return[s,a.executeSerialize()]})),opt:this.opt,customValidate:this.customValidateFunctions&&((r=this.customValidateFunctions)===null||r===void 0?void 0:r.length)>0}}},{key:"executeRender",value:function(r,o){var i={};if(o===null)return i;for(var s in this.items){var a=o[s];if(a!=null){var l=Mr(r,s),c=this.items[s].executeRender(l,a);for(var u in c){var f=u;i[f]=c[f]}}}return i}}])}(eo),MO=function(t){return new _l(t)};MO({get test(){return OO()}});var Hv=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return Rn(this,t),r=Zr(this,t),B(r,"renderInput",null),r.item=n,r.opt=o,r.customValidateFunctions=i,r}return Qr(t,e),An(t,[{key:"validate",value:function(r){return new t(this.item,this.opt,[].concat(ge(this.customValidateFunctions),[r]))}},{key:"executeValidate",value:function(r,o){var i=this.executeAssert(r,o);if(!i.success)return i.errors;if(i.data===null)return!1;for(var s={},a=0,l=Object.entries(i.data);a<l.length;a++){var c=jn(l[a],2),u=c[0],f=c[1],h=Mr(r,Number(u)),p=this.item.executeValidate(h,f);p&&(s=xt(xt({},p),s))}return Object.keys(s).length===0?!1:s}},{key:"executeAssert",value:function(r,o){return o===null&&this.opt?{success:!0,data:o}:o===null?{success:!1,errors:B({},r,[{message:"Expected 'array', got 'null'",typeError:!0}])}:ie(o)!=="object"?{success:!1,errors:B({},r,[{message:"Expected 'object', got '".concat(ie(o),"'"),typeError:!0}])}:Array.isArray(o)?{success:!0,data:o}:{success:!1,errors:B({},r,[{message:"Expected object of type 'array'",typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.item,!0)}},{key:"executeSerialize",value:function(){var r;return{type:"array",item:this.item.executeSerialize(),opt:this.opt,customValidate:this.customValidateFunctions&&((r=this.customValidateFunctions)===null||r===void 0?void 0:r.length)>0}}},{key:"executeRender",value:function(r,o){var i={};if(o===null)return i;for(var s=0;s<o.length;s++){var a=s,l=o[a];if(l!=null){var c=Mr(r,a),u=this.item.executeRender(c,l);for(var f in u){var h=f;i[h]=u[h]}}}if(this.renderInput){var p=this.renderInput,m=p.select,v=p.layout;v!=="list"&&(i[r]={status:"error",message:"Unknown layout type: "+v});try{i[r]={status:"success",data:{layout:"list",parent:"array",items:o.map(function(x){var b=m({val:x}),w=b.title,S=b.subtitle,C=b.image;return{title:w,subtitle:S,image:C}})}}}catch(x){i[r]={status:"error",message:x instanceof Error?x.message:"Unknown error"}}}return i}},{key:"render",value:function(r){return this.renderInput=r,this}}])}(eo),T$=function(t){return new Hv(t)},Xa=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return Rn(this,t),r=Zr(this,t),r.value=n,r.opt=o,r.customValidateFunctions=i,r}return Qr(t,e),An(t,[{key:"validate",value:function(r){return new t(this.value,this.opt,[].concat(ge(this.customValidateFunctions),[r]))}},{key:"executeValidate",value:function(r,o){var i=this.executeCustomValidateFunctions(o,this.customValidateFunctions,{path:r});return this.opt&&o==null?i.length>0?B({},r,i):!1:typeof o!="string"?B({},r,[].concat(ge(i),[{message:"Expected 'string', got '".concat(ie(o),"'"),value:o}])):o!==this.value?B({},r,[].concat(ge(i),[{message:"Expected literal '".concat(this.value,"', got '").concat(o,"'"),value:o}])):i.length>0?B({},r,i):!1}},{key:"executeAssert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:B({},r,[{message:"Expected 'string', got 'null'",typeError:!0}])}:typeof o=="string"&&o===this.value?{success:!0,data:o}:{success:!1,errors:B({},r,[{message:"Expected literal '".concat(this.value,"', got '").concat(o,"'"),typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.value,!0)}},{key:"executeSerialize",value:function(){var r;return{type:"literal",value:this.value,opt:this.opt,customValidate:this.customValidateFunctions&&((r=this.customValidateFunctions)===null||r===void 0?void 0:r.length)>0}}},{key:"executeRender",value:function(){return{}}}])}(eo),O$=function(t){return new Xa(t)},RO=function(e){function t(n,r){var o,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:[];return Rn(this,t),o=Zr(this,t),o.key=n,o.items=r,o.opt=i,o.customValidateFunctions=s,o}return Qr(t,e),An(t,[{key:"validate",value:function(r){return new t(this.key,this.items,this.opt,this.customValidateFunctions.concat(r))}},{key:"executeValidate",value:function(r,o){var i=this.executeCustomValidateFunctions(o,this.customValidateFunctions,{path:r}),s=o;if(this.opt&&s===null)return i.length>0?B({},r,i):!1;if(!this.key)return i.length>0?B({},r,i):B({},r,[].concat(ge(i),[{message:"Missing required first argument in union",schemaError:!0}]));var a=this.key;if(!Array.isArray(this.items))return i.length>0?B({},r,i):B({},r,[].concat(ge(i),[{message:"A union schema must take more than 1 schema arguments",schemaError:!0}]));if(typeof a=="string"){if(this.items.some(function(O){return!(O instanceof _l)}))return i.length>0?B({},r,i):B({},r,[].concat(ge(i),[{message:"Key is a string, so all schema items must be objects",schemaError:!0}]));var l=this.items,c=l.map(function(O){return O.executeSerialize()}),u=c.filter(function(O){return O.type!=="object"||O.items[a].type!=="literal"});if(u.length>0)return i.length>0?B({},r,i):B({},r,[].concat(ge(i),[{message:"All schema items must be objects with a key: ".concat(a," that is a literal schema. Found: ").concat(JSON.stringify(u,null,2)),schemaError:!0}]));var f=c,h=f.filter(function(O){return O.items[a].opt});if(h.length>1)return i.length>0?B({},r,i):B({},r,[].concat(ge(i),[{message:"Schema cannot have an optional keys: ".concat(a),schemaError:!0}]));if(ie(s)!=="object")return i.length>0?B({},r,i):B({},r,[].concat(ge(i),[{message:"Expected an object",typeError:!0}]));var p=s;if(p[a]===void 0)return i.length>0?B({},r,i):B({},r,[].concat(ge(i),[{message:"Missing required key: ".concat(a),typeError:!0}]));var m=[],v=gi(f),x;try{for(v.s();!(x=v.n()).done;){var b=x.value,w=b.items[a];if(w.type==="literal")if(!m.includes(w.value))m.push(w.value);else return i.length>0?B({},r,i):B({},r,[].concat(ge(i),[{message:"Found duplicate key in schema: ".concat(w.value),schemaError:!0}]))}}catch(O){v.e(O)}finally{v.f()}var S=l.find(function(O){return!O.items[a].executeValidate(r,p[a])});if(!S){var C=fu(r,a);if(!C)throw new Error("Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(a));return B({},C,[{message:'Invalid key: "'.concat(a,'". Value was: "').concat(p[a],'". Valid values: ').concat(f.map(function(O){var M=O.items[a];if(M.type==="literal"&&M.value)return'"'.concat(M.value,'"');throw new Error("Expected literal schema, got ".concat(JSON.stringify(M,null,2)))}).join(", "))}])}var N=S.executeValidate(r,p);if(N)return N}else if(a instanceof Xa){if(this.items.some(function(O){return!(O instanceof Xa)}))return B({},r,[{message:"Key is a literal schema, so all schema items must be literals",typeError:!0}]);var P=[a].concat(ge(this.items));if(typeof s=="string"){var _=P.some(function(O){return!O.executeValidate(r,s)});if(!_)return i.length>0?B({},r,i):B({},r,[].concat(ge(i),[{message:"Union must match one of the following: ".concat(P.map(function(O){return'"'.concat(O.value,'"')}).join(", "))}]))}}else return i.length>0?B({},r,i):B({},r,[].concat(ge(i),[{message:"Expected a string or literal"}]));return i.length>0?B({},r,i):!1}},{key:"executeAssert",value:function(r,o){if(this.opt&&o===null)return{success:!0,data:o};if(o===null)return{success:!1,errors:B({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])};if(!this.key)return{success:!1,errors:B({},r,[{message:"Missing required first argument in union schema",schemaError:!0}])};if(!Array.isArray(this.items))return{success:!1,errors:B({},r,[{message:"The schema of this value is wrong. Schema is neither a union of literals nor a tagged union (of objects)",schemaError:!0}])};if(this.key instanceof Xa){var i,s=!1,a={},l=gi((i=[this.key]).concat.apply(i,ge(this.items))),c;try{for(l.s();!(c=l.n()).done;){var u=c.value;if(!(u instanceof Xa))return{success:!1,errors:B({},r,[{message:"Schema of value is a union of string, so all schema items must be literals",schemaError:!0}])};if(typeof o!="string"){a[r]=[{message:"Expected 'string', got '".concat(ie(o),"'"),typeError:!0}];continue}var f=u.executeAssert(r,o);if(f.success){s=!0;break}else for(var h=0,p=Object.entries(f.errors);h<p.length;h++){var m,v=jn(p[h],2),x=v[0],b=v[1];a[x]||(a[x]=[]),(m=a[x]).push.apply(m,ge(b))}}}catch(K){l.e(K)}finally{l.f()}return s?{success:!0,data:o}:{success:!1,errors:a}}else if(typeof this.key=="string"){var w=!1,S={},C=gi(this.items),N;try{for(C.s();!(N=C.n()).done;){var P=N.value,_=P.executeAssert(r,o);if(_.success){w=!0;break}else for(var O=0,M=Object.entries(_.errors);O<M.length;O++){var D,U=jn(M[O],2),z=U[0],H=U[1];S[z]||(S[z]=[]),(D=S[z]).push.apply(D,ge(H))}}}catch(K){C.e(K)}finally{C.f()}return w?{success:!0,data:o}:{success:!1,errors:S}}else return{success:!1,errors:B({},r,[{message:"The schema of this value is wrong. Schema is neither a union of literals nor a tagged union (of objects)",schemaError:!0}])}}},{key:"nullable",value:function(){return new t(this.key,this.items,!0)}},{key:"executeSerialize",value:function(){var r;if(typeof this.key=="string"){var o;return{type:"union",key:this.key,items:this.items.map(function(i){return i.executeSerialize()}),opt:this.opt,customValidate:this.customValidateFunctions&&((o=this.customValidateFunctions)===null||o===void 0?void 0:o.length)>0}}return{type:"union",key:this.key.executeSerialize(),items:this.items.map(function(i){return i.executeSerialize()}),opt:this.opt,customValidate:this.customValidateFunctions&&((r=this.customValidateFunctions)===null||r===void 0?void 0:r.length)>0}}},{key:"executeRender",value:function(r,o){var i={};if(o===null||this.key instanceof Xa)return i;var s=this.key;if(typeof s=="string"){var a=this.items.find(function(f){if(f instanceof _l){var h=f.items[s];if(h instanceof Xa)return ie(o)==="object"&&s in o&&h.value===o[s]}return!1});if(a){var l=a.executeRender(r,o);for(var c in l){var u=c;i[u]=l[u]}return i}i[r]={status:"error",message:"Could not find a matching (object) schema for the union key: ".concat(s)}}return i[r]={status:"error",message:"The schema of this value is wrong. Expected a object union schema, but union key is not a string. Got: '".concat(JSON.stringify(s,null,2),"'")},i}}])}(eo),M$=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return new RO(t,r)},J1=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:[];return Rn(this,t),r=Zr(this,t),r.options=n,r.opt=o,r.isRemote=i,r.customValidateFunctions=s,r}return Qr(t,e),An(t,[{key:"remote",value:function(){return new t(this.options,this.opt,!0)}},{key:"validate",value:function(r){return new t(this.options,this.opt,this.isRemote,[].concat(ge(this.customValidateFunctions),[r]))}},{key:"executeValidate",value:function(r,o){var i=this.executeCustomValidateFunctions(o,this.customValidateFunctions,{path:r});if(this.opt&&o==null)return i.length>0?B({},r,i):!1;if(o==null)return B({},r,[].concat(ge(i),[{message:"Non-optional image was null or undefined.",value:o}]));if(this.isRemote&&o[De]!=="remote")return B({},r,[].concat(ge(i),[{message:"Expected a remote image, but got a local image.",value:o,fixes:["image:upload-remote"]}]));if(this.isRemote&&o[De]==="remote")return B({},r,[].concat(ge(i),[{message:"Remote image was not checked.",value:o,fixes:["image:check-remote"]}]));if(!this.isRemote&&o[De]==="remote")return B({},r,[].concat(ge(i),[{message:"Expected locale image, but found remote.",value:o,fixes:["image:download-remote"]}]));if(typeof o[bt]!="string")return B({},r,[].concat(ge(i),[{message:"Image did not have a file reference string. Got: ".concat(ie(o[bt])),value:o}]));if(o[De]!=="file")return B({},r,[].concat(ge(i),[{message:"Image did not have the valid file extension type. Got: ".concat(o[De]),value:o,fixes:["image:change-extension","image:check-metadata"]}]));var s=this.options||{},a=s.accept,l=o.metadata||{},c=l.mimeType;if(a&&c&&!c.includes("/"))return B({},r,[].concat(ge(i),[{message:"Invalid mime type format. Got: '".concat(c,"'"),value:o,fixes:["image:check-metadata"]}]));if(a&&c&&c.includes("/")){var u=a.split(",").map(function(p){return p.trim()}),f=u.some(function(p){if(p==="*/*")return!0;if(p.endsWith("/*")){var m=p.slice(0,-2);return c.startsWith(m)}return p===c});if(!f)return B({},r,[].concat(ge(i),[{message:"Mime type mismatch. Found '".concat(c,"' but schema accepts '").concat(a,"'"),value:o,fixes:["image:check-metadata"]}]))}var h=Y.filenameToMimeType(o[bt]);return h?h&&c&&h!==c?B({},r,[].concat(ge(i),[{message:"Mime type and file extension not matching. Mime type is '".concat(c,"' but file extension is '").concat(h,"'"),value:o,fixes:["image:check-metadata"]}])):o.metadata?o.metadata.hotspot&&(ie(o.metadata.hotspot)!=="object"||typeof o.metadata.hotspot.x!="number"||typeof o.metadata.hotspot.y!="number")?B({},r,[].concat(ge(i),[{message:"Hotspot must be an object with x and y as numbers.",value:o}])):B({},r,[].concat(ge(i),[{message:"Found metadata, but it could not be validated. Image metadata must be an object with the required props: width (positive number), height (positive number) and the mime type.",value:o,fixes:["image:check-metadata"]}])):B({},r,[].concat(ge(i),[{message:"Could not validate Image metadata.",value:o,fixes:["image:add-metadata"]}])):B({},r,[].concat(ge(i),[{message:"Could not determine mime type from file extension. Got: ".concat(o[bt]),value:o,fixes:["image:check-metadata"]}]))}},{key:"executeAssert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:B({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])}:ie(o)!=="object"?{success:!1,errors:B({},r,[{message:"Expected 'object', got '".concat(ie(o),"'"),typeError:!0}])}:bt in o?De in o&&o[De]==="file"?{success:!0,data:o}:{success:!1,errors:B({},r,[{message:"Value of this schema must use: 'c.image' (error type: missing_file_extension)",typeError:!0}])}:{success:!1,errors:B({},r,[{message:"Value of this schema must use: 'c.image' (error type: missing_ref_prop)",typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.options,!0,this.isRemote)}},{key:"executeSerialize",value:function(){var r;return{type:"image",options:this.options,opt:this.opt,remote:this.isRemote,customValidate:this.customValidateFunctions&&((r=this.customValidateFunctions)===null||r===void 0?void 0:r.length)>0}}},{key:"executeRender",value:function(){return{}}}])}(eo),R$=function(t){return new J1(t)},Kv=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return Rn(this,t),r=Zr(this,t),r.options=n,r.opt=o,r.customValidateFunctions=i,r}return Qr(t,e),An(t,[{key:"maxLength",value:function(r){return new t(xt(xt({},this.options),{},{maxLength:r}),this.opt)}},{key:"minLength",value:function(r){return new t(xt(xt({},this.options),{},{minLength:r}),this.opt)}},{key:"validate",value:function(r){return new t(this.options,this.opt,[].concat(ge(this.customValidateFunctions),[r]))}},{key:"executeValidate",value:function(r,o){var i=this.executeCustomValidateFunctions(o,this.customValidateFunctions,{path:r}),s=this.executeAssert(r,o);if(!s.success)return i.length>0?B({},r,i):s.errors;var a=s.data;if(a===null&&this.opt)return i.length>0?B({},r,i):!1;if(a===null)return B({},r,[].concat(ge(i),[{message:"Expected 'array', got 'null'",typeError:!0}]));var l={},c=this.internalValidate(r,a,l);return c?i.length>0?xt(B({},r,i),c):c:Object.keys(l).length>0?i.length>0?xt(B({},r,i),l):l:i.length>0?B({},r,i):!1}},{key:"internalValidate",value:function(r,o,i){var s=this,a=0,l=function(m,v,x){var b=function(R,F,X){x[R]||(x[R]=[]),x[R].push({message:F,typeError:X})},w=gi(v),S;try{for(w.s();!(S=w.n()).done;){var C,N,P,_,O,M,D,U,z,H,K,V=S.value,I=Mr(m,v.indexOf(V));if(typeof V=="string"){a+=V.length;continue}if(ie(V)!=="object")return B({},I,[{message:"Expected nodes of type 'object' or 'string', got '".concat(ie(V),"'"),typeError:!0}]);if(V===null)return B({},I,[{message:"Expected nodes of type 'object' or 'string', got 'null'",typeError:!0}]);if(!("tag"in V))return B({},I,[{message:"Expected node to either have 'tag' or be of type 'string'",typeError:!0}]);if(typeof V.tag!="string")return B({},I,[{message:"Expected 'string', got '".concat(ie(V.tag),"'"),typeError:!0}]);if(V.tag==="h1"&&!((C=s.options.block)!==null&&C!==void 0&&C.h1)&&b(I,"'h' block is not valid",!1),V.tag==="h2"&&!((N=s.options.block)!==null&&N!==void 0&&N.h2)&&b(I,"'h2' block is not valid",!1),V.tag==="h3"&&!((P=s.options.block)!==null&&P!==void 0&&P.h3)&&b(I,"'h3' block is not valid",!1),V.tag==="h4"&&!((_=s.options.block)!==null&&_!==void 0&&_.h4)&&b(I,"'h4' block is not valid",!1),V.tag==="h5"&&!((O=s.options.block)!==null&&O!==void 0&&O.h5)&&b(I,"'h5' block is not valid",!1),V.tag==="h6"&&!((M=s.options.block)!==null&&M!==void 0&&M.h6)&&b(I,"'h6' block is not valid",!1),V.tag==="ol"&&!((D=s.options.block)!==null&&D!==void 0&&D.ol)&&b(I,"'ol' block is not valid",!1),V.tag==="ul"&&!((U=s.options.block)!==null&&U!==void 0&&U.ul)&&b(I,"'ul' block is not valid",!1),V.tag==="li"&&!((z=s.options.block)!==null&&z!==void 0&&z.ul)&&!((H=s.options.block)!==null&&H!==void 0&&H.ol)&&b(I,"'li' tag is invalid since neither 'ul' nor 'ol' block is not valid",!1),V.tag==="a"&&!((K=s.options.inline)!==null&&K!==void 0&&K.a)&&b(I,"'a' inline is not valid",!1),V.tag==="img"){var A,j;if(!((A=s.options.inline)!==null&&A!==void 0&&A.img))b(I,"'img' inline is not valid",!1);else if((j=s.options.inline)!==null&&j!==void 0&&j.img){var L,$;if(!("src"in V))return B({},I,[{message:"Expected 'src' in 'img'",typeError:!0}]);var W=Mr(I,"src"),G=ie((L=s.options.inline)===null||L===void 0?void 0:L.img)==="object"?($=s.options.inline)===null||$===void 0?void 0:$.img.executeValidate(W,V.src):new J1({},!1,!1).executeValidate(W,V.src);if(G)for(var _e in G){var ke,Ve=_e;x[Ve]||(x[Ve]=[]),(ke=x[Ve]).push.apply(ke,ge(G[Ve]))}}}if("styles"in V&&V.tag!=="span")return B({},I,[{message:"Cannot have styles on '".concat(V.tag,"'. This is only allowed on 'span'"),typeError:!0}]);if("styles"in V){if(!Array.isArray(V.styles))return B({},I,[{message:"Expected 'array', got '".concat(ie(V.styles),"'"),typeError:!0}]);for(var Z=Mr(I,"styles"),J=0;J<V.styles.length;J++){var ce,Ne,he,Le=V.styles[J],Pe=Mr(Z,J);if(typeof Le!="string")return B({},Pe,[{message:"Expected 'string', got '".concat(ie(Le),"'"),typeError:!0}]);Le==="bold"&&!((ce=s.options.style)!==null&&ce!==void 0&&ce.bold)&&b(Pe,"Style 'bold' is not valid",!1),Le==="italic"&&!((Ne=s.options.style)!==null&&Ne!==void 0&&Ne.italic)&&b(Pe,"Style 'italic' is not valid",!1),Le==="lineThrough"&&!((he=s.options.style)!==null&&he!==void 0&&he.lineThrough)&&b(Pe,"Style 'lineThrough' is not valid",!1)}}if("children"in V){if(!Array.isArray(V.children))return B({},I,[{message:"Expected 'array', got '".concat(ie(V.children),"'"),typeError:!0}]);for(var Xe=V.children,gt=0;gt<Xe.length;gt++){var Kt=Xe[gt];if(ie(Kt)==="object"){var T=Mr(I,"children"),k=l(T,[Kt],x);if(k)return k}else if(typeof Kt=="string"){a+=Kt.length;continue}else return B({},I,[{message:"Expected 'object' or 'string', got '".concat(ie(Kt),"'"),typeError:!0}])}}}}catch(E){w.e(E)}finally{w.f()}return!1},c=l(r,o,i),u=[];if(this.options.maxLength&&a>this.options.maxLength&&u.push({message:"Maximum length of ".concat(this.options.maxLength," exceeded (current length: ").concat(a,")"),typeError:!1}),this.options.minLength&&a<this.options.minLength&&u.push({message:"Minimum length of ".concat(this.options.minLength," not met (current length: ").concat(a,")"),typeError:!1}),c){if(u.length>0){var f;c[r]||(c[r]=[]),(f=c[r]).push.apply(f,u)}return c}if(Object.keys(i).length>0){if(u.length>0){var h;i[r]||(i[r]=[]),(h=i[r]).push.apply(h,u)}return i}return u.length>0?B({},r,u):!1}},{key:"executeAssert",value:function(r,o){if(this.opt&&o===null)return{success:!0,data:o};if(o===null&&!this.opt)return{success:!1,errors:B({},r,[{message:"Expected 'array', got 'null'",typeError:!0}])};if(!Array.isArray(o))return{success:!1,errors:B({},r,[{message:"Expected 'array', got '".concat(ie(o),"'"),typeError:!0}])};for(var i={},s=0;s<o.length;s++)this.recursiveAssert(Mr(r,s),o[s],i);return Object.keys(i).length>0?{success:!1,errors:i}:{success:!0,data:o}}},{key:"recursiveAssert",value:function(r,o,i){if(ie(o)!=="object"){i[r]||(i[r]=[]),i[r].push({message:"Expected 'object', got '".concat(ie(o),"'"),typeError:!0});return}if(Array.isArray(o)){i[r]||(i[r]=[]),i[r].push({message:"Expected 'object', got 'array'",typeError:!0});return}if(o===null){i[r]||(i[r]=[]),i[r].push({message:"Expected 'object', got 'null'",typeError:!0});return}if("tag"in o&&typeof o.tag!="string"){i[r]||(i[r]=[]),i[r].push({message:"Expected 'string', got '".concat(ie(o.tag),"'"),typeError:!0});return}if("children"in o)if(Array.isArray(o.children))for(var s=0;s<o.children.length;s++){var a=o.children[s],l=Mr(Mr(r,"children"),s);if(ie(a)==="object")this.recursiveAssert(l,a,i);else{if(typeof a=="string")continue;i[l]||(i[l]=[]),i[l].push({message:"Expected 'object' or 'string', got '".concat(ie(a),"'"),typeError:!0})}}else{i[r]||(i[r]=[]),i[r].push({message:"Expected 'array', got '".concat(ie(o.children),"'"),typeError:!0});return}if("styles"in o)if(!Array.isArray(o.styles))i[r]||(i[r]=[]),i[r].push({message:"Expected 'array', got '".concat(ie(o.styles),"'"),typeError:!0});else for(var c=0;c<o.styles.length;c++){var u=o.styles[c];if(typeof u!="string"){var f=Mr(r,c);i[f]||(i[f]=[]),i[f].push({message:"Expected 'string', got '".concat(ie(u),"'"),typeError:!0})}}}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"executeSerialize",value:function(){var r,o={maxLength:this.options.maxLength,minLength:this.options.minLength,style:this.options.style,block:this.options.block,inline:this.options.inline&&{a:this.options.inline.a,img:this.options.inline.img&&ie(this.options.inline.img)==="object"?this.options.inline.img.executeSerialize():this.options.inline.img}};return{type:"richtext",opt:this.opt,options:o,customValidate:this.customValidateFunctions&&((r=this.customValidateFunctions)===null||r===void 0?void 0:r.length)>0}}},{key:"executeRender",value:function(){return{}}}])}(eo),A$=function(t){return new Kv(t??{})},Yh=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;return Rn(this,t),r=Zr(this,t),B(r,"renderInput",null),r.item=n,r.opt=o,r.customValidateFunctions=i,r.currentRouter=s,r}return Qr(t,e),An(t,[{key:"validate",value:function(r){return new t(this.item,this.opt,[].concat(ge(this.customValidateFunctions),[r]))}},{key:"executeValidate",value:function(r,o){var i=this,s=!1,a=this.executeCustomValidateFunctions(o,this.customValidateFunctions,{path:r});if(this.opt&&o==null)return a.length>0?B({},r,a):!1;if(o===null)return B({},r,[].concat(ge(a),[{message:"Expected 'object', got 'null'"}]));if(ie(o)!=="object")return B({},r,[].concat(ge(a),[{message:"Expected 'object', got '".concat(ie(o),"'")}]));if(Array.isArray(o))return B({},r,[].concat(ge(a),[{message:"Expected 'object', got 'array'"}]));var l=this.getRouterValidations(r,o);if(l)return l;var c=gi(a),u;try{for(c.s();!(u=c.n()).done;){var f=u.value;s=this.appendValidationError(s,r,f.message,o,f.schemaError)}}catch(h){c.e(h)}finally{c.f()}return Object.entries(o).forEach(function(h){var p=jn(h,2),m=p[0],v=p[1],x=fu(r,m);if(!x)s=i.appendValidationError(s,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(v),o);else{var b=i.item.executeValidate(x,v);b&&s?s=xt(xt({},b),s):b&&(s=b)}}),s}},{key:"executeAssert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:ie(o)!=="object"?{success:!1,errors:B({},r,[{message:"Expected 'object', got '".concat(ie(o),"'"),typeError:!0}])}:Array.isArray(o)?{success:!1,errors:B({},r,[{message:"Expected 'object', got 'array'",typeError:!0}])}:{success:!0,data:o}}},{key:"nullable",value:function(){return new t(this.item,!0)}},{key:"router",value:function(r){return new t(this.item,this.opt,this.customValidateFunctions,r)}},{key:"getRouterValidations",value:function(r,o){if(!this.currentRouter||o===null)return!1;var i=X1(r),s=jn(i,2),a=s[0],l=s[1];if(l)return B({},r,[{message:"This field was configured as a router, but it is not defined at the root of the module",schemaError:!0}]);var c=this.currentRouter.validate(a,Object.keys(o));return c.length>0?Object.fromEntries(c.map(function(u){if(!u.error.urlPath)return[r,[{message:"Router validation error: ".concat(u.error.message," has no url path"),schemaError:!0}]];var f=fu(r,u.error.urlPath);return f?[f,[{message:u.error.message}]]:[r,[{message:"Could not create path for router validation error",schemaError:!0}]]})):!1}},{key:"executeSerialize",value:function(){var r,o;return{type:"record",item:this.item.executeSerialize(),opt:this.opt,router:(r=this.currentRouter)===null||r===void 0?void 0:r.getRouterId(),customValidate:this.customValidateFunctions&&((o=this.customValidateFunctions)===null||o===void 0?void 0:o.length)>0}}},{key:"executeRender",value:function(r,o){var i={};if(o===null)return i;for(var s in o){var a=o[s];if(a!=null){var l=Mr(r,s),c=this.item.executeRender(l,a);for(var u in c){var f=u;i[f]=c[f]}}}if(this.renderInput){var h=this.renderInput,p=h.select,m=h.layout;m!=="list"&&(i[r]={status:"error",message:"Unknown layout type: "+m});try{i[r]={status:"success",data:{layout:"list",parent:"record",items:Object.entries(o).map(function(v){var x=jn(v,2),b=x[0],w=x[1],S=p({key:b,val:w}),C=S.title,N=S.subtitle,P=S.image;return[b,{title:C,subtitle:N,image:P}]})}}}catch(v){i[r]={status:"error",message:v instanceof Error?v.message:"Unknown error"}}}return i}},{key:"render",value:function(r){return this.renderInput=r,this}}])}(eo),I$=function(t){return new Yh(t)};function D$(e){var t=e[k$],n=t;return n}function X1(e){var t=e.indexOf(ba);return t===-1?[e,""]:[e.slice(0,t),e.slice(t+ba.length)]}function AO(e,t){return t===""?e:"".concat(e).concat(ba).concat(t)}function IO(e){return e instanceof _l||ie(e)==="object"&&"type"in e&&e.type==="object"}function DO(e){return e instanceof Yh||ie(e)==="object"&&"type"in e&&e.type==="record"}function LO(e){return e instanceof Hv||ie(e)==="object"&&"type"in e&&e.type==="array"}function FO(e){return e instanceof RO||ie(e)==="object"&&"type"in e&&e.type==="union"}function zO(e){return e instanceof Kv||ie(e)==="object"&&"type"in e&&e.type==="richtext"}function $O(e){return e instanceof J1||ie(e)==="object"&&"type"in e&&e.type==="image"}function L$(e,t,n){for(var r=Xf(e),o=ge(r),i=n,s=t,a=function(){var u=r.shift();if(u===void 0)throw Error("Unexpected undefined part");if(LO(i)){var f;if(Number.isNaN(Number(u)))throw Error("Invalid path: array schema ".concat(JSON.stringify(i)," must have a number as path, but got ").concat(u,". Path: ").concat(e));if(ie(s)!=="object"&&!Array.isArray(s))throw Error("Schema type error: expected source to be type of array, but got ".concat(ie(s)));s=s[u],i=i instanceof Hv?(f=i)===null||f===void 0?void 0:f.item:i.item}else if(DO(i)){var h;if(typeof u!="string")throw Error("Invalid path: record schema ".concat(i," must have path: ").concat(u," as string"));if(ie(s)!=="object"&&!Array.isArray(s))throw Error("Schema type error: expected source to be type of record, but got ".concat(ie(s)));if(!s[u])throw Error("Invalid path: record source did not have key ".concat(u," from path: ").concat(e));s=s[u],i=i instanceof Yh?(h=i)===null||h===void 0?void 0:h.item:i.item}else if(IO(i)){if(ie(s)!=="object")throw Error("Schema type error: expected source to be type of object, but got ".concat(ie(s)));if(s!==null&&s[u]===void 0)throw Error("Invalid path: object source did not have key ".concat(u," from path: ").concat(e));s=s===null?s:s[u],i=(i instanceof _l,i.items[u])}else{if($O(i))return{v:{path:o.slice(0,o.length-r.length-1).map(function(w){return JSON.stringify(w)}).join("."),schema:i,source:s}};if(FO(i)){var p=i.key;if(typeof p!="string")return{v:{path:o.map(function(w){return Number.isNaN(Number(w))?JSON.stringify(w):w}).join("."),schema:i,source:s}};var m=s[p];if(!m)throw Error("Invalid path: union source ".concat(i," did not have required key ").concat(p," in path: ").concat(e));var v=i.items.find(function(w){var S;return(w==null||(S=w.items)===null||S===void 0||(S=S[p])===null||S===void 0?void 0:S.value)===m});if(!v)throw Error("Invalid path: union schema ".concat(i," did not have a child object with ").concat(p," of value ").concat(m," in path: ").concat(e));i=v.items[u],s=s[u]}else if(zO(i)){if("src"in s&&"tag"in s&&s.tag==="img"&&r.length===0){var x,b;i=i instanceof Kv&&(x=i.options)!==null&&x!==void 0&&(x=x.inline)!==null&&x!==void 0&&x.img&&typeof((b=i.options)===null||b===void 0||(b=b.inline)===null||b===void 0?void 0:b.img)!="boolean"?i.options.inline.img:i}s=s[u]}else throw Error("Invalid path: ".concat(u," resolved to an unexpected schema ").concat(JSON.stringify(i)))}},l;r.length>0;)if(l=a(),l)return l.v;if(r.length>0)throw Error("Invalid path: ".concat(r.join(".")," is not a valid path"));return{path:o.map(function(c){return Number.isNaN(Number(c))?JSON.stringify(c):c}).join("."),schema:i,source:s}}function F$(e,t,n){for(var r=Xf(e),o=ge(r),i=n,s=t,a=function(){var u=r.shift();if(u===void 0)return{v:{status:"error",message:"Unexpected undefined part"}};if(LO(i)){var f;if(Number.isNaN(Number(u)))return{v:{status:"error",message:"Invalid path: array schema ".concat(JSON.stringify(i)," must have a number as path, but got ").concat(u,". Path: ").concat(e)}};if(s===void 0)return{v:{status:"source-undefined",path:o.slice(0,o.length-r.length-1).map(function(w){return JSON.stringify(w)}).join(".")}};if(ie(s)!=="object"&&!Array.isArray(s))return{v:{status:"error",message:"Schema type error: expected source to be type of array, but got ".concat(ie(s))}};s=s[u],i=i instanceof Hv?(f=i)===null||f===void 0?void 0:f.item:i.item}else if(DO(i)){var h;if(typeof u!="string")return{v:{status:"error",message:"Invalid path: record schema ".concat(i," must have path: ").concat(u," as string")}};if(s===void 0)return{v:{status:"source-undefined",path:o.slice(0,o.length-r.length-1).map(function(w){return JSON.stringify(w)}).join(".")}};if(ie(s)!=="object"&&!Array.isArray(s))return{v:{status:"error",message:"Schema type error: expected source to be type of record, but got ".concat(ie(s))}};if(!s[u])return{v:{status:"error",message:"Invalid path: record source did not have key ".concat(u," from path: ").concat(e)}};s=s[u],i=i instanceof Yh?(h=i)===null||h===void 0?void 0:h.item:i.item}else if(IO(i)){if(s===void 0)return{v:{status:"source-undefined",path:o.slice(0,o.length-r.length-1).map(function(w){return JSON.stringify(w)}).join(".")}};if(ie(s)!=="object")return{v:{status:"error",message:"Schema type error: expected source to be type of object, but got ".concat(ie(s))}};if(s!==null&&s[u]===void 0)return{v:{status:"error",message:"Invalid path: object source did not have key ".concat(u," from path: ").concat(e)}};s=s===null?s:s[u],i=(i instanceof _l,i.items[u])}else{if($O(i))return{v:{status:"ok",path:o.slice(0,o.length-r.length-1).map(function(w){return JSON.stringify(w)}).join("."),schema:i,source:s}};if(FO(i)){var p=i.key;if(typeof p!="string")return{v:{status:"ok",path:o.map(function(w){return Number.isNaN(Number(w))?JSON.stringify(w):w}).join("."),schema:i,source:s}};var m=s[p];if(!m)return{v:{status:"error",message:"Invalid path: union source ".concat(i," did not have required key ").concat(p," in path: ").concat(e)}};var v=i.items.find(function(w){var S;return(w==null||(S=w.items)===null||S===void 0||(S=S[p])===null||S===void 0?void 0:S.value)===m});if(!v)return{v:{status:"error",message:"Invalid path: union schema ".concat(i," did not have a child object with ").concat(p," of value ").concat(m," in path: ").concat(e)}};i=v.items[u],s=s[u]}else if(zO(i)){if("src"in s&&"tag"in s&&s.tag==="img"&&r.length===0){var x,b;i=i instanceof Kv&&(x=i.options)!==null&&x!==void 0&&(x=x.inline)!==null&&x!==void 0&&x.img&&typeof((b=i.options)===null||b===void 0||(b=b.inline)===null||b===void 0?void 0:b.img)!="boolean"?i.options.inline.img:i}s=s[u]}else return{v:{status:"error",message:"Invalid path: ".concat(u," resolved to an unexpected schema ").concat(JSON.stringify(i))}}}},l;r.length>0;)if(l=a(),l)return l.v;return r.length>0?{status:"error",message:"Invalid path: ".concat(r.join(".")," is not a valid path")}:{status:"ok",path:o.map(function(c){return Number.isNaN(Number(c))?JSON.stringify(c):c}).join("."),schema:i,source:s}}function z$(e){var t=e.split("/").slice(1);return t}function Xf(e){for(var t=[],n=0;n<e.length;){var r="";if(e[n]==='"'){for(n++;n<e.length&&e[n]!=='"';)e[n]==="\\"&&e[n+1]==='"'?(r+='"',n++):r+=e[n],n++;if(e[n]!=='"'){var o;throw new Error("Invalid input (".concat(JSON.stringify(e),"): Missing closing double quote: ").concat((o=e[n])!==null&&o!==void 0?o:"at end of string"," (char: ").concat(n,"; length: ").concat(e.length,")"))}}else for(;n<e.length&&e[n]!==".";)r+=e[n],n++;r!==""&&t.push(r),n++}return t}function $$(e){return e.split(",")}function B$(e){var t=X1(e),n=jn(t,2),r=n[0],o=n[1],i=Xf(o).slice(0,-1);return i.length>0?AO(r,BO(i)):r}function BO(e){return e.map(function(t){return Number.isInteger(Number(t))?t:JSON.stringify(t)}).join(".")}var V$=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return Rn(this,t),r=Zr(this,t),r.options=n,r.opt=o,r.customValidateFunctions=i,r}return Qr(t,e),An(t,[{key:"validate",value:function(r){return new t(this.options,this.opt,[].concat(ge(this.customValidateFunctions),[r]))}},{key:"executeValidate",value:function(r,o){var i,s,a=this.executeCustomValidateFunctions(o,this.customValidateFunctions,{path:r});return this.opt&&o==null?a.length>0?B({},r,a):!1:typeof o!="number"?B({},r,[].concat(ge(a),[{message:"Expected 'number', got '".concat(ie(o),"'"),value:o}])):(i=this.options)!==null&&i!==void 0&&i.max&&o>this.options.max?B({},r,[].concat(ge(a),[{message:"Expected 'number' less than ".concat(this.options.max),value:o}])):(s=this.options)!==null&&s!==void 0&&s.min&&o<this.options.min?B({},r,[].concat(ge(a),[{message:"Expected 'number' greater than ".concat(this.options.min),value:o}])):a.length>0?B({},r,a):!1}},{key:"executeAssert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:B({},r,[{message:"Expected 'number', got 'null'",typeError:!0}])}:typeof o=="number"?{success:!0,data:o}:{success:!1,errors:B({},r,[{message:"Expected 'number', got '".concat(ie(o),"'"),typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"max",value:function(r){return new t(xt(xt({},this.options),{},{max:r}),this.opt)}},{key:"min",value:function(r){return new t(xt(xt({},this.options),{},{min:r}),this.opt)}},{key:"executeSerialize",value:function(){var r;return{type:"number",options:this.options,opt:this.opt,customValidate:this.customValidateFunctions&&((r=this.customValidateFunctions)===null||r===void 0?void 0:r.length)>0}}},{key:"executeRender",value:function(){return{}}}])}(eo),U$=function(t){return new V$(t)},W$=function(e){function t(){var n,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return Rn(this,t),n=Zr(this,t),n.opt=r,n.customValidateFunctions=o,n}return Qr(t,e),An(t,[{key:"validate",value:function(r){return new t(this.opt,[].concat(ge(this.customValidateFunctions),[r]))}},{key:"executeValidate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="boolean"?B({},r,[{message:"Expected 'boolean', got '".concat(ie(o),"'"),value:o}]):!1}},{key:"executeAssert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:B({},r,[{message:"Expected 'boolean', got 'null'",typeError:!0}])}:typeof o!="boolean"?{success:!1,errors:B({},r,[{message:"Expected 'boolean', got '".concat(ie(o),"'"),typeError:!0}])}:{success:!0,data:o}}},{key:"nullable",value:function(){return new t(!0)}},{key:"executeSerialize",value:function(){var r;return{type:"boolean",opt:this.opt,customValidate:this.customValidateFunctions&&((r=this.customValidateFunctions)===null||r===void 0?void 0:r.length)>0}}},{key:"executeRender",value:function(){return{}}}])}(eo),H$=function(){return new W$},K$=function(e){function t(n,r){var o,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:[];return Rn(this,t),o=Zr(this,t),o.schema=n,o.sourcePath=r,o.opt=i,o.customValidateFunctions=s,o}return Qr(t,e),An(t,[{key:"validate",value:function(r){return new t(this.schema,this.sourcePath,this.opt,[].concat(ge(this.customValidateFunctions),[r]))}},{key:"executeValidate",value:function(r,o){var i=this.executeCustomValidateFunctions(o,this.customValidateFunctions,{path:r});if(this.opt&&o==null)return i.length>0?B({},r,i):!1;if(!this.schema)return B({},r,[].concat(ge(i),[{message:"Schema not found for module. keyOf must be used with a Val Module"}]));var s=this.schema;if(!(s.type==="object"||s.type==="record"))return B({},r,[].concat(ge(i),[{message:"Schema in keyOf must be an 'object' or 'record'. Found '".concat(s.type||"unknown","'")}]));if(s.opt&&o==null)return!1;if(s.type==="record"&&typeof o!="string")return B({},r,[].concat(ge(i),[{message:"Type of value in keyof (record) must be 'string'"}]));if(s.type==="object"){var a=s.keys;if(!a.includes(o))return B({},r,[].concat(ge(i),[{message:"Value of keyOf (object) must be: ".concat(a.join(", "),". Found: ").concat(o)}]))}return s.type==="record"?typeof o!="string"?B({},r,[].concat(ge(i),[{message:"Value of keyOf (record) must be 'string'. Found: ".concat(ie(o))}])):B({},r,[].concat(ge(i),[{fixes:["keyof:check-keys"],message:"Did not validate keyOf (record). This error (keyof:check-keys) should typically be processed by Val internally. Seeing this error most likely means you have a Val version mismatch.",value:{key:o,sourcePath:this.sourcePath}}])):i.length>0?B({},r,i):!1}},{key:"executeAssert",value:function(r,o){if(this.opt&&o===null)return{success:!0,data:o};if(o===null)return{success:!1,errors:B({},r,[{message:"Expected 'string', got 'null'",typeError:!0}])};var i=this.schema;if(!i)return{success:!1,errors:B({},r,[{message:"Neither key nor schema was found. keyOf is missing an argument.",typeError:!0}])};var s=i;if(!(s.type==="object"||s.type==="record"))return{success:!1,errors:B({},r,[{message:"Schema of first argument must be either: 'array', 'object' or 'record'. Found '".concat(s.type||"unknown","'"),typeError:!0}])};if(s.type==="record"&&typeof o!="string")return{success:!1,errors:B({},r,[{message:"Value of keyOf (record) must be 'string', got '".concat(ie(o),"'"),typeError:!0}])};if(s.type==="object"){var a=s.keys;if(!a.includes(o))return{success:!1,errors:B({},r,[{message:"Value of keyOf (object) must be: ".concat(a.join(", "),". Found: ").concat(o),typeError:!0}])}}return{success:!0,data:o}}},{key:"nullable",value:function(){return new t(this.schema,this.sourcePath,!0)}},{key:"executeSerialize",value:function(){var r,o=this.sourcePath;if(!o)throw new Error("Cannot serialize keyOf schema with empty selector. TIP: keyOf must be used with a Val Module of record schema.");var i=this.schema;if(!i)throw new Error("Cannot serialize keyOf schema with empty selector.");var s;switch(i.type){case"record":s="string";break;case"object":s=i.keys;break;default:throw new Error("Cannot serialize keyOf schema with selector of type '".concat(i.type||"unknown","'"))}return{type:"keyOf",path:o,schema:i,opt:this.opt,values:s,customValidate:this.customValidateFunctions&&((r=this.customValidateFunctions)===null||r===void 0?void 0:r.length)>0}}},{key:"executeRender",value:function(){return{}}}])}(eo),G$=function(t){var n=t==null?void 0:t[_O],r=void 0;if(n instanceof _l){var o=[];try{o=Object.keys((n==null?void 0:n.items)||{})}catch{}r={type:"object",keys:o,opt:n==null?void 0:n.opt}}else n instanceof Yh&&(r={type:"record",opt:n==null?void 0:n.opt});return new K$(r,TO(t))},q$=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return Rn(this,t),r=Zr(this,t),r.options=n,r.opt=o,r.customValidateFunctions=i,r}return Qr(t,e),An(t,[{key:"validate",value:function(r){return new t(this.options,this.opt,[].concat(ge(this.customValidateFunctions),[r]))}},{key:"executeValidate",value:function(r,o){var i,s,a,l;if(this.opt&&o==null)return!1;if(typeof o!="string")return B({},r,[{message:"Expected 'string', got '".concat(ie(o),"'"),value:o}]);if((i=this.options)!==null&&i!==void 0&&i.from&&(s=this.options)!==null&&s!==void 0&&s.to){if(this.options.from>this.options.to)return B({},r,[{message:"From date ".concat(this.options.from," is after to date ").concat(this.options.to),value:o,typeError:!0}]);if(o<this.options.from||o>this.options.to)return B({},r,[{message:"Date is not between ".concat(this.options.from," and ").concat(this.options.to),value:o}])}else if((a=this.options)!==null&&a!==void 0&&a.from){if(o<this.options.from)return B({},r,[{message:"Date is before the minimum date ".concat(this.options.from),value:o}])}else if((l=this.options)!==null&&l!==void 0&&l.to&&o>this.options.to)return B({},r,[{message:"Date is after the maximum date ".concat(this.options.to),value:o}]);return!1}},{key:"executeAssert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:B({},r,[{message:"Expected 'string', got 'null'",typeError:!0}])}:typeof o!="string"?{success:!1,errors:B({},r,[{message:"Expected 'string', got '".concat(ie(o),"'"),typeError:!0}])}:{success:!0,data:o}}},{key:"from",value:function(r){return new t(xt(xt({},this.options),{},{from:r}),this.opt)}},{key:"to",value:function(r){return new t(xt(xt({},this.options),{},{to:r}),this.opt)}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"executeSerialize",value:function(){var r;return{type:"date",opt:this.opt,options:this.options,customValidate:this.customValidateFunctions&&((r=this.customValidateFunctions)===null||r===void 0?void 0:r.length)>0}}},{key:"executeRender",value:function(){return{}}}])}(eo),Y$=function(t){return new q$(t)};function J$(){return{string:OO,boolean:H$,array:T$,object:MO,number:U$,union:M$,richtext:A$,image:R$,literal:O$,keyOf:G$,record:I$,file:N$,date:Y$}}function X$(e,t){var n=t.publicProjectId,r=t.coreVersion,o=t.validationHash,i=t.fileHash,s=t.filePath,a=t.bucket;return"".concat(e,"/file/p/").concat(n,"/b/").concat(a,"/v/").concat(r,"/h/").concat(o,"/f/").concat(i,"/p/").concat(s)}var Z$=/^(https?:\/\/[^/]+)\/file\/p\/([^/]+)\/b\/([^/]+)\/v\/([^/]+)\/h\/([^/]+)\/f\/([^/]+)\/p\/(.+)$/;function VO(e){var t=e.match(Z$);return t?t[7].indexOf("public/val/")!==0?{status:"error",error:"Invalid remote ref: "+e}:{status:"success",remoteHost:t[1],projectId:t[2],bucket:t[3],version:t[4],validationHash:t[5],fileHash:t[6],filePath:t[7]}:{status:"error",error:"Invalid remote ref: "+e}}var WC="https://remote.val.build";function Q$(e){if(e!=null&&e.patch_id){var t=VO(e[bt]);if(t.status==="success")return{url:"/api/val/files/"+t.filePath+"?patch_id=".concat(e.patch_id,"&remote=true&ref=").concat(encodeURIComponent(e[bt])),metadata:e.metadata};console.warn("Internal Val error: failed to split remote ref: ".concat(e[bt],". The data format is different than what is expected. Check Val versions for mismatches."),t.error)}return{url:e[bt],metadata:e.metadata}}var Hr=An(function e(t){Rn(this,e),this.message=t}),e6=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998],vt=function(e){return e[e.inputBytes=64]="inputBytes",e[e.inputWords=16]="inputWords",e[e.highIndex=14]="highIndex",e[e.lowIndex=15]="lowIndex",e[e.workWords=64]="workWords",e[e.allocBytes=80]="allocBytes",e[e.allocWords=20]="allocWords",e[e.allocTotal=8e3]="allocTotal",e}(vt||{});function t6(e){return new n6}var n6=function(){function e(){Rn(this,e),B(this,"A",1779033703),B(this,"B",-1150833019),B(this,"C",1013904242),B(this,"D",-1521486534),B(this,"E",1359893119),B(this,"F",-1694144372),B(this,"G",528734635),B(this,"H",1541459225),B(this,"_size",0),B(this,"_sp",0),(!qp||wd>=vt.allocTotal)&&(qp=new ArrayBuffer(vt.allocTotal),wd=0),this._byte=new Uint8Array(qp,wd,vt.allocBytes),this._word=new Int32Array(qp,wd,vt.allocWords),wd+=vt.allocBytes}return An(e,[{key:"update",value:function(n){if(typeof n=="string")return this._utf8(n);if(n==null)throw new TypeError("Invalid type: "+ie(n));var r=n.byteOffset,o=n.byteLength,i=o/vt.inputBytes|0,s=0;if(i&&!(r&3)&&!(this._size%vt.inputBytes)){for(var a=new Int32Array(n.buffer,r,i*vt.inputWords);i--;)this._int32(a,s>>2),s+=vt.inputBytes;this._size+=s}var l=n.BYTES_PER_ELEMENT;if(l!==1&&n.buffer){var c=new Uint8Array(n.buffer,r+s,o-s);return this._uint8(c)}return s===o?this:this._uint8(n,s)}},{key:"_uint8",value:function(n,r){var o=this._byte,i=this._word,s=n.length;for(r=r|0;r<s;){for(var a=this._size%vt.inputBytes,l=a;r<s&&l<vt.inputBytes;)o[l++]=n[r++];l>=vt.inputBytes&&this._int32(i),this._size+=l-a}return this}},{key:"_utf8",value:function(n){for(var r=this._byte,o=this._word,i=n.length,s=this._sp,a=0;a<i;){for(var l=this._size%vt.inputBytes,c=l;a<i&&c<vt.inputBytes;){var u=n.charCodeAt(a++)|0;u<128?r[c++]=u:u<2048?(r[c++]=192|u>>>6,r[c++]=128|u&63):u<55296||u>57343?(r[c++]=224|u>>>12,r[c++]=128|u>>>6&63,r[c++]=128|u&63):s?(u=((s&1023)<<10)+(u&1023)+65536,r[c++]=240|u>>>18,r[c++]=128|u>>>12&63,r[c++]=128|u>>>6&63,r[c++]=128|u&63,s=0):s=u}c>=vt.inputBytes&&(this._int32(o),o[0]=o[vt.inputWords]),this._size+=c-l}return this._sp=s,this}},{key:"_int32",value:function(n,r){var o=this.A,i=this.B,s=this.C,a=this.D,l=this.E,c=this.F,u=this.G,f=this.H,h=0;for(r=r|0;h<vt.inputWords;)qa[h++]=jo(n[r++]);for(h=vt.inputWords;h<vt.workWords;h++)qa[h]=u6(qa[h-2])+qa[h-7]+c6(qa[h-15])+qa[h-16]|0;for(h=0;h<vt.workWords;h++){var p=f+l6(l)+i6(l,c,u)+e6[h]+qa[h]|0,m=a6(o)+s6(o,i,s)|0;f=u,u=c,c=l,l=a+p|0,a=s,s=i,i=o,o=p+m|0}this.A=o+this.A|0,this.B=i+this.B|0,this.C=s+this.C|0,this.D=a+this.D|0,this.E=l+this.E|0,this.F=c+this.F|0,this.G=u+this.G|0,this.H=f+this.H|0}},{key:"digest",value:function(n){var r=this._byte,o=this._word,i=this._size%vt.inputBytes|0;for(r[i++]=128;i&3;)r[i++]=0;if(i>>=2,i>vt.highIndex){for(;i<vt.inputWords;)o[i++]=0;i=0,this._int32(o)}for(;i<vt.inputWords;)o[i++]=0;var s=this._size*8,a=(s&4294967295)>>>0,l=(s-a)/4294967296;return l&&(o[vt.highIndex]=jo(l)),a&&(o[vt.lowIndex]=jo(a)),this._int32(o),n==="hex"?this._hex():this._bin()}},{key:"_hex",value:function(){var n=this.A,r=this.B,o=this.C,i=this.D,s=this.E,a=this.F,l=this.G,c=this.H;return Es(n)+Es(r)+Es(o)+Es(i)+Es(s)+Es(a)+Es(l)+Es(c)}},{key:"_bin",value:function(){var n=this.A,r=this.B,o=this.C,i=this.D,s=this.E,a=this.F,l=this.G,c=this.H,u=this._byte,f=this._word;return f[0]=jo(n),f[1]=jo(r),f[2]=jo(o),f[3]=jo(i),f[4]=jo(s),f[5]=jo(a),f[6]=jo(l),f[7]=jo(c),u.slice(0,32)}}])}(),qa=new Int32Array(vt.workWords),qp,wd=0,Es=function(t){return(t+4294967296).toString(16).substr(-8)},r6=function(t){return t<<24&4278190080|t<<8&16711680|t>>8&65280|t>>24&255},o6=function(t){return t},jo=d6()?o6:r6,i6=function(t,n,r){return r^t&(n^r)},s6=function(t,n,r){return t&n|r&(t|n)},a6=function(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)},l6=function(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)},c6=function(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3},u6=function(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10};function d6(){var e=new Uint8Array(new Uint16Array([65279]).buffer);return e[0]===254}var Z1=function(t){return t6().update(t).digest("hex")},Q1={x3d:"application/vnd.hzn-3d-crossword","3gp":"video/3gpp","3g2":"video/3gpp2",mseq:"application/vnd.mseq",pwn:"application/vnd.3m.post-it-notes",plb:"application/vnd.3gpp.pic-bw-large",psb:"application/vnd.3gpp.pic-bw-small",pvb:"application/vnd.3gpp.pic-bw-var",tcap:"application/vnd.3gpp2.tcap","7z":"application/x-7z-compressed",abw:"application/x-abiword",ace:"application/x-ace-compressed",acc:"application/vnd.americandynamics.acc",acu:"application/vnd.acucobol",atc:"application/vnd.acucorp",adp:"audio/adpcm",aab:"application/x-authorware-bin",aam:"application/x-authorware-map",aas:"application/x-authorware-seg",air:"application/vnd.adobe.air-application-installer-package+zip",avif:"image/avif",swf:"application/x-shockwave-flash",fxp:"application/vnd.adobe.fxp",pdf:"application/pdf",ppd:"application/vnd.cups-ppd",dir:"application/x-director",xdp:"application/vnd.adobe.xdp+xml",xfdf:"application/vnd.adobe.xfdf",aac:"audio/x-aac",ahead:"application/vnd.ahead.space",azf:"application/vnd.airzip.filesecure.azf",azs:"application/vnd.airzip.filesecure.azs",azw:"application/vnd.amazon.ebook",ami:"application/vnd.amiga.ami","N/A":"application/andrew-inset",apk:"application/vnd.android.package-archive",cii:"application/vnd.anser-web-certificate-issue-initiation",fti:"application/vnd.anser-web-funds-transfer-initiation",atx:"application/vnd.antix.game-component",dmg:"application/x-apple-diskimage",mpkg:"application/vnd.apple.installer+xml",aw:"application/applixware",mp3:"audio/mpeg",les:"application/vnd.hhe.lesson-player",swi:"application/vnd.aristanetworks.swi",s:"text/x-asm",atomcat:"application/atomcat+xml",atomsvc:"application/atomsvc+xml",atom:"application/atom+xml",ac:"application/pkix-attr-cert",aif:"audio/x-aiff",avi:"video/x-msvideo",aep:"application/vnd.audiograph",dxf:"image/vnd.dxf",dwf:"model/vnd.dwf",par:"text/plain-bas",bcpio:"application/x-bcpio",bin:"application/octet-stream",bmp:"image/bmp",torrent:"application/x-bittorrent",cod:"application/vnd.rim.cod",mpm:"application/vnd.blueice.multipass",bmi:"application/vnd.bmi",sh:"application/x-sh",btif:"image/prs.btif",rep:"application/vnd.businessobjects",bz:"application/x-bzip",bz2:"application/x-bzip2",csh:"application/x-csh",c:"text/x-c",cdxml:"application/vnd.chemdraw+xml",css:"text/css",cdx:"chemical/x-cdx",cml:"chemical/x-cml",csml:"chemical/x-csml",cdbcmsg:"application/vnd.contact.cmsg",cla:"application/vnd.claymore",c4g:"application/vnd.clonk.c4group",sub:"image/vnd.dvb.subtitle",cdmia:"application/cdmi-capability",cdmic:"application/cdmi-container",cdmid:"application/cdmi-domain",cdmio:"application/cdmi-object",cdmiq:"application/cdmi-queue",c11amc:"application/vnd.cluetrust.cartomobile-config",c11amz:"application/vnd.cluetrust.cartomobile-config-pkg",ras:"image/x-cmu-raster",dae:"model/vnd.collada+xml",csv:"text/csv",cpt:"application/mac-compactpro",wmlc:"application/vnd.wap.wmlc",cgm:"image/cgm",ice:"x-conference/x-cooltalk",cmx:"image/x-cmx",xar:"application/vnd.xara",cmc:"application/vnd.cosmocaller",cpio:"application/x-cpio",clkx:"application/vnd.crick.clicker",clkk:"application/vnd.crick.clicker.keyboard",clkp:"application/vnd.crick.clicker.palette",clkt:"application/vnd.crick.clicker.template",clkw:"application/vnd.crick.clicker.wordbank",wbs:"application/vnd.criticaltools.wbs+xml",cryptonote:"application/vnd.rig.cryptonote",cif:"chemical/x-cif",cmdf:"chemical/x-cmdf",cu:"application/cu-seeme",cww:"application/prs.cww",curl:"text/vnd.curl",dcurl:"text/vnd.curl.dcurl",mcurl:"text/vnd.curl.mcurl",scurl:"text/vnd.curl.scurl",car:"application/vnd.curl.car",pcurl:"application/vnd.curl.pcurl",cmp:"application/vnd.yellowriver-custom-menu",dssc:"application/dssc+der",xdssc:"application/dssc+xml",deb:"application/x-debian-package",uva:"audio/vnd.dece.audio",uvi:"image/vnd.dece.graphic",uvh:"video/vnd.dece.hd",uvm:"video/vnd.dece.mobile",uvu:"video/vnd.uvvu.mp4",uvp:"video/vnd.dece.pd",uvs:"video/vnd.dece.sd",uvv:"video/vnd.dece.video",dvi:"application/x-dvi",seed:"application/vnd.fdsn.seed",dtb:"application/x-dtbook+xml",res:"application/x-dtbresource+xml",ait:"application/vnd.dvb.ait",svc:"application/vnd.dvb.service",eol:"audio/vnd.digital-winds",djvu:"image/vnd.djvu",dtd:"application/xml-dtd",mlp:"application/vnd.dolby.mlp",wad:"application/x-doom",dpg:"application/vnd.dpgraph",dra:"audio/vnd.dra",dfac:"application/vnd.dreamfactory",dts:"audio/vnd.dts",dtshd:"audio/vnd.dts.hd",dwg:"image/vnd.dwg",geo:"application/vnd.dynageo",es:"application/ecmascript",mag:"application/vnd.ecowin.chart",mmr:"image/vnd.fujixerox.edmics-mmr",rlc:"image/vnd.fujixerox.edmics-rlc",exi:"application/exi",mgz:"application/vnd.proteus.magazine",epub:"application/epub+zip",eml:"message/rfc822",nml:"application/vnd.enliven",xpr:"application/vnd.is-xpr",xif:"image/vnd.xiff",xfdl:"application/vnd.xfdl",emma:"application/emma+xml",ez2:"application/vnd.ezpix-album",ez3:"application/vnd.ezpix-package",fst:"image/vnd.fst",fvt:"video/vnd.fvt",fbs:"image/vnd.fastbidsheet",fe_launch:"application/vnd.denovo.fcselayout-link",f4v:"video/x-f4v",flv:"video/x-flv",fpx:"image/vnd.fpx",npx:"image/vnd.net-fpx",flx:"text/vnd.fmi.flexstor",fli:"video/x-fli",ftc:"application/vnd.fluxtime.clip",fdf:"application/vnd.fdf",f:"text/x-fortran",mif:"application/vnd.mif",fm:"application/vnd.framemaker",fh:"image/x-freehand",fsc:"application/vnd.fsc.weblaunch",fnc:"application/vnd.frogans.fnc",ltf:"application/vnd.frogans.ltf",ddd:"application/vnd.fujixerox.ddd",xdw:"application/vnd.fujixerox.docuworks",xbd:"application/vnd.fujixerox.docuworks.binder",oas:"application/vnd.fujitsu.oasys",oa2:"application/vnd.fujitsu.oasys2",oa3:"application/vnd.fujitsu.oasys3",fg5:"application/vnd.fujitsu.oasysgp",bh2:"application/vnd.fujitsu.oasysprs",spl:"application/x-futuresplash",fzs:"application/vnd.fuzzysheet",g3:"image/g3fax",gmx:"application/vnd.gmx",gtw:"model/vnd.gtw",txd:"application/vnd.genomatix.tuxedo",ggb:"application/vnd.geogebra.file",ggt:"application/vnd.geogebra.tool",gdl:"model/vnd.gdl",gex:"application/vnd.geometry-explorer",gxt:"application/vnd.geonext",g2w:"application/vnd.geoplan",g3w:"application/vnd.geospace",gsf:"application/x-font-ghostscript",bdf:"application/x-font-bdf",gtar:"application/x-gtar",texinfo:"application/x-texinfo",gnumeric:"application/x-gnumeric",kml:"application/vnd.google-earth.kml+xml",kmz:"application/vnd.google-earth.kmz",gqf:"application/vnd.grafeq",gif:"image/gif",gv:"text/vnd.graphviz",gac:"application/vnd.groove-account",ghf:"application/vnd.groove-help",gim:"application/vnd.groove-identity-message",grv:"application/vnd.groove-injector",gtm:"application/vnd.groove-tool-message",tpl:"application/vnd.groove-tool-template",vcg:"application/vnd.groove-vcard",h261:"video/h261",h263:"video/h263",h264:"video/h264",hpid:"application/vnd.hp-hpid",hps:"application/vnd.hp-hps",hdf:"application/x-hdf",rip:"audio/vnd.rip",hbci:"application/vnd.hbci",jlt:"application/vnd.hp-jlyt",pcl:"application/vnd.hp-pcl",hpgl:"application/vnd.hp-hpgl",hvs:"application/vnd.yamaha.hv-script",hvd:"application/vnd.yamaha.hv-dic",hvp:"application/vnd.yamaha.hv-voice","sfd-hdstx":"application/vnd.hydrostatix.sof-data",stk:"application/hyperstudio",hal:"application/vnd.hal+xml",html:"text/html",irm:"application/vnd.ibm.rights-management",sc:"application/vnd.ibm.secure-container",ics:"text/calendar",icc:"application/vnd.iccprofile",ico:"image/x-icon",igl:"application/vnd.igloader",ief:"image/ief",ivp:"application/vnd.immervision-ivp",ivu:"application/vnd.immervision-ivu",rif:"application/reginfo+xml","3dml":"text/vnd.in3d.3dml",spot:"text/vnd.in3d.spot",igs:"model/iges",i2g:"application/vnd.intergeo",cdy:"application/vnd.cinderella",xpw:"application/vnd.intercon.formnet",fcs:"application/vnd.isac.fcs",ipfix:"application/ipfix",cer:"application/pkix-cert",pki:"application/pkixcmp",crl:"application/pkix-crl",pkipath:"application/pkix-pkipath",igm:"application/vnd.insors.igm",rcprofile:"application/vnd.ipunplugged.rcprofile",irp:"application/vnd.irepository.package+xml",jad:"text/vnd.sun.j2me.app-descriptor",jar:"application/java-archive",class:"application/java-vm",jnlp:"application/x-java-jnlp-file",ser:"application/java-serialized-object",java:"text/x-java-source,java",js:"application/javascript",json:"application/json",joda:"application/vnd.joost.joda-archive",jpm:"video/jpm",jpeg:"image/jpeg",jpg:"image/jpeg",pjpeg:"image/pjpeg",jpgv:"video/jpeg",ktz:"application/vnd.kahootz",mmd:"application/vnd.chipnuts.karaoke-mmd",karbon:"application/vnd.kde.karbon",chrt:"application/vnd.kde.kchart",kfo:"application/vnd.kde.kformula",flw:"application/vnd.kde.kivio",kon:"application/vnd.kde.kontour",kpr:"application/vnd.kde.kpresenter",ksp:"application/vnd.kde.kspread",kwd:"application/vnd.kde.kword",htke:"application/vnd.kenameaapp",kia:"application/vnd.kidspiration",kne:"application/vnd.kinar",sse:"application/vnd.kodak-descriptor",lasxml:"application/vnd.las.las+xml",latex:"application/x-latex",lbd:"application/vnd.llamagraphics.life-balance.desktop",lbe:"application/vnd.llamagraphics.life-balance.exchange+xml",jam:"application/vnd.jam",123:"application/vnd.lotus-1-2-3",apr:"application/vnd.lotus-approach",pre:"application/vnd.lotus-freelance",nsf:"application/vnd.lotus-notes",org:"application/vnd.lotus-organizer",scm:"application/vnd.lotus-screencam",lwp:"application/vnd.lotus-wordpro",lvp:"audio/vnd.lucent.voice",m3u:"audio/x-mpegurl",m4v:"video/x-m4v",hqx:"application/mac-binhex40",portpkg:"application/vnd.macports.portpkg",mgp:"application/vnd.osgeo.mapguide.package",mrc:"application/marc",mrcx:"application/marcxml+xml",mxf:"application/mxf",nbp:"application/vnd.wolfram.player",ma:"application/mathematica",mathml:"application/mathml+xml",mbox:"application/mbox",mc1:"application/vnd.medcalcdata",mscml:"application/mediaservercontrol+xml",cdkey:"application/vnd.mediastation.cdkey",mwf:"application/vnd.mfer",mfm:"application/vnd.mfmp",msh:"model/mesh",mads:"application/mads+xml",mets:"application/mets+xml",mods:"application/mods+xml",meta4:"application/metalink4+xml",mcd:"application/vnd.mcd",flo:"application/vnd.micrografx.flo",igx:"application/vnd.micrografx.igx",es3:"application/vnd.eszigno3+xml",mdb:"application/x-msaccess",asf:"video/x-ms-asf",exe:"application/x-msdownload",cil:"application/vnd.ms-artgalry",cab:"application/vnd.ms-cab-compressed",ims:"application/vnd.ms-ims",application:"application/x-ms-application",clp:"application/x-msclip",mdi:"image/vnd.ms-modi",eot:"application/vnd.ms-fontobject",xls:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xltm:"application/vnd.ms-excel.template.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",chm:"application/vnd.ms-htmlhelp",crd:"application/x-mscardfile",lrm:"application/vnd.ms-lrm",mvb:"application/x-msmediaview",mny:"application/x-msmoney",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",sldx:"application/vnd.openxmlformats-officedocument.presentationml.slide",ppsx:"application/vnd.openxmlformats-officedocument.presentationml.slideshow",potx:"application/vnd.openxmlformats-officedocument.presentationml.template",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",obd:"application/x-msbinder",thmx:"application/vnd.ms-officetheme",onetoc:"application/onenote",pya:"audio/vnd.ms-playready.media.pya",pyv:"video/vnd.ms-playready.media.pyv",ppt:"application/vnd.ms-powerpoint",ppam:"application/vnd.ms-powerpoint.addin.macroenabled.12",sldm:"application/vnd.ms-powerpoint.slide.macroenabled.12",pptm:"application/vnd.ms-powerpoint.presentation.macroenabled.12",ppsm:"application/vnd.ms-powerpoint.slideshow.macroenabled.12",potm:"application/vnd.ms-powerpoint.template.macroenabled.12",mpp:"application/vnd.ms-project",pub:"application/x-mspublisher",scd:"application/x-msschedule",xap:"application/x-silverlight-app",stl:"application/vnd.ms-pki.stl",cat:"application/vnd.ms-pki.seccat",vsd:"application/vnd.visio",vsdx:"application/vnd.visio2013",wm:"video/x-ms-wm",wma:"audio/x-ms-wma",wax:"audio/x-ms-wax",wmx:"video/x-ms-wmx",wmd:"application/x-ms-wmd",wpl:"application/vnd.ms-wpl",wmz:"application/x-ms-wmz",wmv:"video/x-ms-wmv",wvx:"video/x-ms-wvx",wmf:"application/x-msmetafile",trm:"application/x-msterminal",doc:"application/msword",docm:"application/vnd.ms-word.document.macroenabled.12",dotm:"application/vnd.ms-word.template.macroenabled.12",wri:"application/x-mswrite",wps:"application/vnd.ms-works",xbap:"application/x-ms-xbap",xps:"application/vnd.ms-xpsdocument",mid:"audio/midi",mpy:"application/vnd.ibm.minipay",afp:"application/vnd.ibm.modcap",rms:"application/vnd.jcp.javame.midlet-rms",tmo:"application/vnd.tmobile-livetv",prc:"application/x-mobipocket-ebook",mbk:"application/vnd.mobius.mbk",dis:"application/vnd.mobius.dis",plc:"application/vnd.mobius.plc",mqy:"application/vnd.mobius.mqy",msl:"application/vnd.mobius.msl",txf:"application/vnd.mobius.txf",daf:"application/vnd.mobius.daf",fly:"text/vnd.fly",mpc:"application/vnd.mophun.certificate",mpn:"application/vnd.mophun.application",mj2:"video/mj2",mpga:"audio/mpeg",mxu:"video/vnd.mpegurl",mpeg:"video/mpeg",m21:"application/mp21",mp4a:"audio/mp4",mp4:"video/mp4",m3u8:"application/vnd.apple.mpegurl",mus:"application/vnd.musician",msty:"application/vnd.muvee.style",mxml:"application/xv+xml",ngdat:"application/vnd.nokia.n-gage.data","n-gage":"application/vnd.nokia.n-gage.symbian.install",ncx:"application/x-dtbncx+xml",nc:"application/x-netcdf",nlu:"application/vnd.neurolanguage.nlu",dna:"application/vnd.dna",nnd:"application/vnd.noblenet-directory",nns:"application/vnd.noblenet-sealer",nnw:"application/vnd.noblenet-web",rpst:"application/vnd.nokia.radio-preset",rpss:"application/vnd.nokia.radio-presets",n3:"text/n3",edm:"application/vnd.novadigm.edm",edx:"application/vnd.novadigm.edx",ext:"application/vnd.novadigm.ext",gph:"application/vnd.flographit",ecelp4800:"audio/vnd.nuera.ecelp4800",ecelp7470:"audio/vnd.nuera.ecelp7470",ecelp9600:"audio/vnd.nuera.ecelp9600",oda:"application/oda",ogx:"application/ogg",oga:"audio/ogg",ogv:"video/ogg",dd2:"application/vnd.oma.dd2+xml",oth:"application/vnd.oasis.opendocument.text-web",opf:"application/oebps-package+xml",qbo:"application/vnd.intu.qbo",oxt:"application/vnd.openofficeorg.extension",osf:"application/vnd.yamaha.openscoreformat",weba:"audio/webm",webm:"video/webm",odc:"application/vnd.oasis.opendocument.chart",otc:"application/vnd.oasis.opendocument.chart-template",odb:"application/vnd.oasis.opendocument.database",odf:"application/vnd.oasis.opendocument.formula",odft:"application/vnd.oasis.opendocument.formula-template",odg:"application/vnd.oasis.opendocument.graphics",otg:"application/vnd.oasis.opendocument.graphics-template",odi:"application/vnd.oasis.opendocument.image",oti:"application/vnd.oasis.opendocument.image-template",odp:"application/vnd.oasis.opendocument.presentation",otp:"application/vnd.oasis.opendocument.presentation-template",ods:"application/vnd.oasis.opendocument.spreadsheet",ots:"application/vnd.oasis.opendocument.spreadsheet-template",odt:"application/vnd.oasis.opendocument.text",odm:"application/vnd.oasis.opendocument.text-master",ott:"application/vnd.oasis.opendocument.text-template",ktx:"image/ktx",sxc:"application/vnd.sun.xml.calc",stc:"application/vnd.sun.xml.calc.template",sxd:"application/vnd.sun.xml.draw",std:"application/vnd.sun.xml.draw.template",sxi:"application/vnd.sun.xml.impress",sti:"application/vnd.sun.xml.impress.template",sxm:"application/vnd.sun.xml.math",sxw:"application/vnd.sun.xml.writer",sxg:"application/vnd.sun.xml.writer.global",stw:"application/vnd.sun.xml.writer.template",otf:"application/x-font-otf",osfpvg:"application/vnd.yamaha.openscoreformat.osfpvg+xml",dp:"application/vnd.osgi.dp",pdb:"application/vnd.palm",p:"text/x-pascal",paw:"application/vnd.pawaafile",pclxl:"application/vnd.hp-pclxl",efif:"application/vnd.picsel",pcx:"image/x-pcx",psd:"image/vnd.adobe.photoshop",prf:"application/pics-rules",pic:"image/x-pict",chat:"application/x-chat",p10:"application/pkcs10",p12:"application/x-pkcs12",p7m:"application/pkcs7-mime",p7s:"application/pkcs7-signature",p7r:"application/x-pkcs7-certreqresp",p7b:"application/x-pkcs7-certificates",p8:"application/pkcs8",plf:"application/vnd.pocketlearn",pnm:"image/x-portable-anymap",pbm:"image/x-portable-bitmap",pcf:"application/x-font-pcf",pfr:"application/font-tdpfr",pgn:"application/x-chess-pgn",pgm:"image/x-portable-graymap",png:"image/png",ppm:"image/x-portable-pixmap",pskcxml:"application/pskc+xml",pml:"application/vnd.ctc-posml",ai:"application/postscript",pfa:"application/x-font-type1",pbd:"application/vnd.powerbuilder6",pgp:"application/pgp-signature",box:"application/vnd.previewsystems.box",ptid:"application/vnd.pvi.ptid1",pls:"application/pls+xml",str:"application/vnd.pg.format",ei6:"application/vnd.pg.osasli",dsc:"text/prs.lines.tag",psf:"application/x-font-linux-psf",qps:"application/vnd.publishare-delta-tree",wg:"application/vnd.pmi.widget",qxd:"application/vnd.quark.quarkxpress",esf:"application/vnd.epson.esf",msf:"application/vnd.epson.msf",ssf:"application/vnd.epson.ssf",qam:"application/vnd.epson.quickanime",qfx:"application/vnd.intu.qfx",mov:"video/quicktime",rar:"application/x-rar-compressed",ram:"audio/x-pn-realaudio",rmp:"audio/x-pn-realaudio-plugin",rsd:"application/rsd+xml",rm:"application/vnd.rn-realmedia",bed:"application/vnd.realvnc.bed",mxl:"application/vnd.recordare.musicxml",musicxml:"application/vnd.recordare.musicxml+xml",rnc:"application/relax-ng-compact-syntax",rdz:"application/vnd.data-vision.rdz",rdf:"application/rdf+xml",rp9:"application/vnd.cloanto.rp9",jisp:"application/vnd.jisp",rtf:"application/rtf",rtx:"text/richtext",link66:"application/vnd.route66.link66+xml",rss:"application/rss+xml",shf:"application/shf+xml",st:"application/vnd.sailingtracker.track",svg:"image/svg+xml",sus:"application/vnd.sus-calendar",sru:"application/sru+xml",setpay:"application/set-payment-initiation",setreg:"application/set-registration-initiation",sema:"application/vnd.sema",semd:"application/vnd.semd",semf:"application/vnd.semf",see:"application/vnd.seemail",snf:"application/x-font-snf",spq:"application/scvp-vp-request",spp:"application/scvp-vp-response",scq:"application/scvp-cv-request",scs:"application/scvp-cv-response",sdp:"application/sdp",etx:"text/x-setext",movie:"video/x-sgi-movie",ifm:"application/vnd.shana.informed.formdata",itp:"application/vnd.shana.informed.formtemplate",iif:"application/vnd.shana.informed.interchange",ipk:"application/vnd.shana.informed.package",tfi:"application/thraud+xml",shar:"application/x-shar",rgb:"image/x-rgb",slt:"application/vnd.epson.salt",aso:"application/vnd.accpac.simply.aso",imp:"application/vnd.accpac.simply.imp",twd:"application/vnd.simtech-mindmapper",csp:"application/vnd.commonspace",saf:"application/vnd.yamaha.smaf-audio",mmf:"application/vnd.smaf",spf:"application/vnd.yamaha.smaf-phrase",teacher:"application/vnd.smart.teacher",svd:"application/vnd.svd",rq:"application/sparql-query",srx:"application/sparql-results+xml",gram:"application/srgs",grxml:"application/srgs+xml",ssml:"application/ssml+xml",skp:"application/vnd.koan",sgml:"text/sgml",sdc:"application/vnd.stardivision.calc",sda:"application/vnd.stardivision.draw",sdd:"application/vnd.stardivision.impress",smf:"application/vnd.stardivision.math",sdw:"application/vnd.stardivision.writer",sgl:"application/vnd.stardivision.writer-global",sm:"application/vnd.stepmania.stepchart",sit:"application/x-stuffit",sitx:"application/x-stuffitx",sdkm:"application/vnd.solent.sdkm+xml",xo:"application/vnd.olpc-sugar",au:"audio/basic",wqd:"application/vnd.wqd",sis:"application/vnd.symbian.install",smi:"application/smil+xml",xsm:"application/vnd.syncml+xml",bdm:"application/vnd.syncml.dm+wbxml",xdm:"application/vnd.syncml.dm+xml",sv4cpio:"application/x-sv4cpio",sv4crc:"application/x-sv4crc",sbml:"application/sbml+xml",tsv:"text/tab-separated-values",tiff:"image/tiff",tao:"application/vnd.tao.intent-module-archive",tar:"application/x-tar",tcl:"application/x-tcl",tex:"application/x-tex",tfm:"application/x-tex-tfm",tei:"application/tei+xml",txt:"text/plain",dxp:"application/vnd.spotfire.dxp",sfs:"application/vnd.spotfire.sfs",tsd:"application/timestamped-data",tpt:"application/vnd.trid.tpt",mxs:"application/vnd.triscape.mxs",t:"text/troff",tra:"application/vnd.trueapp",ttf:"application/x-font-ttf",ttl:"text/turtle",umj:"application/vnd.umajin",uoml:"application/vnd.uoml+xml",unityweb:"application/vnd.unity",ufd:"application/vnd.ufdl",uri:"text/uri-list",utz:"application/vnd.uiq.theme",ustar:"application/x-ustar",uu:"text/x-uuencode",vcs:"text/x-vcalendar",vcf:"text/x-vcard",vcd:"application/x-cdlink",vsf:"application/vnd.vsf",wrl:"model/vrml",vcx:"application/vnd.vcx",mts:"model/vnd.mts",vtu:"model/vnd.vtu",vis:"application/vnd.visionary",viv:"video/vnd.vivo",ccxml:"application/ccxml+xml,",vxml:"application/voicexml+xml",src:"application/x-wais-source",wbxml:"application/vnd.wap.wbxml",wbmp:"image/vnd.wap.wbmp",wav:"audio/x-wav",davmount:"application/davmount+xml",woff:"application/x-font-woff",wspolicy:"application/wspolicy+xml",webp:"image/webp",wtb:"application/vnd.webturbo",wgt:"application/widget",hlp:"application/winhlp",wml:"text/vnd.wap.wml",wmls:"text/vnd.wap.wmlscript",wmlsc:"application/vnd.wap.wmlscriptc",wpd:"application/vnd.wordperfect",stf:"application/vnd.wt.stf",wsdl:"application/wsdl+xml",xbm:"image/x-xbitmap",xpm:"image/x-xpixmap",xwd:"image/x-xwindowdump",der:"application/x-x509-ca-cert",fig:"application/x-xfig",xhtml:"application/xhtml+xml",xml:"application/xml",xdf:"application/xcap-diff+xml",xenc:"application/xenc+xml",xer:"application/patch-ops-error+xml",rl:"application/resource-lists+xml",rs:"application/rls-services+xml",rld:"application/resource-lists-diff+xml",xslt:"application/xslt+xml",xop:"application/xop+xml",xpi:"application/x-xpinstall",xspf:"application/xspf+xml",xul:"application/vnd.mozilla.xul+xml",xyz:"chemical/x-xyz",yaml:"text/yaml",yang:"application/yang",yin:"application/yin+xml",zir:"application/vnd.zul",zip:"application/zip",zmm:"application/vnd.handheld-entertainment+xml",zaz:"application/vnd.zzazz.deck+xml"},UO=Object.fromEntries(Object.entries(Q1).map(function(e){var t=jn(e,2),n=t[0],r=t[1];return[r,n]})),f6=/^data:(.*?);base64,/;function h6(e){var t=f6.exec(e);if(t&&t[1])return t[1]}function p6(e){var t=UO[e];return t||e.split("/")[1]}function m6(e){var t=e.split(".").pop(),n=t&&Q1[t];if(n)return n}function WO(e,t,n,r,o){var i="".concat((r==null?void 0:r.width)||"").concat((r==null?void 0:r.height)||"").concat(r==null?void 0:r.mimeType),s={type:t.type,opt:t.opt,options:xt({},t.options)};return e+JSON.stringify(s)+n+i+o}function g6(e,t,n,r,o,i){return Z1(i.encode(WO(e,t,n,r,o))).slice(0,4)}function HO(e){return e.slice(0,12)}function v6(e){return HO(Z1(new Uint8Array(e)))}function y6(e,t){var n=e.startsWith("/")?e.slice(1).split("/"):e.split("/");if(t.length===0)return{isValid:n.length===0||n.length===1&&n[0]==="",expectedPath:"/"};for(var r=0,o=0,i=!1,s=-1,a=0;a<t.length;a++){var l=t[a];l.startsWith("[[")&&l.endsWith("]]")?(i=!0,s=a,o=1/0):l.startsWith("[...")&&l.endsWith("]")?(i=!0,s=a,r++,o=1/0):l.startsWith("[[")&&l.endsWith("]")?o++:(l.startsWith("[")&&l.endsWith("]"),r++,o++)}if(n.length<r||!i&&n.length>o){var c=t.map(function(m){return m.startsWith("[[")&&m.endsWith("]]")?"[optional:".concat(m.slice(2,-2),"]"):m.startsWith("[...")&&m.endsWith("]")?"[...".concat(m.slice(4,-1),"]"):m.startsWith("[[")&&m.endsWith("]")?"[optional:".concat(m.slice(2,-1),"]"):m.startsWith("[")&&m.endsWith("]")?"[".concat(m.slice(1,-1),"]"):m}).join("/");return{isValid:!1,expectedPath:"/".concat(c)}}for(var u=i?s:t.length,f=0;f<u;f++){var h=t[f],p=n[f];if(h.startsWith("[[")&&h.endsWith("]]")){if(p!==""&&p!==void 0&&p==="")return{isValid:!1,expectedPath:"/".concat(t.join("/"))}}else if(h.startsWith("[")&&h.endsWith("]")){if(p===""||p===void 0)return{isValid:!1,expectedPath:"/".concat(t.join("/"))}}else if(h!==p)return{isValid:!1,expectedPath:"/".concat(t.join("/"))}}return{isValid:!0}}var x6={getRouterId:function(){return"next-app-router"},validate:function(t,n){var r=b6(t),o=[],i=gi(n),s;try{for(i.s();!(s=i.n()).done;){var a=s.value,l=y6(a,r);l.isValid||o.push({error:{message:'URL path "'.concat(a,'" does not match the route pattern for "').concat(t,'"'),urlPath:a,expectedPath:l.expectedPath||null}})}}catch(c){i.e(c)}finally{i.f()}return o}};function b6(e){if(!e||typeof e!="string")return[];for(var t=[/\/app\/(.+)\/page\.val\.ts$/,/\/src\/app\/(.+)\/page\.val\.ts$/,/\/app\/(.+)\/page\.tsx?$/,/\/src\/app\/(.+)\/page\.tsx?$/],n=0,r=t;n<r.length;n++){var o=r[n],i=e.match(o);if(i){var s=i[1];return s.split("/").flatMap(function(a){if(a.startsWith("(")&&a.endsWith(")")&&!a.includes("."))return[];var l=a.match(/^(\([.]+\)(\(.+\))?)(.*)$/);if(l){var c=l[3]||l[4];return c?[c]:[]}return[a]})}}return[]}var ba="?p=",KO="https://content.val.build",Nb="https://app.val.build",Y={VERSION:{core:function(){try{return require("../package.json").version}catch{return null}}()},convertFileSource:P$,convertRemoteSource:Q$,getSchema:UC,getValPath:TO,getSource:D$,resolvePath:L$,safeResolvePath:F$,splitModuleFilePathAndModulePath:X1,joinModuleFilePathAndModulePath:AO,nextAppRouter:x6,remote:{createRemoteRef:X$,getValidationBasis:WO,getValidationHash:g6,getFileHash:v6,hashToRemoteFileHash:HO,splitRemoteRef:VO},validate:function(t,n,r){var o;return t&&((o=UC(t))===null||o===void 0?void 0:o.executeValidate(n,r))},isVal:_$,isFile:E$,createValPathOfItem:fu,getSHA256Hash:Z1,initSchema:J$,getMimeType:h6,mimeTypeToFileExt:p6,filenameToMimeType:m6,EXT_TO_MIME_TYPES:Q1,MIME_TYPES_TO_EXT:UO,ModuleFilePathSep:ba,notFileOp:function(t){return t.op!=="file"},isFileOp:function(t){return t.op==="file"&&typeof t.filePath=="string"},createPatchJSONPath:function(t){return"/".concat(t.split(".").map(function(n){return n&&w6(n)}).join("/"))},createPatchPath:function(t){return Xf(t)},splitModulePath:Xf,splitModuleFilePath:z$,splitJoinedSourcePaths:$$,parentOfSourcePath:B$,patchPathToModulePath:BO,VAL_ENABLE_COOKIE_NAME:"val_enable",VAL_STATE_COOKIE:"val_state",VAL_SESSION_COOKIE:"val_session",createFilename:function(t,n,r,o){var i,s;if(!r||!t)return n;var a=o.slice(0,5),l=(i=Y.getMimeType(t))!==null&&i!==void 0?i:"unknown",c=(s=Y.mimeTypeToFileExt(l))!==null&&s!==void 0?s:"unknown";if(n){var u=n.split(".").slice(0,-1).join(".")||n,f=u.lastIndexOf("_"),h=u.slice(f+1,u.length);h===a&&(u=u.slice(0,f));var p=encodeURIComponent(u).replace(/%[0-9A-Fa-f]{2}/g,"").toLowerCase();return"".concat(p,"_").concat(a,".").concat(c)}return"".concat(o,".").concat(c)}};function w6(e){try{return JSON.parse(e)}catch{return e}}var Gv={},qv={};qv.byteLength=E6;qv.toByteArray=N6;qv.fromByteArray=j6;var fi=[],ro=[],S6=typeof Uint8Array<"u"?Uint8Array:Array,Nx="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var ac=0,k6=Nx.length;ac<k6;++ac)fi[ac]=Nx[ac],ro[Nx.charCodeAt(ac)]=ac;ro[45]=62;ro[95]=63;function GO(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function E6(e){var t=GO(e),n=t[0],r=t[1];return(n+r)*3/4-r}function C6(e,t,n){return(t+n)*3/4-n}function N6(e){var t,n=GO(e),r=n[0],o=n[1],i=new S6(C6(e,r,o)),s=0,a=o>0?r-4:r,l;for(l=0;l<a;l+=4)t=ro[e.charCodeAt(l)]<<18|ro[e.charCodeAt(l+1)]<<12|ro[e.charCodeAt(l+2)]<<6|ro[e.charCodeAt(l+3)],i[s++]=t>>16&255,i[s++]=t>>8&255,i[s++]=t&255;return o===2&&(t=ro[e.charCodeAt(l)]<<2|ro[e.charCodeAt(l+1)]>>4,i[s++]=t&255),o===1&&(t=ro[e.charCodeAt(l)]<<10|ro[e.charCodeAt(l+1)]<<4|ro[e.charCodeAt(l+2)]>>2,i[s++]=t>>8&255,i[s++]=t&255),i}function P6(e){return fi[e>>18&63]+fi[e>>12&63]+fi[e>>6&63]+fi[e&63]}function _6(e,t,n){for(var r,o=[],i=t;i<n;i+=3)r=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(e[i+2]&255),o.push(P6(r));return o.join("")}function j6(e){for(var t,n=e.length,r=n%3,o=[],i=16383,s=0,a=n-r;s<a;s+=i)o.push(_6(e,s,s+i>a?a:s+i));return r===1?(t=e[n-1],o.push(fi[t>>2]+fi[t<<4&63]+"==")):r===2&&(t=(e[n-2]<<8)+e[n-1],o.push(fi[t>>10]+fi[t>>4&63]+fi[t<<2&63]+"=")),o.join("")}var eS={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */eS.read=function(e,t,n,r,o){var i,s,a=o*8-r-1,l=(1<<a)-1,c=l>>1,u=-7,f=n?o-1:0,h=n?-1:1,p=e[t+f];for(f+=h,i=p&(1<<-u)-1,p>>=-u,u+=a;u>0;i=i*256+e[t+f],f+=h,u-=8);for(s=i&(1<<-u)-1,i>>=-u,u+=r;u>0;s=s*256+e[t+f],f+=h,u-=8);if(i===0)i=1-c;else{if(i===l)return s?NaN:(p?-1:1)*(1/0);s=s+Math.pow(2,r),i=i-c}return(p?-1:1)*s*Math.pow(2,i-r)};eS.write=function(e,t,n,r,o,i){var s,a,l,c=i*8-o-1,u=(1<<c)-1,f=u>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,m=r?1:-1,v=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+f>=1?t+=h/l:t+=h*Math.pow(2,1-f),t*l>=2&&(s++,l/=2),s+f>=u?(a=0,s=u):s+f>=1?(a=(t*l-1)*Math.pow(2,o),s=s+f):(a=t*Math.pow(2,f-1)*Math.pow(2,o),s=0));o>=8;e[n+p]=a&255,p+=m,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;e[n+p]=s&255,p+=m,s/=256,c-=8);e[n+p-m]|=v*128};/*!
|
|
44
|
-
* The buffer module from node.js, for the browser.
|
|
45
|
-
*
|
|
46
|
-
* @author Feross Aboukhadijeh <https://feross.org>
|
|
47
|
-
* @license MIT
|
|
48
|
-
*/(function(e){var t=qv,n=eS,r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=a,e.SlowBuffer=w,e.INSPECT_MAX_BYTES=50;var o=2147483647;e.kMaxLength=o,a.TYPED_ARRAY_SUPPORT=i(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{var T=new Uint8Array(1),k={foo:function(){return 42}};return Object.setPrototypeOf(k,Uint8Array.prototype),Object.setPrototypeOf(T,k),T.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function s(T){if(T>o)throw new RangeError('The value "'+T+'" is invalid for option "size"');var k=new Uint8Array(T);return Object.setPrototypeOf(k,a.prototype),k}function a(T,k,E){if(typeof T=="number"){if(typeof k=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return f(T)}return l(T,k,E)}a.poolSize=8192;function l(T,k,E){if(typeof T=="string")return h(T,k);if(ArrayBuffer.isView(T))return m(T);if(T==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T);if(Xe(T,ArrayBuffer)||T&&Xe(T.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Xe(T,SharedArrayBuffer)||T&&Xe(T.buffer,SharedArrayBuffer)))return v(T,k,E);if(typeof T=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var R=T.valueOf&&T.valueOf();if(R!=null&&R!==T)return a.from(R,k,E);var F=x(T);if(F)return F;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]=="function")return a.from(T[Symbol.toPrimitive]("string"),k,E);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}a.from=function(T,k,E){return l(T,k,E)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function c(T){if(typeof T!="number")throw new TypeError('"size" argument must be of type number');if(T<0)throw new RangeError('The value "'+T+'" is invalid for option "size"')}function u(T,k,E){return c(T),T<=0?s(T):k!==void 0?typeof E=="string"?s(T).fill(k,E):s(T).fill(k):s(T)}a.alloc=function(T,k,E){return u(T,k,E)};function f(T){return c(T),s(T<0?0:b(T)|0)}a.allocUnsafe=function(T){return f(T)},a.allocUnsafeSlow=function(T){return f(T)};function h(T,k){if((typeof k!="string"||k==="")&&(k="utf8"),!a.isEncoding(k))throw new TypeError("Unknown encoding: "+k);var E=S(T,k)|0,R=s(E),F=R.write(T,k);return F!==E&&(R=R.slice(0,F)),R}function p(T){for(var k=T.length<0?0:b(T.length)|0,E=s(k),R=0;R<k;R+=1)E[R]=T[R]&255;return E}function m(T){if(Xe(T,Uint8Array)){var k=new Uint8Array(T);return v(k.buffer,k.byteOffset,k.byteLength)}return p(T)}function v(T,k,E){if(k<0||T.byteLength<k)throw new RangeError('"offset" is outside of buffer bounds');if(T.byteLength<k+(E||0))throw new RangeError('"length" is outside of buffer bounds');var R;return k===void 0&&E===void 0?R=new Uint8Array(T):E===void 0?R=new Uint8Array(T,k):R=new Uint8Array(T,k,E),Object.setPrototypeOf(R,a.prototype),R}function x(T){if(a.isBuffer(T)){var k=b(T.length)|0,E=s(k);return E.length===0||T.copy(E,0,0,k),E}if(T.length!==void 0)return typeof T.length!="number"||gt(T.length)?s(0):p(T);if(T.type==="Buffer"&&Array.isArray(T.data))return p(T.data)}function b(T){if(T>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return T|0}function w(T){return+T!=T&&(T=0),a.alloc(+T)}a.isBuffer=function(k){return k!=null&&k._isBuffer===!0&&k!==a.prototype},a.compare=function(k,E){if(Xe(k,Uint8Array)&&(k=a.from(k,k.offset,k.byteLength)),Xe(E,Uint8Array)&&(E=a.from(E,E.offset,E.byteLength)),!a.isBuffer(k)||!a.isBuffer(E))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(k===E)return 0;for(var R=k.length,F=E.length,X=0,ee=Math.min(R,F);X<ee;++X)if(k[X]!==E[X]){R=k[X],F=E[X];break}return R<F?-1:F<R?1:0},a.isEncoding=function(k){switch(String(k).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(k,E){if(!Array.isArray(k))throw new TypeError('"list" argument must be an Array of Buffers');if(k.length===0)return a.alloc(0);var R;if(E===void 0)for(E=0,R=0;R<k.length;++R)E+=k[R].length;var F=a.allocUnsafe(E),X=0;for(R=0;R<k.length;++R){var ee=k[R];if(Xe(ee,Uint8Array))X+ee.length>F.length?a.from(ee).copy(F,X):Uint8Array.prototype.set.call(F,ee,X);else if(a.isBuffer(ee))ee.copy(F,X);else throw new TypeError('"list" argument must be an Array of Buffers');X+=ee.length}return F};function S(T,k){if(a.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||Xe(T,ArrayBuffer))return T.byteLength;if(typeof T!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof T);var E=T.length,R=arguments.length>2&&arguments[2]===!0;if(!R&&E===0)return 0;for(var F=!1;;)switch(k){case"ascii":case"latin1":case"binary":return E;case"utf8":case"utf-8":return ce(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E*2;case"hex":return E>>>1;case"base64":return Le(T).length;default:if(F)return R?-1:ce(T).length;k=(""+k).toLowerCase(),F=!0}}a.byteLength=S;function C(T,k,E){var R=!1;if((k===void 0||k<0)&&(k=0),k>this.length||((E===void 0||E>this.length)&&(E=this.length),E<=0)||(E>>>=0,k>>>=0,E<=k))return"";for(T||(T="utf8");;)switch(T){case"hex":return L(this,k,E);case"utf8":case"utf-8":return K(this,k,E);case"ascii":return A(this,k,E);case"latin1":case"binary":return j(this,k,E);case"base64":return H(this,k,E);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $(this,k,E);default:if(R)throw new TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),R=!0}}a.prototype._isBuffer=!0;function N(T,k,E){var R=T[k];T[k]=T[E],T[E]=R}a.prototype.swap16=function(){var k=this.length;if(k%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var E=0;E<k;E+=2)N(this,E,E+1);return this},a.prototype.swap32=function(){var k=this.length;if(k%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var E=0;E<k;E+=4)N(this,E,E+3),N(this,E+1,E+2);return this},a.prototype.swap64=function(){var k=this.length;if(k%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var E=0;E<k;E+=8)N(this,E,E+7),N(this,E+1,E+6),N(this,E+2,E+5),N(this,E+3,E+4);return this},a.prototype.toString=function(){var k=this.length;return k===0?"":arguments.length===0?K(this,0,k):C.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(k){if(!a.isBuffer(k))throw new TypeError("Argument must be a Buffer");return this===k?!0:a.compare(this,k)===0},a.prototype.inspect=function(){var k="",E=e.INSPECT_MAX_BYTES;return k=this.toString("hex",0,E).replace(/(.{2})/g,"$1 ").trim(),this.length>E&&(k+=" ... "),"<Buffer "+k+">"},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(k,E,R,F,X){if(Xe(k,Uint8Array)&&(k=a.from(k,k.offset,k.byteLength)),!a.isBuffer(k))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof k);if(E===void 0&&(E=0),R===void 0&&(R=k?k.length:0),F===void 0&&(F=0),X===void 0&&(X=this.length),E<0||R>k.length||F<0||X>this.length)throw new RangeError("out of range index");if(F>=X&&E>=R)return 0;if(F>=X)return-1;if(E>=R)return 1;if(E>>>=0,R>>>=0,F>>>=0,X>>>=0,this===k)return 0;for(var ee=X-F,Ze=R-E,ct=Math.min(ee,Ze),wt=this.slice(F,X),cn=k.slice(E,R),dt=0;dt<ct;++dt)if(wt[dt]!==cn[dt]){ee=wt[dt],Ze=cn[dt];break}return ee<Ze?-1:Ze<ee?1:0};function P(T,k,E,R,F){if(T.length===0)return-1;if(typeof E=="string"?(R=E,E=0):E>2147483647?E=2147483647:E<-2147483648&&(E=-2147483648),E=+E,gt(E)&&(E=F?0:T.length-1),E<0&&(E=T.length+E),E>=T.length){if(F)return-1;E=T.length-1}else if(E<0)if(F)E=0;else return-1;if(typeof k=="string"&&(k=a.from(k,R)),a.isBuffer(k))return k.length===0?-1:_(T,k,E,R,F);if(typeof k=="number")return k=k&255,typeof Uint8Array.prototype.indexOf=="function"?F?Uint8Array.prototype.indexOf.call(T,k,E):Uint8Array.prototype.lastIndexOf.call(T,k,E):_(T,[k],E,R,F);throw new TypeError("val must be string, number or Buffer")}function _(T,k,E,R,F){var X=1,ee=T.length,Ze=k.length;if(R!==void 0&&(R=String(R).toLowerCase(),R==="ucs2"||R==="ucs-2"||R==="utf16le"||R==="utf-16le")){if(T.length<2||k.length<2)return-1;X=2,ee/=2,Ze/=2,E/=2}function ct(ys,cd){return X===1?ys[cd]:ys.readUInt16BE(cd*X)}var wt;if(F){var cn=-1;for(wt=E;wt<ee;wt++)if(ct(T,wt)===ct(k,cn===-1?0:wt-cn)){if(cn===-1&&(cn=wt),wt-cn+1===Ze)return cn*X}else cn!==-1&&(wt-=wt-cn),cn=-1}else for(E+Ze>ee&&(E=ee-Ze),wt=E;wt>=0;wt--){for(var dt=!0,Po=0;Po<Ze;Po++)if(ct(T,wt+Po)!==ct(k,Po)){dt=!1;break}if(dt)return wt}return-1}a.prototype.includes=function(k,E,R){return this.indexOf(k,E,R)!==-1},a.prototype.indexOf=function(k,E,R){return P(this,k,E,R,!0)},a.prototype.lastIndexOf=function(k,E,R){return P(this,k,E,R,!1)};function O(T,k,E,R){E=Number(E)||0;var F=T.length-E;R?(R=Number(R),R>F&&(R=F)):R=F;var X=k.length;R>X/2&&(R=X/2);for(var ee=0;ee<R;++ee){var Ze=parseInt(k.substr(ee*2,2),16);if(gt(Ze))return ee;T[E+ee]=Ze}return ee}function M(T,k,E,R){return Pe(ce(k,T.length-E),T,E,R)}function D(T,k,E,R){return Pe(Ne(k),T,E,R)}function U(T,k,E,R){return Pe(Le(k),T,E,R)}function z(T,k,E,R){return Pe(he(k,T.length-E),T,E,R)}a.prototype.write=function(k,E,R,F){if(E===void 0)F="utf8",R=this.length,E=0;else if(R===void 0&&typeof E=="string")F=E,R=this.length,E=0;else if(isFinite(E))E=E>>>0,isFinite(R)?(R=R>>>0,F===void 0&&(F="utf8")):(F=R,R=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var X=this.length-E;if((R===void 0||R>X)&&(R=X),k.length>0&&(R<0||E<0)||E>this.length)throw new RangeError("Attempt to write outside buffer bounds");F||(F="utf8");for(var ee=!1;;)switch(F){case"hex":return O(this,k,E,R);case"utf8":case"utf-8":return M(this,k,E,R);case"ascii":case"latin1":case"binary":return D(this,k,E,R);case"base64":return U(this,k,E,R);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,k,E,R);default:if(ee)throw new TypeError("Unknown encoding: "+F);F=(""+F).toLowerCase(),ee=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function H(T,k,E){return k===0&&E===T.length?t.fromByteArray(T):t.fromByteArray(T.slice(k,E))}function K(T,k,E){E=Math.min(T.length,E);for(var R=[],F=k;F<E;){var X=T[F],ee=null,Ze=X>239?4:X>223?3:X>191?2:1;if(F+Ze<=E){var ct,wt,cn,dt;switch(Ze){case 1:X<128&&(ee=X);break;case 2:ct=T[F+1],(ct&192)===128&&(dt=(X&31)<<6|ct&63,dt>127&&(ee=dt));break;case 3:ct=T[F+1],wt=T[F+2],(ct&192)===128&&(wt&192)===128&&(dt=(X&15)<<12|(ct&63)<<6|wt&63,dt>2047&&(dt<55296||dt>57343)&&(ee=dt));break;case 4:ct=T[F+1],wt=T[F+2],cn=T[F+3],(ct&192)===128&&(wt&192)===128&&(cn&192)===128&&(dt=(X&15)<<18|(ct&63)<<12|(wt&63)<<6|cn&63,dt>65535&&dt<1114112&&(ee=dt))}}ee===null?(ee=65533,Ze=1):ee>65535&&(ee-=65536,R.push(ee>>>10&1023|55296),ee=56320|ee&1023),R.push(ee),F+=Ze}return I(R)}var V=4096;function I(T){var k=T.length;if(k<=V)return String.fromCharCode.apply(String,T);for(var E="",R=0;R<k;)E+=String.fromCharCode.apply(String,T.slice(R,R+=V));return E}function A(T,k,E){var R="";E=Math.min(T.length,E);for(var F=k;F<E;++F)R+=String.fromCharCode(T[F]&127);return R}function j(T,k,E){var R="";E=Math.min(T.length,E);for(var F=k;F<E;++F)R+=String.fromCharCode(T[F]);return R}function L(T,k,E){var R=T.length;(!k||k<0)&&(k=0),(!E||E<0||E>R)&&(E=R);for(var F="",X=k;X<E;++X)F+=Kt[T[X]];return F}function $(T,k,E){for(var R=T.slice(k,E),F="",X=0;X<R.length-1;X+=2)F+=String.fromCharCode(R[X]+R[X+1]*256);return F}a.prototype.slice=function(k,E){var R=this.length;k=~~k,E=E===void 0?R:~~E,k<0?(k+=R,k<0&&(k=0)):k>R&&(k=R),E<0?(E+=R,E<0&&(E=0)):E>R&&(E=R),E<k&&(E=k);var F=this.subarray(k,E);return Object.setPrototypeOf(F,a.prototype),F};function W(T,k,E){if(T%1!==0||T<0)throw new RangeError("offset is not uint");if(T+k>E)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(k,E,R){k=k>>>0,E=E>>>0,R||W(k,E,this.length);for(var F=this[k],X=1,ee=0;++ee<E&&(X*=256);)F+=this[k+ee]*X;return F},a.prototype.readUintBE=a.prototype.readUIntBE=function(k,E,R){k=k>>>0,E=E>>>0,R||W(k,E,this.length);for(var F=this[k+--E],X=1;E>0&&(X*=256);)F+=this[k+--E]*X;return F},a.prototype.readUint8=a.prototype.readUInt8=function(k,E){return k=k>>>0,E||W(k,1,this.length),this[k]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(k,E){return k=k>>>0,E||W(k,2,this.length),this[k]|this[k+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(k,E){return k=k>>>0,E||W(k,2,this.length),this[k]<<8|this[k+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(k,E){return k=k>>>0,E||W(k,4,this.length),(this[k]|this[k+1]<<8|this[k+2]<<16)+this[k+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(k,E){return k=k>>>0,E||W(k,4,this.length),this[k]*16777216+(this[k+1]<<16|this[k+2]<<8|this[k+3])},a.prototype.readIntLE=function(k,E,R){k=k>>>0,E=E>>>0,R||W(k,E,this.length);for(var F=this[k],X=1,ee=0;++ee<E&&(X*=256);)F+=this[k+ee]*X;return X*=128,F>=X&&(F-=Math.pow(2,8*E)),F},a.prototype.readIntBE=function(k,E,R){k=k>>>0,E=E>>>0,R||W(k,E,this.length);for(var F=E,X=1,ee=this[k+--F];F>0&&(X*=256);)ee+=this[k+--F]*X;return X*=128,ee>=X&&(ee-=Math.pow(2,8*E)),ee},a.prototype.readInt8=function(k,E){return k=k>>>0,E||W(k,1,this.length),this[k]&128?(255-this[k]+1)*-1:this[k]},a.prototype.readInt16LE=function(k,E){k=k>>>0,E||W(k,2,this.length);var R=this[k]|this[k+1]<<8;return R&32768?R|4294901760:R},a.prototype.readInt16BE=function(k,E){k=k>>>0,E||W(k,2,this.length);var R=this[k+1]|this[k]<<8;return R&32768?R|4294901760:R},a.prototype.readInt32LE=function(k,E){return k=k>>>0,E||W(k,4,this.length),this[k]|this[k+1]<<8|this[k+2]<<16|this[k+3]<<24},a.prototype.readInt32BE=function(k,E){return k=k>>>0,E||W(k,4,this.length),this[k]<<24|this[k+1]<<16|this[k+2]<<8|this[k+3]},a.prototype.readFloatLE=function(k,E){return k=k>>>0,E||W(k,4,this.length),n.read(this,k,!0,23,4)},a.prototype.readFloatBE=function(k,E){return k=k>>>0,E||W(k,4,this.length),n.read(this,k,!1,23,4)},a.prototype.readDoubleLE=function(k,E){return k=k>>>0,E||W(k,8,this.length),n.read(this,k,!0,52,8)},a.prototype.readDoubleBE=function(k,E){return k=k>>>0,E||W(k,8,this.length),n.read(this,k,!1,52,8)};function G(T,k,E,R,F,X){if(!a.isBuffer(T))throw new TypeError('"buffer" argument must be a Buffer instance');if(k>F||k<X)throw new RangeError('"value" argument is out of bounds');if(E+R>T.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(k,E,R,F){if(k=+k,E=E>>>0,R=R>>>0,!F){var X=Math.pow(2,8*R)-1;G(this,k,E,R,X,0)}var ee=1,Ze=0;for(this[E]=k&255;++Ze<R&&(ee*=256);)this[E+Ze]=k/ee&255;return E+R},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(k,E,R,F){if(k=+k,E=E>>>0,R=R>>>0,!F){var X=Math.pow(2,8*R)-1;G(this,k,E,R,X,0)}var ee=R-1,Ze=1;for(this[E+ee]=k&255;--ee>=0&&(Ze*=256);)this[E+ee]=k/Ze&255;return E+R},a.prototype.writeUint8=a.prototype.writeUInt8=function(k,E,R){return k=+k,E=E>>>0,R||G(this,k,E,1,255,0),this[E]=k&255,E+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(k,E,R){return k=+k,E=E>>>0,R||G(this,k,E,2,65535,0),this[E]=k&255,this[E+1]=k>>>8,E+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(k,E,R){return k=+k,E=E>>>0,R||G(this,k,E,2,65535,0),this[E]=k>>>8,this[E+1]=k&255,E+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(k,E,R){return k=+k,E=E>>>0,R||G(this,k,E,4,4294967295,0),this[E+3]=k>>>24,this[E+2]=k>>>16,this[E+1]=k>>>8,this[E]=k&255,E+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(k,E,R){return k=+k,E=E>>>0,R||G(this,k,E,4,4294967295,0),this[E]=k>>>24,this[E+1]=k>>>16,this[E+2]=k>>>8,this[E+3]=k&255,E+4},a.prototype.writeIntLE=function(k,E,R,F){if(k=+k,E=E>>>0,!F){var X=Math.pow(2,8*R-1);G(this,k,E,R,X-1,-X)}var ee=0,Ze=1,ct=0;for(this[E]=k&255;++ee<R&&(Ze*=256);)k<0&&ct===0&&this[E+ee-1]!==0&&(ct=1),this[E+ee]=(k/Ze>>0)-ct&255;return E+R},a.prototype.writeIntBE=function(k,E,R,F){if(k=+k,E=E>>>0,!F){var X=Math.pow(2,8*R-1);G(this,k,E,R,X-1,-X)}var ee=R-1,Ze=1,ct=0;for(this[E+ee]=k&255;--ee>=0&&(Ze*=256);)k<0&&ct===0&&this[E+ee+1]!==0&&(ct=1),this[E+ee]=(k/Ze>>0)-ct&255;return E+R},a.prototype.writeInt8=function(k,E,R){return k=+k,E=E>>>0,R||G(this,k,E,1,127,-128),k<0&&(k=255+k+1),this[E]=k&255,E+1},a.prototype.writeInt16LE=function(k,E,R){return k=+k,E=E>>>0,R||G(this,k,E,2,32767,-32768),this[E]=k&255,this[E+1]=k>>>8,E+2},a.prototype.writeInt16BE=function(k,E,R){return k=+k,E=E>>>0,R||G(this,k,E,2,32767,-32768),this[E]=k>>>8,this[E+1]=k&255,E+2},a.prototype.writeInt32LE=function(k,E,R){return k=+k,E=E>>>0,R||G(this,k,E,4,2147483647,-2147483648),this[E]=k&255,this[E+1]=k>>>8,this[E+2]=k>>>16,this[E+3]=k>>>24,E+4},a.prototype.writeInt32BE=function(k,E,R){return k=+k,E=E>>>0,R||G(this,k,E,4,2147483647,-2147483648),k<0&&(k=4294967295+k+1),this[E]=k>>>24,this[E+1]=k>>>16,this[E+2]=k>>>8,this[E+3]=k&255,E+4};function _e(T,k,E,R,F,X){if(E+R>T.length)throw new RangeError("Index out of range");if(E<0)throw new RangeError("Index out of range")}function ke(T,k,E,R,F){return k=+k,E=E>>>0,F||_e(T,k,E,4),n.write(T,k,E,R,23,4),E+4}a.prototype.writeFloatLE=function(k,E,R){return ke(this,k,E,!0,R)},a.prototype.writeFloatBE=function(k,E,R){return ke(this,k,E,!1,R)};function Ve(T,k,E,R,F){return k=+k,E=E>>>0,F||_e(T,k,E,8),n.write(T,k,E,R,52,8),E+8}a.prototype.writeDoubleLE=function(k,E,R){return Ve(this,k,E,!0,R)},a.prototype.writeDoubleBE=function(k,E,R){return Ve(this,k,E,!1,R)},a.prototype.copy=function(k,E,R,F){if(!a.isBuffer(k))throw new TypeError("argument should be a Buffer");if(R||(R=0),!F&&F!==0&&(F=this.length),E>=k.length&&(E=k.length),E||(E=0),F>0&&F<R&&(F=R),F===R||k.length===0||this.length===0)return 0;if(E<0)throw new RangeError("targetStart out of bounds");if(R<0||R>=this.length)throw new RangeError("Index out of range");if(F<0)throw new RangeError("sourceEnd out of bounds");F>this.length&&(F=this.length),k.length-E<F-R&&(F=k.length-E+R);var X=F-R;return this===k&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(E,R,F):Uint8Array.prototype.set.call(k,this.subarray(R,F),E),X},a.prototype.fill=function(k,E,R,F){if(typeof k=="string"){if(typeof E=="string"?(F=E,E=0,R=this.length):typeof R=="string"&&(F=R,R=this.length),F!==void 0&&typeof F!="string")throw new TypeError("encoding must be a string");if(typeof F=="string"&&!a.isEncoding(F))throw new TypeError("Unknown encoding: "+F);if(k.length===1){var X=k.charCodeAt(0);(F==="utf8"&&X<128||F==="latin1")&&(k=X)}}else typeof k=="number"?k=k&255:typeof k=="boolean"&&(k=Number(k));if(E<0||this.length<E||this.length<R)throw new RangeError("Out of range index");if(R<=E)return this;E=E>>>0,R=R===void 0?this.length:R>>>0,k||(k=0);var ee;if(typeof k=="number")for(ee=E;ee<R;++ee)this[ee]=k;else{var Ze=a.isBuffer(k)?k:a.from(k,F),ct=Ze.length;if(ct===0)throw new TypeError('The value "'+k+'" is invalid for argument "value"');for(ee=0;ee<R-E;++ee)this[ee+E]=Ze[ee%ct]}return this};var Z=/[^+/0-9A-Za-z-_]/g;function J(T){if(T=T.split("=")[0],T=T.trim().replace(Z,""),T.length<2)return"";for(;T.length%4!==0;)T=T+"=";return T}function ce(T,k){k=k||1/0;for(var E,R=T.length,F=null,X=[],ee=0;ee<R;++ee){if(E=T.charCodeAt(ee),E>55295&&E<57344){if(!F){if(E>56319){(k-=3)>-1&&X.push(239,191,189);continue}else if(ee+1===R){(k-=3)>-1&&X.push(239,191,189);continue}F=E;continue}if(E<56320){(k-=3)>-1&&X.push(239,191,189),F=E;continue}E=(F-55296<<10|E-56320)+65536}else F&&(k-=3)>-1&&X.push(239,191,189);if(F=null,E<128){if((k-=1)<0)break;X.push(E)}else if(E<2048){if((k-=2)<0)break;X.push(E>>6|192,E&63|128)}else if(E<65536){if((k-=3)<0)break;X.push(E>>12|224,E>>6&63|128,E&63|128)}else if(E<1114112){if((k-=4)<0)break;X.push(E>>18|240,E>>12&63|128,E>>6&63|128,E&63|128)}else throw new Error("Invalid code point")}return X}function Ne(T){for(var k=[],E=0;E<T.length;++E)k.push(T.charCodeAt(E)&255);return k}function he(T,k){for(var E,R,F,X=[],ee=0;ee<T.length&&!((k-=2)<0);++ee)E=T.charCodeAt(ee),R=E>>8,F=E%256,X.push(F),X.push(R);return X}function Le(T){return t.toByteArray(J(T))}function Pe(T,k,E,R){for(var F=0;F<R&&!(F+E>=k.length||F>=T.length);++F)k[F+E]=T[F];return F}function Xe(T,k){return T instanceof k||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===k.name}function gt(T){return T!==T}var Kt=function(){for(var T="0123456789abcdef",k=new Array(256),E=0;E<16;++E)for(var R=E*16,F=0;F<16;++F)k[R+F]=T[E]+T[F];return k}()})(Gv);var nt;(function(e){e.assertEqual=o=>o;function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const i={};for(const s of o)i[s]=s;return i},e.getValidEnumValues=o=>{const i=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(const a of i)s[a]=o[a];return e.objectValues(s)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const i=[];for(const s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(const s of o)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function r(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(nt||(nt={}));var Pb;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Pb||(Pb={}));const pe=nt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Hs=e=>{switch(typeof e){case"undefined":return pe.undefined;case"string":return pe.string;case"number":return isNaN(e)?pe.nan:pe.number;case"boolean":return pe.boolean;case"function":return pe.function;case"bigint":return pe.bigint;case"symbol":return pe.symbol;case"object":return Array.isArray(e)?pe.array:e===null?pe.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?pe.promise:typeof Map<"u"&&e instanceof Map?pe.map:typeof Set<"u"&&e instanceof Set?pe.set:typeof Date<"u"&&e instanceof Date?pe.date:pe.object;default:return pe.unknown}},Q=nt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),T6=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Br extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(i){return i.message},r={_errors:[]},o=i=>{for(const s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(this),r}static assert(t){if(!(t instanceof Br))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,nt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const o of this.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Br.create=e=>new Br(e);const hu=(e,t)=>{let n;switch(e.code){case Q.invalid_type:e.received===pe.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Q.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,nt.jsonStringifyReplacer)}`;break;case Q.unrecognized_keys:n=`Unrecognized key(s) in object: ${nt.joinValues(e.keys,", ")}`;break;case Q.invalid_union:n="Invalid input";break;case Q.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${nt.joinValues(e.options)}`;break;case Q.invalid_enum_value:n=`Invalid enum value. Expected ${nt.joinValues(e.options)}, received '${e.received}'`;break;case Q.invalid_arguments:n="Invalid function arguments";break;case Q.invalid_return_type:n="Invalid function return type";break;case Q.invalid_date:n="Invalid date";break;case Q.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:nt.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case Q.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case Q.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case Q.custom:n="Invalid input";break;case Q.invalid_intersection_types:n="Intersection results could not be merged";break;case Q.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Q.not_finite:n="Number must be finite";break;default:n=t.defaultError,nt.assertNever(e)}return{message:n}};let qO=hu;function O6(e){qO=e}function xg(){return qO}const bg=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,i=[...n,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(s,{data:t,defaultError:a}).message;return{...o,path:i,message:a}},M6=[];function de(e,t){const n=xg(),r=bg({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===hu?void 0:hu].filter(o=>!!o)});e.common.issues.push(r)}class Kn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const o of n){if(o.status==="aborted")return Ie;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const o of n){const i=await o.key,s=await o.value;r.push({key:i,value:s})}return Kn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return Ie;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(r[i.value]=s.value)}return{status:t.value,value:r}}}const Ie=Object.freeze({status:"aborted"}),$c=e=>({status:"dirty",value:e}),er=e=>({status:"valid",value:e}),_b=e=>e.status==="aborted",jb=e=>e.status==="dirty",Zf=e=>e.status==="valid",Qf=e=>typeof Promise<"u"&&e instanceof Promise;function wg(e,t,n,r){if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function YO(e,t,n,r,o){if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var we;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(we||(we={}));var Dd,Ld;class xi{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const HC=(e,t)=>{if(Zf(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Br(e.common.issues);return this._error=n,this._error}}};function $e(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(s,a)=>{var l,c;const{message:u}=e;return s.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:(l=u??r)!==null&&l!==void 0?l:a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:(c=u??n)!==null&&c!==void 0?c:a.defaultError}},description:o}}class We{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Hs(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Hs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Kn,ctx:{common:t.parent.common,data:t.data,parsedType:Hs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Qf(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const o={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Hs(t)},i=this._parseSync({data:t,path:o.path,parent:o});return HC(o,i)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Hs(t)},o=this._parse({data:t,path:r.path,parent:r}),i=await(Qf(o)?o:Promise.resolve(o));return HC(r,i)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,i)=>{const s=t(o),a=()=>i.addIssue({code:Q.custom,...r(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new Jo({schema:this,typeName:Re.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return vi.create(this,this._def)}nullable(){return Ea.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Go.create(this,this._def)}promise(){return mu.create(this,this._def)}or(t){return rh.create([this,t],this._def)}and(t){return oh.create(this,t,this._def)}transform(t){return new Jo({...$e(this._def),schema:this,typeName:Re.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new ch({...$e(this._def),innerType:this,defaultValue:n,typeName:Re.ZodDefault})}brand(){return new tS({typeName:Re.ZodBranded,type:this,...$e(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new uh({...$e(this._def),innerType:this,catchValue:n,typeName:Re.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Jh.create(this,t)}readonly(){return dh.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const R6=/^c[^\s-]{8,}$/i,A6=/^[0-9a-z]+$/,I6=/^[0-9A-HJKMNP-TV-Z]{26}$/,D6=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,L6=/^[a-z0-9_-]{21}$/i,F6=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,z6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,$6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Px;const B6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,V6=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,U6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,JO="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",W6=new RegExp(`^${JO}$`);function XO(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function H6(e){return new RegExp(`^${XO(e)}$`)}function ZO(e){let t=`${JO}T${XO(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function K6(e,t){return!!((t==="v4"||!t)&&B6.test(e)||(t==="v6"||!t)&&V6.test(e))}class Uo extends We{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==pe.string){const i=this._getOrReturnCtx(t);return de(i,{code:Q.invalid_type,expected:pe.string,received:i.parsedType}),Ie}const r=new Kn;let o;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),de(o,{code:Q.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),de(o,{code:Q.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const s=t.data.length>i.value,a=t.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(t,o),s?de(o,{code:Q.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&de(o,{code:Q.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")z6.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"email",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Px||(Px=new RegExp($6,"u")),Px.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"emoji",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")D6.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"uuid",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")L6.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"nanoid",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")R6.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"cuid",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")A6.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"cuid2",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")I6.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"ulid",code:Q.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),de(o,{validation:"url",code:Q.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"regex",code:Q.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),de(o,{code:Q.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),de(o,{code:Q.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),de(o,{code:Q.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?ZO(i).test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{code:Q.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?W6.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{code:Q.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?H6(i).test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{code:Q.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?F6.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"duration",code:Q.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?K6(t.data,i.version)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"ip",code:Q.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?U6.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"base64",code:Q.invalid_string,message:i.message}),r.dirty()):nt.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:Q.invalid_string,...we.errToObj(r)})}_addCheck(t){return new Uo({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...we.errToObj(t)})}url(t){return this._addCheck({kind:"url",...we.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...we.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...we.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...we.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...we.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...we.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...we.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...we.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...we.errToObj(t)})}datetime(t){var n,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,local:(r=t==null?void 0:t.local)!==null&&r!==void 0?r:!1,...we.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...we.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...we.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...we.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...we.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...we.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...we.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...we.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...we.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...we.errToObj(n)})}nonempty(t){return this.min(1,we.errToObj(t))}trim(){return new Uo({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Uo({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Uo({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Uo.create=e=>{var t;return new Uo({checks:[],typeName:Re.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...$e(e)})};function G6(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,i=parseInt(e.toFixed(o).replace(".","")),s=parseInt(t.toFixed(o).replace(".",""));return i%s/Math.pow(10,o)}class wa extends We{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==pe.number){const i=this._getOrReturnCtx(t);return de(i,{code:Q.invalid_type,expected:pe.number,received:i.parsedType}),Ie}let r;const o=new Kn;for(const i of this._def.checks)i.kind==="int"?nt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),de(r,{code:Q.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),de(r,{code:Q.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),de(r,{code:Q.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?G6(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),de(r,{code:Q.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),de(r,{code:Q.not_finite,message:i.message}),o.dirty()):nt.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,we.toString(n))}gt(t,n){return this.setLimit("min",t,!1,we.toString(n))}lte(t,n){return this.setLimit("max",t,!0,we.toString(n))}lt(t,n){return this.setLimit("max",t,!1,we.toString(n))}setLimit(t,n,r,o){return new wa({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:we.toString(o)}]})}_addCheck(t){return new wa({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:we.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:we.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:we.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:we.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:we.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:we.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:we.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:we.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:we.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&nt.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}wa.create=e=>new wa({checks:[],typeName:Re.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...$e(e)});class Sa extends We{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==pe.bigint){const i=this._getOrReturnCtx(t);return de(i,{code:Q.invalid_type,expected:pe.bigint,received:i.parsedType}),Ie}let r;const o=new Kn;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),de(r,{code:Q.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),de(r,{code:Q.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),de(r,{code:Q.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):nt.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,we.toString(n))}gt(t,n){return this.setLimit("min",t,!1,we.toString(n))}lte(t,n){return this.setLimit("max",t,!0,we.toString(n))}lt(t,n){return this.setLimit("max",t,!1,we.toString(n))}setLimit(t,n,r,o){return new Sa({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:we.toString(o)}]})}_addCheck(t){return new Sa({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:we.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:we.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:we.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:we.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:we.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Sa.create=e=>{var t;return new Sa({checks:[],typeName:Re.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...$e(e)})};class eh extends We{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==pe.boolean){const r=this._getOrReturnCtx(t);return de(r,{code:Q.invalid_type,expected:pe.boolean,received:r.parsedType}),Ie}return er(t.data)}}eh.create=e=>new eh({typeName:Re.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...$e(e)});class jl extends We{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==pe.date){const i=this._getOrReturnCtx(t);return de(i,{code:Q.invalid_type,expected:pe.date,received:i.parsedType}),Ie}if(isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return de(i,{code:Q.invalid_date}),Ie}const r=new Kn;let o;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),de(o,{code:Q.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),de(o,{code:Q.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):nt.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new jl({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:we.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:we.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}jl.create=e=>new jl({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Re.ZodDate,...$e(e)});class Sg extends We{_parse(t){if(this._getType(t)!==pe.symbol){const r=this._getOrReturnCtx(t);return de(r,{code:Q.invalid_type,expected:pe.symbol,received:r.parsedType}),Ie}return er(t.data)}}Sg.create=e=>new Sg({typeName:Re.ZodSymbol,...$e(e)});class th extends We{_parse(t){if(this._getType(t)!==pe.undefined){const r=this._getOrReturnCtx(t);return de(r,{code:Q.invalid_type,expected:pe.undefined,received:r.parsedType}),Ie}return er(t.data)}}th.create=e=>new th({typeName:Re.ZodUndefined,...$e(e)});class nh extends We{_parse(t){if(this._getType(t)!==pe.null){const r=this._getOrReturnCtx(t);return de(r,{code:Q.invalid_type,expected:pe.null,received:r.parsedType}),Ie}return er(t.data)}}nh.create=e=>new nh({typeName:Re.ZodNull,...$e(e)});class pu extends We{constructor(){super(...arguments),this._any=!0}_parse(t){return er(t.data)}}pu.create=e=>new pu({typeName:Re.ZodAny,...$e(e)});class gl extends We{constructor(){super(...arguments),this._unknown=!0}_parse(t){return er(t.data)}}gl.create=e=>new gl({typeName:Re.ZodUnknown,...$e(e)});class as extends We{_parse(t){const n=this._getOrReturnCtx(t);return de(n,{code:Q.invalid_type,expected:pe.never,received:n.parsedType}),Ie}}as.create=e=>new as({typeName:Re.ZodNever,...$e(e)});class kg extends We{_parse(t){if(this._getType(t)!==pe.undefined){const r=this._getOrReturnCtx(t);return de(r,{code:Q.invalid_type,expected:pe.void,received:r.parsedType}),Ie}return er(t.data)}}kg.create=e=>new kg({typeName:Re.ZodVoid,...$e(e)});class Go extends We{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==pe.array)return de(n,{code:Q.invalid_type,expected:pe.array,received:n.parsedType}),Ie;if(o.exactLength!==null){const s=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(s||a)&&(de(n,{code:s?Q.too_big:Q.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(de(n,{code:Q.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(de(n,{code:Q.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,a)=>o.type._parseAsync(new xi(n,s,n.path,a)))).then(s=>Kn.mergeArray(r,s));const i=[...n.data].map((s,a)=>o.type._parseSync(new xi(n,s,n.path,a)));return Kn.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new Go({...this._def,minLength:{value:t,message:we.toString(n)}})}max(t,n){return new Go({...this._def,maxLength:{value:t,message:we.toString(n)}})}length(t,n){return new Go({...this._def,exactLength:{value:t,message:we.toString(n)}})}nonempty(t){return this.min(1,t)}}Go.create=(e,t)=>new Go({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Re.ZodArray,...$e(t)});function bc(e){if(e instanceof Rt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=vi.create(bc(r))}return new Rt({...e._def,shape:()=>t})}else return e instanceof Go?new Go({...e._def,type:bc(e.element)}):e instanceof vi?vi.create(bc(e.unwrap())):e instanceof Ea?Ea.create(bc(e.unwrap())):e instanceof bi?bi.create(e.items.map(t=>bc(t))):e}class Rt extends We{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=nt.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==pe.object){const c=this._getOrReturnCtx(t);return de(c,{code:Q.invalid_type,expected:pe.object,received:c.parsedType}),Ie}const{status:r,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof as&&this._def.unknownKeys==="strip"))for(const c in o.data)s.includes(c)||a.push(c);const l=[];for(const c of s){const u=i[c],f=o.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new xi(o,f,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof as){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:o.data[u]}});else if(c==="strict")a.length>0&&(de(o,{code:Q.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const f=o.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new xi(o,f,o.path,u)),alwaysSet:u in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const f=await u.key,h=await u.value;c.push({key:f,value:h,alwaysSet:u.alwaysSet})}return c}).then(c=>Kn.mergeObjectSync(r,c)):Kn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return we.errToObj,new Rt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var o,i,s,a;const l=(s=(i=(o=this._def).errorMap)===null||i===void 0?void 0:i.call(o,n,r).message)!==null&&s!==void 0?s:r.defaultError;return n.code==="unrecognized_keys"?{message:(a=we.errToObj(t).message)!==null&&a!==void 0?a:l}:{message:l}}}:{}})}strip(){return new Rt({...this._def,unknownKeys:"strip"})}passthrough(){return new Rt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Rt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Rt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Re.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Rt({...this._def,catchall:t})}pick(t){const n={};return nt.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Rt({...this._def,shape:()=>n})}omit(t){const n={};return nt.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new Rt({...this._def,shape:()=>n})}deepPartial(){return bc(this)}partial(t){const n={};return nt.objectKeys(this.shape).forEach(r=>{const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}),new Rt({...this._def,shape:()=>n})}required(t){const n={};return nt.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof vi;)i=i._def.innerType;n[r]=i}}),new Rt({...this._def,shape:()=>n})}keyof(){return QO(nt.objectKeys(this.shape))}}Rt.create=(e,t)=>new Rt({shape:()=>e,unknownKeys:"strip",catchall:as.create(),typeName:Re.ZodObject,...$e(t)});Rt.strictCreate=(e,t)=>new Rt({shape:()=>e,unknownKeys:"strict",catchall:as.create(),typeName:Re.ZodObject,...$e(t)});Rt.lazycreate=(e,t)=>new Rt({shape:e,unknownKeys:"strip",catchall:as.create(),typeName:Re.ZodObject,...$e(t)});class rh extends We{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const s=i.map(a=>new Br(a.ctx.common.issues));return de(n,{code:Q.invalid_union,unionErrors:s}),Ie}if(n.common.async)return Promise.all(r.map(async i=>{const s={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(o);{let i;const s=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=s.map(l=>new Br(l));return de(n,{code:Q.invalid_union,unionErrors:a}),Ie}}get options(){return this._def.options}}rh.create=(e,t)=>new rh({options:e,typeName:Re.ZodUnion,...$e(t)});const Li=e=>e instanceof sh?Li(e.schema):e instanceof Jo?Li(e.innerType()):e instanceof ah?[e.value]:e instanceof ka?e.options:e instanceof lh?nt.objectValues(e.enum):e instanceof ch?Li(e._def.innerType):e instanceof th?[void 0]:e instanceof nh?[null]:e instanceof vi?[void 0,...Li(e.unwrap())]:e instanceof Ea?[null,...Li(e.unwrap())]:e instanceof tS||e instanceof dh?Li(e.unwrap()):e instanceof uh?Li(e._def.innerType):[];class Yv extends We{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==pe.object)return de(n,{code:Q.invalid_type,expected:pe.object,received:n.parsedType}),Ie;const r=this.discriminator,o=n.data[r],i=this.optionsMap.get(o);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(de(n,{code:Q.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Ie)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const o=new Map;for(const i of n){const s=Li(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of s){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,i)}}return new Yv({typeName:Re.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,...$e(r)})}}function Tb(e,t){const n=Hs(e),r=Hs(t);if(e===t)return{valid:!0,data:e};if(n===pe.object&&r===pe.object){const o=nt.objectKeys(t),i=nt.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(const a of i){const l=Tb(e[a],t[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(n===pe.array&&r===pe.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let i=0;i<e.length;i++){const s=e[i],a=t[i],l=Tb(s,a);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===pe.date&&r===pe.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class oh extends We{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=(i,s)=>{if(_b(i)||_b(s))return Ie;const a=Tb(i.value,s.value);return a.valid?((jb(i)||jb(s))&&n.dirty(),{status:n.value,value:a.data}):(de(r,{code:Q.invalid_intersection_types}),Ie)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}oh.create=(e,t,n)=>new oh({left:e,right:t,typeName:Re.ZodIntersection,...$e(n)});class bi extends We{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==pe.array)return de(r,{code:Q.invalid_type,expected:pe.array,received:r.parsedType}),Ie;if(r.data.length<this._def.items.length)return de(r,{code:Q.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ie;!this._def.rest&&r.data.length>this._def.items.length&&(de(r,{code:Q.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((s,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new xi(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>Kn.mergeArray(n,s)):Kn.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new bi({...this._def,rest:t})}}bi.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new bi({items:e,typeName:Re.ZodTuple,rest:null,...$e(t)})};class ih extends We{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==pe.object)return de(r,{code:Q.invalid_type,expected:pe.object,received:r.parsedType}),Ie;const o=[],i=this._def.keyType,s=this._def.valueType;for(const a in r.data)o.push({key:i._parse(new xi(r,a,r.path,a)),value:s._parse(new xi(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Kn.mergeObjectAsync(n,o):Kn.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof We?new ih({keyType:t,valueType:n,typeName:Re.ZodRecord,...$e(r)}):new ih({keyType:Uo.create(),valueType:t,typeName:Re.ZodRecord,...$e(n)})}}class Eg extends We{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==pe.map)return de(r,{code:Q.invalid_type,expected:pe.map,received:r.parsedType}),Ie;const o=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([a,l],c)=>({key:o._parse(new xi(r,a,r.path,[c,"key"])),value:i._parse(new xi(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of s){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Ie;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of s){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Ie;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}Eg.create=(e,t,n)=>new Eg({valueType:t,keyType:e,typeName:Re.ZodMap,...$e(n)});class Tl extends We{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==pe.set)return de(r,{code:Q.invalid_type,expected:pe.set,received:r.parsedType}),Ie;const o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(de(r,{code:Q.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(de(r,{code:Q.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const i=this._def.valueType;function s(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Ie;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>i._parse(new xi(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(t,n){return new Tl({...this._def,minSize:{value:t,message:we.toString(n)}})}max(t,n){return new Tl({...this._def,maxSize:{value:t,message:we.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Tl.create=(e,t)=>new Tl({valueType:e,minSize:null,maxSize:null,typeName:Re.ZodSet,...$e(t)});class Gc extends We{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==pe.function)return de(n,{code:Q.invalid_type,expected:pe.function,received:n.parsedType}),Ie;function r(a,l){return bg({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,xg(),hu].filter(c=>!!c),issueData:{code:Q.invalid_arguments,argumentsError:l}})}function o(a,l){return bg({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,xg(),hu].filter(c=>!!c),issueData:{code:Q.invalid_return_type,returnTypeError:l}})}const i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof mu){const a=this;return er(async function(...l){const c=new Br([]),u=await a._def.args.parseAsync(l,i).catch(p=>{throw c.addIssue(r(l,p)),c}),f=await Reflect.apply(s,this,u);return await a._def.returns._def.type.parseAsync(f,i).catch(p=>{throw c.addIssue(o(f,p)),c})})}else{const a=this;return er(function(...l){const c=a._def.args.safeParse(l,i);if(!c.success)throw new Br([r(l,c.error)]);const u=Reflect.apply(s,this,c.data),f=a._def.returns.safeParse(u,i);if(!f.success)throw new Br([o(u,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Gc({...this._def,args:bi.create(t).rest(gl.create())})}returns(t){return new Gc({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new Gc({args:t||bi.create([]).rest(gl.create()),returns:n||gl.create(),typeName:Re.ZodFunction,...$e(r)})}}class sh extends We{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}sh.create=(e,t)=>new sh({getter:e,typeName:Re.ZodLazy,...$e(t)});class ah extends We{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return de(n,{received:n.data,code:Q.invalid_literal,expected:this._def.value}),Ie}return{status:"valid",value:t.data}}get value(){return this._def.value}}ah.create=(e,t)=>new ah({value:e,typeName:Re.ZodLiteral,...$e(t)});function QO(e,t){return new ka({values:e,typeName:Re.ZodEnum,...$e(t)})}class ka extends We{constructor(){super(...arguments),Dd.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return de(n,{expected:nt.joinValues(r),received:n.parsedType,code:Q.invalid_type}),Ie}if(wg(this,Dd)||YO(this,Dd,new Set(this._def.values)),!wg(this,Dd).has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return de(n,{received:n.data,code:Q.invalid_enum_value,options:r}),Ie}return er(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return ka.create(t,{...this._def,...n})}exclude(t,n=this._def){return ka.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Dd=new WeakMap;ka.create=QO;class lh extends We{constructor(){super(...arguments),Ld.set(this,void 0)}_parse(t){const n=nt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==pe.string&&r.parsedType!==pe.number){const o=nt.objectValues(n);return de(r,{expected:nt.joinValues(o),received:r.parsedType,code:Q.invalid_type}),Ie}if(wg(this,Ld)||YO(this,Ld,new Set(nt.getValidEnumValues(this._def.values))),!wg(this,Ld).has(t.data)){const o=nt.objectValues(n);return de(r,{received:r.data,code:Q.invalid_enum_value,options:o}),Ie}return er(t.data)}get enum(){return this._def.values}}Ld=new WeakMap;lh.create=(e,t)=>new lh({values:e,typeName:Re.ZodNativeEnum,...$e(t)});class mu extends We{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==pe.promise&&n.common.async===!1)return de(n,{code:Q.invalid_type,expected:pe.promise,received:n.parsedType}),Ie;const r=n.parsedType===pe.promise?n.data:Promise.resolve(n.data);return er(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}mu.create=(e,t)=>new mu({type:e,typeName:Re.ZodPromise,...$e(t)});class Jo extends We{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Re.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{de(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){const s=o.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(async a=>{if(n.value==="aborted")return Ie;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Ie:l.status==="dirty"||n.value==="dirty"?$c(l.value):l});{if(n.value==="aborted")return Ie;const a=this._def.schema._parseSync({data:s,path:r.path,parent:r});return a.status==="aborted"?Ie:a.status==="dirty"||n.value==="dirty"?$c(a.value):a}}if(o.type==="refinement"){const s=a=>{const l=o.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Ie:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Ie:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Zf(s))return s;const a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>Zf(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:n.value,value:a})):s);nt.assertNever(o)}}Jo.create=(e,t,n)=>new Jo({schema:e,typeName:Re.ZodEffects,effect:t,...$e(n)});Jo.createWithPreprocess=(e,t,n)=>new Jo({schema:t,effect:{type:"preprocess",transform:e},typeName:Re.ZodEffects,...$e(n)});class vi extends We{_parse(t){return this._getType(t)===pe.undefined?er(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}vi.create=(e,t)=>new vi({innerType:e,typeName:Re.ZodOptional,...$e(t)});class Ea extends We{_parse(t){return this._getType(t)===pe.null?er(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ea.create=(e,t)=>new Ea({innerType:e,typeName:Re.ZodNullable,...$e(t)});class ch extends We{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===pe.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}ch.create=(e,t)=>new ch({innerType:e,typeName:Re.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...$e(t)});class uh extends We{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Qf(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Br(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Br(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}uh.create=(e,t)=>new uh({innerType:e,typeName:Re.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...$e(t)});class Cg extends We{_parse(t){if(this._getType(t)!==pe.nan){const r=this._getOrReturnCtx(t);return de(r,{code:Q.invalid_type,expected:pe.nan,received:r.parsedType}),Ie}return{status:"valid",value:t.data}}}Cg.create=e=>new Cg({typeName:Re.ZodNaN,...$e(e)});const q6=Symbol("zod_brand");class tS extends We{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Jh extends We{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ie:i.status==="dirty"?(n.dirty(),$c(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Ie:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new Jh({in:t,out:n,typeName:Re.ZodPipeline})}}class dh extends We{_parse(t){const n=this._def.innerType._parse(t),r=o=>(Zf(o)&&(o.value=Object.freeze(o.value)),o);return Qf(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}dh.create=(e,t)=>new dh({innerType:e,typeName:Re.ZodReadonly,...$e(t)});function eM(e,t={},n){return e?pu.create().superRefine((r,o)=>{var i,s;if(!e(r)){const a=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,l=(s=(i=a.fatal)!==null&&i!==void 0?i:n)!==null&&s!==void 0?s:!0,c=typeof a=="string"?{message:a}:a;o.addIssue({code:"custom",...c,fatal:l})}}):pu.create()}const Y6={object:Rt.lazycreate};var Re;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Re||(Re={}));const J6=(e,t={message:`Input not instance of ${e.name}`})=>eM(n=>n instanceof e,t),tM=Uo.create,nM=wa.create,X6=Cg.create,Z6=Sa.create,rM=eh.create,Q6=jl.create,eB=Sg.create,tB=th.create,nB=nh.create,rB=pu.create,oB=gl.create,iB=as.create,sB=kg.create,aB=Go.create,lB=Rt.create,cB=Rt.strictCreate,uB=rh.create,dB=Yv.create,fB=oh.create,hB=bi.create,pB=ih.create,mB=Eg.create,gB=Tl.create,vB=Gc.create,yB=sh.create,xB=ah.create,bB=ka.create,wB=lh.create,SB=mu.create,KC=Jo.create,kB=vi.create,EB=Ea.create,CB=Jo.createWithPreprocess,NB=Jh.create,PB=()=>tM().optional(),_B=()=>nM().optional(),jB=()=>rM().optional(),TB={string:e=>Uo.create({...e,coerce:!0}),number:e=>wa.create({...e,coerce:!0}),boolean:e=>eh.create({...e,coerce:!0}),bigint:e=>Sa.create({...e,coerce:!0}),date:e=>jl.create({...e,coerce:!0})},OB=Ie;var y=Object.freeze({__proto__:null,defaultErrorMap:hu,setErrorMap:O6,getErrorMap:xg,makeIssue:bg,EMPTY_PATH:M6,addIssueToContext:de,ParseStatus:Kn,INVALID:Ie,DIRTY:$c,OK:er,isAborted:_b,isDirty:jb,isValid:Zf,isAsync:Qf,get util(){return nt},get objectUtil(){return Pb},ZodParsedType:pe,getParsedType:Hs,ZodType:We,datetimeRegex:ZO,ZodString:Uo,ZodNumber:wa,ZodBigInt:Sa,ZodBoolean:eh,ZodDate:jl,ZodSymbol:Sg,ZodUndefined:th,ZodNull:nh,ZodAny:pu,ZodUnknown:gl,ZodNever:as,ZodVoid:kg,ZodArray:Go,ZodObject:Rt,ZodUnion:rh,ZodDiscriminatedUnion:Yv,ZodIntersection:oh,ZodTuple:bi,ZodRecord:ih,ZodMap:Eg,ZodSet:Tl,ZodFunction:Gc,ZodLazy:sh,ZodLiteral:ah,ZodEnum:ka,ZodNativeEnum:lh,ZodPromise:mu,ZodEffects:Jo,ZodTransformer:Jo,ZodOptional:vi,ZodNullable:Ea,ZodDefault:ch,ZodCatch:uh,ZodNaN:Cg,BRAND:q6,ZodBranded:tS,ZodPipeline:Jh,ZodReadonly:dh,custom:eM,Schema:We,ZodSchema:We,late:Y6,get ZodFirstPartyTypeKind(){return Re},coerce:TB,any:rB,array:aB,bigint:Z6,boolean:rM,date:Q6,discriminatedUnion:dB,effect:KC,enum:bB,function:vB,instanceof:J6,intersection:fB,lazy:yB,literal:xB,map:mB,nan:X6,nativeEnum:wB,never:iB,null:nB,nullable:EB,number:nM,object:lB,oboolean:jB,onumber:_B,optional:kB,ostring:PB,pipeline:NB,preprocess:CB,promise:SB,record:pB,set:gB,strictObject:cB,string:tM,symbol:eB,transformer:KC,tuple:hB,undefined:tB,union:uB,unknown:oB,void:sB,NEVER:OB,ZodIssueCode:Q,quotelessJson:T6,ZodError:Br});function nS(e){return e instanceof Error&&e.name==="ZodError"&&"issues"in e&&Array.isArray(e.issues)}var Ob=class extends Error{constructor(n,r){super(n,r);Vt(this,"name");Vt(this,"details");this.name="ZodValidationError",this.details=MB(r)}toString(){return this.message}};function MB(e){if(e){const t=e.cause;if(nS(t))return t.issues}return[]}function oM(e){return e.length!==0}var RB=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function AB(e){return e.length===1?e[0].toString():e.reduce((t,n)=>{if(typeof n=="number")return t+"["+n.toString()+"]";if(n.includes('"'))return t+'["'+IB(n)+'"]';if(!RB.test(n))return t+'["'+n+'"]';const r=t.length===0?"":".";return t+r+n},"")}function IB(e){return e.replace(/"/g,'\\"')}var DB="; ",LB=99,iM="Validation error",FB=": ",zB=", or ";function $B(e={}){const{issueSeparator:t=DB,unionSeparator:n=zB,prefixSeparator:r=FB,prefix:o=iM,includePath:i=!0,maxIssuesInMessage:s=LB}=e;return a=>{const l=a.slice(0,s).map(c=>Em({issue:c,issueSeparator:t,unionSeparator:n,includePath:i})).join(t);return BB(l,o,r)}}function Em(e){const{issue:t,issueSeparator:n,unionSeparator:r,includePath:o}=e;if(t.code===Q.invalid_union)return t.unionErrors.reduce((i,s)=>{const a=s.issues.map(l=>Em({issue:l,issueSeparator:n,unionSeparator:r,includePath:o})).join(n);return i.includes(a)||i.push(a),i},[]).join(r);if(t.code===Q.invalid_arguments)return[t.message,...t.argumentsError.issues.map(i=>Em({issue:i,issueSeparator:n,unionSeparator:r,includePath:o}))].join(n);if(t.code===Q.invalid_return_type)return[t.message,...t.returnTypeError.issues.map(i=>Em({issue:i,issueSeparator:n,unionSeparator:r,includePath:o}))].join(n);if(o&&oM(t.path)){if(t.path.length===1){const i=t.path[0];if(typeof i=="number")return`${t.message} at index ${i}`}return`${t.message} at "${AB(t.path)}"`}return t.message}function BB(e,t,n){return t!==null?e.length>0?[t,e].join(n):t:e.length>0?e:iM}function GC(e,t={}){if(!nS(e))throw new TypeError(`Invalid zodError param; expected instance of ZodError. Did you mean to use the "${WB.name}" method instead?`);return sM(e,t)}function sM(e,t={}){const n=e.errors;let r;return oM(n)?r=VB(t)(n):r=e.message,new Ob(r,{cause:e})}function VB(e){return"messageBuilder"in e?e.messageBuilder:$B(e)}var UB=(e={})=>t=>nS(t)?sM(t,e):t instanceof Error?new Ob(t.message,{cause:t}):new Ob("Unknown error");function WB(e,t={}){return UB(t)(e)}function HB(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function KB(e){var t=HB(e,"string");return typeof t=="symbol"?t:t+""}function ft(e,t,n){return(t=KB(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Fo(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qC(Object(n),!0).forEach(function(r){ft(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Mb(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function rS(e,t){if(e){if(typeof e=="string")return Mb(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Mb(e,t):void 0}}function Jv(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=rS(e))||t){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(l){throw l},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
49
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return s=l.done,l},e:function(l){a=!0,i=l},f:function(){try{s||n.return==null||n.return()}finally{if(a)throw i}}}}function GB(e,t,n){var r={},o=[],i=0,s=Jv((e==null?void 0:e.content)||[]),a;try{for(s.s();!(a=s.n()).done;){var l=a.value,c=qB([(i++).toString()],l,r,t,n);o.push(c)}}catch(u){s.e(u)}finally{s.f()}return{blocks:o,files:r}}function qB(e,t,n,r,o){if(t.type==="heading"){var i,s,a=((i=t.attrs)===null||i===void 0?void 0:i.level)||1;if(Number.isNaN(a))throw new Error("Invalid header depth");return{tag:"h".concat(a),children:((s=t.content)===null||s===void 0?void 0:s.map(function(c,u){return YB(e.concat("children",u.toString()),c,n,r,o)}))||[]}}else{if(t.type==="paragraph")return aM(e,t,n,r,o);if(t.type==="bulletList")return uM(e,t,n,r,o);if(t.type==="orderedList")return dM(e,t,n,r,o);var l=t;throw new Error("Unhandled node type: ".concat("type"in l?"exhaustiveCheck.type":"unknown"))}}function YB(e,t,n,r,o){if(t.type==="text")return lM(t);if(t.type==="hardBreak")return{tag:"br"};if(t.type==="image")return fM(e,t,n,r,o);var i=t;throw new Error("Unexpected heading child type: ".concat(JSON.stringify(i,null,2)))}function aM(e,t,n,r,o){var i;return{tag:"p",children:((i=t.content)===null||i===void 0?void 0:i.map(function(s,a){if(s.type==="text")return lM(s);if(s.type==="hardBreak")return{tag:"br"};if(s.type==="image")return fM(e.concat("children",a.toString()),s,n,r,o);var l=s;throw new Error("Unexpected paragraph child type: ".concat(JSON.stringify(l,null,2)))}))||[]}}function lM(e){if(e.type==="text"){var t,n,r=((t=e.marks)===null||t===void 0?void 0:t.flatMap(function(a){return a.type!=="link"?a.type==="strike"?["line-through"]:[a.type]:[]}))||[];if((n=e.marks)!==null&&n!==void 0&&n.some(function(a){return a.type==="link"})){var o;if(r.length>0){var i;return{tag:"a",href:((i=e.marks.find(function(a){return a.type==="link"}))===null||i===void 0?void 0:i.attrs.href)||"",children:[{tag:"span",styles:r,children:[e.text]}]}}return{tag:"a",href:((o=e.marks.find(function(a){return a.type==="link"}))===null||o===void 0?void 0:o.attrs.href)||"",children:[e.text]}}return r.length>0?{tag:"span",styles:r,children:[e.text]}:e.text}else{var s=e.type;throw new Error("Unexpected node type: ".concat(s))}}function cM(e,t,n,r,o){var i;return{tag:"li",children:((i=t.content)===null||i===void 0?void 0:i.map(function(s,a){if(s.type==="paragraph")return aM(e.concat("children",a.toString()),s,n,r,o);if(s.type==="bulletList")return uM(e.concat("children",a.toString()),s,n,r,o);if(s.type==="orderedList")return dM(e.concat("children",a.toString()),s,n,r,o);var l=s;throw new Error("Unexpected list child type: ".concat(l))}))||[]}}function uM(e,t,n,r,o){var i;return{tag:"ul",children:((i=t.content)===null||i===void 0?void 0:i.map(function(s,a){if(s.type==="listItem")return cM(e.concat("children",a.toString()),s,n,r,o);var l=s.type;throw new Error("Unexpected bullet list child type: ".concat(l))}))||[]}}function dM(e,t,n,r,o){var i;return{tag:"ol",children:((i=t.content)===null||i===void 0?void 0:i.map(function(s,a){if(s.type==="listItem")return cM(e.concat("children",a.toString()),s,n,r,o);var l=s.type;throw new Error("Unexpected ordered list child type: ".concat(l))}))||[]}}var YC=function(t){if(t==null)return 0;if(typeof t=="number")return t;var n=parseInt(t,10);return isNaN(n)?0:n},JB=new TextEncoder;function fM(e,t,n,r,o){if(t.attrs&&t.attrs.src.startsWith("data:")){var i=Gv.Buffer.from(t.attrs.src.split(",")[1],"base64"),s=Y.getSHA256Hash(new Uint8Array(i)),a=Y.getMimeType(t.attrs.src);if(a===void 0)throw new Error("Could not detect Mime Type for image: ".concat(t.attrs.src));var l=Y.createFilename(t.attrs.src,t.attrs.fileName||"",{width:typeof t.attrs.width=="number"?t.attrs.width:0,height:typeof t.attrs.height=="number"?t.attrs.height:0,mimeType:a},s),c=r!=null&&r.endsWith("/")?r:"".concat(r,"/"),u="".concat(c).concat(l),f=n[u],h=e.concat("src"),p=Y.remote.hashToRemoteFileHash(s),m=o?Y.remote.createRemoteRef(o.remoteHost,Fo(Fo({},o),{},{fileHash:p,validationHash:Y.remote.getValidationHash(o.coreVersion,o.schema,a,{width:typeof t.attrs.width=="number"?t.attrs.width:0,height:typeof t.attrs.height=="number"?t.attrs.height:0},p,JB),filePath:u.slice(1)})):u;return f?f.patchPaths.push(h):n[u]={value:t.attrs.src,filePathOrRef:m,metadata:{height:YC(t.attrs.height),width:YC(t.attrs.width),mimeType:a},patchPaths:[h]},{tag:"img",src:Fo(Fo(ft({},bt,m),o?ft({},De,"remote"):ft(ft({},De,"file"),Cb,"image")),{},{metadata:{width:typeof t.attrs.width=="number"?t.attrs.width:0,height:typeof t.attrs.height=="number"?t.attrs.height:0,mimeType:a}})}}else if(t.attrs){var v=t.attrs.src,x=_x("patch_id",v),b=v.split("?")[0],w=!1;if(x)if(w=_x("remote",v)==="true",w){var S=_x("ref",v);S?b=decodeURIComponent(S):console.error("Remote image URL does not contain ref: "+v)}else b.startsWith("/api/val/files/public")?b=b.slice(14):console.error("Patched image URL does not start with /api/val/files: "+v);else o&&b.startsWith(o.remoteHost)?w=!0:b.startsWith("/public")?console.error("Unpatched image URL starts with /public: "+v):b="/public".concat(b);var C={tag:"img",src:Fo(Fo({},ft(w?ft({},De,"remote"):ft(ft({},De,"file"),Cb,"image"),bt,b)),{},{metadata:{width:typeof t.attrs.width=="number"?t.attrs.width:0,height:typeof t.attrs.height=="number"?t.attrs.height:0,mimeType:b&&Y.filenameToMimeType(b)||""}},x?{patch_id:x}:{})};return C}else throw new Error("Invalid image node (no attrs): "+JSON.stringify(t))}function _x(e,t){var n=t.split("?");if(!(n.length<2)){var r=n[1],o=new URLSearchParams(r);if(o.has(e))return o.get(e)}}var hM=y.object({type:y.union([y.literal("bold"),y.literal("strike"),y.literal("italic")])}),XB=y.object({type:y.literal("link"),attrs:y.object({href:y.string(),target:y.union([y.literal("_blank"),y.null()]),auto:y.boolean()})}),pM=y.intersection(y.object({type:y.literal("text"),text:y.string()}),y.object({marks:y.array(y.union([hM,XB]))}).partial()),mM=y.intersection(y.object({type:y.literal("hardBreak")}),y.object({marks:y.array(hM)}).partial()),gM=y.intersection(y.object({type:y.literal("image")}),y.object({attrs:y.intersection(y.object({src:y.string()}),y.object({align:y.union([y.literal("center"),y.literal("end"),y.literal("justify"),y.literal("left"),y.literal("match-parent"),y.literal("right"),y.literal("start"),y.null()]),alt:y.union([y.string(),y.null()]),height:y.union([y.string(),y.number(),y.null()]),width:y.union([y.string(),y.number(),y.null()]),rotate:y.union([y.string(),y.null()]),title:y.union([y.string(),y.null()]),fileName:y.union([y.string(),y.null()])}).partial())}).partial()),ZB=y.intersection(y.object({type:y.literal("heading")}),y.object({attrs:y.object({level:y.number()}),content:y.array(y.union([pM,gM,mM]))}).partial()),vM=y.lazy(function(){return y.intersection(y.object({type:y.literal("bulletList")}),y.object({content:y.array(xM)}).partial())}),yM=y.lazy(function(){return y.intersection(y.object({type:y.literal("orderedList")}),y.object({content:y.array(xM)}).partial())}),xM=y.lazy(function(){return y.intersection(y.object({type:y.literal("listItem")}),y.object({attrs:y.object({closed:y.boolean(),nested:y.boolean()}).partial().optional(),content:y.array(y.union([bM,vM,yM]))}).partial())}),bM=y.lazy(function(){return y.intersection(y.object({type:y.literal("paragraph")}),y.object({content:y.array(y.union([pM,gM,mM]))}).partial())});y.object({type:y.literal("doc"),content:y.array(y.union([bM,ZB,vM,yM]))});function QB(e){if(Array.isArray(e))return Mb(e)}function e8(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function t8(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
50
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function n8(e){return QB(e)||e8(e)||rS(e)||t8()}function Yp(e){return{type:"doc",content:e.map(function(t){return r8(t)})}}function r8(e){switch(e.tag){case"h1":return lc(1,e.children);case"h2":return lc(2,e.children);case"h3":return lc(3,e.children);case"h4":return lc(4,e.children);case"h5":return lc(5,e.children);case"h6":return lc(6,e.children);case"p":return kM(e.children);case"ul":return PM(e);case"ol":return _M(e);default:{var t=e;throw Error("Unexpected child node: "+JSON.stringify(t))}}}function lc(e,t){return{type:"heading",attrs:{level:e},content:t.flatMap(wM)}}function Xv(e){return{type:"text",text:e}}function wM(e){return typeof e=="string"?[Xv(e)]:e.tag==="img"?[NM(e)]:e.tag==="br"?[EM()]:e.tag==="a"?CM(e):SM(e)}function SM(e){if(e.styles.length===0&&e.children.length===1){if(typeof e.children[0]=="string")return[Xv(e.children[0])];throw Error("Unexpected amount of children in span node: "+JSON.stringify(e,null,2))}var t=Array.from(new Set(e.styles));return e.children.map(function(n){return{type:"text",text:n,marks:t.map(function(r){switch(r){case"bold":return{type:"bold"};case"italic":return{type:"italic"};case"line-through":return{type:"strike"};default:{var o=r;throw Error("Unexpected span class: "+o)}}})}})}function kM(e){return{type:"paragraph",content:e.flatMap(function(t){if(typeof t=="string")return[Xv(t)];switch(t.tag){case"span":return SM(t);case"a":return CM(t);case"img":return[NM(t)];case"br":return[EM()];default:{var n=t;throw Error("Unexpected paragraph child: "+JSON.stringify(n))}}})}}function EM(){return{type:"hardBreak",marks:[]}}function CM(e){return e.children.flatMap(wM).map(function(t){return t.type!=="text"?t:Fo(Fo({},t),{},{marks:(t.marks||[]).concat({type:"link",attrs:{href:e.href,auto:!1,target:null}})})})}function NM(e){var t,n,r,o=e.src;if(!(De in o)||o[De]!=="file"&&o[De]!=="remote")throw Error("Expected file source in image node");var i;return o[De]==="remote"?i=Y.convertRemoteSource(o):i=Y.convertFileSource(o),{type:"image",attrs:{height:(t=o.metadata)===null||t===void 0?void 0:t.height,width:(n=o.metadata)===null||n===void 0?void 0:n.width,alt:(r=o.metadata)===null||r===void 0?void 0:r.alt,src:i.url}}}function PM(e){return{type:"bulletList",content:e.children.map(jM)}}function _M(e){return{type:"orderedList",content:e.children.map(jM)}}function jM(e){return{type:"listItem",content:o8(e.children)}}function o8(e){var t=[],n=Jv(e),r;try{for(n.s();!(r=n.n()).done;){var o=r.value,i=t[t.length-1];i||(i={type:"paragraph",content:[]},t.push(i));var s=i.content;if(typeof o=="string")s.push(Xv(o));else switch(o.tag){case"ol":{t.push(_M(o));break}case"ul":{t.push(PM(o));break}case"p":{var a=kM(o.children);i.type==="paragraph"&&a.type==="paragraph"?a.content&&s.push.apply(s,n8(a.content)):t.push(a);break}default:{var l=o;throw Error("Unexpected list item child: "+JSON.stringify(l))}}}}catch(c){n.e(c)}finally{n.f()}return t}var Cs=Y.VAL_SESSION_COOKIE,cc=Y.VAL_STATE_COOKIE,Sd=Y.VAL_ENABLE_COOKIE_NAME;function Fd(){Fd=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(I,A,j){I[A]=j.value},i=typeof Symbol=="function"?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(I,A,j){return Object.defineProperty(I,A,{value:j,enumerable:!0,configurable:!0,writable:!0}),I[A]}try{c({},"")}catch{c=function(A,j,L){return A[j]=L}}function u(I,A,j,L){var $=A&&A.prototype instanceof b?A:b,W=Object.create($.prototype),G=new K(L||[]);return o(W,"_invoke",{value:D(I,j,G)}),W}function f(I,A,j){try{return{type:"normal",arg:I.call(A,j)}}catch(L){return{type:"throw",arg:L}}}t.wrap=u;var h="suspendedStart",p="suspendedYield",m="executing",v="completed",x={};function b(){}function w(){}function S(){}var C={};c(C,s,function(){return this});var N=Object.getPrototypeOf,P=N&&N(N(V([])));P&&P!==n&&r.call(P,s)&&(C=P);var _=S.prototype=b.prototype=Object.create(C);function O(I){["next","throw","return"].forEach(function(A){c(I,A,function(j){return this._invoke(A,j)})})}function M(I,A){function j($,W,G,_e){var ke=f(I[$],I,W);if(ke.type!=="throw"){var Ve=ke.arg,Z=Ve.value;return Z&&typeof Z=="object"&&r.call(Z,"__await")?A.resolve(Z.__await).then(function(J){j("next",J,G,_e)},function(J){j("throw",J,G,_e)}):A.resolve(Z).then(function(J){Ve.value=J,G(Ve)},function(J){return j("throw",J,G,_e)})}_e(ke.arg)}var L;o(this,"_invoke",{value:function($,W){function G(){return new A(function(_e,ke){j($,W,_e,ke)})}return L=L?L.then(G,G):G()}})}function D(I,A,j){var L=h;return function($,W){if(L===m)throw Error("Generator is already running");if(L===v){if($==="throw")throw W;return{value:e,done:!0}}for(j.method=$,j.arg=W;;){var G=j.delegate;if(G){var _e=U(G,j);if(_e){if(_e===x)continue;return _e}}if(j.method==="next")j.sent=j._sent=j.arg;else if(j.method==="throw"){if(L===h)throw L=v,j.arg;j.dispatchException(j.arg)}else j.method==="return"&&j.abrupt("return",j.arg);L=m;var ke=f(I,A,j);if(ke.type==="normal"){if(L=j.done?v:p,ke.arg===x)continue;return{value:ke.arg,done:j.done}}ke.type==="throw"&&(L=v,j.method="throw",j.arg=ke.arg)}}}function U(I,A){var j=A.method,L=I.iterator[j];if(L===e)return A.delegate=null,j==="throw"&&I.iterator.return&&(A.method="return",A.arg=e,U(I,A),A.method==="throw")||j!=="return"&&(A.method="throw",A.arg=new TypeError("The iterator does not provide a '"+j+"' method")),x;var $=f(L,I.iterator,A.arg);if($.type==="throw")return A.method="throw",A.arg=$.arg,A.delegate=null,x;var W=$.arg;return W?W.done?(A[I.resultName]=W.value,A.next=I.nextLoc,A.method!=="return"&&(A.method="next",A.arg=e),A.delegate=null,x):W:(A.method="throw",A.arg=new TypeError("iterator result is not an object"),A.delegate=null,x)}function z(I){var A={tryLoc:I[0]};1 in I&&(A.catchLoc=I[1]),2 in I&&(A.finallyLoc=I[2],A.afterLoc=I[3]),this.tryEntries.push(A)}function H(I){var A=I.completion||{};A.type="normal",delete A.arg,I.completion=A}function K(I){this.tryEntries=[{tryLoc:"root"}],I.forEach(z,this),this.reset(!0)}function V(I){if(I||I===""){var A=I[s];if(A)return A.call(I);if(typeof I.next=="function")return I;if(!isNaN(I.length)){var j=-1,L=function $(){for(;++j<I.length;)if(r.call(I,j))return $.value=I[j],$.done=!1,$;return $.value=e,$.done=!0,$};return L.next=L}}throw new TypeError(typeof I+" is not iterable")}return w.prototype=S,o(_,"constructor",{value:S,configurable:!0}),o(S,"constructor",{value:w,configurable:!0}),w.displayName=c(S,l,"GeneratorFunction"),t.isGeneratorFunction=function(I){var A=typeof I=="function"&&I.constructor;return!!A&&(A===w||(A.displayName||A.name)==="GeneratorFunction")},t.mark=function(I){return Object.setPrototypeOf?Object.setPrototypeOf(I,S):(I.__proto__=S,c(I,l,"GeneratorFunction")),I.prototype=Object.create(_),I},t.awrap=function(I){return{__await:I}},O(M.prototype),c(M.prototype,a,function(){return this}),t.AsyncIterator=M,t.async=function(I,A,j,L,$){$===void 0&&($=Promise);var W=new M(u(I,A,j,L),$);return t.isGeneratorFunction(A)?W:W.next().then(function(G){return G.done?G.value:W.next()})},O(_),c(_,l,"Generator"),c(_,s,function(){return this}),c(_,"toString",function(){return"[object Generator]"}),t.keys=function(I){var A=Object(I),j=[];for(var L in A)j.push(L);return j.reverse(),function $(){for(;j.length;){var W=j.pop();if(W in A)return $.value=W,$.done=!1,$}return $.done=!0,$}},t.values=V,K.prototype={constructor:K,reset:function(I){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(H),!I)for(var A in this)A.charAt(0)==="t"&&r.call(this,A)&&!isNaN(+A.slice(1))&&(this[A]=e)},stop:function(){this.done=!0;var I=this.tryEntries[0].completion;if(I.type==="throw")throw I.arg;return this.rval},dispatchException:function(I){if(this.done)throw I;var A=this;function j(ke,Ve){return W.type="throw",W.arg=I,A.next=ke,Ve&&(A.method="next",A.arg=e),!!Ve}for(var L=this.tryEntries.length-1;L>=0;--L){var $=this.tryEntries[L],W=$.completion;if($.tryLoc==="root")return j("end");if($.tryLoc<=this.prev){var G=r.call($,"catchLoc"),_e=r.call($,"finallyLoc");if(G&&_e){if(this.prev<$.catchLoc)return j($.catchLoc,!0);if(this.prev<$.finallyLoc)return j($.finallyLoc)}else if(G){if(this.prev<$.catchLoc)return j($.catchLoc,!0)}else{if(!_e)throw Error("try statement without catch or finally");if(this.prev<$.finallyLoc)return j($.finallyLoc)}}}},abrupt:function(I,A){for(var j=this.tryEntries.length-1;j>=0;--j){var L=this.tryEntries[j];if(L.tryLoc<=this.prev&&r.call(L,"finallyLoc")&&this.prev<L.finallyLoc){var $=L;break}}$&&(I==="break"||I==="continue")&&$.tryLoc<=A&&A<=$.finallyLoc&&($=null);var W=$?$.completion:{};return W.type=I,W.arg=A,$?(this.method="next",this.next=$.finallyLoc,x):this.complete(W)},complete:function(I,A){if(I.type==="throw")throw I.arg;return I.type==="break"||I.type==="continue"?this.next=I.arg:I.type==="return"?(this.rval=this.arg=I.arg,this.method="return",this.next="end"):I.type==="normal"&&A&&(this.next=A),x},finish:function(I){for(var A=this.tryEntries.length-1;A>=0;--A){var j=this.tryEntries[A];if(j.finallyLoc===I)return this.complete(j.completion,j.afterLoc),H(j),x}},catch:function(I){for(var A=this.tryEntries.length-1;A>=0;--A){var j=this.tryEntries[A];if(j.tryLoc===I){var L=j.completion;if(L.type==="throw"){var $=L.arg;H(j)}return $}}throw Error("illegal catch attempt")},delegateYield:function(I,A,j){return this.delegate={iterator:V(I),resultName:A,nextLoc:j},this.method==="next"&&(this.arg=e),x}},t}function JC(e,t,n,r,o,i,s){try{var a=e[i](s),l=a.value}catch(c){return void n(c)}a.done?t(l):Promise.resolve(l).then(r,o)}function XC(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(l){JC(i,r,o,s,a,"next",l)}function a(l){JC(i,r,o,s,a,"throw",l)}s(void 0)})}}var Qi=y.lazy(function(){return y.union([y.string(),y.number(),y.boolean(),y.null(),y.array(Qi),y.record(Qi)])}),TM=function(t){return y.object({op:y.literal("file"),path:t,filePath:y.string(),value:y.string(),remote:y.boolean(),nestedFilePath:y.array(y.string()).optional(),metadata:Qi.optional()})},i8=y.discriminatedUnion("op",[y.object({op:y.literal("add"),path:y.string(),value:Qi}).strict(),y.object({op:y.literal("remove"),path:y.string()}).strict(),y.object({op:y.literal("replace"),path:y.string(),value:Qi}).strict(),y.object({op:y.literal("move"),from:y.string(),path:y.string()}).strict(),y.object({op:y.literal("copy"),from:y.string(),path:y.string()}).strict(),y.object({op:y.literal("test"),path:y.string(),value:Qi}).strict(),TM(y.string()).strict()]);y.array(i8);var s8=y.discriminatedUnion("op",[y.object({op:y.literal("add"),path:y.array(y.string()),value:Qi}).strict(),y.object({op:y.literal("remove"),path:y.array(y.string()).nonempty()}).strict(),y.object({op:y.literal("replace"),path:y.array(y.string()),value:Qi}).strict(),y.object({op:y.literal("move"),from:y.array(y.string()).nonempty(),path:y.array(y.string())}).strict(),y.object({op:y.literal("copy"),from:y.array(y.string()),path:y.array(y.string())}).strict(),y.object({op:y.literal("test"),path:y.array(y.string()),value:Qi}).strict(),TM(y.array(y.string())).strict()]),OM=y.array(s8),Gt=y.string().refine(function(e){return!0}),a8=y.union([y.object({type:y.literal("head"),headBaseSha:y.string()}),y.object({type:y.literal("patch"),patchId:Gt})]);y.object({patch:OM,parentRef:a8});var l8=y.string().transform(function(e){return e}),c8=y.object({type:y.literal("string"),options:y.object({maxLength:y.number().optional(),minLength:y.number().optional(),regexp:y.object({source:y.string(),flags:y.string()}).optional()}).optional(),opt:y.boolean(),raw:y.boolean()}),Rb=y.object({type:y.literal("literal"),value:y.string(),opt:y.boolean()}),u8=y.object({type:y.literal("boolean"),opt:y.boolean()}),d8=y.object({type:y.literal("number"),options:y.object({max:y.number().optional(),min:y.number().optional()}).optional(),opt:y.boolean()}),MM=y.lazy(function(){return y.object({type:y.literal("object"),items:y.record(Zv),opt:y.boolean()})}),f8=y.lazy(function(){return y.object({type:y.literal("array"),item:Zv,opt:y.boolean()})}),h8=y.lazy(function(){return y.union([y.object({type:y.literal("union"),key:Rb,items:y.array(Rb),opt:y.boolean()}),y.object({type:y.literal("union"),key:y.string(),items:y.array(MM),opt:y.boolean()})])}),p8=y.object({ext:y.union([y.tuple([y.literal("jpg")]),y.tuple([y.literal("webp")])]).optional(),directory:y.string().optional(),prefix:y.string().optional(),accept:y.string().optional()}),RM=y.object({type:y.literal("image"),options:p8.optional(),opt:y.boolean()}),m8=y.object({style:y.object({bold:y.boolean().optional(),italic:y.boolean().optional(),lineThrough:y.boolean().optional()}).optional(),block:y.object({h1:y.boolean().optional(),h2:y.boolean().optional(),h3:y.boolean().optional(),h4:y.boolean().optional(),h5:y.boolean().optional(),h6:y.boolean().optional(),ul:y.boolean().optional(),ol:y.boolean().optional()}).optional(),inline:y.object({a:y.boolean().optional(),img:y.union([y.boolean(),RM]).optional()}).optional()}),g8=y.object({type:y.literal("richtext"),options:m8.optional(),opt:y.boolean()}),v8=y.lazy(function(){return y.object({type:y.literal("record"),item:Zv,opt:y.boolean()})}),y8=y.lazy(function(){return y.object({type:y.literal("keyOf"),path:l8,schema:y.union([y.object({type:y.literal("object"),keys:y.array(y.string()),opt:y.boolean().optional()}),y.object({type:y.literal("record"),opt:y.boolean().optional()})]).optional(),values:y.union([y.literal("string"),y.array(y.string())]),opt:y.boolean()})}),x8=y.object({accept:y.string().optional()}),b8=y.object({type:y.literal("file"),options:x8.optional(),opt:y.boolean()}),w8=y.object({type:y.literal("date"),opt:y.boolean()}),Zv=y.union([c8,Rb,u8,d8,MM,f8,h8,g8,v8,y8,b8,w8,RM]),oS=y.object({commitSha:y.string(),clientCommitSha:y.string(),parentCommitSha:y.string(),branch:y.string(),creator:y.string(),createdAt:y.string(),commitMessage:y.string().nullable()}),Za=y.string().refine(function(e){return!0}),jx=y.union([y.object({type:y.literal("head"),headBaseSha:y.string()}),y.object({type:y.literal("patch"),patchId:Gt})]),ZC=y.object({project:y.string().optional(),root:y.string().optional(),files:y.object({directory:y.string()}).optional(),gitCommit:y.string().optional(),gitBranch:y.string().optional()}),S8=y.union([y.literal("image:change-extension"),y.literal("image:add-metadata"),y.literal("image:check-metadata"),y.literal("image:check-remote"),y.literal("image:upload-remote"),y.literal("image:download-remote"),y.literal("file:change-extension"),y.literal("file:add-metadata"),y.literal("file:check-metadata"),y.literal("file:check-remote"),y.literal("file:upload-remote"),y.literal("file:download-remote"),y.literal("keyof:check-keys")]),k8=y.object({message:y.string(),value:y.unknown().optional(),fatal:y.boolean().optional(),fixes:y.array(S8).optional()}),Mi=y.object({status:y.literal(401),json:y.object({message:y.string()})}),E8=y.object({status:y.literal(404),json:y.object({message:y.string()})}),Ot=y.object({message:y.string()}),QC=y.union([y.object({patchId:Gt,message:y.string()}),y.object({parentPatchId:y.string(),message:y.string()})]),Tx=y.object({message:y.string(),path:Za.optional()});y.union([y.literal("val_session"),y.literal("val_enable"),y.literal("val_state")]);var Jp=y.object({value:y.literal("true"),options:y.object({httpOnly:y.literal(!1),sameSite:y.literal("lax")})}),C8={"/draft/enable":{GET:{req:{query:{redirect_to:y.string().optional()},cookies:ft({},Cs,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Ot}),y.object({status:y.literal(302),redirectTo:y.string()}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/draft/disable":{GET:{req:{query:{redirect_to:y.string().optional()},cookies:ft({},Cs,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Ot}),y.object({status:y.literal(302),redirectTo:y.string()}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/draft/stat":{GET:{req:{cookies:ft({},Cs,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Ot}),y.object({status:y.literal(200),json:y.object({draftMode:y.boolean()})})])}},"/enable":{GET:{req:{query:{redirect_to:y.string().optional()},cookies:ft({},Cs,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Ot}),y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ft(ft({},Sd,Jp),cc,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("lax"),expires:y.instanceof(Date)})})))}),y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ft({},Sd,Jp))}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/disable":{GET:{req:{query:{redirect_to:y.string().optional()},cookies:ft({},Cs,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Ot}),y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ft({},Sd,y.object({value:y.literal("false")})))}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/authorize":{GET:{req:{query:{redirect_to:y.string().optional()}},res:y.union([y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ft(ft({},Sd,Jp),cc,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("lax"),expires:y.instanceof(Date)})})))}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/callback":{GET:{req:{query:{code:y.string().optional(),state:y.string().optional()},cookies:ft({},cc,y.string())},res:y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ft(ft(ft({},cc,y.object({value:y.literal(null)})),Sd,Jp.optional()),Cs,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("strict"),path:y.string(),secure:y.literal(!0),expires:y.instanceof(Date)}).optional()}).optional()))})}},"/session":{GET:{req:{cookies:{val_session:y.string().optional()}},res:y.union([y.object({status:y.literal(200),json:y.object({mode:y.union([y.literal("local"),y.literal("proxy")]),enabled:y.boolean()})}),y.object({status:y.union([y.literal(400),y.literal(401),y.literal(403),y.literal(404),y.literal(500),y.literal(501)]),json:y.object({message:y.string()})}),y.object({status:y.literal(401),json:y.object({message:y.string(),details:y.union([y.string(),y.object({reason:y.string()}),y.object({sub:y.string(),exp:y.number(),token:y.string(),org:y.string(),project:y.string()})])})}),y.object({status:y.literal(500),json:y.object({message:y.string()})})])}},"/logout":{GET:{req:{query:{redirect_to:y.string().optional()}},res:y.union([y.object({status:y.literal(200),cookies:y.object(ft(ft({},Cs,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("strict"),path:y.string(),secure:y.literal(!0),expires:y.instanceof(Date)}).optional()}).optional()),cc,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("strict"),path:y.string(),secure:y.literal(!0),expires:y.instanceof(Date)}).optional()}).optional()))}),y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ft(ft({},Cs,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("strict"),path:y.string(),secure:y.literal(!0),expires:y.instanceof(Date)}).optional()}).optional()),cc,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("strict"),path:y.string(),secure:y.literal(!0),expires:y.instanceof(Date)}).optional()}).optional()))})])}},"/remote/settings":{GET:{req:{cookies:{val_session:y.string().optional()}},res:y.union([y.object({status:y.literal(200),json:y.object({publicProjectId:y.string(),coreVersion:y.string(),remoteFileBuckets:y.array(y.object({bucket:y.string()}))})}),y.object({status:y.literal(400),json:y.object({errorCode:y.union([y.literal("project-not-configured"),y.literal("error-could-not-get-settings"),y.literal("project-not-configured"),y.literal("pat-error"),y.literal("api-key-missing")]),message:y.string()})}),y.object({status:y.literal(401),json:y.object({errorCode:y.literal("unauthorized").optional(),message:y.string()})}),y.object({status:y.literal(500),json:y.object({message:y.string()})})])}},"/stat":{POST:{req:{body:y.object({sourcesSha:y.string(),schemaSha:y.string(),baseSha:y.string(),patches:y.array(y.string()).optional()}).nullable(),cookies:{val_session:y.string().optional()}},res:y.union([y.object({status:y.literal(401),json:Ot}),y.object({status:y.literal(500),json:Ot}),y.object({status:y.literal(503),json:Ot}),y.object({status:y.literal(200),json:y.union([y.object({type:y.union([y.literal("request-again"),y.literal("no-change"),y.literal("did-change")]),baseSha:y.string(),schemaSha:y.string(),sourcesSha:y.string(),patches:y.array(Gt),config:ZC,profileId:y.string().nullable(),mode:y.union([y.literal("http"),y.literal("fs")])}),y.object({type:y.literal("use-websocket"),url:y.string(),nonce:y.string(),baseSha:y.string(),schemaSha:y.string(),sourcesSha:y.string(),commitSha:y.string(),patches:y.array(Gt),commits:y.array(oS),config:ZC,profileId:y.string().nullable(),mode:y.union([y.literal("http"),y.literal("fs")])})])})])}},"/upload/patches":{POST:{req:{path:y.string().optional(),body:y.object({parentRef:jx,filePath:y.string(),data:y.any(),type:y.union([y.literal("file"),y.literal("image")]),metadata:y.any(),remote:y.boolean()})},res:y.union([y.object({status:y.literal(400),json:Ot}),y.object({status:y.literal(200),json:y.object({filePath:y.string(),patchId:Gt})})])}},"/direct-file-upload-settings":{POST:{req:{cookies:{val_session:y.string().optional()}},res:y.union([y.object({status:y.literal(400),json:Ot}),y.object({status:y.literal(401),json:Ot}),y.object({status:y.literal(500),json:Ot}),y.object({status:y.literal(200),json:y.object({nonce:y.string().nullable(),baseUrl:y.string()})})])}},"/patches":{DELETE:{req:{query:{id:y.array(Gt)},cookies:{val_session:y.string().optional()}},res:y.union([Mi,y.object({status:y.literal(500),json:y.object({message:y.string(),errors:y.array(QC)})}),y.object({status:y.literal(200),json:y.array(Gt)})])},PUT:{req:{body:y.object({parentRef:jx,patches:y.array(y.object({path:Za,patchId:Gt,patch:y.any()}))}),cookies:{val_session:y.string().optional()}},res:y.union([Mi,y.object({status:y.literal(409),json:y.object({type:y.literal("patch-head-conflict"),message:y.string()})}),y.object({status:y.literal(400),json:y.object({type:y.literal("patch-error"),message:y.string(),errors:y.record(Za,y.array(y.object({error:Ot})))})}),y.object({status:y.literal(200),json:y.object({newPatchIds:y.array(Gt),parentRef:jx})})])},GET:{req:{query:{patch_id:y.array(Gt).optional(),exclude_patch_ops:y.boolean().optional()},cookies:{val_session:y.string().optional()}},res:y.union([Mi,y.object({status:y.literal(500),json:y.object({message:y.string(),patchErrors:y.array(QC)})}),y.object({status:y.literal(500),json:y.object({message:y.string(),error:Ot})}),y.object({status:y.literal(200),json:y.object({patches:y.array(y.object({path:Za,patch:OM.optional(),patchId:Gt,createdAt:y.string(),authorId:y.string().nullable(),appliedAt:y.object({commitSha:y.string()}).nullable()})),baseSha:y.string(),error:Ot.optional(),errors:y.record(Gt,Ot).optional()})})])}},"/schema":{GET:{req:{cookies:{val_session:y.string().optional()}},res:y.union([Mi,y.object({status:y.literal(500),json:y.object({message:y.string(),details:y.array(Tx)})}),y.object({status:y.literal(500),json:y.object({message:y.string(),details:y.array(Ot)})}),y.object({status:y.literal(200),json:y.object({schemaSha:y.string(),schemas:y.record(Za,Zv)})})])}},"/sources/~":{PUT:{req:{path:y.string().optional(),query:{validate_sources:y.boolean().optional(),validate_binary_files:y.boolean().optional()},cookies:{val_session:y.string().optional()}},res:y.union([Mi,y.object({status:y.literal(401),json:Ot}),y.object({status:y.literal(500),json:y.object({message:y.string(),details:y.union([y.array(Tx),Ot])})}),y.object({status:y.literal(409),json:y.object({message:y.string()})}),y.object({status:y.literal(400),json:y.object({message:y.string(),details:y.array(Tx)})}),y.object({status:y.literal(200),json:y.object({schemaSha:y.string(),sourcesSha:y.string(),modules:y.record(Za,y.object({render:y.any(),source:y.any(),patches:y.object({applied:y.array(Gt),skipped:y.array(Gt).optional(),errors:y.record(Gt,Ot).optional()}).optional(),validationErrors:y.record(y.string(),y.array(k8)).optional()}))})})])}},"/profiles":{GET:{req:{cookies:{val_session:y.string().optional()}},res:y.union([Mi,y.object({status:y.literal(200),json:y.object({profiles:y.array(y.object({profileId:y.string(),fullName:y.string(),email:y.string().optional(),avatar:y.object({url:y.string()}).nullable()}))})})])}},"/commit-summary":{GET:{req:{query:{patch_id:y.array(Gt)},cookies:{val_session:y.string().optional()}},res:y.union([Mi,y.object({status:y.literal(400),json:y.object({message:y.string()})}),y.object({status:y.literal(200),json:y.object({patchIds:y.array(Gt),baseSha:y.string(),commitSummary:y.string().nullable()})})])}},"/save":{POST:{req:{body:y.object({message:y.string().optional(),patchIds:y.array(Gt)}),cookies:{val_session:y.string().optional()}},res:y.union([Mi,y.object({status:y.literal(200),json:y.object({})}),y.object({status:y.literal(409),json:y.object({message:y.string(),isNotFastForward:y.literal(!0)})}),y.object({status:y.literal(400),json:y.union([y.object({message:y.string(),details:y.union([y.object({sourceFilePatchErrors:y.record(Za,y.array(Ot)),binaryFilePatchErrors:y.record(Ot)}),y.array(Ot)]).optional()}),y.object({message:y.string(),errorCode:y.union([y.literal("project-not-configured"),y.literal("pat-error")])})])})])}},"/files":{GET:{req:{path:y.string(),query:{patch_id:Gt.optional(),remote:y.string().optional()}},res:y.union([Mi,E8,y.object({status:y.literal(200),body:y.instanceof(ReadableStream)})])}}},AM=function(t,n){var r=C8;return function(){var o=XC(Fd().mark(function i(s,a,l){var c,u,f,h,p,m,v,x,b,w,S,C,N,P,_,O,M,D;return Fd().wrap(function(z){for(;;)switch(z.prev=z.next){case 0:if(f=l,h=s,f!=null&&f.path&&f.path.length>0&&(h+=f.path),f.query){for(p=[],m=0,v=Object.keys(f.query);m<v.length;m++)if(b=v[m],Array.isArray((x=f.query)===null||x===void 0?void 0:x[b])){S=Jv(((w=f.query)===null||w===void 0?void 0:w[b])||[]);try{for(S.s();!(C=S.n()).done;)N=C.value,N!==void 0&&p.push([b,N.toString()])}catch(H){S.e(H)}finally{S.f()}}else((P=f.query)===null||P===void 0?void 0:P[b])!==void 0&&p.push([b,f==null||(_=f.query)===null||_===void 0?void 0:_[b].toString()]);f!=null&&f.query&&p.length>0&&(h+="?".concat(new URLSearchParams(p).toString()))}if(O=r==null||(c=r[s])===null||c===void 0?void 0:c[a],O){z.next=7;break}return z.abrupt("return",{status:null,json:{message:"Invalid route ".concat(s," with method ").concat(a,". This is most likely a Val bug."),type:"client_side_validation_error",details:{validationError:"Route ".concat(s," with method ").concat(a," not found."),data:{routes:Object.keys(r||{}),methods:Object.keys((r==null?void 0:r[s])||{}),route:s,method:a}}}});case 7:if(M=(u=O.req.body)===null||u===void 0?void 0:u.safeParse(f.body),!(M&&!M.success)){z.next=11;break}return console.error("Got an invalid request body while validating client-side. This is most likely a Val bug.",{path:s,method:a,body:f.body,error:M.error}),z.abrupt("return",{status:null,json:{message:"There was an issue validating your data. This is most likely a Val bug.",type:"client_side_validation_error",details:{validationError:GC(M.error).toString(),data:f.body}}});case 11:return z.prev=11,z.next=14,fetch("".concat(t).concat(h),{method:a,headers:{"Content-Type":"application/json"},body:f.body!==void 0?JSON.stringify(f.body):void 0}).then(function(){var H=XC(Fd().mark(function K(V){var I,A,j,L,$;return Fd().wrap(function(G){for(;;)switch(G.prev=G.next){case 0:if(A=V.headers.get("content-type"),V.status!==413){G.next=3;break}return G.abrupt("return",{status:413,json:{message:"Request too large.",method:a,path:s}});case 3:if(A!=null&&A.includes("application/json")){G.next=5;break}return G.abrupt("return",{status:null,json:{type:"client_side_validation_error",message:"Invalid response (expected JSON, but got something else). This could be a result of mismatched Val versions or a transient error. ".concat(V.status),details:{validationError:"Invalid content type",data:{status:V.status,contentType:A}}}});case 5:return G.next=7,V.json();case 7:if(j=G.sent,L={status:V.status,json:j},V.status!==500){G.next=12;break}return console.error("Server responded with an error",j),G.abrupt("return",{status:500,json:Fo({type:"unknown",message:j.message},j)});case 12:if($=(I=O.res)===null||I===void 0?void 0:I.safeParse(L),!($&&!$.success)){G.next=15;break}return G.abrupt("return",{status:null,json:{message:"Response could not be validated. This could also be a result of mismatched Val versions.",type:"client_side_validation_error",details:{validationError:GC($.error).toString(),data:L}}});case 15:return G.abrupt("return",{status:V.status,json:j});case 16:case"end":return G.stop()}},K)}));return function(K){return H.apply(this,arguments)}}());case 14:return D=z.sent,z.abrupt("return",D);case 18:return z.prev=18,z.t0=z.catch(11),z.abrupt("return",{status:null,json:{message:"Failed to fetch data",type:"network_error",retryable:N8(z.t0),details:z.t0 instanceof Error?z.t0.message:JSON.stringify(z.t0)}});case 21:case"end":return z.stop()}},i,null,[[11,18]])}));return function(i,s,a){return o.apply(this,arguments)}}()};function N8(e){if(e instanceof TypeError)return!0;if(e instanceof Error&&"code"in e){var t=e.code,n=["ECONNRESET","ETIMEDOUT","ENOTFOUND","EAI_AGAIN"];return n.includes(t)}return!1}function P8(e){if(Array.isArray(e))return e}function _8(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,s,a=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(u){c=!0,o=u}finally{try{if(!l&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return a}}function j8(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
51
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function T8(e,t){return P8(e)||_8(e,t)||rS(e,t)||j8()}var gu=function(){var t=arguments.length<=0?void 0:arguments[0],n=arguments.length<=1?void 0:arguments[1];if(n){var r=Object.entries(n).flatMap(function(i){var s=T8(i,2),a=s[0],l=s[1];return l?[[a,l.toString()]]:[]}),o=new URLSearchParams(r);return"".concat(t+"?"+o.toString())}return"".concat(t)},eN="val-config",O8="val-config-received",M8=y.object({contentHostUrl:y.string().optional(),appHostUrl:y.string().optional(),project:y.string().optional(),root:y.string().optional(),files:y.object({directory:y.literal("/public/val")}).optional(),gitCommit:y.string().optional(),gitBranch:y.string().optional(),defaultTheme:y.enum(["dark","light"]).optional(),ai:y.object({commitMessages:y.object({disabled:y.boolean().optional()}).optional()}).optional()}),IM=y.object({deploymentId:y.string(),deploymentState:y.string(),commitSha:y.string(),updatedAt:y.string(),createdAt:y.string()});function R8(e,t){var n={type:"node",name:"/",children:[]},r=Jv(t),o;try{var i=function(){var l=o.value,c=l.urlPath,u=l.moduleFilePath,f=u;if(!c.startsWith("/"))return console.error("urlPath must start with /: ".concat(c)),0;var h=Ab(f,e);if(c==="/"){var p="/";return n.pattern=Ab(f,e),n.page={fullPath:p},n.sourcePath=Y.joinModuleFilePathAndModulePath(f,p),n.moduleFilePath=f,0}var m=c.split("/").slice(1).filter(Boolean),v=n;m.forEach(function(x,b){var w=b<m.length-1,S=b===m.length-1,C="/"+m.slice(0,b+1).join("/"),N=Y.joinModuleFilePathAndModulePath(f,'"'.concat(C,'"')),P=w?Fo(Fo({type:"node",name:x,pattern:h,moduleFilePath:f},S?{page:{fullPath:C},sourcePath:N}:{}),{},{children:[]}):{type:"leaf",name:x,pattern:h,fullPath:C,moduleFilePath:f,sourcePath:N,children:[]},_=v.children.findIndex(function(D){return D.name===x});if(_===-1)v.children.push(P),v.type==="node"&&(v.isLinear=!0,v.children.length>1&&delete v.isLinear),v=P;else{var O=v.children[_];if(O.type==="leaf"&&w){var M=O.sourcePath;v.children[_]={type:"node",name:x,pattern:h,page:{fullPath:C},sourcePath:M,children:O.children,moduleFilePath:f},v=v.children[_]}else O.type==="node"&&S?(O.page={fullPath:C},O.sourcePath=N,O.moduleFilePath=f,O.pattern=h):v=v.children[_]}})},s;for(r.s();!(o=r.n()).done;)s=i()}catch(a){r.e(a)}finally{r.f()}return n}function Ab(e,t){return e.replace(t,"").replace(/\/\([^/]+\)/g,"").replace("/page.val.ts","").replace("/page.val.js","")}function DM(e){if(e===""||e==="/")return[];var t=e.startsWith("/")?e.slice(1):e;return t.split("/").map(function(n){var r=n.startsWith("[[")&&n.endsWith("]]"),o=n.startsWith("[")&&n.endsWith("]"),i=r?2:o?1:0,s=n.indexOf("]",i),a=n.slice(i,i+3)==="...",l=n.slice(i+(a?3:0),s);return r||o?a?{type:"array-param",paramName:l,optional:r}:{type:"string-param",paramName:l,optional:r}:{type:"literal",name:n}})}function A8(e){return e.startsWith("/app")?"/app":e.startsWith("/src/app")?"/src/app":null}function Qs(e){return Array.isArray(e)}function vu(e){"@babel/helpers - typeof";return vu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vu(e)}function yn(e){if(e===null||e===!0||e===!1)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function Te(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function Ke(e){Te(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||vu(e)==="object"&&t==="[object Date]"?new Date(e.getTime()):typeof e=="number"||t==="[object Number]"?new Date(e):((typeof e=="string"||t==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function Xn(e,t){Te(2,arguments);var n=Ke(e),r=yn(t);return isNaN(r)?new Date(NaN):(r&&n.setDate(n.getDate()+r),n)}function Xo(e,t){Te(2,arguments);var n=Ke(e),r=yn(t);if(isNaN(r))return new Date(NaN);if(!r)return n;var o=n.getDate(),i=new Date(n.getTime());i.setMonth(n.getMonth()+r+1,0);var s=i.getDate();return o>=s?i:(n.setFullYear(i.getFullYear(),i.getMonth(),o),n)}function I8(e,t){Te(2,arguments);var n=Ke(e).getTime(),r=yn(t);return new Date(n+r)}var D8={};function $a(){return D8}function wi(e,t){var n,r,o,i,s,a,l,c;Te(1,arguments);var u=$a(),f=yn((n=(r=(o=(i=t==null?void 0:t.weekStartsOn)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.weekStartsOn)!==null&&o!==void 0?o:u.weekStartsOn)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&n!==void 0?n:0);if(!(f>=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var h=Ke(e),p=h.getDay(),m=(p<f?7:0)+p-f;return h.setDate(h.getDate()-m),h.setHours(0,0,0,0),h}function Ol(e){return Te(1,arguments),wi(e,{weekStartsOn:1})}function L8(e){Te(1,arguments);var t=Ke(e),n=t.getFullYear(),r=new Date(0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);var o=Ol(r),i=new Date(0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);var s=Ol(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=s.getTime()?n:n-1}function F8(e){Te(1,arguments);var t=L8(e),n=new Date(0);n.setFullYear(t,0,4),n.setHours(0,0,0,0);var r=Ol(n);return r}function fh(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function yu(e){Te(1,arguments);var t=Ke(e);return t.setHours(0,0,0,0),t}var z8=864e5;function qi(e,t){Te(2,arguments);var n=yu(e),r=yu(t),o=n.getTime()-fh(n),i=r.getTime()-fh(r);return Math.round((o-i)/z8)}function Ib(e,t){Te(2,arguments);var n=yn(t),r=n*7;return Xn(e,r)}function $8(e,t){Te(2,arguments);var n=yn(t);return Xo(e,n*12)}function B8(e){Te(1,arguments);var t;if(e&&typeof e.forEach=="function")t=e;else if(vu(e)==="object"&&e!==null)t=Array.prototype.slice.call(e);else return new Date(NaN);var n;return t.forEach(function(r){var o=Ke(r);(n===void 0||n<o||isNaN(Number(o)))&&(n=o)}),n||new Date(NaN)}function V8(e){Te(1,arguments);var t;if(e&&typeof e.forEach=="function")t=e;else if(vu(e)==="object"&&e!==null)t=Array.prototype.slice.call(e);else return new Date(NaN);var n;return t.forEach(function(r){var o=Ke(r);(n===void 0||n>o||isNaN(o.getDate()))&&(n=o)}),n||new Date(NaN)}function dr(e,t){Te(2,arguments);var n=yu(e),r=yu(t);return n.getTime()===r.getTime()}function iS(e){return Te(1,arguments),e instanceof Date||vu(e)==="object"&&Object.prototype.toString.call(e)==="[object Date]"}function U8(e){if(Te(1,arguments),!iS(e)&&typeof e!="number")return!1;var t=Ke(e);return!isNaN(Number(t))}function hh(e,t){Te(2,arguments);var n=Ke(e),r=Ke(t),o=n.getFullYear()-r.getFullYear(),i=n.getMonth()-r.getMonth();return o*12+i}var W8=6048e5;function H8(e,t,n){Te(2,arguments);var r=wi(e,n),o=wi(t,n),i=r.getTime()-fh(r),s=o.getTime()-fh(o);return Math.round((i-s)/W8)}function sS(e){Te(1,arguments);var t=Ke(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function yr(e){Te(1,arguments);var t=Ke(e);return t.setDate(1),t.setHours(0,0,0,0),t}function K8(e){Te(1,arguments);var t=Ke(e),n=new Date(0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function aS(e,t){var n,r,o,i,s,a,l,c;Te(1,arguments);var u=$a(),f=yn((n=(r=(o=(i=t==null?void 0:t.weekStartsOn)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.weekStartsOn)!==null&&o!==void 0?o:u.weekStartsOn)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&n!==void 0?n:0);if(!(f>=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var h=Ke(e),p=h.getDay(),m=(p<f?-7:0)+6-(p-f);return h.setDate(h.getDate()+m),h.setHours(23,59,59,999),h}function LM(e){return Te(1,arguments),aS(e,{weekStartsOn:1})}function G8(e,t){Te(2,arguments);var n=yn(t);return I8(e,-n)}var q8=864e5;function Y8(e){Te(1,arguments);var t=Ke(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var r=t.getTime(),o=n-r;return Math.floor(o/q8)+1}function Ng(e){Te(1,arguments);var t=1,n=Ke(e),r=n.getUTCDay(),o=(r<t?7:0)+r-t;return n.setUTCDate(n.getUTCDate()-o),n.setUTCHours(0,0,0,0),n}function FM(e){Te(1,arguments);var t=Ke(e),n=t.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(n+1,0,4),r.setUTCHours(0,0,0,0);var o=Ng(r),i=new Date(0);i.setUTCFullYear(n,0,4),i.setUTCHours(0,0,0,0);var s=Ng(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=s.getTime()?n:n-1}function J8(e){Te(1,arguments);var t=FM(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var r=Ng(n);return r}var X8=6048e5;function Z8(e){Te(1,arguments);var t=Ke(e),n=Ng(t).getTime()-J8(t).getTime();return Math.round(n/X8)+1}function Pg(e,t){var n,r,o,i,s,a,l,c;Te(1,arguments);var u=$a(),f=yn((n=(r=(o=(i=t==null?void 0:t.weekStartsOn)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.weekStartsOn)!==null&&o!==void 0?o:u.weekStartsOn)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&n!==void 0?n:0);if(!(f>=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var h=Ke(e),p=h.getUTCDay(),m=(p<f?7:0)+p-f;return h.setUTCDate(h.getUTCDate()-m),h.setUTCHours(0,0,0,0),h}function zM(e,t){var n,r,o,i,s,a,l,c;Te(1,arguments);var u=Ke(e),f=u.getUTCFullYear(),h=$a(),p=yn((n=(r=(o=(i=t==null?void 0:t.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.firstWeekContainsDate)!==null&&o!==void 0?o:h.firstWeekContainsDate)!==null&&r!==void 0?r:(l=h.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1);if(!(p>=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=new Date(0);m.setUTCFullYear(f+1,0,p),m.setUTCHours(0,0,0,0);var v=Pg(m,t),x=new Date(0);x.setUTCFullYear(f,0,p),x.setUTCHours(0,0,0,0);var b=Pg(x,t);return u.getTime()>=v.getTime()?f+1:u.getTime()>=b.getTime()?f:f-1}function Q8(e,t){var n,r,o,i,s,a,l,c;Te(1,arguments);var u=$a(),f=yn((n=(r=(o=(i=t==null?void 0:t.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.firstWeekContainsDate)!==null&&o!==void 0?o:u.firstWeekContainsDate)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1),h=zM(e,t),p=new Date(0);p.setUTCFullYear(h,0,f),p.setUTCHours(0,0,0,0);var m=Pg(p,t);return m}var eV=6048e5;function tV(e,t){Te(1,arguments);var n=Ke(e),r=Pg(n,t).getTime()-Q8(n,t).getTime();return Math.round(r/eV)+1}function ht(e,t){for(var n=e<0?"-":"",r=Math.abs(e).toString();r.length<t;)r="0"+r;return n+r}var Ns={y:function(t,n){var r=t.getUTCFullYear(),o=r>0?r:1-r;return ht(n==="yy"?o%100:o,n.length)},M:function(t,n){var r=t.getUTCMonth();return n==="M"?String(r+1):ht(r+1,2)},d:function(t,n){return ht(t.getUTCDate(),n.length)},a:function(t,n){var r=t.getUTCHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h:function(t,n){return ht(t.getUTCHours()%12||12,n.length)},H:function(t,n){return ht(t.getUTCHours(),n.length)},m:function(t,n){return ht(t.getUTCMinutes(),n.length)},s:function(t,n){return ht(t.getUTCSeconds(),n.length)},S:function(t,n){var r=n.length,o=t.getUTCMilliseconds(),i=Math.floor(o*Math.pow(10,r-3));return ht(i,n.length)}},uc={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},nV={G:function(t,n,r){var o=t.getUTCFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return r.era(o,{width:"abbreviated"});case"GGGGG":return r.era(o,{width:"narrow"});case"GGGG":default:return r.era(o,{width:"wide"})}},y:function(t,n,r){if(n==="yo"){var o=t.getUTCFullYear(),i=o>0?o:1-o;return r.ordinalNumber(i,{unit:"year"})}return Ns.y(t,n)},Y:function(t,n,r,o){var i=zM(t,o),s=i>0?i:1-i;if(n==="YY"){var a=s%100;return ht(a,2)}return n==="Yo"?r.ordinalNumber(s,{unit:"year"}):ht(s,n.length)},R:function(t,n){var r=FM(t);return ht(r,n.length)},u:function(t,n){var r=t.getUTCFullYear();return ht(r,n.length)},Q:function(t,n,r){var o=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"Q":return String(o);case"QQ":return ht(o,2);case"Qo":return r.ordinalNumber(o,{unit:"quarter"});case"QQQ":return r.quarter(o,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(o,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(o,{width:"wide",context:"formatting"})}},q:function(t,n,r){var o=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"q":return String(o);case"qq":return ht(o,2);case"qo":return r.ordinalNumber(o,{unit:"quarter"});case"qqq":return r.quarter(o,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(o,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(o,{width:"wide",context:"standalone"})}},M:function(t,n,r){var o=t.getUTCMonth();switch(n){case"M":case"MM":return Ns.M(t,n);case"Mo":return r.ordinalNumber(o+1,{unit:"month"});case"MMM":return r.month(o,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(o,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(o,{width:"wide",context:"formatting"})}},L:function(t,n,r){var o=t.getUTCMonth();switch(n){case"L":return String(o+1);case"LL":return ht(o+1,2);case"Lo":return r.ordinalNumber(o+1,{unit:"month"});case"LLL":return r.month(o,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(o,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(o,{width:"wide",context:"standalone"})}},w:function(t,n,r,o){var i=tV(t,o);return n==="wo"?r.ordinalNumber(i,{unit:"week"}):ht(i,n.length)},I:function(t,n,r){var o=Z8(t);return n==="Io"?r.ordinalNumber(o,{unit:"week"}):ht(o,n.length)},d:function(t,n,r){return n==="do"?r.ordinalNumber(t.getUTCDate(),{unit:"date"}):Ns.d(t,n)},D:function(t,n,r){var o=Y8(t);return n==="Do"?r.ordinalNumber(o,{unit:"dayOfYear"}):ht(o,n.length)},E:function(t,n,r){var o=t.getUTCDay();switch(n){case"E":case"EE":case"EEE":return r.day(o,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(o,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(o,{width:"short",context:"formatting"});case"EEEE":default:return r.day(o,{width:"wide",context:"formatting"})}},e:function(t,n,r,o){var i=t.getUTCDay(),s=(i-o.weekStartsOn+8)%7||7;switch(n){case"e":return String(s);case"ee":return ht(s,2);case"eo":return r.ordinalNumber(s,{unit:"day"});case"eee":return r.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(i,{width:"short",context:"formatting"});case"eeee":default:return r.day(i,{width:"wide",context:"formatting"})}},c:function(t,n,r,o){var i=t.getUTCDay(),s=(i-o.weekStartsOn+8)%7||7;switch(n){case"c":return String(s);case"cc":return ht(s,n.length);case"co":return r.ordinalNumber(s,{unit:"day"});case"ccc":return r.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(i,{width:"narrow",context:"standalone"});case"cccccc":return r.day(i,{width:"short",context:"standalone"});case"cccc":default:return r.day(i,{width:"wide",context:"standalone"})}},i:function(t,n,r){var o=t.getUTCDay(),i=o===0?7:o;switch(n){case"i":return String(i);case"ii":return ht(i,n.length);case"io":return r.ordinalNumber(i,{unit:"day"});case"iii":return r.day(o,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(o,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(o,{width:"short",context:"formatting"});case"iiii":default:return r.day(o,{width:"wide",context:"formatting"})}},a:function(t,n,r){var o=t.getUTCHours(),i=o/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,n,r){var o=t.getUTCHours(),i;switch(o===12?i=uc.noon:o===0?i=uc.midnight:i=o/12>=1?"pm":"am",n){case"b":case"bb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,n,r){var o=t.getUTCHours(),i;switch(o>=17?i=uc.evening:o>=12?i=uc.afternoon:o>=4?i=uc.morning:i=uc.night,n){case"B":case"BB":case"BBB":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,n,r){if(n==="ho"){var o=t.getUTCHours()%12;return o===0&&(o=12),r.ordinalNumber(o,{unit:"hour"})}return Ns.h(t,n)},H:function(t,n,r){return n==="Ho"?r.ordinalNumber(t.getUTCHours(),{unit:"hour"}):Ns.H(t,n)},K:function(t,n,r){var o=t.getUTCHours()%12;return n==="Ko"?r.ordinalNumber(o,{unit:"hour"}):ht(o,n.length)},k:function(t,n,r){var o=t.getUTCHours();return o===0&&(o=24),n==="ko"?r.ordinalNumber(o,{unit:"hour"}):ht(o,n.length)},m:function(t,n,r){return n==="mo"?r.ordinalNumber(t.getUTCMinutes(),{unit:"minute"}):Ns.m(t,n)},s:function(t,n,r){return n==="so"?r.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):Ns.s(t,n)},S:function(t,n){return Ns.S(t,n)},X:function(t,n,r,o){var i=o._originalDate||t,s=i.getTimezoneOffset();if(s===0)return"Z";switch(n){case"X":return nN(s);case"XXXX":case"XX":return Qa(s);case"XXXXX":case"XXX":default:return Qa(s,":")}},x:function(t,n,r,o){var i=o._originalDate||t,s=i.getTimezoneOffset();switch(n){case"x":return nN(s);case"xxxx":case"xx":return Qa(s);case"xxxxx":case"xxx":default:return Qa(s,":")}},O:function(t,n,r,o){var i=o._originalDate||t,s=i.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+tN(s,":");case"OOOO":default:return"GMT"+Qa(s,":")}},z:function(t,n,r,o){var i=o._originalDate||t,s=i.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+tN(s,":");case"zzzz":default:return"GMT"+Qa(s,":")}},t:function(t,n,r,o){var i=o._originalDate||t,s=Math.floor(i.getTime()/1e3);return ht(s,n.length)},T:function(t,n,r,o){var i=o._originalDate||t,s=i.getTime();return ht(s,n.length)}};function tN(e,t){var n=e>0?"-":"+",r=Math.abs(e),o=Math.floor(r/60),i=r%60;if(i===0)return n+String(o);var s=t;return n+String(o)+s+ht(i,2)}function nN(e,t){if(e%60===0){var n=e>0?"-":"+";return n+ht(Math.abs(e)/60,2)}return Qa(e,t)}function Qa(e,t){var n=t||"",r=e>0?"-":"+",o=Math.abs(e),i=ht(Math.floor(o/60),2),s=ht(o%60,2);return r+i+n+s}var rN=function(t,n){switch(t){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},$M=function(t,n){switch(t){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},rV=function(t,n){var r=t.match(/(P+)(p+)?/)||[],o=r[1],i=r[2];if(!i)return rN(t,n);var s;switch(o){case"P":s=n.dateTime({width:"short"});break;case"PP":s=n.dateTime({width:"medium"});break;case"PPP":s=n.dateTime({width:"long"});break;case"PPPP":default:s=n.dateTime({width:"full"});break}return s.replace("{{date}}",rN(o,n)).replace("{{time}}",$M(i,n))},oV={p:$M,P:rV},iV=["D","DD"],sV=["YY","YYYY"];function aV(e){return iV.indexOf(e)!==-1}function lV(e){return sV.indexOf(e)!==-1}function oN(e,t,n){if(e==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var cV={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},uV=function(t,n,r){var o,i=cV[t];return typeof i=="string"?o=i:n===1?o=i.one:o=i.other.replace("{{count}}",n.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+o:o+" ago":o};function Ox(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,r=e.formats[n]||e.formats[e.defaultWidth];return r}}var dV={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},fV={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},hV={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},pV={date:Ox({formats:dV,defaultWidth:"full"}),time:Ox({formats:fV,defaultWidth:"full"}),dateTime:Ox({formats:hV,defaultWidth:"full"})},mV={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},gV=function(t,n,r,o){return mV[t]};function kd(e){return function(t,n){var r=n!=null&&n.context?String(n.context):"standalone",o;if(r==="formatting"&&e.formattingValues){var i=e.defaultFormattingWidth||e.defaultWidth,s=n!=null&&n.width?String(n.width):i;o=e.formattingValues[s]||e.formattingValues[i]}else{var a=e.defaultWidth,l=n!=null&&n.width?String(n.width):e.defaultWidth;o=e.values[l]||e.values[a]}var c=e.argumentCallback?e.argumentCallback(t):t;return o[c]}}var vV={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},yV={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},xV={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},bV={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},wV={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},SV={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},kV=function(t,n){var r=Number(t),o=r%100;if(o>20||o<10)switch(o%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},EV={ordinalNumber:kV,era:kd({values:vV,defaultWidth:"wide"}),quarter:kd({values:yV,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:kd({values:xV,defaultWidth:"wide"}),day:kd({values:bV,defaultWidth:"wide"}),dayPeriod:kd({values:wV,defaultWidth:"wide",formattingValues:SV,defaultFormattingWidth:"wide"})};function Ed(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.width,o=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],i=t.match(o);if(!i)return null;var s=i[0],a=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(a)?NV(a,function(f){return f.test(s)}):CV(a,function(f){return f.test(s)}),c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;var u=t.slice(s.length);return{value:c,rest:u}}}function CV(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function NV(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}function PV(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.match(e.matchPattern);if(!r)return null;var o=r[0],i=t.match(e.parsePattern);if(!i)return null;var s=e.valueCallback?e.valueCallback(i[0]):i[0];s=n.valueCallback?n.valueCallback(s):s;var a=t.slice(o.length);return{value:s,rest:a}}}var _V=/^(\d+)(th|st|nd|rd)?/i,jV=/\d+/i,TV={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},OV={any:[/^b/i,/^(a|c)/i]},MV={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},RV={any:[/1/i,/2/i,/3/i,/4/i]},AV={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},IV={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},DV={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},LV={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},FV={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},zV={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},$V={ordinalNumber:PV({matchPattern:_V,parsePattern:jV,valueCallback:function(t){return parseInt(t,10)}}),era:Ed({matchPatterns:TV,defaultMatchWidth:"wide",parsePatterns:OV,defaultParseWidth:"any"}),quarter:Ed({matchPatterns:MV,defaultMatchWidth:"wide",parsePatterns:RV,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:Ed({matchPatterns:AV,defaultMatchWidth:"wide",parsePatterns:IV,defaultParseWidth:"any"}),day:Ed({matchPatterns:DV,defaultMatchWidth:"wide",parsePatterns:LV,defaultParseWidth:"any"}),dayPeriod:Ed({matchPatterns:FV,defaultMatchWidth:"any",parsePatterns:zV,defaultParseWidth:"any"})},BM={code:"en-US",formatDistance:uV,formatLong:pV,formatRelative:gV,localize:EV,match:$V,options:{weekStartsOn:0,firstWeekContainsDate:1}},BV=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,VV=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,UV=/^'([^]*?)'?$/,WV=/''/g,HV=/[a-zA-Z]/;function ps(e,t,n){var r,o,i,s,a,l,c,u,f,h,p,m,v,x,b,w,S,C;Te(2,arguments);var N=String(t),P=$a(),_=(r=(o=n==null?void 0:n.locale)!==null&&o!==void 0?o:P.locale)!==null&&r!==void 0?r:BM,O=yn((i=(s=(a=(l=n==null?void 0:n.firstWeekContainsDate)!==null&&l!==void 0?l:n==null||(c=n.locale)===null||c===void 0||(u=c.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&a!==void 0?a:P.firstWeekContainsDate)!==null&&s!==void 0?s:(f=P.locale)===null||f===void 0||(h=f.options)===null||h===void 0?void 0:h.firstWeekContainsDate)!==null&&i!==void 0?i:1);if(!(O>=1&&O<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var M=yn((p=(m=(v=(x=n==null?void 0:n.weekStartsOn)!==null&&x!==void 0?x:n==null||(b=n.locale)===null||b===void 0||(w=b.options)===null||w===void 0?void 0:w.weekStartsOn)!==null&&v!==void 0?v:P.weekStartsOn)!==null&&m!==void 0?m:(S=P.locale)===null||S===void 0||(C=S.options)===null||C===void 0?void 0:C.weekStartsOn)!==null&&p!==void 0?p:0);if(!(M>=0&&M<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!_.localize)throw new RangeError("locale must contain localize property");if(!_.formatLong)throw new RangeError("locale must contain formatLong property");var D=Ke(e);if(!U8(D))throw new RangeError("Invalid time value");var U=fh(D),z=G8(D,U),H={firstWeekContainsDate:O,weekStartsOn:M,locale:_,_originalDate:D},K=N.match(VV).map(function(V){var I=V[0];if(I==="p"||I==="P"){var A=oV[I];return A(V,_.formatLong)}return V}).join("").match(BV).map(function(V){if(V==="''")return"'";var I=V[0];if(I==="'")return KV(V);var A=nV[I];if(A)return!(n!=null&&n.useAdditionalWeekYearTokens)&&lV(V)&&oN(V,t,String(e)),!(n!=null&&n.useAdditionalDayOfYearTokens)&&aV(V)&&oN(V,t,String(e)),A(z,V,_.localize,H);if(I.match(HV))throw new RangeError("Format string contains an unescaped latin alphabet character `"+I+"`");return V}).join("");return K}function KV(e){var t=e.match(UV);return t?t[1].replace(WV,"'"):e}function GV(e){Te(1,arguments);var t=Ke(e),n=t.getFullYear(),r=t.getMonth(),o=new Date(0);return o.setFullYear(n,r+1,0),o.setHours(0,0,0,0),o.getDate()}var qV=6048e5;function YV(e){Te(1,arguments);var t=Ke(e),n=Ol(t).getTime()-F8(t).getTime();return Math.round(n/qV)+1}function JV(e){Te(1,arguments);var t=Ke(e),n=t.getTime();return n}function XV(e){return Te(1,arguments),Math.floor(JV(e)/1e3)}function ZV(e,t){var n,r,o,i,s,a,l,c;Te(1,arguments);var u=Ke(e),f=u.getFullYear(),h=$a(),p=yn((n=(r=(o=(i=t==null?void 0:t.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.firstWeekContainsDate)!==null&&o!==void 0?o:h.firstWeekContainsDate)!==null&&r!==void 0?r:(l=h.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1);if(!(p>=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=new Date(0);m.setFullYear(f+1,0,p),m.setHours(0,0,0,0);var v=wi(m,t),x=new Date(0);x.setFullYear(f,0,p),x.setHours(0,0,0,0);var b=wi(x,t);return u.getTime()>=v.getTime()?f+1:u.getTime()>=b.getTime()?f:f-1}function QV(e,t){var n,r,o,i,s,a,l,c;Te(1,arguments);var u=$a(),f=yn((n=(r=(o=(i=t==null?void 0:t.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.firstWeekContainsDate)!==null&&o!==void 0?o:u.firstWeekContainsDate)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1),h=ZV(e,t),p=new Date(0);p.setFullYear(h,0,f),p.setHours(0,0,0,0);var m=wi(p,t);return m}var e9=6048e5;function t9(e,t){Te(1,arguments);var n=Ke(e),r=wi(n,t).getTime()-QV(n,t).getTime();return Math.round(r/e9)+1}function n9(e){Te(1,arguments);var t=Ke(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(0,0,0,0),t}function r9(e,t){return Te(1,arguments),H8(n9(e),yr(e),t)+1}function Db(e,t){Te(2,arguments);var n=Ke(e),r=Ke(t);return n.getTime()>r.getTime()}function VM(e,t){Te(2,arguments);var n=Ke(e),r=Ke(t);return n.getTime()<r.getTime()}function lS(e,t){Te(2,arguments);var n=Ke(e),r=Ke(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function o9(e,t){Te(2,arguments);var n=Ke(e),r=Ke(t);return n.getFullYear()===r.getFullYear()}function Mx(e,t){Te(2,arguments);var n=yn(t);return Xn(e,-n)}function Rx(e,t){Te(2,arguments);var n=Ke(e),r=yn(t),o=n.getFullYear(),i=n.getDate(),s=new Date(0);s.setFullYear(o,r,15),s.setHours(0,0,0,0);var a=GV(s);return n.setMonth(r,Math.min(i,a)),n}function iN(e,t){Te(2,arguments);var n=Ke(e),r=yn(t);return isNaN(n.getTime())?new Date(NaN):(n.setFullYear(r),n)}var Ae=function(){return Ae=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Ae.apply(this,arguments)};function i9(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function UM(e,t,n){for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}function Xh(e){return e.mode==="multiple"}function Zh(e){return e.mode==="range"}function Qv(e){return e.mode==="single"}var s9={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function a9(e,t){return ps(e,"LLLL y",t)}function l9(e,t){return ps(e,"d",t)}function c9(e,t){return ps(e,"LLLL",t)}function u9(e){return"".concat(e)}function d9(e,t){return ps(e,"cccccc",t)}function f9(e,t){return ps(e,"yyyy",t)}var h9=Object.freeze({__proto__:null,formatCaption:a9,formatDay:l9,formatMonthCaption:c9,formatWeekNumber:u9,formatWeekdayName:d9,formatYearCaption:f9}),p9=function(e,t,n){return ps(e,"do MMMM (EEEE)",n)},m9=function(){return"Month: "},g9=function(){return"Go to next month"},v9=function(){return"Go to previous month"},y9=function(e,t){return ps(e,"cccc",t)},x9=function(e){return"Week n. ".concat(e)},b9=function(){return"Year: "},w9=Object.freeze({__proto__:null,labelDay:p9,labelMonthDropdown:m9,labelNext:g9,labelPrevious:v9,labelWeekNumber:x9,labelWeekday:y9,labelYearDropdown:b9});function S9(){var e="buttons",t=s9,n=BM,r={},o={},i=1,s={},a=new Date;return{captionLayout:e,classNames:t,formatters:h9,labels:w9,locale:n,modifiersClassNames:r,modifiers:o,numberOfMonths:i,styles:s,today:a,mode:"default"}}function k9(e){var t=e.fromYear,n=e.toYear,r=e.fromMonth,o=e.toMonth,i=e.fromDate,s=e.toDate;return r?i=yr(r):t&&(i=new Date(t,0,1)),o?s=sS(o):n&&(s=new Date(n,11,31)),{fromDate:i?yu(i):void 0,toDate:s?yu(s):void 0}}var WM=g.createContext(void 0);function HM(e){var t,n=e.initialProps,r=S9(),o=k9(n),i=o.fromDate,s=o.toDate,a=(t=n.captionLayout)!==null&&t!==void 0?t:r.captionLayout;a!=="buttons"&&(!i||!s)&&(a="buttons");var l;(Qv(n)||Xh(n)||Zh(n))&&(l=n.onSelect);var c=Ae(Ae(Ae({},r),n),{captionLayout:a,classNames:Ae(Ae({},r.classNames),n.classNames),components:Ae({},n.components),formatters:Ae(Ae({},r.formatters),n.formatters),fromDate:i,labels:Ae(Ae({},r.labels),n.labels),mode:n.mode||r.mode,modifiers:Ae(Ae({},r.modifiers),n.modifiers),modifiersClassNames:Ae(Ae({},r.modifiersClassNames),n.modifiersClassNames),onSelect:l,styles:Ae(Ae({},r.styles),n.styles),toDate:s});return d.jsx(WM.Provider,{value:c,children:e.children})}function kt(){var e=g.useContext(WM);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function KM(e){var t=kt(),n=t.locale,r=t.classNames,o=t.styles,i=t.formatters.formatCaption;return d.jsx("div",{className:r.caption_label,style:o.caption_label,"aria-live":"polite",role:"presentation",id:e.id,children:i(e.displayMonth,{locale:n})})}function E9(e){return d.jsx("svg",Ae({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e,{children:d.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function GM(e){var t,n,r=e.onChange,o=e.value,i=e.children,s=e.caption,a=e.className,l=e.style,c=kt(),u=(n=(t=c.components)===null||t===void 0?void 0:t.IconDropdown)!==null&&n!==void 0?n:E9;return d.jsxs("div",{className:a,style:l,children:[d.jsx("span",{className:c.classNames.vhidden,children:e["aria-label"]}),d.jsx("select",{name:e.name,"aria-label":e["aria-label"],className:c.classNames.dropdown,style:c.styles.dropdown,value:o,onChange:r,children:i}),d.jsxs("div",{className:c.classNames.caption_label,style:c.styles.caption_label,"aria-hidden":"true",children:[s,d.jsx(u,{className:c.classNames.dropdown_icon,style:c.styles.dropdown_icon})]})]})}function C9(e){var t,n=kt(),r=n.fromDate,o=n.toDate,i=n.styles,s=n.locale,a=n.formatters.formatMonthCaption,l=n.classNames,c=n.components,u=n.labels.labelMonthDropdown;if(!r)return d.jsx(d.Fragment,{});if(!o)return d.jsx(d.Fragment,{});var f=[];if(o9(r,o))for(var h=yr(r),p=r.getMonth();p<=o.getMonth();p++)f.push(Rx(h,p));else for(var h=yr(new Date),p=0;p<=11;p++)f.push(Rx(h,p));var m=function(x){var b=Number(x.target.value),w=Rx(yr(e.displayMonth),b);e.onChange(w)},v=(t=c==null?void 0:c.Dropdown)!==null&&t!==void 0?t:GM;return d.jsx(v,{name:"months","aria-label":u(),className:l.dropdown_month,style:i.dropdown_month,onChange:m,value:e.displayMonth.getMonth(),caption:a(e.displayMonth,{locale:s}),children:f.map(function(x){return d.jsx("option",{value:x.getMonth(),children:a(x,{locale:s})},x.getMonth())})})}function N9(e){var t,n=e.displayMonth,r=kt(),o=r.fromDate,i=r.toDate,s=r.locale,a=r.styles,l=r.classNames,c=r.components,u=r.formatters.formatYearCaption,f=r.labels.labelYearDropdown,h=[];if(!o)return d.jsx(d.Fragment,{});if(!i)return d.jsx(d.Fragment,{});for(var p=o.getFullYear(),m=i.getFullYear(),v=p;v<=m;v++)h.push(iN(K8(new Date),v));var x=function(w){var S=iN(yr(n),Number(w.target.value));e.onChange(S)},b=(t=c==null?void 0:c.Dropdown)!==null&&t!==void 0?t:GM;return d.jsx(b,{name:"years","aria-label":f(),className:l.dropdown_year,style:a.dropdown_year,onChange:x,value:n.getFullYear(),caption:u(n,{locale:s}),children:h.map(function(w){return d.jsx("option",{value:w.getFullYear(),children:u(w,{locale:s})},w.getFullYear())})})}function P9(e,t){var n=g.useState(e),r=n[0],o=n[1],i=t===void 0?r:t;return[i,o]}function _9(e){var t=e.month,n=e.defaultMonth,r=e.today,o=t||n||r||new Date,i=e.toDate,s=e.fromDate,a=e.numberOfMonths,l=a===void 0?1:a;if(i&&hh(i,o)<0){var c=-1*(l-1);o=Xo(i,c)}return s&&hh(o,s)<0&&(o=s),yr(o)}function j9(){var e=kt(),t=_9(e),n=P9(t,e.month),r=n[0],o=n[1],i=function(s){var a;if(!e.disableNavigation){var l=yr(s);o(l),(a=e.onMonthChange)===null||a===void 0||a.call(e,l)}};return[r,i]}function T9(e,t){for(var n=t.reverseMonths,r=t.numberOfMonths,o=yr(e),i=yr(Xo(o,r)),s=hh(i,o),a=[],l=0;l<s;l++){var c=Xo(o,l);a.push(c)}return n&&(a=a.reverse()),a}function O9(e,t){if(!t.disableNavigation){var n=t.toDate,r=t.pagedNavigation,o=t.numberOfMonths,i=o===void 0?1:o,s=r?i:1,a=yr(e);if(!n)return Xo(a,s);var l=hh(n,e);if(!(l<i))return Xo(a,s)}}function M9(e,t){if(!t.disableNavigation){var n=t.fromDate,r=t.pagedNavigation,o=t.numberOfMonths,i=o===void 0?1:o,s=r?i:1,a=yr(e);if(!n)return Xo(a,-s);var l=hh(a,n);if(!(l<=0))return Xo(a,-s)}}var qM=g.createContext(void 0);function R9(e){var t=kt(),n=j9(),r=n[0],o=n[1],i=T9(r,t),s=O9(r,t),a=M9(r,t),l=function(f){return i.some(function(h){return lS(f,h)})},c=function(f,h){l(f)||(h&&VM(f,h)?o(Xo(f,1+t.numberOfMonths*-1)):o(f))},u={currentMonth:r,displayMonths:i,goToMonth:o,goToDate:c,previousMonth:a,nextMonth:s,isDateDisplayed:l};return d.jsx(qM.Provider,{value:u,children:e.children})}function Qh(){var e=g.useContext(qM);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function sN(e){var t,n=kt(),r=n.classNames,o=n.styles,i=n.components,s=Qh().goToMonth,a=function(u){s(Xo(u,e.displayIndex?-e.displayIndex:0))},l=(t=i==null?void 0:i.CaptionLabel)!==null&&t!==void 0?t:KM,c=d.jsx(l,{id:e.id,displayMonth:e.displayMonth});return d.jsxs("div",{className:r.caption_dropdowns,style:o.caption_dropdowns,children:[d.jsx("div",{className:r.vhidden,children:c}),d.jsx(C9,{onChange:a,displayMonth:e.displayMonth}),d.jsx(N9,{onChange:a,displayMonth:e.displayMonth})]})}function A9(e){return d.jsx("svg",Ae({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:d.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function I9(e){return d.jsx("svg",Ae({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:d.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var _g=g.forwardRef(function(e,t){var n=kt(),r=n.classNames,o=n.styles,i=[r.button_reset,r.button];e.className&&i.push(e.className);var s=i.join(" "),a=Ae(Ae({},o.button_reset),o.button);return e.style&&Object.assign(a,e.style),d.jsx("button",Ae({},e,{ref:t,type:"button",className:s,style:a}))});function D9(e){var t,n,r=kt(),o=r.dir,i=r.locale,s=r.classNames,a=r.styles,l=r.labels,c=l.labelPrevious,u=l.labelNext,f=r.components;if(!e.nextMonth&&!e.previousMonth)return d.jsx(d.Fragment,{});var h=c(e.previousMonth,{locale:i}),p=[s.nav_button,s.nav_button_previous].join(" "),m=u(e.nextMonth,{locale:i}),v=[s.nav_button,s.nav_button_next].join(" "),x=(t=f==null?void 0:f.IconRight)!==null&&t!==void 0?t:I9,b=(n=f==null?void 0:f.IconLeft)!==null&&n!==void 0?n:A9;return d.jsxs("div",{className:s.nav,style:a.nav,children:[!e.hidePrevious&&d.jsx(_g,{name:"previous-month","aria-label":h,className:p,style:a.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:o==="rtl"?d.jsx(x,{className:s.nav_icon,style:a.nav_icon}):d.jsx(b,{className:s.nav_icon,style:a.nav_icon})}),!e.hideNext&&d.jsx(_g,{name:"next-month","aria-label":m,className:v,style:a.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:o==="rtl"?d.jsx(b,{className:s.nav_icon,style:a.nav_icon}):d.jsx(x,{className:s.nav_icon,style:a.nav_icon})})]})}function aN(e){var t=kt().numberOfMonths,n=Qh(),r=n.previousMonth,o=n.nextMonth,i=n.goToMonth,s=n.displayMonths,a=s.findIndex(function(m){return lS(e.displayMonth,m)}),l=a===0,c=a===s.length-1,u=t>1&&(l||!c),f=t>1&&(c||!l),h=function(){r&&i(r)},p=function(){o&&i(o)};return d.jsx(D9,{displayMonth:e.displayMonth,hideNext:u,hidePrevious:f,nextMonth:o,previousMonth:r,onPreviousClick:h,onNextClick:p})}function L9(e){var t,n=kt(),r=n.classNames,o=n.disableNavigation,i=n.styles,s=n.captionLayout,a=n.components,l=(t=a==null?void 0:a.CaptionLabel)!==null&&t!==void 0?t:KM,c;return o?c=d.jsx(l,{id:e.id,displayMonth:e.displayMonth}):s==="dropdown"?c=d.jsx(sN,{displayMonth:e.displayMonth,id:e.id}):s==="dropdown-buttons"?c=d.jsxs(d.Fragment,{children:[d.jsx(sN,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),d.jsx(aN,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):c=d.jsxs(d.Fragment,{children:[d.jsx(l,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),d.jsx(aN,{displayMonth:e.displayMonth,id:e.id})]}),d.jsx("div",{className:r.caption,style:i.caption,children:c})}function F9(e){var t=kt(),n=t.footer,r=t.styles,o=t.classNames.tfoot;return n?d.jsx("tfoot",{className:o,style:r.tfoot,children:d.jsx("tr",{children:d.jsx("td",{colSpan:8,children:n})})}):d.jsx(d.Fragment,{})}function z9(e,t,n){for(var r=n?Ol(new Date):wi(new Date,{locale:e,weekStartsOn:t}),o=[],i=0;i<7;i++){var s=Xn(r,i);o.push(s)}return o}function $9(){var e=kt(),t=e.classNames,n=e.styles,r=e.showWeekNumber,o=e.locale,i=e.weekStartsOn,s=e.ISOWeek,a=e.formatters.formatWeekdayName,l=e.labels.labelWeekday,c=z9(o,i,s);return d.jsxs("tr",{style:n.head_row,className:t.head_row,children:[r&&d.jsx("td",{style:n.head_cell,className:t.head_cell}),c.map(function(u,f){return d.jsx("th",{scope:"col",className:t.head_cell,style:n.head_cell,"aria-label":l(u,{locale:o}),children:a(u,{locale:o})},f)})]})}function B9(){var e,t=kt(),n=t.classNames,r=t.styles,o=t.components,i=(e=o==null?void 0:o.HeadRow)!==null&&e!==void 0?e:$9;return d.jsx("thead",{style:r.head,className:n.head,children:d.jsx(i,{})})}function V9(e){var t=kt(),n=t.locale,r=t.formatters.formatDay;return d.jsx(d.Fragment,{children:r(e.date,{locale:n})})}var cS=g.createContext(void 0);function U9(e){if(!Xh(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return d.jsx(cS.Provider,{value:t,children:e.children})}return d.jsx(W9,{initialProps:e.initialProps,children:e.children})}function W9(e){var t=e.initialProps,n=e.children,r=t.selected,o=t.min,i=t.max,s=function(c,u,f){var h,p;(h=t.onDayClick)===null||h===void 0||h.call(t,c,u,f);var m=!!(u.selected&&o&&(r==null?void 0:r.length)===o);if(!m){var v=!!(!u.selected&&i&&(r==null?void 0:r.length)===i);if(!v){var x=r?UM([],r):[];if(u.selected){var b=x.findIndex(function(w){return dr(c,w)});x.splice(b,1)}else x.push(c);(p=t.onSelect)===null||p===void 0||p.call(t,x,c,u,f)}}},a={disabled:[]};r&&a.disabled.push(function(c){var u=i&&r.length>i-1,f=r.some(function(h){return dr(h,c)});return!!(u&&!f)});var l={selected:r,onDayClick:s,modifiers:a};return d.jsx(cS.Provider,{value:l,children:n})}function uS(){var e=g.useContext(cS);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function H9(e,t){var n=t||{},r=n.from,o=n.to;return r&&o?dr(o,e)&&dr(r,e)?void 0:dr(o,e)?{from:o,to:void 0}:dr(r,e)?void 0:Db(r,e)?{from:e,to:o}:{from:r,to:e}:o?Db(e,o)?{from:o,to:e}:{from:e,to:o}:r?VM(e,r)?{from:e,to:r}:{from:r,to:e}:{from:e,to:void 0}}var dS=g.createContext(void 0);function K9(e){if(!Zh(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return d.jsx(dS.Provider,{value:t,children:e.children})}return d.jsx(G9,{initialProps:e.initialProps,children:e.children})}function G9(e){var t=e.initialProps,n=e.children,r=t.selected,o=r||{},i=o.from,s=o.to,a=t.min,l=t.max,c=function(p,m,v){var x,b;(x=t.onDayClick)===null||x===void 0||x.call(t,p,m,v);var w=H9(p,r);(b=t.onSelect)===null||b===void 0||b.call(t,w,p,m,v)},u={range_start:[],range_end:[],range_middle:[],disabled:[]};if(i?(u.range_start=[i],s?(u.range_end=[s],dr(i,s)||(u.range_middle=[{after:i,before:s}])):u.range_end=[i]):s&&(u.range_start=[s],u.range_end=[s]),a&&(i&&!s&&u.disabled.push({after:Mx(i,a-1),before:Xn(i,a-1)}),i&&s&&u.disabled.push({after:i,before:Xn(i,a-1)}),!i&&s&&u.disabled.push({after:Mx(s,a-1),before:Xn(s,a-1)})),l){if(i&&!s&&(u.disabled.push({before:Xn(i,-l+1)}),u.disabled.push({after:Xn(i,l-1)})),i&&s){var f=qi(s,i)+1,h=l-f;u.disabled.push({before:Mx(i,h)}),u.disabled.push({after:Xn(s,h)})}!i&&s&&(u.disabled.push({before:Xn(s,-l+1)}),u.disabled.push({after:Xn(s,l-1)}))}return d.jsx(dS.Provider,{value:{selected:r,onDayClick:c,modifiers:u},children:n})}function fS(){var e=g.useContext(dS);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function Cm(e){return Array.isArray(e)?UM([],e):e!==void 0?[e]:[]}function q9(e){var t={};return Object.entries(e).forEach(function(n){var r=n[0],o=n[1];t[r]=Cm(o)}),t}var Zo;(function(e){e.Outside="outside",e.Disabled="disabled",e.Selected="selected",e.Hidden="hidden",e.Today="today",e.RangeStart="range_start",e.RangeEnd="range_end",e.RangeMiddle="range_middle"})(Zo||(Zo={}));var Y9=Zo.Selected,Ri=Zo.Disabled,J9=Zo.Hidden,X9=Zo.Today,Ax=Zo.RangeEnd,Ix=Zo.RangeMiddle,Dx=Zo.RangeStart,Z9=Zo.Outside;function Q9(e,t,n){var r,o=(r={},r[Y9]=Cm(e.selected),r[Ri]=Cm(e.disabled),r[J9]=Cm(e.hidden),r[X9]=[e.today],r[Ax]=[],r[Ix]=[],r[Dx]=[],r[Z9]=[],r);return e.fromDate&&o[Ri].push({before:e.fromDate}),e.toDate&&o[Ri].push({after:e.toDate}),Xh(e)?o[Ri]=o[Ri].concat(t.modifiers[Ri]):Zh(e)&&(o[Ri]=o[Ri].concat(n.modifiers[Ri]),o[Dx]=n.modifiers[Dx],o[Ix]=n.modifiers[Ix],o[Ax]=n.modifiers[Ax]),o}var YM=g.createContext(void 0);function eU(e){var t=kt(),n=uS(),r=fS(),o=Q9(t,n,r),i=q9(t.modifiers),s=Ae(Ae({},o),i);return d.jsx(YM.Provider,{value:s,children:e.children})}function JM(){var e=g.useContext(YM);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function tU(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function nU(e){return!!(e&&typeof e=="object"&&"from"in e)}function rU(e){return!!(e&&typeof e=="object"&&"after"in e)}function oU(e){return!!(e&&typeof e=="object"&&"before"in e)}function iU(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function sU(e,t){var n,r=t.from,o=t.to;if(r&&o){var i=qi(o,r)<0;i&&(n=[o,r],r=n[0],o=n[1]);var s=qi(e,r)>=0&&qi(o,e)>=0;return s}return o?dr(o,e):r?dr(r,e):!1}function aU(e){return iS(e)}function lU(e){return Array.isArray(e)&&e.every(iS)}function cU(e,t){return t.some(function(n){if(typeof n=="boolean")return n;if(aU(n))return dr(e,n);if(lU(n))return n.includes(e);if(nU(n))return sU(e,n);if(iU(n))return n.dayOfWeek.includes(e.getDay());if(tU(n)){var r=qi(n.before,e),o=qi(n.after,e),i=r>0,s=o<0,a=Db(n.before,n.after);return a?s&&i:i||s}return rU(n)?qi(e,n.after)>0:oU(n)?qi(n.before,e)>0:typeof n=="function"?n(e):!1})}function hS(e,t,n){var r=Object.keys(t).reduce(function(i,s){var a=t[s];return cU(e,a)&&i.push(s),i},[]),o={};return r.forEach(function(i){return o[i]=!0}),n&&!lS(e,n)&&(o.outside=!0),o}function uU(e,t){for(var n=yr(e[0]),r=sS(e[e.length-1]),o,i,s=n;s<=r;){var a=hS(s,t),l=!a.disabled&&!a.hidden;if(!l){s=Xn(s,1);continue}if(a.selected)return s;a.today&&!i&&(i=s),o||(o=s),s=Xn(s,1)}return i||o}var dU=365;function XM(e,t){var n=t.moveBy,r=t.direction,o=t.context,i=t.modifiers,s=t.retry,a=s===void 0?{count:0,lastFocused:e}:s,l=o.weekStartsOn,c=o.fromDate,u=o.toDate,f=o.locale,h={day:Xn,week:Ib,month:Xo,year:$8,startOfWeek:function(x){return o.ISOWeek?Ol(x):wi(x,{locale:f,weekStartsOn:l})},endOfWeek:function(x){return o.ISOWeek?LM(x):aS(x,{locale:f,weekStartsOn:l})}},p=h[n](e,r==="after"?1:-1);r==="before"&&c?p=B8([c,p]):r==="after"&&u&&(p=V8([u,p]));var m=!0;if(i){var v=hS(p,i);m=!v.disabled&&!v.hidden}return m?p:a.count>dU?a.lastFocused:XM(p,{moveBy:n,direction:r,context:o,modifiers:i,retry:Ae(Ae({},a),{count:a.count+1})})}var ZM=g.createContext(void 0);function fU(e){var t=Qh(),n=JM(),r=g.useState(),o=r[0],i=r[1],s=g.useState(),a=s[0],l=s[1],c=uU(t.displayMonths,n),u=o??(a&&t.isDateDisplayed(a))?a:c,f=function(){l(o),i(void 0)},h=function(x){i(x)},p=kt(),m=function(x,b){if(o){var w=XM(o,{moveBy:x,direction:b,context:p,modifiers:n});dr(o,w)||(t.goToDate(w,o),h(w))}},v={focusedDay:o,focusTarget:u,blur:f,focus:h,focusDayAfter:function(){return m("day","after")},focusDayBefore:function(){return m("day","before")},focusWeekAfter:function(){return m("week","after")},focusWeekBefore:function(){return m("week","before")},focusMonthBefore:function(){return m("month","before")},focusMonthAfter:function(){return m("month","after")},focusYearBefore:function(){return m("year","before")},focusYearAfter:function(){return m("year","after")},focusStartOfWeek:function(){return m("startOfWeek","before")},focusEndOfWeek:function(){return m("endOfWeek","after")}};return d.jsx(ZM.Provider,{value:v,children:e.children})}function pS(){var e=g.useContext(ZM);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function hU(e,t){var n=JM(),r=hS(e,n,t);return r}var mS=g.createContext(void 0);function pU(e){if(!Qv(e.initialProps)){var t={selected:void 0};return d.jsx(mS.Provider,{value:t,children:e.children})}return d.jsx(mU,{initialProps:e.initialProps,children:e.children})}function mU(e){var t=e.initialProps,n=e.children,r=function(i,s,a){var l,c,u;if((l=t.onDayClick)===null||l===void 0||l.call(t,i,s,a),s.selected&&!t.required){(c=t.onSelect)===null||c===void 0||c.call(t,void 0,i,s,a);return}(u=t.onSelect)===null||u===void 0||u.call(t,i,i,s,a)},o={selected:t.selected,onDayClick:r};return d.jsx(mS.Provider,{value:o,children:n})}function QM(){var e=g.useContext(mS);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function gU(e,t){var n=kt(),r=QM(),o=uS(),i=fS(),s=pS(),a=s.focusDayAfter,l=s.focusDayBefore,c=s.focusWeekAfter,u=s.focusWeekBefore,f=s.blur,h=s.focus,p=s.focusMonthBefore,m=s.focusMonthAfter,v=s.focusYearBefore,x=s.focusYearAfter,b=s.focusStartOfWeek,w=s.focusEndOfWeek,S=function(A){var j,L,$,W;Qv(n)?(j=r.onDayClick)===null||j===void 0||j.call(r,e,t,A):Xh(n)?(L=o.onDayClick)===null||L===void 0||L.call(o,e,t,A):Zh(n)?($=i.onDayClick)===null||$===void 0||$.call(i,e,t,A):(W=n.onDayClick)===null||W===void 0||W.call(n,e,t,A)},C=function(A){var j;h(e),(j=n.onDayFocus)===null||j===void 0||j.call(n,e,t,A)},N=function(A){var j;f(),(j=n.onDayBlur)===null||j===void 0||j.call(n,e,t,A)},P=function(A){var j;(j=n.onDayMouseEnter)===null||j===void 0||j.call(n,e,t,A)},_=function(A){var j;(j=n.onDayMouseLeave)===null||j===void 0||j.call(n,e,t,A)},O=function(A){var j;(j=n.onDayPointerEnter)===null||j===void 0||j.call(n,e,t,A)},M=function(A){var j;(j=n.onDayPointerLeave)===null||j===void 0||j.call(n,e,t,A)},D=function(A){var j;(j=n.onDayTouchCancel)===null||j===void 0||j.call(n,e,t,A)},U=function(A){var j;(j=n.onDayTouchEnd)===null||j===void 0||j.call(n,e,t,A)},z=function(A){var j;(j=n.onDayTouchMove)===null||j===void 0||j.call(n,e,t,A)},H=function(A){var j;(j=n.onDayTouchStart)===null||j===void 0||j.call(n,e,t,A)},K=function(A){var j;(j=n.onDayKeyUp)===null||j===void 0||j.call(n,e,t,A)},V=function(A){var j;switch(A.key){case"ArrowLeft":A.preventDefault(),A.stopPropagation(),n.dir==="rtl"?a():l();break;case"ArrowRight":A.preventDefault(),A.stopPropagation(),n.dir==="rtl"?l():a();break;case"ArrowDown":A.preventDefault(),A.stopPropagation(),c();break;case"ArrowUp":A.preventDefault(),A.stopPropagation(),u();break;case"PageUp":A.preventDefault(),A.stopPropagation(),A.shiftKey?v():p();break;case"PageDown":A.preventDefault(),A.stopPropagation(),A.shiftKey?x():m();break;case"Home":A.preventDefault(),A.stopPropagation(),b();break;case"End":A.preventDefault(),A.stopPropagation(),w();break}(j=n.onDayKeyDown)===null||j===void 0||j.call(n,e,t,A)},I={onClick:S,onFocus:C,onBlur:N,onKeyDown:V,onKeyUp:K,onMouseEnter:P,onMouseLeave:_,onPointerEnter:O,onPointerLeave:M,onTouchCancel:D,onTouchEnd:U,onTouchMove:z,onTouchStart:H};return I}function vU(){var e=kt(),t=QM(),n=uS(),r=fS(),o=Qv(e)?t.selected:Xh(e)?n.selected:Zh(e)?r.selected:void 0;return o}function yU(e){return Object.values(Zo).includes(e)}function xU(e,t){var n=[e.classNames.day];return Object.keys(t).forEach(function(r){var o=e.modifiersClassNames[r];if(o)n.push(o);else if(yU(r)){var i=e.classNames["day_".concat(r)];i&&n.push(i)}}),n}function bU(e,t){var n=Ae({},e.styles.day);return Object.keys(t).forEach(function(r){var o;n=Ae(Ae({},n),(o=e.modifiersStyles)===null||o===void 0?void 0:o[r])}),n}function wU(e,t,n){var r,o,i,s=kt(),a=pS(),l=hU(e,t),c=gU(e,l),u=vU(),f=!!(s.onDayClick||s.mode!=="default");g.useEffect(function(){var P;l.outside||a.focusedDay&&f&&dr(a.focusedDay,e)&&((P=n.current)===null||P===void 0||P.focus())},[a.focusedDay,e,n,f,l.outside]);var h=xU(s,l).join(" "),p=bU(s,l),m=!!(l.outside&&!s.showOutsideDays||l.hidden),v=(i=(o=s.components)===null||o===void 0?void 0:o.DayContent)!==null&&i!==void 0?i:V9,x=d.jsx(v,{date:e,displayMonth:t,activeModifiers:l}),b={style:p,className:h,children:x,role:"gridcell"},w=a.focusTarget&&dr(a.focusTarget,e)&&!l.outside,S=a.focusedDay&&dr(a.focusedDay,e),C=Ae(Ae(Ae({},b),(r={disabled:l.disabled,role:"gridcell"},r["aria-selected"]=l.selected,r.tabIndex=S||w?0:-1,r)),c),N={isButton:f,isHidden:m,activeModifiers:l,selectedDays:u,buttonProps:C,divProps:b};return N}function SU(e){var t=g.useRef(null),n=wU(e.date,e.displayMonth,t);return n.isHidden?d.jsx("div",{role:"gridcell"}):n.isButton?d.jsx(_g,Ae({name:"day",ref:t},n.buttonProps)):d.jsx("div",Ae({},n.divProps))}function kU(e){var t=e.number,n=e.dates,r=kt(),o=r.onWeekNumberClick,i=r.styles,s=r.classNames,a=r.locale,l=r.labels.labelWeekNumber,c=r.formatters.formatWeekNumber,u=c(Number(t),{locale:a});if(!o)return d.jsx("span",{className:s.weeknumber,style:i.weeknumber,children:u});var f=l(Number(t),{locale:a}),h=function(p){o(t,n,p)};return d.jsx(_g,{name:"week-number","aria-label":f,className:s.weeknumber,style:i.weeknumber,onClick:h,children:u})}function EU(e){var t,n,r=kt(),o=r.styles,i=r.classNames,s=r.showWeekNumber,a=r.components,l=(t=a==null?void 0:a.Day)!==null&&t!==void 0?t:SU,c=(n=a==null?void 0:a.WeekNumber)!==null&&n!==void 0?n:kU,u;return s&&(u=d.jsx("td",{className:i.cell,style:o.cell,children:d.jsx(c,{number:e.weekNumber,dates:e.dates})})),d.jsxs("tr",{className:i.row,style:o.row,children:[u,e.dates.map(function(f){return d.jsx("td",{className:i.cell,style:o.cell,role:"presentation",children:d.jsx(l,{displayMonth:e.displayMonth,date:f})},XV(f))})]})}function lN(e,t,n){for(var r=n!=null&&n.ISOWeek?LM(t):aS(t,n),o=n!=null&&n.ISOWeek?Ol(e):wi(e,n),i=qi(r,o),s=[],a=0;a<=i;a++)s.push(Xn(o,a));var l=s.reduce(function(c,u){var f=n!=null&&n.ISOWeek?YV(u):t9(u,n),h=c.find(function(p){return p.weekNumber===f});return h?(h.dates.push(u),c):(c.push({weekNumber:f,dates:[u]}),c)},[]);return l}function CU(e,t){var n=lN(yr(e),sS(e),t);if(t!=null&&t.useFixedWeeks){var r=r9(e,t);if(r<6){var o=n[n.length-1],i=o.dates[o.dates.length-1],s=Ib(i,6-r),a=lN(Ib(i,1),s,t);n.push.apply(n,a)}}return n}function NU(e){var t,n,r,o=kt(),i=o.locale,s=o.classNames,a=o.styles,l=o.hideHead,c=o.fixedWeeks,u=o.components,f=o.weekStartsOn,h=o.firstWeekContainsDate,p=o.ISOWeek,m=CU(e.displayMonth,{useFixedWeeks:!!c,ISOWeek:p,locale:i,weekStartsOn:f,firstWeekContainsDate:h}),v=(t=u==null?void 0:u.Head)!==null&&t!==void 0?t:B9,x=(n=u==null?void 0:u.Row)!==null&&n!==void 0?n:EU,b=(r=u==null?void 0:u.Footer)!==null&&r!==void 0?r:F9;return d.jsxs("table",{id:e.id,className:s.table,style:a.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!l&&d.jsx(v,{}),d.jsx("tbody",{className:s.tbody,style:a.tbody,children:m.map(function(w){return d.jsx(x,{displayMonth:e.displayMonth,dates:w.dates,weekNumber:w.weekNumber},w.weekNumber)})}),d.jsx(b,{displayMonth:e.displayMonth})]})}function PU(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var _U=PU()?g.useLayoutEffect:g.useEffect,Lx=!1,jU=0;function cN(){return"react-day-picker-".concat(++jU)}function TU(e){var t,n=e??(Lx?cN():null),r=g.useState(n),o=r[0],i=r[1];return _U(function(){o===null&&i(cN())},[]),g.useEffect(function(){Lx===!1&&(Lx=!0)},[]),(t=e??o)!==null&&t!==void 0?t:void 0}function OU(e){var t,n,r=kt(),o=r.dir,i=r.classNames,s=r.styles,a=r.components,l=Qh().displayMonths,c=TU(r.id?"".concat(r.id,"-").concat(e.displayIndex):void 0),u=r.id?"".concat(r.id,"-grid-").concat(e.displayIndex):void 0,f=[i.month],h=s.month,p=e.displayIndex===0,m=e.displayIndex===l.length-1,v=!p&&!m;o==="rtl"&&(t=[p,m],m=t[0],p=t[1]),p&&(f.push(i.caption_start),h=Ae(Ae({},h),s.caption_start)),m&&(f.push(i.caption_end),h=Ae(Ae({},h),s.caption_end)),v&&(f.push(i.caption_between),h=Ae(Ae({},h),s.caption_between));var x=(n=a==null?void 0:a.Caption)!==null&&n!==void 0?n:L9;return d.jsxs("div",{className:f.join(" "),style:h,children:[d.jsx(x,{id:c,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),d.jsx(NU,{id:u,"aria-labelledby":c,displayMonth:e.displayMonth})]},e.displayIndex)}function MU(e){var t=kt(),n=t.classNames,r=t.styles;return d.jsx("div",{className:n.months,style:r.months,children:e.children})}function RU(e){var t,n,r=e.initialProps,o=kt(),i=pS(),s=Qh(),a=g.useState(!1),l=a[0],c=a[1];g.useEffect(function(){o.initialFocus&&i.focusTarget&&(l||(i.focus(i.focusTarget),c(!0)))},[o.initialFocus,l,i.focus,i.focusTarget,i]);var u=[o.classNames.root,o.className];o.numberOfMonths>1&&u.push(o.classNames.multiple_months),o.showWeekNumber&&u.push(o.classNames.with_weeknumber);var f=Ae(Ae({},o.styles.root),o.style),h=Object.keys(r).filter(function(m){return m.startsWith("data-")}).reduce(function(m,v){var x;return Ae(Ae({},m),(x={},x[v]=r[v],x))},{}),p=(n=(t=r.components)===null||t===void 0?void 0:t.Months)!==null&&n!==void 0?n:MU;return d.jsx("div",Ae({className:u.join(" "),style:f,dir:o.dir,id:o.id,nonce:r.nonce,title:r.title,lang:r.lang},h,{children:d.jsx(p,{children:s.displayMonths.map(function(m,v){return d.jsx(OU,{displayIndex:v,displayMonth:m},v)})})}))}function AU(e){var t=e.children,n=i9(e,["children"]);return d.jsx(HM,{initialProps:n,children:d.jsx(R9,{children:d.jsx(pU,{initialProps:n,children:d.jsx(U9,{initialProps:n,children:d.jsx(K9,{initialProps:n,children:d.jsx(eU,{children:d.jsx(fU,{children:t})})})})})})})}function IU(e){return d.jsx(AU,Ae({},e,{children:d.jsx(RU,{initialProps:e})}))}const eR=y.string().uuid().refine(e=>!0),DU=y.union([y.object({type:y.literal("patches"),patches:y.array(eR)}),y.object({type:y.literal("deployment"),deployment:IM}),y.object({type:y.literal("commit"),commit:oS}),y.object({type:y.literal("subscribed")}),y.object({type:y.literal("error"),message:y.string(),reconnect:y.boolean().optional()})]);y.object({type:y.union([y.literal("did-change"),y.literal("no-change"),y.literal("request-again"),y.literal("use-websocket")]),profileId:y.string().nullable(),config:y.object({project:y.string().optional(),files:y.object({directory:y.string()}).optional()}),commitSha:y.string().optional(),sourcesSha:y.string(),schemaSha:y.string(),baseSha:y.string(),patches:y.array(eR),commits:y.array(oS).optional(),deployments:y.array(IM).optional(),mode:y.union([y.literal("fs"),y.literal("http")])});function LU(e){const[t,n]=g.useState({status:"not-asked"}),r=g.useRef(null),{authenticationState:o,setAuthenticationLoadingIfNotAuthenticated:i,setIsAuthenticated:s}=FU(),[a,l]=g.useState(),c=g.useRef(0);return g.useEffect(()=>{if(t.status==="updated-request-again"||t.status==="error"||t.status==="ws-message-received")if(t.wait===0)console.debug("Executing stat immediately",t.status,t.status==="error"?t.error:"no error","Now:",Date.now()),Fx(e,r,c,t,n,i,s,l);else{console.debug("Executing stat in ",t.wait," status: ",t.status,"Now:",Date.now());const u=setTimeout(()=>{Fx(e,r,c,t,n,i,s,l)},t.wait);return()=>clearTimeout(u)}},[e,t]),g.useEffect(()=>{t.status==="not-asked"&&(n({status:"initializing"}),console.debug("Initializing stat"),Fx(e,r,c,t,n,i,s,l))},[e,t.status]),[t,n,o,i,s,a]}const Cd=10*1e3;async function Fx(e,t,n,r,o,i,s,a){const l=++n.current;let c=null;return"data"in r&&r.data&&(c={schemaSha:r.data.schemaSha,sourcesSha:r.data.sourcesSha,baseSha:r.data.baseSha,patches:r.data.patches}),i(),e("/stat","POST",{body:c}).then(u=>{if(u.status===401){s("login-required");return}else s("authorized");if(u.status===503){a(!0),o(f=>({status:"error",error:"Service unavailable",retries:("retries"in f?f.retries:0)+1,waitStart:Date.now(),wait:5e3}));return}if(a(!1),!(n.current!==0&&n.current!==l))if(u.status===200){if(u.json.type==="did-change"||u.json.type==="no-change"||u.json.type==="request-again")o({status:"updated-request-again",data:u.json,waitStart:Date.now(),wait:t.current?Cd:0});else if(u.json.type==="use-websocket"){o(m=>({...m,status:"updated-request-again",data:u.json,waitStart:Date.now(),wait:Cd})),t.current&&(console.debug("Closing existing WebSocket"),t.current.close());const f=u.json.url;console.debug("Connecting to WebSocket",f),t.current=new WebSocket(f);const h=u.json.nonce;t.current.onopen=()=>{var m;(m=t.current)==null||m.send(JSON.stringify({nonce:h,type:"subscribe"}))},t.current.onmessage=m=>{try{const v=DU.safeParse(JSON.parse(m.data));if(!v.success){console.error("Could not parse WebSocket message",v.error);return}const x=v.data;x.type==="error"?o(b=>Nd(b,x.message)):x.type==="patches"?o(b=>"data"in b&&b.data?{status:"ws-message-received",data:{...b.data,patches:x.patches},waitStart:"waitStart"in b?b.waitStart:Date.now(),wait:"waitStart"in b?Math.max(0,Date.now()-b.waitStart):Cd}:b):x.type==="subscribed"?console.debug("Subscribed!"):x.type==="commit"?(console.debug("Commit",x.commit),o(b=>"data"in b&&b.data?{status:"ws-message-received",data:{...b.data,commits:(b.data.commits||[]).concat(x.commit)},waitStart:"waitStart"in b?b.waitStart:Date.now(),wait:"waitStart"in b?Math.max(0,Date.now()-b.waitStart):Cd}:b)):x.type==="deployment"?(console.debug("Deployment",x.deployment),o(b=>"data"in b&&b.data?{status:"ws-message-received",data:{...b.data,deployments:(b.data.deployments||[]).concat({commitSha:x.deployment.commitSha,deploymentId:x.deployment.deploymentId,deploymentState:x.deployment.deploymentState,createdAt:x.deployment.createdAt,updatedAt:x.deployment.updatedAt})},waitStart:"waitStart"in b?b.waitStart:Date.now(),wait:"waitStart"in b?Math.max(0,Date.now()-b.waitStart):Cd}:b)):console.warn("Unknown WebSocket message",x)}catch(v){console.error("Could not parse WebSocket message",v)}};const p=t.current;t.current.onclose=()=>{p===t.current&&(console.debug("WebSocket closed"),o(m=>Nd(m,"WebSocket closed")))},t.current.onerror=()=>{console.warn("WebSocket error"),o(m=>Nd(m,"Got an error while syncing with Val (reason: WebSocket error)"))}}}else o(f=>Nd(f,u.json.message))}).catch(u=>{n.current!==0&&n.current!==l||o(f=>Nd(f,u.message))})}function Nd(e,t){const n="retries"in e?e.retries+1:0,r=e.status==="error"&&e.retries>1?Math.min(500,e.retries*50+Math.floor(Math.random()*100))*10:0;return{status:"error",error:t,data:"data"in e?e.data:void 0,retries:n,waitStart:"waitStart"in e?e.waitStart:Date.now(),wait:r}}function FU(){const[e,t]=g.useState("not-asked"),n=g.useCallback(()=>{e==="not-asked"&&t("loading")},[e]);return{authenticationState:e,setIsAuthenticated:t,setAuthenticationLoadingIfNotAuthenticated:n}}function zd(e){var t,n,r,o,i;if(e.type==="file")return!!e.remote;if(e.type==="image")return!!e.remote;if(e.type==="richtext")return!!(typeof((n=(t=e.options)==null?void 0:t.inline)==null?void 0:n.img)!="boolean"&&((i=(o=(r=e.options)==null?void 0:r.inline)==null?void 0:o.img)!=null&&i.remote));if(e.type==="array")return zd(e.item);if(e.type==="record")return zd(e.item);if(e.type==="union"){for(const s of e.items)if(zd(s))return!0;return!1}else if(e.type==="object"){for(const s in e.items)if(zd(e.items[s]))return!0;return!1}else{if(e.type==="boolean"||e.type==="number"||e.type==="string"||e.type==="date"||e.type==="keyOf"||e.type==="literal")return!1;{const s=e;return console.error(`Val: requiresRemoteFiles: unexpected schema type ${typeof s=="object"&&"type"in s&&s.type}`,e),null}}}function hn(e){for(var t=e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];for(var i=0,s=r;i<s.length;i++){var a=s[i];t=a(t)}return t}function tR(e){return q1(e)}function xu(e,t){if(e===t)return!0;if(ie(e)==="object"&&ie(t)==="object"&&e!==null&&t!==null){if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)if(!xu(e[n],t[n]))return!1;return!0}else if(!Array.isArray(e)&&!Array.isArray(t)){var r=Object.entries(e);if(r.length!==Object.keys(t).length)return!1;for(var o=0,i=r;o<i.length;o++){var s=jn(i[o],2),a=s[0],l=s[1],c=t[a];if(c===void 0||!xu(l,c))return!1}return!0}}return!1}function oo(e){return Array.isArray(e)?e.map(oo):ie(e)==="object"&&e!==null?Object.fromEntries(Object.entries(e).map(function(t){var n=jn(t,2),r=n[0],o=n[1];return[r,oo(o)]})):e}function gS(e){return/^(0|[1-9][0-9]*)$/g.test(e)?_n(Number(e)):Hn(new Hr('Invalid array index "'.concat(e,'"')))}function zU(e,t){return e==="-"?_n(t.length):hn(gS(e),Wv(function(n){return n<=t.length},function(){return new Hr("Array index out of bounds")}))}function nR(e,t){return hn(gS(e),Wv(function(n){return n<t.length},function(){return new Hr("Array index out of bounds")}))}function $U(e,t,n){if(Array.isArray(e))return hn(nR(t,e),co(function(o){var i=e[o];return e[o]=n,i}));if(ie(e)==="object"&&e!==null)if(Object.prototype.hasOwnProperty.call(e,t)){var r=e[t];return e[t]=n,_n(r)}else return Hn(new Hr("Cannot replace object element which does not exist"));return Hn(new Hr("Cannot replace in non-object/array"))}function BU(e,t,n){return tR(t)?hn(vS(e,t),Pl(function(r){var o=jn(r,2),i=o[0],s=o[1];return $U(i,s,n)}),co(function(r){return[e,r]})):_n([n,e])}function rR(e,t){return Array.isArray(e)?hn(gS(t),Pl(function(n){return n>=e.length?Hn(new Hr("Array index out of bounds")):_n(e[n])})):ie(e)==="object"&&e!==null?Object.prototype.hasOwnProperty.call(e,t)?_n(e[t]):_n(void 0):Hn(new Hr("Cannot access non-object/array"))}function vS(e,t){for(var n=e,r=t[0],o=0;o<t.length-1;++o,r=t[o]){var i=rR(n,r);if(Uv(i))return i;if(i.value===void 0)return Hn(new Hr("Path refers to non-existing object/array"));n=i.value}return _n([n,r])}function zx(e,t){return hn(t,Y1(function(n,r){return hn(rR(n,r),Wv(function(o){return o!==void 0},function(){return new Hr("Path refers to non-existing object/array")}))},e))}function VU(e,t){if(Array.isArray(e))return hn(nR(t,e),co(function(r){var o=e.splice(r,1),i=jn(o,1),s=i[0];return s}));if(ie(e)==="object"&&e!==null&&Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];return delete e[t],_n(n)}return Hn(new Hr("Cannot remove from non-object/array"))}function uN(e,t){return hn(vS(e,t),Pl(function(n){var r=jn(n,2),o=r[0],i=r[1];return VU(o,i)}))}function UU(e,t,n){if(Array.isArray(e))return hn(zU(t,e),co(function(o){e.splice(o,0,n)}));if(ie(e)==="object"&&e!==null){var r;return Object.prototype.hasOwnProperty.call(e,t)&&(r=e[t]),e[t]=n,_n(r)}return Hn(new Hr("Cannot add to non-object/array"))}function $x(e,t,n){return tR(t)?hn(vS(e,t),Pl(function(r){var o=jn(r,2),i=o[0],s=o[1];return UU(i,s,n)}),co(function(r){return[e,r]})):_n([n,e])}function Xp(e){var t=jn(e,1),n=t[0];return n}var WU=function(){function e(){Rn(this,e)}return An(e,[{key:"get",value:function(n,r){return zx(n,r)}},{key:"add",value:function(n,r,o){return hn($x(n,r,o),co(Xp))}},{key:"remove",value:function(n,r){return hn(uN(n,r),co(function(){return n}))}},{key:"replace",value:function(n,r,o){return hn(BU(n,r,o),co(Xp))}},{key:"move",value:function(n,r,o){return hn(uN(n,r),Pl(function(i){return $x(n,o,i)}),co(Xp))}},{key:"copy",value:function(n,r,o){return hn(zx(n,r),Pl(function(i){return $x(n,o,oo(i))}),co(Xp))}},{key:"test",value:function(n,r,o){return hn(zx(n,r),co(function(i){return xu(o,i)}))}}])}();function HU(e,t,n){switch(n.op){case"add":return t.add(e,n.path,n.value);case"remove":return t.remove(e,n.path);case"replace":return t.replace(e,n.path,n.value);case"move":return t.move(e,n.from,n.path);case"copy":return t.copy(e,n.from,n.path);case"test":return t.test(e,n.path,n.value)?_n(e):Hn(new Hr("Test failed"));case"file":return Hn(new Hr("Cannot apply a file patch here"))}}function KU(e,t,n){return hn(n,Y1(function(r,o){return HU(r,t,o)},e))}function GU(e,t){return!e||!t?!1:e.length===1&&e[0].op==="replace"&&t.length===1&&t[0].op==="replace"?e[0].path.join("/")===t[0].path.join("/"):!1}function wc(e,t){if(!t||t.length===0)return new Set([e.type]);const n=new Set;let r=e,o=-1;for(const i of t){if(o++,!r)break;if(r.type==="array")r=r.item;else if(r.type==="record")r=r.item;else if(r.type==="object")r=r.items[i];else if(r.type==="union")if(typeof r.key=="string"){const s=r.items;for(const a of s){const l=wc(a,t.slice(o));for(const c of Array.from(l.values()))n.add(c)}return n}else{if(o!==t.length-1)throw new Error("Found string union (primitive), but path has more parts: "+t.join("/")+" at "+i);break}else if(r.type==="boolean"||r.type==="number"||r.type==="string"||r.type==="date"||r.type==="file"||r.type==="image"||r.type==="keyOf"||r.type==="literal"||r.type==="richtext"){if((r.type==="image"||r.type==="file")&&t[o]==="metadata")break;if(o!==t.length-1)throw new Error("Found "+r.type+" (primitive), but path has more parts: "+t.join("/")+" at "+i);break}else{const a=r.type;return console.error(`Unexecpted resolved schema type: ${a} in ${t.join("/")} at ${i}`),new Set([a])}}return r&&(n.add(r.type),r.type==="union"&&(typeof r.key=="string"?n.add("object"):n.add("string"))),n}class Pd{constructor(){this.patchSetMetadata={},this.orderedInsertKeys=[],this.insertedPatches=new Set}reset(){this.patchSetMetadata={},this.orderedInsertKeys=[],this.insertedPatches=new Set}getInsertedPatches(){return this.insertedPatches}insertPath(t,n,r,o,i,s,a,l){let c=n.length>0?`${t}?${n.join("/")}`:t;const u=[];for(let f=this.orderedInsertKeys.length-1;f>=0;f--){const h=this.orderedInsertKeys[f];c!==h?c.startsWith(h)?(c=h,this.orderedInsertKeys.splice(f,1),this.orderedInsertKeys.unshift(c)):h.startsWith(c)&&u.push(f):(this.orderedInsertKeys.splice(f,1),this.orderedInsertKeys.unshift(c))}for(const f of u){const h=this.orderedInsertKeys[f];this.orderedInsertKeys.splice(f,1);const p=this.patchSetMetadata[h];if(this.patchSetMetadata[c]||(this.patchSetMetadata[c]={moduleFilePath:t,patchPath:n,patches:[],authors:[],opTypes:[],schemaTypes:Array.from(a),lastUpdated:o,lastUpdatedBy:i}),p)for(const m of p.patches.slice())this.patchSetMetadata[c].patches.unshift(m),m.author!==null&&this.patchSetMetadata[c].authors.unshift(m.author),this.patchSetMetadata[c].opTypes.unshift(m.opType);else throw new Error(`Could not find patch set metadata or patch metadata for (inserted) patch set path: ${h}`);h!==c&&delete this.patchSetMetadata[h]}this.patchSetMetadata[c]||(this.patchSetMetadata[c]={moduleFilePath:t,patchPath:n,patches:[],authors:[],opTypes:[],schemaTypes:a,lastUpdated:o,lastUpdatedBy:i}),i!==null&&!this.patchSetMetadata[c].authors.includes(i)&&this.patchSetMetadata[c].authors.unshift(i),this.patchSetMetadata[c].lastUpdatedBy=i,this.patchSetMetadata[c].lastUpdated=o,this.patchSetMetadata[c].opTypes.includes(s)||this.patchSetMetadata[c].opTypes.unshift(s),this.patchSetMetadata[c].patches.unshift({patchPath:l,patchId:r,author:i,createdAt:o,opType:s,schemaTypes:a}),this.orderedInsertKeys.includes(c)||this.orderedInsertKeys.unshift(c)}insert(t,n,r,o,i,s){if(!this.insertedPatches.has(o)){if(!n){this.insertPath(t,[],o,i,s,r.op,[],r.path);return}if(this.insertedPatches.add(o),!(r.op==="file"||r.op==="test"))try{if(r.op==="replace"){const a=wc(n,r.path);this.insertPath(t,r.path,o,i,s,r.op,Array.from(a),r.path)}else if(r.op==="add"||r.op==="remove"||r.op==="move"||r.op==="copy"){const a=r.path.slice(0,-1),l=wc(n,a);if(l.size===1&&l.has("array")){if(this.insertPath(t,a,o,i,s,r.op,Array.from(l),r.path),r.op==="move"){const c=r.from.slice(0,-1),u=wc(n,c);this.insertPath(t,c,o,i,s,r.op,Array.from(u),r.path)}}else if(l.size===1&&l.has("record")){const c=r.path,u=wc(n,c);if(this.insertPath(t,c,o,i,s,r.op,Array.from(u),r.path),r.op==="move"){const f=r.from,h=wc(n,f);this.insertPath(t,f,o,i,s,r.op,Array.from(h),r.path)}}else{if(l.size===1&&!(l.has("image")||l.has("file")))throw new Error(`Cannot perform op: '${r.op}' on non-array or non-record schema. Type: ${l.values().next().value}`);this.insertPath(t,a,o,i,s,r.op,[n.type],r.path)}}else{const a=r;throw new Error("Unreachable op: "+a)}}catch(a){a instanceof Error?console.error("Could not resolve path while creating patch set",a.message):console.error("Could not resolve path while creating patch set",a),this.insertPath(t,[],o,i,s,r.op,[n.type],r.path)}}}isInserted(t){return this.insertedPatches.has(t)}serialize(){return this.orderedInsertKeys.map(t=>{if(t in this.patchSetMetadata)return this.patchSetMetadata[t];throw new Error(`Could not find patch set metadata or patch metadata for (inserted) patch set path: ${t}`)})}}class qU{constructor(t,n=void 0){this.client=t,this.overlayEmitter=n,this.autoPublish=!1,this.multipleSourcesSep="|",this.isSyncing=!1,this.MIN_WAIT_SECONDS=1,this.MAX_WAIT_SECONDS=5,this.initializedAt=null,this.forceSyncAllModules=!0,this.errors={},this.listeners={},this.syncStatus={},this.schemas=null,this.serverSideSchemaSha=null,this.clientSideSchemaSha=null,this.baseSha=null,this.sourcesSha=null,this.mode=null,this.optimisticClientSources={},this.serverSources=null,this.renders=null,this.globalServerSidePatchIds=[],this.syncedServerSidePatchIds=[],this.savedButNotYetGlobalServerSidePatchIds=[],this.pendingOps=[],this.pendingClientPatchIds=[],this.patchDataByPatchId={},this.isSyncing=!1,this.patchSets=new Pd,this.authorId=null,this.publishDisabled=!0,this.isPublishing=!1,this.commitSha=null,this.cachedSourceSnapshots=null,this.cachedSchemaSnapshots=null,this.cachedRenderSnapshots=null,this.cachedPatchData=null,this.cachedSerializedPatchSetsSnapshot=null,this.cachedValidationErrors=null,this.cachedAllSchemasSnapshot=null,this.cachedGlobalServerSidePatchIdsSnapshot=null,this.cachedPendingClientSidePatchIdsSnapshot=null,this.cachedSyncedServerSidePatchIdsSnapshot=null,this.cachedSavedServerSidePatchIdsSnapshot=null,this.cachedAllSourcesSnapshot=null,this.cachedSourcesSnapshot=null,this.cachedSyncStatus=null,this.cachedPendingOpsCountSnapshot=null,this.cachedInitializedAtSnapshot=null,this.cachedAutoPublishSnapshot=null,this.cachedPublishDisabledSnapshot=null,this.cachedGlobalTransientErrorSnapshot=null,this.cachedParentRef=void 0,this.cachedPatchErrorsSnapshot=null}setAutoPublish(t,n){this.autoPublish=n;try{localStorage.setItem("val-auto-publish",n.toString())}catch{}return this.invalidateAutoPublish(),this.sync(t)}loadAutoPublish(){try{this.autoPublish=localStorage.getItem("val-auto-publish")==="true",this.invalidateAutoPublish()}catch{}}async init(t,n,r,o,i,s,a,l){this.mode=t,this.baseSha=n,this.commitSha=a,this.sourcesSha=o,this.authorId=s;const c=Date.now();t==="fs"?this.loadAutoPublish():this.autoPublish=!1;const u=await this.syncWithUpdatedStat(t,n,r,o,i,s,a,l);return u.status==="done"&&(await this.syncPatches(!0,l),this.publishDisabled=!1,this.invalidatePublishDisabled(),this.initializedAt=l+(Date.now()-c),this.invalidateInitializedAt()),u}reset(){console.debug("Resetting ValSyncEngine"),this.initializedAt=null,this.forceSyncAllModules=!0,this.errors={},this.listeners={},this.syncStatus={},this.schemas=null,this.serverSideSchemaSha=null,this.clientSideSchemaSha=null,this.sourcesSha=null,this.optimisticClientSources={},this.serverSources=null,this.renders=null,this.globalServerSidePatchIds=[],this.syncedServerSidePatchIds=[],this.savedButNotYetGlobalServerSidePatchIds=[],this.pendingOps=[],this.pendingClientPatchIds=[],this.patchDataByPatchId={},this.isSyncing=!1,this.patchSets=new Pd,this.authorId=null,this.publishDisabled=!0,this.isPublishing=!1,this.commitSha=null,this.cachedSourceSnapshots=null,this.cachedSchemaSnapshots=null,this.cachedRenderSnapshots=null,this.cachedPatchData=null,this.cachedSerializedPatchSetsSnapshot=null,this.cachedValidationErrors=null,this.cachedAllSchemasSnapshot=null,this.cachedGlobalServerSidePatchIdsSnapshot=null,this.cachedPendingClientSidePatchIdsSnapshot=null,this.cachedSyncedServerSidePatchIdsSnapshot=null,this.cachedSavedServerSidePatchIdsSnapshot=null,this.cachedAllSourcesSnapshot=null,this.cachedSyncStatus=null,this.cachedPendingOpsCountSnapshot=null,this.cachedInitializedAtSnapshot=null,this.cachedAutoPublishSnapshot=null,this.cachedPublishDisabledSnapshot=null,this.cachedGlobalTransientErrorSnapshot=null,this.cachedParentRef=void 0,this.cachedPatchErrorsSnapshot=null,this.invalidateInitializedAt()}subscribe(t,n){const r=n||Sn;return o=>{const i=this.listeners;if(i[t]||(i[t]={}),Array.isArray(r)){const s=[];for(const a of r){i[t][a]||(i[t][a]=[]);const l=i[t][a].push(o)-1;s.push(l)}return()=>{var a,l;for(const c of s)(l=(a=i[t])==null?void 0:a[r[c]])==null||l.splice(c,1)}}else{i[t][r]||(i[t][r]=[]);const s=i[t][r].push(o)-1;return()=>{var a;(a=i[t])==null||a[r].splice(s,1)}}}}emit(t){if(t)for(const n of t)n()}setCommitSha(t){this.commitSha=t}invalidateInitializedAt(){var t;this.cachedInitializedAtSnapshot=null,this.emit((t=this.listeners["initialized-at"])==null?void 0:t[Sn])}invalidateSource(t){var n,r,o;this.cachedSourceSnapshots!==null&&(this.cachedSourceSnapshots={...this.cachedSourceSnapshots,[t]:void 0}),this.cachedAllSourcesSnapshot=null,this.cachedSourcesSnapshot=null,this.emit((n=this.listeners.sources)==null?void 0:n[t]),this.emit((r=this.listeners.source)==null?void 0:r[t]),this.emit((o=this.listeners["all-sources"])==null?void 0:o[Sn])}invalidatePatchErrors(t){var n;this.cachedPatchErrorsSnapshot=null,this.emit((n=this.listeners["patch-errors"])==null?void 0:n[t])}invalidateRenders(t){var n;this.cachedSourceSnapshots===null&&(this.cachedSourceSnapshots={}),this.cachedRenderSnapshots={...this.cachedRenderSnapshots,[t]:null},this.emit((n=this.listeners.render)==null?void 0:n[t])}invalidateSyncStatus(t){var n;this.cachedSyncStatus={...this.cachedSyncStatus,[t]:void 0},this.emit((n=this.listeners["sync-status"])==null?void 0:n[t])}invalidateValidationError(t){var n;this.emit((n=this.listeners["validation-error"])==null?void 0:n[t])}invalidateAllValidationErrors(){var t;this.cachedValidationErrors=null,this.emit((t=this.listeners["all-validation-errors"])==null?void 0:t[Sn])}invalidateGlobalTransientErrors(){var t;this.cachedGlobalTransientErrorSnapshot=null,this.emit((t=this.listeners["global-transient-errors"])==null?void 0:t[Sn])}invalidateNetworkError(){var t;this.cachedNetworkErrorSnapshot=void 0,this.emit((t=this.listeners["network-error"])==null?void 0:t[Sn])}invalidatePatchSets(){var t;this.cachedSerializedPatchSetsSnapshot=null,this.emit((t=this.listeners["patch-sets"])==null?void 0:t[Sn])}invalidatePendingOps(){var t;this.cachedPendingOpsCountSnapshot=null,this.emit((t=this.listeners["pending-ops-count"])==null?void 0:t[Sn])}invalidateAllPatches(){var t;this.cachedPatchData=null,this.emit((t=this.listeners["all-patches"])==null?void 0:t[Sn])}invalidateSchema(){var t,n;this.cachedAllSchemasSnapshot=null,this.cachedSchemaSnapshots=null,this.cachedAllSourcesSnapshot=null,this.emit((t=this.listeners.schema)==null?void 0:t[Sn]),this.invalidateAllValidationErrors();for(const r in((n=this.listeners)==null?void 0:n["validation-error"])||{}){const o=r;this.invalidateValidationError(o)}}invalidateParentRef(){var t;this.cachedParentRef=void 0,this.emit((t=this.listeners["parent-ref"])==null?void 0:t[Sn])}invalidateGlobalServerSidePatchIds(){var t;this.cachedGlobalServerSidePatchIdsSnapshot=null,this.invalidateParentRef(),this.emit((t=this.listeners["global-server-side-patch-ids"])==null?void 0:t[Sn])}invalidatePendingClientSidePatchIds(){var t;this.cachedPendingClientSidePatchIdsSnapshot=null,this.emit((t=this.listeners["pending-client-side-patch-ids"])==null?void 0:t[Sn])}invalidateSyncedServerSidePatchIds(){var t;this.cachedSyncedServerSidePatchIdsSnapshot=null,this.emit((t=this.listeners["synced-server-side-patch-ids"])==null?void 0:t[Sn])}invalidateSavedServerSidePatchIds(){var t;this.cachedSavedServerSidePatchIdsSnapshot=null,this.invalidateParentRef(),this.emit((t=this.listeners["saved-server-side-patch-ids"])==null?void 0:t[Sn])}invalidatePublishDisabled(){var t;this.cachedPublishDisabledSnapshot=null,this.emit((t=this.listeners["publish-disabled"])==null?void 0:t[Sn])}invalidateAutoPublish(){var t;this.cachedAutoPublishSnapshot=null,this.emit((t=this.listeners["auto-publish"])==null?void 0:t[Sn])}getSchemaSnapshot(t){if(this.cachedSchemaSnapshots===null&&(this.cachedSchemaSnapshots={}),this.cachedSchemaSnapshots[t]===void 0)if(!this.schemas)this.cachedSchemaSnapshots[t]={status:"no-schemas"};else{const n=this.schemas[t];n?this.cachedSchemaSnapshots[t]={status:"success",data:oo(n)}:this.cachedSchemaSnapshots[t]={status:"module-schema-not-found"}}return this.cachedSchemaSnapshots[t]}getRenderSnapshot(t){var n;return this.cachedRenderSnapshots===null&&(this.cachedRenderSnapshots={}),this.cachedRenderSnapshots[t]===null&&(this.cachedRenderSnapshots[t]=((n=this.renders)==null?void 0:n[t])||null),this.cachedRenderSnapshots[t]}getSourceSnapshot(t){var n;if(this.cachedSourceSnapshots===null&&(this.cachedSourceSnapshots={}),this.cachedSourceSnapshots[t]===void 0){const r=this.optimisticClientSources[t]!==void 0?this.optimisticClientSources[t]:(n=this.serverSources)==null?void 0:n[t];this.schemas===null?this.cachedSourceSnapshots[t]={status:"no-schemas"}:this.schemas[t]?r===void 0?this.cachedSourceSnapshots[t]={status:"source-not-found"}:this.cachedSourceSnapshots[t]={status:"success",data:oo(r),optimistic:this.optimisticClientSources[t]!==void 0}:this.cachedSourceSnapshots[t]={status:"schema-not-found"}}return this.cachedSourceSnapshots[t]}getAllSourcesSnapshot(){var t;if(this.cachedAllSourcesSnapshot===null){this.cachedAllSourcesSnapshot={};for(const n in this.schemas||{}){const r=n,o=this.optimisticClientSources[r]||((t=this.serverSources)==null?void 0:t[r]);o!==void 0&&(this.cachedAllSourcesSnapshot[r]=oo(o))}}return this.cachedAllSourcesSnapshot}getSourcesSnapshot(t){var r;const n=t.sort().map(o=>o+this.multipleSourcesSep).join(this.multipleSourcesSep);if(this.cachedSourcesSnapshot===null&&(this.cachedSourcesSnapshot={}),this.cachedSourcesSnapshot[n]===void 0)for(const o of t){const i=this.optimisticClientSources[o]||((r=this.serverSources)==null?void 0:r[o]);i!==void 0&&(this.cachedSourcesSnapshot[n]=[...this.cachedSourcesSnapshot[n]||[],oo(i)])}return this.cachedSourcesSnapshot[n]}getAllSchemasSnapshot(){var t;this.cachedAllSchemasSnapshot===null&&(this.cachedAllSchemasSnapshot={});for(const n in this.schemas||{}){const r=n,o=(t=this.schemas)==null?void 0:t[r];o&&(this.cachedAllSchemasSnapshot[r]=oo(o))}return this.cachedAllSchemasSnapshot}getValidationErrorSnapshot(t){const n=this.getAllValidationErrorsSnapshot();return n==null?void 0:n[t]}getAllValidationErrorsSnapshot(){if(!this.cachedValidationErrors){this.cachedValidationErrors={};for(const t in this.errors.validationErrors){const n=t,r=[];for(const o of this.errors.validationErrors[n]||[])o&&r.push(o);r.length>0&&(this.cachedValidationErrors[n]=r)}}return this.cachedValidationErrors}getSyncStatusSnapshot(t){return this.cachedSyncStatus===null&&(this.cachedSyncStatus={}),this.cachedSyncStatus[t]===void 0&&(this.cachedSyncStatus[t]=this.syncStatus[t]||null),this.cachedSyncStatus[t]}getPendingOpsSnapshot(){return this.cachedPendingOpsCountSnapshot===null&&(this.cachedPendingOpsCountSnapshot=this.pendingOps.length),this.cachedPendingOpsCountSnapshot}getSerializedPatchSetsSnapshot(){return this.cachedSerializedPatchSetsSnapshot||(this.cachedSerializedPatchSetsSnapshot=this.patchSets.serialize()),this.cachedSerializedPatchSetsSnapshot}getInitializedAtSnapshot(){return this.cachedInitializedAtSnapshot===null&&(this.cachedInitializedAtSnapshot={data:this.initializedAt}),this.cachedInitializedAtSnapshot}getPatchErrorsSnapshot(t){var r;const n=t.sort().join("|");if(this.cachedPatchErrorsSnapshot===null){this.cachedPatchErrorsSnapshot={};const o={};let i=!1;for(const s of t)(r=this.errors.patchErrors)!=null&&r[s]&&(o[s]={...o[s]||{},...oo(this.errors.patchErrors[s])},i=!0);i&&(this.cachedPatchErrorsSnapshot[n]=o)}return this.cachedPatchErrorsSnapshot[n]}getAllPatchesSnapshot(){if(!this.cachedPatchData){this.cachedPatchData={};for(const t in this.patchDataByPatchId){const n=t,r=this.patchDataByPatchId[n];r&&(this.cachedPatchData[n]=oo(r))}}return this.cachedPatchData}getGlobalServerSidePatchIdsSnapshot(){var t;return this.cachedGlobalServerSidePatchIdsSnapshot===null&&(this.cachedGlobalServerSidePatchIdsSnapshot=((t=this.globalServerSidePatchIds)==null?void 0:t.slice())||[]),this.cachedGlobalServerSidePatchIdsSnapshot}getPendingClientSidePatchIdsSnapshot(){var t;return this.cachedPendingClientSidePatchIdsSnapshot===null&&(this.cachedPendingClientSidePatchIdsSnapshot=((t=this.pendingClientPatchIds)==null?void 0:t.slice())||[]),this.cachedPendingClientSidePatchIdsSnapshot}getSyncedServerSidePatchIdsSnapshot(){var t;return this.cachedSyncedServerSidePatchIdsSnapshot===null&&(this.cachedSyncedServerSidePatchIdsSnapshot=((t=this.syncedServerSidePatchIds)==null?void 0:t.slice())||[]),this.cachedSyncedServerSidePatchIdsSnapshot}getSavedServerSidePatchIdsSnapshot(){var t;return this.cachedSavedServerSidePatchIdsSnapshot===null&&(this.cachedSavedServerSidePatchIdsSnapshot=((t=this.savedButNotYetGlobalServerSidePatchIds)==null?void 0:t.slice())||[]),this.cachedSavedServerSidePatchIdsSnapshot}getPublishDisabledSnapshot(){return this.cachedPublishDisabledSnapshot===null&&(this.cachedPublishDisabledSnapshot=this.publishDisabled),this.cachedPublishDisabledSnapshot}getAutoPublishSnapshot(){return this.cachedAutoPublishSnapshot===null&&(this.cachedAutoPublishSnapshot=this.autoPublish),this.cachedAutoPublishSnapshot}getGlobalTransientErrorsSnapshot(){var t;return this.cachedGlobalTransientErrorSnapshot===null&&(this.cachedGlobalTransientErrorSnapshot=((t=this.errors.globalTransientErrorQueue)==null?void 0:t.slice())||[]),this.cachedGlobalTransientErrorSnapshot}getNetworkErrorSnapshot(){return this.cachedNetworkErrorSnapshot===void 0&&(this.cachedNetworkErrorSnapshot=this.errors.hasNetworkErrorTimestamp||null),this.cachedNetworkErrorSnapshot}getParentRefSnapshot(){return this.cachedParentRef===void 0&&(this.cachedParentRef=this.getParentRef()),this.cachedParentRef}addPatchOnClientOnly(t,n,r){var a;const[o]=Y.splitModuleFilePathAndModulePath(t);if(this.serverSources===null||((a=this.serverSources)==null?void 0:a[o])===void 0)return this.addGlobalTransientError(`Content at '${o}' is not yet initialized`,r),{status:"patch-error",message:`Content at '${o}' is not yet initialized`,moduleFilePath:o};this.optimisticClientSources[o]===void 0&&(this.optimisticClientSources[o]=this.serverSources[o]);const i=n.filter(l=>l.op!=="file"),s=KU(oo(this.optimisticClientSources[o]),YU,i);if(f$.isErr(s))return console.error("Could not apply patch:",s.error),this.addGlobalTransientError(`Could apply patch: ${s.error.message}`,r),{status:"patch-error",message:s.error.message,moduleFilePath:o};{const l=s.value,c=oo(this.optimisticClientSources[o]);return this.optimisticClientSources[o]=l,{status:"optimistic-client-sources-updated",moduleFilePath:o,prevSource:c,patch:n}}}async addPatchAwaitable(t,n,r,o,i){const s=this.addPatchOnClientOnly(t,r,i);if(s.status!=="optimistic-client-sources-updated")return s;const{moduleFilePath:a,patch:l}=s,c={type:"add-patches",data:{[a]:[{patch:l,patchId:o,type:n}]},createdAt:i};let u=0;this.syncStatus[t]="patches-pending",this.invalidateSyncStatus(t);let f=await this.executeAddPatches(c,{},i);for(;f.status==="retry"&&u<3&&(u++,await new Promise(h=>setTimeout(h,500*(u+1))),f=await this.executeAddPatches(c,{},i),f.status==="retry"););return this.syncStatus[t]="done",this.invalidateSyncStatus(t),f.status==="done"?{status:"patch-synced",patchId:o,parentRef:f.parentRef,moduleFilePath:a}:(this.optimisticClientSources[a]=s.prevSource,{status:"patch-sync-error",message:"Could not sync patch. Tried 3 times.",moduleFilePath:a})}addPatch(t,n,r,o){var l,c,u,f,h,p,m,v,x,b,w;const i=this.addPatchOnClientOnly(t,r,o);if(i.status!=="optimistic-client-sources-updated")return i;const s=i.moduleFilePath;this.syncStatus[t]="patches-pending",this.invalidateSyncStatus(t);const a=this.pendingOps[this.pendingOps.length-1];if((a==null?void 0:a.type)==="add-patches"){const S=(((c=(l=a.data)==null?void 0:l[s])==null?void 0:c.length)||0)-1,C=(h=(f=(u=a.data)==null?void 0:u[s])==null?void 0:f[S])==null?void 0:h.patch,N=(v=(m=(p=a.data)==null?void 0:p[s])==null?void 0:m[S])==null?void 0:v.patchId;if(GU(C,r)&&((w=(b=(x=a.data)==null?void 0:x[s])==null?void 0:b[S])==null?void 0:w.type)===n&&N&&this.patchDataByPatchId[N])return a.data[s][S].patch=r,a.updatedAt=o,this.invalidatePendingOps(),this.patchDataByPatchId[N].patch=r,this.patchSetInsert(s,N,r,o),this.invalidateSyncStatus(t),this.invalidateSource(s),{status:"patch-merged",patchId:N,moduleFilePath:s};{a.data[s]||(a.data[s]=[]);const P=this.createPatchId();return a.data[s].push({patch:r,type:n,patchId:P}),this.invalidatePendingOps(),this.pendingClientPatchIds.push(P),this.invalidatePendingClientSidePatchIds(),this.patchDataByPatchId[P]={moduleFilePath:s,patch:r,isPending:!0,createdAt:new Date(o).toISOString(),authorId:this.authorId},this.patchSetInsert(s,P,r,o),this.invalidateSyncStatus(t),this.invalidateSource(s),{status:"patch-added",patchId:P,moduleFilePath:s}}}else{const S=this.createPatchId();return this.pendingOps.push({type:"add-patches",data:{[s]:[{patch:r,type:n,patchId:S}]},createdAt:o}),this.invalidatePendingOps(),this.pendingClientPatchIds.push(S),this.invalidatePendingClientSidePatchIds(),this.patchDataByPatchId[S]={moduleFilePath:s,patch:r,isPending:!0,createdAt:new Date(o).toISOString(),authorId:this.authorId},this.patchSetInsert(s,S,r,o),this.invalidateSyncStatus(t),this.invalidateSource(s),{status:"patch-added",patchId:S,moduleFilePath:s}}}createPatchId(){return crypto.randomUUID()}patchSetInsert(t,n,r,o){var s;const i=new Date(o).toISOString();for(const a of r)this.patchSets.insert(t,((s=this.schemas)==null?void 0:s[t])??void 0,a,n,i,this.authorId);this.invalidatePatchSets()}deletePatches(t,n){const r=this.pendingOps[this.pendingOps.length-1];if((r==null?void 0:r.type)==="delete-patches"){r.patchIds.push(...t),r.updatedAt=n;return}this.pendingOps.push({type:"delete-patches",patchIds:t,createdAt:n}),this.invalidatePendingOps()}markAllSyncStatusIn(t,n){for(const r in this.syncStatus)r.startsWith(t)&&(this.syncStatus[r]=n)}getParentRef(){if(this.baseSha===null||this.globalServerSidePatchIds===null)return null;const t=this.savedButNotYetGlobalServerSidePatchIds[this.savedButNotYetGlobalServerSidePatchIds.length-1]||this.globalServerSidePatchIds[this.globalServerSidePatchIds.length-1];return t?{type:"patch",patchId:t}:{type:"head",headBaseSha:this.baseSha}}async syncWithUpdatedStat(t,n,r,o,i,s,a,l){const c=this.sourcesSha!==o;if(this.sourcesSha=o,this.baseSha=n,this.mode=t,this.serverSideSchemaSha!==r||this.commitSha!==a)return this.reset(),this.serverSideSchemaSha=r,this.commitSha=a,this.init(t,n,r,o,i,s,a,l);const u=this.globalServerSidePatchIds===null||!xu(this.globalServerSidePatchIds,i);if(u){this.globalServerSidePatchIds=i;const f=new Set(i);this.deletePendingPatchId(f),this.deleteSavedButNotYetGlobalServerSidePatchIds(f),await this.syncPatches(!1,l),this.invalidateGlobalServerSidePatchIds(),this.invalidateSyncedServerSidePatchIds(),this.invalidateSavedServerSidePatchIds(),this.invalidatePendingClientSidePatchIds()}return!this.forceSyncAllModules&&(c||u)&&(this.forceSyncAllModules=!0),this.sync(l)}async executeAddPatches(t,n,r){const o=[],i=[];for(const[l,c]of Object.entries(t.data)){const u=l;for(const f of c)o.push({path:u,patchId:f.patchId,patch:f.patch}),i.push(f.patchId),n[u]||(n[u]=new Set),n[u].add(f.type)}const s=this.getParentRef();if(s===null)return this.addGlobalTransientError("Tried to update content with changes, but could not since Val is not yet initialized",r),{status:"retry",reason:"not-initialized"};const a=await this.client("/patches","PUT",{body:{patches:o,parentRef:s}});if(a.status!==null&&this.resetNetworkError(),a.status===null&&a.json.type==="network_error")return console.warn("Network error: trying again..."),this.addNetworkError(r),{status:"retry",reason:"network-error"};if(a.status===409)return this.savedButNotYetGlobalServerSidePatchIds=[],{status:"retry",reason:"conflict"};if(a.status!==200){console.error("Failed to add patches",{error:a.json.message}),this.addGlobalTransientError("Failed to save changes",r,a.json.message);for(const c of i)this.patchDataByPatchId={...this.patchDataByPatchId,[c]:void 0};const l=new Set(i);this.pendingClientPatchIds=this.pendingClientPatchIds.filter(c=>!l.has(c))}else{const l=new Set(a.json.newPatchIds);this.deletePendingPatchId(l);for(const c of i){const u=c;this.savedButNotYetGlobalServerSidePatchIds.push(u),this.patchDataByPatchId[u]&&(this.patchDataByPatchId[u].isPending=!1)}}return{status:"done",parentRef:s}}deletePendingPatchId(t){let n=0;for(let r=0;r<this.pendingClientPatchIds.length;r++){const o=this.pendingClientPatchIds[r];if(t.has(o)&&(this.pendingClientPatchIds.splice(r,1),r--,n++,t.size===n))break}}deleteSavedButNotYetGlobalServerSidePatchIds(t){let n=0;for(let r=0;r<this.savedButNotYetGlobalServerSidePatchIds.length;r++){const o=this.savedButNotYetGlobalServerSidePatchIds[r];if(t.has(o)&&(this.savedButNotYetGlobalServerSidePatchIds.splice(r,1),r--,n++,t.size===n))break}}async executeDeletePatches(t,n,r){var l;let o=!1;const i=t.patchIds,s=new Set(i),a=await this.client("/patches","DELETE",{query:{id:t.patchIds.reverse()}});if(a.status!==null&&this.resetNetworkError(),a.status===null&&a.json.type==="network_error")return this.addNetworkError(r),{status:"retry",reason:"network-error"};if(a.status!==200)this.addGlobalTransientError("Failed to delete patches",r);else{for(const c of t.patchIds)if(this.patchDataByPatchId[c]){const u=this.patchDataByPatchId[c].moduleFilePath;n[u]||(n[u]=new Set),n[u].add("unknown"),this.patchDataByPatchId={...this.patchDataByPatchId,[c]:void 0}}else o=!0;this.pendingClientPatchIds=this.pendingClientPatchIds.filter(c=>!s.has(c)),this.globalServerSidePatchIds=((l=this.globalServerSidePatchIds)==null?void 0:l.filter(c=>!s.has(c)))??null}return{status:"done",syncAllRequired:o}}async syncSchema(){const t=await this.client("/schema","GET",{});if(t.status===200){this.schemas={};for(const[n,r]of Object.entries(t.json.schemas)){const o=n;r&&(this.schemas[o]=r)}return this.clientSideSchemaSha!==t.json.schemaSha&&(this.clientSideSchemaSha=t.json.schemaSha),console.debug("Invalidating schema"),this.invalidateSchema(),{status:"done"}}else if(t.status===null)return{status:"retry",reason:"error"};return{status:"retry",reason:"error"}}async syncPatches(t,n){var l;const r=this.globalServerSidePatchIds||[];let o=!1,i=!1;if(this.initializedAt===null||t){this.patchSets=new Pd,o=!0;const c=await this.client("/patches","GET",{query:{exclude_patch_ops:!1,patch_id:void 0}});if(c.status!==200)return this.addGlobalTransientError("Failed to get changes (full sync)",n,`Did not get ok status (got: ${c.status}): ${c.json.message}`),{status:"retry"};for(const u of c.json.patches)u.patch&&(i=!0,this.patchDataByPatchId[u.patchId]={moduleFilePath:u.path,patch:u.patch,isPending:!1,createdAt:u.createdAt,authorId:u.authorId,isCommitted:u.appliedAt?{commitSha:u.appliedAt.commitSha}:void 0});c.json.error&&this.addGlobalTransientError("Some changes has errors",n,c.json.error.message);for(const u of Object.values(c.json.errors||{}))u&&this.addGlobalTransientError("A change has an error",n,u.message)}else{const c=[];for(const u of this.globalServerSidePatchIds||[])this.patchDataByPatchId[u]||c.push(u);if(c.length>0){const f=[];for(let h=0;h<c.length;h+=100)f.push(c.slice(h,h+100));for(const h of f){const p=await this.client("/patches","GET",{query:{exclude_patch_ops:!1,patch_id:h}});if(p.status!==200)return this.addGlobalTransientError("Failed to get changes (batch)",n,`Did not get ok status (got: ${p.status}): ${p.json.message}`),{status:"retry"};for(const m of p.json.patches)m.patch&&(i=!0,this.patchDataByPatchId[m.patchId]={moduleFilePath:m.path,patch:m.patch,isPending:!1,createdAt:m.createdAt,authorId:m.authorId,isCommitted:m.appliedAt?{commitSha:m.appliedAt.commitSha}:void 0})}}}const s=new Set(r);for(const c of Array.from(this.patchSets.getInsertedPatches())||[])if(!s.has(c)){this.patchSets=new Pd,o=!0;break}const a=[];for(const c of r)if(!this.patchSets.isInserted(c)){const u=this.patchDataByPatchId[c],f=(u==null?void 0:u.moduleFilePath)&&((l=this.schemas)==null?void 0:l[u==null?void 0:u.moduleFilePath]);if(u&&f)for(const h of u.patch)o=!0,this.patchSets.insert(u.moduleFilePath,f,h,c,u.createdAt,u.authorId);else a.push(c)}return i&&this.invalidateAllPatches(),o&&this.invalidatePatchSets(),a.length>0?(this.initializedAt!==null&&(console.debug("Missing data for patch ids",a,{currentPatchIds:r,reset:t}),this.mode!=="fs"&&this.addGlobalTransientError("Failed to get changes",n,`Missing data for patch ids: ${a.join(", ")}`)),{status:"retry"}):{status:"done"}}getChangedModules(t){const n=Object.entries(t);if(n.length===0)return[];if(n.length===1){const[r,o]=n[0];if(Array.from(o).every(i=>JU.includes(i)))return[r]}return"all"}async sync(t){var s,a,l,c,u,f,h,p,m;if(this.isSyncing)return{status:"retry",reason:"already-syncing"};if(this.isPublishing)return{status:"retry",reason:"publishing"};let n=[];this.forceSyncAllModules&&(this.forceSyncAllModules=!1,n="all"),this.initializedAt===null&&(n="all"),this.clientSideSchemaSha!==this.serverSideSchemaSha&&(n="all"),this.isSyncing=!0;let r=[],o=!1;const i=new Set([...this.syncedServerSidePatchIds,...this.savedButNotYetGlobalServerSidePatchIds]);if(this.globalServerSidePatchIds&&this.mode==="http"){for(const v of i)if(!this.globalServerSidePatchIds.includes(v)){this.syncedServerSidePatchIds=[],this.savedButNotYetGlobalServerSidePatchIds=[],this.pendingClientPatchIds=[],await this.syncPatches(!0,t),o=!0;break}}try{const v={},x=(S,C)=>t-C<=S*1e3,b=(S,C)=>t-C>=S*1e3;if(((s=this.pendingOps[this.pendingOps.length-1])==null?void 0:s.updatedAt)!==void 0&&x(this.MIN_WAIT_SECONDS,this.pendingOps[this.pendingOps.length-1].updatedAt)&&!b(this.MAX_WAIT_SECONDS,this.pendingOps[this.pendingOps.length-1].createdAt))return{status:"retry",reason:"too-fast"};r=this.pendingOps.slice(),this.pendingOps=[];let w=!1;for(;r[0];){const S=r[0];if(S.type==="add-patches")try{const C=await this.executeAddPatches(S,v,t);if(C.status!=="done")return C}catch{return{status:"retry",reason:"error"}}else if(S.type==="delete-patches")try{const C=await this.executeDeletePatches(S,v,t);if(C.status!=="done")return C;C.syncAllRequired&&n!=="all"&&(n="all")}catch{return{status:"retry",reason:"error"}}w=!0,r.shift()}if(this.invalidatePendingOps(),n!=="all"){const S=this.getChangedModules(v);if(S==="all")n="all";else for(const C of S)n.push(C)}if(this.clientSideSchemaSha===null||this.schemas===null||this.initializedAt===null){const S=await this.syncSchema();if(S.status!=="done")return S}if(n==="all"||n.length>0){const S=n!=="all"&&n.length===1?n[0]:void 0,C=await this.client("/sources/~","PUT",{path:S,query:{validate_sources:!0,validate_binary_files:!1}});if(C.status!==null&&this.resetNetworkError(),C.status===null&&C.json.type==="network_error")return this.addNetworkError(t),{status:"retry",reason:"network-error"};if(C.status!==200)this.addGlobalTransientError("Could not sync content with server. Please wait or reload the application.",t,C.json.message);else{const N=new Set;for(const P in this.errors.validationErrors){const _=P;(S===void 0||_.startsWith(S))&&(N.add(_),this.errors.validationErrors[_]&&(this.errors.validationErrors={...this.errors.validationErrors,[_]:void 0}))}for(const[P,_]of Object.entries(C.json.modules)){const O=P;if(_){this.serverSources===null&&(this.serverSources={}),this.serverSources[O]=_.source,this.renders===null&&(this.renders={}),this.renders[O]=_.render||null,this.invalidateRenders(O),(xu(this.serverSources[O],this.optimisticClientSources[O])||this.pendingOps.length===0)&&(this.optimisticClientSources={...this.optimisticClientSources,[O]:void 0}),console.debug("Invalidating source",O),this.invalidateSource(O),(a=this.overlayEmitter)==null||a.call(this,O,_.source),this.invalidatePatchErrors(O),(l=_.patches)!=null&&l.errors&&(this.errors.patchErrors===void 0&&(this.errors.patchErrors={}),this.errors.patchErrors[O]=_.patches.errors);for(const M in _.validationErrors){const D=M;this.errors.validationErrors||(this.errors.validationErrors={}),this.errors.validationErrors[D]=_.validationErrors[D],N.add(D)}for(const M of((c=_.patches)==null?void 0:c.applied)||[])this.syncedServerSidePatchIds.push(M);for(const M of((u=_.patches)==null?void 0:u.skipped)||[])this.syncedServerSidePatchIds.push(M)}else this.addGlobalTransientError(`Could not find '${O}' in server reply`,t,"This is most likely a bug");this.markAllSyncStatusIn(O,"done")}this.invalidateAllValidationErrors();for(const P of Array.from(N))this.invalidateValidationError(P);C.json.schemaSha!==this.clientSideSchemaSha&&await this.syncSchema()}}if(this.autoPublish&&this.mode==="fs"&&this.globalServerSidePatchIds&&this.globalServerSidePatchIds.length>0){let S=!1;for(const C in this.errors.validationErrors||{}){const N=C;if((h=(f=this.errors)==null?void 0:f.validationErrors)!=null&&h[N]&&((m=(p=this.errors)==null?void 0:p.validationErrors)==null?void 0:m[N].length)>0){S=!0;break}}S?console.debug("Skip auto-publish since there's validation errors",this.errors.validationErrors):(await this.publish(this.globalServerSidePatchIds.concat(...Array.from(this.syncedServerSidePatchIds)),void 0,t),w=!0)}return(o||w)&&(this.invalidatePendingClientSidePatchIds(),this.invalidateGlobalServerSidePatchIds(),this.invalidateSyncedServerSidePatchIds(),this.invalidateSavedServerSidePatchIds()),{status:"done"}}finally{this.isSyncing=!1,this.pendingOps=[...r,...this.pendingOps]}}async publish(t,n,r){try{if(this.isPublishing)return console.debug("Already publishing changes",r),{status:"retry",reason:"already-publishing"};if(this.isPublishing=!0,this.publishDisabled)return console.debug("Could not publish changes, since the publish is disabled",r),{status:"retry",reason:"publish-disabled"};if(this.publishDisabled=!0,this.invalidatePublishDisabled(),Object.values(this.errors.validationErrors||{}).flatMap(s=>s||[]).length>0)return console.debug("Skipping publish since there's validation errors",this.errors.validationErrors),this.addGlobalTransientError("Could not publish changes, since there are validation errors",r),{status:"retry",reason:"validation-error"};if(t.length===0)return this.addGlobalTransientError("Could not publish changes, since there are no changes to publish",Date.now()),{status:"done"};const i=await this.client("/save","POST",{body:{message:n,patchIds:t}});return i.status===null?(this.addGlobalTransientError("Network error: could not publish",Date.now()),{status:"retry"}):i.status!==200?(this.addGlobalTransientError("Failed to publish changes",Date.now(),i.json.message),{status:"retry"}):(this.mode==="fs"&&(this.globalServerSidePatchIds=[],console.debug("Deleting all patch ids")),this.pendingClientPatchIds=[],this.syncedServerSidePatchIds=[],this.savedButNotYetGlobalServerSidePatchIds=[],this.patchDataByPatchId={},this.patchSets=new Pd,await this.syncPatches(!0,r),this.invalidatePatchSets(),this.invalidateAllPatches(),this.invalidatePendingClientSidePatchIds(),this.invalidateSyncedServerSidePatchIds(),this.invalidateSavedServerSidePatchIds(),{status:"done"})}catch(o){return console.error("Error while publishing",o),this.addGlobalTransientError("Failed to publish changes",Date.now(),o.message),{status:"retry",reason:"error"}}finally{this.isPublishing=!1,this.publishDisabled=!1,this.invalidatePublishDisabled()}}resetNetworkError(){this.errors.hasNetworkErrorTimestamp=null,this.invalidateNetworkError()}addNetworkError(t){this.errors.hasNetworkErrorTimestamp=t,this.invalidateNetworkError()}addGlobalTransientError(t,n,r){this.errors.globalTransientErrorQueue||(this.errors.globalTransientErrorQueue=[]),console.error("Global transient error",t,r||""),this.errors.globalTransientErrorQueue.push({message:t,details:r,timestamp:n,id:crypto.randomUUID()}),this.invalidateGlobalTransientErrors()}removeGlobalTransientErrors(t){if(this.errors.globalTransientErrorQueue){const n=new Set(t);this.errors.globalTransientErrorQueue=this.errors.globalTransientErrorQueue.filter(r=>!n.has(r.id)),this.invalidateGlobalTransientErrors()}}}const YU=new WU,Sn="global",JU=["string","boolean","number","date","richtext","file","image"],XU=(e,t)=>{window.dispatchEvent(new CustomEvent("val-event",{detail:{type:"source-update",moduleFilePath:e,source:t}}))};function ZU(e,t,n){var o,i,s;const r={};for(const a of e)r[a.commitSha]=a;for(const a of t)r[a.commitSha]||(r[a.commitSha]={commitMessage:(a==null?void 0:a.commitMessage)||null,deploymentState:"created",creator:a.creator,createdAt:a.createdAt,updatedAt:a.createdAt,commitSha:a.commitSha});for(const a of n)a.commitSha&&(r[a.commitSha]={commitMessage:((o=r[a.commitSha])==null?void 0:o.commitMessage)||null,deploymentState:a.deploymentState,creator:((i=r[a.commitSha])==null?void 0:i.creator)||null,createdAt:((s=r[a.commitSha])==null?void 0:s.createdAt)||a.createdAt,updatedAt:a.updatedAt,commitSha:a.commitSha});return Object.values(r).sort((a,l)=>new Date(l.updatedAt).getTime()-new Date(a.updatedAt).getTime())}function ne(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function QU(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function ey(...e){return t=>e.forEach(n=>QU(n,t))}function Be(...e){return g.useCallback(ey(...e),e)}function eW(e,t){const n=g.createContext(t),r=i=>{const{children:s,...a}=i,l=g.useMemo(()=>a,Object.values(a));return d.jsx(n.Provider,{value:l,children:s})};r.displayName=e+"Provider";function o(i){const s=g.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,o]}function So(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];const c=f=>{var b;const{scope:h,children:p,...m}=f,v=((b=h==null?void 0:h[e])==null?void 0:b[l])||a,x=g.useMemo(()=>m,Object.values(m));return d.jsx(v.Provider,{value:x,children:p})};c.displayName=i+"Provider";function u(f,h){var v;const p=((v=h==null?void 0:h[e])==null?void 0:v[l])||a,m=g.useContext(p);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(s=>g.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,tW(o,...t)]}function tW(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(i)[`__scope${c}`];return{...a,...f}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var ls=g.forwardRef((e,t)=>{const{children:n,...r}=e,o=g.Children.toArray(n),i=o.find(nW);if(i){const s=i.props.children,a=o.map(l=>l===i?g.Children.count(s)>1?g.Children.only(null):g.isValidElement(s)?s.props.children:null:l);return d.jsx(Lb,{...r,ref:t,children:g.isValidElement(s)?g.cloneElement(s,void 0,a):null})}return d.jsx(Lb,{...r,ref:t,children:n})});ls.displayName="Slot";var Lb=g.forwardRef((e,t)=>{const{children:n,...r}=e;if(g.isValidElement(n)){const o=oW(n);return g.cloneElement(n,{...rW(r,n.props),ref:t?ey(t,o):o})}return g.Children.count(n)>1?g.Children.only(null):null});Lb.displayName="SlotClone";var oR=({children:e})=>d.jsx(d.Fragment,{children:e});function nW(e){return g.isValidElement(e)&&e.type===oR}function rW(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function oW(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var iW=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Oe=iW.reduce((e,t)=>{const n=g.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?ls:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(a,{...s,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function iR(e,t){e&&Fr.flushSync(()=>e.dispatchEvent(t))}function nn(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function sW(e,t=globalThis==null?void 0:globalThis.document){const n=nn(e);g.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var aW="DismissableLayer",Fb="dismissableLayer.update",lW="dismissableLayer.pointerDownOutside",cW="dismissableLayer.focusOutside",dN,sR=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Xl=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...l}=e,c=g.useContext(sR),[u,f]=g.useState(null),h=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=g.useState({}),m=Be(t,_=>f(_)),v=Array.from(c.layers),[x]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(x),w=u?v.indexOf(u):-1,S=c.layersWithOutsidePointerEventsDisabled.size>0,C=w>=b,N=fW(_=>{const O=_.target,M=[...c.branches].some(D=>D.contains(O));!C||M||(o==null||o(_),s==null||s(_),_.defaultPrevented||a==null||a())},h),P=hW(_=>{const O=_.target;[...c.branches].some(D=>D.contains(O))||(i==null||i(_),s==null||s(_),_.defaultPrevented||a==null||a())},h);return sW(_=>{w===c.layers.size-1&&(r==null||r(_),!_.defaultPrevented&&a&&(_.preventDefault(),a()))},h),g.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(dN=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),fN(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=dN)}},[u,h,n,c]),g.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),fN())},[u,c]),g.useEffect(()=>{const _=()=>p({});return document.addEventListener(Fb,_),()=>document.removeEventListener(Fb,_)},[]),d.jsx(Oe.div,{...l,ref:m,style:{pointerEvents:S?C?"auto":"none":void 0,...e.style},onFocusCapture:ne(e.onFocusCapture,P.onFocusCapture),onBlurCapture:ne(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:ne(e.onPointerDownCapture,N.onPointerDownCapture)})});Xl.displayName=aW;var uW="DismissableLayerBranch",dW=g.forwardRef((e,t)=>{const n=g.useContext(sR),r=g.useRef(null),o=Be(t,r);return g.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),d.jsx(Oe.div,{...e,ref:o})});dW.displayName=uW;function fW(e,t=globalThis==null?void 0:globalThis.document){const n=nn(e),r=g.useRef(!1),o=g.useRef(()=>{});return g.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let l=function(){aR(lW,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function hW(e,t=globalThis==null?void 0:globalThis.document){const n=nn(e),r=g.useRef(!1);return g.useEffect(()=>{const o=i=>{i.target&&!r.current&&aR(cW,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function fN(){const e=new CustomEvent(Fb);document.dispatchEvent(e)}function aR(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?iR(o,i):o.dispatchEvent(i)}var On=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},pW=JF.useId||(()=>{}),mW=0;function Vr(e){const[t,n]=g.useState(pW());return On(()=>{n(r=>r??String(mW++))},[e]),t?`radix-${t}`:""}const gW=["top","right","bottom","left"],Ca=Math.min,Ar=Math.max,jg=Math.round,Zp=Math.floor,yi=e=>({x:e,y:e}),vW={left:"right",right:"left",bottom:"top",top:"bottom"},yW={start:"end",end:"start"};function zb(e,t,n){return Ar(e,Ca(t,n))}function cs(e,t){return typeof e=="function"?e(t):e}function us(e){return e.split("-")[0]}function Vu(e){return e.split("-")[1]}function yS(e){return e==="x"?"y":"x"}function xS(e){return e==="y"?"height":"width"}function Na(e){return["top","bottom"].includes(us(e))?"y":"x"}function bS(e){return yS(Na(e))}function xW(e,t,n){n===void 0&&(n=!1);const r=Vu(e),o=bS(e),i=xS(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Tg(s)),[s,Tg(s)]}function bW(e){const t=Tg(e);return[$b(e),t,$b(t)]}function $b(e){return e.replace(/start|end/g,t=>yW[t])}function wW(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function SW(e,t,n,r){const o=Vu(e);let i=wW(us(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map($b)))),i}function Tg(e){return e.replace(/left|right|bottom|top/g,t=>vW[t])}function kW(e){return{top:0,right:0,bottom:0,left:0,...e}}function lR(e){return typeof e!="number"?kW(e):{top:e,right:e,bottom:e,left:e}}function Og(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function hN(e,t,n){let{reference:r,floating:o}=e;const i=Na(t),s=bS(t),a=xS(s),l=us(t),c=i==="y",u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/2;let p;switch(l){case"top":p={x:u,y:r.y-o.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Vu(t)){case"start":p[s]-=h*(n&&c?-1:1);break;case"end":p[s]+=h*(n&&c?-1:1);break}return p}const EW=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=hN(c,r,l),h=r,p={},m=0;for(let v=0;v<a.length;v++){const{name:x,fn:b}=a[v],{x:w,y:S,data:C,reset:N}=await b({x:u,y:f,initialPlacement:r,placement:h,strategy:o,middlewareData:p,rects:c,platform:s,elements:{reference:e,floating:t}});u=w??u,f=S??f,p={...p,[x]:{...p[x],...C}},N&&m<=50&&(m++,typeof N=="object"&&(N.placement&&(h=N.placement),N.rects&&(c=N.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):N.rects),{x:u,y:f}=hN(c,h,l)),v=-1)}return{x:u,y:f,placement:h,strategy:o,middlewareData:p}};async function ph(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=cs(t,e),m=lR(p),x=a[h?f==="floating"?"reference":"floating":f],b=Og(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(x)))==null||n?x:x.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),w=f==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),C=await(i.isElement==null?void 0:i.isElement(S))?await(i.getScale==null?void 0:i.getScale(S))||{x:1,y:1}:{x:1,y:1},N=Og(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:S,strategy:l}):w);return{top:(b.top-N.top+m.top)/C.y,bottom:(N.bottom-b.bottom+m.bottom)/C.y,left:(b.left-N.left+m.left)/C.x,right:(N.right-b.right+m.right)/C.x}}const CW=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=cs(e,t)||{};if(c==null)return{};const f=lR(u),h={x:n,y:r},p=bS(o),m=xS(p),v=await s.getDimensions(c),x=p==="y",b=x?"top":"left",w=x?"bottom":"right",S=x?"clientHeight":"clientWidth",C=i.reference[m]+i.reference[p]-h[p]-i.floating[m],N=h[p]-i.reference[p],P=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let _=P?P[S]:0;(!_||!await(s.isElement==null?void 0:s.isElement(P)))&&(_=a.floating[S]||i.floating[m]);const O=C/2-N/2,M=_/2-v[m]/2-1,D=Ca(f[b],M),U=Ca(f[w],M),z=D,H=_-v[m]-U,K=_/2-v[m]/2+O,V=zb(z,K,H),I=!l.arrow&&Vu(o)!=null&&K!==V&&i.reference[m]/2-(K<z?D:U)-v[m]/2<0,A=I?K<z?K-z:K-H:0;return{[p]:h[p]+A,data:{[p]:V,centerOffset:K-V-A,...I&&{alignmentOffset:A}},reset:I}}}),NW=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=!0,...x}=cs(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=us(o),w=Na(a),S=us(a)===a,C=await(l.isRTL==null?void 0:l.isRTL(c.floating)),N=h||(S||!v?[Tg(a)]:bW(a)),P=m!=="none";!h&&P&&N.push(...SW(a,v,m,C));const _=[a,...N],O=await ph(t,x),M=[];let D=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&M.push(O[b]),f){const K=xW(o,s,C);M.push(O[K[0]],O[K[1]])}if(D=[...D,{placement:o,overflows:M}],!M.every(K=>K<=0)){var U,z;const K=(((U=i.flip)==null?void 0:U.index)||0)+1,V=_[K];if(V)return{data:{index:K,overflows:D},reset:{placement:V}};let I=(z=D.filter(A=>A.overflows[0]<=0).sort((A,j)=>A.overflows[1]-j.overflows[1])[0])==null?void 0:z.placement;if(!I)switch(p){case"bestFit":{var H;const A=(H=D.filter(j=>{if(P){const L=Na(j.placement);return L===w||L==="y"}return!0}).map(j=>[j.placement,j.overflows.filter(L=>L>0).reduce((L,$)=>L+$,0)]).sort((j,L)=>j[1]-L[1])[0])==null?void 0:H[0];A&&(I=A);break}case"initialPlacement":I=a;break}if(o!==I)return{reset:{placement:I}}}return{}}}};function pN(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function mN(e){return gW.some(t=>e[t]>=0)}const PW=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=cs(e,t);switch(r){case"referenceHidden":{const i=await ph(t,{...o,elementContext:"reference"}),s=pN(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:mN(s)}}}case"escaped":{const i=await ph(t,{...o,altBoundary:!0}),s=pN(i,n.floating);return{data:{escapedOffsets:s,escaped:mN(s)}}}default:return{}}}}};async function _W(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=us(n),a=Vu(n),l=Na(n)==="y",c=["left","top"].includes(s)?-1:1,u=i&&l?-1:1,f=cs(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof m=="number"&&(p=a==="end"?m*-1:m),l?{x:p*u,y:h*c}:{x:h*c,y:p*u}}const jW=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await _W(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},TW=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:x=>{let{x:b,y:w}=x;return{x:b,y:w}}},...l}=cs(e,t),c={x:n,y:r},u=await ph(t,l),f=Na(us(o)),h=yS(f);let p=c[h],m=c[f];if(i){const x=h==="y"?"top":"left",b=h==="y"?"bottom":"right",w=p+u[x],S=p-u[b];p=zb(w,p,S)}if(s){const x=f==="y"?"top":"left",b=f==="y"?"bottom":"right",w=m+u[x],S=m-u[b];m=zb(w,m,S)}const v=a.fn({...t,[h]:p,[f]:m});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[h]:i,[f]:s}}}}}},OW=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=cs(e,t),u={x:n,y:r},f=Na(o),h=yS(f);let p=u[h],m=u[f];const v=cs(a,t),x=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(l){const S=h==="y"?"height":"width",C=i.reference[h]-i.floating[S]+x.mainAxis,N=i.reference[h]+i.reference[S]-x.mainAxis;p<C?p=C:p>N&&(p=N)}if(c){var b,w;const S=h==="y"?"width":"height",C=["top","left"].includes(us(o)),N=i.reference[f]-i.floating[S]+(C&&((b=s.offset)==null?void 0:b[f])||0)+(C?0:x.crossAxis),P=i.reference[f]+i.reference[S]+(C?0:((w=s.offset)==null?void 0:w[f])||0)-(C?x.crossAxis:0);m<N?m=N:m>P&&(m=P)}return{[h]:p,[f]:m}}}},MW=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:s,elements:a}=t,{apply:l=()=>{},...c}=cs(e,t),u=await ph(t,c),f=us(o),h=Vu(o),p=Na(o)==="y",{width:m,height:v}=i.floating;let x,b;f==="top"||f==="bottom"?(x=f,b=h===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(b=f,x=h==="end"?"top":"bottom");const w=v-u.top-u.bottom,S=m-u.left-u.right,C=Ca(v-u[x],w),N=Ca(m-u[b],S),P=!t.middlewareData.shift;let _=C,O=N;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=S),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(_=w),P&&!h){const D=Ar(u.left,0),U=Ar(u.right,0),z=Ar(u.top,0),H=Ar(u.bottom,0);p?O=m-2*(D!==0||U!==0?D+U:Ar(u.left,u.right)):_=v-2*(z!==0||H!==0?z+H:Ar(u.top,u.bottom))}await l({...t,availableWidth:O,availableHeight:_});const M=await s.getDimensions(a.floating);return m!==M.width||v!==M.height?{reset:{rects:!0}}:{}}}};function ty(){return typeof window<"u"}function Uu(e){return cR(e)?(e.nodeName||"").toLowerCase():"#document"}function Ur(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function _i(e){var t;return(t=(cR(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function cR(e){return ty()?e instanceof Node||e instanceof Ur(e).Node:!1}function Qo(e){return ty()?e instanceof Element||e instanceof Ur(e).Element:!1}function Si(e){return ty()?e instanceof HTMLElement||e instanceof Ur(e).HTMLElement:!1}function gN(e){return!ty()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ur(e).ShadowRoot}function ep(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=ei(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function RW(e){return["table","td","th"].includes(Uu(e))}function ny(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function wS(e){const t=SS(),n=Qo(e)?ei(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function AW(e){let t=Pa(e);for(;Si(t)&&!bu(t);){if(wS(t))return t;if(ny(t))return null;t=Pa(t)}return null}function SS(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function bu(e){return["html","body","#document"].includes(Uu(e))}function ei(e){return Ur(e).getComputedStyle(e)}function ry(e){return Qo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Pa(e){if(Uu(e)==="html")return e;const t=e.assignedSlot||e.parentNode||gN(e)&&e.host||_i(e);return gN(t)?t.host:t}function uR(e){const t=Pa(e);return bu(t)?e.ownerDocument?e.ownerDocument.body:e.body:Si(t)&&ep(t)?t:uR(t)}function mh(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=uR(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Ur(o);if(i){const a=Bb(s);return t.concat(s,s.visualViewport||[],ep(o)?o:[],a&&n?mh(a):[])}return t.concat(o,mh(o,[],n))}function Bb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function dR(e){const t=ei(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Si(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=jg(n)!==i||jg(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function kS(e){return Qo(e)?e:e.contextElement}function qc(e){const t=kS(e);if(!Si(t))return yi(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=dR(t);let s=(i?jg(n.width):n.width)/r,a=(i?jg(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const IW=yi(0);function fR(e){const t=Ur(e);return!SS()||!t.visualViewport?IW:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function DW(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ur(e)?!1:t}function Ml(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=kS(e);let s=yi(1);t&&(r?Qo(r)&&(s=qc(r)):s=qc(e));const a=DW(i,n,r)?fR(i):yi(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,u=o.width/s.x,f=o.height/s.y;if(i){const h=Ur(i),p=r&&Qo(r)?Ur(r):r;let m=h,v=Bb(m);for(;v&&r&&p!==m;){const x=qc(v),b=v.getBoundingClientRect(),w=ei(v),S=b.left+(v.clientLeft+parseFloat(w.paddingLeft))*x.x,C=b.top+(v.clientTop+parseFloat(w.paddingTop))*x.y;l*=x.x,c*=x.y,u*=x.x,f*=x.y,l+=S,c+=C,m=Ur(v),v=Bb(m)}}return Og({width:u,height:f,x:l,y:c})}function ES(e,t){const n=ry(e).scrollLeft;return t?t.left+n:Ml(_i(e)).left+n}function hR(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-(n?0:ES(e,r)),i=r.top+t.scrollTop;return{x:o,y:i}}function LW(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=_i(r),a=t?ny(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=yi(1);const u=yi(0),f=Si(r);if((f||!f&&!i)&&((Uu(r)!=="body"||ep(s))&&(l=ry(r)),Si(r))){const p=Ml(r);c=qc(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}const h=s&&!f&&!i?hR(s,l,!0):yi(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:n.y*c.y-l.scrollTop*c.y+u.y+h.y}}function FW(e){return Array.from(e.getClientRects())}function zW(e){const t=_i(e),n=ry(e),r=e.ownerDocument.body,o=Ar(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Ar(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+ES(e);const a=-n.scrollTop;return ei(r).direction==="rtl"&&(s+=Ar(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function $W(e,t){const n=Ur(e),r=_i(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const c=SS();(!c||c&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}function BW(e,t){const n=Ml(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Si(e)?qc(e):yi(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,c=r*i.y;return{width:s,height:a,x:l,y:c}}function vN(e,t,n){let r;if(t==="viewport")r=$W(e,n);else if(t==="document")r=zW(_i(e));else if(Qo(t))r=BW(t,n);else{const o=fR(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Og(r)}function pR(e,t){const n=Pa(e);return n===t||!Qo(n)||bu(n)?!1:ei(n).position==="fixed"||pR(n,t)}function VW(e,t){const n=t.get(e);if(n)return n;let r=mh(e,[],!1).filter(a=>Qo(a)&&Uu(a)!=="body"),o=null;const i=ei(e).position==="fixed";let s=i?Pa(e):e;for(;Qo(s)&&!bu(s);){const a=ei(s),l=wS(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||ep(s)&&!l&&pR(e,s))?r=r.filter(u=>u!==s):o=a,s=Pa(s)}return t.set(e,r),r}function UW(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?ny(t)?[]:VW(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const f=vN(t,u,o);return c.top=Ar(f.top,c.top),c.right=Ca(f.right,c.right),c.bottom=Ca(f.bottom,c.bottom),c.left=Ar(f.left,c.left),c},vN(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function WW(e){const{width:t,height:n}=dR(e);return{width:t,height:n}}function HW(e,t,n){const r=Si(t),o=_i(t),i=n==="fixed",s=Ml(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=yi(0);if(r||!r&&!i)if((Uu(t)!=="body"||ep(o))&&(a=ry(t)),r){const h=Ml(t,!0,i,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else o&&(l.x=ES(o));const c=o&&!r&&!i?hR(o,a):yi(0),u=s.left+a.scrollLeft-l.x-c.x,f=s.top+a.scrollTop-l.y-c.y;return{x:u,y:f,width:s.width,height:s.height}}function Bx(e){return ei(e).position==="static"}function yN(e,t){if(!Si(e)||ei(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return _i(e)===n&&(n=n.ownerDocument.body),n}function mR(e,t){const n=Ur(e);if(ny(e))return n;if(!Si(e)){let o=Pa(e);for(;o&&!bu(o);){if(Qo(o)&&!Bx(o))return o;o=Pa(o)}return n}let r=yN(e,t);for(;r&&RW(r)&&Bx(r);)r=yN(r,t);return r&&bu(r)&&Bx(r)&&!wS(r)?n:r||AW(e)||n}const KW=async function(e){const t=this.getOffsetParent||mR,n=this.getDimensions,r=await n(e.floating);return{reference:HW(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function GW(e){return ei(e).direction==="rtl"}const qW={convertOffsetParentRelativeRectToViewportRelativeRect:LW,getDocumentElement:_i,getClippingRect:UW,getOffsetParent:mR,getElementRects:KW,getClientRects:FW,getDimensions:WW,getScale:qc,isElement:Qo,isRTL:GW};function YW(e,t){let n=null,r;const o=_i(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const{left:c,top:u,width:f,height:h}=e.getBoundingClientRect();if(a||t(),!f||!h)return;const p=Zp(u),m=Zp(o.clientWidth-(c+f)),v=Zp(o.clientHeight-(u+h)),x=Zp(c),w={rootMargin:-p+"px "+-m+"px "+-v+"px "+-x+"px",threshold:Ar(0,Ca(1,l))||1};let S=!0;function C(N){const P=N[0].intersectionRatio;if(P!==l){if(!S)return s();P?s(!1,P):r=setTimeout(()=>{s(!1,1e-7)},1e3)}S=!1}try{n=new IntersectionObserver(C,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,w)}n.observe(e)}return s(!0),i}function JW(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=kS(e),u=o||i?[...c?mh(c):[],...mh(t)]:[];u.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const f=c&&a?YW(c,n):null;let h=-1,p=null;s&&(p=new ResizeObserver(b=>{let[w]=b;w&&w.target===c&&p&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var S;(S=p)==null||S.observe(t)})),n()}),c&&!l&&p.observe(c),p.observe(t));let m,v=l?Ml(e):null;l&&x();function x(){const b=Ml(e);v&&(b.x!==v.x||b.y!==v.y||b.width!==v.width||b.height!==v.height)&&n(),v=b,m=requestAnimationFrame(x)}return n(),()=>{var b;u.forEach(w=>{o&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),f==null||f(),(b=p)==null||b.disconnect(),p=null,l&&cancelAnimationFrame(m)}}const XW=jW,ZW=TW,QW=NW,eH=MW,tH=PW,xN=CW,nH=OW,rH=(e,t,n)=>{const r=new Map,o={platform:qW,...n},i={...o.platform,_c:r};return EW(e,t,{...o,platform:i})};var Nm=typeof document<"u"?g.useLayoutEffect:g.useEffect;function Mg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Mg(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!Mg(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function gR(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function bN(e,t){const n=gR(e);return Math.round(t*n)/n}function Vx(e){const t=g.useRef(e);return Nm(()=>{t.current=e}),t}function oH(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,f]=g.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=g.useState(r);Mg(h,r)||p(r);const[m,v]=g.useState(null),[x,b]=g.useState(null),w=g.useCallback(j=>{j!==P.current&&(P.current=j,v(j))},[]),S=g.useCallback(j=>{j!==_.current&&(_.current=j,b(j))},[]),C=i||m,N=s||x,P=g.useRef(null),_=g.useRef(null),O=g.useRef(u),M=l!=null,D=Vx(l),U=Vx(o),z=Vx(c),H=g.useCallback(()=>{if(!P.current||!_.current)return;const j={placement:t,strategy:n,middleware:h};U.current&&(j.platform=U.current),rH(P.current,_.current,j).then(L=>{const $={...L,isPositioned:z.current!==!1};K.current&&!Mg(O.current,$)&&(O.current=$,Fr.flushSync(()=>{f($)}))})},[h,t,n,U,z]);Nm(()=>{c===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,f(j=>({...j,isPositioned:!1})))},[c]);const K=g.useRef(!1);Nm(()=>(K.current=!0,()=>{K.current=!1}),[]),Nm(()=>{if(C&&(P.current=C),N&&(_.current=N),C&&N){if(D.current)return D.current(C,N,H);H()}},[C,N,H,D,M]);const V=g.useMemo(()=>({reference:P,floating:_,setReference:w,setFloating:S}),[w,S]),I=g.useMemo(()=>({reference:C,floating:N}),[C,N]),A=g.useMemo(()=>{const j={position:n,left:0,top:0};if(!I.floating)return j;const L=bN(I.floating,u.x),$=bN(I.floating,u.y);return a?{...j,transform:"translate("+L+"px, "+$+"px)",...gR(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:$}},[n,a,I.floating,u.x,u.y]);return g.useMemo(()=>({...u,update:H,refs:V,elements:I,floatingStyles:A}),[u,H,V,I,A])}const iH=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?xN({element:r.current,padding:o}).fn(n):{}:r?xN({element:r,padding:o}).fn(n):{}}}},sH=(e,t)=>({...XW(e),options:[e,t]}),aH=(e,t)=>({...ZW(e),options:[e,t]}),lH=(e,t)=>({...nH(e),options:[e,t]}),cH=(e,t)=>({...QW(e),options:[e,t]}),uH=(e,t)=>({...eH(e),options:[e,t]}),dH=(e,t)=>({...tH(e),options:[e,t]}),fH=(e,t)=>({...iH(e),options:[e,t]});var hH="Arrow",vR=g.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return d.jsx(Oe.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});vR.displayName=hH;var pH=vR;function mH(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];function c(f){const{scope:h,children:p,...m}=f,v=(h==null?void 0:h[e][l])||a,x=g.useMemo(()=>m,Object.values(m));return d.jsx(v.Provider,{value:x,children:p})}function u(f,h){const p=(h==null?void 0:h[e][l])||a,m=g.useContext(p);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>g.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,gH(o,...t)]}function gH(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(i)[`__scope${c}`];return{...a,...f}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function CS(e){const[t,n]=g.useState(void 0);return On(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var NS="Popper",[yR,ji]=mH(NS),[vH,xR]=yR(NS),bR=e=>{const{__scopePopper:t,children:n}=e,[r,o]=g.useState(null);return d.jsx(vH,{scope:t,anchor:r,onAnchorChange:o,children:n})};bR.displayName=NS;var wR="PopperAnchor",SR=g.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=xR(wR,n),s=g.useRef(null),a=Be(t,s);return g.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:d.jsx(Oe.div,{...o,ref:a})});SR.displayName=wR;var PS="PopperContent",[yH,xH]=yR(PS),kR=g.forwardRef((e,t)=>{var J,ce,Ne,he,Le,Pe;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:m,...v}=e,x=xR(PS,n),[b,w]=g.useState(null),S=Be(t,Xe=>w(Xe)),[C,N]=g.useState(null),P=CS(C),_=(P==null?void 0:P.width)??0,O=(P==null?void 0:P.height)??0,M=r+(i!=="center"?"-"+i:""),D=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},U=Array.isArray(c)?c:[c],z=U.length>0,H={padding:D,boundary:U.filter(wH),altBoundary:z},{refs:K,floatingStyles:V,placement:I,isPositioned:A,middlewareData:j}=oH({strategy:"fixed",placement:M,whileElementsMounted:(...Xe)=>JW(...Xe,{animationFrame:p==="always"}),elements:{reference:x.anchor},middleware:[sH({mainAxis:o+O,alignmentAxis:s}),l&&aH({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?lH():void 0,...H}),l&&cH({...H}),uH({...H,apply:({elements:Xe,rects:gt,availableWidth:Kt,availableHeight:T})=>{const{width:k,height:E}=gt.reference,R=Xe.floating.style;R.setProperty("--radix-popper-available-width",`${Kt}px`),R.setProperty("--radix-popper-available-height",`${T}px`),R.setProperty("--radix-popper-anchor-width",`${k}px`),R.setProperty("--radix-popper-anchor-height",`${E}px`)}}),C&&fH({element:C,padding:a}),SH({arrowWidth:_,arrowHeight:O}),h&&dH({strategy:"referenceHidden",...H})]}),[L,$]=NR(I),W=nn(m);On(()=>{A&&(W==null||W())},[A,W]);const G=(J=j.arrow)==null?void 0:J.x,_e=(ce=j.arrow)==null?void 0:ce.y,ke=((Ne=j.arrow)==null?void 0:Ne.centerOffset)!==0,[Ve,Z]=g.useState();return On(()=>{b&&Z(window.getComputedStyle(b).zIndex)},[b]),d.jsx("div",{ref:K.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:A?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ve,"--radix-popper-transform-origin":[(he=j.transformOrigin)==null?void 0:he.x,(Le=j.transformOrigin)==null?void 0:Le.y].join(" "),...((Pe=j.hide)==null?void 0:Pe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:d.jsx(yH,{scope:n,placedSide:L,onArrowChange:N,arrowX:G,arrowY:_e,shouldHideArrow:ke,children:d.jsx(Oe.div,{"data-side":L,"data-align":$,...v,ref:S,style:{...v.style,animation:A?void 0:"none"}})})})});kR.displayName=PS;var ER="PopperArrow",bH={top:"bottom",right:"left",bottom:"top",left:"right"},CR=g.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=xH(ER,r),s=bH[i.placedSide];return d.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:d.jsx(pH,{...o,ref:n,style:{...o.style,display:"block"}})})});CR.displayName=ER;function wH(e){return e!==null}var SH=e=>({name:"transformOrigin",options:e,fn(t){var x,b,w;const{placement:n,rects:r,middlewareData:o}=t,s=((x=o.arrow)==null?void 0:x.centerOffset)!==0,a=s?0:e.arrowWidth,l=s?0:e.arrowHeight,[c,u]=NR(n),f={start:"0%",center:"50%",end:"100%"}[u],h=(((b=o.arrow)==null?void 0:b.x)??0)+a/2,p=(((w=o.arrow)==null?void 0:w.y)??0)+l/2;let m="",v="";return c==="bottom"?(m=s?f:`${h}px`,v=`${-l}px`):c==="top"?(m=s?f:`${h}px`,v=`${r.floating.height+l}px`):c==="right"?(m=`${-l}px`,v=s?f:`${p}px`):c==="left"&&(m=`${r.floating.width+l}px`,v=s?f:`${p}px`),{data:{x:m,y:v}}}});function NR(e){const[t,n="center"]=e.split("-");return[t,n]}var tp=bR,Wu=SR,np=kR,rp=CR,kH="Portal",Hu=g.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,i]=g.useState(!1);On(()=>i(!0),[]);const s=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?t$.createPortal(d.jsx(Oe.div,{...r,ref:t}),s):null});Hu.displayName=kH;function EH(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}var ln=e=>{const{present:t,children:n}=e,r=CH(t),o=typeof n=="function"?n({present:r.isPresent}):g.Children.only(n),i=Be(r.ref,NH(o));return typeof n=="function"||r.isPresent?g.cloneElement(o,{ref:i}):null};ln.displayName="Presence";function CH(e){const[t,n]=g.useState(),r=g.useRef({}),o=g.useRef(e),i=g.useRef("none"),s=e?"mounted":"unmounted",[a,l]=EH(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const c=Qp(r.current);i.current=a==="mounted"?c:"none"},[a]),On(()=>{const c=r.current,u=o.current;if(u!==e){const h=i.current,p=Qp(c);e?l("MOUNT"):p==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),On(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,f=p=>{const v=Qp(r.current).includes(p.animationName);if(p.target===t&&v&&(l("ANIMATION_END"),!o.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},h=p=>{p.target===t&&(i.current=Qp(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:g.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function Qp(e){return(e==null?void 0:e.animationName)||"none"}function NH(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Kr({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=PH({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=nn(n),l=g.useCallback(c=>{if(i){const f=typeof c=="function"?c(e):c;f!==e&&a(f)}else o(c)},[i,e,o,a]);return[s,l]}function PH({defaultProp:e,onChange:t}){const n=g.useState(e),[r]=n,o=g.useRef(r),i=nn(t);return g.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}var _H="VisuallyHidden",_S=g.forwardRef((e,t)=>d.jsx(Oe.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));_S.displayName=_H;var jH=_S,[oy,pge]=So("Tooltip",[ji]),iy=ji(),PR="TooltipProvider",TH=700,Vb="tooltip.open",[OH,jS]=oy(PR),_R=e=>{const{__scopeTooltip:t,delayDuration:n=TH,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,[s,a]=g.useState(!0),l=g.useRef(!1),c=g.useRef(0);return g.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),d.jsx(OH,{scope:t,isOpenDelayed:s,delayDuration:n,onOpen:g.useCallback(()=>{window.clearTimeout(c.current),a(!1)},[]),onClose:g.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:g.useCallback(u=>{l.current=u},[]),disableHoverableContent:o,children:i})};_R.displayName=PR;var sy="Tooltip",[MH,op]=oy(sy),jR=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:i,disableHoverableContent:s,delayDuration:a}=e,l=jS(sy,e.__scopeTooltip),c=iy(t),[u,f]=g.useState(null),h=Vr(),p=g.useRef(0),m=s??l.disableHoverableContent,v=a??l.delayDuration,x=g.useRef(!1),[b=!1,w]=Kr({prop:r,defaultProp:o,onChange:_=>{_?(l.onOpen(),document.dispatchEvent(new CustomEvent(Vb))):l.onClose(),i==null||i(_)}}),S=g.useMemo(()=>b?x.current?"delayed-open":"instant-open":"closed",[b]),C=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,x.current=!1,w(!0)},[w]),N=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,w(!1)},[w]),P=g.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{x.current=!0,w(!0),p.current=0},v)},[v,w]);return g.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),d.jsx(tp,{...c,children:d.jsx(MH,{scope:t,contentId:h,open:b,stateAttribute:S,trigger:u,onTriggerChange:f,onTriggerEnter:g.useCallback(()=>{l.isOpenDelayed?P():C()},[l.isOpenDelayed,P,C]),onTriggerLeave:g.useCallback(()=>{m?N():(window.clearTimeout(p.current),p.current=0)},[N,m]),onOpen:C,onClose:N,disableHoverableContent:m,children:n})})};jR.displayName=sy;var Ub="TooltipTrigger",TS=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=op(Ub,n),i=jS(Ub,n),s=iy(n),a=g.useRef(null),l=Be(t,a,o.onTriggerChange),c=g.useRef(!1),u=g.useRef(!1),f=g.useCallback(()=>c.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),d.jsx(Wu,{asChild:!0,...s,children:d.jsx(Oe.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:l,onPointerMove:ne(e.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),u.current=!0)}),onPointerLeave:ne(e.onPointerLeave,()=>{o.onTriggerLeave(),u.current=!1}),onPointerDown:ne(e.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:ne(e.onFocus,()=>{c.current||o.onOpen()}),onBlur:ne(e.onBlur,o.onClose),onClick:ne(e.onClick,o.onClose)})})});TS.displayName=Ub;var OS="TooltipPortal",[RH,AH]=oy(OS,{forceMount:void 0}),TR=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,i=op(OS,t);return d.jsx(RH,{scope:t,forceMount:n,children:d.jsx(ln,{present:n||i.open,children:d.jsx(Hu,{asChild:!0,container:o,children:r})})})};TR.displayName=OS;var wu="TooltipContent",OR=g.forwardRef((e,t)=>{const n=AH(wu,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,s=op(wu,e.__scopeTooltip);return d.jsx(ln,{present:r||s.open,children:s.disableHoverableContent?d.jsx(MR,{side:o,...i,ref:t}):d.jsx(IH,{side:o,...i,ref:t})})}),IH=g.forwardRef((e,t)=>{const n=op(wu,e.__scopeTooltip),r=jS(wu,e.__scopeTooltip),o=g.useRef(null),i=Be(t,o),[s,a]=g.useState(null),{trigger:l,onClose:c}=n,u=o.current,{onPointerInTransitChange:f}=r,h=g.useCallback(()=>{a(null),f(!1)},[f]),p=g.useCallback((m,v)=>{const x=m.currentTarget,b={x:m.clientX,y:m.clientY},w=zH(b,x.getBoundingClientRect()),S=$H(b,w),C=BH(v.getBoundingClientRect()),N=UH([...S,...C]);a(N),f(!0)},[f]);return g.useEffect(()=>()=>h(),[h]),g.useEffect(()=>{if(l&&u){const m=x=>p(x,u),v=x=>p(x,l);return l.addEventListener("pointerleave",m),u.addEventListener("pointerleave",v),()=>{l.removeEventListener("pointerleave",m),u.removeEventListener("pointerleave",v)}}},[l,u,p,h]),g.useEffect(()=>{if(s){const m=v=>{const x=v.target,b={x:v.clientX,y:v.clientY},w=(l==null?void 0:l.contains(x))||(u==null?void 0:u.contains(x)),S=!VH(b,s);w?h():S&&(h(),c())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[l,u,s,c,h]),d.jsx(MR,{...e,ref:i})}),[DH,LH]=oy(sy,{isInside:!1}),MR=g.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...a}=e,l=op(wu,n),c=iy(n),{onClose:u}=l;return g.useEffect(()=>(document.addEventListener(Vb,u),()=>document.removeEventListener(Vb,u)),[u]),g.useEffect(()=>{if(l.trigger){const f=h=>{const p=h.target;p!=null&&p.contains(l.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,u]),d.jsx(Xl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:u,children:d.jsxs(np,{"data-state":l.stateAttribute,...c,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[d.jsx(oR,{children:r}),d.jsx(DH,{scope:n,isInside:!0,children:d.jsx(jH,{id:l.contentId,role:"tooltip",children:o||r})})]})})});OR.displayName=wu;var RR="TooltipArrow",FH=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=iy(n);return LH(RR,n).isInside?null:d.jsx(rp,{...o,...r,ref:t})});FH.displayName=RR;function zH(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function $H(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function BH(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function VH(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i].x,l=t[i].y,c=t[s].x,u=t[s].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(o=!o)}return o}function UH(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),WH(t)}function WH(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var HH=_R,KH=jR,GH=TS,AR=OR;function IR(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=IR(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function DR(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=IR(e))&&(r&&(r+=" "),r+=t);return r}const MS="-",qH=e=>{const t=JH(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:s=>{const a=s.split(MS);return a[0]===""&&a.length!==1&&a.shift(),LR(a,t)||YH(s)},getConflictingClassGroupIds:(s,a)=>{const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}}},LR=(e,t)=>{var s;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?LR(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(MS);return(s=t.validators.find(({validator:a})=>a(i)))==null?void 0:s.classGroupId},wN=/^\[(.+)\]$/,YH=e=>{if(wN.test(e)){const t=wN.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},JH=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return ZH(Object.entries(e.classGroups),n).forEach(([i,s])=>{Wb(s,r,i,t)}),r},Wb=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:SN(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(XH(o)){Wb(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,s])=>{Wb(s,SN(t,i),n,r)})})},SN=(e,t)=>{let n=e;return t.split(MS).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},XH=e=>e.isThemeGetter,ZH=(e,t)=>t?e.map(([n,r])=>{const o=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([s,a])=>[t+s,a])):i);return[n,o]}):e,QH=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(i,s)=>{n.set(i,s),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let s=n.get(i);if(s!==void 0)return s;if((s=r.get(i))!==void 0)return o(i,s),s},set(i,s){n.has(i)?n.set(i,s):o(i,s)}}},FR="!",e7=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],i=t.length,s=a=>{const l=[];let c=0,u=0,f;for(let x=0;x<a.length;x++){let b=a[x];if(c===0){if(b===o&&(r||a.slice(x,x+i)===t)){l.push(a.slice(u,x)),u=x+i;continue}if(b==="/"){f=x;continue}}b==="["?c++:b==="]"&&c--}const h=l.length===0?a:a.substring(u),p=h.startsWith(FR),m=p?h.substring(1):h,v=f&&f>u?f-u:void 0;return{modifiers:l,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:v}};return n?a=>n({className:a,parseClassName:s}):s},t7=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},n7=e=>({cache:QH(e.cacheSize),parseClassName:e7(e),...qH(e)}),r7=/\s+/,o7=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,i=[],s=e.trim().split(r7);let a="";for(let l=s.length-1;l>=0;l-=1){const c=s[l],{modifiers:u,hasImportantModifier:f,baseClassName:h,maybePostfixModifierPosition:p}=n(c);let m=!!p,v=r(m?h.substring(0,p):h);if(!v){if(!m){a=c+(a.length>0?" "+a:a);continue}if(v=r(h),!v){a=c+(a.length>0?" "+a:a);continue}m=!1}const x=t7(u).join(":"),b=f?x+FR:x,w=b+v;if(i.includes(w))continue;i.push(w);const S=o(v,m);for(let C=0;C<S.length;++C){const N=S[C];i.push(b+N)}a=c+(a.length>0?" "+a:a)}return a};function i7(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=zR(t))&&(r&&(r+=" "),r+=n);return r}const zR=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=zR(e[r]))&&(n&&(n+=" "),n+=t);return n};function s7(e,...t){let n,r,o,i=s;function s(l){const c=t.reduce((u,f)=>f(u),e());return n=n7(c),r=n.cache.get,o=n.cache.set,i=a,a(l)}function a(l){const c=r(l);if(c)return c;const u=o7(l,n);return o(l,u),u}return function(){return i(i7.apply(null,arguments))}}const Et=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},$R=/^\[(?:([a-z-]+):)?(.+)\]$/i,a7=/^\d+\/\d+$/,l7=new Set(["px","full","screen"]),c7=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,u7=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,d7=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,f7=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,h7=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ai=e=>Yc(e)||l7.has(e)||a7.test(e),Ps=e=>Ku(e,"length",w7),Yc=e=>!!e&&!Number.isNaN(Number(e)),Ux=e=>Ku(e,"number",Yc),_d=e=>!!e&&Number.isInteger(Number(e)),p7=e=>e.endsWith("%")&&Yc(e.slice(0,-1)),Ue=e=>$R.test(e),_s=e=>c7.test(e),m7=new Set(["length","size","percentage"]),g7=e=>Ku(e,m7,BR),v7=e=>Ku(e,"position",BR),y7=new Set(["image","url"]),x7=e=>Ku(e,y7,k7),b7=e=>Ku(e,"",S7),jd=()=>!0,Ku=(e,t,n)=>{const r=$R.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},w7=e=>u7.test(e)&&!d7.test(e),BR=()=>!1,S7=e=>f7.test(e),k7=e=>h7.test(e),E7=()=>{const e=Et("colors"),t=Et("spacing"),n=Et("blur"),r=Et("brightness"),o=Et("borderColor"),i=Et("borderRadius"),s=Et("borderSpacing"),a=Et("borderWidth"),l=Et("contrast"),c=Et("grayscale"),u=Et("hueRotate"),f=Et("invert"),h=Et("gap"),p=Et("gradientColorStops"),m=Et("gradientColorStopPositions"),v=Et("inset"),x=Et("margin"),b=Et("opacity"),w=Et("padding"),S=Et("saturate"),C=Et("scale"),N=Et("sepia"),P=Et("skew"),_=Et("space"),O=Et("translate"),M=()=>["auto","contain","none"],D=()=>["auto","hidden","clip","visible","scroll"],U=()=>["auto",Ue,t],z=()=>[Ue,t],H=()=>["",Ai,Ps],K=()=>["auto",Yc,Ue],V=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],I=()=>["solid","dashed","dotted","double","none"],A=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],j=()=>["start","end","center","between","around","evenly","stretch"],L=()=>["","0",Ue],$=()=>["auto","avoid","all","avoid-page","page","left","right","column"],W=()=>[Yc,Ue];return{cacheSize:500,separator:":",theme:{colors:[jd],spacing:[Ai,Ps],blur:["none","",_s,Ue],brightness:W(),borderColor:[e],borderRadius:["none","","full",_s,Ue],borderSpacing:z(),borderWidth:H(),contrast:W(),grayscale:L(),hueRotate:W(),invert:L(),gap:z(),gradientColorStops:[e],gradientColorStopPositions:[p7,Ps],inset:U(),margin:U(),opacity:W(),padding:z(),saturate:W(),scale:W(),sepia:L(),skew:W(),space:z(),translate:z()},classGroups:{aspect:[{aspect:["auto","square","video",Ue]}],container:["container"],columns:[{columns:[_s]}],"break-after":[{"break-after":$()}],"break-before":[{"break-before":$()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...V(),Ue]}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",_d,Ue]}],basis:[{basis:U()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ue]}],grow:[{grow:L()}],shrink:[{shrink:L()}],order:[{order:["first","last","none",_d,Ue]}],"grid-cols":[{"grid-cols":[jd]}],"col-start-end":[{col:["auto",{span:["full",_d,Ue]},Ue]}],"col-start":[{"col-start":K()}],"col-end":[{"col-end":K()}],"grid-rows":[{"grid-rows":[jd]}],"row-start-end":[{row:["auto",{span:[_d,Ue]},Ue]}],"row-start":[{"row-start":K()}],"row-end":[{"row-end":K()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ue]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ue]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...j()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...j(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...j(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[w]}],px:[{px:[w]}],py:[{py:[w]}],ps:[{ps:[w]}],pe:[{pe:[w]}],pt:[{pt:[w]}],pr:[{pr:[w]}],pb:[{pb:[w]}],pl:[{pl:[w]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[_]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[_]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ue,t]}],"min-w":[{"min-w":[Ue,t,"min","max","fit"]}],"max-w":[{"max-w":[Ue,t,"none","full","min","max","fit","prose",{screen:[_s]},_s]}],h:[{h:[Ue,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ue,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ue,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ue,t,"auto","min","max","fit"]}],"font-size":[{text:["base",_s,Ps]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ux]}],"font-family":[{font:[jd]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Ue]}],"line-clamp":[{"line-clamp":["none",Yc,Ux]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ai,Ue]}],"list-image":[{"list-image":["none",Ue]}],"list-style-type":[{list:["none","disc","decimal",Ue]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...I(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ai,Ps]}],"underline-offset":[{"underline-offset":["auto",Ai,Ue]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:z()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ue]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ue]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...V(),v7]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",g7]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},x7]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...I(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:I()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...I()]}],"outline-offset":[{"outline-offset":[Ai,Ue]}],"outline-w":[{outline:[Ai,Ps]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[Ai,Ps]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",_s,b7]}],"shadow-color":[{shadow:[jd]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...A(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":A()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",_s,Ue]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[f]}],saturate:[{saturate:[S]}],sepia:[{sepia:[N]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[N]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ue]}],duration:[{duration:W()}],ease:[{ease:["linear","in","out","in-out",Ue]}],delay:[{delay:W()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ue]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[_d,Ue]}],"translate-x":[{"translate-x":[O]}],"translate-y":[{"translate-y":[O]}],"skew-x":[{"skew-x":[P]}],"skew-y":[{"skew-y":[P]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ue]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ue]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":z()}],"scroll-mx":[{"scroll-mx":z()}],"scroll-my":[{"scroll-my":z()}],"scroll-ms":[{"scroll-ms":z()}],"scroll-me":[{"scroll-me":z()}],"scroll-mt":[{"scroll-mt":z()}],"scroll-mr":[{"scroll-mr":z()}],"scroll-mb":[{"scroll-mb":z()}],"scroll-ml":[{"scroll-ml":z()}],"scroll-p":[{"scroll-p":z()}],"scroll-px":[{"scroll-px":z()}],"scroll-py":[{"scroll-py":z()}],"scroll-ps":[{"scroll-ps":z()}],"scroll-pe":[{"scroll-pe":z()}],"scroll-pt":[{"scroll-pt":z()}],"scroll-pr":[{"scroll-pr":z()}],"scroll-pb":[{"scroll-pb":z()}],"scroll-pl":[{"scroll-pl":z()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ue]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ai,Ps,Ux]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},C7=s7(E7);function fe(...e){return C7(DR(e))}const N7=HH,zr=KH,ho=GH,fr=g.forwardRef(({className:e,sideOffset:t=4,...n},r)=>d.jsx(AR,{ref:r,sideOffset:t,className:fe("z-50 overflow-hidden rounded-md border bg-bg-primary px-3 py-2 text-sm text-fg-primary shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}));fr.displayName=AR.displayName;const tt=Ee.createContext(new Proxy({},{get:()=>{throw new Error("Cannot use ValContext outside of ValProvider")}}));function P7(){return g.useContext(tt).client}function VR({children:e,client:t,dispatchValEvents:n}){var W,G,_e,ke,Ve;const[r,o,i,s,a,l]=LU(t),c=g.useMemo(()=>new qU(t,(Z,J)=>{n&&XU(Z,J)}),[n]),u="data"in r&&r.data?r.data.config:void 0,f="error"in r?r.error:void 0,[h,p]=g.useState();g.useEffect(()=>{if(h===void 0||h===!0)if(l){const Z=setTimeout(()=>{p(l)},2e3);return()=>{clearTimeout(Z)}}else l||p(!1)},[l,h]);const[m,v]=g.useState(null);g.useEffect(()=>{try{const Z=localStorage.getItem("val-theme-"+((u==null?void 0:u.project)||"unknown"));if(Z)if(Z==="light"||Z==="dark")v(Z);else throw new Error(`Invalid Val theme: ${Z}`);else f&&v("dark")}catch(Z){console.error("Error getting theme from local storage",Z)}},[u,f]),g.useEffect(()=>{u!=null&&u.defaultTheme&&m===null?(u==null?void 0:u.defaultTheme)==="dark"||(u==null?void 0:u.defaultTheme)==="light"?v(u.defaultTheme):console.warn(`Invalid config default theme: ${u.defaultTheme}`):u!==void 0&&m===null&&v("dark")},[m,u]);const x=g.useRef(null),b="data"in r&&r.data?r.data.baseSha:void 0,[w,S]=g.useState([]),C=g.useRef(new Set);g.useEffect(()=>{"data"in r&&r.data&&S(Z=>{var J,ce,Ne,he,Le,Pe;return(J=r.data)!=null&&J.deployments&&((ce=r.data.deployments)==null?void 0:ce.length)>0||(Ne=r.data)!=null&&Ne.commits&&((he=r.data.commits)==null?void 0:he.length)>0?ZU(Z,((Le=r.data)==null?void 0:Le.commits)||[],((Pe=r.data)==null?void 0:Pe.deployments)||[]).filter(Xe=>!C.current.has(Xe.commitSha)):Z})},["data"in r&&((W=r.data)==null?void 0:W.deployments)&&((G=r.data)==null?void 0:G.deployments.length),"data"in r&&((_e=r.data)==null?void 0:_e.commits)&&((ke=r.data)==null?void 0:ke.commits.length)]);const N=g.useCallback(Z=>{S(J=>J.filter(ce=>ce.commitSha!==Z)),C.current.add(Z)},[]),[P,_]=g.useState(new Set);g.useEffect(()=>{var Z;"data"in r&&((Z=r.data)!=null&&Z.commitSha)&&_(J=>{var Ne;if(((Ne=r.data)==null?void 0:Ne.commitSha)===void 0||J.has(r.data.commitSha))return J;const ce=new Set(J);return ce.add(r.data.commitSha),ce})},["data"in r&&((Ve=r.data)==null?void 0:Ve.commitSha)]);const[O,M]=g.useState({status:"not-asked"}),[D,U]=g.useState(!1),z=g.useSyncExternalStore(c.subscribe("schema"),()=>c.getAllSchemasSnapshot(),()=>c.getAllSchemasSnapshot());g.useEffect(()=>{if(z){const Z=z;let J=!1;for(const ce of Object.values(Z))if(zd(ce)){J=!0;break}U(J)}},[z]),g.useEffect(()=>{let Z=0;function J(){Z++,O.status!=="ready"&&Z<10&&t("/remote/settings","GET",{}).then(ce=>{ce.status===200?M({status:"ready",coreVersion:ce.json.coreVersion,buckets:ce.json.remoteFileBuckets.map(Ne=>Ne.bucket),publicProjectId:ce.json.publicProjectId}):("errorCode"in ce.json&&ce.json.errorCode?M({status:"inactive",reason:ce.json.errorCode,message:ce.json.message}):M({status:"inactive",reason:"unknown-error",message:"An unknown error has occurred"}),setTimeout(J,5e3))}).catch(ce=>{console.error("Error getting remote settings",ce),M({status:"inactive",reason:"unknown-error",message:"An unknown error has occurred"}),setTimeout(J,5e3)})}D&&(M({status:"loading"}),J())},[D]);const H=g.useRef("not-initialized"),[K,V]=g.useState(!1),I=Zl(c);g.useEffect(()=>{if(I===null&&H.current==="done"&&(H.current="not-initialized"),"data"in r&&r.data&&H.current==="not-initialized"){H.current="in-progress";let Z=null;const J=async()=>{if("data"in r&&r.data){console.debug("ValSyncEngine init started...",r.data.profileId);const ce=await c.init(r.data.mode,r.data.baseSha,r.data.schemaSha,r.data.sourcesSha,r.data.patches,r.data.profileId,r.data.commitSha??null,Date.now());console.debug("ValSyncEngine init result",ce),ce.status==="retry"?(H.current="retry",Z=setTimeout(J,4e3)):(console.debug("Val is initialized!",ce),H.current="done",Z&&clearTimeout(Z),V(!0))}else throw H.current="not-initialized",Error("Unexpected state: init was started with stat.data but now it is not there")};return J(),()=>{Z&&clearTimeout(Z)}}else"data"in r&&r.data&&H.current==="done"&&c.syncWithUpdatedStat(r.data.mode,r.data.baseSha,r.data.schemaSha,r.data.sourcesSha,r.data.patches,r.data.profileId,r.data.commitSha??null,Date.now())},[r,c,I]),g.useEffect(()=>{if(!K)return;let Z=null;const J=async()=>{if(I===null){V(!1),H.current="not-initialized";return}await c.sync(Date.now()),Z&&clearTimeout(Z),Z=setTimeout(J,1e3)};return J(),()=>{Z&&clearTimeout(Z)}},[c,I,K]);const[A,j]=g.useState({type:"not-asked"}),L=g.useSyncExternalStore(c.subscribe("pending-ops-count"),()=>c.getPendingOpsSnapshot(),()=>c.getPendingOpsSnapshot());g.useEffect(()=>{const Z=J=>{L>0&&(J.preventDefault(),J.returnValue="")};return window.addEventListener("beforeunload",Z),()=>{window.removeEventListener("beforeunload",Z)}},[L]);const $=_7(t,i,l);return d.jsx(tt.Provider,{value:{client:t,publishSummaryState:A,setPublishSummaryState:j,syncEngine:c,profileId:"data"in r&&r.data?r.data.profileId:null,mode:"data"in r&&r.data?r.data.mode:"unknown",serviceUnavailable:h,baseSha:b,observedCommitShas:P,deployments:w,dismissDeployment:N,portalRef:x.current,authenticationState:i,theme:m,setTheme:Z=>{if(Z==="dark"||Z==="light"){try{localStorage.setItem("val-theme-"+((u==null?void 0:u.project)||"unknown"),Z),localStorage.setItem("val-theme-unknown",Z)}catch(J){console.error("Error setting theme in local storage",J)}v(Z)}else console.warn(`Cannot set invalid theme theme: ${Z}`)},config:u,profiles:"data"in $&&$.data?$.data:{},remoteFiles:O},children:d.jsx(N7,{children:d.jsxs(HM,{initialProps:{mode:"default"},children:[d.jsx("div",{"data-val-portal":"true",ref:x,...m?{"data-mode":m}:{}}),e]})})})}function _7(e,t,n){const r=g.useRef(!0),[o,i]=g.useState({status:"not-asked"}),s=g.useCallback(async()=>{i(l=>({status:"loading",data:"data"in l?l.data:void 0}));const a=await e("/profiles","GET",{});if(a.status===200){const l={};for(const c of a.json.profiles)l[c.profileId]={fullName:c.fullName,email:c.email,avatar:c.avatar};i({status:"done",data:l})}else console.error("Could not get profiles",a.json),r.current=!0,i(l=>({status:"error",data:"data"in l?l.data:void 0}))},[e,o]);return g.useEffect(()=>{r.current&&(r.current=!1,o.status==="error"?setTimeout(()=>s(),2e3):o.status==="not-asked"&&s())},[t,e,o,n]),o}function In(){return g.useContext(tt).portalRef}function ay(){const{theme:e,setTheme:t}=g.useContext(tt);return{theme:e,setTheme:t}}function Gu(){const{config:e}=g.useContext(tt),t=g.useRef(e&&{...e,remoteHost:WC,appHost:Nb,studioPrefix:"/val/~"});return g.useEffect(()=>{e&&(t.current={...e,remoteHost:WC,appHost:Nb,studioPrefix:"/val/~"})},[e]),t.current}function RS(){const{remoteFiles:e}=g.useContext(tt);return e}function AS(){const{remoteFiles:e}=g.useContext(tt),[t,n]=g.useState(null);function r(o){return Math.floor(Math.random()*o)}return g.useEffect(()=>{e.status==="ready"&&e.buckets.length>0&&t===null&&n(e.buckets[r(e.buckets.length)])},[e]),t}function UR(){const{authenticationState:e}=g.useContext(tt);return e}function j7(){const{serviceUnavailable:e}=g.useContext(tt);return e===!0?"service-unavailable":"connected"}const kN=new TextEncoder,T7=y.object({patchId:y.string().refine(e=>e.length>0),filePath:y.string().refine(e=>e.length>0)});function bn(e){const{syncEngine:t,client:n}=g.useContext(tt),[r,o]=Y.splitModuleFilePathAndModulePath(e),i=g.useMemo(()=>Y.createPatchPath(o),[o]),s=g.useCallback((p,m)=>{t.addPatch(r,m,p,Date.now())},[t,r]),a=g.useCallback((p,m,v)=>t.addPatchAwaitable(r,m,p,v,Date.now()),[t,r]),l=g.useCallback((p,m,v)=>{t.addPatch(p,v,m,Date.now())},[t]),c=g.useCallback(async()=>{let p=await n("/direct-file-upload-settings","POST",{}),m=0;for(;p.status===null&&m<5;)console.warn("Failed to get direct file upload settings, retrying...",p),await new Promise(v=>setTimeout(v,500*(m+1))),p=await n("/direct-file-upload-settings","POST",{}),m++;return p.status===200?{status:"success",data:p.json}:{status:"error",error:"Could not get direct file upload settings"}},[n]),u=g.useCallback(async(p,m,v,x,b,w,S)=>{const C=m?{"x-val-auth-nonce":m}:{},{filePath:N,value:P,metadata:_,remote:O}=w;let M;if(O){const z=Y.remote.splitRemoteRef(N);if(z.status==="error")return Promise.reject({status:"error",error:{message:`Could not create correct file path of remote file (${z.error}). This is most likely a Val bug.`}});M="/"+z.filePath}else M=N;const D=JSON.stringify({filePath:M,parentRef:v,data:P,type:b,metadata:_,remote:O}),U=kN.encode(D).length;return S(0,U),new Promise(z=>{const H=new XMLHttpRequest;H.upload.addEventListener("progress",K=>{K.lengthComputable&&S(K.loaded,K.total)}),H.addEventListener("load",()=>{if(H.status>=200&&H.status<300)try{const K=H.responseText,V=JSON.parse(K),I=T7.safeParse(V);I.success?z({status:"done",patchId:I.data.patchId,filePath:I.data.filePath}):z({status:"error",error:{message:`While saving a file we got an unexpected response (${K==null?void 0:K.slice(0,100)}...)`}})}catch(K){z({status:"error",error:{message:`Got an exception while saving a file. Error: ${K instanceof Error?K.message:String(K)}`}})}else z({status:"error",error:{message:"Could not save patch file. HTTP error: "+H.status+" "+H.statusText}})}),H.addEventListener("error",()=>{z({status:"error",error:{message:"Could save source file (network error?)"}})}),H.addEventListener("abort",()=>{z({status:"error",error:{message:"Upload was aborted"}})}),H.responseType="text",H.open("POST",`${p}/patches/${x}/files`),H.setRequestHeader("Content-Type","application/json");for(const[K,V]of Object.entries(C))H.setRequestHeader(K,V);H.send(D)})},[]),f=g.useSyncExternalStore(t.subscribe("parent-ref"),()=>t.getParentRefSnapshot(),()=>t.getParentRefSnapshot()),h=g.useCallback(async(p,m,v,x)=>{if(f===null){v("Cannot upload files yet. Not initialized.");return}const b=await c();if(b.status!=="success"){v(b.error);return}const{baseUrl:w,nonce:S}=b.data,C=[],N=[];for(const M of p)M.op==="file"?(C.push(M),N.push({...M,value:typeof M.value=="string"?Y.getSHA256Hash(kN.encode(M.value)):M.value})):N.push(M);const P=t.createPatchId();let _=0;for(const M of C){const D=await u(w,S,f,P,m,M,(U,z)=>{x(U,z,_,C.length)});if(D.status==="error"){v(D.error.message);return}_++}const O=await a(N,m,P);if(O.status!=="patch-synced"){v(O.message);return}},[c,a,u,f,t]);return{patchPath:i,addPatch:s,addAndUploadPatchWithFileOps:h,addModuleFilePatch:l}}function WR(){const{syncEngine:e}=g.useContext(tt);return{deletePatches:g.useCallback(n=>{const r=[];for(let o=0;o<n.length;o+=100)r.push(n.slice(o,o+100));for(const o of r)e.deletePatches(o,Date.now())},[e])}}function O7(){const{deployments:e,dismissDeployment:t,observedCommitShas:n}=g.useContext(tt);return{deployments:e,dismissDeployment:t,observedCommitShas:n}}function M7(){const{syncEngine:e}=g.useContext(tt);return{status:"success",data:g.useSyncExternalStore(e.subscribe("patch-sets"),()=>e.getSerializedPatchSetsSnapshot(),()=>e.getSerializedPatchSetsSnapshot())}}function R7(){const{syncEngine:e}=g.useContext(tt),t=g.useSyncExternalStore(e.subscribe("all-patches"),()=>e.getAllPatchesSnapshot(),()=>e.getAllPatchesSnapshot()),n=ip();return g.useMemo(()=>{const o=new Set;for(const i of n){const s=t[i];s!=null&&s.isCommitted&&o.add(i)}return o},[t,n])}function HR(){const{syncEngine:e}=g.useContext(tt);return g.useSyncExternalStore(e.subscribe("global-server-side-patch-ids"),()=>e.getGlobalServerSidePatchIdsSnapshot(),()=>e.getGlobalServerSidePatchIdsSnapshot())}function KR(){const{syncEngine:e}=g.useContext(tt);return g.useSyncExternalStore(e.subscribe("pending-client-side-patch-ids"),()=>e.getPendingClientSidePatchIdsSnapshot(),()=>e.getPendingClientSidePatchIdsSnapshot())}function ip(){const{syncEngine:e}=g.useContext(tt),t=HR(),n=KR(),r=g.useSyncExternalStore(e.subscribe("saved-server-side-patch-ids"),()=>e.getSavedServerSidePatchIdsSnapshot(),()=>e.getSavedServerSidePatchIdsSnapshot());return g.useMemo(()=>{const i=new Set,s=[];for(const a of t)i.has(a)||s.push(a),i.add(a);for(const a of r)i.has(a)||s.push(a),i.add(a);for(const a of n)i.has(a)||s.push(a),i.add(a);return s},[t,n,r])}function qu(){const{mode:e}=g.useContext(tt);return e}function ly(){const{syncEngine:e}=g.useContext(tt);return g.useSyncExternalStore(e.subscribe("pending-ops-count"),()=>e.getPendingOpsSnapshot(),()=>e.getPendingOpsSnapshot())>0?"loading":"success"}const A7=y.union([y.object({type:y.literal("not-asked"),isGenerating:y.boolean().optional()}),y.object({type:y.literal("manual").or(y.literal("ai")),text:y.string(),patchIds:y.array(y.string()).nullable(),isGenerating:y.boolean()})]);function sp(){const{syncEngine:e,client:t,publishSummaryState:n,setPublishSummaryState:r,config:o}=g.useContext(tt),i=ip(),s=g.useSyncExternalStore(e.subscribe("publish-disabled"),()=>e.getPublishDisabledSnapshot(),()=>e.getPublishDisabledSnapshot()),{patchErrors:a}=YR(),l=g.useMemo(()=>{if(a)return Object.values(a).some(x=>x!==null)},[a]),[c,u]=g.useState(!1);g.useEffect(()=>{var x,b;((b=(x=o==null?void 0:o.ai)==null?void 0:x.commitMessages)==null?void 0:b.disabled)===void 0||o.ai.commitMessages.disabled===!1?u(!0):u(!1)},[o]),g.useEffect(()=>{if(n.type==="not-asked"){const x=D7(o==null?void 0:o.project);x&&x.type!=="not-asked"&&i.length>0&&r(x)}},[n,o==null?void 0:o.project,r]);const f=g.useCallback(async()=>{if(i===null)return{type:"error",message:"Empty patch set"};if("isGenerating"in n&&n.isGenerating)return{type:"error",message:"Already generating summary"};r(x=>({...x,isGenerating:!0}));try{const x=await t("/commit-summary","GET",{query:{patch_id:i}});return x.status===200?x.json.commitSummary?{type:"ai",text:x.json.commitSummary}:{type:"error",message:"Commit summary could not be generated"}:{type:"error",message:x.json.message}}finally{r(x=>({...x,isGenerating:!1}))}},[t,i,n]),[h,p]=g.useState(!1),m=g.useCallback(async x=>i===null?{status:"error",message:"No changes to publish"}:h?{status:"error",message:"Already publishing"}:(p(!0),e.publish(i,x,Date.now()).then(b=>(b.status==="done"&&(L7(o==null?void 0:o.project),r(w=>({type:"not-asked",isGenerating:w.isGenerating}))),b)).finally(()=>{p(!1)})),[i,h,o==null?void 0:o.project,e]),v=g.useCallback(x=>{r(b=>{let w;return x.type==="not-asked"?w={type:"not-asked",isGenerating:b.isGenerating}:w={type:x.type,text:x.text,patchIds:i,isGenerating:!!b.isGenerating},I7(w,o==null?void 0:o.project),w})},[i,r,o==null?void 0:o.project]);return{publish:m,publishDisabled:s||l,isPublishing:h,generateSummary:f,canGenerate:c,summary:n,setSummary:v}}function I7(e,t){try{localStorage.setItem("val-publish-summary-"+(t||"unknown"),JSON.stringify(e))}catch(n){console.error("Error setting publish summary in local storage",n)}return e}function D7(e){try{const t=localStorage.getItem("val-publish-summary-"+(e||"unknown"));if(t){const n=A7.safeParse(JSON.parse(t));if(n.success)return n.data;console.warn("Error parsing publish summary from local storage",n.error)}}catch(t){console.error("Error getting publish summary from local storage",t)}return null}function L7(e){try{localStorage.removeItem("val-publish-summary-"+(e||"unknown"))}catch(t){console.error("Error deleting publish summary from local storage",t)}}function F7(){const{profileId:e,profiles:t}=g.useContext(tt);return e?t[e]??null:null}const Zl=e=>g.useSyncExternalStore(e.subscribe("initialized-at"),()=>e.getInitializedAtSnapshot(),()=>e.getInitializedAtSnapshot()).data;function IS(){const{syncEngine:e}=g.useContext(tt);return{autoPublish:g.useSyncExternalStore(e.subscribe("auto-publish"),()=>e.getAutoPublishSnapshot(),()=>e.getAutoPublishSnapshot()),setAutoPublish:n=>{e.setAutoPublish(Date.now(),n)}}}function GR(e){const{syncEngine:t}=g.useContext(tt),[n]=g.useMemo(()=>Y.splitModuleFilePathAndModulePath(e),[e]),r=g.useSyncExternalStore(t.subscribe("render",n),()=>t.getRenderSnapshot(n),()=>t.getRenderSnapshot(n)),o=g.useSyncExternalStore(t.subscribe("source",n),()=>t.getSourceSnapshot(n),()=>t.getSourceSnapshot(n)),i=Zl(t);return g.useMemo(()=>{const s=o.status==="success"&&o.optimistic,a=r==null?void 0:r[e];return i===null||s?{status:"loading",data:a&&"data"in a?a==null?void 0:a.data:void 0}:a},[r,i,o,e])}function Ft(e){const{syncEngine:t}=g.useContext(tt),[n,r]=g.useMemo(()=>Y.splitModuleFilePathAndModulePath(e),[e]),o=g.useSyncExternalStore(t.subscribe("schema"),()=>t.getSchemaSnapshot(n),()=>t.getSchemaSnapshot(n)),i=g.useSyncExternalStore(t.subscribe("source",n),()=>t.getSourceSnapshot(n),()=>t.getSourceSnapshot(n)),s=g.useMemo(()=>{if(o.status!=="success")return o;if(i.status!=="success")return i;let l=null;try{const c=Y.safeResolvePath(r,i.data,o.data);if(c.status==="error")return{status:"error",error:c.message};if(c.status==="source-undefined")return{status:"source-not-found"};l=c.schema}catch(c){return console.error("Error resolving schema at path",e,r,i.data,o.data,c),{status:"error",error:`Error resolving schema at path: ${c instanceof Error?c.message:String(c)}`}}return l?{status:"success",data:l}:{status:"resolved-schema-not-found"}},[o,i,n,r]);return Zl(t)===null?{status:"loading"}:s.status!=="success"?s.status==="resolved-schema-not-found"?{status:"not-found"}:s.status==="no-schemas"?{status:"error",error:"No schemas"}:s.status==="module-schema-not-found"?{status:"not-found"}:{status:"loading"}:s}function Ba(){const{syncEngine:e}=g.useContext(tt),t=g.useSyncExternalStore(e.subscribe("schema"),()=>e.getAllSchemasSnapshot(),()=>e.getAllSchemasSnapshot());if(Zl(e)===null)return{status:"loading"};if(t===null)return console.warn("Schemas: not found"),{status:"error",error:"Schemas not found"};const r={};for(const[o,i]of Object.entries(t)){const s=o;i&&(r[s]=i)}return{status:"success",data:r}}function qR(e){const{syncEngine:t}=g.useContext(tt);return g.useSyncExternalStore(t.subscribe("validation-error",e),()=>t.getValidationErrorSnapshot(e),()=>t.getValidationErrorSnapshot(e))||[]}function Ql(){const{syncEngine:e}=g.useContext(tt);return g.useSyncExternalStore(e.subscribe("all-validation-errors"),()=>e.getAllValidationErrorsSnapshot(),()=>e.getAllValidationErrorsSnapshot())}function z7(){const{syncEngine:e}=g.useContext(tt);return{globalTransientErrors:g.useSyncExternalStore(e.subscribe("global-transient-errors"),()=>e.getGlobalTransientErrorsSnapshot(),()=>e.getGlobalTransientErrorsSnapshot()),removeGlobalTransientErrors:n=>{e.removeGlobalTransientErrors(n)}}}function $7(){const{syncEngine:e,remoteFiles:t}=g.useContext(tt),n=g.useSyncExternalStore(e.subscribe("network-error"),()=>e.getNetworkErrorSnapshot(),()=>e.getNetworkErrorSnapshot());return n!==null?{type:"network-error",networkError:n}:t.status==="inactive"?{type:"remote-files-error",error:t.message}:null}function YR(){const{syncEngine:e}=g.useContext(tt),[t,n]=g.useState([]),r=g.useSyncExternalStore(e.subscribe("schema"),()=>e.getAllSchemasSnapshot(),()=>e.getAllSchemasSnapshot());return g.useEffect(()=>{n(Object.keys(r))},[r]),{patchErrors:g.useSyncExternalStore(e.subscribe("patch-errors",t),()=>e.getPatchErrorsSnapshot(t),()=>e.getPatchErrorsSnapshot(t))}}function DS(){return{globalErrors:[],skippedPatches:{}}}function LS(){const{profiles:e}=g.useContext(tt);return e}function lt(e,t){const{syncEngine:n}=g.useContext(tt),[r,o]=e?Y.splitModuleFilePathAndModulePath(e):["",""],i=g.useSyncExternalStore(n.subscribe("source",r),()=>n.getSourceSnapshot(r),()=>n.getSourceSnapshot(r)),s=Zl(n);return g.useMemo(()=>{if(s===null)return{status:"loading"};if(i.status==="success"){const l=i.data;return l!==void 0&&t!==void 0?B7(r,o,t,l,i.optimistic):{status:"not-found"}}return{status:"error",error:i.message||"Unknown error"}},[i,o,r,s,t])}function JR(e,t){const{syncEngine:n}=g.useContext(tt),r=g.useSyncExternalStore(n.subscribe("sources",e||[]),()=>n.getSourcesSnapshot(e||[]),()=>n.getSourcesSnapshot(e||[])),o=Zl(n);return g.useMemo(()=>{if(o===null)return{status:"loading"};if(!r)return{status:"not-found",data:[],notFoundPaths:e||[]};const i=[],s=[],a=[];if(!e||e.length===0)return{status:"success",data:[]};for(let l=0;l<e.length;l++){const c=e==null?void 0:e[l];if(c===void 0)throw new Error("While resolving shallow modules at paths, we unexpectedly got an undefined module file path");const u=r==null?void 0:r[l];u||a.push(c);const f=QR(c,"",t,u);f.status==="success"?i.push(f.data):s.push({moduleFilePath:c,message:f.error})}return a.length>0?{status:"not-found",data:i,notFoundPaths:a}:s.length>0?{status:"error",data:i,errors:s}:{status:"success",data:i}},[r,t,o,e])}function XR(){const e=Ba();return g.useMemo(()=>{if(e.status==="success"){let t=null;for(const n in e.data){const r=A8(n);if(r){if(t===null)t=r;else if(t!==r)return{status:"error",error:"Found multiple different src folders in the same project"}}}return{status:"success",data:t}}return e},[e])}function FS(){const{syncEngine:e}=g.useContext(tt);return g.useSyncExternalStore(e.subscribe("all-sources"),()=>e.getAllSourcesSnapshot(),()=>e.getAllSourcesSnapshot())}function zS(e){const{syncEngine:t}=g.useContext(tt),[n,r]=Y.splitModuleFilePathAndModulePath(e),o=g.useSyncExternalStore(t.subscribe("source",n),()=>t.getSourceSnapshot(n),()=>t.getSourceSnapshot(n)),i=Zl(t);return g.useMemo(()=>i===null?{status:"loading"}:o.status==="success"?ZR(r,o.data):{status:"error",error:o.message||"Unknown error"},[o,i,r,n])}function ZR(e,t){let n=t;if(t===void 0)return{status:"not-found"};for(const r of Y.splitModulePath(e)){if(n===null)return{status:"error",error:`Expected object at ${e}, got null`};if(n===void 0)return{status:"error",error:`Expected object at ${e}, got undefined`};if(typeof n!="object")return{status:"error",error:`Expected object at ${e}, got ${JSON.stringify(n)}`};if(Qs(n)){const o=Number(r);if(Number.isNaN(o))return{status:"error",error:`Expected number at ${e}, got ${r}`};n=n[o]}else n=n[r]}return n===void 0?{status:"error",error:`Expected object at ${e}, got undefined`}:{status:"success",data:n}}function B7(e,t,n,r,o){const i=ZR(t,r);if("data"in i&&i.data!==void 0){const s=QR(e,t,n,i.data);return s.status==="success"?{status:"success",data:s.data,clientSideOnly:o}:s}return i}function QR(e,t,n,r){if(r===null)return{status:"success",data:null};const o=n;if(o==="object"||o==="record"){if(typeof r!="object")return{status:"error",error:`Expected object, got ${typeof r}`};if(Qs(r))return{status:"error",error:"Expected object, got array"};const i={};for(const s of Object.keys(r))i[s]=Wx(e,t,s);return{status:"success",data:i}}else if(o==="array"){if(typeof r!="object"||!Qs(r))return{status:"error",error:`Expected array, got ${typeof r}`};const i=[];for(let s=0;s<r.length;s++)i.push(Wx(e,t,s));return{status:"success",data:i}}else{if(o==="boolean")return typeof r!="boolean"&&r!==null?{status:"error",error:`Expected boolean, got ${typeof r}`}:{status:"success",data:r};if(o==="number")return typeof r!="number"&&r!==null?{status:"error",error:`Expected number, got ${typeof r}`}:{status:"success",data:r};if(o==="richtext")return typeof r!="object"||!Qs(r)?{status:"error",error:`Expected richtext (i.e. array), got ${typeof r}`}:{status:"success",data:r};if(o==="date"||o==="string"||o==="literal")return typeof r!="string"&&r!==null?{status:"error",error:`Expected string, got ${typeof r}: ${JSON.stringify(r)}`}:{status:"success",data:r};if(o==="file"||o==="image")return typeof r!="object"||!(bt in r)||r[bt]===void 0?{status:"error",error:`Expected object with ${bt} property, got ${typeof r}`}:"metadata"in r&&r.metatadata&&typeof r.metatadata!="object"?{status:"error",error:`Expected metadata of ${o} to be an object, got ${typeof r.metadata}`}:{status:"success",data:r};if(o==="keyOf")return typeof r!="string"?{status:"error",error:`Expected string, got ${typeof r}`}:{status:"success",data:r};if(o==="union"){if(typeof r=="string")return{status:"success",data:r};if(typeof r!="object")return{status:"error",error:`Expected object, got ${typeof r}`};if(Qs(r))return{status:"error",error:"Expected object, got array"};const i={};for(const s of Object.keys(r))i[s]=Wx(e,t,s);return{status:"success",data:i}}else return{status:"error",error:`Unknown schema type: ${o}`}}}function Wx(e,t,n){return t?e+ba+t+"."+JSON.stringify(n):e+ba+n}var e2={exports:{}};/*!
|
|
52
|
-
Copyright (c) 2018 Jed Watson.
|
|
53
|
-
Licensed under the MIT License (MIT), see
|
|
54
|
-
http://jedwatson.github.io/classnames
|
|
55
|
-
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var i="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(i=o(i,r(a)))}return i}function r(i){if(typeof i=="string"||typeof i=="number")return i;if(typeof i!="object")return"";if(Array.isArray(i))return n.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var s="";for(var a in i)t.call(i,a)&&i[a]&&(s=o(s,a));return s}function o(i,s){return s?i?i+" "+s:i+s:i}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(e2);var V7=e2.exports;const Ce=Da(V7);/**
|
|
56
|
-
* @license lucide-react v0.379.0 - ISC
|
|
57
|
-
*
|
|
58
|
-
* This source code is licensed under the ISC license.
|
|
59
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
60
|
-
*/const U7=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),t2=(...e)=>e.filter((t,n,r)=>!!t&&r.indexOf(t)===n).join(" ");/**
|
|
61
|
-
* @license lucide-react v0.379.0 - ISC
|
|
62
|
-
*
|
|
63
|
-
* This source code is licensed under the ISC license.
|
|
64
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
65
|
-
*/var W7={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"};/**
|
|
66
|
-
* @license lucide-react v0.379.0 - ISC
|
|
67
|
-
*
|
|
68
|
-
* This source code is licensed under the ISC license.
|
|
69
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
70
|
-
*/const H7=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:s,...a},l)=>g.createElement("svg",{ref:l,...W7,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:t2("lucide",o),...a},[...s.map(([c,u])=>g.createElement(c,u)),...Array.isArray(i)?i:[i]]));/**
|
|
71
|
-
* @license lucide-react v0.379.0 - ISC
|
|
72
|
-
*
|
|
73
|
-
* This source code is licensed under the ISC license.
|
|
74
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
75
|
-
*/const me=(e,t)=>{const n=g.forwardRef(({className:r,...o},i)=>g.createElement(H7,{ref:i,iconNode:t,className:t2(`lucide-${U7(e)}`,r),...o}));return n.displayName=`${e}`,n};/**
|
|
76
|
-
* @license lucide-react v0.379.0 - ISC
|
|
77
|
-
*
|
|
78
|
-
* This source code is licensed under the ISC license.
|
|
79
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
80
|
-
*/const K7=me("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);/**
|
|
81
|
-
* @license lucide-react v0.379.0 - ISC
|
|
82
|
-
*
|
|
83
|
-
* This source code is licensed under the ISC license.
|
|
84
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
85
|
-
*/const n2=me("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
|
|
86
|
-
* @license lucide-react v0.379.0 - ISC
|
|
87
|
-
*
|
|
88
|
-
* This source code is licensed under the ISC license.
|
|
89
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
90
|
-
*/const Yu=me("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
91
|
-
* @license lucide-react v0.379.0 - ISC
|
|
92
|
-
*
|
|
93
|
-
* This source code is licensed under the ISC license.
|
|
94
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
95
|
-
*/const Ju=me("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
96
|
-
* @license lucide-react v0.379.0 - ISC
|
|
97
|
-
*
|
|
98
|
-
* This source code is licensed under the ISC license.
|
|
99
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
100
|
-
*/const G7=me("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
|
|
101
|
-
* @license lucide-react v0.379.0 - ISC
|
|
102
|
-
*
|
|
103
|
-
* This source code is licensed under the ISC license.
|
|
104
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
105
|
-
*/const Xu=me("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
106
|
-
* @license lucide-react v0.379.0 - ISC
|
|
107
|
-
*
|
|
108
|
-
* This source code is licensed under the ISC license.
|
|
109
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
110
|
-
*/const q7=me("ChevronsDown",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]);/**
|
|
111
|
-
* @license lucide-react v0.379.0 - ISC
|
|
112
|
-
*
|
|
113
|
-
* This source code is licensed under the ISC license.
|
|
114
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
115
|
-
*/const Y7=me("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
116
|
-
* @license lucide-react v0.379.0 - ISC
|
|
117
|
-
*
|
|
118
|
-
* This source code is licensed under the ISC license.
|
|
119
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
120
|
-
*/const J7=me("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
121
|
-
* @license lucide-react v0.379.0 - ISC
|
|
122
|
-
*
|
|
123
|
-
* This source code is licensed under the ISC license.
|
|
124
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
125
|
-
*/const Hx=me("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
126
|
-
* @license lucide-react v0.379.0 - ISC
|
|
127
|
-
*
|
|
128
|
-
* This source code is licensed under the ISC license.
|
|
129
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
130
|
-
*/const X7=me("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
|
|
131
|
-
* @license lucide-react v0.379.0 - ISC
|
|
132
|
-
*
|
|
133
|
-
* This source code is licensed under the ISC license.
|
|
134
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
135
|
-
*/const Z7=me("Compass",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76",key:"m9r19z"}]]);/**
|
|
136
|
-
* @license lucide-react v0.379.0 - ISC
|
|
137
|
-
*
|
|
138
|
-
* This source code is licensed under the ISC license.
|
|
139
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
140
|
-
*/const Q7=me("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
|
|
141
|
-
* @license lucide-react v0.379.0 - ISC
|
|
142
|
-
*
|
|
143
|
-
* This source code is licensed under the ISC license.
|
|
144
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
145
|
-
*/const eK=me("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"}]]);/**
|
|
146
|
-
* @license lucide-react v0.379.0 - ISC
|
|
147
|
-
*
|
|
148
|
-
* This source code is licensed under the ISC license.
|
|
149
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
150
|
-
*/const tK=me("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
|
|
151
|
-
* @license lucide-react v0.379.0 - ISC
|
|
152
|
-
*
|
|
153
|
-
* This source code is licensed under the ISC license.
|
|
154
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
155
|
-
*/const $S=me("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/**
|
|
156
|
-
* @license lucide-react v0.379.0 - ISC
|
|
157
|
-
*
|
|
158
|
-
* This source code is licensed under the ISC license.
|
|
159
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
160
|
-
*/const nK=me("EyeOff",[["path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24",key:"1jxqfv"}],["path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",key:"9wicm4"}],["path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61",key:"1jreej"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/**
|
|
161
|
-
* @license lucide-react v0.379.0 - ISC
|
|
162
|
-
*
|
|
163
|
-
* This source code is licensed under the ISC license.
|
|
164
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
165
|
-
*/const rK=me("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"}]]);/**
|
|
166
|
-
* @license lucide-react v0.379.0 - ISC
|
|
167
|
-
*
|
|
168
|
-
* This source code is licensed under the ISC license.
|
|
169
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
170
|
-
*/const r2=me("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
|
171
|
-
* @license lucide-react v0.379.0 - ISC
|
|
172
|
-
*
|
|
173
|
-
* This source code is licensed under the ISC license.
|
|
174
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
175
|
-
*/const o2=me("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/**
|
|
176
|
-
* @license lucide-react v0.379.0 - ISC
|
|
177
|
-
*
|
|
178
|
-
* This source code is licensed under the ISC license.
|
|
179
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
180
|
-
*/const oK=me("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
|
|
181
|
-
* @license lucide-react v0.379.0 - ISC
|
|
182
|
-
*
|
|
183
|
-
* This source code is licensed under the ISC license.
|
|
184
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
185
|
-
*/const Rg=me("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"}]]);/**
|
|
186
|
-
* @license lucide-react v0.379.0 - ISC
|
|
187
|
-
*
|
|
188
|
-
* This source code is licensed under the ISC license.
|
|
189
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
190
|
-
*/const iK=me("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
|
|
191
|
-
* @license lucide-react v0.379.0 - ISC
|
|
192
|
-
*
|
|
193
|
-
* This source code is licensed under the ISC license.
|
|
194
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
195
|
-
*/const sK=me("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/**
|
|
196
|
-
* @license lucide-react v0.379.0 - ISC
|
|
197
|
-
*
|
|
198
|
-
* This source code is licensed under the ISC license.
|
|
199
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
200
|
-
*/const EN=me("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"}]]);/**
|
|
201
|
-
* @license lucide-react v0.379.0 - ISC
|
|
202
|
-
*
|
|
203
|
-
* This source code is licensed under the ISC license.
|
|
204
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
205
|
-
*/const CN=me("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"}]]);/**
|
|
206
|
-
* @license lucide-react v0.379.0 - ISC
|
|
207
|
-
*
|
|
208
|
-
* This source code is licensed under the ISC license.
|
|
209
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
210
|
-
*/const NN=me("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"}]]);/**
|
|
211
|
-
* @license lucide-react v0.379.0 - ISC
|
|
212
|
-
*
|
|
213
|
-
* This source code is licensed under the ISC license.
|
|
214
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
215
|
-
*/const PN=me("Heading4",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 10v4h4",key:"13sv97"}],["path",{d:"M21 10v8",key:"1kdml4"}]]);/**
|
|
216
|
-
* @license lucide-react v0.379.0 - ISC
|
|
217
|
-
*
|
|
218
|
-
* This source code is licensed under the ISC license.
|
|
219
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
220
|
-
*/const _N=me("Heading5",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 13v-3h4",key:"1nvgqp"}],["path",{d:"M17 17.7c.4.2.8.3 1.3.3 1.5 0 2.7-1.1 2.7-2.5S19.8 13 18.3 13H17",key:"2nebdn"}]]);/**
|
|
221
|
-
* @license lucide-react v0.379.0 - ISC
|
|
222
|
-
*
|
|
223
|
-
* This source code is licensed under the ISC license.
|
|
224
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
225
|
-
*/const jN=me("Heading6",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["circle",{cx:"19",cy:"16",r:"2",key:"15mx69"}],["path",{d:"M20 10c-2 2-3 3.5-3 6",key:"f35dl0"}]]);/**
|
|
226
|
-
* @license lucide-react v0.379.0 - ISC
|
|
227
|
-
*
|
|
228
|
-
* This source code is licensed under the ISC license.
|
|
229
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
230
|
-
*/const i2=me("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"}]]);/**
|
|
231
|
-
* @license lucide-react v0.379.0 - ISC
|
|
232
|
-
*
|
|
233
|
-
* This source code is licensed under the ISC license.
|
|
234
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
235
|
-
*/const aK=me("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"}]]);/**
|
|
236
|
-
* @license lucide-react v0.379.0 - ISC
|
|
237
|
-
*
|
|
238
|
-
* This source code is licensed under the ISC license.
|
|
239
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
240
|
-
*/const lK=me("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/**
|
|
241
|
-
* @license lucide-react v0.379.0 - ISC
|
|
242
|
-
*
|
|
243
|
-
* This source code is licensed under the ISC license.
|
|
244
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
245
|
-
*/const cK=me("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
|
|
246
|
-
* @license lucide-react v0.379.0 - ISC
|
|
247
|
-
*
|
|
248
|
-
* This source code is licensed under the ISC license.
|
|
249
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
250
|
-
*/const BS=me("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/**
|
|
251
|
-
* @license lucide-react v0.379.0 - ISC
|
|
252
|
-
*
|
|
253
|
-
* This source code is licensed under the ISC license.
|
|
254
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
255
|
-
*/const uK=me("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"}]]);/**
|
|
256
|
-
* @license lucide-react v0.379.0 - ISC
|
|
257
|
-
*
|
|
258
|
-
* This source code is licensed under the ISC license.
|
|
259
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
260
|
-
*/const s2=me("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"}]]);/**
|
|
261
|
-
* @license lucide-react v0.379.0 - ISC
|
|
262
|
-
*
|
|
263
|
-
* This source code is licensed under the ISC license.
|
|
264
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
265
|
-
*/const Gr=me("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
266
|
-
* @license lucide-react v0.379.0 - ISC
|
|
267
|
-
*
|
|
268
|
-
* This source code is licensed under the ISC license.
|
|
269
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
270
|
-
*/const dK=me("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/**
|
|
271
|
-
* @license lucide-react v0.379.0 - ISC
|
|
272
|
-
*
|
|
273
|
-
* This source code is licensed under the ISC license.
|
|
274
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
275
|
-
*/const fK=me("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
|
|
276
|
-
* @license lucide-react v0.379.0 - ISC
|
|
277
|
-
*
|
|
278
|
-
* This source code is licensed under the ISC license.
|
|
279
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
280
|
-
*/const hK=me("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
|
|
281
|
-
* @license lucide-react v0.379.0 - ISC
|
|
282
|
-
*
|
|
283
|
-
* This source code is licensed under the ISC license.
|
|
284
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
285
|
-
*/const pK=me("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
|
286
|
-
* @license lucide-react v0.379.0 - ISC
|
|
287
|
-
*
|
|
288
|
-
* This source code is licensed under the ISC license.
|
|
289
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
290
|
-
*/const Kx=me("PanelBottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/**
|
|
291
|
-
* @license lucide-react v0.379.0 - ISC
|
|
292
|
-
*
|
|
293
|
-
* This source code is licensed under the ISC license.
|
|
294
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
295
|
-
*/const mK=me("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
|
|
296
|
-
* @license lucide-react v0.379.0 - ISC
|
|
297
|
-
*
|
|
298
|
-
* This source code is licensed under the ISC license.
|
|
299
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
300
|
-
*/const Ag=me("PanelRightOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]);/**
|
|
301
|
-
* @license lucide-react v0.379.0 - ISC
|
|
302
|
-
*
|
|
303
|
-
* This source code is licensed under the ISC license.
|
|
304
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
305
|
-
*/const gK=me("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
|
|
306
|
-
* @license lucide-react v0.379.0 - ISC
|
|
307
|
-
*
|
|
308
|
-
* This source code is licensed under the ISC license.
|
|
309
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
310
|
-
*/const Gx=me("PanelTop",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]]);/**
|
|
311
|
-
* @license lucide-react v0.379.0 - ISC
|
|
312
|
-
*
|
|
313
|
-
* This source code is licensed under the ISC license.
|
|
314
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
315
|
-
*/const Ig=me("PanelsTopLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]);/**
|
|
316
|
-
* @license lucide-react v0.379.0 - ISC
|
|
317
|
-
*
|
|
318
|
-
* This source code is licensed under the ISC license.
|
|
319
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
320
|
-
*/const vK=me("Pen",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}]]);/**
|
|
321
|
-
* @license lucide-react v0.379.0 - ISC
|
|
322
|
-
*
|
|
323
|
-
* This source code is licensed under the ISC license.
|
|
324
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
325
|
-
*/const VS=me("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
326
|
-
* @license lucide-react v0.379.0 - ISC
|
|
327
|
-
*
|
|
328
|
-
* This source code is licensed under the ISC license.
|
|
329
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
330
|
-
*/const a2=me("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
|
|
331
|
-
* @license lucide-react v0.379.0 - ISC
|
|
332
|
-
*
|
|
333
|
-
* This source code is licensed under the ISC license.
|
|
334
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
335
|
-
*/const yK=me("Split",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]]);/**
|
|
336
|
-
* @license lucide-react v0.379.0 - ISC
|
|
337
|
-
*
|
|
338
|
-
* This source code is licensed under the ISC license.
|
|
339
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
340
|
-
*/const xK=me("SquareArrowOutUpRight",[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]]);/**
|
|
341
|
-
* @license lucide-react v0.379.0 - ISC
|
|
342
|
-
*
|
|
343
|
-
* This source code is licensed under the ISC license.
|
|
344
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
345
|
-
*/const bK=me("SquareDashedMousePointer",[["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"m12 12 4 10 1.7-4.3L22 16Z",key:"64ilsv"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h2",key:"1qve2z"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v2",key:"p14lih"}],["path",{d:"M3 14v1",key:"vnatye"}]]);/**
|
|
346
|
-
* @license lucide-react v0.379.0 - ISC
|
|
347
|
-
*
|
|
348
|
-
* This source code is licensed under the ISC license.
|
|
349
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
350
|
-
*/const wK=me("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z",key:"1lpok0"}]]);/**
|
|
351
|
-
* @license lucide-react v0.379.0 - ISC
|
|
352
|
-
*
|
|
353
|
-
* This source code is licensed under the ISC license.
|
|
354
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
355
|
-
*/const SK=me("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"}]]);/**
|
|
356
|
-
* @license lucide-react v0.379.0 - ISC
|
|
357
|
-
*
|
|
358
|
-
* This source code is licensed under the ISC license.
|
|
359
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
360
|
-
*/const kK=me("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
|
|
361
|
-
* @license lucide-react v0.379.0 - ISC
|
|
362
|
-
*
|
|
363
|
-
* This source code is licensed under the ISC license.
|
|
364
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
365
|
-
*/const EK=me("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/**
|
|
366
|
-
* @license lucide-react v0.379.0 - ISC
|
|
367
|
-
*
|
|
368
|
-
* This source code is licensed under the ISC license.
|
|
369
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
370
|
-
*/const CK=me("ToggleRight",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"16",cy:"12",r:"2",key:"4ma0v8"}]]);/**
|
|
371
|
-
* @license lucide-react v0.379.0 - ISC
|
|
372
|
-
*
|
|
373
|
-
* This source code is licensed under the ISC license.
|
|
374
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
375
|
-
*/const US=me("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"}]]);/**
|
|
376
|
-
* @license lucide-react v0.379.0 - ISC
|
|
377
|
-
*
|
|
378
|
-
* This source code is licensed under the ISC license.
|
|
379
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
380
|
-
*/const NK=me("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]]);/**
|
|
381
|
-
* @license lucide-react v0.379.0 - ISC
|
|
382
|
-
*
|
|
383
|
-
* This source code is licensed under the ISC license.
|
|
384
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
385
|
-
*/const Su=me("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
386
|
-
* @license lucide-react v0.379.0 - ISC
|
|
387
|
-
*
|
|
388
|
-
* This source code is licensed under the ISC license.
|
|
389
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
390
|
-
*/const PK=me("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"}]]);/**
|
|
391
|
-
* @license lucide-react v0.379.0 - ISC
|
|
392
|
-
*
|
|
393
|
-
* This source code is licensed under the ISC license.
|
|
394
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
395
|
-
*/const Hb=me("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"}]]);/**
|
|
396
|
-
* @license lucide-react v0.379.0 - ISC
|
|
397
|
-
*
|
|
398
|
-
* This source code is licensed under the ISC license.
|
|
399
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
400
|
-
*/const _K=me("Unlink",[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]);/**
|
|
401
|
-
* @license lucide-react v0.379.0 - ISC
|
|
402
|
-
*
|
|
403
|
-
* This source code is licensed under the ISC license.
|
|
404
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
405
|
-
*/const Dg=me("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
|
|
406
|
-
* @license lucide-react v0.379.0 - ISC
|
|
407
|
-
*
|
|
408
|
-
* This source code is licensed under the ISC license.
|
|
409
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
410
|
-
*/const jK=me("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
|
|
411
|
-
* @license lucide-react v0.379.0 - ISC
|
|
412
|
-
*
|
|
413
|
-
* This source code is licensed under the ISC license.
|
|
414
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
415
|
-
*/const l2=me("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/**
|
|
416
|
-
* @license lucide-react v0.379.0 - ISC
|
|
417
|
-
*
|
|
418
|
-
* This source code is licensed under the ISC license.
|
|
419
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
420
|
-
*/const Rl=me("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function ku({isOpen:e,children:t,duration:n=.3,className:r}){return d.jsx("div",{style:{transition:`grid-template-rows ${n}s`},className:Ce("grid overflow-hidden",r,{"grid-rows-[0fr]":!e,"grid-rows-[1fr]":e}),children:d.jsx("div",{style:{transition:`visibility ${n}s`},className:Ce("min-h-0",{visible:e,invisible:!e}),children:t})})}function wf(e){let t="",n=!1;for(let r=0;r<e.length;r++){const o=e[r]!==e[r].toLowerCase();r===0?(t+=e[r].toUpperCase(),n=!1):n&&o?(n=!1,t+=" "+e[r].toUpperCase()):(t+=e[r].toLowerCase(),n=!0)}return t=t.replace(/[-–—]/g,""),t}function Eu(e){return e.endsWith(".val.ts")||e.endsWith(".val.js")?wf(e.slice(0,-7)):wf(e)}const c2=Ee.createContext(new Proxy({},{get:()=>{throw Error("ValRouter context not provided")}})),qx="/val/~";function TN(e,t){var n;(n=e.getElementById("val-content-area"))==null||n.scrollTo({top:t.offsetTop,behavior:"smooth"})}function u2({children:e,overlay:t}){const[n,r]=g.useState(!1),[o,i]=g.useState(""),s=g.useRef([]);g.useEffect(()=>{const l=()=>{const c=location.pathname.indexOf(qx);if(c>-1){const u=new URLSearchParams(location.search).get("p"),h=location.pathname.slice(c+qx.length)+(u?`?p=${u}`:"");i(h);const p=s.current.pop();if(p)setTimeout(()=>{var v,x;const m=(x=(v=document.getElementById("val-shadow-root"))==null?void 0:v.shadowRoot)==null?void 0:x.getElementById("val-content-area");p&&(m==null||m.scrollTo(0,p))},50);else if(location.hash){const m=decodeURIComponent(location.hash.slice(1));window.history.replaceState(null,"",location.pathname+location.search);let v=100;const x=()=>{var b;if(m){const w=(b=document.getElementById("val-shadow-root"))==null?void 0:b.shadowRoot,S=w==null?void 0:w.getElementById(m);S&&w?TN(w,S):v>0&&(v--,setTimeout(x,100))}};x()}}r(!0)};return l(),window.addEventListener("popstate",l),()=>{window.removeEventListener("popstate",l)}},[]);const a=g.useCallback((l,c)=>{var f;const u=`${qx}${l}`;if(i(l),t)window.location.href=u+(c!=null&&c.scrollToId?`#${c.scrollToId}`:"");else{const h=(f=document.getElementById("val-shadow-root"))==null?void 0:f.shadowRoot,p=h==null?void 0:h.getElementById("val-content-area"),m=p==null?void 0:p.scrollTop,v=c==null?void 0:c.scrollToId;v&&h?setTimeout(()=>{const x=h.getElementById(v);x&&h&&TN(h,x)},100):p==null||p.scrollTo(0,0),m!==void 0&&s.current.push(m),c!=null&&c.replace?window.history.replaceState(null,"",u):window.history.pushState(null,"",u)}},[t]);return d.jsx(c2.Provider,{value:{hardLink:!!t,currentSourcePath:o,navigate:a,ready:n},children:e})}function xn(){const{navigate:e,currentSourcePath:t,ready:n}=g.useContext(c2);return{navigate:e,currentSourcePath:t,ready:n}}var TK=g.createContext(void 0);function ap(e){const t=g.useContext(TK);return e||t||"ltr"}function Kb(e,[t,n]){return Math.min(n,Math.max(t,e))}function OK(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}var WS="ScrollArea",[d2,mge]=So(WS),[MK,ko]=d2(WS),f2=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:i=600,...s}=e,[a,l]=g.useState(null),[c,u]=g.useState(null),[f,h]=g.useState(null),[p,m]=g.useState(null),[v,x]=g.useState(null),[b,w]=g.useState(0),[S,C]=g.useState(0),[N,P]=g.useState(!1),[_,O]=g.useState(!1),M=Be(t,U=>l(U)),D=ap(o);return d.jsx(MK,{scope:n,type:r,dir:D,scrollHideDelay:i,scrollArea:a,viewport:c,onViewportChange:u,content:f,onContentChange:h,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:N,onScrollbarXEnabledChange:P,scrollbarY:v,onScrollbarYChange:x,scrollbarYEnabled:_,onScrollbarYEnabledChange:O,onCornerWidthChange:w,onCornerHeightChange:C,children:d.jsx(Oe.div,{dir:D,...s,ref:M,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":S+"px",...e.style}})})});f2.displayName=WS;var h2="ScrollAreaViewport",p2=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...i}=e,s=ko(h2,n),a=g.useRef(null),l=Be(t,a,s.onViewportChange);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),d.jsx(Oe.div,{"data-radix-scroll-area-viewport":"",...i,ref:l,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style},children:d.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});p2.displayName=h2;var Ti="ScrollAreaScrollbar",HS=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=ko(Ti,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:s}=o,a=e.orientation==="horizontal";return g.useEffect(()=>(a?i(!0):s(!0),()=>{a?i(!1):s(!1)}),[a,i,s]),o.type==="hover"?d.jsx(RK,{...r,ref:t,forceMount:n}):o.type==="scroll"?d.jsx(AK,{...r,ref:t,forceMount:n}):o.type==="auto"?d.jsx(m2,{...r,ref:t,forceMount:n}):o.type==="always"?d.jsx(KS,{...r,ref:t}):null});HS.displayName=Ti;var RK=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=ko(Ti,e.__scopeScrollArea),[i,s]=g.useState(!1);return g.useEffect(()=>{const a=o.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),s(!0)},u=()=>{l=window.setTimeout(()=>s(!1),o.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",u),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",u)}}},[o.scrollArea,o.scrollHideDelay]),d.jsx(ln,{present:n||i,children:d.jsx(m2,{"data-state":i?"visible":"hidden",...r,ref:t})})}),AK=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=ko(Ti,e.__scopeScrollArea),i=e.orientation==="horizontal",s=uy(()=>l("SCROLL_END"),100),[a,l]=OK("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return g.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,o.scrollHideDelay,l]),g.useEffect(()=>{const c=o.viewport,u=i?"scrollLeft":"scrollTop";if(c){let f=c[u];const h=()=>{const p=c[u];f!==p&&(l("SCROLL"),s()),f=p};return c.addEventListener("scroll",h),()=>c.removeEventListener("scroll",h)}},[o.viewport,i,l,s]),d.jsx(ln,{present:n||a!=="hidden",children:d.jsx(KS,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:ne(e.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:ne(e.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),m2=g.forwardRef((e,t)=>{const n=ko(Ti,e.__scopeScrollArea),{forceMount:r,...o}=e,[i,s]=g.useState(!1),a=e.orientation==="horizontal",l=uy(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,u=n.viewport.offsetHeight<n.viewport.scrollHeight;s(a?c:u)}},10);return Cu(n.viewport,l),Cu(n.content,l),d.jsx(ln,{present:r||i,children:d.jsx(KS,{"data-state":i?"visible":"hidden",...o,ref:t})})}),KS=g.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=ko(Ti,e.__scopeScrollArea),i=g.useRef(null),s=g.useRef(0),[a,l]=g.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=b2(a.viewport,a.content),u={...r,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:h=>i.current=h,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:h=>s.current=h};function f(h,p){return $K(h,s.current,a,p)}return n==="horizontal"?d.jsx(IK,{...u,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const h=o.viewport.scrollLeft,p=ON(h,a,o.dir);i.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:h=>{o.viewport&&(o.viewport.scrollLeft=h)},onDragScroll:h=>{o.viewport&&(o.viewport.scrollLeft=f(h,o.dir))}}):n==="vertical"?d.jsx(DK,{...u,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const h=o.viewport.scrollTop,p=ON(h,a);i.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:h=>{o.viewport&&(o.viewport.scrollTop=h)},onDragScroll:h=>{o.viewport&&(o.viewport.scrollTop=f(h))}}):null}),IK=g.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=ko(Ti,e.__scopeScrollArea),[s,a]=g.useState(),l=g.useRef(null),c=Be(t,l,i.onScrollbarXChange);return g.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),d.jsx(v2,{"data-orientation":"horizontal",...o,ref:c,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":cy(n)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.x),onDragScroll:u=>e.onDragScroll(u.x),onWheelScroll:(u,f)=>{if(i.viewport){const h=i.viewport.scrollLeft+u.deltaX;e.onWheelScroll(h),S2(h,f)&&u.preventDefault()}},onResize:()=>{l.current&&i.viewport&&s&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:Fg(s.paddingLeft),paddingEnd:Fg(s.paddingRight)}})}})}),DK=g.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=ko(Ti,e.__scopeScrollArea),[s,a]=g.useState(),l=g.useRef(null),c=Be(t,l,i.onScrollbarYChange);return g.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),d.jsx(v2,{"data-orientation":"vertical",...o,ref:c,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":cy(n)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.y),onDragScroll:u=>e.onDragScroll(u.y),onWheelScroll:(u,f)=>{if(i.viewport){const h=i.viewport.scrollTop+u.deltaY;e.onWheelScroll(h),S2(h,f)&&u.preventDefault()}},onResize:()=>{l.current&&i.viewport&&s&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:Fg(s.paddingTop),paddingEnd:Fg(s.paddingBottom)}})}})}),[LK,g2]=d2(Ti),v2=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:i,onThumbPointerUp:s,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:u,onResize:f,...h}=e,p=ko(Ti,n),[m,v]=g.useState(null),x=Be(t,M=>v(M)),b=g.useRef(null),w=g.useRef(""),S=p.viewport,C=r.content-r.viewport,N=nn(u),P=nn(l),_=uy(f,10);function O(M){if(b.current){const D=M.clientX-b.current.left,U=M.clientY-b.current.top;c({x:D,y:U})}}return g.useEffect(()=>{const M=D=>{const U=D.target;(m==null?void 0:m.contains(U))&&N(D,C)};return document.addEventListener("wheel",M,{passive:!1}),()=>document.removeEventListener("wheel",M,{passive:!1})},[S,m,C,N]),g.useEffect(P,[r,P]),Cu(m,_),Cu(p.content,_),d.jsx(LK,{scope:n,scrollbar:m,hasThumb:o,onThumbChange:nn(i),onThumbPointerUp:nn(s),onThumbPositionChange:P,onThumbPointerDown:nn(a),children:d.jsx(Oe.div,{...h,ref:x,style:{position:"absolute",...h.style},onPointerDown:ne(e.onPointerDown,M=>{M.button===0&&(M.target.setPointerCapture(M.pointerId),b.current=m.getBoundingClientRect(),w.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),O(M))}),onPointerMove:ne(e.onPointerMove,O),onPointerUp:ne(e.onPointerUp,M=>{const D=M.target;D.hasPointerCapture(M.pointerId)&&D.releasePointerCapture(M.pointerId),document.body.style.webkitUserSelect=w.current,p.viewport&&(p.viewport.style.scrollBehavior=""),b.current=null})})})}),Lg="ScrollAreaThumb",y2=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=g2(Lg,e.__scopeScrollArea);return d.jsx(ln,{present:n||o.hasThumb,children:d.jsx(FK,{ref:t,...r})})}),FK=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,i=ko(Lg,n),s=g2(Lg,n),{onThumbPositionChange:a}=s,l=Be(t,f=>s.onThumbChange(f)),c=g.useRef(),u=uy(()=>{c.current&&(c.current(),c.current=void 0)},100);return g.useEffect(()=>{const f=i.viewport;if(f){const h=()=>{if(u(),!c.current){const p=BK(f,a);c.current=p,a()}};return a(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[i.viewport,u,a]),d.jsx(Oe.div,{"data-state":s.hasThumb?"visible":"hidden",...o,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:ne(e.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),m=f.clientX-p.left,v=f.clientY-p.top;s.onThumbPointerDown({x:m,y:v})}),onPointerUp:ne(e.onPointerUp,s.onThumbPointerUp)})});y2.displayName=Lg;var GS="ScrollAreaCorner",x2=g.forwardRef((e,t)=>{const n=ko(GS,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?d.jsx(zK,{...e,ref:t}):null});x2.displayName=GS;var zK=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=ko(GS,n),[i,s]=g.useState(0),[a,l]=g.useState(0),c=!!(i&&a);return Cu(o.scrollbarX,()=>{var f;const u=((f=o.scrollbarX)==null?void 0:f.offsetHeight)||0;o.onCornerHeightChange(u),l(u)}),Cu(o.scrollbarY,()=>{var f;const u=((f=o.scrollbarY)==null?void 0:f.offsetWidth)||0;o.onCornerWidthChange(u),s(u)}),c?d.jsx(Oe.div,{...r,ref:t,style:{width:i,height:a,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Fg(e){return e?parseInt(e,10):0}function b2(e,t){const n=e/t;return isNaN(n)?0:n}function cy(e){const t=b2(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function $K(e,t,n,r="ltr"){const o=cy(n),i=o/2,s=t||i,a=o-s,l=n.scrollbar.paddingStart+s,c=n.scrollbar.size-n.scrollbar.paddingEnd-a,u=n.content-n.viewport,f=r==="ltr"?[0,u]:[u*-1,0];return w2([l,c],f)(e)}function ON(e,t,n="ltr"){const r=cy(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-o,s=t.content-t.viewport,a=i-r,l=n==="ltr"?[0,s]:[s*-1,0],c=Kb(e,l);return w2([0,s],[0,a])(c)}function w2(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function S2(e,t){return e>0&&e<t}var BK=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const i={left:e.scrollLeft,top:e.scrollTop},s=n.left!==i.left,a=n.top!==i.top;(s||a)&&t(),n=i,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function uy(e,t){const n=nn(e),r=g.useRef(0);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),g.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Cu(e,t){const n=nn(t);On(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}var k2=f2,VK=p2,UK=x2;const hr=g.forwardRef(({className:e,children:t,innerRef:n,viewportId:r,orientation:o,...i},s)=>d.jsxs(k2,{ref:s,className:fe("relative overflow-hidden",e),...i,children:[d.jsx(VK,{className:"h-full w-full rounded-[inherit]",ref:n,id:r,children:t}),d.jsx(qS,{orientation:o}),d.jsx(UK,{})]}));hr.displayName=k2.displayName;const qS=g.forwardRef(({className:e,orientation:t="vertical",...n},r)=>d.jsx(HS,{ref:r,orientation:t,className:fe("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:d.jsx(y2,{className:fe("relative rounded-full bg-border",t==="vertical"&&"flex-1")})}));qS.displayName=HS.displayName;var Yx=0;function dy(){g.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??MN()),document.body.insertAdjacentElement("beforeend",e[1]??MN()),Yx++,()=>{Yx===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Yx--}},[])}function MN(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Jx="focusScope.autoFocusOnMount",Xx="focusScope.autoFocusOnUnmount",RN={bubbles:!1,cancelable:!0},WK="FocusScope",lp=g.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=e,[a,l]=g.useState(null),c=nn(o),u=nn(i),f=g.useRef(null),h=Be(t,v=>l(v)),p=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(r){let v=function(S){if(p.paused||!a)return;const C=S.target;a.contains(C)?f.current=C:Rs(f.current,{select:!0})},x=function(S){if(p.paused||!a)return;const C=S.relatedTarget;C!==null&&(a.contains(C)||Rs(f.current,{select:!0}))},b=function(S){if(document.activeElement===document.body)for(const N of S)N.removedNodes.length>0&&Rs(a)};document.addEventListener("focusin",v),document.addEventListener("focusout",x);const w=new MutationObserver(b);return a&&w.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",x),w.disconnect()}}},[r,a,p.paused]),g.useEffect(()=>{if(a){IN.add(p);const v=document.activeElement;if(!a.contains(v)){const b=new CustomEvent(Jx,RN);a.addEventListener(Jx,c),a.dispatchEvent(b),b.defaultPrevented||(HK(JK(E2(a)),{select:!0}),document.activeElement===v&&Rs(a))}return()=>{a.removeEventListener(Jx,c),setTimeout(()=>{const b=new CustomEvent(Xx,RN);a.addEventListener(Xx,u),a.dispatchEvent(b),b.defaultPrevented||Rs(v??document.body,{select:!0}),a.removeEventListener(Xx,u),IN.remove(p)},0)}}},[a,c,u,p]);const m=g.useCallback(v=>{if(!n&&!r||p.paused)return;const x=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,b=document.activeElement;if(x&&b){const w=v.currentTarget,[S,C]=KK(w);S&&C?!v.shiftKey&&b===C?(v.preventDefault(),n&&Rs(S,{select:!0})):v.shiftKey&&b===S&&(v.preventDefault(),n&&Rs(C,{select:!0})):b===w&&v.preventDefault()}},[n,r,p.paused]);return d.jsx(Oe.div,{tabIndex:-1,...s,ref:h,onKeyDown:m})});lp.displayName=WK;function HK(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Rs(r,{select:t}),document.activeElement!==n)return}function KK(e){const t=E2(e),n=AN(t,e),r=AN(t.reverse(),e);return[n,r]}function E2(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function AN(e,t){for(const n of e)if(!GK(n,{upTo:t}))return n}function GK(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function qK(e){return e instanceof HTMLInputElement&&"select"in e}function Rs(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&qK(e)&&t&&e.select()}}var IN=YK();function YK(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=DN(e,t),e.unshift(t)},remove(t){var n;e=DN(e,t),(n=e[0])==null||n.resume()}}}function DN(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function JK(e){return e.filter(t=>t.tagName!=="A")}var XK=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},dc=new WeakMap,em=new WeakMap,tm={},Zx=0,C2=function(e){return e&&(e.host||C2(e.parentNode))},ZK=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=C2(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},QK=function(e,t,n,r){var o=ZK(t,Array.isArray(e)?e:[e]);tm[n]||(tm[n]=new WeakMap);var i=tm[n],s=[],a=new Set,l=new Set(o),c=function(f){!f||a.has(f)||(a.add(f),c(f.parentNode))};o.forEach(c);var u=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(h){if(a.has(h))u(h);else try{var p=h.getAttribute(r),m=p!==null&&p!=="false",v=(dc.get(h)||0)+1,x=(i.get(h)||0)+1;dc.set(h,v),i.set(h,x),s.push(h),v===1&&m&&em.set(h,!0),x===1&&h.setAttribute(n,"true"),m||h.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return u(t),a.clear(),Zx++,function(){s.forEach(function(f){var h=dc.get(f)-1,p=i.get(f)-1;dc.set(f,h),i.set(f,p),h||(em.has(f)||f.removeAttribute(r),em.delete(f)),p||f.removeAttribute(n)}),Zx--,Zx||(dc=new WeakMap,dc=new WeakMap,em=new WeakMap,tm={})}},fy=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=XK(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),QK(r,o,n,"aria-hidden")):function(){return null}},hi=function(){return hi=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},hi.apply(this,arguments)};function N2(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function eG(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var Pm="right-scroll-bar-position",_m="width-before-scroll-bar",tG="with-scroll-bars-hidden",nG="--removed-body-scroll-bar-size";function Qx(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function rG(e,t){var n=g.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var oG=typeof window<"u"?g.useLayoutEffect:g.useEffect,LN=new WeakMap;function iG(e,t){var n=rG(null,function(r){return e.forEach(function(o){return Qx(o,r)})});return oG(function(){var r=LN.get(n);if(r){var o=new Set(r),i=new Set(e),s=n.current;o.forEach(function(a){i.has(a)||Qx(a,null)}),i.forEach(function(a){o.has(a)||Qx(a,s)})}LN.set(n,e)},[e]),n}function sG(e){return e}function aG(e,t){t===void 0&&(t=sG);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var s=t(i,r);return n.push(s),function(){n=n.filter(function(a){return a!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var a=n;n=[],a.forEach(i),s=n}var l=function(){var u=s;s=[],u.forEach(i)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(u){s.push(u),c()},filter:function(u){return s=s.filter(u),n}}}};return o}function lG(e){e===void 0&&(e={});var t=aG(null);return t.options=hi({async:!0,ssr:!1},e),t}var P2=function(e){var t=e.sideCar,n=N2(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return g.createElement(r,hi({},n))};P2.isSideCarExport=!0;function cG(e,t){return e.useMedium(t),P2}var _2=lG(),e0=function(){},hy=g.forwardRef(function(e,t){var n=g.useRef(null),r=g.useState({onScrollCapture:e0,onWheelCapture:e0,onTouchMoveCapture:e0}),o=r[0],i=r[1],s=e.forwardProps,a=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,f=e.shards,h=e.sideCar,p=e.noIsolation,m=e.inert,v=e.allowPinchZoom,x=e.as,b=x===void 0?"div":x,w=e.gapMode,S=N2(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=h,N=iG([n,t]),P=hi(hi({},S),o);return g.createElement(g.Fragment,null,u&&g.createElement(C,{sideCar:_2,removeScrollBar:c,shards:f,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:w}),s?g.cloneElement(g.Children.only(a),hi(hi({},P),{ref:N})):g.createElement(b,hi({},P,{className:l,ref:N}),a))});hy.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};hy.classNames={fullWidth:_m,zeroRight:Pm};var uG=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function dG(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=uG();return t&&e.setAttribute("nonce",t),e}function fG(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function hG(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var pG=function(){var e=0,t=null;return{add:function(n){e==0&&(t=dG())&&(fG(t,n),hG(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},mG=function(){var e=pG();return function(t,n){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},j2=function(){var e=mG(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},gG={left:0,top:0,right:0,gap:0},t0=function(e){return parseInt(e||"",10)||0},vG=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[t0(n),t0(r),t0(o)]},yG=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return gG;var t=vG(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},xG=j2(),Jc="data-scroll-locked",bG=function(e,t,n,r){var o=e.left,i=e.top,s=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
421
|
-
.`.concat(tG,` {
|
|
422
|
-
overflow: hidden `).concat(r,`;
|
|
423
|
-
padding-right: `).concat(a,"px ").concat(r,`;
|
|
424
|
-
}
|
|
425
|
-
body[`).concat(Jc,`] {
|
|
426
|
-
overflow: hidden `).concat(r,`;
|
|
427
|
-
overscroll-behavior: contain;
|
|
428
|
-
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
429
|
-
padding-left: `.concat(o,`px;
|
|
430
|
-
padding-top: `).concat(i,`px;
|
|
431
|
-
padding-right: `).concat(s,`px;
|
|
432
|
-
margin-left:0;
|
|
433
|
-
margin-top:0;
|
|
434
|
-
margin-right: `).concat(a,"px ").concat(r,`;
|
|
435
|
-
`),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
.`).concat(Pm,` {
|
|
439
|
-
right: `).concat(a,"px ").concat(r,`;
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
.`).concat(_m,` {
|
|
443
|
-
margin-right: `).concat(a,"px ").concat(r,`;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
.`).concat(Pm," .").concat(Pm,` {
|
|
447
|
-
right: 0 `).concat(r,`;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
.`).concat(_m," .").concat(_m,` {
|
|
451
|
-
margin-right: 0 `).concat(r,`;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
body[`).concat(Jc,`] {
|
|
455
|
-
`).concat(nG,": ").concat(a,`px;
|
|
456
|
-
}
|
|
457
|
-
`)},FN=function(){var e=parseInt(document.body.getAttribute(Jc)||"0",10);return isFinite(e)?e:0},wG=function(){g.useEffect(function(){return document.body.setAttribute(Jc,(FN()+1).toString()),function(){var e=FN()-1;e<=0?document.body.removeAttribute(Jc):document.body.setAttribute(Jc,e.toString())}},[])},SG=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;wG();var i=g.useMemo(function(){return yG(o)},[o]);return g.createElement(xG,{styles:bG(i,!t,o,n?"":"!important")})},Gb=!1;if(typeof window<"u")try{var nm=Object.defineProperty({},"passive",{get:function(){return Gb=!0,!0}});window.addEventListener("test",nm,nm),window.removeEventListener("test",nm,nm)}catch{Gb=!1}var fc=Gb?{passive:!1}:!1,kG=function(e){return e.tagName==="TEXTAREA"},T2=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!kG(e)&&n[t]==="visible")},EG=function(e){return T2(e,"overflowY")},CG=function(e){return T2(e,"overflowX")},zN=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=O2(e,r);if(o){var i=M2(e,r),s=i[1],a=i[2];if(s>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},NG=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},PG=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},O2=function(e,t){return e==="v"?EG(t):CG(t)},M2=function(e,t){return e==="v"?NG(t):PG(t)},_G=function(e,t){return e==="h"&&t==="rtl"?-1:1},jG=function(e,t,n,r,o){var i=_G(e,window.getComputedStyle(t).direction),s=i*r,a=n.target,l=t.contains(a),c=!1,u=s>0,f=0,h=0;do{var p=M2(e,a),m=p[0],v=p[1],x=p[2],b=v-x-i*m;(m||b)&&O2(e,a)&&(f+=b,h+=m),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(u&&(Math.abs(f)<1||!o)||!u&&(Math.abs(h)<1||!o))&&(c=!0),c},rm=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},$N=function(e){return[e.deltaX,e.deltaY]},BN=function(e){return e&&"current"in e?e.current:e},TG=function(e,t){return e[0]===t[0]&&e[1]===t[1]},OG=function(e){return`
|
|
458
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
459
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
460
|
-
`)},MG=0,hc=[];function RG(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),o=g.useState(MG++)[0],i=g.useState(j2)[0],s=g.useRef(e);g.useEffect(function(){s.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var v=eG([e.lockRef.current],(e.shards||[]).map(BN),!0).filter(Boolean);return v.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),v.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=g.useCallback(function(v,x){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!s.current.allowPinchZoom;var b=rm(v),w=n.current,S="deltaX"in v?v.deltaX:w[0]-b[0],C="deltaY"in v?v.deltaY:w[1]-b[1],N,P=v.target,_=Math.abs(S)>Math.abs(C)?"h":"v";if("touches"in v&&_==="h"&&P.type==="range")return!1;var O=zN(_,P);if(!O)return!0;if(O?N=_:(N=_==="v"?"h":"v",O=zN(_,P)),!O)return!1;if(!r.current&&"changedTouches"in v&&(S||C)&&(r.current=N),!N)return!0;var M=r.current||N;return jG(M,x,v,M==="h"?S:C,!0)},[]),l=g.useCallback(function(v){var x=v;if(!(!hc.length||hc[hc.length-1]!==i)){var b="deltaY"in x?$N(x):rm(x),w=t.current.filter(function(N){return N.name===x.type&&(N.target===x.target||x.target===N.shadowParent)&&TG(N.delta,b)})[0];if(w&&w.should){x.cancelable&&x.preventDefault();return}if(!w){var S=(s.current.shards||[]).map(BN).filter(Boolean).filter(function(N){return N.contains(x.target)}),C=S.length>0?a(x,S[0]):!s.current.noIsolation;C&&x.cancelable&&x.preventDefault()}}},[]),c=g.useCallback(function(v,x,b,w){var S={name:v,delta:x,target:b,should:w,shadowParent:AG(b)};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(C){return C!==S})},1)},[]),u=g.useCallback(function(v){n.current=rm(v),r.current=void 0},[]),f=g.useCallback(function(v){c(v.type,$N(v),v.target,a(v,e.lockRef.current))},[]),h=g.useCallback(function(v){c(v.type,rm(v),v.target,a(v,e.lockRef.current))},[]);g.useEffect(function(){return hc.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",l,fc),document.addEventListener("touchmove",l,fc),document.addEventListener("touchstart",u,fc),function(){hc=hc.filter(function(v){return v!==i}),document.removeEventListener("wheel",l,fc),document.removeEventListener("touchmove",l,fc),document.removeEventListener("touchstart",u,fc)}},[]);var p=e.removeScrollBar,m=e.inert;return g.createElement(g.Fragment,null,m?g.createElement(i,{styles:OG(o)}):null,p?g.createElement(SG,{gapMode:e.gapMode}):null)}function AG(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const IG=cG(_2,RG);var cp=g.forwardRef(function(e,t){return g.createElement(hy,hi({},e,{ref:t,sideCar:IG}))});cp.classNames=hy.classNames;var YS="Popover",[R2,gge]=So(YS,[ji]),up=ji(),[DG,Va]=R2(YS),A2=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!1}=e,a=up(t),l=g.useRef(null),[c,u]=g.useState(!1),[f=!1,h]=Kr({prop:r,defaultProp:o,onChange:i});return d.jsx(tp,{...a,children:d.jsx(DG,{scope:t,contentId:Vr(),triggerRef:l,open:f,onOpenChange:h,onOpenToggle:g.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:c,onCustomAnchorAdd:g.useCallback(()=>u(!0),[]),onCustomAnchorRemove:g.useCallback(()=>u(!1),[]),modal:s,children:n})})};A2.displayName=YS;var I2="PopoverAnchor",LG=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Va(I2,n),i=up(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:a}=o;return g.useEffect(()=>(s(),()=>a()),[s,a]),d.jsx(Wu,{...i,...r,ref:t})});LG.displayName=I2;var D2="PopoverTrigger",zg=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Va(D2,n),i=up(n),s=Be(t,o.triggerRef),a=d.jsx(Oe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":B2(o.open),...r,ref:s,onClick:ne(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?a:d.jsx(Wu,{asChild:!0,...i,children:a})});zg.displayName=D2;var JS="PopoverPortal",[FG,zG]=R2(JS,{forceMount:void 0}),L2=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,i=Va(JS,t);return d.jsx(FG,{scope:t,forceMount:n,children:d.jsx(ln,{present:n||i.open,children:d.jsx(Hu,{asChild:!0,container:o,children:r})})})};L2.displayName=JS;var Nu="PopoverContent",F2=g.forwardRef((e,t)=>{const n=zG(Nu,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,i=Va(Nu,e.__scopePopover);return d.jsx(ln,{present:r||i.open,children:i.modal?d.jsx($G,{...o,ref:t}):d.jsx(BG,{...o,ref:t})})});F2.displayName=Nu;var $G=g.forwardRef((e,t)=>{const n=Va(Nu,e.__scopePopover),r=g.useRef(null),o=Be(t,r),i=g.useRef(!1);return g.useEffect(()=>{const s=r.current;if(s)return fy(s)},[]),d.jsx(cp,{as:ls,allowPinchZoom:!0,children:d.jsx(z2,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ne(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),i.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:ne(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:ne(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),BG=g.forwardRef((e,t)=>{const n=Va(Nu,e.__scopePopover),r=g.useRef(!1),o=g.useRef(!1);return d.jsx(z2,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,a;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;((c=n.triggerRef.current)==null?void 0:c.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),z2=g.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...f}=e,h=Va(Nu,n),p=up(n);return dy(),d.jsx(lp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:d.jsx(Xl,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>h.onOpenChange(!1),children:d.jsx(np,{"data-state":B2(h.open),role:"dialog",id:h.contentId,...p,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),$2="PopoverClose",Al=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Va($2,n);return d.jsx(Oe.button,{type:"button",...r,ref:t,onClick:ne(e.onClick,()=>o.onOpenChange(!1))})});Al.displayName=$2;var VG="PopoverArrow",UG=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=up(n);return d.jsx(rp,{...o,...r,ref:t})});UG.displayName=VG;function B2(e){return e?"open":"closed"}var WG=A2,HG=zg,KG=L2,V2=F2;const br=WG,xo=HG,tr=g.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>d.jsx(KG,{container:r.container,children:d.jsx(V2,{ref:o,align:t,sideOffset:n,className:fe("z-50 w-72 rounded-md border bg-bg-secondary p-4 text-fg-secondary shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));tr.displayName=V2.displayName;function VN({profile:e,size:t="md"}){var c,u,f;const[n,r]=g.useState(((c=e==null?void 0:e.avatar)==null?void 0:c.url)||null);g.useEffect(()=>{var h,p;(h=e==null?void 0:e.avatar)!=null&&h.url?r((p=e==null?void 0:e.avatar)==null?void 0:p.url):r(null)},[(u=e==null?void 0:e.avatar)==null?void 0:u.url]);const[o,...i]=((f=e.fullName)==null?void 0:f.split(" "))||[""],s=i[i.length-1]||"",a=`${o[0].toUpperCase()}${s[0].toUpperCase()}`,l=Ce("rounded-full text-center inline-block bg-bg-brand-primary text-fg-brand-primary",{"h-8 w-8 leading-8 text-xs":t==="sm","h-10 w-10 leading-10 text-base":t==="md","h-12 w-12 leading-[3rem] text-lg":t==="lg"});return n?d.jsx("img",{src:n,alt:a,className:l,onError:()=>{r(null)}}):d.jsx("span",{className:l,children:a})}function GG(e,t,n,r){if(t[n]===void 0)return console.error(`Get keysOf source not found for ${n}`),[];if(!e[n])return console.error(`Schema not found for ${n}`),[];const s=n,a=[],l=(c,u,f)=>{var h;if(u===void 0){console.error(`Schema not found for ${c}`);return}if(u.type==="keyOf")u.path===s&&(r?typeof f=="string"&&f===r&&(a.includes(c)?console.error(`Duplicate keyOf reference found for ${c} in ${n}`):a.push(c)):a.includes(c)?console.error(`Duplicate keyOf reference found for ${c} in ${n}`):a.push(c));else if(u.type==="object"||u.type==="record"){if(WN(f)||U2(f))for(const p in f){const m=f==null?void 0:f[p],v=u.type==="object"?(h=u.items)==null?void 0:h[p]:u.item;m&&l(UN(c,p),v,m)}}else if(u.type==="array"){if(qG(f)){let p=0;for(const m of f)l(UN(c,p),u.item,m),p++}}else if(u.type==="union"){const p=u.key;if(typeof p=="string"&&WN(f)){const m=f[p];if(typeof m=="string"){const v=u.items.filter(x=>x.type==="object").find(x=>{const b=x.items[p];if((b==null?void 0:b.type)==="literal")return b.value===m});v&&l(c,v,f)}}}else u.type==="string"||u.type==="number"||u.type==="boolean"||u.type==="literal"||u.type==="date"||u.type==="image"||u.type==="file"||u.type==="richtext"||console.error("Could not get keyOf references. Unhandled schema type",u)};for(const c in e){const u=c;l(c,e[u],t[u])}return a}function UN(e,t){return e.includes(ba)?`${e}.${JSON.stringify(t)}`:`${e}${ba}${JSON.stringify(t)}`}function WN(e){return U2(e)}function U2(e){return typeof e=="object"&&!!e&&!Qs(e)}function qG(e){return typeof e=="object"&&!!e&&Qs(e)}function W2(e,t){const n=Ba(),r=ly(),o=FS();return g.useMemo(()=>e!==void 0&&"data"in n&&n.data!==void 0&&n.data[e]!==void 0?GG(n.data,o,e,t):[],[r,o,"data"in n&&n.data,e,t])}const HN=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,KN=DR,YG=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return KN(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:i}=t,s=Object.keys(o).map(c=>{const u=n==null?void 0:n[c],f=i==null?void 0:i[c];if(u===null)return null;const h=HN(u)||HN(f);return o[c][h]}),a=n&&Object.entries(n).reduce((c,u)=>{let[f,h]=u;return h===void 0||(c[f]=h),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:f,className:h,...p}=u;return Object.entries(p).every(m=>{let[v,x]=m;return Array.isArray(x)?x.includes({...i,...a}[v]):{...i,...a}[v]===x})?[...c,f,h]:c},[]);return KN(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)},qb=YG("inline-flex items-center justify-center whitespace-nowrap rounded-md text-fg-primary text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:text-fg-disabled disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:fe("cursor-pointer","border border-border-brand-primary","bg-bg-brand-primary text-fg-brand-primary","hover:bg-bg-brand-primary-hover hover:text-fg-brand-primary-hover","disabled:bg-bg-disabled disabled:text-fg-disabled disabled:border disabled:border-border-primary"),destructive:fe("cursor-pointer","border border-bg-error-primary","bg-bg-error-primary text-fg-error-primary hover:bg-bg-error-primary-hover disabled:text-fg-error-primary"),outline:fe("cursor-pointer","border border-transparent","bg-bg-background hover:bg-bg-secondary","disabled:bg-bg-disabled disabled:text-fg-disabled disabled:border disabled:border-border-primary"),secondary:fe("cursor-pointer","border border-border-secondary","bg-bg-secondary text-fg-secondary hover:bg-bg-secondary-hover"),ghost:fe("cursor-pointer","border border-transparent","bg-bg-background hover:bg-bg-secondary","disabled:bg-bg-disabled disabled:text-fg-disabled disabled:border disabled:border-border-primary","hover:bg-bg-secondary-hover hover:text-fg-secondary"),link:fe("cursor-pointer","border border-transparent","text-fg-primary underline-offset-4 hover:underline")},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),qe=g.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},i)=>{const s=r?ls:"button";return d.jsx(s,{className:fe(qb({variant:t,size:n,className:e})),ref:i,...o})});qe.displayName="Button";function JG({path:e,disabled:t}){const[n,r]=Y.splitModuleFilePathAndModulePath(e),o=Y.splitModuleFilePath(n),i=Y.splitModulePath(r),{navigate:s}=xn();return d.jsxs("div",{className:"w-full",children:[d.jsx("button",{type:"button",title:n,disabled:t,className:"inline-block text-left truncate",onClick:()=>{s(n)},children:o.map((a,l)=>d.jsxs(g.Fragment,{children:[l===0&&d.jsx("span",{className:"text-muted",children:"/"}),d.jsx("span",{className:Ce({"text-muted":!(i.length===0&&l===o.length-1)}),children:Eu(a)}),l>0&&l<o.length-1&&d.jsx("span",{className:"text-muted",children:"/"})]},`${a}-${l}`))}),d.jsx("button",{type:"button",disabled:t,title:Y.joinModuleFilePathAndModulePath(n,r),className:"inline-block text-left truncate",onClick:()=>{s(Y.joinModuleFilePathAndModulePath(n,r))},children:i.map((a,l)=>d.jsxs(g.Fragment,{children:[d.jsx("span",{className:"text-muted",children:"/"}),d.jsx("span",{className:Ce({"text-muted":l===i.length-2}),children:Eu(a)})]},`${a}-${l}`))})]})}function H2({path:e,parentPath:t,variant:n,refs:r,children:o,size:i,onComplete:s,confirmationMessage:a,className:l}){const c=In();return d.jsxs(br,{children:[d.jsx(xo,{asChild:!0,children:d.jsx(qe,{size:i,variant:n,className:l,children:o})}),d.jsxs(tr,{container:c,className:"flex flex-col gap-2 p-4",children:[d.jsx("div",{className:"text-lg font-bold",children:"Are you sure?"}),d.jsx("div",{children:a}),d.jsx(Al,{asChild:!0,children:d.jsx(XG,{path:e,parentPath:t,refs:r,variant:"destructive",onComplete:s,children:d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsx(US,{size:12}),d.jsx("span",{children:"Delete"})]})})})]})]})}function XG({path:e,parentPath:t,variant:n,refs:r,children:o,size:i,onComplete:s}){const{navigate:a}=xn(),{addPatch:l,patchPath:c}=bn(e),u=lt(t,"record");return!("data"in u)||u.data===void 0||u.data===null?(console.error("Parent source not found",u,{path:e}),null):d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(qe,{size:i,variant:n,disabled:r.length>0,onClick:()=>{l([{op:"remove",path:c}],"record"),a(t),s&&s()},children:o})}),d.jsx(fr,{side:"top",children:r.length>0?d.jsxs("div",{children:[d.jsx("p",{children:"Cannot delete record."}),d.jsxs("p",{children:["You must change the following references"," ",d.jsx(l2,{size:10,className:"inline"})," to be able to delete:"]}),d.jsx("ul",{children:r.map(f=>d.jsx("li",{children:d.jsx(JG,{path:f})},f))})]}):d.jsx("p",{children:"Delete record"})})]})}function Il(e){if(e.type==="object")return Object.fromEntries(Object.keys(e.items).map(n=>[n,Il(e.items[n])]));if(e.type==="array")return[];if(e.type==="record")return{};if(e.opt)return null;if(e.type==="richtext")return[];if(e.type==="string")return"";if(e.type==="boolean")return!1;if(e.type==="number")return 0;if(e.type==="keyOf")return e.values==="string"?"":e.values[0];if(e.type==="file"||e.type==="image")return null;if(e.type==="literal")return e.value;if(e.type==="union")return typeof e.key=="string"?Il(e.items[0]):e.key.value;if(e.type==="date")return ps(new Date,"yyyy-MM-dd");throw Error("Unexpected schema type: "+JSON.stringify(e))}const Zu=g.forwardRef(({className:e,type:t,...n},r)=>d.jsx("input",{type:t,className:fe("flex h-10 m-1 w-[calc(100%-8px)] rounded-md border border-input bg-bg-primary px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));Zu.displayName="Input";function ZG(e,t){const n={},r=t==null?void 0:t.split("/");(r==null?void 0:r[0])===""&&r.shift();const o=(r==null?void 0:r.filter(s=>s!==""))||[];let i=0;for(let s=0;s<e.length;s++){const a=e[s];if(a.type==="literal"){const l=o[i];if(!l)return{status:"error",message:`Missing required literal part: ${a.name}`};if(a.name!==l)return{status:"error",message:`Invalid path part: expected "${a.name}", got "${l}"`};i++}else if(a.type==="string-param"){const l=o[i];if(!l){if(a.optional)continue;return{status:"error",message:`Missing required parameter: ${a.paramName}`}}n[a.paramName]=l,i++}else if(a.type==="array-param"){const l=o.slice(i);if(l.length===0){if(a.optional)continue;return{status:"error",message:`Missing required catch-all parameter: ${a.paramName}`}}n[a.paramName]=l,i+=l.length}}return i<o.length?{status:"error",message:`Extra path parts found: ${o.slice(i).join("/")}`}:{status:"success",params:n}}function K2({routePattern:e,existingKeys:t,onSubmit:n,submitText:r,defaultParams:o,onCancel:i,defaultValue:s}){const[a,l]=g.useState({});g.useEffect(()=>{o&&l(o)},[o]);const[c,u]=g.useState({});g.useEffect(()=>{if(s){const m=ZG(e,s);m.status==="success"&&l(m.params)}},[s,e]);const f=g.useMemo(()=>"/"+e.map(m=>{if(m.type==="string-param"||m.type==="array-param"){const v=a[m.paramName];return Array.isArray(v)?v.join("/"):v}return m.name}).join("/"),[e,a]),p=!g.useMemo(()=>e.every(m=>m.type==="string-param"||m.type==="array-param"?!!a[m.paramName]&&!c[m.paramName]:!0),[e,a,c])||f in t;return d.jsxs("form",{className:"p-4 space-y-3",onSubmit:m=>{m.preventDefault(),n(f)},children:[d.jsx("div",{className:"flex items-center",children:e.map((m,v)=>d.jsx("span",{className:"truncate",children:m.type==="string-param"||m.type==="array-param"?d.jsxs("span",{className:"flex items-center",children:[d.jsx("span",{children:"/"}),d.jsxs("span",{className:"flex flex-col",children:[d.jsx("input",{className:fe("p-1 bg-transparent border-0 max-w-[10ch]",{"border-border-secondary border-1":c[m.paramName]}),placeholder:m.paramName,value:QG(a,m.paramName),onChange:x=>{l({...a,[m.paramName]:x.target.value});const b=m.type==="string-param"?x.target.value:x.target.value.replace(/\//g,"");encodeURIComponent(b)!==b?u({...c,[m.paramName]:"Invalid characters"}):u({...c,[m.paramName]:void 0})}}),c[m.paramName]&&d.jsx("span",{className:"text-xs text-fg-error-secondary",children:c[m.paramName]})]})]}):d.jsxs("span",{className:"text-fg-secondary",children:["/",m.name]})},v))}),d.jsxs("div",{className:"flex gap-4",children:[d.jsx(qe,{disabled:p,children:r}),d.jsx(qe,{variant:"ghost",type:"reset",onClick:i,children:"Cancel"})]})]})}function QG(e,t){const n=e[t];return Array.isArray(n)?n.join("/"):n||""}function G2({path:e,size:t,variant:n,children:r,open:o,setOpen:i,defaultOpen:s,routePattern:a}){const l=lt(e,"record"),c=Ft(e),u=In(),{addPatch:f}=bn(e),{navigate:h}=xn(),[p,m]=g.useState(s??!1);g.useEffect(()=>{o!==void 0&&m(o)},[o]),g.useEffect(()=>{i!==void 0&&i(p)},[p,i]),g.useEffect(()=>{s!==void 0&&m(s)},[s]);const v=g.useCallback(S=>{const C="data"in c?c.data:null;if(C===null||C.type!=="record")return;const N=Y.createPatchPath(w).concat(S);f([{op:"add",path:N,value:Il(C.item)}],"record"),h(Y.joinModuleFilePathAndModulePath(b,Y.patchPathToModulePath(N))),m(!1)},[f,h,c,e]);if(!("data"in l)||l.data===void 0||l.data===null)return console.error("Source not found",l,{path:e}),null;if(!("data"in c)||c.data===void 0)return console.error("Schema not found",l,{path:e}),null;if(c.data.type!=="record")return console.error("Schema is not a record",c,{path:e}),null;const[b,w]=Y.splitModuleFilePathAndModulePath(e);return d.jsxs(br,{open:p,onOpenChange:m,children:[d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(xo,{onClick:()=>{m(!0)},asChild:!0,children:d.jsx(qe,{size:t,variant:n,children:r})})}),d.jsx(fr,{children:d.jsx("p",{children:"Add"})})]}),d.jsx(tr,{container:u,children:a?d.jsx(K2,{routePattern:a,existingKeys:Object.keys(l.data),onSubmit:v,onCancel:()=>{m(!1)},submitText:"Create"}):d.jsx(eq,{existingKeys:Object.keys(l.data),onSubmit:v})})]})}function eq({existingKeys:e,onSubmit:t}){const[n,r]=g.useState(""),o=n===""||n in e;return d.jsxs("form",{className:"flex flex-col gap-2",onSubmit:i=>{i.preventDefault(),t(n)},children:[d.jsx(Zu,{autoFocus:!0,value:n,onChange:i=>{r(i.target.value)}}),d.jsx("div",{children:d.jsx(qe,{type:"submit",disabled:o,variant:"outline",children:"Add"})})]})}function tq({existingKeys:e,defaultValue:t,onCancel:n,onSubmit:r}){const[o,i]=g.useState(t),s=o===t||o===""||o in e;return d.jsxs("form",{className:"flex flex-col gap-2",onSubmit:a=>{a.preventDefault(),r(o)},children:[d.jsx(Zu,{type:"text",value:o,onChange:a=>{i(a.target.value)}}),d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsx(qe,{disabled:s,variant:"outline",type:"submit",children:"Update"}),d.jsx(qe,{variant:"ghost",type:"reset",onClick:()=>{n(),i(t)},children:"Cancel"})]})]})}function q2({defaultValue:e,path:t,parentPath:n,variant:r,existingKeys:o,routePattern:i,size:s,children:a,onComplete:l}){const{navigate:c}=xn(),[u,f]=g.useState(!1),h=In();g.useEffect(()=>{const S=C=>{C.key==="Escape"&&f(!1)};return window.addEventListener("keydown",S),()=>{window.removeEventListener("keydown",S)}},[]);const{addPatch:p,addModuleFilePatch:m}=bn(t),[v,x]=Y.splitModuleFilePathAndModulePath(n),b=Y.createPatchPath(x),w=g.useCallback(S=>{const C=[{op:"move",from:b.concat(e),path:b.concat(S)}];p(C,"record");for(const P of o){const[_,O]=Y.splitModuleFilePathAndModulePath(P),M=Y.createPatchPath(O);m(_,[{op:"replace",path:M,value:S}],"record")}const N=Y.joinModuleFilePathAndModulePath(v,Y.patchPathToModulePath(b.concat(S)));c(N,{replace:!0}),l&&l()},[p,m,v,b,c,l]);return d.jsxs(br,{open:u,children:[d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(qe,{asChild:!0,size:s,variant:r,children:d.jsx(xo,{onClick:()=>{f(!0)},children:a})})}),d.jsx(fr,{side:"top",children:"Rename record"})]}),d.jsx(tr,{container:h,className:"text-fg-primary",children:i?d.jsx(K2,{routePattern:i,existingKeys:o,defaultValue:e,onSubmit:S=>{w(S),f(!1)},onCancel:()=>{f(!1)},submitText:"Update"}):d.jsx(tq,{parentPath:n,defaultValue:e,existingKeys:o,onSubmit:S=>{w(S),f(!1)},onCancel:()=>{f(!1)}})})]})}function nq({moduleFilePaths:e}){const t=JR(e,"record"),n=XR(),r=g.useMemo(()=>{const o=[];if(n.status!=="success")return n;if(n.data===null)return{status:"error",error:"No src folder found"};if(t.status!=="success")return t.status==="not-found"?{status:"error",error:"No data found"}:t.status==="error"?{status:"error",error:`Failed to load ${Object.keys(t.errors).length} modules: ${Object.entries(t.errors).map(([a,l])=>`"${a}": ${l.message}`).join(", ")}`}:t;for(const s of t.data||[])for(const a in s){const[l]=Y.splitModuleFilePathAndModulePath(s[a]);o.push({urlPath:a,moduleFilePath:l})}const i=R8(n.data,o);return{status:t.status,data:i}},[t,n]);return r.status==="loading"||r.status==="not-asked"?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx(Gr,{size:16,className:"animate-spin"})}):r.status==="error"?(console.error("Sitemap errors",r.error),null):d.jsx(Y2,{node:r.data})}function Y2({node:e}){var m;const t=In(),{currentSourcePath:n}=xn(),[r,o]=g.useState(!0),{navigate:i}=xn(),[s,a]=g.useState(!1),[l,c]=g.useState(!1),u=g.useMemo(()=>{var v;return!!((v=e.sourcePath)!=null&&v.startsWith(n))},[n,e.sourcePath]),f=g.useMemo(()=>{if(!e.pattern)return;const v=DM(e.pattern);if(v.some(x=>x.type==="string-param"||x.type==="array-param"))return v},[e.pattern]),h=g.useCallback(()=>{var v;e.sourcePath?i(e.sourcePath):e.type==="node"&&((v=e.children)==null?void 0:v.length)>0&&o(x=>!x)},[i,e]),p=e.moduleFilePath;return d.jsxs("div",{children:[d.jsxs("div",{className:"relative flex items-center justify-between w-full h-10 group",children:[d.jsxs("div",{className:"flex items-center my-1",children:[d.jsx("button",{onClick:()=>o(!r),className:fe("hidden h-4 w-4 mr-2",{block:((m=e.children)==null?void 0:m.length)>0}),children:d.jsx(Xu,{size:16,className:fe("transform",{"rotate-90":r})})}),d.jsx("span",{children:e.sourcePath?d.jsxs("button",{onClick:h,className:fe("flex items-center gap-1",{}),children:[e.name==="/"?d.jsx(Z7,{size:14}):e.type==="leaf"||e.type==="node"&&e.page?d.jsx(r2,{size:14}):null,d.jsxs("span",{children:[e.name==="/"&&d.jsx("span",{className:"ml-2 text-fg-primary-alt",children:"Main page"}),e.name!=="/"&&d.jsx("span",{className:fe({underline:u}),children:e.name})]})]}):d.jsxs("button",{onClick:h,className:fe("flex items-center gap-1",{}),children:[d.jsx(oK,{size:14}),d.jsx("span",{children:d.jsx("span",{children:e.name})})]})})]}),d.jsxs("div",{className:fe("absolute right-0 top-0 items-center group-hover:flex h-10 bg-bg-primary",{hidden:!s&&!l,flex:s||l}),children:[e.sourcePath&&d.jsx(qe,{size:"sm",variant:"ghost",onClick:h,className:"flex items-center gap-2",children:d.jsx(BS,{size:12})}),(e.sourcePath||e.type==="leaf"||e.page)&&d.jsxs(br,{onOpenChange:a,open:s,children:[d.jsx(xo,{asChild:!0,children:d.jsx(qe,{size:"sm",variant:"ghost",children:d.jsx($S,{size:12})})}),d.jsx(tr,{container:t,children:d.jsx(rq,{node:e,routePatternWithParams:f,onClose:()=>a(!1)})})]}),f&&p&&d.jsx(G2,{path:p,size:"sm",variant:"ghost",open:l,setOpen:c,routePattern:f,children:d.jsx(VS,{size:12})})]})]}),d.jsx(ku,{isOpen:r,className:"pl-3",children:e.children.map((v,x)=>d.jsx(Y2,{node:v},x))})]})}function rq({node:e,onClose:t,routePatternWithParams:n}){const r=g.useMemo(()=>{var s;return e.type==="leaf"?e.fullPath:(s=e.page)==null?void 0:s.fullPath},[e]),o=g.useMemo(()=>e.sourcePath?Y.splitModuleFilePathAndModulePath(e.sourcePath)[0]:void 0,[e==null?void 0:e.sourcePath]),i=W2(o,r);return d.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[o&&e.sourcePath&&d.jsx(H2,{path:e.sourcePath,parentPath:o,refs:i,size:"sm",variant:"ghost",onComplete:t,confirmationMessage:`This will delete the ${r} page.`,children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(US,{size:14}),d.jsx("span",{children:"Delete"})]})}),r!==void 0&&e.sourcePath&&o&&d.jsx(q2,{variant:"ghost",size:"sm",existingKeys:i,path:e.sourcePath,defaultValue:r,routePattern:n,parentPath:o,onComplete:t,children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(vK,{size:12}),d.jsx("span",{children:"Rename"})]})})]})}function oq(e){const t={"/":{name:"/",fullPath:"/",isDirectory:!0,children:[]}};for(const n of e){const r=n.split("/");if(r[0]!=="")throw new Error("Expected path to start with '/'");for(let o=1;o<r.length;o++){const i=r.slice(0,o).join("/"),s=[i,r[o]].join("/"),a=r[o];if(!a)throw new Error("Expected name to be non-empty");if(!t[s]){const l={name:a,fullPath:s,children:[]};o<r.length-1&&(l.isDirectory=!0),t[s]=l,t[i||"/"].children.push(t[s])}}}return t["/"]}function iq(){const e=Ba();return g.useMemo(()=>{if(e.status==="success"){const t=[],n={};for(const r in e.data){const o=r,i=e.data[o];i.type==="record"&&i.router?(n[i.router]=n[i.router]||[],n[i.router].push(o)):t.push(o)}return{status:e.status,data:{root:oq(t),sitemap:n}}}return e},[e])}const J2=1280;function sq(){const e=Gu(),[t,n]=g.useState(""),[r,o]=g.useState("");g.useEffect(()=>{async function w(){let S=!1;const C=async N=>{if(!S)try{(await fetch(N)).ok&&(S=!0,n(N))}catch{}};await C("/favicon.ico"),await C("/favicon.svg"),await C("/favicon.png"),await C("/apple-touch-icon.png"),await C("https://valbuild.com/favicon.ico")}if(w(),e!=null&&e.project)o(e.project);else try{let S=new URL(location.origin).hostname;if(S!=="localhost"){const C=S.split(".");C.length>=2&&(S=C.slice(1,-1).join(".")),o(wf(S))}else o("Dev mode")}catch{o("Studio")}},[JSON.stringify(e)]);const i=Ba(),s=In(),{theme:a,setTheme:l}=ay(),{navMenu:c}=Jy(),u=iq(),f=(e==null?void 0:e.appHost)||Nb,[h,p]=r.split("/"),m=F7(),v=`${f}/orgs/${h}`,x=`${f}/orgs/${h}/members`,b=`${v}/projects/${p}`;return d.jsxs("nav",{className:"relative min-h-[100svh] bg-bg-primary",children:[d.jsxs("div",{className:"flex gap-4 justify-between items-center p-4 pr-6 h-16 border-b border-border-primary",children:[d.jsxs("div",{className:"flex gap-4 items-center",children:[t?d.jsx("img",{src:t,alt:"",className:"w-4 h-4"}):d.jsx("div",{className:"w-4 h-4"}),h&&p?d.jsx("a",{className:"truncate hover:underline",href:b,children:r}):d.jsx("span",{className:"truncate",children:r})]}),d.jsx("button",{className:"lg:hidden",onClick:()=>{c.setOpen(!c.isOpen)},children:d.jsx(Ag,{size:16,className:Ce("transform",{"rotate-180":!c.isOpen})})})]}),"data"in i&&d.jsx("div",{className:Ce("py-4 pl-2",{}),children:d.jsxs(hr,{children:[d.jsx("div",{className:"max-h-[calc(100svh-32px-64px-32px-16px)] max-w-[320px] px-2",children:"data"in u?d.jsxs(d.Fragment,{children:[d.jsx(lq,{title:"Site map",defaultOpen:!0,sitemap:u.data.sitemap}),d.jsx(aq,{title:"Explorer",defaultOpen:!0,node:u.data.root})]}):u.status==="loading"?d.jsx(cq,{}):null}),d.jsx(qS,{orientation:"horizontal"})]})}),d.jsx("div",{className:"p-4 h-6"}),d.jsx("div",{className:"absolute bottom-0 left-0 w-full",children:d.jsxs(br,{children:[d.jsxs(xo,{className:"flex items-center justify-between w-full p-4 border-t border-border-primary hover:bg-bg-secondary data-[state=open]:bg-bg-secondary",children:[d.jsx("span",{children:m&&d.jsx(VN,{size:"sm",profile:m})}),d.jsx($S,{size:16})]}),d.jsx(tr,{className:"p-0 py-2",container:s,side:"top",children:d.jsxs("div",{className:"flex flex-col gap-2 justify-between items-center",children:[m&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex gap-2 items-center px-4 py-2 w-full",children:[d.jsx(VN,{size:"sm",profile:m}),d.jsxs("div",{className:"text-sm",children:[d.jsx("div",{className:"truncate",children:m.fullName}),m.email&&d.jsx("div",{className:"font-light truncate",children:m.email})]})]}),d.jsx("hr",{className:"mb-1 w-full h-1 border-t border-border-primary"})]}),d.jsxs("div",{className:"flex gap-2 items-center px-4 w-full",children:[a==="dark"?d.jsx(pK,{size:"1rem"}):d.jsx(kK,{size:"1rem"}),d.jsx("button",{className:"",onClick:()=>{l(a==="dark"?"light":"dark")},children:a==="dark"?d.jsx("span",{className:"text-sm",children:"Dark mode"}):d.jsx("span",{className:"text-sm",children:"Light mode"})})]}),m&&d.jsxs("div",{className:"flex gap-2 items-center px-4 w-full",children:[d.jsx(jK,{size:"1rem"}),d.jsx("a",{href:x,children:d.jsx("span",{className:"text-sm truncate",children:"Manage members"})})]}),m&&d.jsxs(d.Fragment,{children:[d.jsx("hr",{className:"mt-1 mb-1 w-full h-1 border-t border-border-primary"}),d.jsxs("div",{className:"flex gap-2 items-center px-4 w-full",children:[d.jsx(fK,{size:"1rem"}),d.jsx("a",{href:gu("/api/val/logout",{redirect_to:`${window.location.origin}`}),children:d.jsx("span",{className:"text-sm",children:"Log out"})})]})]})]})})]})})]})}function aq({title:e,defaultOpen:t,node:n}){return!n||(n==null?void 0:n.children.length)===0?null:d.jsx(X2,{icon:d.jsx(Ig,{size:16}),title:e,defaultOpen:t,children:n.children.sort(Z2).map((r,o)=>g.createElement(Q2,{...r,name:r.name,key:o,root:!0}))})}function X2({title:e,children:t,defaultOpen:n,icon:r}){const[o,i]=g.useState(n??!0);return d.jsxs("div",{className:"py-2",children:[d.jsxs("button",{className:"flex justify-between items-center py-2 w-full text-sm tracking-tighter uppercase text-fg-secondary",onClick:()=>{i(!o)},children:[d.jsxs("div",{className:"flex gap-2 items-center",children:[r,e]}),d.jsx(Xu,{size:16,className:Ce("transform",{"rotate-90":o})})]}),d.jsx(ku,{isOpen:o,className:"pr-1",children:t})]})}function lq({title:e,defaultOpen:t,sitemap:n}){const r=n["next-app-router"];return r?d.jsx(X2,{title:e,defaultOpen:t,icon:d.jsx(Rg,{size:16}),children:d.jsx(nq,{moduleFilePaths:r})}):null}function cq(){return d.jsx("div",{className:"flex justify-start items-center w-full h-full",children:d.jsx(Gr,{size:16,className:"animate-spin"})})}function Z2(e,t){return e.isDirectory&&!t.isDirectory?-1:!e.isDirectory&&t.isDirectory?1:e.name.localeCompare(t.name)}function Q2({name:e,fullPath:t,isDirectory:n,children:r,root:o}){const{navigate:i,currentSourcePath:s}=xn(),{navMenu:a}=Jy(),[l,c]=g.useState(!0),u=Ql()||{},f=g.useMemo(()=>{let x=!1;for(const b in u)if(b.startsWith(t)){x=!0;break}return x},[u,t]),h=g.useMemo(()=>{if(n){if(!l)return f}else if(!n)return f;return!1},[f,l,n]),p=t,m=Ft(p),v="data"in m?m.data.type:"loading";return d.jsxs("div",{className:"w-full text-sm",children:[d.jsxs("button",{className:Ce("relative flex items-center justify-between w-full ",{"py-2":o,"p-2":!o,underline:s.startsWith(p)&&!n,"font-bold":s.startsWith(p)&&n}),onClick:()=>{n?c(!l):(window.innerWidth<J2&&a.setOpen(!1),i(p))},children:[d.jsxs("div",{className:"flex items-center pr-2",children:[n?d.jsx(Xu,{size:16,className:Ce("transform mr-2",{"rotate-90":l,hidden:!r.length})}):d.jsx(uq,{type:v,size:14}),d.jsx("span",{children:Eu(e)})]}),h&&d.jsx("div",{className:"ml-2 w-2 h-2 rounded-full bg-bg-error-secondary"})]}),d.jsx("div",{className:"pl-2",children:d.jsx(ku,{isOpen:l,children:r.sort(Z2).map((x,b)=>g.createElement(Q2,{...x,key:b}))})})]})}function uq({size:e,type:t}){if(t==="loading")return d.jsx(Gr,{size:e,className:"mr-2 animate-spin"});switch(t){case"string":return d.jsx(PK,{size:e,className:"mr-2"});case"number":return d.jsx(sK,{size:e,className:"mr-2"});case"boolean":return d.jsx(CK,{size:e,className:"mr-2"});case"object":return d.jsx(cK,{size:e,className:"mr-2"});case"literal":return d.jsx(X7,{size:e,className:"mr-2"});case"array":return d.jsx(s2,{size:e,className:"mr-2"});case"union":return d.jsx(yK,{size:e,className:"mr-2"});case"richtext":return d.jsx(r2,{size:e,className:"mr-2"});case"record":return d.jsx(EK,{size:e,className:"mr-2"});case"keyOf":return d.jsx(lK,{size:e,className:"mr-2"});case"file":return d.jsx(o2,{size:e,className:"mr-2"});case"date":return d.jsx(n2,{size:e,className:"mr-2"});case"image":return d.jsx(i2,{size:e,className:"mr-2"});default:return d.jsx(Y7,{size:e,className:"mr-2"})}}function XS(e){const t=g.useRef({value:e,previous:e});return g.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var ZS="Checkbox",[dq,vge]=So(ZS),[fq,hq]=dq(ZS),eA=g.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:l="on",onCheckedChange:c,form:u,...f}=e,[h,p]=g.useState(null),m=Be(t,C=>p(C)),v=g.useRef(!1),x=h?u||!!h.closest("form"):!0,[b=!1,w]=Kr({prop:o,defaultProp:i,onChange:c}),S=g.useRef(b);return g.useEffect(()=>{const C=h==null?void 0:h.form;if(C){const N=()=>w(S.current);return C.addEventListener("reset",N),()=>C.removeEventListener("reset",N)}},[h,w]),d.jsxs(fq,{scope:n,state:b,disabled:a,children:[d.jsx(Oe.button,{type:"button",role:"checkbox","aria-checked":da(b)?"mixed":b,"aria-required":s,"data-state":rA(b),"data-disabled":a?"":void 0,disabled:a,value:l,...f,ref:m,onKeyDown:ne(e.onKeyDown,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:ne(e.onClick,C=>{w(N=>da(N)?!0:!N),x&&(v.current=C.isPropagationStopped(),v.current||C.stopPropagation())})}),x&&d.jsx(pq,{control:h,bubbles:!v.current,name:r,value:l,checked:b,required:s,disabled:a,form:u,style:{transform:"translateX(-100%)"},defaultChecked:da(i)?!1:i})]})});eA.displayName=ZS;var tA="CheckboxIndicator",nA=g.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=hq(tA,n);return d.jsx(ln,{present:r||da(i.state)||i.state===!0,children:d.jsx(Oe.span,{"data-state":rA(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});nA.displayName=tA;var pq=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:o,...i}=e,s=g.useRef(null),a=XS(n),l=CS(t);g.useEffect(()=>{const u=s.current,f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(a!==n&&p){const m=new Event("click",{bubbles:r});u.indeterminate=da(n),p.call(u,da(n)?!1:n),u.dispatchEvent(m)}},[a,n,r]);const c=g.useRef(da(n)?!1:n);return d.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o??c.current,...i,tabIndex:-1,ref:s,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function da(e){return e==="indeterminate"}function rA(e){return da(e)?"indeterminate":e?"checked":"unchecked"}var oA=eA,mq=nA;const Qu=g.forwardRef(({className:e,...t},n)=>{const[r,o]=g.useState();return g.useEffect(()=>{o(t.checked)},[t.checked]),d.jsx(oA,{ref:n,checked:r,onCheckedChange:i=>{o(i),t.onCheckedChange&&t.onCheckedChange(i)},className:fe("peer h-4 w-4 shrink-0 rounded-sm bg-bg-primary border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 data-[state=checked]:bg-bg-primary data-[state=checked]:text-fg-primary",e),...t,children:d.jsxs(mq,{className:fe("flex items-center justify-center text-current"),children:[r===!0&&d.jsx(Yu,{size:12}),r==="indeterminate"&&d.jsx(hK,{size:12})]})})});Qu.displayName=oA.displayName;function jm(e,t){const n=new Date(t).getTime(),r=e.getTime(),o=Math.floor((r-n)/1e3),i=Math.floor(o/60),s=Math.floor(o/3600),a=Math.floor(o/86400),l=Math.floor(a/30);return o<60?"just now":i<60?`${i}m ago`:s<24?`${s}h ago`:a===1?"yesterday":a<30?`${a}d ago`:`${l}mo ago`}function iA({onPublish:e,onClose:t}){const[n,r]=g.useState(null),o=ip(),{summary:i,canGenerate:s,setSummary:a,publishDisabled:l,generateSummary:c}=sp(),[u,f]=g.useState(!1),h=()=>{f(!1),i.type!=="not-asked"&&a({...i})};g.useEffect(()=>{i.type!=="not-asked"&&!i.isGenerating&&!xu(i.patchIds,o)&&f(!0)},[i,o]);const p=g.useCallback(()=>{h(),c().then(x=>{x.type==="ai"?a({type:"ai",text:x.text.trim()}):r(x.message)})},[h,c,a,r]),m="w-full p-2 border rounded bg-bg-secondary",v="text"in i?i.text:"";return d.jsxs("div",{className:"flex flex-col gap-4",children:[d.jsxs("div",{className:"flex items-center justify-between w-full gap-2",children:[d.jsx("span",{className:"font-semibold",children:"Summary"}),s&&d.jsx(GN,{onClick:p,isGenerating:i.isGenerating})]}),n&&d.jsx("div",{className:"p-4 rounded bg-bg-error-primary text-fg-error-primary",children:n}),d.jsxs("div",{className:"grid text-xs font-light",children:[d.jsx("div",{"aria-hidden":!0,className:fe(m,"invisible whitespace-pre-wrap"),style:{gridArea:"1 / 1 / 2 / 2"},children:v+" "}),d.jsx("textarea",{disabled:!!i.isGenerating,className:fe(m,"resize-none overflow-clip disabled:opacity-50"),value:v,style:{gridArea:"1 / 1 / 2 / 2"},placeholder:"Write a summary of your changes"+(s?" or generate one using AI":""),onChange:x=>{h(),a({type:"manual",text:x.currentTarget.value})}})]}),d.jsxs("div",{className:fe("p-2 text-xs flex-grow font-light bg-bg-warning-primary text-[black] rounded flex items-center","flex justify-between w-full gap-2 py-2",{hidden:!u}),"aria-hidden":u,children:[d.jsx("span",{children:"Summary might be outdated. "}),d.jsx("button",{className:"underline",onClick:h,children:"Dismiss"})]}),d.jsx("div",{className:"flex items-center justify-end gap-2",children:e?d.jsxs(d.Fragment,{children:[d.jsx(qe,{variant:"outline",onClick:()=>{t()},children:"Close"}),u&&s&&d.jsx(GN,{isGenerating:i.isGenerating,onClick:p}),!u&&d.jsxs(qe,{disabled:l||v.trim()==="",onClick:()=>{i.type!=="not-asked"&&e()},variant:"default",className:"flex items-center gap-2",children:[d.jsxs("span",{children:[" ",l?"Pushing...":"Publish"]}),d.jsx(Dg,{size:16})]})]}):d.jsx(d.Fragment,{children:d.jsx(qe,{variant:"outline",onClick:()=>{t()},children:"Close"})})})]})}function GN({isGenerating:e,onClick:t}){return d.jsx(qe,{className:"truncate",disabled:!!e,onClick:()=>{t()},variant:"outline",children:d.jsxs("span",{className:"flex items-center gap-2",children:[d.jsx("span",{children:e?"Generating...":"Generate"}),d.jsx(a2,{size:16})]})})}function gq(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];function c(f){const{scope:h,children:p,...m}=f,v=(h==null?void 0:h[e][l])||a,x=g.useMemo(()=>m,Object.values(m));return d.jsx(v.Provider,{value:x,children:p})}function u(f,h){const p=(h==null?void 0:h[e][l])||a,m=g.useContext(p);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>g.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,vq(o,...t)]}function vq(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(i)[`__scope${c}`];return{...a,...f}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function py(e){const t=e+"CollectionProvider",[n,r]=gq(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:m,children:v}=p,x=Ee.useRef(null),b=Ee.useRef(new Map).current;return d.jsx(o,{scope:m,itemMap:b,collectionRef:x,children:v})};s.displayName=t;const a=e+"CollectionSlot",l=Ee.forwardRef((p,m)=>{const{scope:v,children:x}=p,b=i(a,v),w=Be(m,b.collectionRef);return d.jsx(ls,{ref:w,children:x})});l.displayName=a;const c=e+"CollectionItemSlot",u="data-radix-collection-item",f=Ee.forwardRef((p,m)=>{const{scope:v,children:x,...b}=p,w=Ee.useRef(null),S=Be(m,w),C=i(c,v);return Ee.useEffect(()=>(C.itemMap.set(w,{ref:w,...b}),()=>void C.itemMap.delete(w))),d.jsx(ls,{[u]:"",ref:S,children:x})});f.displayName=c;function h(p){const m=i(e+"CollectionConsumer",p);return Ee.useCallback(()=>{const x=m.collectionRef.current;if(!x)return[];const b=Array.from(x.querySelectorAll(`[${u}]`));return Array.from(m.itemMap.values()).sort((C,N)=>b.indexOf(C.ref.current)-b.indexOf(N.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:s,Slot:l,ItemSlot:f},h,r]}var QS="Collapsible",[yq,sA]=So(QS),[xq,ek]=yq(QS),aA=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:i,onOpenChange:s,...a}=e,[l=!1,c]=Kr({prop:r,defaultProp:o,onChange:s});return d.jsx(xq,{scope:n,disabled:i,contentId:Vr(),open:l,onOpenToggle:g.useCallback(()=>c(u=>!u),[c]),children:d.jsx(Oe.div,{"data-state":nk(l),"data-disabled":i?"":void 0,...a,ref:t})})});aA.displayName=QS;var lA="CollapsibleTrigger",cA=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=ek(lA,n);return d.jsx(Oe.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":nk(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:ne(e.onClick,o.onOpenToggle)})});cA.displayName=lA;var tk="CollapsibleContent",uA=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=ek(tk,e.__scopeCollapsible);return d.jsx(ln,{present:n||o.open,children:({present:i})=>d.jsx(bq,{...r,ref:t,present:i})})});uA.displayName=tk;var bq=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...i}=e,s=ek(tk,n),[a,l]=g.useState(r),c=g.useRef(null),u=Be(t,c),f=g.useRef(0),h=f.current,p=g.useRef(0),m=p.current,v=s.open||a,x=g.useRef(v),b=g.useRef();return g.useEffect(()=>{const w=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(w)},[]),On(()=>{const w=c.current;if(w){b.current=b.current||{transitionDuration:w.style.transitionDuration,animationName:w.style.animationName},w.style.transitionDuration="0s",w.style.animationName="none";const S=w.getBoundingClientRect();f.current=S.height,p.current=S.width,x.current||(w.style.transitionDuration=b.current.transitionDuration,w.style.animationName=b.current.animationName),l(r)}},[s.open,r]),d.jsx(Oe.div,{"data-state":nk(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!v,...i,ref:u,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:v&&o})});function nk(e){return e?"open":"closed"}var wq=aA,Sq=cA,kq=uA,ms="Accordion",Eq=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[rk,Cq,Nq]=py(ms),[my,yge]=So(ms,[Nq,sA]),ok=sA(),dA=Ee.forwardRef((e,t)=>{const{type:n,...r}=e,o=r,i=r;return d.jsx(rk.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?d.jsx(Tq,{...i,ref:t}):d.jsx(jq,{...o,ref:t})})});dA.displayName=ms;var[fA,Pq]=my(ms),[hA,_q]=my(ms,{collapsible:!1}),jq=Ee.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},collapsible:i=!1,...s}=e,[a,l]=Kr({prop:n,defaultProp:r,onChange:o});return d.jsx(fA,{scope:e.__scopeAccordion,value:a?[a]:[],onItemOpen:l,onItemClose:Ee.useCallback(()=>i&&l(""),[i,l]),children:d.jsx(hA,{scope:e.__scopeAccordion,collapsible:i,children:d.jsx(pA,{...s,ref:t})})})}),Tq=Ee.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...i}=e,[s=[],a]=Kr({prop:n,defaultProp:r,onChange:o}),l=Ee.useCallback(u=>a((f=[])=>[...f,u]),[a]),c=Ee.useCallback(u=>a((f=[])=>f.filter(h=>h!==u)),[a]);return d.jsx(fA,{scope:e.__scopeAccordion,value:s,onItemOpen:l,onItemClose:c,children:d.jsx(hA,{scope:e.__scopeAccordion,collapsible:!0,children:d.jsx(pA,{...i,ref:t})})})}),[Oq,gy]=my(ms),pA=Ee.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:o,orientation:i="vertical",...s}=e,a=Ee.useRef(null),l=Be(a,t),c=Cq(n),f=ap(o)==="ltr",h=ne(e.onKeyDown,p=>{var O;if(!Eq.includes(p.key))return;const m=p.target,v=c().filter(M=>{var D;return!((D=M.ref.current)!=null&&D.disabled)}),x=v.findIndex(M=>M.ref.current===m),b=v.length;if(x===-1)return;p.preventDefault();let w=x;const S=0,C=b-1,N=()=>{w=x+1,w>C&&(w=S)},P=()=>{w=x-1,w<S&&(w=C)};switch(p.key){case"Home":w=S;break;case"End":w=C;break;case"ArrowRight":i==="horizontal"&&(f?N():P());break;case"ArrowDown":i==="vertical"&&N();break;case"ArrowLeft":i==="horizontal"&&(f?P():N());break;case"ArrowUp":i==="vertical"&&P();break}const _=w%b;(O=v[_].ref.current)==null||O.focus()});return d.jsx(Oq,{scope:n,disabled:r,direction:o,orientation:i,children:d.jsx(rk.Slot,{scope:n,children:d.jsx(Oe.div,{...s,"data-orientation":i,ref:l,onKeyDown:r?void 0:h})})})}),$g="AccordionItem",[Mq,ik]=my($g),sk=Ee.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...o}=e,i=gy($g,n),s=Pq($g,n),a=ok(n),l=Vr(),c=r&&s.value.includes(r)||!1,u=i.disabled||e.disabled;return d.jsx(Mq,{scope:n,open:c,disabled:u,triggerId:l,children:d.jsx(wq,{"data-orientation":i.orientation,"data-state":yA(c),...a,...o,ref:t,disabled:u,open:c,onOpenChange:f=>{f?s.onItemOpen(r):s.onItemClose(r)}})})});sk.displayName=$g;var mA="AccordionHeader",gA=Ee.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=gy(ms,n),i=ik(mA,n);return d.jsx(Oe.h3,{"data-orientation":o.orientation,"data-state":yA(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});gA.displayName=mA;var Yb="AccordionTrigger",ak=Ee.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=gy(ms,n),i=ik(Yb,n),s=_q(Yb,n),a=ok(n);return d.jsx(rk.ItemSlot,{scope:n,children:d.jsx(Sq,{"aria-disabled":i.open&&!s.collapsible||void 0,"data-orientation":o.orientation,id:i.triggerId,...a,...r,ref:t})})});ak.displayName=Yb;var vA="AccordionContent",lk=Ee.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=gy(ms,n),i=ik(vA,n),s=ok(n);return d.jsx(kq,{role:"region","aria-labelledby":i.triggerId,"data-orientation":o.orientation,...s,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});lk.displayName=vA;function yA(e){return e?"open":"closed"}var xA=dA,Rq=sk,Aq=gA,bA=ak,wA=lk;const Dl=xA,_a=g.forwardRef(({className:e,...t},n)=>d.jsx(Rq,{ref:n,className:fe("border-b",e),...t}));_a.displayName="AccordionItem";const Ll=g.forwardRef(({className:e,children:t,...n},r)=>d.jsx(Aq,{className:"flex",children:d.jsxs(bA,{ref:r,className:fe("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,d.jsx(Ju,{className:"w-4 h-4 transition-transform duration-200 shrink-0"})]})}));Ll.displayName=bA.displayName;const ja=g.forwardRef(({className:e,children:t,...n},r)=>d.jsx(wA,{ref:r,className:fe("overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",e),...n,children:d.jsx("div",{className:"pt-0 pb-4",children:t})}));ja.displayName=wA.displayName;function SA(e,t,n){if(e.length===0)return{success:!1,error:"Empty path"};let r=-1,o="";const i=c=>{o===""?o=c:o+="."+c};if(t===void 0)return{success:!1,error:`Undefined schema in: '${e.join("/")}'.`};if(n===void 0)return{success:!1,error:`Undefined source in: '${e.join("/")}'.`};let s=t,a=n;const l=[{modulePath:o,schema:s,source:a}];for(const c of e){if(r++,c==="")return{success:!1,error:`Empty path part in: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(s.type==="array"){s=s.item;const u=Number(c);if(!Number.isSafeInteger(u))return{success:!1,error:`Invalid array index in: '${e.join("/")}'. Expected an integer but got '${c}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(typeof a!="object")return{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an object but got '${typeof a}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(a===null)return{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an object but got 'null' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(a===void 0)return{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an object but got 'undefined' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(!Array.isArray(a))return{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an array but got '${typeof a}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(!a[u])return{success:!1,error:`Invalid array index in: '${e.join("/")}'. Expected an index less than ${a.length} but got '${u}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};a=a[u],i(c)}else if(s.type==="record"){s=s.item;const u=om(e,c,r,a,"record");if(!u.success)return{success:!1,error:u.error};a=u.source[c],i(JSON.stringify(c))}else if(s.type==="object"){s=s.items[c];const u=om(e,c,r,a,"record");if(!u.success)return{success:!1,error:u.error};a=u.source[c],i(JSON.stringify(c))}else if(s.type==="union"){const u=typeof s.key=="object"&&s.key.type==="literal"?s:void 0,f=typeof s.key=="string"?s:void 0;if(u)return{success:!1,error:"Invalid lookup in string union"};if(f){const h=om(e,c,r,a,"union object");if(!h.success)return{success:!1,error:h.error};const p=h.source;let m;for(const v of f.items){const x=v.items[f.key];if(x.type==="literal"){if(p[f.key]===x.value){m=v;break}}else return{success:!1,error:`Invalid lookup in union: unknown union type in: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`}}if(!m)return{success:!1,error:`Invalid lookup in union: unknown union type in: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};s=m.items[c],a=p[c],i(JSON.stringify(c))}else return{success:!1,error:`Invalid lookup in union: unknown union type in: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`}}else if(s.type==="image"||s.type==="file"){const u=om(e,c,r,a,"record");if(!u.success)return{success:!1,error:u.error};a=u.source[c],i(JSON.stringify(c))}else return{success:!1,error:`Cannot construct sub-path in schema of '${s.type}' in: '${e.join("/")}'. Path was: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")}`};l.push({modulePath:o,schema:s,source:a})}return{success:!0,modulePath:o,schema:s,source:a,allResolved:l}}function om(e,t,n,r,o){return typeof r!="object"?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got '${typeof r}' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:r===null?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got 'null' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:r===void 0?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got 'undefined' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:typeof r!="object"?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got '${typeof r}' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:Array.isArray(r)?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got 'array' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:t in r?{success:!0,source:r}:{success:!1,error:`Could not find key of source: '${e.join("/")}'. Expected a key in ${Object.keys(r).join(", ")} but got '${t}' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}}function Iq(e,t){return(t==null?void 0:t.type)==="array"?e.type!=="string":(t==null?void 0:t.type)==="record"}function kA(e,t,n){if(!n)return null;const[r,o]=Y.splitModuleFilePathAndModulePath(e);if(!o)return r;const i=t[r],s=n[r];if(i===void 0||!s)return null;const a=SA(Y.splitModulePath(o),s,i);if(a.success){for(let l=a.allResolved.length-1;l>=0;l--){const c=a.allResolved[l],u=a.allResolved[l-1];if(Iq(c.schema,(u==null?void 0:u.schema)||null))return c.modulePath===""?r:Y.joinModuleFilePathAndModulePath(r,c.modulePath)}return r}else console.error(`Error resolving path: ${a.error} for path: ${e}`);return null}function dp({moduleFilePath:e,patchPath:t,className:n,toolTip:r=!0,link:o=!0}){const i=Gu(),s=g.useRef(null),a=g.useRef(new Map),[l,c]=g.useState([]),[u,f]=g.useState(),h=FS(),p=Ba(),{navigate:m}=xn();g.useEffect(()=>{const x=e?Y.splitModuleFilePath(e):[],b=t,w=()=>{if(!s.current)return;const C=s.current,N=getComputedStyle(C),P=`${N.fontSize} ${N.fontFamily}`,_=C.offsetWidth,O=x.map(Dq).concat(b).map(K=>`/${K}`);f(O.join(""));const M=K=>{const V=`${K}:${P}`,I=a.current.get(V)??Lq(K,P);return a.current.set(V,I),I},D="/…",U=M(D),z=[];let H=0;for(let K=O.length-1;K>=0;K--){const V=M(O[K]),A=!(K===0);if(H+V+(A?U:0)<=_){const j=K>x.length?"module-path":"module-file-path";z.unshift({text:O[K],type:j,moduleFilePath:e,modulePathSegments:b.slice(0,K)}),H+=V}else{z.unshift({type:"ellipsis",text:D});break}}c(z)},S=new ResizeObserver(w);return s.current&&(S.observe(s.current),w()),()=>{s.current&&S.unobserve(s.current)}},[e,t]);const v=g.useMemo(()=>{if(!o)return null;const x="data"in p?p.data:{};if(t.length===0){const w=e;return{navPath:w,sourcePath:w}}const b=SA(t,x[e],h[e]);if(b.success){const w=Y.joinModuleFilePathAndModulePath(e,b.modulePath),S=kA(w,h,x);if(S)return{navPath:S,scrollToId:w};console.debug(`Failed to resolve nav path for ${e} and ${t.join(".")}: ${S}`)}else console.debug(`Failed to resolve source path for ${e} and ${t.join(".")}: ${b.error}`);return null},[e,t,h,p]);return d.jsxs(zr,{open:r===!1?!1:void 0,children:[d.jsx(TS,{asChild:!0,children:d.jsx("a",{href:v&&i?`${i.studioPrefix}${v.navPath}#${v.scrollToId}`:void 0,ref:s,className:Ce("inline-block whitespace-nowrap overflow-hidden w-full align-baseline",{"cursor-pointer hover:underline":o},n),onClick:x=>{o&&v&&x.metaKey===!1&&x.ctrlKey===!1&&x.shiftKey===!1&&(x.preventDefault(),m(v.navPath,{scrollToId:v.scrollToId}))},children:l.map((x,b)=>d.jsx("span",{children:x.text},b))})}),d.jsx(fr,{side:"top",children:d.jsx(hr,{orientation:"horizontal",className:"max-w-[calc(100vw-3rem)] whitespace-nowrap",children:u})})]})}function Dq(e){const t=Eu(e);return t.slice(0,1).toUpperCase()+t.slice(1)}function Lq(e,t){const r=document.createElement("canvas").getContext("2d");return r?(r.font=t,r.measureText(e).width):0}function EA({className:e,loadingStatus:t}){const n=ip(),r=qu(),o=R7(),i=M7(),s=In(),[a,l]=g.useState(!1),{canGenerate:c}=sp(),u=Ql(),{autoPublish:f}=IS(),h=g.useMemo(()=>{var D;let M=0;for(const U in u)M+=((D=u[U])==null?void 0:D.length)||0;return M},[u]),p=n.length-o.size,{deployments:m,dismissDeployment:v,observedCommitShas:x}=O7(),{globalTransientErrors:b,removeGlobalTransientErrors:w}=z7(),{patchErrors:S}=YR(),[C,N]=g.useState(new Date);g.useEffect(()=>{const M=setInterval(()=>{N(new Date)},6e4);return()=>{clearInterval(M)}},[]);const{deletePatches:P}=WR(),_=P7(),O=async(M,D,U)=>{const z=await _("/patches","GET",{query:{patch_id:[D],exclude_patch_ops:!1}});if(z.status===200){const H=z.json,K=`val-patch-error-report-${M.replace("/","__").replace(/\.val\./,"-")}-${D}.json`,V=new Blob([JSON.stringify({moduleFilePath:M,patchId:D,error:U,patch:H},null,2)],{type:"application/json"}),I=document.createElement("a");I.href=URL.createObjectURL(V),I.download=K,I.click()}else alert("Failed to download report")};return d.jsxs("div",{className:Ce("text-sm",e),children:[S&&Object.values(S).some(M=>M!==null)&&d.jsx("div",{className:"sticky top-0 border-b border-border-primary bg-bg-error-primary text-fg-error-primary z-5",children:d.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[d.jsxs("div",{className:"px-4 text-pretty",children:[d.jsx("div",{children:"Unfortunately, one or more changes have errors."}),d.jsx("div",{children:"No changes can currently be applied."})]}),Object.entries(S).map(([M,D],U)=>d.jsx("div",{className:"pb-4",children:d.jsx(hr,{orientation:"horizontal",className:"max-w-[280px] text-pretty text-xs",children:D&&Object.entries(D).map(([z,H],K)=>d.jsx(xA,{className:"grid grid-cols-2 gap-2",type:"single",collapsible:!0,children:d.jsxs(sk,{value:z,children:[d.jsx("div",{children:d.jsx(qe,{variant:"destructive",onClick:()=>{P([z])},children:d.jsx("span",{className:"flex gap-2 justify-between items-center text-left",children:d.jsx("span",{children:"Remove change and fix issue"})})})}),d.jsx(ak,{asChild:!0,className:"group",children:d.jsxs(qe,{variant:"destructive",children:[d.jsx("span",{className:"text-left truncate group-data-[state=open]:hidden",children:"Report"}),d.jsx("span",{className:"text-left truncate group-data-[state=open]:block hidden",children:"Hide"})]})}),d.jsxs(lk,{children:[d.jsx(qe,{variant:"destructive",onClick:()=>{O(M,z,H.message)},children:d.jsxs("span",{className:"flex gap-2 justify-between items-center text-left",children:[d.jsx("span",{children:"Download debug report"}),d.jsx(eK,{size:14})]})}),d.jsxs("div",{className:"p-4",children:[d.jsx("div",{className:"font-bold",children:"Details"}),d.jsx("div",{children:"Module file path"}),d.jsx("div",{children:d.jsx(qN,{sourcePath:M})}),d.jsx("div",{children:"Error message"}),d.jsx("pre",{children:H.message})]})]})]})},K))})},M+"#"+U))]})}),u&&h>0&&d.jsx("div",{className:"sticky top-0 border-b border-border-primary bg-bg-error-primary text-fg-error-primary z-5",children:d.jsx(hr,{orientation:"horizontal",children:d.jsx(Dl,{type:"single",className:"px-4 font-serif",collapsible:!0,children:d.jsxs(_a,{value:"error",className:"border-b-0",children:[d.jsx(Ll,{className:" data-[state=open]:mb-4 text-fg-error-primary border-fg-error-primary ",children:d.jsxs("div",{className:"flex justify-between items-center w-full",children:[d.jsxs("div",{children:[h," validation issue",h>1?"s":""]}),d.jsx(Su,{size:16})]})}),d.jsx(ja,{className:"",children:d.jsx("div",{className:"flex flex-col gap-4",children:Object.entries(u).map(([M,D],U)=>d.jsxs("div",{className:"pb-4",children:[d.jsx("div",{className:"items-start text-left",children:d.jsx(qN,{sourcePath:M})}),d.jsx("div",{children:d.jsx(hr,{orientation:"horizontal",className:"max-w-[280px] text-pretty text-xs",children:D==null?void 0:D.map((z,H)=>d.jsx("div",{className:"",children:d.jsx("div",{children:z.message})},H))})})]},M+"#"+U))})})]})})})}),b&&b.length>0&&d.jsx("div",{className:"sticky top-0 border-b border-border-primary bg-bg-error-primary text-fg-error-primary z-5",children:d.jsx(hr,{orientation:"horizontal",children:d.jsx(Dl,{type:"single",className:"px-4 font-serif",collapsible:!0,children:d.jsxs(_a,{value:"error",className:"border-b-0 data-[state=open]:mb-4",children:[d.jsxs(Ll,{children:[b.length," transient error",b.length>1?"s":""]}),d.jsx(ja,{className:"w-full",children:d.jsx("div",{className:"flex flex-col gap-2",children:b.map(M=>d.jsxs("div",{className:"flex gap-2 justify-between items-start",children:[d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx("div",{className:"font-bold",children:M.message}),M.details&&d.jsx("div",{children:M.details}),d.jsx("div",{className:"text-[10px] font-thin",children:jm(C,new Date(M.timestamp).toISOString())})]}),d.jsx("button",{onClick:()=>w([M.id]),children:d.jsx(Rl,{size:14})})]},M.id))})})]})})})}),m.length>0&&d.jsx("div",{className:"p-4 border-b border-border-primary",children:d.jsx(Fq,{deployments:m,observedCommitShas:x,onDismiss:v})}),r==="http"&&d.jsx("div",{className:"flex justify-end items-center p-4 border-b z-5 border-border-primary",children:d.jsxs(br,{open:a,onOpenChange:M=>{l(M)},children:[d.jsx(xo,{asChild:!0,children:d.jsxs(qe,{variant:"secondary",className:"flex gap-2 items-center text-sm",children:[d.jsx("span",{children:"Summary"}),c&&d.jsx(a2,{size:14})]})}),d.jsxs(tr,{container:s,align:"end",className:"z-[9001] flex flex-col gap-4",children:[d.jsx(Al,{asChild:!0,className:"self-end cursor-pointer",children:d.jsx(Rl,{size:12})}),d.jsx(iA,{onClose:()=>{l(!1)}})]})]})}),d.jsx("div",{className:"p-4 z-5",children:d.jsxs("div",{className:"flex justify-between items-center",children:[d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsxs("div",{className:"font-bold",children:[p<=0?"No ":`${p} `,"pending change",p===1?"":"s"]}),(t==="loading"||t==="not-asked")&&d.jsx("div",{className:"",children:d.jsx(Gr,{size:16,className:"animate-spin"})})]}),d.jsxs(br,{children:[d.jsx(xo,{asChild:!0,children:d.jsxs(qe,{disabled:n.length===0,variant:"secondary",className:"flex gap-2 items-center text-sm",children:[d.jsx("span",{children:"Undo all"}),d.jsx(Hb,{size:14})]})}),d.jsx(tr,{container:s,className:"z-[9001]",children:d.jsxs("div",{className:"flex flex-col gap-4",children:[d.jsx("div",{className:"text-lg font-bold",children:"Are you sure?"}),d.jsx("div",{children:"This will undo all changes to the current state."}),d.jsx("div",{children:d.jsx(Al,{asChild:!0,children:d.jsxs(qe,{variant:"destructive",className:"flex gap-2 items-center text-sm",onClick:()=>{P(n)},children:[d.jsx("span",{children:"Undo all changes"}),d.jsx(Hb,{size:14})]})})})]})})]})]})}),(!f||h>0)&&d.jsx("div",{className:"flex flex-col gap-[2px]",children:"data"in i&&n.length>0&&i.data.map(M=>d.jsx(Vq,{committedPatchIds:o,patchSet:M,patchErrors:(S==null?void 0:S[M.moduleFilePath])??{}},M.moduleFilePath+":"+M.patchPath.join("/")))})]})}function qN({sourcePath:e}){const[t,n]=Y.splitModuleFilePathAndModulePath(e),r=Y.splitModulePath(n);return d.jsx(dp,{moduleFilePath:t,patchPath:r})}function Fq({deployments:e,observedCommitShas:t,onDismiss:n}){return g.useEffect(()=>{for(const r of e)t.has(r.commitSha)&&setTimeout(()=>{n(r.commitSha)},5e3)},[e,t]),d.jsxs("div",{children:[d.jsxs("div",{className:"flex justify-between items-center p-2 font-bold",children:[d.jsx("span",{children:"Deployments"}),d.jsx(Gr,{size:16,className:"inline animate-spin"})]}),d.jsx("div",{children:e.reverse().map(r=>d.jsx(zq,{deployment:r,isFinished:t.has(r.commitSha),onDismiss:()=>{n(r.commitSha)}},r.commitSha))})]})}function zq({deployment:e,isFinished:t,onDismiss:n}){var s;const r=LS(),o=In(),i=e.creator&&r[e.creator];return d.jsxs("div",{className:"flex justify-between items-start p-2",children:[d.jsxs("div",{className:"flex gap-2 items-start",children:[i&&d.jsx("img",{src:(s=i.avatar)==null?void 0:s.url,alt:i.fullName,className:"w-8 h-8 rounded-full"}),d.jsxs(zr,{children:[d.jsx(TR,{container:o}),d.jsx(ho,{children:d.jsx("div",{className:"max-w-[180px] overflow-clip font-light truncate",children:e.commitMessage})}),d.jsx(fr,{className:"max-w-[320px]",children:d.jsx("pre",{className:"font-sans font-light whitespace-break-spaces",children:e.commitMessage})})]})]}),t&&d.jsxs("div",{className:"flex gap-2 items-start",children:[d.jsx("span",{className:"text-xs font-light text-fg-quaternary",children:"Deployed"}),d.jsx("button",{onClick:()=>{n()},children:d.jsx(Yu,{size:14})})]}),!t&&d.jsx($q,{since:new Date(e.createdAt)})]})}function $q({since:e}){const[t,n]=g.useState("00"),[r,o]=g.useState("00");return g.useEffect(()=>{let i;const s=()=>{const a=Date.now(),l=Math.floor((a-e.getTime())/1e3),c=Math.floor(l/60),u=l%60;let f;c>4?(f=(60-u)*1e3,n(c.toString()),o(null)):(f=1e3,n(c.toString().padStart(2,"0")),o(u.toString().padStart(2,"0"))),i=setTimeout(s,f)};return s(),()=>{clearTimeout(i)}},[e]),d.jsxs("div",{className:"text-xs font-light text-fg-quaternary",children:[t,r!==null?`:${r}`:" mins"]})}function Bq({moduleFilePath:e,patchMetadata:t,committedPatchIds:n}){var u;const r=CA([t.opType],t.createdAt,n.has(t.patchId)),o=LS(),{skippedPatches:i}=DS(),s=void 0,[a]=g.useMemo(()=>[!!i[t.patchId]],[t.patchId,i[t.patchId]]),l=qu();let c=[];if(t.author){const f=o[t.author];if(f){const h=((u=f==null?void 0:f.avatar)==null?void 0:u.url)??null;c=[{fullName:f.fullName,url:h}]}else console.warn("Did not find profile for author: ",t.author,{profilesById:o})}return c.length===0&&l==="http"&&console.warn("No authors",{patchMetadata:t}),d.jsx(Jb,{moduleFilePath:e,patchPath:t.patchPath,changeDescription:a?"Skipped":r,authors:c,errors:s,skipped:a,isApplied:n.has(t.patchId)})}function CA(e,t,n){const[r,o]=g.useState(new Date);if(g.useEffect(()=>{const a=setInterval(()=>{o(new Date)},6e4);return()=>{clearInterval(a)}},[]),n)return"Pushed "+jm(r,t);if(e.length>1)return"Updated "+jm(r,t);const i=e[0];let s=i;return i==="add"?s="Added":i==="remove"?s="Removed":i==="replace"?s="Replaced":i==="move"?s="Moved":i==="copy"?s="Copied":i==="test"?s="Tested":i==="file"?s="Updated":console.warn("Unexpected op type: ",i),s+" "+jm(r,t)}function Vq({patchSet:e,committedPatchIds:t,patchErrors:n}){const[r,o]=g.useState(!1),i=g.useRef(null),[s,a]=g.useState(!1);g.useEffect(()=>{const v=new IntersectionObserver(x=>{x[0].isIntersecting&&a(!0)},{threshold:0});return i.current&&v.observe(i.current),()=>{v.disconnect()}},[]);const{skippedPatches:l}=DS(),{deletePatches:c}=WR(),u=g.useMemo(()=>e.patches.map(v=>v.patchId),[e.patches.map(v=>v.patchId).join(",")]),f=g.useMemo(()=>{const v=[];for(const x of u){const b=n==null?void 0:n[x];!l[x]&&b&&v.unshift(b.message)}return v},[u,n,l]),h=CA(e.opTypes,e.lastUpdated,!1),p=LS(),m=e.patches.every(v=>t.has(v.patchId));return s?d.jsxs(d.Fragment,{children:[d.jsx(Jb,{moduleFilePath:e.moduleFilePath,patchPath:e.patchPath,isApplied:m,authors:e.authors.reduce((v,x)=>v.includes(x)?v:v.concat(x),[]).flatMap(v=>{var b;const x=p[v];if(x){const w=((b=x==null?void 0:x.avatar)==null?void 0:b.url)??null;return[{fullName:x.fullName,url:w}]}return[]}),changeDescription:h,isOpen:r,setOpen:o,errors:f,onDelete:()=>{c(u.filter(v=>!t.has(v)))},amount:new Set(u).size}),d.jsx(ku,{isOpen:r,children:e.patches.map((v,x)=>d.jsx(Bq,{committedPatchIds:t,moduleFilePath:e.moduleFilePath,patchMetadata:v},e.moduleFilePath+":"+e.patchPath.join("/")+v.patchId+x))})]}):d.jsx(Jb,{ref:i,isApplied:m})}const Jb=g.forwardRef(({moduleFilePath:e,patchPath:t,changeDescription:n,authors:r,isOpen:o,setOpen:i,isSelected:s,setSelected:a,errors:l,skipped:c,onDelete:u,amount:f,isApplied:h},p)=>{const m=In();return d.jsxs("div",{ref:p,className:Ce("p-6",{"bg-bg-secondary":!o,"bg-bg-tertiary":o,"opacity-50":h}),children:[d.jsxs("div",{className:"relative",children:[d.jsx("span",{className:"inline-block w-[calc(320px-24px-8px-16px-24px-48px)] truncate mr-2 ",children:e&&t&&d.jsx(dp,{moduleFilePath:e,patchPath:t,link:!0,toolTip:!0})}),s===void 0&&d.jsx("span",{className:Ce("inline-block w-6 h-6 rounded",{"bg-bg-disabled animate-pulse":t===void 0})}),s!==void 0&&!h&&d.jsx(Qu,{checked:s,onCheckedChange:v=>{a&&a(v)}}),d.jsxs("div",{className:"inline relative ml-5",children:[f&&d.jsxs(zr,{children:[d.jsx(ho,{children:d.jsx("span",{className:"absolute -right-5 -top-6 w-6 h-6 text-xs leading-6 text-center rounded-full bg-bg-primary text-fg-primary",children:f>9?"9+":f})}),d.jsx(fr,{side:"left",children:d.jsxs("p",{children:[f," change",f>1?"s":""," in this patch set"]})})]}),u&&!h&&f&&f>0&&d.jsxs(br,{children:[d.jsx(xo,{children:d.jsx(Hb,{size:16,className:"inline"})}),d.jsxs(tr,{container:m,className:"flex flex-col gap-2 z-[9001]",children:[d.jsx("div",{className:"text-lg font-bold",children:"Are you sure?"}),d.jsxs("div",{children:["This will undo ",f," change",f>1?"s":"","."]}),d.jsx("div",{children:d.jsx(Al,{asChild:!0,children:d.jsxs(qe,{variant:"destructive",onClick:u,children:["Undo change",f>1?"s":""]})})})]})]})]})]}),l&&l.length>0&&!c&&d.jsxs("div",{className:"p-2 max-w-[240px] bg-bg-error-primary text-fg-primary rounded-lg",children:[l.slice(0,1).map((v,x)=>d.jsx("div",{title:v,className:"truncate",children:"Invalid change"},x)),l.length>1&&d.jsxs("div",{className:"truncate",children:["+",l.length-1," more"]})]}),(!l||l.length===0)&&c&&d.jsx("div",{className:"p-2 max-w-[240px] bg-bg-error-primary text-fg-primary",children:d.jsx("div",{className:"truncate",children:"Skipped"})}),d.jsxs("div",{className:"flex justify-between items-center pt-2",children:[d.jsxs("span",{className:"flex flex-shrink-0 gap-2",children:[r!==void 0&&r.length>0&&d.jsxs("span",{className:"flex gap-1 mr-2",children:[r.slice(0,2).map((v,x)=>{if(v.url)return d.jsxs(zr,{children:[d.jsx(ho,{className:"flex-shrink-0 w-6 h-6",children:d.jsx("img",{src:v.url,alt:v.fullName,className:Ce("rounded-full",{"-ml-3":r.length>2&&x>0})})}),d.jsx(fr,{children:d.jsx("div",{children:v.fullName})})]},v.url);const b=Uq(v.fullName);return d.jsxs(zr,{children:[d.jsx(ho,{className:Ce({"-ml-3":r.length>2&&x>0}),children:d.jsx("span",{className:Ce("flex items-center justify-center w-6 h-6 text-xs font-semibold rounded-full bg-bg-primary text-fg-primary"),"aria-label":"Initials for: "+v.fullName,children:b})}),d.jsx(fr,{children:d.jsx("div",{children:v.fullName})})]},v.fullName+v.url)}),r.length>2&&d.jsxs(zr,{children:[d.jsx(ho,{className:Ce({"-ml-3":r.length>2}),children:d.jsxs("span",{className:"flex justify-center items-center -ml-3 w-6 h-6 text-xs font-semibold rounded-full bg-bg-primary text-fg-primary",children:["+",r.length-2]})}),d.jsx(fr,{className:"grid grid-cols-[auto,1fr] gap-2",children:r.slice(2).map(v=>d.jsxs(g.Fragment,{children:[v.url?d.jsx("img",{src:v.url,alt:v.fullName,title:v.fullName,className:Ce("w-6 h-6 rounded-full")},v.url):d.jsx("div",{}),d.jsx("div",{children:v.fullName})]},v.fullName+v.url))})]})]}),r===void 0&&d.jsx("span",{className:Ce("inline-block w-6 h-6 mr-2",{"bg-bg-disabled animate-pulse rounded-3xl":r===void 0})}),n&&d.jsx("span",{className:Ce({"text-fg-disabled":c}),children:n})]}),o!==void 0&&d.jsx("button",{className:"inline-block flex-shrink-0",onClick:()=>{i&&i(!o)},children:d.jsx(Ju,{size:16,className:Ce("transform",{"rotate-180":o})})})]})]})});function Uq(e){return!e||typeof e!="string"?"":e.trim().normalize("NFC").split(/\s+/).filter(r=>r.length>0).map(r=>/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u.test(r)?r[0]:r[0].toLocaleUpperCase()).join("")}function Xb(){const[e,t]=g.useState(!1),{publish:n,publishDisabled:r,isPublishing:o,summary:i}=sp(),s=Ql(),a=s!==void 0&&Object.keys(s).length>0,l=HR(),c=KR(),u=qu(),f=In(),{autoPublish:h}=IS();return a?d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(qe,{className:"flex gap-2 items-center",disabled:!0,children:u==="fs"?"Save":d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Ready"}),d.jsx(Dg,{size:16})]})})}),d.jsx(fr,{children:d.jsx("div",{className:"flex flex-col gap-2",children:d.jsx("p",{children:"Fix validation errors to continue"})})})]}):u==="fs"?d.jsxs(qe,{className:"flex gap-2 items-center",disabled:r||a||h||l.length===0||c.length>0,title:a?"Please fix validation errors":"",onClick:()=>{n("No summary provided")},children:[a?d.jsx("span",{children:"Save"}):d.jsx("span",{children:o?"Saving":"Save"}),o&&d.jsx(Gr,{className:"animate-spin",size:16})]}):d.jsx("span",{children:d.jsxs(br,{open:e,onOpenChange:p=>{t(p)},children:[d.jsx(xo,{asChild:!0,children:d.jsxs(qe,{className:"flex gap-2 items-center",disabled:r||a||l.length===0||c.length>0,onClick:()=>{t(!0)},children:[!o&&d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Ready"}),d.jsx(Dg,{size:16})]}),o&&d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Pushing"}),d.jsx(Gr,{className:"animate-spin",size:16})]})]})}),d.jsxs(tr,{container:f,align:"end",className:"z-[9001] flex flex-col gap-4",children:[d.jsx(Al,{asChild:!0,className:"self-end cursor-pointer",children:d.jsx(Rl,{size:12})}),d.jsx(iA,{onClose:()=>{t(!1)},onPublish:()=>{if(t(!1),i.type==="not-asked")return;const p=i.text.trim();n(p)}})]})]})})}function Wq(){const e=ly(),{isPublishing:t}=sp(),n=Ql()||{},{globalErrors:r}=DS(),o=qu(),[i,s]=g.useMemo(()=>{const a=new Set;let l=0;for(const c in n){const[u]=Y.splitModuleFilePathAndModulePath(c);a.add(u),l+=1}return[Array.from(a).sort(),l]},[n]);return d.jsxs("div",{className:"min-h-[100svh] bg-bg-primary",style:{"--menu-width":"320px"},children:[d.jsx("div",{className:"h-16 border-b border-border-primary",children:d.jsx(Gq,{})}),t&&d.jsxs("div",{className:"flex gap-2 justify-end items-center p-4 text-right border-t bg-bg-tertiary text-fg-primary border-border-primary",children:[d.jsx("span",{children:"Publishing changes "}),d.jsx(Gr,{size:16,className:"animate-spin"})]}),d.jsx(hr,{children:d.jsxs("div",{className:"max-h-[calc(100svh-64px)]",children:[r&&r.length>0&&r.length!==s&&d.jsx(Dl,{type:"single",collapsible:!0,children:d.jsxs(_a,{value:"global-errors",children:[d.jsxs(Ll,{className:"p-4 font-normal text-left rounded data-[state=open]:rounded-b-none bg-bg-error-primary text-fg-error-primary",children:["Cannot ",o==="fs"?"save":"publish"," now. Found"," ",r==null?void 0:r.length," errors in all."," ",r.length-s," were non-validation errors. A developer might need to fix these issues."]}),d.jsx(ja,{children:d.jsx(hr,{children:d.jsx("div",{className:"max-h-[calc(100svh-128px)] max-w-[var(--menu-width)]",children:r==null?void 0:r.map((a,l)=>d.jsx(Kq,{error:a},l))})})})]})}),(r==null?void 0:r.length)===s&&i.length>0&&d.jsx(Dl,{type:"single",collapsible:!0,children:d.jsxs(_a,{value:"global-errors",children:[d.jsx(Ll,{className:"p-4 font-normal text-left rounded data-[state=open]:rounded-b-none bg-bg-error-primary text-fg-error-primary",children:d.jsxs("div",{children:[d.jsxs("div",{children:["Cannot ",o==="fs"?"save":"publish"," now."]}),d.jsx("div",{children:"Found errors in modules"})]})}),d.jsx(ja,{children:d.jsx(hr,{children:d.jsx("div",{className:"max-h-[calc(100svh-64px)] max-w-[var(--menu-width)]",children:i==null?void 0:i.map((a,l)=>d.jsx(Hq,{moduleFilePath:a},l))})})})]})}),e!=="not-asked"&&d.jsx("div",{className:Ce("",{}),children:d.jsx(hr,{children:d.jsx("div",{className:"max-h-[calc(100svh-64px)] border-b border-border-primary",children:d.jsx(EA,{loadingStatus:e})})})})]})})]})}function Hq({moduleFilePath:e}){const t=Y.splitModuleFilePath(e),n=xn();return d.jsx("div",{className:"px-4 py-2 border-b bg-bg-error-primary text-fg-error-primary border-border-error-primary",children:d.jsx("button",{className:"underline cursor-pointer",onClick:()=>{n.navigate(e)},children:t.map((r,o)=>d.jsxs(g.Fragment,{children:[d.jsx("span",{className:fe("text-fg-brand-secondary",{"ml-1":o>0}),children:"/"}),d.jsx("span",{children:Eu(r)})]},o))})})}function Kq({error:e}){const[t,n]=g.useState(!1);return d.jsx("div",{className:fe("px-1 py-2 bg-bg-error-primary text-fg-error-primary border-b border-border-error-primary",{truncate:!t,"whitespace-normal":t}),onClick:()=>n(!t),children:e})}function Gq(){const{currentSourcePath:e}=xn(),t=Ba(),[n,r]=Y.splitModuleFilePathAndModulePath(e),o=lt(n,"record"),i=g.useMemo(()=>{if(t.status!=="success")return t;if(o.status!=="success")return o;const f=t.data[n];if(f.type==="record"&&f.router){if(o.data===null)return{status:"success",data:null};const h=Object.keys(o.data),p=Y.splitModulePath(r)[0];for(const m of h)if(p&&p.startsWith(m))return{status:"success",data:{previewRoute:m}}}return{status:"success",data:null}},["data"in t&&t.data,n,r,o]),{navMenu:s,toolsMenu:a}=Jy(),l=qu(),{setAutoPublish:c,autoPublish:u}=IS();return d.jsx("div",{className:"flex flex-col",children:d.jsxs("div",{className:"flex gap-2 justify-between items-center p-4 w-full",children:[d.jsx("button",{className:"lg:hidden",onClick:()=>{a.setOpen(!a.isOpen)},children:d.jsx(Ag,{size:16,className:Ce("transform",{"rotate-180":!s.isOpen})})}),d.jsxs("div",{className:"flex gap-2 justify-end items-center w-full",children:[l==="fs"&&d.jsxs("div",{className:"overflow-hidden flex items-center gap-2 text-[10px] lg:text-xs",children:[d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx("span",{className:"truncate text-fg-secondary",children:"Auto-save"})}),d.jsxs(fr,{children:[d.jsx("p",{children:"When auto-save is enabled Val will save to changes to disk automatically"}),d.jsx("p",{children:"This is a development mode feature"})]})]}),d.jsx(Qu,{checked:u,onCheckedChange:c})]}),d.jsx(qq,{maybePreviewRoute:i}),d.jsx(Xb,{})]})]})})}function qq({maybePreviewRoute:e}){var n,r;const t=g.useMemo(()=>{var o;return e.status==="success"&&((o=e.data)!=null&&o.previewRoute)?gu("/api/val/enable",{redirect_to:window.origin+e.data.previewRoute}):gu("/api/val/enable",{redirect_to:window.origin})},[e]);return d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(qe,{className:"flex gap-2 items-center",variant:"secondary",asChild:!0,children:d.jsxs("a",{href:t,children:[d.jsx("span",{children:"Preview"}),e.status==="success"&&((n=e.data)!=null&&n.previewRoute)?d.jsx(Rg,{size:16}):d.jsx(Ig,{size:16})]})})}),d.jsx(fr,{children:e.status==="success"&&((r=e.data)!=null&&r.previewRoute)?d.jsxs("p",{children:["Preview your changes in ",e.data.previewRoute]}):d.jsx("p",{children:"Preview your changes on the main page"})})]})}function Xt({error:e,path:t}){return d.jsx("div",{id:t,children:d.jsx("div",{className:"p-4 bg-bg-error-primary text-fg-error-primary",children:e})})}function yt({path:e,type:t}){return d.jsx("div",{id:e,className:Ce("pt-6",{"w-full flex items-center justify-center":t==="module","text-left":t!=="module"}),children:d.jsx(Gr,{size:t==="module"?24:16,className:"animate-spin"})})}function Mn({path:e,type:t}){const[n,r]=g.useState(!1);return g.useEffect(()=>{const o=setTimeout(()=>{r(!0)},2e3);return()=>{clearTimeout(o)}},[]),e.length===0?null:n?d.jsx("div",{className:"pt-6",id:e,children:d.jsx("div",{children:"Could not get data"})}):d.jsx(yt,{path:e,type:t})}function kr({actualType:e,expectedType:t,path:n}){return d.jsx("div",{id:n,children:d.jsxs("div",{children:["Schema mismatch: actual: ",e," vs expected: ",t," "]})})}function it({error:e,path:t,schema:n}){const{addPatch:r,patchPath:o}=bn(t);return d.jsxs("div",{id:t,className:"flex justify-between items-center px-2 py-3 rounded-lg bg-bg-error-primary text-fg-primary",children:[d.jsxs("div",{children:["Source error: ",e]}),d.jsxs("div",{className:"flex gap-2 items-center",children:[n&&n.status==="success"&&!(n.data.type==="file"||n.data.type==="image")&&d.jsx(qe,{variant:"outline",className:"hover:bg-bg-error-secondary-hover",onClick:()=>{r([{op:"replace",path:o,value:Il(n.data)}],n.data.type)},children:"Fix"}),d.jsx(Su,{size:16})]})]})}function Yq(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const vy=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ed(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function ck(e){return"nodeType"in e}function Er(e){var t,n;return e?ed(e)?e:ck(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function uk(e){const{Document:t}=Er(e);return e instanceof t}function fp(e){return ed(e)?!1:e instanceof Er(e).HTMLElement}function NA(e){return e instanceof Er(e).SVGElement}function td(e){return e?ed(e)?e.document:ck(e)?uk(e)?e:fp(e)||NA(e)?e.ownerDocument:document:document:document}const ki=vy?g.useLayoutEffect:g.useEffect;function dk(e){const t=g.useRef(e);return ki(()=>{t.current=e}),g.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function Jq(){const e=g.useRef(null),t=g.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=g.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function gh(e,t){t===void 0&&(t=[e]);const n=g.useRef(e);return ki(()=>{n.current!==e&&(n.current=e)},t),n}function hp(e,t){const n=g.useRef();return g.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Bg(e){const t=dk(e),n=g.useRef(null),r=g.useCallback(o=>{o!==n.current&&(t==null||t(o,n.current)),n.current=o},[]);return[n,r]}function Zb(e){const t=g.useRef();return g.useEffect(()=>{t.current=e},[e]),t.current}let n0={};function pp(e,t){return g.useMemo(()=>{if(t)return t;const n=n0[e]==null?0:n0[e]+1;return n0[e]=n,e+"-"+n},[e,t])}function PA(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,s)=>{const a=Object.entries(s);for(const[l,c]of a){const u=i[l];u!=null&&(i[l]=u+e*c)}return i},{...t})}}const Xc=PA(1),vh=PA(-1);function Xq(e){return"clientX"in e&&"clientY"in e}function fk(e){if(!e)return!1;const{KeyboardEvent:t}=Er(e.target);return t&&e instanceof t}function Zq(e){if(!e)return!1;const{TouchEvent:t}=Er(e.target);return t&&e instanceof t}function Qb(e){if(Zq(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Xq(e)?{x:e.clientX,y:e.clientY}:null}const yh=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[yh.Translate.toString(e),yh.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),YN="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Qq(e){return e.matches(YN)?e:e.querySelector(YN)}const eY={display:"none"};function tY(e){let{id:t,value:n}=e;return Ee.createElement("div",{id:t,style:eY},n)}function nY(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Ee.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function rY(){const[e,t]=g.useState("");return{announce:g.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const _A=g.createContext(null);function oY(e){const t=g.useContext(_A);g.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function iY(){const[e]=g.useState(()=>new Set),t=g.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[g.useCallback(r=>{let{type:o,event:i}=r;e.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[e]),t]}const sY={draggable:`
|
|
461
|
-
To pick up a draggable item, press the space bar.
|
|
462
|
-
While dragging, use the arrow keys to move the item.
|
|
463
|
-
Press space again to drop the item in its new position, or press escape to cancel.
|
|
464
|
-
`},aY={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function lY(e){let{announcements:t=aY,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=sY}=e;const{announce:i,announcement:s}=rY(),a=pp("DndLiveRegion"),[l,c]=g.useState(!1);if(g.useEffect(()=>{c(!0)},[]),oY(g.useMemo(()=>({onDragStart(f){let{active:h}=f;i(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:p}=f;t.onDragMove&&i(t.onDragMove({active:h,over:p}))},onDragOver(f){let{active:h,over:p}=f;i(t.onDragOver({active:h,over:p}))},onDragEnd(f){let{active:h,over:p}=f;i(t.onDragEnd({active:h,over:p}))},onDragCancel(f){let{active:h,over:p}=f;i(t.onDragCancel({active:h,over:p}))}}),[i,t])),!l)return null;const u=Ee.createElement(Ee.Fragment,null,Ee.createElement(tY,{id:r,value:o.draggable}),Ee.createElement(nY,{id:a,announcement:s}));return n?Fr.createPortal(u,n):u}var tn;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(tn||(tn={}));function Vg(){}function r0(e,t){return g.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function cY(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const ti=Object.freeze({x:0,y:0});function jA(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function TA(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function uY(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function JN(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function OA(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function XN(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const dY=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=XN(t,t.left,t.top),i=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=jA(XN(l),o);i.push({id:a,data:{droppableContainer:s,value:c}})}}return i.sort(TA)},fY=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=JN(t),i=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=JN(l),u=o.reduce((h,p,m)=>h+jA(c[m],p),0),f=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:s,value:f}})}}return i.sort(TA)};function hY(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),s=o-r,a=i-n;if(r<o&&n<i){const l=t.width*t.height,c=e.width*e.height,u=s*a,f=u/(l+c-u);return Number(f.toFixed(4))}return 0}const pY=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:s}=i,a=n.get(s);if(a){const l=hY(a,t);l>0&&o.push({id:s,data:{droppableContainer:i,value:l}})}}return o.sort(uY)};function mY(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function MA(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ti}function gY(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((s,a)=>({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const vY=gY(1);function yY(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function xY(e,t,n){const r=yY(t);if(!r)return e;const{scaleX:o,scaleY:i,x:s,y:a}=r,l=e.left-s-(1-o)*parseFloat(n),c=e.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),u=o?e.width/o:e.width,f=i?e.height/i:e.height;return{width:u,height:f,top:c,right:l+u,bottom:c+f,left:l}}const bY={ignoreTransform:!1};function nd(e,t){t===void 0&&(t=bY);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=Er(e).getComputedStyle(e);c&&(n=xY(n,c,u))}const{top:r,left:o,width:i,height:s,bottom:a,right:l}=n;return{top:r,left:o,width:i,height:s,bottom:a,right:l}}function ZN(e){return nd(e,{ignoreTransform:!0})}function wY(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function SY(e,t){return t===void 0&&(t=Er(e).getComputedStyle(e)),t.position==="fixed"}function kY(e,t){t===void 0&&(t=Er(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function yy(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(uk(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!fp(o)||NA(o)||n.includes(o))return n;const i=Er(e).getComputedStyle(o);return o!==e&&kY(o,i)&&n.push(o),SY(o,i)?n:r(o.parentNode)}return e?r(e):n}function RA(e){const[t]=yy(e,1);return t??null}function o0(e){return!vy||!e?null:ed(e)?e:ck(e)?uk(e)||e===td(e).scrollingElement?window:fp(e)?e:null:null}function AA(e){return ed(e)?e.scrollX:e.scrollLeft}function IA(e){return ed(e)?e.scrollY:e.scrollTop}function ew(e){return{x:AA(e),y:IA(e)}}var fn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(fn||(fn={}));function DA(e){return!vy||!e?!1:e===document.scrollingElement}function LA(e){const t={x:0,y:0},n=DA(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const EY={x:.2,y:.2};function CY(e,t,n,r,o){let{top:i,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=EY);const{isTop:c,isBottom:u,isLeft:f,isRight:h}=LA(e),p={x:0,y:0},m={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!c&&i<=t.top+v.height?(p.y=fn.Backward,m.y=r*Math.abs((t.top+v.height-i)/v.height)):!u&&l>=t.bottom-v.height&&(p.y=fn.Forward,m.y=r*Math.abs((t.bottom-v.height-l)/v.height)),!h&&a>=t.right-v.width?(p.x=fn.Forward,m.x=r*Math.abs((t.right-v.width-a)/v.width)):!f&&s<=t.left+v.width&&(p.x=fn.Backward,m.x=r*Math.abs((t.left+v.width-s)/v.width)),{direction:p,speed:m}}function NY(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:s}=window;return{top:0,left:0,right:i,bottom:s,width:i,height:s}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function FA(e){return e.reduce((t,n)=>Xc(t,ew(n)),ti)}function PY(e){return e.reduce((t,n)=>t+AA(n),0)}function _Y(e){return e.reduce((t,n)=>t+IA(n),0)}function jY(e,t){if(t===void 0&&(t=nd),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);RA(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const TY=[["x",["left","right"],PY],["y",["top","bottom"],_Y]];class hk{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=yy(n),o=FA(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,s,a]of TY)for(const l of s)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=o[i]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Sf{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function OY(e){const{EventTarget:t}=Er(e);return e instanceof t?e:td(e)}function i0(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var io;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(io||(io={}));function QN(e){e.preventDefault()}function MY(e){e.stopPropagation()}var et;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(et||(et={}));const zA={start:[et.Space,et.Enter],cancel:[et.Esc],end:[et.Space,et.Enter,et.Tab]},RY=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case et.Right:return{...n,x:n.x+25};case et.Left:return{...n,x:n.x-25};case et.Down:return{...n,y:n.y+25};case et.Up:return{...n,y:n.y-25}}};class pk{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Sf(td(n)),this.windowListeners=new Sf(Er(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(io.Resize,this.handleCancel),this.windowListeners.add(io.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(io.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&jY(r),n(ti)}handleKeyDown(t){if(fk(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=zA,coordinateGetter:s=RY,scrollBehavior:a="smooth"}=o,{code:l}=t;if(i.end.includes(l)){this.handleEnd(t);return}if(i.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:ti;this.referenceCoordinates||(this.referenceCoordinates=u);const f=s(t,{active:n,context:r.current,currentCoordinates:u});if(f){const h=vh(f,u),p={x:0,y:0},{scrollableAncestors:m}=r.current;for(const v of m){const x=t.code,{isTop:b,isRight:w,isLeft:S,isBottom:C,maxScroll:N,minScroll:P}=LA(v),_=NY(v),O={x:Math.min(x===et.Right?_.right-_.width/2:_.right,Math.max(x===et.Right?_.left:_.left+_.width/2,f.x)),y:Math.min(x===et.Down?_.bottom-_.height/2:_.bottom,Math.max(x===et.Down?_.top:_.top+_.height/2,f.y))},M=x===et.Right&&!w||x===et.Left&&!S,D=x===et.Down&&!C||x===et.Up&&!b;if(M&&O.x!==f.x){const U=v.scrollLeft+h.x,z=x===et.Right&&U<=N.x||x===et.Left&&U>=P.x;if(z&&!h.y){v.scrollTo({left:U,behavior:a});return}z?p.x=v.scrollLeft-U:p.x=x===et.Right?v.scrollLeft-N.x:v.scrollLeft-P.x,p.x&&v.scrollBy({left:-p.x,behavior:a});break}else if(D&&O.y!==f.y){const U=v.scrollTop+h.y,z=x===et.Down&&U<=N.y||x===et.Up&&U>=P.y;if(z&&!h.x){v.scrollTo({top:U,behavior:a});return}z?p.y=v.scrollTop-U:p.y=x===et.Down?v.scrollTop-N.y:v.scrollTop-P.y,p.y&&v.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(t,Xc(vh(f,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}pk.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=zA,onActivation:o}=t,{active:i}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function eP(e){return!!(e&&"distance"in e)}function tP(e){return!!(e&&"delay"in e)}class mk{constructor(t,n,r){var o;r===void 0&&(r=OY(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:s}=i;this.props=t,this.events=n,this.document=td(s),this.documentListeners=new Sf(this.document),this.listeners=new Sf(r),this.windowListeners=new Sf(Er(s)),this.initialCoordinates=(o=Qb(i))!=null?o:ti,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(io.Resize,this.handleCancel),this.windowListeners.add(io.DragStart,QN),this.windowListeners.add(io.VisibilityChange,this.handleCancel),this.windowListeners.add(io.ContextMenu,QN),this.documentListeners.add(io.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(tP(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(eP(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(io.Click,MY,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(io.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:s,options:{activationConstraint:a}}=i;if(!o)return;const l=(n=Qb(t))!=null?n:ti,c=vh(o,l);if(!r&&a){if(eP(a)){if(a.tolerance!=null&&i0(c,a.tolerance))return this.handleCancel();if(i0(c,a.distance))return this.handleStart()}if(tP(a)&&i0(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===et.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const AY={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class $A extends mk{constructor(t){const{event:n}=t,r=td(n.target);super(t,AY,r)}}$A.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const IY={move:{name:"mousemove"},end:{name:"mouseup"}};var tw;(function(e){e[e.RightClick=2]="RightClick"})(tw||(tw={}));class BA extends mk{constructor(t){super(t,IY,td(t.event.target))}}BA.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===tw.RightClick?!1:(r==null||r({event:n}),!0)}}];const s0={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class VA extends mk{constructor(t){super(t,s0)}static setup(){return window.addEventListener(s0.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(s0.move.name,t)};function t(){}}}VA.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r==null||r({event:n}),!0)}}];var kf;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(kf||(kf={}));var Ug;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ug||(Ug={}));function DY(e){let{acceleration:t,activator:n=kf.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:s=5,order:a=Ug.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:f,threshold:h}=e;const p=FY({delta:f,disabled:!i}),[m,v]=Jq(),x=g.useRef({x:0,y:0}),b=g.useRef({x:0,y:0}),w=g.useMemo(()=>{switch(n){case kf.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case kf.DraggableRect:return o}},[n,o,l]),S=g.useRef(null),C=g.useCallback(()=>{const P=S.current;if(!P)return;const _=x.current.x*b.current.x,O=x.current.y*b.current.y;P.scrollBy(_,O)},[]),N=g.useMemo(()=>a===Ug.TreeOrder?[...c].reverse():c,[a,c]);g.useEffect(()=>{if(!i||!c.length||!w){v();return}for(const P of N){if((r==null?void 0:r(P))===!1)continue;const _=c.indexOf(P),O=u[_];if(!O)continue;const{direction:M,speed:D}=CY(P,O,w,t,h);for(const U of["x","y"])p[U][M[U]]||(D[U]=0,M[U]=0);if(D.x>0||D.y>0){v(),S.current=P,m(C,s),x.current=D,b.current=M;return}}x.current={x:0,y:0},b.current={x:0,y:0},v()},[t,C,r,v,i,s,JSON.stringify(w),JSON.stringify(p),m,c,N,u,JSON.stringify(h)])}const LY={x:{[fn.Backward]:!1,[fn.Forward]:!1},y:{[fn.Backward]:!1,[fn.Forward]:!1}};function FY(e){let{delta:t,disabled:n}=e;const r=Zb(t);return hp(o=>{if(n||!r||!o)return LY;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[fn.Backward]:o.x[fn.Backward]||i.x===-1,[fn.Forward]:o.x[fn.Forward]||i.x===1},y:{[fn.Backward]:o.y[fn.Backward]||i.y===-1,[fn.Forward]:o.y[fn.Forward]||i.y===1}}},[n,t,r])}function zY(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return hp(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function $Y(e,t){return g.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...i]},[]),[e,t])}var xh;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(xh||(xh={}));var nw;(function(e){e.Optimized="optimized"})(nw||(nw={}));const nP=new Map;function BY(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,s]=g.useState(null),{frequency:a,measure:l,strategy:c}=o,u=g.useRef(e),f=x(),h=gh(f),p=g.useCallback(function(b){b===void 0&&(b=[]),!h.current&&s(w=>w===null?b:w.concat(b.filter(S=>!w.includes(S))))},[h]),m=g.useRef(null),v=hp(b=>{if(f&&!n)return nP;if(!b||b===nP||u.current!==e||i!=null){const w=new Map;for(let S of e){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){w.set(S.id,S.rect.current);continue}const C=S.node.current,N=C?new hk(l(C),C):null;S.rect.current=N,N&&w.set(S.id,N)}return w}return b},[e,i,n,f,l]);return g.useEffect(()=>{u.current=e},[e]),g.useEffect(()=>{f||p()},[n,f]),g.useEffect(()=>{i&&i.length>0&&s(null)},[JSON.stringify(i)]),g.useEffect(()=>{f||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},a))},[a,f,p,...r]),{droppableRects:v,measureDroppableContainers:p,measuringScheduled:i!=null};function x(){switch(c){case xh.Always:return!1;case xh.BeforeDragging:return n;default:return!n}}}function UA(e,t){return hp(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function VY(e,t){return UA(e,t)}function UY(e){let{callback:t,disabled:n}=e;const r=dk(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return g.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function xy(e){let{callback:t,disabled:n}=e;const r=dk(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return g.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function WY(e){return new hk(nd(e),e)}function rP(e,t,n){t===void 0&&(t=WY);const[r,o]=g.useState(null);function i(){o(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=t(e);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const s=UY({callback(l){if(e)for(const c of l){const{type:u,target:f}=c;if(u==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),a=xy({callback:i});return ki(()=>{i(),e?(a==null||a.observe(e),s==null||s.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),s==null||s.disconnect())},[e]),r}function HY(e){const t=UA(e);return MA(e,t)}const oP=[];function KY(e){const t=g.useRef(e),n=hp(r=>e?r&&r!==oP&&e&&t.current&&e.parentNode===t.current.parentNode?r:yy(e):oP,[e]);return g.useEffect(()=>{t.current=e},[e]),n}function GY(e){const[t,n]=g.useState(null),r=g.useRef(e),o=g.useCallback(i=>{const s=o0(i.target);s&&n(a=>a?(a.set(s,ew(s)),new Map(a)):null)},[]);return g.useEffect(()=>{const i=r.current;if(e!==i){s(i);const a=e.map(l=>{const c=o0(l);return c?(c.addEventListener("scroll",o,{passive:!0}),[c,ew(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(i)};function s(a){a.forEach(l=>{const c=o0(l);c==null||c.removeEventListener("scroll",o)})}},[o,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,s)=>Xc(i,s),ti):FA(e):ti,[e,t])}function iP(e,t){t===void 0&&(t=[]);const n=g.useRef(null);return g.useEffect(()=>{n.current=null},t),g.useEffect(()=>{const r=e!==ti;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?vh(e,n.current):ti}function qY(e){g.useEffect(()=>{if(!vy)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function YY(e,t){return g.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=s=>{i(s,t)},n},{}),[e,t])}function WA(e){return g.useMemo(()=>e?wY(e):null,[e])}const sP=[];function JY(e,t){t===void 0&&(t=nd);const[n]=e,r=WA(n?Er(n):null),[o,i]=g.useState(sP);function s(){i(()=>e.length?e.map(l=>DA(l)?r:new hk(t(l),l)):sP)}const a=xy({callback:s});return ki(()=>{a==null||a.disconnect(),s(),e.forEach(l=>a==null?void 0:a.observe(l))},[e]),o}function XY(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return fp(t)?t:e}function ZY(e){let{measure:t}=e;const[n,r]=g.useState(null),o=g.useCallback(c=>{for(const{target:u}of c)if(fp(u)){r(f=>{const h=t(u);return f?{...f,width:h.width,height:h.height}:h});break}},[t]),i=xy({callback:o}),s=g.useCallback(c=>{const u=XY(c);i==null||i.disconnect(),u&&(i==null||i.observe(u)),r(u?t(u):null)},[t,i]),[a,l]=Bg(s);return g.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const QY=[{sensor:$A,options:{}},{sensor:pk,options:{}}],eJ={current:{}},Tm={draggable:{measure:ZN},droppable:{measure:ZN,strategy:xh.WhileDragging,frequency:nw.Optimized},dragOverlay:{measure:nd}};class Ef extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const tJ={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ef,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Vg},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Tm,measureDroppableContainers:Vg,windowRect:null,measuringScheduled:!1},nJ={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Vg,draggableNodes:new Map,over:null,measureDroppableContainers:Vg},by=g.createContext(nJ),HA=g.createContext(tJ);function rJ(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ef}}}function oJ(e,t){switch(t.type){case tn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case tn.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case tn.DragEnd:case tn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case tn.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Ef(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case tn.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const s=new Ef(e.droppable.containers);return s.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case tn.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Ef(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function iJ(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=g.useContext(by),i=Zb(r),s=Zb(n==null?void 0:n.id);return g.useEffect(()=>{if(!t&&!r&&i&&s!=null){if(!fk(i)||document.activeElement===i.target)return;const a=o.get(s);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const f=Qq(u);if(f){f.focus();break}}})}},[r,t,o,s,i]),null}function sJ(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function aJ(e){return g.useMemo(()=>({draggable:{...Tm.draggable,...e==null?void 0:e.draggable},droppable:{...Tm.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Tm.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function lJ(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=g.useRef(!1),{x:s,y:a}=typeof o=="boolean"?{x:o,y:o}:o;ki(()=>{if(!s&&!a||!t){i.current=!1;return}if(i.current||!r)return;const c=t==null?void 0:t.node.current;if(!c||c.isConnected===!1)return;const u=n(c),f=MA(u,r);if(s||(f.x=0),a||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=RA(c);h&&h.scrollBy({top:f.y,left:f.x})}},[t,s,a,r,n])}const KA=g.createContext({...ti,scaleX:1,scaleY:1});var $s;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})($s||($s={}));const cJ=g.memo(function(t){var n,r,o,i;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:u=QY,collisionDetection:f=pY,measuring:h,modifiers:p,...m}=t;const v=g.useReducer(oJ,void 0,rJ),[x,b]=v,[w,S]=iY(),[C,N]=g.useState($s.Uninitialized),P=C===$s.Initialized,{draggable:{active:_,nodes:O,translate:M},droppable:{containers:D}}=x,U=_!=null?O.get(_):null,z=g.useRef({initial:null,translated:null}),H=g.useMemo(()=>{var Dn;return _!=null?{id:_,data:(Dn=U==null?void 0:U.data)!=null?Dn:eJ,rect:z}:null},[_,U]),K=g.useRef(null),[V,I]=g.useState(null),[A,j]=g.useState(null),L=gh(m,Object.values(m)),$=pp("DndDescribedBy",s),W=g.useMemo(()=>D.getEnabled(),[D]),G=aJ(h),{droppableRects:_e,measureDroppableContainers:ke,measuringScheduled:Ve}=BY(W,{dragging:P,dependencies:[M.x,M.y],config:G.droppable}),Z=zY(O,_),J=g.useMemo(()=>A?Qb(A):null,[A]),ce=TF(),Ne=VY(Z,G.draggable.measure);lJ({activeNode:_!=null?O.get(_):null,config:ce.layoutShiftCompensation,initialRect:Ne,measure:G.draggable.measure});const he=rP(Z,G.draggable.measure,Ne),Le=rP(Z?Z.parentElement:null),Pe=g.useRef({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:_e,draggableNodes:O,draggingNode:null,draggingNodeRect:null,droppableContainers:D,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Xe=D.getNodeFor((n=Pe.current.over)==null?void 0:n.id),gt=ZY({measure:G.dragOverlay.measure}),Kt=(r=gt.nodeRef.current)!=null?r:Z,T=P?(o=gt.rect)!=null?o:he:null,k=!!(gt.nodeRef.current&>.rect),E=HY(k?null:he),R=WA(Kt?Er(Kt):null),F=KY(P?Xe??Z:null),X=JY(F),ee=sJ(p,{transform:{x:M.x-E.x,y:M.y-E.y,scaleX:1,scaleY:1},activatorEvent:A,active:H,activeNodeRect:he,containerNodeRect:Le,draggingNodeRect:T,over:Pe.current.over,overlayNodeRect:gt.rect,scrollableAncestors:F,scrollableAncestorRects:X,windowRect:R}),Ze=J?Xc(J,M):null,ct=GY(F),wt=iP(ct),cn=iP(ct,[he]),dt=Xc(ee,wt),Po=T?vY(T,ee):null,ys=H&&Po?f({active:H,collisionRect:Po,droppableRects:_e,droppableContainers:W,pointerCoordinates:Ze}):null,cd=OA(ys,"id"),[xs,_E]=g.useState(null),CF=k?ee:Xc(ee,cn),NF=mY(CF,(i=xs==null?void 0:xs.rect)!=null?i:null,he),Zy=g.useRef(null),jE=g.useCallback((Dn,Nr)=>{let{sensor:Pr,options:bs}=Nr;if(K.current==null)return;const no=O.get(K.current);if(!no)return;const _r=Dn.nativeEvent,si=new Pr({active:K.current,activeNode:no,event:_r,options:bs,context:Pe,onAbort(wn){if(!O.get(wn))return;const{onDragAbort:ai}=L.current,Oi={id:wn};ai==null||ai(Oi),w({type:"onDragAbort",event:Oi})},onPending(wn,ws,ai,Oi){if(!O.get(wn))return;const{onDragPending:dd}=L.current,Ss={id:wn,constraint:ws,initialCoordinates:ai,offset:Oi};dd==null||dd(Ss),w({type:"onDragPending",event:Ss})},onStart(wn){const ws=K.current;if(ws==null)return;const ai=O.get(ws);if(!ai)return;const{onDragStart:Oi}=L.current,ud={activatorEvent:_r,active:{id:ws,data:ai.data,rect:z}};Fr.unstable_batchedUpdates(()=>{Oi==null||Oi(ud),N($s.Initializing),b({type:tn.DragStart,initialCoordinates:wn,active:ws}),w({type:"onDragStart",event:ud}),I(Zy.current),j(_r)})},onMove(wn){b({type:tn.DragMove,coordinates:wn})},onEnd:ic(tn.DragEnd),onCancel:ic(tn.DragCancel)});Zy.current=si;function ic(wn){return async function(){const{active:ai,collisions:Oi,over:ud,scrollAdjustedTranslate:dd}=Pe.current;let Ss=null;if(ai&&dd){const{cancelDrop:fd}=L.current;Ss={activatorEvent:_r,active:ai,collisions:Oi,delta:dd,over:ud},wn===tn.DragEnd&&typeof fd=="function"&&await Promise.resolve(fd(Ss))&&(wn=tn.DragCancel)}K.current=null,Fr.unstable_batchedUpdates(()=>{b({type:wn}),N($s.Uninitialized),_E(null),I(null),j(null),Zy.current=null;const fd=wn===tn.DragEnd?"onDragEnd":"onDragCancel";if(Ss){const Qy=L.current[fd];Qy==null||Qy(Ss),w({type:fd,event:Ss})}})}}},[O]),PF=g.useCallback((Dn,Nr)=>(Pr,bs)=>{const no=Pr.nativeEvent,_r=O.get(bs);if(K.current!==null||!_r||no.dndKit||no.defaultPrevented)return;const si={active:_r};Dn(Pr,Nr.options,si)===!0&&(no.dndKit={capturedBy:Nr.sensor},K.current=bs,jE(Pr,Nr))},[O,jE]),TE=$Y(u,PF);qY(u),ki(()=>{he&&C===$s.Initializing&&N($s.Initialized)},[he,C]),g.useEffect(()=>{const{onDragMove:Dn}=L.current,{active:Nr,activatorEvent:Pr,collisions:bs,over:no}=Pe.current;if(!Nr||!Pr)return;const _r={active:Nr,activatorEvent:Pr,collisions:bs,delta:{x:dt.x,y:dt.y},over:no};Fr.unstable_batchedUpdates(()=>{Dn==null||Dn(_r),w({type:"onDragMove",event:_r})})},[dt.x,dt.y]),g.useEffect(()=>{const{active:Dn,activatorEvent:Nr,collisions:Pr,droppableContainers:bs,scrollAdjustedTranslate:no}=Pe.current;if(!Dn||K.current==null||!Nr||!no)return;const{onDragOver:_r}=L.current,si=bs.get(cd),ic=si&&si.rect.current?{id:si.id,rect:si.rect.current,data:si.data,disabled:si.disabled}:null,wn={active:Dn,activatorEvent:Nr,collisions:Pr,delta:{x:no.x,y:no.y},over:ic};Fr.unstable_batchedUpdates(()=>{_E(ic),_r==null||_r(wn),w({type:"onDragOver",event:wn})})},[cd]),ki(()=>{Pe.current={activatorEvent:A,active:H,activeNode:Z,collisionRect:Po,collisions:ys,droppableRects:_e,draggableNodes:O,draggingNode:Kt,draggingNodeRect:T,droppableContainers:D,over:xs,scrollableAncestors:F,scrollAdjustedTranslate:dt},z.current={initial:T,translated:Po}},[H,Z,ys,Po,O,Kt,T,_e,D,xs,F,dt]),DY({...ce,delta:M,draggingRect:Po,pointerCoordinates:Ze,scrollableAncestors:F,scrollableAncestorRects:X});const _F=g.useMemo(()=>({active:H,activeNode:Z,activeNodeRect:he,activatorEvent:A,collisions:ys,containerNodeRect:Le,dragOverlay:gt,draggableNodes:O,droppableContainers:D,droppableRects:_e,over:xs,measureDroppableContainers:ke,scrollableAncestors:F,scrollableAncestorRects:X,measuringConfiguration:G,measuringScheduled:Ve,windowRect:R}),[H,Z,he,A,ys,Le,gt,O,D,_e,xs,ke,F,X,G,Ve,R]),jF=g.useMemo(()=>({activatorEvent:A,activators:TE,active:H,activeNodeRect:he,ariaDescribedById:{draggable:$},dispatch:b,draggableNodes:O,over:xs,measureDroppableContainers:ke}),[A,TE,H,he,b,$,O,xs,ke]);return Ee.createElement(_A.Provider,{value:S},Ee.createElement(by.Provider,{value:jF},Ee.createElement(HA.Provider,{value:_F},Ee.createElement(KA.Provider,{value:NF},c)),Ee.createElement(iJ,{disabled:(a==null?void 0:a.restoreFocus)===!1})),Ee.createElement(lY,{...a,hiddenTextDescribedById:$}));function TF(){const Dn=(V==null?void 0:V.autoScrollEnabled)===!1,Nr=typeof l=="object"?l.enabled===!1:l===!1,Pr=P&&!Dn&&!Nr;return typeof l=="object"?{...l,enabled:Pr}:{enabled:Pr}}}),uJ=g.createContext(null),aP="button",dJ="Draggable";function fJ(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=pp(dJ),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:f,over:h}=g.useContext(by),{role:p=aP,roleDescription:m="draggable",tabIndex:v=0}=o??{},x=(l==null?void 0:l.id)===t,b=g.useContext(x?KA:uJ),[w,S]=Bg(),[C,N]=Bg(),P=YY(s,t),_=gh(n);ki(()=>(f.set(t,{id:t,key:i,node:w,activatorNode:C,data:_}),()=>{const M=f.get(t);M&&M.key===i&&f.delete(t)}),[f,t]);const O=g.useMemo(()=>({role:p,tabIndex:v,"aria-disabled":r,"aria-pressed":x&&p===aP?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,v,x,m,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:O,isDragging:x,listeners:r?void 0:P,node:w,over:h,setNodeRef:S,setActivatorNodeRef:N,transform:b}}function hJ(){return g.useContext(HA)}const pJ="Droppable",mJ={timeout:25};function gJ(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=pp(pJ),{active:s,dispatch:a,over:l,measureDroppableContainers:c}=g.useContext(by),u=g.useRef({disabled:n}),f=g.useRef(!1),h=g.useRef(null),p=g.useRef(null),{disabled:m,updateMeasurementsFor:v,timeout:x}={...mJ,...o},b=gh(v??r),w=g.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(b.current)?b.current:[b.current]),p.current=null},x)},[x]),S=xy({callback:w,disabled:m||!s}),C=g.useCallback((O,M)=>{S&&(M&&(S.unobserve(M),f.current=!1),O&&S.observe(O))},[S]),[N,P]=Bg(C),_=gh(t);return g.useEffect(()=>{!S||!N.current||(S.disconnect(),f.current=!1,S.observe(N.current))},[N,S]),g.useEffect(()=>(a({type:tn.RegisterDroppable,element:{id:r,key:i,disabled:n,node:N,rect:h,data:_}}),()=>a({type:tn.UnregisterDroppable,key:i,id:r})),[r]),g.useEffect(()=>{n!==u.current.disabled&&(a({type:tn.SetDroppableDisabled,id:r,key:i,disabled:n}),u.current.disabled=n)},[r,i,n,a]),{active:s,rect:h,isOver:(l==null?void 0:l.id)===r,node:N,over:l,setNodeRef:P}}function gk(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function vJ(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function im(e){return e!==null&&e>=0}function yJ(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function xJ(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const GA=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=gk(t,r,n),s=t[o],a=i[o];return!a||!s?null:{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}},sm={scaleX:1,scaleY:1},bJ=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:s}=e;const a=(t=i[n])!=null?t:r;if(!a)return null;if(o===n){const c=i[s];return c?{x:0,y:n<s?c.top+c.height-(a.top+a.height):c.top-a.top,...sm}:null}const l=wJ(i,o,n);return o>n&&o<=s?{x:0,y:-a.height-l,...sm}:o<n&&o>=s?{x:0,y:a.height+l,...sm}:{x:0,y:0,...sm}};function wJ(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?n<t?o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const qA="Sortable",YA=Ee.createContext({activeIndex:-1,containerId:qA,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:GA,disabled:{draggable:!1,droppable:!1}});function SJ(e){let{children:t,id:n,items:r,strategy:o=GA,disabled:i=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=hJ(),f=pp(qA,n),h=a.rect!==null,p=g.useMemo(()=>r.map(P=>typeof P=="object"&&"id"in P?P.id:P),[r]),m=s!=null,v=s?p.indexOf(s.id):-1,x=c?p.indexOf(c.id):-1,b=g.useRef(p),w=!yJ(p,b.current),S=x!==-1&&v===-1||w,C=xJ(i);ki(()=>{w&&m&&u(p)},[w,p,m,u]),g.useEffect(()=>{b.current=p},[p]);const N=g.useMemo(()=>({activeIndex:v,containerId:f,disabled:C,disableTransforms:S,items:p,overIndex:x,useDragOverlay:h,sortedRects:vJ(p,l),strategy:o}),[v,f,C.draggable,C.droppable,S,p,x,l,h,o]);return Ee.createElement(YA.Provider,{value:N},t)}const kJ=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return gk(n,r,o).indexOf(t)},EJ=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:s,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==i&&o===s?!1:n?!0:s!==o&&t===l},CJ={duration:200,easing:"ease"},JA="transform",NJ=yh.Transition.toString({property:JA,duration:0,easing:"linear"}),PJ={roleDescription:"sortable"};function _J(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,s]=g.useState(null),a=g.useRef(n);return ki(()=>{if(!t&&n!==a.current&&r.current){const l=o.current;if(l){const c=nd(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&s(u)}}n!==a.current&&(a.current=n)},[t,n,r,o]),g.useEffect(()=>{i&&s(null)},[i]),i}function jJ(e){let{animateLayoutChanges:t=EJ,attributes:n,disabled:r,data:o,getNewIndex:i=kJ,id:s,strategy:a,resizeObserverConfig:l,transition:c=CJ}=e;const{items:u,containerId:f,activeIndex:h,disabled:p,disableTransforms:m,sortedRects:v,overIndex:x,useDragOverlay:b,strategy:w}=g.useContext(YA),S=TJ(r,p),C=u.indexOf(s),N=g.useMemo(()=>({sortable:{containerId:f,index:C,items:u},...o}),[f,o,C,u]),P=g.useMemo(()=>u.slice(u.indexOf(s)),[u,s]),{rect:_,node:O,isOver:M,setNodeRef:D}=gJ({id:s,data:N,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:P,...l}}),{active:U,activatorEvent:z,activeNodeRect:H,attributes:K,setNodeRef:V,listeners:I,isDragging:A,over:j,setActivatorNodeRef:L,transform:$}=fJ({id:s,data:N,attributes:{...PJ,...n},disabled:S.draggable}),W=Yq(D,V),G=!!U,_e=G&&!m&&im(h)&&im(x),ke=!b&&A,Ve=ke&&_e?$:null,J=_e?Ve??(a??w)({rects:v,activeNodeRect:H,activeIndex:h,overIndex:x,index:C}):null,ce=im(h)&&im(x)?i({id:s,items:u,activeIndex:h,overIndex:x}):C,Ne=U==null?void 0:U.id,he=g.useRef({activeId:Ne,items:u,newIndex:ce,containerId:f}),Le=u!==he.current.items,Pe=t({active:U,containerId:f,isDragging:A,isSorting:G,id:s,index:C,items:u,newIndex:he.current.newIndex,previousItems:he.current.items,previousContainerId:he.current.containerId,transition:c,wasDragging:he.current.activeId!=null}),Xe=_J({disabled:!Pe,index:C,node:O,rect:_});return g.useEffect(()=>{G&&he.current.newIndex!==ce&&(he.current.newIndex=ce),f!==he.current.containerId&&(he.current.containerId=f),u!==he.current.items&&(he.current.items=u)},[G,ce,f,u]),g.useEffect(()=>{if(Ne===he.current.activeId)return;if(Ne&&!he.current.activeId){he.current.activeId=Ne;return}const Kt=setTimeout(()=>{he.current.activeId=Ne},50);return()=>clearTimeout(Kt)},[Ne]),{active:U,activeIndex:h,attributes:K,data:N,rect:_,index:C,newIndex:ce,items:u,isOver:M,isSorting:G,isDragging:A,listeners:I,node:O,overIndex:x,over:j,setNodeRef:W,setActivatorNodeRef:L,setDroppableNodeRef:D,setDraggableNodeRef:V,transform:Xe??J,transition:gt()};function gt(){if(Xe||Le&&he.current.newIndex===C)return NJ;if(!(ke&&!fk(z)||!c)&&(G||Pe))return yh.Transition.toString({...c,property:JA})}}function TJ(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function Wg(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const OJ=[et.Down,et.Right,et.Up,et.Left],MJ=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:s,scrollableAncestors:a}}=t;if(OJ.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];i.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const h=o.get(f.id);if(h)switch(e.code){case et.Down:r.top<h.top&&l.push(f);break;case et.Up:r.top>h.top&&l.push(f);break;case et.Left:r.left>h.left&&l.push(f);break;case et.Right:r.left<h.left&&l.push(f);break}});const c=fY({active:n,collisionRect:r,droppableRects:o,droppableContainers:l,pointerCoordinates:null});let u=OA(c,"id");if(u===(s==null?void 0:s.id)&&c.length>1&&(u=c[1].id),u!=null){const f=i.get(n.id),h=i.get(u),p=h?o.get(h.id):null,m=h==null?void 0:h.node.current;if(m&&p&&f&&h){const x=yy(m).some((P,_)=>a[_]!==P),b=XA(f,h),w=RJ(f,h),S=x||!b?{x:0,y:0}:{x:w?r.width-p.width:0,y:w?r.height-p.height:0},C={x:p.left,y:p.top};return S.x&&S.y?C:vh(C,S)}}}};function XA(e,t){return!Wg(e)||!Wg(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function RJ(e,t){return!Wg(e)||!Wg(t)||!XA(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function qr({}){return null}function ZA({path:e,autoFocus:t}){const n="string",r=Ft(e),o=lt(e,"string"),{patchPath:i,addPatch:s}=bn(e),[a,l]=g.useState(null),c="data"in o&&o.data,u="clientSideOnly"in o&&o.clientSideOnly;return g.useEffect(()=>{u===!1&&l(typeof c=="string"?c:null)},[c,u]),r.status==="error"?d.jsx(Xt,{path:e,error:r.error,type:n}):o.status==="error"?d.jsx(it,{path:e,error:o.error,schema:r}):o.status=="not-found"||r.status==="not-found"?d.jsx(Mn,{path:e,type:n}):r.status==="loading"?d.jsx(yt,{path:e,type:n}):!("data"in o)||o.data===void 0?d.jsx(yt,{path:e,type:n}):r.data.type!==n?d.jsx(kr,{path:e,expectedType:n,actualType:r.data.type}):d.jsxs("div",{id:e,children:[d.jsx(qr,{path:e}),d.jsx(Zu,{className:"pr-6 sm:pr-8 sm:w-[calc(100%-0.5rem)]",autoFocus:t,value:a||"",onChange:f=>{l(f.target.value),s([{op:"replace",path:i,value:f.target.value}],n)}})]})}function AJ({path:e}){const t=lt(e,"string");return t.status==="error"?d.jsx(it,{path:e,error:t.error}):!("data"in t)||t.data===void 0?d.jsx(wr,{path:e}):t.data===null?d.jsx(Sr,{path:e}):d.jsx("div",{className:"truncate",children:t.data})}function IJ({path:e}){const t="boolean",n=Ft(e),r=lt(e,t),{patchPath:o,addPatch:i}=bn(e);if(n.status==="error")return d.jsx(Xt,{path:e,error:n.error,type:t});if(r.status==="error")return d.jsx(it,{path:e,error:r.error,schema:n});if(r.status=="not-found"||n.status==="not-found")return d.jsx(Mn,{path:e,type:t});if(n.status==="loading")return d.jsx(yt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return d.jsx(yt,{path:e,type:t});if(n.data.type!==t)return d.jsx(kr,{path:e,expectedType:t,actualType:n.data.type});const s=r.data,a=s===null?"indeterminate":s;return d.jsxs("div",{id:e,children:[d.jsx(qr,{path:e}),d.jsx(Qu,{checked:a,onCheckedChange:()=>{let l=!1;n.data.opt?a===!0?l=null:a===null?l=!1:a===!1?l=!0:(console.warn("Unexpected value for boolean field",a),l=!1):a===!0?l=!1:a==="indeterminate"||a===!1?l=!0:(console.warn("Unexpected value for boolean field",a),l=!1),i([{op:"replace",path:o,value:l}],n.data.type)}})]})}function DJ({path:e,source:t,isNullable:n,loadingStatus:r}){const{addPatch:o,patchPath:i}=bn(e);return typeof t!="boolean"&&t!==null?d.jsx(it,{path:e,error:"Expected boolean"}):d.jsx(Qu,{id:e,disabled:r==="loading",checked:t===null?"indeterminate":typeof t=="boolean"?t:!1,onCheckedChange:()=>{o(t===null?[{op:"replace",path:i,value:!0}]:t===!1&&n?[{op:"replace",path:i,value:null}]:t===!1?[{op:"replace",path:i,value:!0}]:[{op:"replace",path:i,value:!1}],"boolean")}})}function LJ({path:e}){const t=lt(e,"boolean");return t.status==="error"?d.jsx(it,{path:e,error:t.error}):!("data"in t)||t.data===void 0?d.jsx(wr,{path:e}):t.data===null?d.jsx(Sr,{path:e}):t.data===!0?d.jsx("div",{className:"flex justify-center items-center w-4 h-4 rounded border border-border-primary",children:d.jsx(Yu,{className:"w-3 h-3"})}):t.data===!1?d.jsx("div",{className:"w-4 h-4 rounded border border-border-primary"}):(console.warn("Unexpected value for boolean field",t.data),d.jsx("div",{className:"w-4 h-4 rounded border-bg-brand-primary"}))}function FJ({path:e}){const t="number",n=Ft(e),r=lt(e,t),{patchPath:o,addPatch:i}=bn(e);if(n.status==="error")return d.jsx(Xt,{path:e,error:n.error,type:t});if(r.status==="error")return d.jsx(it,{path:e,error:r.error,schema:n});if(r.status=="not-found"||n.status==="not-found")return d.jsx(Mn,{path:e,type:t});if(n.status==="loading")return d.jsx(yt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return d.jsx(yt,{path:e,type:t});if(n.data.type!==t)return d.jsx(kr,{path:e,expectedType:t,actualType:n.data.type});const s=r.data;return d.jsxs("div",{id:e,children:[d.jsx(qr,{path:e}),d.jsx(Zu,{inputMode:"numeric",value:s||0,onChange:a=>{const l=Number(a.target.value);Number.isNaN(l)||i([{op:"replace",path:o,value:l}],t)}})]})}function zJ({path:e}){const t=lt(e,"number");return t.status==="error"?d.jsx(it,{path:e,error:t.error}):!("data"in t)||t.data===void 0?d.jsx(wr,{path:e}):t.data===null?d.jsx(Sr,{path:e}):d.jsx("div",{className:"truncate",children:t.data})}var $J=[" ","Enter","ArrowUp","ArrowDown"],BJ=[" ","Enter"],mp="Select",[wy,Sy,VJ]=py(mp),[rd,xge]=So(mp,[VJ,ji]),ky=ji(),[UJ,Ua]=rd(mp),[WJ,HJ]=rd(mp),QA=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:i,value:s,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:f,disabled:h,required:p,form:m}=e,v=ky(t),[x,b]=g.useState(null),[w,S]=g.useState(null),[C,N]=g.useState(!1),P=ap(c),[_=!1,O]=Kr({prop:r,defaultProp:o,onChange:i}),[M,D]=Kr({prop:s,defaultProp:a,onChange:l}),U=g.useRef(null),z=x?m||!!x.closest("form"):!0,[H,K]=g.useState(new Set),V=Array.from(H).map(I=>I.props.value).join(";");return d.jsx(tp,{...v,children:d.jsxs(UJ,{required:p,scope:t,trigger:x,onTriggerChange:b,valueNode:w,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:N,contentId:Vr(),value:M,onValueChange:D,open:_,onOpenChange:O,dir:P,triggerPointerDownPosRef:U,disabled:h,children:[d.jsx(wy.Provider,{scope:t,children:d.jsx(WJ,{scope:e.__scopeSelect,onNativeOptionAdd:g.useCallback(I=>{K(A=>new Set(A).add(I))},[]),onNativeOptionRemove:g.useCallback(I=>{K(A=>{const j=new Set(A);return j.delete(I),j})},[]),children:n})}),z?d.jsxs(SI,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:f,value:M,onChange:I=>D(I.target.value),disabled:h,form:m,children:[M===void 0?d.jsx("option",{value:""}):null,Array.from(H)]},V):null]})})};QA.displayName=mp;var eI="SelectTrigger",tI=g.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,i=ky(n),s=Ua(eI,n),a=s.disabled||r,l=Be(t,s.onTriggerChange),c=Sy(n),u=g.useRef("touch"),[f,h,p]=kI(v=>{const x=c().filter(S=>!S.disabled),b=x.find(S=>S.value===s.value),w=EI(x,v,b);w!==void 0&&s.onValueChange(w.value)}),m=v=>{a||(s.onOpenChange(!0),p()),v&&(s.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return d.jsx(Wu,{asChild:!0,...i,children:d.jsx(Oe.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":wI(s.value)?"":void 0,...o,ref:l,onClick:ne(o.onClick,v=>{v.currentTarget.focus(),u.current!=="mouse"&&m(v)}),onPointerDown:ne(o.onPointerDown,v=>{u.current=v.pointerType;const x=v.target;x.hasPointerCapture(v.pointerId)&&x.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(m(v),v.preventDefault())}),onKeyDown:ne(o.onKeyDown,v=>{const x=f.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&h(v.key),!(x&&v.key===" ")&&$J.includes(v.key)&&(m(),v.preventDefault())})})})});tI.displayName=eI;var nI="SelectValue",rI=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:i,placeholder:s="",...a}=e,l=Ua(nI,n),{onValueNodeHasChildrenChange:c}=l,u=i!==void 0,f=Be(t,l.onValueNodeChange);return On(()=>{c(u)},[c,u]),d.jsx(Oe.span,{...a,ref:f,style:{pointerEvents:"none"},children:wI(l.value)?d.jsx(d.Fragment,{children:s}):i})});rI.displayName=nI;var KJ="SelectIcon",oI=g.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return d.jsx(Oe.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});oI.displayName=KJ;var GJ="SelectPortal",iI=e=>d.jsx(Hu,{asChild:!0,...e});iI.displayName=GJ;var Fl="SelectContent",sI=g.forwardRef((e,t)=>{const n=Ua(Fl,e.__scopeSelect),[r,o]=g.useState();if(On(()=>{o(new DocumentFragment)},[]),!n.open){const i=r;return i?Fr.createPortal(d.jsx(aI,{scope:e.__scopeSelect,children:d.jsx(wy.Slot,{scope:e.__scopeSelect,children:d.jsx("div",{children:e.children})})}),i):null}return d.jsx(lI,{...e,ref:t})});sI.displayName=Fl;var Ro=10,[aI,Wa]=rd(Fl),qJ="SelectContentImpl",lI=g.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:s,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:m,hideWhenDetached:v,avoidCollisions:x,...b}=e,w=Ua(Fl,n),[S,C]=g.useState(null),[N,P]=g.useState(null),_=Be(t,J=>C(J)),[O,M]=g.useState(null),[D,U]=g.useState(null),z=Sy(n),[H,K]=g.useState(!1),V=g.useRef(!1);g.useEffect(()=>{if(S)return fy(S)},[S]),dy();const I=g.useCallback(J=>{const[ce,...Ne]=z().map(Pe=>Pe.ref.current),[he]=Ne.slice(-1),Le=document.activeElement;for(const Pe of J)if(Pe===Le||(Pe==null||Pe.scrollIntoView({block:"nearest"}),Pe===ce&&N&&(N.scrollTop=0),Pe===he&&N&&(N.scrollTop=N.scrollHeight),Pe==null||Pe.focus(),document.activeElement!==Le))return},[z,N]),A=g.useCallback(()=>I([O,S]),[I,O,S]);g.useEffect(()=>{H&&A()},[H,A]);const{onOpenChange:j,triggerPointerDownPosRef:L}=w;g.useEffect(()=>{if(S){let J={x:0,y:0};const ce=he=>{var Le,Pe;J={x:Math.abs(Math.round(he.pageX)-(((Le=L.current)==null?void 0:Le.x)??0)),y:Math.abs(Math.round(he.pageY)-(((Pe=L.current)==null?void 0:Pe.y)??0))}},Ne=he=>{J.x<=10&&J.y<=10?he.preventDefault():S.contains(he.target)||j(!1),document.removeEventListener("pointermove",ce),L.current=null};return L.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",Ne,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",Ne,{capture:!0})}}},[S,j,L]),g.useEffect(()=>{const J=()=>j(!1);return window.addEventListener("blur",J),window.addEventListener("resize",J),()=>{window.removeEventListener("blur",J),window.removeEventListener("resize",J)}},[j]);const[$,W]=kI(J=>{const ce=z().filter(Le=>!Le.disabled),Ne=ce.find(Le=>Le.ref.current===document.activeElement),he=EI(ce,J,Ne);he&&setTimeout(()=>he.ref.current.focus())}),G=g.useCallback((J,ce,Ne)=>{const he=!V.current&&!Ne;(w.value!==void 0&&w.value===ce||he)&&(M(J),he&&(V.current=!0))},[w.value]),_e=g.useCallback(()=>S==null?void 0:S.focus(),[S]),ke=g.useCallback((J,ce,Ne)=>{const he=!V.current&&!Ne;(w.value!==void 0&&w.value===ce||he)&&U(J)},[w.value]),Ve=r==="popper"?rw:cI,Z=Ve===rw?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:m,hideWhenDetached:v,avoidCollisions:x}:{};return d.jsx(aI,{scope:n,content:S,viewport:N,onViewportChange:P,itemRefCallback:G,selectedItem:O,onItemLeave:_e,itemTextRefCallback:ke,focusSelectedItem:A,selectedItemText:D,position:r,isPositioned:H,searchRef:$,children:d.jsx(cp,{as:ls,allowPinchZoom:!0,children:d.jsx(lp,{asChild:!0,trapped:w.open,onMountAutoFocus:J=>{J.preventDefault()},onUnmountAutoFocus:ne(o,J=>{var ce;(ce=w.trigger)==null||ce.focus({preventScroll:!0}),J.preventDefault()}),children:d.jsx(Xl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:J=>J.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:d.jsx(Ve,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:J=>J.preventDefault(),...b,...Z,onPlaced:()=>K(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:ne(b.onKeyDown,J=>{const ce=J.ctrlKey||J.altKey||J.metaKey;if(J.key==="Tab"&&J.preventDefault(),!ce&&J.key.length===1&&W(J.key),["ArrowUp","ArrowDown","Home","End"].includes(J.key)){let he=z().filter(Le=>!Le.disabled).map(Le=>Le.ref.current);if(["ArrowUp","End"].includes(J.key)&&(he=he.slice().reverse()),["ArrowUp","ArrowDown"].includes(J.key)){const Le=J.target,Pe=he.indexOf(Le);he=he.slice(Pe+1)}setTimeout(()=>I(he)),J.preventDefault()}})})})})})})});lI.displayName=qJ;var YJ="SelectItemAlignedPosition",cI=g.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,i=Ua(Fl,n),s=Wa(Fl,n),[a,l]=g.useState(null),[c,u]=g.useState(null),f=Be(t,_=>u(_)),h=Sy(n),p=g.useRef(!1),m=g.useRef(!0),{viewport:v,selectedItem:x,selectedItemText:b,focusSelectedItem:w}=s,S=g.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&c&&v&&x&&b){const _=i.trigger.getBoundingClientRect(),O=c.getBoundingClientRect(),M=i.valueNode.getBoundingClientRect(),D=b.getBoundingClientRect();if(i.dir!=="rtl"){const Le=D.left-O.left,Pe=M.left-Le,Xe=_.left-Pe,gt=_.width+Xe,Kt=Math.max(gt,O.width),T=window.innerWidth-Ro,k=Kb(Pe,[Ro,Math.max(Ro,T-Kt)]);a.style.minWidth=gt+"px",a.style.left=k+"px"}else{const Le=O.right-D.right,Pe=window.innerWidth-M.right-Le,Xe=window.innerWidth-_.right-Pe,gt=_.width+Xe,Kt=Math.max(gt,O.width),T=window.innerWidth-Ro,k=Kb(Pe,[Ro,Math.max(Ro,T-Kt)]);a.style.minWidth=gt+"px",a.style.right=k+"px"}const U=h(),z=window.innerHeight-Ro*2,H=v.scrollHeight,K=window.getComputedStyle(c),V=parseInt(K.borderTopWidth,10),I=parseInt(K.paddingTop,10),A=parseInt(K.borderBottomWidth,10),j=parseInt(K.paddingBottom,10),L=V+I+H+j+A,$=Math.min(x.offsetHeight*5,L),W=window.getComputedStyle(v),G=parseInt(W.paddingTop,10),_e=parseInt(W.paddingBottom,10),ke=_.top+_.height/2-Ro,Ve=z-ke,Z=x.offsetHeight/2,J=x.offsetTop+Z,ce=V+I+J,Ne=L-ce;if(ce<=ke){const Le=U.length>0&&x===U[U.length-1].ref.current;a.style.bottom="0px";const Pe=c.clientHeight-v.offsetTop-v.offsetHeight,Xe=Math.max(Ve,Z+(Le?_e:0)+Pe+A),gt=ce+Xe;a.style.height=gt+"px"}else{const Le=U.length>0&&x===U[0].ref.current;a.style.top="0px";const Xe=Math.max(ke,V+v.offsetTop+(Le?G:0)+Z)+Ne;a.style.height=Xe+"px",v.scrollTop=ce-ke+v.offsetTop}a.style.margin=`${Ro}px 0`,a.style.minHeight=$+"px",a.style.maxHeight=z+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[h,i.trigger,i.valueNode,a,c,v,x,b,i.dir,r]);On(()=>S(),[S]);const[C,N]=g.useState();On(()=>{c&&N(window.getComputedStyle(c).zIndex)},[c]);const P=g.useCallback(_=>{_&&m.current===!0&&(S(),w==null||w(),m.current=!1)},[S,w]);return d.jsx(XJ,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:P,children:d.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:d.jsx(Oe.div,{...o,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});cI.displayName=YJ;var JJ="SelectPopperPosition",rw=g.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Ro,...i}=e,s=ky(n);return d.jsx(np,{...s,...i,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});rw.displayName=JJ;var[XJ,vk]=rd(Fl,{}),ow="SelectViewport",uI=g.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,i=Wa(ow,n),s=vk(ow,n),a=Be(t,i.onViewportChange),l=g.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),d.jsx(wy.Slot,{scope:n,children:d.jsx(Oe.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:ne(o.onScroll,c=>{const u=c.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=s;if(h!=null&&h.current&&f){const p=Math.abs(l.current-u.scrollTop);if(p>0){const m=window.innerHeight-Ro*2,v=parseFloat(f.style.minHeight),x=parseFloat(f.style.height),b=Math.max(v,x);if(b<m){const w=b+p,S=Math.min(m,w),C=w-S;f.style.height=S+"px",f.style.bottom==="0px"&&(u.scrollTop=C>0?C:0,f.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});uI.displayName=ow;var dI="SelectGroup",[ZJ,QJ]=rd(dI),eX=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Vr();return d.jsx(ZJ,{scope:n,id:o,children:d.jsx(Oe.div,{role:"group","aria-labelledby":o,...r,ref:t})})});eX.displayName=dI;var fI="SelectLabel",hI=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=QJ(fI,n);return d.jsx(Oe.div,{id:o.id,...r,ref:t})});hI.displayName=fI;var Hg="SelectItem",[tX,pI]=rd(Hg),mI=g.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...s}=e,a=Ua(Hg,n),l=Wa(Hg,n),c=a.value===r,[u,f]=g.useState(i??""),[h,p]=g.useState(!1),m=Be(t,w=>{var S;return(S=l.itemRefCallback)==null?void 0:S.call(l,w,r,o)}),v=Vr(),x=g.useRef("touch"),b=()=>{o||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.jsx(tX,{scope:n,value:r,disabled:o,textId:v,isSelected:c,onItemTextChange:g.useCallback(w=>{f(S=>S||((w==null?void 0:w.textContent)??"").trim())},[]),children:d.jsx(wy.ItemSlot,{scope:n,value:r,disabled:o,textValue:u,children:d.jsx(Oe.div,{role:"option","aria-labelledby":v,"data-highlighted":h?"":void 0,"aria-selected":c&&h,"data-state":c?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...s,ref:m,onFocus:ne(s.onFocus,()=>p(!0)),onBlur:ne(s.onBlur,()=>p(!1)),onClick:ne(s.onClick,()=>{x.current!=="mouse"&&b()}),onPointerUp:ne(s.onPointerUp,()=>{x.current==="mouse"&&b()}),onPointerDown:ne(s.onPointerDown,w=>{x.current=w.pointerType}),onPointerMove:ne(s.onPointerMove,w=>{var S;x.current=w.pointerType,o?(S=l.onItemLeave)==null||S.call(l):x.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ne(s.onPointerLeave,w=>{var S;w.currentTarget===document.activeElement&&((S=l.onItemLeave)==null||S.call(l))}),onKeyDown:ne(s.onKeyDown,w=>{var C;((C=l.searchRef)==null?void 0:C.current)!==""&&w.key===" "||(BJ.includes(w.key)&&b(),w.key===" "&&w.preventDefault())})})})})});mI.displayName=Hg;var $d="SelectItemText",gI=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...i}=e,s=Ua($d,n),a=Wa($d,n),l=pI($d,n),c=HJ($d,n),[u,f]=g.useState(null),h=Be(t,b=>f(b),l.onItemTextChange,b=>{var w;return(w=a.itemTextRefCallback)==null?void 0:w.call(a,b,l.value,l.disabled)}),p=u==null?void 0:u.textContent,m=g.useMemo(()=>d.jsx("option",{value:l.value,disabled:l.disabled,children:p},l.value),[l.disabled,l.value,p]),{onNativeOptionAdd:v,onNativeOptionRemove:x}=c;return On(()=>(v(m),()=>x(m)),[v,x,m]),d.jsxs(d.Fragment,{children:[d.jsx(Oe.span,{id:l.textId,...i,ref:h}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Fr.createPortal(i.children,s.valueNode):null]})});gI.displayName=$d;var vI="SelectItemIndicator",yI=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return pI(vI,n).isSelected?d.jsx(Oe.span,{"aria-hidden":!0,...r,ref:t}):null});yI.displayName=vI;var iw="SelectScrollUpButton",nX=g.forwardRef((e,t)=>{const n=Wa(iw,e.__scopeSelect),r=vk(iw,e.__scopeSelect),[o,i]=g.useState(!1),s=Be(t,r.onScrollButtonChange);return On(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;i(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?d.jsx(xI,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});nX.displayName=iw;var sw="SelectScrollDownButton",rX=g.forwardRef((e,t)=>{const n=Wa(sw,e.__scopeSelect),r=vk(sw,e.__scopeSelect),[o,i]=g.useState(!1),s=Be(t,r.onScrollButtonChange);return On(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;i(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?d.jsx(xI,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});rX.displayName=sw;var xI=g.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,i=Wa("SelectScrollButton",n),s=g.useRef(null),a=Sy(n),l=g.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return g.useEffect(()=>()=>l(),[l]),On(()=>{var u;const c=a().find(f=>f.ref.current===document.activeElement);(u=c==null?void 0:c.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),d.jsx(Oe.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:ne(o.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:ne(o.onPointerMove,()=>{var c;(c=i.onItemLeave)==null||c.call(i),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:ne(o.onPointerLeave,()=>{l()})})}),oX="SelectSeparator",bI=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return d.jsx(Oe.div,{"aria-hidden":!0,...r,ref:t})});bI.displayName=oX;var aw="SelectArrow",iX=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=ky(n),i=Ua(aw,n),s=Wa(aw,n);return i.open&&s.position==="popper"?d.jsx(rp,{...o,...r,ref:t}):null});iX.displayName=aw;function wI(e){return e===""||e===void 0}var SI=g.forwardRef((e,t)=>{const{value:n,...r}=e,o=g.useRef(null),i=Be(t,o),s=XS(n);return g.useEffect(()=>{const a=o.current,l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(s!==n&&u){const f=new Event("change",{bubbles:!0});u.call(a,n),a.dispatchEvent(f)}},[s,n]),d.jsx(_S,{asChild:!0,children:d.jsx("select",{...r,ref:i,defaultValue:n})})});SI.displayName="BubbleSelect";function kI(e){const t=nn(e),n=g.useRef(""),r=g.useRef(0),o=g.useCallback(s=>{const a=n.current+s;t(a),function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(a)},[t]),i=g.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,i]}function EI(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=sX(e,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function sX(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var CI=QA,yk=tI,aX=rI,lX=oI,cX=iI,xk=sI,NI=uI,PI=hI,bk=mI,_I=gI,uX=yI,jI=bI;const Ey=CI,Cy=aX,gp=g.forwardRef(({className:e,children:t,...n},r)=>d.jsxs(yk,{ref:r,className:fe("flex h-10 m-1 w-[calc(100%-8px)] items-center justify-between rounded-md border border-input bg-bg-primary px-3 py-2 text-sm ring-offset-background placeholder:text-fg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...n,children:[t,d.jsx(lX,{asChild:!0,children:d.jsx(Ju,{className:"w-4 h-4 opacity-50"})})]}));gp.displayName=yk.displayName;const vp=g.forwardRef(({className:e,children:t,position:n="popper",container:r,...o},i)=>d.jsx(cX,{container:r,children:d.jsx(xk,{ref:i,className:fe("relative z-50 min-w-[10rem] overflow-hidden rounded-md border bg-bg-primary text-fg-primary shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...o,children:d.jsx(NI,{className:fe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:d.jsx(hr,{orientation:"vertical",children:d.jsx("div",{className:"max-h-[var(--radix-select-content-available-height)]",children:t})})})})}));vp.displayName=xk.displayName;const dX=g.forwardRef(({className:e,...t},n)=>d.jsx(PI,{ref:n,className:fe("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));dX.displayName=PI.displayName;const yp=g.forwardRef(({className:e,children:t,...n},r)=>d.jsxs(bk,{ref:r,className:fe("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm text-fg-primary outline-none focus:bg-bg-primary-hover focus:text-fg-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[d.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:d.jsx(uX,{children:d.jsx(Yu,{className:"w-4 h-4"})})}),d.jsx(_I,{children:t})]}));yp.displayName=bk.displayName;const fX=g.forwardRef(({className:e,...t},n)=>d.jsx(jI,{ref:n,className:fe("-mx-1 my-1 h-px bg-bg-secondary",e),...t}));fX.displayName=jI.displayName;function fa(e,t){return e.includes("?p=")?e+"."+JSON.stringify(t):e+"?p="+JSON.stringify(t)}function hX(e){const t=e.replace(/([A-Z])/g," $1").toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)}function pX({children:e}){return d.jsx("div",{children:hX(e)})}function TI(e){const[t,n]=Y.splitModuleFilePathAndModulePath(e),r=Y.joinModuleFilePathAndModulePath(t,Y.splitModulePath(n).slice(0,-1).join(".")),o=Ft(r);return{path:r,schema:"data"in o?o.data:void 0}}const Om=(e,t,n)=>t!==e&&(n==null?void 0:n.type)==="record",mX=(e,t,n)=>t!==e&&(n==null?void 0:n.type)==="array",lP=e=>(e==null?void 0:e.type)==="record",gX=e=>(e==null?void 0:e.type)==="array";function OI({path:e,variant:t}){const n=Ft(e),{path:r,schema:o}=TI(e),[i]=Y.splitModuleFilePathAndModulePath(e),s=MI(e),a=s[s.length-1],l=W2(r,Om(e,r,o)?a==null?void 0:a.part:void 0),c=XR(),u=lP("data"in n?n.data:void 0)&&c.status==="success"&&c.data&&"data"in n&&n.data.type==="record"&&n.data.router?cP(i,c.data,n.data.router):null,f=Om(e,r,o)&&c.status==="success"&&c.data&&o&&o.type==="record"&&o.router?cP(i,c.data,o.router):null,h=(f==null?void 0:f.every(b=>b.type==="literal"))||!1,p=!f||!h,m=!f||!h,v=(u==null?void 0:u.every(b=>b.type==="literal"))||!1,x=!u||!v;return d.jsxs("span",{className:"inline-flex gap-2 items-center",children:[Om(e,r,o)&&d.jsxs(d.Fragment,{children:[d.jsx(uP,{refs:l,variant:t}),m&&d.jsx(q2,{defaultValue:a.text,path:e,parentPath:r,variant:Pf(t),size:Nf(t),routePattern:f,existingKeys:l,children:d.jsx(wK,{size:Cf(t)})}),p&&d.jsx(H2,{path:e,parentPath:r,variant:Pf(t),size:Nf(t),refs:l,confirmationMessage:`This will delete the ${a.text} record.`,children:d.jsx(NK,{size:Cf(t)})})]}),gX("data"in n?n.data:void 0)&&d.jsx(vX,{path:e,variant:t}),lP("data"in n?n.data:void 0)&&d.jsxs(d.Fragment,{children:[d.jsx(uP,{refs:l,variant:t}),x&&d.jsx(G2,{path:e,variant:Pf(t),size:Nf(t),routePattern:u,children:d.jsx(VS,{size:Cf(t)})})]})]})}function cP(e,t,n){if(n==="next-app-router"){const r=Ab(e,t);return DM(r)}return null}function uP({refs:e,variant:t}){const n=In();return e.length===0?null:d.jsxs(br,{children:[d.jsxs(zr,{children:[d.jsx(ho,{asChild:!0,children:d.jsx(qe,{asChild:!0,size:Nf(t),variant:Pf(t),children:d.jsx(xo,{children:d.jsx(l2,{size:Cf(t)})})})}),d.jsx(fr,{side:"top",children:"References to this record"})]}),d.jsx(tr,{container:n,children:d.jsx("div",{className:"text-sm",children:d.jsx("ul",{children:e.map(r=>{const[o,i]=Y.splitModuleFilePathAndModulePath(r),s=Y.createPatchPath(i);return d.jsx("li",{children:d.jsx(dp,{moduleFilePath:o,patchPath:s})},r)})})})})]})}function Cf(e){return e==="module"?16:12}function Nf(e){return"icon"}function Pf(e){return e==="module"?"outline":"ghost"}function vX({path:e,variant:t}){const{navigate:n}=xn(),{addPatch:r,patchPath:o}=bn(e),i=Ft(e),s=lt(e,"array"),[a]=Y.splitModuleFilePathAndModulePath(e);if(!("data"in s)||!s.data||!("data"in i))return null;const l=i.data;if(l.type!=="array")return console.error("Cannot add to non-array",s,{parentPath:e}),null;const c=s.data.length;return d.jsx(qe,{title:"Add",size:Nf(t),variant:Pf(t),onClick:()=>{const u=o.concat(c.toString());r([{op:"add",path:u,value:Il(l.item)}],l.type),l.item.type!=="string"&&n(Y.joinModuleFilePathAndModulePath(a,Y.patchPathToModulePath(u)))},children:d.jsx(VS,{size:Cf(t)})})}function MI(e){const[t,n]=Y.splitModuleFilePathAndModulePath(e),r=Y.splitModuleFilePath(t).map(a=>({text:Eu(a),part:a,sourcePath:t}));if(!n)return r;const o=Y.splitModulePath(n),i=[];let s="";for(let a=0;a<o.length;a++){let l=(s?s+".":"")+JSON.stringify(o[a]);n.startsWith(l)||(l=(s?s+".":"")+o[a]),s=l,i.push({text:o[a],part:o[a],sourcePath:Y.joinModuleFilePathAndModulePath(t,l)})}return r.concat(i)}function wk({validationErrors:e}){return d.jsxs("div",{className:fe("w-full",{"h-6":e.length===0}),children:[e.length>1&&d.jsx(Dl,{type:"single",collapsible:!0,className:"w-full min-h-6",children:d.jsxs(_a,{value:"validation-errors",className:"pb-2 w-full border-b-0 group",children:[d.jsx(Ll,{className:fe("min-h-6","transition-colors duration-200 ease-in-out","group-data-[state=closed]:bg-bg-error-primary rounded-lg","p-2"),children:d.jsxs("div",{className:fe("flex items-center justify-between w-full"),children:[d.jsxs("div",{className:"text-fg-primary group-data-[state=closed]:text-fg-error-primary",children:[e.length," validation error",e.length>1?"s":""]}),d.jsx("div",{className:"text-fg-error-primary",children:d.jsx(Su,{size:16})})]})}),d.jsx(ja,{children:d.jsx("div",{className:"flex flex-col gap-2",children:e.map((t,n)=>d.jsx("div",{className:fe("p-2 rounded-lg","bg-bg-error-primary text-fg-error-primary"),children:t.message},n))})})]})}),e.length===1&&e[0]&&d.jsx(yX,{validationError:e[0]})]})}function yX({validationError:e}){const[t,n]=g.useState(!1),[r,o]=g.useState(!1),i=g.useRef(null),s=g.useRef(null);return g.useEffect(()=>{const a=()=>{if(i.current){const c=document.createElement("div"),u=window.getComputedStyle(i.current);c.style.cssText=u.cssText,c.style.position="absolute",c.style.visibility="hidden",c.style.left="-9999px",c.style.width=u.width,c.style.webkitLineClamp="unset",c.style.overflow="visible",c.style.display="block",c.textContent=e.message,document.body.appendChild(c);const f=c.getBoundingClientRect().height;document.body.removeChild(c);const h=i.current.getBoundingClientRect().height;o(f>h+1)}},l=setTimeout(a,50);return window.addEventListener("resize",a),()=>{clearTimeout(l),window.removeEventListener("resize",a)}},[e.message]),d.jsxs("div",{ref:s,className:fe("flex items-center justify-between w-full transition-all duration-200 ease-in-out","p-2 mt-2","bg-bg-error-primary text-fg-error-primary rounded-lg"),style:{height:t?"auto":void 0},children:[d.jsx("div",{ref:i,className:fe("transition-all duration-200 ease-in-out",{"line-clamp-1":!t}),style:{flex:r?"1":"auto",marginRight:r?"8px":"0"},children:e.message}),!r&&d.jsx("div",{className:"text-fg-error-primary",children:d.jsx(Su,{size:16})}),r&&d.jsxs("button",{className:"flex flex-shrink-0 items-center",onClick:()=>n(!t),children:[d.jsx("div",{className:"text-fg-error-primary",children:d.jsx(Su,{size:16})}),d.jsx(Ju,{size:16,className:fe("transform transition-transform duration-200 ease-in-out",{"rotate-180":t})})]})]})}function RI({label:e,children:t,path:n,transparent:r,type:o,foldLevel:i="1"}){var S,C;const s=ly(),a=qR(n),{patchPath:l,addPatch:c}=bn(n),u=Ft(n),f=lt(n,o),[h,p]=g.useState(!0),[m,v]=g.useState(!1);g.useEffect(()=>{var N,P;"data"in f&&f.data===null&&"data"in u&&!u.data.opt&&(((N=u.data)==null?void 0:N.type)==="image"||((P=u.data)==null?void 0:P.type)==="file")&&v(!0)},[f,u]);const x="data"in f?f.data:void 0,b="data"in u&&((S=u.data)==null?void 0:S.type)==="boolean",w="data"in u&&((C=u.data)==null?void 0:C.opt)===!0;return d.jsxs("div",{className:Ce("px-4 pt-6 pb-0 border rounded-lg",{"bg-bg-tertiary":!r,"border-bg-error-secondary":a.length>0}),children:[d.jsxs("div",{className:"flex justify-between items-center pb-2",children:[d.jsxs("div",{className:"flex gap-4 items-center",children:[!b&&w&&d.jsx(Qu,{disabled:s==="loading",checked:x!==null||m,onCheckedChange:()=>{(u.data.type==="image"||u.data.type==="file")&&x===null?v(!0):c(x===null?[{op:"replace",path:l,value:Il({...u.data,opt:!1})}]:[{op:"replace",path:l,value:null}],u.data.type)}}),b&&d.jsx(DJ,{path:n,isNullable:w,loadingStatus:s,source:x}),typeof e=="string"&&d.jsx(pX,{children:e}),e&&typeof e!="string"&&e]}),d.jsxs("div",{className:"flex gap-2 items-center",children:[x!==null&&d.jsx(OI,{path:n,variant:"field"}),x!==null&&!b&&d.jsxs("button",{onClick:()=>p(N=>!N),className:Ce("transform transition-transform",{"rotate-180":h}),children:[i==="1"&&d.jsx(Ju,{size:16}),i==="2"&&d.jsx(q7,{size:16})]})]})]}),!b&&d.jsx(Dl,{type:"single",collapsible:!0,value:h&&(x!==null||m)?"open":"closed",children:d.jsx(_a,{value:"open",className:"w-full border-b-0",children:d.jsx(ja,{children:t})})}),a.length>0&&d.jsx("div",{className:"pb-8",children:d.jsx(wk,{validationErrors:a})})]})}function xX({path:e}){const t="object",n=Ft(e),r=lt(e,t);if(n.status==="error")return d.jsx(Xt,{path:e,error:n.error,type:t});if(r.status==="error")return d.jsx(it,{path:e,error:r.error,schema:n});if(r.status=="not-found"||n.status==="not-found")return d.jsx(Mn,{path:e,type:t});if(n.status==="loading")return d.jsx(yt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return d.jsx(yt,{path:e,type:t});if(n.data.type!==t)return d.jsx(kr,{path:e,expectedType:t,actualType:n.data.type});const o=n.data;return d.jsxs("div",{id:e,children:[d.jsx(qr,{path:e}),d.jsx("div",{className:"flex flex-col gap-6",children:Object.entries(o.items).map(([i,s])=>{const a=fa(e,i);return d.jsx(RI,{label:i,path:a,type:s.type,children:d.jsx(Yy,{path:a,schema:s},a)},a)})})]})}function bX({path:e}){const t="object",n=Ft(e);if(n.status==="error")return d.jsx(Xt,{path:e,error:n.error,type:t});if(n.status==="loading")return d.jsx(yt,{path:e,type:t});if(n.status==="not-found")return d.jsx(Mn,{path:e,type:t});if(n.data.type!=="object")return d.jsx(kr,{path:e,expectedType:"object",actualType:n.data.type});const r=n.data;return d.jsx(AI,{path:e,schema:r})}function AI({path:e,schema:t}){return d.jsx("div",{id:e,className:"grid grid-cols-[min-content,1fr] text-left gap-2 text-xs",children:Object.keys(t.items).map(n=>{const r=fa(e,n);return d.jsx(wX,{label:n,children:d.jsx(yE,{path:r})},n)})})}function wX({label:e,children:t}){return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"flex whitespace-nowrap text-fg-disabled",children:wf(e)}),t]})}function lw(e){return typeof e.key!="string"}function SX({path:e}){const t="union",n=Ft(e),r=lt(e,t);if(n.status==="error")return d.jsx(Xt,{path:e,error:n.error,type:t});if(r.status==="error")return d.jsx(it,{path:e,error:r.error,schema:n});if(r.status=="not-found"||n.status==="not-found")return d.jsx(Mn,{path:e,type:t});if(n.status==="loading")return d.jsx(yt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return d.jsx(yt,{path:e,type:t});if(n.data.type!==t)return d.jsx(kr,{path:e,expectedType:t,actualType:n.data.type});const o=r.data;if(lw(n.data))return typeof o!="string"&&o!==null?d.jsx(it,{path:e,error:"Expected source to be a string, but found: "+typeof o,schema:n}):d.jsxs("div",{id:e,children:[d.jsx(qr,{path:e}),d.jsx(EX,{path:e,source:o,options:n.data.items.concat(n.data.key).flatMap(i=>(i==null?void 0:i.type)==="literal"?[i.value]:(console.warn("Unexpected item in string union",i),[]))})]});if(!lw(n.data))return typeof o!="object"?d.jsx(it,{path:e,error:"Expected source to be an object, but found: "+typeof o,schema:n}):Array.isArray(o)?d.jsx(it,{path:e,error:"Expected source to be an object, but found an array",schema:n}):d.jsxs("div",{id:e,children:[d.jsx(qr,{path:e}),d.jsx(kX,{path:e,schema:n.data})]})}function kX({path:e,schema:t}){const n=zS(e),{addPatch:r,patchPath:o}=bn(e),i=In(),s=fa(e,t.key),a=lt(s,"literal");if(!("data"in a)||a.data===void 0)return d.jsx(yt,{path:e,type:"union"});const l=t.items.find(f=>{var p;const h=(p=f.items)==null?void 0:p[t.key];return h.type==="literal"?h.value===a.data:(console.error("Expected literal schema in object union",h),!1)});if((l==null?void 0:l.items)===void 0)return d.jsx(yt,{path:e,type:"union"});const c=t.items.flatMap(f=>{var p;const h=(p=f.items)==null?void 0:p[t.key];return h.type==="literal"?[h.value]:(console.error("Expected literal schema in object union",h),[])}),u=g.useRef({});return g.useEffect(()=>{n!==void 0&&a.data!==void 0&&typeof a.data=="string"&&n.status==="success"&&(u.current[e]||(u.current[e]={}),u.current[e][a.data]=n.data)},[n,a,e]),d.jsxs("div",{className:"grid gap-4",children:[d.jsxs(Ey,{value:a.data??void 0,onValueChange:f=>{const h=t.items.find(m=>{var x;const v=(x=m.items)==null?void 0:x[t.key];return v.type==="literal"?v.value===f:(console.error("Expected literal schema in object union",v),!1)});if((h==null?void 0:h.items)===void 0){console.error(`Selected schema with ${t.key} = ${f} not found`);return}const p=u.current[e][f]||Il(h);p[t.key]=f,r([{op:"replace",path:o,value:p}],t.type)},children:[d.jsx(gp,{children:d.jsx(Cy,{children:a.data})}),d.jsx(vp,{container:i,className:"w-32",children:c==null?d.jsx(II,{}):c.map(f=>d.jsx(yp,{value:f,children:f},f))})]}),Object.keys(l==null?void 0:l.items).filter(f=>f!==(t==null?void 0:t.key)).map(f=>{var p,m,v;const h=fa(e,f);return d.jsx(RI,{path:h,foldLevel:"1",label:f,type:(m=(p=l==null?void 0:l.items)==null?void 0:p[f])==null?void 0:m.type,children:d.jsx(Yy,{path:h,schema:(v=l==null?void 0:l.items)==null?void 0:v[f]},f)},h)})]})}function EX({path:e,source:t,options:n}){const{addPatch:r,patchPath:o}=bn(e),i=In();return d.jsxs(Ey,{value:t??"",onValueChange:s=>{r([{op:"replace",path:o,value:s}],"union")},children:[d.jsx(gp,{children:d.jsx(Cy,{children:t})}),d.jsx(vp,{className:"w-32",container:i,children:n==null?d.jsx(II,{}):n.map(s=>d.jsx(yp,{value:s,children:s},s))})]})}function II(){return d.jsx("div",{children:"Loading..."})}function CX({path:e}){const t="union",n=zS(e),r=Ft(e);if(n.status==="error")return d.jsx(it,{path:e,error:n.error,schema:r});if(!("data"in n)||n.data===void 0)return d.jsx(wr,{path:e});if(!("data"in r)||r.data===void 0)return d.jsx(wr,{path:e});if(n.data===null)return d.jsx(Sr,{path:e});if(r.data.type!==t)return d.jsx(kr,{path:e,expectedType:t,actualType:r.data.type});const o=r.data;if(lw(o))return typeof n.data!="string"?d.jsx(it,{path:e,error:"Expected source to be a string, but found: "+typeof n.data,schema:r}):d.jsx("div",{className:"truncate",children:n.data});{const i=n.data;if(!i)return d.jsx(Sr,{path:e});if(typeof i!="object"&&!(typeof i=="object"&&o.key in i))return d.jsx(it,{path:e,error:"Expected source to be an object, but found: "+typeof i,schema:r});const s=o.items.find(a=>{var c;const l=(c=a.items)==null?void 0:c[o.key];if((l==null?void 0:l.type)==="literal"&&i!==null&&typeof i=="object"&&o.key in i&&!Qs(i))return l.value===i[o.key]});return s?d.jsx(AI,{path:e,schema:s}):d.jsx(it,{path:e,error:"Expected source to have key "+o.key+" but it was not found",schema:r})}}function DI(e){return new Promise((t,n)=>{var i;const r=(i=e.currentTarget.files)==null?void 0:i[0],o=new FileReader;o.addEventListener("load",()=>{const s=o.result;if(typeof s=="string"){const a=new Image;a.addEventListener("load",()=>{const l=Gv.Buffer.from(s.split(",")[1],"base64"),c=Y.getSHA256Hash(l);if(a.naturalWidth&&a.naturalHeight){const u=Y.getMimeType(s);t({src:s,width:a.naturalWidth,height:a.naturalHeight,filename:r==null?void 0:r.name,fileHash:c,mimeType:u,fileExt:u&&Y.mimeTypeToFileExt(u)})}else t({src:s,filename:r==null?void 0:r.name,fileHash:c})}),a.src=s}else n(s?{message:"Unexpected image result type",result:s}:{message:"Empty result"})}),r&&o.readAsDataURL(r)})}function NX(e){return new Promise((t,n)=>{var i;const r=(i=e.currentTarget.files)==null?void 0:i[0],o=new FileReader;o.addEventListener("load",()=>{const s=o.result;if(typeof s=="string"){const a=Gv.Buffer.from(s.split(",")[1],"base64"),l=Y.getSHA256Hash(a),c=Y.getMimeType(s);t({src:s,filename:r==null?void 0:r.name,fileHash:l,mimeType:c,fileExt:c&&Y.mimeTypeToFileExt(c)})}else n(s?{message:"Unexpected file result type",result:s}:{message:"Empty result"})}),r&&o.readAsDataURL(r)})}function PX(e){return e.split(".").pop()||""}const _X=new TextEncoder;async function LI(e,t,n,r,o,i,s,a="/public/val"){const l=Y.createFilename(t,n,o,r);if(!l||!o)return[];const c=`${a}/${l}`,u=Y.remote.hashToRemoteFileHash(r),f=s?Y.remote.createRemoteRef(s.remoteHost,{publicProjectId:s.publicProjectId,coreVersion:s.coreVersion,bucket:s.bucket,validationHash:Y.remote.getValidationHash(s.coreVersion,s.schema,PX(l),o,u,_X),fileHash:u,filePath:`${a.slice(1)}/${l}`}):c;return[{value:{[bt]:f,[De]:s?"remote":"file",...i!=="file"?{[Cb]:i}:{},metadata:o},op:"replace",path:e},{value:t,metadata:o,op:"file",path:e,filePath:f,remote:s!==null}]}function jX({path:e}){var U;const t="file",n=Gu(),r=AS(),o=RS(),i=Ft(e),s=lt(e,t),[a,l]=g.useState(!1),[c,u]=g.useState(null),[f,h]=g.useState(null),[p,m]=g.useState(!1),{patchPath:v,addAndUploadPatchWithFileOps:x}=bn(e),[b,w]=g.useState(null),S="data"in s&&s.data,C=s.status==="success"&&s.clientSideOnly;if(g.useEffect(()=>{if(S&&S.metadata&&!C){const z=De in S&&S[De]==="remote"?Y.convertRemoteSource({...S,[De]:"remote"}).url:Y.convertFileSource({...S,[De]:"file"}).url;h(z),m(!1)}},[s]),g.useEffect(()=>{var z,H,K;i.status==="success"&&i.data.type==="file"&&((H=(z=i.data.options)==null?void 0:z.accept)!=null&&H.startsWith("video/"))&&l(!0),S&&typeof((K=S.metadata)==null?void 0:K.mimeType)=="string"&&(S.metadata.mimeType.startsWith("video/")?l(!0):l(!1))},[i,S]),i.status==="error")return d.jsx(Xt,{path:e,error:i.error,type:t});if(s.status==="error")return d.jsx(it,{path:e,error:s.error,schema:i});if(s.status=="not-found"||i.status==="not-found")return d.jsx(Mn,{path:e,type:t});if(i.status==="loading")return d.jsx(yt,{path:e,type:t});if(n===void 0)return d.jsx(yt,{path:e,type:t});if(i.data.type!==t)return d.jsx(kr,{path:e,expectedType:t,actualType:i.data.type});const N=s.data;if(N===void 0)return d.jsx(Mn,{path:e,type:t});const _=i.data.type==="file"&&i.data.remote&&o.status!=="ready",O=i.data.remote&&o.status==="ready"&&r?{publicProjectId:o.publicProjectId,coreVersion:o.coreVersion,bucket:r,schema:i.data,remoteHost:n.remoteHost}:null;let M=null;if(N!=null&&N._ref)if(i.data.remote){const z=Y.remote.splitRemoteRef(N==null?void 0:N._ref);z.status==="success"&&(M=z.filePath)}else M=N==null?void 0:N._ref;let D=null;return M&&(D=M.split("/").slice(-1)[0]),d.jsxs("div",{id:e,children:[d.jsx(qr,{path:e}),c&&d.jsx("div",{className:"p-4 rounded bg-bg-error-primary text-fg-error-primary",children:c}),d.jsxs("div",{className:"grid gap-2",children:[D&&d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsx("div",{className:"text-sm text-fg-secondary",children:D}),p&&d.jsx(Gr,{className:`animate-spin text-fg-secondary ${p?"block":"hidden"}`,size:16}),b!==null&&d.jsxs("div",{className:"text-sm text-fg-secondary",children:[b,"%"]})]}),d.jsxs("div",{className:"flex gap-4 items-center",children:[N&&(a?d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsx("video",{className:"w-full h-auto rounded-lg",controls:!0,src:De in N&&N[De]==="remote"?Y.convertRemoteSource({...N,[De]:"remote"}).url:Y.convertFileSource({...N,[De]:"file"}).url}),d.jsx(qe,{asChild:!0,variant:"secondary",children:d.jsx("label",{htmlFor:`file_input:${e}`,children:"Upload"})})]}):d.jsxs(d.Fragment,{children:[d.jsx(qe,{asChild:!0,variant:"secondary",children:d.jsx("label",{htmlFor:`file_input:${e}`,children:"Upload"})}),d.jsxs("a",{className:"flex gap-2 items-center",target:"_blank",rel:"noopener noreferrer",download:D,href:De in N&&N[De]==="remote"?Y.convertRemoteSource({...N,[De]:"remote"}).url:Y.convertFileSource({...N,[De]:"file"}).url,children:[d.jsx("span",{children:" Open file"}),d.jsx(xK,{})]})]})),d.jsx("input",{disabled:_,hidden:!0,id:`file_input:${e}`,type:"file",accept:(U=i.data.options)==null?void 0:U.accept,onChange:z=>{NX(z).then(H=>{var j;const K="file",V=f;h(H.src),m(!0);const I={src:H.src,filename:H.filename};let A;H.mimeType&&(A={mimeType:H.mimeType}),u(null),LI(v,I.src,I.filename??null,H.fileHash,A,K,O,(j=n.files)==null?void 0:j.directory).then(L=>{m(!0),w(0),x(L,K,$=>{h(V),u($)},($,W,G,_e)=>{const ke=$*(G+1)/(W*_e);w(Math.round(ke*100))}).finally(()=>{w(null),m(!1)})}).catch(L=>{console.error("Failed to create file patch",L),m(!1),h(V),u("Could not upload file. Please try again later")}),z.target.value=""})}})]})]})]})}function TX({path:e}){const t=lt(e,"image");return t.status==="error"?d.jsx(it,{path:e,error:t.error}):!("data"in t)||t.data===void 0?d.jsx(wr,{path:e}):t.data===null?d.jsx(Sr,{path:e}):d.jsx(o2,{size:12})}function OX({path:e}){var H,K,V,I;const t="image",n=Gu(),r=RS(),o=AS(),i=Ft(e),s=lt(e,t),[a,l]=g.useState(void 0),[c,u]=g.useState(null),[f,h]=g.useState(null),[p,m]=g.useState(!1),{addPatch:v,patchPath:x,addAndUploadPatchWithFileOps:b}=bn(e),[w,S]=g.useState(null),C="data"in s&&s.data,N=s.status==="success"&&s.clientSideOnly;if(g.useEffect(()=>{if(C)if(C.metadata){if(!N){const j=De in C&&C[De]==="remote"?Y.convertRemoteSource({...C,[De]:"remote"}).url:Y.convertFileSource({...C,[De]:"file"}).url;h(j),m(!1)}const A=C.metadata;if(typeof A.width!="number"||typeof A.height!="number"){console.warn(`Expected metadata width and height to be numbers but width was: ${typeof A.width} and height was: ${typeof A.height}`);return}if("hotspot"in A){if(typeof A.hotspot=="object"&&A.hotspot&&"x"in A.hotspot&&"y"in A.hotspot){const{x:j,y:L}=A.hotspot;typeof j=="number"&&typeof L=="number"?l({x:j,y:L}):console.warn(`Expected hotspot to have x and y as numbers but x was: ${typeof j} and y: ${typeof L}`)}}else l(void 0)}else l(void 0)},[s]),i.status==="error")return d.jsx(Xt,{path:e,error:i.error,type:t});if(s.status==="error")return d.jsx(it,{path:e,error:s.error,schema:i});if(s.status=="not-found"||i.status==="not-found")return d.jsx(Mn,{path:e,type:t});if(i.status==="loading")return d.jsx(yt,{path:e,type:t});if(n===void 0)return d.jsx(yt,{path:e,type:t});if(i.data.type!==t)return d.jsx(kr,{path:e,expectedType:t,actualType:i.data.type});const P=s.data;if(P===void 0)return d.jsx(Mn,{path:e,type:t});const O=i.data.type==="image"&&i.data.remote&&r.status!=="ready",M=i.data.remote&&r.status==="ready"&&o?{publicProjectId:r.publicProjectId,bucket:o,coreVersion:r.coreVersion,schema:i.data,remoteHost:n.remoteHost}:null,D=Y.createValPathOfItem(e,"metadata"),U=Y.createValPathOfItem(D,"alt"),z=Y.createValPathOfItem(D,"hotspot");return d.jsxs("div",{id:e,children:[d.jsx(qr,{path:e}),c&&d.jsx("div",{className:"p-4 rounded bg-bg-error-primary text-fg-error-primary",children:c}),i.data.type==="image"&&i.data.remote&&r.status==="inactive"&&d.jsx("div",{className:"p-4 rounded bg-bg-error-primary text-fg-error-primary",children:MX(r.reason)}),d.jsxs("div",{className:"flex flex-col gap-2",children:[P&&d.jsxs("div",{className:"",children:[d.jsx("span",{id:U,children:"Alt text"}),d.jsx(Zu,{value:(H=P.metadata)!=null&&H.alt&&typeof((K=P.metadata)==null?void 0:K.alt)=="string"?(V=P.metadata)==null?void 0:V.alt:"",disabled:O,onChange:A=>{const j=A.target.value;P.metadata&&"alt"in P.metadata?v([{op:"replace",value:j,path:x.concat(["metadata","alt"])}],"string"):P.metadata&&!("alt"in P.metadata)?v([{op:"add",value:j,path:x.concat(["metadata","alt"])}],"string"):P.metadata===void 0?v([{op:"add",value:{...a?{hotspot:a}:{},alt:j},path:x.concat(["metadata"])}],"object"):console.warn(`Expected source.metadata to be an object but got ${typeof P.metadata}`)}})]}),P&&f&&d.jsxs("div",{className:"relative rounded-lg bg-bg-secondary",children:[p&&d.jsxs("div",{className:"flex absolute inset-0 flex-col justify-center items-center",children:[d.jsx("div",{className:"absolute inset-0 w-full h-full opacity-50 bg-bg-secondary"}),d.jsx(Gr,{size:24,className:"animate-spin"}),d.jsx("div",{className:"mt-2 text-xs font-thin text-[white] z-5",children:w!==null?`${w}%`:""})]}),d.jsx("img",{src:f,draggable:!1,className:"object-contain max-h-[500px] w-full",style:{cursor:"crosshair"},id:z,onClick:A=>{const{width:j,height:L,left:$,top:W}=A.currentTarget.getBoundingClientRect(),G={x:Math.max((A.clientX-6-$)/j,0),y:Math.max((A.clientY-6-W)/L,0)};P.metadata&&"hotspot"in P.metadata?v([{op:"replace",path:x.concat(["metadata","hotspot"]),value:G}],"object"):P.metadata?v([{op:"add",path:x.concat(["metadata","hotspot"]),value:G}],"object"):P.metadata===void 0?v([{op:"add",value:{...G?{hotspot:G}:{}},path:x.concat(["metadata"])}],"object"):console.warn(`Expected source.metadata to be an object but got ${typeof P.metadata}`)}}),a&&d.jsx("div",{className:"rounded-full h-[12px] w-[12px] bg-background mix-blend-difference border-bg-brand-primary border-2 absolute pointer-events-none",style:{top:`${a.y*100}%`,left:`${a.x*100}%`}})]}),d.jsx(qe,{asChild:!0,variant:"secondary",children:d.jsx("label",{htmlFor:`img_input:${e}`,children:"Upload"})}),d.jsx("input",{disabled:s.status==="loading",hidden:!0,id:`img_input:${e}`,type:"file",accept:((I=i.data.options)==null?void 0:I.accept)||"image/*",onChange:A=>{DI(A).then(j=>{var _e,ke;const L="image",$=f;h(j.src),m(!0);const W={src:j.src,filename:j.filename};let G;j.width&&j.height&&j.mimeType&&(G={width:j.width,height:j.height,mimeType:j.mimeType,alt:C&&typeof((_e=C==null?void 0:C.metadata)==null?void 0:_e.alt)=="string"?C.metadata.alt:void 0}),u(null),LI(x,W.src,W.filename??null,j.fileHash,G,L,M,(ke=n.files)==null?void 0:ke.directory).then(Ve=>{m(!0),S(0),b(Ve,L,Z=>{h($),u(Z)},(Z,J,ce,Ne)=>{const he=Z*(ce+1)/(J*Ne);S(Math.round(he*100))}).finally(()=>{S(null),m(!1)})}).catch(Ve=>{console.error("Failed to create file patch",Ve),m(!1),h($),u("Could not upload file. Please try again later")}),A.target.value=""})}})]})]})}function MX(e){switch(e){case"api-key-missing":return"Val is running in production mode. To upload remote files and images, the VAL_API_KEY env must be set. Contact a developer to fix this issue.";case"error-could-not-get-settings":return`Could not get settings from the Val remote server. This means that updating or changing certain types of files and images might not work. Check your internet connection and try again. (Error code: ${e})`;case"no-internet-connection":return"Cannot upload remote files and images, since this requires an internet connection";case"pat-error":return"Val is running in development mode. To upload remote files and images, you must either login (by running `npx -p @valbuild/cli val login`) or set the VAL_API_KEY env";case"project-not-configured":return"Project is not configured. To upload remote files and images, the val.config must contain a project id that is obtained from https://app.val.build. Contact a developer to fix this issue.";case"unauthorized":return"Cannot upload remote files and images since you are unauthorized";case"unauthorized-personal-access-token-error":return"Cannot upload remote files and images since the personal access token is unauthorized. Try to login again by running `npx -p @valbuild/cli val login`";case"unknown-error":return"Unknown error";default:return e}}function RX({path:e}){const t=lt(e,"image");if(t.status==="error")return d.jsx(it,{path:e,error:t.error});if(!("data"in t)||t.data===void 0)return d.jsx(wr,{path:e});if(t.data===null)return d.jsx(Sr,{path:e});const n=t.data;return d.jsx("img",{src:De in n&&n[De]==="remote"?Y.convertRemoteSource({...n,[De]:"remote"}).url:Y.convertFileSource({...n,[De]:"file"}).url,draggable:!1,className:"object-contain max-w-[60px] max-h-[60px] rounded-lg"})}function AX({path:e}){var h;const t="keyOf",{navigate:n}=xn(),r=Ft(e),o="data"in r&&r.data&&r.data.type==="keyOf"?{type:(h=r.data.schema)==null?void 0:h.type,path:r.data.path}:void 0,i=lt(o==null?void 0:o.path,o==null?void 0:o.type),s=lt(e,t),{patchPath:a,addPatch:l}=bn(e),c=In();if(r.status==="error")return d.jsx(Xt,{path:e,error:r.error,type:t});if(s.status==="error")return d.jsx(it,{path:e,error:s.error,schema:r});if(i.status==="error")return d.jsx(it,{path:e,error:i.error,schema:r});if(s.status=="not-found"||r.status==="not-found")return d.jsx(Mn,{path:e,type:t});if(o!==void 0&&!(o.type==="record"||o.type==="object"))return d.jsx(Xt,{path:o.path,error:`Cannot refer to keyOf type: ${o.type}. Must refer to be record or object`});if(o!==void 0&&i.status==="not-found")return d.jsx(Xt,{path:o.path,error:"Referenced source not found",type:o.type});if(!("data"in s)||s.data===void 0)return d.jsx(yt,{path:e,type:t});if("data"in r&&r.data&&r.data.type!==t)return d.jsx(kr,{path:e,expectedType:t,actualType:r.data.type});if(!i)return d.jsx(Xt,{path:o==null?void 0:o.path,error:"Referenced source not found",type:"keyOf"});if("data"in i&&i.data===null)return d.jsx(Xt,{path:o==null?void 0:o.path,error:"Referenced source is null",type:"keyOf"});const u="data"in i&&i.data?Object.keys(i.data):void 0,f=s.data;return d.jsxs("div",{id:e,children:[d.jsx(qr,{path:e}),d.jsxs("div",{className:"flex justify-between items-center",children:[d.jsxs(Ey,{value:f??"",onValueChange:p=>{l([{op:"replace",path:a,value:p}],t)},children:[d.jsx(gp,{children:d.jsx(Cy,{children:f})}),d.jsx(vp,{className:"w-32",container:c,children:r.status==="loading"||o==null||u===void 0?d.jsx(IX,{}):u.map(p=>d.jsx(yp,{value:p,children:p},p))})]}),f&&(o==null?void 0:o.path)&&d.jsx("button",{title:"Go to reference",className:"px-2",onClick:()=>{n(Y.createValPathOfItem(o.path,f))},children:d.jsx(BS,{size:16})})]}),u&&u.length>0&&f!==null&&!u.includes(f)&&d.jsxs("div",{className:"flex gap-2 p-2 py-3 mt-2 rounded-md bg-bg-error-primary text-fg-error-primary",children:[d.jsxs("span",{className:"line-clamp-1",children:["Value must be one of: ",u.join(", ")," ",u.join(", "),u.join(", "),u.join(", "),u.join(", "),u.join(", "),u.join(", ")]}),d.jsx("span",{className:"flex-shrink-0",children:d.jsx(Su,{size:16})})]})]})}function IX(){return d.jsx("span",{children:"Loading..."})}function DX({path:e}){const t=lt(e,"keyOf");return t.status==="error"?d.jsx(it,{path:e,error:t.error}):!("data"in t)||t.data===void 0?d.jsx(wr,{path:e}):t.data===null?d.jsx(Sr,{path:e}):d.jsx("div",{className:"truncate",children:t.data})}function FI({className:e,classNames:t,captionLayout:n,showOutsideDays:r=!0,...o}){const i=o.fromDate&&o.toDate;return d.jsx(IU,{showOutsideDays:r,captionLayout:n,className:fe("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex flex-row justify-center pt-1 relative items-center",caption_dropdowns:"flex flex-row space-x-2",caption_label:`text-sm font-medium ${i?"hidden":""}`,nav:"space-x-1 flex items-center",dropdown_month:"flex flex-row text-accent justify-between text-[0.8rem]",dropdown_year:"flex flex-row text-accent justify-between text-[0.8rem]",dropdown:"bg-transparent border-solid rounded-md border-2 border-secondary",nav_button:fe(qb({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:fe(qb({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-fg-primary hover:bg-primary hover:text-fg-primary focus:text-fg-primary",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",...t},components:{IconLeft:()=>d.jsx(G7,{className:"w-4 h-4"}),IconRight:()=>d.jsx(Xu,{className:"w-4 h-4"}),Dropdown:({caption:s,children:a,value:l,onChange:c})=>{const u=f=>{c&&c({target:{value:f}})};return d.jsx("div",{className:"flex flex-row space-x-2",children:d.jsxs(CI,{onValueChange:u,value:String(l),children:[d.jsx(yk,{asChild:!0,children:d.jsxs(qe,{variant:"ghost",size:"sm",children:[s,d.jsx(Ju,{className:"w-4 h-4"})]})}),d.jsx(xk,{className:"z-50 p-1 rounded-md bg-bg-secondary text-fg-secondary",children:d.jsx(NI,{className:"overflow-y-auto pr-4 pb-4 max-h-48 rounded-md shadow-lg bg-bg-tertiary text-fg-tertiary",children:g.Children.map(a,f=>{if(g.isValidElement(f)){const{value:h,children:p}=f.props;return d.jsx(bk,{value:String(h),className:"p-2 rounded-md cursor-pointer hover:bg-bg-secondary-hover hover:text-fg-secondary",children:d.jsx(_I,{children:p})},h)}return null})})})]})})}},...o})}FI.displayName="Calendar";function LX({path:e}){var h,p;const t="date",n=Ft(e),r=lt(e,t),{patchPath:o,addPatch:i}=bn(e),[s,a]=g.useState(null),[l,c]=g.useState(!1),u=In();if(g.useEffect(()=>{if("data"in r&&r.data!==void 0)if(r.data===null)a(r.data);else try{const m=new Date(r.data);a(m)}catch{console.error("Cannot parse invalid date:",r.data)}},["data"in r&&r.data]),n.status==="error")return d.jsx(Xt,{path:e,error:n.error,type:t});if(r.status==="error")return d.jsx(it,{path:e,error:r.error,schema:n});if(r.status=="not-found"||n.status==="not-found")return d.jsx(Mn,{path:e,type:t});if(n.status==="loading")return d.jsx(yt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return d.jsx(yt,{path:e,type:t});if(n.data.type!==t)return d.jsx(kr,{path:e,expectedType:t,actualType:n.data.type});const f=n.data;return d.jsxs("div",{id:e,children:[d.jsx(qr,{path:e}),d.jsxs(br,{open:l,onOpenChange:m=>{c(m)},children:[d.jsx(xo,{asChild:!0,onClick:()=>{c(!0)},children:d.jsxs(qe,{variant:"outline",className:Ce("w-[280px] justify-start text-left font-normal bg-bg-primary hover:bg-bg-secondary"),children:[d.jsx(n2,{className:"w-4 h-4 mr-2"}),s?ps(s,"PPP"):d.jsx("span",{children:"Pick a date"})]})}),d.jsx(tr,{className:"w-auto p-0",container:u,children:d.jsx(FI,{mode:"single",captionLayout:"dropdown-buttons",defaultMonth:s??void 0,weekStartsOn:1,fromDate:(h=f.options)!=null&&h.from?new Date(f.options.from):void 0,toDate:(p=f.options)!=null&&p.to?new Date(f.options.to):void 0,selected:s||void 0,onSelect:m=>{m&&(a(m),i([{op:"replace",value:m.toISOString().slice(0,10),path:o}],f.type),c(!1))}})})]})]})}function FX({path:e}){const t=lt(e,"date");return t.status==="error"?d.jsx(it,{path:e,error:t.error}):!("data"in t)||t.data===void 0?d.jsx(wr,{path:e}):t.data===null?d.jsx(Sr,{path:e}):d.jsx("div",{className:"truncate",children:new Date(t.data).toLocaleString()})}function zX({path:e}){const t=lt(e,"literal");return t.status==="error"?d.jsx(it,{path:e,error:t.error}):!("data"in t)||t.data===void 0?d.jsx(wr,{path:e}):t.data===null?d.jsx(Sr,{path:e}):d.jsx("div",{id:e,className:"truncate",children:t.data})}function zI(e,t){for(const n in t)if(n.startsWith(e))return!0;return!1}function $I(){return d.jsx("div",{className:"w-2 h-2 rounded-full bg-bg-error-secondary"})}function BI({error:e}){return d.jsx("div",{className:"p-4 text-fg-error-primary bg-bg-error-primary",children:d.jsxs("div",{children:["Preview error: ",e]})})}function $X({path:e}){const t="record",n=Ql()||{},{navigate:r}=xn(),o=Ft(e),i=GR(e),s=lt(e,t);if(o.status==="error")return d.jsx(Xt,{path:e,error:o.error,type:t});if(s.status==="error")return d.jsx(it,{path:e,error:s.error,schema:o});if(s.status=="not-found"||o.status==="not-found")return d.jsx(Mn,{path:e,type:t});if(o.status==="loading")return d.jsx(yt,{path:e,type:t});if(!("data"in s)||s.data===void 0)return d.jsx(yt,{path:e,type:t});if(o.data.type!==t)return d.jsx(kr,{path:e,expectedType:t,actualType:o.data.type});const a=s.data,l=i&&"data"in i&&i.data&&i.data.layout==="list"&&i.data.parent==="record"?i.data:void 0;return d.jsxs("div",{id:e,children:[d.jsx(qr,{path:e}),(i==null?void 0:i.status)==="error"&&d.jsx(BI,{error:i.message,path:e}),l&&d.jsx(VX,{path:e,...l}),!l&&d.jsx("div",{className:"grid grid-cols-1 gap-4",children:a&&Object.entries(a).map(([c])=>d.jsxs("div",{onClick:()=>r(fa(e,c)),className:Ce("bg-primary-foreground cursor-pointer min-w-[320px] max-h-[170px] overflow-hidden rounded-md border border-border-primary p-4","hover:bg-bg-secondary-hover"),children:[d.jsxs("div",{className:"flex justify-between items-start",children:[d.jsx("div",{className:"pb-4 font-semibold text-md",children:c}),zI(fa(e,c),n)&&d.jsx($I,{})]}),d.jsx("div",{children:d.jsx(yE,{path:fa(e,c)})})]},c))})]})}function BX({title:e,image:t,subtitle:n}){return d.jsxs("div",{className:Ce("flex w-full items-start justify-between pl-4 flex-grow text-left"),children:[d.jsxs("div",{className:"flex flex-col flex-shrink py-4 overflow-x-clip",children:[d.jsx("div",{className:"text-lg font-medium",children:e}),n&&d.jsx("div",{className:"block overflow-hidden flex-shrink max-h-5 text-sm text-gray-500 text-ellipsis",children:n})]}),t&&d.jsx(UX,{src:t,alt:e})]})}function VX({path:e,items:t}){const{navigate:n}=xn();return d.jsx("div",{className:"flex flex-col space-y-4 w-full",children:t.map(([r,{title:o,subtitle:i,image:s}])=>d.jsx("button",{onClick:()=>n(fa(e,r)),className:Ce("hover:bg-bg-secondary-hover","border rounded-lg cursor-pointer border-border-primary"),children:d.jsx(BX,{title:o,subtitle:i,image:s})},r))})}function UX({src:e,alt:t}){var i;const[n,r]=g.useState(!1);if(e==null)return d.jsx("div",{className:"flex-shrink-0 ml-4 w-20 h-20 opacity-25 bg-bg-brand-secondary"});const o=e[De]==="file"?Y.convertFileSource(e).url:Y.convertRemoteSource(e).url;return d.jsxs("div",{className:"relative flex-shrink-0 ml-4 w-20 h-20",children:[!n&&d.jsx("div",{className:"absolute inset-0 opacity-25 bg-bg-brand-secondary animate-in"}),d.jsx("img",{src:o,alt:t,onLoad:()=>r(!0),onError:()=>r(!1),className:`absolute inset-0 object-cover w-full h-full rounded-r-lg ${n?"opacity-100":"opacity-0"}`,style:{objectPosition:(i=e.metadata)!=null&&i.hotspot?`${e.metadata.hotspot.x}% ${e.metadata.hotspot.y}%`:"",transition:"opacity 0.2s ease-in-out"}})]})}function WX({path:e}){const t=lt(e,"record");if(t.status==="error")return d.jsx(it,{path:e,error:t.error});if(!("data"in t)||t.data===void 0)return d.jsx(wr,{path:e});if(t.data===null)return d.jsx(Sr,{path:e});const n=Object.keys(t.data);return d.jsxs("div",{className:"text-left",children:[d.jsx("span",{className:"text-fg-brand-primary",children:n.length}),d.jsx("span",{className:"mr-1",children:` item${n.length===1?"":"s"}:`}),n.map((r,o)=>d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-fg-brand-primary",children:r},r),o<n.length-1?", ":""]}))]})}let Ny=()=>({events:{},emit(e,...t){(this.events[e]||[]).forEach(n=>n(...t))},on(e,t){return(this.events[e]=this.events[e]||[]).push(t),()=>this.events[e]=(this.events[e]||[]).filter(n=>n!==t)}});var cw={exports:{}};(function(e,t){var n=typeof Reflect<"u"?Reflect.construct:void 0,r=Object.defineProperty,o=Error.captureStackTrace;o===void 0&&(o=function(c){var u=new Error;r(c,"stack",{configurable:!0,get:function(){var h=u.stack;return r(this,"stack",{configurable:!0,value:h,writable:!0}),h},set:function(h){r(c,"stack",{configurable:!0,value:h,writable:!0})}})});function i(l){l!==void 0&&r(this,"message",{configurable:!0,value:l,writable:!0});var c=this.constructor.name;c!==void 0&&c!==this.name&&r(this,"name",{configurable:!0,value:c,writable:!0}),o(this,this.constructor)}i.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:i,writable:!0}});var s=function(){function l(u,f){return r(u,"name",{configurable:!0,value:f})}try{var c=function(){};if(l(c,"foo"),c.name==="foo")return l}catch{}}();function a(l,c){if(c==null||c===Error)c=i;else if(typeof c!="function")throw new TypeError("super_ should be a function");var u;if(typeof l=="string")u=l,l=n!==void 0?function(){return n(c,arguments,this.constructor)}:function(){c.apply(this,arguments)},s!==void 0&&(s(l,u),u=void 0);else if(typeof l!="function")throw new TypeError("constructor should be either a string or a function");l.super_=l.super=c;var f={constructor:{configurable:!0,value:l,writable:!0}};return u!==void 0&&(f.name={configurable:!0,value:u,writable:!0}),l.prototype=Object.create(c.prototype,f),l}t=e.exports=a,t.BaseError=i})(cw,cw.exports);var VI=cw.exports,dP="ProseMirror-selectednode",UI="",ea="\0",fP="__state_override__",HX={LastNodeCompatible:"lastNodeCompatible",FormattingMark:"formattingMark",FormattingNode:"formattingNode",NodeCursor:"nodeCursor",FontStyle:"fontStyle",Link:"link",Color:"color",Alignment:"alignment",Indentation:"indentation",Behavior:"behavior",Code:"code",InlineNode:"inline",ListContainerNode:"listContainer",ListItemNode:"listItemNode",Block:"block",BlockNode:"block",TextBlock:"textBlock",ExcludeInputRules:"excludeFromInputRules",PreventExits:"preventsExits",Media:"media"},He=HX,ds=Symbol.for("__remirror__"),gn=(e=>(e.PlainExtension="RemirrorPlainExtension",e.NodeExtension="RemirrorNodeExtension",e.MarkExtension="RemirrorMarkExtension",e.PlainExtensionConstructor="RemirrorPlainExtensionConstructor",e.NodeExtensionConstructor="RemirrorNodeExtensionConstructor",e.MarkExtensionConstructor="RemirrorMarkExtensionConstructor",e.Manager="RemirrorManager",e.Preset="RemirrorPreset",e.PresetConstructor="RemirrorPresetConstructor",e))(gn||{}),mt=(e=>(e[e.Critical=1e6]="Critical",e[e.Highest=1e5]="Highest",e[e.High=1e4]="High",e[e.Medium=1e3]="Medium",e[e.Default=100]="Default",e[e.Low=10]="Low",e[e.Lowest=0]="Lowest",e))(mt||{}),lr=(e=>(e[e.None=0]="None",e[e.Create=1]="Create",e[e.EditorView=2]="EditorView",e[e.Runtime=3]="Runtime",e[e.Destroy=4]="Destroy",e))(lr||{}),oe=(e=>(e.Undo="_|undo|_",e.Redo="_|redo|_",e.Bold="_|bold|_",e.Italic="_|italic|_",e.Underline="_|underline|_",e.Strike="_|strike|_",e.Code="_|code|_",e.Paragraph="_|paragraph|_",e.H1="_|h1|_",e.H2="_|h2|_",e.H3="_|h3|_",e.H4="_|h4|_",e.H5="_|h5|_",e.H6="_|h6|_",e.TaskList="_|task|_",e.BulletList="_|bullet|_",e.OrderedList="_|number|_",e.Quote="_|quote|_",e.Divider="_|divider|_",e.Codeblock="_|codeblock|_",e.ClearFormatting="_|clear|_",e.Superscript="_|sup|_",e.Subscript="_|sub|_",e.LeftAlignment="_|left-align|_",e.CenterAlignment="_|center-align|_",e.RightAlignment="_|right-align|_",e.JustifyAlignment="_|justify-align|_",e.InsertLink="_|link|_",e.Find="_|find|_",e.FindBackwards="_|find-backwards|_",e.FindReplace="_|find-replace|_",e.AddFootnote="_|footnote|_",e.AddComment="_|comment|_",e.ContextMenu="_|context-menu|_",e.IncreaseFontSize="_|inc-font-size|_",e.DecreaseFontSize="_|dec-font-size|_",e.IncreaseIndent="_|indent|_",e.DecreaseIndent="_|dedent|_",e.Shortcuts="_|shortcuts|_",e.Copy="_|copy|_",e.Cut="_|cut|_",e.Paste="_|paste|_",e.PastePlain="_|paste-plain|_",e.SelectAll="_|select-all|_",e.Format="_|format|_",e))(oe||{}),re=(e=>(e.PROD="RMR0000",e.UNKNOWN="RMR0001",e.INVALID_COMMAND_ARGUMENTS="RMR0002",e.CUSTOM="RMR0003",e.CORE_HELPERS="RMR0004",e.MUTATION="RMR0005",e.INTERNAL="RMR0006",e.MISSING_REQUIRED_EXTENSION="RMR0007",e.MANAGER_PHASE_ERROR="RMR0008",e.INVALID_GET_EXTENSION="RMR0010",e.INVALID_MANAGER_ARGUMENTS="RMR0011",e.SCHEMA="RMR0012",e.HELPERS_CALLED_IN_OUTER_SCOPE="RMR0013",e.INVALID_MANAGER_EXTENSION="RMR0014",e.DUPLICATE_COMMAND_NAMES="RMR0016",e.DUPLICATE_HELPER_NAMES="RMR0017",e.NON_CHAINABLE_COMMAND="RMR0018",e.INVALID_EXTENSION="RMR0019",e.INVALID_CONTENT="RMR0021",e.INVALID_NAME="RMR0050",e.EXTENSION="RMR0100",e.EXTENSION_SPEC="RMR0101",e.EXTENSION_EXTRA_ATTRIBUTES="RMR0102",e.INVALID_SET_EXTENSION_OPTIONS="RMR0103",e.REACT_PROVIDER_CONTEXT="RMR0200",e.REACT_GET_ROOT_PROPS="RMR0201",e.REACT_EDITOR_VIEW="RMR0202",e.REACT_CONTROLLED="RMR0203",e.REACT_NODE_VIEW="RMR0204",e.REACT_GET_CONTEXT="RMR0205",e.REACT_COMPONENTS="RMR0206",e.REACT_HOOKS="RMR0207",e.I18N_CONTEXT="RMR0300",e))(re||{}),KX=function(t){return GX(t)&&!qX(t)};function GX(e){return!!e&&typeof e=="object"}function qX(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||XX(e)}var YX=typeof Symbol=="function"&&Symbol.for,JX=YX?Symbol.for("react.element"):60103;function XX(e){return e.$$typeof===JX}function ZX(e){return Array.isArray(e)?[]:{}}function bh(e,t){return t.clone!==!1&&t.isMergeableObject(e)?Pu(ZX(e),e,t):e}function QX(e,t,n){return e.concat(t).map(function(r){return bh(r,n)})}function eZ(e,t){if(!t.customMerge)return Pu;var n=t.customMerge(e);return typeof n=="function"?n:Pu}function tZ(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function hP(e){return Object.keys(e).concat(tZ(e))}function WI(e,t){try{return t in e}catch{return!1}}function nZ(e,t){return WI(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function rZ(e,t,n){var r={};return n.isMergeableObject(e)&&hP(e).forEach(function(o){r[o]=bh(e[o],n)}),hP(t).forEach(function(o){nZ(e,o)||(WI(e,o)&&n.isMergeableObject(t[o])?r[o]=eZ(o,n)(e[o],t[o],n):r[o]=bh(t[o],n))}),r}function Pu(e,t,n){n=n||{},n.arrayMerge=n.arrayMerge||QX,n.isMergeableObject=n.isMergeableObject||KX,n.cloneUnlessOtherwiseSpecified=bh;var r=Array.isArray(t),o=Array.isArray(e),i=r===o;return i?r?n.arrayMerge(e,t,n):rZ(e,t,n):bh(t,n)}Pu.all=function(t,n){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(r,o){return Pu(r,o,n)},{})};var oZ=Pu,iZ=oZ;const sZ=Da(iZ);/*!
|
|
465
|
-
* isobject <https://github.com/jonschlinkert/isobject>
|
|
466
|
-
*
|
|
467
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
468
|
-
* Released under the MIT License.
|
|
469
|
-
*/var HI=function(t){return t!=null&&typeof t=="object"&&Array.isArray(t)===!1};/*!
|
|
470
|
-
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
471
|
-
*
|
|
472
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
473
|
-
* Released under the MIT License.
|
|
474
|
-
*/var aZ=HI;function pP(e){return aZ(e)===!0&&Object.prototype.toString.call(e)==="[object Object]"}var lZ=function(t){var n,r;return!(pP(t)===!1||(n=t.constructor,typeof n!="function")||(r=n.prototype,pP(r)===!1)||r.hasOwnProperty("isPrototypeOf")===!1)};/*!
|
|
475
|
-
* is-extendable <https://github.com/jonschlinkert/is-extendable>
|
|
476
|
-
*
|
|
477
|
-
* Copyright (c) 2015-2017, Jon Schlinkert.
|
|
478
|
-
* Released under the MIT License.
|
|
479
|
-
*/var cZ=lZ,uZ=function(t){return cZ(t)||typeof t=="function"||Array.isArray(t)};/*!
|
|
480
|
-
* object.omit <https://github.com/jonschlinkert/object.omit>
|
|
481
|
-
*
|
|
482
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
483
|
-
* Released under the MIT License.
|
|
484
|
-
*/var dZ=uZ,fZ=function(t,n,r){if(!dZ(t))return{};typeof n=="function"&&(r=n,n=[]),typeof n=="string"&&(n=[n]);for(var o=typeof r=="function",i=Object.keys(t),s={},a=0;a<i.length;a++){var l=i[a],c=t[l];(!n||n.indexOf(l)===-1&&(!o||r(c,l,t)))&&(s[l]=c)}return s};const Sk=Da(fZ);/*!
|
|
485
|
-
* object.pick <https://github.com/jonschlinkert/object.pick>
|
|
486
|
-
*
|
|
487
|
-
* Copyright (c) 2014-2015 Jon Schlinkert, contributors.
|
|
488
|
-
* Licensed under the MIT License
|
|
489
|
-
*/var hZ=HI,pZ=function(t,n){if(!hZ(t)&&typeof t!="function")return{};var r={};if(typeof n=="string")return n in t&&(r[n]=t[n]),r;for(var o=n.length,i=-1;++i<o;){var s=n[i];s in t&&(r[s]=t[s])}return r};const uw=Da(pZ),KI=/^[a-zà-öø-ÿ]+|[A-ZÀ-ÖØ-ß][a-zà-öø-ÿ]+|[a-zà-öø-ÿ]+|[0-9]+|[A-ZÀ-ÖØ-ß]+(?![a-zà-öø-ÿ])/g,mZ=/\S+/g;function gZ(e,t){const n={parts:[],prefixes:[]},r=e.matchAll(t);let o=0;for(const s of r){if(typeof s.index!="number")continue;const a=s[0];n.parts.push(a);const l=e.slice(o,s.index).trim();n.prefixes.push(l),o=s.index+a.length}const i=e.slice(o).trim();return i&&(n.parts.push(""),n.prefixes.push(i)),n}function GI(e,t){const{keepSpecialCharacters:n=!1,keep:r,prefix:o=""}=t||{},i=e.trim().normalize("NFC"),s=i.includes(" "),l=gZ(i,s?mZ:KI);return l.parts.map((c,u)=>{let f=l.prefixes[u]||"",h=c;return n===!1&&(r&&(h=h.normalize("NFD").replace(new RegExp(`[^a-zA-ZØßø0-9${r.join("")}]`,"g"),"")),r||(h=h.normalize("NFD").replace(/[^a-zA-ZØßø0-9]/g,""),f="")),r&&(f=f.replace(new RegExp(`[^${r.join("")}]`,"g"),"")),u===0?f+h:!f&&!h?"":s&&!f&&o.match(/\s/)?" "+h:(f||o)+h}).filter(Boolean)}function vZ(e){const t=e.matchAll(KI).next().value,n=t?t.index:0;return e.slice(0,n+1).toUpperCase()+e.slice(n+1).toLowerCase()}function qI(e,t){return GI(e,t).reduce((n,r)=>n+vZ(r),"")}function mP(e,t){return GI(e,{...t,prefix:"-"}).join("").toLowerCase()}function dw(e,t,n,r){var o,i=!1,s=0;function a(){o&&clearTimeout(o)}function l(){a(),i=!0}typeof t!="boolean"&&(r=n,n=t,t=void 0);function c(){for(var u=arguments.length,f=new Array(u),h=0;h<u;h++)f[h]=arguments[h];var p=this,m=Date.now()-s;if(i)return;function v(){s=Date.now(),n.apply(p,f)}function x(){o=void 0}r&&!o&&v(),a(),r===void 0&&m>e?v():t!==!0&&(o=setTimeout(r?x:v,r===void 0?e-m:e))}return c.cancel=l,c}function yZ(e,t,n){return n===void 0?dw(e,t,!1):dw(e,n,t!==!1)}function It(e,t,n){const r=e[t];return YI(!_y(r),n),r}function YI(e,t){if(!e)throw new xZ(t)}var xZ=class extends VI.BaseError{constructor(){super(...arguments),this.name="AssertionError"}};function on(e){return Object.entries(e)}function wh(e){return Object.keys(e)}function Py(e){return Object.values(e)}function ni(e,t,n){return e.includes(t,n)}function Se(e){return Object.assign(Object.create(null),e)}function JI(e){return Object.prototype.toString.call(e)}function XI(e){return JI(e).slice(8,-1)}function xp(e,t){return n=>typeof n!==e?!1:t?t(n):!0}function kk(e){return t=>XI(t)===e}var _y=xp("undefined"),Fe=xp("string"),Yr=xp("number",e=>!Number.isNaN(e)),jt=xp("function");function bZ(e){return e===null}function wZ(e){return e===!0||e===!1}function ec(e){if(XI(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})}function SZ(e){return e==null||/^[bns]/.test(typeof e)}function Ta(e){return bZ(e)||_y(e)}function Gn(e){return!Ta(e)&&(jt(e)||xp("object")(e))}var kZ=kk("RegExp");function EZ(e){return kk("Map")(e)}function CZ(e){return kk("Set")(e)}function Kg(e){return Gn(e)&&!EZ(e)&&!CZ(e)&&Object.keys(e).length===0}var sn=Array.isArray;function Oa(e){return sn(e)&&e.length===0}function gP(e){return sn(e)&&e.length>0}function jy(e,t,n=r=>!!r){t.lastIndex=0;const r=[],o=t.flags;let i;o.includes("g")||(t=new RegExp(t.source,`g${o}`));do i=t.exec(e),i&&r.push(i);while(n(i));return t.lastIndex=0,r}function Gg(){const e=Date.now(),t=Gg.last||e;return Gg.last=e>t?e:t+1}Gg.last=0;function qg(e=""){return`${e}${Gg().toString(36)}`}function NZ(e){return Sk(e,t=>!_y(t))}function PZ(e){if(!ec(e))throw new Error("An invalid value was passed into this clone utility. Expected a plain object");return{...e}}function Sh(e,t=!1){const n=t?[...e].reverse():e,r=new Set(n);return t?[...r].reverse():[...r]}function ZI(){}function _Z(...e){return sZ.all(e,{isMergeableObject:ec})}function jZ({min:e,max:t,value:n}){return n<e?e:n>t?t:n}function TZ(e){return e[e.length-1]}function zl(e,t){return[...e].map((n,r)=>({value:n,index:r})).sort((n,r)=>t(n.value,r.value)||n.index-r.index).map(({value:n})=>n)}function OZ(e,t,n){try{if(Fe(t)&&t in e)return e[t];sn(t)&&(t=`['${t.join("']['")}']`);let r=e;return t.replace(/\[\s*(["'])(.*?)\1\s*]|^\s*(\w+)\s*(?=\.|\[|$)|\.\s*(\w*)\s*(?=\.|\[|$)|\[\s*(-?\d+)\s*]/g,(o,i,s,a,l,c)=>(r=r[s||a||l||c],"")),r===void 0?n:r}catch{return n}}function MZ(e,t){const n=PZ(t);let r=n;for(const[o,i]of e.entries()){const s=o>=e.length-1;let a=r[i];if(s){if(sn(r)){const l=Number.parseInt(i.toString(),10);Yr(l)&&r.splice(l,1)}else Reflect.deleteProperty(r,i);return n}if(SZ(a))return n;a=sn(a)?[...a]:{...a},r[i]=a,r=a}return n}function RZ(e){return t=>OZ(t,e)}function QI(e,t,n=!1){const r=[],o=new Set,i=jt(t)?t:RZ(t),s=n?[...e].reverse():e;for(const a of s){const l=i(a);o.has(l)||(o.add(l),r.push(a))}return n?r.reverse():r}function eD(e,t){const n=sn(e)?e[0]:e;return Yr(t)?n<=t?Array.from({length:t+1-n},(r,o)=>o+n):Array.from({length:n+1-t},(r,o)=>-1*o+n):Array.from({length:Math.abs(n)},(r,o)=>(n<0?-1:1)*o)}function vP(e,...t){const n=t.filter(Yr);return e>=Math.min(...n)&&e<=Math.max(...n)}function tD(e){return jt(e)?e():e}var nD="https://remirror.io/docs/errors",AZ={[re.UNKNOWN]:"An error occurred but we're not quite sure why. 🧐",[re.INVALID_COMMAND_ARGUMENTS]:"The arguments passed to the command method were invalid.",[re.CUSTOM]:"This is a custom error, possibly thrown by an external library.",[re.CORE_HELPERS]:"An error occurred in a function called from the `@remirror/core-helpers` library.",[re.MUTATION]:"Mutation of immutable value detected.",[re.INTERNAL]:"This is an error which should not occur and is internal to the remirror codebase.",[re.MISSING_REQUIRED_EXTENSION]:"Your editor is missing a required extension.",[re.MANAGER_PHASE_ERROR]:"This occurs when accessing a method or property before it is available.",[re.INVALID_GET_EXTENSION]:"The user requested an invalid extension from the getExtensions method. Please check the `createExtensions` return method is returning an extension with the defined constructor.",[re.INVALID_MANAGER_ARGUMENTS]:"Invalid value(s) passed into `Manager` constructor. Only `Presets` and `Extensions` are supported.",[re.SCHEMA]:"There is a problem with the schema or you are trying to access a node / mark that doesn't exists.",[re.HELPERS_CALLED_IN_OUTER_SCOPE]:"The `helpers` method which is passed into the ``create*` method should only be called within returned method since it relies on an active view (not present in the outer scope).",[re.INVALID_MANAGER_EXTENSION]:"You requested an invalid extension from the manager.",[re.DUPLICATE_COMMAND_NAMES]:"Command method names must be unique within the editor.",[re.DUPLICATE_HELPER_NAMES]:"Helper method names must be unique within the editor.",[re.NON_CHAINABLE_COMMAND]:"Attempted to chain a non chainable command.",[re.INVALID_EXTENSION]:"The provided extension is invalid.",[re.INVALID_CONTENT]:"The content provided to the editor is not supported.",[re.INVALID_NAME]:"An invalid name was used for the extension.",[re.EXTENSION]:"An error occurred within an extension. More details should be made available.",[re.EXTENSION_SPEC]:"The spec was defined without calling the `defaults`, `parse` or `dom` methods.",[re.EXTENSION_EXTRA_ATTRIBUTES]:"Extra attributes must either be a string or an object.",[re.INVALID_SET_EXTENSION_OPTIONS]:"A call to `extension.setOptions` was made with invalid keys.",[re.REACT_PROVIDER_CONTEXT]:"`useRemirrorContext` was called outside of the `remirror` context. It can only be used within an active remirror context created by the `<Remirror />`.",[re.REACT_GET_ROOT_PROPS]:"`getRootProps` has been attached to the DOM more than once. It should only be attached to the dom once per editor.",[re.REACT_EDITOR_VIEW]:"A problem occurred adding the editor view to the dom.",[re.REACT_CONTROLLED]:"There is a problem with your controlled editor setup.",[re.REACT_NODE_VIEW]:"Something went wrong with your custom ReactNodeView Component.",[re.REACT_GET_CONTEXT]:"You attempted to call `getContext` provided by the `useRemirror` prop during the first render of the editor. This is not possible and should only be after the editor first mounts.",[re.REACT_COMPONENTS]:"An error occurred within a remirror component.",[re.REACT_HOOKS]:"An error occurred within a remirror hook.",[re.I18N_CONTEXT]:"You called `useI18n()` outside of an `I18nProvider` context."};function IZ(e){return Fe(e)&&ni(Py(re),e)}function DZ(e,t){const n=AZ[e],r=n?`${n}
|
|
490
|
-
|
|
491
|
-
`:"",o=t?`${t}
|
|
492
|
-
|
|
493
|
-
`:"";return`${r}${o}For more information visit ${nD}#${e.toLowerCase()}`}var rD=class extends VI.BaseError{constructor({code:e,message:t,disableLogging:n=!1}={}){const r=IZ(e)?e:re.CUSTOM;super(DZ(r,t)),this.errorCode=r,this.url=`${nD}#${r.toLowerCase()}`,n||console.error(this.message)}static create(e={}){return new rD(e)}};function je(e,t){if(!e)throw rD.create(t)}function ll(e,t={}){return e}function En(e){this.content=e}En.prototype={constructor:En,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,o=r.find(e),i=r.content.slice();return o==-1?i.push(n||e,t):(i[o+1]=t,n&&(i[o]=n)),new En(i)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new En(n)},addToStart:function(e,t){return new En([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new En(n)},addBefore:function(e,t,n){var r=this.remove(t),o=r.content.slice(),i=r.find(e);return o.splice(i==-1?o.length:i,0,t,n),new En(o)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=En.from(e),e.size?new En(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=En.from(e),e.size?new En(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=En.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}};En.from=function(e){if(e instanceof En)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new En(t)};function oD(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let o=e.child(r),i=t.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){let s=oD(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function iD(e,t,n,r){for(let o=e.childCount,i=t.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=e.child(--o),a=t.child(--i),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let c=0,u=Math.min(s.text.length,a.text.length);for(;c<u&&s.text[s.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let c=iD(s.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class q{constructor(t,n){if(this.content=t,this.size=n||0,n==null)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,n,r,o=0,i){for(let s=0,a=0;a<n;s++){let l=this.content[s],c=a+l.nodeSize;if(c>t&&r(l,o+a,i||null,s)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,t-u),Math.min(l.content.size,n-u),r,o+u)}a=c}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,r,o){let i="",s=!0;return this.nodesBetween(t,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(t,l)-l,n-l):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<t.content.length;i++)o.push(t.content[i]);return new q(o,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],o=0;if(n>t)for(let i=0,s=0;s<n;i++){let a=this.content[i],l=s+a.nodeSize;l>t&&((s<t||l>n)&&(a.isText?a=a.cut(Math.max(0,t-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,t-s-1),Math.min(a.content.size,n-s-1))),r.push(a),o+=a.nodeSize),s=l}return new q(r,o)}cutByIndex(t,n){return t==n?q.empty:t==0&&n==this.content.length?this:new q(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[t]=n,new q(o,i)}addToStart(t){return new q([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new q(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(t.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let n=this.content[t];if(!n)throw new RangeError("Index "+t+" out of range for "+this);return n}maybeChild(t){return this.content[t]||null}forEach(t){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];t(o,r,n),r+=o.nodeSize}}findDiffStart(t,n=0){return oD(this,t,n)}findDiffEnd(t,n=this.size,r=t.size){return iD(this,t,n,r)}findIndex(t,n=-1){if(t==0)return am(0,t);if(t==this.size)return am(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let r=0,o=0;;r++){let i=this.child(r),s=o+i.nodeSize;if(s>=t)return s==t||n>0?am(r+1,s):am(r,o);o=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return q.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new q(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return q.empty;let n,r=0;for(let o=0;o<t.length;o++){let i=t[o];r+=i.nodeSize,o&&i.isText&&t[o-1].sameMarkup(i)?(n||(n=t.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new q(n||t,r)}static from(t){if(!t)return q.empty;if(t instanceof q)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new q([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}q.empty=new q([],0);const a0={index:0,offset:0};function am(e,t){return a0.index=e,a0.offset=t,a0}function Yg(e,t){if(e===t)return!0;if(!(e&&typeof e=="object")||!(t&&typeof t=="object"))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!Yg(e[r],t[r]))return!1}else{for(let r in e)if(!(r in t)||!Yg(e[r],t[r]))return!1;for(let r in t)if(!(r in e))return!1}return!0}class ot{constructor(t,n){this.type=t,this.attrs=n}addToSet(t){let n,r=!1;for(let o=0;o<t.length;o++){let i=t[o];if(this.eq(i))return t;if(this.type.excludes(i.type))n||(n=t.slice(0,o));else{if(i.type.excludes(this.type))return t;!r&&i.type.rank>this.type.rank&&(n||(n=t.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=t.slice()),r||n.push(this),n}removeFromSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return t.slice(0,n).concat(t.slice(n+1));return t}isInSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return!0;return!1}eq(t){return this==t||this.type==t.type&&Yg(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=t.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let o=r.create(n.attrs);return r.checkAttrs(o.attrs),o}static sameSet(t,n){if(t==n)return!0;if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(n[r]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return ot.none;if(t instanceof ot)return[t];let n=t.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}}ot.none=[];class Jg extends Error{}class ae{constructor(t,n,r){this.content=t,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=aD(this.content,t+this.openStart,n);return r&&new ae(r,this.openStart,this.openEnd)}removeBetween(t,n){return new ae(sD(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return ae.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ae(q.fromJSON(t,n.content),r,o)}static maxOpen(t,n=!0){let r=0,o=0;for(let i=t.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=t.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new ae(t,r,o)}}ae.empty=new ae(q.empty,0,0);function sD(e,t,n){let{index:r,offset:o}=e.findIndex(t),i=e.maybeChild(r),{index:s,offset:a}=e.findIndex(n);if(o==t||i.isText){if(a!=n&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(r,i.copy(sD(i.content,t-o-1,n-o-1)))}function aD(e,t,n,r){let{index:o,offset:i}=e.findIndex(t),s=e.maybeChild(o);if(i==t||s.isText)return e.cut(0,t).append(n).append(e.cut(t));let a=aD(s.content,t-i-1,n);return a&&e.replaceChild(o,s.copy(a))}function LZ(e,t,n){if(n.openStart>e.depth)throw new Jg("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Jg("Inconsistent open depths");return lD(e,t,n,0)}function lD(e,t,n,r){let o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){let s=lD(e,t,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let s=e.parent,a=s.content;return yl(s,a.cut(0,e.parentOffset).append(n.content).append(a.cut(t.parentOffset)))}else{let{start:s,end:a}=FZ(n,e);return yl(i,uD(e,s,a,t,r))}else return yl(i,Xg(e,t,r))}function cD(e,t){if(!t.type.compatibleContent(e.type))throw new Jg("Cannot join "+t.type.name+" onto "+e.type.name)}function fw(e,t,n){let r=e.node(n);return cD(r,t.node(n)),r}function vl(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function _f(e,t,n,r){let o=(t||e).node(n),i=0,s=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(vl(e.nodeAfter,r),i++));for(let a=i;a<s;a++)vl(o.child(a),r);t&&t.depth==n&&t.textOffset&&vl(t.nodeBefore,r)}function yl(e,t){return e.type.checkContent(t),e.copy(t)}function uD(e,t,n,r,o){let i=e.depth>o&&fw(e,t,o+1),s=r.depth>o&&fw(n,r,o+1),a=[];return _f(null,e,o,a),i&&s&&t.index(o)==n.index(o)?(cD(i,s),vl(yl(i,uD(e,t,n,r,o+1)),a)):(i&&vl(yl(i,Xg(e,t,o+1)),a),_f(t,n,o,a),s&&vl(yl(s,Xg(n,r,o+1)),a)),_f(r,null,o,a),new q(a)}function Xg(e,t,n){let r=[];if(_f(null,e,n,r),e.depth>n){let o=fw(e,t,n+1);vl(yl(o,Xg(e,t,n+1)),r)}return _f(t,null,n,r),new q(r)}function FZ(e,t){let n=t.depth-e.openStart,o=t.node(n).copy(e.content);for(let i=n-1;i>=0;i--)o=t.node(i).copy(q.from(o));return{start:o.resolveNoCache(e.openStart+n),end:o.resolveNoCache(o.content.size-e.openEnd-n)}}class _u{constructor(t,n,r){this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,n=this.index(this.depth);if(n==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=t.child(n);return r?t.child(n).cut(r):o}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):t==0?null:this.parent.child(t-1)}posAtIndex(t,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<t;i++)o+=r.child(i).nodeSize;return o}marks(){let t=this.parent,n=this.index();if(t.content.size==0)return ot.none;if(this.textOffset)return t.child(n).marks;let r=t.maybeChild(n-1),o=t.maybeChild(n);if(!r){let a=r;r=o,o=a}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(t){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=t.parent.maybeChild(t.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(t){for(let n=this.depth;n>0;n--)if(this.start(n)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){if(t.pos<this.pos)return t.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);r>=0;r--)if(t.pos<=this.end(r)&&(!n||n(this.node(r))))return new $l(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let n=1;n<=this.depth;n++)t+=(t?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return t+":"+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,i=n;for(let s=t;;){let{index:a,offset:l}=s.content.findIndex(i),c=i-l;if(r.push(s,a,o+l),!c||(s=s.child(a),s.isText))break;i=c-1,o+=l+1}return new _u(n,r,i)}static resolveCached(t,n){let r=yP.get(t);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else yP.set(t,r=new zZ);let o=r.elts[r.i]=_u.resolve(t,n);return r.i=(r.i+1)%$Z,o}}class zZ{constructor(){this.elts=[],this.i=0}}const $Z=12,yP=new WeakMap;class $l{constructor(t,n,r){this.$from=t,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const BZ=Object.create(null);let ha=class hw{constructor(t,n,r,o=ot.none){this.type=t,this.attrs=n,this.marks=o,this.content=r||q.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,n,r,o=0){this.content.nodesBetween(t,n,r,o,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,n,r,o){return this.content.textBetween(t,n,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,n,r){return this.type==t&&Yg(this.attrs,n||t.defaultAttrs||BZ)&&ot.sameSet(this.marks,r||ot.none)}copy(t=null){return t==this.content?this:new hw(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new hw(this.type,this.attrs,this.content,t)}cut(t,n=this.content.size){return t==0&&n==this.content.size?this:this.copy(this.content.cut(t,n))}slice(t,n=this.content.size,r=!1){if(t==n)return ae.empty;let o=this.resolve(t),i=this.resolve(n),s=r?0:o.sharedDepth(n),a=o.start(s),c=o.node(s).content.cut(o.pos-a,i.pos-a);return new ae(c,o.depth-s,i.depth-s)}replace(t,n,r){return LZ(this.resolve(t),this.resolve(n),r)}nodeAt(t){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(t);if(n=n.maybeChild(r),!n)return null;if(o==t||n.isText)return n;t-=o+1}}childAfter(t){let{index:n,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(t);if(r<t)return{node:this.content.child(n),index:n,offset:r};let o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(t){return _u.resolveCached(this,t)}resolveNoCache(t){return _u.resolve(this,t)}rangeHasMark(t,n,r){let o=!1;return n>t&&this.nodesBetween(t,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),dD(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,r=q.empty,o=0,i=r.childCount){let s=this.contentMatchAt(t).matchFragment(r,o,i),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=o;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(t,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(t).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=ot.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),t=r.addToSet(t)}if(!ot.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(n=>n.toJSON())),t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(t.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(n.text,r)}let o=q.fromJSON(t,n.content),i=t.nodeType(n.type).create(n.attrs,o,r);return i.type.checkAttrs(i.attrs),i}};ha.prototype.text=void 0;class Zg extends ha{constructor(t,n,r,o){if(super(t,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):dD(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new Zg(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new Zg(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return t==0&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function dD(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class Bl{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new VZ(t,n);if(r.next==null)return Bl.empty;let o=fD(r);r.next&&r.err("Unexpected trailing text");let i=YZ(qZ(o));return JZ(i,r),i}matchType(t){for(let n=0;n<this.next.length;n++)if(this.next[n].type==t)return this.next[n].next;return null}matchFragment(t,n=0,r=t.childCount){let o=this;for(let i=n;o&&i<r;i++)o=o.matchType(t.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:n}=this.next[t];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(t){for(let n=0;n<this.next.length;n++)for(let r=0;r<t.next.length;r++)if(this.next[n].type==t.next[r].type)return!0;return!1}fillBefore(t,n=!1,r=0){let o=[this];function i(s,a){let l=s.matchFragment(t,r);if(l&&(!n||l.validEnd))return q.from(a.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:f}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(f)==-1){o.push(f);let h=i(f,a.concat(u));if(h)return h}}return null}return i(this,[])}findWrapping(t){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==t)return this.wrapCache[r+1];let n=this.computeWrapping(t);return this.wrapCache.push(t,n),n}computeWrapping(t){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(t)){let s=[];for(let a=o;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:a,next:l}=i.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!o.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:o}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function n(r){t.push(r);for(let o=0;o<r.next.length;o++)t.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),t.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+t.indexOf(r.next[s].next);return i}).join(`
|
|
494
|
-
`)}}Bl.empty=new Bl(!0);class VZ{constructor(t,n){this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function fD(e){let t=[];do t.push(UZ(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function UZ(e){let t=[];do t.push(WZ(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function WZ(e){let t=GZ(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=HZ(e,t);else break;return t}function xP(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function HZ(e,t){let n=xP(e),r=n;return e.eat(",")&&(e.next!="}"?r=xP(e):r=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function KZ(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.isInGroup(t)&&o.push(s)}return o.length==0&&e.err("No node type or group '"+t+"' found"),o}function GZ(e){if(e.eat("(")){let t=fD(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=KZ(e,e.next).map(n=>(e.inline==null?e.inline=n.isInline:e.inline!=n.isInline&&e.err("Mixing inline and block content"),{type:"name",value:n}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function qZ(e){let t=[[]];return o(i(e,0),n()),t;function n(){return t.push([])-1}function r(s,a,l){let c={term:l,to:a};return t[s].push(c),c}function o(s,a){s.forEach(l=>l.to=a)}function i(s,a){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(i(c,a)),[]);if(s.type=="seq")for(let l=0;;l++){let c=i(s.exprs[l],a);if(l==s.exprs.length-1)return c;o(c,a=n())}else if(s.type=="star"){let l=n();return r(a,l),o(i(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return o(i(s.expr,a),l),o(i(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(i(s.expr,a));if(s.type=="range"){let l=a;for(let c=0;c<s.min;c++){let u=n();o(i(s.expr,l),u),l=u}if(s.max==-1)o(i(s.expr,l),l);else for(let c=s.min;c<s.max;c++){let u=n();r(l,u),o(i(s.expr,l),u),l=u}return[r(l)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function hD(e,t){return t-e}function bP(e,t){let n=[];return r(t),n.sort(hD);function r(o){let i=e[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let s=0;s<i.length;s++){let{term:a,to:l}=i[s];!a&&n.indexOf(l)==-1&&r(l)}}}function YZ(e){let t=Object.create(null);return n(bP(e,0));function n(r){let o=[];r.forEach(s=>{e[s].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<o.length;u++)o[u][0]==a&&(c=o[u][1]);bP(e,l).forEach(u=>{c||o.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=t[r.join(",")]=new Bl(r.indexOf(e.length-1)>-1);for(let s=0;s<o.length;s++){let a=o[s][1].sort(hD);i.next.push({type:o[s][0],next:t[a.join(",")]||n(a)})}return i}}function JZ(e,t){for(let n=0,r=[e];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let a=0;a<o.next.length;a++){let{type:l,next:c}=o.next[a];s.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&t.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function pD(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function mD(e,t){let n=Object.create(null);for(let r in e){let o=t&&t[r];if(o===void 0){let i=e[r];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function gD(e,t,n,r){for(let o in t)if(!(o in e))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in e){let i=e[o];i.validate&&i.validate(t[o])}}function vD(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new ZZ(e,r,t[r]);return n}let pw=class yD{constructor(t,n,r){this.name=t,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=vD(t,r.attrs),this.defaultAttrs=pD(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||t=="text"),this.isText=t=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Bl.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:mD(this.attrs,t)}create(t=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ha(this,this.computeAttrs(t),q.from(n),ot.setFrom(r))}createChecked(t=null,n,r){return n=q.from(n),this.checkContent(n),new ha(this,this.computeAttrs(t),n,ot.setFrom(r))}createAndFill(t=null,n,r){if(t=this.computeAttrs(t),n=q.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let o=this.contentMatch.matchFragment(n),i=o&&o.fillBefore(q.empty,!0);return i?new ha(this,t,n.append(i),ot.setFrom(r)):null}validContent(t){let n=this.contentMatch.matchFragment(t);if(!n||!n.validEnd)return!1;for(let r=0;r<t.childCount;r++)if(!this.allowsMarks(t.child(r).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){gD(this.attrs,t,"node",this.name)}allowsMarkType(t){return this.markSet==null||this.markSet.indexOf(t)>-1}allowsMarks(t){if(this.markSet==null)return!0;for(let n=0;n<t.length;n++)if(!this.allowsMarkType(t[n].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let n;for(let r=0;r<t.length;r++)this.allowsMarkType(t[r].type)?n&&n.push(t[r]):n||(n=t.slice(0,r));return n?n.length?n:ot.none:t}static compile(t,n){let r=Object.create(null);t.forEach((i,s)=>r[i]=new yD(i,n,s));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function XZ(e,t,n){let r=n.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}class ZZ{constructor(t,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?XZ(t,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class bp{constructor(t,n,r,o){this.name=t,this.rank=n,this.schema=r,this.spec=o,this.attrs=vD(t,o.attrs),this.excluded=null;let i=pD(this.attrs);this.instance=i?new ot(this,i):null}create(t=null){return!t&&this.instance?this.instance:new ot(this,mD(this.attrs,t))}static compile(t,n){let r=Object.create(null),o=0;return t.forEach((i,s)=>r[i]=new bp(i,o++,n,s)),r}removeFromSet(t){for(var n=0;n<t.length;n++)t[n].type==this&&(t=t.slice(0,n).concat(t.slice(n+1)),n--);return t}isInSet(t){for(let n=0;n<t.length;n++)if(t[n].type==this)return t[n]}checkAttrs(t){gD(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}class QZ{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in t)n[o]=t[o];n.nodes=En.from(t.nodes),n.marks=En.from(t.marks||{}),this.nodes=pw.compile(this.spec.nodes,this),this.marks=bp.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=Bl.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?wP(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:wP(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,n=null,r,o){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof pw){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(n,r,o)}text(t,n){let r=this.nodes.text;return new Zg(r,r.defaultAttrs,t,ot.setFrom(n))}mark(t,n){return typeof t=="string"&&(t=this.marks[t]),t.create(n)}nodeFromJSON(t){return ha.fromJSON(this,t)}markFromJSON(t){return ot.fromJSON(this,t)}nodeType(t){let n=this.nodes[t];if(!n)throw new RangeError("Unknown node type: "+t);return n}}function wP(e,t){let n=[];for(let r=0;r<t.length;r++){let o=t[r],i=e.marks[o],s=i;if(i)n.push(i);else for(let a in e.marks){let l=e.marks[a];(o=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}function eQ(e){return e.tag!=null}function tQ(e){return e.style!=null}class ju{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(eQ(o))this.tags.push(o);else if(tQ(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=t.nodes[o.node];return i.contentMatch.matchType(i)})}parse(t,n={}){let r=new kP(this,n,!1);return r.addAll(t,ot.none,n.from,n.to),r.finish()}parseSlice(t,n={}){let r=new kP(this,n,!0);return r.addAll(t,ot.none,n.from,n.to),ae.maxOpen(r.finish())}matchTag(t,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(oQ(t,i.tag)&&(i.namespace===void 0||t.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(t);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(t,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],a=s.style;if(!(a.indexOf(t)!=0||s.context&&!r.matchesContext(s.context)||a.length>t.length&&(a.charCodeAt(t.length)!=61||a.slice(t.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(t){let n=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<n.length;s++){let a=n[s];if((a.priority==null?50:a.priority)<i)break}n.splice(s,0,o)}for(let o in t.marks){let i=t.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=EP(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in t.nodes){let i=t.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=EP(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new ju(t,ju.schemaRules(t)))}}const xD={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},nQ={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},bD={ol:!0,ul:!0},Qg=1,ev=2,jf=4;function SP(e,t,n){return t!=null?(t?Qg:0)|(t==="full"?ev:0):e&&e.whitespace=="pre"?Qg|ev:n&~jf}class lm{constructor(t,n,r,o,i,s){this.type=t,this.attrs=n,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=ot.none,this.match=i||(s&jf?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(q.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(t.type))?(this.match=r,o):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&Qg)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=q.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(q.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!xD.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class kP{constructor(t,n,r){this.parser=t,this.options=n,this.isOpen=r,this.open=0;let o=n.topNode,i,s=SP(null,n.preserveWhitespace,0)|(r?jf:0);o?i=new lm(o.type,o.attrs,ot.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new lm(null,null,ot.none,!0,null,s):i=new lm(t.schema.topNodeType,null,ot.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,n){t.nodeType==3?this.addTextNode(t,n):t.nodeType==1&&this.addElement(t,n)}addTextNode(t,n){let r=t.nodeValue,o=this.top;if(o.options&ev||o.inlineContext(t)||/[^ \t\r\n\u000c]/.test(r)){if(o.options&Qg)o.options&ev?r=r.replace(/\r\n?/g,`
|
|
495
|
-
`):r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let i=o.content[o.content.length-1],s=t.previousSibling;(!i||s&&s.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),n),this.findInText(t)}else this.findInside(t)}addElement(t,n,r){let o=t.nodeName.toLowerCase(),i;bD.hasOwnProperty(o)&&this.parser.normalizeLists&&rQ(t);let s=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(i=this.parser.matchTag(t,this,r));if(s?s.ignore:nQ.hasOwnProperty(o))this.findInside(t),this.ignoreFallback(t,n);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(t=s.skip);let a,l=this.top,c=this.needsBlock;if(xD.hasOwnProperty(o))l.content.length&&l.content[0].isInline&&this.open&&(this.open--,l=this.top),a=!0,l.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,n);return}let u=s&&s.skip?n:this.readStyles(t,n);u&&this.addAll(t,u),a&&this.sync(l),this.needsBlock=c}else{let a=this.readStyles(t,n);a&&this.addElementByRule(t,s,a,s.consuming===!1?i:void 0)}}leafFallback(t,n){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
|
|
496
|
-
`),n)}ignoreFallback(t,n){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n)}readStyles(t,n){let r=t.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(i,s,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(t,n,r,o){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r)||this.leafFallback(t,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(t);else if(o)this.addElement(t,r,o);else if(n.getContent)this.findInside(t),n.getContent(t,this.parser.schema).forEach(l=>this.insertNode(l,r));else{let l=t;typeof n.contentElement=="string"?l=t.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(t):n.contentElement&&(l=n.contentElement),this.findAround(t,l,!0),this.addAll(l,r),this.findAround(t,l,!1)}i&&this.sync(a)&&this.open--}addAll(t,n,r,o){let i=r||0;for(let s=r?t.childNodes[r]:t.firstChild,a=o==null?null:t.childNodes[o];s!=a;s=s.nextSibling,++i)this.findAtPoint(t,i),this.addDOM(s,n);this.findAtPoint(t,i)}findPlace(t,n){let r,o;for(let i=this.open;i>=0;i--){let s=this.nodes[i],a=s.findWrapping(t);if(a&&(!r||r.length>a.length)&&(r=a,o=s,!a.length)||s.solid)break}if(!r)return null;this.sync(o);for(let i=0;i<r.length;i++)n=this.enterInner(r[i],null,n,!1);return n}insertNode(t,n){if(t.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(n=this.enterInner(o,null,n))}let r=this.findPlace(t,n);if(r){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(t.type));let i=ot.none;for(let s of r.concat(t.marks))(o.type?o.type.allowsMarkType(s.type):CP(s.type,t.type))&&(i=s.addToSet(i));return o.content.push(t.mark(i)),!0}return!1}enter(t,n,r,o){let i=this.findPlace(t.create(n),r);return i&&(i=this.enterInner(t,n,r,!0,o)),i}enterInner(t,n,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(t);let a=SP(t,i,s.options);s.options&jf&&s.content.length==0&&(a|=jf);let l=ot.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):CP(c.type,t))?(l=c.addToSet(l),!1):!0),this.nodes.push(new lm(t,n,l,o,null,a)),this.open++,r}closeExtra(t=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(t){for(let n=this.open;n>=0;n--)if(this.nodes[n]==t)return this.open=n,!0;return!1}get currentPos(){this.closeExtra();let t=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let o=r.length-1;o>=0;o--)t+=r[o].nodeSize;n&&t++}return t}findAtPoint(t,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==t&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&t.nodeType==1&&t.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(t,n,r){if(t!=n&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&t.nodeType==1&&t.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&(this.find[n].pos=this.currentPos-(t.nodeValue.length-this.find[n].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let n=t.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=i;l--)if(s(a-1,l))return!0;return!1}else{let u=l>0||l==0&&o?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function rQ(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&bD.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):r=="li"?n=t:r&&(n=null)}}function oQ(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function EP(e){let t={};for(let n in e)t[n]=e[n];return t}function CP(e,t){let n=t.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(e))continue;let i=[],s=a=>{i.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==t||i.indexOf(u)<0&&s(u))return!0}};if(s(o.contentMatch))return!0}}class Ha{constructor(t,n){this.nodes=t,this.marks=n}serializeFragment(t,n={},r){r||(r=l0(n).createDocumentFragment());let o=r,i=[];return t.forEach(s=>{if(i.length||s.marks.length){let a=0,l=0;for(;a<i.length&&l<s.marks.length;){let c=s.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(i[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<i.length;)o=i.pop()[1];for(;l<s.marks.length;){let c=s.marks[l++],u=this.serializeMark(c,s.isInline,n);u&&(i.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(t,n){let{dom:r,contentDOM:o}=Mm(l0(n),this.nodes[t.type.name](t),null,t.attrs);if(o){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,n,o)}return r}serializeNode(t,n={}){let r=this.serializeNodeInner(t,n);for(let o=t.marks.length-1;o>=0;o--){let i=this.serializeMark(t.marks[o],t.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(t,n,r={}){let o=this.marks[t.type.name];return o&&Mm(l0(r),o(t,n),null,t.attrs)}static renderSpec(t,n,r=null,o){return Mm(t,n,r,o)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new Ha(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=NP(t.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(t){return NP(t.marks)}}function NP(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function l0(e){return e.document||window.document}const PP=new WeakMap;function iQ(e){let t=PP.get(e);return t===void 0&&PP.set(e,t=sQ(e)),t}function sQ(e){let t=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")t||(t=[]),t.push(r);else for(let o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(e),t}function Mm(e,t,n,r){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let o=t[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=iQ(r))&&i.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=o.indexOf(" ");s>0&&(n=o.slice(0,s),o=o.slice(s+1));let a,l=n?e.createElementNS(n,o):e.createElement(o),c=t[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let f in c)if(c[f]!=null){let h=f.indexOf(" ");h>0?l.setAttributeNS(f.slice(0,h),f.slice(h+1),c[f]):l.setAttribute(f,c[f])}}for(let f=u;f<t.length;f++){let h=t[f];if(h===0){if(f<t.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:p,contentDOM:m}=Mm(e,h,n,r);if(l.appendChild(p),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:l,contentDOM:a}}const wD=65535,SD=Math.pow(2,16);function aQ(e,t){return e+t*SD}function _P(e){return e&wD}function lQ(e){return(e-(e&wD))/SD}const kD=1,ED=2,Rm=4,CD=8;class mw{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&CD)>0}get deletedBefore(){return(this.delInfo&(kD|Rm))>0}get deletedAfter(){return(this.delInfo&(ED|Rm))>0}get deletedAcross(){return(this.delInfo&Rm)>0}}class Dr{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&Dr.empty)return Dr.empty}recover(t){let n=0,r=_P(t);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+lQ(t)}mapResult(t,n=1){return this._map(t,n,!1)}map(t,n=1){return this._map(t,n,!0)}_map(t,n,r){let o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?o:0);if(l>t)break;let c=this.ranges[a+i],u=this.ranges[a+s],f=l+c;if(t<=f){let h=c?t==l?-1:t==f?1:n:n,p=l+o+(h<0?0:u);if(r)return p;let m=t==(n<0?l:f)?null:aQ(a/3,t-l),v=t==l?ED:t==f?kD:Rm;return(n<0?t!=l:t!=f)&&(v|=CD),new mw(p,v,m)}o+=u-c}return r?t+o:new mw(t+o,0,null)}touches(t,n){let r=0,o=_P(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>t)break;let c=this.ranges[a+i],u=l+c;if(t<=u&&a==o*3)return!0;r+=this.ranges[a+s]-c}return!1}forEach(t){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],a=s-(this.inverted?i:0),l=s+(this.inverted?0:i),c=this.ranges[o+n],u=this.ranges[o+r];t(a,a+c,l,l+u),i+=u-c}}invert(){return new Dr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?Dr.empty:new Dr(t<0?[0,-t,0]:[0,0,t])}}Dr.empty=new Dr([]);class Zc{constructor(t=[],n,r=0,o=t.length){this.maps=t,this.mirror=n,this.from=r,this.to=o}slice(t=0,n=this.maps.length){return new Zc(this.maps,this.mirror,t,n)}copy(){return new Zc(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(t,n){this.to=this.maps.push(t),n!=null&&this.setMirror(this.maps.length-1,n)}appendMapping(t){for(let n=0,r=this.maps.length;n<t.maps.length;n++){let o=t.getMirror(n);this.appendMap(t.maps[n],o!=null&&o<n?r+o:void 0)}}getMirror(t){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==t)return this.mirror[n+(n%2?-1:1)]}}setMirror(t,n){this.mirror||(this.mirror=[]),this.mirror.push(t,n)}appendMappingInverted(t){for(let n=t.maps.length-1,r=this.maps.length+t.maps.length;n>=0;n--){let o=t.getMirror(n);this.appendMap(t.maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let t=new Zc;return t.appendMappingInverted(this),t}map(t,n=1){if(this.mirror)return this._map(t,n,!0);for(let r=this.from;r<this.to;r++)t=this.maps[r].map(t,n);return t}mapResult(t,n=1){return this._map(t,n,!1)}_map(t,n,r){let o=0;for(let i=this.from;i<this.to;i++){let s=this.maps[i],a=s.mapResult(t,n);if(a.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,t=this.maps[l].recover(a.recover);continue}}o|=a.delInfo,t=a.pos}return r?t:new mw(t,o,null)}}const c0=Object.create(null);class an{getMap(){return Dr.empty}merge(t){return null}static fromJSON(t,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=c0[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in c0)throw new RangeError("Duplicate use of step JSON ID "+t);return c0[t]=n,n.prototype.jsonID=t,n}}class Wt{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new Wt(t,null)}static fail(t){return new Wt(null,t)}static fromReplace(t,n,r,o){try{return Wt.ok(t.replace(n,r,o))}catch(i){if(i instanceof Jg)return Wt.fail(i.message);throw i}}}function Ek(e,t,n){let r=[];for(let o=0;o<e.childCount;o++){let i=e.child(o);i.content.size&&(i=i.copy(Ek(i.content,t,i))),i.isInline&&(i=t(i,n,o)),r.push(i)}return q.fromArray(r)}class Yi extends an{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=t.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new ae(Ek(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return Wt.fromReplace(t,this.from,this.to,i)}invert(){return new Wo(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Yi(n.pos,r.pos,this.mark)}merge(t){return t instanceof Yi&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Yi(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Yi(n.from,n.to,t.markFromJSON(n.mark))}}an.jsonID("addMark",Yi);class Wo extends an{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=new ae(Ek(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),t),n.openStart,n.openEnd);return Wt.fromReplace(t,this.from,this.to,r)}invert(){return new Yi(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Wo(n.pos,r.pos,this.mark)}merge(t){return t instanceof Wo&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Wo(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Wo(n.from,n.to,t.markFromJSON(n.mark))}}an.jsonID("removeMark",Wo);class ta extends an{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Wt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Wt.fromReplace(t,this.pos,this.pos+1,new ae(q.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new ta(this.pos,n.marks[o]);return new ta(this.pos,this.mark)}}return new Tu(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new ta(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ta(n.pos,t.markFromJSON(n.mark))}}an.jsonID("addNodeMark",ta);class Tu extends an{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Wt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Wt.fromReplace(t,this.pos,this.pos+1,new ae(q.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new ta(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Tu(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Tu(n.pos,t.markFromJSON(n.mark))}}an.jsonID("removeNodeMark",Tu);class pn extends an{constructor(t,n,r,o=!1){super(),this.from=t,this.to=n,this.slice=r,this.structure=o}apply(t){return this.structure&&gw(t,this.from,this.to)?Wt.fail("Structure replace would overwrite content"):Wt.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Dr([this.from,this.to-this.from,this.slice.size])}invert(t){return new pn(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new pn(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(t){if(!(t instanceof pn)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?ae.empty:new ae(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new pn(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?ae.empty:new ae(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new pn(t.from,this.to,n,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new pn(n.from,n.to,ae.fromJSON(t,n.slice),!!n.structure)}}an.jsonID("replace",pn);class Ht extends an{constructor(t,n,r,o,i,s,a=!1){super(),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=a}apply(t){if(this.structure&&(gw(t,this.from,this.gapFrom)||gw(t,this.gapTo,this.to)))return Wt.fail("Structure gap-replace would overwrite content");let n=t.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Wt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Wt.fromReplace(t,this.from,this.to,r):Wt.fail("Content does not fit in gap")}getMap(){return new Dr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new Ht(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),o=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||i>r.pos?null:new Ht(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ht(n.from,n.to,n.gapFrom,n.gapTo,ae.fromJSON(t,n.slice),n.insert,!!n.structure)}}an.jsonID("replaceAround",Ht);function gw(e,t,n){let r=e.resolve(t),o=n-t,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function cQ(e,t,n,r){let o=[],i=[],s,a;e.doc.nodesBetween(t,n,(l,c,u)=>{if(!l.isInline)return;let f=l.marks;if(!r.isInSet(f)&&u.type.allowsMarkType(r.type)){let h=Math.max(c,t),p=Math.min(c+l.nodeSize,n),m=r.addToSet(f);for(let v=0;v<f.length;v++)f[v].isInSet(m)||(s&&s.to==h&&s.mark.eq(f[v])?s.to=p:o.push(s=new Wo(h,p,f[v])));a&&a.to==h?a.to=p:i.push(a=new Yi(h,p,r))}}),o.forEach(l=>e.step(l)),i.forEach(l=>e.step(l))}function uQ(e,t,n,r){let o=[],i=0;e.doc.nodesBetween(t,n,(s,a)=>{if(!s.isInline)return;i++;let l=null;if(r instanceof bp){let c=s.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let c=Math.min(a+s.nodeSize,n);for(let u=0;u<l.length;u++){let f=l[u],h;for(let p=0;p<o.length;p++){let m=o[p];m.step==i-1&&f.eq(o[p].style)&&(h=m)}h?(h.to=c,h.step=i):o.push({style:f,from:Math.max(a,t),to:c,step:i})}}}),o.forEach(s=>e.step(new Wo(s.from,s.to,s.style)))}function Ck(e,t,n,r=n.contentMatch,o=!0){let i=e.doc.nodeAt(t),s=[],a=t+1;for(let l=0;l<i.childCount;l++){let c=i.child(l),u=a+c.nodeSize,f=r.matchType(c.type);if(!f)s.push(new pn(a,u,ae.empty));else{r=f;for(let h=0;h<c.marks.length;h++)n.allowsMarkType(c.marks[h].type)||e.step(new Wo(a,u,c.marks[h]));if(o&&c.isText&&n.whitespace!="pre"){let h,p=/\r?\n|\r/g,m;for(;h=p.exec(c.text);)m||(m=new ae(q.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new pn(a+h.index,a+h.index+h[0].length,m))}}a=u}if(!r.validEnd){let l=r.fillBefore(q.empty,!0);e.replace(a,a,new ae(l,0,0))}for(let l=s.length-1;l>=0;l--)e.step(s[l])}function dQ(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function od(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth;;--r){let o=e.$from.node(r),i=e.$from.index(r),s=e.$to.indexAfter(r);if(r<e.depth&&o.canReplace(i,s,n))return r;if(r==0||o.type.spec.isolating||!dQ(o,i,s))break}return null}function fQ(e,t,n){let{$from:r,$to:o,depth:i}=t,s=r.before(i+1),a=o.after(i+1),l=s,c=a,u=q.empty,f=0;for(let m=i,v=!1;m>n;m--)v||r.index(m)>0?(v=!0,u=q.from(r.node(m).copy(u)),f++):l--;let h=q.empty,p=0;for(let m=i,v=!1;m>n;m--)v||o.after(m+1)<o.end(m)?(v=!0,h=q.from(o.node(m).copy(h)),p++):c++;e.step(new Ht(l,c,s,a,new ae(u.append(h),f,p),u.size-f,!0))}function Nk(e,t,n=null,r=e){let o=hQ(e,t),i=o&&pQ(r,t);return i?o.map(jP).concat({type:t,attrs:n}).concat(i.map(jP)):null}function jP(e){return{type:e,attrs:null}}function hQ(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;let s=i.length?i[0]:t;return n.canReplaceWith(r,o,s)?i:null}function pQ(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.child(r),s=t.contentMatch.findWrapping(i.type);if(!s)return null;let l=(s.length?s[s.length-1]:t).contentMatch;for(let c=r;l&&c<o;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:s}function mQ(e,t,n){let r=q.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let a=n[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=q.from(n[s].type.create(n[s].attrs,r))}let o=t.start,i=t.end;e.step(new Ht(o,i,o,i,new ae(r,0,0),n.length,!0))}function gQ(e,t,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=e.steps.length;e.doc.nodesBetween(t,n,(s,a)=>{let l=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,l)&&vQ(e.doc,e.mapping.slice(i).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!m?c=!1:!p&&m&&(c=!0)}c===!1&&PD(e,s,a,i),Ck(e,e.mapping.slice(i).map(a,1),r,void 0,c===null);let u=e.mapping.slice(i),f=u.map(a,1),h=u.map(a+s.nodeSize,1);return e.step(new Ht(f,h,f+1,h-1,new ae(q.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&ND(e,s,a,i),!1}})}function ND(e,t,n,r){t.forEach((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let l=e.mapping.slice(r).map(n+1+i+s.index);e.replaceWith(l,l+1,t.type.schema.linebreakReplacement.create())}}})}function PD(e,t,n,r){t.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=e.mapping.slice(r).map(n+1+i);e.replaceWith(s,s+1,t.type.schema.text(`
|
|
497
|
-
`))}})}function vQ(e,t,n){let r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function yQ(e,t,n,r,o){let i=e.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return e.replaceWith(t,t+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new Ht(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new ae(q.from(s),0,0),1,!0))}function Qc(e,t,n=1,r){let o=e.resolve(t),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>i;c--,u--){let f=o.node(c),h=o.index(c);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(h,f.childCount),m=r&&r[u+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let v=r&&r[u]||f;if(!f.canReplace(h+1,f.childCount)||!v.type.validContent(p))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function xQ(e,t,n=1,r){let o=e.doc.resolve(t),i=q.empty,s=q.empty;for(let a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){i=q.from(o.node(a).copy(i));let u=r&&r[c];s=q.from(u?u.type.create(u.attrs,s):o.node(a).copy(s))}e.step(new pn(t,t,new ae(i.append(s),n,n),!0))}function wp(e,t){let n=e.resolve(t),r=n.index();return wQ(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function bQ(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let o=0;o<t.childCount;o++){let i=t.child(o),s=i.type==r?e.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!e.type.allowsMarks(i.marks))return!1}return n.validEnd}function wQ(e,t){return!!(e&&t&&!e.isLeaf&&bQ(e,t))}function SQ(e,t,n){let r=null,{linebreakReplacement:o}=e.doc.type.schema,i=e.doc.resolve(t-n),s=i.node().type;if(o&&s.inlineContent){let u=s.whitespace=="pre",f=!!s.contentMatch.matchType(o);u&&!f?r=!1:!u&&f&&(r=!0)}let a=e.steps.length;if(r===!1){let u=e.doc.resolve(t+n);PD(e,u.node(),u.before(),a)}s.inlineContent&&Ck(e,t+n-1,s,i.node().contentMatchAt(i.index()),r==null);let l=e.mapping.slice(a),c=l.map(t-n);if(e.step(new pn(c,l.map(t+n,-1),ae.empty,!0)),r===!0){let u=e.doc.resolve(c);ND(e,u.node(),u.before(),e.steps.length)}return e}function _D(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,n))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function jD(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=r.depth;s>=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),c=r.node(s),u=!1;if(i==1)u=c.canReplace(l,l,o);else{let f=c.contentMatchAt(l).findWrapping(o.firstChild.type);u=f&&c.canReplaceWith(l,l,f[0])}if(u)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function Pk(e,t,n=t,r=ae.empty){if(t==n&&!r.size)return null;let o=e.resolve(t),i=e.resolve(n);return TD(o,i,r)?new pn(t,n,r):new kQ(o,i,r).fit()}function TD(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}class kQ{constructor(t,n,r){this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=q.empty;for(let o=0;o<=t.depth;o++){let i=t.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(t.indexAfter(o))})}for(let o=t.depth;o>0;o--)this.placed=q.from(t.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(t<0?this.$to:r.doc.resolve(t));if(!o)return null;let i=this.placed,s=r.depth,a=o.depth;for(;s&&a&&i.childCount==1;)i=i.firstChild.content,s--,a--;let l=new ae(i,s,a);return t>-1?new Ht(r.pos,t,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new pn(r.pos,o.pos,l):null}findFittable(){let t=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<t;r++){let i=n.firstChild;if(n.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){t=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?t:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=u0(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,f=null;if(n==1&&(s?c.matchType(s.type)||(f=c.fillBefore(q.from(s),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:f};if(n==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:t,openStart:n,openEnd:r}=this.unplaced,o=u0(t,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new ae(t,n+1,Math.max(r,o.size+n>=t.size-r?n+1:0)),!0)}dropNode(){let{content:t,openStart:n,openEnd:r}=this.unplaced,o=u0(t,n);if(o.childCount<=1&&n>0){let i=t.size-n<=n+o.size;this.unplaced=new ae(Bd(t,n-1,1),n-1,i?n-1:r)}else this.unplaced=new ae(Bd(t,n,1),n,r)}placeNodes({sliceDepth:t,frontierDepth:n,parent:r,inject:o,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let v=0;v<i.length;v++)this.openFrontierNode(i[v]);let s=this.unplaced,a=r?r.content:s.content,l=s.openStart-t,c=0,u=[],{match:f,type:h}=this.frontier[n];if(o){for(let v=0;v<o.childCount;v++)u.push(o.child(v));f=f.matchFragment(o)}let p=a.size+t-(s.content.size-s.openEnd);for(;c<a.childCount;){let v=a.child(c),x=f.matchType(v.type);if(!x)break;c++,(c>1||l==0||v.content.size)&&(f=x,u.push(OD(v.mark(h.allowedMarks(v.marks)),c==1?l:0,c==a.childCount?p:-1)))}let m=c==a.childCount;m||(p=-1),this.placed=Vd(this.placed,n,q.from(u)),this.frontier[n].match=f,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let v=0,x=a;v<p;v++){let b=x.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),x=b.content}this.unplaced=m?t==0?ae.empty:new ae(Bd(s.content,t-1,1),t-1,p<0?s.openEnd:t-1):new ae(Bd(s.content,t,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],n;if(!t.type.isTextblock||!d0(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(t){e:for(let n=Math.min(this.depth,t.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],i=n<t.depth&&t.end(n+1)==t.pos+(t.depth-(n+1)),s=d0(t,n,o,r,i);if(s){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=d0(t,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:i?t.doc.resolve(t.after(n+1)):t}}}}close(t){let n=this.findCloseLevel(t);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Vd(this.placed,n.depth,n.fit)),t=n.move;for(let r=n.depth+1;r<=t.depth;r++){let o=t.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,t.index(r));this.openFrontierNode(o.type,o.attrs,i)}return t}openFrontierNode(t,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(t),this.placed=Vd(this.placed,this.depth,q.from(t.create(n,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(q.empty,!0);n.childCount&&(this.placed=Vd(this.placed,this.frontier.length,n))}}function Bd(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Bd(e.firstChild.content,t-1,n)))}function Vd(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Vd(e.lastChild.content,t-1,n)))}function u0(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function OD(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,OD(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(q.empty,!0)))),e.copy(r)}function d0(e,t,n,r,o){let i=e.node(t),s=o?e.indexAfter(t):e.index(t);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!EQ(n,i.content,s)?a:null}function EQ(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function CQ(e){return e.spec.defining||e.spec.definingForContent}function NQ(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let o=e.doc.resolve(t),i=e.doc.resolve(n);if(TD(o,i,r))return e.step(new pn(t,n,r));let s=RD(o,e.doc.resolve(n));s[s.length-1]==0&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let h=o.depth,p=o.pos-1;h>0;h--,p--){let m=o.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(h)>-1?a=h:o.before(h)==p&&s.splice(1,0,-h)}let l=s.indexOf(a),c=[],u=r.openStart;for(let h=r.content,p=0;;p++){let m=h.firstChild;if(c.push(m),p==r.openStart)break;h=m.content}for(let h=u-1;h>=0;h--){let p=c[h],m=CQ(p.type);if(m&&!p.sameMarkup(o.node(Math.abs(a)-1)))u=h;else if(m||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+u+1)%(r.openStart+1),m=c[p];if(m)for(let v=0;v<s.length;v++){let x=s[(v+l)%s.length],b=!0;x<0&&(b=!1,x=-x);let w=o.node(x-1),S=o.index(x-1);if(w.canReplaceWith(S,S,m.type,m.marks))return e.replace(o.before(x),b?i.after(x):n,new ae(MD(r.content,0,r.openStart,p),p,r.openEnd))}}let f=e.steps.length;for(let h=s.length-1;h>=0&&(e.replace(t,n,r),!(e.steps.length>f));h--){let p=s[h];p<0||(t=o.before(p),n=i.after(p))}}function MD(e,t,n,r,o){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(MD(i.content,t+1,n,r,i)))}if(t>r){let i=o.contentMatchAt(0),s=i.fillBefore(e).append(e);e=s.append(i.matchFragment(s).fillBefore(q.empty,!0))}return e}function PQ(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let o=_D(e.doc,t,r.type);o!=null&&(t=n=o)}e.replaceRange(t,n,new ae(q.from(r),0,0))}function _Q(e,t,n){let r=e.doc.resolve(t),o=e.doc.resolve(n),i=RD(r,o);for(let s=0;s<i.length;s++){let a=i[s],l=s==i.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return e.delete(r.start(a),o.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),o.indexAfter(a-1))))return e.delete(r.before(a),o.after(a))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(t-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return e.delete(r.before(s),n);e.delete(t,n)}function RD(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let o=r;o>=0;o--){let i=e.start(o);if(i<e.pos-(e.depth-o)||t.end(o)>t.pos+(t.depth-o)||e.node(o).type.spec.isolating||t.node(o).type.spec.isolating)break;(i==t.start(o)||o==e.depth&&o==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&o&&t.start(o-1)==i-1)&&n.push(o)}return n}class eu extends an{constructor(t,n,r){super(),this.pos=t,this.attr=n,this.value=r}apply(t){let n=t.nodeAt(this.pos);if(!n)return Wt.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return Wt.fromReplace(t,this.pos,this.pos+1,new ae(q.from(o),0,n.isLeaf?0:1))}getMap(){return Dr.empty}invert(t){return new eu(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new eu(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new eu(n.pos,n.attr,n.value)}}an.jsonID("attr",eu);class kh extends an{constructor(t,n){super(),this.attr=t,this.value=n}apply(t){let n=Object.create(null);for(let o in t.attrs)n[o]=t.attrs[o];n[this.attr]=this.value;let r=t.type.create(n,t.content,t.marks);return Wt.ok(r)}getMap(){return Dr.empty}invert(t){return new kh(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new kh(n.attr,n.value)}}an.jsonID("docAttr",kh);let Ou=class extends Error{};Ou=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};Ou.prototype=Object.create(Error.prototype);Ou.prototype.constructor=Ou;Ou.prototype.name="TransformError";class jQ{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new Zc}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let n=this.maybeStep(t);if(n.failed)throw new Ou(n.failed);return this}maybeStep(t){let n=t.apply(this.doc);return n.failed||this.addStep(t,n.doc),n}get docChanged(){return this.steps.length>0}addStep(t,n){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=n}replace(t,n=t,r=ae.empty){let o=Pk(this.doc,t,n,r);return o&&this.step(o),this}replaceWith(t,n,r){return this.replace(t,n,new ae(q.from(r),0,0))}delete(t,n){return this.replace(t,n,ae.empty)}insert(t,n){return this.replaceWith(t,t,n)}replaceRange(t,n,r){return NQ(this,t,n,r),this}replaceRangeWith(t,n,r){return PQ(this,t,n,r),this}deleteRange(t,n){return _Q(this,t,n),this}lift(t,n){return fQ(this,t,n),this}join(t,n=1){return SQ(this,t,n),this}wrap(t,n){return mQ(this,t,n),this}setBlockType(t,n=t,r,o=null){return gQ(this,t,n,r,o),this}setNodeMarkup(t,n,r=null,o){return yQ(this,t,n,r,o),this}setNodeAttribute(t,n,r){return this.step(new eu(t,n,r)),this}setDocAttribute(t,n){return this.step(new kh(t,n)),this}addNodeMark(t,n){return this.step(new ta(t,n)),this}removeNodeMark(t,n){if(!(n instanceof ot)){let r=this.doc.nodeAt(t);if(!r)throw new RangeError("No node at position "+t);if(n=n.isInSet(r.marks),!n)return this}return this.step(new Tu(t,n)),this}split(t,n=1,r){return xQ(this,t,n,r),this}addMark(t,n,r){return cQ(this,t,n,r),this}removeMark(t,n,r){return uQ(this,t,n,r),this}clearIncompatible(t,n,r){return Ck(this,t,n,r),this}}const f0=Object.create(null);class Ge{constructor(t,n,r){this.$anchor=t,this.$head=n,this.ranges=r||[new TQ(t.min(n),t.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let n=0;n<t.length;n++)if(t[n].$from.pos!=t[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,n=ae.empty){let r=n.content.lastChild,o=null;for(let a=0;a<n.openEnd;a++)o=r,r=r.lastChild;let i=t.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:c}=s[a],u=t.mapping.slice(i);t.replaceRange(u.map(l.pos),u.map(c.pos),a?ae.empty:n),a==0&&MP(t,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(t,n){let r=t.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:s,$to:a}=o[i],l=t.mapping.slice(r),c=l.map(s.pos),u=l.map(a.pos);i?t.deleteRange(c,u):(t.replaceRangeWith(c,u,n),MP(t,r,n.isInline?-1:1))}}static findFrom(t,n,r=!1){let o=t.parent.inlineContent?new ze(t):Sc(t.node(0),t.parent,t.pos,t.index(),n,r);if(o)return o;for(let i=t.depth-1;i>=0;i--){let s=n<0?Sc(t.node(0),t.node(i),t.before(i+1),t.index(i),n,r):Sc(t.node(0),t.node(i),t.after(i+1),t.index(i)+1,n,r);if(s)return s}return null}static near(t,n=1){return this.findFrom(t,n)||this.findFrom(t,-n)||new Qn(t.node(0))}static atStart(t){return Sc(t,t,0,0,1)||new Qn(t)}static atEnd(t){return Sc(t,t,t.content.size,t.childCount,-1)||new Qn(t)}static fromJSON(t,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=f0[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in f0)throw new RangeError("Duplicate use of selection JSON ID "+t);return f0[t]=n,n.prototype.jsonID=t,n}getBookmark(){return ze.between(this.$anchor,this.$head).getBookmark()}}Ge.prototype.visible=!0;class TQ{constructor(t,n){this.$from=t,this.$to=n}}let TP=!1;function OP(e){!TP&&!e.parent.inlineContent&&(TP=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class ze extends Ge{constructor(t,n=t){OP(t),OP(n),super(t,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return Ge.near(r);let o=t.resolve(n.map(this.anchor));return new ze(o.parent.inlineContent?o:r,r)}replace(t,n=ae.empty){if(super.replace(t,n),n==ae.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof ze&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new Ty(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new ze(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){let o=t.resolve(n);return new this(o,r==n?o:t.resolve(r))}static between(t,n,r){let o=t.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let i=Ge.findFrom(n,r,!0)||Ge.findFrom(n,-r,!0);if(i)n=i.$head;else return Ge.near(n,r)}return t.parent.inlineContent||(o==0?t=n:(t=(Ge.findFrom(t,-r,!0)||Ge.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=o<0&&(t=n))),new ze(t,n)}}Ge.jsonID("text",ze);class Ty{constructor(t,n){this.anchor=t,this.head=n}map(t){return new Ty(t.map(this.anchor),t.map(this.head))}resolve(t){return ze.between(t.resolve(this.anchor),t.resolve(this.head))}}class Me extends Ge{constructor(t){let n=t.nodeAfter,r=t.node(0).resolve(t.pos+n.nodeSize);super(t,r),this.node=n}map(t,n){let{deleted:r,pos:o}=n.mapResult(this.anchor),i=t.resolve(o);return r?Ge.near(i):new Me(i)}content(){return new ae(q.from(this.node),0,0)}eq(t){return t instanceof Me&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new _k(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Me(t.resolve(n.anchor))}static create(t,n){return new Me(t.resolve(n))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}}Me.prototype.visible=!1;Ge.jsonID("node",Me);class _k{constructor(t){this.anchor=t}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new Ty(r,r):new _k(r)}resolve(t){let n=t.resolve(this.anchor),r=n.nodeAfter;return r&&Me.isSelectable(r)?new Me(n):Ge.near(n)}}class Qn extends Ge{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,n=ae.empty){if(n==ae.empty){t.delete(0,t.doc.content.size);let r=Ge.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else super.replace(t,n)}toJSON(){return{type:"all"}}static fromJSON(t){return new Qn(t)}map(t){return new Qn(t)}eq(t){return t instanceof Qn}getBookmark(){return OQ}}Ge.jsonID("all",Qn);const OQ={map(){return this},resolve(e){return new Qn(e)}};function Sc(e,t,n,r,o,i=!1){if(t.inlineContent)return ze.create(e,n);for(let s=r-(o>0?0:1);o>0?s<t.childCount:s>=0;s+=o){let a=t.child(s);if(a.isAtom){if(!i&&Me.isSelectable(a))return Me.create(e,n-(o<0?a.nodeSize:0))}else{let l=Sc(e,a,n+o,o<0?a.childCount:0,o,i);if(l)return l}n+=a.nodeSize*o}return null}function MP(e,t,n){let r=e.steps.length-1;if(r<t)return;let o=e.steps[r];if(!(o instanceof pn||o instanceof Ht))return;let i=e.mapping.maps[r],s;i.forEach((a,l,c,u)=>{s==null&&(s=u)}),e.setSelection(Ge.near(e.doc.resolve(s),n))}const RP=1,cm=2,AP=4;class MQ extends jQ{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=(this.updated|RP)&~cm,this.storedMarks=null,this}get selectionSet(){return(this.updated&RP)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=cm,this}ensureMarks(t){return ot.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&cm)>0}addStep(t,n){super.addStep(t,n),this.updated=this.updated&~cm,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,n=!0){let r=this.selection;return n&&(t=t.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||ot.none))),r.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,n,r){let o=this.doc.type.schema;if(n==null)return t?this.replaceSelectionWith(o.text(t),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!t)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(t,i)),this.selection.empty||this.setSelection(Ge.near(this.selection.$to)),this}}setMeta(t,n){return this.meta[typeof t=="string"?t:t.key]=n,this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=AP,this}get scrolledIntoView(){return(this.updated&AP)>0}}function IP(e,t){return!t||!e?e:e.bind(t)}class Ud{constructor(t,n,r){this.name=t,this.init=IP(n.init,r),this.apply=IP(n.apply,r)}}const RQ=[new Ud("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new Ud("selection",{init(e,t){return e.selection||Ge.atStart(t.doc)},apply(e){return e.selection}}),new Ud("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new Ud("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})];class h0{constructor(t,n){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=RQ.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 Ud(r.key,r.spec.state,r))})}}class cl{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,t,this))return!1}return!0}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let n=[t],r=this.applyInner(t),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let l=o?o[s].n:0,c=o?o[s].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",t),!o){o=[];for(let f=0;f<this.config.plugins.length;f++)o.push(f<s?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),i=!0}o&&(o[s]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new cl(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];n[i.name]=i.apply(t,this[i.name],this,n)}return n}get tr(){return new MQ(this)}static create(t){let n=new h0(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new cl(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(t,r);return r}reconfigure(t){let n=new h0(this.schema,t.plugins),r=n.fields,o=new cl(n);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(t,o)}return o}toJSON(t){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),t&&typeof t=="object")for(let r in t){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=t[r],i=o.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(o,this[o.key]))}return n}static fromJSON(t,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let o=new h0(t.schema,t.plugins),i=new cl(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=ha.fromJSON(t.schema,n.doc);else if(s.name=="selection")i.selection=Ge.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[s.name]=c.fromJSON.call(l,t,n[a],i);return}}i[s.name]=s.init(t,i)}}),i}}function AD(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):r=="handleDOMEvents"&&(o=AD(o,t,{})),n[r]=o}return n}class gs{constructor(t){this.spec=t,this.props={},t.props&&AD(t.props,this,this.props),this.key=t.key?t.key.key:ID("plugin")}getState(t){return t[this.key]}}const p0=Object.create(null);function ID(e){return e in p0?e+"$"+ ++p0[e]:(p0[e]=0,e+"$")}class id{constructor(t="key"){this.key=ID(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}function DD(){return typeof document<"u"?document:null}function LD(e,t){if(typeof e!="string")return[e];var n=[e];typeof t=="string"||Array.isArray(t)?t={brackets:t}:t||(t={});var r=t.brackets?Array.isArray(t.brackets)?t.brackets:[t.brackets]:["{}","[]","()"],o=t.escape||"___",i=!!t.flat;r.forEach(function(l){var c=new RegExp(["\\",l[0],"[^\\",l[0],"\\",l[1],"]*\\",l[1]].join("")),u=[];function f(h,p,m){var v=n.push(h.slice(l[0].length,-l[1].length))-1;return u.push(v),o+v+o}n.forEach(function(h,p){for(var m,v=0;h!=m;)if(m=h,h=h.replace(c,f),v++>1e4)throw Error("References have circular dependency. Please, check them.");n[p]=h}),u=u.reverse(),n=n.map(function(h){return u.forEach(function(p){h=h.replace(new RegExp("(\\"+o+p+"\\"+o+")","g"),l[0]+"$1"+l[1])}),h})});var s=new RegExp("\\"+o+"([0-9]+)\\"+o);function a(l,c,u){for(var f=[],h,p=0;h=s.exec(l);){if(p++>1e4)throw Error("Circular references in parenthesis");f.push(l.slice(0,h.index)),f.push(a(c[h[1]],c)),l=l.slice(h.index+h[0].length)}return f.push(l),f}return i?n:a(n[0],n)}function FD(e,t){if(t&&t.flat){var n=t&&t.escape||"___",r=e[0],o;if(!r)return"";for(var i=new RegExp("\\"+n+"([0-9]+)\\"+n),s=0;r!=o;){if(s++>1e4)throw Error("Circular references in "+e);o=r,r=r.replace(i,a)}return r}return e.reduce(function l(c,u){return Array.isArray(u)&&(u=u.reduce(l,"")),c+u},"");function a(l,c){if(e[c]==null)throw Error("Reference "+c+"is undefined");return e[c]}}function zD(e,t){return Array.isArray(e)?FD(e,t):LD(e,t)}zD.parse=LD;zD.stringify=FD;const AQ={id:"extension.command.copy.label",message:"Copy",comment:"Label for copy command."},IQ={id:"extension.command.copy.description",message:"Copy the selected text",comment:"Description for copy command."},DQ={id:"extension.command.cut.label",message:"Cut",comment:"Label for cut command."},LQ={id:"extension.command.cut.description",message:"Cut the selected text",comment:"Description for cut command."},FQ={id:"extension.command.paste.label",message:"Paste",comment:"Label for paste command."},zQ={id:"extension.command.paste.description",message:"Paste content into the editor",comment:"Description for paste command."},$Q={id:"extension.command.select-all.label",message:"Select all",comment:"Label for select all command."},BQ={id:"extension.command.select-all.description",message:"Select all content within the editor",comment:"Description for select all command."};var Ma=Object.freeze({__proto__:null,COPY_DESCRIPTION:IQ,COPY_LABEL:AQ,CUT_DESCRIPTION:LQ,CUT_LABEL:DQ,PASTE_DESCRIPTION:zQ,PASTE_LABEL:FQ,SELECT_ALL_DESCRIPTION:BQ,SELECT_ALL_LABEL:$Q});const VQ={id:"extension.command.toggle-bold.label",message:"Bold",comment:"Label for bold formatting command."},UQ={id:"extension.command.toggle-bold.description",message:"Add bold formatting to the selected text",comment:"Description for bold formatting command."};var DP=Object.freeze({__proto__:null,DESCRIPTION:UQ,LABEL:VQ});const WQ={id:"extension.command.toggle-heading.label",message:`{level, select, 1 {Heading 1}
|
|
498
|
-
2 {Heading 2}
|
|
499
|
-
3 {Heading 3}
|
|
500
|
-
4 {Heading 4}
|
|
501
|
-
5 {Heading 5}
|
|
502
|
-
6 {Heading 6}
|
|
503
|
-
other {Heading}}`,comment:"Label for heading command with support for levels."};var HQ=Object.freeze({__proto__:null,LABEL:WQ});const KQ={id:"extension.command.undo.label",message:"Undo",comment:"Label for undo."},GQ={id:"extension.command.undo.description",message:"Undo the most recent action",comment:"Description for undo."},qQ={id:"extension.command.redo.label",message:"Redo",comment:"Label for redo."},YQ={id:"extension.command.redo.description",message:"Redo the most recent action",comment:"Description for redo."};var tv=Object.freeze({__proto__:null,REDO_DESCRIPTION:YQ,REDO_LABEL:qQ,UNDO_DESCRIPTION:GQ,UNDO_LABEL:KQ});const JQ={id:"extension.command.toggle-italic.label",message:"Italic",comment:"Label for italic formatting command."},XQ={id:"extension.command.toggle-italic.description",message:"Italicize the selected text",comment:"Description for italic formatting command."};var LP=Object.freeze({__proto__:null,DESCRIPTION:XQ,LABEL:JQ});const ZQ={id:"extension.command.toggle-ordered-list.label",message:"Ordered list",comment:"Label for inserting an ordered list into the editor."},QQ={id:"extension.command.toggle-bullet-list.description",message:"Bulleted list",comment:"Description for inserting a bullet list into the editor."},eee={id:"extension.command.toggle-task-list.description",message:"Tasked list",comment:"Description for inserting a task list into the editor."};var jk=Object.freeze({__proto__:null,BULLET_LIST_LABEL:QQ,ORDERED_LIST_LABEL:ZQ,TASK_LIST_LABEL:eee});const tee={id:"extension.command.insert-paragraph.label",message:"Insert Paragraph",comment:"Label for inserting a paragraph."},nee={id:"extension.command.insert-paragraph.description",message:"Insert a new paragraph",comment:"Description for inserting a paragraph."},ree={id:"extension.command.convert-paragraph.label",message:"Convert Paragraph",comment:"Label for converting the current node into a paragraph."},oee={id:"extension.command.convert-paragraph.description",message:"Convert current block into a paragraph block.",comment:"Description for converting a paragraph."};var nv=Object.freeze({__proto__:null,CONVERT_DESCRIPTION:oee,CONVERT_LABEL:ree,INSERT_DESCRIPTION:nee,INSERT_LABEL:tee});const iee={id:"extension.command.toggle-strike.label",message:"Strikethrough",comment:"Label for strike formatting command."},see={id:"extension.command.toggle-strike.description",message:"Strikethrough the selected text",comment:"Description for strike formatting command."};var FP=Object.freeze({__proto__:null,DESCRIPTION:see,LABEL:iee});class Eo{constructor(t,n,r={}){this.match=t,this.match=t,this.handler=typeof n=="string"?aee(n):n,this.undoable=r.undoable!==!1,this.inCode=r.inCode||!1}}function aee(e){return function(t,n,r,o){let i=e;if(n[1]){let s=n[0].lastIndexOf(n[1]);i+=n[0].slice(s+n[1].length),r+=s;let a=r-o;a>0&&(i=n[0].slice(s-a,s)+i,r=o)}return t.tr.insertText(i,r,o)}}const lee=500;function cee({rules:e}){let t=new gs({state:{init(){return null},apply(n,r){let o=n.getMeta(this);return o||(n.selectionSet||n.docChanged?null:r)}},props:{handleTextInput(n,r,o,i){return zP(n,r,o,i,e,t)},handleDOMEvents:{compositionend:n=>{setTimeout(()=>{let{$cursor:r}=n.state.selection;r&&zP(n,r.pos,r.pos,"",e,t)})}}},isInputRules:!0});return t}function zP(e,t,n,r,o,i){if(e.composing)return!1;let s=e.state,a=s.doc.resolve(t),l=a.parent.textBetween(Math.max(0,a.parentOffset-lee),a.parentOffset,null,"")+r;for(let c=0;c<o.length;c++){let u=o[c];if(a.parent.type.spec.code){if(!u.inCode)continue}else if(u.inCode==="only")continue;let f=u.match.exec(l),h=f&&u.handler(s,f,t-(f[0].length-r.length),n);if(h)return u.undoable&&h.setMeta(i,{transform:h,from:t,to:n,text:r}),e.dispatch(h),!0}return!1}const uee=(e,t)=>{let n=e.plugins;for(let r=0;r<n.length;r++){let o=n[r],i;if(o.spec.isInputRules&&(i=o.getState(e))){if(t){let s=e.tr,a=i.transform;for(let l=a.steps.length-1;l>=0;l--)s.step(a.steps[l].invert(a.docs[l]));if(i.text){let l=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,e.schema.text(i.text,l))}else s.delete(i.from,i.to);t(s)}return!0}}return!1};new Eo(/--$/,"—");new Eo(/\.\.\.$/,"…");new Eo(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“");new Eo(/"$/,"”");new Eo(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘");new Eo(/'$/,"’");function Tk(e,t,n=null,r){return new Eo(e,(o,i,s,a)=>{let l=n instanceof Function?n(i):n,c=o.tr.delete(s,a),u=c.doc.resolve(s),f=u.blockRange(),h=f&&Nk(f,t,l);if(!h)return null;c.wrap(f,h);let p=c.doc.resolve(s-1).nodeBefore;return p&&p.type==t&&wp(c.doc,s-1)&&(!r||r(i,p))&&c.join(s-1),c})}function dee(e,t,n=null){return new Eo(e,(r,o,i,s)=>{let a=r.doc.resolve(i),l=n instanceof Function?n(o):n;return a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),t)?r.tr.delete(i,s).setBlockType(i,i,t,l):null})}const Cn=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Eh=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t};let vw=null;const Bi=function(e,t,n){let r=vw||(vw=document.createRange());return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},fee=function(){vw=null},Vl=function(e,t,n,r){return n&&($P(e,t,n,r,-1)||$P(e,t,n,r,1))},hee=/^(img|br|input|textarea|hr)$/i;function $P(e,t,n,r,o){for(;;){if(e==n&&t==r)return!0;if(t==(o<0?0:uo(e))){let i=e.parentNode;if(!i||i.nodeType!=1||Sp(e)||hee.test(e.nodeName)||e.contentEditable=="false")return!1;t=Cn(e)+(o<0?0:1),e=i}else if(e.nodeType==1){if(e=e.childNodes[t+(o<0?-1:0)],e.contentEditable=="false")return!1;t=o<0?uo(e):0}else return!1}}function uo(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function pee(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable=="false")return null;e=e.childNodes[t-1],t=uo(e)}else if(e.parentNode&&!Sp(e))t=Cn(e),e=e.parentNode;else return null}}function mee(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable=="false")return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!Sp(e))t=Cn(e)+1,e=e.parentNode;else return null}}function gee(e,t,n){for(let r=t==0,o=t==uo(e);r||o;){if(e==n)return!0;let i=Cn(e);if(e=e.parentNode,!e)return!1;r=r&&i==0,o=o&&i==uo(e)}}function Sp(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const Oy=function(e){return e.focusNode&&Vl(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function ol(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function vee(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function yee(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(uo(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(uo(r.startContainer),r.startOffset)}}}const Ei=typeof navigator<"u"?navigator:null,BP=typeof document<"u"?document:null,Ka=Ei&&Ei.userAgent||"",yw=/Edge\/(\d+)/.exec(Ka),$D=/MSIE \d/.exec(Ka),xw=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ka),xr=!!($D||xw||yw),pa=$D?document.documentMode:xw?+xw[1]:yw?+yw[1]:0,ri=!xr&&/gecko\/(\d+)/i.test(Ka);ri&&+(/Firefox\/(\d+)/.exec(Ka)||[0,0])[1];const bw=!xr&&/Chrome\/(\d+)/.exec(Ka),Un=!!bw,BD=bw?+bw[1]:0,nr=!xr&&!!Ei&&/Apple Computer/.test(Ei.vendor),Mu=nr&&(/Mobile\/\w+/.test(Ka)||!!Ei&&Ei.maxTouchPoints>2),so=Mu||(Ei?/Mac/.test(Ei.platform):!1),xee=Ei?/Win/.test(Ei.platform):!1,zo=/Android \d/.test(Ka),kp=!!BP&&"webkitFontSmoothing"in BP.documentElement.style,bee=kp?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function wee(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Ii(e,t){return typeof e=="number"?e:e[t]}function See(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function VP(e,t,n){let r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let s=n||e.dom;s;s=Eh(s)){if(s.nodeType!=1)continue;let a=s,l=a==i.body,c=l?wee(i):See(a),u=0,f=0;if(t.top<c.top+Ii(r,"top")?f=-(c.top-t.top+Ii(o,"top")):t.bottom>c.bottom-Ii(r,"bottom")&&(f=t.bottom-t.top>c.bottom-c.top?t.top+Ii(o,"top")-c.top:t.bottom-c.bottom+Ii(o,"bottom")),t.left<c.left+Ii(r,"left")?u=-(c.left-t.left+Ii(o,"left")):t.right>c.right-Ii(r,"right")&&(u=t.right-c.right+Ii(o,"right")),u||f)if(l)i.defaultView.scrollBy(u,f);else{let h=a.scrollLeft,p=a.scrollTop;f&&(a.scrollTop+=f),u&&(a.scrollLeft+=u);let m=a.scrollLeft-h,v=a.scrollTop-p;t={left:t.left-m,top:t.top-v,right:t.right-m,bottom:t.bottom-v}}if(l||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function kee(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,o;for(let i=(t.left+t.right)/2,s=n+1;s<Math.min(innerHeight,t.bottom);s+=5){let a=e.root.elementFromPoint(i,s);if(!a||a==e.dom||!e.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,o=l.top;break}}return{refDOM:r,refTop:o,stack:VD(e.dom)}}function VD(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Eh(r));return t}function Eee({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;UD(n,r==0?0:r-t)}function UD(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:o,left:i}=e[n];r.scrollTop!=o+t&&(r.scrollTop=o+t),r.scrollLeft!=i&&(r.scrollLeft=i)}}let pc=null;function Cee(e){if(e.setActive)return e.setActive();if(pc)return e.focus(pc);let t=VD(e);e.focus(pc==null?{get preventScroll(){return pc={preventScroll:!0},!0}}:void 0),pc||(pc=!1,UD(t,0))}function WD(e,t){let n,r=2e8,o,i=0,s=t.top,a=t.top,l,c;for(let u=e.firstChild,f=0;u;u=u.nextSibling,f++){let h;if(u.nodeType==1)h=u.getClientRects();else if(u.nodeType==3)h=Bi(u).getClientRects();else continue;for(let p=0;p<h.length;p++){let m=h[p];if(m.top<=s&&m.bottom>=a){s=Math.max(m.bottom,s),a=Math.min(m.top,a);let v=m.left>t.left?m.left-t.left:m.right<t.left?t.left-m.right:0;if(v<r){n=u,r=v,o=v&&n.nodeType==3?{left:m.right<t.left?m.right:m.left,top:t.top}:t,u.nodeType==1&&v&&(i=f+(t.left>=(m.left+m.right)/2?1:0));continue}}else m.top>t.top&&!l&&m.left<=t.left&&m.right>=t.left&&(l=u,c={left:Math.max(m.left,Math.min(m.right,t.left)),top:m.top});!n&&(t.left>=m.right&&t.top>=m.top||t.left>=m.left&&t.top>=m.bottom)&&(i=f+1)}}return!n&&l&&(n=l,o=c,r=0),n&&n.nodeType==3?Nee(n,o):!n||r&&n.nodeType==1?{node:e,offset:i}:WD(n,o)}function Nee(e,t){let n=e.nodeValue.length,r=document.createRange();for(let o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);let i=As(r,1);if(i.top!=i.bottom&&Ok(t,i))return{node:e,offset:o+(t.left>=(i.left+i.right)/2?1:0)}}return{node:e,offset:0}}function Ok(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Pee(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function _ee(e,t,n){let{node:r,offset:o}=WD(t,n),i=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return e.docView.posFromDOM(r,o,i)}function jee(e,t,n,r){let o=-1;for(let i=t,s=!1;i!=e.dom;){let a=e.docView.nearestDesc(i,!0);if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)){let l=a.dom.getBoundingClientRect();if(a.node.isBlock&&a.parent&&(!s&&l.left>r.left||l.top>r.top?o=a.posBefore:(!s&&l.right<r.left||l.bottom<r.top)&&(o=a.posAfter),s=!0),!a.contentDOM&&o<0&&!a.node.isText)return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter}i=a.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,-1)}function HD(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let s=e.childNodes[i];if(s.nodeType==1){let a=s.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(Ok(t,c))return HD(s,t,c)}}if((i=(i+1)%r)==o)break}return e}function Tee(e,t){let n=e.dom.ownerDocument,r,o=0,i=yee(n,t.left,t.top);i&&({node:r,offset:o}=i);let s=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),a;if(!s||!e.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=e.dom.getBoundingClientRect();if(!Ok(t,c)||(s=HD(e.dom,t,c),!s))return null}if(nr)for(let c=s;r&&c;c=Eh(c))c.draggable&&(r=void 0);if(s=Pee(s,t),r){if(ri&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],f;u.nodeName=="IMG"&&(f=u.getBoundingClientRect()).right<=t.left&&f.bottom>t.top&&o++}let c;kp&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=t.top&&o--,r==e.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?a=e.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(a=jee(e,r,o,t))}a==null&&(a=_ee(e,s,t));let l=e.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function UP(e){return e.top<e.bottom||e.left<e.right}function As(e,t){let n=e.getClientRects();if(n.length){let r=n[t<0?0:n.length-1];if(UP(r))return r}return Array.prototype.find.call(n,UP)||e.getBoundingClientRect()}const Oee=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function KD(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=kp||ri;if(r.nodeType==3)if(s&&(Oee.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let l=As(Bi(r,o,o),n);if(ri&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=As(Bi(r,o-1,o-1),-1);if(c.top==l.top){let u=As(Bi(r,o,o+1),-1);if(u.top!=l.top)return Td(u,u.left<c.left)}}return l}else{let l=o,c=o,u=n<0?1:-1;return n<0&&!o?(c++,u=-1):n>=0&&o==r.nodeValue.length?(l--,u=1):n<0?l--:c++,Td(As(Bi(r,l,c),u),u<0)}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(i==null&&o&&(n<0||o==uo(r))){let l=r.childNodes[o-1];if(l.nodeType==1)return m0(l.getBoundingClientRect(),!1)}if(i==null&&o<uo(r)){let l=r.childNodes[o];if(l.nodeType==1)return m0(l.getBoundingClientRect(),!0)}return m0(r.getBoundingClientRect(),n>=0)}if(i==null&&o&&(n<0||o==uo(r))){let l=r.childNodes[o-1],c=l.nodeType==3?Bi(l,uo(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return Td(As(c,1),!1)}if(i==null&&o<uo(r)){let l=r.childNodes[o];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?Bi(l,0,s?0:1):l.nodeType==1?l:null:null;if(c)return Td(As(c,-1),!0)}return Td(As(r.nodeType==3?Bi(r):r,-n),n>=0)}function Td(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function m0(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function GD(e,t,n){let r=e.state,o=e.root.activeElement;r!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),o!=e.dom&&o&&o.focus()}}function Mee(e,t,n){let r=t.selection,o=n=="up"?r.$from:r.$to;return GD(e,t,()=>{let{node:i}=e.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let a=e.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let s=KD(e,o.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Bi(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const Ree=/[\u0590-\u08ac]/;function Aee(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=e.domSelection();return a?!Ree.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:s:GD(e,t,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:f}=e.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",n,"character");let p=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:m,focusOffset:v}=e.domSelectionRange(),x=m&&!p.contains(m.nodeType==1?m:m.parentNode)||l==m&&c==v;try{a.collapse(u,f),l&&(l!=u||c!=f)&&a.extend&&a.extend(l,c)}catch{}return h!=null&&(a.caretBidiLevel=h),x}):r.pos==r.start()||r.pos==r.end()}let WP=null,HP=null,KP=!1;function Iee(e,t,n){return WP==t&&HP==n?KP:(WP=t,HP=n,KP=n=="up"||n=="down"?Mee(e,t,n):Aee(e,t,n))}const mo=0,GP=1,ul=2,Ci=3;class Ep{constructor(t,n,r,o){this.parent=t,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=mo,r.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,n,r){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let n=0;n<this.children.length;n++)t+=this.children[n].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let n=0,r=this.posAtStart;;n++){let o=this.children[n];if(o==t)return r;r+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(t,n,r){if(this.contentDOM&&this.contentDOM.contains(t.nodeType==1?t:t.parentNode))if(r<0){let i,s;if(t==this.contentDOM)i=t.childNodes[n-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(t==this.contentDOM)i=t.childNodes[n];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let o;if(t==this.dom&&this.contentDOM)o=n>Cn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=t;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&n==t.childNodes.length)for(let i=t;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(t,n=!1){for(let r=!0,o=t;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!n||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(t.nodeType==1?t:t.parentNode):s==t))r=!1;else return i}}getDesc(t){let n=t.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(t,n,r){for(let o=t;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(t,n,r)}return-1}descAt(t){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],i=r+o.size;if(r==t&&i!=r){for(;!o.border&&o.children.length;)o=o.children[0];return o}if(t<i)return o.descAt(t-r-o.border);r=i}}domFromPos(t,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],a=i+s.size;if(a>t||s instanceof YD){o=t-i;break}i=a}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof qD&&i.side>=0;r--);if(n<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?Cn(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?Cn(i.dom):this.contentDOM.childNodes.length}}}parseRange(t,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:t,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,i=-1;for(let s=r,a=0;;a++){let l=this.children[a],c=s+l.size;if(o==-1&&t<=c){let u=s+l.border;if(t>=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(t,n,u);t=s;for(let f=a;f>0;f--){let h=this.children[f-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){o=Cn(h.dom)+1;break}t-=h.size}o==-1&&(o=0)}if(o>-1&&(c>n||a==this.children.length-1)){n=c;for(let u=a+1;u<this.children.length;u++){let f=this.children[u];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=Cn(f.dom);break}n+=f.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:t,to:n,fromOffset:o,toOffset:i}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[t<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(t)}domAfterPos(t){let{node:n,offset:r}=this.domFromPos(t,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+t);return n.childNodes[r]}setSelection(t,n,r,o=!1){let i=Math.min(t,n),s=Math.max(t,n);for(let p=0,m=0;p<this.children.length;p++){let v=this.children[p],x=m+v.size;if(i>m&&s<x)return v.setSelection(t-m-v.border,n-m-v.border,r,o);m=x}let a=this.domFromPos(t,t?-1:1),l=n==t?a:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),f=!1;if((ri||nr)&&t==n){let{node:p,offset:m}=a;if(p.nodeType==3){if(f=!!(m&&p.nodeValue[m-1]==`
|
|
504
|
-
`),f&&m==p.nodeValue.length)for(let v=p,x;v;v=v.parentNode){if(x=v.nextSibling){x.nodeName=="BR"&&(a=l={node:x.parentNode,offset:Cn(x)+1});break}let b=v.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let v=p.childNodes[m-1];f=v&&(v.nodeName=="BR"||v.contentEditable=="false")}}if(ri&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let p=u.focusNode.childNodes[u.focusOffset];p&&p.contentEditable=="false"&&(o=!0)}if(!(o||f&&nr)&&Vl(a.node,a.offset,u.anchorNode,u.anchorOffset)&&Vl(l.node,l.offset,u.focusNode,u.focusOffset))return;let h=!1;if((c.extend||t==n)&&!f){c.collapse(a.node,a.offset);try{t!=n&&c.extend(l.node,l.offset),h=!0}catch{}}if(!h){if(t>n){let m=a;a=l,l=m}let p=document.createRange();p.setEnd(l.node,l.offset),p.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(p)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,n){for(let r=0,o=0;o<this.children.length;o++){let i=this.children[o],s=r+i.size;if(r==s?t<=s&&n>=r:t<s&&n>r){let a=r+i.border,l=s-i.border;if(t>=a&&n<=l){this.dirty=t==r||n==s?ul:GP,t==a&&n==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Ci:i.markDirty(t-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?ul:Ci}r=s}this.dirty=ul}markParentsDirty(){let t=1;for(let n=this.parent;n;n=n.parent,t++){let r=t==1?ul:GP;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(t){return!1}}class qD extends Ep{constructor(t,n,r,o){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(t,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(t){return this.dirty==mo&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let n=this.widget.spec.stopEvent;return n?n(t):!1}ignoreMutation(t){return t.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class Dee extends Ep{constructor(t,n,r,o){super(t,[],n,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(t,n){return t!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}}class Ul extends Ep{constructor(t,n,r,o,i){super(t,[],r,o),this.mark=n,this.spec=i}static create(t,n,r,o){let i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return(!s||!s.dom)&&(s=Ha.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Ul(t,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Ci||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=Ci&&this.mark.eq(t)}markDirty(t,n){if(super.markDirty(t,n),this.dirty!=mo){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=mo}}slice(t,n,r){let o=Ul.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=Sw(i,n,s,r)),t>0&&(i=Sw(i,0,t,r));for(let a=0;a<i.length;a++)i[a].parent=o;return o.children=i,o}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class ma extends Ep{constructor(t,n,r,o,i,s,a,l,c){super(t,[],i,s),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=a}static create(t,n,r,o,i,s){let a=i.nodeViews[n.type.name],l,c=a&&a(n,i,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,o),u=c&&c.dom,f=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:f}=Ha.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!f&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let h=u;return u=ZD(u,r,n),c?l=new Lee(t,n,r,o,u,f||null,h,c,i,s+1):n.isText?new My(t,n,r,o,u,h,i):new ma(t,n,r,o,u,f||null,h,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){t.contentElement=r.dom.parentNode;break}}t.contentElement||(t.getContent=()=>q.empty)}return t}matchesNode(t,n,r){return this.dirty==mo&&t.eq(this.node)&&rv(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,n){let r=this.node.inlineContent,o=n,i=t.composing?this.localCompositionInfo(t,n):null,s=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new zee(this,s&&s.node,t);Vee(this.node,this.innerDeco,(c,u,f)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,t):c.type.side>=0&&!f&&l.syncToMarks(u==this.node.childCount?ot.none:this.node.child(u).marks,r,t),l.placeWidget(c,t,o)},(c,u,f,h)=>{l.syncToMarks(c.marks,r,t);let p;l.findNodeMatch(c,u,f,h)||a&&t.state.selection.from>o&&t.state.selection.to<o+c.nodeSize&&(p=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(c,u,f,p,t)||l.updateNextNode(c,u,f,t,h,o)||l.addNode(c,u,f,t,o),o+=c.nodeSize}),l.syncToMarks([],r,t),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==ul)&&(s&&this.protectLocalComposition(t,s),JD(this.contentDOM,this.children,t),Mu&&Uee(this.dom))}localCompositionInfo(t,n){let{from:r,to:o}=t.state.selection;if(!(t.state.selection instanceof ze)||r<n||o>n+this.node.content.size)return null;let i=t.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,a=Wee(this.node.content,s,r-n,o-n);return a<0?null:{node:i,pos:a,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(t,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new Dee(this,i,n,o);t.input.compositionNodes.push(s),this.children=Sw(this.children,r,r+o.length,t,s)}update(t,n,r,o){return this.dirty==Ci||!t.sameMarkup(this.node)?!1:(this.updateInner(t,n,r,o),!0)}updateInner(t,n,r,o){this.updateOuterDeco(n),this.node=t,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=mo}updateOuterDeco(t){if(rv(t,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=XD(this.dom,this.nodeDOM,ww(this.outerDeco,this.node,n),ww(t,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function qP(e,t,n,r,o){ZD(r,t,e);let i=new ma(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class My extends ma{constructor(t,n,r,o,i,s,a){super(t,n,r,o,i,null,s,a,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,n,r,o){return this.dirty==Ci||this.dirty!=mo&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=mo||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=t.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=t,this.dirty=mo,!0)}inParent(){let t=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,n,r){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(t,n,r)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,n,r){let o=this.node.cut(t,n),i=document.createTextNode(o.text);return new My(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}markDirty(t,n){super.markDirty(t,n),this.dom!=this.nodeDOM&&(t==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Ci)}get domAtom(){return!1}isText(t){return this.node.text==t}}class YD extends Ep{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==mo&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Lee extends ma{constructor(t,n,r,o,i,s,a,l,c,u){super(t,n,r,o,i,s,a,c,u),this.spec=l}update(t,n,r,o){if(this.dirty==Ci)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let i=this.spec.update(t,n,r);return i&&this.updateInner(t,n,r,o),i}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,n,r,o){this.spec.setSelection?this.spec.setSelection(t,n,r.root):super.setSelection(t,n,r,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):!1}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function JD(e,t,n){let r=e.firstChild,o=!1;for(let i=0;i<t.length;i++){let s=t[i],a=s.dom;if(a.parentNode==e){for(;a!=r;)r=YP(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(a,r);if(s instanceof Ul){let l=r?r.previousSibling:e.lastChild;JD(s.contentDOM,s.children,n),r=l?l.nextSibling:e.firstChild}}for(;r;)r=YP(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const Tf=function(e){e&&(this.nodeName=e)};Tf.prototype=Object.create(null);const dl=[new Tf];function ww(e,t,n){if(e.length==0)return dl;let r=n?dl[0]:new Tf,o=[r];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&o.push(r=new Tf(s.nodeName));for(let a in s){let l=s[a];l!=null&&(n&&o.length==1&&o.push(r=new Tf(t.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return o}function XD(e,t,n,r){if(n==dl&&r==dl)return t;let o=t;for(let i=0;i<r.length;i++){let s=r[i],a=n[i];if(i){let l;a&&a.nodeName==s.nodeName&&o!=e&&(l=o.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(o),a=dl[0]),o=l}Fee(o,a||dl[0],s)}return o}function Fee(e,t,n){for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&e.classList.remove(r[i]);for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&e.classList.add(o[i]);e.classList.length==0&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(t.style);)e.style.removeProperty(o[1])}n.style&&(e.style.cssText+=n.style)}}function ZD(e,t,n){return XD(e,e,dl,ww(t,n,e.nodeType!=1))}function rv(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function YP(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class zee{constructor(t,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=$ee(t.node.content,t)}destroyBetween(t,n){if(t!=n){for(let r=t;r<n;r++)this.top.children[r].destroy();this.top.children.splice(t,n-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,n,r){let o=0,i=this.stack.length>>1,s=Math.min(i,t.length);for(;o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(t[o])&&t[o].type.spec.spanning!==!1;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=mo,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<t.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let c=this.top.children[l];if(c.matchesMark(t[i])&&!this.isLocked(c.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=Ul.create(this.top,t[i],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}}findNodeMatch(t,n,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(t,n,r))i=this.top.children.indexOf(s,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(t,n,r)&&!this.preMatch.matched.has(c)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(t,n,r,o,i){let s=this.top.children[o];return s.dirty==Ci&&s.dom==s.contentDOM&&(s.dirty=ul),s.update(t,n,r,i)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(t){for(;;){let n=t.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=t.pmViewDesc;if(r){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}t=n}}updateNextNode(t,n,r,o,i,s){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof ma){let c=this.preMatch.matched.get(l);if(c!=null&&c!=i)return!1;let u=l.dom,f,h=this.isLocked(u)&&!(t.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==t.text&&l.dirty!=Ci&&rv(n,l.outerDeco));if(!h&&l.update(t,n,r,o))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!h&&(f=this.recreateWrapper(l,t,n,r,o,s)))return this.destroyBetween(this.index,a),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=ul,f.updateChildren(o,s+1),f.dirty=mo),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,n,r,o,i,s){if(t.dirty||n.isAtom||!t.children.length||!t.node.content.eq(n.content)||!rv(r,t.outerDeco)||!o.eq(t.innerDeco))return null;let a=ma.create(this.top,n,r,o,i,s);if(a.contentDOM){a.children=t.children,t.children=[];for(let l of a.children)l.parent=a}return t.destroy(),a}addNode(t,n,r,o,i){let s=ma.create(this.top,t,n,r,o,i);s.contentDOM&&s.updateChildren(o,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(t,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(t)&&(t==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let i=new qD(this.top,t,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let t=this.top.children[this.index-1],n=this.top;for(;t instanceof Ul;)n=t,t=n.children[n.children.length-1];(!t||!(t instanceof My)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((nr||Un)&&t&&t.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(t,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(t))this.index++;else{let r=document.createElement(t);t=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),t=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new YD(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0}}isLocked(t){return this.lock&&(t==this.lock||t.nodeType==1&&t.contains(this.lock.parentNode))}}function $ee(e,t){let n=t,r=n.children.length,o=e.childCount,i=new Map,s=[];e:for(;o>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof Ul)n=c,r=c.children.length;else{a=c,r--;break}}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=e.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}function Bee(e,t){return e.type.side-t.type.side}function Vee(e,t,n,r){let o=t.locals(e),i=0;if(o.length==0){for(let c=0;c<e.childCount;c++){let u=e.child(c);r(u,o,t.forChild(i,u),c),i+=u.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let u,f;for(;s<o.length&&o[s].to==i;){let x=o[s++];x.widget&&(u?(f||(f=[u])).push(x):u=x)}if(u)if(f){f.sort(Bee);for(let x=0;x<f.length;x++)n(f[x],c,!!l)}else n(u,c,!!l);let h,p;if(l)p=-1,h=l,l=null;else if(c<e.childCount)p=c,h=e.child(c++);else break;for(let x=0;x<a.length;x++)a[x].to<=i&&a.splice(x--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);let m=i+h.nodeSize;if(h.isText){let x=m;s<o.length&&o[s].from<x&&(x=o[s].from);for(let b=0;b<a.length;b++)a[b].to<x&&(x=a[b].to);x<m&&(l=h.cut(x-i),h=h.cut(0,x-i),m=x,p=-1)}else for(;s<o.length&&o[s].to<m;)s++;let v=h.isInline&&!h.isLeaf?a.filter(x=>!x.inline):a.slice();r(h,v,t.forChild(i,h),p),i=m}}function Uee(e){if(e.nodeName=="UL"||e.nodeName=="OL"){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}function Wee(e,t,n,r){for(let o=0,i=0;o<e.childCount&&i<=r;){let s=e.child(o++),a=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;o<e.childCount;){let c=e.child(o++);if(i+=c.nodeSize,!c.isText)break;l+=c.text}if(i>=n){if(i>=r&&l.slice(r-t.length-a,r-a)==t)return r-t.length;let c=a<r?l.lastIndexOf(t,r-a-1):-1;if(c>=0&&c+t.length+a>=n)return a+c;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return-1}function Sw(e,t,n,r,o){let i=[];for(let s=0,a=0;s<e.length;s++){let l=e[s],c=a,u=a+=l.size;c>=n||u<=t?i.push(l):(c<t&&i.push(l.slice(0,t-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function Mk(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let o=e.docView.nearestDesc(n.focusNode),i=o&&o.size==0,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,c;if(Oy(n)){for(l=s;o&&!o.node;)o=o.parent;let f=o.node;if(o&&f.isAtom&&Me.isSelectable(f)&&o.parent&&!(f.isInline&&gee(n.focusNode,n.focusOffset,o.dom))){let h=o.posBefore;c=new Me(s==h?a:r.resolve(h))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let f=s,h=s;for(let p=0;p<n.rangeCount;p++){let m=n.getRangeAt(p);f=Math.min(f,e.docView.posFromDOM(m.startContainer,m.startOffset,1)),h=Math.max(h,e.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[l,s]=h==e.state.selection.anchor?[h,f]:[f,h],a=r.resolve(s)}else l=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let f=t=="pointer"||e.state.selection.head<a.pos&&!i?1:-1;c=Rk(e,u,a,f)}return c}function QD(e){return e.editable?e.hasFocus():tL(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function es(e,t=!1){let n=e.state.selection;if(eL(e,n),!!QD(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&Un){let r=e.domSelectionRange(),o=e.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&Vl(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)Kee(e);else{let{anchor:r,head:o}=n,i,s;JP&&!(n instanceof ze)&&(n.$from.parent.inlineContent||(i=XP(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=XP(e,n.to))),e.docView.setSelection(r,o,e,t),JP&&(i&&ZP(i),s&&ZP(s)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Hee(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const JP=nr||Un&&BD<63;function XP(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(nr&&o&&o.contentEditable=="false")return g0(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return g0(o);if(i)return g0(i)}}function g0(e){return e.contentEditable="true",nr&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function ZP(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function Hee(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!QD(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function Kee(e){let t=e.domSelection(),n=document.createRange();if(!t)return;let r=e.cursorWrapper.dom,o=r.nodeName=="IMG";o?n.setStart(r.parentNode,Cn(r)+1):n.setStart(r,0),n.collapse(!0),t.removeAllRanges(),t.addRange(n),!o&&!e.state.selection.visible&&xr&&pa<=11&&(r.disabled=!0,r.disabled=!1)}function eL(e,t){if(t instanceof Me){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(QP(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else QP(e)}function QP(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Rk(e,t,n,r){return e.someProp("createSelectionBetween",o=>o(e,t,n))||ze.between(t,n,r)}function e_(e){return e.editable&&!e.hasFocus()?!1:tL(e)}function tL(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function Gee(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Vl(t.node,t.offset,n.anchorNode,n.anchorOffset)}function kw(e,t){let{$anchor:n,$head:r}=e.selection,o=t>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return i&&Ge.findFrom(i,t)}function Bs(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function t_(e,t,n){let r=e.state.selection;if(r instanceof ze)if(n.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=e.state.doc.resolve(o.pos+i.nodeSize*(t<0?-1:1));return Bs(e,new ze(r.$anchor,s))}else if(r.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let o=kw(e.state,t);return o&&o instanceof Me?Bs(e,o):!1}else if(!(so&&n.indexOf("m")>-1)){let o=r.$head,i=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let a=t<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=e.docView.descAt(a))&&!s.contentDOM?Me.isSelectable(i)?Bs(e,new Me(t<0?e.state.doc.resolve(o.pos-i.nodeSize):o)):kp?Bs(e,new ze(e.state.doc.resolve(t<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Me&&r.node.isInline)return Bs(e,new ze(t>0?r.$to:r.$from));{let o=kw(e.state,t);return o?Bs(e,o):!1}}}function ov(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Of(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function mc(e,t){return t<0?qee(e):Yee(e)}function qee(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=!1;for(ri&&n.nodeType==1&&r<ov(n)&&Of(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Of(a,-1))o=n,i=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(nL(n))break;{let a=n.previousSibling;for(;a&&Of(a,-1);)o=n.parentNode,i=Cn(a),a=a.previousSibling;if(a)n=a,r=ov(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}s?Ew(e,n,r):o&&Ew(e,o,i)}function Yee(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o=ov(n),i,s;for(;;)if(r<o){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Of(a,1))i=n,s=++r;else break}else{if(nL(n))break;{let a=n.nextSibling;for(;a&&Of(a,1);)i=a.parentNode,s=Cn(a)+1,a=a.nextSibling;if(a)n=a,r=0,o=ov(n);else{if(n=n.parentNode,n==e.dom)break;r=o=0}}}i&&Ew(e,i,s)}function nL(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Jee(e,t){for(;e&&t==e.childNodes.length&&!Sp(e);)t=Cn(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;e=n,t=0}}function Xee(e,t){for(;e&&!t&&!Sp(e);)t=Cn(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;e=n,t=e.childNodes.length}}function Ew(e,t,n){if(t.nodeType!=3){let i,s;(s=Jee(t,n))?(t=s,n=0):(i=Xee(t,n))&&(t=i,n=i.nodeValue.length)}let r=e.domSelection();if(!r)return;if(Oy(r)){let i=document.createRange();i.setEnd(t,n),i.setStart(t,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:o}=e;setTimeout(()=>{e.state==o&&es(e)},50)}function n_(e,t){let n=e.state.doc.resolve(t);if(!(Un||xee)&&n.parent.inlineContent){let o=e.coordsAtPos(t);if(t>n.start()){let i=e.coordsAtPos(t-1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left<o.left?"ltr":"rtl"}if(t<n.end()){let i=e.coordsAtPos(t+1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left>o.left?"ltr":"rtl"}}return getComputedStyle(e.dom).direction=="rtl"?"rtl":"ltr"}function r_(e,t,n){let r=e.state.selection;if(r instanceof ze&&!r.empty||n.indexOf("s")>-1||so&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let s=kw(e.state,t);if(s&&s instanceof Me)return Bs(e,s)}if(!o.parent.inlineContent){let s=t<0?o:i,a=r instanceof Qn?Ge.near(s,t):Ge.findFrom(s,t);return a?Bs(e,a):!1}return!1}function o_(e,t){if(!(e.state.selection instanceof ze))return!0;let{$head:n,$anchor:r,empty:o}=e.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let i=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=e.state.tr;return t<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),e.dispatch(s),!0}return!1}function i_(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Zee(e){if(!nr||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let r=t.firstChild;i_(e,r,"true"),setTimeout(()=>i_(e,r,"false"),20)}return!1}function Qee(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function ete(e,t){let n=t.keyCode,r=Qee(t);if(n==8||so&&n==72&&r=="c")return o_(e,-1)||mc(e,-1);if(n==46&&!t.shiftKey||so&&n==68&&r=="c")return o_(e,1)||mc(e,1);if(n==13||n==27)return!0;if(n==37||so&&n==66&&r=="c"){let o=n==37?n_(e,e.state.selection.from)=="ltr"?-1:1:-1;return t_(e,o,r)||mc(e,o)}else if(n==39||so&&n==70&&r=="c"){let o=n==39?n_(e,e.state.selection.from)=="ltr"?1:-1:1;return t_(e,o,r)||mc(e,o)}else{if(n==38||so&&n==80&&r=="c")return r_(e,-1,r)||mc(e,-1);if(n==40||so&&n==78&&r=="c")return Zee(e)||r_(e,1,r)||mc(e,1);if(r==(so?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function rL(e,t){e.someProp("transformCopied",p=>{t=p(t,e)});let n=[],{content:r,openStart:o,openEnd:i}=t;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=e.someProp("clipboardSerializer")||Ha.fromSchema(e.state.schema),a=cL(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,u,f=0;for(;c&&c.nodeType==1&&(u=lL[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let m=a.createElement(u[p]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),f++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${i}${f?` -${f}`:""} ${JSON.stringify(n)}`);let h=e.someProp("clipboardTextSerializer",p=>p(t,e))||t.content.textBetween(0,t.content.size,`
|
|
505
|
-
|
|
506
|
-
`);return{dom:l,text:h,slice:t}}function oL(e,t,n,r,o){let i=o.parent.type.spec.code,s,a;if(!n&&!t)return null;let l=t&&(r||i||!n);if(l){if(e.someProp("transformPastedText",h=>{t=h(t,i||r,e)}),i)return t?new ae(q.from(e.state.schema.text(t.replace(/\r\n?/g,`
|
|
507
|
-
`))),0,0):ae.empty;let f=e.someProp("clipboardTextParser",h=>h(t,o,r,e));if(f)a=f;else{let h=o.marks(),{schema:p}=e.state,m=Ha.fromSchema(p);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(v=>{let x=s.appendChild(document.createElement("p"));v&&x.appendChild(m.serializeNode(p.text(v,h)))})}}else e.someProp("transformPastedHTML",f=>{n=f(n,e)}),s=ote(n),kp&&ite(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let h=s.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;s=h}if(a||(a=(e.someProp("clipboardParser")||e.someProp("domParser")||ju.fromSchema(e.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||u),context:o,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!tte.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)a=ste(s_(a,+u[1],+u[2]),u[4]);else if(a=ae.maxOpen(nte(a.content,o),!0),a.openStart||a.openEnd){let f=0,h=0;for(let p=a.content.firstChild;f<a.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=a.content.lastChild;h<a.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);a=s_(a,f,h)}return e.someProp("transformPasted",f=>{a=f(a,e)}),a}const tte=/^(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 nte(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let o=t.node(n).contentMatchAt(t.index(n)),i,s=[];if(e.forEach(a=>{if(!s)return;let l=o.findWrapping(a.type),c;if(!l)return s=null;if(c=s.length&&i.length&&sL(l,i,a,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=aL(s[s.length-1],i.length));let u=iL(a,l);s.push(u),o=o.matchType(u.type),i=l}}),s)return q.from(s)}return e}function iL(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,q.from(e));return e}function sL(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){let i=sL(e,t,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==e.length-1?n.type:e[o+1]))return r.copy(r.content.append(q.from(iL(n,e,o+1))))}}function aL(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,aL(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(q.empty,!0);return e.copy(n.append(r))}function Cw(e,t,n,r,o,i){let s=t<0?e.firstChild:e.lastChild,a=s.content;return e.childCount>1&&(i=0),o<r-1&&(a=Cw(a,t,n,r,o+1,i)),o>=n&&(a=t<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(q.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function s_(e,t,n){return t<e.openStart&&(e=new ae(Cw(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new ae(Cw(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const lL={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let a_=null;function cL(){return a_||(a_=document.implementation.createHTMLDocument("title"))}let v0=null;function rte(e){let t=window.trustedTypes;return t?(v0||(v0=t.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),v0.createHTML(e)):e}function ote(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=cL().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(e),o;if((o=r&&lL[r[1].toLowerCase()])&&(e=o.map(i=>"<"+i+">").join("")+e+o.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=rte(e),o)for(let i=0;i<o.length;i++)n=n.querySelector(o[i])||n;return n}function ite(e){let t=e.querySelectorAll(Un?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}function ste(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:o,openStart:i,openEnd:s}=e;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;o=q.from(l.create(r[a+1],o)),i++,s++}return new ae(o,i,s)}const rr={},or={},ate={touchstart:!0,touchmove:!0};class lte{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function cte(e){for(let t in rr){let n=rr[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=r=>{dte(e,r)&&!Ak(e,r)&&(e.editable||!(r.type in or))&&n(e,r)},ate[t]?{passive:!0}:void 0)}nr&&e.dom.addEventListener("input",()=>null),Nw(e)}function na(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function ute(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function Nw(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=r=>Ak(e,r))})}function Ak(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function dte(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function fte(e,t){!Ak(e,t)&&rr[t.type]&&(e.editable||!(t.type in or))&&rr[t.type](e,t)}or.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!dL(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(zo&&Un&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),Mu&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();e.input.lastIOSEnter=r,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==r&&(e.someProp("handleKeyDown",o=>o(e,ol(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",r=>r(e,n))||ete(e,n)?n.preventDefault():na(e,"key")};or.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};or.keypress=(e,t)=>{let n=t;if(dL(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||so&&n.metaKey)return;if(e.someProp("handleKeyPress",o=>o(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof ze)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode);!/[\r\n]/.test(o)&&!e.someProp("handleTextInput",i=>i(e,r.$from.pos,r.$to.pos,o))&&e.dispatch(e.state.tr.insertText(o).scrollIntoView()),n.preventDefault()}};function Ry(e){return{left:e.clientX,top:e.clientY}}function hte(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function Ik(e,t,n,r,o){if(r==-1)return!1;let i=e.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(e.someProp(t,a=>s>i.depth?a(e,n,i.nodeAfter,i.before(s),o,!0):a(e,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function tu(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);r.setMeta("pointer",!0),e.dispatch(r)}function pte(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&Me.isSelectable(r)?(tu(e,new Me(n)),!0):!1}function mte(e,t){if(t==-1)return!1;let n=e.state.selection,r,o;n instanceof Me&&(r=n.node);let i=e.state.doc.resolve(t);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s);if(Me.isSelectable(a)){r&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?o=i.before(n.$from.depth):o=i.before(s);break}}return o!=null?(tu(e,Me.create(e.state.doc,o)),!0):!1}function gte(e,t,n,r,o){return Ik(e,"handleClickOn",t,n,r)||e.someProp("handleClick",i=>i(e,t,r))||(o?mte(e,n):pte(e,n))}function vte(e,t,n,r){return Ik(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",o=>o(e,t,r))}function yte(e,t,n,r){return Ik(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",o=>o(e,t,r))||xte(e,n,r)}function xte(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(tu(e,ze.create(r,0,r.content.size)),!0):!1;let o=r.resolve(t);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),a=o.before(i);if(s.inlineContent)tu(e,ze.create(r,a+1,a+1+s.content.size));else if(Me.isSelectable(s))tu(e,Me.create(r,a));else continue;return!0}}function Dk(e){return iv(e)}const uL=so?"metaKey":"ctrlKey";rr.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=Dk(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&hte(n,e.input.lastClick)&&!n[uL]&&(e.input.lastClick.type=="singleClick"?i="doubleClick":e.input.lastClick.type=="doubleClick"&&(i="tripleClick")),e.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i};let s=e.posAtCoords(Ry(n));s&&(i=="singleClick"?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new bte(e,s,n,!!r)):(i=="doubleClick"?vte:yte)(e,s.pos,s.inside,n)?n.preventDefault():na(e,"pointer"))};class bte{constructor(t,n,r,o){this.view=t,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!r[uL],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=t.state.doc.nodeAt(n.inside),s=n.inside;else{let u=t.state.doc.resolve(n.pos);i=u.parent,s=u.depth?u.before():0}const a=o?null:r.target,l=a?t.docView.nearestDesc(a,!0):null;this.target=l&&l.dom.nodeType==1?l.dom:null;let{selection:c}=t.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof Me&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&ri&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),na(t,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>es(this.view)),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Ry(t))),this.updateAllowDefault(t),this.allowDefault||!n?na(this.view,"pointer"):gte(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||nr&&this.mightDrag&&!this.mightDrag.node.isAtom||Un&&!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)?(tu(this.view,Ge.near(this.view.state.doc.resolve(n.pos))),t.preventDefault()):na(this.view,"pointer")}move(t){this.updateAllowDefault(t),na(this.view,"pointer"),t.buttons==0&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}rr.touchstart=e=>{e.input.lastTouch=Date.now(),Dk(e),na(e,"pointer")};rr.touchmove=e=>{e.input.lastTouch=Date.now(),na(e,"pointer")};rr.contextmenu=e=>Dk(e);function dL(e,t){return e.composing?!0:nr&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const wte=zo?5e3:-1;or.compositionstart=or.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof ze&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))e.markCursor=e.state.storedMarks||n.marks(),iv(e,!0),e.markCursor=null;else if(iv(e,!t.selection.empty),ri&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=e.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){let a=e.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else o=s,i=-1}}e.input.composing=!0}fL(e,wte)};or.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,fL(e,20))};function fL(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>iv(e),t))}function hL(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=kte());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Ste(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=pee(t.focusNode,t.focusOffset),r=mee(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function kte(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function iv(e,t=!1){if(!(zo&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),hL(e),t||e.docView&&e.docView.dirty){let n=Mk(e);return n&&!n.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!e.state.selection.empty?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function Ete(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}const Ch=xr&&pa<15||Mu&&bee<604;rr.copy=or.cut=(e,t)=>{let n=t,r=e.state.selection,o=n.type=="cut";if(r.empty)return;let i=Ch?null:n.clipboardData,s=r.content(),{dom:a,text:l}=rL(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):Ete(e,a),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Cte(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function Nte(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Nh(e,r.value,null,o,t):Nh(e,r.textContent,r.innerHTML,o,t)},50)}function Nh(e,t,n,r,o){let i=oL(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",l=>l(e,o,i||ae.empty)))return!0;if(!i)return!1;let s=Cte(i),a=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function pL(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}or.paste=(e,t)=>{let n=t;if(e.composing&&!zo)return;let r=Ch?null:n.clipboardData,o=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&Nh(e,pL(r),r.getData("text/html"),o,n)?n.preventDefault():Nte(e,n)};class mL{constructor(t,n,r){this.slice=t,this.move=n,this.node=r}}const gL=so?"altKey":"ctrlKey";rr.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=e.state.selection,i=o.empty?null:e.posAtCoords(Ry(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof Me?o.to-1:o.to))){if(r&&r.mightDrag)s=Me.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=e.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=e.docView&&(s=Me.create(e.state.doc,f.posBefore))}}let a=(s||e.state.selection).content(),{dom:l,text:c,slice:u}=rL(e,a);(!n.dataTransfer.files.length||!Un||BD>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Ch?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Ch||n.dataTransfer.setData("text/plain",c),e.dragging=new mL(u,!n[gL],s)};rr.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};or.dragover=or.dragenter=(e,t)=>t.preventDefault();or.drop=(e,t)=>{let n=t,r=e.dragging;if(e.dragging=null,!n.dataTransfer)return;let o=e.posAtCoords(Ry(n));if(!o)return;let i=e.state.doc.resolve(o.pos),s=r&&r.slice;s?e.someProp("transformPasted",m=>{s=m(s,e)}):s=oL(e,pL(n.dataTransfer),Ch?null:n.dataTransfer.getData("text/html"),!1,i);let a=!!(r&&!n[gL]);if(e.someProp("handleDrop",m=>m(e,n,s||ae.empty,a))){n.preventDefault();return}if(!s)return;n.preventDefault();let l=s?jD(e.state.doc,i.pos,s):i.pos;l==null&&(l=i.pos);let c=e.state.tr;if(a){let{node:m}=r;m?m.replace(c):c.deleteSelection()}let u=c.mapping.map(l),f=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,h=c.doc;if(f?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(h))return;let p=c.doc.resolve(u);if(f&&Me.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new Me(p));else{let m=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((v,x,b,w)=>m=w),c.setSelection(Rk(e,p,c.doc.resolve(m)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))};rr.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&es(e)},20))};rr.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)};rr.beforeinput=(e,t)=>{if(Un&&zo&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:r}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=r||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",i=>i(e,ol(8,"Backspace")))))return;let{$cursor:o}=e.state.selection;o&&o.pos>0&&e.dispatch(e.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let e in or)rr[e]=or[e];function Ph(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class sv{constructor(t,n){this.toDOM=t,this.spec=n||xl,this.side=this.spec.side||0}map(t,n,r,o){let{pos:i,deleted:s}=t.mapResult(n.from+o,this.side<0?-1:1);return s?null:new _t(i-r,i-r,this)}valid(){return!0}eq(t){return this==t||t instanceof sv&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Ph(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class ga{constructor(t,n){this.attrs=t,this.spec=n||xl}map(t,n,r,o){let i=t.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,s=t.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new _t(i,s,this)}valid(t,n){return n.from<n.to}eq(t){return this==t||t instanceof ga&&Ph(this.attrs,t.attrs)&&Ph(this.spec,t.spec)}static is(t){return t.type instanceof ga}destroy(){}}class Lk{constructor(t,n){this.attrs=t,this.spec=n||xl}map(t,n,r,o){let i=t.mapResult(n.from+o,1);if(i.deleted)return null;let s=t.mapResult(n.to+o,-1);return s.deleted||s.pos<=i.pos?null:new _t(i.pos-r,s.pos-r,this)}valid(t,n){let{index:r,offset:o}=t.content.findIndex(n.from),i;return o==n.from&&!(i=t.child(r)).isText&&o+i.nodeSize==n.to}eq(t){return this==t||t instanceof Lk&&Ph(this.attrs,t.attrs)&&Ph(this.spec,t.spec)}destroy(){}}class _t{constructor(t,n,r){this.from=t,this.to=n,this.type=r}copy(t,n){return new _t(t,n,this.type)}eq(t,n=0){return this.type.eq(t.type)&&this.from+n==t.from&&this.to+n==t.to}map(t,n,r){return this.type.map(t,this,n,r)}static widget(t,n,r){return new _t(t,t,new sv(n,r))}static inline(t,n,r,o){return new _t(t,n,new ga(r,o))}static node(t,n,r,o){return new _t(t,n,new Lk(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof ga}get widget(){return this.type instanceof sv}}const kc=[],xl={};class at{constructor(t,n){this.local=t.length?t:kc,this.children=n.length?n:kc}static create(t,n){return n.length?av(n,t,0,xl):Bn}find(t,n,r){let o=[];return this.findInner(t??0,n??1e9,o,0,r),o}findInner(t,n,r,o,i){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=n&&a.to>=t&&(!i||i(a.spec))&&r.push(a.copy(a.from+o,a.to+o))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>t){let a=this.children[s]+1;this.children[s+2].findInner(t-a,n-a,r,o+a,i)}}map(t,n,r){return this==Bn||t.maps.length==0?this:this.mapInner(t,n,0,0,r||xl)}mapInner(t,n,r,o,i){let s;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(t,r,o);l&&l.type.valid(n,l)?(s||(s=[])).push(l):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?Pte(this.children,s||[],t,n,r,o,i):s?new at(s.sort(bl),kc):Bn}add(t,n){return n.length?this==Bn?at.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let o,i=0;t.forEach((a,l)=>{let c=l+r,u;if(u=yL(n,a,c)){for(o||(o=this.children.slice());i<o.length&&o[i]<l;)i+=3;o[i]==l?o[i+2]=o[i+2].addInner(a,u,c+1):o.splice(i,0,l,l+a.nodeSize,av(u,a,c+1,xl)),i+=3}});let s=vL(i?xL(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(t,s[a])||s.splice(a--,1);return new at(s.length?this.local.concat(s).sort(bl):this.local,o||this.children)}remove(t){return t.length==0||this==Bn?this:this.removeInner(t,0)}removeInner(t,n){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,a=r[i]+n,l=r[i+1]+n;for(let u=0,f;u<t.length;u++)(f=t[u])&&f.from>a&&f.to<l&&(t[u]=null,(s||(s=[])).push(f));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(s,a+1);c!=Bn?r[i+2]=c:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<t.length;i++)if(s=t[i])for(let a=0;a<o.length;a++)o[a].eq(s,n)&&(o==this.local&&(o=this.local.slice()),o.splice(a--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new at(o,r):Bn}forChild(t,n){if(this==Bn)return this;if(n.isLeaf)return at.empty;let r,o;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=t){this.children[a]==t&&(r=this.children[a+2]);break}let i=t+1,s=i+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<s&&l.to>i&&l.type instanceof ga){let c=Math.max(i,l.from)-i,u=Math.min(s,l.to)-i;c<u&&(o||(o=[])).push(l.copy(c,u))}}if(o){let a=new at(o.sort(bl),kc);return r?new Ks([a,r]):a}return r||Bn}eq(t){if(this==t)return!0;if(!(t instanceof at)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(t.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=t.children[n]||this.children[n+1]!=t.children[n+1]||!this.children[n+2].eq(t.children[n+2]))return!1;return!0}locals(t){return Fk(this.localsInner(t))}localsInner(t){if(this==Bn)return kc;if(t.inlineContent||!this.local.some(ga.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof ga||n.push(this.local[r]);return n}forEachSet(t){t(this)}}at.empty=new at([],[]);at.removeOverlap=Fk;const Bn=at.empty;class Ks{constructor(t){this.members=t}map(t,n){const r=this.members.map(o=>o.map(t,n,xl));return Ks.from(r)}forChild(t,n){if(n.isLeaf)return at.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(t,n);i!=Bn&&(i instanceof Ks?r=r.concat(i.members):r.push(i))}return Ks.from(r)}eq(t){if(!(t instanceof Ks)||t.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(t.members[n]))return!1;return!0}locals(t){let n,r=!0;for(let o=0;o<this.members.length;o++){let i=this.members[o].localsInner(t);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?Fk(r?n:n.sort(bl)):kc}static from(t){switch(t.length){case 0:return Bn;case 1:return t[0];default:return new Ks(t.every(n=>n instanceof at)?t:t.reduce((n,r)=>n.concat(r instanceof at?r:r.members),[]))}}forEachSet(t){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(t)}}function Pte(e,t,n,r,o,i,s){let a=e.slice();for(let c=0,u=i;c<n.maps.length;c++){let f=0;n.maps[c].forEach((h,p,m,v)=>{let x=v-m-(p-h);for(let b=0;b<a.length;b+=3){let w=a[b+1];if(w<0||h>w+u-f)continue;let S=a[b]+u-f;p>=S?a[b+1]=h<=S?-2:-1:h>=u&&x&&(a[b]+=x,a[b+1]+=x)}f+=x}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=n.map(e[c]+i),f=u-o;if(f<0||f>=r.content.size){l=!0;continue}let h=n.map(e[c+1]+i,-1),p=h-o,{index:m,offset:v}=r.content.findIndex(f),x=r.maybeChild(m);if(x&&v==f&&v+x.nodeSize==p){let b=a[c+2].mapInner(n,x,u+1,e[c]+i+1,s);b!=Bn?(a[c]=f,a[c+1]=p,a[c+2]=b):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=_te(a,e,t,n,o,i,s),u=av(c,r,0,s);t=u.local;for(let f=0;f<a.length;f+=3)a[f+1]<0&&(a.splice(f,3),f-=3);for(let f=0,h=0;f<u.children.length;f+=3){let p=u.children[f];for(;h<a.length&&a[h]<p;)h+=3;a.splice(h,0,u.children[f],u.children[f+1],u.children[f+2])}}return new at(t.sort(bl),a)}function vL(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let o=e[r];n.push(new _t(o.from+t,o.to+t,o.type))}return n}function _te(e,t,n,r,o,i,s){function a(l,c){for(let u=0;u<l.local.length;u++){let f=l.local[u].map(r,o,c);f?n.push(f):s.onRemove&&s.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<e.length;l+=3)e[l+1]==-1&&a(e[l+2],t[l]+i+1);return n}function yL(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,o=null;for(let i=0,s;i<e.length;i++)(s=e[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),e[i]=null);return o}function xL(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function av(e,t,n,r){let o=[],i=!1;t.forEach((a,l)=>{let c=yL(e,a,l+n);if(c){i=!0;let u=av(c,a,n+l+1,r);u!=Bn&&o.push(l,l+a.nodeSize,u)}});let s=vL(i?xL(e):e,-n).sort(bl);for(let a=0;a<s.length;a++)s[a].type.valid(t,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new at(s,o):Bn}function bl(e,t){return e.from-t.from||e.to-t.to}function Fk(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let o=n+1;o<t.length;o++){let i=t[o];if(i.from==r.from){i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),l_(t,o+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),l_(t,o,r.copy(i.from,r.to)));break}}}return t}function l_(e,t,n){for(;t<e.length&&bl(n,e[t])>0;)t++;e.splice(t,0,n)}function y0(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=Bn&&t.push(r)}),e.cursorWrapper&&t.push(at.create(e.state.doc,[e.cursorWrapper.deco])),Ks.from(t)}const jte={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Tte=xr&&pa<=11;class Ote{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class Mte{constructor(t,n){this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Ote,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);xr&&pa<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),Tte&&(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,jte)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let n=0;n<t.length;n++)this.queue.push(t[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(e_(this.view)){if(this.suppressingSelectionUpdates)return es(this.view);if(xr&&pa<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&Vl(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let n=new Set,r;for(let i=t.focusNode;i;i=Eh(i))n.add(i);for(let i=t.anchorNode;i;i=Eh(i))if(n.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=t.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&e_(t)&&!this.ignoreSelectionChange(r),i=-1,s=-1,a=!1,l=[];if(t.editable)for(let u=0;u<n.length;u++){let f=this.registerMutation(n[u],l);f&&(i=i<0?f.from:Math.min(f.from,i),s=s<0?f.to:Math.max(f.to,s),f.typeOver&&(a=!0))}if(ri&&l.length){let u=l.filter(f=>f.nodeName=="BR");if(u.length==2){let[f,h]=u;f.parentNode&&f.parentNode.parentNode==h.parentNode?h.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let h of u){let p=h.parentNode;p&&p.nodeName=="LI"&&(!f||Ite(t,f)!=p)&&h.remove()}}}let c=null;i<0&&o&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&Oy(r)&&(c=Mk(t))&&c.eq(Ge.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,es(t),this.currentSelection.set(r),t.scrollToSelection()):(i>-1||o)&&(i>-1&&(t.docView.markDirty(i,s),Rte(t)),this.handleDOMChange(i,s,a,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||es(t),this.currentSelection.set(r))}registerMutation(t,n){if(n.indexOf(t.target)>-1)return null;let r=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(r==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!r||r.ignoreMutation(t))return null;if(t.type=="childList"){for(let u=0;u<t.addedNodes.length;u++){let f=t.addedNodes[u];n.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(t.target))return{from:r.posBefore,to:r.posAfter};let o=t.previousSibling,i=t.nextSibling;if(xr&&pa<=11&&t.addedNodes.length)for(let u=0;u<t.addedNodes.length;u++){let{previousSibling:f,nextSibling:h}=t.addedNodes[u];(!f||Array.prototype.indexOf.call(t.addedNodes,f)<0)&&(o=f),(!h||Array.prototype.indexOf.call(t.addedNodes,h)<0)&&(i=h)}let s=o&&o.parentNode==t.target?Cn(o)+1:0,a=r.localPosFromDOM(t.target,s,-1),l=i&&i.parentNode==t.target?Cn(i):t.target.childNodes.length,c=r.localPosFromDOM(t.target,l,1);return{from:a,to:c}}else return t.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=t.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:t.target.nodeValue==t.oldValue})}}let c_=new WeakMap,u_=!1;function Rte(e){if(!c_.has(e)&&(c_.set(e,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=ri,u_)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),u_=!0}}function d_(e,t){let n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return Vl(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function Ate(e,t){if(t.getComposedRanges){let o=t.getComposedRanges(e.root)[0];if(o)return d_(e,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?d_(e,n):null}function Ite(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let r=e.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function Dte(e,t,n){let{node:r,fromOffset:o,toOffset:i,from:s,to:a}=e.docView.parseRange(t,n),l=e.domSelectionRange(),c,u=l.anchorNode;if(u&&e.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],Oy(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Un&&e.input.lastKeyCode===8)for(let x=i;x>o;x--){let b=r.childNodes[x-1],w=b.pmViewDesc;if(b.nodeName=="BR"&&!w){i=x;break}if(!w||w.size)break}let f=e.state.doc,h=e.someProp("domParser")||ju.fromSchema(e.state.schema),p=f.resolve(s),m=null,v=h.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:i,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Lte,context:p});if(c&&c[0].pos!=null){let x=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=x),m={anchor:x+s,head:b+s}}return{doc:v,sel:m,from:s,to:a}}function Lte(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(nr&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(e.parentNode.lastChild==e||nr&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Fte=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function zte(e,t,n,r,o){let i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let M=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,D=Mk(e,M);if(D&&!e.state.selection.eq(D)){if(Un&&zo&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",z=>z(e,ol(13,"Enter"))))return;let U=e.state.tr.setSelection(D);M=="pointer"?U.setMeta("pointer",!0):M=="key"&&U.scrollIntoView(),i&&U.setMeta("composition",i),e.dispatch(U)}return}let s=e.state.doc.resolve(t),a=s.sharedDepth(n);t=s.before(a+1),n=e.state.doc.resolve(n).after(a+1);let l=e.state.selection,c=Dte(e,t,n),u=e.state.doc,f=u.slice(c.from,c.to),h,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(h=e.state.selection.to,p="end"):(h=e.state.selection.from,p="start"),e.input.lastKeyCode=null;let m=Vte(f.content,c.doc.content,c.from,h,p);if(m&&e.input.domChangeCount++,(Mu&&e.input.lastIOSEnter>Date.now()-225||zo)&&o.some(M=>M.nodeType==1&&!Fte.test(M.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp("handleKeyDown",M=>M(e,ol(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof ze&&!l.empty&&l.$head.sameParent(l.$anchor)&&!e.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let M=f_(e,e.state.doc,c.sel);if(M&&!M.eq(e.state.selection)){let D=e.state.tr.setSelection(M);i&&D.setMeta("composition",i),e.dispatch(D)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof ze&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=c.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=c.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),xr&&pa<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>c.from&&c.doc.textBetween(m.start-c.from-1,m.start-c.from+1)==" "&&(m.start--,m.endA--,m.endB--);let v=c.doc.resolveNoCache(m.start-c.from),x=c.doc.resolveNoCache(m.endB-c.from),b=u.resolve(m.start),w=v.sameParent(x)&&v.parent.inlineContent&&b.end()>=m.endA,S;if((Mu&&e.input.lastIOSEnter>Date.now()-225&&(!w||o.some(M=>M.nodeName=="DIV"||M.nodeName=="P"))||!w&&v.pos<c.doc.content.size&&!v.sameParent(x)&&(S=Ge.findFrom(c.doc.resolve(v.pos+1),1,!0))&&S.head==x.pos)&&e.someProp("handleKeyDown",M=>M(e,ol(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&Bte(u,m.start,m.endA,v,x)&&e.someProp("handleKeyDown",M=>M(e,ol(8,"Backspace")))){zo&&Un&&e.domObserver.suppressSelectionUpdates();return}Un&&zo&&m.endB==m.start&&(e.input.lastAndroidDelete=Date.now()),zo&&!w&&v.start()!=x.start()&&x.parentOffset==0&&v.depth==x.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,x=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{e.someProp("handleKeyDown",function(M){return M(e,ol(13,"Enter"))})},20));let C=m.start,N=m.endA,P,_,O;if(w){if(v.pos==x.pos)xr&&pa<=11&&v.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>es(e),20)),P=e.state.tr.delete(C,N),_=u.resolve(m.start).marksAcross(u.resolve(m.endA));else if(m.endA==m.endB&&(O=$te(v.parent.content.cut(v.parentOffset,x.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start()))))P=e.state.tr,O.type=="add"?P.addMark(C,N,O.mark):P.removeMark(C,N,O.mark);else if(v.parent.child(v.index()).isText&&v.index()==x.index()-(x.textOffset?0:1)){let M=v.parent.textBetween(v.parentOffset,x.parentOffset);if(e.someProp("handleTextInput",D=>D(e,C,N,M)))return;P=e.state.tr.insertText(M,C,N)}}if(P||(P=e.state.tr.replace(C,N,c.doc.slice(m.start-c.from,m.endB-c.from))),c.sel){let M=f_(e,P.doc,c.sel);M&&!(Un&&zo&&e.composing&&M.empty&&(m.start!=m.endB||e.input.lastAndroidDelete<Date.now()-100)&&(M.head==C||M.head==P.mapping.map(N)-1)||xr&&M.empty&&M.head==C)&&P.setSelection(M)}_&&P.ensureMarks(_),i&&P.setMeta("composition",i),e.dispatch(P.scrollIntoView())}function f_(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Rk(e,t.resolve(n.anchor),t.resolve(n.head))}function $te(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,o=n,i=r,s,a,l;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(o.length==1&&i.length==0)a=o[0],s="add",l=u=>u.mark(a.addToSet(u.marks));else if(o.length==0&&i.length==1)a=i[0],s="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<t.childCount;u++)c.push(l(t.child(u)));if(q.from(c).eq(e))return{mark:a,type:s}}function Bte(e,t,n,r,o){if(n-t<=o.pos-r.pos||x0(r,!0,!1)<o.pos)return!1;let i=e.resolve(t);if(!r.parent.isTextblock){let a=i.nodeAfter;return a!=null&&n==t+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=e.resolve(x0(i,!0,!0));return!s.parent.isTextblock||s.pos>n||x0(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function x0(e,t,n){let r=e.depth,o=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,o++,t=!1;if(n){let i=e.node(r).maybeChild(e.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function Vte(e,t,n,r,o){let i=e.findDiffStart(t,n);if(i==null)return null;let{a:s,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if(o=="end"){let l=Math.max(0,i-Math.min(s,a));r-=s+l-i}if(s<i&&e.size<t.size){let l=r<=i&&r>=s?i-r:0;i-=l,i&&i<t.size&&h_(t.textBetween(i-1,i+1))&&(i+=l?1:-1),a=i+(a-s),s=i}else if(a<i){let l=r<=i&&r>=a?i-r:0;i-=l,i&&i<e.size&&h_(e.textBetween(i-1,i+1))&&(i+=l?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}function h_(e){if(e.length!=2)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class Ute{constructor(t,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new lte,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(y_),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=g_(this),m_(this),this.nodeViews=v_(this),this.docView=qP(this.state.doc,p_(this),y0(this),this.dom,this),this.domObserver=new Mte(this,(r,o,i,s)=>zte(this,r,o,i,s)),this.domObserver.start(),cte(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let n in t)this._props[n]=t[n];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&Nw(this);let n=this._props;this._props=t,t.plugins&&(t.plugins.forEach(y_),this.directPlugins=t.plugins),this.updateStateInner(t.state,n)}setProps(t){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in t)n[r]=t[r];this.update(n)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,n){var r;let o=this.state,i=!1,s=!1;t.storedMarks&&this.composing&&(hL(this),s=!0),this.state=t;let a=o.plugins!=t.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=v_(this);Hte(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Nw(this),this.editable=g_(this),m_(this);let l=y0(this),c=p_(this),u=o.plugins!=t.plugins&&!o.doc.eq(t.doc)?"reset":t.scrollToSelection>o.scrollToSelection?"to selection":"preserve",f=i||!this.docView.matchesNode(t.doc,c,l);(f||!t.selection.eq(o.selection))&&(s=!0);let h=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&kee(this);if(s){this.domObserver.stop();let p=f&&(xr||Un)&&!this.composing&&!o.selection.empty&&!t.selection.empty&&Wte(o.selection,t.selection);if(f){let m=Un?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Ste(this)),(i||!this.docView.update(t.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=qP(t.doc,c,l,this.dom,this)),m&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Gee(this))?es(this,p):(eL(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,o),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():h&&Eee(h)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Me){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&VP(this,n.getBoundingClientRect(),t)}else VP(this,this.coordsAtPos(this.state.selection.head,1),t)}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(!t||t.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,t)}}updateDraggedNode(t,n){let r=t.node,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new mL(t.slice,t.move,o<0?void 0:Me.create(this.state.doc,o))}someProp(t,n){let r=this._props&&this._props[t],o;if(r!=null&&(o=n?n(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[t];if(a!=null&&(o=n?n(a):a))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let a=i[s].props[t];if(a!=null&&(o=n?n(a):a))return o}}hasFocus(){if(xr){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;for(;t&&this.dom!=t&&this.dom.contains(t);){if(t.contentEditable=="false")return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Cee(this.dom),es(this),this.domObserver.start()}get root(){let t=this._root;if(t==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return t||document}updateRoot(){this._root=null}posAtCoords(t){return Tee(this,t)}coordsAtPos(t,n=1){return KD(this,t,n)}domAtPos(t,n=0){return this.docView.domFromPos(t,n)}nodeDOM(t){let n=this.docView.descAt(t);return n?n.nodeDOM:null}posAtDOM(t,n,r=-1){let o=this.docView.posFromDOM(t,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(t,n){return Iee(this,n||this.state,t)}pasteHTML(t,n){return Nh(this,"",t,!1,n||new ClipboardEvent("paste"))}pasteText(t,n){return Nh(this,t,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(ute(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],y0(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,fee())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return fte(this,t)}dispatch(t){let n=this._props.dispatchTransaction;n?n.call(this,t):this.updateState(this.state.apply(t))}domSelectionRange(){let t=this.domSelection();return t?nr&&this.root.nodeType===11&&vee(this.dom.ownerDocument)==this.dom&&Ate(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function p_(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(e.state)),n)for(let r in n)r=="class"?t.class+=" "+n[r]:r=="style"?t.style=(t.style?t.style+";":"")+n[r]:!t[r]&&r!="contenteditable"&&r!="nodeName"&&(t[r]=String(n[r]))}),t.translate||(t.translate="no"),[_t.node(0,e.state.doc.content.size,t)]}function m_(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:_t.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function g_(e){return!e.someProp("editable",t=>t(e.state)===!1)}function Wte(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function v_(e){let t=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(t,o)||(t[o]=r[o])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function Hte(e,t){let n=0,r=0;for(let o in e){if(e[o]!=t[o])return!0;n++}for(let o in t)r++;return n!=r}function y_(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Kte=e=>{if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")};const Gte=Da(Kte);function qte(e){return!!(e.prev&&e.next&&e.prev.text.full!==e.next.text.full)}function Yte(e){return!!(e.prev&&e.next&&e.prev.range.cursor!==e.next.range.cursor)}function Jte(e){return!!(!e.prev&&e.next)}function Xte(e){return!!(e.prev&&!e.next)}function Zte(e){return!!(e.prev&&e.next&&e.prev.range.from!==e.next.range.from)}function Qte(e){return e==="invalid-exit-split"}var ene=["jump-backward-exit","jump-forward-exit"],tne=["jump-backward-change","jump-forward-change"];function nne(e){var t,n;return ni(ene,(t=e.exit)==null?void 0:t.exitReason)||ni(tne,(n=e.change)==null?void 0:n.changeReason)}function x_(e){return!!(e&&e.query.full.length>=e.suggester.matchOffset)}function b_(e){return Gn(e)&&e instanceof ze}function pr(e){const{match:t,changeReason:n,exitReason:r}=e;return{...t,changeReason:n,exitReason:r}}function rne(e,t){const{invalidPrefixCharacters:n,validPrefixCharacters:r}=t;return n?!new RegExp(_w(n)).test(e):new RegExp(_w(r)).test(e)}function one(e){const{text:t,regexp:n,$pos:r,suggester:o}=e,i=r.start();let s;return jy(t,n).forEach(a=>{const l=a.input.slice(Math.max(0,a.index-1),a.index);if(rne(l,o)){const c=a.index+i,u=a[0],f=a[1];if(!Fe(u)||!Fe(f))return;const h=c+u.length,p=Math.min(h,r.pos),m=p-c;c<r.pos&&h>=r.pos&&(s={range:{from:c,to:h,cursor:p},match:a,query:{partial:u.slice(f.length,m),full:u.slice(f.length)},text:{partial:u.slice(0,m),full:u},textAfter:r.doc.textBetween(h,r.end(),ea,ea),textBefore:r.doc.textBetween(i,c,ea,ea),suggester:o})}}),s}function bL(e){const{$pos:t,suggester:n}=e,{char:r,name:o,startOfLine:i,supportedCharacters:s,matchOffset:a,multiline:l,caseInsensitive:c,unicode:u}=n,f=hne({char:r,matchOffset:a,startOfLine:i,supportedCharacters:s,multiline:l,caseInsensitive:c,unicode:u}),h=t.doc.textBetween(t.before(),t.end(),ea,ea);return one({suggester:n,text:h,regexp:f,$pos:t,char:r,name:o})}function wL(e){const{state:t,match:n}=e;try{return bL({$pos:t.doc.resolve(n.range.cursor),suggester:n.suggester})}catch{return}}function SL(e){const{prev:t,next:n,state:r}=e;return!n&&t.range.from>=r.doc.nodeSize?{exit:pr({match:t,exitReason:"delete"})}:!n||!t.query.partial?{exit:pr({match:t,exitReason:"invalid-exit-split"})}:t.range.to===n.range.cursor?{exit:pr({match:n,exitReason:"exit-end"})}:t.query.partial?{exit:pr({match:n,exitReason:"exit-split"})}:{}}function ine(e){const{prev:t,next:n,state:r}=e,o=Se(),i=wL({state:r,match:t}),{exit:s}=i&&i.query.full!==t.query.full?SL({prev:t,next:i,state:r}):o;return t.range.from<n.range.from?{exit:s??pr({match:t,exitReason:"jump-forward-exit"}),change:pr({match:n,changeReason:"jump-forward-change"})}:{exit:s??pr({match:t,exitReason:"jump-backward-exit"}),change:pr({match:n,changeReason:"jump-backward-change"})}}function sne(e){const{match:t,state:n,$pos:r}=e,{selection:o}=n,i=wL({match:t,state:n});return!i||i.text.full!==t.text.full?SL({prev:t,next:i,state:n}):!o.empty&&(o.from<=t.range.from||o.to>=t.range.to)?{exit:pr({match:t,exitReason:"selection-outside"})}:r.pos>t.range.to?{exit:pr({match:t,exitReason:"move-end"})}:r.pos<=t.range.from?{exit:pr({match:t,exitReason:"move-start"})}:{}}function ane(e){const{prev:t,next:n,state:r,$pos:o}=e,i=Se();if(!t&&!n)return i;const s={prev:t,next:n};return Zte(s)?ine({prev:s.prev,next:s.next,state:r}):Jte(s)?{change:pr({match:s.next,changeReason:"start"})}:Xte(s)?sne({$pos:o,match:s.prev,state:r}):qte(s)?{change:pr({match:s.next,changeReason:"change-character"})}:Yte(s)?{change:pr({match:s.next,changeReason:r.selection.empty?"move":"selection-inside"})}:i}function w_(e,t){for(let n=e.depth;n>0;n--){const r=e.node(n);if(t.includes(r.type.name))return!0}return!1}function Pw(e,t){const{$from:n,$to:r}=e;return kL(e,t)?!0:eD(n.pos,r.pos).some(o=>lne(n.doc.resolve(o),t))}function kL(e,t){const{$from:n,$to:r}=e,o=new Set((n.marksAcross(r)??[]).map(i=>i.type.name));return t.some(i=>o.has(i))}function lne(e,t){const n=new Set(e.marks().map(r=>r.type.name));return t.some(r=>n.has(r))}function cne(e,t){const{$cursor:n}=t,{validMarks:r,validNodes:o,invalidMarks:i,invalidNodes:s}=e;return!r&&!o&&Oa(i)&&Oa(s)?!0:!(r&&!kL(t,r)||o&&!w_(n,o)||!r&&Pw(t,i)||!o&&w_(n,s))}function S_(e){const{suggesters:t,$pos:n,selectionEmpty:r}=e;for(const o of t)if(!(o.emptySelectionsOnly&&!r))try{const i=bL({suggester:o,$pos:n});if(!i)continue;const s={$from:n.doc.resolve(i.range.from),$to:n.doc.resolve(i.range.to),$cursor:n};if(cne(o,s)&&o.isValidPosition(s,i))return i}catch{}}function _w(e){return kZ(e)?e.source:e}function une(e){return e?"^":""}function dne(e,t){return`(?:${_w(e)}){${t},}`}function fne(e){return Fe(e)?new RegExp(Gte(e)):e}function hne(e){const{char:t,matchOffset:n,startOfLine:r,supportedCharacters:o,captureChar:i=!0,caseInsensitive:s=!1,multiline:a=!1,unicode:l=!1}=e,c=`g${a?"m":""}${s?"i":""}${l?"u":""}`;let u=fne(t).source;return i&&(u=`(${u})`),new RegExp(`${une(r)}${u}${dne(o,n)}`,c)}var pne={appendTransaction:!1,priority:50,ignoredTag:"span",matchOffset:0,disableDecorations:!1,startOfLine:!1,suggestClassName:"suggest",suggestTag:"span",supportedCharacters:/\w+/,validPrefixCharacters:/^[\s\0]?$/,invalidPrefixCharacters:null,ignoredClassName:null,invalidMarks:[],invalidNodes:[],validMarks:null,validNodes:null,isValidPosition:()=>!0,checkNextValidSelection:null,emptySelectionsOnly:!1,caseInsensitive:!1,multiline:!1,unicode:!1,captureChar:!0},EL="__ignore_prosemirror_suggest_update__",Vh,ru,Qt,Wi,fl,Io,qt,Hi,hl,ou,mne=(ou=class{constructor(t){Ln(this,Vh,!1);Ln(this,ru,!1);Ln(this,Qt);Ln(this,Wi);Ln(this,fl);Ln(this,Io,Se());Vt(this,"view");Ln(this,qt,at.empty);Ln(this,Hi,!1);Ln(this,hl,!1);Vt(this,"setMarkRemoved",()=>{Qe(this,Hi,!0)});Vt(this,"findNextTextSelection",t=>{const n=t.$from.doc,r=Math.min(n.nodeSize-2,t.to+1),o=n.resolve(r),i=Ge.findFrom(o,1,!0);if(b_(i))return i});Vt(this,"ignoreNextExit",()=>{Qe(this,ru,!0)});Vt(this,"addIgnored",({from:t,name:n,specific:r=!1})=>{const o=ue(this,Qt).find(c=>c.name===n);if(!o)throw new Error(`No suggester exists for the name provided: ${n}`);const i=Fe(o.char)?o.char.length:1,s=t+i,a=o.ignoredClassName?{class:o.ignoredClassName}:{},l=_t.inline(t,s,{nodeName:o.ignoredTag,...a},{name:n,specific:r,char:o.char});Qe(this,qt,ue(this,qt).add(this.view.state.doc,[l]))});Vt(this,"removeIgnored",({from:t,name:n})=>{const r=ue(this,Qt).find(s=>s.name===n);if(!r)throw new Error(`No suggester exists for the name provided: ${n}`);const o=Fe(r.char)?r.char.length:1,i=ue(this,qt).find(t,t+o)[0];!i||i.spec.name!==n||Qe(this,qt,ue(this,qt).remove([i]))});Vt(this,"clearIgnored",t=>{if(!t){Qe(this,qt,at.empty);return}const r=ue(this,qt).find().filter(({spec:o})=>o.name===t);Qe(this,qt,ue(this,qt).remove(r))});Vt(this,"findMatchAtPosition",(t,n)=>{const r=n?ue(this,Qt).filter(o=>o.name===n):ue(this,Qt);return S_({suggesters:r,$pos:t,docChanged:!1,selectionEmpty:!0})});Vt(this,"setLastChangeFromAppend",()=>{Qe(this,hl,!0)});const n=k_();Qe(this,Qt,t.map(n)),Qe(this,Qt,zl(ue(this,Qt),(r,o)=>o.priority-r.priority))}static create(t){return new ou(t)}get decorationSet(){return ue(this,qt)}get removed(){return ue(this,Hi)}get match(){return ue(this,Wi)?ue(this,Wi):ue(this,fl)&&ue(this,Io).exit?ue(this,fl):void 0}init(t){return this.view=t,this}createProps(t){const{name:n,char:r}=t.suggester;return{view:this.view,addIgnored:this.addIgnored,clearIgnored:this.clearIgnored,ignoreNextExit:this.ignoreNextExit,setMarkRemoved:this.setMarkRemoved,name:n,char:r,...t}}shouldRunExit(){return ue(this,ru)?(Qe(this,ru,!1),!1):!0}updateWithNextSelection(t){var r,o,i;const n=this.findNextTextSelection(t.selection);if(n)for(const s of ue(this,Qt)){const a=(r=ue(this,Io).change)==null?void 0:r.suggester.name,l=(o=ue(this,Io).exit)==null?void 0:o.suggester.name;(i=s.checkNextValidSelection)==null||i.call(s,n.$from,t,{change:a,exit:l})}}changeHandler(t,n){const{change:r,exit:o}=ue(this,Io),i=this.match;if(!r&&!o||!x_(i))return;const s=n===(o==null?void 0:o.suggester.appendTransaction)&&this.shouldRunExit(),a=n===(r==null?void 0:r.suggester.appendTransaction);if(!(!s&&!a)){if(r&&o&&nne({change:r,exit:o})){const l=this.createProps(o),c=this.createProps(r),u=o.range.from<r.range.from;s&&o.suggester.onChange(l,t),a&&r.suggester.onChange(c,t),s&&Qe(this,Hi,!1);return}r&&a&&r.suggester.onChange(this.createProps(r),t),o&&s&&(o.suggester.onChange(this.createProps(o),t),Qe(this,Hi,!1),Qte(o.exitReason)&&Qe(this,Io,Se()))}}mapIgnoredDecorations(t){const n=ue(this,qt).map(t.mapping,t.doc),o=n.find().filter(({from:i,to:s,spec:a})=>{const l=Fe(a.char)?a.char.length:1;return s-i!==l});Qe(this,qt,n.remove(o))}shouldIgnoreMatch({range:t,suggester:{name:n}}){return ue(this,qt).find().some(({spec:i,from:s})=>s!==t.from?!1:i.specific?i.name===n:!0)}resetState(){Qe(this,Io,Se()),Qe(this,Wi,void 0),Qe(this,Hi,!1),Qe(this,hl,!1)}updateReasons(t){const{$pos:n,state:r}=t,o=ue(this,Vh),i=ue(this,Qt),s=r.selection.empty,a=b_(r.selection)?S_({suggesters:i,$pos:n,docChanged:o,selectionEmpty:s}):void 0;Qe(this,Wi,a&&this.shouldIgnoreMatch(a)?void 0:a),Qe(this,Io,ane({next:ue(this,Wi),prev:ue(this,fl),state:r,$pos:n}))}addSuggester(t){const n=ue(this,Qt).find(o=>o.name===t.name),r=k_();if(n)Qe(this,Qt,ue(this,Qt).map(o=>o===n?r(t):o));else{const o=[...ue(this,Qt),r(t)];Qe(this,Qt,zl(o,(i,s)=>s.priority-i.priority))}return()=>this.removeSuggester(t.name)}removeSuggester(t){const n=Fe(t)?t:t.name;Qe(this,Qt,ue(this,Qt).filter(r=>r.name!==n)),this.clearIgnored(n)}toJSON(){return this.match}apply(t){const{exit:n,change:r}=ue(this,Io);if(ue(this,hl)&&(Qe(this,hl,!1),!(n!=null&&n.suggester.appendTransaction)&&!(r!=null&&r.suggester.appendTransaction)))return this;const{tr:o,state:i}=t,s=o.docChanged||o.selectionSet;return o.getMeta(EL)||!s&&!ue(this,Hi)?this:(Qe(this,Vh,o.docChanged),this.mapIgnoredDecorations(o),n&&this.resetState(),Qe(this,fl,ue(this,Wi)),this.updateReasons({$pos:o.selection.$from,state:i}),this)}createDecorations(t){const n=this.match;if(!x_(n))return ue(this,qt);const{disableDecorations:r}=n.suggester;if(jt(r)?r(t,n):r)return ue(this,qt);const{range:i,suggester:s}=n,{name:a,suggestTag:l,suggestClassName:c}=s,{from:u,to:f}=i;return this.shouldIgnoreMatch(n)?ue(this,qt):ue(this,qt).add(t.doc,[_t.inline(u,f,{nodeName:l,class:a?`${c} suggest-${a}`:c},{name:a})])}},Vh=new WeakMap,ru=new WeakMap,Qt=new WeakMap,Wi=new WeakMap,fl=new WeakMap,Io=new WeakMap,qt=new WeakMap,Hi=new WeakMap,hl=new WeakMap,ou);function k_(){const e=new Set;return t=>{if(e.has(t.name))throw new Error(`A suggester already exists with the name '${t.name}'. The name provided must be unique.`);const n={...pne,...t};return e.add(t.name),n}}var CL=new id("suggest");function zk(e){return CL.getState(e)}function E_(e,t){return zk(e).addSuggester(t)}function C_(e){e.setMeta(EL,!0)}function gne(e,t){return zk(e).removeSuggester(t)}function vne(...e){const t=mne.create(e);return new gs({key:CL,view:n=>(t.init(n),{update:r=>t.changeHandler(r.state.tr,!1)}),state:{init:()=>t,apply:(n,r,o,i)=>t.apply({tr:n,state:i})},appendTransaction:(n,r,o)=>{const i=o.tr;return t.updateWithNextSelection(i),t.changeHandler(i,!0),i.docChanged||i.steps.length>0||i.selectionSet||i.storedMarksSet?(t.setLastChangeFromAppend(),i):null},props:{decorations:n=>t.createDecorations(n)}})}function $k(e,t){const n=Object.getPrototypeOf(t);let r=e.selection,o=e.doc,i=e.storedMarks;const s=Se();for(const[a,l]of Object.entries(t))s[a]={value:l};return Object.create(n,{...s,storedMarks:{get(){return i}},selection:{get(){return r}},doc:{get(){return o}},tr:{get(){return r=e.selection,o=e.doc,i=e.storedMarks,e}}})}function Mf(e){return({state:t,dispatch:n,view:r,tr:o})=>e($k(o,t),n,r)}function N_(e){return t=>{var n;return je(t.dispatch===void 0||t.dispatch===((n=t.view)==null?void 0:n.dispatch),{code:re.NON_CHAINABLE_COMMAND}),e(t)}}function yne(...e){return({state:t,dispatch:n,view:r,tr:o,...i})=>{for(const s of e)if(s({state:t,dispatch:n,view:r,tr:o,...i}))return!0;return!1}}var $o={get isBrowser(){return!!(typeof window<"u"&&typeof window.document<"u"&&window.navigator&&window.navigator.userAgent)},get isJSDOM(){return $o.isBrowser&&window.navigator.userAgent.includes("jsdom")},get isNode(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null},get isIos(){return $o.isBrowser&&/iPod|iPhone|iPad/.test(navigator.platform)},get isMac(){return $o.isBrowser&&/Mac|iPod|iPhone|iPad/.test(navigator.platform)},get isApple(){return $o.isNode?process.platform==="darwin":$o.isBrowser?/Mac|iPod|iPhone|iPad/.test(window.navigator.platform):!1},get isDevelopment(){return!1},get isTest(){return!1},get isProduction(){return!0}};function js(e,t){var n;const r=Wne(e);return((n=r==null?void 0:r.getComputedStyle(e))==null?void 0:n.getPropertyValue(t))??""}function $n(e,t){return Object.assign(e.style,t)}function jw(e){return Gn(e)&&Yr(e.nodeType)&&Fe(e.nodeName)}function Ni(e){return jw(e)&&e.nodeType===1}function Bk(e){const{types:t,node:n}=e;if(!n)return!1;const r=o=>o===n.type||o===n.type.name;return sn(t)?t.some(r):r(t)}function xne(e,t){const{tr:n}=t;return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function Ay(e){const{predicate:t,selection:n}=e,r=PL(n)?n.selection.$from:Wk(n)?n.$from:n;for(let o=r.depth;o>0;o--){const i=r.node(o),s=o>0?r.before(o):0,a=r.start(o),l=s+i.nodeSize;if(t(i,s))return{pos:s,depth:o,node:i,start:a,end:l}}}function bne(e){const{depth:t}=e,n=t>0?e.before(t):0,r=e.node(t),o=e.start(t),i=n+r.nodeSize;return{pos:n,start:o,node:r,end:i,depth:t}}function _h(e){const{types:t,selection:n}=e;return Ay({predicate:r=>Bk({types:t,node:r}),selection:n})}function wne(e){const{types:t,selection:n}=e;if(!(!Dy(n)||!Bk({types:t,node:n.node})))return{pos:n.$from.pos,depth:n.$from.depth,start:n.$from.start(),end:n.$from.pos+n.node.nodeSize,node:n.node}}function Vk(e){return Wk(e)?e.empty:e.selection.empty}function Sne(e){return e.docChanged||e.selectionSet}function kne(e){return!!jh(e)}function jh(e){const{state:t,type:n,attrs:r}=e,{selection:o,doc:i}=t,s=Fe(n)?i.type.schema.nodes[n]:n;je(s,{code:re.SCHEMA,message:`No node exists for ${n}`});const a=wne({selection:o,types:n})??Ay({predicate:l=>l.type===s,selection:o});return!r||Kg(r)||!a||a.node.hasMarkup(s,{...a.node.attrs,...r})?a:void 0}function lv(...e){return t=>{if(!gP(e))return!1;const[n,...r]=e;let o=!1;const i=(...l)=>()=>{if(!gP(l))return!1;o=!0;const[,...c]=l;return lv(...l)({...t,next:i(...c)})},s=i(...r),a=n({...t,next:s});return o||a?a:s()}}function Ene(e,t){const n=new Map,r=Se();for(const o of e)for(const[i,s]of on(o)){const l=[...n.get(i)??[],s],c=lv(...l);n.set(i,l),r[i]=t(c)}return r}function Cne(e){return Ene(e,t=>(n,r,o)=>t({state:n,dispatch:r,view:o,tr:n.tr,next:()=>!1}))}function Uk(e,t){const n=e.attrs??{};return Object.entries(t).every(([r,o])=>n[r]===o)}function Nne(e){return jL(e,[Yi,Ht,pn,Wo])}function sd(e){return Gn(e)}function ad(e,t){return sn(t)?ni(t,e[ds]):t===e[ds]}function Pne(e){return Gn(e)&&e instanceof pw}function _ne(e,t){return Fe(e)?It(t.nodes,e):e}function NL(e){return Gn(e)&&e instanceof bp}function jne(e,t){return Fe(e)?It(t.marks,e):e}function Iy(e){return Gn(e)&&e instanceof ha}function Tne(e){return Gn(e)&&e instanceof q}function One(e){return Gn(e)&&e instanceof ot}function PL(e){return Gn(e)&&e instanceof cl}function tc(e){return Gn(e)&&e instanceof ze}function Mne(e){return Gn(e)&&e instanceof Qn}function Wk(e){return Gn(e)&&e instanceof Ge}function Rne(e){return Gn(e)&&e instanceof _u}function P_(e){const{trState:t,from:n,to:r,type:o,attrs:i={}}=e,{doc:s}=t,a=jne(o,s.type.schema);if(Object.keys(i).length===0)return s.rangeHasMark(n,r,a);let l=!1;return r>n&&s.nodesBetween(n,r,c=>l?!1:(l=(c.marks??[]).some(f=>f.type!==a?!1:Uk(f,i)),!l)),l}function Dy(e){return Gn(e)&&e instanceof Me}function cv(e){const{trState:t,type:n,attrs:r={},from:o,to:i}=e,{selection:s,doc:a,storedMarks:l}=t,c=Fe(n)?a.type.schema.marks[n]:n;if(je(c,{code:re.SCHEMA,message:`Mark type: ${n} does not exist on the current schema.`}),o&&i)try{return Math.max(o,i)<a.nodeSize&&P_({...e,from:o,to:i})}catch{return!1}return s.empty?(l??s.$from.marks()).some(f=>f.type!==n?!1:Uk(f,r??{})):P_({...e,from:s.from,to:s.to})}function Hk(e,t={}){const n=Ane(e.type.schema);if(!n)return!1;const{ignoreAttributes:r,ignoreDocAttributes:o}=t;return r?_L(n,e):o?n.content.eq(e.content):n.eq(e)}function _L(e,t){if(e===t)return!0;const n=e.type===t.type&&ot.sameSet(e.marks,t.marks);function r(){if(e.content===t.content)return!0;if(e.content.size!==t.content.size)return!1;const o=[],i=[];e.content.forEach(s=>o.push(s)),t.content.forEach(s=>i.push(s));for(const[s,a]of o.entries()){const l=i[s];if(!l||!_L(a,l))return!1}return!0}return n&&r()}function Ane(e){var t;return((t=e.nodes.doc)==null?void 0:t.createAndFill())??void 0}function Ly(e){for(const t of Object.values(e.nodes))if(t.name!=="doc"&&(t.isBlock||t.isTextblock))return t;je(!1,{code:re.SCHEMA,message:"No default block node found for the provided schema."})}function Ine(e){return e.type===Ly(e.type.schema)}function Kk(e){return!!e&&e.type.isBlock&&!e.textContent&&!e.childCount}function fs(e,t,n){const r=e.parent.childAfter(e.parentOffset);if(!r.node)return;const o=Fe(t)?t:t.name,i=r.node.marks.find(({type:f})=>f.name===o);let s=e.index(),a=e.start()+r.offset,l=s+1,c=a+r.node.nodeSize;if(!i)return n&&c<n.pos?fs(e.doc.resolve(c+1),t,n):void 0;for(;s>0&&i.isInSet(e.parent.child(s-1).marks);)s-=1,a-=e.parent.child(s).nodeSize;for(;l<e.parent.childCount&&i.isInSet(e.parent.child(l).marks);)c+=e.parent.child(l).nodeSize,l+=1;const u=e.doc.textBetween(a,c,UI,`
|
|
508
|
-
|
|
509
|
-
`);return{from:a,to:c,text:u,mark:i}}function jL(e,t){return t.length===0||t.some(n=>e instanceof n)}function Dne(e){return QI(e,({from:n,to:r,prevFrom:o,prevTo:i})=>`${n}_${r}_${o}_${i}`).filter((n,r,o)=>!o.some((i,s)=>r===s?!1:n.prevFrom>=i.prevFrom&&n.prevTo<=i.prevTo&&n.from>=i.from&&n.to<=i.to))}function Lne(e,t=[]){const n=[],{steps:r,mapping:o}=e,i=o.invert();r.forEach((a,l)=>{if(!jL(a,t))return;const c=[],u=a.getMap(),f=o.slice(l);if(u.ranges.length===0&&Nne(a)){const{from:h,to:p}=a;c.push({from:h,to:p})}else u.forEach((h,p)=>{c.push({from:h,to:p})});c.forEach(h=>{const p=f.map(h.from,-1),m=f.map(h.to);n.push({from:p,to:m,prevFrom:i.map(p,-1),prevTo:i.map(m)})})});const s=zl(n,(a,l)=>a.from-l.from);return Dne(s)}function Fne(e){var t;return((t=e.content.firstChild)==null?void 0:t.textContent)??""}function zne(e,t){if(!tc(e.selection))return;let{from:n,to:r}=e.selection;const o=(s,a)=>Fne(ze.between(e.doc.resolve(s),e.doc.resolve(a)).content());for(let s=o(n-1,n);s&&!t.test(s);n--,s=o(n-1,n));for(let s=o(r,r+1);s&&!t.test(s);r++,s=o(r,r+1));if(n===r)return;const i=e.doc.textBetween(n,r,UI,`
|
|
510
|
-
|
|
511
|
-
`);return{from:n,to:r,text:i}}function TL(e){return zne(e,/\W/)}function Rf(e,t=0){const n=sn(e)?e[t]:e;return YI(Fe(n),`No match string found for match ${e}`),n??""}function $ne(e){return tc(e)?e.$cursor:void 0}function Bne(e,t){return Iy(e)?t?e.type===t.nodes.doc:e.type.name==="doc":!1}function Vne(e){return Gn(e)&&Yr(e.anchor)&&Yr(e.head)}function bo(e,t){const n=t.nodeSize-2,r=0;let o;const i=l=>jZ({min:r,max:n,value:l});if(Wk(e))return e;if(e==="all")return new Qn(t);if(e==="start"?o=r:e==="end"?o=n:Rne(e)?o=e.pos:o=e,Yr(o))return o=i(o),ze.near(t.resolve(o));if(Vne(o)){const l=i(o.anchor),c=i(o.head);return ze.between(t.resolve(l),t.resolve(c))}const s=i(o.from),a=i(o.to);return ze.between(t.resolve(s),t.resolve(a))}var Une=3;function OL(e){const{content:t,schema:n,document:r,stringHandler:o,onError:i,attempts:s=0}=e,a=i&&s<=Une||s===0;if(je(a,{code:re.INVALID_CONTENT,message:"The invalid content has been called recursively more than ${MAX_ATTEMPTS} times. The content is invalid and the error handler has not been able to recover properly."}),Fe(t))return je(o,{code:re.INVALID_CONTENT,message:`The string '${t}' was added to the editor, but no \`stringHandler\` was added. Please provide a valid string handler which transforms your content to a \`ProsemirrorNode\` to prevent this error.`}),o({document:r,content:t,schema:n});if(PL(t))return t.doc;if(Iy(t))return t;try{return n.nodeFromJSON(t)}catch(l){const c=Jne({schema:n,error:l,json:t}),u=i==null?void 0:i(c);return je(u,{code:re.INVALID_CONTENT,message:`An error occurred when processing the content. Please provide an \`onError\` handler to process the invalid content: ${JSON.stringify(c.invalidContent,null,2)}`}),OL({...e,content:u,attempts:s+1})}}function Fy(){const e=DD();if(e)return e;throw new Error(`Unable to retrieve the document from the global scope.
|
|
512
|
-
It seems that you are running Remirror in a non-browser environment. Remirror need browser APIs to work.
|
|
513
|
-
If you are using Jest (or other testing frameworks), make sure that you are using the JSDOM environment (https://jestjs.io/docs/29.0/configuration#testenvironment-string).
|
|
514
|
-
If you are using Next.js (or other server-side rendering frameworks), please use dynamic import with \`ssr: false\` to load the editor component without rendering it on the server (https://nextjs.org/docs/advanced-features/dynamic-import#with-no-ssr).
|
|
515
|
-
If you are using Node.js, you can install JSDOM and Remirror will try to use it automatically, or you can create a fake document and pass it to Remirror`)}function ML(e){var t;return(e==null?void 0:e.defaultView)??(typeof window<"u"?window:void 0)??((t=DD())==null?void 0:t.defaultView)}function Wne(e){return ML(e==null?void 0:e.ownerDocument)}function Hne(e){const t=ML(e)??Fy().defaultView;if(t)return t;throw new Error("Unable to retrieve the window from the global scope")}function Kne(e,t=Fy()){const n=Bne(e,e.type.schema)?e.content:q.from(e);return Ha.fromSchema(e.type.schema).serializeFragment(n,{document:t})}function Gne(e,t){return new(Hne(t)).DOMParser().parseFromString(`<body>${e}</body>`,"text/html").body}function qne(e,t=Fy()){const n=t.createElement("div");return n.append(Kne(e,t)),n.innerHTML}function Tw(e){const{content:t,schema:n,document:r,fragment:o=!1,...i}=e,s=Gne(t,r),a=ju.fromSchema(n);return o?a.parseSlice(s,{...__,...i}).content:a.parse(s,{...__,...i})}var __={preserveWhitespace:!1};function RL(e,t){const n=wh(t.defaults());return Sk({...e},n)}var Yne={remove(e,t){let n=e;for(const r of t)r.invalidParentNode||(n=MZ(r.path,n));return n}};function Jne({json:e,schema:t,...n}){const r=new Set(wh(t.marks)),o=new Set(wh(t.nodes)),i=AL({json:e,path:[],validNodes:o,validMarks:r});return{json:e,invalidContent:i,transformers:Yne,...n}}function AL(e){const{json:t,validMarks:n,validNodes:r,path:o=[]}=e,i={validMarks:n,validNodes:r},s=[],{type:a,marks:l,content:c}=t;let{invalidParentMark:u=!1,invalidParentNode:f=!1}=e;if(l){const h=[];for(const[p,m]of l.entries()){const v=Fe(m)?m:m.type;n.has(v)||(h.unshift({name:v,path:[...o,"marks",`${p}`],type:"mark",invalidParentMark:u,invalidParentNode:f}),u=!0)}s.push(...h)}if(r.has(a)||(s.push({name:a,type:"node",path:o,invalidParentMark:u,invalidParentNode:f}),f=!0),c){const h=[];for(const[p,m]of c.entries())h.unshift(...AL({...i,json:m,path:[...o,"content",`${p}`],invalidParentMark:u,invalidParentNode:f}));s.unshift(...h)}return s}function Xne(e){return!!(tc(e)&&e.$cursor&&e.$cursor.parentOffset>=e.$cursor.parent.content.size)}function Ow(e){return!!(tc(e)&&e.$cursor&&e.$cursor.parentOffset<=0)}function j_(e){const t=Ge.atStart(e.$anchor.doc);return!!(Ow(e)&&t.anchor===e.anchor)}function Zne(e){return({dispatch:t,tr:n})=>{const{type:r,attrs:o=Se(),appendText:i,range:s}=e,a=s?ze.between(n.doc.resolve(s.from),n.doc.resolve(s.to)):n.selection,{$from:l,from:c,to:u}=a;let f=l.depth===0?n.doc.type.allowsMarkType(r):!1;return n.doc.nodesBetween(c,u,h=>{if(f)return!1;if(h.inlineContent&&h.type.allowsMarkType(r)){f=!0;return}}),f?(t==null||t(n.addMark(c,u,r.create(o))&&i?n.insertText(i):n),!0):!1}}function Qne({tr:e,dispatch:t}){const{$from:n,$to:r}=e.selection,o=n.blockRange(r),i=o&&od(o);return!Yr(i)||!o?!1:(t==null||t(e.lift(o,i).scrollIntoView()),!0)}function IL(e,t={},n){return function(r){const{tr:o,dispatch:i,state:s}=r,a=Fe(e)?It(s.schema.nodes,e):e,{from:l,to:c}=bo(n??o.selection,o.doc),u=o.doc.resolve(l),f=o.doc.resolve(c),h=u.blockRange(f),p=h&&Nk(h,a,t);return!p||!h?!1:(i==null||i(o.wrap(h,p).scrollIntoView()),!0)}}function ere(e,t={},n){return r=>{const{tr:o,state:i}=r,s=Fe(e)?It(i.schema.nodes,e):e;return jh({state:o,type:s,attrs:t})?Qne(r):IL(e,t,n)(r)}}function uv(e,t,n,r=!0){return function(o){const{tr:i,dispatch:s,state:a}=o,l=Fe(e)?It(a.schema.nodes,e):e,{from:c,to:u}=bo(n??i.selection,i.doc);let f=!1,h;return i.doc.nodesBetween(c,u,(p,m)=>{if(f)return!1;if(!p.isTextblock||p.hasMarkup(l,t))return;if(p.type===l){f=!0,h=p.attrs;return}const v=i.doc.resolve(m),x=v.index();f=v.parent.canReplaceWith(x,x+1,l),f&&(h=v.parent.attrs)}),f?(s==null||s(i.setBlockType(c,u,l,{...r?h:{},...t}).scrollIntoView()),!0):!1}}function DL(e){return t=>{const{tr:n,state:r}=t,{type:o,attrs:i,preserveAttrs:s=!0}=e,a=jh({state:n,type:o,attrs:i}),l=e.toggleType??Ly(r.schema);if(a)return uv(l,{...s?a.node.attrs:{},...i})(t);const c=jh({state:n,type:l,attrs:i});return uv(o,{...s?c==null?void 0:c.node.attrs:{},...i})(t)}}function tre(e=0){const t=navigator.userAgent.match(/Chrom(e|ium)\/(\d+)\./);return t?Number.parseInt(It(t,2),10)>=e:!1}function nre(e,t){let{head:n,empty:r,anchor:o}=e;for(const i of t.steps)n=i.getMap().map(n);r?t.setSelection(ze.near(t.doc.resolve(n))):t.setSelection(ze.between(t.doc.resolve(o),t.doc.resolve(n)))}function rre(e){const{attrs:t={},appendText:n="",content:r="",keepSelection:o=!1,range:i}=e;return({state:s,tr:a,dispatch:l})=>{var c;const u=s.schema,f=bo(e.selection??i??a.selection,a.doc),h=f.$from.index(),{from:p,to:m,$from:v}=f,x=Fe(e.type)?u.nodes[e.type]??u.marks[e.type]:e.type;if(je(Fe(e.type)?x:!0,{code:re.SCHEMA,message:`Schema contains no marks or nodes with name ${x}`}),Pne(x)){if(!v.parent.canReplaceWith(h,h,x))return!1;a.replaceWith(p,m,x.create(t,r?u.text(r):void 0))}else je(r,{message:"`replaceText` cannot be called without content when using a mark type"}),a.replaceWith(p,m,u.text(r,NL(x)?[x.create(t)]:void 0));return n&&a.insertText(n),o&&nre(s.selection,a),l&&(tre(60)&&((c=document.getSelection())==null||c.empty()),l(a)),!0}}function LL(e,t){const n=e.parent.childAfter(e.parentOffset);if(!n.node)return;const{marks:r,nodeSize:o}=n.node;if(r[0])return r[0].type;const s=e.start()+n.offset+o;return LL(e.doc.resolve(s+1))}function FL(e){return({dispatch:t,tr:n,state:r})=>{const{type:o,expand:i=!0,range:s}=e,a=bo(e.selection??s??n.selection,n.doc);let{from:l,to:c,$from:u,$to:f}=a;const h=Fe(o)?r.schema.marks[o]:o;h!==null&&je(h,{code:re.SCHEMA,message:`Mark type: ${o} does not exist on the current schema.`});const p=h??LL(u);if(!p)return!1;const m=fs(u,p,f);return i&&m&&(l=Math.max(0,Math.min(l,m.from)),c=Math.min(Math.max(c,m.to),n.doc.nodeSize-2)),t==null||t(n.removeMark(l,Yr(c)?c:l,NL(h)?h:void 0)),!0}}function dv(e){const{regexp:t,type:n,getAttributes:r,ignoreWhitespace:o=!1,beforeDispatch:i,updateCaptured:s,shouldSkip:a,invalidMarks:l}=e;let c;const u=new Eo(t,(f,h,p,m)=>{const{tr:v,schema:x}=f;c||(c=Fe(n)?x.marks[n]:n,je(c,{code:re.SCHEMA,message:`Mark type: ${n} does not exist on the current schema.`}));let b=h[1],w=h[0];const S=ore({captureGroup:b,fullMatch:w,end:m,start:p,rule:u,state:f,ignoreWhitespace:o,invalidMarks:l,shouldSkip:a,updateCaptured:s});if(!S)return null;({start:p,end:m,captureGroup:b,fullMatch:w}=S);const C=jt(r)?r(h):r;let N=m,P=[];if(b){const _=w.search(/\S/),O=p+w.indexOf(b),M=O+b.length;P=v.storedMarks??[],M<m&&v.delete(M,m),O>p&&v.delete(p+_,O),N=p+_+b.length}return v.addMark(p,N,c.create(C)),v.setStoredMarks(P),i==null||i({tr:v,match:h,start:p,end:m}),v});return u}function ore({captureGroup:e,fullMatch:t,end:n,start:r,rule:o,ignoreWhitespace:i,shouldSkip:s,updateCaptured:a,state:l,invalidMarks:c}){var u;if(t==null)return null;const f=(a==null?void 0:a({captureGroup:e,fullMatch:t,start:r,end:n}))??{};e=f.captureGroup??e,t=f.fullMatch??t,r=f.start??r,n=f.end??n;const h=l.doc.resolve(r),p=l.doc.resolve(n);return c&&Pw({$from:h,$to:p},c)||o.invalidMarks&&Pw({$from:h,$to:p},o.invalidMarks)||i&&(e==null?void 0:e.trim())===""||s!=null&&s({state:l,captureGroup:e,fullMatch:t,start:r,end:n,ruleType:"mark"})||(u=o.shouldSkip)!=null&&u.call(o,{state:l,captureGroup:e,fullMatch:t,start:r,end:n,ruleType:"mark"})?null:{captureGroup:e,end:n,fullMatch:t,start:r}}var ire=function(){const t=Array.prototype.slice.call(arguments).filter(Boolean),n={},r=[];t.forEach(i=>{(i?i.split(" "):[]).forEach(a=>{if(a.startsWith("atm_")){const[,l]=a.split("_");n[l]=a}else r.push(a)})});const o=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&o.push(n[i]);return o.push(...r),o.join(" ")},sre=ire;const zL=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function are(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const $L=(e,t,n)=>{let r=are(e,n);if(!r)return!1;let o=BL(r);if(!o){let s=r.blockRange(),a=s&&od(s);return a==null?!1:(t&&t(e.tr.lift(s,a).scrollIntoView()),!0)}let i=o.nodeBefore;if(WL(e,o,t,-1))return!0;if(r.parent.content.size==0&&(Ru(i,"end")||Me.isSelectable(i)))for(let s=r.depth;;s--){let a=Pk(e.doc,r.before(s),r.after(s),ae.empty);if(a&&a.slice.size<a.to-a.from){if(t){let l=e.tr.step(a);l.setSelection(Ru(i,"end")?Ge.findFrom(l.doc.resolve(l.mapping.map(o.pos,-1)),-1):Me.create(l.doc,o.pos-i.nodeSize)),t(l.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&o.depth==r.depth-1?(t&&t(e.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1};function Ru(e,t,n=!1){for(let r=e;r;r=t=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const lre=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;i=BL(r)}let s=i&&i.nodeBefore;return!s||!Me.isSelectable(s)?!1:(t&&t(e.tr.setSelection(Me.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function BL(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function cre(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const ure=(e,t,n)=>{let r=cre(e,n);if(!r)return!1;let o=VL(r);if(!o)return!1;let i=o.nodeAfter;if(WL(e,o,t,1))return!0;if(r.parent.content.size==0&&(Ru(i,"start")||Me.isSelectable(i))){let s=Pk(e.doc,r.before(),r.after(),ae.empty);if(s&&s.slice.size<s.to-s.from){if(t){let a=e.tr.step(s);a.setSelection(Ru(i,"start")?Ge.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):Me.create(a.doc,a.mapping.map(o.pos))),t(a.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(t&&t(e.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},dre=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;i=VL(r)}let s=i&&i.nodeAfter;return!s||!Me.isSelectable(s)?!1:(t&&t(e.tr.setSelection(Me.create(e.doc,i.pos)).scrollIntoView()),!0)};function VL(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const fre=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
|
|
516
|
-
`).scrollIntoView()),!0)};function Gk(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const UL=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=Gk(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(t){let a=n.after(),l=e.tr.replaceWith(a,a,s.createAndFill());l.setSelection(Ge.near(l.doc.resolve(a),1)),t(l.scrollIntoView())}return!0},hre=(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof Qn||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Gk(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=e.tr.insert(s,i.createAndFill());a.setSelection(ze.create(a.doc,s+1)),t(a.scrollIntoView())}return!0},pre=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Qc(e.doc,i))return t&&t(e.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&od(r);return o==null?!1:(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)};function mre(e){return(t,n)=>{let{$from:r,$to:o}=t.selection;if(t.selection instanceof Me&&t.selection.node.isBlock)return!r.parentOffset||!Qc(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],s,a,l=!1,c=!1;for(let p=r.depth;;p--)if(r.node(p).isBlock){l=r.end(p)==r.pos+(r.depth-p),c=r.start(p)==r.pos-(r.depth-p),a=Gk(r.node(p-1).contentMatchAt(r.indexAfter(p-1))),i.unshift(l&&a?{type:a}:null),s=p;break}else{if(p==1)return!1;i.unshift(null)}let u=t.tr;(t.selection instanceof ze||t.selection instanceof Qn)&&u.deleteSelection();let f=u.mapping.map(r.pos),h=Qc(u.doc,f,i.length,i);if(h||(i[0]=a?{type:a}:null,h=Qc(u.doc,f,i.length,i)),u.split(f,i.length,i),!l&&c&&r.node(s).type!=a){let p=u.mapping.map(r.before(s)),m=u.doc.resolve(p);a&&r.node(s-1).canReplaceWith(m.index(),m.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(s)),a)}return n&&n(u.scrollIntoView()),!0}}const gre=mre(),vre=(e,t)=>{let{$from:n,to:r}=e.selection,o,i=n.sharedDepth(r);return i==0?!1:(o=n.before(i),t&&t(e.tr.setSelection(Me.create(e.doc,o))),!0)},yre=(e,t)=>(t&&t(e.tr.setSelection(new Qn(e.doc))),!0);function xre(e,t,n){let r=t.nodeBefore,o=t.nodeAfter,i=t.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&t.parent.canReplace(i-1,i)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(i,i+1)||!(o.isTextblock||wp(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function WL(e,t,n,r){let o=t.nodeBefore,i=t.nodeAfter,s,a,l=o.type.spec.isolating||i.type.spec.isolating;if(!l&&xre(e,t,n))return!0;let c=!l&&t.parent.canReplace(t.index(),t.index()+1);if(c&&(s=(a=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&a.matchType(s[0]||i.type).validEnd){if(n){let p=t.pos+i.nodeSize,m=q.empty;for(let b=s.length-1;b>=0;b--)m=q.from(s[b].create(null,m));m=q.from(o.copy(m));let v=e.tr.step(new Ht(t.pos-1,p,t.pos,p,new ae(m,1,0),s.length,!0)),x=v.doc.resolve(p+2*s.length);x.nodeAfter&&x.nodeAfter.type==o.type&&wp(v.doc,x.pos)&&v.join(x.pos),n(v.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&l?null:Ge.findFrom(t,1),f=u&&u.$from.blockRange(u.$to),h=f&&od(f);if(h!=null&&h>=t.depth)return n&&n(e.tr.lift(f,h).scrollIntoView()),!0;if(c&&Ru(i,"start",!0)&&Ru(o,"end")){let p=o,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let v=i,x=1;for(;!v.isTextblock;v=v.firstChild)x++;if(p.canReplace(p.childCount,p.childCount,v.content)){if(n){let b=q.empty;for(let S=m.length-1;S>=0;S--)b=q.from(m[S].copy(b));let w=e.tr.step(new Ht(t.pos-m.length,t.pos+i.nodeSize,t.pos+x,t.pos+i.nodeSize-x,new ae(b,m.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function HL(e){return function(t,n){let r=t.selection,o=e<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(t.tr.setSelection(ze.create(t.doc,e<0?o.start(i):o.end(i)))),!0):!1}}const bre=HL(-1),wre=HL(1);function Sre(e,t,n,r){for(let o=0;o<t.length;o++){let{$from:i,$to:s}=t[o],a=i.depth==0?e.inlineContent&&e.type.allowsMarkType(n):!1;if(e.nodesBetween(i.pos,s.pos,(l,c)=>{if(a||!r)return!1;a=l.inlineContent&&l.type.allowsMarkType(n)}),a)return!0}return!1}function kre(e,t=null,n){let r=n!==!1;return function(o,i){let{empty:s,$cursor:a,ranges:l}=o.selection;if(s&&!a||!Sre(o.doc,l,e,r))return!1;if(i)if(a)e.isInSet(o.storedMarks||a.marks())?i(o.tr.removeStoredMark(e)):i(o.tr.addStoredMark(e.create(t)));else{let c,u=o.tr;c=!l.some(f=>o.doc.rangeHasMark(f.$from.pos,f.$to.pos,e));for(let f=0;f<l.length;f++){let{$from:h,$to:p}=l[f];if(!c)u.removeMark(h.pos,p.pos,e);else{let m=h.pos,v=p.pos,x=h.nodeAfter,b=p.nodeBefore,w=x&&x.isText?/^\s*/.exec(x.text)[0].length:0,S=b&&b.isText?/\s*$/.exec(b.text)[0].length:0;m+w<v&&(m+=w,v-=S),u.addMark(m,v,e.create(t))}}i(u.scrollIntoView())}return!0}}function zy(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}let b0=zy(zL,$L,lre),T_=zy(zL,ure,dre);const Ui={Enter:zy(fre,hre,pre,gre),"Mod-Enter":UL,Backspace:b0,"Mod-Backspace":b0,"Shift-Backspace":b0,Delete:T_,"Mod-Delete":T_,"Mod-a":yre},KL={"Ctrl-h":Ui.Backspace,"Alt-Backspace":Ui["Mod-Backspace"],"Ctrl-d":Ui.Delete,"Ctrl-Alt-Backspace":Ui["Mod-Delete"],"Alt-Delete":Ui["Mod-Delete"],"Alt-d":Ui["Mod-Delete"],"Ctrl-a":bre,"Ctrl-e":wre};for(let e in Ui)KL[e]=Ui[e];const Ere=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,w0=Ere?KL:Ui;var Ra={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:"'"},fv={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Cre=typeof navigator<"u"&&/Mac/.test(navigator.platform),Nre=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Nn=0;Nn<10;Nn++)Ra[48+Nn]=Ra[96+Nn]=String(Nn);for(var Nn=1;Nn<=24;Nn++)Ra[Nn+111]="F"+Nn;for(var Nn=65;Nn<=90;Nn++)Ra[Nn]=String.fromCharCode(Nn+32),fv[Nn]=String.fromCharCode(Nn);for(var S0 in Ra)fv.hasOwnProperty(S0)||(fv[S0]=Ra[S0]);function Pre(e){var t=Cre&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Nre&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?fv:Ra)[e.keyCode]||e.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const _re=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function jre(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n=="Space"&&(n=" ");let r,o,i,s;for(let a=0;a<t.length-1;a++){let l=t[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))o=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))_re?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function Tre(e){let t=Object.create(null);for(let n in e)t[jre(n)]=e[n];return t}function k0(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function GL(e){let t=Tre(e);return function(n,r){let o=Pre(r),i,s=t[k0(o,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=t[k0(o,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||o.charCodeAt(0)>127)&&(i=Ra[r.keyCode])&&i!=o){let a=t[k0(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}function Ore(e){const t=zl(e,(i,s)=>(s.priority??mt.Low)-(i.priority??mt.Low)),n=[],r=[];for(const i of t)Fre(i)?n.push(i):r.push(i);let o;return new gs({key:Mre,view:i=>(o=i,{}),props:{transformPasted:i=>{var c,u,f;const s=o.state.selection.$from,a=s.node().type.name,l=new Set(s.marks().map(h=>h.type.name));for(const h of n){if((c=h.ignoredNodes)!=null&&c.includes(a)||(u=h.ignoredMarks)!=null&&u.some(w=>l.has(w)))continue;const p=((f=i.content.firstChild)==null?void 0:f.textContent)??"",m=!o.state.selection.empty&&i.content.childCount===1&&p,v=jy(p,h.regexp)[0];if(m&&v&&h.type==="mark"&&h.replaceSelection){const{from:w,to:S}=o.state.selection,C=o.state.doc.slice(w,S),N=C.content.textBetween(0,C.content.size);if(typeof h.replaceSelection!="boolean"?h.replaceSelection(N):h.replaceSelection){const P=[],{getAttributes:_,markType:O}=h,M=jt(_)?_(v,!0):_,D=O.create(M);return C.content.forEach(U=>{if(U.isText){const z=D.addToSet(U.marks);P.push(U.mark(z))}}),ae.maxOpen(q.fromArray(P))}}const{nodes:x,transformed:b}=Dre(i.content,h,o.state.schema);b&&(i=h.type==="node"&&h.nodeType.isBlock?new ae(q.fromArray(x),0,0):new ae(q.fromArray(x),i.openStart,i.openEnd))}return Vre(i)},handleDOMEvents:{paste:(i,s)=>{var f,h;const a=s;if(!((h=(f=i.props).editable)!=null&&h.call(f,i.state)))return!1;const{clipboardData:l}=a;if(!l)return!1;const c=[...l.items].map(p=>p.getAsFile()).filter(p=>!!p);if(c.length===0)return!1;const{selection:u}=i.state;for(const{fileHandler:p,regexp:m}of r){const v=m?c.filter(x=>m.test(x.type)):c;if(v.length!==0&&p({event:a,files:v,selection:u,view:i,type:"paste"}))return a.preventDefault(),!0}return!1},drop:(i,s)=>{var p,m,v;const a=s;if(!((m=(p=i.props).editable)!=null&&m.call(p,i.state)))return!1;const{dataTransfer:l,clientX:c,clientY:u}=a;if(!l)return!1;const f=Bre(a);if(f.length===0)return!1;const h=((v=i.posAtCoords({left:c,top:u}))==null?void 0:v.pos)??i.state.selection.anchor;for(const{fileHandler:x,regexp:b}of r){const w=b?f.filter(S=>b.test(S.type)):f;if(w.length!==0&&x({event:a,files:w,pos:h,view:i,type:"drop"}))return a.preventDefault(),!0}return!1}}}})}var Mre=new id("pasteRule");function E0(e,t){return function n(r){const{fragment:o,rule:i,nodes:s}=r,{regexp:a,ignoreWhitespace:l,ignoredMarks:c,ignoredNodes:u}=i;let f=!1;return o.forEach(h=>{if(u!=null&&u.includes(h.type.name)||zre(h)){s.push(h);return}if(!h.isText){const v=n({fragment:h.content,rule:i,nodes:[]});f||(f=v.transformed);const x=q.fromArray(v.nodes);h.type.validContent(x)?s.push(h.copy(x)):s.push(...v.nodes);return}if(h.marks.some(v=>$re(v)||(c==null?void 0:c.includes(v.type.name)))){s.push(h);return}const p=h.text??"";let m=0;for(const v of jy(p,a)){const x=v[1],b=v[0];if(l&&(x==null?void 0:x.trim())===""||!b)return;const w=v.index,S=w+b.length;w>m&&s.push(h.cut(m,w));let C=h.cut(w,S);if(b&&x){const N=b.search(/\S/),P=w+b.indexOf(x),_=P+x.length;N&&s.push(h.cut(w,w+N)),C=h.cut(P,_)}e({nodes:s,rule:i,textNode:C,match:v,schema:t}),f=!0,m=S}p&&m<p.length&&s.push(h.cut(m))}),{nodes:s,transformed:f}}}function Rre(e){const{nodes:t,rule:n,textNode:r,match:o,schema:i}=e,{transformMatch:s,getAttributes:a,markType:l}=n,c=jt(a)?a(o,!1):a,u=r.text??"",f=l.create(c),h=s==null?void 0:s(o);if(h==="")return;if(h===!1){t.push(i.text(u,r.marks));return}const p=f.addToSet(r.marks);t.push(i.text(h??u,p))}function Are(e){const{nodes:t,rule:n,textNode:r,match:o,schema:i}=e,{transformMatch:s}=n,a=s==null?void 0:s(o);if(a===""||a===!1)return;const l=a??r.text??"";t.push(i.text(l,r.marks))}function Ire(e){const{nodes:t,rule:n,textNode:r,match:o}=e,{getAttributes:i,nodeType:s,getContent:a}=n,l=jt(i)?i(o,!1):i,c=(a?a(o):r)||void 0;t.push(s.createChecked(l,c))}function Dre(e,t,n){const r=[];switch(t.type){case"mark":return E0(Rre,n)({fragment:e,nodes:r,rule:t});case"node":return E0(Ire,n)({fragment:e,nodes:r,rule:t});default:return E0(Are,n)({fragment:e,nodes:r,rule:t})}}var Lre=["mark","node","text"];function Fre(e){return ni(Lre,e.type)}function zre(e){var t;return e.type.spec.code||((t=e.type.spec.group)==null?void 0:t.split(" ").includes("code"))}function $re(e){var t;return e.type.name==="code"||((t=e.type.spec.group)==null?void 0:t.split(" ").includes("code"))}function Bre(e){var n,r;const{dataTransfer:t}=e;return t?((n=t.files)==null?void 0:n.length)>0?[...t.files]:(r=t.items)!=null&&r.length?[...t.items].map(o=>o.getAsFile()).filter(o=>!!o):[]:[]}function Vre(e){const t=ae.maxOpen(e.content);return t.openStart<e.openStart||t.openEnd<e.openEnd?t:e}var Ure=Object.defineProperty,Wre=Object.getOwnPropertyDescriptor,ye=(e,t,n,r)=>{for(var o=r>1?void 0:r?Wre(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Ure(t,n,o),o},qL=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},le=(e,t,n)=>(qL(e,t,"read from private field"),n?n.call(e):t.get(e)),Yt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},un=(e,t,n,r)=>(qL(e,t,"write to private field"),t.set(e,n),n);function Hre(e,t){return e===t}function O_(e){const{previousOptions:t,update:n,equals:r=Hre}=e,o=ll({...t,...n}),i=Se(),s=wh(t);for(const l of s){const c=t[l],u=o[l];if(r(c,u)){i[l]={changed:!1};continue}i[l]={changed:!0,previousValue:c,value:u}}const a=l=>{const c=Se();for(const u of l){const f=i[u];f!=null&&f.changed&&(c[u]=f.value)}return c};return{changes:ll(i),options:o,pickChanged:a}}var Kre={[re.DUPLICATE_HELPER_NAMES]:"helper method",[re.DUPLICATE_COMMAND_NAMES]:"command method"};function YL(e){const{name:t,set:n,code:r}=e,o=Kre[r];je(!n.has(t),{code:r,message:`There is a naming conflict for the name: ${t} used in this '${o}'. Please rename or remove from the editor to avoid runtime errors.`}),n.add(t)}function Mw(...e){return Sh(sre(...e).split(" ")).join(" ")}var M_="__IGNORE__",Gre="__ALL__",ld=class{constructor(e,...[t]){this["~O"]={},this._mappedHandlers=Se(),this.populateMappedHandlers(),this._options=this._initialOptions=_Z(e,this.constructor.defaultOptions,t??Se(),this.createDefaultHandlerOptions()),this._dynamicKeys=this.getDynamicKeys(),this.init()}get options(){return this._options}get dynamicKeys(){return this._dynamicKeys}get initialOptions(){return this._initialOptions}init(){}getDynamicKeys(){const e=[],{customHandlerKeys:t,handlerKeys:n,staticKeys:r}=this.constructor;for(const o of wh(this._options))r.includes(o)||n.includes(o)||t.includes(o)||e.push(o);return e}ensureAllKeysAreDynamic(e){}setOptions(e){var t;const n=this.getDynamicOptions();this.ensureAllKeysAreDynamic(e);const{changes:r,options:o,pickChanged:i}=O_({previousOptions:n,update:e});this.updateDynamicOptions(o),(t=this.onSetOptions)==null||t.call(this,{reason:"set",changes:r,options:o,pickChanged:i,initialOptions:this._initialOptions})}resetOptions(){var e;const t=this.getDynamicOptions(),{changes:n,options:r,pickChanged:o}=O_({previousOptions:t,update:this._initialOptions});this.updateDynamicOptions(r),(e=this.onSetOptions)==null||e.call(this,{reason:"reset",options:r,changes:n,pickChanged:o,initialOptions:this._initialOptions})}getDynamicOptions(){return Sk(this._options,[...this.constructor.customHandlerKeys,...this.constructor.handlerKeys])}updateDynamicOptions(e){this._options={...this._options,...e}}populateMappedHandlers(){for(const e of this.constructor.handlerKeys)this._mappedHandlers[e]=[]}createDefaultHandlerOptions(){const e=Se();for(const t of this.constructor.handlerKeys)e[t]=(...n)=>{var r;const{handlerKeyOptions:o}=this.constructor,i=(r=o[t])==null?void 0:r.reducer;let s=i==null?void 0:i.getDefault(...n);for(const[,a]of this._mappedHandlers[t]){const l=a(...n);if(s=i?i.accumulator(s,l,...n):l,qre(o,s,t))return s}return s};return e}addHandler(e,t,n=mt.Default){return this._mappedHandlers[e].push([n,t]),this.sortHandlers(e),()=>this._mappedHandlers[e]=this._mappedHandlers[e].filter(([,r])=>r!==t)}hasHandlers(e){return(this._mappedHandlers[e]??[]).length>0}sortHandlers(e){this._mappedHandlers[e]=zl(this._mappedHandlers[e],([t],[n])=>n-t)}addCustomHandler(e,t){var n;return((n=this.onAddCustomHandler)==null?void 0:n.call(this,{[e]:t}))??ZI}};ld.defaultOptions={};ld.staticKeys=[];ld.handlerKeys=[];ld.handlerKeyOptions={};ld.customHandlerKeys=[];function qre(e,t,n){const{[Gre]:r}=e,o=e[n];return!r&&!o?!1:!!(o&&o.earlyReturnValue!==M_&&(jt(o.earlyReturnValue)?o.earlyReturnValue(t)===!0:t===o.earlyReturnValue)||r&&r.earlyReturnValue!==M_&&(jt(r.earlyReturnValue)?r.earlyReturnValue(t)===!0:t===r.earlyReturnValue))}var $y=class extends ld{constructor(...e){super(Yre,...e),this["~E"]={},this._extensions=QI(this.createExtensions(),t=>t.constructor),this.extensionMap=new Map;for(const t of this._extensions)this.extensionMap.set(t.constructor,t)}get priority(){return this.priorityOverride??this.options.priority??this.constructor.defaultPriority}get constructorName(){return`${qI(this.name)}Extension`}get store(){return je(this._store,{code:re.MANAGER_PHASE_ERROR,message:"An error occurred while attempting to access the 'extension.store' when the Manager has not yet set created the lifecycle methods."}),ll(this._store,{requireKeys:!0})}get extensions(){return this._extensions}replaceChildExtension(e,t){this.extensionMap.has(e)&&(this.extensionMap.set(e,t),this._extensions=this.extensions.map(n=>t.constructor===e?t:n))}createExtensions(){return[]}getExtension(e){const t=this.extensionMap.get(e);return je(t,{code:re.INVALID_GET_EXTENSION,message:`'${e.name}' does not exist within the preset: '${this.name}'`}),t}isOfType(e){return this.constructor===e}setStore(e){this._store||(this._store=e)}clone(...e){return new this.constructor(...e)}setPriority(e){this.priorityOverride=e}};$y.defaultPriority=mt.Default;var Tt=class extends $y{static get[ds](){return gn.PlainExtensionConstructor}get[ds](){return gn.PlainExtension}},Cp=class extends $y{static get[ds](){return gn.MarkExtensionConstructor}get[ds](){return gn.MarkExtension}get type(){return It(this.store.schema.marks,this.name)}constructor(...e){super(...e)}};Cp.disableExtraAttributes=!1;var Co=class extends $y{static get[ds](){return gn.NodeExtensionConstructor}get[ds](){return gn.NodeExtension}get type(){return It(this.store.schema.nodes,this.name)}constructor(...e){super(...e)}};Co.disableExtraAttributes=!1;var Yre={priority:void 0,extraAttributes:{},disableExtraAttributes:!1,exclude:{}};function JL(e){return sd(e)&&ad(e,[gn.PlainExtension,gn.MarkExtension,gn.NodeExtension])}function Jre(e){return sd(e)&&ad(e,[gn.PlainExtensionConstructor,gn.MarkExtensionConstructor,gn.NodeExtensionConstructor])}function XL(e){return sd(e)&&ad(e,gn.PlainExtension)}function Np(e){return sd(e)&&ad(e,gn.NodeExtension)}function By(e){return sd(e)&&ad(e,gn.MarkExtension)}function st(e){return t=>{const{defaultOptions:n,customHandlerKeys:r,handlerKeys:o,staticKeys:i,defaultPriority:s,handlerKeyOptions:a,...l}=e,c=t;n&&(c.defaultOptions=n),s&&(c.defaultPriority=s),a&&(c.handlerKeyOptions=a),c.staticKeys=i??[],c.handlerKeys=o??[],c.customHandlerKeys=r??[];for(const[u,f]of Object.entries(l))c[u]||(c[u]=f);return c}}var Xre=class extends Tt{constructor(){super(...arguments),this.attributeList=[],this.attributeObject=Se(),this.updateAttributes=(e=!0)=>{this.transformAttributes(),e&&this.store.commands.forceUpdate("attributes")}}get name(){return"attributes"}onCreate(){this.transformAttributes(),this.store.setExtensionStore("updateAttributes",this.updateAttributes)}transformAttributes(){var e,t,n;if(this.attributeObject=Se(),(e=this.store.managerSettings.exclude)!=null&&e.attributes){this.store.setStoreKey("attributes",this.attributeObject);return}this.attributeList=[];for(const r of this.store.extensions){if((t=r.options.exclude)!=null&&t.attributes)continue;const o=(n=r.createAttributes)==null?void 0:n.call(r),i={...o,class:Mw(...r.classNames??[],o==null?void 0:o.class)};this.attributeList.unshift(i)}for(const r of this.attributeList)this.attributeObject={...this.attributeObject,...r,class:Mw(this.attributeObject.class,r.class)};this.store.setStoreKey("attributes",this.attributeObject)}};function Bt(e={}){return(t,n,r)=>{(t.decoratedHelpers??(t.decoratedHelpers={}))[n]=e}}function xe(e={}){return(t,n,r)=>{(t.decoratedCommands??(t.decoratedCommands={}))[n]=e}}function to(e){return(t,n,r)=>{(t.decoratedKeybindings??(t.decoratedKeybindings={}))[n]=e}}var Zre=class{constructor(e){this.promiseCreator=e,this.failureHandlers=[],this.successHandlers=[],this.validateHandlers=[],this.generateCommand=()=>t=>{let n=!0;const{view:r,tr:o,dispatch:i}=t;if(!r)return!1;for(const a of this.validateHandlers)if(!a({...t,dispatch:()=>{}})){n=!1;break}return!i||!n?n:(this.promiseCreator(t).then(a=>{this.runHandlers(this.successHandlers,{value:a,state:r.state,tr:r.state.tr,dispatch:r.dispatch,view:r})}).catch(a=>{this.runHandlers(this.failureHandlers,{error:a,state:r.state,tr:r.state.tr,dispatch:r.dispatch,view:r})}),i(o),!0)}}validate(e,t="push"){return this.validateHandlers[t](e),this}success(e,t="push"){return this.successHandlers[t](e),this}failure(e,t="push"){return this.failureHandlers[t](e),this}runHandlers(e,t){var n;for(const r of e)if(!r({...t,dispatch:()=>{}}))break;(n=t.dispatch)==null||n.call(t,t.tr)}};function Th(e){const{type:t,attrs:n,range:r,selection:o}=e;return i=>{const{dispatch:s,tr:a,state:l}=i,c=Fe(t)?l.schema.marks[t]:t;if(je(c,{code:re.SCHEMA,message:`Mark type: ${t} does not exist on the current schema.`}),r||o){const{from:u,to:f}=bo(o??r??a.selection,a.doc);return cv({trState:a,type:t,...r})?s==null||s(a.removeMark(u,f,c)):s==null||s(a.addMark(u,f,c.create(n))),!0}return Mf(kre(c,n))(i)}}function Qre(e,t,n){for(const{$from:r,$to:o}of n){let i=r.depth===0?t.type.allowsMarkType(e):!1;if(t.nodesBetween(r.pos,o.pos,s=>{if(i)return!1;i=s.inlineContent&&s.type.allowsMarkType(e)}),i)return!0}return!1}function eoe(e,t,n){return({tr:r,dispatch:o,state:i})=>{const s=bo(n??r.selection,r.doc),a=$ne(s),l=Fe(e)?i.schema.marks[e]:e;if(je(l,{code:re.SCHEMA,message:`Mark type: ${e} does not exist on the current schema.`}),s.empty&&!a||!Qre(l,r.doc,s.ranges))return!1;if(!o)return!0;if(a)return r.removeStoredMark(l),t&&r.addStoredMark(l.create(t)),o(r),!0;let c=!1;for(const{$from:u,$to:f}of s.ranges){if(c)break;c=r.doc.rangeHasMark(u.pos,f.pos,l)}for(const{$from:u,$to:f}of s.ranges)c&&r.removeMark(u.pos,f.pos,l),t&&r.addMark(u.pos,f.pos,l.create(t));return o(r),!0}}function toe(e,t={}){return({tr:n,dispatch:r,state:o})=>{const i=o.schema,s=n.selection,{from:a=s.from,to:l=a??s.to,marks:c={}}=t;if(!r)return!0;n.insertText(e,a,l);const u=It(n.steps,n.steps.length-1).getMap().map(l);for(const[f,h]of on(c))n.addMark(a,u,It(i.marks,f).create(h));return r(n),!0}}var Ye=class extends Tt{constructor(){super(...arguments),this.decorated=new Map,this.forceUpdateTransaction=(e,...t)=>{const{forcedUpdates:n}=this.getCommandMeta(e);return this.setCommandMeta(e,{forcedUpdates:Sh([...n,...t])}),e}}get name(){return"commands"}get transaction(){const e=this.store.getState();this._transaction||(this._transaction=e.tr);const t=this._transaction.before.eq(e.doc),n=!Oa(this._transaction.steps);if(!t){const r=e.tr;if(n)for(const o of this._transaction.steps)r.step(o);this._transaction=r}return this._transaction}onCreate(){this.store.setStoreKey("getForcedUpdates",this.getForcedUpdates.bind(this))}onView(e){var t;const{extensions:n,helpers:r}=this.store,o=Se(),i=new Set;let s=Se();const a=c=>{var u;const f=Se(),h=()=>c??this.transaction;let p=[];const m=()=>p;for(const[x,b]of Object.entries(o))(u=s[x])!=null&&u.disableChaining||(f[x]=this.chainedFactory({chain:f,command:b.original,getTr:h,getChain:m}));const v=x=>{je(x===h(),{message:"Chaining currently only supports `CommandFunction` methods which do not use the `state.tr` property. Instead you should use the provided `tr` property."})};return f.run=(x={})=>{const b=p;p=[];for(const w of b)if(!w(v)&&x.exitEarly)return;e.dispatch(h())},f.tr=()=>{const x=p;p=[];for(const b of x)b(v);return h()},f.enabled=()=>{for(const x of p)if(!x())return!1;return!0},f.new=x=>a(x),f};for(const c of n){const u=((t=c.createCommands)==null?void 0:t.call(c))??{},f=c.decoratedCommands??{},h={};s={...s,decoratedCommands:f};for(const[p,m]of Object.entries(f)){const v=Fe(m.shortcut)&&m.shortcut.startsWith("_|")?{shortcut:r.getNamedShortcut(m.shortcut,c.options)}:void 0;this.updateDecorated(p,{...m,name:c.name,...v}),u[p]=c[p].bind(c),m.active&&(h[p]=()=>{var x;return((x=m.active)==null?void 0:x.call(m,c.options,this.store))??!1})}Kg(u)||this.addCommands({active:h,names:i,commands:o,extensionCommands:u})}const l=a();for(const[c,u]of Object.entries(l))a[c]=u;this.store.setStoreKey("commands",o),this.store.setStoreKey("chain",a),this.store.setExtensionStore("commands",o),this.store.setExtensionStore("chain",a)}onStateUpdate({state:e}){this._transaction=e.tr}createPlugin(){return{}}customDispatch(e){return e}insertText(e,t={}){return Fe(e)?toe(e,t):this.store.createPlaceholderCommand({promise:e,placeholder:{type:"inline"},onSuccess:(n,r,o)=>this.insertText(n,{...t,...r})(o)}).generateCommand()}selectText(e,t={}){return({tr:n,dispatch:r})=>{const o=bo(e,n.doc);return n.selection.anchor===o.anchor&&n.selection.head===o.head&&!t.forceUpdate?!1:(r==null||r(n.setSelection(o)),!0)}}selectMark(e){return t=>{const{tr:n}=t,r=fs(n.selection.$from,e);return r?this.store.commands.selectText.original({from:r.from,to:r.to})(t):!1}}delete(e){return({tr:t,dispatch:n})=>{const{from:r,to:o}=e??t.selection;return n==null||n(t.delete(r,o)),!0}}emptyUpdate(e){return({tr:t,dispatch:n})=>(n&&(e==null||e(),n(t)),!0)}forceUpdate(...e){return({tr:t,dispatch:n})=>(n==null||n(this.forceUpdateTransaction(t,...e)),!0)}updateNodeAttributes(e,t){return({tr:n,dispatch:r})=>(r==null||r(n.setNodeMarkup(e,void 0,t)),!0)}setContent(e,t){return n=>{const{tr:r,dispatch:o}=n,i=this.store.manager.createState({content:e,selection:t});return i?(o==null||o(r.replaceRangeWith(0,r.doc.nodeSize-2,i.doc)),!0):!1}}resetContent(){return e=>{const{tr:t,dispatch:n}=e,r=this.store.manager.createEmptyDoc();return r?this.setContent(r)(e):(n==null||n(t.delete(0,t.doc.nodeSize)),!0)}}emptySelection(){return({tr:e,dispatch:t})=>e.selection.empty?!1:(t==null||t(e.setSelection(ze.near(e.selection.$anchor))),!0)}insertNewLine(){return({dispatch:e,tr:t})=>tc(t.selection)?(e==null||e(t.insertText(`
|
|
517
|
-
`)),!0):!1}insertNode(e,t={}){return({dispatch:n,tr:r,state:o})=>{var i;const{attrs:s,range:a,selection:l,replaceEmptyParentBlock:c=!1}=t,{from:u,to:f,$from:h}=bo(l??a??r.selection,r.doc);if(Iy(e)||Tne(e)){const b=h.before(h.depth);return n==null||n(c&&u===f&&Kk(h.parent)?r.replaceWith(b,b+h.parent.nodeSize,e):r.replaceWith(u,f,e)),!0}const p=Fe(e)?o.schema.nodes[e]:e;je(p,{code:re.SCHEMA,message:`The requested node type ${e} does not exist in the schema.`});const m=(i=t.marks)==null?void 0:i.map(b=>{if(b instanceof ot)return b;const w=Fe(b)?o.schema.marks[b]:b;return je(w,{code:re.SCHEMA,message:`The requested mark type ${b} does not exist in the schema.`}),w.create()}),v=p.createAndFill(s,Fe(t.content)?o.schema.text(t.content):t.content,m);if(!v)return!1;const x=u!==f;return n==null||n(x?r.replaceRangeWith(u,f,v):r.insert(u,v)),!0}}focus(e){return t=>{const{dispatch:n,tr:r}=t,{view:o}=this.store;if(e===!1||o.hasFocus()&&(e===void 0||e===!0))return!1;if(e===void 0||e===!0){const{from:i=0,to:s=i}=r.selection;e={from:i,to:s}}return n&&this.delayedFocus(),this.selectText(e)(t)}}blur(e){return t=>{const{view:n}=this.store;return n.hasFocus()?(requestAnimationFrame(()=>{n.dom.blur()}),e?this.selectText(e)(t):!0):!1}}setBlockNodeType(e,t,n,r=!0){return uv(e,t,n,r)}toggleWrappingNode(e,t,n){return ere(e,t,n)}toggleBlockNodeItem(e){return DL(e)}wrapInNode(e,t,n){return IL(e,t,n)}applyMark(e,t,n){return eoe(e,t,n)}toggleMark(e){return Th(e)}removeMark(e){return FL(e)}setMeta(e,t){return({tr:n})=>(n.setMeta(e,t),!0)}selectAll(){return this.selectText("all")}copy(){return e=>e.tr.selection.empty?!1:(e.dispatch&&document.execCommand("copy"),!0)}paste(){return this.store.createPlaceholderCommand({promise:async()=>{var e;return(e=navigator.clipboard)!=null&&e.readText?await navigator.clipboard.readText():""},placeholder:{type:"inline"},onSuccess:(e,t,n)=>this.insertNode(Tw({content:e,schema:n.state.schema}),{selection:t})(n)}).generateCommand()}cut(){return e=>e.tr.selection.empty?!1:(e.dispatch&&document.execCommand("cut"),!0)}replaceText(e){return rre(e)}getAllCommandOptions(){const e={};for(const[t,n]of this.decorated)Kg(n)||(e[t]=n);return e}getCommandOptions(e){return this.decorated.get(e)}getCommandProp(){return{tr:this.transaction,dispatch:this.store.view.dispatch,state:this.store.view.state,view:this.store.view}}updateDecorated(e,t){if(!t){this.decorated.delete(e);return}const n=this.decorated.get(e)??{name:""};this.decorated.set(e,{...n,...t})}handleIosFocus(){$o.isIos&&this.store.view.dom.focus()}delayedFocus(){this.handleIosFocus(),requestAnimationFrame(()=>{this.store.view.focus(),this.store.view.dispatch(this.transaction.scrollIntoView())})}getForcedUpdates(e){return this.getCommandMeta(e).forcedUpdates}getCommandMeta(e){const t=e.getMeta(this.pluginKey)??{};return{...noe,...t}}setCommandMeta(e,t){const n=this.getCommandMeta(e);e.setMeta(this.pluginKey,{...n,...t})}addCommands(e){const{extensionCommands:t,commands:n,names:r,active:o}=e;for(const[i,s]of on(t))YL({name:i,set:r,code:re.DUPLICATE_COMMAND_NAMES}),je(!roe.has(i),{code:re.DUPLICATE_COMMAND_NAMES,message:"The command name you chose is forbidden."}),n[i]=this.createUnchainedCommand(s,o[i])}unchainedFactory(e){return(...t)=>{const{shouldDispatch:n=!0,command:r}=e,{view:o}=this.store,{state:i}=o;let s;return n&&(s=o.dispatch),r(...t)({state:i,dispatch:s,view:o,tr:i.tr})}}createUnchainedCommand(e,t){const n=this.unchainedFactory({command:e});return n.enabled=this.unchainedFactory({command:e,shouldDispatch:!1}),n.isEnabled=n.enabled,n.original=e,n.active=t,n}chainedFactory(e){return(...t)=>{const{chain:n,command:r,getTr:o,getChain:i}=e,s=i(),{view:a}=this.store,{state:l}=a;return s.push(c=>r(...t)({state:l,dispatch:c,view:a,tr:o()})),n}}};ye([xe()],Ye.prototype,"customDispatch",1);ye([xe()],Ye.prototype,"insertText",1);ye([xe()],Ye.prototype,"selectText",1);ye([xe()],Ye.prototype,"selectMark",1);ye([xe()],Ye.prototype,"delete",1);ye([xe()],Ye.prototype,"emptyUpdate",1);ye([xe()],Ye.prototype,"forceUpdate",1);ye([xe()],Ye.prototype,"updateNodeAttributes",1);ye([xe()],Ye.prototype,"setContent",1);ye([xe()],Ye.prototype,"resetContent",1);ye([xe()],Ye.prototype,"emptySelection",1);ye([xe()],Ye.prototype,"insertNewLine",1);ye([xe()],Ye.prototype,"insertNode",1);ye([xe()],Ye.prototype,"focus",1);ye([xe()],Ye.prototype,"blur",1);ye([xe()],Ye.prototype,"setBlockNodeType",1);ye([xe()],Ye.prototype,"toggleWrappingNode",1);ye([xe()],Ye.prototype,"toggleBlockNodeItem",1);ye([xe()],Ye.prototype,"wrapInNode",1);ye([xe()],Ye.prototype,"applyMark",1);ye([xe()],Ye.prototype,"toggleMark",1);ye([xe()],Ye.prototype,"removeMark",1);ye([xe()],Ye.prototype,"setMeta",1);ye([xe({description:({t:e})=>e(Ma.SELECT_ALL_DESCRIPTION),label:({t:e})=>e(Ma.SELECT_ALL_LABEL),shortcut:oe.SelectAll})],Ye.prototype,"selectAll",1);ye([xe({description:({t:e})=>e(Ma.COPY_DESCRIPTION),label:({t:e})=>e(Ma.COPY_LABEL),shortcut:oe.Copy,icon:"fileCopyLine"})],Ye.prototype,"copy",1);ye([xe({description:({t:e})=>e(Ma.PASTE_DESCRIPTION),label:({t:e})=>e(Ma.PASTE_LABEL),shortcut:oe.Paste,icon:"clipboardLine"})],Ye.prototype,"paste",1);ye([xe({description:({t:e})=>e(Ma.CUT_DESCRIPTION),label:({t:e})=>e(Ma.CUT_LABEL),shortcut:oe.Cut,icon:"scissorsFill"})],Ye.prototype,"cut",1);ye([xe()],Ye.prototype,"replaceText",1);ye([Bt()],Ye.prototype,"getAllCommandOptions",1);ye([Bt()],Ye.prototype,"getCommandOptions",1);ye([Bt()],Ye.prototype,"getCommandProp",1);Ye=ye([st({defaultPriority:mt.Highest,defaultOptions:{trackerClassName:"remirror-tracker-position",trackerNodeName:"span"},staticKeys:["trackerClassName","trackerNodeName"]})],Ye);var noe={forcedUpdates:[]},roe=new Set(["run","chain","original","raw","enabled","tr","new"]),oi=class extends Tt{constructor(){super(...arguments),this.placeholders=at.empty,this.placeholderWidgets=new Map,this.createPlaceholderCommand=e=>{const t=qg(),{promise:n,placeholder:r,onFailure:o,onSuccess:i}=e;return new Zre(n).validate(s=>this.addPlaceholder(t,r)(s)).success(s=>{const{state:a,tr:l,dispatch:c,view:u,value:f}=s,h=this.store.helpers.findPlaceholder(t);if(!h){const p=new Error("The placeholder has been removed");return(o==null?void 0:o({error:p,state:a,tr:l,dispatch:c,view:u}))??!1}return this.removePlaceholder(t)({state:a,tr:l,view:u,dispatch:()=>{}}),i(f,h,{state:a,tr:l,dispatch:c,view:u})}).failure(s=>(this.removePlaceholder(t)({...s,dispatch:()=>{}}),(o==null?void 0:o(s))??!1))}}get name(){return"decorations"}onCreate(){this.store.setExtensionStore("createPlaceholderCommand",this.createPlaceholderCommand)}createPlugin(){return{state:{init:()=>{},apply:e=>{var t,n,r,o,i,s;const{added:a,clearTrackers:l,removed:c,updated:u}=this.getMeta(e);if(l){this.placeholders=at.empty;for(const[,f]of this.placeholderWidgets)(n=(t=f.spec).onDestroy)==null||n.call(t,this.store.view,f.spec.element);this.placeholderWidgets.clear();return}this.placeholders=this.placeholders.map(e.mapping,e.doc,{onRemove:f=>{var h,p;const m=this.placeholderWidgets.get(f.id);m&&((p=(h=m.spec).onDestroy)==null||p.call(h,this.store.view,m.spec.element))}});for(const[,f]of this.placeholderWidgets)(o=(r=f.spec).onUpdate)==null||o.call(r,this.store.view,f.from,f.spec.element,f.spec.data);for(const f of a){if(f.type==="inline"){this.addInlinePlaceholder(f,e);continue}if(f.type==="node"){this.addNodePlaceholder(f,e);continue}if(f.type==="widget"){this.addWidgetPlaceholder(f,e);continue}}for(const{id:f,data:h}of u){const p=this.placeholderWidgets.get(f);if(!p)continue;const m=_t.widget(p.from,p.spec.element,{...p.spec,data:h});this.placeholders=this.placeholders.remove([p]).add(e.doc,[m]),this.placeholderWidgets.set(f,m)}for(const f of c){const h=this.placeholders.find(void 0,void 0,m=>m.id===f&&m.__type===gc),p=this.placeholderWidgets.get(f);p&&((s=(i=p.spec).onDestroy)==null||s.call(i,this.store.view,p.spec.element)),this.placeholders=this.placeholders.remove(h),this.placeholderWidgets.delete(f)}}},props:{decorations:e=>{let t=this.options.decorations(e);t=t.add(e.doc,this.placeholders.find());for(const n of this.store.extensions){if(!n.createDecorations)continue;const r=n.createDecorations(e).find();t=t.add(e.doc,r)}return t},handleDOMEvents:{blur:e=>(this.options.persistentSelectionClass&&e.dispatch(e.state.tr.setMeta(R_,!1)),!1),focus:e=>(this.options.persistentSelectionClass&&e.dispatch(e.state.tr.setMeta(R_,!0)),!1)}}}}updateDecorations(){return({tr:e,dispatch:t})=>(t==null||t(e),!0)}addPlaceholder(e,t,n){return({dispatch:r,tr:o})=>this.addPlaceholderTransaction(e,t,o,!r)?(r==null||r(n?o.deleteSelection():o),!0):!1}updatePlaceholder(e,t){return({dispatch:n,tr:r})=>this.updatePlaceholderTransaction({id:e,data:t,tr:r,checkOnly:!n})?(n==null||n(r),!0):!1}removePlaceholder(e){return({dispatch:t,tr:n})=>this.removePlaceholderTransaction({id:e,tr:n,checkOnly:!t})?(t==null||t(n),!0):!1}clearPlaceholders(){return({tr:e,dispatch:t})=>this.clearPlaceholdersTransaction({tr:e,checkOnly:!t})?(t==null||t(e),!0):!1}findPlaceholder(e){return this.findAllPlaceholders().get(e)}findAllPlaceholders(){const e=new Map,t=this.placeholders.find(void 0,void 0,n=>n.__type===gc);for(const n of t)e.set(n.spec.id,{from:n.from,to:n.to});return e}createDecorations(e){var t,n,r;const{persistentSelectionClass:o}=this.options;return!o||(t=this.store.view)!=null&&t.hasFocus()||(r=(n=this.store.helpers).isInteracting)!=null&&r.call(n)?at.empty:ioe(e,at.empty,{class:Fe(o)?o:"selection"})}onApplyState(){}addWidgetPlaceholder(e,t){const{pos:n,createElement:r,onDestroy:o,onUpdate:i,className:s,nodeName:a,id:l,type:c}=e,u=(r==null?void 0:r(this.store.view,n))??document.createElement(a);u.classList.add(s);const f=_t.widget(n,u,{id:l,__type:gc,type:c,element:u,onDestroy:o,onUpdate:i});this.placeholderWidgets.set(l,f),this.placeholders=this.placeholders.add(t.doc,[f])}addInlinePlaceholder(e,t){const{from:n=t.selection.from,to:r=t.selection.to,className:o,nodeName:i,id:s,type:a}=e;let l;if(n===r){const c=document.createElement(i);c.classList.add(o),l=_t.widget(n,c,{id:s,type:a,__type:gc,widget:c})}else l=_t.inline(n,r,{nodeName:i,class:o},{id:s,__type:gc});this.placeholders=this.placeholders.add(t.doc,[l])}addNodePlaceholder(e,t){const{pos:n,className:r,nodeName:o,id:i}=e,s=Yr(n)?t.doc.resolve(n):t.selection.$from,a=Yr(n)?s.nodeAfter?{pos:n,end:s.nodeAfter.nodeSize}:void 0:bne(s);if(!a)return;const l=_t.node(a.pos,a.end,{nodeName:o,class:r},{id:i,__type:gc});this.placeholders=this.placeholders.add(t.doc,[l])}withRequiredBase(e,t){const{placeholderNodeName:n,placeholderClassName:r}=this.options,{nodeName:o=n,className:i,...s}=t,a=(i?[r,i]:[r]).join(" ");return{nodeName:o,className:a,...s,id:e}}getMeta(e){const t=e.getMeta(this.pluginKey)??{};return{...ooe,...t}}setMeta(e,t){const n=this.getMeta(e);e.setMeta(this.pluginKey,{...n,...t})}addPlaceholderTransaction(e,t,n,r=!1){if(this.findPlaceholder(e))return!1;if(r)return!0;const{added:i}=this.getMeta(n);return this.setMeta(n,{added:[...i,this.withRequiredBase(e,t)]}),!0}updatePlaceholderTransaction(e){const{id:t,tr:n,checkOnly:r=!1,data:o}=e;if(!this.findPlaceholder(t))return!1;if(r)return!0;const{updated:s}=this.getMeta(n);return this.setMeta(n,{updated:Sh([...s,{id:t,data:o}])}),!0}removePlaceholderTransaction(e){const{id:t,tr:n,checkOnly:r=!1}=e;if(!this.findPlaceholder(t))return!1;if(r)return!0;const{removed:i}=this.getMeta(n);return this.setMeta(n,{removed:Sh([...i,t])}),!0}clearPlaceholdersTransaction(e){const{tr:t,checkOnly:n=!1}=e;return this.getPluginState()===at.empty?!1:(n||this.setMeta(t,{clearTrackers:!0}),!0)}};ye([xe()],oi.prototype,"updateDecorations",1);ye([xe()],oi.prototype,"addPlaceholder",1);ye([xe()],oi.prototype,"updatePlaceholder",1);ye([xe()],oi.prototype,"removePlaceholder",1);ye([xe()],oi.prototype,"clearPlaceholders",1);ye([Bt()],oi.prototype,"findPlaceholder",1);ye([Bt()],oi.prototype,"findAllPlaceholders",1);oi=ye([st({defaultOptions:{persistentSelectionClass:void 0,placeholderClassName:"placeholder",placeholderNodeName:"span"},staticKeys:["placeholderClassName","placeholderNodeName"],handlerKeys:["decorations"],handlerKeyOptions:{decorations:{reducer:{accumulator:(e,t,n)=>e.add(n.doc,t.find()),getDefault:()=>at.empty}}},defaultPriority:mt.Low})],oi);var ooe={added:[],updated:[],clearTrackers:!1,removed:[]},gc="placeholderDecoration",R_="persistentSelectionFocus";function ioe(e,t,n){const{selection:r,doc:o}=e;if(r.empty)return t;const{from:i,to:s}=r,a=Dy(r)?_t.node(i,s,n):_t.inline(i,s,n);return t.add(o,[a])}var Rw=class extends Tt{get name(){return"docChanged"}onStateUpdate(e){const{firstUpdate:t,transactions:n,tr:r}=e;t||(n??[r]).some(o=>o==null?void 0:o.docChanged)&&this.options.docChanged(e)}};Rw=ye([st({handlerKeys:["docChanged"],handlerKeyOptions:{docChanged:{earlyReturnValue:!1}},defaultPriority:mt.Lowest})],Rw);var wo=class extends Tt{get name(){return"helpers"}onCreate(){var e;this.store.setStringHandler("text",this.textToProsemirrorNode.bind(this)),this.store.setStringHandler("html",Tw);const t=Se(),n=Se(),r=Se(),o=new Set;for(const i of this.store.extensions){Np(i)&&(n[i.name]=a=>kne({state:this.store.getState(),type:i.type,attrs:a}),r[i.name]=a=>{var l;return(l=jh({state:this.store.getState(),type:i.type,attrs:a}))==null?void 0:l.node.attrs}),By(i)&&(n[i.name]=a=>cv({trState:this.store.getState(),type:i.type,attrs:a}),r[i.name]=a=>{const l=fs(this.store.getState().selection.$from,i.type);if(!l||!a)return l==null?void 0:l.mark.attrs;if(Uk(l.mark,a))return l.mark.attrs});const s=((e=i.createHelpers)==null?void 0:e.call(i))??{};for(const a of Object.keys(i.decoratedHelpers??{}))s[a]=i[a].bind(i);if(!Kg(s))for(const[a,l]of on(s))YL({name:a,set:o,code:re.DUPLICATE_HELPER_NAMES}),t[a]=l}this.store.setStoreKey("attrs",r),this.store.setStoreKey("active",n),this.store.setStoreKey("helpers",t),this.store.setExtensionStore("attrs",r),this.store.setExtensionStore("active",n),this.store.setExtensionStore("helpers",t)}isSelectionEmpty(e=this.store.getState()){return Vk(e)}isViewEditable(e=this.store.getState()){var t,n;return((n=(t=this.store.view.props).editable)==null?void 0:n.call(t,e))??!1}getStateJSON(e=this.store.getState()){return e.toJSON()}getJSON(e=this.store.getState()){return e.doc.toJSON()}getRemirrorJSON(e=this.store.getState()){return this.getJSON(e)}insertHtml(e,t){return n=>{const{state:r}=n,o=Tw({content:e,schema:r.schema,fragment:!0});return this.store.commands.insertNode.original(o,t)(n)}}getText({lineBreakDivider:e=`
|
|
518
|
-
|
|
519
|
-
`,state:t=this.store.getState()}={}){return t.doc.textBetween(0,t.doc.content.size,e,ea)}getTextBetween(e,t,n=this.store.getState().doc){return n.textBetween(e,t,`
|
|
520
|
-
|
|
521
|
-
`,ea)}getHTML(e=this.store.getState()){return qne(e.doc,this.store.document)}textToProsemirrorNode(e){const t=`<pre>${e.content}</pre>`;return this.store.stringHandlers.html({...e,content:t})}};ye([Bt()],wo.prototype,"isSelectionEmpty",1);ye([Bt()],wo.prototype,"isViewEditable",1);ye([Bt()],wo.prototype,"getStateJSON",1);ye([Bt()],wo.prototype,"getJSON",1);ye([Bt()],wo.prototype,"getRemirrorJSON",1);ye([xe()],wo.prototype,"insertHtml",1);ye([Bt()],wo.prototype,"getText",1);ye([Bt()],wo.prototype,"getTextBetween",1);ye([Bt()],wo.prototype,"getHTML",1);wo=ye([st({})],wo);var Aw=class extends Tt{get name(){return"inputRules"}onCreate(){this.store.setExtensionStore("rebuildInputRules",this.rebuildInputRules.bind(this))}createExternalPlugins(){return[this.generateInputRulesPlugin()]}generateInputRulesPlugin(){var e,t;const n=[],r=this.store.markTags[He.ExcludeInputRules];for(const o of this.store.extensions)if(!((e=this.store.managerSettings.exclude)!=null&&e.inputRules||!o.createInputRules||(t=o.options.exclude)!=null&&t.inputRules))for(const i of o.createInputRules())i.shouldSkip=this.options.shouldSkipInputRule,i.invalidMarks=r,n.push(i);return cee({rules:n})}rebuildInputRules(){this.store.updateExtensionPlugins(this)}};Aw=ye([st({defaultPriority:mt.Default,handlerKeys:["shouldSkipInputRule"],handlerKeyOptions:{shouldSkipInputRule:{earlyReturnValue:!0}}})],Aw);var Bo=class extends Tt{constructor(){super(...arguments),this.extraKeyBindings=[],this.backwardMarkExitTracker=new Map,this.keydownHandler=null,this.onAddCustomHandler=({keymap:e})=>{var t,n;if(e)return this.extraKeyBindings=[...this.extraKeyBindings,e],(n=(t=this.store).rebuildKeymap)==null||n.call(t),()=>{var r,o;this.extraKeyBindings=this.extraKeyBindings.filter(i=>i!==e),(o=(r=this.store).rebuildKeymap)==null||o.call(r)}},this.rebuildKeymap=()=>{this.setupKeydownHandler()}}get name(){return"keymap"}get shortcutMap(){const{shortcuts:e}=this.options;return Fe(e)?coe[e]:e}onCreate(){this.store.setExtensionStore("rebuildKeymap",this.rebuildKeymap)}createExternalPlugins(){var e;return(e=this.store.managerSettings.exclude)!=null&&e.keymap?[]:(this.setupKeydownHandler(),[new gs({props:{handleKeyDown:(t,n)=>{var r;return(r=this.keydownHandler)==null?void 0:r.call(this,t,n)}}})])}setupKeydownHandler(){const e=this.generateKeymapBindings();this.keydownHandler=GL(e)}generateKeymapBindings(){var e;const t=[],n=this.shortcutMap,r=this.store.getExtension(Ye),o=a=>l=>Am({shortcut:l,map:n,store:this.store,options:a.options});for(const a of this.store.extensions){const l=a.decoratedKeybindings??{};if(!((e=a.options.exclude)!=null&&e.keymap)){a.createKeymap&&t.push(aoe(a.createKeymap(o(a)),n));for(const[c,u]of on(l)){if(u.isActive&&!u.isActive(a.options,this.store))continue;const f=a[c].bind(a),h=Am({shortcut:u.shortcut,map:n,options:a.options,store:this.store}),p=jt(u.priority)?u.priority(a.options,this.store):u.priority??mt.Low,m=Se();for(const v of h)m[v]=f;t.push([p,m]),u.command&&r.updateDecorated(u.command,{shortcut:h})}}}const i=this.sortKeymaps([...this.extraKeyBindings,...t]);return Cne(i)}arrowRightShortcut(e){const t=this.store.markTags[He.PreventExits],n=this.store.nodeTags[He.PreventExits];return this.exitMarkForwards(t,n)(e)}arrowLeftShortcut(e){const t=this.store.markTags[He.PreventExits],n=this.store.nodeTags[He.PreventExits];return lv(this.exitNodeBackwards(n),this.exitMarkBackwards(t,n))(e)}backspace(e){const t=this.store.markTags[He.PreventExits],n=this.store.nodeTags[He.PreventExits];return lv(this.exitNodeBackwards(n,!0),this.exitMarkBackwards(t,n,!0))(e)}createKeymap(){const{selectParentNodeOnEscape:e,undoInputRuleOnBackspace:t,excludeBaseKeymap:n}=this.options,r=Se();if(!n)for(const[o,i]of on(w0))r[o]=Mf(i);return t&&w0.Backspace&&(r.Backspace=Mf(zy(uee,w0.Backspace))),e&&(r.Escape=Mf(vre)),[mt.Low,r]}getNamedShortcut(e,t={}){return e.startsWith("_|")?Am({shortcut:e,map:this.shortcutMap,store:this.store,options:t}):[e]}onSetOptions(e){var t,n;const{changes:r}=e;(r.excludeBaseKeymap.changed||r.selectParentNodeOnEscape.changed||r.undoInputRuleOnBackspace.changed)&&((n=(t=this.store).rebuildKeymap)==null||n.call(t))}sortKeymaps(e){return zl(e.map(t=>sn(t)?t:[mt.Default,t]),(t,n)=>n[0]-t[0]).map(t=>t[1])}exitMarkForwards(e,t){return n=>{const{tr:r,dispatch:o}=n;if(!Xne(r.selection)||_h({selection:r.selection,types:t}))return!1;const a=r.selection.$from.marks().filter(l=>!e.includes(l.type.name));if(Oa(a))return!1;if(!o)return!0;for(const l of a)r.removeStoredMark(l);return o(r.insertText(" ",r.selection.from)),!0}}exitNodeBackwards(e,t=!1){return n=>{const{tr:r}=n;if(!(t?j_:Ow)(r.selection))return!1;const i=r.selection.$anchor.node();return!Kk(i)||Ine(i)||e.includes(i.type.name)?!1:this.store.commands.toggleBlockNodeItem.original({type:i.type})(n)}}exitMarkBackwards(e,t,n=!1){return r=>{const{tr:o,dispatch:i}=r;if(!(n?j_:Ow)(o.selection)||this.backwardMarkExitTracker.has(o.selection.anchor))return this.backwardMarkExitTracker.clear(),!1;if(_h({selection:o.selection,types:t}))return!1;const l=[...o.storedMarks??[],...o.selection.$from.marks()].filter(c=>!e.includes(c.type.name));if(Oa(l))return!1;if(!i)return!0;for(const c of l)o.removeStoredMark(c);return this.backwardMarkExitTracker.set(o.selection.anchor,!0),i(o),!0}}};ye([to({shortcut:"ArrowRight",isActive:e=>e.exitMarksOnArrowPress})],Bo.prototype,"arrowRightShortcut",1);ye([to({shortcut:"ArrowLeft",isActive:e=>e.exitMarksOnArrowPress})],Bo.prototype,"arrowLeftShortcut",1);ye([to({shortcut:"Backspace",isActive:e=>e.exitMarksOnArrowPress})],Bo.prototype,"backspace",1);ye([Bt()],Bo.prototype,"getNamedShortcut",1);Bo=ye([st({defaultPriority:mt.Low,defaultOptions:{shortcuts:"default",undoInputRuleOnBackspace:!0,selectParentNodeOnEscape:!1,excludeBaseKeymap:!1,exitMarksOnArrowPress:!0},customHandlerKeys:["keymap"]})],Bo);function soe(e){return ni(Py(oe),e)}function Am({shortcut:e,map:t,options:n,store:r}){return Fe(e)?[Iw(e,t)]:sn(e)?e.map(o=>Iw(o,t)):(e=e(n,r),Am({shortcut:e,map:t,options:n,store:r}))}function Iw(e,t){return soe(e)?t[e]:e}function aoe(e,t){const n={};let r,o;sn(e)?[o,r]=e:r=e;for(const[i,s]of on(r))n[Iw(i,t)]=s;return _y(o)?n:[o,n]}var ZL={[oe.Copy]:"Mod-c",[oe.Cut]:"Mod-x",[oe.Paste]:"Mod-v",[oe.PastePlain]:"Mod-Shift-v",[oe.SelectAll]:"Mod-a",[oe.Undo]:"Mod-z",[oe.Redo]:$o.isMac?"Shift-Mod-z":"Mod-y",[oe.Bold]:"Mod-b",[oe.Italic]:"Mod-i",[oe.Underline]:"Mod-u",[oe.Strike]:"Mod-d",[oe.Code]:"Mod-`",[oe.Paragraph]:"Mod-Shift-0",[oe.H1]:"Mod-Shift-1",[oe.H2]:"Mod-Shift-2",[oe.H3]:"Mod-Shift-3",[oe.H4]:"Mod-Shift-4",[oe.H5]:"Mod-Shift-5",[oe.H6]:"Mod-Shift-6",[oe.TaskList]:"Mod-Shift-7",[oe.BulletList]:"Mod-Shift-8",[oe.OrderedList]:"Mod-Shift-9",[oe.Quote]:"Mod->",[oe.Divider]:"Mod-Shift-|",[oe.Codeblock]:"Mod-Shift-~",[oe.ClearFormatting]:"Mod-Shift-C",[oe.Superscript]:"Mod-.",[oe.Subscript]:"Mod-,",[oe.LeftAlignment]:"Mod-Shift-L",[oe.CenterAlignment]:"Mod-Shift-E",[oe.RightAlignment]:"Mod-Shift-R",[oe.JustifyAlignment]:"Mod-Shift-J",[oe.InsertLink]:"Mod-k",[oe.Find]:"Mod-f",[oe.FindBackwards]:"Mod-Shift-f",[oe.FindReplace]:"Mod-Shift-H",[oe.AddFootnote]:"Mod-Alt-f",[oe.AddComment]:"Mod-Alt-m",[oe.ContextMenu]:"Mod-Shift-\\",[oe.IncreaseFontSize]:"Mod-Shift-.",[oe.DecreaseFontSize]:"Mod-Shift-,",[oe.IncreaseIndent]:"Tab",[oe.DecreaseIndent]:"Shift-Tab",[oe.Shortcuts]:"Mod-/",[oe.Format]:$o.isMac?"Alt-Shift-f":"Shift-Ctrl-f"},loe={...ZL,[oe.Strike]:"Mod-Shift-S",[oe.Code]:"Mod-Shift-M",[oe.Paragraph]:"Mod-Alt-0",[oe.H1]:"Mod-Alt-1",[oe.H2]:"Mod-Alt-2",[oe.H3]:"Mod-Alt-3",[oe.H4]:"Mod-Alt-4",[oe.H5]:"Mod-Alt-5",[oe.H6]:"Mod-Alt-6",[oe.OrderedList]:"Mod-Alt-7",[oe.BulletList]:"Mod-Alt-8",[oe.Quote]:"Mod-Alt-9",[oe.ClearFormatting]:"Mod-\\",[oe.IncreaseIndent]:"Mod-[",[oe.DecreaseIndent]:"Mod-]"},coe={default:ZL,googleDoc:loe},uoe=class extends Tt{get name(){return"nodeViews"}createPlugin(){const e=[],t=Se();for(const n of this.store.extensions){if(!n.createNodeViews)continue;const r=n.createNodeViews();e.unshift(jt(r)?{[n.name]:r}:r)}e.unshift(this.store.managerSettings.nodeViews??{});for(const n of e)Object.assign(t,n);return{props:{nodeViews:t}}}},doe=class extends Tt{get name(){return"pasteRules"}createExternalPlugins(){return[this.generatePasteRulesPlugin()]}generatePasteRulesPlugin(){var e,t;const n=[];for(const r of this.store.extensions){if((e=this.store.managerSettings.exclude)!=null&&e.pasteRules||!r.createPasteRules||(t=r.options.exclude)!=null&&t.pasteRules)continue;const o=r.createPasteRules(),i=sn(o)?o:[o];n.push(...i)}return Ore(n)}},Dw=class extends Tt{constructor(){super(...arguments),this.plugins=[],this.managerPlugins=[],this.applyStateHandlers=[],this.initStateHandlers=[],this.appendTransactionHandlers=[],this.pluginKeys=Se(),this.stateGetters=new Map,this.getPluginStateCreator=e=>t=>e.getState(t??this.store.getState()),this.getStateByName=e=>{const t=this.stateGetters.get(e);return je(t,{message:"No plugin exists for the requested extension name."}),t()}}get name(){return"plugins"}onCreate(){const{setStoreKey:e,setExtensionStore:t,managerSettings:n,extensions:r}=this.store;this.updateExtensionStore();const{plugins:o=[]}=n;this.updatePlugins(o,this.managerPlugins);for(const i of r)i.onApplyState&&this.applyStateHandlers.push(i.onApplyState.bind(i)),i.onInitState&&this.initStateHandlers.push(i.onInitState.bind(i)),i.onAppendTransaction&&this.appendTransactionHandlers.push(i.onAppendTransaction.bind(i)),this.extractExtensionPlugins(i);this.managerPlugins=o,this.store.setStoreKey("plugins",this.plugins),e("pluginKeys",this.pluginKeys),e("getPluginState",this.getStateByName),t("getPluginState",this.getStateByName)}createPlugin(){return{appendTransaction:(e,t,n)=>{const r=n.tr,o={previousState:t,tr:r,transactions:e,state:n};for(const i of this.appendTransactionHandlers)i(o);return this.options.appendTransaction(o),r.docChanged||r.steps.length>0||r.selectionSet||r.storedMarksSet?r:void 0},state:{init:(e,t)=>{for(const n of this.initStateHandlers)n(t)},apply:(e,t,n,r)=>{const o={previousState:n,state:r,tr:e};for(const i of this.applyStateHandlers)i(o);this.options.applyState(o)}}}}extractExtensionPlugins(e){var t,n;if(!(!e.createPlugin&&!e.createExternalPlugins||(t=this.store.managerSettings.exclude)!=null&&t.plugins||(n=e.options.exclude)!=null&&n.plugins)){if(e.createPlugin){const o=new id(e.name);this.pluginKeys[e.name]=o;const i=this.getPluginStateCreator(o);e.pluginKey=o,e.getPluginState=i,this.stateGetters.set(e.name,i),this.stateGetters.set(e.constructor,i);const s={...e.createPlugin(),key:o},a=new gs(s);this.updatePlugins([a],e.plugin?[e.plugin]:void 0),e.plugin=a}if(e.createExternalPlugins){const o=e.createExternalPlugins();this.updatePlugins(o,e.externalPlugins),e.externalPlugins=o}}}updatePlugins(e,t){if(!t||Oa(t)){this.plugins=[...this.plugins,...e];return}if(e.length!==t.length){this.plugins=[...this.plugins.filter(r=>!t.includes(r)),...e];return}const n=new Map;for(const[r,o]of e.entries())n.set(It(t,r),o);this.plugins=this.plugins.map(r=>t.includes(r)?n.get(r):r)}updateExtensionStore(){const{setExtensionStore:e}=this.store;e("updatePlugins",this.updatePlugins.bind(this)),e("dispatchPluginUpdate",this.dispatchPluginUpdate.bind(this)),e("updateExtensionPlugins",this.updateExtensionPlugins.bind(this))}updateExtensionPlugins(e){const t=JL(e)?e:Jre(e)?this.store.manager.getExtension(e):this.store.extensions.find(n=>n.name===e);je(t,{code:re.INVALID_MANAGER_EXTENSION,message:`The extension ${e} does not exist within the editor.`}),this.extractExtensionPlugins(t),this.store.setStoreKey("plugins",this.plugins),this.dispatchPluginUpdate()}dispatchPluginUpdate(){je(this.store.phase>=lr.EditorView,{code:re.MANAGER_PHASE_ERROR,message:"`dispatchPluginUpdate` should only be called after the view has been added to the manager."});const{view:e,updateState:t}=this.store,n=e.state.reconfigure({plugins:this.plugins});t(n)}};Dw=ye([st({defaultPriority:mt.Highest,handlerKeys:["applyState","appendTransaction"]})],Dw);var Lw=class extends Tt{constructor(){super(...arguments),this.dynamicAttributes={marks:Se(),nodes:Se()}}get name(){return"schema"}onCreate(){const{managerSettings:e,tags:t,markNames:n,nodeNames:r,extensions:o}=this.store,{defaultBlockNode:i,disableExtraAttributes:s,nodeOverride:a,markOverride:l}=e,c=m=>!!(m&&t[He.Block].includes(m));if(e.schema){const{nodes:m,marks:v}=xoe(e.schema);this.addSchema(e.schema,m,v);return}const u=c(i)?{doc:Se(),[i]:Se()}:Se(),f=Se(),h=foe({settings:e,gatheredSchemaAttributes:this.gatherExtraAttributes(o),nodeNames:r,markNames:n,tags:t});for(const m of o){h[m.name]={...h[m.name],...m.options.extraAttributes};const v=s===!0||m.options.disableExtraAttributes===!0||m.constructor.disableExtraAttributes===!0;if(Np(m)){const{spec:x,dynamic:b}=A_({createExtensionSpec:(w,S)=>m.createNodeSpec(w,S),extraAttributes:It(h,m.name),override:{...a,...m.options.nodeOverride},ignoreExtraAttributes:v,name:m.constructorName,tags:m.tags});m.spec=x,u[m.name]=x,Object.keys(b).length>0&&(this.dynamicAttributes.nodes[m.name]=b)}if(By(m)){const{spec:x,dynamic:b}=A_({createExtensionSpec:(w,S)=>m.createMarkSpec(w,S),extraAttributes:It(h,m.name),override:{...l,...m.options.markOverride},ignoreExtraAttributes:v,name:m.constructorName,tags:m.tags??[]});m.spec=x,f[m.name]=x,Object.keys(b).length>0&&(this.dynamicAttributes.marks[m.name]=b)}}const p=new QZ({nodes:u,marks:f,topNode:"doc"});this.addSchema(p,u,f)}createPlugin(){return{appendTransaction:(e,t,n)=>{const{tr:r}=n;return!e.some(i=>i.docChanged)||Object.keys(this.dynamicAttributes.nodes).length===0&&Object.keys(this.dynamicAttributes.marks).length===0?null:(r.doc.descendants((i,s)=>(this.checkAndUpdateDynamicNodes(i,s,r),this.checkAndUpdateDynamicMarks(i,s,r),!0)),r.steps.length>0?r:null)}}}addSchema(e,t,n){this.store.setStoreKey("nodes",t),this.store.setStoreKey("marks",n),this.store.setStoreKey("schema",e),this.store.setExtensionStore("schema",e),this.store.setStoreKey("defaultBlockNode",Ly(e).name);for(const r of Object.values(e.nodes))if(r.name!=="doc"&&(r.isBlock||r.isTextblock))break}checkAndUpdateDynamicNodes(e,t,n){for(const[r,o]of on(this.dynamicAttributes.nodes))if(e.type.name===r)for(const[i,s]of on(o)){if(!Ta(e.attrs[i]))continue;const a={...e.attrs,[i]:s(e)};n.setNodeMarkup(t,void 0,a),C_(n)}}checkAndUpdateDynamicMarks(e,t,n){for(const[r,o]of on(this.dynamicAttributes.marks)){const i=It(this.store.schema.marks,r),s=e.marks.find(a=>a.type.name===r);if(s)for(const[a,l]of on(o)){if(!Ta(s.attrs[a]))continue;const c=fs(n.doc.resolve(t),i);if(!c)continue;const{from:u,to:f}=c,h=i.create({...s.attrs,[a]:l(s)});n.removeMark(u,f,i).addMark(u,f,h),C_(n)}}}gatherExtraAttributes(e){const t=[];for(const n of e)n.createSchemaAttributes&&t.push(...n.createSchemaAttributes());return t}};Lw=ye([st({defaultPriority:mt.Highest})],Lw);function foe(e){const{settings:t,gatheredSchemaAttributes:n,nodeNames:r,markNames:o,tags:i}=e,s=Se();if(t.disableExtraAttributes)return s;const a=[...n,...t.extraAttributes??[]];for(const l of a??[]){const c=poe({identifiers:l.identifiers,nodeNames:r,markNames:o,tags:i});for(const u of c){const f=s[u]??{};s[u]={...f,...l.attributes}}}return s}function hoe(e){return ec(e)&&sn(e.tags)}function poe(e){const{identifiers:t,nodeNames:n,markNames:r,tags:o}=e;if(t==="nodes")return n;if(t==="marks")return r;if(t==="all")return[...n,...r];if(sn(t))return t;je(hoe(t),{code:re.EXTENSION_EXTRA_ATTRIBUTES,message:"Invalid value passed as an identifier when creating `extraAttributes`."});const{tags:i=[],names:s=[],behavior:a="any",excludeNames:l,excludeTags:c,type:u}=t,f=new Set,h=u==="mark"?r:u==="node"?n:[...r,...n],p=v=>h.includes(v)&&!(l!=null&&l.includes(v));for(const v of s)p(v)&&f.add(v);const m=new Map;for(const v of i)if(!(c!=null&&c.includes(v)))for(const x of o[v]){if(!p(x))continue;if(a==="any"){f.add(x);continue}const b=m.get(x)??new Set;b.add(v),m.set(x,b)}for(const[v,x]of m)x.size===i.length&&f.add(v);return[...f]}function A_(e){var t;const{createExtensionSpec:n,extraAttributes:r,ignoreExtraAttributes:o,name:i,tags:s,override:a}=e,l=Se();function c(x,b){l[x]=b}let u=!1;function f(){u=!0}const h=moe(r,o,f,c),p=goe(r,o),m=voe(r,o),v=n({defaults:h,parse:p,dom:m},a);return je(o||u,{code:re.EXTENSION_SPEC,message:`When creating a node specification you must call the 'defaults', and parse, and 'dom' methods. To avoid this error you can set the static property 'disableExtraAttributes' of '${i}' to 'true'.`}),v.group=[...((t=v.group)==null?void 0:t.split(" "))??[],...s].join(" ")||void 0,{spec:v,dynamic:l}}function qk(e){return Fe(e)||jt(e)?{default:e}:(je(e,{message:`${JI(e)} is not supported`,code:re.EXTENSION_EXTRA_ATTRIBUTES}),e)}function moe(e,t,n,r){return()=>{n();const o=Se();if(t)return o;for(const[i,s]of on(e)){let l=qk(s).default;jt(l)&&(r(i,l),l=null),o[i]=l===void 0?{}:{default:l}}return o}}function goe(e,t){return n=>{const r=Se();if(t)return r;for(const[o,i]of on(e)){const{parseDOM:s,...a}=qk(i);if(Ni(n)){if(Ta(s)){r[o]=n.getAttribute(o)??a.default;continue}if(jt(s)){r[o]=s(n)??a.default;continue}r[o]=n.getAttribute(s)??a.default}}return r}}function voe(e,t){return n=>{const r=Se();if(t)return r;function o(i,s){if(i){if(Fe(i)){r[s]=i;return}if(sn(i)){const[a,l]=i;r[a]=l??n.attrs[s];return}for(const[a,l]of on(i))r[a]=l}}for(const[i,s]of on(e)){const{toDOM:a,parseDOM:l}=qk(s);if(Ta(a)){const c=Fe(l)?l:i;r[c]=n.attrs[i];continue}if(jt(a)){o(a(n.attrs,yoe(n)),i);continue}o(a,i)}return r}}function yoe(e){return Iy(e)?{node:e}:One(e)?{mark:e}:{}}function xoe(e){const t=Se(),n=Se();for(const[r,o]of Object.entries(e.nodes))t[r]=o.spec;for(const[r,o]of Object.entries(e.marks))n[r]=o.spec;return{nodes:t,marks:n}}var Au=class extends Tt{constructor(){super(...arguments),this.onAddCustomHandler=({suggester:e})=>{var t;if(!(!e||(t=this.store.managerSettings.exclude)!=null&&t.suggesters))return E_(this.store.getState(),e)}}get name(){return"suggest"}onCreate(){this.store.setExtensionStore("addSuggester",e=>E_(this.store.getState(),e)),this.store.setExtensionStore("removeSuggester",e=>gne(this.store.getState(),e))}createExternalPlugins(){var e,t;const n=[];for(const r of this.store.extensions){if((e=this.store.managerSettings.exclude)!=null&&e.suggesters)break;if(!r.createSuggesters||(t=r.options.exclude)!=null&&t.suggesters)continue;const o=r.createSuggesters(),i=sn(o)?o:[o];n.push(...i)}return[vne(...n)]}getSuggestState(e){return zk(e??this.store.getState())}getSuggestMethods(){const{addIgnored:e,clearIgnored:t,removeIgnored:n,ignoreNextExit:r,setMarkRemoved:o,findMatchAtPosition:i,findNextTextSelection:s,setLastChangeFromAppend:a}=this.getSuggestState();return{addIgnored:e,clearIgnored:t,removeIgnored:n,ignoreNextExit:r,setMarkRemoved:o,findMatchAtPosition:i,findNextTextSelection:s,setLastChangeFromAppend:a}}isSuggesterActive(e){var t;return ni(sn(e)?e:[e],(t=this.getSuggestState().match)==null?void 0:t.suggester.name)}};ye([Bt()],Au.prototype,"getSuggestState",1);ye([Bt()],Au.prototype,"getSuggestMethods",1);ye([Bt()],Au.prototype,"isSuggesterActive",1);Au=ye([st({customHandlerKeys:["suggester"]})],Au);var Fw=class extends Tt{constructor(){super(...arguments),this.allTags=Se(),this.plainTags=Se(),this.markTags=Se(),this.nodeTags=Se()}get name(){return"tags"}onCreate(){this.resetTags();for(const e of this.store.extensions)this.updateTagForExtension(e);this.store.setStoreKey("tags",this.allTags),this.store.setExtensionStore("tags",this.allTags),this.store.setStoreKey("plainTags",this.plainTags),this.store.setExtensionStore("plainTags",this.plainTags),this.store.setStoreKey("markTags",this.markTags),this.store.setExtensionStore("markTags",this.markTags),this.store.setStoreKey("nodeTags",this.nodeTags),this.store.setExtensionStore("nodeTags",this.nodeTags)}resetTags(){const e=Se(),t=Se(),n=Se(),r=Se();for(const o of Py(He))e[o]=[],t[o]=[],n[o]=[],r[o]=[];this.allTags=e,this.plainTags=t,this.markTags=n,this.nodeTags=r}updateTagForExtension(e){var t,n;const r=new Set([...e.tags??[],...((t=e.createTags)==null?void 0:t.call(e))??[],...e.options.extraTags??[],...((n=this.store.managerSettings.extraTags)==null?void 0:n[e.name])??[]]);for(const o of r)je(boe(o),{code:re.EXTENSION,message:`The tag provided by the extension: ${e.constructorName} is not supported by the editor. To add custom tags you can use the 'mutateTag' method.`}),this.allTags[o].push(e.name),XL(e)&&this.plainTags[o].push(e.name),By(e)&&this.markTags[o].push(e.name),Np(e)&&this.nodeTags[o].push(e.name);e.tags=[...r]}};Fw=ye([st({defaultPriority:mt.Highest})],Fw);function boe(e){return ni(Py(He),e)}var woe=new id("remirrorFilePlaceholderPlugin");function Soe(){const e=new gs({key:woe,state:{init(){return{set:at.empty,payloads:new Map}},apply(t,{set:n,payloads:r}){n=n.map(t.mapping,t.doc);const o=t.getMeta(e);if(o)if(o.type===0){const i=document.createElement("placeholder"),s=_t.widget(o.pos,i,{id:o.id});n=n.add(t.doc,[s]),r.set(o.id,o.payload)}else o.type===1&&(n=n.remove(n.find(void 0,void 0,i=>i.id===o.id)),r.delete(o.id));return{set:n,payloads:r}}},props:{decorations(t){var n;return((n=e.getState(t))==null?void 0:n.set)??null}}});return e}var koe=class extends Tt{get name(){return"upload"}createExternalPlugins(){return[Soe()]}};function Eoe(e={}){e={...{exitMarksOnArrowPress:Bo.defaultOptions.exitMarksOnArrowPress,excludeBaseKeymap:Bo.defaultOptions.excludeBaseKeymap,selectParentNodeOnEscape:Bo.defaultOptions.selectParentNodeOnEscape,undoInputRuleOnBackspace:Bo.defaultOptions.undoInputRuleOnBackspace,persistentSelectionClass:oi.defaultOptions.persistentSelectionClass},...e};const n=uw(e,["excludeBaseKeymap","selectParentNodeOnEscape","undoInputRuleOnBackspace"]),r=uw(e,["persistentSelectionClass"]);return[new Fw,new Lw,new Xre,new Dw,new Aw,new doe,new uoe,new Au,new Ye,new wo,new Bo(n),new Rw,new koe,new oi(r)]}var I_=class extends Tt{get name(){return"meta"}onCreate(){if(this.store.setStoreKey("getCommandMeta",this.getCommandMeta.bind(this)),!!this.options.capture)for(const e of this.store.extensions)this.captureCommands(e),this.captureKeybindings(e)}createPlugin(){return{}}captureCommands(e){const t=e.decoratedCommands??{},n=e.createCommands;for(const r of Object.keys(t)){const o=e[r];e[r]=(...i)=>s=>{var a;const l=o(...i)(s);return s.dispatch&&l&&this.setCommandMeta(s.tr,{type:"command",chain:s.dispatch!==((a=s.view)==null?void 0:a.dispatch),name:r,extension:e.name,decorated:!0}),l}}n&&(e.createCommands=()=>{const r=n();for(const[o,i]of Object.entries(r))r[o]=(...s)=>a=>{var l;const c=i(...s)(a);return a.dispatch&&c&&this.setCommandMeta(a.tr,{type:"command",chain:a.dispatch!==((l=a.view)==null?void 0:l.dispatch),name:o,extension:e.name,decorated:!1}),c};return r})}captureKeybindings(e){}getCommandMeta(e){return e.getMeta(this.pluginKey)??[]}setCommandMeta(e,t){const n=this.getCommandMeta(e);e.setMeta(this.pluginKey,[...n,t])}};I_=ye([st({defaultOptions:{capture:$o.isDevelopment},staticKeys:["capture"],defaultPriority:mt.Highest})],I_);var Im,Wd,Dm,Ec,Is,Lm,Fm,Coe=class{constructor(e){Yt(this,Im,qg()),Yt(this,Wd,void 0),Yt(this,Dm,void 0),Yt(this,Ec,!0),Yt(this,Is,Ny()),Yt(this,Lm,void 0),Yt(this,Fm,void 0),this.getState=()=>this.view.state??this.initialEditorState,this.getPreviousState=()=>this.previousState,this.dispatchTransaction=i=>{var s,a;je(!this.manager.destroyed,{code:re.MANAGER_PHASE_ERROR,message:"A transaction was dispatched to a manager that has already been destroyed. Please check your set up, or open an issue."}),i=((a=(s=this.props).onDispatchTransaction)==null?void 0:a.call(s,i,this.getState()))??i;const l=this.getState(),{state:c,transactions:u}=l.applyTransaction(i);un(this,Dm,l),this.updateState({state:c,tr:i,transactions:u});const f=this.manager.store.getForcedUpdates(i);Oa(f)||this.updateViewProps(...f)},this.onChange=(i=Se())=>{var s,a;const l=this.eventListenerProps(i);le(this,Ec)&&un(this,Ec,!1),(a=(s=this.props).onChange)==null||a.call(s,l)},this.onBlur=i=>{var s,a;const l=this.eventListenerProps();(a=(s=this.props).onBlur)==null||a.call(s,l,i),le(this,Is).emit("blur",l,i)},this.onFocus=i=>{var s,a;const l=this.eventListenerProps();(a=(s=this.props).onFocus)==null||a.call(s,l,i),le(this,Is).emit("focus",l,i)},this.setContent=(i,{triggerChange:s=!1}={})=>{const{doc:a}=this.manager.createState({content:i}),l=this.getState(),{state:c}=this.getState().applyTransaction(l.tr.replaceRangeWith(0,l.doc.nodeSize-2,a));if(s)return this.updateState({state:c,triggerChange:s});this.view.updateState(c)},this.clearContent=({triggerChange:i=!1}={})=>{this.setContent(this.manager.createEmptyDoc(),{triggerChange:i})},this.createStateFromContent=(i,s)=>this.manager.createState({content:i,selection:s}),this.focus=i=>{this.manager.store.commands.focus(i)},this.blur=i=>{this.manager.store.commands.blur(i)};const{getProps:t,initialEditorState:n,element:r}=e;if(un(this,Wd,t),un(this,Fm,n),this.manager.attachFramework(this,this.updateListener.bind(this)),this.manager.view)return;const o=this.createView(n,r);this.manager.addView(o)}get addHandler(){return le(this,Lm)??un(this,Lm,le(this,Is).on.bind(le(this,Is)))}get updatableViewProps(){return{attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0}}get firstRender(){return le(this,Ec)}get props(){return le(this,Wd).call(this)}get previousState(){return this.previousStateOverride??le(this,Dm)??this.initialEditorState}get manager(){return this.props.manager}get view(){return this.manager.view}get uid(){return le(this,Im)}get initialEditorState(){return le(this,Fm)}updateListener(e){const{state:t,tr:n}=e;return le(this,Is).emit("updated",this.eventListenerProps({state:t,tr:n}))}update(e){const{getProps:t}=e;return un(this,Wd,t),this}updateViewProps(...e){const t=uw(this.updatableViewProps,e);this.view.setProps({...this.view.props,...t})}getAttributes(e){var t;const{attributes:n,autoFocus:r,classNames:o=[],label:i,editable:s}=this.props,a=(t=this.manager.store)==null?void 0:t.attributes,l=jt(n)?n(this.eventListenerProps()):n;let c={};(r||Yr(r))&&(c=e?{autoFocus:!0}:{autofocus:"true"});const u=Sh(Mw(e&&"Prosemirror","remirror-editor",a==null?void 0:a.class,...o).split(" ")).join(" "),f={role:"textbox",...c,"aria-multiline":"true",...s??!0?{}:{"aria-readonly":"true"},"aria-label":i??"",...a,class:u};return NZ({...f,...l})}addFocusListeners(){this.view.dom.addEventListener("blur",this.onBlur),this.view.dom.addEventListener("focus",this.onFocus)}removeFocusListeners(){this.view.dom.removeEventListener("blur",this.onBlur),this.view.dom.removeEventListener("focus",this.onFocus)}destroy(){le(this,Is).emit("destroy"),this.view&&this.removeFocusListeners()}eventListenerProps(e=Se()){const{state:t,tr:n,transactions:r}=e;return{tr:n,transactions:r,internalUpdate:!n,view:this.view,firstRender:le(this,Ec),state:t??this.getState(),createStateFromContent:this.createStateFromContent,previousState:this.previousState,helpers:this.manager.store.helpers}}get baseOutput(){return{manager:this.manager,...this.manager.store,addHandler:this.addHandler,focus:this.focus,blur:this.blur,uid:le(this,Im),view:this.view,getState:this.getState,getPreviousState:this.getPreviousState,getExtension:this.manager.getExtension.bind(this.manager),hasExtension:this.manager.hasExtension.bind(this.manager),clearContent:this.clearContent,setContent:this.setContent}}};Im=new WeakMap;Wd=new WeakMap;Dm=new WeakMap;Ec=new WeakMap;Is=new WeakMap;Lm=new WeakMap;Fm=new WeakMap;function Noe(e,t){const n=[],r=new WeakMap,o=[],i=new WeakMap;let s=[];const a={duplicateMap:i,parentExtensions:o,gatheredExtensions:s,settings:t};for(const f of e)QL(a,{extension:f});s=zl(s,(f,h)=>h.priority-f.priority);const l=new WeakSet,c=new Set;for(const f of s){const h=f.constructor,p=f.name,m=i.get(h);je(m,{message:`No entries were found for the ExtensionConstructor ${f.name}`,code:re.INTERNAL}),!(l.has(h)||c.has(p))&&(l.add(h),c.add(p),n.push(f),r.set(h,f),m.forEach(v=>v==null?void 0:v.replaceChildExtension(h,f)))}const u=[];for(const f of n)Poe({extension:f,found:l,missing:u});return je(Oa(u),{code:re.MISSING_REQUIRED_EXTENSION,message:u.map(({Constructor:f,extension:h})=>`The extension '${h.name}' requires '${f.name} in order to run correctly.`).join(`
|
|
522
|
-
`)}),{extensions:n,extensionMap:r}}function QL(e,t){var n;const{gatheredExtensions:r,duplicateMap:o,parentExtensions:i,settings:s}=e,{extension:a,parentExtension:l}=t;let{names:c=[]}=t;je(JL(a),{code:re.INVALID_MANAGER_EXTENSION,message:`An invalid extension: ${a} was provided to the [[\`RemirrorManager\`]].`});const u=a.extensions;if(a.setPriority((n=s.priority)==null?void 0:n[a.name]),r.push(a),_oe({duplicateMap:o,extension:a,parentExtension:l}),u.length!==0){if(c.includes(a.name)){`${c.join(" > ")}${a.name}`;return}c=[...c,a.name],i.push(a);for(const f of u)QL(e,{names:c,extension:f,parentExtension:a})}}function Poe(e){const{extension:t,found:n,missing:r}=e;if(t.requiredExtensions)for(const o of t.requiredExtensions??[])n.has(o)||r.push({Constructor:o,extension:t})}function _oe(e){const{duplicateMap:t,extension:n,parentExtension:r}=e,o=n.constructor,i=t.get(o),s=r?[r]:[];t.set(o,i?[...i,...s]:s)}function joe(e){var t,n,r,o;const{extension:i,nodeNames:s,markNames:a,plainNames:l,store:c,handlers:u}=e;i.setStore(c);const f=(t=i.onCreate)==null?void 0:t.bind(i),h=(n=i.onView)==null?void 0:n.bind(i),p=(r=i.onStateUpdate)==null?void 0:r.bind(i),m=(o=i.onDestroy)==null?void 0:o.bind(i);f&&u.create.push(f),h&&u.view.push(h),p&&u.update.push(p),m&&u.destroy.push(m),By(i)&&a.push(i.name),Np(i)&&i.name!=="doc"&&s.push(i.name),XL(i)&&l.push(i.name)}var Ds,Hd,To,Fi,Kd,Tr,el,Gd,tl,qd,nl,Oo,Yd,zm=class{constructor(e,t={}){Yt(this,Ds,void 0),Yt(this,Hd,Se()),Yt(this,To,Se()),Yt(this,Fi,void 0),Yt(this,Kd,void 0),Yt(this,Tr,lr.None),Yt(this,el,void 0),Yt(this,Gd,!0),Yt(this,tl,{create:[],view:[],update:[],destroy:[]}),Yt(this,qd,[]),Yt(this,nl,Ny()),Yt(this,Oo,void 0),Yt(this,Yd,void 0),this.getState=()=>{var o;return le(this,Tr)>=lr.EditorView?this.view.state:(je(le(this,Oo),{code:re.MANAGER_PHASE_ERROR,message:"`getState` can only be called after the `Framework` or the `EditorView` has been added to the manager`. Check your plugins to make sure that the decorations callback uses the state argument."}),(o=le(this,Oo))==null?void 0:o.initialEditorState)},this.updateState=o=>{const i=this.getState();this.view.updateState(o),this.onStateUpdate({previousState:i,state:o})};const{extensions:n,extensionMap:r}=Noe(e,t);un(this,el,t),un(this,Fi,ll(n)),un(this,Kd,r),un(this,Ds,this.createExtensionStore()),un(this,Tr,lr.Create),this.setupLifecycleHandlers();for(const o of le(this,tl).create){const i=o();i&&le(this,qd).push(i)}}static create(e,t={}){return new zm([...tD(e),...Eoe(t.builtin)],t)}get[ds](){return gn.Manager}get destroyed(){return le(this,Tr)===lr.Destroy}get mounted(){return le(this,Tr)>=lr.EditorView&&le(this,Tr)<lr.Destroy}get output(){var e;return(e=le(this,Oo))==null?void 0:e.frameworkOutput}get frameworkAttached(){return!!le(this,Oo)}get extensions(){return le(this,Fi)}get stringHandlers(){return le(this,Hd)}get store(){return ll(le(this,To))}get extensionStore(){return ll(le(this,Ds))}get tr(){return this.getExtension(Ye).transaction}get nodes(){return le(this,To).nodes}get marks(){return le(this,To).marks}get schema(){return le(this,To).schema}get extensionTags(){return le(this,To).tags}get view(){return le(this,To).view}get settings(){return le(this,el)}get document(){return le(this,el).document??Fy()}setupLifecycleHandlers(){const e=le(this,Ds),t=le(this,tl),n=[],r=[],o=[];e.nodeNames=n,e.markNames=r,e.plainNames=o;for(const i of le(this,Fi))joe({extension:i,nodeNames:n,markNames:r,plainNames:o,handlers:t,store:e})}setStringHandler(e,t){le(this,Hd)[e]=t}setStoreKey(e,t){le(this,To)[e]=t}getStoreKey(e){const t=le(this,To)[e];return je(!Ta(t),{code:re.MANAGER_PHASE_ERROR,message:"`getStoreKey` should not be called before the values are available."}),t}setExtensionStore(e,t){je(le(this,Tr)<=lr.EditorView,{code:re.MANAGER_PHASE_ERROR,message:"`setExtensionStore` should only be called during the `onCreate` lifecycle hook. Make sure to only call it within the returned methods."}),le(this,Ds)[e]=t}createExtensionStore(){const e=Se(),t=!0;let n,r;return Object.defineProperties(e,{extensions:{get:()=>le(this,Fi),enumerable:t},phase:{get:()=>le(this,Tr),enumerable:t},view:{get:()=>this.view,enumerable:t},managerSettings:{get:()=>ll(le(this,el)),enumerable:t},getState:{value:this.getState,enumerable:t},updateState:{value:this.updateState,enumerable:t},isMounted:{value:()=>this.mounted,enumerable:t},getExtension:{value:this.getExtension.bind(this),enumerable:t},manager:{get:()=>this,enumerable:t},document:{get:()=>this.document,enumerable:t},stringHandlers:{get:()=>le(this,Hd),enumerable:t},currentState:{get:()=>n??(n=this.getState()),set:o=>{n=o},enumerable:t},previousState:{get:()=>r,set:o=>{r=o},enumerable:t}}),e.getStoreKey=this.getStoreKey.bind(this),e.setStoreKey=this.setStoreKey.bind(this),e.setExtensionStore=this.setExtensionStore.bind(this),e.setStringHandler=this.setStringHandler.bind(this),e}addView(e){if(le(this,Tr)>=lr.EditorView)return this;un(this,Gd,!0),un(this,Tr,lr.EditorView),le(this,To).view=e;for(const t of le(this,tl).view){const n=t(e);n&&le(this,qd).push(n)}return this}attachFramework(e,t){var n;le(this,Oo)!==e&&(le(this,Oo)&&(le(this,Oo).destroy(),(n=le(this,Yd))==null||n.call(this)),un(this,Oo,e),un(this,Yd,this.addHandler("stateUpdate",t)))}createEmptyDoc(){var e;const t=(e=this.schema.nodes.doc)==null?void 0:e.createAndFill();return je(t,{code:re.INVALID_CONTENT,message:"An empty node could not be created due to an invalid schema."}),t}createState(e={}){const{onError:t,defaultSelection:n="end"}=this.settings,{content:r=this.createEmptyDoc(),selection:o=n,stringHandler:i=this.settings.stringHandler}=e,{schema:s,plugins:a}=this.store,l=OL({stringHandler:Fe(i)?this.stringHandlers[i]:i,document:this.document,content:r,onError:t,schema:s,selection:o});return cl.create({schema:s,doc:l,plugins:a,selection:bo(o,l)})}addHandler(e,t){return le(this,nl).on(e,t)}onStateUpdate(e){const t=le(this,Gd);le(this,Ds).currentState=e.state,le(this,Ds).previousState=e.previousState,t&&(un(this,Tr,lr.Runtime),un(this,Gd,!1));const n={...e,firstUpdate:t};for(const r of le(this,tl).update)r(n);le(this,nl).emit("stateUpdate",n)}getExtension(e){const t=le(this,Kd).get(e);return je(t,{code:re.INVALID_MANAGER_EXTENSION,message:`'${e.name}' doesn't exist within this manager. Make sure it is properly added before attempting to use it.`}),t}hasExtension(e){return!!le(this,Kd).get(e)}clone(){const e=le(this,Fi).map(n=>n.clone(n.options)),t=zm.create(()=>e,le(this,el));return le(this,nl).emit("clone",t),t}recreate(e=[],t={}){const n=le(this,Fi).map(o=>o.clone(o.initialOptions)),r=zm.create(()=>[...n,...e],t);return le(this,nl).emit("recreate",r),r}destroy(){var e,t,n,r,o,i;un(this,Tr,lr.Destroy);for(const s of((e=this.view)==null?void 0:e.state.plugins)??[])(n=(t=s.getState(this.view.state))==null?void 0:t.destroy)==null||n.call(t);(r=le(this,Oo))==null||r.destroy(),(o=le(this,Yd))==null||o.call(this);for(const s of le(this,qd))s();for(const s of le(this,tl).destroy)s();(i=this.view)==null||i.destroy(),le(this,nl).emit("destroy")}includes(e){const t=[],n=[];for(const r of le(this,Fi))t.push(r.name,r.constructorName),n.push(r.constructor);return e.every(r=>Fe(r)?ni(t,r):ni(n,r))}},Toe=zm;Ds=new WeakMap;Hd=new WeakMap;To=new WeakMap;Fi=new WeakMap;Kd=new WeakMap;Tr=new WeakMap;el=new WeakMap;Gd=new WeakMap;tl=new WeakMap;qd=new WeakMap;nl=new WeakMap;Oo=new WeakMap;Yd=new WeakMap;function Ooe(e,t){return!(!sd(e)||!ad(e,gn.Manager))}var Moe=Object.defineProperty,Roe=Object.getOwnPropertyDescriptor,Aoe=(e,t,n,r)=>{for(var o=r>1?void 0:r?Roe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Moe(t,n,o),o},e4=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},be=(e,t,n)=>(e4(e,t,"read from private field"),n?n.call(e):t.get(e)),Or=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},jr=(e,t,n,r)=>(e4(e,t,"write to private field"),t.set(e,n),n),Jd,Ioe=class{constructor(){this.portals=new Map,Or(this,Jd,Ny()),this.on=e=>be(this,Jd).on("update",e),this.once=e=>{const t=be(this,Jd).on("update",n=>{t(),e(n)});return t}}update(){be(this,Jd).emit("update",this.portals)}render({Component:e,container:t}){const n=this.portals.get(t);this.portals.set(t,{Component:e,key:(n==null?void 0:n.key)??qg()}),this.update()}forceUpdate(){for(const[e,{Component:t}]of this.portals)this.portals.set(e,{Component:t,key:qg()})}remove(e){this.portals.delete(e),this.update()}};Jd=new WeakMap;var Doe=e=>{const{portals:t}=e;return Ee.createElement(Ee.Fragment,null,t.map(([n,{Component:r,key:o}])=>Fr.createPortal(Ee.createElement(r,null),n,o)))};function Loe(e){const[t,n]=g.useState(()=>Array.from(e.portals.entries()));return g.useEffect(()=>e.on(r=>{n(Array.from(r.entries()))}),[e]),g.useMemo(()=>t,[t])}var Mt,Xd,rl,Zd,$m,Qd,Cc,ef,Bm,zi,qn,zw,t4=class{constructor({getPosition:e,node:t,portalContainer:n,view:r,ReactComponent:o,options:i}){Or(this,Mt,void 0),Or(this,Xd,[]),Or(this,rl,void 0),Or(this,Zd,void 0),Or(this,$m,void 0),Or(this,Qd,void 0),Or(this,Cc,void 0),Or(this,ef,!1),Or(this,Bm,void 0),Or(this,zi,void 0),Or(this,qn,void 0),Or(this,zw,l=>{l&&(je(be(this,zi),{code:re.REACT_NODE_VIEW,message:`You have applied a ref to a node view provided for '${be(this,Mt).type.name}' which doesn't support content.`}),l.append(be(this,zi)))}),this.Component=()=>{const l=be(this,$m);return je(l,{code:re.REACT_NODE_VIEW,message:`The custom react node view provided for ${be(this,Mt).type.name} doesn't have a valid ReactComponent`}),Ee.createElement(l,{updateAttributes:this.updateAttributes,selected:this.selected,view:be(this,rl),getPosition:be(this,Qd),node:be(this,Mt),forwardRef:be(this,zw),decorations:be(this,Xd)})},this.updateAttributes=l=>{if(!be(this,rl).editable)return;const c=be(this,Qd).call(this);if(c==null)return;const u=be(this,rl).state.tr.setNodeMarkup(c,void 0,{...be(this,Mt).attrs,...l});be(this,rl).dispatch(u)},je(jt(e),{message:"You are attempting to use a node view for a mark type. This is not supported yet. Please check your configuration."}),jr(this,Mt,t),jr(this,rl,r),jr(this,Zd,n),jr(this,$m,o),jr(this,Qd,e),jr(this,Cc,i),jr(this,qn,this.createDom());const{contentDOM:s,wrapper:a}=this.createContentDom()??{};jr(this,Bm,s??void 0),jr(this,zi,a),be(this,zi)&&be(this,qn).append(be(this,zi)),this.setDomAttributes(be(this,Mt),be(this,qn)),this.Component.displayName=qI(`${be(this,Mt).type.name}NodeView`),this.renderComponent()}static create(e){const{portalContainer:t,ReactComponent:n,options:r}=e;return(o,i,s)=>new t4({options:r,node:o,view:i,getPosition:s,portalContainer:t,ReactComponent:n})}get selected(){return be(this,ef)}get contentDOM(){return be(this,Bm)}get dom(){return be(this,qn)}renderComponent(){be(this,Zd).render({Component:this.Component,container:be(this,qn)})}createDom(){const{defaultBlockNode:e,defaultInlineNode:t}=be(this,Cc),n=be(this,Mt).isInline?document.createElement(t):document.createElement(e);return n.classList.add(`${mP(be(this,Mt).type.name)}-node-view-wrapper`),n}createContentDom(){var e,t;if(be(this,Mt).isLeaf)return;const n=(t=(e=be(this,Mt).type.spec).toDOM)==null?void 0:t.call(e,be(this,Mt));if(!n)return;const{contentDOM:r,dom:o}=Ha.renderSpec(document,n);let i;if(Ni(o))return i=o,o===r&&(i=document.createElement("span"),i.classList.add(`${mP(be(this,Mt).type.name)}-node-view-content-wrapper`),i.append(r)),Ni(r),{wrapper:i,contentDOM:r}}update(e,t){return Bk({types:be(this,Mt).type,node:e})?(be(this,Mt)===e&&be(this,Xd)===t||(be(this,Mt).sameMarkup(e)||this.setDomAttributes(e,be(this,qn)),jr(this,Mt,e),jr(this,Xd,t),this.renderComponent()),!0):!1}setDomAttributes(e,t){const{toDOM:n}=be(this,Mt).type.spec;let r=e.attrs;if(n){const o=n(e);if(Fe(o)||Foe(o))return;ec(o[1])&&(r=o[1])}for(const[o,i]of on(r))t.setAttribute(o,i)}selectNode(){jr(this,ef,!0),be(this,qn)&&be(this,qn).classList.add(dP),this.renderComponent()}deselectNode(){jr(this,ef,!1),be(this,qn)&&be(this,qn).classList.remove(dP),this.renderComponent()}destroy(){be(this,Zd).remove(be(this,qn))}ignoreMutation(e){return e.type==="selection"?!be(this,Mt).type.spec.selectable:be(this,zi)?!be(this,zi).contains(e.target):!0}stopEvent(e){var t;if(!be(this,qn))return!1;if(jt(be(this,Cc).stopEvent))return be(this,Cc).stopEvent({event:e});const n=e.target;if(!(be(this,qn).contains(n)&&!((t=this.contentDOM)!=null&&t.contains(n))))return!1;const o=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!o)return!0;const s=!!be(this,Mt).type.spec.draggable,a=Me.isSelectable(be(this,Mt)),l=e.type==="copy",c=e.type==="paste",u=e.type==="cut",f=e.type==="mousedown",h=e.type.startsWith("drag");return!s&&a&&h&&e.preventDefault(),!(h||o||l||c||u||f&&a)}},D_=t4;Mt=new WeakMap;Xd=new WeakMap;rl=new WeakMap;Zd=new WeakMap;$m=new WeakMap;Qd=new WeakMap;Cc=new WeakMap;ef=new WeakMap;Bm=new WeakMap;zi=new WeakMap;qn=new WeakMap;zw=new WeakMap;function Foe(e){return jw(e)||ec(e)&&jw(e.dom)}var Oh=class extends Tt{constructor(){super(...arguments),this.portalContainer=new Ioe}get name(){return"reactComponent"}onCreate(){this.store.setStoreKey("portalContainer",this.portalContainer)}createNodeViews(){const e=Se(),t=this.store.managerSettings.nodeViewComponents??{};for(const r of this.store.extensions)!r.ReactComponent||!Np(r)||r.reactComponentEnvironment==="ssr"||(e[r.name]=D_.create({options:this.options,ReactComponent:r.ReactComponent,portalContainer:this.portalContainer}));const n=on({...this.options.nodeViewComponents,...t});for(const[r,o]of n)e[r]=D_.create({options:this.options,ReactComponent:o,portalContainer:this.portalContainer});return e}};Oh=Aoe([st({defaultOptions:{defaultBlockNode:"div",defaultInlineNode:"span",defaultContentNode:"span",defaultEnvironment:"both",nodeViewComponents:{},stopEvent:null},staticKeys:["defaultBlockNode","defaultInlineNode","defaultContentNode","defaultEnvironment"]})],Oh);var zoe=Object.defineProperty,L_=Object.getOwnPropertySymbols,$oe=Object.prototype.hasOwnProperty,Boe=Object.prototype.propertyIsEnumerable,F_=(e,t,n)=>t in e?zoe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,z_=(e,t)=>{for(var n in t||(t={}))$oe.call(t,n)&&F_(e,n,t[n]);if(L_)for(var n of L_(t))Boe.call(t,n)&&F_(e,n,t[n]);return e};function Voe(e){const t=g.createContext(null),n=Uoe(t);return[o=>{const i=e(o);return Ee.createElement(t.Provider,{value:i},o.children)},n,t]}function Uoe(e){return(t,n)=>{const r=g.useContext(e),o=Woe(r);if(!r)throw new Error("`useContextHook` must be placed inside the `Provider` returned by the `createContextState` method");if(!t)return r;if(typeof t!="function")throw new TypeError("invalid arguments passed to `useContextHook`. This hook must be called with zero arguments, a getter function or a path string.");const i=t(r);if(!o||!n)return i;const s=t(o);return n(s,i)?s:i}}function Woe(e){const t=g.useRef();return Hoe(()=>{t.current=e}),t.current}var Hoe=typeof document<"u"?g.useLayoutEffect:g.useEffect;function Koe(e,t){return Voe(n=>{const r=g.useRef(null),o=g.useRef(),i=void 0,[s,a]=g.useState(()=>e({get:$_(r),set:B_(o),previousContext:void 0,props:n,state:i})),l=[...Object.values(n),i];return g.useEffect(()=>{l.length!==0&&a(c=>e({get:$_(r),set:B_(o),previousContext:c,props:n,state:i}))},l),r.current=s,o.current=a,s})}function $_(e){return t=>{if(!e.current)throw new Error("`get` called outside of function scope. `get` can only be called within a function.");if(!t)return e.current;if(typeof t!="function")throw new TypeError("Invalid arguments passed to `useContextHook`. The hook must be called with zero arguments, a getter function or a path string.");return t(e.current)}}function B_(e){return t=>{if(!e.current)throw new Error("`set` called outside of function scope. `set` can only be called within a function.");e.current(n=>z_(z_({},n),typeof t=="function"?t(n):t))}}var n4={},r4={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.errorMessages=e.ErrorType=void 0;var t;(function(n){n.MalformedUnicode="MALFORMED_UNICODE",n.MalformedHexadecimal="MALFORMED_HEXADECIMAL",n.CodePointLimit="CODE_POINT_LIMIT",n.OctalDeprecation="OCTAL_DEPRECATION",n.EndOfString="END_OF_STRING"})(t=e.ErrorType||(e.ErrorType={})),e.errorMessages=new Map([[t.MalformedUnicode,"malformed Unicode character escape sequence"],[t.MalformedHexadecimal,"malformed hexadecimal character escape sequence"],[t.CodePointLimit,"Unicode codepoint must not be greater than 0x10FFFF in escape sequence"],[t.OctalDeprecation,'"0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead'],[t.EndOfString,"malformed escape sequence at end of string"]])})(r4);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.unraw=e.errorMessages=e.ErrorType=void 0;const t=r4;Object.defineProperty(e,"ErrorType",{enumerable:!0,get:function(){return t.ErrorType}}),Object.defineProperty(e,"errorMessages",{enumerable:!0,get:function(){return t.errorMessages}});function n(p){return!p.match(/[^a-f0-9]/i)?parseInt(p,16):NaN}function r(p,m,v){const x=n(p);if(Number.isNaN(x)||v!==void 0&&v!==p.length)throw new SyntaxError(t.errorMessages.get(m));return x}function o(p){const m=r(p,t.ErrorType.MalformedHexadecimal,2);return String.fromCharCode(m)}function i(p,m){const v=r(p,t.ErrorType.MalformedUnicode,4);if(m!==void 0){const x=r(m,t.ErrorType.MalformedUnicode,4);return String.fromCharCode(v,x)}return String.fromCharCode(v)}function s(p){return p.charAt(0)==="{"&&p.charAt(p.length-1)==="}"}function a(p){if(!s(p))throw new SyntaxError(t.errorMessages.get(t.ErrorType.MalformedUnicode));const m=p.slice(1,-1),v=r(m,t.ErrorType.MalformedUnicode);try{return String.fromCodePoint(v)}catch(x){throw x instanceof RangeError?new SyntaxError(t.errorMessages.get(t.ErrorType.CodePointLimit)):x}}function l(p,m=!1){if(m)throw new SyntaxError(t.errorMessages.get(t.ErrorType.OctalDeprecation));const v=parseInt(p,8);return String.fromCharCode(v)}const c=new Map([["b","\b"],["f","\f"],["n",`
|
|
523
|
-
`],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function u(p){return c.get(p)||p}const f=/\\(?:(\\)|x([\s\S]{0,2})|u(\{[^}]*\}?)|u([\s\S]{4})\\u([^{][\s\S]{0,3})|u([\s\S]{0,4})|([0-3]?[0-7]{1,2})|([\s\S])|$)/g;function h(p,m=!1){return p.replace(f,function(v,x,b,w,S,C,N,P,_){if(x!==void 0)return"\\";if(b!==void 0)return o(b);if(w!==void 0)return a(w);if(S!==void 0)return i(S,C);if(N!==void 0)return i(N);if(P==="0")return"\0";if(P!==void 0)return l(P,!m);if(_!==void 0)return u(_);throw new SyntaxError(t.errorMessages.get(t.ErrorType.EndOfString))})}e.unraw=h,e.default=h})(n4);const wl=e=>typeof e=="string",Goe=e=>typeof e=="function",V_=new Map,o4="en";function Yk(e){return[...Array.isArray(e)?e:[e],o4]}function i4(e,t,n){const r=Yk(e);return hv(()=>pv("date",r,n),()=>new Intl.DateTimeFormat(r,n)).format(wl(t)?new Date(t):t)}function $w(e,t,n){const r=Yk(e);return hv(()=>pv("number",r,n),()=>new Intl.NumberFormat(r,n)).format(t)}function U_(e,t,n,{offset:r=0,...o}){const i=Yk(e),s=t?hv(()=>pv("plural-ordinal",i),()=>new Intl.PluralRules(i,{type:"ordinal"})):hv(()=>pv("plural-cardinal",i),()=>new Intl.PluralRules(i,{type:"cardinal"}));return o[n]??o[s.select(n-r)]??o.other}function hv(e,t){const n=e();let r=V_.get(n);return r||(r=t(),V_.set(n,r)),r}function pv(e,t,n){const r=t.join("-");return`${e}-${r}-${JSON.stringify(n)}`}const s4=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,a4="%__lingui_octothorpe__%",qoe=(e,t,n={})=>{const r=t||e,o=s=>typeof s=="object"?s:n[s]||{style:s},i=(s,a)=>{const l=Object.keys(n).length?o("number"):void 0,c=$w(r,s,l);return a.replace(new RegExp(a4,"g"),c)};return{plural:(s,a)=>{const{offset:l=0}=a,c=U_(r,!1,s,a);return i(s-l,c)},selectordinal:(s,a)=>{const{offset:l=0}=a,c=U_(r,!0,s,a);return i(s-l,c)},select:Yoe,number:(s,a)=>$w(r,s,o(a)),date:(s,a)=>i4(r,s,o(a))}},Yoe=(e,t)=>t[e]??t.other;function Joe(e,t,n){return(r={},o)=>{const i=qoe(t,n,o),s=(l,c=!1)=>Array.isArray(l)?l.reduce((u,f)=>{if(f==="#"&&c)return u+a4;if(wl(f))return u+f;const[h,p,m]=f;let v={};p==="plural"||p==="selectordinal"||p==="select"?Object.entries(m).forEach(([b,w])=>{v[b]=s(w,p==="plural"||p==="selectordinal")}):v=m;let x;if(p){const b=i[p];x=b(r[h],v)}else x=r[h];return x==null?u:u+x},""):l,a=s(e);return wl(a)&&s4.test(a)?n4.unraw(a.trim()):wl(a)?a.trim():a?String(a):""}}var Xoe=Object.defineProperty,Zoe=(e,t,n)=>t in e?Xoe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qoe=(e,t,n)=>(Zoe(e,t+"",n),n);class eie{constructor(){Qoe(this,"_events",{})}on(t,n){var r;return(r=this._events)[t]??(r[t]=[]),this._events[t].push(n),()=>this.removeListener(t,n)}removeListener(t,n){const r=this._getListeners(t);if(!r)return;const o=r.indexOf(n);~o&&r.splice(o,1)}emit(t,...n){const r=this._getListeners(t);r&&r.map(o=>o.apply(this,n))}_getListeners(t){const n=this._events[t];return Array.isArray(n)?n:!1}}var tie=Object.defineProperty,nie=(e,t,n)=>t in e?tie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vc=(e,t,n)=>(nie(e,typeof t!="symbol"?t+"":t,n),n);class rie extends eie{constructor(t){super(),vc(this,"_locale",""),vc(this,"_locales"),vc(this,"_localeData",{}),vc(this,"_messages",{}),vc(this,"_missing"),vc(this,"t",this._.bind(this)),t.missing!=null&&(this._missing=t.missing),t.messages!=null&&this.load(t.messages),t.localeData!=null&&this.loadLocaleData(t.localeData),(typeof t.locale=="string"||t.locales)&&this.activate(t.locale??o4,t.locales)}get locale(){return this._locale}get locales(){return this._locales}get messages(){return this._messages[this._locale]??{}}get localeData(){return this._localeData[this._locale]??{}}_loadLocaleData(t,n){const r=this._localeData[t];r?Object.assign(r,n):this._localeData[t]=n}loadLocaleData(t,n){n!=null?this._loadLocaleData(t,n):Object.keys(t).forEach(r=>this._loadLocaleData(r,t[r])),this.emit("change")}_load(t,n){const r=this._messages[t];r?Object.assign(r,n):this._messages[t]=n}load(t,n){typeof t=="string"&&typeof n=="object"?this._load(t,n):Object.entries(t).forEach(([r,o])=>this._load(r,o)),this.emit("change")}loadAndActivate({locale:t,locales:n,messages:r}){this._locale=t,this._locales=n||void 0,this._messages[this._locale]=r,this.emit("change")}activate(t,n){this._locale=t,this._locales=n,this.emit("change")}_(t,n,r){let o=r==null?void 0:r.message;t||(t=""),wl(t)||(n=t.values||n,o=t.message,t=t.id);const i=this.messages[t],s=i===void 0,a=this._missing;if(a&&s)return Goe(a)?a(this._locale,t):a;s&&this.emit("missing",{id:t,locale:this._locale});let l=i||o||t;return wl(l)&&s4.test(l)?JSON.parse(`"${l}"`):wl(l)?l:Joe(l,this._locale,this._locales)(n,r==null?void 0:r.formats)}date(t,n){return i4(this._locales||this._locale,t,n)}number(t,n){return $w(this._locales||this._locale,t,n)}}function oie(e={}){return new rie(e)}const Vy=oie();function se(e,t){return t?"other":e==1?"one":"other"}function vs(e,t){return t?"other":e==0||e==1?"one":"other"}function Cr(e,t){var n=String(e).split("."),r=!n[1];return t?"other":e==1&&r?"one":"other"}function ut(e,t){return"other"}function Ga(e,t){return t?"other":e==1?"one":e==2?"two":"other"}const iie=ut,sie=se,aie=vs;function lie(e,t){return t?"other":e>=0&&e<=1?"one":"other"}const cie=se;function uie(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2);return t?"other":e==0?"zero":e==1?"one":e==2?"two":o>=3&&o<=10?"few":o>=11&&o<=99?"many":"other"}function die(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2);return t?"other":e==0?"zero":e==1?"one":e==2?"two":o>=3&&o<=10?"few":o>=11&&o<=99?"many":"other"}function fie(e,t){return t?e==1||e==5||e==7||e==8||e==9||e==10?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e>=0&&e<=1?"one":"other"}const hie=se,pie=Cr;function mie(e,t){var n=String(e).split("."),r=n[0],o=r.slice(-1),i=r.slice(-2),s=r.slice(-3);return t?o==1||o==2||o==5||o==7||o==8||i==20||i==50||i==70||i==80?"one":o==3||o==4||s==100||s==200||s==300||s==400||s==500||s==600||s==700||s==800||s==900?"few":r==0||o==6||i==40||i==60||i==90?"many":"other":e==1?"one":"other"}function gie(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2);return t?(o==2||o==3)&&i!=12&&i!=13?"few":"other":o==1&&i!=11?"one":o>=2&&o<=4&&(i<12||i>14)?"few":r&&o==0||o>=5&&o<=9||i>=11&&i<=14?"many":"other"}const vie=se,yie=se,xie=se,bie=vs,wie=ut;function Sie(e,t){return t?e==1||e==5||e==7||e==8||e==9||e==10?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e>=0&&e<=1?"one":"other"}const kie=ut;function Eie(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2),s=r&&n[0].slice(-6);return t?"other":o==1&&i!=11&&i!=71&&i!=91?"one":o==2&&i!=12&&i!=72&&i!=92?"two":(o==3||o==4||o==9)&&(i<10||i>19)&&(i<70||i>79)&&(i<90||i>99)?"few":e!=0&&r&&s==0?"many":"other"}const Cie=se;function Nie(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":i&&s==1&&a!=11||l==1&&c!=11?"one":i&&s>=2&&s<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function Pie(e,t){var n=String(e).split("."),r=!n[1];return t?e==1||e==3?"one":e==2?"two":e==4?"few":"other":e==1&&r?"one":"other"}const _ie=se;function jie(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=o.slice(-1);return t?"other":i&&(r==1||r==2||r==3)||i&&s!=4&&s!=6&&s!=9||!i&&a!=4&&a!=6&&a!=9?"one":"other"}const Tie=se,Oie=se,Mie=se;function Rie(e,t){var n=String(e).split("."),r=n[0],o=!n[1];return t?"other":e==1&&o?"one":r>=2&&r<=4&&o?"few":o?"other":"many"}function Aie(e,t){return t?e==0||e==7||e==8||e==9?"zero":e==1?"one":e==2?"two":e==3||e==4?"few":e==5||e==6?"many":"other":e==0?"zero":e==1?"one":e==2?"two":e==3?"few":e==6?"many":"other"}function Iie(e,t){var n=String(e).split("."),r=n[0],o=Number(n[0])==e;return t?"other":e==1||!o&&(r==0||r==1)?"one":"other"}const Die=Cr;function Lie(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-2),a=o.slice(-2);return t?"other":i&&s==1||a==1?"one":i&&s==2||a==2?"two":i&&(s==3||s==4)||a==3||a==4?"few":"other"}const Fie=se,zie=ut,$ie=se,Bie=se;function Vie(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-1),s=o&&n[0].slice(-2);return t?i==1&&s!=11?"one":i==2&&s!=12?"two":i==3&&s!=13?"few":"other":e==1&&r?"one":"other"}const Uie=se,Wie=se,Hie=Cr,Kie=se;function Gie(e,t){return t?"other":e>=0&&e<=1?"one":"other"}function qie(e,t){return t?"other":e>=0&&e<2?"one":"other"}const Yie=Cr;function Jie(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=o.slice(-1);return t?e==1?"one":"other":i&&(r==1||r==2||r==3)||i&&s!=4&&s!=6&&s!=9||!i&&a!=4&&a!=6&&a!=9?"one":"other"}const Xie=se;function Zie(e,t){return t?e==1?"one":"other":e>=0&&e<2?"one":"other"}const Qie=se,ese=Cr;function tse(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?e==1?"one":"other":e==1?"one":e==2?"two":r&&e>=3&&e<=6?"few":r&&e>=7&&e<=10?"many":"other"}function nse(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?e==1||e==11?"one":e==2||e==12?"two":e==3||e==13?"few":"other":e==1||e==11?"one":e==2||e==12?"two":r&&e>=3&&e<=10||r&&e>=13&&e<=19?"few":"other"}const rse=Cr,ose=se;function ise(e,t){return t?e==1?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e>=0&&e<=1?"one":"other"}const sse=vs;function ase(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return t?"other":o&&i==1?"one":o&&i==2?"two":o&&(s==0||s==20||s==40||s==60||s==80)?"few":o?"other":"many"}const lse=se,cse=se;function use(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=Number(n[0])==e,s=i&&n[0].slice(-1);return t?"other":e==1&&o?"one":r==2&&o?"two":o&&(e<0||e>10)&&i&&s==0?"many":"other"}function dse(e,t){return t?e==1?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e>=0&&e<=1?"one":"other"}function fse(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":i&&s==1&&a!=11||l==1&&c!=11?"one":i&&s>=2&&s<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function hse(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-2),a=o.slice(-2);return t?"other":i&&s==1||a==1?"one":i&&s==2||a==2?"two":i&&(s==3||s==4)||a==3||a==4?"few":"other"}function pse(e,t){return t?e==1||e==5?"one":"other":e==1?"one":"other"}function mse(e,t){return t?e==1?"one":"other":e>=0&&e<2?"one":"other"}const gse=Cr,vse=ut,yse=ut,xse=ut,bse=Cr;function wse(e,t){var n=String(e).split("."),r=n[0],o=Number(n[0])==e,i=r.slice(-1),s=r.slice(-2);return t?"other":o&&i==1&&s!=11||!o?"one":"other"}function Sse(e,t){var n=String(e).split("."),r=!n[1];return t?e==11||e==8||e==80||e==800?"many":"other":e==1&&r?"one":"other"}const kse=Ga;function Ese(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=Number(n[0])==e,s=i&&n[0].slice(-1);return t?"other":e==1&&o?"one":r==2&&o?"two":o&&(e<0||e>10)&&i&&s==0?"many":"other"}const Cse=ut,Nse=ut,Pse=se,_se=Cr,jse=se,Tse=ut,Ose=ut;function Mse(e,t){var n=String(e).split("."),r=n[0],o=r.slice(-2);return t?r==1?"one":r==0||o>=2&&o<=20||o==40||o==60||o==80?"many":"other":e==1?"one":"other"}function Rse(e,t){return t?"other":e>=0&&e<2?"one":"other"}const Ase=se,Ise=se,Dse=ut,Lse=ut;function Fse(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1);return t?o==6||o==9||r&&o==0&&e!=0?"many":"other":e==1?"one":"other"}const zse=se,$se=se,Bse=ut;function Vse(e,t){return t?"other":e>=0&&e<=1?"one":"other"}const Use=ut,Wse=se,Hse=se;function Kse(e,t){return t?"other":e==0?"zero":e==1?"one":"other"}const Gse=se;function qse(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2),i=r&&n[0].slice(-3),s=r&&n[0].slice(-5),a=r&&n[0].slice(-6);return t?r&&e>=1&&e<=4||o>=1&&o<=4||o>=21&&o<=24||o>=41&&o<=44||o>=61&&o<=64||o>=81&&o<=84?"one":e==5||o==5?"many":"other":e==0?"zero":e==1?"one":o==2||o==22||o==42||o==62||o==82||r&&i==0&&(s>=1e3&&s<=2e4||s==4e4||s==6e4||s==8e4)||e!=0&&a==1e5?"two":o==3||o==23||o==43||o==63||o==83?"few":e!=1&&(o==1||o==21||o==41||o==61||o==81)?"many":"other"}const Yse=se;function Jse(e,t){var n=String(e).split("."),r=n[0];return t?"other":e==0?"zero":(r==0||r==1)&&e!=0?"one":"other"}const Xse=se,Zse=se,Qse=ut,eae=vs;function tae(e,t){return t&&e==1?"one":"other"}function nae(e,t){var n=String(e).split("."),r=n[1]||"",o=Number(n[0])==e,i=o&&n[0].slice(-1),s=o&&n[0].slice(-2);return t?"other":i==1&&(s<11||s>19)?"one":i>=2&&i<=9&&(s<11||s>19)?"few":r!=0?"many":"other"}function rae(e,t){var n=String(e).split("."),r=n[1]||"",o=r.length,i=Number(n[0])==e,s=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-2),c=r.slice(-1);return t?"other":i&&s==0||a>=11&&a<=19||o==2&&l>=11&&l<=19?"zero":s==1&&a!=11||o==2&&c==1&&l!=11||o!=2&&c==1?"one":"other"}const oae=se,iae=vs,sae=se;function aae(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?s==1&&a!=11?"one":s==2&&a!=12?"two":(s==7||s==8)&&a!=17&&a!=18?"many":"other":i&&s==1&&a!=11||l==1&&c!=11?"one":"other"}const lae=se,cae=se;function uae(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-2);return t?e==1?"one":"other":e==1&&r?"one":!r||e==0||i>=2&&i<=19?"few":"other"}function dae(e,t){return t?e==1?"one":e==2||e==3?"two":e==4?"few":"other":e==1?"one":"other"}function fae(e,t){return t&&e==1?"one":"other"}function hae(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2);return t?"other":e==1?"one":e==0||o>=2&&o<=10?"few":o>=11&&o<=19?"many":"other"}const pae=ut,mae=se,gae=Ga,vae=se,yae=se;function xae(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?r&&e>=1&&e<=4?"one":"other":e==1?"one":"other"}const bae=Cr,wae=se,Sae=se,kae=se,Eae=ut,Cae=se,Nae=vs,Pae=se,_ae=se,jae=se;function Tae(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?e==1||e==5||r&&e>=7&&e<=9?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e==1?"one":"other"}const Oae=se,Mae=ut,Rae=vs,Aae=se;function Iae(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return t?"other":e==1&&o?"one":o&&i>=2&&i<=4&&(s<12||s>14)?"few":o&&r!=1&&(i==0||i==1)||o&&i>=5&&i<=9||o&&s>=12&&s<=14?"many":"other"}function Dae(e,t){var n=String(e).split("."),r=n[1]||"",o=r.length,i=Number(n[0])==e,s=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-2),c=r.slice(-1);return t?"other":i&&s==0||a>=11&&a<=19||o==2&&l>=11&&l<=19?"zero":s==1&&a!=11||o==2&&c==1&&l!=11||o!=2&&c==1?"one":"other"}const Lae=se;function Fae(e,t){var n=String(e).split("."),r=n[0];return t?"other":r==0||r==1?"one":"other"}const zae=Cr,$ae=se;function Bae(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-2);return t?e==1?"one":"other":e==1&&r?"one":!r||e==0||i>=2&&i<=19?"few":"other"}const Vae=se,Uae=ut;function Wae(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return t?"other":o&&i==1&&s!=11?"one":o&&i>=2&&i<=4&&(s<12||s>14)?"few":o&&i==0||o&&i>=5&&i<=9||o&&s>=11&&s<=14?"many":"other"}const Hae=se,Kae=ut,Gae=se;function qae(e,t){var n=String(e).split("."),r=!n[1];return t?e==11||e==8||e==80||e==800?"many":"other":e==1&&r?"one":"other"}function Yae(e,t){var n=String(e).split("."),r=!n[1];return t?e==11||e==8||e==80||e==800?"many":"other":e==1&&r?"one":"other"}const Jae=se,Xae=se,Zae=Ga,Qae=se,ele=ut,tle=ut;function nle(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":i&&s==1&&a!=11||l==1&&c!=11?"one":i&&s>=2&&s<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function rle(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?"other":e>=0&&e<=1?"one":r&&e>=2&&e<=10?"few":"other"}function ole(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"";return t?"other":e==0||e==1||r==0&&o==1?"one":"other"}function ile(e,t){var n=String(e).split("."),r=n[0],o=!n[1];return t?"other":e==1&&o?"one":r>=2&&r<=4&&o?"few":o?"other":"many"}function sle(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-2);return t?"other":o&&i==1?"one":o&&i==2?"two":o&&(i==3||i==4)||!o?"few":"other"}const ale=Ga,lle=Ga,cle=Ga,ule=Ga,dle=Ga,fle=se,hle=se;function ple(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2);return t?e==1?"one":o==4&&i!=14?"many":"other":e==1?"one":"other"}function mle(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":i&&s==1&&a!=11||l==1&&c!=11?"one":i&&s>=2&&s<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}const gle=se,vle=se,yle=se,xle=ut;function ble(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-1),s=o&&n[0].slice(-2);return t?(i==1||i==2)&&s!=11&&s!=12?"one":"other":e==1&&r?"one":"other"}const wle=Cr,Sle=se,kle=se,Ele=se,Cle=se,Nle=ut,Ple=vs,_le=se;function jle(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1);return t?o==6||o==9||e==10?"few":"other":e==1?"one":"other"}function Tle(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=o.slice(-1);return t?e==1?"one":"other":i&&(r==1||r==2||r==3)||i&&s!=4&&s!=6&&s!=9||!i&&a!=4&&a!=6&&a!=9?"one":"other"}const Ole=se,Mle=ut,Rle=se,Ale=se;function Ile(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?"other":e==0||e==1||r&&e>=11&&e<=99?"one":"other"}const Dle=se;function Lle(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=Number(n[0])==e,s=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-1),c=r.slice(-2);return t?s==3&&a!=13?"few":"other":o&&l==1&&c!=11?"one":o&&l>=2&&l<=4&&(c<12||c>14)?"few":o&&l==0||o&&l>=5&&l<=9||o&&c>=11&&c<=14?"many":"other"}const Fle=Cr,zle=se,$le=se;function Ble(e,t){return t&&e==1?"one":"other"}const Vle=se,Ule=se,Wle=vs,Hle=se,Kle=ut,Gle=se,qle=se,Yle=Cr,Jle=ut,Xle=ut,Zle=ut;function Qle(e,t){return t?"other":e>=0&&e<=1?"one":"other"}const ece=Object.freeze(Object.defineProperty({__proto__:null,_in:iie,af:sie,ak:aie,am:lie,an:cie,ar:uie,ars:die,as:fie,asa:hie,ast:pie,az:mie,be:gie,bem:vie,bez:yie,bg:xie,bho:bie,bm:wie,bn:Sie,bo:kie,br:Eie,brx:Cie,bs:Nie,ca:Pie,ce:_ie,ceb:jie,cgg:Tie,chr:Oie,ckb:Mie,cs:Rie,cy:Aie,da:Iie,de:Die,dsb:Lie,dv:Fie,dz:zie,ee:$ie,el:Bie,en:Vie,eo:Uie,es:Wie,et:Hie,eu:Kie,fa:Gie,ff:qie,fi:Yie,fil:Jie,fo:Xie,fr:Zie,fur:Qie,fy:ese,ga:tse,gd:nse,gl:rse,gsw:ose,gu:ise,guw:sse,gv:ase,ha:lse,haw:cse,he:use,hi:dse,hr:fse,hsb:hse,hu:pse,hy:mse,ia:gse,id:vse,ig:yse,ii:xse,io:bse,is:wse,it:Sse,iu:kse,iw:Ese,ja:Cse,jbo:Nse,jgo:Pse,ji:_se,jmc:jse,jv:Tse,jw:Ose,ka:Mse,kab:Rse,kaj:Ase,kcg:Ise,kde:Dse,kea:Lse,kk:Fse,kkj:zse,kl:$se,km:Bse,kn:Vse,ko:Use,ks:Wse,ksb:Hse,ksh:Kse,ku:Gse,kw:qse,ky:Yse,lag:Jse,lb:Xse,lg:Zse,lkt:Qse,ln:eae,lo:tae,lt:nae,lv:rae,mas:oae,mg:iae,mgo:sae,mk:aae,ml:lae,mn:cae,mo:uae,mr:dae,ms:fae,mt:hae,my:pae,nah:mae,naq:gae,nb:vae,nd:yae,ne:xae,nl:bae,nn:wae,nnh:Sae,no:kae,nqo:Eae,nr:Cae,nso:Nae,ny:Pae,nyn:_ae,om:jae,or:Tae,os:Oae,osa:Mae,pa:Rae,pap:Aae,pl:Iae,prg:Dae,ps:Lae,pt:Fae,pt_PT:zae,rm:$ae,ro:Bae,rof:Vae,root:Uae,ru:Wae,rwk:Hae,sah:Kae,saq:Gae,sc:qae,scn:Yae,sd:Jae,sdh:Xae,se:Zae,seh:Qae,ses:ele,sg:tle,sh:nle,shi:rle,si:ole,sk:ile,sl:sle,sma:ale,smi:lle,smj:cle,smn:ule,sms:dle,sn:fle,so:hle,sq:ple,sr:mle,ss:gle,ssy:vle,st:yle,su:xle,sv:ble,sw:wle,syr:Sle,ta:kle,te:Ele,teo:Cle,th:Nle,ti:Ple,tig:_le,tk:jle,tl:Tle,tn:Ole,to:Mle,tr:Rle,ts:Ale,tzm:Ile,ug:Dle,uk:Lle,ur:Fle,uz:zle,ve:$le,vi:Ble,vo:Vle,vun:Ule,wa:Wle,wae:Hle,wo:Kle,xh:Gle,xog:qle,yi:Yle,yo:Jle,yue:Xle,zh:Zle,zu:Qle},Symbol.toStringTag,{value:"Module"}));var tce=Object.defineProperty,nce=Object.getOwnPropertyDescriptor,rce=Object.getOwnPropertyNames,oce=Object.prototype.hasOwnProperty,ice=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of rce(t))!oce.call(e,o)&&o!==n&&tce(e,o,{get:()=>t[o],enumerable:!(r=nce(t,o))||r.enumerable});return e},sce=(e,t,n)=>(ice(e,t,"default"),n),ace=JSON.parse('{"extension.command.toggle-upper-case.label":[["case","select",{"upper":"Uppercase","lower":"Lowercase","capitalize":"Sentence case","smallCaps":"Small caps","other":"Text case"}]],"extension.table.column_count":[["count","plural",{"one":["#"," column"],"other":["#"," columns"]}]],"extension.table.row_count":[["count","plural",{"one":["#"," row"],"other":["#"," rows"]}]],"extension.command.toggle-columns.description":[["count","select",{"2":"Split the block into two columns","3":"Split the current block into three columns","4":"Split the current block into four columns","other":"Split the current block into multiple columns"}]],"extension.command.toggle-columns.label":[["count","select",{"2":"Two Column Block","3":"Three Column Block","4":"Four Column Block","other":"Multi Column Block"}]],"extension.command.set-text-direction.label":[["dir","select",{"ltr":"Left-To-Right","rtl":"Right-To-Left","other":"Reset Direction"}]],"extension.command.set-text-direction.description":[["dir","select",{"ltr":"Set the text direction from left to right","rtl":"Set the text direction from right to left","other":"Reset text direction"}]],"extension.command.toggle-heading.label":[["level","select",{"1":"Heading 1","2":"Heading 2","3":"Heading 3","4":"Heading 4","5":"Heading 5","6":"Heading 6","other":"Heading"}]],"extension.command.toggle-callout.description":[["type","select",{"info":"Create an information callout block","warning":"Create a warning callout block","error":"Create an error callout block","success":"Create a success callout block","other":"Create a callout block"}]],"extension.command.toggle-callout.label":[["type","select",{"info":"Information Callout","warning":"Warning Callout","error":"Error Callout","success":"Success Callout","other":"Callout"}]],"extension.command.toggle-code-block.description":"Add a code block","extension.command.add-annotation.label":"Add annotation","extension.command.toggle-blockquote.description":"Add blockquote formatting to the selected text","extension.command.toggle-bold.description":"Add bold formatting to the selected text","extension.command.toggle-code.description":"Add inline code formatting to the selected text","keyboard.shortcut.alt":"Alt","keyboard.shortcut.arrowDown":"Arrow Down","keyboard.shortcut.arrowLeft":"Arrow Left","keyboard.shortcut.arrowRight":"Arrow Right","keyboard.shortcut.arrowUp":"Arrow Up","keyboard.shortcut.backspace":"Backspace","ui.text-color.black":"Black","extension.command.toggle-blockquote.label":"Blockquote","ui.text-color.blue":"Blue","ui.text-color.blue.hue":["Blue ",["hue"]],"extension.command.toggle-bold.label":"Bold","extension.command.toggle-bullet-list.description":"Bulleted list","keyboard.shortcut.capsLock":"Caps Lock","extension.command.center-align.label":"Center align","extension.command.toggle-code.label":"Code","extension.command.toggle-code-block.label":"Codeblock","keyboard.shortcut.command":"Command","QcPNd6":"Image description","ogrUzJ":"Add a short description here.","yqdyzr":"Image","6/02F4":"Image source","X8H91v":"Image","zhQ7Zt":"Italic","ZL7E7l":"Underline","keyboard.shortcut.control":"Control","extension.command.convert-paragraph.description":"Convert current block into a paragraph block.","extension.command.convert-paragraph.label":"Convert Paragraph","extension.command.copy.label":"Copy","extension.command.copy.description":"Copy the selected text","extension.command.create-table.description":"Create a table with set number of rows and columns.","extension.command.create-table.label":"Create table","extension.command.cut.label":"Cut","extension.command.cut.description":"Cut the selected text","ui.text-color.cyan":"Cyan","ui.text-color.cyan.hue":["Cyan ",["hue"]],"extension.command.decrease-font-size.label":"Decrease","extension.command.decrease-indent.label":"Decrease indentation","extension.command.decrease-font-size.description":"Decrease the font size.","keyboard.shortcut.delete":"Delete","extension.command.insert-horizontal-rule.label":"Divider","keyboard.shortcut.end":"End","keyboard.shortcut.escape":"Enter","keyboard.shortcut.enter":"Enter","6PjrOF":"Add annotation","OTq5WC":"Center align","oeZ3ox":"Convert current block into a paragraph block.","m1khs+":"Convert Paragraph","w/1U+3":"Copy the selected text","kdodi0":"Copy","k0KR/u":"Create a table with set number of rows and columns.","zrwMyD":"Create table","D/nWxh":"Cut the selected text","jHPv5m":"Cut","5cNgRx":"Decrease the font size.","vyRNWx":"Decrease","Jgiol4":"Decrease indentation","1gJSHH":"Increase the font size","OQXJXz":"Increase","72TLhr":"Increase indentation","HFlfzJ":"Insert Emoji","RPq9fY":"Separate content with a diving horizontal line","OKQF+e":"Divider","zjYb9C":"Insert a new paragraph","4M4sXC":"Insert Paragraph","1Q+eVc":"Justify","ejWWtP":"Left align","wVqrpS":"Paste content into the editor","07v9aw":"Paste","zUYfou":"Redo the most recent action","9Nq9zr":"Redo","0uxaZe":"Remove annotation","iJWZAz":"Right align","g5WpPn":"Select all content within the editor","2+pZDT":"Select all","yChCR1":"Set text case","GMzAC/":"Set the font size for the selected text.","vzEyrv":"Font size","7VCkJ8":"Set the text color for the selected text.","qjWFaR":"Text color","LVWgFu":[["dir","select",{"ltr":"Set the text direction from left to right","rtl":"Set the text direction from right to left","other":"Reset text direction"}]],"WXwRy1":[["dir","select",{"ltr":"Left-To-Right","rtl":"Right-To-Left","other":"Reset Direction"}]],"G/o315":"Set the text highlight color for the selected text.","xtHg6d":"Text highlight","1p1W/p":"Add blockquote formatting to the selected text","6+rh6I":"Blockquote","0yB3LV":"Add bold formatting to the selected text","sFMo4Z":"Bold","SMKG/s":"Bulleted list","/BYCMi":[["type","select",{"info":"Create an information callout block","warning":"Create a warning callout block","error":"Create an error callout block","success":"Create a success callout block","other":"Create a callout block"}]],"V+3IBe":[["type","select",{"info":"Information Callout","warning":"Warning Callout","error":"Error Callout","success":"Success Callout","other":"Callout"}]],"hbIo4L":"Add a code block","7GkMcx":"Codeblock","2r4JYl":"Add inline code formatting to the selected text","Up8Tpe":"Code","ATHSPS":[["count","select",{"2":"Split the block into two columns","3":"Split the current block into three columns","4":"Split the current block into four columns","other":"Split the current block into multiple columns"}]],"7DC1VE":[["count","select",{"2":"Two Column Block","3":"Three Column Block","4":"Four Column Block","other":"Multi Column Block"}]],"hnrBeo":[["level","select",{"1":"Heading 1","2":"Heading 2","3":"Heading 3","4":"Heading 4","5":"Heading 5","6":"Heading 6","other":"Heading"}]],"NkZAcw":"Italicize the selected text","2fTW9e":"Italic","c759Ra":"Ordered list","uQwrZu":"Strikethrough the selected text","pT3qly":"Strikethrough","BHk+zu":"Subscript","18BVwM":"Superscript","tOIVCV":"Tasked list","4Janx3":"Underline the selected text","dCHt+D":"Underline","YYAprs":[["case","select",{"upper":"Uppercase","lower":"Lowercase","capitalize":"Sentence case","smallCaps":"Small caps","other":"Text case"}]],"tczyZL":"Show hidden whitespace characters in your editor.","0qAX23":"Toggle Whitespace","ezMADU":"Undo the most recent action","N3P7EC":"Undo","2nj/+s":"Update annotation","dWD7u4":[["count","plural",{"one":["#"," column"],"other":["#"," columns"]}]],"qXqgVT":[["count","plural",{"one":["#"," row"],"other":["#"," rows"]}]],"extension.command.set-font-size.label":"Font size","ui.text-color.grape":"Grape","ui.text-color.grape.hue":["Grape ",["hue"]],"ui.text-color.gray":"Gray","ui.text-color.gray.hue":["Gray ",["hue"]],"ui.text-color.green":"Green","ui.text-color.green.hue":["Green ",["hue"]],"keyboard.shortcut.home":"Home","extension.command.increase-font-size.label":"Increase","extension.command.increase-indent.label":"Increase indentation","extension.command.increase-font-size.description":"Increase the font size","ui.text-color.indigo":"Indigo","ui.text-color.indigo.hue":["Indigo ",["hue"]],"extension.command.insert-paragraph.description":"Insert a new paragraph","extension.command.insert-emoji.label":"Insert Emoji","extension.command.insert-paragraph.label":"Insert Paragraph","extension.command.toggle-italic.label":"Italic","extension.command.toggle-italic.description":"Italicize the selected text","extension.command.justify-align.label":"Justify","R7NlCw":"Alt","RbDiK5":"Arrow Down","Dgyd+E":"Arrow Left","8pdCk4":"Arrow Right","Gp/343":"Arrow Up","PFPV0A":"Backspace","0IRYvp":"Caps Lock","X7HX0D":"Command","zq0AdD":"Control","8SfToN":"Delete","Ys/uah":"End","3K5hww":"Enter","veQt1j":"Enter","ySv7i+":"Home","e6RUI1":"Page Down","EEJk31":"Page Up","7sbhAU":"Shift","Q4eplT":"Space","SUhVVC":"Tab","extension.command.left-align.label":"Left align","ui.text-color.lime":"Lime","ui.text-color.lime.hue":["Lime ",["hue"]],"react-components.mention-atom-component.zero-items":"No items available","ui.text-color.orange":"Orange","ui.text-color.orange.hue":["Orange ",["hue"]],"extension.command.toggle-ordered-list.label":"Ordered list","keyboard.shortcut.pageDown":"Page Down","keyboard.shortcut.pageUp":"Page Up","extension.command.paste.label":"Paste","extension.command.paste.description":"Paste content into the editor","ui.text-color.pink":"Pink","ui.text-color.pink.hue":["Pink ",["hue"]],"zvMfIA":"No items available","pEjhti":"Static Menu","ui.text-color.red":"Red","ui.text-color.red.hue":["Red ",["hue"]],"extension.command.redo.label":"Redo","extension.command.redo.description":"Redo the most recent action","extension.command.remove-annotation.label":"Remove annotation","extension.command.right-align.label":"Right align","extension.command.select-all.label":"Select all","extension.command.select-all.description":"Select all content within the editor","extension.command.insert-horizontal-rule.description":"Separate content with a diving horizontal line","extension.command.set-casing.label":"Set text case","extension.command.set-font-size.description":"Set the font size for the selected text.","extension.command.set-text-color.description":"Set the text color for the selected text.","extension.command.set-text-highlight.description":"Set the text highlight color for the selected text.","keyboard.shortcut.shift":"Shift","extension.command.toggle-whitespace.description":"Show hidden whitespace characters in your editor.","keyboard.shortcut.space":"Space","extension.command.toggle-strike.label":"Strikethrough","extension.command.toggle-strike.description":"Strikethrough the selected text","extension.command.toggle-subscript.label":"Subscript","extension.command.toggle-superscript.label":"Superscript","keyboard.shortcut.tab":"Tab","extension.command.toggle-task-list.description":"Tasked list","ui.text-color.teal":"Teal","ui.text-color.teal.hue":["Teal ",["hue"]],"extension.command.set-text-color.label":"Text color","extension.command.set-text-highlight.label":"Text highlight","extension.command.toggle-whitespace.label":"Toggle Whitespace","ui.text-color.transparent":"Transparent","slrB1c":"Black","6QML30":"Blue","xw+keN":["Blue ",["hue"]],"38RHqP":"Cyan","D89yPf":["Cyan ",["hue"]],"VjBLnd":"Grape","Rp40yv":["Grape ",["hue"]],"5Dm9D1":"Gray","HGjXjC":["Gray ",["hue"]],"b9fz+n":"Green","18jo3M":["Green ",["hue"]],"CFzqCV":"Indigo","aVlDku":["Indigo ",["hue"]],"04PfLc":"Lime","KRTK6Y":["Lime ",["hue"]],"pSnXFd":"Orange","ve/MJZ":["Orange ",["hue"]],"OvCgDa":"Pink","l7NqyT":["Pink ",["hue"]],"IT9k0j":"Red","AdyJ7/":["Red ",["hue"]],"3D2UWc":"Teal","Dcq0Y1":["Teal ",["hue"]],"bsi2ik":"Transparent","Tj3PRR":"Violet","xxMH5N":["Violet ",["hue"]],"Rum0ah":"White","4gaw/Q":"Yellow","hhauc3":["Yellow ",["hue"]],"extension.command.toggle-underline.label":"Underline","extension.command.toggle-underline.description":"Underline the selected text","extension.command.undo.label":"Undo","extension.command.undo.description":"Undo the most recent action","extension.command.update-annotation.label":"Update annotation","ui.text-color.violet":"Violet","ui.text-color.violet.hue":["Violet ",["hue"]],"ui.text-color.white":"White","ui.text-color.yellow":"Yellow","ui.text-color.yellow.hue":["Yellow ",["hue"]]}'),l4={};sce(l4,ece);Vy.loadLocaleData("en",{plurals:l4.en});Vy.load("en",ace);Vy.activate("en");var lce=Object.defineProperty,cce=Object.getOwnPropertyDescriptor,Jk=(e,t,n,r)=>{for(var o=r>1?void 0:r?cce(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&lce(t,n,o),o},Iu=class extends Co{get name(){return"doc"}createNodeSpec(e,t){const{docAttributes:n,content:r}=this.options,o=Se();if(ec(n))for(const[i,s]of on(n))o[i]={default:s};else for(const i of n)o[i]={default:null};return{attrs:o,content:r,...t}}setDocAttributes(e){return({tr:t,dispatch:n})=>{if(n){for(const[r,o]of Object.entries(e))t.step(new Bw(r,o));n(t)}return!0}}isDefaultDocNode({state:e=this.store.getState(),options:t}={}){return Hk(e.doc,t)}};Jk([xe()],Iu.prototype,"setDocAttributes",1);Jk([Bt()],Iu.prototype,"isDefaultDocNode",1);Iu=Jk([st({defaultOptions:{content:"block+",docAttributes:[]},defaultPriority:mt.Medium,staticKeys:["content","docAttributes"],disableExtraAttributes:!0})],Iu);var c4="SetDocAttribute",u4="RevertSetDocAttribute",Bw=class Vw extends an{constructor(n,r,o=c4){super();Vt(this,"key");Vt(this,"stepType");Vt(this,"value");Vt(this,"previous");this.stepType=o,this.key=n,this.value=r}static fromJSON(n,r){return new Vw(r.key,r.value,r.stepType)}apply(n){this.previous=n.attrs[this.key];const r={...n.attrs,[this.key]:this.value};return Wt.ok(n.type.create(r,n.content,n.marks))}invert(){return new Vw(this.key,this.previous,u4)}map(){return this}toJSON(){return{stepType:this.stepType,key:this.key,value:this.value}}};try{an.jsonID(c4,Bw),an.jsonID(u4,Bw)}catch(e){if(!e.message.startsWith("Duplicate use of step JSON ID"))throw e}var uce=Object.defineProperty,dce=Object.getOwnPropertyDescriptor,d4=(e,t,n,r)=>{for(var o=r>1?void 0:r?dce(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&uce(t,n,o),o};function fce(e,t,n,r){const o=e.docView.posFromDOM(t,n,r);return o===null||o<0?null:o}function hce(e,t){const n=t.target;if(n){const r=fce(e,n,0);if(r!==null){const o=e.state.doc.resolve(r),i=o.node().isLeaf?0:1,s=o.start()-i;return{pos:r,inside:s}}}return e.posAtCoords({left:t.clientX,top:t.clientY})??void 0}var mv=class extends Tt{constructor(){super(...arguments),this.mousedown=!1,this.mouseover=!1,this.createMouseEventHandler=e=>(t,n)=>{const r=n,o=hce(t,r);if(!o)return!1;const i=[],s=[],{inside:a,pos:l}=o;if(a===-1)return!1;const c=t.state.doc.resolve(l),u=c.depth+1;for(const f of eD(u,1))i.push({node:f>c.depth&&c.nodeAfter?c.nodeAfter:c.node(f),pos:c.before(f)});for(const{type:f}of c.marksAcross(c)??[]){const h=fs(c,f);h&&s.push(h)}return e(r,{view:t,nodes:i,marks:s,getMark:f=>{const h=Fe(f)?t.state.schema.marks[f]:f;return je(h,{code:re.EXTENSION,message:`The mark ${f} being checked does not exist within the editor schema.`}),s.find(p=>p.mark.type===h)},getNode:f=>{var h;const p=Fe(f)?t.state.schema.nodes[f]:f;je(p,{code:re.EXTENSION,message:"The node being checked does not exist"});const m=i.find(({node:v})=>v.type===p);if(m)return{...m,isRoot:!!((h=i[0])!=null&&h.node.eq(m.node))}}})}}get name(){return"events"}onView(){var e,t;if(!((e=this.store.managerSettings.exclude)!=null&&e.clickHandler))for(const n of this.store.extensions){if(!n.createEventHandlers||(t=n.options.exclude)!=null&&t.clickHandler)continue;const r=n.createEventHandlers();for(const[o,i]of on(r))this.addHandler(o,i)}}createPlugin(){const e=new WeakMap,t=(n,r,o,i,s,a,l,c)=>{const u=this.store.currentState,{schema:f,doc:h}=u,p=h.resolve(i),m=e.has(l),v=pce({$pos:p,handled:m,view:o,state:u});let x=!1;m||(x=n(l,v)||x);const b={...v,pos:i,direct:c,nodeWithPosition:{node:s,pos:a},getNode:w=>{const S=Fe(w)?f.nodes[w]:w;return je(S,{code:re.EXTENSION,message:"The node being checked does not exist"}),S===s.type?{node:s,pos:a}:void 0}};return e.set(l,!0),r(l,b)||x};return{props:{handleKeyPress:(n,r)=>this.options.keypress(r)||!1,handleKeyDown:(n,r)=>this.options.keydown(r)||!1,handleTextInput:(n,r,o,i)=>this.options.textInput({from:r,to:o,text:i})||!1,handleClickOn:(n,r,o,i,s,a)=>t(this.options.clickMark,this.options.click,n,r,o,i,s,a),handleDoubleClickOn:(n,r,o,i,s,a)=>t(this.options.doubleClickMark,this.options.doubleClick,n,r,o,i,s,a),handleTripleClickOn:(n,r,o,i,s,a)=>t(this.options.tripleClickMark,this.options.tripleClick,n,r,o,i,s,a),handleDOMEvents:{focus:(n,r)=>this.options.focus(r)||!1,blur:(n,r)=>this.options.blur(r)||!1,mousedown:(n,r)=>(this.startMouseover(),this.options.mousedown(r)||!1),mouseup:(n,r)=>(this.endMouseover(),this.options.mouseup(r)||!1),mouseleave:(n,r)=>(this.mouseover=!1,this.options.mouseleave(r)||!1),mouseenter:(n,r)=>(this.mouseover=!0,this.options.mouseenter(r)||!1),keyup:(n,r)=>this.options.keyup(r)||!1,mouseout:this.createMouseEventHandler((n,r)=>{const o={...r,hovering:!1};return this.options.hover(n,o)||!1}),mouseover:this.createMouseEventHandler((n,r)=>{const o={...r,hovering:!0};return this.options.hover(n,o)||!1}),contextmenu:this.createMouseEventHandler((n,r)=>this.options.contextmenu(n,r)||!1),scroll:(n,r)=>this.options.scroll(r)||!1,copy:(n,r)=>this.options.copy(r)||!1,cut:(n,r)=>this.options.cut(r)||!1,paste:(n,r)=>this.options.paste(r)||!1}},view:n=>{let r=n.editable;const o=this.options;return{update(i){const s=i.editable;s!==r&&(o.editable(s),r=s)}}}}}isInteracting(){return this.mousedown&&this.mouseover}startMouseover(){this.mouseover=!0,!this.mousedown&&(this.mousedown=!0,this.store.document.documentElement.addEventListener("mouseup",()=>{this.endMouseover()},{once:!0}))}endMouseover(){this.mousedown&&(this.mousedown=!1,this.store.commands.emptyUpdate())}};d4([Bt()],mv.prototype,"isInteracting",1);mv=d4([st({handlerKeys:["blur","focus","mousedown","mouseup","mouseenter","mouseleave","textInput","keypress","keyup","keydown","click","clickMark","doubleClick","doubleClickMark","tripleClick","tripleClickMark","contextmenu","hover","scroll","copy","cut","paste","editable"],handlerKeyOptions:{blur:{earlyReturnValue:!0},focus:{earlyReturnValue:!0},mousedown:{earlyReturnValue:!0},mouseleave:{earlyReturnValue:!0},mouseup:{earlyReturnValue:!0},click:{earlyReturnValue:!0},doubleClick:{earlyReturnValue:!0},tripleClick:{earlyReturnValue:!0},hover:{earlyReturnValue:!0},contextmenu:{earlyReturnValue:!0},scroll:{earlyReturnValue:!0},copy:{earlyReturnValue:!0},cut:{earlyReturnValue:!0},paste:{earlyReturnValue:!0}},defaultPriority:mt.High})],mv);function pce(e){const{handled:t,view:n,$pos:r,state:o}=e,i={getMark:ZI,markRanges:[],view:n,state:o};if(t)return i;for(const{type:s}of r.marksAcross(r)??[]){const a=fs(r,s);a&&i.markRanges.push(a)}return i.getMark=s=>{const a=Fe(s)?o.schema.marks[s]:s;return je(a,{code:re.EXTENSION,message:`The mark ${s} being checked does not exist within the editor schema.`}),i.markRanges.find(l=>l.mark.type===a)},i}class $t extends Ge{constructor(t){super(t,t)}map(t,n){let r=t.resolve(n.map(this.head));return $t.valid(r)?new $t(r):Ge.near(r)}content(){return ae.empty}eq(t){return t instanceof $t&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new $t(t.resolve(n.pos))}getBookmark(){return new Xk(this.anchor)}static valid(t){let n=t.parent;if(n.isTextblock||!mce(t)||!gce(t))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(t.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(t,n,r=!1){e:for(;;){if(!r&&$t.valid(t))return t;let o=t.pos,i=null;for(let s=t.depth;;s--){let a=t.node(s);if(n>0?t.indexAfter(s)<a.childCount:t.index(s)>0){i=a.child(n>0?t.indexAfter(s):t.index(s)-1);break}else if(s==0)return null;o+=n;let l=t.doc.resolve(o);if($t.valid(l))return l}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!Me.isSelectable(i)){t=t.doc.resolve(o+i.nodeSize*n),r=!1;continue e}break}i=s,o+=n;let a=t.doc.resolve(o);if($t.valid(a))return a}return null}}}$t.prototype.visible=!1;$t.findFrom=$t.findGapCursorFrom;Ge.jsonID("gapcursor",$t);class Xk{constructor(t){this.pos=t}map(t){return new Xk(t.map(this.pos))}resolve(t){let n=t.resolve(this.pos);return $t.valid(n)?new $t(n):Ge.near(n)}}function mce(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function gce(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function vce(){return new gs({props:{decorations:wce,createSelectionBetween(e,t,n){return t.pos==n.pos&&$t.valid(n)?new $t(n):null},handleClick:xce,handleKeyDown:yce,handleDOMEvents:{beforeinput:bce}}})}const yce=GL({ArrowLeft:um("horiz",-1),ArrowRight:um("horiz",1),ArrowUp:um("vert",-1),ArrowDown:um("vert",1)});function um(e,t){const n=e=="vert"?t>0?"down":"up":t>0?"right":"left";return function(r,o,i){let s=r.selection,a=t>0?s.$to:s.$from,l=s.empty;if(s instanceof ze){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(t>0?a.after():a.before())}let c=$t.findGapCursorFrom(a,t,l);return c?(o&&o(r.tr.setSelection(new $t(c))),!0):!1}}function xce(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!$t.valid(r))return!1;let o=e.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&Me.isSelectable(e.state.doc.nodeAt(o.inside))?!1:(e.dispatch(e.state.tr.setSelection(new $t(r))),!0)}function bce(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof $t))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let o=q.empty;for(let s=r.length-1;s>=0;s--)o=q.from(r[s].createAndFill(null,o));let i=e.state.tr.replace(n.pos,n.pos,new ae(o,0,0));return i.setSelection(ze.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function wce(e){if(!(e.selection instanceof $t))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",at.create(e.doc,[_t.widget(e.selection.head,t,{key:"gapcursor"})])}var Sce=Object.defineProperty,kce=Object.getOwnPropertyDescriptor,Ece=(e,t,n,r)=>{for(var o=r>1?void 0:r?kce(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Sce(t,n,o),o},Uw=class extends Tt{get name(){return"gapCursor"}createExternalPlugins(){return[vce()]}};Uw=Ece([st({})],Uw);var gv=200,vn=function(){};vn.prototype.append=function(t){return t.length?(t=vn.from(t),!this.length&&t||t.length<gv&&this.leafAppend(t)||this.length<gv&&t.leafPrepend(this)||this.appendInner(t)):this};vn.prototype.prepend=function(t){return t.length?vn.from(t).append(this):this};vn.prototype.appendInner=function(t){return new Cce(this,t)};vn.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?vn.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};vn.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};vn.prototype.forEach=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(t,n,r,0):this.forEachInvertedInner(t,n,r,0)};vn.prototype.map=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(t(i,s))},n,r),o};vn.from=function(t){return t instanceof vn?t:t&&t.length?new f4(t):vn.empty};var f4=function(e){function t(r){e.call(this),this.values=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new t(this.values.slice(o,i))},t.prototype.getInner=function(o){return this.values[o]},t.prototype.forEachInner=function(o,i,s,a){for(var l=i;l<s;l++)if(o(this.values[l],a+l)===!1)return!1},t.prototype.forEachInvertedInner=function(o,i,s,a){for(var l=i-1;l>=s;l--)if(o(this.values[l],a+l)===!1)return!1},t.prototype.leafAppend=function(o){if(this.length+o.length<=gv)return new t(this.values.concat(o.flatten()))},t.prototype.leafPrepend=function(o){if(this.length+o.length<=gv)return new t(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(vn);vn.empty=new f4([]);var Cce=function(e){function t(n,r){e.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},t.prototype.forEachInner=function(r,o,i,s){var a=this.left.length;if(o<a&&this.left.forEachInner(r,o,Math.min(i,a),s)===!1||i>a&&this.right.forEachInner(r,Math.max(o-a,0),Math.min(this.length,i)-a,s+a)===!1)return!1},t.prototype.forEachInvertedInner=function(r,o,i,s){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(r,o-a,Math.max(i,a)-a,s+a)===!1||i<a&&this.left.forEachInvertedInner(r,Math.min(o,a),i,s)===!1)return!1},t.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},t.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new t(this.left,o)},t.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new t(o,this.right)},t.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new t(this.left,new t(this.right,r)):new t(this,r)},t}(vn);const Nce=500;class Vo{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=t.tr,a,l,c=[],u=[];return this.items.forEach((f,h)=>{if(!f.step){o||(o=this.remapping(r,h+1),i=o.maps.length),i--,u.push(f);return}if(o){u.push(new Ts(f.map));let p=f.step.map(o.slice(i)),m;p&&s.maybeStep(p).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],c.push(new Ts(m,void 0,void 0,c.length+u.length))),i--,m&&o.appendMap(m,i)}else s.maybeStep(f.step);if(f.selection)return a=o?f.selection.map(o.slice(i)):f.selection,l=new Vo(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(t,n,r,o){let i=[],s=this.eventCount,a=this.items,l=!o&&a.length?a.get(a.length-1):null;for(let u=0;u<t.steps.length;u++){let f=t.steps[u].invert(t.docs[u]),h=new Ts(t.mapping.maps[u],f,n),p;(p=l&&l.merge(h))&&(h=p,u?i.pop():a=a.slice(0,a.length-1)),i.push(h),n&&(s++,n=void 0),o||(l=h)}let c=s-r.depth;return c>_ce&&(a=Pce(a,c),s-=c),new Vo(a.append(i),s)}remapping(t,n){let r=new Zc;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=t?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},t,n),r}addMaps(t){return this.eventCount==0?this:new Vo(this.items.append(t.map(n=>new Ts(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=t.mapping,s=t.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},o);let l=n;this.items.forEach(h=>{let p=i.getMirror(--l);if(p==null)return;s=Math.min(s,p);let m=i.maps[p];if(h.step){let v=t.steps[p].invert(t.docs[p]),x=h.selection&&h.selection.map(i.slice(l+1,p));x&&a++,r.push(new Ts(m,v,x))}else r.push(new Ts(m))},o);let c=[];for(let h=n;h<s;h++)c.push(new Ts(i.maps[h]));let u=this.items.slice(0,o).append(c).append(r),f=new Vo(u,a);return f.emptyItemCount()>Nce&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,o=[],i=0;return this.items.forEach((s,a)=>{if(a>=t)o.push(s),s.selection&&i++;else if(s.step){let l=s.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=s.selection&&s.selection.map(n.slice(r));u&&i++;let f=new Ts(c.invert(),l,u),h,p=o.length-1;(h=o.length&&o[p].merge(f))?o[p]=h:o.push(f)}}else s.map&&r--},this.items.length,0),new Vo(vn.from(o.reverse()),i)}}Vo.empty=new Vo(vn.empty,0);function Pce(e,t){let n;return e.forEach((r,o)=>{if(r.selection&&t--==0)return n=o,!1}),e.slice(n)}let Ts=class h4{constructor(t,n,r,o){this.map=t,this.step=n,this.selection=r,this.mirrorOffset=o}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new h4(n.getMap().invert(),n,this.selection)}}};class Vs{constructor(t,n,r,o,i){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const _ce=20;function jce(e,t,n,r){let o=n.getMeta(ts),i;if(o)return o.historyState;n.getMeta(Mce)&&(e=new Vs(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(s&&s.getMeta(ts))return s.getMeta(ts).redo?new Vs(e.done.addTransform(n,void 0,r,Vm(t)),e.undone,W_(n.mapping.maps),e.prevTime,e.prevComposition):new Vs(e.done,e.undone.addTransform(n,void 0,r,Vm(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=e.prevTime==0||!s&&e.prevComposition!=a&&(e.prevTime<(n.time||0)-r.newGroupDelay||!Tce(n,e.prevRanges)),c=s?C0(e.prevRanges,n.mapping):W_(n.mapping.maps);return new Vs(e.done.addTransform(n,l?t.selection.getBookmark():void 0,r,Vm(t)),Vo.empty,c,n.time,a??e.prevComposition)}else return(i=n.getMeta("rebased"))?new Vs(e.done.rebased(n,i),e.undone.rebased(n,i),C0(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new Vs(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),C0(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function Tce(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<t.length;i+=2)r<=t[i+1]&&o>=t[i]&&(n=!0)}),n}function W_(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((r,o,i,s)=>t.push(i,s));return t}function C0(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}function Oce(e,t,n){let r=Vm(t),o=ts.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),o,r),l=new Vs(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(ts,{redo:n,historyState:l})}let N0=!1,H_=null;function Vm(e){let t=e.plugins;if(H_!=t){N0=!1,H_=t;for(let n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){N0=!0;break}}return N0}const ts=new id("history"),Mce=new id("closeHistory");function Rce(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new gs({key:ts,state:{init(){return new Vs(Vo.empty,Vo.empty,null,0,-1)},apply(t,n,r){return jce(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,n){let r=n.inputType,o=r=="historyUndo"?Um:r=="historyRedo"?tf:null;return o?(n.preventDefault(),o(t.state,t.dispatch)):!1}}}})}function p4(e,t){return(n,r)=>{let o=ts.getState(n);if(!o||(e?o.undone:o.done).eventCount==0)return!1;if(r){let i=Oce(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const Um=p4(!1,!0),tf=p4(!0,!0);function Ww(e){let t=ts.getState(e);return t?t.done.eventCount:0}function Ace(e){let t=ts.getState(e);return t?t.undone.eventCount:0}var Ice=Object.defineProperty,Dce=Object.getOwnPropertyDescriptor,nc=(e,t,n,r)=>{for(var o=r>1?void 0:r?Dce(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Ice(t,n,o),o},Pi=class extends Tt{constructor(){super(...arguments),this.wrapMethod=(e,t)=>({state:n,dispatch:r,view:o})=>{const{getState:i,getDispatch:s}=this.options,a=jt(i)?i():n,l=jt(s)&&r?s():r,c=e(a,l,o);return t==null||t(c),c}}get name(){return"history"}createKeymap(){return{"Mod-y":$o.isMac?()=>!1:this.wrapMethod(tf,this.options.onRedo),"Mod-z":this.wrapMethod(Um,this.options.onUndo),"Shift-Mod-z":this.wrapMethod(tf,this.options.onRedo)}}undoShortcut(e){return this.wrapMethod(Um,this.options.onUndo)(e)}redoShortcut(e){return this.wrapMethod(tf,this.options.onRedo)(e)}createExternalPlugins(){const{depth:e,newGroupDelay:t}=this.options;return[Rce({depth:e,newGroupDelay:t})]}undo(){return N_(this.wrapMethod(Um,this.options.onUndo))}redo(){return N_(this.wrapMethod(tf,this.options.onRedo))}undoDepth(e=this.store.getState()){return Ww(e)}redoDepth(e=this.store.getState()){return Ace(e)}};nc([to({shortcut:oe.Undo,command:"undo"})],Pi.prototype,"undoShortcut",1);nc([to({shortcut:oe.Redo,command:"redo"})],Pi.prototype,"redoShortcut",1);nc([xe({disableChaining:!0,description:({t:e})=>e(tv.UNDO_DESCRIPTION),label:({t:e})=>e(tv.UNDO_LABEL),icon:"arrowGoBackFill"})],Pi.prototype,"undo",1);nc([xe({disableChaining:!0,description:({t:e})=>e(tv.REDO_DESCRIPTION),label:({t:e})=>e(tv.REDO_LABEL),icon:"arrowGoForwardFill"})],Pi.prototype,"redo",1);nc([Bt()],Pi.prototype,"undoDepth",1);nc([Bt()],Pi.prototype,"redoDepth",1);Pi=nc([st({defaultOptions:{depth:100,newGroupDelay:500,getDispatch:void 0,getState:void 0},staticKeys:["depth","newGroupDelay"],handlerKeys:["onUndo","onRedo"]})],Pi);var Lce=Object.defineProperty,Fce=Object.getOwnPropertyDescriptor,Uy=(e,t,n,r)=>{for(var o=r>1?void 0:r?Fce(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Lce(t,n,o),o},zce={icon:"paragraph",label:({t:e})=>e(nv.INSERT_LABEL),description:({t:e})=>e(nv.INSERT_DESCRIPTION)},$ce={icon:"paragraph",label:({t:e})=>e(nv.CONVERT_LABEL),description:({t:e})=>e(nv.CONVERT_DESCRIPTION)},Wl=class extends Co{get name(){return"paragraph"}createTags(){return[He.LastNodeCompatible,He.TextBlock,He.Block,He.FormattingNode]}createNodeSpec(e,t){return{content:"inline*",draggable:!1,...t,attrs:{...e.defaults()},parseDOM:[{tag:"p",getAttrs:n=>({...e.parse(n)})},...t.parseDOM??[]],toDOM:n=>["p",e.dom(n),0]}}convertParagraph(e={}){const{attrs:t,selection:n,preserveAttrs:r}=e;return this.store.commands.setBlockNodeType.original(this.type,t,n,r)}insertParagraph(e,t={}){const{selection:n,attrs:r}=t;return this.store.commands.insertNode.original(this.type,{content:e,selection:n,attrs:r})}shortcut(e){return this.convertParagraph()(e)}};Uy([xe($ce)],Wl.prototype,"convertParagraph",1);Uy([xe(zce)],Wl.prototype,"insertParagraph",1);Uy([to({shortcut:oe.Paragraph,command:"convertParagraph"})],Wl.prototype,"shortcut",1);Wl=Uy([st({defaultPriority:mt.Medium})],Wl);function Ji(e,t,n){return Math.min(Math.max(e,n),t)}class Bce extends Error{constructor(t){super(`Failed to parse color: "${t}"`)}}var nf=Bce;function Zk(e){if(typeof e!="string")throw new nf(e);if(e.trim().toLowerCase()==="transparent")return[0,0,0,0];let t=e.trim();t=Yce.test(e)?Wce(e):e;const n=Hce.exec(t);if(n){const s=Array.from(n).slice(1);return[...s.slice(0,3).map(a=>parseInt(Mh(a,2),16)),parseInt(Mh(s[3]||"f",2),16)/255]}const r=Kce.exec(t);if(r){const s=Array.from(r).slice(1);return[...s.slice(0,3).map(a=>parseInt(a,16)),parseInt(s[3]||"ff",16)/255]}const o=Gce.exec(t);if(o){const s=Array.from(o).slice(1);return[...s.slice(0,3).map(a=>parseInt(a,10)),parseFloat(s[3]||"1")]}const i=qce.exec(t);if(i){const[s,a,l,c]=Array.from(i).slice(1).map(parseFloat);if(Ji(0,100,a)!==a)throw new nf(e);if(Ji(0,100,l)!==l)throw new nf(e);return[...Jce(s,a,l),Number.isNaN(c)?1:c]}throw new nf(e)}function Vce(e){let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return(t>>>0)%2341}const K_=e=>parseInt(e.replace(/_/g,""),36),Uce="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((e,t)=>{const n=K_(t.substring(0,3)),r=K_(t.substring(3)).toString(16);let o="";for(let i=0;i<6-r.length;i++)o+="0";return e[n]=`${o}${r}`,e},{});function Wce(e){const t=e.toLowerCase().trim(),n=Uce[Vce(t)];if(!n)throw new nf(e);return`#${n}`}const Mh=(e,t)=>Array.from(Array(t)).map(()=>e).join(""),Hce=new RegExp(`^#${Mh("([a-f0-9])",3)}([a-f0-9])?$`,"i"),Kce=new RegExp(`^#${Mh("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),Gce=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${Mh(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),qce=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,Yce=/^[a-z]+$/i,G_=e=>Math.round(e*255),Jce=(e,t,n)=>{let r=n/100;if(t===0)return[r,r,r].map(G_);const o=(e%360+360)%360/60,i=(1-Math.abs(2*r-1))*(t/100),s=i*(1-Math.abs(o%2-1));let a=0,l=0,c=0;o>=0&&o<1?(a=i,l=s):o>=1&&o<2?(a=s,l=i):o>=2&&o<3?(l=i,c=s):o>=3&&o<4?(l=s,c=i):o>=4&&o<5?(a=s,c=i):o>=5&&o<6&&(a=i,c=s);const u=r-i/2,f=a+u,h=l+u,p=c+u;return[f,h,p].map(G_)};function Xce(e){const[t,n,r,o]=Zk(e).map((f,h)=>h===3?f:f/255),i=Math.max(t,n,r),s=Math.min(t,n,r),a=(i+s)/2;if(i===s)return[0,0,a,o];const l=i-s,c=a>.5?l/(2-i-s):l/(i+s);return[60*(t===i?(n-r)/l+(n<r?6:0):n===i?(r-t)/l+2:(t-n)/l+4),c,a,o]}function Zce(e,t,n,r){return`hsla(${(e%360).toFixed()}, ${Ji(0,100,t*100).toFixed()}%, ${Ji(0,100,n*100).toFixed()}%, ${parseFloat(Ji(0,1,r).toFixed(3))})`}function Ir(e,t){const[n,r,o,i]=Xce(e);return Zce(n,r,o-t,i)}function Qce(e){if(e==="transparent")return 0;function t(i){const s=i/255;return s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4)}const[n,r,o]=Zk(e);return .2126*t(n)+.7152*t(r)+.0722*t(o)}function eue(e,t,n,r){return`rgba(${Ji(0,255,e).toFixed()}, ${Ji(0,255,t).toFixed()}, ${Ji(0,255,n).toFixed()}, ${parseFloat(Ji(0,1,r).toFixed(3))})`}function Wm(e,t){return Ir(e,-t)}function vv(e,t){const[n,r,o,i]=Zk(e);return eue(n,r,o,i-t)}function tue(e){return Qce(e)>.179}function nu(e){return tue(e)?"#000":"#fff"}const nue="remirror-editor-wrapper",rue="remirror-button-active",oue="remirror-button",iue="remirror-composite",sue="remirror-dialog",aue="remirror-dialog-backdrop",lue="remirror-form",cue="remirror-form-message",uue="remirror-form-label",due="remirror-form-group",fue="remirror-group",hue="remirror-input",pue="remirror-menu",mue="remirror-menu-pane",gue="remirror-menu-pane-active",vue="remirror-menu-dropdown-label",yue="remirror-menu-pane-icon",xue="remirror-menu-pane-label",bue="remirror-menu-pane-shortcut",wue="remirror-menu-button-left",Sue="remirror-menu-button-right",kue="remirror-menu-button-nested-left",Eue="remirror-menu-button-nested-right",Cue="remirror-menu-button",Nue="remirror-menu-bar",Pue="remirror-flex-column",_ue="remirror-flex-row",jue="remirror-menu-item",Tue="remirror-menu-item-row",Oue="remirror-menu-item-column",Mue="remirror-menu-item-checkbox",Rue="remirror-menu-item-radio",Aue="remirror-menu-group",Iue="remirror-floating-popover",Due="remirror-popover",Lue="remirror-animated-popover",Fue="remirror-role",zue="remirror-separator",$ue="remirror-tab",Bue="remirror-tab-list",Vue="remirror-tabbable",Uue="remirror-toolbar",Wue="remirror-tooltip",Hue="remirror-table-size-editor",Kue="remirror-table-size-editor-body",Gue="remirror-table-size-editor-cell",que="remirror-table-size-editor-cell-selected",Yue="remirror-table-size-editor-footer",Jue="remirror-color-picker",Xue="remirror-color-picker-cell",Zue="remirror-color-picker-cell-selected";var Que=Object.freeze({__proto__:null,ANIMATED_POPOVER:Lue,BUTTON:oue,BUTTON_ACTIVE:rue,COLOR_PICKER:Jue,COLOR_PICKER_CELL:Xue,COLOR_PICKER_CELL_SELECTED:Zue,COMPOSITE:iue,DIALOG:sue,DIALOG_BACKDROP:aue,EDITOR_WRAPPER:nue,FLEX_COLUMN:Pue,FLEX_ROW:_ue,FLOATING_POPOVER:Iue,FORM:lue,FORM_GROUP:due,FORM_LABEL:uue,FORM_MESSAGE:cue,GROUP:fue,INPUT:hue,MENU:pue,MENU_BAR:Nue,MENU_BUTTON:Cue,MENU_BUTTON_LEFT:wue,MENU_BUTTON_NESTED_LEFT:kue,MENU_BUTTON_NESTED_RIGHT:Eue,MENU_BUTTON_RIGHT:Sue,MENU_DROPDOWN_LABEL:vue,MENU_GROUP:Aue,MENU_ITEM:jue,MENU_ITEM_CHECKBOX:Mue,MENU_ITEM_COLUMN:Oue,MENU_ITEM_RADIO:Rue,MENU_ITEM_ROW:Tue,MENU_PANE:mue,MENU_PANE_ACTIVE:gue,MENU_PANE_ICON:yue,MENU_PANE_LABEL:xue,MENU_PANE_SHORTCUT:bue,POPOVER:Due,ROLE:Fue,SEPARATOR:zue,TAB:$ue,TABBABLE:Vue,TABLE_SIZE_EDITOR:Hue,TABLE_SIZE_EDITOR_BODY:Kue,TABLE_SIZE_EDITOR_CELL:Gue,TABLE_SIZE_EDITOR_CELL_SELECTED:que,TABLE_SIZE_EDITOR_FOOTER:Yue,TAB_LIST:Bue,TOOLBAR:Uue,TOOLTIP:Wue});const ede="remirror-image-loader";var tde=Object.freeze({__proto__:null,IMAGE_LOADER:ede});const nde="remirror-list-item-with-custom-mark",rde="remirror-ul-list-content",ode="remirror-editor",ide="remirror-list-item-marker-container",sde="remirror-list-item-checkbox",ade="remirror-collapsible-list-item-closed",lde="remirror-collapsible-list-item-button",cde="remirror-list-spine";var Aa=Object.freeze({__proto__:null,COLLAPSIBLE_LIST_ITEM_BUTTON:lde,COLLAPSIBLE_LIST_ITEM_CLOSED:ade,EDITOR:ode,LIST_ITEM_CHECKBOX:sde,LIST_ITEM_MARKER_CONTAINER:ide,LIST_ITEM_WITH_CUSTOM_MARKER:nde,LIST_SPINE:cde,UL_LIST_CONTENT:rde});const ude="remirror-is-empty";var dde=Object.freeze({__proto__:null,IS_EMPTY:ude});const fde="remirror-editor",hde="remirror-positioner",pde="remirror-positioner-widget";var mde=Object.freeze({__proto__:null,EDITOR:fde,POSITIONER:hde,POSITIONER_WIDGET:pde});const Mo={gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]},Xi="#000000",Qk="#ffffff",gde="#252103",eE=vv(Xi,.75),Wy="#7963d2",tE="#bcd263",vde="#fff",yde="#fff",nE=Mo.gray[1],q_="rgba(10,31,68,0.08)",Y_="rgba(10,31,68,0.10)",J_="rgba(10,31,68,0.12)",xde=Wm(vv(Xi,.1),.13),rE={background:Qk,border:eE,foreground:Xi,muted:nE,primary:Wy,secondary:tE,primaryText:vde,secondaryText:yde,text:gde,faded:xde},bde={...rE,background:Ir(Qk,.15),border:Ir(eE,.15),foreground:Ir(Xi,.15),muted:Ir(nE,.15),primary:Ir(Wy,.15),secondary:Ir(tE,.15),get text(){return nu(this.background)},get primaryText(){return nu(this.primary)},get secondaryText(){return nu(this.secondary)}},wde={...rE,background:Ir(Qk,.075),border:Ir(eE,.075),foreground:Ir(Xi,.075),muted:Ir(nE,.075),primary:Ir(Wy,.075),secondary:Ir(tE,.075),get text(){return nu(this.background)},get primaryText(){return nu(this.primary)},get secondaryText(){return nu(this.secondary)}};({...rE,backdrop:vv(Xi,.1),outline:vv(Wy,.6),table:(Wm(Xi,.8),Wm(Xi,.4),Mo.gray[3],Mo.blue[7],Mo.blue[1],Mo.blue[5],Mo.blue[7],Wm(Xi,.4),Mo.blue[5],Mo.red[7],Mo.red[1],Mo.red[5])},`${q_}`,`${Y_}`,`${J_}`);var Sde=Object.defineProperty,kde=Object.getOwnPropertyDescriptor,oE=(e,t,n,r)=>{for(var o=r>1?void 0:r?kde(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Sde(t,n,o),o},m4=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Zt=(e,t,n)=>(m4(e,t,"read from private field"),n?n.call(e):t.get(e)),Di=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Os=(e,t,n,r)=>(m4(e,t,"write to private field"),t.set(e,n),n),rf,of,Nc,sf,Hm,af,lf,cf,uf,Km=class{constructor(e){Di(this,rf,Ny()),Di(this,of,[]),Di(this,Nc,new Map),Di(this,sf,[]),Di(this,Hm,!1),Di(this,af,void 0),Di(this,lf,void 0),Di(this,cf,void 0),Di(this,uf,void 0),this.addListener=(t,n)=>Zt(this,rf).on(t,n),Os(this,af,e),Os(this,lf,e.getActive),Os(this,uf,e.getPosition),Os(this,cf,e.getID),this.hasChanged=e.hasChanged,this.events=e.events??["state","scroll"]}static create(e){return new Km(e)}static fromPositioner(e,t){return Km.create({...e.basePositioner,...t})}get basePositioner(){return{getActive:Zt(this,lf),getPosition:Zt(this,uf),hasChanged:this.hasChanged,events:this.events,getID:Zt(this,cf)}}onActiveChanged(e){this.recentUpdate=e;const t=Zt(this,lf).call(this,e);Os(this,of,t),Os(this,Nc,new Map),Os(this,Hm,!1),Os(this,sf,[]);const n=[];for(const[r,o]of t.entries()){const i=this.getID(o,r);Zt(this,sf).push(i),n.push({setElement:s=>this.addProps({...e,data:o,element:s},r),id:i,data:o})}Zt(this,rf).emit("update",n)}getID(e,t){var n;return((n=Zt(this,cf))==null?void 0:n.call(this,e,t))??t.toString()}addProps(e,t){if(Zt(this,Hm)||(Zt(this,Nc).set(t,e),Zt(this,Nc).size<Zt(this,of).length))return;const n=[];for(const r of Zt(this,of).keys()){const o=Zt(this,Nc).get(r);je(o,{code:re.INTERNAL,message:"Something went wrong when retrieving the parameters"});const i=Zt(this,sf)[r];if(!i)return;n.push({position:Zt(this,uf).call(this,o),element:o.element,id:i})}Zt(this,rf).emit("done",n)}clone(e){return Km.create({...Zt(this,af),...jt(e)?e(Zt(this,af)):e})}active(e){const t=jt(e)?e:()=>e;return this.clone(n=>({getActive:r=>n.getActive(r).filter(t)}))}},qo=Km;rf=new WeakMap;of=new WeakMap;Nc=new WeakMap;sf=new WeakMap;Hm=new WeakMap;af=new WeakMap;lf=new WeakMap;cf=new WeakMap;uf=new WeakMap;qo.EMPTY=[];function Ede(e,t=x4){const{key:n}=(e==null?void 0:e.getMeta(y4))??{};return n===t}function g4(e){const{tr:t,state:n,previousState:r}=e;return!r||t&&Ede(t)?!0:t?Sne(t):!n.doc.eq(r.doc)||!n.selection.eq(r.selection)}function v4(e,t,n={}){const r=t.getBoundingClientRect(),{accountForPadding:o=!1}=n;let i=0,s=0,a=0,l=0;if(Ni(t)&&o){const u=Number.parseFloat(js(t,"padding-left").replace("px","")),f=Number.parseFloat(js(t,"padding-right").replace("px","")),h=Number.parseFloat(js(t,"padding-top").replace("px","")),p=Number.parseFloat(js(t,"padding-bottom").replace("px","")),m=Number.parseFloat(js(t,"border-left").replace("px","")),v=Number.parseFloat(js(t,"border-right").replace("px","")),x=Number.parseFloat(js(t,"border-top").replace("px","")),b=Number.parseFloat(js(t,"border-bottom").replace("px","")),w=t.offsetWidth-t.clientWidth,S=t.offsetHeight-t.clientHeight;i+=u+m+(t.dir==="rtl"?w:0),s+=f+v+(t.dir==="rtl"?0:w),a+=h+x,l+=p+b+S}const c=new DOMRect(r.left+i,r.top+a,r.width-s,r.height-l);for(const[u,f]of[[e.top,e.left],[e.top,e.right],[e.bottom,e.left],[e.bottom,e.right]])if(vP(u,c.top,c.bottom)&&vP(f,c.left,c.right))return!0;return!1}var Cde="remirror-positioner-widget",y4="positionerUpdate",x4="__all_positioners__",b4={y:-999999,x:-999999,width:0,height:0},X_={...b4,left:-999999,top:-999999,bottom:-999999,right:-999999},Nde={...b4,rect:{...X_,toJSON:()=>X_},visible:!1},Pde=qo.create({hasChanged:g4,getActive(e){const{state:t}=e;if(!Vk(t)||t.selection.$anchor.depth>2)return qo.EMPTY;const n=Ay({predicate:r=>r.type.isBlock,selection:t});return n?[n]:qo.EMPTY},getPosition(e){const{view:t,data:n}=e,r=t.nodeDOM(n.pos);if(!Ni(r))return Nde;const o=r.getBoundingClientRect(),i=t.dom.getBoundingClientRect(),s=o.height,a=o.width,l=t.dom.scrollLeft+o.left-i.left,c=t.dom.scrollTop+o.top-i.top,u=v4(o,t.dom);return{y:c,x:l,height:s,width:a,rect:o,visible:u}}}),w4=Pde.clone(({getActive:e})=>({getActive:t=>{const[n]=e(t);return n&&Kk(n.node)&&n.node.type===Ly(t.state.schema)?[n]:qo.EMPTY}}));w4.clone(({getPosition:e})=>({getPosition:t=>({...e(t),width:1})}));w4.clone(({getPosition:e})=>({getPosition:t=>{const{width:n,x:r,y:o,height:i}=e(t);return{...e(t),width:1,x:n+r,rect:new DOMRect(n+r,o,1,i)}}}));function iE(e){return qo.create({hasChanged:g4,getActive:t=>{const{state:n,view:r}=t;if(!e(n)||!tc(n.selection))return qo.EMPTY;try{const{head:o,anchor:i}=n.selection;return[{from:r.coordsAtPos(i),to:r.coordsAtPos(o)}]}catch{return qo.EMPTY}},getPosition(t){const{element:n,data:r,view:o}=t,{from:i,to:s}=r,a=n.offsetParent??o.dom,l=a.getBoundingClientRect(),c=Math.abs(s.bottom-i.top),u=c>i.bottom-i.top,f=Math.min(i.left,s.left),h=Math.min(i.top,s.top),p=a.scrollLeft+(u?s.left-l.left:f-l.left),m=a.scrollTop+h-l.top,v=u?1:Math.abs(i.left-s.right),x=new DOMRect(u?s.left:f,h,v,c),b=v4(x,o.dom);return{rect:x,y:m,x:p,height:c,width:v,visible:b}}})}var _de=iE(e=>!e.selection.empty);iE(e=>e.selection.empty);iE(()=>!0);_de.clone(()=>({getActive:e=>{const{state:t,view:n}=e;if(!t.selection.empty)return qo.EMPTY;const r=TL(t);if(!r)return qo.EMPTY;try{return[{from:n.coordsAtPos(r.from),to:n.coordsAtPos(r.to)}]}catch{return qo.EMPTY}}}));var Rh=class extends Tt{constructor(){super(...arguments),this.positioners=[],this.onAddCustomHandler=({positioner:e})=>{if(e)return this.positioners=[...this.positioners,e],this.store.commands.forceUpdate(),()=>{this.positioners=this.positioners.filter(t=>t!==e)}}}get name(){return"positioner"}createAttributes(){return{class:mde.EDITOR}}init(){this.onScroll=yZ(this.options.scrollDebounce,this.onScroll.bind(this))}createEventHandlers(){return{scroll:()=>(this.onScroll(),!1),hover:(e,t)=>(this.positioner(this.getBaseProps("hover",{hover:t})),!1),contextmenu:(e,t)=>(this.positioner(this.getBaseProps("contextmenu",{contextmenu:t})),!1)}}onStateUpdate(e){this.positioner({...e,previousState:e.firstUpdate?void 0:e.previousState,event:"state",helpers:this.store.helpers})}createDecorations(e){if(this.element??(this.element=this.createElement()),!this.element.hasChildNodes())return at.empty;const t=_t.widget(0,this.element,{key:"positioner-widget",side:-1,stopEvent:()=>!0});return at.create(e.doc,[t])}forceUpdatePositioners(e=x4){return({tr:t,dispatch:n})=>(n==null||n(t.setMeta(y4,{key:e})),!0)}getPositionerWidget(){return this.element??(this.element=this.createElement())}createElement(){const e=document.createElement("span");return e.dataset.id=Cde,e.setAttribute("role","presentation"),e}triggerPositioner(e,t){e.hasChanged(t)&&e.onActiveChanged({...t,view:this.store.view})}positioner(e){for(const t of this.positioners)t.events.includes(e.event)&&this.triggerPositioner(t,e)}getBaseProps(e,t){const n=this.store.getState(),r=this.store.previousState;return{helpers:this.store.helpers,event:e,firstUpdate:!1,previousState:r,state:n,...t}}onScroll(){this.positioner(this.getBaseProps("scroll",{scroll:{scrollTop:this.store.view.dom.scrollTop}}))}};oE([xe()],Rh.prototype,"forceUpdatePositioners",1);oE([Bt()],Rh.prototype,"getPositionerWidget",1);Rh=oE([st({defaultOptions:{scrollDebounce:100},customHandlerKeys:["positioner"],staticKeys:["scrollDebounce"]})],Rh);var jde=Object.defineProperty,Tde=Object.getOwnPropertyDescriptor,Ode=(e,t,n,r)=>{for(var o=r>1?void 0:r?Tde(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&jde(t,n,o),o},Hw=class extends Co{get name(){return"text"}createTags(){return[He.InlineNode]}createNodeSpec(){return{}}};Hw=Ode([st({disableExtraAttributes:!0,defaultPriority:mt.Medium})],Hw);var Mde={...Iu.defaultOptions,...Wl.defaultOptions,...Pi.defaultOptions,excludeExtensions:[]};function Rde(e={}){e={...Mde,...e};const{content:t,depth:n,getDispatch:r,getState:o,newGroupDelay:i,excludeExtensions:s}=e,a={};for(const c of s??[])a[c]=!0;const l=[];if(!a.history){const c=new Pi({depth:n,getDispatch:r,getState:o,newGroupDelay:i});l.push(c)}return a.doc||l.push(new Iu({content:t})),a.text||l.push(new Hw),a.paragraph||l.push(new Wl),a.positioner||l.push(new Rh),a.gapCursor||l.push(new Uw),a.events||l.push(new mv),l}var Ade=Object.defineProperty,Ide=Object.getOwnPropertyDescriptor,Dde=(e,t,n,r)=>{for(var o=r>1?void 0:r?Ide(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Ade(t,n,o),o},Hl=class extends Tt{get name(){return"placeholder"}createAttributes(){return{"aria-placeholder":this.options.placeholder}}createPlugin(){return{state:{init:(e,t)=>({...this.options,empty:Hk(t.doc,{ignoreAttributes:!0})}),apply:(e,t,n,r)=>Lde({pluginState:t,tr:e,extension:this,state:r})},props:{decorations:e=>Fde({state:e,extension:this})}}}onSetOptions(e){const{changes:t}=e;t.placeholder.changed&&this.store.phase>=lr.EditorView&&this.store.updateAttributes()}};Hl=Dde([st({defaultOptions:{emptyNodeClass:dde.IS_EMPTY,placeholder:""}})],Hl);function Lde(e){const{pluginState:t,extension:n,tr:r,state:o}=e;return r.docChanged?{...n.options,empty:Hk(o.doc)}:t}function Fde(e){const{extension:t,state:n}=e,{empty:r}=t.pluginKey.getState(n),{emptyNodeClass:o,placeholder:i}=t.options;if(!r)return null;const s=[];return n.doc.descendants((a,l)=>{const c=_t.node(l,l+a.nodeSize,{class:o,"data-placeholder":i});s.push(c)}),at.create(n.doc,s)}var zde=Object.defineProperty,$de=Object.getOwnPropertyDescriptor,Bde=(e,t,n,r)=>{for(var o=r>1?void 0:r?$de(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&zde(t,n,o),o},Vde={...Hl.defaultOptions,...Oh.defaultOptions},Ude=[...Hl.staticKeys,...Oh.staticKeys],Ah=class extends Tt{get name(){return"react"}onSetOptions(e){const{pickChanged:t}=e;this.getExtension(Hl).setOptions(t(["placeholder"]))}createExtensions(){const{emptyNodeClass:e,placeholder:t,defaultBlockNode:n,defaultContentNode:r,defaultEnvironment:o,defaultInlineNode:i,nodeViewComponents:s}=this.options;return[new Hl({emptyNodeClass:e,placeholder:t,priority:mt.Low}),new Oh({defaultBlockNode:n,defaultContentNode:r,defaultEnvironment:o,defaultInlineNode:i,nodeViewComponents:s})]}};Ah=Bde([st({defaultOptions:Vde,staticKeys:Ude})],Ah);var S4={};Object.defineProperty(S4,"__esModule",{value:!0});function Wde(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length===2)return Q_(e[0],e[1])||null;var n=e.slice(1).reduce(function(r,o){return Q_(r,o)},e[0]);return n||null}var Od=S4.default=Wde,Z_=new WeakMap;function Q_(e,t){if(e&&t){var n=Z_.get(e)||new WeakMap;Z_.set(e,n);var r=n.get(t)||function(o){ej(e,o),ej(t,o)};return n.set(t,r),r}return e||t}function ej(e,t){typeof e=="function"?e(t):e.current=t}var k4=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},P0=(e,t,n)=>(k4(e,t,"read from private field"),t.get(e)),Hde=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Kde=(e,t,n,r)=>(k4(e,t,"write to private field"),t.set(e,n),n);function Gde(){const[,e]=g.useState(Se());return g.useCallback(()=>{e(Se())},[])}var E4=g.createContext(null);function Hy(e){const t=g.useContext(E4),n=g.useRef(Gde());je(t,{code:re.REACT_PROVIDER_CONTEXT});const{addHandler:r}=t;return g.useEffect(()=>{let o=e;if(o){if(ec(o)){const{autoUpdate:i}=o;o=i?()=>n.current():void 0}if(jt(o))return r("updated",o)}},[r,e]),t}function qde(e=!0){return Hy({autoUpdate:e}).active}function Yde(e=!1){return Hy(e?{autoUpdate:!0}:void 0).attrs}function C4(){return Hy().chain.new()}var[Jde,bge]=Koe(({props:e})=>{const t=e.locale??"en",n=e.i18n??Vy,r=e.supportedLocales??[t],o=n._.bind(n);return{locale:t,i18n:n,supportedLocales:r,t:o}});function tj(e,t={}){const{core:n,react:r,...o}=t;return Ooe(e)?e:Toe.create(()=>[...tD(e),new Ah(r),...Rde(n)],o)}function Xde(e,t={}){const n=g.useRef(e),r=g.useRef(t),[o,i]=g.useState(()=>tj(e,t));return n.current=e,r.current=t,g.useEffect(()=>o.addHandler("destroy",()=>{i(()=>tj(n.current,r.current))}),[o]),o}var Zde=typeof Od=="object"&&Od.__esModule&&Od.default?Od.default:Od,Pc,Qde=class extends Coe{constructor(e){if(super(e),Hde(this,Pc,void 0),this.rootPropsConfig={called:!1,count:0},this.getRootProps=t=>this.internalGetRootProps(t,null),this.internalGetRootProps=(t,n)=>{this.rootPropsConfig.called=!0;const{refKey:r="ref",ref:o,...i}=t??Se();return{[r]:Zde(o,this.onRef),key:this.uid,...i,children:n}},this.onRef=t=>{t&&(this.rootPropsConfig.count+=1,je(this.rootPropsConfig.count<=1,{code:re.REACT_GET_ROOT_PROPS,message:`Called ${this.rootPropsConfig.count} times`}),Kde(this,Pc,t),this.onRefLoad())},this.manager.view){this.manager.view.setProps({state:this.manager.view.state,dispatchTransaction:this.dispatchTransaction,attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0});return}this.manager.getExtension(Hl).setOptions({placeholder:this.props.placeholder??""})}get name(){return"react"}update(e){return super.update(e),this}createView(e){return new Ute(null,{state:e,dispatchTransaction:this.dispatchTransaction,attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0,plugins:[]})}updateState({state:e,...t}){const{triggerChange:n=!0,tr:r,transactions:o}=t;if(this.props.state){const{onChange:i}=this.props;je(i,{code:re.REACT_CONTROLLED,message:"You are required to provide the `onChange` handler when creating a controlled editor."}),je(n,{code:re.REACT_CONTROLLED,message:"Controlled editors do not support `clearContent` or `setContent` where `triggerChange` is `true`. Update the `state` prop instead."}),this.previousStateOverride||(this.previousStateOverride=this.getState()),this.onChange({state:e,tr:r,transactions:o});return}!r&&!o&&(e=e.apply(e.tr.setMeta(fP,{}))),this.view.updateState(e),n&&(o==null?void 0:o.length)!==0&&this.onChange({state:e,tr:r,transactions:o}),this.manager.onStateUpdate({previousState:this.previousState,state:e,tr:r,transactions:o})}updateControlledState(e,t){this.previousStateOverride=t,e=e.apply(e.tr.setMeta(fP,{})),this.view.updateState(e),this.manager.onStateUpdate({previousState:this.previousState,state:e}),this.previousStateOverride=void 0}addProsemirrorViewToDom(e,t){this.props.insertPosition==="start"?e.insertBefore(t,e.firstChild):e.append(t)}onRefLoad(){je(P0(this,Pc),{code:re.REACT_EDITOR_VIEW,message:"Something went wrong when initializing the text editor. Please check your setup."});const{autoFocus:e}=this.props;this.addProsemirrorViewToDom(P0(this,Pc),this.view.dom),e&&this.focus(e),this.onChange(),this.addFocusListeners()}onUpdate(){this.view&&P0(this,Pc)&&this.view.setProps({...this.view.props,editable:()=>this.props.editable??!0})}get frameworkOutput(){return{...this.baseOutput,getRootProps:this.getRootProps,portalContainer:this.manager.store.portalContainer}}resetRender(){this.rootPropsConfig.called=!1,this.rootPropsConfig.count=0}};Pc=new WeakMap;var N4=typeof document<"u"?g.useLayoutEffect:g.useEffect;function efe(e){const t=g.useRef();return N4(()=>{t.current=e}),t.current}function tfe(e){const{manager:t,state:n}=e,{placeholder:r,editable:o}=e;g.useRef(!0).current&&!Ta(r)&&t.getExtension(Ah).setOptions({placeholder:r}),g.useEffect(()=>{r!=null&&t.getExtension(Ah).setOptions({placeholder:r})},[r,t]);const[s]=g.useState(()=>{if(n)return n;const l=t.createEmptyDoc(),[c,u]=sn(e.initialContent)?e.initialContent:[e.initialContent??l];return t.createState({content:c,selection:u})}),a=nfe({initialEditorState:s,getProps:()=>e});return g.useEffect(()=>()=>{a.destroy()},[a]),g.useEffect(()=>{a.onUpdate()},[o,a]),rfe(a),a.frameworkOutput}function nfe(e){const t=g.useRef(e);t.current=e;const n=g.useMemo(()=>new Qde(t.current),[]);return n.update(e),n}function rfe(e){const{state:t}=e.props,n=g.useRef(!!t),r=efe(t);N4(()=>{const o=t?n.current===!0:n.current===!1;je(o,{code:re.REACT_CONTROLLED,message:n.current?"You have attempted to switch from a controlled to an uncontrolled editor. Once you set up an editor as a controlled editor it must always provide a `state` prop.":"You have provided a `state` prop to an uncontrolled editor. In order to set up your editor as controlled you must provide the `state` prop from the very first render."}),!(!t||t===r)&&e.updateControlledState(t,r??void 0)},[t,r,e])}function ofe(e={}){const{content:t,document:n,selection:r,extensions:o,...i}=e,s=Xde(o??(()=>[]),i),[a,l]=g.useState(()=>s.createState({selection:r,content:t??s.createEmptyDoc()})),c=g.useCallback(({state:f})=>{l(f)},[]),u=g.useCallback(()=>s.output,[s]);return g.useMemo(()=>({state:a,setState:l,manager:s,onChange:c,getContext:u}),[u,s,c,a])}var Kw=()=>Ee.createElement("div",{className:Que.EDITOR_WRAPPER,...Hy().getRootProps()}),ife=e=>(e.hook(),null);function sfe(e){const{children:t,autoRender:n,i18n:r,locale:o,supportedLocales:i,hooks:s=[],...a}=e,l=tfe(a),c=Loe(l.portalContainer),u=n==="start"||n===!0||!t&&Ta(n),f=n==="end";return Ee.createElement(Jde,{i18n:r,locale:o,supportedLocales:i},Ee.createElement(E4.Provider,{value:l},Ee.createElement(Doe,{portals:c}),s.map((h,p)=>Ee.createElement(ife,{hook:h,key:p})),u&&Ee.createElement(Kw,null),t,f&&Ee.createElement(Kw,null)))}function afe(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let a=r?n.tr:null;return lfe(a,s,e,t)?(r&&r(a.scrollIntoView()),!0):!1}}function lfe(e,t,n,r=null){let o=!1,i=t,s=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let l=s.resolve(t.start-2);i=new $l(l,l,t.depth),t.endIndex<t.parent.childCount&&(t=new $l(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let a=Nk(i,n,r,t);return a?(e&&cfe(e,t,a,o,n),!0):!1}function cfe(e,t,n,r,o){let i=q.empty;for(let u=n.length-1;u>=0;u--)i=q.from(n[u].type.create(n[u].attrs,i));e.step(new Ht(t.start-(r?2:0),t.end,t.start,t.end,new ae(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==o&&(s=u+1);let a=n.length-s,l=t.start+n.length-(r?2:0),c=t.parent;for(let u=t.startIndex,f=t.endIndex,h=!0;u<f;u++,h=!1)!h&&Qc(e.doc,l,a)&&(e.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return e}function ufe(e){return function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==e);return i?n?r.node(i.depth-1).type==e?dfe(t,n,e,i):ffe(t,n,i):!0:!1}}function dfe(e,t,n,r){let o=e.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new Ht(i-1,s,i,s,new ae(q.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new $l(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=od(r);if(a==null)return!1;o.lift(r,a);let l=o.mapping.map(i,-1)-1;return wp(o.doc,l)&&o.join(l),t(o.scrollIntoView()),!0}function ffe(e,t,n){let r=e.tr,o=n.parent;for(let p=n.end,m=n.endIndex-1,v=n.startIndex;m>v;m--)p-=o.child(m).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(a?0:1),u+1,s.content.append(l?q.empty:q.from(o))))return!1;let f=i.pos,h=f+s.nodeSize;return r.step(new Ht(f-(a?1:0),h+(l?1:0),f+1,h-1,new ae((a?q.empty:q.from(o.copy(q.empty))).append(l?q.empty:q.from(o.copy(q.empty))),a?0:1,l?0:1),a?0:1)),t(r.scrollIntoView()),!0}var hfe=Object.defineProperty,pfe=Object.getOwnPropertyDescriptor,No=(e,t,n,r)=>{for(var o=r>1?void 0:r?pfe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&hfe(t,n,o),o};function Gw(e){var t;return!!((t=e.spec.group)!=null&&t.includes(He.ListContainerNode))}function mfe(e){var t;return!!((t=e.spec.group)!=null&&t.includes(He.ListItemNode))}function Ia(e){return Gw(e.type)}function va(e){return mfe(e.type)}function sE(e,t){return n=>{const{dispatch:r,tr:o}=n,i=$k(o,n.state),{$from:s,$to:a}=o.selection,l=s.blockRange(a);if(!l)return!1;const c=Ay({predicate:u=>Gw(u.type),selection:o.selection});if(c&&l.depth-c.depth<=1&&l.startIndex===0){if(c.node.type===e)return j4(t)(n);if(Gw(c.node.type))return e.validContent(c.node.content)?(r==null||r(o.setNodeMarkup(c.pos,e)),!0):gfe(o,c,e,t)?(r==null||r(o.scrollIntoView()),!0):!1}return afe(e)(i,r)}}function P4(e,t=["checked"]){return function({tr:n,dispatch:r,state:o}){var p,m;const i=_ne(e,o.schema),{$from:s,$to:a}=n.selection;if(Dy(n.selection)&&n.selection.node.isBlock||s.depth<2||!s.sameParent(a))return!1;const l=s.node(-1);if(l.type!==i)return!1;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==i||s.index(-2)!==s.node(-2).childCount-1)return!1;if(r){const v=s.index(-1)>0;let x=q.empty;for(let S=s.depth-(v?1:2);S>=s.depth-3;S--)x=q.from(s.node(S).copy(x));const b=((p=i.contentMatch.defaultType)==null?void 0:p.createAndFill())||void 0;x=x.append(q.from(i.createAndFill(null,b)||void 0));const w=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3;n.replace(s.before(v?void 0:-1),s.after(-w),new ae(x,v?3:2,2)),n.setSelection(n.selection.constructor.near(n.doc.resolve(s.pos+(v?3:2)))),r(n.scrollIntoView())}return!0}if(l.attrs.closed&&s.sameParent(a)&&a.pos===a.end()){if(r){const v=s.after(-1),x=((m=i.contentMatch.defaultType)==null?void 0:m.createAndFill())||void 0,b=i.createAndFill(null,x);b&&(n.insert(v,b),n.setSelection(ze.near(n.doc.resolve(v+1)))),n.delete(s.pos,a.pos),r(n.scrollIntoView())}return!0}const c=Object.fromEntries(Object.entries(l.attrs).filter(([v])=>!t.includes(v))),u=a.pos===s.end()?l.contentMatchAt(0).defaultType:null,f={...s.node().attrs};n.delete(s.pos,a.pos);const h=u?[{type:i,attrs:c},{type:u,attrs:f}]:[{type:i,attrs:c}];return Qc(n.doc,s.pos,2)?(r&&r(n.split(s.pos,2,h).scrollIntoView()),!0):!1}}function gfe(e,t,n,r){const o=t.node,i=e.doc.resolve(t.start),s=i.node(-1),a=i.index(-1);if(!s||!s.canReplace(a,a+1,q.from(n.create())))return!1;const l=[];for(let p=0;p<o.childCount;p++){const m=o.child(p);if(!r.validContent(m.content))return!1;const v=r.createChecked(null,m.content);l.push(v)}const c=n.createChecked(null,l),u=t.pos,f=u+o.nodeSize,h=e.selection.from;return e.replaceRangeWith(u,f,c),e.setSelection(e.selection.constructor.near(e.doc.resolve(h))),!0}function vfe({listType:e,itemType:t,tr:n,range:r}){var l;const o=r.parent,i=n.doc.slice(r.start,r.end);if(o.type===e&&((l=i.content.firstChild)==null?void 0:l.type)===t)return!1;const s=[];for(let c=0;c<i.content.childCount;c++){const u=i.content.child(c);if(!t.validContent(u.content))return!1;const f=t.createChecked(null,u.content);s.push(f)}const a=e.createChecked(null,s);return n.replaceRange(r.start,r.end,new ae(q.from(a),0,0)),!0}function Du({listType:e,itemType:t,tr:n}){const r=yv(n.selection);if(!r)return!1;const o=r.startIndex===0,{from:i,to:s}=n.selection;return vfe({listType:e,itemType:t,tr:n,range:r})?(n.setSelection(ze.between(n.doc.resolve(o?i:i+2),n.doc.resolve(o?s:s+2))),n.scrollIntoView(),!0):!1}function yfe(e,t,n){const r=e.tr,o=n.parent,i=r.mapping.maps.length;for(let m=n.end,v=n.endIndex-1,x=n.startIndex;v>x;v--)m-=o.child(v).nodeSize,r.delete(m-1,m+1);const s=r.doc.resolve(n.start),a=s.nodeAfter;if(!a||r.mapping.slice(i).map(n.end)!==n.start+a.nodeSize)return!1;const l=n.startIndex===0,c=n.endIndex===o.childCount,u=s.node(-1),f=s.index(-1);if(!u.canReplace(f+(l?0:1),f+1,a.content.append(c?q.empty:q.from(o))))return!1;const h=s.pos,p=h+a.nodeSize;return r.step(new Ht(h-(l?1:0),p+(c?1:0),h+1,p-1,new ae((l?q.empty:q.from(o.copy(q.empty))).append(c?q.empty:q.from(o.copy(q.empty))),l?0:1,c?0:1),l?0:1)),t(r.scrollIntoView()),!0}function _4(e,t){const n=t||e.selection.$from;let r=[],o,i,s,a;for(let c=n.depth;c>=0;c--){if(i=n.node(c),o=n.index(c),s=i.maybeChild(o-1),a=i.maybeChild(o),s&&a&&s.type.name===a.type.name&&Ia(s)){const u=n.before(c+1);r.push(u)}if(o=n.indexAfter(c),s=i.maybeChild(o-1),a=i.maybeChild(o),s&&a&&s.type.name===a.type.name&&Ia(s)){const u=n.after(c+1);r.push(u)}}r=[...new Set(r)].sort((c,u)=>u-c);let l=!1;for(const c of r)wp(e.doc,c)&&(e.join(c),l=!0);return l}function j4(e){return t=>{const{dispatch:n,tr:r}=t,o=$k(r,t.state),i=xfe(e,r.selection);return i?(n&&yfe(o,n,i),!0):!1}}function xfe(e,t){const{$from:n,$to:r}=t;return n.blockRange(r,i=>{var s;return((s=i.firstChild)==null?void 0:s.type)===e})}function yv(e){const{$from:t,$to:n}=e;return t.blockRange(n,Ia)}function bfe(e){const t=e.selection.$from,n=t.blockRange();if(!n||!va(n.parent)||n.startIndex!==0)return!1;const r=t.node(n.depth-2),o=t.index(n.depth),i=t.index(n.depth-1),s=t.index(n.depth-2),a=r.maybeChild(s-1),l=a==null?void 0:a.lastChild;if(o!==0||i!==0)return!1;if(a&&Ia(a)&&l&&va(l))return Du({listType:a.type,itemType:l.type,tr:e});if(va(r)){const c=r,u=t.node(n.depth-3);if(Ia(u))return Du({listType:u.type,itemType:c.type,tr:e})}return!1}function nj({view:e}){if(!e)return!1;{const t=e.state.selection.$cursor;if(!t||t.parentOffset>0)return!1;const n=t.blockRange();if(!n||!va(n.parent)||n.startIndex!==0)return!1}{const t=e.state.tr;bfe(t)&&e.dispatch(t)}{const t=e.state.selection.$cursor;if(!t||t.parentOffset>0)return!1;const n=t.blockRange();if(!n||!va(n.parent)||n.startIndex!==0)return!1;const r=t.index(n.depth),o=t.index(n.depth-1),i=t.index(n.depth-2),s=n.depth-2>=1&&va(t.node(n.depth-2));r===0&&o===0&&i<=1&&s&&ufe(n.parent.type)(e.state,e.dispatch)}return $L(e.state,e.dispatch,e),!0}function T4({node:e,mark:t,updateDOM:n,updateMark:r}){const o=document.createElement("label");o.contentEditable="false",o.classList.add(Aa.LIST_ITEM_MARKER_CONTAINER),o.append(t);const i=document.createElement("div"),s=document.createElement("li");s.classList.add(Aa.LIST_ITEM_WITH_CUSTOM_MARKER),s.append(o),s.append(i);const a=l=>l.type!==e.type?!1:(e=l,n(e,s),r(e,t),!0);return a(e),{dom:s,contentDOM:i,update:a}}function wfe(e,t){const n=e.node(t.depth-1),r=e.node(t.depth-2);return!va(n)||!Ia(r)?!1:{parentItem:n,parentList:r}}function Sfe(e,t){const n=t.parent,r=t.parent.child(t.endIndex-1),o=t.end,i=t.$to.end(t.depth);return o<i?(e.step(new Ht(o-1,i,o,i,new ae(q.from(r.type.create(null,n.copy())),1,0),1,!0)),new $l(e.doc.resolve(t.$from.pos),e.doc.resolve(i),t.depth)):t}function kfe(e,t){const n=t.parent,r=t.parent.child(t.endIndex-1),o=t.end,i=t.$to.end(t.depth-1);return o+1<i?(e.step(new Ht(o-1,i,o+1,i,new ae(q.from(n.type.create(null,r.type.create(null))),2,0),0,!0)),new $l(e.selection.$from,e.selection.$to,t.depth)):t}function Efe(e,t,n,r){return Du({listType:n.type,itemType:r.type,tr:e})?new $l(e.selection.$from,e.selection.$to,t.depth):t}function Cfe(e){let t=yv(e.selection);if(!t)return!1;const n=wfe(e.selection.$from,t);if(!n)return!1;const{parentItem:r,parentList:o}=n;t=Sfe(e,t),t=kfe(e,t),t=Efe(e,t,o,r);const i=od(t);return typeof i!="number"||(e.lift(t,i),t=yv(e.selection),t&&_4(e,e.doc.resolve(t.end-2))),!0}var Nfe=({tr:e,dispatch:t})=>Cfe(e)?(t==null||t(e.scrollIntoView()),!0):!1;function Pfe(e,t,n){let r,o,i,s;const a=t.doc;if(n.startIndex>=1){r=e.child(n.startIndex-1),o=e,s=a.resolve(n.start).start(n.depth),i=s+1;for(let l=0;l<n.startIndex-1;l++)i+=o.child(l).nodeSize}else{const l=t.index(n.depth-1);if(l>=1){const c=t.node(n.depth-1),u=t.start(n.depth-1);if(o=c.child(l-1),!Ia(o))return!1;s=u+1;for(let f=0;f<l-1;f++)s+=c.child(f).nodeSize;if(r=o.child(o.childCount-1),i=s+o.nodeSize-r.nodeSize-1,!va(r))return!1}else return!1}return{previousItem:r,previousList:o,previousItemStart:i,previousListStart:s}}function _fe(e,t,n){let r,o;const i=n.start,s=t.depth>=n.depth+2?t.end(n.depth+2):n.end-1,a=n.end;return s+1>=a?(r=e.slice(i,a),o=null):(r=e.slice(i,s),o=e.slice(s+1,a-1)),{selectedSlice:r,unselectedSlice:o}}function jfe(e){const{$from:t,$to:n}=e.selection,r=yv(e.selection);if(!r)return!1;const o=e.doc.resolve(r.start).node();if(!Ia(o))return!1;const i=Pfe(o,t,r);if(!i)return!1;const{previousItem:s,previousList:a,previousItemStart:l}=i,{selectedSlice:c,unselectedSlice:u}=_fe(e.doc,n,r),f=s.content.append(q.fromArray([o.copy(c.content)])).append(u?u.content:q.empty);e.deleteRange(r.start,r.end);const h=l+s.nodeSize-2,p=s.copy(f);return p.check(),e.replaceRangeWith(l-1,h+1,p),e.setSelection(a===o?ze.between(e.doc.resolve(t.pos),e.doc.resolve(n.pos)):ze.between(e.doc.resolve(t.pos-2),e.doc.resolve(n.pos-2))),!0}var Tfe=({tr:e,dispatch:t})=>jfe(e)?(t==null||t(e.scrollIntoView()),!0):!1,O4=class extends Tt{get name(){return"listItemShared"}createKeymap(){const e={Tab:Tfe,"Shift-Tab":Nfe,Backspace:nj,"Mod-Backspace":nj};if($o.isMac){const t={"Ctrl-h":e.Backspace,"Alt-Backspace":e["Mod-Backspace"]};return{...e,...t}}return e}createPlugin(){return{appendTransaction:(e,t,n)=>{const r=n.tr;return _4(r)?r:null}}}},Lu=class extends Co{get name(){return"listItem"}createTags(){return[He.ListItemNode]}createNodeSpec(e,t){return{content:"paragraph block*",defining:!0,draggable:!1,...t,attrs:{...e.defaults(),closed:{default:!1},nested:{default:!1}},parseDOM:[{tag:"li",getAttrs:e.parse,priority:mt.Lowest},...t.parseDOM??[]],toDOM:n=>["li",e.dom(n),0]}}createNodeViews(){return this.options.enableCollapsible?(e,t,n)=>{const r=document.createElement("div");return r.classList.add(Aa.COLLAPSIBLE_LIST_ITEM_BUTTON),r.contentEditable="false",r.addEventListener("click",()=>{if(r.classList.contains("disabled"))return;const o=n(),i=Me.create(t.state.doc,o);return t.dispatch(t.state.tr.setSelection(i)),this.store.commands.toggleListItemClosed(),!0}),T4({mark:r,node:e,updateDOM:Ofe,updateMark:Mfe})}:{}}createKeymap(){return{Enter:P4(this.type)}}createExtensions(){return[new O4]}toggleListItemClosed(e){return({state:{tr:t,selection:n},dispatch:r})=>{if(!Dy(n)||n.node.type.name!==this.name)return!1;const{node:o,from:i}=n;return e=wZ(e)?e:!o.attrs.closed,r==null||r(t.setNodeMarkup(i,void 0,{...o.attrs,closed:e})),!0}}liftListItemOutOfList(e){return j4(e??this.type)}};No([xe()],Lu.prototype,"toggleListItemClosed",1);No([xe()],Lu.prototype,"liftListItemOutOfList",1);Lu=No([st({defaultOptions:{enableCollapsible:!1},staticKeys:["enableCollapsible"]})],Lu);function Ofe(e,t){e.attrs.closed?t.classList.add(Aa.COLLAPSIBLE_LIST_ITEM_CLOSED):t.classList.remove(Aa.COLLAPSIBLE_LIST_ITEM_CLOSED)}function Mfe(e,t){e.childCount<=1?t.classList.add("disabled"):t.classList.remove("disabled")}var Ih=class extends Co{get name(){return"bulletList"}createTags(){return[He.Block,He.ListContainerNode]}createNodeSpec(e,t){return{content:"listItem+",...t,attrs:e.defaults(),parseDOM:[{tag:"ul",getAttrs:e.parse},...t.parseDOM??[]],toDOM:n=>["ul",e.dom(n),0]}}createNodeViews(){return this.options.enableSpine?(e,t,n)=>{var c;const r=document.createElement("div");r.style.position="relative";const o=n(),i=t.state.doc.resolve(o+1),s=i.node(i.depth-1);if(!(((c=s==null?void 0:s.type)==null?void 0:c.name)!=="listItem")){const u=document.createElement("div");u.contentEditable="false",u.classList.add(Aa.LIST_SPINE),u.addEventListener("click",f=>{const h=n(),p=t.state.doc.resolve(h+1),m=p.start(p.depth-1),v=Me.create(t.state.doc,m-1);t.dispatch(t.state.tr.setSelection(v)),this.store.commands.toggleListItemClosed(),f.preventDefault(),f.stopPropagation()}),r.append(u)}const l=document.createElement("ul");return l.classList.add(Aa.UL_LIST_CONTENT),r.append(l),{dom:r,contentDOM:l}}:{}}createExtensions(){return[new Lu({priority:mt.Low,enableCollapsible:this.options.enableSpine})]}toggleBulletList(){return sE(this.type,It(this.store.schema.nodes,"listItem"))}listShortcut(e){return this.toggleBulletList()(e)}createInputRules(){const e=/^\s*([*+-])\s$/;return[Tk(e,this.type),new Eo(e,(t,n,r,o)=>{const i=t.tr;return i.deleteRange(r,o),Du({listType:this.type,itemType:It(this.store.schema.nodes,"listItem"),tr:i})?i:null})]}};No([xe({icon:"listUnordered",label:({t:e})=>e(jk.BULLET_LIST_LABEL)})],Ih.prototype,"toggleBulletList",1);No([to({shortcut:oe.BulletList,command:"toggleBulletList"})],Ih.prototype,"listShortcut",1);Ih=No([st({defaultOptions:{enableSpine:!1},staticKeys:["enableSpine"]})],Ih);var Dh=class extends Co{get name(){return"orderedList"}createTags(){return[He.Block,He.ListContainerNode]}createNodeSpec(e,t){return{content:"listItem+",...t,attrs:{...e.defaults(),order:{default:1}},parseDOM:[{tag:"ol",getAttrs:n=>Ni(n)?{...e.parse(n),order:+(n.getAttribute("start")??1)}:{}},...t.parseDOM??[]],toDOM:n=>{const r=e.dom(n);return n.attrs.order===1?["ol",r,0]:["ol",{...r,start:n.attrs.order},0]}}}createExtensions(){return[new Lu({priority:mt.Low})]}toggleOrderedList(){return sE(this.type,It(this.store.schema.nodes,"listItem"))}listShortcut(e){return this.toggleOrderedList()(e)}createInputRules(){const e=/^(\d+)\.\s$/;return[Tk(e,this.type,t=>({order:+It(t,1)}),(t,n)=>n.childCount+n.attrs.order===+It(t,1)),new Eo(e,(t,n,r,o)=>{const i=t.tr;if(i.deleteRange(r,o),!Du({listType:this.type,itemType:It(this.store.schema.nodes,"listItem"),tr:i}))return null;const a=+It(n,1);if(a!==1){const l=_h({selection:i.selection,types:this.type});l&&i.setNodeMarkup(l.pos,void 0,{order:a})}return i})]}};No([xe({icon:"listOrdered",label:({t:e})=>e(jk.ORDERED_LIST_LABEL)})],Dh.prototype,"toggleOrderedList",1);No([to({shortcut:oe.OrderedList,command:"toggleOrderedList"})],Dh.prototype,"listShortcut",1);Dh=No([st({})],Dh);var M4=class extends Co{get name(){return"taskListItem"}createTags(){return[He.ListItemNode]}createNodeSpec(e,t){return{content:"paragraph block*",defining:!0,draggable:!1,...t,attrs:{...e.defaults(),checked:{default:!1}},parseDOM:[{tag:"li[data-task-list-item]",getAttrs:n=>{let r=!1;return Ni(n)&&n.getAttribute("data-checked")!==null&&(r=!0),{checked:r,...e.parse(n)}},priority:mt.Medium},...t.parseDOM??[]],toDOM:n=>["li",{...e.dom(n),"data-task-list-item":"","data-checked":n.attrs.checked?"":void 0},0]}}createNodeViews(){return(e,t,n)=>{const r=document.createElement("input");return r.type="checkbox",r.classList.add(Aa.LIST_ITEM_CHECKBOX),r.contentEditable="false",r.addEventListener("click",o=>{t.editable||o.preventDefault()}),r.addEventListener("change",()=>{const o=n(),i=t.state.doc.resolve(o+1);this.store.commands.toggleCheckboxChecked({$pos:i})}),r.checked=e.attrs.checked,T4({node:e,mark:r,updateDOM:Rfe,updateMark:Afe})}}createKeymap(){return{Enter:P4(this.type)}}createExtensions(){return[new O4]}toggleCheckboxChecked(e){let t,n;return typeof e=="boolean"?t=e:e&&(t=e.checked,n=e.$pos),({tr:r,dispatch:o})=>{const i=_h({selection:n??r.selection.$from,types:this.type});if(!i)return!1;const{node:s,pos:a}=i,l={...s.attrs,checked:t??!s.attrs.checked};return o==null||o(r.setNodeMarkup(a,void 0,l)),!0}}createInputRules(){const e=/^\s*(\[( ?|x|X)]\s)$/;return[Tk(e,this.type,t=>({checked:["x","X"].includes(Rf(t,2))})),new Eo(e,(t,n,r,o)=>{const i=t.tr;if(i.deleteRange(r,o),!Du({listType:It(this.store.schema.nodes,"taskList"),itemType:this.type,tr:i}))return null;const a=["x","X"].includes(Rf(n,2));if(a){const l=_h({selection:i.selection,types:this.type});l&&i.setNodeMarkup(l.pos,void 0,{checked:a})}return i})]}};No([xe()],M4.prototype,"toggleCheckboxChecked",1);function Rfe(e,t){e.attrs.checked?t.setAttribute("data-checked",""):t.removeAttribute("data-checked"),t.setAttribute("data-task-list-item","")}function Afe(e,t){t.checked=!!e.attrs.checked}var R4=class extends Co{get name(){return"taskList"}createTags(){return[He.Block,He.ListContainerNode]}createNodeSpec(e,t){return{content:"taskListItem+",...t,attrs:e.defaults(),parseDOM:[{tag:"ul[data-task-list]",getAttrs:e.parse,priority:mt.Medium},...t.parseDOM??[]],toDOM:n=>["ul",{...e.dom(n),"data-task-list":""},0]}}createExtensions(){return[new M4({})]}toggleTaskList(){return sE(this.type,It(this.store.schema.nodes,"taskListItem"))}listShortcut(e){return this.toggleTaskList()(e)}};No([xe({icon:"checkboxMultipleLine",label:({t:e})=>e(jk.TASK_LIST_LABEL)})],R4.prototype,"toggleTaskList",1);No([to({shortcut:oe.TaskList,command:"toggleTaskList"})],R4.prototype,"listShortcut",1);function Ife(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];function c(f){const{scope:h,children:p,...m}=f,v=(h==null?void 0:h[e][l])||a,x=g.useMemo(()=>m,Object.values(m));return d.jsx(v.Provider,{value:x,children:p})}function u(f,h){const p=(h==null?void 0:h[e][l])||a,m=g.useContext(p);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>g.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,Dfe(o,...t)]}function Dfe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(i)[`__scope${c}`];return{...a,...f}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var _0="rovingFocusGroup.onEntryFocus",Lfe={bubbles:!1,cancelable:!0},Ky="RovingFocusGroup",[qw,A4,Ffe]=py(Ky),[zfe,I4]=Ife(Ky,[Ffe]),[$fe,Bfe]=zfe(Ky),D4=g.forwardRef((e,t)=>d.jsx(qw.Provider,{scope:e.__scopeRovingFocusGroup,children:d.jsx(qw.Slot,{scope:e.__scopeRovingFocusGroup,children:d.jsx(Vfe,{...e,ref:t})})}));D4.displayName=Ky;var Vfe=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...f}=e,h=g.useRef(null),p=Be(t,h),m=ap(i),[v=null,x]=Kr({prop:s,defaultProp:a,onChange:l}),[b,w]=g.useState(!1),S=nn(c),C=A4(n),N=g.useRef(!1),[P,_]=g.useState(0);return g.useEffect(()=>{const O=h.current;if(O)return O.addEventListener(_0,S),()=>O.removeEventListener(_0,S)},[S]),d.jsx($fe,{scope:n,orientation:r,dir:m,loop:o,currentTabStopId:v,onItemFocus:g.useCallback(O=>x(O),[x]),onItemShiftTab:g.useCallback(()=>w(!0),[]),onFocusableItemAdd:g.useCallback(()=>_(O=>O+1),[]),onFocusableItemRemove:g.useCallback(()=>_(O=>O-1),[]),children:d.jsx(Oe.div,{tabIndex:b||P===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:ne(e.onMouseDown,()=>{N.current=!0}),onFocus:ne(e.onFocus,O=>{const M=!N.current;if(O.target===O.currentTarget&&M&&!b){const D=new CustomEvent(_0,Lfe);if(O.currentTarget.dispatchEvent(D),!D.defaultPrevented){const U=C().filter(I=>I.focusable),z=U.find(I=>I.active),H=U.find(I=>I.id===v),V=[z,H,...U].filter(Boolean).map(I=>I.ref.current);z4(V,u)}}N.current=!1}),onBlur:ne(e.onBlur,()=>w(!1))})})}),L4="RovingFocusGroupItem",F4=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=Vr(),l=i||a,c=Bfe(L4,n),u=c.currentTabStopId===l,f=A4(n),{onFocusableItemAdd:h,onFocusableItemRemove:p}=c;return g.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),d.jsx(qw.ItemSlot,{scope:n,id:l,focusable:r,active:o,children:d.jsx(Oe.span,{tabIndex:u?0:-1,"data-orientation":c.orientation,...s,ref:t,onMouseDown:ne(e.onMouseDown,m=>{r?c.onItemFocus(l):m.preventDefault()}),onFocus:ne(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:ne(e.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){c.onItemShiftTab();return}if(m.target!==m.currentTarget)return;const v=Hfe(m,c.orientation,c.dir);if(v!==void 0){if(m.metaKey||m.ctrlKey||m.altKey||m.shiftKey)return;m.preventDefault();let b=f().filter(w=>w.focusable).map(w=>w.ref.current);if(v==="last")b.reverse();else if(v==="prev"||v==="next"){v==="prev"&&b.reverse();const w=b.indexOf(m.currentTarget);b=c.loop?Kfe(b,w+1):b.slice(w+1)}setTimeout(()=>z4(b))}})})})});F4.displayName=L4;var Ufe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Wfe(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Hfe(e,t,n){const r=Wfe(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Ufe[r]}function z4(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Kfe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Gfe=D4,qfe=F4,Yw=["Enter"," "],Yfe=["ArrowDown","PageUp","Home"],$4=["ArrowUp","PageDown","End"],Jfe=[...Yfe,...$4],Xfe={ltr:[...Yw,"ArrowRight"],rtl:[...Yw,"ArrowLeft"]},Zfe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Pp="Menu",[Lh,Qfe,ehe]=py(Pp),[rc,B4]=So(Pp,[ehe,ji,I4]),Gy=ji(),V4=I4(),[the,oc]=rc(Pp),[nhe,_p]=rc(Pp),U4=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=e,a=Gy(t),[l,c]=g.useState(null),u=g.useRef(!1),f=nn(i),h=ap(o);return g.useEffect(()=>{const p=()=>{u.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>u.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),d.jsx(tp,{...a,children:d.jsx(the,{scope:t,open:n,onOpenChange:f,content:l,onContentChange:c,children:d.jsx(nhe,{scope:t,onClose:g.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:u,dir:h,modal:s,children:r})})})};U4.displayName=Pp;var rhe="MenuAnchor",aE=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Gy(n);return d.jsx(Wu,{...o,...r,ref:t})});aE.displayName=rhe;var lE="MenuPortal",[ohe,W4]=rc(lE,{forceMount:void 0}),H4=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,i=oc(lE,t);return d.jsx(ohe,{scope:t,forceMount:n,children:d.jsx(ln,{present:n||i.open,children:d.jsx(Hu,{asChild:!0,container:o,children:r})})})};H4.displayName=lE;var go="MenuContent",[ihe,cE]=rc(go),K4=g.forwardRef((e,t)=>{const n=W4(go,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=oc(go,e.__scopeMenu),s=_p(go,e.__scopeMenu);return d.jsx(Lh.Provider,{scope:e.__scopeMenu,children:d.jsx(ln,{present:r||i.open,children:d.jsx(Lh.Slot,{scope:e.__scopeMenu,children:s.modal?d.jsx(she,{...o,ref:t}):d.jsx(ahe,{...o,ref:t})})})})}),she=g.forwardRef((e,t)=>{const n=oc(go,e.__scopeMenu),r=g.useRef(null),o=Be(t,r);return g.useEffect(()=>{const i=r.current;if(i)return fy(i)},[]),d.jsx(uE,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ne(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),ahe=g.forwardRef((e,t)=>{const n=oc(go,e.__scopeMenu);return d.jsx(uE,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),uE=g.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:h,onDismiss:p,disableOutsideScroll:m,...v}=e,x=oc(go,n),b=_p(go,n),w=Gy(n),S=V4(n),C=Qfe(n),[N,P]=g.useState(null),_=g.useRef(null),O=Be(t,_,x.onContentChange),M=g.useRef(0),D=g.useRef(""),U=g.useRef(0),z=g.useRef(null),H=g.useRef("right"),K=g.useRef(0),V=m?cp:g.Fragment,I=m?{as:ls,allowPinchZoom:!0}:void 0,A=L=>{var J,ce;const $=D.current+L,W=C().filter(Ne=>!Ne.disabled),G=document.activeElement,_e=(J=W.find(Ne=>Ne.ref.current===G))==null?void 0:J.textValue,ke=W.map(Ne=>Ne.textValue),Ve=xhe(ke,$,_e),Z=(ce=W.find(Ne=>Ne.textValue===Ve))==null?void 0:ce.ref.current;(function Ne(he){D.current=he,window.clearTimeout(M.current),he!==""&&(M.current=window.setTimeout(()=>Ne(""),1e3))})($),Z&&setTimeout(()=>Z.focus())};g.useEffect(()=>()=>window.clearTimeout(M.current),[]),dy();const j=g.useCallback(L=>{var W,G;return H.current===((W=z.current)==null?void 0:W.side)&&whe(L,(G=z.current)==null?void 0:G.area)},[]);return d.jsx(ihe,{scope:n,searchRef:D,onItemEnter:g.useCallback(L=>{j(L)&&L.preventDefault()},[j]),onItemLeave:g.useCallback(L=>{var $;j(L)||(($=_.current)==null||$.focus(),P(null))},[j]),onTriggerLeave:g.useCallback(L=>{j(L)&&L.preventDefault()},[j]),pointerGraceTimerRef:U,onPointerGraceIntentChange:g.useCallback(L=>{z.current=L},[]),children:d.jsx(V,{...I,children:d.jsx(lp,{asChild:!0,trapped:o,onMountAutoFocus:ne(i,L=>{var $;L.preventDefault(),($=_.current)==null||$.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:d.jsx(Xl,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:h,onDismiss:p,children:d.jsx(Gfe,{asChild:!0,...S,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:N,onCurrentTabStopIdChange:P,onEntryFocus:ne(l,L=>{b.isUsingKeyboardRef.current||L.preventDefault()}),preventScrollOnEntryFocus:!0,children:d.jsx(np,{role:"menu","aria-orientation":"vertical","data-state":l3(x.open),"data-radix-menu-content":"",dir:b.dir,...w,...v,ref:O,style:{outline:"none",...v.style},onKeyDown:ne(v.onKeyDown,L=>{const W=L.target.closest("[data-radix-menu-content]")===L.currentTarget,G=L.ctrlKey||L.altKey||L.metaKey,_e=L.key.length===1;W&&(L.key==="Tab"&&L.preventDefault(),!G&&_e&&A(L.key));const ke=_.current;if(L.target!==ke||!Jfe.includes(L.key))return;L.preventDefault();const Z=C().filter(J=>!J.disabled).map(J=>J.ref.current);$4.includes(L.key)&&Z.reverse(),vhe(Z)}),onBlur:ne(e.onBlur,L=>{L.currentTarget.contains(L.target)||(window.clearTimeout(M.current),D.current="")}),onPointerMove:ne(e.onPointerMove,Fh(L=>{const $=L.target,W=K.current!==L.clientX;if(L.currentTarget.contains($)&&W){const G=L.clientX>K.current?"right":"left";H.current=G,K.current=L.clientX}}))})})})})})})});K4.displayName=go;var lhe="MenuGroup",dE=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.jsx(Oe.div,{role:"group",...r,ref:t})});dE.displayName=lhe;var che="MenuLabel",G4=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.jsx(Oe.div,{...r,ref:t})});G4.displayName=che;var xv="MenuItem",rj="menu.itemSelect",qy=g.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,i=g.useRef(null),s=_p(xv,e.__scopeMenu),a=cE(xv,e.__scopeMenu),l=Be(t,i),c=g.useRef(!1),u=()=>{const f=i.current;if(!n&&f){const h=new CustomEvent(rj,{bubbles:!0,cancelable:!0});f.addEventListener(rj,p=>r==null?void 0:r(p),{once:!0}),iR(f,h),h.defaultPrevented?c.current=!1:s.onClose()}};return d.jsx(q4,{...o,ref:l,disabled:n,onClick:ne(e.onClick,u),onPointerDown:f=>{var h;(h=e.onPointerDown)==null||h.call(e,f),c.current=!0},onPointerUp:ne(e.onPointerUp,f=>{var h;c.current||(h=f.currentTarget)==null||h.click()}),onKeyDown:ne(e.onKeyDown,f=>{const h=a.searchRef.current!=="";n||h&&f.key===" "||Yw.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});qy.displayName=xv;var q4=g.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=e,s=cE(xv,n),a=V4(n),l=g.useRef(null),c=Be(t,l),[u,f]=g.useState(!1),[h,p]=g.useState("");return g.useEffect(()=>{const m=l.current;m&&p((m.textContent??"").trim())},[i.children]),d.jsx(Lh.ItemSlot,{scope:n,disabled:r,textValue:o??h,children:d.jsx(qfe,{asChild:!0,...a,focusable:!r,children:d.jsx(Oe.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:c,onPointerMove:ne(e.onPointerMove,Fh(m=>{r?s.onItemLeave(m):(s.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ne(e.onPointerLeave,Fh(m=>s.onItemLeave(m))),onFocus:ne(e.onFocus,()=>f(!0)),onBlur:ne(e.onBlur,()=>f(!1))})})})}),uhe="MenuCheckboxItem",Y4=g.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return d.jsx(e3,{scope:e.__scopeMenu,checked:n,children:d.jsx(qy,{role:"menuitemcheckbox","aria-checked":bv(n)?"mixed":n,...o,ref:t,"data-state":hE(n),onSelect:ne(o.onSelect,()=>r==null?void 0:r(bv(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Y4.displayName=uhe;var J4="MenuRadioGroup",[dhe,fhe]=rc(J4,{value:void 0,onValueChange:()=>{}}),X4=g.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,i=nn(r);return d.jsx(dhe,{scope:e.__scopeMenu,value:n,onValueChange:i,children:d.jsx(dE,{...o,ref:t})})});X4.displayName=J4;var Z4="MenuRadioItem",Q4=g.forwardRef((e,t)=>{const{value:n,...r}=e,o=fhe(Z4,e.__scopeMenu),i=n===o.value;return d.jsx(e3,{scope:e.__scopeMenu,checked:i,children:d.jsx(qy,{role:"menuitemradio","aria-checked":i,...r,ref:t,"data-state":hE(i),onSelect:ne(r.onSelect,()=>{var s;return(s=o.onValueChange)==null?void 0:s.call(o,n)},{checkForDefaultPrevented:!1})})})});Q4.displayName=Z4;var fE="MenuItemIndicator",[e3,hhe]=rc(fE,{checked:!1}),t3=g.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,i=hhe(fE,n);return d.jsx(ln,{present:r||bv(i.checked)||i.checked===!0,children:d.jsx(Oe.span,{...o,ref:t,"data-state":hE(i.checked)})})});t3.displayName=fE;var phe="MenuSeparator",n3=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.jsx(Oe.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});n3.displayName=phe;var mhe="MenuArrow",r3=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Gy(n);return d.jsx(rp,{...o,...r,ref:t})});r3.displayName=mhe;var ghe="MenuSub",[wge,o3]=rc(ghe),df="MenuSubTrigger",i3=g.forwardRef((e,t)=>{const n=oc(df,e.__scopeMenu),r=_p(df,e.__scopeMenu),o=o3(df,e.__scopeMenu),i=cE(df,e.__scopeMenu),s=g.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=i,c={__scopeMenu:e.__scopeMenu},u=g.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return g.useEffect(()=>u,[u]),g.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),l(null)}},[a,l]),d.jsx(aE,{asChild:!0,...c,children:d.jsx(q4,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":l3(n.open),...e,ref:ey(t,o.onTriggerChange),onClick:f=>{var h;(h=e.onClick)==null||h.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:ne(e.onPointerMove,Fh(f=>{i.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:ne(e.onPointerLeave,Fh(f=>{var p,m;u();const h=(p=n.content)==null?void 0:p.getBoundingClientRect();if(h){const v=(m=n.content)==null?void 0:m.dataset.side,x=v==="right",b=x?-5:5,w=h[x?"left":"right"],S=h[x?"right":"left"];i.onPointerGraceIntentChange({area:[{x:f.clientX+b,y:f.clientY},{x:w,y:h.top},{x:S,y:h.top},{x:S,y:h.bottom},{x:w,y:h.bottom}],side:v}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(f),f.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:ne(e.onKeyDown,f=>{var p;const h=i.searchRef.current!=="";e.disabled||h&&f.key===" "||Xfe[r.dir].includes(f.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),f.preventDefault())})})})});i3.displayName=df;var s3="MenuSubContent",a3=g.forwardRef((e,t)=>{const n=W4(go,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=oc(go,e.__scopeMenu),s=_p(go,e.__scopeMenu),a=o3(s3,e.__scopeMenu),l=g.useRef(null),c=Be(t,l);return d.jsx(Lh.Provider,{scope:e.__scopeMenu,children:d.jsx(ln,{present:r||i.open,children:d.jsx(Lh.Slot,{scope:e.__scopeMenu,children:d.jsx(uE,{id:a.contentId,"aria-labelledby":a.triggerId,...o,ref:c,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var f;s.isUsingKeyboardRef.current&&((f=l.current)==null||f.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:ne(e.onFocusOutside,u=>{u.target!==a.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:ne(e.onEscapeKeyDown,u=>{s.onClose(),u.preventDefault()}),onKeyDown:ne(e.onKeyDown,u=>{var p;const f=u.currentTarget.contains(u.target),h=Zfe[s.dir].includes(u.key);f&&h&&(i.onOpenChange(!1),(p=a.trigger)==null||p.focus(),u.preventDefault())})})})})})});a3.displayName=s3;function l3(e){return e?"open":"closed"}function bv(e){return e==="indeterminate"}function hE(e){return bv(e)?"indeterminate":e?"checked":"unchecked"}function vhe(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function yhe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function xhe(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=yhe(e,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function bhe(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i].x,l=t[i].y,c=t[s].x,u=t[s].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(o=!o)}return o}function whe(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return bhe(n,t)}function Fh(e){return t=>t.pointerType==="mouse"?e(t):void 0}var She=U4,khe=aE,Ehe=H4,Che=K4,Nhe=dE,Phe=G4,_he=qy,jhe=Y4,The=X4,Ohe=Q4,Mhe=t3,Rhe=n3,Ahe=r3,Ihe=i3,Dhe=a3,pE="DropdownMenu",[Lhe,Sge]=So(pE,[B4]),ar=B4(),[Fhe,c3]=Lhe(pE),u3=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:s,modal:a=!0}=e,l=ar(t),c=g.useRef(null),[u=!1,f]=Kr({prop:o,defaultProp:i,onChange:s});return d.jsx(Fhe,{scope:t,triggerId:Vr(),triggerRef:c,contentId:Vr(),open:u,onOpenChange:f,onOpenToggle:g.useCallback(()=>f(h=>!h),[f]),modal:a,children:d.jsx(She,{...l,open:u,onOpenChange:f,dir:r,modal:a,children:n})})};u3.displayName=pE;var d3="DropdownMenuTrigger",f3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,i=c3(d3,n),s=ar(n);return d.jsx(khe,{asChild:!0,...s,children:d.jsx(Oe.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:ey(t,i.triggerRef),onPointerDown:ne(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(i.onOpenToggle(),i.open||a.preventDefault())}),onKeyDown:ne(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&i.onOpenToggle(),a.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});f3.displayName=d3;var zhe="DropdownMenuPortal",h3=e=>{const{__scopeDropdownMenu:t,...n}=e,r=ar(t);return d.jsx(Ehe,{...r,...n})};h3.displayName=zhe;var p3="DropdownMenuContent",m3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=c3(p3,n),i=ar(n),s=g.useRef(!1);return d.jsx(Che,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...r,ref:t,onCloseAutoFocus:ne(e.onCloseAutoFocus,a=>{var l;s.current||(l=o.triggerRef.current)==null||l.focus(),s.current=!1,a.preventDefault()}),onInteractOutside:ne(e.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!o.modal||u)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});m3.displayName=p3;var $he="DropdownMenuGroup",Bhe=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ar(n);return d.jsx(Nhe,{...o,...r,ref:t})});Bhe.displayName=$he;var Vhe="DropdownMenuLabel",g3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ar(n);return d.jsx(Phe,{...o,...r,ref:t})});g3.displayName=Vhe;var Uhe="DropdownMenuItem",v3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ar(n);return d.jsx(_he,{...o,...r,ref:t})});v3.displayName=Uhe;var Whe="DropdownMenuCheckboxItem",y3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ar(n);return d.jsx(jhe,{...o,...r,ref:t})});y3.displayName=Whe;var Hhe="DropdownMenuRadioGroup",Khe=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ar(n);return d.jsx(The,{...o,...r,ref:t})});Khe.displayName=Hhe;var Ghe="DropdownMenuRadioItem",x3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ar(n);return d.jsx(Ohe,{...o,...r,ref:t})});x3.displayName=Ghe;var qhe="DropdownMenuItemIndicator",b3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ar(n);return d.jsx(Mhe,{...o,...r,ref:t})});b3.displayName=qhe;var Yhe="DropdownMenuSeparator",w3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ar(n);return d.jsx(Rhe,{...o,...r,ref:t})});w3.displayName=Yhe;var Jhe="DropdownMenuArrow",Xhe=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ar(n);return d.jsx(Ahe,{...o,...r,ref:t})});Xhe.displayName=Jhe;var Zhe="DropdownMenuSubTrigger",S3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ar(n);return d.jsx(Ihe,{...o,...r,ref:t})});S3.displayName=Zhe;var Qhe="DropdownMenuSubContent",k3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ar(n);return d.jsx(Dhe,{...o,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});k3.displayName=Qhe;var epe=u3,tpe=f3,npe=h3,E3=m3,C3=g3,N3=v3,P3=y3,_3=x3,j3=b3,T3=w3,O3=S3,M3=k3;const rpe=epe,ope=tpe,ipe=g.forwardRef(({className:e,inset:t,children:n,...r},o)=>d.jsxs(O3,{ref:o,className:fe("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-bg-brand-primary data-[state=open]:bg-bg-brand-primary",t&&"pl-8",e),...r,children:[n,d.jsx(Xu,{className:"ml-auto w-4 h-4"})]}));ipe.displayName=O3.displayName;const spe=g.forwardRef(({className:e,...t},n)=>d.jsx(M3,{ref:n,className:fe("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-bg-secondary p-1 text-fg-secondary shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));spe.displayName=M3.displayName;const R3=g.forwardRef(({className:e,sideOffset:t=4,container:n,...r},o)=>d.jsx(npe,{container:n,children:d.jsx(E3,{ref:o,sideOffset:t,className:fe("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-bg-secondary p-1 text-fg-secondary shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));R3.displayName=E3.displayName;const Ls=g.forwardRef(({className:e,inset:t,...n},r)=>d.jsx(N3,{ref:r,className:fe("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-bg-brand-primary focus:text-fg-brand-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));Ls.displayName=N3.displayName;const ape=g.forwardRef(({className:e,children:t,checked:n,...r},o)=>d.jsxs(P3,{ref:o,className:fe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[d.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:d.jsx(j3,{children:d.jsx(Yu,{className:"w-4 h-4"})})}),t]}));ape.displayName=P3.displayName;const lpe=g.forwardRef(({className:e,children:t,...n},r)=>d.jsxs(_3,{ref:r,className:fe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[d.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:d.jsx(j3,{children:d.jsx(J7,{className:"w-2 h-2 fill-current"})})}),t]}));lpe.displayName=_3.displayName;const cpe=g.forwardRef(({className:e,inset:t,...n},r)=>d.jsx(C3,{ref:r,className:fe("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));cpe.displayName=C3.displayName;const upe=g.forwardRef(({className:e,...t},n)=>d.jsx(T3,{ref:n,className:fe("-mx-1 my-1 h-px bg-muted",e),...t}));upe.displayName=T3.displayName;var dpe=Object.defineProperty,fpe=Object.getOwnPropertyDescriptor,jp=(e,t,n,r)=>{for(var o=r>1?void 0:r?fpe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&dpe(t,n,o),o},hpe={icon:"bold",label:({t:e})=>e(DP.LABEL),description:({t:e})=>e(DP.DESCRIPTION)},Kl=class extends Cp{get name(){return"bold"}createTags(){return[He.FormattingMark,He.FontStyle]}createMarkSpec(e,t){return{...t,attrs:e.defaults(),parseDOM:[{tag:"strong",getAttrs:e.parse},{tag:"b",getAttrs:n=>Ni(n)&&n.style.fontWeight!=="normal"?e.parse(n):!1},{style:"font-weight",getAttrs:n=>Fe(n)&&/^(bold(er)?|[5-9]\d{2,})$/.test(n)?null:!1},...t.parseDOM??[]],toDOM:n=>{const{weight:r}=this.options;return r?["strong",{"font-weight":r.toString()},0]:["strong",e.dom(n),0]}}}createInputRules(){return[dv({regexp:/(?:\*\*|__)([^*_]+)(?:\*\*|__)$/,type:this.type,ignoreWhitespace:!0})]}toggleBold(e){return Th({type:this.type,selection:e})}setBold(e){return({tr:t,dispatch:n})=>{const{from:r,to:o}=bo(e??t.selection,t.doc);return n==null||n(t.addMark(r,o,this.type.create())),!0}}removeBold(e){return({tr:t,dispatch:n})=>{const{from:r,to:o}=bo(e??t.selection,t.doc);return t.doc.rangeHasMark(r,o,this.type)?(n==null||n(t.removeMark(r,o,this.type)),!0):!1}}shortcut(e){return this.toggleBold()(e)}};jp([xe(hpe)],Kl.prototype,"toggleBold",1);jp([xe()],Kl.prototype,"setBold",1);jp([xe()],Kl.prototype,"removeBold",1);jp([to({shortcut:oe.Bold,command:"toggleBold"})],Kl.prototype,"shortcut",1);Kl=jp([st({defaultOptions:{weight:void 0},staticKeys:["weight"]})],Kl);var ppe=Object.defineProperty,mpe=Object.getOwnPropertyDescriptor,mE=(e,t,n,r)=>{for(var o=r>1?void 0:r?mpe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&ppe(t,n,o),o},gpe={icon:"italic",label:({t:e})=>e(LP.LABEL),description:({t:e})=>e(LP.DESCRIPTION)},zh=class extends Cp{get name(){return"italic"}createTags(){return[He.FontStyle,He.FormattingMark]}createMarkSpec(e,t){return{...t,attrs:e.defaults(),parseDOM:[{tag:"i",getAttrs:e.parse},{tag:"em",getAttrs:e.parse},{style:"font-style=italic"},...t.parseDOM??[]],toDOM:n=>["em",e.dom(n),0]}}createKeymap(){return{"Mod-i":Th({type:this.type})}}createInputRules(){return[dv({regexp:/(?:^|[^*])\*([^*]+)\*$/,type:this.type,ignoreWhitespace:!0,updateCaptured:({fullMatch:e,start:t})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:t+1}}),dv({regexp:/(?:^|\W)_([^_]+)_$/,type:this.type,ignoreWhitespace:!0,updateCaptured:({fullMatch:e,start:t})=>e.startsWith("_")?{}:{fullMatch:e.slice(1),start:t+1}})]}createPasteRules(){return[{type:"mark",markType:this.type,regexp:/(?:^|\W)_([^_]+)_/g},{type:"mark",markType:this.type,regexp:/\*([^*]+)\*/g}]}toggleItalic(e){return Th({type:this.type,selection:e})}shortcut(e){return this.toggleItalic()(e)}};mE([xe(gpe)],zh.prototype,"toggleItalic",1);mE([to({shortcut:oe.Italic,command:"toggleItalic"})],zh.prototype,"shortcut",1);zh=mE([st({})],zh);var vpe=Object.defineProperty,ype=Object.getOwnPropertyDescriptor,gE=(e,t,n,r)=>{for(var o=r>1?void 0:r?ype(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&vpe(t,n,o),o},xpe={icon:"strikethrough",label:({t:e})=>e(FP.LABEL),description:({t:e})=>e(FP.DESCRIPTION)},$h=class extends Cp{get name(){return"strike"}createTags(){return[He.FontStyle,He.FormattingMark]}createMarkSpec(e,t){return{...t,attrs:e.defaults(),parseDOM:[{tag:"s",getAttrs:e.parse},{tag:"del",getAttrs:e.parse},{tag:"strike",getAttrs:e.parse},{style:"text-decoration",getAttrs:n=>n==="line-through"?{}:!1},...t.parseDOM??[]],toDOM:n=>["s",e.dom(n),0]}}toggleStrike(){return Th({type:this.type})}shortcut(e){return this.toggleStrike()(e)}createInputRules(){return[dv({regexp:/~([^~]+)~$/,type:this.type,ignoreWhitespace:!0})]}createPasteRules(){return[{regexp:/~([^~]+)~/g,type:"mark",markType:this.type}]}};gE([xe(xpe)],$h.prototype,"toggleStrike",1);gE([to({shortcut:oe.Strike,command:"toggleStrike"})],$h.prototype,"shortcut",1);$h=gE([st({})],$h);var bpe='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="22" height="22" fill="rgba(0, 0, 0, 0.65)" stroke="rgba(255, 255, 255, 0.5)" transform="rotate(90)" xmlns:v="https://vecta.io/nano"><path fill-rule="evenodd" d="M14 0a2 2 0 0 0-2 2v10H2a2 2 0 1 0 0 4h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/></svg>',wpe='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="22" height="22" fill="rgba(0, 0, 0, 0.65)" stroke="rgba(255, 255, 255, 0.5)" transform="matrix(0 1 1 0 0 0)" xmlns:v="https://vecta.io/nano"><path fill-rule="evenodd" d="M14 0a2 2 0 0 0-2 2v10H2a2 2 0 1 0 0 4h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/></svg>',Spe=encodeURIComponent(bpe),kpe=encodeURIComponent(wpe),Yn,dj,Epe=(dj=class{constructor(e){Vt(this,"dom");Ln(this,Yn);Vt(this,"type");const t=document.createElement("div"),n=document.createElement("div");this.dom=t,Qe(this,Yn,n),this.type=e,this.createHandle(e)}createHandle(e){switch($n(this.dom,{position:"absolute",pointerEvents:"auto",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"100"}),$n(ue(this,Yn),{opacity:"0",transition:"opacity 300ms ease-in 0s"}),ue(this,Yn).dataset.dragging="",e){case 0:$n(this.dom,{right:"0px",top:"0px",height:"100%",width:"15px",cursor:"col-resize"}),$n(ue(this,Yn),{width:" 4px",height:"36px",maxHeight:"50%",boxSizing:"content-box",background:"rgba(0, 0, 0, 0.65)",border:"1px solid rgba(255, 255, 255, 0.5)",borderRadius:"6px"});break;case 1:$n(this.dom,{left:"0px",top:"0px",height:"100%",width:"15px",cursor:"col-resize"}),$n(ue(this,Yn),{width:" 4px",height:"36px",maxHeight:"50%",boxSizing:"content-box",background:"rgba(0, 0, 0, 0.65)",border:"1px solid rgba(255, 255, 255, 0.5)",borderRadius:"6px"});break;case 2:$n(this.dom,{bottom:"0px",width:"100%",height:"14px",cursor:"row-resize"}),$n(ue(this,Yn),{width:" 42px",height:"4px",boxSizing:"content-box",maxWidth:"50%",background:"rgba(0, 0, 0, 0.65)",border:"1px solid rgba(255, 255, 255, 0.5)",borderRadius:"6px"});break;case 3:$n(this.dom,{right:"-1px",bottom:"-2px",width:"30px",height:"30px",cursor:"nwse-resize",zIndex:"101"}),$n(ue(this,Yn),{height:"22px",width:"22px",backgroundRepeat:"no-repeat",backgroundImage:`url("data:image/svg+xml,${kpe}") `});break;case 4:$n(this.dom,{left:"-1px",bottom:"-2px",width:"30px",height:"30px",cursor:"nesw-resize",zIndex:"101"}),$n(ue(this,Yn),{height:"22px",width:"22px",backgroundRepeat:"no-repeat",backgroundImage:`url("data:image/svg+xml,${Spe}") `});break}this.dom.append(ue(this,Yn))}setHandleVisibility(e){const t=e||!!ue(this,Yn).dataset.dragging;ue(this,Yn).style.opacity=t?"1":"0"}dataSetDragging(e){ue(this,Yn).dataset.dragging=e?"true":""}},Yn=new WeakMap,dj),dm=50,A3=(e=>(e[e.Fixed=0]="Fixed",e[e.Flexible=1]="Flexible",e))(A3||{}),Gs,qs,Ys,ui,Js,fj,Cpe=(fj=class{constructor({node:e,view:t,getPos:n,aspectRatio:r=0,options:o,initialSize:i}){Vt(this,"dom");Ln(this,Gs);Ln(this,qs);Ln(this,Ys,[]);Vt(this,"aspectRatio");Ln(this,ui);Ln(this,Js);const s=this.createWrapper(e,i),a=this.createElement({node:e,view:t,getPos:n,options:o}),c=(r===1?[0,1,2,3,4]:[0,1]).map(h=>new Epe(h));for(const h of c){const p=m=>{this.startResizing(m,t,n,h)};h.dom.addEventListener("mousedown",p),ue(this,Ys).push(()=>h.dom.removeEventListener("mousedown",p)),s.append(h.dom)}const u=()=>{c.forEach(h=>h.setHandleVisibility(!0))},f=()=>{c.forEach(h=>h.setHandleVisibility(!1))};s.addEventListener("mouseover",u),s.addEventListener("mouseout",f),ue(this,Ys).push(()=>s.removeEventListener("mouseover",u),()=>s.removeEventListener("mouseout",f)),s.append(a),this.dom=s,Qe(this,qs,e),Qe(this,Gs,a),this.aspectRatio=r}createWrapper(e,t){const n=document.createElement("div");return n.classList.add("remirror-resizable-view"),n.style.position="relative",t?$n(n,{width:oj(t.width),aspectRatio:`${t.width} / ${t.height}`}):$n(n,{width:oj(e.attrs.width),aspectRatio:`${e.attrs.width} / ${e.attrs.height}`}),$n(n,{maxWidth:"100%",minWidth:`${dm}px`,verticalAlign:"bottom",display:"inline-block",lineHeight:"0",transition:"width 0.15s ease-out, height 0.15s ease-out"}),n}startResizing(e,t,n,r){var u,f;e.preventDefault(),r.dataSetDragging(!0),ue(this,Gs).style.pointerEvents="none";const o=e.pageX,i=e.pageY,s=((u=ue(this,Gs))==null?void 0:u.getBoundingClientRect().width)||0,a=((f=ue(this,Gs))==null?void 0:f.getBoundingClientRect().height)||0,l=dw(100,!1,h=>{const p=h.pageX,m=h.pageY,v=p-o,x=m-i;let b=null,w=null;if(this.aspectRatio===0&&s&&a)switch(r.type){case 0:case 3:b=s+v,w=a/s*b;break;case 1:case 4:b=s-v,w=a/s*b;break;case 2:w=a+x,b=s/a*w;break}else if(this.aspectRatio===1)switch(r.type){case 0:b=s+v;break;case 1:b=s-v;break;case 2:w=a+x;break;case 3:b=s+v,w=a+x;break;case 4:b=s-v,w=a+x;break}typeof b=="number"&&b<dm&&(this.aspectRatio===0&&s&&a?(b=dm,w=a/s*b):this.aspectRatio===1&&(b=dm)),b&&(Qe(this,ui,Math.round(b)),this.dom.style.width=`${ue(this,ui)}px`),w&&Qe(this,Js,Math.round(w)),(b||w)&&(this.dom.style.aspectRatio=`${ue(this,ui)} / ${ue(this,Js)}`)}),c=h=>{h.preventDefault(),r.dataSetDragging(!1),r.setHandleVisibility(!1),ue(this,Gs).style.pointerEvents="auto",document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",c);const p=n(),m=t.state.tr.setNodeMarkup(p,void 0,{...ue(this,qs).attrs,width:ue(this,ui),height:ue(this,Js)});t.dispatch(m)};document.addEventListener("mousemove",l),document.addEventListener("mouseup",c),ue(this,Ys).push(()=>document.removeEventListener("mousemove",l)),ue(this,Ys).push(()=>document.removeEventListener("mouseup",c))}update(e){return e.type!==ue(this,qs).type||this.aspectRatio===0&&e.attrs.width&&e.attrs.width!==ue(this,ui)||this.aspectRatio===1&&e.attrs.width&&e.attrs.height&&e.attrs.width!==ue(this,ui)&&e.attrs.height!==ue(this,Js)||!Npe(ue(this,qs),e,["width","height"])?!1:(Qe(this,qs,e),Qe(this,ui,e.attrs.width),Qe(this,Js,e.attrs.height),!0)}destroy(){ue(this,Ys).forEach(e=>e())}},Gs=new WeakMap,qs=new WeakMap,Ys=new WeakMap,ui=new WeakMap,Js=new WeakMap,fj);function Npe(e,t,n){return e===t||Ppe(e,t,n)&&e.content.eq(t.content)}function Ppe(e,t,n){const r=e.attrs,o=t.attrs,i={};for(const a of n)i[a]=null;e.attrs={...r,...i},t.attrs={...o,...i};const s=e.sameMarkup(t);return e.attrs=r,t.attrs=o,s}function oj(e){return typeof e=="number"?`${e}px`:e||void 0}var _pe=Object.defineProperty,jpe=Object.getOwnPropertyDescriptor,vE=(e,t,n,r)=>{for(var o=r>1?void 0:r?jpe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&_pe(t,n,o),o},Tpe=class extends Cpe{constructor(e,t,n){super({node:e,view:t,getPos:n,aspectRatio:A3.Fixed})}createElement({node:e}){const t=document.createElement("img");return t.setAttribute("src",e.attrs.src),$n(t,{width:"100%",minWidth:"50px",objectFit:"contain"}),t}},Bh=class extends Co{get name(){return"image"}createTags(){return[He.InlineNode,He.Media]}createNodeSpec(e,t){const{preferPastedTextContent:n}=this.options;return{inline:!0,draggable:!0,selectable:!1,...t,attrs:{...e.defaults(),alt:{default:""},crop:{default:null},height:{default:null},width:{default:null},rotate:{default:null},src:{default:null},title:{default:""},fileName:{default:null},resizable:{default:!1}},parseDOM:[{tag:"img[src]",getAttrs:r=>{var o;if(Ni(r)){const i=Mpe({element:r,parse:e.parse});return n&&((o=i.src)!=null&&o.startsWith("file:///"))?!1:i}return{}}},...t.parseDOM??[]],toDOM:r=>{const o=RL(r.attrs,e);return["img",{...e.dom(r),...o}]}}}insertImage(e,t){return({tr:n,dispatch:r})=>{const{from:o,to:i}=bo(t??n.selection,n.doc),s=this.type.create(e);return r==null||r(n.replaceRangeWith(o,i,s)),!0}}uploadImage(e,t){const{updatePlaceholder:n,destroyPlaceholder:r,createPlaceholder:o}=this.options;return i=>{const{tr:s}=i;let a=s.selection.from;return this.store.createPlaceholderCommand({promise:e,placeholder:{type:"widget",get pos(){return a},createElement:(l,c)=>{const u=o(l,c);return t==null||t(u),u},onUpdate:(l,c,u,f)=>{n(l,c,u,f)},onDestroy:(l,c)=>{r(l,c)}},onSuccess:(l,c,u)=>this.insertImage(l,c)(u)}).validate(({tr:l,dispatch:c})=>{const u=_D(l.doc,a,this.type);return u==null?!1:(a=u,l.selection.empty||c==null||c(l.deleteSelection()),!0)},"unshift").generateCommand()(i)}}fileUploadFileHandler(e,t,n){var c;const{preferPastedTextContent:r,uploadHandler:o}=this.options;if(r&&Ipe(t)&&((c=t.clipboardData)!=null&&c.getData("text/plain")))return!1;const{commands:i,chain:s}=this.store,a=e.map((u,f)=>({file:u,progress:h=>{i.updatePlaceholder(l[f],h)}})),l=o(a);Yr(n)&&s.selectText(n);for(const u of l)s.uploadImage(u);return s.run(),!0}createPasteRules(){return[{type:"file",regexp:/image/i,fileHandler:e=>{const t=e.type==="drop"?e.pos:void 0;return this.fileUploadFileHandler(e.files,e.event,t)}}]}createNodeViews(){return this.options.enableResizing?(e,t,n)=>new Tpe(e,t,n):{}}};vE([xe()],Bh.prototype,"insertImage",1);vE([xe()],Bh.prototype,"uploadImage",1);Bh=vE([st({defaultOptions:{createPlaceholder:Rpe,updatePlaceholder:()=>{},destroyPlaceholder:()=>{},uploadHandler:Ape,enableResizing:!1,preferPastedTextContent:!0}})],Bh);function Ope(e){let{width:t,height:n}=e.style;return t=t||e.getAttribute("width")||"",n=n||e.getAttribute("height")||"",{width:t,height:n}}function Mpe({element:e,parse:t}){const{width:n,height:r}=Ope(e);return{...t(e),alt:e.getAttribute("alt")??"",height:Number.parseInt(r||"0",10)||null,src:e.getAttribute("src")??null,title:e.getAttribute("title")??"",width:Number.parseInt(n||"0",10)||null,fileName:e.getAttribute("data-file-name")??null}}function Rpe(e,t){const n=document.createElement("div");return n.classList.add(tde.IMAGE_LOADER),n}function Ape(e){je(e.length>0,{code:re.EXTENSION,message:"The upload handler was applied for the image extension without any valid files"});let t=0;const n=[];for(const{file:r,progress:o}of e)n.push(()=>new Promise(i=>{const s=new FileReader;s.addEventListener("load",a=>{var l;t+=1,o(t/e.length),i({src:(l=a.target)==null?void 0:l.result,fileName:r.name})},{once:!0}),s.readAsDataURL(r)}));return n}function Ipe(e){return e.clipboardData!==void 0}function Dpe(e={}){return new gs({view(t){return new Lpe(t,e)}})}class Lpe{constructor(t,n){var r;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return t.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.handlers.forEach(({name:t,handler:n})=>this.editorView.dom.removeEventListener(t,n))}update(t,n){this.cursorPos!=null&&n.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,r;if(n){let a=t.nodeBefore,l=t.nodeAfter;if(a||l){let c=this.editorView.nodeDOM(this.cursorPos-(a?a.nodeSize:0));if(c){let u=c.getBoundingClientRect(),f=a?u.bottom:u.top;a&&l&&(f=(f+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:u.left,right:u.right,top:f-this.width/2,bottom:f+this.width/2}}}}if(!r){let a=this.editorView.coordsAtPos(this.cursorPos);r={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let o=this.editorView.dom.offsetParent;this.element||(this.element=o.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let i,s;if(!o||o==document.body&&getComputedStyle(o).position=="static")i=-pageXOffset,s=-pageYOffset;else{let a=o.getBoundingClientRect();i=a.left-o.scrollLeft,s=a.top-o.scrollTop}this.element.style.left=r.left-i+"px",this.element.style.top=r.top-s+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),t)}dragover(t){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,t):o;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=jD(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){(t.target==this.editorView.dom||!this.editorView.dom.contains(t.relatedTarget))&&this.setCursor(null)}}var Fpe=Object.defineProperty,zpe=Object.getOwnPropertyDescriptor,$pe=(e,t,n,r)=>{for(var o=r>1?void 0:r?zpe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Fpe(t,n,o),o},Jw=class extends Tt{get name(){return"dropCursor"}createExternalPlugins(){const{color:e,width:t}=this.options;return[Dpe({color:e,width:t})]}};Jw=$pe([st({defaultOptions:{color:"black",width:1}})],Jw);var Bpe=Object.defineProperty,Vpe=Object.getOwnPropertyDescriptor,I3=(e,t,n,r)=>{for(var o=r>1?void 0:r?Vpe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Bpe(t,n,o),o},{LABEL:Upe}=HQ,Wpe={icon:({attrs:e})=>`h${(e==null?void 0:e.level)??"1"}`,label:({t:e,attrs:t})=>e({...Upe,values:{level:t==null?void 0:t.level}})},Hpe=[oe.H1,oe.H2,oe.H3,oe.H4,oe.H5,oe.H6],wv=class extends Co{get name(){return"heading"}createTags(){return[He.Block,He.TextBlock,He.FormattingNode]}createNodeSpec(e,t){return{content:"inline*",defining:!0,draggable:!1,...t,attrs:{...e.defaults(),level:{default:this.options.defaultLevel}},parseDOM:[...this.options.levels.map(n=>({tag:`h${n}`,getAttrs:r=>({...e.parse(r),level:n})})),...t.parseDOM??[]],toDOM:n=>this.options.levels.includes(n.attrs.level)?[`h${n.attrs.level}`,e.dom(n),0]:[`h${this.options.defaultLevel}`,e.dom(n),0]}}toggleHeading(e={}){return DL({type:this.type,toggleType:"paragraph",attrs:e})}createKeymap(e){const t=this.store.getExtension(Ye),n=Se(),r=[];for(const o of this.options.levels){const i=Hpe[o-1]??oe.H1;n[i]=uv(this.type,{level:o}),r.push({attrs:{level:o},shortcut:e(i)[0]})}return t.updateDecorated("toggleHeading",{shortcut:r}),n}createInputRules(){return this.options.levels.map(e=>dee(new RegExp(`^(#{1,${e}})\\s$`),this.type,()=>({level:e})))}createPasteRules(){return this.options.levels.map(e=>({type:"node",nodeType:this.type,regexp:new RegExp(`^#{${e}}\\s([\\s\\w]+)$`),getAttributes:()=>({level:e}),startOfTextBlock:!0}))}};I3([xe(Wpe)],wv.prototype,"toggleHeading",1);wv=I3([st({defaultOptions:{levels:[1,2,3,4,5,6],defaultLevel:1},staticKeys:["defaultLevel","levels"]})],wv);var D3={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(typeof self<"u"?self:AF,function(){return function(n){function r(i){if(o[i])return o[i].exports;var s=o[i]={i,l:!1,exports:{}};return n[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}var o={};return r.m=n,r.c=o,r.d=function(i,s,a){r.o(i,s)||Object.defineProperty(i,s,{configurable:!1,enumerable:!0,get:a})},r.n=function(i){var s=i&&i.__esModule?function(){return i.default}:function(){return i};return r.d(s,"a",s),s},r.o=function(i,s){return Object.prototype.hasOwnProperty.call(i,s)},r.p="",r(r.s=0)}([function(n,r,o){function i(){throw new TypeError("The given URL is not a string. Please verify your string|array.")}function s(c){typeof c!="string"&&i();for(var u=0,f=0,h=0,p=c.length,m=0;p--&&++m&&!(u&&-1<a.indexOf(c[m]));)c[m]==="."&&(++u,f=m);for(u=m,m=f;m--;)if(l.indexOf(c[m])!==-1){h=m+1;break}return 2>h?"":c.slice(h,u)}var a=["/",":","?","#"],l=[".","/","@"];n.exports=function(c){if(typeof c=="string")return s(c);if(Array.isArray(c)){var u=[],f,h=0;for(f=c.length;h<f;h++)u.push(s(c[h]));return u}i()}}])})})(D3);var Kpe=D3.exports;const Gpe=Da(Kpe);var qpe=Object.defineProperty,Ype=Object.getOwnPropertyDescriptor,Tp=(e,t,n,r)=>{for(var o=r>1?void 0:r?Ype(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&qpe(t,n,o),o},Jpe=["com","de","net","org","uk","cn","ga","nl","cf","ml","tk","ru","br","gq","xyz","fr","eu","info","co","au","ca","it","in","ch","pl","es","online","us","top","be","jp","biz","se","at","dk","cz","za","me","ir","icu","shop","kr","site","mx","hu","io","cc","club","no","cyou"],ij="updateLink",Xpe=/(?:(?:(?:https?|ftp):)?\/\/)?(?:\S+(?::\S*)?@)?(?:(?:[\da-z\u00A1-\uFFFF][\w\u00A1-\uFFFF-]{0,62})?[\da-z\u00A1-\uFFFF]\.)*(?:(?:\d(?!\.)|[a-z\u00A1-\uFFFF])(?:[\da-z\u00A1-\uFFFF][\w\u00A1-\uFFFF-]{0,62})?[\da-z\u00A1-\uFFFF]\.)+[a-z\u00A1-\uFFFF]{2,}(?::\d{2,5})?(?:[#/?]\S*)?/gi,Gl=class extends Cp{constructor(){super(...arguments);Vt(this,"_autoLinkRegexNonGlobal")}get name(){return"link"}createTags(){return[He.Link,He.ExcludeInputRules]}createMarkSpec(t,n){const r="data-link-auto",o=i=>{const{defaultTarget:s,supportedTargets:a}=this.options,l=s?[...a,s]:a;return i&&ni(l,i)?{target:i}:void 0};return{inclusive:!1,excludes:"_",...n,attrs:{...t.defaults(),href:{},target:{default:this.options.defaultTarget},auto:{default:!1}},parseDOM:[{tag:"a[href]",getAttrs:i=>{if(!Ni(i))return!1;const s=i.getAttribute("href"),a=i.textContent,l=this.options.autoLink&&(i.hasAttribute(r)||s===a||(s==null?void 0:s.replace(`${this.options.defaultProtocol}//`,""))===a);return{...t.parse(i),href:s,auto:l,...o(i.getAttribute("target"))}}},...n.parseDOM??[]],toDOM:i=>{const{auto:s,target:a,...l}=RL(i.attrs,t),c=i.attrs.auto?{[r]:""}:{};return["a",{...t.dom(i),...l,rel:"noopener noreferrer nofollow",...c,...o(i.attrs.target)},0]}}}onCreate(){const{autoLinkRegex:t}=this.options;this._autoLinkRegexNonGlobal=new RegExp(`^${t.source}$`,t.flags.replace("g",""))}shortcut({tr:t}){let n="",{from:r,to:o,empty:i,$from:s}=t.selection,a=!1;const l=fs(s,this.type);if(i){const c=l??TL(t);if(!c)return!1;({text:n,from:r,to:o}=c),a=!0}return r===o?!1:(a||(n=t.doc.textBetween(r,o)),this.options.onActivateLink(n),this.options.onShortcut({activeLink:l?{attrs:l.mark.attrs,from:l.from,to:l.to}:void 0,selectedText:n,from:r,to:o}),!0)}updateLink(t,n){return r=>{const{tr:o}=r;return!(tc(o.selection)&&!Vk(o.selection)||Mne(o.selection)||cv({trState:o,type:this.type}))&&!n?!1:(o.setMeta(this.name,{command:ij,attrs:t,range:n}),Zne({type:this.type,attrs:t,range:n})(r))}}selectLink(){return this.store.commands.selectMark.original(this.type)}removeLink(t){return n=>{const{tr:r}=n;return cv({trState:r,type:this.type,...t})?FL({type:this.type,expand:!0,range:t})(n):!1}}createPasteRules(){return[{type:"mark",regexp:this.options.autoLinkRegex,markType:this.type,getAttributes:(t,n)=>({href:this.buildHref(Rf(t)),auto:!n}),transformMatch:t=>{const n=Rf(t);return!n||!this.isValidUrl(n)?!1:n}}]}createEventHandlers(){return{clickMark:(t,n)=>{const r=n.getMark(this.type);if(!r)return;const o=r.mark.attrs,i={...o,...r};if(this.options.onClick(t,i))return!0;if(!this.store.view.editable)return;let s=!1;if(this.options.openLinkOnClick){s=!0;const a=o.href;window.open(a,"_blank")}return this.options.selectTextOnClick&&(s=!0,this.store.commands.selectText(r)),s}}}createPlugin(){return{appendTransaction:(t,n,r)=>{if(t.filter(m=>!!m.getMeta(this.name)).forEach(m=>{const v=m.getMeta(this.name);if(v.command===ij){const{range:x,attrs:b}=v,{selection:w,doc:S}=r,C={range:x,selection:w,doc:S,attrs:b},{from:N,to:P}=x??w;this.options.onUpdateLink(S.textBetween(N,P),C)}}),!this.options.autoLink||Ww(n)-Ww(r)===1||!t.some(m=>m.docChanged))return;const a=xne(t,n),l=Lne(a,[Ht,pn]),{mapping:c}=a,{tr:u,doc:f}=r,{updateLink:h,removeLink:p}=this.store.chain(u);if(l.forEach(({prevFrom:m,prevTo:v,from:x,to:b})=>{const w=[],S=b-x===2,C=this.getLinkMarksInRange(n.doc,m,v,!0).filter(N=>N.mark.type===this.type).map(({from:N,to:P,text:_})=>({mappedFrom:c.map(N),mappedTo:c.map(P),text:_,from:N,to:P}));C.forEach(({mappedFrom:N,mappedTo:P,from:_,to:O},M)=>this.getLinkMarksInRange(f,N,P,!0).filter(D=>D.mark.type===this.type).forEach(D=>{const U=n.doc.textBetween(_,O,void 0," "),z=f.textBetween(D.from,D.to+1,void 0," ").trim(),H=this.isValidUrl(U);this.isValidUrl(z)||(H&&(p({from:D.from,to:D.to}).tr(),C.splice(M,1)),!S&&x===b&&this.findAutoLinks(z).map(V=>this.addLinkProperties({...V,from:N+V.start,to:N+V.end})).forEach(({attrs:V,range:I,text:A})=>{h(V,I).tr(),w.push({attrs:V,range:I,text:A})}))})),this.findTextBlocksInRange(f,{from:x,to:b}).forEach(({text:N,positionStart:P})=>{this.findAutoLinks(N).map(_=>this.addLinkProperties({..._,from:P+_.start+1,to:P+_.end+1})).filter(({range:_})=>{const O=x>=_.from&&x<=_.to,M=b>=_.from&&b<=_.to;return O||M||S}).filter(({range:_})=>this.getLinkMarksInRange(u.doc,_.from,_.to,!1).length===0).filter(({range:{from:_},text:O})=>!C.some(({text:M,mappedFrom:D})=>D===_&&M===O)).forEach(({attrs:_,text:O,range:M})=>{h(_,M).tr(),w.push({attrs:_,range:M,text:O})})}),window.requestAnimationFrame(()=>{w.forEach(({attrs:N,range:P,text:_})=>{const{doc:O,selection:M}=u;this.options.onUpdateLink(_,{attrs:N,doc:O,range:P,selection:M})})})}),u.steps.length!==0)return u}}}buildHref(t){return this.options.extractHref({url:t,defaultProtocol:this.options.defaultProtocol})}getLinkMarksInRange(t,n,r,o){const i=[];if(n===r){const s=Math.max(n-1,0),a=t.resolve(s),l=fs(a,this.type);(l==null?void 0:l.mark.attrs.auto)===o&&i.push(l)}else t.nodesBetween(n,r,(s,a)=>{const c=(s.marks??[]).find(({type:u,attrs:f})=>u===this.type&&f.auto===o);c&&i.push({from:a,to:a+s.nodeSize,mark:c,text:s.textContent})});return i}findTextBlocksInRange(t,n){const r=[];return t.nodesBetween(n.from,n.to,(o,i)=>{!o.isTextblock||!o.type.allowsMarkType(this.type)||r.push({node:o,pos:i})}),r.map(o=>({text:t.textBetween(o.pos,o.pos+o.node.nodeSize,void 0," "),positionStart:o.pos}))}addLinkProperties({from:t,to:n,href:r,...o}){return{...o,range:{from:t,to:n},attrs:{href:r,auto:!0}}}findAutoLinks(t){if(this.options.findAutoLinks)return this.options.findAutoLinks(t,this.options.defaultProtocol);const n=[];for(const r of jy(t,this.options.autoLinkRegex)){const o=Rf(r);if(!o)continue;const i=this.buildHref(o);!this.isValidTLD(i)&&!i.startsWith("tel:")||n.push({text:o,href:i,start:r.index,end:r.index+o.length})}return n}isValidUrl(t){var n;return this.options.isValidUrl?this.options.isValidUrl(t,this.options.defaultProtocol):this.isValidTLD(this.buildHref(t))&&!!((n=this._autoLinkRegexNonGlobal)!=null&&n.test(t))}isValidTLD(t){const{autoLinkAllowedTLDs:n}=this.options;if(n.length===0)return!0;const r=Gpe(t);if(r==="")return!0;const o=TZ(r.split("."));return n.includes(o)}};Tp([to({shortcut:oe.InsertLink})],Gl.prototype,"shortcut",1);Tp([xe()],Gl.prototype,"updateLink",1);Tp([xe()],Gl.prototype,"selectLink",1);Tp([xe()],Gl.prototype,"removeLink",1);Gl=Tp([st({defaultOptions:{autoLink:!1,defaultProtocol:"",selectTextOnClick:!1,openLinkOnClick:!1,autoLinkRegex:Xpe,autoLinkAllowedTLDs:Jpe,findAutoLinks:void 0,isValidUrl:void 0,defaultTarget:null,supportedTargets:[],extractHref:Zpe},staticKeys:["autoLinkRegex"],handlerKeyOptions:{onClick:{earlyReturnValue:!0}},handlerKeys:["onActivateLink","onShortcut","onUpdateLink","onClick"],defaultPriority:mt.Medium})],Gl);function Zpe({url:e,defaultProtocol:t}){const n=/^((?:https?|ftp)?:)\/\//.test(e);return!n&&e.includes("@")?`mailto:${e}`:n?e:`${t}//${e}`}var Qpe=Object.defineProperty,eme=Object.getOwnPropertyDescriptor,L3=(e,t,n,r)=>{for(var o=r>1?void 0:r?eme(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Qpe(t,n,o),o},Sv=class extends Co{get name(){return"hardBreak"}createTags(){return[He.InlineNode]}createNodeSpec(e,t){return{inline:!0,selectable:!1,atom:!0,leafText:()=>`
|
|
524
|
-
`,...t,attrs:e.defaults(),parseDOM:[{tag:"br",getAttrs:e.parse},...t.parseDOM??[]],toDOM:n=>["br",e.dom(n)]}}createKeymap(){const e=yne(Mf(UL),()=>(this.store.commands.insertHardBreak(),!0));return{"Mod-Enter":e,"Shift-Enter":e}}insertHardBreak(){return e=>{const{tr:t,dispatch:n}=e;return n==null||n(t.replaceSelectionWith(this.type.create()).scrollIntoView()),!0}}};L3([xe()],Sv.prototype,"insertHardBreak",1);Sv=L3([st({defaultPriority:mt.Low})],Sv);const tme=()=>[new Kl({}),new zh,new $h,new Bh({enableResizing:!1}),new Jw({}),new wv({levels:[1,2,3,4,5,6],defaultLevel:1}),new Ih({}),new Dh,new Gl({autoLink:!0}),new Sv].slice();function nme(e){const{manager:t,state:n,setState:r}=ofe({extensions:tme,content:e,selection:"start"});return{manager:t,state:n,setState:r}}function rme({initialContent:e,state:t,manager:n,options:r,onChange:o,onFocus:i,debug:s,disabled:a,autoFocus:l}){const c=r&&Object.entries(r).some(([,p])=>p),[u,f]=g.useState(c),h=g.useMemo(()=>[Ce("p-4 outline-none focus:outline-none appearance-none bg-bg-primary rounded-b-md")],[u]);return d.jsx("div",{autoFocus:l,onFocus:()=>{i&&i(!0)},onBlur:()=>{i&&i(!1)},className:Ce("relative text-base m-1 val-rich-text-editor focus-within:outline-none focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 border border-input rounded-md"),children:d.jsxs(sfe,{manager:n,initialContent:e,state:t,classNames:h,onChange:o,editable:!a,children:[d.jsx(ome,{hasOptions:c,options:r,debug:s,setShowToolbar:f}),d.jsx(Kw,{})]})})}const ome=({options:e,hasOptions:t,debug:n,setShowToolbar:r})=>{var l,c,u,f,h,p,m,v,x,b,w,S,C,N,P,_,O,M,D,U,z,H,K,V,I,A,j,L;const o=C4(),i=qde(),s=t||i.heading()||i.image()||i.link()||i.bulletList()||i.orderedList()||i.bold()||i.italic()||i.strike();g.useEffect(()=>{r(s)},[s]);const a=g.useRef(null);return d.jsxs("div",{children:[d.jsx("div",{className:"h-0",ref:a}),d.jsxs("div",{className:Ce("sticky top-0 flex flex-col py-2 z-[40] divide-y rounded-md rounded-b-none border-b border-input bg-primary-foreground",{hidden:!s}),children:[d.jsx("div",{className:"flex items-center justify-between",children:d.jsxs("div",{className:"flex flex-row items-center justify-start px-4 py-1 gap-x-3",children:[(((l=e==null?void 0:e.block)==null?void 0:l.h1)||((c=e==null?void 0:e.block)==null?void 0:c.h2)||((u=e==null?void 0:e.block)==null?void 0:u.h3)||((f=e==null?void 0:e.block)==null?void 0:f.h4)||((h=e==null?void 0:e.block)==null?void 0:h.h5)||((p=e==null?void 0:e.block)==null?void 0:p.h6)||i.heading())&&d.jsxs(rpe,{children:[d.jsx(ope,{asChild:!0,className:"pr-4",children:d.jsxs("button",{children:[i.heading({level:1})&&d.jsx(EN,{size:22}),i.heading({level:2})&&d.jsx(CN,{size:22}),i.heading({level:3})&&d.jsx(NN,{size:22}),i.heading({level:4})&&d.jsx(PN,{size:22}),i.heading({level:5})&&d.jsx(_N,{size:22}),i.heading({level:6})&&d.jsx(jN,{size:22}),!i.heading()&&"Normal"]})}),d.jsxs(R3,{container:a.current,children:[d.jsx(Ls,{onClick:()=>{o.setBlockNodeType("paragraph").focus().run()},children:"Normal"}),((m=e==null?void 0:e.block)==null?void 0:m.h1)&&d.jsx(Ls,{onClick:()=>{o.setBlockNodeType("heading",{level:1}).focus().run()},children:d.jsx(EN,{size:16})}),((v=e==null?void 0:e.block)==null?void 0:v.h2)&&d.jsx(Ls,{onClick:()=>{o.setBlockNodeType("heading",{level:2}).focus().run()},children:d.jsx(CN,{size:16})}),((x=e==null?void 0:e.block)==null?void 0:x.h3)&&d.jsx(Ls,{onClick:()=>{o.setBlockNodeType("heading",{level:3}).focus().run()},children:d.jsx(NN,{size:16})}),((b=e==null?void 0:e.block)==null?void 0:b.h4)&&d.jsx(Ls,{onClick:()=>{o.setBlockNodeType("heading",{level:4}).focus().run()},children:d.jsx(PN,{size:16})}),((w=e==null?void 0:e.block)==null?void 0:w.h5)&&d.jsx(Ls,{onClick:()=>{o.setBlockNodeType("heading",{level:5}).focus().run()},children:d.jsx(_N,{size:16})}),((S=e==null?void 0:e.block)==null?void 0:S.h6)&&d.jsx(Ls,{onClick:()=>{o.setBlockNodeType("heading",{level:6}).focus().run()},children:d.jsx(jN,{size:16})})]})]}),(((C=e==null?void 0:e.style)==null?void 0:C.bold)||i.bold())&&d.jsx(yc,{icon:d.jsx(K7,{size:18}),stroke:3,isOption:(N=e==null?void 0:e.style)==null?void 0:N.bold,isActive:((P=e==null?void 0:e.style)==null?void 0:P.bold)||i.bold(),onToggle:()=>o.toggleBold().focus().run()}),(((_=e==null?void 0:e.style)==null?void 0:_.lineThrough)||i.strike())&&d.jsx(yc,{icon:d.jsx(SK,{size:18}),stroke:3,isOption:(O=e==null?void 0:e.style)==null?void 0:O.lineThrough,isActive:((M=e==null?void 0:e.style)==null?void 0:M.lineThrough)||i.strike(),onToggle:()=>o.toggleStrike().focus().run()}),(((D=e==null?void 0:e.style)==null?void 0:D.italic)||i.italic())&&d.jsx(yc,{icon:d.jsx(aK,{size:18}),stroke:3,isOption:(U=e==null?void 0:e.style)==null?void 0:U.italic,isActive:((z=e==null?void 0:e.style)==null?void 0:z.italic)||i.italic(),onToggle:()=>o.toggleItalic().focus().run()}),(((H=e==null?void 0:e.block)==null?void 0:H.ul)||i.bulletList())&&d.jsx(yc,{icon:d.jsx(s2,{size:18}),stroke:3,isActive:((K=e==null?void 0:e.block)==null?void 0:K.ul)||i.bulletList(),onToggle:()=>o.toggleBulletList().focus().run()}),(((V=e==null?void 0:e.block)==null?void 0:V.ol)||i.orderedList())&&d.jsx(yc,{icon:d.jsx(uK,{size:18}),stroke:3,isActive:((I=e==null?void 0:e.block)==null?void 0:I.ol)||i.orderedList(),onToggle:()=>o.toggleOrderedList().focus().run()}),(((A=e==null?void 0:e.inline)==null?void 0:A.a)||i.link())&&d.jsx(yc,{icon:d.jsx(BS,{size:18}),stroke:3,isActive:((j=e==null?void 0:e.inline)==null?void 0:j.a)||i.link(),onToggle:()=>o.selectMark("link").updateLink({href:""}).focus().run()}),(((L=e==null?void 0:e.inline)==null?void 0:L.img)||i.image())&&d.jsxs("label",{className:"cursor-pointer",htmlFor:"val-toolbar-image-select",children:[d.jsx("input",{hidden:!0,id:"val-toolbar-image-select",accept:"image/*",type:"file",onChange:$=>{DI($).then(W=>{o.insertImage({src:W.src,width:W.width,height:W.height,fileName:Y.createFilename(W.src,W.filename??null,{width:W.width,height:W.height,mimeType:W.mimeType},W.fileHash)??void 0}).focus().run(),$.target.value=""})}}),d.jsx(i2,{size:18,className:`${i.image()&&"stroke-[3px]"}`})]}),n&&d.jsx("button",{onMouseDown:$=>$.preventDefault(),onClick:()=>o.insertHardBreak().run(),children:"Br"})]})}),d.jsx(ime,{})]})]})};function ime(){const e=C4(),[t,n]=g.useState(),r=Yde().link();return g.useEffect(()=>{const i=typeof r=="object"&&"href"in r&&typeof r.href=="string"?r.href:void 0;n(i)},[r==null?void 0:r.href]),r!==void 0?d.jsxs("div",{className:"flex items-center justify-start px-4 pt-1 gap-x-2",children:[d.jsx("input",{className:"bg-transparent text-accent",onChange:i=>{n(i.target.value)},defaultValue:t,placeholder:"https://"}),d.jsx("button",{className:"p-2",title:"Update",disabled:t===void 0,onClick:()=>{t!==void 0&&e.selectMark("link").updateLink({href:t}).focus().run()},children:d.jsx(Yu,{size:14})}),d.jsx("button",{className:"p-2",title:"Remove",onClick:()=>{e.removeLink().focus().run()},children:d.jsx(_K,{size:13})})]}):null}function yc({stroke:e,isActive:t,onToggle:n,icon:r}){return d.jsx("button",{className:Ce({"text-accent":t,"stroke-[2px]":t&&e===2,"stroke-[3px]":t&&e===3}),onClick:o=>{o.preventDefault(),n()},children:r})}function sme({path:e,autoFocus:t}){const n="richtext",r=Gu(),o=Ft(e),i=lt(e,n),s=RS(),a=AS(),l="data"in i?i.data:void 0,{manager:c}=nme(l&&Yp(l)),u=g.useRef(!1),{patchPath:f,addPatch:h,addAndUploadPatchWithFileOps:p}=bn(e),[m,v]=g.useState(c.createState({content:l?Yp(l):void 0})),x="data"in i&&i.data,b="clientSideOnly"in i&&i.clientSideOnly;g.useEffect(()=>{b===!1&&v(C=>{try{const N=x?Yp(x):void 0,P=c.createState({content:N,selection:C.selection});return P.doc.eq(C.doc)?C:P}catch(N){return console.error("Error (re)creating editor state with selection, retrying without...",N),c.createState({content:x?Yp(x):void 0})}})},[x,b]);const w=g.useMemo(()=>{var N,P;if(!("data"in o&&o.data.type==="richtext"))return null;const C=o.data;return typeof((P=(N=C.options)==null?void 0:N.inline)==null?void 0:P.img)=="object"&&C.options.inline.img.remote&&s.status==="ready"&&(r!=null&&r.remoteHost)&&a?{publicProjectId:s.publicProjectId,bucket:a,coreVersion:s.coreVersion,schema:C.options.inline.img,remoteHost:r==null?void 0:r.remoteHost}:null},[o,s,r,a]);if(o.status==="error")return d.jsx(Xt,{path:e,error:o.error,type:n});if(i.status==="error")return d.jsx(it,{path:e,error:i.error,schema:o});if(i.status=="not-found"||o.status==="not-found")return d.jsx(Mn,{path:e,type:n});if(o.status==="loading")return d.jsx(yt,{path:e,type:n});if(!("data"in i)||i.data===void 0)return d.jsx(yt,{path:e,type:n});if(o.data.type!==n)return d.jsx(kr,{path:e,expectedType:n,actualType:o.data.type});const S=o.data;return r!=null&&r.remoteHost||console.warn("RichTextField: config.remoteHost is not set. Remote images will not work."),d.jsxs("div",{id:e,children:[d.jsx(qr,{path:e}),d.jsx(rme,{autoFocus:t,disabled:u.current,state:m,options:S.options,manager:c,onChange:async C=>{var P;const N=m==null?void 0:m.doc;if(!u.current&&(v(C.state),N&&!C.state.doc.eq(N))){const _=ame(f,((P=r==null?void 0:r.files)==null?void 0:P.directory)??"/public/val",C.state.doc.toJSON(),w);_.some(O=>O.op==="file")?(u.current=!0,await p(_,"image",O=>{alert("Error uploading image. Please try again later."),console.error("Error uploading image",O)},(O,M,D,U)=>{console.log(`Uploading ${O}/${M} (${D}/${U})`)}).finally(()=>{u.current=!1})):h(_,"richtext")}}})]})}function ame(e,t,n,r){const{blocks:o,files:i}=n?GB(n,t,r):{blocks:[],files:{}};return[{op:"replace",path:e,value:o},...Object.values(i).flatMap(({value:s,filePathOrRef:a,metadata:l,patchPaths:c})=>c.map(u=>({op:"file",path:e,filePath:a,value:s,metadata:l,nestedFilePath:u,remote:!!r})))]}function lme({path:e}){const t=lt(e,"richtext");if(t.status==="error")return d.jsx(it,{path:e,error:t.error});if(t.status=="not-found")return d.jsx(Mn,{path:e,type:"richtext"});if(!("data"in t)||t.data===void 0)return d.jsx(wr,{path:e});if(t.data===null)return d.jsx(Sr,{path:e});const n=cme(t.data);return n.status==="error"?d.jsx(it,{path:e,error:n.error}):d.jsx("div",{className:"truncate",children:n.value})}function cme(e){let t;function n(o){if(t)return t;if(typeof o=="string")return o;if(typeof o=="object"&&o){if("children"in o&&Array.isArray(o.children))return o.children.map(n).join(" ");if("tag"in o&&typeof o.tag=="string")return""}return t="Invalid richtext node: "+JSON.stringify(o),JSON.stringify(o)}const r=e.map(n).join(" ");return t?{status:"error",error:t}:{status:"ok",value:r}}function yE({path:e}){const t=Ft(e),n=lt(e,"data"in t&&t.data.type?t.data.type:void 0);if(!("data"in t)||t.data===void 0)return d.jsx(wr,{path:e});const r=t.data.type;if("data"in n&&n.data===null)return d.jsx(Sr,{path:e});if(r==="string")return d.jsx(AJ,{path:e});if(r==="array")return d.jsx(mme,{path:e});if(r==="boolean")return d.jsx(LJ,{path:e});if(r==="number")return d.jsx(zJ,{path:e});if(r==="union")return d.jsx(CX,{path:e});if(r==="object")return d.jsx(bX,{path:e});if(r==="image")return d.jsx(RX,{path:e});if(r==="keyOf")return d.jsx(DX,{path:e});if(r==="date")return d.jsx(FX,{path:e});if(r==="literal")return d.jsx(zX,{path:e});if(r==="record")return d.jsx(WX,{path:e});if(r==="richtext")return d.jsx(lme,{path:e});if(r==="file")return d.jsx(TX,{path:e});{const o=r;return d.jsxs("div",{children:["Cannot preview: ",o]})}}function wr({path:e}){return d.jsx("div",{id:e,children:d.jsx(Gr,{size:12,className:"animate-spin"})},e+"-loading")}function Sr({path:e}){return d.jsx("div",{id:e,className:"text-fg-quaternary",children:"<empty>"},e+"-null")}function ume({source:e,render:t,path:n,schema:r,disabled:o,onClick:i,onMove:s,onDelete:a,onDuplicate:l}){const[c,u]=g.useState([]);g.useEffect(()=>{const p=[];let m=1;for(const v of e)p.push({path:v,id:m}),m++;u(p)},[e,n]);const f=cY(r0(BA),r0(VA),r0(pk,{coordinateGetter:MJ})),h=g.useCallback(p=>{const{active:m,over:v}=p;if((m==null?void 0:m.id)!==(v==null?void 0:v.id)){const x=c.findIndex(w=>w.id===Number(m==null?void 0:m.id)),b=c.findIndex(w=>w.id===Number(v==null?void 0:v.id));u(w=>gk(w,x,b)),s(x,b)}},[c]);return d.jsx(cJ,{sensors:f,collisionDetection:dY,onDragEnd:h,children:d.jsx(SJ,{items:c,strategy:bJ,disabled:o,children:d.jsx("div",{className:"flex flex-col gap-y-4 w-full",children:c.map(({path:p,id:m})=>d.jsx(dme,{id:m,schema:r,disabled:o,renderLayout:t==null?void 0:t.layout,render:t==null?void 0:t.items[m-1],path:p,onClick:i,onDelete:v=>{a(v-1)},onDuplicate:v=>{l(v-1)}},m))})})})}const sj=170;function dme({id:e,path:t,schema:n,disabled:r,render:o,onClick:i,onDelete:s,onDuplicate:a}){var C,N,P;const l=In(),c=g.useRef(null),[u,f]=g.useState(!1);g.useEffect(()=>{c.current&&(c.current.getBoundingClientRect().height>=sj?f(!0):f(!1))},[e,t]);const{attributes:h,listeners:p,setNodeRef:m,transform:v,transition:x}=jJ({id:e,disabled:r===!0}),b=Ql()||{},w={transform:yh.Transform.toString(v),transition:x},S=!(((C=b[t])==null?void 0:C.length)>0);return d.jsxs("div",{"touch-action":"manipulation",ref:m,style:w,className:fe("relative flex disabled:opacity-55 flex-1",{"items-start":!S,"items-center":S}),children:[d.jsx("button",{...h,...p,className:fe("pb-1 pr-2",{"opacity-30":r,"mt-2.5":!S}),disabled:r,onClick:()=>{i(t)},children:d.jsx(iK,{})}),!o&&((N=n==null?void 0:n.item)==null?void 0:N.type)==="string"&&d.jsxs("div",{className:fe("flex-grow w-full",{"p-2 border border-bg-error-secondary rounded-lg":!!b[t]}),children:[d.jsx(ZA,{path:t}),b[t]&&d.jsx("div",{className:"px-2",children:d.jsx(wk,{validationErrors:b[t]})})]}),(o||((P=n==null?void 0:n.item)==null?void 0:P.type)!=="string")&&d.jsxs("button",{className:fe("flex-grow","relative flex text-left border rounded-lg border-border bg-card gap-y-2 bg-bg-primary","hover:bg-bg-secondary-hover","overflow-y-clip"),style:{maxHeight:sj},ref:c,disabled:r,onClick:()=>{i(t)},children:[o&&d.jsx(fme,{...o}),!o&&d.jsx("div",{className:"flex-grow p-4 w-full",children:d.jsx(yE,{path:t})}),u&&d.jsx("div",{className:"absolute bottom-0 left-0 w-full bg-gradient-to-b via-50% from-transparent via-card/90 to-card",style:{height:40}})]}),zI(t,b)&&d.jsx("div",{className:fe("absolute right-3",{"top-2":S,"top-0":!S}),children:d.jsx($I,{})}),d.jsxs(br,{children:[d.jsx(xo,{className:fe("flex hover:bg-bg-secondary-hover px-2 hover:rounded-lg",{"items-start mt-4":!S,"items-center py-2":S}),children:d.jsx(tK,{size:16})}),d.jsxs(tr,{className:"p-2",container:l,side:"top",children:[d.jsxs("button",{className:fe("flex items-center gap-x-2"),onClick:()=>{s(e)},children:[d.jsx("span",{children:d.jsx(US,{className:"w-4 h-4"})}),d.jsx("span",{children:"Delete"})]}),d.jsxs("button",{className:fe("flex items-center gap-x-2"),onClick:()=>{a(e)},children:[d.jsx("span",{children:d.jsx(Q7,{className:"w-4 h-4"})}),d.jsx("span",{children:"Duplicate"})]})]})]})]})}function fme({title:e,image:t,subtitle:n}){return d.jsxs("div",{className:fe("flex w-full items-center justify-between pl-4 flex-grow"),children:[d.jsxs("div",{className:"flex flex-col flex-shrink py-4 overflow-x-clip",children:[d.jsx("div",{className:"text-lg font-medium",children:e}),n&&d.jsx("div",{className:"block overflow-hidden flex-shrink max-h-5 text-sm text-gray-500 text-ellipsis",children:n})]}),t&&d.jsx(hme,{src:t,alt:e})]})}function hme({src:e,alt:t}){var i;const[n,r]=g.useState(!1);if(e==null)return d.jsx("div",{className:"flex-shrink-0 ml-4 w-20 h-20 opacity-25 bg-bg-brand-secondary"});const o=e[De]==="file"?Y.convertFileSource(e).url:Y.convertRemoteSource(e).url;return d.jsxs("div",{className:"relative flex-shrink-0 ml-4 w-20 h-20",children:[!n&&d.jsx("div",{className:"absolute inset-0 opacity-25 bg-bg-brand-secondary animate-in"}),d.jsx("img",{src:o,alt:t,onLoad:()=>r(!0),onError:()=>r(!1),className:`absolute inset-0 object-cover w-full h-full rounded-r-lg ${n?"opacity-100":"opacity-0"}`,style:{objectPosition:(i=e.metadata)!=null&&i.hotspot?`${e.metadata.hotspot.x}% ${e.metadata.hotspot.y}%`:"",transition:"opacity 0.2s ease-in-out"}})]})}function pme({path:e}){const t="array",{navigate:n}=xn(),r=Ft(e),o=GR(e),i=lt(e,t),s=zS(e),{addPatch:a,patchPath:l}=bn(e);if(r.status==="error")return d.jsx(Xt,{path:e,error:r.error,type:t});if(i.status==="error")return d.jsx(it,{path:e,error:i.error,schema:r});if(i.status=="not-found"||r.status==="not-found")return d.jsx(Mn,{path:e,type:t});if(r.status==="loading")return d.jsx(yt,{path:e,type:t});if(r.data.type!=="array")return d.jsx(kr,{path:e,expectedType:"array",actualType:r.data.type});const c=r.data,u=o&&"data"in o?o.data:void 0,f=u&&(i.status==="success"&&i.clientSideOnly||i.status==="loading");return d.jsxs("div",{id:e,className:"relative w-full",children:[d.jsx(qr,{path:e}),(o==null?void 0:o.status)==="error"&&d.jsx(BI,{error:o.message,path:e}),f&&d.jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-bg-disabled z-[40] opacity-40",children:d.jsx(Gr,{className:"animate-spin"})}),d.jsx(ume,{path:e,disabled:f,onClick:h=>{n(h)},onDelete:async h=>{a([{op:"remove",path:l.concat(h.toString())}],c.type)},onDuplicate:async h=>{var p;"data"in s&&s.data&&Array.isArray(s.data)&&a([{op:"add",path:l.concat(h.toString()),value:((p=s.data)==null?void 0:p[h])??null}],c.type)},onMove:async(h,p)=>{a([{op:"move",from:l.concat(h.toString()),path:l.concat(p.toString())}],c.type)},schema:c,render:(u==null?void 0:u.layout)==="list"&&u.parent==="array"?u:void 0,source:i.data||[]})]})}function mme({path:e}){const t=lt(e,"array");return t.status==="error"?d.jsx(it,{path:e,error:t.error}):!("data"in t)||t.data===void 0?d.jsx(wr,{path:e}):t.data===null?d.jsx(Sr,{path:e}):d.jsx("div",{children:`${t.data.length} items`})}function Yy({path:e,schema:t,autoFocus:n}){if(t.type==="string")return d.jsx(ZA,{path:e,autoFocus:n},e);if(t.type==="number")return d.jsx(FJ,{path:e},e);if(t.type==="boolean")return d.jsx(IJ,{path:e},e);if(t.type==="image")return d.jsx(OX,{path:e},e);if(t.type==="object")return d.jsx(xX,{path:e},e);if(t.type==="array")return d.jsx(pme,{path:e},e);if(t.type==="record")return d.jsx($X,{path:e},e);if(t.type==="union")return d.jsx(SX,{path:e},e);if(t.type==="keyOf")return d.jsx(AX,{path:e},e);if(t.type==="richtext")return d.jsx(sme,{path:e,autoFocus:n},e);if(t.type==="date")return d.jsx(LX,{path:e},e);if(t.type==="file")return d.jsx(jX,{path:e},e);if(t.type==="literal")return d.jsx(Xt,{path:e,error:"Literal fields are not editable"});{const r=t;return d.jsx(Xt,{path:e,error:"Unexpected field schema: "+JSON.stringify(r)})}}function gme({path:e}){const t=Ft(e),{path:n,schema:r}=TI(e),{navigate:o}=xn(),i=FS(),s=Ba(),a=qR(e),l=g.useCallback(v=>{if("data"in s){const x=s.data,b=kA(v,i,x);b?o(b):(o(v),console.error(`Error navigating to path: ${v} - no schemas found`))}else console.warn("Schemas not loaded yet"),o(v)},[s,i,o]);if(t.status==="error")return d.jsx(Xt,{path:e,error:t.error,type:"module"});if(t.status==="loading")return d.jsx(yt,{path:e,type:"module"});if(t.status==="not-found")return d.jsx(Mn,{path:e,type:"module"});const c=t.data,u=MI(e),f=u.slice(0,-1),h=u[u.length-1],p=mX(e,n,r),m=Om(e,n,r);return d.jsxs("div",{className:"flex flex-col gap-6 pt-4 pb-40",children:[d.jsxs("div",{className:"flex flex-col gap-2 text-left",children:[u.length>1&&d.jsx("div",{className:"inline-flex items-center text-sm text-fg-quaternary",children:f.map((v,x)=>x<f.length-1?d.jsxs(g.Fragment,{children:[d.jsx("button",{onClick:()=>{l(v.sourcePath)},children:v.text}),d.jsx("span",{children:d.jsx(Xu,{size:16})})]},x):d.jsx("button",{onClick:()=>{l(v.sourcePath)},children:v.text},x))}),d.jsx("div",{children:d.jsxs("div",{className:"flex gap-4 justify-between items-center h-6 text-xl",children:[!p&&d.jsx("span",{children:d.jsx("span",{children:h.text})}),p&&d.jsxs("span",{children:["#",Number(h.text)]}),d.jsx(OI,{path:e,variant:"module"})]})})]}),d.jsxs("div",{children:[m&&a.length>0&&d.jsx(wk,{validationErrors:a}),d.jsx("div",{className:fe({"border rounded-lg border-bg-error-secondary p-4 mt-4":a.length>0}),children:d.jsx(Yy,{path:e,schema:c},e)})]})]})}function vme(){const e=j7(),t=$7();return d.jsxs(d.Fragment,{children:[d.jsx(yme,{}),d.jsxs(hr,{viewportId:"val-content-area",children:[t!==null&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"w-full h-16"}),d.jsxs("div",{className:"absolute w-full h-16 top-0 p-4 text-center text-fg-error-primary bg-bg-error-primary z-[50]",children:[t.type==="network-error"&&"Network error - retrying...",t.type==="remote-files-error"&&t.error]})]}),d.jsx("div",{className:"max-h-[calc(100svh-64px)] max-w-[800px] px-4 mx-auto",children:e==="service-unavailable"?d.jsxs("div",{className:"p-8 mt-20 text-center text-fg-error-primary bg-bg-error-primary",children:[d.jsx("p",{children:"Could not connect to the content service."}),d.jsx("p",{children:"Please try again later"})]}):d.jsx(xme,{})})]})]})}function yme(){const{navMenu:e,toolsMenu:t}=Jy();return d.jsxs("div",{className:"flex justify-between items-center px-4 w-full h-16 border-b border-border-primary",children:[d.jsx("button",{className:Ce({"ml-[calc(320px+0.5rem)] xl:ml-0":e.isOpen,"hidden lg:inline":e.isOpen||t.isOpen}),onClick:()=>e.setOpen(!e.isOpen),children:d.jsx(Ag,{size:16,className:Ce("transform",{"rotate-180":!e.isOpen})})}),d.jsx("button",{className:Ce({"mr-[calc(320px+0.5rem)] xl:mr-0":t.isOpen,"hidden lg:inline":e.isOpen||t.isOpen}),onClick:()=>t.setOpen(!t.isOpen),children:d.jsx(Ag,{size:16,className:Ce("transform",{"rotate-180":t.isOpen})})})]})}function xme(){const{currentSourcePath:e}=xn(),t=e;return d.jsx(gme,{path:t})}var xE="Dialog",[F3,kge]=So(xE),[bme,ii]=F3(xE),z3=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!0}=e,a=g.useRef(null),l=g.useRef(null),[c=!1,u]=Kr({prop:r,defaultProp:o,onChange:i});return d.jsx(bme,{scope:t,triggerRef:a,contentRef:l,contentId:Vr(),titleId:Vr(),descriptionId:Vr(),open:c,onOpenChange:u,onOpenToggle:g.useCallback(()=>u(f=>!f),[u]),modal:s,children:n})};z3.displayName=xE;var $3="DialogTrigger",wme=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ii($3,n),i=Be(t,o.triggerRef);return d.jsx(Oe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":kE(o.open),...r,ref:i,onClick:ne(e.onClick,o.onOpenToggle)})});wme.displayName=$3;var bE="DialogPortal",[Sme,B3]=F3(bE,{forceMount:void 0}),V3=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=ii(bE,t);return d.jsx(Sme,{scope:t,forceMount:n,children:g.Children.map(r,s=>d.jsx(ln,{present:n||i.open,children:d.jsx(Hu,{asChild:!0,container:o,children:s})}))})};V3.displayName=bE;var kv="DialogOverlay",U3=g.forwardRef((e,t)=>{const n=B3(kv,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=ii(kv,e.__scopeDialog);return i.modal?d.jsx(ln,{present:r||i.open,children:d.jsx(kme,{...o,ref:t})}):null});U3.displayName=kv;var kme=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ii(kv,n);return d.jsx(cp,{as:ls,allowPinchZoom:!0,shards:[o.contentRef],children:d.jsx(Oe.div,{"data-state":kE(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),ql="DialogContent",W3=g.forwardRef((e,t)=>{const n=B3(ql,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=ii(ql,e.__scopeDialog);return d.jsx(ln,{present:r||i.open,children:i.modal?d.jsx(Eme,{...o,ref:t}):d.jsx(Cme,{...o,ref:t})})});W3.displayName=ql;var Eme=g.forwardRef((e,t)=>{const n=ii(ql,e.__scopeDialog),r=g.useRef(null),o=Be(t,n.contentRef,r);return g.useEffect(()=>{const i=r.current;if(i)return fy(i)},[]),d.jsx(H3,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ne(e.onCloseAutoFocus,i=>{var s;i.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:ne(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&i.preventDefault()}),onFocusOutside:ne(e.onFocusOutside,i=>i.preventDefault())})}),Cme=g.forwardRef((e,t)=>{const n=ii(ql,e.__scopeDialog),r=g.useRef(!1),o=g.useRef(!1);return d.jsx(H3,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,a;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;((c=n.triggerRef.current)==null?void 0:c.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),H3=g.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...s}=e,a=ii(ql,n),l=g.useRef(null),c=Be(t,l);return dy(),d.jsxs(d.Fragment,{children:[d.jsx(lp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:d.jsx(Xl,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":kE(a.open),...s,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),d.jsxs(d.Fragment,{children:[d.jsx(Nme,{titleId:a.titleId}),d.jsx(_me,{contentRef:l,descriptionId:a.descriptionId})]})]})}),wE="DialogTitle",SE=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ii(wE,n);return d.jsx(Oe.h2,{id:o.titleId,...r,ref:t})});SE.displayName=wE;var K3="DialogDescription",G3=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ii(K3,n);return d.jsx(Oe.p,{id:o.descriptionId,...r,ref:t})});G3.displayName=K3;var q3="DialogClose",Y3=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ii(q3,n);return d.jsx(Oe.button,{type:"button",...r,ref:t,onClick:ne(e.onClick,()=>o.onOpenChange(!1))})});Y3.displayName=q3;function kE(e){return e?"open":"closed"}var J3="DialogTitleWarning",[Ege,X3]=eW(J3,{contentName:ql,titleName:wE,docsSlug:"dialog"}),Nme=({titleId:e})=>{const t=X3(J3),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
525
|
-
|
|
526
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
527
|
-
|
|
528
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return g.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Pme="DialogDescriptionWarning",_me=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${X3(Pme).contentName}}.`;return g.useEffect(()=>{var i;const o=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},jme=z3,Tme=V3,Z3=U3,Q3=W3,eF=SE,tF=G3,Ome=Y3;const Mme=jme,Rme=Tme,nF=g.forwardRef(({className:e,...t},n)=>d.jsx(Z3,{ref:n,className:fe("fixed inset-0 z-50 bg-bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));nF.displayName=Z3.displayName;const rF=g.forwardRef(({className:e,children:t,container:n,hideClose:r,...o},i)=>d.jsxs(Rme,{container:n,children:[d.jsx(nF,{}),d.jsxs(Q3,{ref:i,className:fe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-bg-background text-fg-primary p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",e),...o,children:[t,r?null:d.jsxs(Ome,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-bg-brand-primary data-[state=open]:text-fg-primary",children:[d.jsx(Rl,{className:"w-4 h-4"}),d.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));rF.displayName=Q3.displayName;const oF=({className:e,...t})=>d.jsx("div",{className:fe("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});oF.displayName="DialogHeader";const Ame=g.forwardRef(({className:e,...t},n)=>d.jsx(eF,{ref:n,className:fe("text-lg font-semibold leading-none tracking-tight",e),...t}));Ame.displayName=eF.displayName;const iF=g.forwardRef(({className:e,...t},n)=>d.jsx(tF,{ref:n,className:fe("text-sm text-fg-primary",e),...t}));iF.displayName=tF.displayName;function Ime(){const e=In();return d.jsx(Mme,{open:!0,modal:!0,children:d.jsxs(rF,{container:e,"aria-label":"Login required",className:"bg-bg-primary text-fg-primary",children:[d.jsx(oF,{children:d.jsx(SE,{children:d.jsx("span",{children:"Log in required"})})}),d.jsx(iF,{children:"You need to log in to access Val."}),d.jsx(qe,{asChild:!0,children:d.jsx("a",{href:gu("/api/val/authorize",{redirect_to:window.origin+gu("/val")}),children:"Log in"})})]})})}function Dme(){const{theme:e}=ay(),[t,n]=g.useState(!1),[r,o]=g.useState(!1),[i,s]=g.useState(!1),{currentSourcePath:a,ready:l}=xn();return g.useEffect(()=>{!t&&l&&(window.innerWidth<J2?(a||o(!0),n(!0)):(s(!0),o(!0),n(!0)))},[t,l,a]),UR()==="login-required"?d.jsx("div",{className:"min-h-[100svh] bg-bg-primary",children:d.jsx(Ime,{})}):d.jsx(sF.Provider,{value:{navMenu:{isOpen:r,setOpen:o},toolsMenu:{isOpen:i,setOpen:s}},children:d.jsxs("main",{style:{visibility:"hidden",minHeight:"100svh",width:"100vw"},id:"val-app-container",className:Ce("font-sans bg-bg-primary text-fg-primary grid grid-cols-1",{"xl:grid-cols-[320px,1fr,320px]":r&&i,"xl:grid-cols-[320px,1fr]":r&&!i,"xl:grid-cols-[1fr,320px]":!r&&i}),...e?{"data-mode":e}:{},children:[d.jsx("div",{className:Ce({hidden:!r,"w-[min(320px,100vw)] border-r overflow-x-hidden border-border-primary fixed top-0 left-0 xl:relative xl:left-auto z-[41]":r}),children:d.jsx(sq,{})}),d.jsx("div",{children:d.jsx(vme,{})}),d.jsx("div",{className:Ce({hidden:!i,"w-[min(320px,100vw)] border-l border-border-primary fixed top-0 right-0 xl:relative xl:right-auto z-[42]":i}),children:d.jsx("div",{className:"min-h-[100svh] bg-bg-primary",children:d.jsx(Wq,{})})})]})})}const sF=Ee.createContext(new Proxy({},{get(){throw new Error("LayoutContext not provided")}}));function Jy(){return g.useContext(sF)}const Lme=({client:e,config:t})=>d.jsx(VR,{client:e,dispatchValEvents:!1,config:t,children:d.jsx(u2,{children:d.jsx(Dme,{})})}),Fme=g.createContext(null),j0={didCatch:!1,error:null};class aF extends g.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=j0}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];(n=(r=this.props).onReset)===null||n===void 0||n.call(r,{args:i,reason:"imperative-api"}),this.setState(j0)}}componentDidCatch(t,n){var r,o;(r=(o=this.props).onError)===null||r===void 0||r.call(o,t,n)}componentDidUpdate(t,n){const{didCatch:r}=this.state,{resetKeys:o}=this.props;if(r&&n.error!==null&&zme(t.resetKeys,o)){var i,s;(i=(s=this.props).onReset)===null||i===void 0||i.call(s,{next:o,prev:t.resetKeys,reason:"keys"}),this.setState(j0)}}render(){const{children:t,fallbackRender:n,FallbackComponent:r,fallback:o}=this.props,{didCatch:i,error:s}=this.state;let a=t;if(i){const l={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")a=n(l);else if(r)a=g.createElement(r,l);else if(o!==void 0)a=o;else throw s}return g.createElement(Fme.Provider,{value:{didCatch:i,error:s,resetErrorBoundary:this.resetErrorBoundary}},a)}}function zme(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}const $me=({className:e})=>d.jsxs("svg",{width:"58",height:"34",viewBox:"0 0 58 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[d.jsx("g",{filter:"url(#filter0_d_21_1677)",children:d.jsx("path",{d:"M5 5.36426C5 5.16309 5.16309 5 5.36426 5H17.6581C17.8593 5 18.0223 5.16309 18.0223 5.36426V28.4949C18.0223 28.696 17.8593 28.8591 17.6581 28.8591H5.36426C5.16309 28.8591 5 28.696 5 28.4949V5.36426Z",fill:"hsl(var(--accent))"})}),d.jsx("g",{filter:"url(#filter1_i_21_1677)",children:d.jsx("circle",{cx:"11.4656",cy:"23.7595",r:"2.18557",fill:"currentColor"})}),d.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M52.8588 23.839H48.7257H48.537H48.1128C47.6715 23.839 47.4508 23.5942 47.4508 23.1044V13.7293C47.4508 13.5784 47.3285 13.4561 47.1777 13.4561H45.8118C45.6609 13.4561 45.5386 13.5784 45.5386 13.7293V15.1836C45.5386 15.2844 45.4569 15.3661 45.3561 15.3661C45.2876 15.3661 45.225 15.3275 45.1924 15.2672C44.805 14.5503 44.283 14.02 43.6264 13.6765C42.9563 13.301 42.2045 13.1132 41.3709 13.1132C40.6028 13.1132 39.8755 13.252 39.189 13.5295C38.5026 13.8071 37.8979 14.2152 37.3748 14.7539C36.8682 15.2764 36.4678 15.9212 36.1736 16.6885C35.8794 17.4558 35.7323 18.3374 35.7323 19.3332V19.725C35.7323 20.7372 35.8794 21.627 36.1736 22.3942C36.4678 23.1615 36.8682 23.8146 37.3748 24.3533C37.8979 24.8757 38.5026 25.2757 39.189 25.5532C39.8755 25.8144 40.6191 25.945 41.42 25.945C42.1881 25.945 42.9154 25.7491 43.6019 25.3573C44.2751 24.982 44.8058 24.4119 45.1941 23.6471C45.2255 23.5852 45.2886 23.5452 45.358 23.5452H45.3917C45.4728 23.5452 45.5386 23.611 45.5386 23.6921C45.5386 23.7904 45.544 23.8856 45.5547 23.9777V25.1392C45.5547 25.3904 45.7584 25.5941 46.0096 25.5941H47.2261C47.2914 25.5995 47.3581 25.6022 47.4263 25.6022H48.537H48.7257H57.7268C57.8777 25.6022 58 25.4799 58 25.329V24.1122C58 23.9614 57.8777 23.839 57.7268 23.839H55.3174C55.1665 23.839 55.0442 23.7167 55.0442 23.5659V8.73368C55.0442 8.58279 54.9219 8.46048 54.771 8.46048H50.5054C50.3545 8.46048 50.2322 8.58279 50.2322 8.73368V9.95043C50.2322 10.1013 50.3545 10.2236 50.5054 10.2236H52.8588C53.0097 10.2236 53.132 10.3459 53.132 10.4968V23.5659C53.132 23.7167 53.0097 23.839 52.8588 23.839ZM41.6161 24.1329C42.1881 24.1329 42.7111 24.0268 43.1851 23.8146C43.6754 23.6023 44.0922 23.3003 44.4354 22.9085C44.7786 22.5167 45.0483 22.0514 45.2444 21.5127C45.4406 20.9576 45.5386 20.3454 45.5386 19.6761V19.3822C45.5386 18.7292 45.4406 18.1333 45.2444 17.5946C45.0483 17.0395 44.7705 16.5661 44.4109 16.1743C44.0677 15.7824 43.6509 15.4804 43.1606 15.2682C42.6866 15.0396 42.1718 14.9254 41.6161 14.9254C41.044 14.9254 40.521 15.0315 40.0471 15.2437C39.5731 15.4559 39.1563 15.758 38.7968 16.1498C38.4535 16.5252 38.1839 16.9905 37.9877 17.5456C37.7916 18.0843 37.6936 18.6802 37.6936 19.3332V19.725C37.6936 21.1127 38.0531 22.1983 38.7722 22.982C39.5077 23.7493 40.4557 24.1329 41.6161 24.1329ZM31.1115 25.4191C31.0732 25.5287 30.9698 25.6022 30.8536 25.6022H27.4661C27.35 25.6022 27.2465 25.5287 27.2082 25.4191L23.1578 13.8193C23.0958 13.6417 23.2276 13.4561 23.4157 13.4561H25.089C25.2068 13.4561 25.3114 13.5316 25.3484 13.6435L28.9666 24.581C28.9942 24.6643 29.0721 24.7206 29.1599 24.7206C29.2477 24.7206 29.3256 24.6643 29.3532 24.581L32.9714 13.6435C33.0084 13.5316 33.1129 13.4561 33.2308 13.4561H34.9041C35.0922 13.4561 35.224 13.6417 35.162 13.8193L31.1115 25.4191Z",fill:"currentColor"}),d.jsxs("defs",{children:[d.jsxs("filter",{id:"filter0_d_21_1677",x:"0.124722",y:"0.124722",width:"22.7729",height:"33.6097",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[d.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),d.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),d.jsx("feOffset",{}),d.jsx("feGaussianBlur",{stdDeviation:"2.43764"}),d.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),d.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.219608 0 0 0 0 0.803922 0 0 0 0 0.501961 0 0 0 0.3 0"}),d.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_21_1677"}),d.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_21_1677",result:"shape"})]}),d.jsxs("filter",{id:"filter1_i_21_1677",x:"9.28003",y:"21.5739",width:"4.37112",height:"4.37112",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[d.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),d.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),d.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),d.jsx("feOffset",{}),d.jsx("feGaussianBlur",{stdDeviation:"0.546392"}),d.jsx("feComposite",{in2:"hardAlpha",operator:"arithmetic",k2:"-1",k3:"1"}),d.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.219608 0 0 0 0 0.803922 0 0 0 0 0.501961 0 0 0 0.3 0"}),d.jsx("feBlend",{mode:"normal",in2:"shape",result:"effect1_innerShadow_21_1677"})]})]})]});function lF({error:e,resetErrorBoundary:t}){return console.error(e),d.jsx("div",{className:"flex absolute top-0 left-0 justify-center items-center w-screen h-screen bg-bg-primary text-fg-primary",children:d.jsx("div",{className:"p-10 w-full h-full",children:d.jsxs("div",{className:"overflow-scroll p-10 w-full h-full bg-card text-fg-primary",children:[d.jsxs("div",{className:"flex justify-between items-center",children:[d.jsxs("div",{className:"flex items-center gap-[0.5em] text-lg font-bold text-center py-2",children:[d.jsx($me,{})," encountered an error"]}),d.jsx("button",{onClick:t,children:d.jsx(Rl,{})})]}),d.jsx("div",{className:"text-4xl font-normal",children:"Message:"}),d.jsx("pre",{children:e.message}),e.stack&&d.jsx(Dl,{type:"single",className:"font-serif",collapsible:!0,defaultValue:"error",children:d.jsxs(_a,{value:"error",children:[d.jsx(Ll,{children:"Stack trace:"}),d.jsx(ja,{className:"p-4 bg-bg-secondary",children:e.stack&&d.jsx("pre",{children:e.stack})})]})})]})})})}function Bme({root:e,children:t}){return Fr.createPortal(t,e)}const cF=({children:e,style:t})=>{const n=g.useRef(null),[r,o]=g.useState(null);return g.useLayoutEffect(()=>{if(n.current)if(n.current.shadowRoot)o(n.current.shadowRoot);else{const i=n.current.attachShadow({mode:"open"});o(i)}},[]),d.jsx("div",{ref:n,style:t,id:"val-shadow-root",children:r&&d.jsx(Bme,{root:r,children:e})})},uF="/spa/index.css",Vme="val-app",Ume="val-overlay",dF="$$BUILD_$$REPLACE_WITH_VERSION$$";function fF(){return d.jsxs(d.Fragment,{children:[d.jsx("link",{rel:"preconnect",href:"https://fonts.googleapis.com"}),d.jsx("link",{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"use-credentials"}),d.jsx("link",{href:"https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=Space+Grotesk:wght@300..700&display=swap",rel:"stylesheet"})]})}function hF(){const[e,t]=g.useState(null);return g.useEffect(()=>{const n=r=>{var a;if(!(r instanceof CustomEvent)){console.warn("Received message of type val-config, but it was not a CustomEvent",r);return}if(r.detail.type!=="val-config"){console.warn("Received message of type val-config, but it did not have the expected type",r.detail);return}const o=r.detail.hash;if(!o){console.warn("Received message of type val-config, but it did not have a hash",r.detail);return}const i=r.detail.config,s=M8.safeParse(i);s.success?t(s.data):(console.error("Invalid config. Recreating...",s.error),t({project:typeof(i==null?void 0:i.project)=="string"?i.project:void 0,root:typeof(i==null?void 0:i.root)=="string"?i.root:void 0,gitCommit:typeof(i==null?void 0:i.gitCommit)=="string"?i.gitCommit:void 0,ai:i!=null&&i.ai&&i.ai.commitMessages&&typeof i.ai.commitMessages.disabled=="boolean"?{commitMessages:{disabled:i.ai.commitMessages.disabled}}:void 0,files:i!=null&&i.files?{directory:typeof((a=i==null?void 0:i.files)==null?void 0:a.directory)=="string"?i.files.directory:"/public/val"}:void 0,gitBranch:typeof(i==null?void 0:i.gitBranch)=="string"?i.gitBranch:void 0,defaultTheme:(i==null?void 0:i.defaultTheme)==="dark"?"dark":"light"})),window.dispatchEvent(new CustomEvent(O8,{detail:{type:"val-config-received",hash:o}}))};return window.addEventListener(eN,n),()=>{window.removeEventListener(eN,n)}},[]),e}function Wme(){const e=hF(),t="/api/val",{client:n}=g.useMemo(()=>({client:AM(t,{...e,contentHostUrl:KO})}),[t,e]);return d.jsxs(d.Fragment,{children:[d.jsx(fF,{}),d.jsxs(cF,{children:[d.jsx("link",{rel:"stylesheet",href:`${t}/static${`/${dF}`}${uF}`}),d.jsx(aF,{fallbackRender:lF,children:d.jsx(Lme,{client:n,config:e})})]})]})}var EE="Switch",[Hme,Cge]=So(EE),[Kme,Gme]=Hme(EE),pF=g.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:l="on",onCheckedChange:c,form:u,...f}=e,[h,p]=g.useState(null),m=Be(t,S=>p(S)),v=g.useRef(!1),x=h?u||!!h.closest("form"):!0,[b=!1,w]=Kr({prop:o,defaultProp:i,onChange:c});return d.jsxs(Kme,{scope:n,checked:b,disabled:a,children:[d.jsx(Oe.button,{type:"button",role:"switch","aria-checked":b,"aria-required":s,"data-state":vF(b),"data-disabled":a?"":void 0,disabled:a,value:l,...f,ref:m,onClick:ne(e.onClick,S=>{w(C=>!C),x&&(v.current=S.isPropagationStopped(),v.current||S.stopPropagation())})}),x&&d.jsx(qme,{control:h,bubbles:!v.current,name:r,value:l,checked:b,required:s,disabled:a,form:u,style:{transform:"translateX(-100%)"}})]})});pF.displayName=EE;var mF="SwitchThumb",gF=g.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=Gme(mF,n);return d.jsx(Oe.span,{"data-state":vF(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});gF.displayName=mF;var qme=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,i=g.useRef(null),s=XS(n),a=CS(t);return g.useEffect(()=>{const l=i.current,c=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(c,"checked").set;if(s!==n&&f){const h=new Event("click",{bubbles:r});f.call(l,n),l.dispatchEvent(h)}},[s,n,r]),d.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:i,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function vF(e){return e?"checked":"unchecked"}var yF=pF,Yme=gF;const xF=g.forwardRef(({className:e,...t},n)=>d.jsx(yF,{className:fe("peer inline-flex h-[22px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:bg-bg-primary disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-bg-tertiary data-[state=unchecked]:bg-bg-secondary-hover",e),...t,ref:n,children:d.jsx(Yme,{className:fe("pointer-events-none block h-[18px] w-5 rounded-full bg-bg-primary shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));xF.displayName=yF.displayName;var T0,CE="HoverCard",[bF,Nge]=So(CE,[ji]),Xy=ji(),[Jme,NE]=bF(CE),wF=e=>{const{__scopeHoverCard:t,children:n,open:r,defaultOpen:o,onOpenChange:i,openDelay:s=700,closeDelay:a=300}=e,l=Xy(t),c=g.useRef(0),u=g.useRef(0),f=g.useRef(!1),h=g.useRef(!1),[p=!1,m]=Kr({prop:r,defaultProp:o,onChange:i}),v=g.useCallback(()=>{clearTimeout(u.current),c.current=window.setTimeout(()=>m(!0),s)},[s,m]),x=g.useCallback(()=>{clearTimeout(c.current),!f.current&&!h.current&&(u.current=window.setTimeout(()=>m(!1),a))},[a,m]),b=g.useCallback(()=>m(!1),[m]);return g.useEffect(()=>()=>{clearTimeout(c.current),clearTimeout(u.current)},[]),d.jsx(Jme,{scope:t,open:p,onOpenChange:m,onOpen:v,onClose:x,onDismiss:b,hasSelectionRef:f,isPointerDownOnContentRef:h,children:d.jsx(tp,{...l,children:n})})};wF.displayName=CE;var SF="HoverCardTrigger",kF=g.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,o=NE(SF,n),i=Xy(n);return d.jsx(Wu,{asChild:!0,...i,children:d.jsx(Oe.a,{"data-state":o.open?"open":"closed",...r,ref:t,onPointerEnter:ne(e.onPointerEnter,Cv(o.onOpen)),onPointerLeave:ne(e.onPointerLeave,Cv(o.onClose)),onFocus:ne(e.onFocus,o.onOpen),onBlur:ne(e.onBlur,o.onClose),onTouchStart:ne(e.onTouchStart,s=>s.preventDefault())})})});kF.displayName=SF;var Xme="HoverCardPortal",[Pge,Zme]=bF(Xme,{forceMount:void 0}),Ev="HoverCardContent",PE=g.forwardRef((e,t)=>{const n=Zme(Ev,e.__scopeHoverCard),{forceMount:r=n.forceMount,...o}=e,i=NE(Ev,e.__scopeHoverCard);return d.jsx(ln,{present:r||i.open,children:d.jsx(Qme,{"data-state":i.open?"open":"closed",...o,onPointerEnter:ne(e.onPointerEnter,Cv(i.onOpen)),onPointerLeave:ne(e.onPointerLeave,Cv(i.onClose)),ref:t})})});PE.displayName=Ev;var Qme=g.forwardRef((e,t)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,...a}=e,l=NE(Ev,n),c=Xy(n),u=g.useRef(null),f=Be(t,u),[h,p]=g.useState(!1);return g.useEffect(()=>{if(h){const m=document.body;return T0=m.style.userSelect||m.style.webkitUserSelect,m.style.userSelect="none",m.style.webkitUserSelect="none",()=>{m.style.userSelect=T0,m.style.webkitUserSelect=T0}}},[h]),g.useEffect(()=>{if(u.current){const m=()=>{p(!1),l.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var x;((x=document.getSelection())==null?void 0:x.toString())!==""&&(l.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",m),()=>{document.removeEventListener("pointerup",m),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!1}}},[l.isPointerDownOnContentRef,l.hasSelectionRef]),g.useEffect(()=>{u.current&&nge(u.current).forEach(v=>v.setAttribute("tabindex","-1"))}),d.jsx(Xl,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:s,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:ne(i,m=>{m.preventDefault()}),onDismiss:l.onDismiss,children:d.jsx(np,{...c,...a,onPointerDown:ne(a.onPointerDown,m=>{m.currentTarget.contains(m.target)&&p(!0),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!0}),ref:f,style:{...a.style,userSelect:h?"text":void 0,WebkitUserSelect:h?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),ege="HoverCardArrow",tge=g.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,o=Xy(n);return d.jsx(rp,{...o,...r,ref:t})});tge.displayName=ege;function Cv(e){return t=>t.pointerType==="touch"?void 0:e()}function nge(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)t.push(n.currentNode);return t}var rge=wF,EF=PE;const oge=rge,ige=g.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>d.jsx(EF,{ref:o,align:t,sideOffset:n,className:fe("z-50 w-64 text-xs rounded-md border bg-bg-secondary p-4 text-fg-secondary shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));ige.displayName=EF.displayName;function sge(e){const[t,n]=g.useState(null),[r,o]=g.useState([]),[i,s]=g.useState({x:0,y:0});g.useEffect(()=>{const v=()=>{s({x:window.scrollX,y:window.scrollY})};return window.addEventListener("scroll",v,{passive:!1}),()=>{window.removeEventListener("scroll",v)}},[]),g.useEffect(()=>{if(t==="select"){let v;const x=()=>{const b=[];document.querySelectorAll("[data-val-path]").forEach(w=>{const S=w.getAttribute("data-val-path");if(!S)return;if(w.tagName==="SOURCE"||w.tagName==="TRACK"){const N=w.parentElement;if(!N||!(N.tagName==="VIDEO"||N.tagName==="PICTURE"||N.tagName==="AUDIO"))return;const P=N.getBoundingClientRect();b.push({top:P.top,left:P.left,width:P.width,height:P.height,joinedPaths:S});return}const C=w.getBoundingClientRect();b.push({top:C.top,left:C.left,width:C.width,height:C.height,joinedPaths:S})}),o(b),v=setTimeout(x,1e3)};return x(),()=>{clearTimeout(v)}}else o([])},[t,i]);const[a,l]=g.useState(null);g.useEffect(()=>{if(t==="select"&&a===null){const v=x=>{x.key==="Escape"&&n(null)};return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v)}}},[t,a]);const{theme:c}=ay(),[u,f]=g.useState(null),h=Gu(),p="val-menu-right-center";g.useEffect(()=>{try{const v=h&&localStorage.getItem("val-menu-drop-zone-"+((h==null?void 0:h.project)||"unknown"))||localStorage.getItem("val-menu-drop-zone-default");if(v)if(v==="val-menu-left-top"||v==="val-menu-left-center"||v==="val-menu-left-bottom"||v==="val-menu-center-top"||v==="val-menu-center-bottom"||v==="val-menu-right-top"||v==="val-menu-right-center"||v==="val-menu-right-bottom")f(v);else throw new Error("Invalid drop zone: "+v);else f(p)}catch(v){console.error("Error getting drop zone from local storage",v),f(p)}},[(h==null?void 0:h.project)||"unknown"]);const m=v=>{f(v);try{v&&(localStorage.setItem("val-menu-drop-zone-"+((h==null?void 0:h.project)||"unknown"),v),localStorage.setItem("val-menu-drop-zone-default",v))}catch(x){console.error("Error setting drop zone to local storage",x)}};return d.jsxs("div",{...c?{"data-mode":c}:{},id:"val-overlay-container",children:[d.jsx(age,{editMode:a,setMode:n,setEditMode:l}),r.map((v,x)=>d.jsx("div",{className:"absolute top-0 border border-bg-brand-primary z-[8998] hover:border-2 rounded",onClickCapture:b=>{b.stopPropagation(),n(null),l({joinedPaths:v.joinedPaths,clientY:b.clientY,clientX:b.clientX,boundingBox:v})},style:{display:"block",top:(v==null?void 0:v.top)+i.y,left:(v==null?void 0:v.left)+i.x,width:v==null?void 0:v.width,height:v==null?void 0:v.height},children:d.jsx("div",{className:"relative top-0 left-0 w-full",children:d.jsx("div",{className:"absolute top-[0px] right-[0px] w-full truncate bg-bg-brand-primary text-fg-brand-primary flex gap-2 px-2 rounded-bl hover:opacity-20 cursor-pointer",style:{fontSize:`${Math.min(v.height-2,10)}px`,maxHeight:`${Math.min(v.height-2,16)}px`,maxWidth:`${Math.min(v.width-2,300)}px`},children:Y.splitJoinedSourcePaths(v.joinedPaths).map(b=>{const[w,S]=Y.splitModuleFilePathAndModulePath(b);return d.jsx(dp,{link:!1,toolTip:!1,moduleFilePath:w,patchPath:Y.splitModulePath(S)},b)})})})},x)),a===null&&d.jsx(uge,{...e,mode:t,setMode:n,loading:c===null,dropZone:u,setDropZone:m})]})}function age({editMode:e,setMode:t,setEditMode:n}){const[r,o]=g.useState({x:window.innerWidth,y:window.innerHeight}),[i,s]=g.useState(window.innerWidth),a=g.useRef(null);g.useEffect(()=>{const u=()=>{e?setTimeout(()=>{if(a.current){const{innerWidth:f,innerHeight:h}=window,{offsetWidth:p,offsetHeight:m}=a.current,v=m,x=p;let b=e.clientX,w=e.clientY;const S=80,C=f-(e.clientX+x);C<0&&(b=b+(C-S));const N=h-(e.clientY+v);N<0&&(w=w+(N-S)),o({x:b,y:w})}},100):o({x:window.innerWidth,y:window.innerHeight})};window.innerWidth<1024?o({x:16,y:16}):u()},[e]),g.useEffect(()=>{const u=()=>{s(window.innerWidth),i<1024&&o({x:16,y:16})};return u(),window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u)}},[]);const[l,c]=g.useState(!1);return g.useEffect(()=>{if(l){const u=p=>{if(p instanceof MouseEvent)o(m=>({x:m.x+p.movementX,y:m.y+p.movementY}));else{const m=p.touches[0];o(()=>({x:m.clientX,y:m.clientY}))}},f=()=>{c(!1)},h=()=>{c(!1)};return window.addEventListener("mousemove",u),window.addEventListener("mouseup",f),window.addEventListener("click",h),()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",f),window.removeEventListener("click",h)}}},[l]),g.useEffect(()=>{const u=f=>{f.key==="Escape"&&(t("select"),n(null))};return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u)}},[]),d.jsxs("div",{className:Ce("fixed top-0 left-0 z-[8998]",{hidden:e===null,"opacity-100 w-[200svw] h-[100svh]":e!==null}),children:[d.jsx("div",{className:Ce("fixed top-0 left-0",{hidden:e===null,"opacity-100 w-[100vw] h-[100svh]":e!==null}),onClick:u=>{u.preventDefault(),l||(t("select"),n(null))}}),d.jsxs("div",{className:Ce("absolute grid grid-cols-[32px,1fr,32px] rounded bg-bg-primary text-fg-primary cursor-pointer",{"w-[calc(100vw-32px)] h-[calc(100svh-32px)]":i<1024,"min-w-[500px]":i>=1024}),ref:a,style:{top:r.y,left:r.x},children:[d.jsx("div",{className:"cursor-grab",onMouseDown:()=>{c(!0)}}),d.jsxs("div",{className:"grid grid-rows-[32px,1fr,32px]",children:[d.jsx("div",{ref:a,className:"cursor-grab",onMouseDown:()=>{c(!0)}}),d.jsxs("form",{className:"flex flex-col items-start justify-start w-full gap-4 lg:justify-start",onSubmit:u=>{u.preventDefault(),u.stopPropagation(),t("select"),n(null)},children:[e&&Y.splitJoinedSourcePaths(e.joinedPaths).map(u=>{const[f,h]=Y.splitModuleFilePathAndModulePath(u),p=Y.splitModulePath(h);return d.jsxs(g.Fragment,{children:[d.jsx(dp,{link:!0,toolTip:!0,moduleFilePath:f,patchPath:p}),d.jsx(lge,{path:u})]},u)}),d.jsx(qe,{className:"self-end",type:"submit",children:"Done"})]}),d.jsx("div",{ref:a,className:"cursor-grab",onMouseDown:()=>{c(!0)}})]}),d.jsx("div",{ref:a,className:"cursor-grab",onMouseDown:()=>{c(!0)}})]})]})}const Xw="p-2 rounded-md disabled:bg-bg-disabled transition-colors border",Zw="hover:bg-bg-primary-hover border-bg-primary";function lge({path:e}){const t=Ft(e);return!("data"in t)||t.data===void 0?d.jsx("div",{className:"flex flex-col gap-4",children:d.jsx(yt,{path:e})}):d.jsx("div",{className:"flex flex-col gap-4 max-w-[600px] w-full",children:d.jsx(Yy,{path:e,schema:t.data,autoFocus:!0})})}function aj({dropZone:e}){return e==="val-menu-left-top"?d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Gx,{className:"w-4 h-4"}),d.jsx("span",{children:"Left Top"})]}):e==="val-menu-left-center"?d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(mK,{className:"w-4 h-4"}),d.jsx("span",{children:"Left Center"})]}):e==="val-menu-left-bottom"?d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Kx,{className:"w-4 h-4"}),d.jsx("span",{children:"Left Bottom"})]}):e==="val-menu-center-top"?d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Gx,{className:"w-4 h-4"}),d.jsx("span",{children:"Center Top"})]}):e==="val-menu-center-bottom"?d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Kx,{className:"w-4 h-4"}),d.jsx("span",{children:"Center Bottom"})]}):e==="val-menu-right-top"?d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Gx,{className:"w-4 h-4"}),d.jsx("span",{children:"Right Top"})]}):e==="val-menu-right-center"?d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(gK,{className:"w-4 h-4"}),d.jsx("span",{children:"Right Center"})]}):e==="val-menu-right-bottom"?d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Kx,{className:"w-4 h-4"}),d.jsx("span",{children:"Right Bottom"})]}):(console.warn("Unknown drop zone:",e),null)}function lj({dropZone:e,ghost:t,draftMode:n,draftModeLoading:r,setDraftMode:o,mode:i,setMode:s,disableOverlay:a,loading:l,setDropZone:c}){const u=e==="val-menu-right-center"||e==="val-menu-left-center"?"vertical":"horizontal",f=UR(),h=In(),{theme:p,setTheme:m}=ay(),v=ly(),[x,b]=g.useState(0),w=ip(),S=Ql()||{},C=Object.keys(S).length,N=qu();g.useEffect(()=>{const D=()=>{window.innerWidth<400?b(-56):b(32)};return D(),window.addEventListener("resize",D),()=>{window.removeEventListener("resize",D)}},[]);const{publishDisabled:P}=sp(),_=cge(),O=e==="val-menu-center-bottom"?"top":e==="val-menu-center-top"?"bottom":e==="val-menu-right-center"?"left":e==="val-menu-left-center"?"right":e==="val-menu-left-bottom"||e==="val-menu-right-bottom"?"top":e==="val-menu-right-top"||e==="val-menu-left-top"?"bottom":"top",M=["val-menu-left-top","val-menu-left-center","val-menu-left-bottom","val-menu-center-top","val-menu-center-bottom","val-menu-right-top","val-menu-right-center","val-menu-right-bottom"];return d.jsxs("div",{className:"p-4 right-16",children:[l&&d.jsx("div",{className:Nv(e)+" p-4",children:d.jsx("div",{className:"flex items-center justify-center p-2 text-white bg-black rounded backdrop-blur",children:d.jsx(Hx,{className:"animate-spin",size:16})})}),f==="login-required"&&d.jsx("div",{className:Nv(e)+" p-4",children:d.jsx("div",{className:"flex items-center justify-center p-2 text-white bg-black rounded backdrop-blur",children:d.jsx("a",{href:gu("/api/val/authorize",{redirect_to:window.location.href}),children:d.jsx(dK,{size:16})})})}),d.jsx(ku,{isOpen:n&&!r&&!l&&f!=="login-required",children:d.jsxs("div",{className:Ce("flex relative rounded bg-bg-primary border border-border-primary text-fg-primary gap-2",{"flex-col py-4 px-2":u==="vertical","flex-row px-4 py-2":u==="horizontal","opacity-70":t}),children:[d.jsx(xc,{label:"Pick content",active:i==="select",onClick:()=>s(D=>D==="select"?null:"select"),icon:d.jsx(bK,{size:16})}),d.jsx(xc,{label:"Disable preview mode",disabled:r,icon:r?d.jsx(Hx,{size:16,className:"animate-spin"}):d.jsx(nK,{size:16}),onClick:()=>o(!1)}),d.jsx("div",{className:"pb-1 mt-1 border-t border-border-primary"}),d.jsxs(br,{children:[d.jsx(zg,{disabled:P,className:Ce(Xw,Zw),children:d.jsxs(oge,{children:[d.jsx(kF,{children:d.jsxs("div",{className:"relative",children:[w.length>0&&d.jsx("div",{className:"absolute -top-3 -right-3",children:d.jsxs("div",{className:Ce("w-4 h-4 text-[9px] leading-4 text-center rounded-full",{"bg-bg-brand-primary":C===0,"bg-bg-error-primary text-fg-error-primary":C>0}),children:[C===0&&w.length>9&&d.jsx("span",{children:"9+"}),C===0&&w.length<=9&&d.jsx("span",{children:w.length}),C>9&&d.jsx("span",{children:"9+"}),C<=9&&C>0&&d.jsx("span",{children:C})]})}),d.jsx(Dg,{size:16})]})}),d.jsx(PE,{children:d.jsxs("div",{className:"p-2 rounded bg-bg-primary text-fg-primary",children:[C>0&&d.jsxs("div",{className:"text-fg-error-primary",children:["Cannot ",N==="fs"?"save":"publish"," due to"," ",C," validation error",C>1&&"s"]}),w.length>0&&C==0&&d.jsxs("div",{children:[w.length," patch",w.length>1&&"es"," ready to publish"]})]})})]})}),d.jsxs(tr,{container:h,align:"center",side:O,sideOffset:x,className:"z-[9000] relative max-w-[352px] w-screen rounded-none sm:rounded flex flex-col items-end",children:[d.jsx("div",{className:"absolute top-4 right-4 sm:hidden",children:d.jsx(Al,{children:d.jsx(Rl,{size:16})})}),!P&&d.jsx("div",{className:"flex items-center justify-between gap-4 px-4 py-4 pt-8 sm:hidden",children:d.jsx(Xb,{})}),d.jsx(hr,{children:d.jsx("div",{className:"sm:max-h-[min(400px,80svh)] max-h-[calc(100svh-96px-64px)] w-[320px]",children:d.jsx(EA,{loadingStatus:v})})}),!P&&d.jsx("div",{className:"hidden py-4 sm:block",children:d.jsx(Xb,{})})]})]}),d.jsx(xc,{label:"Studio",icon:_.status==="success"&&_.data?d.jsx(Rg,{size:16}):d.jsx(Ig,{size:16}),href:window.origin+"/val/~"+(_.status==="success"&&_.data?_.data:"")}),d.jsxs(br,{children:[d.jsx(zg,{className:Ce(Xw,Zw),children:d.jsx($S,{size:16})}),d.jsx(tr,{container:h,className:"z-[9003]",children:d.jsxs("div",{className:"grid grid-cols-[1fr,auto] gap-2 items-center",children:[d.jsx("span",{children:"Position"}),d.jsxs(Ey,{value:e,onValueChange:D=>{c(D)},children:[d.jsx(gp,{children:d.jsx(Cy,{children:d.jsx(aj,{dropZone:e})})}),d.jsx(vp,{container:h,className:"z-[9004]",children:M.map(D=>d.jsx(yp,{value:D,children:d.jsx(aj,{dropZone:D})},D))})]}),d.jsx("span",{children:"Dark mode"}),d.jsx(xF,{checked:p==="dark",onCheckedChange:D=>{m(D?"dark":"light")}})]})})]})]})}),d.jsx(ku,{isOpen:!(n&&!r)&&!l&&f!=="login-required",children:d.jsxs("div",{className:Ce("flex relative rounded bg-bg-primary text-fg-primary gap-2 justify-center items-center",{"flex-col py-4 px-2":u==="vertical","flex-row px-4 py-2":u==="horizontal","opacity-70":t}),children:[d.jsx(xc,{label:"Enable preview mode",disabled:r,icon:r?d.jsx(Hx,{size:16,className:"animate-spin"}):d.jsx(rK,{size:16}),onClick:()=>{o(!0)}}),d.jsx(xc,{label:"Studio",icon:_.status==="success"&&_.data?d.jsx(Rg,{size:16}):d.jsx(Ig,{size:16}),href:window.origin+"/val/~"+(_.status==="success"&&_.data?_.data:"")}),d.jsx(xc,{label:"Disable Val",icon:d.jsx(Rl,{size:16}),onClick:()=>a()})]})})]})}function cge(){const e=Ba(),t="data"in e&&e.data?Object.keys(e.data):[],n=JR(t,"record"),[r,o]=g.useState(null);return g.useEffect(()=>{o(window.location.pathname);const s=()=>{o(window.location.pathname)};return window.addEventListener("popstate",s),()=>{window.removeEventListener("popstate",s)}},[]),g.useMemo(()=>{if(r){for(const s of n.data||[])for(const[a,l]of Object.entries(s))if(a===r){const[c]=Y.splitModuleFilePathAndModulePath(l),u="data"in e?e.data[c]:void 0;if((u==null?void 0:u.type)==="record"&&u.router!==void 0)return{status:"success",data:Y.joinModuleFilePathAndModulePath(c,JSON.stringify(a))}}}return{status:"not-found"}},["data"in e&&e.data,n,r])}function xc({icon:e,onClick:t,disabled:n,active:r,label:o,href:i}){const s=i?"a":"button";return d.jsx(s,{href:i,disabled:n,className:Ce(Xw,{"bg-bg-brand-primary text-fg-brand-primary border-border-brand-primary hover:bg-bg-brand-primary-hover hover:text-fg-brand-primary":r,[Zw]:!r}),onClick:t,"aria-label":o,title:o,children:e})}function uge(e){const[t,n]=g.useState(!1),{dropZone:r,setDropZone:o}=e,[i,s]=g.useState(null),a=c=>u=>{u.preventDefault(),o(c)},l=c=>u=>{u.preventDefault(),s(c)};return d.jsxs(d.Fragment,{children:[r&&d.jsx("div",{className:Ce("z-[8999] cursor-grab",Nv(r)),draggable:!0,onDragStart:()=>{n(!0)},onDragEnd:()=>{n(!1)},children:d.jsx(lj,{...e,dropZone:r})}),t&&r&&d.jsxs(d.Fragment,{children:[i&&i!==r&&d.jsx("div",{className:Ce("z-[3]",Nv(i)),onDrop:a(i),onDragOver:l(i),children:d.jsx(lj,{ghost:!0,...e,dropZone:i})}),d.jsxs("div",{className:"fixed top-0 left-0 grid w-screen h-screen grid-cols-3 grid-rows-3 z-[2]",children:[d.jsx(Ms,{id:"val-menu-left-top",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),d.jsx(Ms,{id:"val-menu-center-top",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),d.jsx(Ms,{id:"val-menu-right-top",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),d.jsx(Ms,{id:"val-menu-left-center",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),d.jsx("div",{}),d.jsx(Ms,{id:"val-menu-right-center",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),d.jsx(Ms,{id:"val-menu-left-bottom",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),d.jsx(Ms,{id:"val-menu-center-bottom",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),d.jsx(Ms,{id:"val-menu-right-bottom",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l})]})]})]})}function Nv(e){let t="fixed transform";return e==="val-menu-left-top"?t+=" left-0 top-0":e==="val-menu-left-center"?t+=" left-0 top-1/2 -translate-y-1/2":e==="val-menu-left-bottom"?t+=" left-0 bottom-0":e==="val-menu-center-top"?t+=" left-1/2 -translate-x-1/2 top-0":e==="val-menu-center-bottom"?t+=" left-1/2 -translate-x-1/2 bottom-0":e==="val-menu-right-top"?t+=" right-0 top-0":e==="val-menu-right-center"?t+=" right-0 top-1/2 -translate-y-1/2":t+=" right-0 bottom-0",t}const Ms=({id:e,onDrop:t,onDragOver:n})=>d.jsx("div",{onDrop:t(e),onDragOver:n(e)});function dge(){const e=hF(),t="/api/val",n=AM("/api/val",{...e,contentHostUrl:KO}),[r,o]=g.useState(!1),[i,s]=g.useState(!1);return g.useEffect(()=>{const a=l=>{l instanceof CustomEvent?(l==null?void 0:l.detail.type)==="draftMode"&&typeof(l==null?void 0:l.detail.value)=="boolean"?o(l.detail.value):l.detail.type==="draftModeLoading"&&typeof l.detail.value=="boolean"?s(l.detail.value):console.error("Val: invalid event detail (val-overlay-spa)",l.detail):console.error("Val: invalid event (val-overlay-spa)",l)};return window.addEventListener("val-overlay-spa",a),window.dispatchEvent(new CustomEvent("val-overlay-provider",{detail:{type:"spa-ready"}})),()=>{window.removeEventListener("val-overlay-spa",a)}},[]),d.jsxs(d.Fragment,{children:[d.jsx(fF,{}),d.jsxs(cF,{children:[d.jsx("style",{children:`
|
|
529
|
-
#val-overlay-container {
|
|
530
|
-
visibility: hidden;
|
|
531
|
-
}
|
|
532
|
-
`}),d.jsx("link",{rel:"stylesheet",href:`${t}/static${`/${dF}`}${uF}`}),d.jsx(aF,{fallbackRender:lF,children:d.jsx(VR,{client:n,dispatchValEvents:r,config:e,children:d.jsx(u2,{overlay:!0,children:d.jsx(sge,{draftMode:r,draftModeLoading:i,setDraftMode:a=>{const l=new CustomEvent("val-overlay-provider",{detail:{type:"draftMode",value:a}});window.dispatchEvent(l)},disableOverlay:()=>{location.href=`${window.location.origin}/api/val/disable?redirect_to=${encodeURIComponent(window.location.href)}`}})})})})]})]})}const cj=document.getElementById(Vme),uj=document.getElementById(Ume);cj?Gm.createRoot(cj).render(Ee.createElement(Ee.StrictMode,null,Ee.createElement(Wme,null))):uj?Gm.createRoot(uj).render(Ee.createElement(Ee.StrictMode,null,Ee.createElement(dge,null))):console.error("Val: could not mount Val element. Check your configuration.");
|