@valbuild/ui 0.50.0 → 0.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -40,7 +40,7 @@ Error generating stack: `+i.message+`
40
40
  */var dD=h,fD=Symbol.for("react.element"),pD=Symbol.for("react.fragment"),hD=Object.prototype.hasOwnProperty,mD=dD.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,gD={key:!0,ref:!0,__self:!0,__source:!0};function ZT(t,e,n){var r,o={},i=null,s=null;n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(s=e.ref);for(r in e)hD.call(e,r)&&!gD.hasOwnProperty(r)&&(o[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)o[r]===void 0&&(o[r]=e[r]);return{$$typeof:fD,type:t,key:i,ref:s,props:o,_owner:mD.current}}Km.Fragment=pD;Km.jsx=ZT;Km.jsxs=ZT;YT.exports=Km;var b=YT.exports;function Qy(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function f1(t,e){if(t){if(typeof t=="string")return Qy(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Qy(t,e)}}function qm(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=f1(t))||e&&t&&typeof t.length=="number"){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(l){throw l},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
41
41
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,s=!1,a;return{s:function(){n=n.call(t)},n:function(){var l=n.next();return i=l.done,l},e:function(l){s=!0,a=l},f:function(){try{!i&&n.return!=null&&n.return()}finally{if(s)throw a}}}}function JT(t){return t.length>0}var Sf=Object.freeze({kind:"ok",value:void 0});function Ef(t){return t===void 0?Sf:{kind:"ok",value:t}}function Po(t){return{kind:"err",error:t}}function Ac(t){return t===Sf||t.kind==="ok"}function p1(t){return t!==Sf&&t.kind==="err"}function XT(t){var e=[],n=[],r=qm(t),o;try{for(r.s();!(o=r.n()).done;){var i=o.value;Ac(i)?e.push(i.value):n.push(i.error)}}catch(s){r.e(s)}finally{r.f()}return JT(n)?Po(n):Ef(e)}function vD(t){return XT(t)}function yD(t){var e=[],n=qm(t),r;try{for(n.s();!(r=n.n()).done;){var o=r.value;p1(o)&&e.push(o.error)}}catch(i){n.e(i)}finally{n.f()}return JT(e)?Po(e):Sf}function xD(t,e){return function(n){for(var r=Ef(e),o=0;o<n.length&&Ac(r);++o)r=t(r.value,n[o],o);return r}}function bD(t){return function(e){return Ac(e)?Ef(t(e.value)):e}}function wD(t){return function(e){return Ac(e)?t(e.value):e}}function kD(t){return function(e){return p1(e)?Po(t(e.error)):e}}function SD(t,e){return function(n){return t(n)?Ef(n):Po(e(n))}}var ED=function(e,n){return function(r){return Ac(r)?e(r.value)?r:Po(n(r.value)):r}},xa=Object.freeze({__proto__:null,voidOk:Sf,ok:Ef,err:Po,isOk:Ac,isErr:p1,allT:XT,all:vD,allV:yD,flatMapReduce:xD,map:bD,flatMap:wD,mapErr:kD,fromPredicate:SD,filterOrElse:ED});function _D(t){if(Array.isArray(t))return Qy(t)}function CD(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function TD(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
42
42
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function QT(t){return _D(t)||CD(t)||f1(t)||TD()}function ke(t){"@babel/helpers - typeof";return ke=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ke(t)}function OD(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function eO(t){var e=OD(t,"string");return typeof e=="symbol"?e:String(e)}function fe(t,e,n){return e=eO(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function hk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function fc(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?hk(Object(n),!0).forEach(function(r){fe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):hk(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function MD(t){if(Array.isArray(t))return t}function RD(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,o,i,s,a=[],l=!0,c=!1;try{if(i=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==e);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 ND(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
43
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vs(t,e){return MD(t)||RD(t,e)||f1(t,e)||ND()}function yn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function mk(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,eO(r.key),r)}}function xn(t,e,n){return e&&mk(t.prototype,e),n&&mk(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function _h(t){return _h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},_h(t)}function tO(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(tO=function(){return!!t})()}function nO(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function PD(t,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return nO(t)}function yr(t,e,n){return e=_h(e),PD(t,tO()?Reflect.construct(e,n||[],_h(t).constructor):e.apply(t,n))}function e0(t,e){return e0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},e0(t,e)}function xr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&e0(t,e)}var br=function(){function t(){yn(this,t)}return xn(t,[{key:"appendValidationError",value:function(n,r,o,i){return n?(n[r]?n[r].push({message:o,value:i}):n[r]=[{message:o,value:i}],n):fe({},r,[{message:o,value:i}])}}]),t}(),ba=Symbol("GetSchema"),An=Symbol("Path"),Wt=Symbol("GetSource");function $D(t){return t[ba]}var h1=xn(function t(e){yn(this,t),this.span=e}),AD=function(t){xr(e,t);function e(n,r){var o;return yn(this,e),o=yr(this,e,[r]),fe(nO(o),"type","Sym"),o.value=n,o}return xn(e,[{key:"transpile",value:function(){return this.value}}]),e}(h1);new AD("()");var sn="_type",gn="_ref",ID=function(t){xr(e,t);function e(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return yn(this,e),r=yr(this,e),r.options=n,r.opt=o,r}return xn(e,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:o==null?fe({},r,[{message:"Non-optional file was null or undefined.",value:o}]):typeof o[gn]!="string"?fe({},r,[{message:"File did not have a file reference string. Got: ".concat(ke(o[gn])),value:o}]):o[sn]!=="file"?fe({},r,[{message:"File did not have the valid file extension type. Got: ".concat(o[sn]),value:o}]):o.metadata?fe({},r,[{message:"Found metadata, but it could not be validated. File metadata must be an object with the required props: width (positive number), height (positive number) and sha256 (string of length 64 of the base16 hash).",value:o,fixes:["file:check-metadata"]}]):fe({},r,[{message:"Missing File metadata.",value:o,fixes:["file:add-metadata"]}])}},{key:"assert",value:function(r){return this.opt&&r==null?!0:(r==null?void 0:r[gn])==="file"&&(r==null?void 0:r[sn])==="file"}},{key:"optional",value:function(){return new e(this.options,!0)}},{key:"serialize",value:function(){return{type:"file",options:this.options,opt:this.opt}}}]),e}(br),DD=function(e){return new ID(e)};function rO(t){var e,n;if(!t[gn].startsWith("/public")){var r,o;return{url:t[gn]+((r=t.metadata)!==null&&r!==void 0&&r.sha256?"?sha256=".concat((o=t.metadata)===null||o===void 0?void 0:o.sha256):""),metadata:t.metadata}}return{url:t[gn].slice(7)+((e=t.metadata)!==null&&e!==void 0&&e.sha256?"?sha256=".concat((n=t.metadata)===null||n===void 0?void 0:n.sha256):""),metadata:t.metadata}}function oO(t){return ke(t)==="object"&&t!==null&&t!==void 0&&("val"in t||"valPath"in t)}function LD(t){return ke(t)==="object"&&t!==null&&t!==void 0&&An in t&&"val"in t}function iO(t){return t[An]}function jD(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function gk(t,e,n){return e?Qt(t(Qt(e,n))):Qt(e,n)}function ys(t){return ke(t)==="object"&&t!==null&&(Wt in t||An in t)}function Qt(t,e,n){if(ke(t)==="object"){if(ys(t))return t;if(oO(t))return Qt(t.val,t.valPath)}if(t&&t[gn]&&t[sn]==="file"){var r=t[gn];if(typeof r!="string")throw Error("Invalid file ref: "+r);return Qt(rO(t),e,n)}switch(ke(t)){case"function":case"symbol":throw Error("Invalid selector type: ".concat(ke(t),": ").concat(t));case"object":if(t!==null)return new Proxy(t,{has:function(i,s){return s===Wt||s===An||s==="andThen"||s===ba?!0:s in i},get:function(i,s){if(s===Wt)return t;if(s===An)return e;if(s===ba)return n;if(s==="andThen")return function(l){return gk(l,t,e)};if(Array.isArray(i)){if(s==="filter")return function(l){var c=i.map(function(u,d){return Qt(u,Mr(e,d),n==null?void 0:n.item)}).filter(function(u){return l&&l instanceof br?l.assert(vk(u)):vk(l(u))});return Qt(c,e,n)};if(s==="map")return function(l){var c=i.map(function(u,d){var f=l(Qt(u,Mr(e,d),n==null?void 0:n.item),Qt(d));return ys(f)?f:Qt(f)});return Qt(c,e,n)}}if(Array.isArray(i)&&s==="length")return Qt(i.length);var a=Reflect.get(i,s);return jD(t,s)?Number.isNaN(Number(s))?Qt(a,Mr(e,s),n==null?void 0:n.items[s]):Qt(a,Mr(e,Number(s)),n==null?void 0:n.item):a}});default:return fe(fe(fe({eq:function(i){var s=i;if(ys(i)&&(s=i[Wt],s instanceof h1))throw Error("TODO: Cannot evaluate equality with an Expr");return Qt(t===s,void 0)},andThen:function(i){return gk(i,t===void 0?null:t,e)}},Wt,t===void 0?null:t),An,e),ba,n)}}function Mr(t,e){if(ke(e)==="symbol")throw Error("Cannot create val path of array item with symbol prop: ".concat(e.toString()));return t&&"".concat(t,".").concat(JSON.stringify(e))}function vk(t){if(ke(t)==="object"&&(Wt in t||An in t)){var e=t[Wt];return e}return t}var m1=function(t){xr(e,t);function e(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return yn(this,e),r=yr(this,e),r.items=n,r.opt=o,r}return xn(e,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:ke(o)!=="object"?fe({},r,[{message:"Expected 'object', got '".concat(ke(o),"'")}]):Array.isArray(o)?fe({},r,[{message:"Expected 'object', got 'array'"}]):(Object.entries(this.items).forEach(function(a){var l=vs(a,2),c=l[0],u=l[1],d=Mr(r,c);if(!d)s=i.appendValidationError(s,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(c),o);else{var f=u.validate(d,o[c]);f&&s?s=fc(fc({},f),s):f&&(s=f)}}),s)}},{key:"assert",value:function(r){if(this.opt&&r==null)return!0;if(!r)return!1;for(var o=0,i=Object.entries(this.items);o<i.length;o++){var s=vs(i[o],2),a=s[0],l=s[1];if(!l.assert(r[a]))return!1}return ke(r)==="object"&&!Array.isArray(r)}},{key:"optional",value:function(){return new e(this.items,!0)}},{key:"serialize",value:function(){return{type:"object",items:Object.fromEntries(Object.entries(this.items).map(function(r){var o=vs(r,2),i=o[0],s=o[1];return[i,s.serialize()]})),opt:this.opt}}}]),e}(br),zD=function(e){return new m1(e)},sO=function(t){xr(e,t);function e(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return yn(this,e),r=yr(this,e),r.item=n,r.opt=o,r}return xn(e,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:ke(o)!=="object"||!Array.isArray(o)?fe({},r,[{message:"Expected 'array', got '".concat(ke(o),"'")}]):(o.forEach(function(a,l){var c=Mr(r,l);if(!c)s=i.appendValidationError(s,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at index ").concat(l),o);else{var u=i.item.validate(c,a);u&&s?s=fc(fc({},u),s):u&&(s=u)}}),s)}},{key:"assert",value:function(r){if(this.opt&&r==null)return!0;if(!r)return!1;var o=qm(r),i;try{for(o.s();!(i=o.n()).done;){var s=i.value;if(!this.item.assert(s))return!1}}catch(a){o.e(a)}finally{o.f()}return ke(r)==="object"&&Array.isArray(r)}},{key:"optional",value:function(){return new e(this.item,!0)}},{key:"serialize",value:function(){return{type:"array",item:this.item.serialize(),opt:this.opt}}}]),e}(br),FD=function(e){return new sO(e)},t0=function(t){xr(e,t);function e(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return yn(this,e),r=yr(this,e),r.value=n,r.opt=o,r}return xn(e,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="string"?fe({},r,[{message:"Expected 'string', got '".concat(ke(o),"'"),value:o}]):o!==this.value?fe({},r,[{message:"Expected literal '".concat(this.value,"', got '").concat(o,"'"),value:o}]):!1}},{key:"assert",value:function(r){return this.opt&&r==null?!0:typeof r=="string"}},{key:"optional",value:function(){return new e(this.value,!0)}},{key:"serialize",value:function(){return{type:"literal",value:this.value,opt:this.opt}}}]),e}(br),BD=function(e){return new t0(e)},aO=function(t){xr(e,t);function e(n,r){var o,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return yn(this,e),o=yr(this,e),o.key=n,o.items=r,o.opt=i,o}return xn(e,[{key:"validate",value:function(r,o){var i=o,s=!1;if(this.opt&&i==null)return!1;if(!this.key)return fe({},r,[{message:"Missing required first argument in union"}]);var a=this.key;if(!Array.isArray(this.items))return fe({},r,[{message:"A union schema must take more than 1 schema arguments",fatal:!0}]);if(typeof a=="string"){if(this.items.some(function(C){return!(C instanceof m1)}))return fe({},r,[{message:"Key is a string, so all schema items must be objects",fatal:!0}]);var l=this.items,c=l.map(function(C){return C.serialize()}),u=c.filter(function(C){return C.type!=="object"||C.items[a].type!=="literal"});if(u.length>0)return fe({},r,[{message:"All schema items must be objects with a key: ".concat(a," that is a literal schema. Found: ").concat(JSON.stringify(u,null,2)),fatal:!0}]);var d=c,f=d.filter(function(C){return C.items[a].opt});if(f.length>1)return fe({},r,[{message:"Schema cannot have an optional keys: ".concat(a),fatal:!0}]);if(ke(i)!=="object")return fe({},r,[{message:"Expected an object"}]);var p=i;if(p[a]===void 0)return fe({},r,[{message:"Missing required key: ".concat(a)}]);var m=[],g=qm(d),y;try{for(g.s();!(y=g.n()).done;){var v=y.value,x=v.items[a];if(x.type==="literal")if(!m.includes(x.value))m.push(x.value);else return fe({},r,[{message:"Found duplicate key in schema: ".concat(x.value),fatal:!0}])}}catch(C){g.e(C)}finally{g.f()}var w=l.find(function(C){return!C.items[a].validate(r,p[a])});if(!w){var S=Mr(r,a);if(!S)throw new Error("Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(a));return fe({},S,[{message:'Invalid key: "'.concat(a,'". Value was: "').concat(p[a],'". Valid values: ').concat(d.map(function(C){var T=C.items[a];if(T.type==="literal"&&T.value)return'"'.concat(T.value,'"');throw new Error("Expected literal schema, got ".concat(JSON.stringify(T,null,2)))}).join(", "))}])}var _=w.validate(r,p);if(_)return _}else if(a instanceof t0){if(this.items.some(function(C){return!(C instanceof t0)}))return fe({},r,[{message:"Key is a literal schema, so all schema items must be literals",fatal:!0}]);var k=[a].concat(QT(this.items));if(typeof i=="string"){var E=k.some(function(C){return!C.validate(r,i)});if(!E)return fe({},r,[{message:"Union must match one of the following: ".concat(k.map(function(C){return'"'.concat(C.value,'"')}).join(", "))}])}}else return fe({},r,[{message:"Expected a string or literal"}]);return s}},{key:"assert",value:function(r){return!0}},{key:"optional",value:function(){return new e(this.key,this.items,!0)}},{key:"serialize",value:function(){return typeof this.key=="string"?{type:"union",key:this.key,items:this.items.map(function(r){return r.serialize()}),opt:this.opt}:{type:"union",items:this.items.map(function(r){return r.serialize()}),opt:this.opt}}}]),e}(br),UD=function(e){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 aO(e,r)},lO=function(t){xr(e,t);function e(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return yn(this,e),r=yr(this,e),r.options=n,r.opt=o,r}return xn(e,[{key:"validate",value:function(r,o){return!1}},{key:"assert",value:function(r){return!0}},{key:"optional",value:function(){return new e(this.options,!0)}},{key:"serialize",value:function(){return{type:"richtext",opt:this.opt,options:this.options}}}]),e}(br),VD=function(e){return new lO(e??{})},cO=function(t){xr(e,t);function e(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return yn(this,e),r=yr(this,e),r.options=n,r.opt=o,r}return xn(e,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:o==null?fe({},r,[{message:"Non-optional image was null or undefined.",value:o}]):typeof o[gn]!="string"?fe({},r,[{message:"Image did not have a file reference string. Got: ".concat(ke(o[gn])),value:o}]):o[sn]!=="file"?fe({},r,[{message:"Image did not have the valid file extension type. Got: ".concat(o[sn]),value:o}]):o.metadata?fe({},r,[{message:"Found metadata, but it could not be validated. Image metadata must be an object with the required props: width (positive number), height (positive number) and sha256 (string of length 64 of the base16 hash).",value:o,fixes:["image:replace-metadata"]}]):fe({},r,[{message:"Could not validate Image metadata.",value:o,fixes:["image:add-metadata"]}])}},{key:"assert",value:function(r){return this.opt&&r==null?!0:(r==null?void 0:r[gn])==="image"&&(r==null?void 0:r[sn])==="file"}},{key:"optional",value:function(){return new e(this.options,!0)}},{key:"serialize",value:function(){return{type:"image",options:this.options,opt:this.opt}}}]),e}(br),HD=function(e){return new cO(e)},uO=function(t){xr(e,t);function e(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return yn(this,e),r=yr(this,e),r.item=n,r.opt=o,r}return xn(e,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:ke(o)!=="object"?fe({},r,[{message:"Expected 'object', got '".concat(ke(o),"'")}]):Array.isArray(o)?fe({},r,[{message:"Expected 'object', got 'array'"}]):(Object.entries(o).forEach(function(a){var l=vs(a,2),c=l[0],u=l[1],d=Mr(r,c);if(!d)s=i.appendValidationError(s,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(u),o);else{var f=i.item.validate(d,u);f&&s?s=fc(fc({},f),s):f&&(s=f)}}),s)}},{key:"assert",value:function(r){if(this.opt&&r==null)return!0;if(!r)return!1;for(var o=0,i=Object.entries(r);o<i.length;o++){var s=vs(i[o],2),a=s[1];if(!this.item.assert(a))return!1}return ke(r)==="object"&&!Array.isArray(r)}},{key:"optional",value:function(){return new e(this.item,!0)}},{key:"serialize",value:function(){return{type:"record",item:this.item.serialize(),opt:this.opt}}}]),e}(br),WD=function(e){return new uO(e)};function KD(t){var e=t[Wt];if(e instanceof h1)throw Error("Cannot get raw source of an Expr");var n=e;return n}function qD(t){return t.indexOf(".")===-1?[t,""]:[t.slice(0,t.indexOf(".")),t.slice(t.indexOf(".")+1)]}function GD(t){return t instanceof m1||ke(t)==="object"&&"type"in t&&t.type==="object"}function YD(t){return t instanceof uO||ke(t)==="object"&&"type"in t&&t.type==="record"}function ZD(t){return t instanceof sO||ke(t)==="object"&&"type"in t&&t.type==="array"}function JD(t){return t instanceof aO||ke(t)==="object"&&"type"in t&&t.type==="union"}function XD(t){return t instanceof lO||ke(t)==="object"&&"type"in t&&t.type==="richtext"}function QD(t){return t instanceof cO||ke(t)==="object"&&"type"in t&&t.type==="image"}function e3(t,e,n){for(var r=t3(t),o=QT(r),i=n,s=e,a=function(){var u=r.shift();if(u===void 0)throw Error("Unexpected undefined part");if(ZD(i)){if(Number.isNaN(Number(u)))throw Error("Invalid path: array schema ".concat(JSON.stringify(i)," must have a number as path, but got ").concat(u,". Path: ").concat(t));if(ke(s)!=="object"&&!Array.isArray(s))throw Error("Schema type error: expected source to be type of array, but got ".concat(ke(s)));if(s[u]===void 0){var d;throw Error("Invalid path: array source (length: ".concat((d=s)===null||d===void 0?void 0:d.length,") did not have index ").concat(u," from path: ").concat(t))}s=s[u],i=i.item}else if(YD(i)){if(typeof u!="string")throw Error("Invalid path: record schema ".concat(i," must have path: ").concat(u," as string"));if(ke(s)!=="object"&&!Array.isArray(s))throw Error("Schema type error: expected source to be type of record, but got ".concat(ke(s)));if(!s[u])throw Error("Invalid path: record source did not have key ".concat(u," from path: ").concat(t));s=s[u],i=i.item}else if(GD(i)){if(ke(s)!=="object")throw Error("Schema type error: expected source to be type of object, but got ".concat(ke(s)));if(!s[u])throw Error("Invalid path: object source did not have key ".concat(u," from path: ").concat(t));s=s[u],i=i.items[u]}else{if(QD(i))return{v:{path:o.slice(0,o.length-r.length-1).map(function(g){return JSON.stringify(g)}).join("."),schema:i,source:s}};if(JD(i)){var f=i.key;if(!f)return{v:{path:o.map(function(g){return Number.isNaN(Number(g))?JSON.stringify(g):g}).join("."),schema:i,source:s}};var p=s[f];if(!p)throw Error("Invalid path: union source ".concat(i," did not have required key ").concat(f," in path: ").concat(t));var m=i.items.find(function(g){var y;return(g==null||(y=g.items)===null||y===void 0||(y=y[f])===null||y===void 0?void 0:y.value)===p});if(!m)throw Error("Invalid path: union schema ".concat(i," did not have a child object with ").concat(f," of value ").concat(p," in path: ").concat(t));i=m.items[u],s=s[u]}else{if(XD(i))return{v:{path:o.slice(0,o.length-r.length-1).map(function(g){return JSON.stringify(g)}).join("."),schema:i,source:s}};throw Error("Invalid path: ".concat(u," resolved to an unexpected schema ").concat(JSON.stringify(i)))}}},l;r.length>0;)if(l=a(),l)return l.v;if(r.length>0)throw Error("Invalid path: ".concat(r.join(".")," is not a valid path"));return{path:o.map(function(c){return Number.isNaN(Number(c))?JSON.stringify(c):c}).join("."),schema:i,source:s}}function t3(t){for(var e=[],n=0;n<t.length;){var r="";if(t[n]==='"'){for(n++;n<t.length&&t[n]!=='"';)t[n]==="\\"&&t[n+1]==='"'?(r+='"',n++):r+=t[n],n++;if(t[n]!=='"'){var o;throw new Error("Invalid input (".concat(JSON.stringify(t),"): Missing closing double quote: ").concat((o=t[n])!==null&&o!==void 0?o:"at end of string"," (char: ").concat(n,"; length: ").concat(t.length,")"))}}else for(;n<t.length&&t[n]!==".";)r+=t[n],n++;r!==""&&e.push(r),n++}return e}var n3=function(t){xr(e,t);function e(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return yn(this,e),r=yr(this,e),r.options=n,r.opt=o,r}return xn(e,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="number"?fe({},r,[{message:"Expected 'number', got '".concat(ke(o),"'"),value:o}]):!1}},{key:"assert",value:function(r){return this.opt&&r==null?!0:typeof r=="number"}},{key:"optional",value:function(){return new e(this.options,!0)}},{key:"serialize",value:function(){return{type:"number",options:this.options,opt:this.opt}}}]),e}(br),r3=function(e){return new n3(e)},dO=function(t){xr(e,t);function e(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return yn(this,e),r=yr(this,e),r.options=n,r.opt=o,r.isRaw=i,r}return xn(e,[{key:"validate",value:function(r,o){var i,s,a;if(this.opt&&o==null)return!1;if(typeof o!="string")return fe({},r,[{message:"Expected 'string', got '".concat(ke(o),"'"),value:o}]);var l=[];return(i=this.options)!==null&&i!==void 0&&i.maxLength&&o.length>this.options.maxLength&&l.push({message:"Expected string to be at most ".concat(this.options.maxLength," characters long, got ").concat(o.length),value:o}),(s=this.options)!==null&&s!==void 0&&s.minLength&&o.length<this.options.minLength&&l.push({message:"Expected string to be at least ".concat(this.options.minLength," characters long, got ").concat(o.length),value:o}),(a=this.options)!==null&&a!==void 0&&a.regexp&&!this.options.regexp.test(o)&&l.push({message:"Expected string to match reg exp: ".concat(this.options.regexp.toString(),", got '").concat(o,"'"),value:o}),l.length>0?fe({},r,l):!1}},{key:"assert",value:function(r){return this.opt&&r==null?!0:typeof r=="string"}},{key:"optional",value:function(){return new e(this.options,!0,this.isRaw)}},{key:"raw",value:function(){return new e(this.options,this.opt,!0)}},{key:"serialize",value:function(){var r,o,i;return{type:"string",options:{maxLength:(r=this.options)===null||r===void 0?void 0:r.maxLength,minLength:(o=this.options)===null||o===void 0?void 0:o.minLength,regexp:((i=this.options)===null||i===void 0?void 0:i.regexp)&&{source:this.options.regexp.source,flags:this.options.regexp.flags}},opt:this.opt,raw:this.isRaw}}}]),e}(br),o3=function(e){return new dO(e)},i3=function(t){xr(e,t);function e(){var n,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return yn(this,e),n=yr(this,e),n.opt=r,n}return xn(e,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="boolean"?fe({},r,[{message:"Expected 'boolean', got '".concat(ke(o),"'"),value:o}]):!1}},{key:"assert",value:function(r){return this.opt&&r==null?!0:typeof r=="boolean"}},{key:"optional",value:function(){return new e(!0)}},{key:"serialize",value:function(){return{type:"boolean",opt:this.opt}}}]),e}(br),s3=function(){return new i3},a3=function(t){xr(e,t);function e(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return yn(this,e),r=yr(this,e),r.selector=n,r.opt=o,r}return xn(e,[{key:"validate",value:function(r,o){if(this.opt&&o==null)return!1;var i=this.selector[ba];if(!i)return fe({},r,[{message:"Schema not found for module. keyOf must be used with a Val Module"}]);var s=i.serialize();if(!(s.type==="array"||s.type==="object"||s.type==="record"))return fe({},r,[{message:"Schema in keyOf must be an 'array', 'object' or 'record'. Found '".concat(s.type,"'")}]);if(s.opt&&o==null)return!1;if(s.type==="array"&&typeof o!="number")return fe({},r,[{message:"Type of value in keyof (array) must be 'number'"}]);if(s.type==="record"&&typeof o!="string")return fe({},r,[{message:"Type of value in keyof (record) must be 'string'"}]);if(s.type==="object"){var a=Object.keys(s.items);if(!a.includes(o))return fe({},r,[{message:"Value of keyOf (object) must be: ".concat(a.join(", "),". Found: ").concat(o)}])}return!1}},{key:"assert",value:function(r){if(this.opt&&r==null)return!0;var o=this.selector[ba];if(!o)return!1;var i=o.serialize();if(!(i.type==="array"||i.type==="object"||i.type==="record"))return!1;if(i.opt&&r==null)return!0;if(i.type==="array"&&typeof r!="number"||i.type==="record"&&typeof r!="string")return!1;if(i.type==="object"){var s=Object.keys(i.items);if(!s.includes(r))return!1}return!0}},{key:"optional",value:function(){return new e(this.selector,!0)}},{key:"serialize",value:function(){var r,o=iO(this.selector);if(!o)throw new Error("Cannot serialize keyOf schema with empty selector. TIP: keyOf must be used with a Val Module.");var i=(r=this.selector[ba])===null||r===void 0?void 0:r.serialize();if(!i)throw new Error("Cannot serialize oneOf schema with empty selector.");var s;switch(i.type){case"array":s="number";break;case"record":s="string";break;case"object":s=Object.keys(i.items);break;default:throw new Error("Cannot serialize oneOf schema with selector of type '".concat(i.type,"'. keyOf must be used with a Val Module."))}return{type:"keyOf",selector:o,opt:this.opt,values:s}}}]),e}(br),l3=function(e){return new a3(e)};function c3(){return{string:o3,boolean:s3,array:FD,object:zD,number:r3,union:UD,richtext:VD,image:HD,literal:BD,keyOf:l3,record:WD,file:DD}}function u3(t){return fO(p3(t))}function d3(t){return ys(t)?ke(t[Wt])==="object"&&t[Wt]!==null&&Array.isArray(t[Wt]):Array.isArray(t)}function f3(t){return ys(t)?ke(t[Wt])==="object"&&t[Wt]!==null&&!Array.isArray(t[Wt]):ke(t)==="object"}function p3(t){var e=Qt(t);function n(r){var o=d3(r),i=f3(r);if(o){var s=Wt in r?r[Wt]:r,a=An in r?r[An]:void 0;return{val:s.map(function(u,d){return n(ys(u)?u:Qt(u,Mr(a,d)))}),valPath:a}}else if(i){var l=Wt in r?r[Wt]:r,c=An in r?r[An]:void 0;return{val:l!==null&&Object.fromEntries(Object.entries(l).map(function(u){var d=vs(u,2),f=d[0],p=d[1];return[f,n(ys(p)?p:Qt(p,Mr(c,f)))]})),valPath:c}}else return ys(r)?{val:n(r[Wt]),valPath:r[An]}:r}return n(e)}function n0(t){var e=oO(t)?t.val:t;switch(ke(e)){case"function":case"symbol":throw Error("Invalid val type: ".concat(ke(e)));case"object":return e===null?null:Array.isArray(e)?e.map(n0):Object.fromEntries(Object.entries(e).map(function(n){var r=vs(n,2),o=r[0],i=r[1];return[o,i&&n0(i)]}));default:return e}}function fO(t){var e=t.val;switch(ke(e)){case"function":case"symbol":throw Error("Invalid val type: ".concat(ke(e)));case"object":if(e!==null)return new Proxy(e,{has:function(r,o){return o==="val"||o===An?!0:yk(r,o)},get:function(r,o){if(o===An)return t.valPath;if(o==="val")return n0(t);if(Array.isArray(r)&&o==="length")return r.length;if(yk(e,o)){var i,s;return fO({val:Reflect.get(r,o).val,valPath:(i=(s=Reflect.get(r,o))===null||s===void 0?void 0:s.valPath)!==null&&i!==void 0?i:Mr(t.valPath,Array.isArray(r)?Number(o):o)})}return Reflect.get(r,o)}});default:return fe(fe({},An,t.valPath),"val",t.val)}}function yk(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var h3=[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],lt=function(t){return t[t.inputBytes=64]="inputBytes",t[t.inputWords=16]="inputWords",t[t.highIndex=14]="highIndex",t[t.lowIndex=15]="lowIndex",t[t.workWords=64]="workWords",t[t.allocBytes=80]="allocBytes",t[t.allocWords=20]="allocWords",t[t.allocTotal=8e3]="allocTotal",t}(lt||{}),xk={sha256:1};function m3(t){if(t&&!xk[t]&&!xk[t.toLowerCase()])throw new Error("Digest method not supported");return new g3}var g3=function(){function t(){yn(this,t),fe(this,"A",1779033703),fe(this,"B",-1150833019),fe(this,"C",1013904242),fe(this,"D",-1521486534),fe(this,"E",1359893119),fe(this,"F",-1694144372),fe(this,"G",528734635),fe(this,"H",1541459225),fe(this,"_size",0),fe(this,"_sp",0),(!lp||nu>=lt.allocTotal)&&(lp=new ArrayBuffer(lt.allocTotal),nu=0),this._byte=new Uint8Array(lp,nu,lt.allocBytes),this._word=new Int32Array(lp,nu,lt.allocWords),nu+=lt.allocBytes}return xn(t,[{key:"update",value:function(n){if(typeof n=="string")return this._utf8(n);if(n==null)throw new TypeError("Invalid type: "+ke(n));var r=n.byteOffset,o=n.byteLength,i=o/lt.inputBytes|0,s=0;if(i&&!(r&3)&&!(this._size%lt.inputBytes)){for(var a=new Int32Array(n.buffer,r,i*lt.inputWords);i--;)this._int32(a,s>>2),s+=lt.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%lt.inputBytes,l=a;r<s&&l<lt.inputBytes;)o[l++]=n[r++];l>=lt.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%lt.inputBytes,c=l;a<i&&c<lt.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>=lt.inputBytes&&(this._int32(o),o[0]=o[lt.inputWords]),this._size+=c-l}return this._sp=s,this}},{key:"_int32",value:function(n,r){var o=this.A,i=this.B,s=this.C,a=this.D,l=this.E,c=this.F,u=this.G,d=this.H,f=0;for(r=r|0;f<lt.inputWords;)Gs[f++]=Hr(n[r++]);for(f=lt.inputWords;f<lt.workWords;f++)Gs[f]=E3(Gs[f-2])+Gs[f-7]+S3(Gs[f-15])+Gs[f-16]|0;for(f=0;f<lt.workWords;f++){var p=d+k3(l)+x3(l,c,u)+h3[f]+Gs[f]|0,m=w3(o)+b3(o,i,s)|0;d=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=d+this.H|0}},{key:"digest",value:function(n){var r=this._byte,o=this._word,i=this._size%lt.inputBytes|0;for(r[i++]=128;i&3;)r[i++]=0;if(i>>=2,i>lt.highIndex){for(;i<lt.inputWords;)o[i++]=0;i=0,this._int32(o)}for(;i<lt.inputWords;)o[i++]=0;var s=this._size*8,a=(s&4294967295)>>>0,l=(s-a)/4294967296;return l&&(o[lt.highIndex]=Hr(l)),a&&(o[lt.lowIndex]=Hr(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 Ai(n)+Ai(r)+Ai(o)+Ai(i)+Ai(s)+Ai(a)+Ai(l)+Ai(c)}},{key:"_bin",value:function(){var n=this.A,r=this.B,o=this.C,i=this.D,s=this.E,a=this.F,l=this.G,c=this.H,u=this._byte,d=this._word;return d[0]=Hr(n),d[1]=Hr(r),d[2]=Hr(o),d[3]=Hr(i),d[4]=Hr(s),d[5]=Hr(a),d[6]=Hr(l),d[7]=Hr(c),u.slice(0,32)}}]),t}(),Gs=new Int32Array(lt.workWords),lp,nu=0,Ai=function(e){return(e+4294967296).toString(16).substr(-8)},v3=function(e){return e<<24&4278190080|e<<8&16711680|e>>8&65280|e>>24&255},y3=function(e){return e},Hr=_3()?y3:v3,x3=function(e,n,r){return r^e&(n^r)},b3=function(e,n,r){return e&n|r&(e|n)},w3=function(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)},k3=function(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)},S3=function(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3},E3=function(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10};function _3(){var t=new Uint8Array(new Uint16Array([65279]).buffer);return t[0]===254}var C3=function(e){return m3().update(e).digest("hex")};function Td(){Td=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(R,N,O){R[N]=O.value},i=typeof Symbol=="function"?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(R,N,O){return Object.defineProperty(R,N,{value:O,enumerable:!0,configurable:!0,writable:!0}),R[N]}try{c({},"")}catch{c=function(N,O,P){return N[O]=P}}function u(R,N,O,P){var I=N&&N.prototype instanceof v?N:v,H=Object.create(I.prototype),le=new U(P||[]);return o(H,"_invoke",{value:A(R,O,le)}),H}function d(R,N,O){try{return{type:"normal",arg:R.call(N,O)}}catch(P){return{type:"throw",arg:P}}}e.wrap=u;var f="suspendedStart",p="suspendedYield",m="executing",g="completed",y={};function v(){}function x(){}function w(){}var S={};c(S,s,function(){return this});var _=Object.getPrototypeOf,k=_&&_(_(G([])));k&&k!==n&&r.call(k,s)&&(S=k);var E=w.prototype=v.prototype=Object.create(S);function C(R){["next","throw","return"].forEach(function(N){c(R,N,function(O){return this._invoke(N,O)})})}function T(R,N){function O(I,H,le,Le){var Ee=d(R[I],R,H);if(Ee.type!=="throw"){var Je=Ee.arg,Ae=Je.value;return Ae&&typeof Ae=="object"&&r.call(Ae,"__await")?N.resolve(Ae.__await).then(function(ne){O("next",ne,le,Le)},function(ne){O("throw",ne,le,Le)}):N.resolve(Ae).then(function(ne){Je.value=ne,le(Je)},function(ne){return O("throw",ne,le,Le)})}Le(Ee.arg)}var P;o(this,"_invoke",{value:function(I,H){function le(){return new N(function(Le,Ee){O(I,H,Le,Ee)})}return P=P?P.then(le,le):le()}})}function A(R,N,O){var P=f;return function(I,H){if(P===m)throw new Error("Generator is already running");if(P===g){if(I==="throw")throw H;return{value:t,done:!0}}for(O.method=I,O.arg=H;;){var le=O.delegate;if(le){var Le=B(le,O);if(Le){if(Le===y)continue;return Le}}if(O.method==="next")O.sent=O._sent=O.arg;else if(O.method==="throw"){if(P===f)throw P=g,O.arg;O.dispatchException(O.arg)}else O.method==="return"&&O.abrupt("return",O.arg);P=m;var Ee=d(R,N,O);if(Ee.type==="normal"){if(P=O.done?g:p,Ee.arg===y)continue;return{value:Ee.arg,done:O.done}}Ee.type==="throw"&&(P=g,O.method="throw",O.arg=Ee.arg)}}}function B(R,N){var O=N.method,P=R.iterator[O];if(P===t)return N.delegate=null,O==="throw"&&R.iterator.return&&(N.method="return",N.arg=t,B(R,N),N.method==="throw")||O!=="return"&&(N.method="throw",N.arg=new TypeError("The iterator does not provide a '"+O+"' method")),y;var I=d(P,R.iterator,N.arg);if(I.type==="throw")return N.method="throw",N.arg=I.arg,N.delegate=null,y;var H=I.arg;return H?H.done?(N[R.resultName]=H.value,N.next=R.nextLoc,N.method!=="return"&&(N.method="next",N.arg=t),N.delegate=null,y):H:(N.method="throw",N.arg=new TypeError("iterator result is not an object"),N.delegate=null,y)}function D(R){var N={tryLoc:R[0]};1 in R&&(N.catchLoc=R[1]),2 in R&&(N.finallyLoc=R[2],N.afterLoc=R[3]),this.tryEntries.push(N)}function Z(R){var N=R.completion||{};N.type="normal",delete N.arg,R.completion=N}function U(R){this.tryEntries=[{tryLoc:"root"}],R.forEach(D,this),this.reset(!0)}function G(R){if(R||R===""){var N=R[s];if(N)return N.call(R);if(typeof R.next=="function")return R;if(!isNaN(R.length)){var O=-1,P=function I(){for(;++O<R.length;)if(r.call(R,O))return I.value=R[O],I.done=!1,I;return I.value=t,I.done=!0,I};return P.next=P}}throw new TypeError(typeof R+" is not iterable")}return x.prototype=w,o(E,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:x,configurable:!0}),x.displayName=c(w,l,"GeneratorFunction"),e.isGeneratorFunction=function(R){var N=typeof R=="function"&&R.constructor;return!!N&&(N===x||(N.displayName||N.name)==="GeneratorFunction")},e.mark=function(R){return Object.setPrototypeOf?Object.setPrototypeOf(R,w):(R.__proto__=w,c(R,l,"GeneratorFunction")),R.prototype=Object.create(E),R},e.awrap=function(R){return{__await:R}},C(T.prototype),c(T.prototype,a,function(){return this}),e.AsyncIterator=T,e.async=function(R,N,O,P,I){I===void 0&&(I=Promise);var H=new T(u(R,N,O,P),I);return e.isGeneratorFunction(N)?H:H.next().then(function(le){return le.done?le.value:H.next()})},C(E),c(E,l,"Generator"),c(E,s,function(){return this}),c(E,"toString",function(){return"[object Generator]"}),e.keys=function(R){var N=Object(R),O=[];for(var P in N)O.push(P);return O.reverse(),function I(){for(;O.length;){var H=O.pop();if(H in N)return I.value=H,I.done=!1,I}return I.done=!0,I}},e.values=G,U.prototype={constructor:U,reset:function(R){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(Z),!R)for(var N in this)N.charAt(0)==="t"&&r.call(this,N)&&!isNaN(+N.slice(1))&&(this[N]=t)},stop:function(){this.done=!0;var R=this.tryEntries[0].completion;if(R.type==="throw")throw R.arg;return this.rval},dispatchException:function(R){if(this.done)throw R;var N=this;function O(Ee,Je){return H.type="throw",H.arg=R,N.next=Ee,Je&&(N.method="next",N.arg=t),!!Je}for(var P=this.tryEntries.length-1;P>=0;--P){var I=this.tryEntries[P],H=I.completion;if(I.tryLoc==="root")return O("end");if(I.tryLoc<=this.prev){var le=r.call(I,"catchLoc"),Le=r.call(I,"finallyLoc");if(le&&Le){if(this.prev<I.catchLoc)return O(I.catchLoc,!0);if(this.prev<I.finallyLoc)return O(I.finallyLoc)}else if(le){if(this.prev<I.catchLoc)return O(I.catchLoc,!0)}else{if(!Le)throw new Error("try statement without catch or finally");if(this.prev<I.finallyLoc)return O(I.finallyLoc)}}}},abrupt:function(R,N){for(var O=this.tryEntries.length-1;O>=0;--O){var P=this.tryEntries[O];if(P.tryLoc<=this.prev&&r.call(P,"finallyLoc")&&this.prev<P.finallyLoc){var I=P;break}}I&&(R==="break"||R==="continue")&&I.tryLoc<=N&&N<=I.finallyLoc&&(I=null);var H=I?I.completion:{};return H.type=R,H.arg=N,I?(this.method="next",this.next=I.finallyLoc,y):this.complete(H)},complete:function(R,N){if(R.type==="throw")throw R.arg;return R.type==="break"||R.type==="continue"?this.next=R.arg:R.type==="return"?(this.rval=this.arg=R.arg,this.method="return",this.next="end"):R.type==="normal"&&N&&(this.next=N),y},finish:function(R){for(var N=this.tryEntries.length-1;N>=0;--N){var O=this.tryEntries[N];if(O.finallyLoc===R)return this.complete(O.completion,O.afterLoc),Z(O),y}},catch:function(R){for(var N=this.tryEntries.length-1;N>=0;--N){var O=this.tryEntries[N];if(O.tryLoc===R){var P=O.completion;if(P.type==="throw"){var I=P.arg;Z(O)}return I}}throw new Error("illegal catch attempt")},delegateYield:function(R,N,O){return this.delegate={iterator:G(R),resultName:N,nextLoc:O},this.method==="next"&&(this.arg=t),y}},e}function bk(t,e,n,r,o,i,s){try{var a=t[i](s),l=a.value}catch(c){n(c);return}a.done?e(l):Promise.resolve(l).then(r,o)}function pO(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function s(l){bk(i,r,o,s,a,"next",l)}function a(l){bk(i,r,o,s,a,"throw",l)}s(void 0)})}}var T3=function(){function t(e){yn(this,t),this.host=e}return xn(t,[{key:"getDisableUrl",value:function(n){return"".concat(this.host,"/disable?redirect_to=").concat(encodeURIComponent(n))}},{key:"getLoginUrl",value:function(n){return"".concat(this.host,"/authorize?redirect_to=").concat(encodeURIComponent(n))}},{key:"getEnableUrl",value:function(n){return"".concat(this.host,"/enable?redirect_to=").concat(encodeURIComponent(n))}},{key:"getPatches",value:function(){var e=pO(Td().mark(function r(o){var i,s,a;return Td().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return i=o.patchIds,s=o.headers,a=i?"?".concat(i.map(function(u){return"".concat(u,"=").concat(encodeURIComponent(u))}).join("&")):"",c.abrupt("return",fetch("".concat(this.host,"/patches/~").concat(a),{headers:s||{"Content-Type":"application/json"}}).then(function(u){return ou(u)}).catch(ru));case 3:case"end":return c.stop()}},r,this)}));function n(r){return e.apply(this,arguments)}return n}()},{key:"getEditUrl",value:function(){return"".concat(this.host,"/static/edit")}},{key:"postPatches",value:function(n,r,o){return fetch("".concat(this.host,"/patches/~"),{headers:o||{"Content-Type":"application/json"},method:"POST",body:JSON.stringify(fe({},n,r))}).then(function(i){return ou(i)}).catch(ru)}},{key:"getSession",value:function(){return fetch("".concat(this.host,"/session")).then(function(n){return ou(n).catch(ru)})}},{key:"getTree",value:function(n){var r=n.patch,o=r===void 0?!1:r,i=n.includeSchema,s=i===void 0?!1:i,a=n.includeSource,l=a===void 0?!1:a,c=n.treePath,u=c===void 0?"/":c,d=n.headers,f=new URLSearchParams;return f.set("patch",o.toString()),f.set("schema",s.toString()),f.set("source",l.toString()),fetch("".concat(this.host,"/tree/~").concat(u,"?").concat(f.toString()),{headers:d}).then(function(p){return ou(p)}).catch(ru)}},{key:"postCommit",value:function(n){var r=n.patches,o=n.headers;return fetch("".concat(this.host,"/commit"),{method:"POST",body:JSON.stringify({patches:r}),headers:o||{"Content-Type":"application/json"}}).then(function(i){return ou(i)}).catch(ru)}}]),t}();function ru(t){return Po({statusCode:500,message:t instanceof Error?t.message:"Unknown error"})}function ou(t){return r0.apply(this,arguments)}function r0(){return r0=pO(Td().mark(function t(e){var n;return Td().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(o.prev=0,!e.ok){o.next=9;break}return o.t0=xa,o.next=5,e.json();case 5:return o.t1=o.sent,o.abrupt("return",o.t0.ok.call(o.t0,o.t1));case 9:return o.prev=9,o.next=12,e.json();case 12:return n=o.sent,o.abrupt("return",Po({statusCode:e.status,message:n.message||e.statusText,details:n.details||Object.fromEntries(Object.entries(n).filter(function(i){var s=vs(i,1),a=s[0];return a!=="message"}))}));case 16:return o.prev=16,o.t2=o.catch(9),o.abrupt("return",Po({statusCode:e.status,message:e.statusText}));case 19:o.next=24;break;case 21:return o.prev=21,o.t3=o.catch(0),o.abrupt("return",Po({message:o.t3 instanceof Error?o.t3.message:"Unknown error"}));case 24:case"end":return o.stop()}},t,null,[[0,21],[9,16]])})),r0.apply(this,arguments)}var yt={convertFileSource:rO,getSchema:$D,getValPath:iO,getVal:u3,getSource:KD,resolvePath:e3,splitModuleIdAndModulePath:qD,isVal:LD,createValPathOfItem:Mr,getSHA256Hash:C3,initSchema:c3,createPatchJSONPath:function(e){return"/".concat(e.split(".").map(function(n){return n&&O3(n)}).join("/"))},VAL_ENABLE_COOKIE_NAME:"val_enable",VAL_STATE_COOKIE:"val_state",VAL_SESSION_COOKIE:"val_session"};function O3(t){try{return JSON.parse(t)}catch{return t}}var hO={exports:{}};/*!
43
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vs(t,e){return MD(t)||RD(t,e)||f1(t,e)||ND()}function yn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function mk(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,eO(r.key),r)}}function xn(t,e,n){return e&&mk(t.prototype,e),n&&mk(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function _h(t){return _h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},_h(t)}function tO(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(tO=function(){return!!t})()}function nO(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function PD(t,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return nO(t)}function yr(t,e,n){return e=_h(e),PD(t,tO()?Reflect.construct(e,n||[],_h(t).constructor):e.apply(t,n))}function e0(t,e){return e0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},e0(t,e)}function xr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&e0(t,e)}var br=function(){function t(){yn(this,t)}return xn(t,[{key:"appendValidationError",value:function(n,r,o,i){return n?(n[r]?n[r].push({message:o,value:i}):n[r]=[{message:o,value:i}],n):fe({},r,[{message:o,value:i}])}}]),t}(),ba=Symbol("GetSchema"),An=Symbol("Path"),Wt=Symbol("GetSource");function $D(t){return t[ba]}var h1=xn(function t(e){yn(this,t),this.span=e}),AD=function(t){xr(e,t);function e(n,r){var o;return yn(this,e),o=yr(this,e,[r]),fe(nO(o),"type","Sym"),o.value=n,o}return xn(e,[{key:"transpile",value:function(){return this.value}}]),e}(h1);new AD("()");var sn="_type",gn="_ref",ID=function(t){xr(e,t);function e(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return yn(this,e),r=yr(this,e),r.options=n,r.opt=o,r}return xn(e,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:o==null?fe({},r,[{message:"Non-optional file was null or undefined.",value:o}]):typeof o[gn]!="string"?fe({},r,[{message:"File did not have a file reference string. Got: ".concat(ke(o[gn])),value:o}]):o[sn]!=="file"?fe({},r,[{message:"File did not have the valid file extension type. Got: ".concat(o[sn]),value:o}]):o.metadata?fe({},r,[{message:"Found metadata, but it could not be validated. File metadata must be an object with the required props: width (positive number), height (positive number) and sha256 (string of length 64 of the base16 hash).",value:o,fixes:["file:check-metadata"]}]):fe({},r,[{message:"Missing File metadata.",value:o,fixes:["file:add-metadata"]}])}},{key:"assert",value:function(r){return this.opt&&r==null?!0:(r==null?void 0:r[gn])==="file"&&(r==null?void 0:r[sn])==="file"}},{key:"optional",value:function(){return new e(this.options,!0)}},{key:"serialize",value:function(){return{type:"file",options:this.options,opt:this.opt}}}]),e}(br),DD=function(e){return new ID(e)};function rO(t){var e,n;if(!t[gn].startsWith("/public")){var r,o;return{url:t[gn]+((r=t.metadata)!==null&&r!==void 0&&r.sha256?"?sha256=".concat((o=t.metadata)===null||o===void 0?void 0:o.sha256):""),metadata:t.metadata}}return{url:t[gn].slice(7)+((e=t.metadata)!==null&&e!==void 0&&e.sha256?"?sha256=".concat((n=t.metadata)===null||n===void 0?void 0:n.sha256):""),metadata:t.metadata}}function oO(t){return ke(t)==="object"&&t!==null&&t!==void 0&&("val"in t||"valPath"in t)}function LD(t){return ke(t)==="object"&&t!==null&&t!==void 0&&An in t&&"val"in t}function iO(t){return t[An]}function jD(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function gk(t,e,n){return e?Qt(t(Qt(e,n))):Qt(e,n)}function ys(t){return ke(t)==="object"&&t!==null&&(Wt in t||An in t)}function Qt(t,e,n){if(ke(t)==="object"){if(ys(t))return t;if(oO(t))return Qt(t.val,t.valPath)}if(t&&t[gn]&&t[sn]==="file"){var r=t[gn];if(typeof r!="string")throw Error("Invalid file ref: "+r);return Qt(rO(t),e,n)}switch(ke(t)){case"function":case"symbol":throw Error("Invalid selector type: ".concat(ke(t),": ").concat(t));case"object":if(t!==null)return new Proxy(t,{has:function(i,s){return s===Wt||s===An||s==="andThen"||s===ba?!0:s in i},get:function(i,s){if(s===Wt)return t;if(s===An)return e;if(s===ba)return n;if(s==="andThen")return function(l){return gk(l,t,e)};if(Array.isArray(i)){if(s==="filter")return function(l){var c=i.map(function(u,d){return Qt(u,Mr(e,d),n==null?void 0:n.item)}).filter(function(u){return l&&l instanceof br?l.assert(vk(u)):vk(l(u))});return Qt(c,e,n)};if(s==="map")return function(l){var c=i.map(function(u,d){var f=l(Qt(u,Mr(e,d),n==null?void 0:n.item),Qt(d));return ys(f)?f:Qt(f)});return Qt(c,e,n)}}if(Array.isArray(i)&&s==="length")return Qt(i.length);var a=Reflect.get(i,s);return jD(t,s)?Number.isNaN(Number(s))?Qt(a,Mr(e,s),n==null?void 0:n.items[s]):Qt(a,Mr(e,Number(s)),n==null?void 0:n.item):a}});default:return fe(fe(fe({eq:function(i){var s=i;if(ys(i)&&(s=i[Wt],s instanceof h1))throw Error("TODO: Cannot evaluate equality with an Expr");return Qt(t===s,void 0)},andThen:function(i){return gk(i,t===void 0?null:t,e)}},Wt,t===void 0?null:t),An,e),ba,n)}}function Mr(t,e){if(ke(e)==="symbol")throw Error("Cannot create val path of array item with symbol prop: ".concat(e.toString()));return t&&"".concat(t,".").concat(JSON.stringify(e))}function vk(t){if(ke(t)==="object"&&(Wt in t||An in t)){var e=t[Wt];return e}return t}var m1=function(t){xr(e,t);function e(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return yn(this,e),r=yr(this,e),r.items=n,r.opt=o,r}return xn(e,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:ke(o)!=="object"?fe({},r,[{message:"Expected 'object', got '".concat(ke(o),"'")}]):Array.isArray(o)?fe({},r,[{message:"Expected 'object', got 'array'"}]):(Object.entries(this.items).forEach(function(a){var l=vs(a,2),c=l[0],u=l[1],d=Mr(r,c);if(!d)s=i.appendValidationError(s,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(c),o);else{var f=u.validate(d,o[c]);f&&s?s=fc(fc({},f),s):f&&(s=f)}}),s)}},{key:"assert",value:function(r){if(this.opt&&r==null)return!0;if(!r)return!1;for(var o=0,i=Object.entries(this.items);o<i.length;o++){var s=vs(i[o],2),a=s[0],l=s[1];if(!l.assert(r[a]))return!1}return ke(r)==="object"&&!Array.isArray(r)}},{key:"optional",value:function(){return new e(this.items,!0)}},{key:"serialize",value:function(){return{type:"object",items:Object.fromEntries(Object.entries(this.items).map(function(r){var o=vs(r,2),i=o[0],s=o[1];return[i,s.serialize()]})),opt:this.opt}}}]),e}(br),zD=function(e){return new m1(e)},sO=function(t){xr(e,t);function e(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return yn(this,e),r=yr(this,e),r.item=n,r.opt=o,r}return xn(e,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:ke(o)!=="object"||!Array.isArray(o)?fe({},r,[{message:"Expected 'array', got '".concat(ke(o),"'")}]):(o.forEach(function(a,l){var c=Mr(r,l);if(!c)s=i.appendValidationError(s,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at index ").concat(l),o);else{var u=i.item.validate(c,a);u&&s?s=fc(fc({},u),s):u&&(s=u)}}),s)}},{key:"assert",value:function(r){if(this.opt&&r==null)return!0;if(!r)return!1;var o=qm(r),i;try{for(o.s();!(i=o.n()).done;){var s=i.value;if(!this.item.assert(s))return!1}}catch(a){o.e(a)}finally{o.f()}return ke(r)==="object"&&Array.isArray(r)}},{key:"optional",value:function(){return new e(this.item,!0)}},{key:"serialize",value:function(){return{type:"array",item:this.item.serialize(),opt:this.opt}}}]),e}(br),FD=function(e){return new sO(e)},t0=function(t){xr(e,t);function e(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return yn(this,e),r=yr(this,e),r.value=n,r.opt=o,r}return xn(e,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="string"?fe({},r,[{message:"Expected 'string', got '".concat(ke(o),"'"),value:o}]):o!==this.value?fe({},r,[{message:"Expected literal '".concat(this.value,"', got '").concat(o,"'"),value:o}]):!1}},{key:"assert",value:function(r){return this.opt&&r==null?!0:typeof r=="string"}},{key:"optional",value:function(){return new e(this.value,!0)}},{key:"serialize",value:function(){return{type:"literal",value:this.value,opt:this.opt}}}]),e}(br),BD=function(e){return new t0(e)},aO=function(t){xr(e,t);function e(n,r){var o,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return yn(this,e),o=yr(this,e),o.key=n,o.items=r,o.opt=i,o}return xn(e,[{key:"validate",value:function(r,o){var i=o,s=!1;if(this.opt&&i==null)return!1;if(!this.key)return fe({},r,[{message:"Missing required first argument in union"}]);var a=this.key;if(!Array.isArray(this.items))return fe({},r,[{message:"A union schema must take more than 1 schema arguments",fatal:!0}]);if(typeof a=="string"){if(this.items.some(function(C){return!(C instanceof m1)}))return fe({},r,[{message:"Key is a string, so all schema items must be objects",fatal:!0}]);var l=this.items,c=l.map(function(C){return C.serialize()}),u=c.filter(function(C){return C.type!=="object"||C.items[a].type!=="literal"});if(u.length>0)return fe({},r,[{message:"All schema items must be objects with a key: ".concat(a," that is a literal schema. Found: ").concat(JSON.stringify(u,null,2)),fatal:!0}]);var d=c,f=d.filter(function(C){return C.items[a].opt});if(f.length>1)return fe({},r,[{message:"Schema cannot have an optional keys: ".concat(a),fatal:!0}]);if(ke(i)!=="object")return fe({},r,[{message:"Expected an object"}]);var p=i;if(p[a]===void 0)return fe({},r,[{message:"Missing required key: ".concat(a)}]);var m=[],g=qm(d),y;try{for(g.s();!(y=g.n()).done;){var v=y.value,x=v.items[a];if(x.type==="literal")if(!m.includes(x.value))m.push(x.value);else return fe({},r,[{message:"Found duplicate key in schema: ".concat(x.value),fatal:!0}])}}catch(C){g.e(C)}finally{g.f()}var w=l.find(function(C){return!C.items[a].validate(r,p[a])});if(!w){var S=Mr(r,a);if(!S)throw new Error("Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(a));return fe({},S,[{message:'Invalid key: "'.concat(a,'". Value was: "').concat(p[a],'". Valid values: ').concat(d.map(function(C){var T=C.items[a];if(T.type==="literal"&&T.value)return'"'.concat(T.value,'"');throw new Error("Expected literal schema, got ".concat(JSON.stringify(T,null,2)))}).join(", "))}])}var _=w.validate(r,p);if(_)return _}else if(a instanceof t0){if(this.items.some(function(C){return!(C instanceof t0)}))return fe({},r,[{message:"Key is a literal schema, so all schema items must be literals",fatal:!0}]);var k=[a].concat(QT(this.items));if(typeof i=="string"){var E=k.some(function(C){return!C.validate(r,i)});if(!E)return fe({},r,[{message:"Union must match one of the following: ".concat(k.map(function(C){return'"'.concat(C.value,'"')}).join(", "))}])}}else return fe({},r,[{message:"Expected a string or literal"}]);return s}},{key:"assert",value:function(r){return!0}},{key:"optional",value:function(){return new e(this.key,this.items,!0)}},{key:"serialize",value:function(){return typeof this.key=="string"?{type:"union",key:this.key,items:this.items.map(function(r){return r.serialize()}),opt:this.opt}:{type:"union",items:this.items.map(function(r){return r.serialize()}),opt:this.opt}}}]),e}(br),UD=function(e){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 aO(e,r)},lO=function(t){xr(e,t);function e(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return yn(this,e),r=yr(this,e),r.options=n,r.opt=o,r}return xn(e,[{key:"validate",value:function(r,o){return!1}},{key:"assert",value:function(r){return!0}},{key:"optional",value:function(){return new e(this.options,!0)}},{key:"serialize",value:function(){return{type:"richtext",opt:this.opt,options:this.options}}}]),e}(br),VD=function(e){return new lO(e??{})},cO=function(t){xr(e,t);function e(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return yn(this,e),r=yr(this,e),r.options=n,r.opt=o,r}return xn(e,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:o==null?fe({},r,[{message:"Non-optional image was null or undefined.",value:o}]):typeof o[gn]!="string"?fe({},r,[{message:"Image did not have a file reference string. Got: ".concat(ke(o[gn])),value:o}]):o[sn]!=="file"?fe({},r,[{message:"Image did not have the valid file extension type. Got: ".concat(o[sn]),value:o}]):o.metadata?fe({},r,[{message:"Found metadata, but it could not be validated. Image metadata must be an object with the required props: width (positive number), height (positive number) and sha256 (string of length 64 of the base16 hash).",value:o,fixes:["image:replace-metadata"]}]):fe({},r,[{message:"Could not validate Image metadata.",value:o,fixes:["image:add-metadata"]}])}},{key:"assert",value:function(r){return this.opt&&r==null?!0:(r==null?void 0:r[gn])==="image"&&(r==null?void 0:r[sn])==="file"}},{key:"optional",value:function(){return new e(this.options,!0)}},{key:"serialize",value:function(){return{type:"image",options:this.options,opt:this.opt}}}]),e}(br),HD=function(e){return new cO(e)},uO=function(t){xr(e,t);function e(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return yn(this,e),r=yr(this,e),r.item=n,r.opt=o,r}return xn(e,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:ke(o)!=="object"?fe({},r,[{message:"Expected 'object', got '".concat(ke(o),"'")}]):Array.isArray(o)?fe({},r,[{message:"Expected 'object', got 'array'"}]):(Object.entries(o).forEach(function(a){var l=vs(a,2),c=l[0],u=l[1],d=Mr(r,c);if(!d)s=i.appendValidationError(s,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(u),o);else{var f=i.item.validate(d,u);f&&s?s=fc(fc({},f),s):f&&(s=f)}}),s)}},{key:"assert",value:function(r){if(this.opt&&r==null)return!0;if(!r)return!1;for(var o=0,i=Object.entries(r);o<i.length;o++){var s=vs(i[o],2),a=s[1];if(!this.item.assert(a))return!1}return ke(r)==="object"&&!Array.isArray(r)}},{key:"optional",value:function(){return new e(this.item,!0)}},{key:"serialize",value:function(){return{type:"record",item:this.item.serialize(),opt:this.opt}}}]),e}(br),WD=function(e){return new uO(e)};function KD(t){var e=t[Wt];if(e instanceof h1)throw Error("Cannot get raw source of an Expr");var n=e;return n}function qD(t){return t.indexOf(".")===-1?[t,""]:[t.slice(0,t.indexOf(".")),t.slice(t.indexOf(".")+1)]}function GD(t){return t instanceof m1||ke(t)==="object"&&"type"in t&&t.type==="object"}function YD(t){return t instanceof uO||ke(t)==="object"&&"type"in t&&t.type==="record"}function ZD(t){return t instanceof sO||ke(t)==="object"&&"type"in t&&t.type==="array"}function JD(t){return t instanceof aO||ke(t)==="object"&&"type"in t&&t.type==="union"}function XD(t){return t instanceof lO||ke(t)==="object"&&"type"in t&&t.type==="richtext"}function QD(t){return t instanceof cO||ke(t)==="object"&&"type"in t&&t.type==="image"}function e3(t,e,n){for(var r=t3(t),o=QT(r),i=n,s=e,a=function(){var u=r.shift();if(u===void 0)throw Error("Unexpected undefined part");if(ZD(i)){if(Number.isNaN(Number(u)))throw Error("Invalid path: array schema ".concat(JSON.stringify(i)," must have a number as path, but got ").concat(u,". Path: ").concat(t));if(ke(s)!=="object"&&!Array.isArray(s))throw Error("Schema type error: expected source to be type of array, but got ".concat(ke(s)));if(s[u]===void 0){var d;throw Error("Invalid path: array source (length: ".concat((d=s)===null||d===void 0?void 0:d.length,") did not have index ").concat(u," from path: ").concat(t))}s=s[u],i=i.item}else if(YD(i)){if(typeof u!="string")throw Error("Invalid path: record schema ".concat(i," must have path: ").concat(u," as string"));if(ke(s)!=="object"&&!Array.isArray(s))throw Error("Schema type error: expected source to be type of record, but got ".concat(ke(s)));if(!s[u])throw Error("Invalid path: record source did not have key ".concat(u," from path: ").concat(t));s=s[u],i=i.item}else if(GD(i)){if(ke(s)!=="object")throw Error("Schema type error: expected source to be type of object, but got ".concat(ke(s)));if(!s[u])throw Error("Invalid path: object source did not have key ".concat(u," from path: ").concat(t));s=s[u],i=i.items[u]}else{if(QD(i))return{v:{path:o.slice(0,o.length-r.length-1).map(function(g){return JSON.stringify(g)}).join("."),schema:i,source:s}};if(JD(i)){var f=i.key;if(!f)return{v:{path:o.map(function(g){return Number.isNaN(Number(g))?JSON.stringify(g):g}).join("."),schema:i,source:s}};var p=s[f];if(!p)throw Error("Invalid path: union source ".concat(i," did not have required key ").concat(f," in path: ").concat(t));var m=i.items.find(function(g){var y;return(g==null||(y=g.items)===null||y===void 0||(y=y[f])===null||y===void 0?void 0:y.value)===p});if(!m)throw Error("Invalid path: union schema ".concat(i," did not have a child object with ").concat(f," of value ").concat(p," in path: ").concat(t));i=m.items[u],s=s[u]}else{if(XD(i))return{v:{path:o.slice(0,o.length-r.length-1).map(function(g){return JSON.stringify(g)}).join("."),schema:i,source:s}};throw Error("Invalid path: ".concat(u," resolved to an unexpected schema ").concat(JSON.stringify(i)))}}},l;r.length>0;)if(l=a(),l)return l.v;if(r.length>0)throw Error("Invalid path: ".concat(r.join(".")," is not a valid path"));return{path:o.map(function(c){return Number.isNaN(Number(c))?JSON.stringify(c):c}).join("."),schema:i,source:s}}function t3(t){for(var e=[],n=0;n<t.length;){var r="";if(t[n]==='"'){for(n++;n<t.length&&t[n]!=='"';)t[n]==="\\"&&t[n+1]==='"'?(r+='"',n++):r+=t[n],n++;if(t[n]!=='"'){var o;throw new Error("Invalid input (".concat(JSON.stringify(t),"): Missing closing double quote: ").concat((o=t[n])!==null&&o!==void 0?o:"at end of string"," (char: ").concat(n,"; length: ").concat(t.length,")"))}}else for(;n<t.length&&t[n]!==".";)r+=t[n],n++;r!==""&&e.push(r),n++}return e}var n3=function(t){xr(e,t);function e(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return yn(this,e),r=yr(this,e),r.options=n,r.opt=o,r}return xn(e,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="number"?fe({},r,[{message:"Expected 'number', got '".concat(ke(o),"'"),value:o}]):!1}},{key:"assert",value:function(r){return this.opt&&r==null?!0:typeof r=="number"}},{key:"optional",value:function(){return new e(this.options,!0)}},{key:"serialize",value:function(){return{type:"number",options:this.options,opt:this.opt}}}]),e}(br),r3=function(e){return new n3(e)},dO=function(t){xr(e,t);function e(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return yn(this,e),r=yr(this,e),r.options=n,r.opt=o,r.isRaw=i,r}return xn(e,[{key:"validate",value:function(r,o){var i,s,a;if(this.opt&&o==null)return!1;if(typeof o!="string")return fe({},r,[{message:"Expected 'string', got '".concat(ke(o),"'"),value:o}]);var l=[];return(i=this.options)!==null&&i!==void 0&&i.maxLength&&o.length>this.options.maxLength&&l.push({message:"Expected string to be at most ".concat(this.options.maxLength," characters long, got ").concat(o.length),value:o}),(s=this.options)!==null&&s!==void 0&&s.minLength&&o.length<this.options.minLength&&l.push({message:"Expected string to be at least ".concat(this.options.minLength," characters long, got ").concat(o.length),value:o}),(a=this.options)!==null&&a!==void 0&&a.regexp&&!this.options.regexp.test(o)&&l.push({message:"Expected string to match reg exp: ".concat(this.options.regexp.toString(),", got '").concat(o,"'"),value:o}),l.length>0?fe({},r,l):!1}},{key:"assert",value:function(r){return this.opt&&r==null?!0:typeof r=="string"}},{key:"optional",value:function(){return new e(this.options,!0,this.isRaw)}},{key:"raw",value:function(){return new e(this.options,this.opt,!0)}},{key:"serialize",value:function(){var r,o,i;return{type:"string",options:{maxLength:(r=this.options)===null||r===void 0?void 0:r.maxLength,minLength:(o=this.options)===null||o===void 0?void 0:o.minLength,regexp:((i=this.options)===null||i===void 0?void 0:i.regexp)&&{source:this.options.regexp.source,flags:this.options.regexp.flags}},opt:this.opt,raw:this.isRaw}}}]),e}(br),o3=function(e){return new dO(e)},i3=function(t){xr(e,t);function e(){var n,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return yn(this,e),n=yr(this,e),n.opt=r,n}return xn(e,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="boolean"?fe({},r,[{message:"Expected 'boolean', got '".concat(ke(o),"'"),value:o}]):!1}},{key:"assert",value:function(r){return this.opt&&r==null?!0:typeof r=="boolean"}},{key:"optional",value:function(){return new e(!0)}},{key:"serialize",value:function(){return{type:"boolean",opt:this.opt}}}]),e}(br),s3=function(){return new i3},a3=function(t){xr(e,t);function e(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return yn(this,e),r=yr(this,e),r.selector=n,r.opt=o,r}return xn(e,[{key:"validate",value:function(r,o){if(this.opt&&o==null)return!1;var i=this.selector[ba];if(!i)return fe({},r,[{message:"Schema not found for module. keyOf must be used with a Val Module"}]);var s=i.serialize();if(!(s.type==="array"||s.type==="object"||s.type==="record"))return fe({},r,[{message:"Schema in keyOf must be an 'array', 'object' or 'record'. Found '".concat(s.type,"'")}]);if(s.opt&&o==null)return!1;if(s.type==="array"&&typeof o!="number")return fe({},r,[{message:"Type of value in keyof (array) must be 'number'"}]);if(s.type==="record"&&typeof o!="string")return fe({},r,[{message:"Type of value in keyof (record) must be 'string'"}]);if(s.type==="object"){var a=Object.keys(s.items);if(!a.includes(o))return fe({},r,[{message:"Value of keyOf (object) must be: ".concat(a.join(", "),". Found: ").concat(o)}])}return!1}},{key:"assert",value:function(r){if(this.opt&&r==null)return!0;var o=this.selector[ba];if(!o)return!1;var i=o.serialize();if(!(i.type==="array"||i.type==="object"||i.type==="record"))return!1;if(i.opt&&r==null)return!0;if(i.type==="array"&&typeof r!="number"||i.type==="record"&&typeof r!="string")return!1;if(i.type==="object"){var s=Object.keys(i.items);if(!s.includes(r))return!1}return!0}},{key:"optional",value:function(){return new e(this.selector,!0)}},{key:"serialize",value:function(){var r,o=iO(this.selector);if(!o)throw new Error("Cannot serialize keyOf schema with empty selector. TIP: keyOf must be used with a Val Module.");var i=(r=this.selector[ba])===null||r===void 0?void 0:r.serialize();if(!i)throw new Error("Cannot serialize oneOf schema with empty selector.");var s;switch(i.type){case"array":s="number";break;case"record":s="string";break;case"object":s=Object.keys(i.items);break;default:throw new Error("Cannot serialize oneOf schema with selector of type '".concat(i.type,"'. keyOf must be used with a Val Module."))}return{type:"keyOf",selector:o,opt:this.opt,values:s}}}]),e}(br),l3=function(e){return new a3(e)};function c3(){return{string:o3,boolean:s3,array:FD,object:zD,number:r3,union:UD,richtext:VD,image:HD,literal:BD,keyOf:l3,record:WD,file:DD}}function u3(t){return fO(p3(t))}function d3(t){return ys(t)?ke(t[Wt])==="object"&&t[Wt]!==null&&Array.isArray(t[Wt]):Array.isArray(t)}function f3(t){return ys(t)?ke(t[Wt])==="object"&&t[Wt]!==null&&!Array.isArray(t[Wt]):ke(t)==="object"}function p3(t){var e=Qt(t);function n(r){var o=d3(r),i=f3(r);if(o){var s=Wt in r?r[Wt]:r,a=An in r?r[An]:void 0;return{val:s.map(function(u,d){return n(ys(u)?u:Qt(u,Mr(a,d)))}),valPath:a}}else if(i){var l=Wt in r?r[Wt]:r,c=An in r?r[An]:void 0;return{val:l!==null&&Object.fromEntries(Object.entries(l).map(function(u){var d=vs(u,2),f=d[0],p=d[1];return[f,n(ys(p)?p:Qt(p,Mr(c,f)))]})),valPath:c}}else return ys(r)?{val:n(r[Wt]),valPath:r[An]}:r}return n(e)}function n0(t){var e=oO(t)?t.val:t;switch(ke(e)){case"function":case"symbol":throw Error("Invalid val type: ".concat(ke(e)));case"object":return e===null?null:Array.isArray(e)?e.map(n0):Object.fromEntries(Object.entries(e).map(function(n){var r=vs(n,2),o=r[0],i=r[1];return[o,i&&n0(i)]}));default:return e}}function fO(t){var e=t.val;switch(ke(e)){case"function":case"symbol":throw Error("Invalid val type: ".concat(ke(e)));case"object":if(e!==null)return new Proxy(e,{has:function(r,o){return o==="val"||o===An?!0:yk(r,o)},get:function(r,o){if(o===An)return t.valPath;if(o==="val")return n0(t);if(Array.isArray(r)&&o==="length")return r.length;if(yk(e,o)){var i,s;return fO({val:Reflect.get(r,o).val,valPath:(i=(s=Reflect.get(r,o))===null||s===void 0?void 0:s.valPath)!==null&&i!==void 0?i:Mr(t.valPath,Array.isArray(r)?Number(o):o)})}return Reflect.get(r,o)}});default:return fe(fe({},An,t.valPath),"val",t.val)}}function yk(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var h3=[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],lt=function(t){return t[t.inputBytes=64]="inputBytes",t[t.inputWords=16]="inputWords",t[t.highIndex=14]="highIndex",t[t.lowIndex=15]="lowIndex",t[t.workWords=64]="workWords",t[t.allocBytes=80]="allocBytes",t[t.allocWords=20]="allocWords",t[t.allocTotal=8e3]="allocTotal",t}(lt||{}),xk={sha256:1};function m3(t){if(t&&!xk[t]&&!xk[t.toLowerCase()])throw new Error("Digest method not supported");return new g3}var g3=function(){function t(){yn(this,t),fe(this,"A",1779033703),fe(this,"B",-1150833019),fe(this,"C",1013904242),fe(this,"D",-1521486534),fe(this,"E",1359893119),fe(this,"F",-1694144372),fe(this,"G",528734635),fe(this,"H",1541459225),fe(this,"_size",0),fe(this,"_sp",0),(!lp||nu>=lt.allocTotal)&&(lp=new ArrayBuffer(lt.allocTotal),nu=0),this._byte=new Uint8Array(lp,nu,lt.allocBytes),this._word=new Int32Array(lp,nu,lt.allocWords),nu+=lt.allocBytes}return xn(t,[{key:"update",value:function(n){if(typeof n=="string")return this._utf8(n);if(n==null)throw new TypeError("Invalid type: "+ke(n));var r=n.byteOffset,o=n.byteLength,i=o/lt.inputBytes|0,s=0;if(i&&!(r&3)&&!(this._size%lt.inputBytes)){for(var a=new Int32Array(n.buffer,r,i*lt.inputWords);i--;)this._int32(a,s>>2),s+=lt.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%lt.inputBytes,l=a;r<s&&l<lt.inputBytes;)o[l++]=n[r++];l>=lt.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%lt.inputBytes,c=l;a<i&&c<lt.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>=lt.inputBytes&&(this._int32(o),o[0]=o[lt.inputWords]),this._size+=c-l}return this._sp=s,this}},{key:"_int32",value:function(n,r){var o=this.A,i=this.B,s=this.C,a=this.D,l=this.E,c=this.F,u=this.G,d=this.H,f=0;for(r=r|0;f<lt.inputWords;)Gs[f++]=Hr(n[r++]);for(f=lt.inputWords;f<lt.workWords;f++)Gs[f]=E3(Gs[f-2])+Gs[f-7]+S3(Gs[f-15])+Gs[f-16]|0;for(f=0;f<lt.workWords;f++){var p=d+k3(l)+x3(l,c,u)+h3[f]+Gs[f]|0,m=w3(o)+b3(o,i,s)|0;d=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=d+this.H|0}},{key:"digest",value:function(n){var r=this._byte,o=this._word,i=this._size%lt.inputBytes|0;for(r[i++]=128;i&3;)r[i++]=0;if(i>>=2,i>lt.highIndex){for(;i<lt.inputWords;)o[i++]=0;i=0,this._int32(o)}for(;i<lt.inputWords;)o[i++]=0;var s=this._size*8,a=(s&4294967295)>>>0,l=(s-a)/4294967296;return l&&(o[lt.highIndex]=Hr(l)),a&&(o[lt.lowIndex]=Hr(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 Ai(n)+Ai(r)+Ai(o)+Ai(i)+Ai(s)+Ai(a)+Ai(l)+Ai(c)}},{key:"_bin",value:function(){var n=this.A,r=this.B,o=this.C,i=this.D,s=this.E,a=this.F,l=this.G,c=this.H,u=this._byte,d=this._word;return d[0]=Hr(n),d[1]=Hr(r),d[2]=Hr(o),d[3]=Hr(i),d[4]=Hr(s),d[5]=Hr(a),d[6]=Hr(l),d[7]=Hr(c),u.slice(0,32)}}]),t}(),Gs=new Int32Array(lt.workWords),lp,nu=0,Ai=function(e){return(e+4294967296).toString(16).substr(-8)},v3=function(e){return e<<24&4278190080|e<<8&16711680|e>>8&65280|e>>24&255},y3=function(e){return e},Hr=_3()?y3:v3,x3=function(e,n,r){return r^e&(n^r)},b3=function(e,n,r){return e&n|r&(e|n)},w3=function(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)},k3=function(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)},S3=function(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3},E3=function(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10};function _3(){var t=new Uint8Array(new Uint16Array([65279]).buffer);return t[0]===254}var C3=function(e){return m3().update(e).digest("hex")};function Td(){Td=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(R,N,O){R[N]=O.value},i=typeof Symbol=="function"?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(R,N,O){return Object.defineProperty(R,N,{value:O,enumerable:!0,configurable:!0,writable:!0}),R[N]}try{c({},"")}catch{c=function(N,O,P){return N[O]=P}}function u(R,N,O,P){var I=N&&N.prototype instanceof v?N:v,H=Object.create(I.prototype),le=new U(P||[]);return o(H,"_invoke",{value:A(R,O,le)}),H}function d(R,N,O){try{return{type:"normal",arg:R.call(N,O)}}catch(P){return{type:"throw",arg:P}}}e.wrap=u;var f="suspendedStart",p="suspendedYield",m="executing",g="completed",y={};function v(){}function x(){}function w(){}var S={};c(S,s,function(){return this});var _=Object.getPrototypeOf,k=_&&_(_(G([])));k&&k!==n&&r.call(k,s)&&(S=k);var E=w.prototype=v.prototype=Object.create(S);function C(R){["next","throw","return"].forEach(function(N){c(R,N,function(O){return this._invoke(N,O)})})}function T(R,N){function O(I,H,le,Le){var Ee=d(R[I],R,H);if(Ee.type!=="throw"){var Je=Ee.arg,Ae=Je.value;return Ae&&typeof Ae=="object"&&r.call(Ae,"__await")?N.resolve(Ae.__await).then(function(ne){O("next",ne,le,Le)},function(ne){O("throw",ne,le,Le)}):N.resolve(Ae).then(function(ne){Je.value=ne,le(Je)},function(ne){return O("throw",ne,le,Le)})}Le(Ee.arg)}var P;o(this,"_invoke",{value:function(I,H){function le(){return new N(function(Le,Ee){O(I,H,Le,Ee)})}return P=P?P.then(le,le):le()}})}function A(R,N,O){var P=f;return function(I,H){if(P===m)throw new Error("Generator is already running");if(P===g){if(I==="throw")throw H;return{value:t,done:!0}}for(O.method=I,O.arg=H;;){var le=O.delegate;if(le){var Le=B(le,O);if(Le){if(Le===y)continue;return Le}}if(O.method==="next")O.sent=O._sent=O.arg;else if(O.method==="throw"){if(P===f)throw P=g,O.arg;O.dispatchException(O.arg)}else O.method==="return"&&O.abrupt("return",O.arg);P=m;var Ee=d(R,N,O);if(Ee.type==="normal"){if(P=O.done?g:p,Ee.arg===y)continue;return{value:Ee.arg,done:O.done}}Ee.type==="throw"&&(P=g,O.method="throw",O.arg=Ee.arg)}}}function B(R,N){var O=N.method,P=R.iterator[O];if(P===t)return N.delegate=null,O==="throw"&&R.iterator.return&&(N.method="return",N.arg=t,B(R,N),N.method==="throw")||O!=="return"&&(N.method="throw",N.arg=new TypeError("The iterator does not provide a '"+O+"' method")),y;var I=d(P,R.iterator,N.arg);if(I.type==="throw")return N.method="throw",N.arg=I.arg,N.delegate=null,y;var H=I.arg;return H?H.done?(N[R.resultName]=H.value,N.next=R.nextLoc,N.method!=="return"&&(N.method="next",N.arg=t),N.delegate=null,y):H:(N.method="throw",N.arg=new TypeError("iterator result is not an object"),N.delegate=null,y)}function D(R){var N={tryLoc:R[0]};1 in R&&(N.catchLoc=R[1]),2 in R&&(N.finallyLoc=R[2],N.afterLoc=R[3]),this.tryEntries.push(N)}function Z(R){var N=R.completion||{};N.type="normal",delete N.arg,R.completion=N}function U(R){this.tryEntries=[{tryLoc:"root"}],R.forEach(D,this),this.reset(!0)}function G(R){if(R||R===""){var N=R[s];if(N)return N.call(R);if(typeof R.next=="function")return R;if(!isNaN(R.length)){var O=-1,P=function I(){for(;++O<R.length;)if(r.call(R,O))return I.value=R[O],I.done=!1,I;return I.value=t,I.done=!0,I};return P.next=P}}throw new TypeError(typeof R+" is not iterable")}return x.prototype=w,o(E,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:x,configurable:!0}),x.displayName=c(w,l,"GeneratorFunction"),e.isGeneratorFunction=function(R){var N=typeof R=="function"&&R.constructor;return!!N&&(N===x||(N.displayName||N.name)==="GeneratorFunction")},e.mark=function(R){return Object.setPrototypeOf?Object.setPrototypeOf(R,w):(R.__proto__=w,c(R,l,"GeneratorFunction")),R.prototype=Object.create(E),R},e.awrap=function(R){return{__await:R}},C(T.prototype),c(T.prototype,a,function(){return this}),e.AsyncIterator=T,e.async=function(R,N,O,P,I){I===void 0&&(I=Promise);var H=new T(u(R,N,O,P),I);return e.isGeneratorFunction(N)?H:H.next().then(function(le){return le.done?le.value:H.next()})},C(E),c(E,l,"Generator"),c(E,s,function(){return this}),c(E,"toString",function(){return"[object Generator]"}),e.keys=function(R){var N=Object(R),O=[];for(var P in N)O.push(P);return O.reverse(),function I(){for(;O.length;){var H=O.pop();if(H in N)return I.value=H,I.done=!1,I}return I.done=!0,I}},e.values=G,U.prototype={constructor:U,reset:function(R){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(Z),!R)for(var N in this)N.charAt(0)==="t"&&r.call(this,N)&&!isNaN(+N.slice(1))&&(this[N]=t)},stop:function(){this.done=!0;var R=this.tryEntries[0].completion;if(R.type==="throw")throw R.arg;return this.rval},dispatchException:function(R){if(this.done)throw R;var N=this;function O(Ee,Je){return H.type="throw",H.arg=R,N.next=Ee,Je&&(N.method="next",N.arg=t),!!Je}for(var P=this.tryEntries.length-1;P>=0;--P){var I=this.tryEntries[P],H=I.completion;if(I.tryLoc==="root")return O("end");if(I.tryLoc<=this.prev){var le=r.call(I,"catchLoc"),Le=r.call(I,"finallyLoc");if(le&&Le){if(this.prev<I.catchLoc)return O(I.catchLoc,!0);if(this.prev<I.finallyLoc)return O(I.finallyLoc)}else if(le){if(this.prev<I.catchLoc)return O(I.catchLoc,!0)}else{if(!Le)throw new Error("try statement without catch or finally");if(this.prev<I.finallyLoc)return O(I.finallyLoc)}}}},abrupt:function(R,N){for(var O=this.tryEntries.length-1;O>=0;--O){var P=this.tryEntries[O];if(P.tryLoc<=this.prev&&r.call(P,"finallyLoc")&&this.prev<P.finallyLoc){var I=P;break}}I&&(R==="break"||R==="continue")&&I.tryLoc<=N&&N<=I.finallyLoc&&(I=null);var H=I?I.completion:{};return H.type=R,H.arg=N,I?(this.method="next",this.next=I.finallyLoc,y):this.complete(H)},complete:function(R,N){if(R.type==="throw")throw R.arg;return R.type==="break"||R.type==="continue"?this.next=R.arg:R.type==="return"?(this.rval=this.arg=R.arg,this.method="return",this.next="end"):R.type==="normal"&&N&&(this.next=N),y},finish:function(R){for(var N=this.tryEntries.length-1;N>=0;--N){var O=this.tryEntries[N];if(O.finallyLoc===R)return this.complete(O.completion,O.afterLoc),Z(O),y}},catch:function(R){for(var N=this.tryEntries.length-1;N>=0;--N){var O=this.tryEntries[N];if(O.tryLoc===R){var P=O.completion;if(P.type==="throw"){var I=P.arg;Z(O)}return I}}throw new Error("illegal catch attempt")},delegateYield:function(R,N,O){return this.delegate={iterator:G(R),resultName:N,nextLoc:O},this.method==="next"&&(this.arg=t),y}},e}function bk(t,e,n,r,o,i,s){try{var a=t[i](s),l=a.value}catch(c){n(c);return}a.done?e(l):Promise.resolve(l).then(r,o)}function pO(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function s(l){bk(i,r,o,s,a,"next",l)}function a(l){bk(i,r,o,s,a,"throw",l)}s(void 0)})}}var T3=function(){function t(e){yn(this,t),this.host=e}return xn(t,[{key:"getDisableUrl",value:function(n){return"".concat(this.host,"/disable?redirect_to=").concat(encodeURIComponent(n))}},{key:"getLoginUrl",value:function(n){return"".concat(this.host,"/authorize?redirect_to=").concat(encodeURIComponent(n))}},{key:"getEnableUrl",value:function(n){return"".concat(this.host,"/enable?redirect_to=").concat(encodeURIComponent(n))}},{key:"getPatches",value:function(){var e=pO(Td().mark(function r(o){var i,s,a;return Td().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return i=o.patchIds,s=o.headers,a=i?"?".concat(i.map(function(u){return"".concat(u,"=").concat(encodeURIComponent(u))}).join("&")):"",c.abrupt("return",fetch("".concat(this.host,"/patches/~").concat(a),{headers:s||{"Content-Type":"application/json"}}).then(function(u){return ou(u)}).catch(ru));case 3:case"end":return c.stop()}},r,this)}));function n(r){return e.apply(this,arguments)}return n}()},{key:"getEditUrl",value:function(){return"/val"}},{key:"postPatches",value:function(n,r,o){return fetch("".concat(this.host,"/patches/~"),{headers:o||{"Content-Type":"application/json"},method:"POST",body:JSON.stringify(fe({},n,r))}).then(function(i){return ou(i)}).catch(ru)}},{key:"getSession",value:function(){return fetch("".concat(this.host,"/session")).then(function(n){return ou(n).catch(ru)})}},{key:"getTree",value:function(n){var r=n.patch,o=r===void 0?!1:r,i=n.includeSchema,s=i===void 0?!1:i,a=n.includeSource,l=a===void 0?!1:a,c=n.treePath,u=c===void 0?"/":c,d=n.headers,f=new URLSearchParams;return f.set("patch",o.toString()),f.set("schema",s.toString()),f.set("source",l.toString()),fetch("".concat(this.host,"/tree/~").concat(u,"?").concat(f.toString()),{headers:d}).then(function(p){return ou(p)}).catch(ru)}},{key:"postCommit",value:function(n){var r=n.patches,o=n.headers;return fetch("".concat(this.host,"/commit"),{method:"POST",body:JSON.stringify({patches:r}),headers:o||{"Content-Type":"application/json"}}).then(function(i){return ou(i)}).catch(ru)}}]),t}();function ru(t){return Po({statusCode:500,message:t instanceof Error?t.message:"Unknown error"})}function ou(t){return r0.apply(this,arguments)}function r0(){return r0=pO(Td().mark(function t(e){var n;return Td().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(o.prev=0,!e.ok){o.next=9;break}return o.t0=xa,o.next=5,e.json();case 5:return o.t1=o.sent,o.abrupt("return",o.t0.ok.call(o.t0,o.t1));case 9:return o.prev=9,o.next=12,e.json();case 12:return n=o.sent,o.abrupt("return",Po({statusCode:e.status,message:n.message||e.statusText,details:n.details||Object.fromEntries(Object.entries(n).filter(function(i){var s=vs(i,1),a=s[0];return a!=="message"}))}));case 16:return o.prev=16,o.t2=o.catch(9),o.abrupt("return",Po({statusCode:e.status,message:e.statusText}));case 19:o.next=24;break;case 21:return o.prev=21,o.t3=o.catch(0),o.abrupt("return",Po({message:o.t3 instanceof Error?o.t3.message:"Unknown error"}));case 24:case"end":return o.stop()}},t,null,[[0,21],[9,16]])})),r0.apply(this,arguments)}var yt={convertFileSource:rO,getSchema:$D,getValPath:iO,getVal:u3,getSource:KD,resolvePath:e3,splitModuleIdAndModulePath:qD,isVal:LD,createValPathOfItem:Mr,getSHA256Hash:C3,initSchema:c3,createPatchJSONPath:function(e){return"/".concat(e.split(".").map(function(n){return n&&O3(n)}).join("/"))},VAL_ENABLE_COOKIE_NAME:"val_enable",VAL_STATE_COOKIE:"val_state",VAL_SESSION_COOKIE:"val_session"};function O3(t){try{return JSON.parse(t)}catch{return t}}var hO={exports:{}};/*!
44
44
  Copyright (c) 2018 Jed Watson.
45
45
  Licensed under the MIT License (MIT), see
46
46
  http://jedwatson.github.io/classnames
@@ -215,7 +215,7 @@ If you are using Node.js, you can install JSDOM and Remirror will try to use it
215
215
 
216
216
  `,ss)}getHTML(t=this.store.getState()){return PV(t.doc,this.store.document)}textToProsemirrorNode(t){const e=`<pre>${t.content}</pre>`;return this.store.stringHandlers.html({...t,content:e})}};ae([At()],Dr.prototype,"isSelectionEmpty",1);ae([At()],Dr.prototype,"isViewEditable",1);ae([At()],Dr.prototype,"getStateJSON",1);ae([At()],Dr.prototype,"getJSON",1);ae([At()],Dr.prototype,"getRemirrorJSON",1);ae([ue()],Dr.prototype,"insertHtml",1);ae([At()],Dr.prototype,"getText",1);ae([At()],Dr.prototype,"getTextBetween",1);ae([At()],Dr.prototype,"getHTML",1);Dr=ae([Ze({})],Dr);var ex=class extends St{get name(){return"inputRules"}onCreate(){this.store.setExtensionStore("rebuildInputRules",this.rebuildInputRules.bind(this))}createExternalPlugins(){return[this.generateInputRulesPlugin()]}generateInputRulesPlugin(){var t,e;const n=[],r=this.store.markTags[Ie.ExcludeInputRules];for(const o of this.store.extensions)if(!((t=this.store.managerSettings.exclude)!=null&&t.inputRules||!o.createInputRules||(e=o.options.exclude)!=null&&e.inputRules))for(const i of o.createInputRules())i.shouldSkip=this.options.shouldSkipInputRule,i.invalidMarks=r,n.push(i);return JF({rules:n})}rebuildInputRules(){this.store.updateExtensionPlugins(this)}};ex=ae([Ze({defaultPriority:at.Default,handlerKeys:["shouldSkipInputRule"],handlerKeyOptions:{shouldSkipInputRule:{earlyReturnValue:!0}}})],ex);var eo=class extends St{constructor(){super(...arguments),this.extraKeyBindings=[],this.backwardMarkExitTracker=new Map,this.keydownHandler=null,this.onAddCustomHandler=({keymap:t})=>{var e,n;if(t)return this.extraKeyBindings=[...this.extraKeyBindings,t],(n=(e=this.store).rebuildKeymap)==null||n.call(e),()=>{var r,o;this.extraKeyBindings=this.extraKeyBindings.filter(i=>i!==t),(o=(r=this.store).rebuildKeymap)==null||o.call(r)}},this.rebuildKeymap=()=>{this.setupKeydownHandler()}}get name(){return"keymap"}get shortcutMap(){const{shortcuts:t}=this.options;return Se(t)?qH[t]:t}onCreate(){this.store.setExtensionStore("rebuildKeymap",this.rebuildKeymap)}createExternalPlugins(){var t;return(t=this.store.managerSettings.exclude)!=null&&t.keymap?[]:(this.setupKeydownHandler(),[new Ti({props:{handleKeyDown:(e,n)=>{var r;return(r=this.keydownHandler)==null?void 0:r.call(this,e,n)}}})])}setupKeydownHandler(){const t=this.generateKeymapBindings();this.keydownHandler=WN(t)}generateKeymapBindings(){var t;const e=[],n=this.shortcutMap,r=this.store.getExtension(Fe),o=a=>l=>Up({shortcut:l,map:n,store:this.store,options:a.options});for(const a of this.store.extensions){const l=a.decoratedKeybindings??{};if(!((t=a.options.exclude)!=null&&t.keymap)){a.createKeymap&&e.push(WH(a.createKeymap(o(a)),n));for(const[c,u]of qt(l)){if(u.isActive&&!u.isActive(a.options,this.store))continue;const d=a[c].bind(a),f=Up({shortcut:u.shortcut,map:n,options:a.options,store:this.store}),p=dt(u.priority)?u.priority(a.options,this.store):u.priority??at.Low,m=pe();for(const g of f)m[g]=d;e.push([p,m]),u.command&&r.updateDecorated(u.command,{shortcut:f})}}}const i=this.sortKeymaps([...this.extraKeyBindings,...e]);return cV(i)}arrowRightShortcut(t){const e=this.store.markTags[Ie.PreventExits],n=this.store.nodeTags[Ie.PreventExits];return this.exitMarkForwards(e,n)(t)}arrowLeftShortcut(t){const e=this.store.markTags[Ie.PreventExits],n=this.store.nodeTags[Ie.PreventExits];return cm(this.exitNodeBackwards(n),this.exitMarkBackwards(e,n))(t)}backspace(t){const e=this.store.markTags[Ie.PreventExits],n=this.store.nodeTags[Ie.PreventExits];return cm(this.exitNodeBackwards(n,!0),this.exitMarkBackwards(e,n,!0))(t)}createKeymap(){const{selectParentNodeOnEscape:t,undoInputRuleOnBackspace:e,excludeBaseKeymap:n}=this.options,r=pe();if(!n)for(const[o,i]of qt(Zv))r[o]=ld(i);return e&&Zv.Backspace&&(r.Backspace=ld($g(XF,Zv.Backspace))),t&&(r.Escape=ld(tH)),[at.Low,r]}getNamedShortcut(t,e={}){return t.startsWith("_|")?Up({shortcut:t,map:this.shortcutMap,store:this.store,options:e}):[t]}onSetOptions(t){var e,n;const{changes:r}=t;(r.excludeBaseKeymap.changed||r.selectParentNodeOnEscape.changed||r.undoInputRuleOnBackspace.changed)&&((n=(e=this.store).rebuildKeymap)==null||n.call(e))}sortKeymaps(t){return za(t.map(e=>Gt(e)?e:[at.Default,e]),(e,n)=>n[0]-e[0]).map(e=>e[1])}exitMarkForwards(t,e){return n=>{const{tr:r,dispatch:o}=n;if(!IV(r.selection)||ef({selection:r.selection,types:e}))return!1;const a=r.selection.$from.marks().filter(l=>!t.includes(l.type.name));if(As(a))return!1;if(!o)return!0;for(const l of a)r.removeStoredMark(l);return o(r.insertText(" ",r.selection.from)),!0}}exitNodeBackwards(t,e=!1){return n=>{const{tr:r}=n;if(!(e?WE:X0)(r.selection))return!1;const i=r.selection.$anchor.node();return!wb(i)||xV(i)||t.includes(i.type.name)?!1:this.store.commands.toggleBlockNodeItem.original({type:i.type})(n)}}exitMarkBackwards(t,e,n=!1){return r=>{const{tr:o,dispatch:i}=r;if(!(n?WE:X0)(o.selection)||this.backwardMarkExitTracker.has(o.selection.anchor))return this.backwardMarkExitTracker.clear(),!1;if(ef({selection:o.selection,types:e}))return!1;const l=[...o.storedMarks??[],...o.selection.$from.marks()].filter(c=>!t.includes(c.type.name));if(As(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}}};ae([wr({shortcut:"ArrowRight",isActive:t=>t.exitMarksOnArrowPress})],eo.prototype,"arrowRightShortcut",1);ae([wr({shortcut:"ArrowLeft",isActive:t=>t.exitMarksOnArrowPress})],eo.prototype,"arrowLeftShortcut",1);ae([wr({shortcut:"Backspace",isActive:t=>t.exitMarksOnArrowPress})],eo.prototype,"backspace",1);ae([At()],eo.prototype,"getNamedShortcut",1);eo=ae([Ze({defaultPriority:at.Low,defaultOptions:{shortcuts:"default",undoInputRuleOnBackspace:!0,selectParentNodeOnEscape:!1,excludeBaseKeymap:!1,exitMarksOnArrowPress:!0},customHandlerKeys:["keymap"]})],eo);function HH(t){return mo(wg(q),t)}function Up({shortcut:t,map:e,options:n,store:r}){return Se(t)?[tx(t,e)]:Gt(t)?t.map(o=>tx(o,e)):(t=t(n,r),Up({shortcut:t,map:e,options:n,store:r}))}function tx(t,e){return HH(t)?e[t]:t}function WH(t,e){const n={};let r,o;Gt(t)?[o,r]=t:r=t;for(const[i,s]of qt(r))n[tx(i,e)]=s;return kg(o)?n:[o,n]}var ZN={[q.Copy]:"Mod-c",[q.Cut]:"Mod-x",[q.Paste]:"Mod-v",[q.PastePlain]:"Mod-Shift-v",[q.SelectAll]:"Mod-a",[q.Undo]:"Mod-z",[q.Redo]:Qr.isMac?"Shift-Mod-z":"Mod-y",[q.Bold]:"Mod-b",[q.Italic]:"Mod-i",[q.Underline]:"Mod-u",[q.Strike]:"Mod-d",[q.Code]:"Mod-`",[q.Paragraph]:"Mod-Shift-0",[q.H1]:"Mod-Shift-1",[q.H2]:"Mod-Shift-2",[q.H3]:"Mod-Shift-3",[q.H4]:"Mod-Shift-4",[q.H5]:"Mod-Shift-5",[q.H6]:"Mod-Shift-6",[q.TaskList]:"Mod-Shift-7",[q.BulletList]:"Mod-Shift-8",[q.OrderedList]:"Mod-Shift-9",[q.Quote]:"Mod->",[q.Divider]:"Mod-Shift-|",[q.Codeblock]:"Mod-Shift-~",[q.ClearFormatting]:"Mod-Shift-C",[q.Superscript]:"Mod-.",[q.Subscript]:"Mod-,",[q.LeftAlignment]:"Mod-Shift-L",[q.CenterAlignment]:"Mod-Shift-E",[q.RightAlignment]:"Mod-Shift-R",[q.JustifyAlignment]:"Mod-Shift-J",[q.InsertLink]:"Mod-k",[q.Find]:"Mod-f",[q.FindBackwards]:"Mod-Shift-f",[q.FindReplace]:"Mod-Shift-H",[q.AddFootnote]:"Mod-Alt-f",[q.AddComment]:"Mod-Alt-m",[q.ContextMenu]:"Mod-Shift-\\",[q.IncreaseFontSize]:"Mod-Shift-.",[q.DecreaseFontSize]:"Mod-Shift-,",[q.IncreaseIndent]:"Tab",[q.DecreaseIndent]:"Shift-Tab",[q.Shortcuts]:"Mod-/",[q.Format]:Qr.isMac?"Alt-Shift-f":"Shift-Ctrl-f"},KH={...ZN,[q.Strike]:"Mod-Shift-S",[q.Code]:"Mod-Shift-M",[q.Paragraph]:"Mod-Alt-0",[q.H1]:"Mod-Alt-1",[q.H2]:"Mod-Alt-2",[q.H3]:"Mod-Alt-3",[q.H4]:"Mod-Alt-4",[q.H5]:"Mod-Alt-5",[q.H6]:"Mod-Alt-6",[q.OrderedList]:"Mod-Alt-7",[q.BulletList]:"Mod-Alt-8",[q.Quote]:"Mod-Alt-9",[q.ClearFormatting]:"Mod-\\",[q.IncreaseIndent]:"Mod-[",[q.DecreaseIndent]:"Mod-]"},qH={default:ZN,googleDoc:KH},GH=class extends St{get name(){return"nodeViews"}createPlugin(){const t=[],e=pe();for(const n of this.store.extensions){if(!n.createNodeViews)continue;const r=n.createNodeViews();t.unshift(dt(r)?{[n.name]:r}:r)}t.unshift(this.store.managerSettings.nodeViews??{});for(const n of t)Object.assign(e,n);return{props:{nodeViews:e}}}},YH=class extends St{get name(){return"pasteRules"}createExternalPlugins(){return[this.generatePasteRulesPlugin()]}generatePasteRulesPlugin(){var t,e;const n=[];for(const r of this.store.extensions){if((t=this.store.managerSettings.exclude)!=null&&t.pasteRules||!r.createPasteRules||(e=r.options.exclude)!=null&&e.pasteRules)continue;const o=r.createPasteRules(),i=Gt(o)?o:[o];n.push(...i)}return mH(n)}},nx=class extends St{constructor(){super(...arguments),this.plugins=[],this.managerPlugins=[],this.applyStateHandlers=[],this.initStateHandlers=[],this.appendTransactionHandlers=[],this.pluginKeys=pe(),this.stateGetters=new Map,this.getPluginStateCreator=t=>e=>t.getState(e??this.store.getState()),this.getStateByName=t=>{const e=this.stateGetters.get(t);return ve(e,{message:"No plugin exists for the requested extension name."}),e()}}get name(){return"plugins"}onCreate(){const{setStoreKey:t,setExtensionStore:e,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),t("pluginKeys",this.pluginKeys),t("getPluginState",this.getStateByName),e("getPluginState",this.getStateByName)}createPlugin(){return{appendTransaction:(t,e,n)=>{const r=n.tr,o={previousState:e,tr:r,transactions:t,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:(t,e)=>{for(const n of this.initStateHandlers)n(e)},apply:(t,e,n,r)=>{const o={previousState:n,state:r,tr:t};for(const i of this.applyStateHandlers)i(o);this.options.applyState(o)}}}}extractExtensionPlugins(t){var e,n;if(!(!t.createPlugin&&!t.createExternalPlugins||(e=this.store.managerSettings.exclude)!=null&&e.plugins||(n=t.options.exclude)!=null&&n.plugins)){if(t.createPlugin){const o=new Uc(t.name);this.pluginKeys[t.name]=o;const i=this.getPluginStateCreator(o);t.pluginKey=o,t.getPluginState=i,this.stateGetters.set(t.name,i),this.stateGetters.set(t.constructor,i);const s={...t.createPlugin(),key:o},a=new Ti(s);this.updatePlugins([a],t.plugin?[t.plugin]:void 0),t.plugin=a}if(t.createExternalPlugins){const o=t.createExternalPlugins();this.updatePlugins(o,t.externalPlugins),t.externalPlugins=o}}}updatePlugins(t,e){if(!e||As(e)){this.plugins=[...this.plugins,...t];return}if(t.length!==e.length){this.plugins=[...this.plugins.filter(r=>!e.includes(r)),...t];return}const n=new Map;for(const[r,o]of t.entries())n.set(Tt(e,r),o);this.plugins=this.plugins.map(r=>e.includes(r)?n.get(r):r)}updateExtensionStore(){const{setExtensionStore:t}=this.store;t("updatePlugins",this.updatePlugins.bind(this)),t("dispatchPluginUpdate",this.dispatchPluginUpdate.bind(this)),t("updateExtensionPlugins",this.updateExtensionPlugins.bind(this))}updateExtensionPlugins(t){const e=GN(t)?t:AH(t)?this.store.manager.getExtension(t):this.store.extensions.find(n=>n.name===t);ve(e,{code:K.INVALID_MANAGER_EXTENSION,message:`The extension ${t} does not exist within the editor.`}),this.extractExtensionPlugins(e),this.store.setStoreKey("plugins",this.plugins),this.dispatchPluginUpdate()}dispatchPluginUpdate(){ve(this.store.phase>=Kn.EditorView,{code:K.MANAGER_PHASE_ERROR,message:"`dispatchPluginUpdate` should only be called after the view has been added to the manager."});const{view:t,updateState:e}=this.store,n=t.state.reconfigure({plugins:this.plugins});e(n)}};nx=ae([Ze({defaultPriority:at.Highest,handlerKeys:["applyState","appendTransaction"]})],nx);var rx=class extends St{constructor(){super(...arguments),this.dynamicAttributes={marks:pe(),nodes:pe()}}get name(){return"schema"}onCreate(){const{managerSettings:t,tags:e,markNames:n,nodeNames:r,extensions:o}=this.store,{defaultBlockNode:i,disableExtraAttributes:s,nodeOverride:a,markOverride:l}=t,c=m=>!!(m&&e[Ie.Block].includes(m));if(t.schema){const{nodes:m,marks:g}=rW(t.schema);this.addSchema(t.schema,m,g);return}const u=c(i)?{doc:pe(),[i]:pe()}:pe(),d=pe(),f=ZH({settings:t,gatheredSchemaAttributes:this.gatherExtraAttributes(o),nodeNames:r,markNames:n,tags:e});for(const m of o){f[m.name]={...f[m.name],...m.options.extraAttributes};const g=s===!0||m.options.disableExtraAttributes===!0||m.constructor.disableExtraAttributes===!0;if(Df(m)){const{spec:y,dynamic:v}=ZE({createExtensionSpec:(x,w)=>m.createNodeSpec(x,w),extraAttributes:Tt(f,m.name),override:{...a,...m.options.nodeOverride},ignoreExtraAttributes:g,name:m.constructorName,tags:m.tags});m.spec=y,u[m.name]=y,Object.keys(v).length>0&&(this.dynamicAttributes.nodes[m.name]=v)}if(Ig(m)){const{spec:y,dynamic:v}=ZE({createExtensionSpec:(x,w)=>m.createMarkSpec(x,w),extraAttributes:Tt(f,m.name),override:{...l,...m.options.markOverride},ignoreExtraAttributes:g,name:m.constructorName,tags:m.tags??[]});m.spec=y,d[m.name]=y,Object.keys(v).length>0&&(this.dynamicAttributes.marks[m.name]=v)}}const p=new Uz({nodes:u,marks:d,topNode:"doc"});this.addSchema(p,u,d)}createPlugin(){return{appendTransaction:(t,e,n)=>{const{tr:r}=n;return!t.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(t,e,n){this.store.setStoreKey("nodes",e),this.store.setStoreKey("marks",n),this.store.setStoreKey("schema",t),this.store.setExtensionStore("schema",t),this.store.setStoreKey("defaultBlockNode",Ng(t).name);for(const r of Object.values(t.nodes))if(r.name!=="doc"&&(r.isBlock||r.isTextblock))break}checkAndUpdateDynamicNodes(t,e,n){for(const[r,o]of qt(this.dynamicAttributes.nodes))if(t.type.name===r)for(const[i,s]of qt(o)){if(!$s(t.attrs[i]))continue;const a={...t.attrs,[i]:s(t)};n.setNodeMarkup(e,void 0,a),BE(n)}}checkAndUpdateDynamicMarks(t,e,n){for(const[r,o]of qt(this.dynamicAttributes.marks)){const i=Tt(this.store.schema.marks,r),s=t.marks.find(a=>a.type.name===r);if(s)for(const[a,l]of qt(o)){if(!$s(s.attrs[a]))continue;const c=wi(n.doc.resolve(e),i);if(!c)continue;const{from:u,to:d}=c,f=i.create({...s.attrs,[a]:l(s)});n.removeMark(u,d,i).addMark(u,d,f),BE(n)}}}gatherExtraAttributes(t){const e=[];for(const n of t)n.createSchemaAttributes&&e.push(...n.createSchemaAttributes());return e}};rx=ae([Ze({defaultPriority:at.Highest})],rx);function ZH(t){const{settings:e,gatheredSchemaAttributes:n,nodeNames:r,markNames:o,tags:i}=t,s=pe();if(e.disableExtraAttributes)return s;const a=[...n,...e.extraAttributes??[]];for(const l of a??[]){const c=XH({identifiers:l.identifiers,nodeNames:r,markNames:o,tags:i});for(const u of c){const d=s[u]??{};s[u]={...d,...l.attributes}}}return s}function JH(t){return el(t)&&Gt(t.tags)}function XH(t){const{identifiers:e,nodeNames:n,markNames:r,tags:o}=t;if(e==="nodes")return n;if(e==="marks")return r;if(e==="all")return[...n,...r];if(Gt(e))return e;ve(JH(e),{code:K.EXTENSION_EXTRA_ATTRIBUTES,message:"Invalid value passed as an identifier when creating `extraAttributes`."});const{tags:i=[],names:s=[],behavior:a="any",excludeNames:l,excludeTags:c,type:u}=e,d=new Set,f=u==="mark"?r:u==="node"?n:[...r,...n],p=g=>f.includes(g)&&!(l!=null&&l.includes(g));for(const g of s)p(g)&&d.add(g);const m=new Map;for(const g of i)if(!(c!=null&&c.includes(g)))for(const y of o[g]){if(!p(y))continue;if(a==="any"){d.add(y);continue}const v=m.get(y)??new Set;v.add(g),m.set(y,v)}for(const[g,y]of m)y.size===i.length&&d.add(g);return[...d]}function ZE(t){var e;const{createExtensionSpec:n,extraAttributes:r,ignoreExtraAttributes:o,name:i,tags:s,override:a}=t,l=pe();function c(y,v){l[y]=v}let u=!1;function d(){u=!0}const f=QH(r,o,d,c),p=eW(r,o),m=tW(r,o),g=n({defaults:f,parse:p,dom:m},a);return ve(o||u,{code:K.EXTENSION_SPEC,message:`When creating a node specification you must call the 'defaults', and parse, and 'dom' methods. To avoid this error you can set the static property 'disableExtraAttributes' of '${i}' to 'true'.`}),g.group=[...((e=g.group)==null?void 0:e.split(" "))??[],...s].join(" ")||void 0,{spec:g,dynamic:l}}function Sb(t){return Se(t)||dt(t)?{default:t}:(ve(t,{message:`${ZM(t)} is not supported`,code:K.EXTENSION_EXTRA_ATTRIBUTES}),t)}function QH(t,e,n,r){return()=>{n();const o=pe();if(e)return o;for(const[i,s]of qt(t)){let l=Sb(s).default;dt(l)&&(r(i,l),l=null),o[i]=l===void 0?{}:{default:l}}return o}}function eW(t,e){return n=>{const r=pe();if(e)return r;for(const[o,i]of qt(t)){const{parseDOM:s,...a}=Sb(i);if(Fo(n)){if($s(s)){r[o]=n.getAttribute(o)??a.default;continue}if(dt(s)){r[o]=s(n)??a.default;continue}r[o]=n.getAttribute(s)??a.default}}return r}}function tW(t,e){return n=>{const r=pe();if(e)return r;function o(i,s){if(i){if(Se(i)){r[s]=i;return}if(Gt(i)){const[a,l]=i;r[a]=l??n.attrs[s];return}for(const[a,l]of qt(i))r[a]=l}}for(const[i,s]of qt(t)){const{toDOM:a,parseDOM:l}=Sb(s);if($s(a)){const c=Se(l)?l:i;r[c]=n.attrs[i];continue}if(dt(a)){o(a(n.attrs,nW(n)),i);continue}o(a,i)}return r}}function nW(t){return Mg(t)?{node:t}:mV(t)?{mark:t}:{}}function rW(t){const e=pe(),n=pe();for(const[r,o]of Object.entries(t.nodes))e[r]=o.spec;for(const[r,o]of Object.entries(t.marks))n[r]=o.spec;return{nodes:e,marks:n}}var Cc=class extends St{constructor(){super(...arguments),this.onAddCustomHandler=({suggester:t})=>{var e;if(!(!t||(e=this.store.managerSettings.exclude)!=null&&e.suggesters))return FE(this.store.getState(),t)}}get name(){return"suggest"}onCreate(){this.store.setExtensionStore("addSuggester",t=>FE(this.store.getState(),t)),this.store.setExtensionStore("removeSuggester",t=>eV(this.store.getState(),t))}createExternalPlugins(){var t,e;const n=[];for(const r of this.store.extensions){if((t=this.store.managerSettings.exclude)!=null&&t.suggesters)break;if(!r.createSuggesters||(e=r.options.exclude)!=null&&e.suggesters)continue;const o=r.createSuggesters(),i=Gt(o)?o:[o];n.push(...i)}return[tV(...n)]}getSuggestState(t){return hb(t??this.store.getState())}getSuggestMethods(){const{addIgnored:t,clearIgnored:e,removeIgnored:n,ignoreNextExit:r,setMarkRemoved:o,findMatchAtPosition:i,findNextTextSelection:s,setLastChangeFromAppend:a}=this.getSuggestState();return{addIgnored:t,clearIgnored:e,removeIgnored:n,ignoreNextExit:r,setMarkRemoved:o,findMatchAtPosition:i,findNextTextSelection:s,setLastChangeFromAppend:a}}isSuggesterActive(t){var e;return mo(Gt(t)?t:[t],(e=this.getSuggestState().match)==null?void 0:e.suggester.name)}};ae([At()],Cc.prototype,"getSuggestState",1);ae([At()],Cc.prototype,"getSuggestMethods",1);ae([At()],Cc.prototype,"isSuggesterActive",1);Cc=ae([Ze({customHandlerKeys:["suggester"]})],Cc);var ox=class extends St{constructor(){super(...arguments),this.allTags=pe(),this.plainTags=pe(),this.markTags=pe(),this.nodeTags=pe()}get name(){return"tags"}onCreate(){this.resetTags();for(const t of this.store.extensions)this.updateTagForExtension(t);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 t=pe(),e=pe(),n=pe(),r=pe();for(const o of wg(Ie))t[o]=[],e[o]=[],n[o]=[],r[o]=[];this.allTags=t,this.plainTags=e,this.markTags=n,this.nodeTags=r}updateTagForExtension(t){var e,n;const r=new Set([...t.tags??[],...((e=t.createTags)==null?void 0:e.call(t))??[],...t.options.extraTags??[],...((n=this.store.managerSettings.extraTags)==null?void 0:n[t.name])??[]]);for(const o of r)ve(oW(o),{code:K.EXTENSION,message:`The tag provided by the extension: ${t.constructorName} is not supported by the editor. To add custom tags you can use the 'mutateTag' method.`}),this.allTags[o].push(t.name),YN(t)&&this.plainTags[o].push(t.name),Ig(t)&&this.markTags[o].push(t.name),Df(t)&&this.nodeTags[o].push(t.name);t.tags=[...r]}};ox=ae([Ze({defaultPriority:at.Highest})],ox);function oW(t){return mo(wg(Ie),t)}var iW=new Uc("remirrorFilePlaceholderPlugin");function sW(){const t=new Ti({key:iW,state:{init(){return{set:Qe.empty,payloads:new Map}},apply(e,{set:n,payloads:r}){n=n.map(e.mapping,e.doc);const o=e.getMeta(t);if(o)if(o.type===0){const i=document.createElement("placeholder"),s=kt.widget(o.pos,i,{id:o.id});n=n.add(e.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(e){var n;return((n=t.getState(e))==null?void 0:n.set)??null}}});return t}var aW=class extends St{get name(){return"upload"}createExternalPlugins(){return[sW()]}};function lW(t={}){t={...{exitMarksOnArrowPress:eo.defaultOptions.exitMarksOnArrowPress,excludeBaseKeymap:eo.defaultOptions.excludeBaseKeymap,selectParentNodeOnEscape:eo.defaultOptions.selectParentNodeOnEscape,undoInputRuleOnBackspace:eo.defaultOptions.undoInputRuleOnBackspace,persistentSelectionClass:vo.defaultOptions.persistentSelectionClass},...t};const n=N0(t,["excludeBaseKeymap","selectParentNodeOnEscape","undoInputRuleOnBackspace"]),r=N0(t,["persistentSelectionClass"]);return[new ox,new rx,new IH,new nx,new ex,new YH,new GH,new Cc,new Fe,new Dr,new eo(n),new hm,new aW,new vo(r)]}var JE=class extends St{get name(){return"meta"}onCreate(){if(this.store.setStoreKey("getCommandMeta",this.getCommandMeta.bind(this)),!!this.options.capture)for(const t of this.store.extensions)this.captureCommands(t),this.captureKeybindings(t)}createPlugin(){return{}}captureCommands(t){const e=t.decoratedCommands??{},n=t.createCommands;for(const r of Object.keys(e)){const o=t[r];t[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:t.name,decorated:!0}),l}}n&&(t.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:t.name,decorated:!1}),c};return r})}captureKeybindings(t){}getCommandMeta(t){return t.getMeta(this.pluginKey)??[]}setCommandMeta(t,e){const n=this.getCommandMeta(t);t.setMeta(this.pluginKey,[...n,e])}};JE=ae([Ze({defaultOptions:{capture:Qr.isDevelopment},staticKeys:["capture"],defaultPriority:at.Highest})],JE);var Vp,_u,Hp,Cl,Wi,Wp,Kp,cW=class{constructor(t){Ft(this,Vp,Zh()),Ft(this,_u,void 0),Ft(this,Hp,void 0),Ft(this,Cl,!0),Ft(this,Wi,bg()),Ft(this,Wp,void 0),Ft(this,Kp,void 0),this.getState=()=>this.view.state??this.initialEditorState,this.getPreviousState=()=>this.previousState,this.dispatchTransaction=i=>{var s,a;ve(!this.manager.destroyed,{code:K.MANAGER_PHASE_ERROR,message:"A transaction was dispatched to a manager that has already been destroyed. Please check your set up, or open an issue."}),i=((a=(s=this.props).onDispatchTransaction)==null?void 0:a.call(s,i,this.getState()))??i;const l=this.getState(),{state:c,transactions:u}=l.applyTransaction(i);en(this,Hp,l),this.updateState({state:c,tr:i,transactions:u});const d=this.manager.store.getForcedUpdates(i);As(d)||this.updateViewProps(...d)},this.onChange=(i=pe())=>{var s,a;const l=this.eventListenerProps(i);Q(this,Cl)&&en(this,Cl,!1),(a=(s=this.props).onChange)==null||a.call(s,l)},this.onBlur=i=>{var s,a;const l=this.eventListenerProps();(a=(s=this.props).onBlur)==null||a.call(s,l,i),Q(this,Wi).emit("blur",l,i)},this.onFocus=i=>{var s,a;const l=this.eventListenerProps();(a=(s=this.props).onFocus)==null||a.call(s,l,i),Q(this,Wi).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:e,initialEditorState:n,element:r}=t;if(en(this,_u,e),en(this,Kp,n),this.manager.attachFramework(this,this.updateListener.bind(this)),this.manager.view)return;const o=this.createView(n,r);this.manager.addView(o)}get addHandler(){return Q(this,Wp)??en(this,Wp,Q(this,Wi).on.bind(Q(this,Wi)))}get updatableViewProps(){return{attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0}}get firstRender(){return Q(this,Cl)}get props(){return Q(this,_u).call(this)}get previousState(){return this.previousStateOverride??Q(this,Hp)??this.initialEditorState}get manager(){return this.props.manager}get view(){return this.manager.view}get uid(){return Q(this,Vp)}get initialEditorState(){return Q(this,Kp)}updateListener(t){const{state:e,tr:n}=t;return Q(this,Wi).emit("updated",this.eventListenerProps({state:e,tr:n}))}update(t){const{getProps:e}=t;return en(this,_u,e),this}updateViewProps(...t){const e=N0(this.updatableViewProps,t);this.view.setProps({...this.view.props,...e})}getAttributes(t){var e;const{attributes:n,autoFocus:r,classNames:o=[],label:i,editable:s}=this.props,a=(e=this.manager.store)==null?void 0:e.attributes,l=dt(n)?n(this.eventListenerProps()):n;let c={};(r||mr(r))&&(c=t?{autoFocus:!0}:{autofocus:"true"});const u=Gd(Q0(t&&"Prosemirror","remirror-editor",a==null?void 0:a.class,...o).split(" ")).join(" "),d={role:"textbox",...c,"aria-multiline":"true",...s??!0?{}:{"aria-readonly":"true"},"aria-label":i??"",...a,class:u};return vz({...d,...l})}addFocusListeners(){this.view.dom.addEventListener("blur",this.onBlur),this.view.dom.addEventListener("focus",this.onFocus)}removeFocusListeners(){this.view.dom.removeEventListener("blur",this.onBlur),this.view.dom.removeEventListener("focus",this.onFocus)}destroy(){Q(this,Wi).emit("destroy"),this.view&&this.removeFocusListeners()}eventListenerProps(t=pe()){const{state:e,tr:n,transactions:r}=t;return{tr:n,transactions:r,internalUpdate:!n,view:this.view,firstRender:Q(this,Cl),state:e??this.getState(),createStateFromContent:this.createStateFromContent,previousState:this.previousState,helpers:this.manager.store.helpers}}get baseOutput(){return{manager:this.manager,...this.manager.store,addHandler:this.addHandler,focus:this.focus,blur:this.blur,uid:Q(this,Vp),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}}};Vp=new WeakMap;_u=new WeakMap;Hp=new WeakMap;Cl=new WeakMap;Wi=new WeakMap;Wp=new WeakMap;Kp=new WeakMap;function uW(t,e){const n=[],r=new WeakMap,o=[],i=new WeakMap;let s=[];const a={duplicateMap:i,parentExtensions:o,gatheredExtensions:s,settings:e};for(const d of t)JN(a,{extension:d});s=za(s,(d,f)=>f.priority-d.priority);const l=new WeakSet,c=new Set;for(const d of s){const f=d.constructor,p=d.name,m=i.get(f);ve(m,{message:`No entries were found for the ExtensionConstructor ${d.name}`,code:K.INTERNAL}),!(l.has(f)||c.has(p))&&(l.add(f),c.add(p),n.push(d),r.set(f,d),m.forEach(g=>g==null?void 0:g.replaceChildExtension(f,d)))}const u=[];for(const d of n)dW({extension:d,found:l,missing:u});return ve(As(u),{code:K.MISSING_REQUIRED_EXTENSION,message:u.map(({Constructor:d,extension:f})=>`The extension '${f.name}' requires '${d.name} in order to run correctly.`).join(`
217
217
  `)}),{extensions:n,extensionMap:r}}function JN(t,e){var n;const{gatheredExtensions:r,duplicateMap:o,parentExtensions:i,settings:s}=t,{extension:a,parentExtension:l}=e;let{names:c=[]}=e;ve(GN(a),{code:K.INVALID_MANAGER_EXTENSION,message:`An invalid extension: ${a} was provided to the [[\`RemirrorManager\`]].`});const u=a.extensions;if(a.setPriority((n=s.priority)==null?void 0:n[a.name]),r.push(a),fW({duplicateMap:o,extension:a,parentExtension:l}),u.length!==0){if(c.includes(a.name)){`${c.join(" > ")}${a.name}`;return}c=[...c,a.name],i.push(a);for(const d of u)JN(t,{names:c,extension:d,parentExtension:a})}}function dW(t){const{extension:e,found:n,missing:r}=t;if(e.requiredExtensions)for(const o of e.requiredExtensions??[])n.has(o)||r.push({Constructor:o,extension:e})}function fW(t){const{duplicateMap:e,extension:n,parentExtension:r}=t,o=n.constructor,i=e.get(o),s=r?[r]:[];e.set(o,i?[...i,...s]:s)}function pW(t){var e,n,r,o;const{extension:i,nodeNames:s,markNames:a,plainNames:l,store:c,handlers:u}=t;i.setStore(c);const d=(e=i.onCreate)==null?void 0:e.bind(i),f=(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);d&&u.create.push(d),f&&u.view.push(f),p&&u.update.push(p),m&&u.destroy.push(m),Ig(i)&&a.push(i.name),Df(i)&&i.name!=="doc"&&s.push(i.name),YN(i)&&l.push(i.name)}var Ki,Cu,Wr,Yo,Tu,nr,Js,Ou,Xs,Mu,Qs,Kr,Ru,qp=class{constructor(t,e={}){Ft(this,Ki,void 0),Ft(this,Cu,pe()),Ft(this,Wr,pe()),Ft(this,Yo,void 0),Ft(this,Tu,void 0),Ft(this,nr,Kn.None),Ft(this,Js,void 0),Ft(this,Ou,!0),Ft(this,Xs,{create:[],view:[],update:[],destroy:[]}),Ft(this,Mu,[]),Ft(this,Qs,bg()),Ft(this,Kr,void 0),Ft(this,Ru,void 0),this.getState=()=>{var o;return Q(this,nr)>=Kn.EditorView?this.view.state:(ve(Q(this,Kr),{code:K.MANAGER_PHASE_ERROR,message:"`getState` can only be called after the `Framework` or the `EditorView` has been added to the manager`. Check your plugins to make sure that the decorations callback uses the state argument."}),(o=Q(this,Kr))==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}=uW(t,e);en(this,Js,e),en(this,Yo,pa(n)),en(this,Tu,r),en(this,Ki,this.createExtensionStore()),en(this,nr,Kn.Create),this.setupLifecycleHandlers();for(const o of Q(this,Xs).create){const i=o();i&&Q(this,Mu).push(i)}}static create(t,e={}){return new qp([...tR(t),...lW(e.builtin)],e)}get[bi](){return an.Manager}get destroyed(){return Q(this,nr)===Kn.Destroy}get mounted(){return Q(this,nr)>=Kn.EditorView&&Q(this,nr)<Kn.Destroy}get output(){var t;return(t=Q(this,Kr))==null?void 0:t.frameworkOutput}get frameworkAttached(){return!!Q(this,Kr)}get extensions(){return Q(this,Yo)}get stringHandlers(){return Q(this,Cu)}get store(){return pa(Q(this,Wr))}get extensionStore(){return pa(Q(this,Ki))}get tr(){return this.getExtension(Fe).transaction}get nodes(){return Q(this,Wr).nodes}get marks(){return Q(this,Wr).marks}get schema(){return Q(this,Wr).schema}get extensionTags(){return Q(this,Wr).tags}get view(){return Q(this,Wr).view}get settings(){return Q(this,Js)}get document(){return Q(this,Js).document??Pg()}setupLifecycleHandlers(){const t=Q(this,Ki),e=Q(this,Xs),n=[],r=[],o=[];t.nodeNames=n,t.markNames=r,t.plainNames=o;for(const i of Q(this,Yo))pW({extension:i,nodeNames:n,markNames:r,plainNames:o,handlers:e,store:t})}setStringHandler(t,e){Q(this,Cu)[t]=e}setStoreKey(t,e){Q(this,Wr)[t]=e}getStoreKey(t){const e=Q(this,Wr)[t];return ve(!$s(e),{code:K.MANAGER_PHASE_ERROR,message:"`getStoreKey` should not be called before the values are available."}),e}setExtensionStore(t,e){ve(Q(this,nr)<=Kn.EditorView,{code:K.MANAGER_PHASE_ERROR,message:"`setExtensionStore` should only be called during the `onCreate` lifecycle hook. Make sure to only call it within the returned methods."}),Q(this,Ki)[t]=e}createExtensionStore(){const t=pe(),e=!0;let n,r;return Object.defineProperties(t,{extensions:{get:()=>Q(this,Yo),enumerable:e},phase:{get:()=>Q(this,nr),enumerable:e},view:{get:()=>this.view,enumerable:e},managerSettings:{get:()=>pa(Q(this,Js)),enumerable:e},getState:{value:this.getState,enumerable:e},updateState:{value:this.updateState,enumerable:e},isMounted:{value:()=>this.mounted,enumerable:e},getExtension:{value:this.getExtension.bind(this),enumerable:e},manager:{get:()=>this,enumerable:e},document:{get:()=>this.document,enumerable:e},stringHandlers:{get:()=>Q(this,Cu),enumerable:e},currentState:{get:()=>n??(n=this.getState()),set:o=>{n=o},enumerable:e},previousState:{get:()=>r,set:o=>{r=o},enumerable:e}}),t.getStoreKey=this.getStoreKey.bind(this),t.setStoreKey=this.setStoreKey.bind(this),t.setExtensionStore=this.setExtensionStore.bind(this),t.setStringHandler=this.setStringHandler.bind(this),t}addView(t){if(Q(this,nr)>=Kn.EditorView)return this;en(this,Ou,!0),en(this,nr,Kn.EditorView),Q(this,Wr).view=t;for(const e of Q(this,Xs).view){const n=e(t);n&&Q(this,Mu).push(n)}return this}attachFramework(t,e){var n;Q(this,Kr)!==t&&(Q(this,Kr)&&(Q(this,Kr).destroy(),(n=Q(this,Ru))==null||n.call(this)),en(this,Kr,t),en(this,Ru,this.addHandler("stateUpdate",e)))}createEmptyDoc(){var t;const e=(t=this.schema.nodes.doc)==null?void 0:t.createAndFill();return ve(e,{code:K.INVALID_CONTENT,message:"An empty node could not be created due to an invalid schema."}),e}createState(t={}){const{onError:e,defaultSelection:n="end"}=this.settings,{content:r=this.createEmptyDoc(),selection:o=n,stringHandler:i=this.settings.stringHandler}=t,{schema:s,plugins:a}=this.store,l=MN({stringHandler:Se(i)?this.stringHandlers[i]:i,document:this.document,content:r,onError:e,schema:s,selection:o});return ha.create({schema:s,doc:l,plugins:a,selection:Ir(o,l)})}addHandler(t,e){return Q(this,Qs).on(t,e)}onStateUpdate(t){const e=Q(this,Ou);Q(this,Ki).currentState=t.state,Q(this,Ki).previousState=t.previousState,e&&(en(this,nr,Kn.Runtime),en(this,Ou,!1));const n={...t,firstUpdate:e};for(const r of Q(this,Xs).update)r(n);Q(this,Qs).emit("stateUpdate",n)}getExtension(t){const e=Q(this,Tu).get(t);return ve(e,{code:K.INVALID_MANAGER_EXTENSION,message:`'${t.name}' doesn't exist within this manager. Make sure it is properly added before attempting to use it.`}),e}hasExtension(t){return!!Q(this,Tu).get(t)}clone(){const t=Q(this,Yo).map(n=>n.clone(n.options)),e=qp.create(()=>t,Q(this,Js));return Q(this,Qs).emit("clone",e),e}recreate(t=[],e={}){const n=Q(this,Yo).map(o=>o.clone(o.initialOptions)),r=qp.create(()=>[...n,...t],e);return Q(this,Qs).emit("recreate",r),r}destroy(){var t,e,n,r,o,i;en(this,nr,Kn.Destroy);for(const s of((t=this.view)==null?void 0:t.state.plugins)??[])(n=(e=s.getState(this.view.state))==null?void 0:e.destroy)==null||n.call(e);(r=Q(this,Kr))==null||r.destroy(),(o=Q(this,Ru))==null||o.call(this);for(const s of Q(this,Mu))s();for(const s of Q(this,Xs).destroy)s();(i=this.view)==null||i.destroy(),Q(this,Qs).emit("destroy")}includes(t){const e=[],n=[];for(const r of Q(this,Yo))e.push(r.name,r.constructorName),n.push(r.constructor);return t.every(r=>Se(r)?mo(e,r):mo(n,r))}},hW=qp;Ki=new WeakMap;Cu=new WeakMap;Wr=new WeakMap;Yo=new WeakMap;Tu=new WeakMap;nr=new WeakMap;Js=new WeakMap;Ou=new WeakMap;Xs=new WeakMap;Mu=new WeakMap;Qs=new WeakMap;Kr=new WeakMap;Ru=new WeakMap;function mW(t,e){return!Vc(t)||!Hc(t,an.Manager)?!1:e?t.includes(e):!0}var gW=Object.defineProperty,vW=Object.getOwnPropertyDescriptor,yW=(t,e,n,r)=>{for(var o=r>1?void 0:r?vW(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&gW(e,n,o),o},XN=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},de=(t,e,n)=>(XN(t,e,"read from private field"),n?n.call(t):e.get(t)),rr=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},tr=(t,e,n,r)=>(XN(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Nu,xW=class{constructor(){this.portals=new Map,rr(this,Nu,bg()),this.on=t=>de(this,Nu).on("update",t),this.once=t=>{const e=de(this,Nu).on("update",n=>{e(),t(n)});return e}}update(){de(this,Nu).emit("update",this.portals)}render({Component:t,container:e}){const n=this.portals.get(e);this.portals.set(e,{Component:t,key:(n==null?void 0:n.key)??Zh()}),this.update()}forceUpdate(){for(const[t,{Component:e}]of this.portals)this.portals.set(t,{Component:e,key:Zh()})}remove(t){this.portals.delete(t),this.update()}};Nu=new WeakMap;var bW=t=>{const{portals:e}=t;return oe.createElement(oe.Fragment,null,e.map(([n,{Component:r,key:o}])=>Vo.createPortal(oe.createElement(r,null),n,o)))};function wW(t){const[e,n]=h.useState(()=>Array.from(t.portals.entries()));return h.useEffect(()=>t.on(r=>{n(Array.from(r.entries()))}),[t]),h.useMemo(()=>e,[e])}var Et,Pu,ea,$u,Gp,Au,Tl,Iu,Yp,Zo,Nn,ix,QN=class{constructor({getPosition:t,node:e,portalContainer:n,view:r,ReactComponent:o,options:i}){rr(this,Et,void 0),rr(this,Pu,[]),rr(this,ea,void 0),rr(this,$u,void 0),rr(this,Gp,void 0),rr(this,Au,void 0),rr(this,Tl,void 0),rr(this,Iu,!1),rr(this,Yp,void 0),rr(this,Zo,void 0),rr(this,Nn,void 0),rr(this,ix,l=>{l&&(ve(de(this,Zo),{code:K.REACT_NODE_VIEW,message:`You have applied a ref to a node view provided for '${de(this,Et).type.name}' which doesn't support content.`}),l.append(de(this,Zo)))}),this.Component=()=>{const l=de(this,Gp);return ve(l,{code:K.REACT_NODE_VIEW,message:`The custom react node view provided for ${de(this,Et).type.name} doesn't have a valid ReactComponent`}),oe.createElement(l,{updateAttributes:this.updateAttributes,selected:this.selected,view:de(this,ea),getPosition:de(this,Au),node:de(this,Et),forwardRef:de(this,ix),decorations:de(this,Pu)})},this.updateAttributes=l=>{if(!de(this,ea).editable)return;const c=de(this,Au).call(this);if(c==null)return;const u=de(this,ea).state.tr.setNodeMarkup(c,void 0,{...de(this,Et).attrs,...l});de(this,ea).dispatch(u)},ve(dt(t),{message:"You are attempting to use a node view for a mark type. This is not supported yet. Please check your configuration."}),tr(this,Et,e),tr(this,ea,r),tr(this,$u,n),tr(this,Gp,o),tr(this,Au,t),tr(this,Tl,i),tr(this,Nn,this.createDom());const{contentDOM:s,wrapper:a}=this.createContentDom()??{};tr(this,Yp,s??void 0),tr(this,Zo,a),de(this,Zo)&&de(this,Nn).append(de(this,Zo)),this.setDomAttributes(de(this,Et),de(this,Nn)),this.Component.displayName=GM(`${de(this,Et).type.name}NodeView`),this.renderComponent()}static create(t){const{portalContainer:e,ReactComponent:n,options:r}=t;return(o,i,s)=>new QN({options:r,node:o,view:i,getPosition:s,portalContainer:e,ReactComponent:n})}get selected(){return de(this,Iu)}get contentDOM(){return de(this,Yp)}get dom(){return de(this,Nn)}renderComponent(){de(this,$u).render({Component:this.Component,container:de(this,Nn)})}createDom(){const{defaultBlockNode:t,defaultInlineNode:e}=de(this,Tl),n=de(this,Et).isInline?document.createElement(e):document.createElement(t);return n.classList.add(`${AS(de(this,Et).type.name)}-node-view-wrapper`),n}createContentDom(){var t,e;if(de(this,Et).isLeaf)return;const n=(e=(t=de(this,Et).type.spec).toDOM)==null?void 0:e.call(t,de(this,Et));if(!n)return;const{contentDOM:r,dom:o}=ro.renderSpec(document,n);let i;if(Fo(o))return i=o,o===r&&(i=document.createElement("span"),i.classList.add(`${AS(de(this,Et).type.name)}-node-view-content-wrapper`),i.append(r)),Fo(r),{wrapper:i,contentDOM:r}}update(t,e){return gb({types:de(this,Et).type,node:t})?(de(this,Et)===t&&de(this,Pu)===e||(de(this,Et).sameMarkup(t)||this.setDomAttributes(t,de(this,Nn)),tr(this,Et,t),tr(this,Pu,e),this.renderComponent()),!0):!1}setDomAttributes(t,e){const{toDOM:n}=de(this,Et).type.spec;let r=t.attrs;if(n){const o=n(t);if(Se(o)||kW(o))return;el(o[1])&&(r=o[1])}for(const[o,i]of qt(r))e.setAttribute(o,i)}selectNode(){tr(this,Iu,!0),de(this,Nn)&&de(this,Nn).classList.add(RS),this.renderComponent()}deselectNode(){tr(this,Iu,!1),de(this,Nn)&&de(this,Nn).classList.remove(RS),this.renderComponent()}destroy(){de(this,$u).remove(de(this,Nn))}ignoreMutation(t){return t.type==="selection"?!de(this,Et).type.spec.selectable:de(this,Zo)?!de(this,Zo).contains(t.target):!0}stopEvent(t){var e;if(!de(this,Nn))return!1;if(dt(de(this,Tl).stopEvent))return de(this,Tl).stopEvent({event:t});const n=t.target;if(!(de(this,Nn).contains(n)&&!((e=this.contentDOM)!=null&&e.contains(n))))return!1;const o=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!o)return!0;const s=!!de(this,Et).type.spec.draggable,a=ye.isSelectable(de(this,Et)),l=t.type==="copy",c=t.type==="paste",u=t.type==="cut",d=t.type==="mousedown",f=t.type.startsWith("drag");return!s&&a&&f&&t.preventDefault(),!(f||o||l||c||u||d&&a)}},XE=QN;Et=new WeakMap;Pu=new WeakMap;ea=new WeakMap;$u=new WeakMap;Gp=new WeakMap;Au=new WeakMap;Tl=new WeakMap;Iu=new WeakMap;Yp=new WeakMap;Zo=new WeakMap;Nn=new WeakMap;ix=new WeakMap;function kW(t){return Z0(t)||el(t)&&Z0(t.dom)}var rf=class extends St{constructor(){super(...arguments),this.portalContainer=new xW}get name(){return"reactComponent"}onCreate(){this.store.setStoreKey("portalContainer",this.portalContainer)}createNodeViews(){const t=pe(),e=this.store.managerSettings.nodeViewComponents??{};for(const r of this.store.extensions)!r.ReactComponent||!Df(r)||r.reactComponentEnvironment==="ssr"||(t[r.name]=XE.create({options:this.options,ReactComponent:r.ReactComponent,portalContainer:this.portalContainer}));const n=qt({...this.options.nodeViewComponents,...e});for(const[r,o]of n)t[r]=XE.create({options:this.options,ReactComponent:o,portalContainer:this.portalContainer});return t}};rf=yW([Ze({defaultOptions:{defaultBlockNode:"div",defaultInlineNode:"span",defaultContentNode:"span",defaultEnvironment:"both",nodeViewComponents:{},stopEvent:null},staticKeys:["defaultBlockNode","defaultInlineNode","defaultContentNode","defaultEnvironment"]})],rf);function SW(t){const e=h.createContext(null),n=EW(e);return[o=>{const i=t(o);return oe.createElement(e.Provider,{value:i},o.children)},n,e]}function EW(t){return(e,n)=>{const r=h.useContext(t),o=_W(r);if(!r)throw new Error("`useContextHook` must be placed inside the `Provider` returned by the `createContextState` method");if(!e)return r;if(typeof e!="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=e(r);if(!o||!n)return i;const s=e(o);return n(s,i)?s:i}}function _W(t){const e=h.useRef();return CW(()=>{e.current=t}),e.current}var CW=typeof document<"u"?h.useLayoutEffect:h.useEffect;function TW(t,e){return SW(n=>{const r=h.useRef(null),o=h.useRef(),i=e==null?void 0:e(n),[s,a]=h.useState(()=>t({get:QE(r),set:e_(o),previousContext:void 0,props:n,state:i})),l=[...Object.values(n),i];return h.useEffect(()=>{l.length!==0&&a(c=>t({get:QE(r),set:e_(o),previousContext:c,props:n,state:i}))},l),r.current=s,o.current=a,s})}function QE(t){return e=>{if(!t.current)throw new Error("`get` called outside of function scope. `get` can only be called within a function.");if(!e)return t.current;if(typeof e!="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 e(t.current)}}function e_(t){return e=>{if(!t.current)throw new Error("`set` called outside of function scope. `set` can only be called within a function.");t.current(n=>({...n,...typeof e=="function"?e(n):e}))}}var eP={},tP={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.errorMessages=t.ErrorType=void 0;var e;(function(n){n.MalformedUnicode="MALFORMED_UNICODE",n.MalformedHexadecimal="MALFORMED_HEXADECIMAL",n.CodePointLimit="CODE_POINT_LIMIT",n.OctalDeprecation="OCTAL_DEPRECATION",n.EndOfString="END_OF_STRING"})(e=t.ErrorType||(t.ErrorType={})),t.errorMessages=new Map([[e.MalformedUnicode,"malformed Unicode character escape sequence"],[e.MalformedHexadecimal,"malformed hexadecimal character escape sequence"],[e.CodePointLimit,"Unicode codepoint must not be greater than 0x10FFFF in escape sequence"],[e.OctalDeprecation,'"0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead'],[e.EndOfString,"malformed escape sequence at end of string"]])})(tP);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.unraw=t.errorMessages=t.ErrorType=void 0;const e=tP;Object.defineProperty(t,"ErrorType",{enumerable:!0,get:function(){return e.ErrorType}}),Object.defineProperty(t,"errorMessages",{enumerable:!0,get:function(){return e.errorMessages}});function n(p){return!p.match(/[^a-f0-9]/i)?parseInt(p,16):NaN}function r(p,m,g){const y=n(p);if(Number.isNaN(y)||g!==void 0&&g!==p.length)throw new SyntaxError(e.errorMessages.get(m));return y}function o(p){const m=r(p,e.ErrorType.MalformedHexadecimal,2);return String.fromCharCode(m)}function i(p,m){const g=r(p,e.ErrorType.MalformedUnicode,4);if(m!==void 0){const y=r(m,e.ErrorType.MalformedUnicode,4);return String.fromCharCode(g,y)}return String.fromCharCode(g)}function s(p){return p.charAt(0)==="{"&&p.charAt(p.length-1)==="}"}function a(p){if(!s(p))throw new SyntaxError(e.errorMessages.get(e.ErrorType.MalformedUnicode));const m=p.slice(1,-1),g=r(m,e.ErrorType.MalformedUnicode);try{return String.fromCodePoint(g)}catch(y){throw y instanceof RangeError?new SyntaxError(e.errorMessages.get(e.ErrorType.CodePointLimit)):y}}function l(p,m=!1){if(m)throw new SyntaxError(e.errorMessages.get(e.ErrorType.OctalDeprecation));const g=parseInt(p,8);return String.fromCharCode(g)}const c=new Map([["b","\b"],["f","\f"],["n",`
218
- `],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function u(p){return c.get(p)||p}const d=/\\(?:(\\)|x([\s\S]{0,2})|u(\{[^}]*\}?)|u([\s\S]{4})\\u([^{][\s\S]{0,3})|u([\s\S]{0,4})|([0-3]?[0-7]{1,2})|([\s\S])|$)/g;function f(p,m=!1){return p.replace(d,function(g,y,v,x,w,S,_,k,E){if(y!==void 0)return"\\";if(v!==void 0)return o(v);if(x!==void 0)return a(x);if(w!==void 0)return i(w,S);if(_!==void 0)return i(_);if(k==="0")return"\0";if(k!==void 0)return l(k,!m);if(E!==void 0)return u(E);throw new SyntaxError(e.errorMessages.get(e.ErrorType.EndOfString))})}t.unraw=f,t.default=f})(eP);const OW=ki(eP),Ta=t=>typeof t=="string",MW=t=>typeof t=="function",t_=new Map,nP="en";function Eb(t){return[...Array.isArray(t)?t:[t],nP]}function rP(t,e,n){const r=Eb(t);return mm(()=>gm("date",r,n),()=>new Intl.DateTimeFormat(r,n)).format(Ta(e)?new Date(e):e)}function sx(t,e,n){const r=Eb(t);return mm(()=>gm("number",r,n),()=>new Intl.NumberFormat(r,n)).format(e)}function n_(t,e,n,{offset:r=0,...o}){const i=Eb(t),s=e?mm(()=>gm("plural-ordinal",i),()=>new Intl.PluralRules(i,{type:"ordinal"})):mm(()=>gm("plural-cardinal",i),()=>new Intl.PluralRules(i,{type:"cardinal"}));return o[n]??o[s.select(n-r)]??o.other}function mm(t,e){const n=t();let r=t_.get(n);return r||(r=e(),t_.set(n,r)),r}function gm(t,e,n){const r=e.join("-");return`${t}-${r}-${JSON.stringify(n)}`}const oP=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g,RW=(t,e,n={})=>{const r=e||t,o=s=>typeof s=="object"?s:n[s]||{style:s},i=(s,a)=>{const l=Object.keys(n).length?o("number"):void 0,c=sx(r,s,l);return a.replace("#",c)};return{plural:(s,a)=>{const{offset:l=0}=a,c=n_(r,!1,s,a);return i(s-l,c)},selectordinal:(s,a)=>{const{offset:l=0}=a,c=n_(r,!0,s,a);return i(s-l,c)},select:NW,number:(s,a)=>sx(r,s,o(a)),date:(s,a)=>rP(r,s,o(a)),undefined:PW}},NW=(t,e)=>e[t]??e.other,PW=t=>t;function $W(t,e,n){return(r={},o)=>{const i=RW(e,n,o),s=l=>Array.isArray(l)?l.reduce((c,u)=>{if(Ta(u))return c+u;const[d,f,p]=u;let m={};p!=null&&typeof p=="object"?Object.entries(p).forEach(([v,x])=>{m[v]=s(x)}):m=p;const g=i[f],y=g(r[d],m);return y==null?c:c+y},""):l,a=s(t);return Ta(a)&&oP.test(a)?OW(a.trim()):Ta(a)?a.trim():a?String(a):""}}var AW=Object.defineProperty,IW=(t,e,n)=>e in t?AW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,DW=(t,e,n)=>(IW(t,typeof e!="symbol"?e+"":e,n),n);class LW{constructor(){DW(this,"_events",{})}on(e,n){var r;return(r=this._events)[e]??(r[e]=[]),this._events[e].push(n),()=>this.removeListener(e,n)}removeListener(e,n){const r=this._getListeners(e);if(!r)return;const o=r.indexOf(n);~o&&r.splice(o,1)}emit(e,...n){const r=this._getListeners(e);r&&r.map(o=>o.apply(this,n))}_getListeners(e){const n=this._events[e];return Array.isArray(n)?n:!1}}var jW=Object.defineProperty,zW=(t,e,n)=>e in t?jW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,yl=(t,e,n)=>(zW(t,typeof e!="symbol"?e+"":e,n),n);class FW extends LW{constructor(e){super(),yl(this,"_locale",""),yl(this,"_locales"),yl(this,"_localeData",{}),yl(this,"_messages",{}),yl(this,"_missing"),yl(this,"t",this._.bind(this)),e.missing!=null&&(this._missing=e.missing),e.messages!=null&&this.load(e.messages),e.localeData!=null&&this.loadLocaleData(e.localeData),(typeof e.locale=="string"||e.locales)&&this.activate(e.locale??nP,e.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(e,n){const r=this._localeData[e];r?Object.assign(r,n):this._localeData[e]=n}loadLocaleData(e,n){n!=null?this._loadLocaleData(e,n):Object.keys(e).forEach(r=>this._loadLocaleData(r,e[r])),this.emit("change")}_load(e,n){const r=this._messages[e];r?Object.assign(r,n):this._messages[e]=n}load(e,n){typeof e=="string"&&typeof n=="object"?this._load(e,n):Object.entries(e).forEach(([r,o])=>this._load(r,o)),this.emit("change")}loadAndActivate({locale:e,locales:n,messages:r}){this._locale=e,this._locales=n||void 0,this._messages[this._locale]=r,this.emit("change")}activate(e,n){this._locale=e,this._locales=n,this.emit("change")}_(e,n,r){let o=r==null?void 0:r.message;Ta(e)||(n=e.values||n,o=e.message,e=e.id);const i=this.messages[e],s=i===void 0,a=this._missing;if(a&&s)return MW(a)?a(this._locale,e):a;s&&this.emit("missing",{id:e,locale:this._locale});let l=i||o||e;return Ta(l)&&oP.test(l)?JSON.parse(`"${l}"`):Ta(l)?l:$W(l,this._locale,this._locales)(n,r==null?void 0:r.formats)}date(e,n){return rP(this._locales||this._locale,e,n)}number(e,n){return sx(this._locales||this._locale,e,n)}}function BW(t={}){return new FW(t)}const Dg=BW();function Y(t,e){return e?"other":t==1?"one":"other"}function Oi(t,e){return e?"other":t==0||t==1?"one":"other"}function er(t,e){var n=String(t).split("."),r=!n[1];return e?"other":t==1&&r?"one":"other"}function ot(t,e){return"other"}function Hs(t,e){return e?"other":t==1?"one":t==2?"two":"other"}const UW=ot,VW=Y,HW=Oi;function WW(t,e){return e?"other":t>=0&&t<=1?"one":"other"}const KW=Y;function qW(t,e){var n=String(t).split("."),r=Number(n[0])==t,o=r&&n[0].slice(-2);return e?"other":t==0?"zero":t==1?"one":t==2?"two":o>=3&&o<=10?"few":o>=11&&o<=99?"many":"other"}function GW(t,e){var n=String(t).split("."),r=Number(n[0])==t,o=r&&n[0].slice(-2);return e?"other":t==0?"zero":t==1?"one":t==2?"two":o>=3&&o<=10?"few":o>=11&&o<=99?"many":"other"}function YW(t,e){return e?t==1||t==5||t==7||t==8||t==9||t==10?"one":t==2||t==3?"two":t==4?"few":t==6?"many":"other":t>=0&&t<=1?"one":"other"}const ZW=Y,JW=er;function XW(t,e){var n=String(t).split("."),r=n[0],o=r.slice(-1),i=r.slice(-2),s=r.slice(-3);return e?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":t==1?"one":"other"}function QW(t,e){var n=String(t).split("."),r=Number(n[0])==t,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2);return e?(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 eK=Y,tK=Y,nK=Y,rK=Oi,oK=ot;function iK(t,e){return e?t==1||t==5||t==7||t==8||t==9||t==10?"one":t==2||t==3?"two":t==4?"few":t==6?"many":"other":t>=0&&t<=1?"one":"other"}const sK=ot;function aK(t,e){var n=String(t).split("."),r=Number(n[0])==t,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2),s=r&&n[0].slice(-6);return e?"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":t!=0&&r&&s==0?"many":"other"}const lK=Y;function cK(t,e){var n=String(t).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 e?"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 uK(t,e){var n=String(t).split("."),r=!n[1];return e?t==1||t==3?"one":t==2?"two":t==4?"few":"other":t==1&&r?"one":"other"}const dK=Y;function fK(t,e){var n=String(t).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=o.slice(-1);return e?"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 pK=Y,hK=Y,mK=Y;function gK(t,e){var n=String(t).split("."),r=n[0],o=!n[1];return e?"other":t==1&&o?"one":r>=2&&r<=4&&o?"few":o?"other":"many"}function vK(t,e){return e?t==0||t==7||t==8||t==9?"zero":t==1?"one":t==2?"two":t==3||t==4?"few":t==5||t==6?"many":"other":t==0?"zero":t==1?"one":t==2?"two":t==3?"few":t==6?"many":"other"}function yK(t,e){var n=String(t).split("."),r=n[0],o=Number(n[0])==t;return e?"other":t==1||!o&&(r==0||r==1)?"one":"other"}const xK=er;function bK(t,e){var n=String(t).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-2),a=o.slice(-2);return e?"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 wK=Y,kK=ot,SK=Y,EK=Y;function _K(t,e){var n=String(t).split("."),r=!n[1],o=Number(n[0])==t,i=o&&n[0].slice(-1),s=o&&n[0].slice(-2);return e?i==1&&s!=11?"one":i==2&&s!=12?"two":i==3&&s!=13?"few":"other":t==1&&r?"one":"other"}const CK=Y,TK=Y,OK=er,MK=Y;function RK(t,e){return e?"other":t>=0&&t<=1?"one":"other"}function NK(t,e){return e?"other":t>=0&&t<2?"one":"other"}const PK=er;function $K(t,e){var n=String(t).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=o.slice(-1);return e?t==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 AK=Y;function IK(t,e){return e?t==1?"one":"other":t>=0&&t<2?"one":"other"}const DK=Y,LK=er;function jK(t,e){var n=String(t).split("."),r=Number(n[0])==t;return e?t==1?"one":"other":t==1?"one":t==2?"two":r&&t>=3&&t<=6?"few":r&&t>=7&&t<=10?"many":"other"}function zK(t,e){var n=String(t).split("."),r=Number(n[0])==t;return e?t==1||t==11?"one":t==2||t==12?"two":t==3||t==13?"few":"other":t==1||t==11?"one":t==2||t==12?"two":r&&t>=3&&t<=10||r&&t>=13&&t<=19?"few":"other"}const FK=er,BK=Y;function UK(t,e){return e?t==1?"one":t==2||t==3?"two":t==4?"few":t==6?"many":"other":t>=0&&t<=1?"one":"other"}const VK=Oi;function HK(t,e){var n=String(t).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return e?"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 WK=Y,KK=Y;function qK(t,e){var n=String(t).split("."),r=n[0],o=!n[1],i=Number(n[0])==t,s=i&&n[0].slice(-1);return e?"other":t==1&&o?"one":r==2&&o?"two":o&&(t<0||t>10)&&i&&s==0?"many":"other"}function GK(t,e){return e?t==1?"one":t==2||t==3?"two":t==4?"few":t==6?"many":"other":t>=0&&t<=1?"one":"other"}function YK(t,e){var n=String(t).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 e?"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 ZK(t,e){var n=String(t).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-2),a=o.slice(-2);return e?"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 JK(t,e){return e?t==1||t==5?"one":"other":t==1?"one":"other"}function XK(t,e){return e?t==1?"one":"other":t>=0&&t<2?"one":"other"}const QK=er,eq=ot,tq=ot,nq=ot,rq=er;function oq(t,e){var n=String(t).split("."),r=n[0],o=Number(n[0])==t,i=r.slice(-1),s=r.slice(-2);return e?"other":o&&i==1&&s!=11||!o?"one":"other"}function iq(t,e){var n=String(t).split("."),r=!n[1];return e?t==11||t==8||t==80||t==800?"many":"other":t==1&&r?"one":"other"}const sq=Hs;function aq(t,e){var n=String(t).split("."),r=n[0],o=!n[1],i=Number(n[0])==t,s=i&&n[0].slice(-1);return e?"other":t==1&&o?"one":r==2&&o?"two":o&&(t<0||t>10)&&i&&s==0?"many":"other"}const lq=ot,cq=ot,uq=Y,dq=er,fq=Y,pq=ot,hq=ot;function mq(t,e){var n=String(t).split("."),r=n[0],o=r.slice(-2);return e?r==1?"one":r==0||o>=2&&o<=20||o==40||o==60||o==80?"many":"other":t==1?"one":"other"}function gq(t,e){return e?"other":t>=0&&t<2?"one":"other"}const vq=Y,yq=Y,xq=ot,bq=ot;function wq(t,e){var n=String(t).split("."),r=Number(n[0])==t,o=r&&n[0].slice(-1);return e?o==6||o==9||r&&o==0&&t!=0?"many":"other":t==1?"one":"other"}const kq=Y,Sq=Y,Eq=ot;function _q(t,e){return e?"other":t>=0&&t<=1?"one":"other"}const Cq=ot,Tq=Y,Oq=Y;function Mq(t,e){return e?"other":t==0?"zero":t==1?"one":"other"}const Rq=Y;function Nq(t,e){var n=String(t).split("."),r=Number(n[0])==t,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 e?r&&t>=1&&t<=4||o>=1&&o<=4||o>=21&&o<=24||o>=41&&o<=44||o>=61&&o<=64||o>=81&&o<=84?"one":t==5||o==5?"many":"other":t==0?"zero":t==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)||t!=0&&a==1e5?"two":o==3||o==23||o==43||o==63||o==83?"few":t!=1&&(o==1||o==21||o==41||o==61||o==81)?"many":"other"}const Pq=Y;function $q(t,e){var n=String(t).split("."),r=n[0];return e?"other":t==0?"zero":(r==0||r==1)&&t!=0?"one":"other"}const Aq=Y,Iq=Y,Dq=ot,Lq=Oi;function jq(t,e){return e&&t==1?"one":"other"}function zq(t,e){var n=String(t).split("."),r=n[1]||"",o=Number(n[0])==t,i=o&&n[0].slice(-1),s=o&&n[0].slice(-2);return e?"other":i==1&&(s<11||s>19)?"one":i>=2&&i<=9&&(s<11||s>19)?"few":r!=0?"many":"other"}function Fq(t,e){var n=String(t).split("."),r=n[1]||"",o=r.length,i=Number(n[0])==t,s=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-2),c=r.slice(-1);return e?"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 Bq=Y,Uq=Oi,Vq=Y;function Hq(t,e){var n=String(t).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 e?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 Wq=Y,Kq=Y;function qq(t,e){var n=String(t).split("."),r=!n[1],o=Number(n[0])==t,i=o&&n[0].slice(-2);return e?t==1?"one":"other":t==1&&r?"one":!r||t==0||i>=2&&i<=19?"few":"other"}function Gq(t,e){return e?t==1?"one":t==2||t==3?"two":t==4?"few":"other":t==1?"one":"other"}function Yq(t,e){return e&&t==1?"one":"other"}function Zq(t,e){var n=String(t).split("."),r=Number(n[0])==t,o=r&&n[0].slice(-2);return e?"other":t==1?"one":t==0||o>=2&&o<=10?"few":o>=11&&o<=19?"many":"other"}const Jq=ot,Xq=Y,Qq=Hs,eG=Y,tG=Y;function nG(t,e){var n=String(t).split("."),r=Number(n[0])==t;return e?r&&t>=1&&t<=4?"one":"other":t==1?"one":"other"}const rG=er,oG=Y,iG=Y,sG=Y,aG=ot,lG=Y,cG=Oi,uG=Y,dG=Y,fG=Y;function pG(t,e){var n=String(t).split("."),r=Number(n[0])==t;return e?t==1||t==5||r&&t>=7&&t<=9?"one":t==2||t==3?"two":t==4?"few":t==6?"many":"other":t==1?"one":"other"}const hG=Y,mG=ot,gG=Oi,vG=Y;function yG(t,e){var n=String(t).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return e?"other":t==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 xG(t,e){var n=String(t).split("."),r=n[1]||"",o=r.length,i=Number(n[0])==t,s=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-2),c=r.slice(-1);return e?"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 bG=Y;function wG(t,e){var n=String(t).split("."),r=n[0];return e?"other":r==0||r==1?"one":"other"}const kG=er,SG=Y;function EG(t,e){var n=String(t).split("."),r=!n[1],o=Number(n[0])==t,i=o&&n[0].slice(-2);return e?t==1?"one":"other":t==1&&r?"one":!r||t==0||i>=2&&i<=19?"few":"other"}const _G=Y,CG=ot;function TG(t,e){var n=String(t).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return e?"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 OG=Y,MG=ot,RG=Y;function NG(t,e){var n=String(t).split("."),r=!n[1];return e?t==11||t==8||t==80||t==800?"many":"other":t==1&&r?"one":"other"}function PG(t,e){var n=String(t).split("."),r=!n[1];return e?t==11||t==8||t==80||t==800?"many":"other":t==1&&r?"one":"other"}const $G=Y,AG=Y,IG=Hs,DG=Y,LG=ot,jG=ot;function zG(t,e){var n=String(t).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 e?"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 FG(t,e){var n=String(t).split("."),r=Number(n[0])==t;return e?"other":t>=0&&t<=1?"one":r&&t>=2&&t<=10?"few":"other"}function BG(t,e){var n=String(t).split("."),r=n[0],o=n[1]||"";return e?"other":t==0||t==1||r==0&&o==1?"one":"other"}function UG(t,e){var n=String(t).split("."),r=n[0],o=!n[1];return e?"other":t==1&&o?"one":r>=2&&r<=4&&o?"few":o?"other":"many"}function VG(t,e){var n=String(t).split("."),r=n[0],o=!n[1],i=r.slice(-2);return e?"other":o&&i==1?"one":o&&i==2?"two":o&&(i==3||i==4)||!o?"few":"other"}const HG=Hs,WG=Hs,KG=Hs,qG=Hs,GG=Hs,YG=Y,ZG=Y;function JG(t,e){var n=String(t).split("."),r=Number(n[0])==t,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2);return e?t==1?"one":o==4&&i!=14?"many":"other":t==1?"one":"other"}function XG(t,e){var n=String(t).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 e?"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 QG=Y,eY=Y,tY=Y,nY=ot;function rY(t,e){var n=String(t).split("."),r=!n[1],o=Number(n[0])==t,i=o&&n[0].slice(-1),s=o&&n[0].slice(-2);return e?(i==1||i==2)&&s!=11&&s!=12?"one":"other":t==1&&r?"one":"other"}const oY=er,iY=Y,sY=Y,aY=Y,lY=Y,cY=ot,uY=Oi,dY=Y;function fY(t,e){var n=String(t).split("."),r=Number(n[0])==t,o=r&&n[0].slice(-1);return e?o==6||o==9||t==10?"few":"other":t==1?"one":"other"}function pY(t,e){var n=String(t).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=o.slice(-1);return e?t==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 hY=Y,mY=ot,gY=Y,vY=Y;function yY(t,e){var n=String(t).split("."),r=Number(n[0])==t;return e?"other":t==0||t==1||r&&t>=11&&t<=99?"one":"other"}const xY=Y;function bY(t,e){var n=String(t).split("."),r=n[0],o=!n[1],i=Number(n[0])==t,s=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-1),c=r.slice(-2);return e?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 wY=er,kY=Y,SY=Y;function EY(t,e){return e&&t==1?"one":"other"}const _Y=Y,CY=Y,TY=Oi,OY=Y,MY=ot,RY=Y,NY=Y,PY=er,$Y=ot,AY=ot,IY=ot;function DY(t,e){return e?"other":t>=0&&t<=1?"one":"other"}const LY=Object.freeze(Object.defineProperty({__proto__:null,_in:UW,af:VW,ak:HW,am:WW,an:KW,ar:qW,ars:GW,as:YW,asa:ZW,ast:JW,az:XW,be:QW,bem:eK,bez:tK,bg:nK,bho:rK,bm:oK,bn:iK,bo:sK,br:aK,brx:lK,bs:cK,ca:uK,ce:dK,ceb:fK,cgg:pK,chr:hK,ckb:mK,cs:gK,cy:vK,da:yK,de:xK,dsb:bK,dv:wK,dz:kK,ee:SK,el:EK,en:_K,eo:CK,es:TK,et:OK,eu:MK,fa:RK,ff:NK,fi:PK,fil:$K,fo:AK,fr:IK,fur:DK,fy:LK,ga:jK,gd:zK,gl:FK,gsw:BK,gu:UK,guw:VK,gv:HK,ha:WK,haw:KK,he:qK,hi:GK,hr:YK,hsb:ZK,hu:JK,hy:XK,ia:QK,id:eq,ig:tq,ii:nq,io:rq,is:oq,it:iq,iu:sq,iw:aq,ja:lq,jbo:cq,jgo:uq,ji:dq,jmc:fq,jv:pq,jw:hq,ka:mq,kab:gq,kaj:vq,kcg:yq,kde:xq,kea:bq,kk:wq,kkj:kq,kl:Sq,km:Eq,kn:_q,ko:Cq,ks:Tq,ksb:Oq,ksh:Mq,ku:Rq,kw:Nq,ky:Pq,lag:$q,lb:Aq,lg:Iq,lkt:Dq,ln:Lq,lo:jq,lt:zq,lv:Fq,mas:Bq,mg:Uq,mgo:Vq,mk:Hq,ml:Wq,mn:Kq,mo:qq,mr:Gq,ms:Yq,mt:Zq,my:Jq,nah:Xq,naq:Qq,nb:eG,nd:tG,ne:nG,nl:rG,nn:oG,nnh:iG,no:sG,nqo:aG,nr:lG,nso:cG,ny:uG,nyn:dG,om:fG,or:pG,os:hG,osa:mG,pa:gG,pap:vG,pl:yG,prg:xG,ps:bG,pt:wG,pt_PT:kG,rm:SG,ro:EG,rof:_G,root:CG,ru:TG,rwk:OG,sah:MG,saq:RG,sc:NG,scn:PG,sd:$G,sdh:AG,se:IG,seh:DG,ses:LG,sg:jG,sh:zG,shi:FG,si:BG,sk:UG,sl:VG,sma:HG,smi:WG,smj:KG,smn:qG,sms:GG,sn:YG,so:ZG,sq:JG,sr:XG,ss:QG,ssy:eY,st:tY,su:nY,sv:rY,sw:oY,syr:iY,ta:sY,te:aY,teo:lY,th:cY,ti:uY,tig:dY,tk:fY,tl:pY,tn:hY,to:mY,tr:gY,ts:vY,tzm:yY,ug:xY,uk:bY,ur:wY,uz:kY,ve:SY,vi:EY,vo:_Y,vun:CY,wa:TY,wae:OY,wo:MY,xh:RY,xog:NY,yi:PY,yo:$Y,yue:AY,zh:IY,zu:DY},Symbol.toStringTag,{value:"Module"}));var jY=Object.defineProperty,zY=Object.getOwnPropertyDescriptor,FY=Object.getOwnPropertyNames,BY=Object.prototype.hasOwnProperty,r_=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of FY(e))!BY.call(t,o)&&o!==n&&jY(t,o,{get:()=>e[o],enumerable:!(r=zY(e,o))||r.enumerable});return t},UY=(t,e,n)=>(r_(t,e,"default"),n&&r_(n,e,"default")),VY=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"]]}'),iP={};UY(iP,LY);Dg.loadLocaleData("en",{plurals:iP.en});Dg.load("en",VY);Dg.activate("en");var HY=Object.defineProperty,WY=Object.getOwnPropertyDescriptor,_b=(t,e,n,r)=>{for(var o=r>1?void 0:r?WY(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&HY(e,n,o),o},Tc=class extends Fr{get name(){return"doc"}createNodeSpec(t,e){const{docAttributes:n,content:r}=this.options,o=pe();if(el(n))for(const[i,s]of qt(n))o[i]={default:s};else for(const i of n)o[i]={default:null};return{attrs:o,content:r,...e}}setDocAttributes(t){return({tr:e,dispatch:n})=>{if(n){for(const[r,o]of Object.entries(t))e.step(new of(r,o));n(e)}return!0}}isDefaultDocNode({state:t=this.store.getState(),options:e}={}){return bb(t.doc,e)}};_b([ue()],Tc.prototype,"setDocAttributes",1);_b([At()],Tc.prototype,"isDefaultDocNode",1);Tc=_b([Ze({defaultOptions:{content:"block+",docAttributes:[]},defaultPriority:at.Medium,staticKeys:["content","docAttributes"],disableExtraAttributes:!0})],Tc);var sP="SetDocAttribute",aP="RevertSetDocAttribute",of=class extends Yt{constructor(t,e,n=sP){super(),this.stepType=n,this.key=t,this.value=e}static fromJSON(t,e){return new of(e.key,e.value,e.stepType)}apply(t){this.previous=t.attrs[this.key];const e={...t.attrs,[this.key]:this.value};return jt.ok(t.type.create(e,t.content,t.marks))}invert(){return new of(this.key,this.previous,aP)}map(){return this}toJSON(){return{stepType:this.stepType,key:this.key,value:this.value}}};try{Yt.jsonID(sP,of),Yt.jsonID(aP,of)}catch(t){if(!t.message.startsWith("Duplicate use of step JSON ID"))throw t}var KY=Object.defineProperty,qY=Object.getOwnPropertyDescriptor,lP=(t,e,n,r)=>{for(var o=r>1?void 0:r?qY(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&KY(e,n,o),o};function GY(t,e,n,r){const o=t.docView.posFromDOM(e,n,r);return o===null||o<0?null:o}function YY(t,e){const n=e.target;if(n){const r=GY(t,n,0);if(r!==null){const o=t.state.doc.resolve(r),i=o.node().isLeaf?0:1,s=o.start()-i;return{pos:r,inside:s}}}return t.posAtCoords({left:e.clientX,top:e.clientY})??void 0}var vm=class extends St{constructor(){super(...arguments),this.mousedown=!1,this.mouseover=!1,this.createMouseEventHandler=t=>(e,n)=>{const r=n,o=YY(e,r);if(!o)return!1;const i=[],s=[],{inside:a,pos:l}=o;if(a===-1)return!1;const c=e.state.doc.resolve(l),u=c.depth+1;for(const d of eR(u,1))i.push({node:d>c.depth&&c.nodeAfter?c.nodeAfter:c.node(d),pos:c.before(d)});for(const{type:d}of c.marksAcross(c)??[]){const f=wi(c,d);f&&s.push(f)}return t(r,{view:e,nodes:i,marks:s,getMark:d=>{const f=Se(d)?e.state.schema.marks[d]:d;return ve(f,{code:K.EXTENSION,message:`The mark ${d} being checked does not exist within the editor schema.`}),s.find(p=>p.mark.type===f)},getNode:d=>{var f;const p=Se(d)?e.state.schema.nodes[d]:d;ve(p,{code:K.EXTENSION,message:"The node being checked does not exist"});const m=i.find(({node:g})=>g.type===p);if(m)return{...m,isRoot:!!((f=i[0])!=null&&f.node.eq(m.node))}}})}}get name(){return"events"}onView(){var t,e;if(!((t=this.store.managerSettings.exclude)!=null&&t.clickHandler))for(const n of this.store.extensions){if(!n.createEventHandlers||(e=n.options.exclude)!=null&&e.clickHandler)continue;const r=n.createEventHandlers();for(const[o,i]of qt(r))this.addHandler(o,i)}}createPlugin(){const t=new WeakMap,e=(n,r,o,i,s,a,l,c)=>{const u=this.store.currentState,{schema:d,doc:f}=u,p=f.resolve(i),m=t.has(l),g=ZY({$pos:p,handled:m,view:o,state:u});let y=!1;m||(y=n(l,g)||y);const v={...g,pos:i,direct:c,nodeWithPosition:{node:s,pos:a},getNode:x=>{const w=Se(x)?d.nodes[x]:x;return ve(w,{code:K.EXTENSION,message:"The node being checked does not exist"}),w===s.type?{node:s,pos:a}:void 0}};return t.set(l,!0),r(l,v)||y};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)=>e(this.options.clickMark,this.options.click,n,r,o,i,s,a),handleDoubleClickOn:(n,r,o,i,s,a)=>e(this.options.doubleClickMark,this.options.doubleClick,n,r,o,i,s,a),handleTripleClickOn:(n,r,o,i,s,a)=>e(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())}};lP([At()],vm.prototype,"isInteracting",1);vm=lP([Ze({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:at.High})],vm);function ZY(t){const{handled:e,view:n,$pos:r,state:o}=t,i={getMark:XM,markRanges:[],view:n,state:o};if(e)return i;for(const{type:s}of r.marksAcross(r)??[]){const a=wi(r,s);a&&i.markRanges.push(a)}return i.getMark=s=>{const a=Se(s)?o.schema.marks[s]:s;return ve(a,{code:K.EXTENSION,message:`The mark ${s} being checked does not exist within the editor schema.`}),i.markRanges.find(l=>l.mark.type===a)},i}class $t extends je{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return $t.valid(r)?new $t(r):je.near(r)}content(){return J.empty}eq(e){return e instanceof $t&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new $t(e.resolve(n.pos))}getBookmark(){return new Cb(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!JY(e)||!XY(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&$t.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let a=e.node(s);if(n>0?e.indexAfter(s)<a.childCount:e.index(s)>0){i=a.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=n;let l=e.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&&!ye.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*n),r=!1;continue e}break}i=s,o+=n;let a=e.doc.resolve(o);if($t.valid(a))return a}return null}}}$t.prototype.visible=!1;$t.findFrom=$t.findGapCursorFrom;je.jsonID("gapcursor",$t);class Cb{constructor(e){this.pos=e}map(e){return new Cb(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return $t.valid(n)?new $t(n):je.near(n)}}function JY(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let 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 XY(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let 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 QY(){return new Ti({props:{decorations:rZ,createSelectionBetween(t,e,n){return e.pos==n.pos&&$t.valid(n)?new $t(n):null},handleClick:tZ,handleKeyDown:eZ,handleDOMEvents:{beforeinput:nZ}}})}const eZ=WN({ArrowLeft:wp("horiz",-1),ArrowRight:wp("horiz",1),ArrowUp:wp("vert",-1),ArrowDown:wp("vert",1)});function wp(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let s=r.selection,a=e>0?s.$to:s.$from,l=s.empty;if(s instanceof Ce){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=$t.findGapCursorFrom(a,e,l);return c?(o&&o(r.tr.setSelection(new $t(c))),!0):!1}}function tZ(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!$t.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&ye.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new $t(r))),!0)}function nZ(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof $t))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let o=F.empty;for(let s=r.length-1;s>=0;s--)o=F.from(r[s].createAndFill(null,o));let i=t.state.tr.replace(n.pos,n.pos,new J(o,0,0));return i.setSelection(Ce.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function rZ(t){if(!(t.selection instanceof $t))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Qe.create(t.doc,[kt.widget(t.selection.head,e,{key:"gapcursor"})])}var oZ=Object.defineProperty,iZ=Object.getOwnPropertyDescriptor,sZ=(t,e,n,r)=>{for(var o=r>1?void 0:r?iZ(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&oZ(e,n,o),o},ax=class extends St{get name(){return"gapCursor"}createExternalPlugins(){return[QY()]}};ax=sZ([Ze({})],ax);var ym=200,ln=function(){};ln.prototype.append=function(e){return e.length?(e=ln.from(e),!this.length&&e||e.length<ym&&this.leafAppend(e)||this.length<ym&&e.leafPrepend(this)||this.appendInner(e)):this};ln.prototype.prepend=function(e){return e.length?ln.from(e).append(this):this};ln.prototype.appendInner=function(e){return new aZ(this,e)};ln.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?ln.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};ln.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ln.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};ln.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},n,r),o};ln.from=function(e){return e instanceof ln?e:e&&e.length?new cP(e):ln.empty};var cP=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,a){for(var l=i;l<s;l++)if(o(this.values[l],a+l)===!1)return!1},e.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},e.prototype.leafAppend=function(o){if(this.length+o.length<=ym)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=ym)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(ln);ln.empty=new cP([]);var aZ=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,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},e.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},e.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))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(ln);const lZ=500;class to{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,a,l,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new Eo(d.map));let p=d.step.map(o.slice(i)),m;p&&s.maybeStep(p).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],c.push(new Eo(m,void 0,void 0,c.length+u.length))),i--,m&&o.appendMap(m,i)}else s.maybeStep(d.step);if(d.selection)return a=o?d.selection.map(o.slice(i)):d.selection,l=new to(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(e,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<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new Eo(e.mapping.maps[u],d,n),p;(p=l&&l.merge(f))&&(f=p,u?i.pop():a=a.slice(0,a.length-1)),i.push(f),n&&(s++,n=void 0),o||(l=f)}let c=s-r.depth;return c>uZ&&(a=cZ(a,c),s-=c),new to(a.append(i),s)}remapping(e,n){let r=new ec;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new to(this.items.append(e.map(n=>new Eo(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},o);let l=n;this.items.forEach(f=>{let p=i.getMirror(--l);if(p==null)return;s=Math.min(s,p);let m=i.maps[p];if(f.step){let g=e.steps[p].invert(e.docs[p]),y=f.selection&&f.selection.map(i.slice(l+1,p));y&&a++,r.push(new Eo(m,g,y))}else r.push(new Eo(m))},o);let c=[];for(let f=n;f<s;f++)c.push(new Eo(i.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new to(u,a);return d.emptyItemCount()>lZ&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,o=[],i=0;return this.items.forEach((s,a)=>{if(a>=e)o.push(s),s.selection&&i++;else if(s.step){let l=s.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=s.selection&&s.selection.map(n.slice(r));u&&i++;let d=new Eo(c.invert(),l,u),f,p=o.length-1;(f=o.length&&o[p].merge(d))?o[p]=f:o.push(d)}}else s.map&&r--},this.items.length,0),new to(ln.from(o.reverse()),i)}}to.empty=new to(ln.empty,0);function cZ(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}class Eo{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Eo(n.getMap().invert(),n,this.selection)}}}class Xi{constructor(e,n,r,o,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const uZ=20;function dZ(t,e,n,r){let o=n.getMeta($o),i;if(o)return o.historyState;n.getMeta(pZ)&&(t=new Xi(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta($o))return s.getMeta($o).redo?new Xi(t.done.addTransform(n,void 0,r,Zp(e)),t.undone,o_(n.mapping.maps[n.steps.length-1]),t.prevTime,t.prevComposition):new Xi(t.done,t.undone.addTransform(n,void 0,r,Zp(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!fZ(n,t.prevRanges)),c=s?ey(t.prevRanges,n.mapping):o_(n.mapping.maps[n.steps.length-1]);return new Xi(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Zp(e)),to.empty,c,n.time,a??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Xi(t.done.rebased(n,i),t.undone.rebased(n,i),ey(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Xi(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),ey(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function fZ(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&o>=e[i]&&(n=!0)}),n}function o_(t){let e=[];return t.forEach((n,r,o,i)=>e.push(o,i)),e}function ey(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function uP(t,e,n,r){let o=Zp(e),i=$o.get(e).spec.config,s=(r?t.undone:t.done).popEvent(e,o);if(!s)return;let a=s.selection.resolve(s.transform.doc),l=(r?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,o),c=new Xi(r?l:s.remaining,r?s.remaining:l,null,0,-1);n(s.transform.setSelection(a).setMeta($o,{redo:r,historyState:c}).scrollIntoView())}let ty=!1,i_=null;function Zp(t){let e=t.plugins;if(i_!=e){ty=!1,i_=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){ty=!0;break}}return ty}const $o=new Uc("history"),pZ=new Uc("closeHistory");function hZ(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ti({key:$o,state:{init(){return new Xi(to.empty,to.empty,null,0,-1)},apply(e,n,r){return dZ(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?Jp:r=="historyRedo"?Du:null;return o?(n.preventDefault(),o(e.state,e.dispatch)):!1}}}})}const Jp=(t,e)=>{let n=$o.getState(t);return!n||n.done.eventCount==0?!1:(e&&uP(n,t,e,!1),!0)},Du=(t,e)=>{let n=$o.getState(t);return!n||n.undone.eventCount==0?!1:(e&&uP(n,t,e,!0),!0)};function lx(t){let e=$o.getState(t);return e?e.done.eventCount:0}function mZ(t){let e=$o.getState(t);return e?e.undone.eventCount:0}var gZ=Object.defineProperty,vZ=Object.getOwnPropertyDescriptor,nl=(t,e,n,r)=>{for(var o=r>1?void 0:r?vZ(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&gZ(e,n,o),o},Bo=class extends St{constructor(){super(...arguments),this.wrapMethod=(t,e)=>({state:n,dispatch:r,view:o})=>{const{getState:i,getDispatch:s}=this.options,a=dt(i)?i():n,l=dt(s)&&r?s():r,c=t(a,l,o);return e==null||e(c),c}}get name(){return"history"}createKeymap(){return{"Mod-y":Qr.isMac?()=>!1:this.wrapMethod(Du,this.options.onRedo),"Mod-z":this.wrapMethod(Jp,this.options.onUndo),"Shift-Mod-z":this.wrapMethod(Du,this.options.onRedo)}}undoShortcut(t){return this.wrapMethod(Jp,this.options.onUndo)(t)}redoShortcut(t){return this.wrapMethod(Du,this.options.onRedo)(t)}createExternalPlugins(){const{depth:t,newGroupDelay:e}=this.options;return[hZ({depth:t,newGroupDelay:e})]}undo(){return UE(this.wrapMethod(Jp,this.options.onUndo))}redo(){return UE(this.wrapMethod(Du,this.options.onRedo))}undoDepth(t=this.store.getState()){return lx(t)}redoDepth(t=this.store.getState()){return mZ(t)}};nl([wr({shortcut:q.Undo,command:"undo"})],Bo.prototype,"undoShortcut",1);nl([wr({shortcut:q.Redo,command:"redo"})],Bo.prototype,"redoShortcut",1);nl([ue({disableChaining:!0,description:({t})=>t(rm.UNDO_DESCRIPTION),label:({t})=>t(rm.UNDO_LABEL),icon:"arrowGoBackFill"})],Bo.prototype,"undo",1);nl([ue({disableChaining:!0,description:({t})=>t(rm.REDO_DESCRIPTION),label:({t})=>t(rm.REDO_LABEL),icon:"arrowGoForwardFill"})],Bo.prototype,"redo",1);nl([At()],Bo.prototype,"undoDepth",1);nl([At()],Bo.prototype,"redoDepth",1);Bo=nl([Ze({defaultOptions:{depth:100,newGroupDelay:500,getDispatch:void 0,getState:void 0},staticKeys:["depth","newGroupDelay"],handlerKeys:["onUndo","onRedo"]})],Bo);var yZ=Object.defineProperty,xZ=Object.getOwnPropertyDescriptor,Lg=(t,e,n,r)=>{for(var o=r>1?void 0:r?xZ(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&yZ(e,n,o),o},bZ={icon:"paragraph",label:({t})=>t(om.INSERT_LABEL),description:({t})=>t(om.INSERT_DESCRIPTION)},wZ={icon:"paragraph",label:({t})=>t(om.CONVERT_LABEL),description:({t})=>t(om.CONVERT_DESCRIPTION)},Ha=class extends Fr{get name(){return"paragraph"}createTags(){return[Ie.LastNodeCompatible,Ie.TextBlock,Ie.Block,Ie.FormattingNode]}createNodeSpec(t,e){return{content:"inline*",draggable:!1,...e,attrs:{...t.defaults()},parseDOM:[{tag:"p",getAttrs:n=>({...t.parse(n)})},...e.parseDOM??[]],toDOM:n=>["p",t.dom(n),0]}}convertParagraph(t={}){const{attrs:e,selection:n,preserveAttrs:r}=t;return this.store.commands.setBlockNodeType.original(this.type,e,n,r)}insertParagraph(t,e={}){const{selection:n,attrs:r}=e;return this.store.commands.insertNode.original(this.type,{content:t,selection:n,attrs:r})}shortcut(t){return this.convertParagraph()(t)}};Lg([ue(wZ)],Ha.prototype,"convertParagraph",1);Lg([ue(bZ)],Ha.prototype,"insertParagraph",1);Lg([wr({shortcut:q.Paragraph,command:"convertParagraph"})],Ha.prototype,"shortcut",1);Ha=Lg([Ze({defaultPriority:at.Medium})],Ha);function si(t,e,n){return Math.min(Math.max(t,n),e)}class kZ extends Error{constructor(e){super(`Failed to parse color: "${e}"`)}}var Lu=kZ;function Tb(t){if(typeof t!="string")throw new Lu(t);if(t.trim().toLowerCase()==="transparent")return[0,0,0,0];let e=t.trim();e=RZ.test(t)?_Z(t):t;const n=CZ.exec(e);if(n){const s=Array.from(n).slice(1);return[...s.slice(0,3).map(a=>parseInt(sf(a,2),16)),parseInt(sf(s[3]||"f",2),16)/255]}const r=TZ.exec(e);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=OZ.exec(e);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=MZ.exec(e);if(i){const[s,a,l,c]=Array.from(i).slice(1).map(parseFloat);if(si(0,100,a)!==a)throw new Lu(t);if(si(0,100,l)!==l)throw new Lu(t);return[...NZ(s,a,l),Number.isNaN(c)?1:c]}throw new Lu(t)}function SZ(t){let e=5381,n=t.length;for(;n;)e=e*33^t.charCodeAt(--n);return(e>>>0)%2341}const s_=t=>parseInt(t.replace(/_/g,""),36),EZ="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((t,e)=>{const n=s_(e.substring(0,3)),r=s_(e.substring(3)).toString(16);let o="";for(let i=0;i<6-r.length;i++)o+="0";return t[n]=`${o}${r}`,t},{});function _Z(t){const e=t.toLowerCase().trim(),n=EZ[SZ(e)];if(!n)throw new Lu(t);return`#${n}`}const sf=(t,e)=>Array.from(Array(e)).map(()=>t).join(""),CZ=new RegExp(`^#${sf("([a-f0-9])",3)}([a-f0-9])?$`,"i"),TZ=new RegExp(`^#${sf("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),OZ=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${sf(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),MZ=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,RZ=/^[a-z]+$/i,a_=t=>Math.round(t*255),NZ=(t,e,n)=>{let r=n/100;if(e===0)return[r,r,r].map(a_);const o=(t%360+360)%360/60,i=(1-Math.abs(2*r-1))*(e/100),s=i*(1-Math.abs(o%2-1));let a=0,l=0,c=0;o>=0&&o<1?(a=i,l=s):o>=1&&o<2?(a=s,l=i):o>=2&&o<3?(l=i,c=s):o>=3&&o<4?(l=s,c=i):o>=4&&o<5?(a=s,c=i):o>=5&&o<6&&(a=i,c=s);const u=r-i/2,d=a+u,f=l+u,p=c+u;return[d,f,p].map(a_)};function PZ(t){const[e,n,r,o]=Tb(t).map((d,f)=>f===3?d:d/255),i=Math.max(e,n,r),s=Math.min(e,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*(e===i?(n-r)/l+(n<r?6:0):n===i?(r-e)/l+2:(e-n)/l+4),c,a,o]}function $Z(t,e,n,r){return`hsla(${(t%360).toFixed()}, ${si(0,100,e*100).toFixed()}%, ${si(0,100,n*100).toFixed()}%, ${parseFloat(si(0,1,r).toFixed(3))})`}function lr(t,e){const[n,r,o,i]=PZ(t);return $Z(n,r,o-e,i)}function AZ(t){if(t==="transparent")return 0;function e(i){const s=i/255;return s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4)}const[n,r,o]=Tb(t);return .2126*e(n)+.7152*e(r)+.0722*e(o)}function IZ(t,e,n,r){return`rgba(${si(0,255,t).toFixed()}, ${si(0,255,e).toFixed()}, ${si(0,255,n).toFixed()}, ${parseFloat(si(0,1,r).toFixed(3))})`}function Xp(t,e){return lr(t,-e)}function xm(t,e){const[n,r,o,i]=Tb(t);return IZ(n,r,o,i-e)}function DZ(t){return AZ(t)>.179}function oc(t){return DZ(t)?"#000":"#fff"}const LZ="remirror-editor-wrapper",jZ="remirror-button-active",zZ="remirror-button",FZ="remirror-composite",BZ="remirror-dialog",UZ="remirror-dialog-backdrop",VZ="remirror-form",HZ="remirror-form-message",WZ="remirror-form-label",KZ="remirror-form-group",qZ="remirror-group",GZ="remirror-input",YZ="remirror-menu",ZZ="remirror-menu-pane",JZ="remirror-menu-pane-active",XZ="remirror-menu-dropdown-label",QZ="remirror-menu-pane-icon",eJ="remirror-menu-pane-label",tJ="remirror-menu-pane-shortcut",nJ="remirror-menu-button-left",rJ="remirror-menu-button-right",oJ="remirror-menu-button-nested-left",iJ="remirror-menu-button-nested-right",sJ="remirror-menu-button",aJ="remirror-menu-bar",lJ="remirror-flex-column",cJ="remirror-flex-row",uJ="remirror-menu-item",dJ="remirror-menu-item-row",fJ="remirror-menu-item-column",pJ="remirror-menu-item-checkbox",hJ="remirror-menu-item-radio",mJ="remirror-menu-group",gJ="remirror-floating-popover",vJ="remirror-popover",yJ="remirror-animated-popover",xJ="remirror-role",bJ="remirror-separator",wJ="remirror-tab",kJ="remirror-tab-list",SJ="remirror-tabbable",EJ="remirror-toolbar",_J="remirror-tooltip",CJ="remirror-table-size-editor",TJ="remirror-table-size-editor-body",OJ="remirror-table-size-editor-cell",MJ="remirror-table-size-editor-cell-selected",RJ="remirror-table-size-editor-footer",NJ="remirror-color-picker",PJ="remirror-color-picker-cell",$J="remirror-color-picker-cell-selected";var AJ=Object.freeze({__proto__:null,ANIMATED_POPOVER:yJ,BUTTON:zZ,BUTTON_ACTIVE:jZ,COLOR_PICKER:NJ,COLOR_PICKER_CELL:PJ,COLOR_PICKER_CELL_SELECTED:$J,COMPOSITE:FZ,DIALOG:BZ,DIALOG_BACKDROP:UZ,EDITOR_WRAPPER:LZ,FLEX_COLUMN:lJ,FLEX_ROW:cJ,FLOATING_POPOVER:gJ,FORM:VZ,FORM_GROUP:KZ,FORM_LABEL:WZ,FORM_MESSAGE:HZ,GROUP:qZ,INPUT:GZ,MENU:YZ,MENU_BAR:aJ,MENU_BUTTON:sJ,MENU_BUTTON_LEFT:nJ,MENU_BUTTON_NESTED_LEFT:oJ,MENU_BUTTON_NESTED_RIGHT:iJ,MENU_BUTTON_RIGHT:rJ,MENU_DROPDOWN_LABEL:XZ,MENU_GROUP:mJ,MENU_ITEM:uJ,MENU_ITEM_CHECKBOX:pJ,MENU_ITEM_COLUMN:fJ,MENU_ITEM_RADIO:hJ,MENU_ITEM_ROW:dJ,MENU_PANE:ZZ,MENU_PANE_ACTIVE:JZ,MENU_PANE_ICON:QZ,MENU_PANE_LABEL:eJ,MENU_PANE_SHORTCUT:tJ,POPOVER:vJ,ROLE:xJ,SEPARATOR:bJ,TAB:wJ,TABBABLE:SJ,TABLE_SIZE_EDITOR:CJ,TABLE_SIZE_EDITOR_BODY:TJ,TABLE_SIZE_EDITOR_CELL:OJ,TABLE_SIZE_EDITOR_CELL_SELECTED:MJ,TABLE_SIZE_EDITOR_FOOTER:RJ,TAB_LIST:kJ,TOOLBAR:EJ,TOOLTIP:_J});const IJ="remirror-image-loader";var DJ=Object.freeze({__proto__:null,IMAGE_LOADER:IJ});const LJ="remirror-list-item-with-custom-mark",jJ="remirror-ul-list-content",zJ="remirror-editor",FJ="remirror-list-item-marker-container",BJ="remirror-list-item-checkbox",UJ="remirror-collapsible-list-item-closed",VJ="remirror-collapsible-list-item-button",HJ="remirror-list-spine";var Ls=Object.freeze({__proto__:null,COLLAPSIBLE_LIST_ITEM_BUTTON:VJ,COLLAPSIBLE_LIST_ITEM_CLOSED:UJ,EDITOR:zJ,LIST_ITEM_CHECKBOX:BJ,LIST_ITEM_MARKER_CONTAINER:FJ,LIST_ITEM_WITH_CUSTOM_MARKER:LJ,LIST_SPINE:HJ,UL_LIST_CONTENT:jJ});const WJ="remirror-is-empty";var KJ=Object.freeze({__proto__:null,IS_EMPTY:WJ});const qJ="remirror-editor",GJ="remirror-positioner",YJ="remirror-positioner-widget";var ZJ=Object.freeze({__proto__:null,EDITOR:qJ,POSITIONER:GJ,POSITIONER_WIDGET:YJ});const qr={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"]},ai="#000000",Ob="#ffffff",JJ="#252103",Mb=xm(ai,.75),jg="#7963d2",Rb="#bcd263",XJ="#fff",QJ="#fff",Nb=qr.gray[1],l_="rgba(10,31,68,0.08)",c_="rgba(10,31,68,0.10)",u_="rgba(10,31,68,0.12)",eX=Xp(xm(ai,.1),.13),Pb={background:Ob,border:Mb,foreground:ai,muted:Nb,primary:jg,secondary:Rb,primaryText:XJ,secondaryText:QJ,text:JJ,faded:eX},tX={...Pb,background:lr(Ob,.15),border:lr(Mb,.15),foreground:lr(ai,.15),muted:lr(Nb,.15),primary:lr(jg,.15),secondary:lr(Rb,.15),get text(){return oc(this.background)},get primaryText(){return oc(this.primary)},get secondaryText(){return oc(this.secondary)}},nX={...Pb,background:lr(Ob,.075),border:lr(Mb,.075),foreground:lr(ai,.075),muted:lr(Nb,.075),primary:lr(jg,.075),secondary:lr(Rb,.075),get text(){return oc(this.background)},get primaryText(){return oc(this.primary)},get secondaryText(){return oc(this.secondary)}};({...Pb,backdrop:xm(ai,.1),outline:xm(jg,.6),table:(Xp(ai,.8),Xp(ai,.4),qr.gray[3],qr.blue[7],qr.blue[1],qr.blue[5],qr.blue[7],Xp(ai,.4),qr.blue[5],qr.red[7],qr.red[1],qr.red[5])},`${l_}`,`${c_}`,`${u_}`);var rX=Object.defineProperty,oX=Object.getOwnPropertyDescriptor,$b=(t,e,n,r)=>{for(var o=r>1?void 0:r?oX(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&rX(e,n,o),o},dP=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},Ut=(t,e,n)=>(dP(t,e,"read from private field"),n?n.call(t):e.get(t)),qo=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},ji=(t,e,n,r)=>(dP(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),ju,zu,Ol,Fu,Qp,Bu,Uu,Vu,Hu,eh=class{constructor(t){qo(this,ju,bg()),qo(this,zu,[]),qo(this,Ol,new Map),qo(this,Fu,[]),qo(this,Qp,!1),qo(this,Bu,void 0),qo(this,Uu,void 0),qo(this,Vu,void 0),qo(this,Hu,void 0),this.addListener=(e,n)=>Ut(this,ju).on(e,n),ji(this,Bu,t),ji(this,Uu,t.getActive),ji(this,Hu,t.getPosition),ji(this,Vu,t.getID),this.hasChanged=t.hasChanged,this.events=t.events??["state","scroll"]}static create(t){return new eh(t)}static fromPositioner(t,e){return eh.create({...t.basePositioner,...e})}get basePositioner(){return{getActive:Ut(this,Uu),getPosition:Ut(this,Hu),hasChanged:this.hasChanged,events:this.events,getID:Ut(this,Vu)}}onActiveChanged(t){this.recentUpdate=t;const e=Ut(this,Uu).call(this,t);ji(this,zu,e),ji(this,Ol,new Map),ji(this,Qp,!1),ji(this,Fu,[]);const n=[];for(const[r,o]of e.entries()){const i=this.getID(o,r);Ut(this,Fu).push(i),n.push({setElement:s=>this.addProps({...t,data:o,element:s},r),id:i,data:o})}Ut(this,ju).emit("update",n)}getID(t,e){var n;return((n=Ut(this,Vu))==null?void 0:n.call(this,t,e))??e.toString()}addProps(t,e){if(Ut(this,Qp)||(Ut(this,Ol).set(e,t),Ut(this,Ol).size<Ut(this,zu).length))return;const n=[];for(const r of Ut(this,zu).keys()){const o=Ut(this,Ol).get(r);ve(o,{code:K.INTERNAL,message:"Something went wrong when retrieving the parameters"});const i=Ut(this,Fu)[r];if(!i)return;n.push({position:Ut(this,Hu).call(this,o),element:o.element,id:i})}Ut(this,ju).emit("done",n)}clone(t){return eh.create({...Ut(this,Bu),...dt(t)?t(Ut(this,Bu)):t})}active(t){const e=dt(t)?t:()=>t;return this.clone(n=>({getActive:r=>n.getActive(r).filter(e)}))}},uo=eh;ju=new WeakMap;zu=new WeakMap;Ol=new WeakMap;Fu=new WeakMap;Qp=new WeakMap;Bu=new WeakMap;Uu=new WeakMap;Vu=new WeakMap;Hu=new WeakMap;uo.EMPTY=[];function iX(t,e=mP){const{key:n}=(t==null?void 0:t.getMeta(hP))??{};return n===e}function fP(t){const{tr:e,state:n,previousState:r}=t;return!r||e&&iX(e)?!0:e?sV(e):!n.doc.eq(r.doc)||!n.selection.eq(r.selection)}function pP(t,e,n={}){const r=e.getBoundingClientRect(),{accountForPadding:o=!1}=n;let i=0,s=0,a=0,l=0;if(Fo(e)&&o){const u=Number.parseFloat(Li(e,"padding-left").replace("px","")),d=Number.parseFloat(Li(e,"padding-right").replace("px","")),f=Number.parseFloat(Li(e,"padding-top").replace("px","")),p=Number.parseFloat(Li(e,"padding-bottom").replace("px","")),m=Number.parseFloat(Li(e,"border-left").replace("px","")),g=Number.parseFloat(Li(e,"border-right").replace("px","")),y=Number.parseFloat(Li(e,"border-top").replace("px","")),v=Number.parseFloat(Li(e,"border-bottom").replace("px","")),x=e.offsetWidth-e.clientWidth,w=e.offsetHeight-e.clientHeight;i+=u+m+(e.dir==="rtl"?x:0),s+=d+g+(e.dir==="rtl"?0:x),a+=f+y,l+=p+v+w}const c=new DOMRect(r.left+i,r.top+a,r.width-s,r.height-l);for(const[u,d]of[[t.top,t.left],[t.top,t.right],[t.bottom,t.left],[t.bottom,t.right]])if(DS(u,c.top,c.bottom)&&DS(d,c.left,c.right))return!0;return!1}var sX="remirror-positioner-widget",hP="positionerUpdate",mP="__all_positioners__",gP={y:-999999,x:-999999,width:0,height:0},d_={...gP,left:-999999,top:-999999,bottom:-999999,right:-999999},aX={...gP,rect:{...d_,toJSON:()=>d_},visible:!1},lX=uo.create({hasChanged:fP,getActive(t){const{state:e}=t;if(!vb(e)||e.selection.$anchor.depth>2)return uo.EMPTY;const n=Og({predicate:r=>r.type.isBlock,selection:e});return n?[n]:uo.EMPTY},getPosition(t){const{view:e,data:n}=t,r=e.nodeDOM(n.pos);if(!Fo(r))return aX;const o=r.getBoundingClientRect(),i=e.dom.getBoundingClientRect(),s=o.height,a=o.width,l=e.dom.scrollLeft+o.left-i.left,c=e.dom.scrollTop+o.top-i.top,u=pP(o,e.dom);return{y:c,x:l,height:s,width:a,rect:o,visible:u}}}),vP=lX.clone(({getActive:t})=>({getActive:e=>{const[n]=t(e);return n&&wb(n.node)&&n.node.type===Ng(e.state.schema)?[n]:uo.EMPTY}}));vP.clone(({getPosition:t})=>({getPosition:e=>({...t(e),width:1})}));vP.clone(({getPosition:t})=>({getPosition:e=>{const{width:n,x:r,y:o,height:i}=t(e);return{...t(e),width:1,x:n+r,rect:new DOMRect(n+r,o,1,i)}}}));function Ab(t){return uo.create({hasChanged:fP,getActive:e=>{const{state:n,view:r}=e;if(!t(n)||!tl(n.selection))return uo.EMPTY;try{const{head:o,anchor:i}=n.selection;return[{from:r.coordsAtPos(i),to:r.coordsAtPos(o)}]}catch{return uo.EMPTY}},getPosition(e){const{element:n,data:r,view:o}=e,{from:i,to:s}=r,a=n.offsetParent??o.dom,l=a.getBoundingClientRect(),c=Math.abs(s.bottom-i.top),u=c>i.bottom-i.top,d=Math.min(i.left,s.left),f=Math.min(i.top,s.top),p=a.scrollLeft+(u?s.left-l.left:d-l.left),m=a.scrollTop+f-l.top,g=u?1:Math.abs(i.left-s.right),y=new DOMRect(u?s.left:d,f,g,c),v=pP(y,o.dom);return{rect:y,y:m,x:p,height:c,width:g,visible:v}}})}var cX=Ab(t=>!t.selection.empty);Ab(t=>t.selection.empty);Ab(()=>!0);cX.clone(()=>({getActive:t=>{const{state:e,view:n}=t;if(!e.selection.empty)return uo.EMPTY;const r=ON(e);if(!r)return uo.EMPTY;try{return[{from:n.coordsAtPos(r.from),to:n.coordsAtPos(r.to)}]}catch{return uo.EMPTY}}}));var af=class extends St{constructor(){super(...arguments),this.positioners=[],this.onAddCustomHandler=({positioner:t})=>{if(t)return this.positioners=[...this.positioners,t],this.store.commands.forceUpdate(),()=>{this.positioners=this.positioners.filter(e=>e!==t)}}}get name(){return"positioner"}createAttributes(){return{class:ZJ.EDITOR}}init(){this.onScroll=cz(this.options.scrollDebounce,this.onScroll.bind(this))}createEventHandlers(){return{scroll:()=>(this.onScroll(),!1),hover:(t,e)=>(this.positioner(this.getBaseProps("hover",{hover:e})),!1),contextmenu:(t,e)=>(this.positioner(this.getBaseProps("contextmenu",{contextmenu:e})),!1)}}onStateUpdate(t){this.positioner({...t,previousState:t.firstUpdate?void 0:t.previousState,event:"state",helpers:this.store.helpers})}createDecorations(t){if(this.element??(this.element=this.createElement()),!this.element.hasChildNodes())return Qe.empty;const e=kt.widget(0,this.element,{key:"positioner-widget",side:-1,stopEvent:()=>!0});return Qe.create(t.doc,[e])}forceUpdatePositioners(t=mP){return({tr:e,dispatch:n})=>(n==null||n(e.setMeta(hP,{key:t})),!0)}getPositionerWidget(){return this.element??(this.element=this.createElement())}createElement(){const t=document.createElement("span");return t.dataset.id=sX,t.setAttribute("role","presentation"),t}triggerPositioner(t,e){t.hasChanged(e)&&t.onActiveChanged({...e,view:this.store.view})}positioner(t){for(const e of this.positioners)e.events.includes(t.event)&&this.triggerPositioner(e,t)}getBaseProps(t,e){const n=this.store.getState(),r=this.store.previousState;return{helpers:this.store.helpers,event:t,firstUpdate:!1,previousState:r,state:n,...e}}onScroll(){this.positioner(this.getBaseProps("scroll",{scroll:{scrollTop:this.store.view.dom.scrollTop}}))}};$b([ue()],af.prototype,"forceUpdatePositioners",1);$b([At()],af.prototype,"getPositionerWidget",1);af=$b([Ze({defaultOptions:{scrollDebounce:100},customHandlerKeys:["positioner"],staticKeys:["scrollDebounce"]})],af);var uX=Object.defineProperty,dX=Object.getOwnPropertyDescriptor,fX=(t,e,n,r)=>{for(var o=r>1?void 0:r?dX(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&uX(e,n,o),o},cx=class extends Fr{get name(){return"text"}createTags(){return[Ie.InlineNode]}createNodeSpec(){return{}}};cx=fX([Ze({disableExtraAttributes:!0,defaultPriority:at.Medium})],cx);var pX={...Tc.defaultOptions,...Ha.defaultOptions,...Bo.defaultOptions,excludeExtensions:[]};function hX(t={}){t={...pX,...t};const{content:e,depth:n,getDispatch:r,getState:o,newGroupDelay:i,excludeExtensions:s}=t,a={};for(const c of s??[])a[c]=!0;const l=[];if(!a.history){const c=new Bo({depth:n,getDispatch:r,getState:o,newGroupDelay:i});l.push(c)}return a.doc||l.push(new Tc({content:e})),a.text||l.push(new cx),a.paragraph||l.push(new Ha),a.positioner||l.push(new af),a.gapCursor||l.push(new ax),a.events||l.push(new vm),l}var mX=Object.defineProperty,gX=Object.getOwnPropertyDescriptor,vX=(t,e,n,r)=>{for(var o=r>1?void 0:r?gX(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&mX(e,n,o),o},Wa=class extends St{get name(){return"placeholder"}createAttributes(){return{"aria-placeholder":this.options.placeholder}}createPlugin(){return{state:{init:(t,e)=>({...this.options,empty:bb(e.doc,{ignoreAttributes:!0})}),apply:(t,e,n,r)=>yX({pluginState:e,tr:t,extension:this,state:r})},props:{decorations:t=>xX({state:t,extension:this})}}}onSetOptions(t){const{changes:e}=t;e.placeholder.changed&&this.store.phase>=Kn.EditorView&&this.store.updateAttributes()}};Wa=vX([Ze({defaultOptions:{emptyNodeClass:KJ.IS_EMPTY,placeholder:""}})],Wa);function yX(t){const{pluginState:e,extension:n,tr:r,state:o}=t;return r.docChanged?{...n.options,empty:bb(o.doc)}:e}function xX(t){const{extension:e,state:n}=t,{empty:r}=e.pluginKey.getState(n),{emptyNodeClass:o,placeholder:i}=e.options;if(!r)return null;const s=[];return n.doc.descendants((a,l)=>{const c=kt.node(l,l+a.nodeSize,{class:o,"data-placeholder":i});s.push(c)}),Qe.create(n.doc,s)}var bX=Object.defineProperty,wX=Object.getOwnPropertyDescriptor,kX=(t,e,n,r)=>{for(var o=r>1?void 0:r?wX(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&bX(e,n,o),o},SX={...Wa.defaultOptions,...rf.defaultOptions},EX=[...Wa.staticKeys,...rf.staticKeys],lf=class extends St{get name(){return"react"}onSetOptions(t){const{pickChanged:e}=t;this.getExtension(Wa).setOptions(e(["placeholder"]))}createExtensions(){const{emptyNodeClass:t,placeholder:e,defaultBlockNode:n,defaultContentNode:r,defaultEnvironment:o,defaultInlineNode:i,nodeViewComponents:s}=this.options;return[new Wa({emptyNodeClass:t,placeholder:e,priority:at.Low}),new rf({defaultBlockNode:n,defaultContentNode:r,defaultEnvironment:o,defaultInlineNode:i,nodeViewComponents:s})]}};lf=kX([Ze({defaultOptions:SX,staticKeys:EX})],lf);var yP={};Object.defineProperty(yP,"__esModule",{value:!0});function _X(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(t.length===2)return p_(t[0],t[1])||null;var n=t.slice(1).reduce(function(r,o){return p_(r,o)},t[0]);return n||null}var fu=yP.default=_X,f_=new WeakMap;function p_(t,e){if(t&&e){var n=f_.get(t)||new WeakMap;f_.set(t,n);var r=n.get(e)||function(o){h_(t,o),h_(e,o)};return n.set(e,r),r}return t||e}function h_(t,e){typeof t=="function"?t(e):t.current=e}var xP=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},ny=(t,e,n)=>(xP(t,e,"read from private field"),n?n.call(t):e.get(t)),CX=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},TX=(t,e,n,r)=>(xP(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);function OX(){const[,t]=h.useState(pe());return h.useCallback(()=>{t(pe())},[])}var bP=h.createContext(null);function Kc(t){const e=h.useContext(bP),n=h.useRef(OX());ve(e,{code:K.REACT_PROVIDER_CONTEXT});const{addHandler:r}=e;return h.useEffect(()=>{let o=t;if(o){if(el(o)){const{autoUpdate:i}=o;o=i?()=>n.current():void 0}if(dt(o))return r("updated",o)}},[r,t]),e}function MX(t=!0){return Kc({autoUpdate:t}).active}function RX(t=!1){return Kc(t?{autoUpdate:!0}:void 0).attrs}function Ib(){return Kc().chain.new()}function NX(t,e=void 0,n){const{getExtension:r}=Kc(),o=h.useMemo(()=>r(t),[t,r]);let i;if(dt(e)?i=n?[o,...n]:[o,e]:i=e?[o,...Object.values(e)]:[],h.useEffect(()=>{dt(e)||!e||o.setOptions(e)},i),h.useEffect(()=>{if(dt(e))return e({addHandler:o.addHandler.bind(o),addCustomHandler:o.addCustomHandler.bind(o),extension:o})},i),!e)return o}function PX(t,e,n){const r=h.useCallback(({addHandler:o})=>o(e,n),[n,e]);return NX(t,r)}function $X(t){PX(hm,"docChanged",t)}function AX(t=!1){return Kc(t?{autoUpdate:!0}:void 0).helpers}var[IX,Joe]=TW(({props:t})=>{const e=t.locale??"en",n=t.i18n??Dg,r=t.supportedLocales??[e],o=n._.bind(n);return{locale:e,i18n:n,supportedLocales:r,t:o}});function m_(t,e={}){const{core:n,react:r,...o}=e;return mW(t)?t:hW.create(()=>[...tR(t),new lf(r),...hX(n)],o)}function DX(t,e={}){const n=h.useRef(t),r=h.useRef(e),[o,i]=h.useState(()=>m_(t,e));return n.current=t,r.current=e,h.useEffect(()=>o.addHandler("destroy",()=>{i(()=>m_(n.current,r.current))}),[o]),o}var LX=typeof fu=="object"&&fu.__esModule&&fu.default?fu.default:fu,Ml,jX=class extends cW{constructor(t){if(super(t),CX(this,Ml,void 0),this.rootPropsConfig={called:!1,count:0},this.getRootProps=e=>this.internalGetRootProps(e,null),this.internalGetRootProps=(e,n)=>{this.rootPropsConfig.called=!0;const{refKey:r="ref",ref:o,...i}=e??pe();return{[r]:LX(o,this.onRef),key:this.uid,...i,children:n}},this.onRef=e=>{e&&(this.rootPropsConfig.count+=1,ve(this.rootPropsConfig.count<=1,{code:K.REACT_GET_ROOT_PROPS,message:`Called ${this.rootPropsConfig.count} times`}),TX(this,Ml,e),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(Wa).setOptions({placeholder:this.props.placeholder??""})}get name(){return"react"}update(t){return super.update(t),this}createView(t){return new TU(null,{state:t,dispatchTransaction:this.dispatchTransaction,attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0,plugins:[]})}updateState({state:t,...e}){const{triggerChange:n=!0,tr:r,transactions:o}=e;if(this.props.state){const{onChange:i}=this.props;ve(i,{code:K.REACT_CONTROLLED,message:"You are required to provide the `onChange` handler when creating a controlled editor."}),ve(n,{code:K.REACT_CONTROLLED,message:"Controlled editors do not support `clearContent` or `setContent` where `triggerChange` is `true`. Update the `state` prop instead."}),this.previousStateOverride||(this.previousStateOverride=this.getState()),this.onChange({state:t,tr:r,transactions:o});return}!r&&!o&&(t=t.apply(t.tr.setMeta(NS,{}))),this.view.updateState(t),n&&(o==null?void 0:o.length)!==0&&this.onChange({state:t,tr:r,transactions:o}),this.manager.onStateUpdate({previousState:this.previousState,state:t,tr:r,transactions:o})}updateControlledState(t,e){this.previousStateOverride=e,t=t.apply(t.tr.setMeta(NS,{})),this.view.updateState(t),this.manager.onStateUpdate({previousState:this.previousState,state:t}),this.previousStateOverride=void 0}addProsemirrorViewToDom(t,e){this.props.insertPosition==="start"?t.insertBefore(e,t.firstChild):t.append(e)}onRefLoad(){ve(ny(this,Ml),{code:K.REACT_EDITOR_VIEW,message:"Something went wrong when initializing the text editor. Please check your setup."});const{autoFocus:t}=this.props;this.addProsemirrorViewToDom(ny(this,Ml),this.view.dom),t&&this.focus(t),this.onChange(),this.addFocusListeners()}onUpdate(){this.view&&ny(this,Ml)&&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}};Ml=new WeakMap;var wP=typeof document<"u"?h.useLayoutEffect:h.useEffect;function zX(t){const e=h.useRef();return wP(()=>{e.current=t}),e.current}function FX(t){const{manager:e,state:n}=t,{placeholder:r,editable:o}=t;h.useRef(!0).current&&!$s(r)&&e.getExtension(lf).setOptions({placeholder:r}),h.useEffect(()=>{r!=null&&e.getExtension(lf).setOptions({placeholder:r})},[r,e]);const[s]=h.useState(()=>{if(n)return n;const l=e.createEmptyDoc(),[c,u]=Gt(t.initialContent)?t.initialContent:[t.initialContent??l];return e.createState({content:c,selection:u})}),a=BX({initialEditorState:s,getProps:()=>t});return h.useEffect(()=>()=>{a.destroy()},[a]),h.useEffect(()=>{a.onUpdate()},[o,a]),UX(a),a.frameworkOutput}function BX(t){const e=h.useRef(t);e.current=t;const n=h.useMemo(()=>new jX(e.current),[]);return n.update(t),n}function UX(t){const{state:e}=t.props,n=h.useRef(!!e),r=zX(e);wP(()=>{const o=e?n.current===!0:n.current===!1;ve(o,{code:K.REACT_CONTROLLED,message:n.current?"You have attempted to switch from a controlled to an uncontrolled editor. Once you set up an editor as a controlled editor it must always provide a `state` prop.":"You have provided a `state` prop to an uncontrolled editor. In order to set up your editor as controlled you must provide the `state` prop from the very first render."}),!(!e||e===r)&&t.updateControlledState(e,r??void 0)},[e,r,t])}function VX(t={}){const{content:e,document:n,selection:r,extensions:o,...i}=t,s=DX(o??(()=>[]),i),[a,l]=h.useState(()=>s.createState({selection:r,content:e??s.createEmptyDoc()})),c=h.useCallback(({state:d})=>{l(d)},[]),u=h.useCallback(()=>s.output,[s]);return h.useMemo(()=>({state:a,setState:l,manager:s,onChange:c,getContext:u}),[u,s,c,a])}var HX=({onChange:t})=>{const{getJSON:e}=AX();return $X(h.useCallback(({state:n})=>{const r=e(n);t(r)},[t,e])),null},ux=()=>oe.createElement("div",{className:AJ.EDITOR_WRAPPER,...Kc().getRootProps()}),WX=t=>(t.hook(),null);function KX(t){const{children:e,autoRender:n,i18n:r,locale:o,supportedLocales:i,hooks:s=[],...a}=t,l=FX(a),c=wW(l.portalContainer),u=n==="start"||n===!0||!e&&$s(n),d=n==="end";return oe.createElement(IX,{i18n:r,locale:o,supportedLocales:i},oe.createElement(bP.Provider,{value:l},oe.createElement(bW,{portals:c}),s.map((f,p)=>oe.createElement(WX,{hook:f,key:p})),u&&oe.createElement(ux,null),e,d&&oe.createElement(ux,null)))}function qX(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),a=!1,l=s;if(!s)return!1;if(s.depth>=2&&o.node(s.depth-1).type.compatibleContent(t)&&s.startIndex==0){if(o.index(s.depth-1)==0)return!1;let u=n.doc.resolve(s.start-2);l=new Fa(u,u,s.depth),s.endIndex<s.parent.childCount&&(s=new Fa(o,n.doc.resolve(i.end(s.depth)),s.depth)),a=!0}let c=eb(l,t,e,s);return c?(r&&r(GX(n.tr,s,c,a,t).scrollIntoView()),!0):!1}}function GX(t,e,n,r,o){let i=F.empty;for(let u=n.length-1;u>=0;u--)i=F.from(n[u].type.create(n[u].attrs,i));t.step(new zt(e.start-(r?2:0),e.end,e.start,e.end,new J(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=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&tc(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function YX(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?ZX(e,n,t,i):JX(e,n,i):!0:!1}}function ZX(t,e,n,r){let o=t.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new zt(i-1,s,i,s,new J(F.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Fa(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=Bc(r);if(a==null)return!1;o.lift(r,a);let l=o.mapping.map(i,-1)-1;return Pf(o.doc,l)&&o.join(l),e(o.scrollIntoView()),!0}function JX(t,e,n){let r=t.tr,o=n.parent;for(let p=n.end,m=n.endIndex-1,g=n.startIndex;m>g;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?F.empty:F.from(o))))return!1;let d=i.pos,f=d+s.nodeSize;return r.step(new zt(d-(a?1:0),f+(l?1:0),d+1,f-1,new J((a?F.empty:F.from(o.copy(F.empty))).append(l?F.empty:F.from(o.copy(F.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}var XX=Object.defineProperty,QX=Object.getOwnPropertyDescriptor,Br=(t,e,n,r)=>{for(var o=r>1?void 0:r?QX(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&XX(e,n,o),o};function dx(t){var e;return!!((e=t.spec.group)!=null&&e.includes(Ie.ListContainerNode))}function eQ(t){var e;return!!((e=t.spec.group)!=null&&e.includes(Ie.ListItemNode))}function js(t){return dx(t.type)}function Es(t){return eQ(t.type)}function Db(t,e){return n=>{const{dispatch:r,tr:o}=n,i=mb(o,n.state),{$from:s,$to:a}=o.selection,l=s.blockRange(a);if(!l)return!1;const c=Og({predicate:u=>dx(u.type),selection:o.selection});if(c&&l.depth-c.depth<=1&&l.startIndex===0){if(c.node.type===t)return EP(e)(n);if(dx(c.node.type))return t.validContent(c.node.content)?(r==null||r(o.setNodeMarkup(c.pos,t)),!0):tQ(o,c,t,e)?(r==null||r(o.scrollIntoView()),!0):!1}return qX(t)(i,r)}}function kP(t,e=["checked"]){return function({tr:n,dispatch:r,state:o}){var i,s;const a=fV(t,o.schema),{$from:l,$to:c}=n.selection;if(Rg(n.selection)&&n.selection.node.isBlock||l.depth<2||!l.sameParent(c))return!1;const u=l.node(-1);if(u.type!==a)return!1;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(r){const g=l.index(-1)>0;let y=F.empty;for(let w=l.depth-(g?1:2);w>=l.depth-3;w--)y=F.from(l.node(w).copy(y));const v=((i=a.contentMatch.defaultType)==null?void 0:i.createAndFill())||void 0;y=y.append(F.from(a.createAndFill(null,v)||void 0));const x=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3;n.replace(l.before(g?void 0:-1),l.after(-x),new J(y,g?3:2,2)),n.setSelection(n.selection.constructor.near(n.doc.resolve(l.pos+(g?3:2)))),r(n.scrollIntoView())}return!0}if(u.attrs.closed&&l.sameParent(c)&&c.pos===c.end()){if(r){const g=l.after(-1),y=((s=a.contentMatch.defaultType)==null?void 0:s.createAndFill())||void 0,v=a.createAndFill(null,y);v&&(n.insert(g,v),n.setSelection(Ce.near(n.doc.resolve(g+1)))),n.delete(l.pos,c.pos),r(n.scrollIntoView())}return!0}const d=Object.fromEntries(Object.entries(u.attrs).filter(([g])=>!e.includes(g))),f=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,p={...l.node().attrs};n.delete(l.pos,c.pos);const m=f?[{type:a,attrs:d},{type:f,attrs:p}]:[{type:a,attrs:d}];return tc(n.doc,l.pos,2)?(r&&r(n.split(l.pos,2,m).scrollIntoView()),!0):!1}}function tQ(t,e,n,r){const o=e.node,i=t.doc.resolve(e.start),s=i.node(-1),a=i.index(-1);if(!s||!s.canReplace(a,a+1,F.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 g=r.createChecked(null,m.content);l.push(g)}const c=n.createChecked(null,l),u=e.pos,d=u+o.nodeSize,f=t.selection.from;return t.replaceRangeWith(u,d,c),t.setSelection(t.selection.constructor.near(t.doc.resolve(f))),!0}function nQ({listType:t,itemType:e,tr:n,range:r}){var o;const i=r.parent,s=n.doc.slice(r.start,r.end);if(i.type===t&&((o=s.content.firstChild)==null?void 0:o.type)===e)return!1;const a=[];for(let c=0;c<s.content.childCount;c++){const u=s.content.child(c);if(!e.validContent(u.content))return!1;const d=e.createChecked(null,u.content);a.push(d)}const l=t.createChecked(null,a);return n.replaceRange(r.start,r.end,new J(F.from(l),0,0)),!0}function Oc({listType:t,itemType:e,tr:n}){const r=bm(n.selection);if(!r)return!1;const o=r.startIndex===0,{from:i,to:s}=n.selection;return nQ({listType:t,itemType:e,tr:n,range:r})?(n.setSelection(Ce.between(n.doc.resolve(o?i:i+2),n.doc.resolve(o?s:s+2))),n.scrollIntoView(),!0):!1}function rQ(t,e,n){const r=t.tr,o=n.parent,i=r.mapping.maps.length;for(let m=n.end,g=n.endIndex-1,y=n.startIndex;g>y;g--)m-=o.child(g).nodeSize,r.delete(m-1,m+1);const s=r.doc.resolve(n.start),a=s.nodeAfter;if(!a||r.mapping.slice(i).map(n.end)!==n.start+a.nodeSize)return!1;const l=n.startIndex===0,c=n.endIndex===o.childCount,u=s.node(-1),d=s.index(-1);if(!u.canReplace(d+(l?0:1),d+1,a.content.append(c?F.empty:F.from(o))))return!1;const f=s.pos,p=f+a.nodeSize;return r.step(new zt(f-(l?1:0),p+(c?1:0),f+1,p-1,new J((l?F.empty:F.from(o.copy(F.empty))).append(c?F.empty:F.from(o.copy(F.empty))),l?0:1,c?0:1),l?0:1)),e(r.scrollIntoView()),!0}function SP(t,e){const n=e||t.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&&js(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&&js(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)Pf(t.doc,c)&&(t.join(c),l=!0);return l}function EP(t){return e=>{const{dispatch:n,tr:r}=e,o=mb(r,e.state),i=oQ(t,r.selection);return i?(n&&rQ(o,n,i),!0):!1}}function oQ(t,e){const{$from:n,$to:r}=e;return n.blockRange(r,i=>{var s;return((s=i.firstChild)==null?void 0:s.type)===t})}function bm(t){const{$from:e,$to:n}=t;return e.blockRange(n,js)}function iQ(t){const e=t.selection.$from,n=e.blockRange();if(!n||!Es(n.parent)||n.startIndex!==0)return!1;const r=e.node(n.depth-2),o=e.index(n.depth),i=e.index(n.depth-1),s=e.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&&js(a)&&l&&Es(l))return Oc({listType:a.type,itemType:l.type,tr:t});if(Es(r)){const c=r,u=e.node(n.depth-3);if(js(u))return Oc({listType:u.type,itemType:c.type,tr:t})}return!1}function g_({view:t}){if(!t)return!1;{const e=t.state.selection.$cursor;if(!e||e.parentOffset>0)return!1;const n=e.blockRange();if(!n||!Es(n.parent)||n.startIndex!==0)return!1}{const e=t.state.tr;iQ(e)&&t.dispatch(e)}{const e=t.state.selection.$cursor;if(!e||e.parentOffset>0)return!1;const n=e.blockRange();if(!n||!Es(n.parent)||n.startIndex!==0)return!1;const r=e.index(n.depth),o=e.index(n.depth-1),i=e.index(n.depth-2),s=n.depth-2>=1&&Es(e.node(n.depth-2));r===0&&o===0&&i<=1&&s&&YX(n.parent.type)(t.state,t.dispatch)}return jN(t.state,t.dispatch,t),!0}function _P({node:t,mark:e,updateDOM:n,updateMark:r}){const o=document.createElement("label");o.contentEditable="false",o.classList.add(Ls.LIST_ITEM_MARKER_CONTAINER),o.append(e);const i=document.createElement("div"),s=document.createElement("li");s.classList.add(Ls.LIST_ITEM_WITH_CUSTOM_MARKER),s.append(o),s.append(i);const a=l=>l.type!==t.type?!1:(t=l,n(t,s),r(t,e),!0);return a(t),{dom:s,contentDOM:i,update:a}}function sQ(t,e){const n=t.node(e.depth-1),r=t.node(e.depth-2);return!Es(n)||!js(r)?!1:{parentItem:n,parentList:r}}function aQ(t,e){const n=e.parent,r=e.parent.child(e.endIndex-1),o=e.end,i=e.$to.end(e.depth);return o<i?(t.step(new zt(o-1,i,o,i,new J(F.from(r.type.create(null,n.copy())),1,0),1,!0)),new Fa(t.doc.resolve(e.$from.pos),t.doc.resolve(i),e.depth)):e}function lQ(t,e){const n=e.parent,r=e.parent.child(e.endIndex-1),o=e.end,i=e.$to.end(e.depth-1);return o+1<i?(t.step(new zt(o-1,i,o+1,i,new J(F.from(n.type.create(null,r.type.create(null))),2,0),0,!0)),new Fa(t.selection.$from,t.selection.$to,e.depth)):e}function cQ(t,e,n,r){return Oc({listType:n.type,itemType:r.type,tr:t})?new Fa(t.selection.$from,t.selection.$to,e.depth):e}function uQ(t){let e=bm(t.selection);if(!e)return!1;const n=sQ(t.selection.$from,e);if(!n)return!1;const{parentItem:r,parentList:o}=n;e=aQ(t,e),e=lQ(t,e),e=cQ(t,e,o,r);const i=Bc(e);return typeof i!="number"||(t.lift(e,i),e=bm(t.selection),e&&SP(t,t.doc.resolve(e.end-2))),!0}var dQ=({tr:t,dispatch:e})=>uQ(t)?(e==null||e(t.scrollIntoView()),!0):!1;function fQ(t,e,n){let r,o,i,s;const a=e.doc;if(n.startIndex>=1){r=t.child(n.startIndex-1),o=t,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=e.index(n.depth-1);if(l>=1){const c=e.node(n.depth-1),u=e.start(n.depth-1);if(o=c.child(l-1),!js(o))return!1;s=u+1;for(let d=0;d<l-1;d++)s+=c.child(d).nodeSize;if(r=o.child(o.childCount-1),i=s+o.nodeSize-r.nodeSize-1,!Es(r))return!1}else return!1}return{previousItem:r,previousList:o,previousItemStart:i,previousListStart:s}}function pQ(t,e,n){let r,o;const i=n.start,s=e.depth>=n.depth+2?e.end(n.depth+2):n.end-1,a=n.end;return s+1>=a?(r=t.slice(i,a),o=null):(r=t.slice(i,s),o=t.slice(s+1,a-1)),{selectedSlice:r,unselectedSlice:o}}function hQ(t){const{$from:e,$to:n}=t.selection,r=bm(t.selection);if(!r)return!1;const o=t.doc.resolve(r.start).node();if(!js(o))return!1;const i=fQ(o,e,r);if(!i)return!1;const{previousItem:s,previousList:a,previousItemStart:l}=i,{selectedSlice:c,unselectedSlice:u}=pQ(t.doc,n,r),d=s.content.append(F.fromArray([o.copy(c.content)])).append(u?u.content:F.empty);t.deleteRange(r.start,r.end);const f=l+s.nodeSize-2,p=s.copy(d);return p.check(),t.replaceRangeWith(l-1,f+1,p),t.setSelection(a===o?Ce.between(t.doc.resolve(e.pos),t.doc.resolve(n.pos)):Ce.between(t.doc.resolve(e.pos-2),t.doc.resolve(n.pos-2))),!0}var mQ=({tr:t,dispatch:e})=>hQ(t)?(e==null||e(t.scrollIntoView()),!0):!1,CP=class extends St{get name(){return"listItemShared"}createKeymap(){const t={Tab:mQ,"Shift-Tab":dQ,Backspace:g_,"Mod-Backspace":g_};if(Qr.isMac){const e={"Ctrl-h":t.Backspace,"Alt-Backspace":t["Mod-Backspace"]};return{...t,...e}}return t}createPlugin(){return{appendTransaction:(t,e,n)=>{const r=n.tr;return SP(r)?r:null}}}},Mc=class extends Fr{get name(){return"listItem"}createTags(){return[Ie.ListItemNode]}createNodeSpec(t,e){return{content:"paragraph block*",defining:!0,draggable:!1,...e,attrs:{...t.defaults(),closed:{default:!1},nested:{default:!1}},parseDOM:[{tag:"li",getAttrs:t.parse,priority:at.Lowest},...e.parseDOM??[]],toDOM:n=>["li",t.dom(n),0]}}createNodeViews(){return this.options.enableCollapsible?(t,e,n)=>{const r=document.createElement("div");return r.classList.add(Ls.COLLAPSIBLE_LIST_ITEM_BUTTON),r.contentEditable="false",r.addEventListener("click",()=>{if(r.classList.contains("disabled"))return;const o=n(),i=ye.create(e.state.doc,o);return e.dispatch(e.state.tr.setSelection(i)),this.store.commands.toggleListItemClosed(),!0}),_P({mark:r,node:t,updateDOM:gQ,updateMark:vQ})}:{}}createKeymap(){return{Enter:kP(this.type)}}createExtensions(){return[new CP]}toggleListItemClosed(t){return({state:{tr:e,selection:n},dispatch:r})=>{if(!Rg(n)||n.node.type.name!==this.name)return!1;const{node:o,from:i}=n;return t=fz(t)?t:!o.attrs.closed,r==null||r(e.setNodeMarkup(i,void 0,{...o.attrs,closed:t})),!0}}liftListItemOutOfList(t){return EP(t??this.type)}};Br([ue()],Mc.prototype,"toggleListItemClosed",1);Br([ue()],Mc.prototype,"liftListItemOutOfList",1);Mc=Br([Ze({defaultOptions:{enableCollapsible:!1},staticKeys:["enableCollapsible"]})],Mc);function gQ(t,e){t.attrs.closed?e.classList.add(Ls.COLLAPSIBLE_LIST_ITEM_CLOSED):e.classList.remove(Ls.COLLAPSIBLE_LIST_ITEM_CLOSED)}function vQ(t,e){t.childCount<=1?e.classList.add("disabled"):e.classList.remove("disabled")}var cf=class extends Fr{get name(){return"bulletList"}createTags(){return[Ie.Block,Ie.ListContainerNode]}createNodeSpec(t,e){return{content:"listItem+",...e,attrs:t.defaults(),parseDOM:[{tag:"ul",getAttrs:t.parse},...e.parseDOM??[]],toDOM:n=>["ul",t.dom(n),0]}}createNodeViews(){return this.options.enableSpine?(t,e,n)=>{var r;const o=document.createElement("div");o.style.position="relative";const i=n(),s=e.state.doc.resolve(i+1),a=s.node(s.depth-1);if(!(((r=a==null?void 0:a.type)==null?void 0:r.name)!=="listItem")){const u=document.createElement("div");u.contentEditable="false",u.classList.add(Ls.LIST_SPINE),u.addEventListener("click",d=>{const f=n(),p=e.state.doc.resolve(f+1),m=p.start(p.depth-1),g=ye.create(e.state.doc,m-1);e.dispatch(e.state.tr.setSelection(g)),this.store.commands.toggleListItemClosed(),d.preventDefault(),d.stopPropagation()}),o.append(u)}const c=document.createElement("ul");return c.classList.add(Ls.UL_LIST_CONTENT),o.append(c),{dom:o,contentDOM:c}}:{}}createExtensions(){return[new Mc({priority:at.Low,enableCollapsible:this.options.enableSpine})]}toggleBulletList(){return Db(this.type,Tt(this.store.schema.nodes,"listItem"))}listShortcut(t){return this.toggleBulletList()(t)}createInputRules(){const t=/^\s*([*+-])\s$/;return[ob(t,this.type),new zr(t,(e,n,r,o)=>{const i=e.tr;return i.deleteRange(r,o),Oc({listType:this.type,itemType:Tt(this.store.schema.nodes,"listItem"),tr:i})?i:null})]}};Br([ue({icon:"listUnordered",label:({t})=>t(rb.BULLET_LIST_LABEL)})],cf.prototype,"toggleBulletList",1);Br([wr({shortcut:q.BulletList,command:"toggleBulletList"})],cf.prototype,"listShortcut",1);cf=Br([Ze({defaultOptions:{enableSpine:!1},staticKeys:["enableSpine"]})],cf);var uf=class extends Fr{get name(){return"orderedList"}createTags(){return[Ie.Block,Ie.ListContainerNode]}createNodeSpec(t,e){return{content:"listItem+",...e,attrs:{...t.defaults(),order:{default:1}},parseDOM:[{tag:"ol",getAttrs:n=>Fo(n)?{...t.parse(n),order:+(n.getAttribute("start")??1)}:{}},...e.parseDOM??[]],toDOM:n=>{const r=t.dom(n);return n.attrs.order===1?["ol",r,0]:["ol",{...r,start:n.attrs.order},0]}}}createExtensions(){return[new Mc({priority:at.Low})]}toggleOrderedList(){return Db(this.type,Tt(this.store.schema.nodes,"listItem"))}listShortcut(t){return this.toggleOrderedList()(t)}createInputRules(){const t=/^(\d+)\.\s$/;return[ob(t,this.type,e=>({order:+Tt(e,1)}),(e,n)=>n.childCount+n.attrs.order===+Tt(e,1)),new zr(t,(e,n,r,o)=>{const i=e.tr;if(i.deleteRange(r,o),!Oc({listType:this.type,itemType:Tt(this.store.schema.nodes,"listItem"),tr:i}))return null;const a=+Tt(n,1);if(a!==1){const l=ef({selection:i.selection,types:this.type});l&&i.setNodeMarkup(l.pos,void 0,{order:a})}return i})]}};Br([ue({icon:"listOrdered",label:({t})=>t(rb.ORDERED_LIST_LABEL)})],uf.prototype,"toggleOrderedList",1);Br([wr({shortcut:q.OrderedList,command:"toggleOrderedList"})],uf.prototype,"listShortcut",1);uf=Br([Ze({})],uf);var TP=class extends Fr{get name(){return"taskListItem"}createTags(){return[Ie.ListItemNode]}createNodeSpec(t,e){return{content:"paragraph block*",defining:!0,draggable:!1,...e,attrs:{...t.defaults(),checked:{default:!1}},parseDOM:[{tag:"li[data-task-list-item]",getAttrs:n=>{let r=!1;return Fo(n)&&n.getAttribute("data-checked")!==null&&(r=!0),{checked:r,...t.parse(n)}},priority:at.Medium},...e.parseDOM??[]],toDOM:n=>["li",{...t.dom(n),"data-task-list-item":"","data-checked":n.attrs.checked?"":void 0},0]}}createNodeViews(){return(t,e,n)=>{const r=document.createElement("input");return r.type="checkbox",r.classList.add(Ls.LIST_ITEM_CHECKBOX),r.contentEditable="false",r.addEventListener("click",o=>{e.editable||o.preventDefault()}),r.addEventListener("change",()=>{const o=n(),i=e.state.doc.resolve(o+1);this.store.commands.toggleCheckboxChecked({$pos:i})}),r.checked=t.attrs.checked,_P({node:t,mark:r,updateDOM:yQ,updateMark:xQ})}}createKeymap(){return{Enter:kP(this.type)}}createExtensions(){return[new CP]}toggleCheckboxChecked(t){let e,n;return typeof t=="boolean"?e=t:t&&(e=t.checked,n=t.$pos),({tr:r,dispatch:o})=>{const i=ef({selection:n??r.selection.$from,types:this.type});if(!i)return!1;const{node:s,pos:a}=i,l={...s.attrs,checked:e??!s.attrs.checked};return o==null||o(r.setNodeMarkup(a,void 0,l)),!0}}createInputRules(){const t=/^\s*(\[( ?|x|X)]\s)$/;return[ob(t,this.type,e=>({checked:["x","X"].includes(cd(e,2))})),new zr(t,(e,n,r,o)=>{const i=e.tr;if(i.deleteRange(r,o),!Oc({listType:Tt(this.store.schema.nodes,"taskList"),itemType:this.type,tr:i}))return null;const a=["x","X"].includes(cd(n,2));if(a){const l=ef({selection:i.selection,types:this.type});l&&i.setNodeMarkup(l.pos,void 0,{checked:a})}return i})]}};Br([ue()],TP.prototype,"toggleCheckboxChecked",1);function yQ(t,e){t.attrs.checked?e.setAttribute("data-checked",""):e.removeAttribute("data-checked"),e.setAttribute("data-task-list-item","")}function xQ(t,e){e.checked=!!t.attrs.checked}var OP=class extends Fr{get name(){return"taskList"}createTags(){return[Ie.Block,Ie.ListContainerNode]}createNodeSpec(t,e){return{content:"taskListItem+",...e,attrs:t.defaults(),parseDOM:[{tag:"ul[data-task-list]",getAttrs:t.parse,priority:at.Medium},...e.parseDOM??[]],toDOM:n=>["ul",{...t.dom(n),"data-task-list":""},0]}}createExtensions(){return[new TP({})]}toggleTaskList(){return Db(this.type,Tt(this.store.schema.nodes,"taskListItem"))}listShortcut(t){return this.toggleTaskList()(t)}};Br([ue({icon:"checkboxMultipleLine",label:({t})=>t(rb.TASK_LIST_LABEL)})],OP.prototype,"toggleTaskList",1);Br([wr({shortcut:q.TaskList,command:"toggleTaskList"})],OP.prototype,"listShortcut",1);const ry="rovingFocusGroup.onEntryFocus",bQ={bubbles:!1,cancelable:!0},Lb="RovingFocusGroup",[fx,MP,wQ]=dg(Lb),[kQ,RP]=Lr(Lb,[wQ]),[SQ,EQ]=kQ(Lb),_Q=h.forwardRef((t,e)=>h.createElement(fx.Provider,{scope:t.__scopeRovingFocusGroup},h.createElement(fx.Slot,{scope:t.__scopeRovingFocusGroup},h.createElement(CQ,z({},t,{ref:e}))))),CQ=h.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,...u}=t,d=h.useRef(null),f=We(e,d),p=_f(i),[m=null,g]=Ao({prop:s,defaultProp:a,onChange:l}),[y,v]=h.useState(!1),x=rn(c),w=MP(n),S=h.useRef(!1),[_,k]=h.useState(0);return h.useEffect(()=>{const E=d.current;if(E)return E.addEventListener(ry,x),()=>E.removeEventListener(ry,x)},[x]),h.createElement(SQ,{scope:n,orientation:r,dir:p,loop:o,currentTabStopId:m,onItemFocus:h.useCallback(E=>g(E),[g]),onItemShiftTab:h.useCallback(()=>v(!0),[]),onFocusableItemAdd:h.useCallback(()=>k(E=>E+1),[]),onFocusableItemRemove:h.useCallback(()=>k(E=>E-1),[])},h.createElement(Re.div,z({tabIndex:y||_===0?-1:0,"data-orientation":r},u,{ref:f,style:{outline:"none",...t.style},onMouseDown:se(t.onMouseDown,()=>{S.current=!0}),onFocus:se(t.onFocus,E=>{const C=!S.current;if(E.target===E.currentTarget&&C&&!y){const T=new CustomEvent(ry,bQ);if(E.currentTarget.dispatchEvent(T),!T.defaultPrevented){const A=w().filter(G=>G.focusable),B=A.find(G=>G.active),D=A.find(G=>G.id===m),U=[B,D,...A].filter(Boolean).map(G=>G.ref.current);NP(U)}}S.current=!1}),onBlur:se(t.onBlur,()=>v(!1))})))}),TQ="RovingFocusGroupItem",OQ=h.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=t,a=ao(),l=i||a,c=EQ(TQ,n),u=c.currentTabStopId===l,d=MP(n),{onFocusableItemAdd:f,onFocusableItemRemove:p}=c;return h.useEffect(()=>{if(r)return f(),()=>p()},[r,f,p]),h.createElement(fx.ItemSlot,{scope:n,id:l,focusable:r,active:o},h.createElement(Re.span,z({tabIndex:u?0:-1,"data-orientation":c.orientation},s,{ref:e,onMouseDown:se(t.onMouseDown,m=>{r?c.onItemFocus(l):m.preventDefault()}),onFocus:se(t.onFocus,()=>c.onItemFocus(l)),onKeyDown:se(t.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){c.onItemShiftTab();return}if(m.target!==m.currentTarget)return;const g=NQ(m,c.orientation,c.dir);if(g!==void 0){m.preventDefault();let v=d().filter(x=>x.focusable).map(x=>x.ref.current);if(g==="last")v.reverse();else if(g==="prev"||g==="next"){g==="prev"&&v.reverse();const x=v.indexOf(m.currentTarget);v=c.loop?PQ(v,x+1):v.slice(x+1)}setTimeout(()=>NP(v))}})})))}),MQ={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function RQ(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function NQ(t,e,n){const r=RQ(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return MQ[r]}function NP(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function PQ(t,e){return t.map((n,r)=>t[(e+r)%t.length])}const $Q=_Q,AQ=OQ,px=["Enter"," "],IQ=["ArrowDown","PageUp","Home"],PP=["ArrowUp","PageDown","End"],DQ=[...IQ,...PP],LQ={ltr:[...px,"ArrowRight"],rtl:[...px,"ArrowLeft"]},jQ={ltr:["ArrowLeft"],rtl:["ArrowRight"]},zg="Menu",[df,zQ,FQ]=dg(zg),[rl,$P]=Lr(zg,[FQ,jc,RP]),jb=jc(),AP=RP(),[BQ,ol]=rl(zg),[UQ,Lf]=rl(zg),VQ=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=t,a=jb(e),[l,c]=h.useState(null),u=h.useRef(!1),d=rn(i),f=_f(o);return h.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})}},[]),h.createElement(R1,a,h.createElement(BQ,{scope:e,open:n,onOpenChange:d,content:l,onContentChange:c},h.createElement(UQ,{scope:e,onClose:h.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:s},r)))},IP=h.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,o=jb(n);return h.createElement(N1,z({},o,r,{ref:e}))}),DP="MenuPortal",[HQ,LP]=rl(DP,{forceMount:void 0}),WQ=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:o}=t,i=ol(DP,e);return h.createElement(HQ,{scope:e,forceMount:n},h.createElement(Hn,{present:n||i.open},h.createElement(sg,{asChild:!0,container:o},r)))},fo="MenuContent",[KQ,zb]=rl(fo),qQ=h.forwardRef((t,e)=>{const n=LP(fo,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,i=ol(fo,t.__scopeMenu),s=Lf(fo,t.__scopeMenu);return h.createElement(df.Provider,{scope:t.__scopeMenu},h.createElement(Hn,{present:r||i.open},h.createElement(df.Slot,{scope:t.__scopeMenu},s.modal?h.createElement(GQ,z({},o,{ref:e})):h.createElement(YQ,z({},o,{ref:e})))))}),GQ=h.forwardRef((t,e)=>{const n=ol(fo,t.__scopeMenu),r=h.useRef(null),o=We(e,r);return h.useEffect(()=>{const i=r.current;if(i)return ag(i)},[]),h.createElement(Fb,z({},t,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:se(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)}))}),YQ=h.forwardRef((t,e)=>{const n=ol(fo,t.__scopeMenu);return h.createElement(Fb,z({},t,{ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)}))}),Fb=h.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...g}=t,y=ol(fo,n),v=Lf(fo,n),x=jb(n),w=AP(n),S=zQ(n),[_,k]=h.useState(null),E=h.useRef(null),C=We(e,E,y.onContentChange),T=h.useRef(0),A=h.useRef(""),B=h.useRef(0),D=h.useRef(null),Z=h.useRef("right"),U=h.useRef(0),G=m?cg:h.Fragment,R=m?{as:mi,allowPinchZoom:!0}:void 0,N=P=>{var I,H;const le=A.current+P,Le=S().filter(tt=>!tt.disabled),Ee=document.activeElement,Je=(I=Le.find(tt=>tt.ref.current===Ee))===null||I===void 0?void 0:I.textValue,Ae=Le.map(tt=>tt.textValue),ne=dee(Ae,le,Je),et=(H=Le.find(tt=>tt.textValue===ne))===null||H===void 0?void 0:H.ref.current;(function tt(nt){A.current=nt,window.clearTimeout(T.current),nt!==""&&(T.current=window.setTimeout(()=>tt(""),1e3))})(le),et&&setTimeout(()=>et.focus())};h.useEffect(()=>()=>window.clearTimeout(T.current),[]),ng();const O=h.useCallback(P=>{var I,H;return Z.current===((I=D.current)===null||I===void 0?void 0:I.side)&&pee(P,(H=D.current)===null||H===void 0?void 0:H.area)},[]);return h.createElement(KQ,{scope:n,searchRef:A,onItemEnter:h.useCallback(P=>{O(P)&&P.preventDefault()},[O]),onItemLeave:h.useCallback(P=>{var I;O(P)||((I=E.current)===null||I===void 0||I.focus(),k(null))},[O]),onTriggerLeave:h.useCallback(P=>{O(P)&&P.preventDefault()},[O]),pointerGraceTimerRef:B,onPointerGraceIntentChange:h.useCallback(P=>{D.current=P},[])},h.createElement(G,R,h.createElement(rg,{asChild:!0,trapped:o,onMountAutoFocus:se(i,P=>{var I;P.preventDefault(),(I=E.current)===null||I===void 0||I.focus()}),onUnmountAutoFocus:s},h.createElement(tg,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p},h.createElement($Q,z({asChild:!0},w,{dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:_,onCurrentTabStopIdChange:k,onEntryFocus:se(l,P=>{v.isUsingKeyboardRef.current||P.preventDefault()})}),h.createElement(P1,z({role:"menu","aria-orientation":"vertical","data-state":UP(y.open),"data-radix-menu-content":"",dir:v.dir},x,g,{ref:C,style:{outline:"none",...g.style},onKeyDown:se(g.onKeyDown,P=>{const H=P.target.closest("[data-radix-menu-content]")===P.currentTarget,le=P.ctrlKey||P.altKey||P.metaKey,Le=P.key.length===1;H&&(P.key==="Tab"&&P.preventDefault(),!le&&Le&&N(P.key));const Ee=E.current;if(P.target!==Ee||!DQ.includes(P.key))return;P.preventDefault();const Ae=S().filter(ne=>!ne.disabled).map(ne=>ne.ref.current);PP.includes(P.key)&&Ae.reverse(),cee(Ae)}),onBlur:se(t.onBlur,P=>{P.currentTarget.contains(P.target)||(window.clearTimeout(T.current),A.current="")}),onPointerMove:se(t.onPointerMove,ff(P=>{const I=P.target,H=U.current!==P.clientX;if(P.currentTarget.contains(I)&&H){const le=P.clientX>U.current?"right":"left";Z.current=le,U.current=P.clientX}}))})))))))}),ZQ=h.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return h.createElement(Re.div,z({},r,{ref:e}))}),hx="MenuItem",v_="menu.itemSelect",Bb=h.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...o}=t,i=h.useRef(null),s=Lf(hx,t.__scopeMenu),a=zb(hx,t.__scopeMenu),l=We(e,i),c=h.useRef(!1),u=()=>{const d=i.current;if(!n&&d){const f=new CustomEvent(v_,{bubbles:!0,cancelable:!0});d.addEventListener(v_,p=>r==null?void 0:r(p),{once:!0}),mO(d,f),f.defaultPrevented?c.current=!1:s.onClose()}};return h.createElement(jP,z({},o,{ref:l,disabled:n,onClick:se(t.onClick,u),onPointerDown:d=>{var f;(f=t.onPointerDown)===null||f===void 0||f.call(t,d),c.current=!0},onPointerUp:se(t.onPointerUp,d=>{var f;c.current||(f=d.currentTarget)===null||f===void 0||f.click()}),onKeyDown:se(t.onKeyDown,d=>{const f=a.searchRef.current!=="";n||f&&d.key===" "||px.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})}))}),jP=h.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=t,s=zb(hx,n),a=AP(n),l=h.useRef(null),c=We(e,l),[u,d]=h.useState(!1),[f,p]=h.useState("");return h.useEffect(()=>{const m=l.current;if(m){var g;p(((g=m.textContent)!==null&&g!==void 0?g:"").trim())}},[i.children]),h.createElement(df.ItemSlot,{scope:n,disabled:r,textValue:o??f},h.createElement(AQ,z({asChild:!0},a,{focusable:!r}),h.createElement(Re.div,z({role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0},i,{ref:c,onPointerMove:se(t.onPointerMove,ff(m=>{r?s.onItemLeave(m):(s.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus())})),onPointerLeave:se(t.onPointerLeave,ff(m=>s.onItemLeave(m))),onFocus:se(t.onFocus,()=>d(!0)),onBlur:se(t.onBlur,()=>d(!1))}))))}),JQ=h.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...o}=t;return h.createElement(FP,{scope:t.__scopeMenu,checked:n},h.createElement(Bb,z({role:"menuitemcheckbox","aria-checked":wm(n)?"mixed":n},o,{ref:e,"data-state":Ub(n),onSelect:se(o.onSelect,()=>r==null?void 0:r(wm(n)?!0:!n),{checkForDefaultPrevented:!1})})))}),XQ="MenuRadioGroup",[Xoe,QQ]=rl(XQ,{value:void 0,onValueChange:()=>{}}),eee="MenuRadioItem",tee=h.forwardRef((t,e)=>{const{value:n,...r}=t,o=QQ(eee,t.__scopeMenu),i=n===o.value;return h.createElement(FP,{scope:t.__scopeMenu,checked:i},h.createElement(Bb,z({role:"menuitemradio","aria-checked":i},r,{ref:e,"data-state":Ub(i),onSelect:se(r.onSelect,()=>{var s;return(s=o.onValueChange)===null||s===void 0?void 0:s.call(o,n)},{checkForDefaultPrevented:!1})})))}),zP="MenuItemIndicator",[FP,nee]=rl(zP,{checked:!1}),ree=h.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...o}=t,i=nee(zP,n);return h.createElement(Hn,{present:r||wm(i.checked)||i.checked===!0},h.createElement(Re.span,z({},o,{ref:e,"data-state":Ub(i.checked)})))}),oee=h.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return h.createElement(Re.div,z({role:"separator","aria-orientation":"horizontal"},r,{ref:e}))}),iee="MenuSub",[Qoe,BP]=rl(iee),kp="MenuSubTrigger",see=h.forwardRef((t,e)=>{const n=ol(kp,t.__scopeMenu),r=Lf(kp,t.__scopeMenu),o=BP(kp,t.__scopeMenu),i=zb(kp,t.__scopeMenu),s=h.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=i,c={__scopeMenu:t.__scopeMenu},u=h.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return h.useEffect(()=>u,[u]),h.useEffect(()=>{const d=a.current;return()=>{window.clearTimeout(d),l(null)}},[a,l]),h.createElement(IP,z({asChild:!0},c),h.createElement(jP,z({id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":UP(n.open)},t,{ref:Gm(e,o.onTriggerChange),onClick:d=>{var f;(f=t.onClick)===null||f===void 0||f.call(t,d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:se(t.onPointerMove,ff(d=>{i.onItemEnter(d),!d.defaultPrevented&&!t.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:se(t.onPointerLeave,ff(d=>{var f;u();const p=(f=n.content)===null||f===void 0?void 0:f.getBoundingClientRect();if(p){var m;const g=(m=n.content)===null||m===void 0?void 0:m.dataset.side,y=g==="right",v=y?-5:5,x=p[y?"left":"right"],w=p[y?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+v,y:d.clientY},{x,y:p.top},{x:w,y:p.top},{x:w,y:p.bottom},{x,y:p.bottom}],side:g}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(d),d.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:se(t.onKeyDown,d=>{const f=i.searchRef.current!=="";if(!(t.disabled||f&&d.key===" ")&&LQ[r.dir].includes(d.key)){var p;n.onOpenChange(!0),(p=n.content)===null||p===void 0||p.focus(),d.preventDefault()}})})))}),aee="MenuSubContent",lee=h.forwardRef((t,e)=>{const n=LP(fo,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,i=ol(fo,t.__scopeMenu),s=Lf(fo,t.__scopeMenu),a=BP(aee,t.__scopeMenu),l=h.useRef(null),c=We(e,l);return h.createElement(df.Provider,{scope:t.__scopeMenu},h.createElement(Hn,{present:r||i.open},h.createElement(df.Slot,{scope:t.__scopeMenu},h.createElement(Fb,z({id:a.contentId,"aria-labelledby":a.triggerId},o,{ref:c,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var d;s.isUsingKeyboardRef.current&&((d=l.current)===null||d===void 0||d.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:se(t.onFocusOutside,u=>{u.target!==a.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:se(t.onEscapeKeyDown,u=>{s.onClose(),u.preventDefault()}),onKeyDown:se(t.onKeyDown,u=>{const d=u.currentTarget.contains(u.target),f=jQ[s.dir].includes(u.key);if(d&&f){var p;i.onOpenChange(!1),(p=a.trigger)===null||p===void 0||p.focus(),u.preventDefault()}})})))))});function UP(t){return t?"open":"closed"}function wm(t){return t==="indeterminate"}function Ub(t){return wm(t)?"indeterminate":t?"checked":"unchecked"}function cee(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function uee(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function dee(t,e,n){const o=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let s=uee(t,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 fee(t,e){const{x:n,y:r}=t;let o=!1;for(let i=0,s=e.length-1;i<e.length;s=i++){const a=e[i].x,l=e[i].y,c=e[s].x,u=e[s].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(o=!o)}return o}function pee(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return fee(n,e)}function ff(t){return e=>e.pointerType==="mouse"?t(e):void 0}const hee=VQ,mee=IP,gee=WQ,vee=qQ,yee=ZQ,xee=Bb,bee=JQ,wee=tee,kee=ree,See=oee,Eee=see,_ee=lee,VP="DropdownMenu",[Cee,eie]=Lr(VP,[$P]),Ur=$P(),[Tee,HP]=Cee(VP),Oee=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:s,modal:a=!0}=t,l=Ur(e),c=h.useRef(null),[u=!1,d]=Ao({prop:o,defaultProp:i,onChange:s});return h.createElement(Tee,{scope:e,triggerId:ao(),triggerRef:c,contentId:ao(),open:u,onOpenChange:d,onOpenToggle:h.useCallback(()=>d(f=>!f),[d]),modal:a},h.createElement(hee,z({},l,{open:u,onOpenChange:d,dir:r,modal:a}),n))},Mee="DropdownMenuTrigger",Ree=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=t,i=HP(Mee,n),s=Ur(n);return h.createElement(mee,z({asChild:!0},s),h.createElement(Re.button,z({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:Gm(e,i.triggerRef),onPointerDown:se(t.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(i.onOpenToggle(),i.open||a.preventDefault())}),onKeyDown:se(t.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&i.onOpenToggle(),a.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})))}),Nee=t=>{const{__scopeDropdownMenu:e,...n}=t,r=Ur(e);return h.createElement(gee,z({},r,n))},Pee="DropdownMenuContent",$ee=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=HP(Pee,n),i=Ur(n),s=h.useRef(!1);return h.createElement(vee,z({id:o.contentId,"aria-labelledby":o.triggerId},i,r,{ref:e,onCloseAutoFocus:se(t.onCloseAutoFocus,a=>{var l;s.current||(l=o.triggerRef.current)===null||l===void 0||l.focus(),s.current=!1,a.preventDefault()}),onInteractOutside:se(t.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:{...t.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)"}}))}),Aee=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Ur(n);return h.createElement(yee,z({},o,r,{ref:e}))}),Iee=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Ur(n);return h.createElement(xee,z({},o,r,{ref:e}))}),Dee=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Ur(n);return h.createElement(bee,z({},o,r,{ref:e}))}),Lee=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Ur(n);return h.createElement(wee,z({},o,r,{ref:e}))}),jee=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Ur(n);return h.createElement(kee,z({},o,r,{ref:e}))}),zee=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Ur(n);return h.createElement(See,z({},o,r,{ref:e}))}),Fee=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Ur(n);return h.createElement(Eee,z({},o,r,{ref:e}))}),Bee=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Ur(n);return h.createElement(_ee,z({},o,r,{ref:e,style:{...t.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)"}}))}),Uee=Oee,Vee=Ree,Hee=Nee,WP=$ee,KP=Aee,qP=Iee,GP=Dee,YP=Lee,ZP=jee,JP=zee,XP=Fee,QP=Bee,Wee=Uee,Kee=Vee,qee=h.forwardRef(({className:t,inset:e,children:n,...r},o)=>b.jsxs(XP,{ref:o,className:ze("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",e&&"pl-8",t),...r,children:[n,b.jsx(z5,{className:"ml-auto h-4 w-4"})]}));qee.displayName=XP.displayName;const Gee=h.forwardRef(({className:t,...e},n)=>b.jsx(QP,{ref:n,className:ze("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground 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",t),...e}));Gee.displayName=QP.displayName;const e$=h.forwardRef(({className:t,sideOffset:e=4,...n},r)=>b.jsx(Hee,{children:b.jsx(WP,{ref:r,sideOffset:e,className:ze("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground 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",t),...n})}));e$.displayName=WP.displayName;const qi=h.forwardRef(({className:t,inset:e,...n},r)=>b.jsx(qP,{ref:r,className:ze("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...n}));qi.displayName=qP.displayName;const Yee=h.forwardRef(({className:t,children:e,checked:n,...r},o)=>b.jsxs(GP,{ref:o,className:ze("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",t),checked:n,...r,children:[b.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:b.jsx(ZP,{children:b.jsx(y1,{className:"h-4 w-4"})})}),e]}));Yee.displayName=GP.displayName;const Zee=h.forwardRef(({className:t,children:e,...n},r)=>b.jsxs(YP,{ref:r,className:ze("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",t),...n,children:[b.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:b.jsx(ZP,{children:b.jsx(F5,{className:"h-2 w-2 fill-current"})})}),e]}));Zee.displayName=YP.displayName;const Jee=h.forwardRef(({className:t,inset:e,...n},r)=>b.jsx(KP,{ref:r,className:ze("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));Jee.displayName=KP.displayName;const Xee=h.forwardRef(({className:t,...e},n)=>b.jsx(JP,{ref:n,className:ze("-mx-1 my-1 h-px bg-muted",t),...e}));Xee.displayName=JP.displayName;function km(t){"@babel/helpers - typeof";return km=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},km(t)}function Ka(t){if(t===null||t===!0||t===!1)return NaN;var e=Number(t);return isNaN(e)?e:e<0?Math.ceil(e):Math.floor(e)}function cn(t,e){if(e.length<t)throw new TypeError(t+" argument"+(t>1?"s":"")+" required, but only "+e.length+" present")}function kr(t){cn(1,arguments);var e=Object.prototype.toString.call(t);return t instanceof Date||km(t)==="object"&&e==="[object Date]"?new Date(t.getTime()):typeof t=="number"||e==="[object Number]"?new Date(t):((typeof t=="string"||e==="[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 Qee(t,e){cn(2,arguments);var n=kr(t).getTime(),r=Ka(e);return new Date(n+r)}var ete={};function Fg(){return ete}function tte(t){var e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),t.getTime()-e.getTime()}function y_(t){cn(1,arguments);var e=kr(t);return e.setHours(0,0,0,0),e}function nte(t){return cn(1,arguments),t instanceof Date||km(t)==="object"&&Object.prototype.toString.call(t)==="[object Date]"}function rte(t){if(cn(1,arguments),!nte(t)&&typeof t!="number")return!1;var e=kr(t);return!isNaN(Number(e))}function ote(t){cn(1,arguments);var e=kr(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(23,59,59,999),e}function ite(t){cn(1,arguments);var e=kr(t);return e.setDate(1),e.setHours(0,0,0,0),e}function ste(t,e){cn(2,arguments);var n=Ka(e);return Qee(t,-n)}var ate=864e5;function lte(t){cn(1,arguments);var e=kr(t),n=e.getTime();e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0);var r=e.getTime(),o=n-r;return Math.floor(o/ate)+1}function Sm(t){cn(1,arguments);var e=1,n=kr(t),r=n.getUTCDay(),o=(r<e?7:0)+r-e;return n.setUTCDate(n.getUTCDate()-o),n.setUTCHours(0,0,0,0),n}function t$(t){cn(1,arguments);var e=kr(t),n=e.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(n+1,0,4),r.setUTCHours(0,0,0,0);var o=Sm(r),i=new Date(0);i.setUTCFullYear(n,0,4),i.setUTCHours(0,0,0,0);var s=Sm(i);return e.getTime()>=o.getTime()?n+1:e.getTime()>=s.getTime()?n:n-1}function cte(t){cn(1,arguments);var e=t$(t),n=new Date(0);n.setUTCFullYear(e,0,4),n.setUTCHours(0,0,0,0);var r=Sm(n);return r}var ute=6048e5;function dte(t){cn(1,arguments);var e=kr(t),n=Sm(e).getTime()-cte(e).getTime();return Math.round(n/ute)+1}function Em(t,e){var n,r,o,i,s,a,l,c;cn(1,arguments);var u=Fg(),d=Ka((n=(r=(o=(i=e==null?void 0:e.weekStartsOn)!==null&&i!==void 0?i:e==null||(s=e.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.weekStartsOn)!==null&&o!==void 0?o:u.weekStartsOn)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&n!==void 0?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var f=kr(t),p=f.getUTCDay(),m=(p<d?7:0)+p-d;return f.setUTCDate(f.getUTCDate()-m),f.setUTCHours(0,0,0,0),f}function n$(t,e){var n,r,o,i,s,a,l,c;cn(1,arguments);var u=kr(t),d=u.getUTCFullYear(),f=Fg(),p=Ka((n=(r=(o=(i=e==null?void 0:e.firstWeekContainsDate)!==null&&i!==void 0?i:e==null||(s=e.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.firstWeekContainsDate)!==null&&o!==void 0?o:f.firstWeekContainsDate)!==null&&r!==void 0?r:(l=f.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1);if(!(p>=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=new Date(0);m.setUTCFullYear(d+1,0,p),m.setUTCHours(0,0,0,0);var g=Em(m,e),y=new Date(0);y.setUTCFullYear(d,0,p),y.setUTCHours(0,0,0,0);var v=Em(y,e);return u.getTime()>=g.getTime()?d+1:u.getTime()>=v.getTime()?d:d-1}function fte(t,e){var n,r,o,i,s,a,l,c;cn(1,arguments);var u=Fg(),d=Ka((n=(r=(o=(i=e==null?void 0:e.firstWeekContainsDate)!==null&&i!==void 0?i:e==null||(s=e.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.firstWeekContainsDate)!==null&&o!==void 0?o:u.firstWeekContainsDate)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1),f=n$(t,e),p=new Date(0);p.setUTCFullYear(f,0,d),p.setUTCHours(0,0,0,0);var m=Em(p,e);return m}var pte=6048e5;function hte(t,e){cn(1,arguments);var n=kr(t),r=Em(n,e).getTime()-fte(n,e).getTime();return Math.round(r/pte)+1}function it(t,e){for(var n=t<0?"-":"",r=Math.abs(t).toString();r.length<e;)r="0"+r;return n+r}var mte={y:function(e,n){var r=e.getUTCFullYear(),o=r>0?r:1-r;return it(n==="yy"?o%100:o,n.length)},M:function(e,n){var r=e.getUTCMonth();return n==="M"?String(r+1):it(r+1,2)},d:function(e,n){return it(e.getUTCDate(),n.length)},a:function(e,n){var r=e.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(e,n){return it(e.getUTCHours()%12||12,n.length)},H:function(e,n){return it(e.getUTCHours(),n.length)},m:function(e,n){return it(e.getUTCMinutes(),n.length)},s:function(e,n){return it(e.getUTCSeconds(),n.length)},S:function(e,n){var r=n.length,o=e.getUTCMilliseconds(),i=Math.floor(o*Math.pow(10,r-3));return it(i,n.length)}};const zi=mte;var xl={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},gte={G:function(e,n,r){var o=e.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(e,n,r){if(n==="yo"){var o=e.getUTCFullYear(),i=o>0?o:1-o;return r.ordinalNumber(i,{unit:"year"})}return zi.y(e,n)},Y:function(e,n,r,o){var i=n$(e,o),s=i>0?i:1-i;if(n==="YY"){var a=s%100;return it(a,2)}return n==="Yo"?r.ordinalNumber(s,{unit:"year"}):it(s,n.length)},R:function(e,n){var r=t$(e);return it(r,n.length)},u:function(e,n){var r=e.getUTCFullYear();return it(r,n.length)},Q:function(e,n,r){var o=Math.ceil((e.getUTCMonth()+1)/3);switch(n){case"Q":return String(o);case"QQ":return it(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(e,n,r){var o=Math.ceil((e.getUTCMonth()+1)/3);switch(n){case"q":return String(o);case"qq":return it(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(e,n,r){var o=e.getUTCMonth();switch(n){case"M":case"MM":return zi.M(e,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(e,n,r){var o=e.getUTCMonth();switch(n){case"L":return String(o+1);case"LL":return it(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(e,n,r,o){var i=hte(e,o);return n==="wo"?r.ordinalNumber(i,{unit:"week"}):it(i,n.length)},I:function(e,n,r){var o=dte(e);return n==="Io"?r.ordinalNumber(o,{unit:"week"}):it(o,n.length)},d:function(e,n,r){return n==="do"?r.ordinalNumber(e.getUTCDate(),{unit:"date"}):zi.d(e,n)},D:function(e,n,r){var o=lte(e);return n==="Do"?r.ordinalNumber(o,{unit:"dayOfYear"}):it(o,n.length)},E:function(e,n,r){var o=e.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(e,n,r,o){var i=e.getUTCDay(),s=(i-o.weekStartsOn+8)%7||7;switch(n){case"e":return String(s);case"ee":return it(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(e,n,r,o){var i=e.getUTCDay(),s=(i-o.weekStartsOn+8)%7||7;switch(n){case"c":return String(s);case"cc":return it(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(e,n,r){var o=e.getUTCDay(),i=o===0?7:o;switch(n){case"i":return String(i);case"ii":return it(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(e,n,r){var o=e.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(e,n,r){var o=e.getUTCHours(),i;switch(o===12?i=xl.noon:o===0?i=xl.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(e,n,r){var o=e.getUTCHours(),i;switch(o>=17?i=xl.evening:o>=12?i=xl.afternoon:o>=4?i=xl.morning:i=xl.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(e,n,r){if(n==="ho"){var o=e.getUTCHours()%12;return o===0&&(o=12),r.ordinalNumber(o,{unit:"hour"})}return zi.h(e,n)},H:function(e,n,r){return n==="Ho"?r.ordinalNumber(e.getUTCHours(),{unit:"hour"}):zi.H(e,n)},K:function(e,n,r){var o=e.getUTCHours()%12;return n==="Ko"?r.ordinalNumber(o,{unit:"hour"}):it(o,n.length)},k:function(e,n,r){var o=e.getUTCHours();return o===0&&(o=24),n==="ko"?r.ordinalNumber(o,{unit:"hour"}):it(o,n.length)},m:function(e,n,r){return n==="mo"?r.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):zi.m(e,n)},s:function(e,n,r){return n==="so"?r.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):zi.s(e,n)},S:function(e,n){return zi.S(e,n)},X:function(e,n,r,o){var i=o._originalDate||e,s=i.getTimezoneOffset();if(s===0)return"Z";switch(n){case"X":return b_(s);case"XXXX":case"XX":return ta(s);case"XXXXX":case"XXX":default:return ta(s,":")}},x:function(e,n,r,o){var i=o._originalDate||e,s=i.getTimezoneOffset();switch(n){case"x":return b_(s);case"xxxx":case"xx":return ta(s);case"xxxxx":case"xxx":default:return ta(s,":")}},O:function(e,n,r,o){var i=o._originalDate||e,s=i.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+x_(s,":");case"OOOO":default:return"GMT"+ta(s,":")}},z:function(e,n,r,o){var i=o._originalDate||e,s=i.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+x_(s,":");case"zzzz":default:return"GMT"+ta(s,":")}},t:function(e,n,r,o){var i=o._originalDate||e,s=Math.floor(i.getTime()/1e3);return it(s,n.length)},T:function(e,n,r,o){var i=o._originalDate||e,s=i.getTime();return it(s,n.length)}};function x_(t,e){var n=t>0?"-":"+",r=Math.abs(t),o=Math.floor(r/60),i=r%60;if(i===0)return n+String(o);var s=e||"";return n+String(o)+s+it(i,2)}function b_(t,e){if(t%60===0){var n=t>0?"-":"+";return n+it(Math.abs(t)/60,2)}return ta(t,e)}function ta(t,e){var n=e||"",r=t>0?"-":"+",o=Math.abs(t),i=it(Math.floor(o/60),2),s=it(o%60,2);return r+i+n+s}var w_=function(e,n){switch(e){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"})}},r$=function(e,n){switch(e){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"})}},vte=function(e,n){var r=e.match(/(P+)(p+)?/)||[],o=r[1],i=r[2];if(!i)return w_(e,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}}",w_(o,n)).replace("{{time}}",r$(i,n))},yte={p:r$,P:vte},xte=["D","DD"],bte=["YY","YYYY"];function wte(t){return xte.indexOf(t)!==-1}function kte(t){return bte.indexOf(t)!==-1}function k_(t,e,n){if(t==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(e,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(t==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(e,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(t==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(e,"`) 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(t==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(e,"`) 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 Ste={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"}},Ete=function(e,n,r){var o,i=Ste[e];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};const _te=Ete;function oy(t){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.width?String(e.width):t.defaultWidth,r=t.formats[n]||t.formats[t.defaultWidth];return r}}var Cte={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Tte={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Ote={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Mte={date:oy({formats:Cte,defaultWidth:"full"}),time:oy({formats:Tte,defaultWidth:"full"}),dateTime:oy({formats:Ote,defaultWidth:"full"})};const Rte=Mte;var Nte={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Pte=function(e,n,r,o){return Nte[e]};const $te=Pte;function pu(t){return function(e,n){var r=n!=null&&n.context?String(n.context):"standalone",o;if(r==="formatting"&&t.formattingValues){var i=t.defaultFormattingWidth||t.defaultWidth,s=n!=null&&n.width?String(n.width):i;o=t.formattingValues[s]||t.formattingValues[i]}else{var a=t.defaultWidth,l=n!=null&&n.width?String(n.width):t.defaultWidth;o=t.values[l]||t.values[a]}var c=t.argumentCallback?t.argumentCallback(e):e;return o[c]}}var Ate={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Ite={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Dte={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"]},Lte={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"]},jte={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"}},zte={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"}},Fte=function(e,n){var r=Number(e),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"},Bte={ordinalNumber:Fte,era:pu({values:Ate,defaultWidth:"wide"}),quarter:pu({values:Ite,defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:pu({values:Dte,defaultWidth:"wide"}),day:pu({values:Lte,defaultWidth:"wide"}),dayPeriod:pu({values:jte,defaultWidth:"wide",formattingValues:zte,defaultFormattingWidth:"wide"})};const Ute=Bte;function hu(t){return function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.width,o=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(o);if(!i)return null;var s=i[0],a=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(a)?Hte(a,function(d){return d.test(s)}):Vte(a,function(d){return d.test(s)}),c;c=t.valueCallback?t.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;var u=e.slice(s.length);return{value:c,rest:u}}}function Vte(t,e){for(var n in t)if(t.hasOwnProperty(n)&&e(t[n]))return n}function Hte(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return n}function Wte(t){return function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=e.match(t.matchPattern);if(!r)return null;var o=r[0],i=e.match(t.parsePattern);if(!i)return null;var s=t.valueCallback?t.valueCallback(i[0]):i[0];s=n.valueCallback?n.valueCallback(s):s;var a=e.slice(o.length);return{value:s,rest:a}}}var Kte=/^(\d+)(th|st|nd|rd)?/i,qte=/\d+/i,Gte={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},Yte={any:[/^b/i,/^(a|c)/i]},Zte={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Jte={any:[/1/i,/2/i,/3/i,/4/i]},Xte={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},Qte={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]},ene={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},tne={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]},nne={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},rne={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}},one={ordinalNumber:Wte({matchPattern:Kte,parsePattern:qte,valueCallback:function(e){return parseInt(e,10)}}),era:hu({matchPatterns:Gte,defaultMatchWidth:"wide",parsePatterns:Yte,defaultParseWidth:"any"}),quarter:hu({matchPatterns:Zte,defaultMatchWidth:"wide",parsePatterns:Jte,defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:hu({matchPatterns:Xte,defaultMatchWidth:"wide",parsePatterns:Qte,defaultParseWidth:"any"}),day:hu({matchPatterns:ene,defaultMatchWidth:"wide",parsePatterns:tne,defaultParseWidth:"any"}),dayPeriod:hu({matchPatterns:nne,defaultMatchWidth:"any",parsePatterns:rne,defaultParseWidth:"any"})};const ine=one;var sne={code:"en-US",formatDistance:_te,formatLong:Rte,formatRelative:$te,localize:Ute,match:ine,options:{weekStartsOn:0,firstWeekContainsDate:1}};const o$=sne;var ane=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,lne=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,cne=/^'([^]*?)'?$/,une=/''/g,dne=/[a-zA-Z]/;function il(t,e,n){var r,o,i,s,a,l,c,u,d,f,p,m,g,y,v,x,w,S;cn(2,arguments);var _=String(e),k=Fg(),E=(r=(o=n==null?void 0:n.locale)!==null&&o!==void 0?o:k.locale)!==null&&r!==void 0?r:o$,C=Ka((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:k.firstWeekContainsDate)!==null&&s!==void 0?s:(d=k.locale)===null||d===void 0||(f=d.options)===null||f===void 0?void 0:f.firstWeekContainsDate)!==null&&i!==void 0?i:1);if(!(C>=1&&C<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var T=Ka((p=(m=(g=(y=n==null?void 0:n.weekStartsOn)!==null&&y!==void 0?y:n==null||(v=n.locale)===null||v===void 0||(x=v.options)===null||x===void 0?void 0:x.weekStartsOn)!==null&&g!==void 0?g:k.weekStartsOn)!==null&&m!==void 0?m:(w=k.locale)===null||w===void 0||(S=w.options)===null||S===void 0?void 0:S.weekStartsOn)!==null&&p!==void 0?p:0);if(!(T>=0&&T<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!E.localize)throw new RangeError("locale must contain localize property");if(!E.formatLong)throw new RangeError("locale must contain formatLong property");var A=kr(t);if(!rte(A))throw new RangeError("Invalid time value");var B=tte(A),D=ste(A,B),Z={firstWeekContainsDate:C,weekStartsOn:T,locale:E,_originalDate:A},U=_.match(lne).map(function(G){var R=G[0];if(R==="p"||R==="P"){var N=yte[R];return N(G,E.formatLong)}return G}).join("").match(ane).map(function(G){if(G==="''")return"'";var R=G[0];if(R==="'")return fne(G);var N=gte[R];if(N)return!(n!=null&&n.useAdditionalWeekYearTokens)&&kte(G)&&k_(G,e,String(t)),!(n!=null&&n.useAdditionalDayOfYearTokens)&&wte(G)&&k_(G,e,String(t)),N(D,G,E.localize,Z);if(R.match(dne))throw new RangeError("Format string contains an unescaped latin alphabet character `"+R+"`");return G}).join("");return U}function fne(t){var e=t.match(cne);return e?e[1].replace(une,"'"):t}var It=function(){return It=Object.assign||function(e){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)&&(e[i]=n[i])}return e},It.apply(this,arguments)};var i$={exports:{}},mu={};/**
218
+ `],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function u(p){return c.get(p)||p}const d=/\\(?:(\\)|x([\s\S]{0,2})|u(\{[^}]*\}?)|u([\s\S]{4})\\u([^{][\s\S]{0,3})|u([\s\S]{0,4})|([0-3]?[0-7]{1,2})|([\s\S])|$)/g;function f(p,m=!1){return p.replace(d,function(g,y,v,x,w,S,_,k,E){if(y!==void 0)return"\\";if(v!==void 0)return o(v);if(x!==void 0)return a(x);if(w!==void 0)return i(w,S);if(_!==void 0)return i(_);if(k==="0")return"\0";if(k!==void 0)return l(k,!m);if(E!==void 0)return u(E);throw new SyntaxError(e.errorMessages.get(e.ErrorType.EndOfString))})}t.unraw=f,t.default=f})(eP);const OW=ki(eP),Ta=t=>typeof t=="string",MW=t=>typeof t=="function",t_=new Map,nP="en";function Eb(t){return[...Array.isArray(t)?t:[t],nP]}function rP(t,e,n){const r=Eb(t);return mm(()=>gm("date",r,n),()=>new Intl.DateTimeFormat(r,n)).format(Ta(e)?new Date(e):e)}function sx(t,e,n){const r=Eb(t);return mm(()=>gm("number",r,n),()=>new Intl.NumberFormat(r,n)).format(e)}function n_(t,e,n,{offset:r=0,...o}){const i=Eb(t),s=e?mm(()=>gm("plural-ordinal",i),()=>new Intl.PluralRules(i,{type:"ordinal"})):mm(()=>gm("plural-cardinal",i),()=>new Intl.PluralRules(i,{type:"cardinal"}));return o[n]??o[s.select(n-r)]??o.other}function mm(t,e){const n=t();let r=t_.get(n);return r||(r=e(),t_.set(n,r)),r}function gm(t,e,n){const r=e.join("-");return`${t}-${r}-${JSON.stringify(n)}`}const oP=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g,RW=(t,e,n={})=>{const r=e||t,o=s=>typeof s=="object"?s:n[s]||{style:s},i=(s,a)=>{const l=Object.keys(n).length?o("number"):void 0,c=sx(r,s,l);return a.replace("#",c)};return{plural:(s,a)=>{const{offset:l=0}=a,c=n_(r,!1,s,a);return i(s-l,c)},selectordinal:(s,a)=>{const{offset:l=0}=a,c=n_(r,!0,s,a);return i(s-l,c)},select:NW,number:(s,a)=>sx(r,s,o(a)),date:(s,a)=>rP(r,s,o(a)),undefined:PW}},NW=(t,e)=>e[t]??e.other,PW=t=>t;function $W(t,e,n){return(r={},o)=>{const i=RW(e,n,o),s=l=>Array.isArray(l)?l.reduce((c,u)=>{if(Ta(u))return c+u;const[d,f,p]=u;let m={};p!=null&&typeof p=="object"?Object.entries(p).forEach(([v,x])=>{m[v]=s(x)}):m=p;const g=i[f],y=g(r[d],m);return y==null?c:c+y},""):l,a=s(t);return Ta(a)&&oP.test(a)?OW(a.trim()):Ta(a)?a.trim():a?String(a):""}}var AW=Object.defineProperty,IW=(t,e,n)=>e in t?AW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,DW=(t,e,n)=>(IW(t,typeof e!="symbol"?e+"":e,n),n);class LW{constructor(){DW(this,"_events",{})}on(e,n){var r;return(r=this._events)[e]??(r[e]=[]),this._events[e].push(n),()=>this.removeListener(e,n)}removeListener(e,n){const r=this._getListeners(e);if(!r)return;const o=r.indexOf(n);~o&&r.splice(o,1)}emit(e,...n){const r=this._getListeners(e);r&&r.map(o=>o.apply(this,n))}_getListeners(e){const n=this._events[e];return Array.isArray(n)?n:!1}}var jW=Object.defineProperty,zW=(t,e,n)=>e in t?jW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,yl=(t,e,n)=>(zW(t,typeof e!="symbol"?e+"":e,n),n);class FW extends LW{constructor(e){super(),yl(this,"_locale",""),yl(this,"_locales"),yl(this,"_localeData",{}),yl(this,"_messages",{}),yl(this,"_missing"),yl(this,"t",this._.bind(this)),e.missing!=null&&(this._missing=e.missing),e.messages!=null&&this.load(e.messages),e.localeData!=null&&this.loadLocaleData(e.localeData),(typeof e.locale=="string"||e.locales)&&this.activate(e.locale??nP,e.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(e,n){const r=this._localeData[e];r?Object.assign(r,n):this._localeData[e]=n}loadLocaleData(e,n){n!=null?this._loadLocaleData(e,n):Object.keys(e).forEach(r=>this._loadLocaleData(r,e[r])),this.emit("change")}_load(e,n){const r=this._messages[e];r?Object.assign(r,n):this._messages[e]=n}load(e,n){typeof e=="string"&&typeof n=="object"?this._load(e,n):Object.entries(e).forEach(([r,o])=>this._load(r,o)),this.emit("change")}loadAndActivate({locale:e,locales:n,messages:r}){this._locale=e,this._locales=n||void 0,this._messages[this._locale]=r,this.emit("change")}activate(e,n){this._locale=e,this._locales=n,this.emit("change")}_(e,n,r){let o=r==null?void 0:r.message;Ta(e)||(n=e.values||n,o=e.message,e=e.id);const i=this.messages[e],s=i===void 0,a=this._missing;if(a&&s)return MW(a)?a(this._locale,e):a;s&&this.emit("missing",{id:e,locale:this._locale});let l=i||o||e;return Ta(l)&&oP.test(l)?JSON.parse(`"${l}"`):Ta(l)?l:$W(l,this._locale,this._locales)(n,r==null?void 0:r.formats)}date(e,n){return rP(this._locales||this._locale,e,n)}number(e,n){return sx(this._locales||this._locale,e,n)}}function BW(t={}){return new FW(t)}const Dg=BW();function Y(t,e){return e?"other":t==1?"one":"other"}function Oi(t,e){return e?"other":t==0||t==1?"one":"other"}function er(t,e){var n=String(t).split("."),r=!n[1];return e?"other":t==1&&r?"one":"other"}function ot(t,e){return"other"}function Hs(t,e){return e?"other":t==1?"one":t==2?"two":"other"}const UW=ot,VW=Y,HW=Oi;function WW(t,e){return e?"other":t>=0&&t<=1?"one":"other"}const KW=Y;function qW(t,e){var n=String(t).split("."),r=Number(n[0])==t,o=r&&n[0].slice(-2);return e?"other":t==0?"zero":t==1?"one":t==2?"two":o>=3&&o<=10?"few":o>=11&&o<=99?"many":"other"}function GW(t,e){var n=String(t).split("."),r=Number(n[0])==t,o=r&&n[0].slice(-2);return e?"other":t==0?"zero":t==1?"one":t==2?"two":o>=3&&o<=10?"few":o>=11&&o<=99?"many":"other"}function YW(t,e){return e?t==1||t==5||t==7||t==8||t==9||t==10?"one":t==2||t==3?"two":t==4?"few":t==6?"many":"other":t>=0&&t<=1?"one":"other"}const ZW=Y,JW=er;function XW(t,e){var n=String(t).split("."),r=n[0],o=r.slice(-1),i=r.slice(-2),s=r.slice(-3);return e?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":t==1?"one":"other"}function QW(t,e){var n=String(t).split("."),r=Number(n[0])==t,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2);return e?(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 eK=Y,tK=Y,nK=Y,rK=Oi,oK=ot;function iK(t,e){return e?t==1||t==5||t==7||t==8||t==9||t==10?"one":t==2||t==3?"two":t==4?"few":t==6?"many":"other":t>=0&&t<=1?"one":"other"}const sK=ot;function aK(t,e){var n=String(t).split("."),r=Number(n[0])==t,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2),s=r&&n[0].slice(-6);return e?"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":t!=0&&r&&s==0?"many":"other"}const lK=Y;function cK(t,e){var n=String(t).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 e?"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 uK(t,e){var n=String(t).split("."),r=!n[1];return e?t==1||t==3?"one":t==2?"two":t==4?"few":"other":t==1&&r?"one":"other"}const dK=Y;function fK(t,e){var n=String(t).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=o.slice(-1);return e?"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 pK=Y,hK=Y,mK=Y;function gK(t,e){var n=String(t).split("."),r=n[0],o=!n[1];return e?"other":t==1&&o?"one":r>=2&&r<=4&&o?"few":o?"other":"many"}function vK(t,e){return e?t==0||t==7||t==8||t==9?"zero":t==1?"one":t==2?"two":t==3||t==4?"few":t==5||t==6?"many":"other":t==0?"zero":t==1?"one":t==2?"two":t==3?"few":t==6?"many":"other"}function yK(t,e){var n=String(t).split("."),r=n[0],o=Number(n[0])==t;return e?"other":t==1||!o&&(r==0||r==1)?"one":"other"}const xK=er;function bK(t,e){var n=String(t).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-2),a=o.slice(-2);return e?"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 wK=Y,kK=ot,SK=Y,EK=Y;function _K(t,e){var n=String(t).split("."),r=!n[1],o=Number(n[0])==t,i=o&&n[0].slice(-1),s=o&&n[0].slice(-2);return e?i==1&&s!=11?"one":i==2&&s!=12?"two":i==3&&s!=13?"few":"other":t==1&&r?"one":"other"}const CK=Y,TK=Y,OK=er,MK=Y;function RK(t,e){return e?"other":t>=0&&t<=1?"one":"other"}function NK(t,e){return e?"other":t>=0&&t<2?"one":"other"}const PK=er;function $K(t,e){var n=String(t).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=o.slice(-1);return e?t==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 AK=Y;function IK(t,e){return e?t==1?"one":"other":t>=0&&t<2?"one":"other"}const DK=Y,LK=er;function jK(t,e){var n=String(t).split("."),r=Number(n[0])==t;return e?t==1?"one":"other":t==1?"one":t==2?"two":r&&t>=3&&t<=6?"few":r&&t>=7&&t<=10?"many":"other"}function zK(t,e){var n=String(t).split("."),r=Number(n[0])==t;return e?t==1||t==11?"one":t==2||t==12?"two":t==3||t==13?"few":"other":t==1||t==11?"one":t==2||t==12?"two":r&&t>=3&&t<=10||r&&t>=13&&t<=19?"few":"other"}const FK=er,BK=Y;function UK(t,e){return e?t==1?"one":t==2||t==3?"two":t==4?"few":t==6?"many":"other":t>=0&&t<=1?"one":"other"}const VK=Oi;function HK(t,e){var n=String(t).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return e?"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 WK=Y,KK=Y;function qK(t,e){var n=String(t).split("."),r=n[0],o=!n[1],i=Number(n[0])==t,s=i&&n[0].slice(-1);return e?"other":t==1&&o?"one":r==2&&o?"two":o&&(t<0||t>10)&&i&&s==0?"many":"other"}function GK(t,e){return e?t==1?"one":t==2||t==3?"two":t==4?"few":t==6?"many":"other":t>=0&&t<=1?"one":"other"}function YK(t,e){var n=String(t).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 e?"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 ZK(t,e){var n=String(t).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-2),a=o.slice(-2);return e?"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 JK(t,e){return e?t==1||t==5?"one":"other":t==1?"one":"other"}function XK(t,e){return e?t==1?"one":"other":t>=0&&t<2?"one":"other"}const QK=er,eq=ot,tq=ot,nq=ot,rq=er;function oq(t,e){var n=String(t).split("."),r=n[0],o=Number(n[0])==t,i=r.slice(-1),s=r.slice(-2);return e?"other":o&&i==1&&s!=11||!o?"one":"other"}function iq(t,e){var n=String(t).split("."),r=!n[1];return e?t==11||t==8||t==80||t==800?"many":"other":t==1&&r?"one":"other"}const sq=Hs;function aq(t,e){var n=String(t).split("."),r=n[0],o=!n[1],i=Number(n[0])==t,s=i&&n[0].slice(-1);return e?"other":t==1&&o?"one":r==2&&o?"two":o&&(t<0||t>10)&&i&&s==0?"many":"other"}const lq=ot,cq=ot,uq=Y,dq=er,fq=Y,pq=ot,hq=ot;function mq(t,e){var n=String(t).split("."),r=n[0],o=r.slice(-2);return e?r==1?"one":r==0||o>=2&&o<=20||o==40||o==60||o==80?"many":"other":t==1?"one":"other"}function gq(t,e){return e?"other":t>=0&&t<2?"one":"other"}const vq=Y,yq=Y,xq=ot,bq=ot;function wq(t,e){var n=String(t).split("."),r=Number(n[0])==t,o=r&&n[0].slice(-1);return e?o==6||o==9||r&&o==0&&t!=0?"many":"other":t==1?"one":"other"}const kq=Y,Sq=Y,Eq=ot;function _q(t,e){return e?"other":t>=0&&t<=1?"one":"other"}const Cq=ot,Tq=Y,Oq=Y;function Mq(t,e){return e?"other":t==0?"zero":t==1?"one":"other"}const Rq=Y;function Nq(t,e){var n=String(t).split("."),r=Number(n[0])==t,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 e?r&&t>=1&&t<=4||o>=1&&o<=4||o>=21&&o<=24||o>=41&&o<=44||o>=61&&o<=64||o>=81&&o<=84?"one":t==5||o==5?"many":"other":t==0?"zero":t==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)||t!=0&&a==1e5?"two":o==3||o==23||o==43||o==63||o==83?"few":t!=1&&(o==1||o==21||o==41||o==61||o==81)?"many":"other"}const Pq=Y;function $q(t,e){var n=String(t).split("."),r=n[0];return e?"other":t==0?"zero":(r==0||r==1)&&t!=0?"one":"other"}const Aq=Y,Iq=Y,Dq=ot,Lq=Oi;function jq(t,e){return e&&t==1?"one":"other"}function zq(t,e){var n=String(t).split("."),r=n[1]||"",o=Number(n[0])==t,i=o&&n[0].slice(-1),s=o&&n[0].slice(-2);return e?"other":i==1&&(s<11||s>19)?"one":i>=2&&i<=9&&(s<11||s>19)?"few":r!=0?"many":"other"}function Fq(t,e){var n=String(t).split("."),r=n[1]||"",o=r.length,i=Number(n[0])==t,s=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-2),c=r.slice(-1);return e?"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 Bq=Y,Uq=Oi,Vq=Y;function Hq(t,e){var n=String(t).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 e?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 Wq=Y,Kq=Y;function qq(t,e){var n=String(t).split("."),r=!n[1],o=Number(n[0])==t,i=o&&n[0].slice(-2);return e?t==1?"one":"other":t==1&&r?"one":!r||t==0||i>=2&&i<=19?"few":"other"}function Gq(t,e){return e?t==1?"one":t==2||t==3?"two":t==4?"few":"other":t==1?"one":"other"}function Yq(t,e){return e&&t==1?"one":"other"}function Zq(t,e){var n=String(t).split("."),r=Number(n[0])==t,o=r&&n[0].slice(-2);return e?"other":t==1?"one":t==0||o>=2&&o<=10?"few":o>=11&&o<=19?"many":"other"}const Jq=ot,Xq=Y,Qq=Hs,eG=Y,tG=Y;function nG(t,e){var n=String(t).split("."),r=Number(n[0])==t;return e?r&&t>=1&&t<=4?"one":"other":t==1?"one":"other"}const rG=er,oG=Y,iG=Y,sG=Y,aG=ot,lG=Y,cG=Oi,uG=Y,dG=Y,fG=Y;function pG(t,e){var n=String(t).split("."),r=Number(n[0])==t;return e?t==1||t==5||r&&t>=7&&t<=9?"one":t==2||t==3?"two":t==4?"few":t==6?"many":"other":t==1?"one":"other"}const hG=Y,mG=ot,gG=Oi,vG=Y;function yG(t,e){var n=String(t).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return e?"other":t==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 xG(t,e){var n=String(t).split("."),r=n[1]||"",o=r.length,i=Number(n[0])==t,s=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-2),c=r.slice(-1);return e?"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 bG=Y;function wG(t,e){var n=String(t).split("."),r=n[0];return e?"other":r==0||r==1?"one":"other"}const kG=er,SG=Y;function EG(t,e){var n=String(t).split("."),r=!n[1],o=Number(n[0])==t,i=o&&n[0].slice(-2);return e?t==1?"one":"other":t==1&&r?"one":!r||t==0||i>=2&&i<=19?"few":"other"}const _G=Y,CG=ot;function TG(t,e){var n=String(t).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return e?"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 OG=Y,MG=ot,RG=Y;function NG(t,e){var n=String(t).split("."),r=!n[1];return e?t==11||t==8||t==80||t==800?"many":"other":t==1&&r?"one":"other"}function PG(t,e){var n=String(t).split("."),r=!n[1];return e?t==11||t==8||t==80||t==800?"many":"other":t==1&&r?"one":"other"}const $G=Y,AG=Y,IG=Hs,DG=Y,LG=ot,jG=ot;function zG(t,e){var n=String(t).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 e?"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 FG(t,e){var n=String(t).split("."),r=Number(n[0])==t;return e?"other":t>=0&&t<=1?"one":r&&t>=2&&t<=10?"few":"other"}function BG(t,e){var n=String(t).split("."),r=n[0],o=n[1]||"";return e?"other":t==0||t==1||r==0&&o==1?"one":"other"}function UG(t,e){var n=String(t).split("."),r=n[0],o=!n[1];return e?"other":t==1&&o?"one":r>=2&&r<=4&&o?"few":o?"other":"many"}function VG(t,e){var n=String(t).split("."),r=n[0],o=!n[1],i=r.slice(-2);return e?"other":o&&i==1?"one":o&&i==2?"two":o&&(i==3||i==4)||!o?"few":"other"}const HG=Hs,WG=Hs,KG=Hs,qG=Hs,GG=Hs,YG=Y,ZG=Y;function JG(t,e){var n=String(t).split("."),r=Number(n[0])==t,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2);return e?t==1?"one":o==4&&i!=14?"many":"other":t==1?"one":"other"}function XG(t,e){var n=String(t).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 e?"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 QG=Y,eY=Y,tY=Y,nY=ot;function rY(t,e){var n=String(t).split("."),r=!n[1],o=Number(n[0])==t,i=o&&n[0].slice(-1),s=o&&n[0].slice(-2);return e?(i==1||i==2)&&s!=11&&s!=12?"one":"other":t==1&&r?"one":"other"}const oY=er,iY=Y,sY=Y,aY=Y,lY=Y,cY=ot,uY=Oi,dY=Y;function fY(t,e){var n=String(t).split("."),r=Number(n[0])==t,o=r&&n[0].slice(-1);return e?o==6||o==9||t==10?"few":"other":t==1?"one":"other"}function pY(t,e){var n=String(t).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=o.slice(-1);return e?t==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 hY=Y,mY=ot,gY=Y,vY=Y;function yY(t,e){var n=String(t).split("."),r=Number(n[0])==t;return e?"other":t==0||t==1||r&&t>=11&&t<=99?"one":"other"}const xY=Y;function bY(t,e){var n=String(t).split("."),r=n[0],o=!n[1],i=Number(n[0])==t,s=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-1),c=r.slice(-2);return e?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 wY=er,kY=Y,SY=Y;function EY(t,e){return e&&t==1?"one":"other"}const _Y=Y,CY=Y,TY=Oi,OY=Y,MY=ot,RY=Y,NY=Y,PY=er,$Y=ot,AY=ot,IY=ot;function DY(t,e){return e?"other":t>=0&&t<=1?"one":"other"}const LY=Object.freeze(Object.defineProperty({__proto__:null,_in:UW,af:VW,ak:HW,am:WW,an:KW,ar:qW,ars:GW,as:YW,asa:ZW,ast:JW,az:XW,be:QW,bem:eK,bez:tK,bg:nK,bho:rK,bm:oK,bn:iK,bo:sK,br:aK,brx:lK,bs:cK,ca:uK,ce:dK,ceb:fK,cgg:pK,chr:hK,ckb:mK,cs:gK,cy:vK,da:yK,de:xK,dsb:bK,dv:wK,dz:kK,ee:SK,el:EK,en:_K,eo:CK,es:TK,et:OK,eu:MK,fa:RK,ff:NK,fi:PK,fil:$K,fo:AK,fr:IK,fur:DK,fy:LK,ga:jK,gd:zK,gl:FK,gsw:BK,gu:UK,guw:VK,gv:HK,ha:WK,haw:KK,he:qK,hi:GK,hr:YK,hsb:ZK,hu:JK,hy:XK,ia:QK,id:eq,ig:tq,ii:nq,io:rq,is:oq,it:iq,iu:sq,iw:aq,ja:lq,jbo:cq,jgo:uq,ji:dq,jmc:fq,jv:pq,jw:hq,ka:mq,kab:gq,kaj:vq,kcg:yq,kde:xq,kea:bq,kk:wq,kkj:kq,kl:Sq,km:Eq,kn:_q,ko:Cq,ks:Tq,ksb:Oq,ksh:Mq,ku:Rq,kw:Nq,ky:Pq,lag:$q,lb:Aq,lg:Iq,lkt:Dq,ln:Lq,lo:jq,lt:zq,lv:Fq,mas:Bq,mg:Uq,mgo:Vq,mk:Hq,ml:Wq,mn:Kq,mo:qq,mr:Gq,ms:Yq,mt:Zq,my:Jq,nah:Xq,naq:Qq,nb:eG,nd:tG,ne:nG,nl:rG,nn:oG,nnh:iG,no:sG,nqo:aG,nr:lG,nso:cG,ny:uG,nyn:dG,om:fG,or:pG,os:hG,osa:mG,pa:gG,pap:vG,pl:yG,prg:xG,ps:bG,pt:wG,pt_PT:kG,rm:SG,ro:EG,rof:_G,root:CG,ru:TG,rwk:OG,sah:MG,saq:RG,sc:NG,scn:PG,sd:$G,sdh:AG,se:IG,seh:DG,ses:LG,sg:jG,sh:zG,shi:FG,si:BG,sk:UG,sl:VG,sma:HG,smi:WG,smj:KG,smn:qG,sms:GG,sn:YG,so:ZG,sq:JG,sr:XG,ss:QG,ssy:eY,st:tY,su:nY,sv:rY,sw:oY,syr:iY,ta:sY,te:aY,teo:lY,th:cY,ti:uY,tig:dY,tk:fY,tl:pY,tn:hY,to:mY,tr:gY,ts:vY,tzm:yY,ug:xY,uk:bY,ur:wY,uz:kY,ve:SY,vi:EY,vo:_Y,vun:CY,wa:TY,wae:OY,wo:MY,xh:RY,xog:NY,yi:PY,yo:$Y,yue:AY,zh:IY,zu:DY},Symbol.toStringTag,{value:"Module"}));var jY=Object.defineProperty,zY=Object.getOwnPropertyDescriptor,FY=Object.getOwnPropertyNames,BY=Object.prototype.hasOwnProperty,r_=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of FY(e))!BY.call(t,o)&&o!==n&&jY(t,o,{get:()=>e[o],enumerable:!(r=zY(e,o))||r.enumerable});return t},UY=(t,e,n)=>(r_(t,e,"default"),n&&r_(n,e,"default")),VY=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"]]}'),iP={};UY(iP,LY);Dg.loadLocaleData("en",{plurals:iP.en});Dg.load("en",VY);Dg.activate("en");var HY=Object.defineProperty,WY=Object.getOwnPropertyDescriptor,_b=(t,e,n,r)=>{for(var o=r>1?void 0:r?WY(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&HY(e,n,o),o},Tc=class extends Fr{get name(){return"doc"}createNodeSpec(t,e){const{docAttributes:n,content:r}=this.options,o=pe();if(el(n))for(const[i,s]of qt(n))o[i]={default:s};else for(const i of n)o[i]={default:null};return{attrs:o,content:r,...e}}setDocAttributes(t){return({tr:e,dispatch:n})=>{if(n){for(const[r,o]of Object.entries(t))e.step(new of(r,o));n(e)}return!0}}isDefaultDocNode({state:t=this.store.getState(),options:e}={}){return bb(t.doc,e)}};_b([ue()],Tc.prototype,"setDocAttributes",1);_b([At()],Tc.prototype,"isDefaultDocNode",1);Tc=_b([Ze({defaultOptions:{content:"block+",docAttributes:[]},defaultPriority:at.Medium,staticKeys:["content","docAttributes"],disableExtraAttributes:!0})],Tc);var sP="SetDocAttribute",aP="RevertSetDocAttribute",of=class extends Yt{constructor(t,e,n=sP){super(),this.stepType=n,this.key=t,this.value=e}static fromJSON(t,e){return new of(e.key,e.value,e.stepType)}apply(t){this.previous=t.attrs[this.key];const e={...t.attrs,[this.key]:this.value};return jt.ok(t.type.create(e,t.content,t.marks))}invert(){return new of(this.key,this.previous,aP)}map(){return this}toJSON(){return{stepType:this.stepType,key:this.key,value:this.value}}};try{Yt.jsonID(sP,of),Yt.jsonID(aP,of)}catch(t){if(!t.message.startsWith("Duplicate use of step JSON ID"))throw t}var KY=Object.defineProperty,qY=Object.getOwnPropertyDescriptor,lP=(t,e,n,r)=>{for(var o=r>1?void 0:r?qY(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&KY(e,n,o),o};function GY(t,e,n,r){const o=t.docView.posFromDOM(e,n,r);return o===null||o<0?null:o}function YY(t,e){const n=e.target;if(n){const r=GY(t,n,0);if(r!==null){const o=t.state.doc.resolve(r),i=o.node().isLeaf?0:1,s=o.start()-i;return{pos:r,inside:s}}}return t.posAtCoords({left:e.clientX,top:e.clientY})??void 0}var vm=class extends St{constructor(){super(...arguments),this.mousedown=!1,this.mouseover=!1,this.createMouseEventHandler=t=>(e,n)=>{const r=n,o=YY(e,r);if(!o)return!1;const i=[],s=[],{inside:a,pos:l}=o;if(a===-1)return!1;const c=e.state.doc.resolve(l),u=c.depth+1;for(const d of eR(u,1))i.push({node:d>c.depth&&c.nodeAfter?c.nodeAfter:c.node(d),pos:c.before(d)});for(const{type:d}of c.marksAcross(c)??[]){const f=wi(c,d);f&&s.push(f)}return t(r,{view:e,nodes:i,marks:s,getMark:d=>{const f=Se(d)?e.state.schema.marks[d]:d;return ve(f,{code:K.EXTENSION,message:`The mark ${d} being checked does not exist within the editor schema.`}),s.find(p=>p.mark.type===f)},getNode:d=>{var f;const p=Se(d)?e.state.schema.nodes[d]:d;ve(p,{code:K.EXTENSION,message:"The node being checked does not exist"});const m=i.find(({node:g})=>g.type===p);if(m)return{...m,isRoot:!!((f=i[0])!=null&&f.node.eq(m.node))}}})}}get name(){return"events"}onView(){var t,e;if(!((t=this.store.managerSettings.exclude)!=null&&t.clickHandler))for(const n of this.store.extensions){if(!n.createEventHandlers||(e=n.options.exclude)!=null&&e.clickHandler)continue;const r=n.createEventHandlers();for(const[o,i]of qt(r))this.addHandler(o,i)}}createPlugin(){const t=new WeakMap,e=(n,r,o,i,s,a,l,c)=>{const u=this.store.currentState,{schema:d,doc:f}=u,p=f.resolve(i),m=t.has(l),g=ZY({$pos:p,handled:m,view:o,state:u});let y=!1;m||(y=n(l,g)||y);const v={...g,pos:i,direct:c,nodeWithPosition:{node:s,pos:a},getNode:x=>{const w=Se(x)?d.nodes[x]:x;return ve(w,{code:K.EXTENSION,message:"The node being checked does not exist"}),w===s.type?{node:s,pos:a}:void 0}};return t.set(l,!0),r(l,v)||y};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)=>e(this.options.clickMark,this.options.click,n,r,o,i,s,a),handleDoubleClickOn:(n,r,o,i,s,a)=>e(this.options.doubleClickMark,this.options.doubleClick,n,r,o,i,s,a),handleTripleClickOn:(n,r,o,i,s,a)=>e(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())}};lP([At()],vm.prototype,"isInteracting",1);vm=lP([Ze({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:at.High})],vm);function ZY(t){const{handled:e,view:n,$pos:r,state:o}=t,i={getMark:XM,markRanges:[],view:n,state:o};if(e)return i;for(const{type:s}of r.marksAcross(r)??[]){const a=wi(r,s);a&&i.markRanges.push(a)}return i.getMark=s=>{const a=Se(s)?o.schema.marks[s]:s;return ve(a,{code:K.EXTENSION,message:`The mark ${s} being checked does not exist within the editor schema.`}),i.markRanges.find(l=>l.mark.type===a)},i}class $t extends je{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return $t.valid(r)?new $t(r):je.near(r)}content(){return J.empty}eq(e){return e instanceof $t&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new $t(e.resolve(n.pos))}getBookmark(){return new Cb(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!JY(e)||!XY(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&$t.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let a=e.node(s);if(n>0?e.indexAfter(s)<a.childCount:e.index(s)>0){i=a.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=n;let l=e.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&&!ye.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*n),r=!1;continue e}break}i=s,o+=n;let a=e.doc.resolve(o);if($t.valid(a))return a}return null}}}$t.prototype.visible=!1;$t.findFrom=$t.findGapCursorFrom;je.jsonID("gapcursor",$t);class Cb{constructor(e){this.pos=e}map(e){return new Cb(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return $t.valid(n)?new $t(n):je.near(n)}}function JY(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let 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 XY(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let 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 QY(){return new Ti({props:{decorations:rZ,createSelectionBetween(t,e,n){return e.pos==n.pos&&$t.valid(n)?new $t(n):null},handleClick:tZ,handleKeyDown:eZ,handleDOMEvents:{beforeinput:nZ}}})}const eZ=WN({ArrowLeft:wp("horiz",-1),ArrowRight:wp("horiz",1),ArrowUp:wp("vert",-1),ArrowDown:wp("vert",1)});function wp(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let s=r.selection,a=e>0?s.$to:s.$from,l=s.empty;if(s instanceof Ce){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=$t.findGapCursorFrom(a,e,l);return c?(o&&o(r.tr.setSelection(new $t(c))),!0):!1}}function tZ(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!$t.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&ye.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new $t(r))),!0)}function nZ(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof $t))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let o=F.empty;for(let s=r.length-1;s>=0;s--)o=F.from(r[s].createAndFill(null,o));let i=t.state.tr.replace(n.pos,n.pos,new J(o,0,0));return i.setSelection(Ce.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function rZ(t){if(!(t.selection instanceof $t))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Qe.create(t.doc,[kt.widget(t.selection.head,e,{key:"gapcursor"})])}var oZ=Object.defineProperty,iZ=Object.getOwnPropertyDescriptor,sZ=(t,e,n,r)=>{for(var o=r>1?void 0:r?iZ(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&oZ(e,n,o),o},ax=class extends St{get name(){return"gapCursor"}createExternalPlugins(){return[QY()]}};ax=sZ([Ze({})],ax);var ym=200,ln=function(){};ln.prototype.append=function(e){return e.length?(e=ln.from(e),!this.length&&e||e.length<ym&&this.leafAppend(e)||this.length<ym&&e.leafPrepend(this)||this.appendInner(e)):this};ln.prototype.prepend=function(e){return e.length?ln.from(e).append(this):this};ln.prototype.appendInner=function(e){return new aZ(this,e)};ln.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?ln.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};ln.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ln.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};ln.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},n,r),o};ln.from=function(e){return e instanceof ln?e:e&&e.length?new cP(e):ln.empty};var cP=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,a){for(var l=i;l<s;l++)if(o(this.values[l],a+l)===!1)return!1},e.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},e.prototype.leafAppend=function(o){if(this.length+o.length<=ym)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=ym)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(ln);ln.empty=new cP([]);var aZ=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,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},e.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},e.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))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(ln);const lZ=500;class to{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,a,l,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new Eo(d.map));let p=d.step.map(o.slice(i)),m;p&&s.maybeStep(p).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],c.push(new Eo(m,void 0,void 0,c.length+u.length))),i--,m&&o.appendMap(m,i)}else s.maybeStep(d.step);if(d.selection)return a=o?d.selection.map(o.slice(i)):d.selection,l=new to(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(e,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<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new Eo(e.mapping.maps[u],d,n),p;(p=l&&l.merge(f))&&(f=p,u?i.pop():a=a.slice(0,a.length-1)),i.push(f),n&&(s++,n=void 0),o||(l=f)}let c=s-r.depth;return c>uZ&&(a=cZ(a,c),s-=c),new to(a.append(i),s)}remapping(e,n){let r=new ec;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new to(this.items.append(e.map(n=>new Eo(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},o);let l=n;this.items.forEach(f=>{let p=i.getMirror(--l);if(p==null)return;s=Math.min(s,p);let m=i.maps[p];if(f.step){let g=e.steps[p].invert(e.docs[p]),y=f.selection&&f.selection.map(i.slice(l+1,p));y&&a++,r.push(new Eo(m,g,y))}else r.push(new Eo(m))},o);let c=[];for(let f=n;f<s;f++)c.push(new Eo(i.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new to(u,a);return d.emptyItemCount()>lZ&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,o=[],i=0;return this.items.forEach((s,a)=>{if(a>=e)o.push(s),s.selection&&i++;else if(s.step){let l=s.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=s.selection&&s.selection.map(n.slice(r));u&&i++;let d=new Eo(c.invert(),l,u),f,p=o.length-1;(f=o.length&&o[p].merge(d))?o[p]=f:o.push(d)}}else s.map&&r--},this.items.length,0),new to(ln.from(o.reverse()),i)}}to.empty=new to(ln.empty,0);function cZ(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}class Eo{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Eo(n.getMap().invert(),n,this.selection)}}}class Xi{constructor(e,n,r,o,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const uZ=20;function dZ(t,e,n,r){let o=n.getMeta($o),i;if(o)return o.historyState;n.getMeta(pZ)&&(t=new Xi(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta($o))return s.getMeta($o).redo?new Xi(t.done.addTransform(n,void 0,r,Zp(e)),t.undone,o_(n.mapping.maps[n.steps.length-1]),t.prevTime,t.prevComposition):new Xi(t.done,t.undone.addTransform(n,void 0,r,Zp(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!fZ(n,t.prevRanges)),c=s?ey(t.prevRanges,n.mapping):o_(n.mapping.maps[n.steps.length-1]);return new Xi(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Zp(e)),to.empty,c,n.time,a??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Xi(t.done.rebased(n,i),t.undone.rebased(n,i),ey(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Xi(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),ey(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function fZ(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&o>=e[i]&&(n=!0)}),n}function o_(t){let e=[];return t.forEach((n,r,o,i)=>e.push(o,i)),e}function ey(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function uP(t,e,n,r){let o=Zp(e),i=$o.get(e).spec.config,s=(r?t.undone:t.done).popEvent(e,o);if(!s)return;let a=s.selection.resolve(s.transform.doc),l=(r?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,o),c=new Xi(r?l:s.remaining,r?s.remaining:l,null,0,-1);n(s.transform.setSelection(a).setMeta($o,{redo:r,historyState:c}).scrollIntoView())}let ty=!1,i_=null;function Zp(t){let e=t.plugins;if(i_!=e){ty=!1,i_=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){ty=!0;break}}return ty}const $o=new Uc("history"),pZ=new Uc("closeHistory");function hZ(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ti({key:$o,state:{init(){return new Xi(to.empty,to.empty,null,0,-1)},apply(e,n,r){return dZ(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?Jp:r=="historyRedo"?Du:null;return o?(n.preventDefault(),o(e.state,e.dispatch)):!1}}}})}const Jp=(t,e)=>{let n=$o.getState(t);return!n||n.done.eventCount==0?!1:(e&&uP(n,t,e,!1),!0)},Du=(t,e)=>{let n=$o.getState(t);return!n||n.undone.eventCount==0?!1:(e&&uP(n,t,e,!0),!0)};function lx(t){let e=$o.getState(t);return e?e.done.eventCount:0}function mZ(t){let e=$o.getState(t);return e?e.undone.eventCount:0}var gZ=Object.defineProperty,vZ=Object.getOwnPropertyDescriptor,nl=(t,e,n,r)=>{for(var o=r>1?void 0:r?vZ(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&gZ(e,n,o),o},Bo=class extends St{constructor(){super(...arguments),this.wrapMethod=(t,e)=>({state:n,dispatch:r,view:o})=>{const{getState:i,getDispatch:s}=this.options,a=dt(i)?i():n,l=dt(s)&&r?s():r,c=t(a,l,o);return e==null||e(c),c}}get name(){return"history"}createKeymap(){return{"Mod-y":Qr.isMac?()=>!1:this.wrapMethod(Du,this.options.onRedo),"Mod-z":this.wrapMethod(Jp,this.options.onUndo),"Shift-Mod-z":this.wrapMethod(Du,this.options.onRedo)}}undoShortcut(t){return this.wrapMethod(Jp,this.options.onUndo)(t)}redoShortcut(t){return this.wrapMethod(Du,this.options.onRedo)(t)}createExternalPlugins(){const{depth:t,newGroupDelay:e}=this.options;return[hZ({depth:t,newGroupDelay:e})]}undo(){return UE(this.wrapMethod(Jp,this.options.onUndo))}redo(){return UE(this.wrapMethod(Du,this.options.onRedo))}undoDepth(t=this.store.getState()){return lx(t)}redoDepth(t=this.store.getState()){return mZ(t)}};nl([wr({shortcut:q.Undo,command:"undo"})],Bo.prototype,"undoShortcut",1);nl([wr({shortcut:q.Redo,command:"redo"})],Bo.prototype,"redoShortcut",1);nl([ue({disableChaining:!0,description:({t})=>t(rm.UNDO_DESCRIPTION),label:({t})=>t(rm.UNDO_LABEL),icon:"arrowGoBackFill"})],Bo.prototype,"undo",1);nl([ue({disableChaining:!0,description:({t})=>t(rm.REDO_DESCRIPTION),label:({t})=>t(rm.REDO_LABEL),icon:"arrowGoForwardFill"})],Bo.prototype,"redo",1);nl([At()],Bo.prototype,"undoDepth",1);nl([At()],Bo.prototype,"redoDepth",1);Bo=nl([Ze({defaultOptions:{depth:100,newGroupDelay:500,getDispatch:void 0,getState:void 0},staticKeys:["depth","newGroupDelay"],handlerKeys:["onUndo","onRedo"]})],Bo);var yZ=Object.defineProperty,xZ=Object.getOwnPropertyDescriptor,Lg=(t,e,n,r)=>{for(var o=r>1?void 0:r?xZ(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&yZ(e,n,o),o},bZ={icon:"paragraph",label:({t})=>t(om.INSERT_LABEL),description:({t})=>t(om.INSERT_DESCRIPTION)},wZ={icon:"paragraph",label:({t})=>t(om.CONVERT_LABEL),description:({t})=>t(om.CONVERT_DESCRIPTION)},Ha=class extends Fr{get name(){return"paragraph"}createTags(){return[Ie.LastNodeCompatible,Ie.TextBlock,Ie.Block,Ie.FormattingNode]}createNodeSpec(t,e){return{content:"inline*",draggable:!1,...e,attrs:{...t.defaults()},parseDOM:[{tag:"p",getAttrs:n=>({...t.parse(n)})},...e.parseDOM??[]],toDOM:n=>["p",t.dom(n),0]}}convertParagraph(t={}){const{attrs:e,selection:n,preserveAttrs:r}=t;return this.store.commands.setBlockNodeType.original(this.type,e,n,r)}insertParagraph(t,e={}){const{selection:n,attrs:r}=e;return this.store.commands.insertNode.original(this.type,{content:t,selection:n,attrs:r})}shortcut(t){return this.convertParagraph()(t)}};Lg([ue(wZ)],Ha.prototype,"convertParagraph",1);Lg([ue(bZ)],Ha.prototype,"insertParagraph",1);Lg([wr({shortcut:q.Paragraph,command:"convertParagraph"})],Ha.prototype,"shortcut",1);Ha=Lg([Ze({defaultPriority:at.Medium})],Ha);function si(t,e,n){return Math.min(Math.max(t,n),e)}class kZ extends Error{constructor(e){super(`Failed to parse color: "${e}"`)}}var Lu=kZ;function Tb(t){if(typeof t!="string")throw new Lu(t);if(t.trim().toLowerCase()==="transparent")return[0,0,0,0];let e=t.trim();e=RZ.test(t)?_Z(t):t;const n=CZ.exec(e);if(n){const s=Array.from(n).slice(1);return[...s.slice(0,3).map(a=>parseInt(sf(a,2),16)),parseInt(sf(s[3]||"f",2),16)/255]}const r=TZ.exec(e);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=OZ.exec(e);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=MZ.exec(e);if(i){const[s,a,l,c]=Array.from(i).slice(1).map(parseFloat);if(si(0,100,a)!==a)throw new Lu(t);if(si(0,100,l)!==l)throw new Lu(t);return[...NZ(s,a,l),Number.isNaN(c)?1:c]}throw new Lu(t)}function SZ(t){let e=5381,n=t.length;for(;n;)e=e*33^t.charCodeAt(--n);return(e>>>0)%2341}const s_=t=>parseInt(t.replace(/_/g,""),36),EZ="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((t,e)=>{const n=s_(e.substring(0,3)),r=s_(e.substring(3)).toString(16);let o="";for(let i=0;i<6-r.length;i++)o+="0";return t[n]=`${o}${r}`,t},{});function _Z(t){const e=t.toLowerCase().trim(),n=EZ[SZ(e)];if(!n)throw new Lu(t);return`#${n}`}const sf=(t,e)=>Array.from(Array(e)).map(()=>t).join(""),CZ=new RegExp(`^#${sf("([a-f0-9])",3)}([a-f0-9])?$`,"i"),TZ=new RegExp(`^#${sf("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),OZ=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${sf(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),MZ=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,RZ=/^[a-z]+$/i,a_=t=>Math.round(t*255),NZ=(t,e,n)=>{let r=n/100;if(e===0)return[r,r,r].map(a_);const o=(t%360+360)%360/60,i=(1-Math.abs(2*r-1))*(e/100),s=i*(1-Math.abs(o%2-1));let a=0,l=0,c=0;o>=0&&o<1?(a=i,l=s):o>=1&&o<2?(a=s,l=i):o>=2&&o<3?(l=i,c=s):o>=3&&o<4?(l=s,c=i):o>=4&&o<5?(a=s,c=i):o>=5&&o<6&&(a=i,c=s);const u=r-i/2,d=a+u,f=l+u,p=c+u;return[d,f,p].map(a_)};function PZ(t){const[e,n,r,o]=Tb(t).map((d,f)=>f===3?d:d/255),i=Math.max(e,n,r),s=Math.min(e,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*(e===i?(n-r)/l+(n<r?6:0):n===i?(r-e)/l+2:(e-n)/l+4),c,a,o]}function $Z(t,e,n,r){return`hsla(${(t%360).toFixed()}, ${si(0,100,e*100).toFixed()}%, ${si(0,100,n*100).toFixed()}%, ${parseFloat(si(0,1,r).toFixed(3))})`}function lr(t,e){const[n,r,o,i]=PZ(t);return $Z(n,r,o-e,i)}function AZ(t){if(t==="transparent")return 0;function e(i){const s=i/255;return s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4)}const[n,r,o]=Tb(t);return .2126*e(n)+.7152*e(r)+.0722*e(o)}function IZ(t,e,n,r){return`rgba(${si(0,255,t).toFixed()}, ${si(0,255,e).toFixed()}, ${si(0,255,n).toFixed()}, ${parseFloat(si(0,1,r).toFixed(3))})`}function Xp(t,e){return lr(t,-e)}function xm(t,e){const[n,r,o,i]=Tb(t);return IZ(n,r,o,i-e)}function DZ(t){return AZ(t)>.179}function oc(t){return DZ(t)?"#000":"#fff"}const LZ="remirror-editor-wrapper",jZ="remirror-button-active",zZ="remirror-button",FZ="remirror-composite",BZ="remirror-dialog",UZ="remirror-dialog-backdrop",VZ="remirror-form",HZ="remirror-form-message",WZ="remirror-form-label",KZ="remirror-form-group",qZ="remirror-group",GZ="remirror-input",YZ="remirror-menu",ZZ="remirror-menu-pane",JZ="remirror-menu-pane-active",XZ="remirror-menu-dropdown-label",QZ="remirror-menu-pane-icon",eJ="remirror-menu-pane-label",tJ="remirror-menu-pane-shortcut",nJ="remirror-menu-button-left",rJ="remirror-menu-button-right",oJ="remirror-menu-button-nested-left",iJ="remirror-menu-button-nested-right",sJ="remirror-menu-button",aJ="remirror-menu-bar",lJ="remirror-flex-column",cJ="remirror-flex-row",uJ="remirror-menu-item",dJ="remirror-menu-item-row",fJ="remirror-menu-item-column",pJ="remirror-menu-item-checkbox",hJ="remirror-menu-item-radio",mJ="remirror-menu-group",gJ="remirror-floating-popover",vJ="remirror-popover",yJ="remirror-animated-popover",xJ="remirror-role",bJ="remirror-separator",wJ="remirror-tab",kJ="remirror-tab-list",SJ="remirror-tabbable",EJ="remirror-toolbar",_J="remirror-tooltip",CJ="remirror-table-size-editor",TJ="remirror-table-size-editor-body",OJ="remirror-table-size-editor-cell",MJ="remirror-table-size-editor-cell-selected",RJ="remirror-table-size-editor-footer",NJ="remirror-color-picker",PJ="remirror-color-picker-cell",$J="remirror-color-picker-cell-selected";var AJ=Object.freeze({__proto__:null,ANIMATED_POPOVER:yJ,BUTTON:zZ,BUTTON_ACTIVE:jZ,COLOR_PICKER:NJ,COLOR_PICKER_CELL:PJ,COLOR_PICKER_CELL_SELECTED:$J,COMPOSITE:FZ,DIALOG:BZ,DIALOG_BACKDROP:UZ,EDITOR_WRAPPER:LZ,FLEX_COLUMN:lJ,FLEX_ROW:cJ,FLOATING_POPOVER:gJ,FORM:VZ,FORM_GROUP:KZ,FORM_LABEL:WZ,FORM_MESSAGE:HZ,GROUP:qZ,INPUT:GZ,MENU:YZ,MENU_BAR:aJ,MENU_BUTTON:sJ,MENU_BUTTON_LEFT:nJ,MENU_BUTTON_NESTED_LEFT:oJ,MENU_BUTTON_NESTED_RIGHT:iJ,MENU_BUTTON_RIGHT:rJ,MENU_DROPDOWN_LABEL:XZ,MENU_GROUP:mJ,MENU_ITEM:uJ,MENU_ITEM_CHECKBOX:pJ,MENU_ITEM_COLUMN:fJ,MENU_ITEM_RADIO:hJ,MENU_ITEM_ROW:dJ,MENU_PANE:ZZ,MENU_PANE_ACTIVE:JZ,MENU_PANE_ICON:QZ,MENU_PANE_LABEL:eJ,MENU_PANE_SHORTCUT:tJ,POPOVER:vJ,ROLE:xJ,SEPARATOR:bJ,TAB:wJ,TABBABLE:SJ,TABLE_SIZE_EDITOR:CJ,TABLE_SIZE_EDITOR_BODY:TJ,TABLE_SIZE_EDITOR_CELL:OJ,TABLE_SIZE_EDITOR_CELL_SELECTED:MJ,TABLE_SIZE_EDITOR_FOOTER:RJ,TAB_LIST:kJ,TOOLBAR:EJ,TOOLTIP:_J});const IJ="remirror-image-loader";var DJ=Object.freeze({__proto__:null,IMAGE_LOADER:IJ});const LJ="remirror-list-item-with-custom-mark",jJ="remirror-ul-list-content",zJ="remirror-editor",FJ="remirror-list-item-marker-container",BJ="remirror-list-item-checkbox",UJ="remirror-collapsible-list-item-closed",VJ="remirror-collapsible-list-item-button",HJ="remirror-list-spine";var Ls=Object.freeze({__proto__:null,COLLAPSIBLE_LIST_ITEM_BUTTON:VJ,COLLAPSIBLE_LIST_ITEM_CLOSED:UJ,EDITOR:zJ,LIST_ITEM_CHECKBOX:BJ,LIST_ITEM_MARKER_CONTAINER:FJ,LIST_ITEM_WITH_CUSTOM_MARKER:LJ,LIST_SPINE:HJ,UL_LIST_CONTENT:jJ});const WJ="remirror-is-empty";var KJ=Object.freeze({__proto__:null,IS_EMPTY:WJ});const qJ="remirror-editor",GJ="remirror-positioner",YJ="remirror-positioner-widget";var ZJ=Object.freeze({__proto__:null,EDITOR:qJ,POSITIONER:GJ,POSITIONER_WIDGET:YJ});const qr={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"]},ai="#000000",Ob="#ffffff",JJ="#252103",Mb=xm(ai,.75),jg="#7963d2",Rb="#bcd263",XJ="#fff",QJ="#fff",Nb=qr.gray[1],l_="rgba(10,31,68,0.08)",c_="rgba(10,31,68,0.10)",u_="rgba(10,31,68,0.12)",eX=Xp(xm(ai,.1),.13),Pb={background:Ob,border:Mb,foreground:ai,muted:Nb,primary:jg,secondary:Rb,primaryText:XJ,secondaryText:QJ,text:JJ,faded:eX},tX={...Pb,background:lr(Ob,.15),border:lr(Mb,.15),foreground:lr(ai,.15),muted:lr(Nb,.15),primary:lr(jg,.15),secondary:lr(Rb,.15),get text(){return oc(this.background)},get primaryText(){return oc(this.primary)},get secondaryText(){return oc(this.secondary)}},nX={...Pb,background:lr(Ob,.075),border:lr(Mb,.075),foreground:lr(ai,.075),muted:lr(Nb,.075),primary:lr(jg,.075),secondary:lr(Rb,.075),get text(){return oc(this.background)},get primaryText(){return oc(this.primary)},get secondaryText(){return oc(this.secondary)}};({...Pb,backdrop:xm(ai,.1),outline:xm(jg,.6),table:(Xp(ai,.8),Xp(ai,.4),qr.gray[3],qr.blue[7],qr.blue[1],qr.blue[5],qr.blue[7],Xp(ai,.4),qr.blue[5],qr.red[7],qr.red[1],qr.red[5])},`${l_}`,`${c_}`,`${u_}`);var rX=Object.defineProperty,oX=Object.getOwnPropertyDescriptor,$b=(t,e,n,r)=>{for(var o=r>1?void 0:r?oX(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&rX(e,n,o),o},dP=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},Ut=(t,e,n)=>(dP(t,e,"read from private field"),n?n.call(t):e.get(t)),qo=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},ji=(t,e,n,r)=>(dP(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),ju,zu,Ol,Fu,Qp,Bu,Uu,Vu,Hu,eh=class{constructor(t){qo(this,ju,bg()),qo(this,zu,[]),qo(this,Ol,new Map),qo(this,Fu,[]),qo(this,Qp,!1),qo(this,Bu,void 0),qo(this,Uu,void 0),qo(this,Vu,void 0),qo(this,Hu,void 0),this.addListener=(e,n)=>Ut(this,ju).on(e,n),ji(this,Bu,t),ji(this,Uu,t.getActive),ji(this,Hu,t.getPosition),ji(this,Vu,t.getID),this.hasChanged=t.hasChanged,this.events=t.events??["state","scroll"]}static create(t){return new eh(t)}static fromPositioner(t,e){return eh.create({...t.basePositioner,...e})}get basePositioner(){return{getActive:Ut(this,Uu),getPosition:Ut(this,Hu),hasChanged:this.hasChanged,events:this.events,getID:Ut(this,Vu)}}onActiveChanged(t){this.recentUpdate=t;const e=Ut(this,Uu).call(this,t);ji(this,zu,e),ji(this,Ol,new Map),ji(this,Qp,!1),ji(this,Fu,[]);const n=[];for(const[r,o]of e.entries()){const i=this.getID(o,r);Ut(this,Fu).push(i),n.push({setElement:s=>this.addProps({...t,data:o,element:s},r),id:i,data:o})}Ut(this,ju).emit("update",n)}getID(t,e){var n;return((n=Ut(this,Vu))==null?void 0:n.call(this,t,e))??e.toString()}addProps(t,e){if(Ut(this,Qp)||(Ut(this,Ol).set(e,t),Ut(this,Ol).size<Ut(this,zu).length))return;const n=[];for(const r of Ut(this,zu).keys()){const o=Ut(this,Ol).get(r);ve(o,{code:K.INTERNAL,message:"Something went wrong when retrieving the parameters"});const i=Ut(this,Fu)[r];if(!i)return;n.push({position:Ut(this,Hu).call(this,o),element:o.element,id:i})}Ut(this,ju).emit("done",n)}clone(t){return eh.create({...Ut(this,Bu),...dt(t)?t(Ut(this,Bu)):t})}active(t){const e=dt(t)?t:()=>t;return this.clone(n=>({getActive:r=>n.getActive(r).filter(e)}))}},uo=eh;ju=new WeakMap;zu=new WeakMap;Ol=new WeakMap;Fu=new WeakMap;Qp=new WeakMap;Bu=new WeakMap;Uu=new WeakMap;Vu=new WeakMap;Hu=new WeakMap;uo.EMPTY=[];function iX(t,e=mP){const{key:n}=(t==null?void 0:t.getMeta(hP))??{};return n===e}function fP(t){const{tr:e,state:n,previousState:r}=t;return!r||e&&iX(e)?!0:e?sV(e):!n.doc.eq(r.doc)||!n.selection.eq(r.selection)}function pP(t,e,n={}){const r=e.getBoundingClientRect(),{accountForPadding:o=!1}=n;let i=0,s=0,a=0,l=0;if(Fo(e)&&o){const u=Number.parseFloat(Li(e,"padding-left").replace("px","")),d=Number.parseFloat(Li(e,"padding-right").replace("px","")),f=Number.parseFloat(Li(e,"padding-top").replace("px","")),p=Number.parseFloat(Li(e,"padding-bottom").replace("px","")),m=Number.parseFloat(Li(e,"border-left").replace("px","")),g=Number.parseFloat(Li(e,"border-right").replace("px","")),y=Number.parseFloat(Li(e,"border-top").replace("px","")),v=Number.parseFloat(Li(e,"border-bottom").replace("px","")),x=e.offsetWidth-e.clientWidth,w=e.offsetHeight-e.clientHeight;i+=u+m+(e.dir==="rtl"?x:0),s+=d+g+(e.dir==="rtl"?0:x),a+=f+y,l+=p+v+w}const c=new DOMRect(r.left+i,r.top+a,r.width-s,r.height-l);for(const[u,d]of[[t.top,t.left],[t.top,t.right],[t.bottom,t.left],[t.bottom,t.right]])if(DS(u,c.top,c.bottom)&&DS(d,c.left,c.right))return!0;return!1}var sX="remirror-positioner-widget",hP="positionerUpdate",mP="__all_positioners__",gP={y:-999999,x:-999999,width:0,height:0},d_={...gP,left:-999999,top:-999999,bottom:-999999,right:-999999},aX={...gP,rect:{...d_,toJSON:()=>d_},visible:!1},lX=uo.create({hasChanged:fP,getActive(t){const{state:e}=t;if(!vb(e)||e.selection.$anchor.depth>2)return uo.EMPTY;const n=Og({predicate:r=>r.type.isBlock,selection:e});return n?[n]:uo.EMPTY},getPosition(t){const{view:e,data:n}=t,r=e.nodeDOM(n.pos);if(!Fo(r))return aX;const o=r.getBoundingClientRect(),i=e.dom.getBoundingClientRect(),s=o.height,a=o.width,l=e.dom.scrollLeft+o.left-i.left,c=e.dom.scrollTop+o.top-i.top,u=pP(o,e.dom);return{y:c,x:l,height:s,width:a,rect:o,visible:u}}}),vP=lX.clone(({getActive:t})=>({getActive:e=>{const[n]=t(e);return n&&wb(n.node)&&n.node.type===Ng(e.state.schema)?[n]:uo.EMPTY}}));vP.clone(({getPosition:t})=>({getPosition:e=>({...t(e),width:1})}));vP.clone(({getPosition:t})=>({getPosition:e=>{const{width:n,x:r,y:o,height:i}=t(e);return{...t(e),width:1,x:n+r,rect:new DOMRect(n+r,o,1,i)}}}));function Ab(t){return uo.create({hasChanged:fP,getActive:e=>{const{state:n,view:r}=e;if(!t(n)||!tl(n.selection))return uo.EMPTY;try{const{head:o,anchor:i}=n.selection;return[{from:r.coordsAtPos(i),to:r.coordsAtPos(o)}]}catch{return uo.EMPTY}},getPosition(e){const{element:n,data:r,view:o}=e,{from:i,to:s}=r,a=n.offsetParent??o.dom,l=a.getBoundingClientRect(),c=Math.abs(s.bottom-i.top),u=c>i.bottom-i.top,d=Math.min(i.left,s.left),f=Math.min(i.top,s.top),p=a.scrollLeft+(u?s.left-l.left:d-l.left),m=a.scrollTop+f-l.top,g=u?1:Math.abs(i.left-s.right),y=new DOMRect(u?s.left:d,f,g,c),v=pP(y,o.dom);return{rect:y,y:m,x:p,height:c,width:g,visible:v}}})}var cX=Ab(t=>!t.selection.empty);Ab(t=>t.selection.empty);Ab(()=>!0);cX.clone(()=>({getActive:t=>{const{state:e,view:n}=t;if(!e.selection.empty)return uo.EMPTY;const r=ON(e);if(!r)return uo.EMPTY;try{return[{from:n.coordsAtPos(r.from),to:n.coordsAtPos(r.to)}]}catch{return uo.EMPTY}}}));var af=class extends St{constructor(){super(...arguments),this.positioners=[],this.onAddCustomHandler=({positioner:t})=>{if(t)return this.positioners=[...this.positioners,t],this.store.commands.forceUpdate(),()=>{this.positioners=this.positioners.filter(e=>e!==t)}}}get name(){return"positioner"}createAttributes(){return{class:ZJ.EDITOR}}init(){this.onScroll=cz(this.options.scrollDebounce,this.onScroll.bind(this))}createEventHandlers(){return{scroll:()=>(this.onScroll(),!1),hover:(t,e)=>(this.positioner(this.getBaseProps("hover",{hover:e})),!1),contextmenu:(t,e)=>(this.positioner(this.getBaseProps("contextmenu",{contextmenu:e})),!1)}}onStateUpdate(t){this.positioner({...t,previousState:t.firstUpdate?void 0:t.previousState,event:"state",helpers:this.store.helpers})}createDecorations(t){if(this.element??(this.element=this.createElement()),!this.element.hasChildNodes())return Qe.empty;const e=kt.widget(0,this.element,{key:"positioner-widget",side:-1,stopEvent:()=>!0});return Qe.create(t.doc,[e])}forceUpdatePositioners(t=mP){return({tr:e,dispatch:n})=>(n==null||n(e.setMeta(hP,{key:t})),!0)}getPositionerWidget(){return this.element??(this.element=this.createElement())}createElement(){const t=document.createElement("span");return t.dataset.id=sX,t.setAttribute("role","presentation"),t}triggerPositioner(t,e){t.hasChanged(e)&&t.onActiveChanged({...e,view:this.store.view})}positioner(t){for(const e of this.positioners)e.events.includes(t.event)&&this.triggerPositioner(e,t)}getBaseProps(t,e){const n=this.store.getState(),r=this.store.previousState;return{helpers:this.store.helpers,event:t,firstUpdate:!1,previousState:r,state:n,...e}}onScroll(){this.positioner(this.getBaseProps("scroll",{scroll:{scrollTop:this.store.view.dom.scrollTop}}))}};$b([ue()],af.prototype,"forceUpdatePositioners",1);$b([At()],af.prototype,"getPositionerWidget",1);af=$b([Ze({defaultOptions:{scrollDebounce:100},customHandlerKeys:["positioner"],staticKeys:["scrollDebounce"]})],af);var uX=Object.defineProperty,dX=Object.getOwnPropertyDescriptor,fX=(t,e,n,r)=>{for(var o=r>1?void 0:r?dX(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&uX(e,n,o),o},cx=class extends Fr{get name(){return"text"}createTags(){return[Ie.InlineNode]}createNodeSpec(){return{}}};cx=fX([Ze({disableExtraAttributes:!0,defaultPriority:at.Medium})],cx);var pX={...Tc.defaultOptions,...Ha.defaultOptions,...Bo.defaultOptions,excludeExtensions:[]};function hX(t={}){t={...pX,...t};const{content:e,depth:n,getDispatch:r,getState:o,newGroupDelay:i,excludeExtensions:s}=t,a={};for(const c of s??[])a[c]=!0;const l=[];if(!a.history){const c=new Bo({depth:n,getDispatch:r,getState:o,newGroupDelay:i});l.push(c)}return a.doc||l.push(new Tc({content:e})),a.text||l.push(new cx),a.paragraph||l.push(new Ha),a.positioner||l.push(new af),a.gapCursor||l.push(new ax),a.events||l.push(new vm),l}var mX=Object.defineProperty,gX=Object.getOwnPropertyDescriptor,vX=(t,e,n,r)=>{for(var o=r>1?void 0:r?gX(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&mX(e,n,o),o},Wa=class extends St{get name(){return"placeholder"}createAttributes(){return{"aria-placeholder":this.options.placeholder}}createPlugin(){return{state:{init:(t,e)=>({...this.options,empty:bb(e.doc,{ignoreAttributes:!0})}),apply:(t,e,n,r)=>yX({pluginState:e,tr:t,extension:this,state:r})},props:{decorations:t=>xX({state:t,extension:this})}}}onSetOptions(t){const{changes:e}=t;e.placeholder.changed&&this.store.phase>=Kn.EditorView&&this.store.updateAttributes()}};Wa=vX([Ze({defaultOptions:{emptyNodeClass:KJ.IS_EMPTY,placeholder:""}})],Wa);function yX(t){const{pluginState:e,extension:n,tr:r,state:o}=t;return r.docChanged?{...n.options,empty:bb(o.doc)}:e}function xX(t){const{extension:e,state:n}=t,{empty:r}=e.pluginKey.getState(n),{emptyNodeClass:o,placeholder:i}=e.options;if(!r)return null;const s=[];return n.doc.descendants((a,l)=>{const c=kt.node(l,l+a.nodeSize,{class:o,"data-placeholder":i});s.push(c)}),Qe.create(n.doc,s)}var bX=Object.defineProperty,wX=Object.getOwnPropertyDescriptor,kX=(t,e,n,r)=>{for(var o=r>1?void 0:r?wX(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&bX(e,n,o),o},SX={...Wa.defaultOptions,...rf.defaultOptions},EX=[...Wa.staticKeys,...rf.staticKeys],lf=class extends St{get name(){return"react"}onSetOptions(t){const{pickChanged:e}=t;this.getExtension(Wa).setOptions(e(["placeholder"]))}createExtensions(){const{emptyNodeClass:t,placeholder:e,defaultBlockNode:n,defaultContentNode:r,defaultEnvironment:o,defaultInlineNode:i,nodeViewComponents:s}=this.options;return[new Wa({emptyNodeClass:t,placeholder:e,priority:at.Low}),new rf({defaultBlockNode:n,defaultContentNode:r,defaultEnvironment:o,defaultInlineNode:i,nodeViewComponents:s})]}};lf=kX([Ze({defaultOptions:SX,staticKeys:EX})],lf);var yP={};Object.defineProperty(yP,"__esModule",{value:!0});function _X(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(t.length===2)return p_(t[0],t[1])||null;var n=t.slice(1).reduce(function(r,o){return p_(r,o)},t[0]);return n||null}var fu=yP.default=_X,f_=new WeakMap;function p_(t,e){if(t&&e){var n=f_.get(t)||new WeakMap;f_.set(t,n);var r=n.get(e)||function(o){h_(t,o),h_(e,o)};return n.set(e,r),r}return t||e}function h_(t,e){typeof t=="function"?t(e):t.current=e}var xP=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},ny=(t,e,n)=>(xP(t,e,"read from private field"),n?n.call(t):e.get(t)),CX=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},TX=(t,e,n,r)=>(xP(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);function OX(){const[,t]=h.useState(pe());return h.useCallback(()=>{t(pe())},[])}var bP=h.createContext(null);function Kc(t){const e=h.useContext(bP),n=h.useRef(OX());ve(e,{code:K.REACT_PROVIDER_CONTEXT});const{addHandler:r}=e;return h.useEffect(()=>{let o=t;if(o){if(el(o)){const{autoUpdate:i}=o;o=i?()=>n.current():void 0}if(dt(o))return r("updated",o)}},[r,t]),e}function MX(t=!0){return Kc({autoUpdate:t}).active}function RX(t=!1){return Kc(t?{autoUpdate:!0}:void 0).attrs}function Ib(){return Kc().chain.new()}function NX(t,e=void 0,n){const{getExtension:r}=Kc(),o=h.useMemo(()=>r(t),[t,r]);let i;if(dt(e)?i=n?[o,...n]:[o,e]:i=e?[o,...Object.values(e)]:[],h.useEffect(()=>{dt(e)||!e||o.setOptions(e)},i),h.useEffect(()=>{if(dt(e))return e({addHandler:o.addHandler.bind(o),addCustomHandler:o.addCustomHandler.bind(o),extension:o})},i),!e)return o}function PX(t,e,n){const r=h.useCallback(({addHandler:o})=>o(e,n),[n,e]);return NX(t,r)}function $X(t){PX(hm,"docChanged",t)}function AX(t=!1){return Kc(t?{autoUpdate:!0}:void 0).helpers}var[IX,Joe]=TW(({props:t})=>{const e=t.locale??"en",n=t.i18n??Dg,r=t.supportedLocales??[e],o=n._.bind(n);return{locale:e,i18n:n,supportedLocales:r,t:o}});function m_(t,e={}){const{core:n,react:r,...o}=e;return mW(t)?t:hW.create(()=>[...tR(t),new lf(r),...hX(n)],o)}function DX(t,e={}){const n=h.useRef(t),r=h.useRef(e),[o,i]=h.useState(()=>m_(t,e));return n.current=t,r.current=e,h.useEffect(()=>o.addHandler("destroy",()=>{i(()=>m_(n.current,r.current))}),[o]),o}var LX=typeof fu=="object"&&fu.__esModule&&fu.default?fu.default:fu,Ml,jX=class extends cW{constructor(t){if(super(t),CX(this,Ml,void 0),this.rootPropsConfig={called:!1,count:0},this.getRootProps=e=>this.internalGetRootProps(e,null),this.internalGetRootProps=(e,n)=>{this.rootPropsConfig.called=!0;const{refKey:r="ref",ref:o,...i}=e??pe();return{[r]:LX(o,this.onRef),key:this.uid,...i,children:n}},this.onRef=e=>{e&&(this.rootPropsConfig.count+=1,ve(this.rootPropsConfig.count<=1,{code:K.REACT_GET_ROOT_PROPS,message:`Called ${this.rootPropsConfig.count} times`}),TX(this,Ml,e),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(Wa).setOptions({placeholder:this.props.placeholder??""})}get name(){return"react"}update(t){return super.update(t),this}createView(t){return new TU(null,{state:t,dispatchTransaction:this.dispatchTransaction,attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0,plugins:[]})}updateState({state:t,...e}){const{triggerChange:n=!0,tr:r,transactions:o}=e;if(this.props.state){const{onChange:i}=this.props;ve(i,{code:K.REACT_CONTROLLED,message:"You are required to provide the `onChange` handler when creating a controlled editor."}),ve(n,{code:K.REACT_CONTROLLED,message:"Controlled editors do not support `clearContent` or `setContent` where `triggerChange` is `true`. Update the `state` prop instead."}),this.previousStateOverride||(this.previousStateOverride=this.getState()),this.onChange({state:t,tr:r,transactions:o});return}!r&&!o&&(t=t.apply(t.tr.setMeta(NS,{}))),this.view.updateState(t),n&&(o==null?void 0:o.length)!==0&&this.onChange({state:t,tr:r,transactions:o}),this.manager.onStateUpdate({previousState:this.previousState,state:t,tr:r,transactions:o})}updateControlledState(t,e){this.previousStateOverride=e,t=t.apply(t.tr.setMeta(NS,{})),this.view.updateState(t),this.manager.onStateUpdate({previousState:this.previousState,state:t}),this.previousStateOverride=void 0}addProsemirrorViewToDom(t,e){this.props.insertPosition==="start"?t.insertBefore(e,t.firstChild):t.append(e)}onRefLoad(){ve(ny(this,Ml),{code:K.REACT_EDITOR_VIEW,message:"Something went wrong when initializing the text editor. Please check your setup."});const{autoFocus:t}=this.props;this.addProsemirrorViewToDom(ny(this,Ml),this.view.dom),t&&this.focus(t),this.onChange(),this.addFocusListeners()}onUpdate(){this.view&&ny(this,Ml)&&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}};Ml=new WeakMap;var wP=typeof document<"u"?h.useLayoutEffect:h.useEffect;function zX(t){const e=h.useRef();return wP(()=>{e.current=t}),e.current}function FX(t){const{manager:e,state:n}=t,{placeholder:r,editable:o}=t;h.useRef(!0).current&&!$s(r)&&e.getExtension(lf).setOptions({placeholder:r}),h.useEffect(()=>{r!=null&&e.getExtension(lf).setOptions({placeholder:r})},[r,e]);const[s]=h.useState(()=>{if(n)return n;const l=e.createEmptyDoc(),[c,u]=Gt(t.initialContent)?t.initialContent:[t.initialContent??l];return e.createState({content:c,selection:u})}),a=BX({initialEditorState:s,getProps:()=>t});return h.useEffect(()=>()=>{a.destroy()},[a]),h.useEffect(()=>{a.onUpdate()},[o,a]),UX(a),a.frameworkOutput}function BX(t){const e=h.useRef(t);e.current=t;const n=h.useMemo(()=>new jX(e.current),[]);return n.update(t),n}function UX(t){const{state:e}=t.props,n=h.useRef(!!e),r=zX(e);wP(()=>{const o=e?n.current===!0:n.current===!1;ve(o,{code:K.REACT_CONTROLLED,message:n.current?"You have attempted to switch from a controlled to an uncontrolled editor. Once you set up an editor as a controlled editor it must always provide a `state` prop.":"You have provided a `state` prop to an uncontrolled editor. In order to set up your editor as controlled you must provide the `state` prop from the very first render."}),!(!e||e===r)&&t.updateControlledState(e,r??void 0)},[e,r,t])}function VX(t={}){const{content:e,document:n,selection:r,extensions:o,...i}=t,s=DX(o??(()=>[]),i),[a,l]=h.useState(()=>s.createState({selection:r,content:e??s.createEmptyDoc()})),c=h.useCallback(({state:d})=>{l(d)},[]),u=h.useCallback(()=>s.output,[s]);return h.useMemo(()=>({state:a,setState:l,manager:s,onChange:c,getContext:u}),[u,s,c,a])}var HX=({onChange:t})=>{const{getJSON:e}=AX();return $X(h.useCallback(({state:n})=>{const r=e(n);t(r)},[t,e])),null},ux=()=>oe.createElement("div",{className:AJ.EDITOR_WRAPPER,...Kc().getRootProps()}),WX=t=>(t.hook(),null);function KX(t){const{children:e,autoRender:n,i18n:r,locale:o,supportedLocales:i,hooks:s=[],...a}=t,l=FX(a),c=wW(l.portalContainer),u=n==="start"||n===!0||!e&&$s(n),d=n==="end";return oe.createElement(IX,{i18n:r,locale:o,supportedLocales:i},oe.createElement(bP.Provider,{value:l},oe.createElement(bW,{portals:c}),s.map((f,p)=>oe.createElement(WX,{hook:f,key:p})),u&&oe.createElement(ux,null),e,d&&oe.createElement(ux,null)))}function qX(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),a=!1,l=s;if(!s)return!1;if(s.depth>=2&&o.node(s.depth-1).type.compatibleContent(t)&&s.startIndex==0){if(o.index(s.depth-1)==0)return!1;let u=n.doc.resolve(s.start-2);l=new Fa(u,u,s.depth),s.endIndex<s.parent.childCount&&(s=new Fa(o,n.doc.resolve(i.end(s.depth)),s.depth)),a=!0}let c=eb(l,t,e,s);return c?(r&&r(GX(n.tr,s,c,a,t).scrollIntoView()),!0):!1}}function GX(t,e,n,r,o){let i=F.empty;for(let u=n.length-1;u>=0;u--)i=F.from(n[u].type.create(n[u].attrs,i));t.step(new zt(e.start-(r?2:0),e.end,e.start,e.end,new J(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=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&tc(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function YX(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?ZX(e,n,t,i):JX(e,n,i):!0:!1}}function ZX(t,e,n,r){let o=t.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new zt(i-1,s,i,s,new J(F.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Fa(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=Bc(r);if(a==null)return!1;o.lift(r,a);let l=o.mapping.map(i,-1)-1;return Pf(o.doc,l)&&o.join(l),e(o.scrollIntoView()),!0}function JX(t,e,n){let r=t.tr,o=n.parent;for(let p=n.end,m=n.endIndex-1,g=n.startIndex;m>g;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?F.empty:F.from(o))))return!1;let d=i.pos,f=d+s.nodeSize;return r.step(new zt(d-(a?1:0),f+(l?1:0),d+1,f-1,new J((a?F.empty:F.from(o.copy(F.empty))).append(l?F.empty:F.from(o.copy(F.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}var XX=Object.defineProperty,QX=Object.getOwnPropertyDescriptor,Br=(t,e,n,r)=>{for(var o=r>1?void 0:r?QX(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&XX(e,n,o),o};function dx(t){var e;return!!((e=t.spec.group)!=null&&e.includes(Ie.ListContainerNode))}function eQ(t){var e;return!!((e=t.spec.group)!=null&&e.includes(Ie.ListItemNode))}function js(t){return dx(t.type)}function Es(t){return eQ(t.type)}function Db(t,e){return n=>{const{dispatch:r,tr:o}=n,i=mb(o,n.state),{$from:s,$to:a}=o.selection,l=s.blockRange(a);if(!l)return!1;const c=Og({predicate:u=>dx(u.type),selection:o.selection});if(c&&l.depth-c.depth<=1&&l.startIndex===0){if(c.node.type===t)return EP(e)(n);if(dx(c.node.type))return t.validContent(c.node.content)?(r==null||r(o.setNodeMarkup(c.pos,t)),!0):tQ(o,c,t,e)?(r==null||r(o.scrollIntoView()),!0):!1}return qX(t)(i,r)}}function kP(t,e=["checked"]){return function({tr:n,dispatch:r,state:o}){var i,s;const a=fV(t,o.schema),{$from:l,$to:c}=n.selection;if(Rg(n.selection)&&n.selection.node.isBlock||l.depth<2||!l.sameParent(c))return!1;const u=l.node(-1);if(u.type!==a)return!1;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(r){const g=l.index(-1)>0;let y=F.empty;for(let w=l.depth-(g?1:2);w>=l.depth-3;w--)y=F.from(l.node(w).copy(y));const v=((i=a.contentMatch.defaultType)==null?void 0:i.createAndFill())||void 0;y=y.append(F.from(a.createAndFill(null,v)||void 0));const x=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3;n.replace(l.before(g?void 0:-1),l.after(-x),new J(y,g?3:2,2)),n.setSelection(n.selection.constructor.near(n.doc.resolve(l.pos+(g?3:2)))),r(n.scrollIntoView())}return!0}if(u.attrs.closed&&l.sameParent(c)&&c.pos===c.end()){if(r){const g=l.after(-1),y=((s=a.contentMatch.defaultType)==null?void 0:s.createAndFill())||void 0,v=a.createAndFill(null,y);v&&(n.insert(g,v),n.setSelection(Ce.near(n.doc.resolve(g+1)))),n.delete(l.pos,c.pos),r(n.scrollIntoView())}return!0}const d=Object.fromEntries(Object.entries(u.attrs).filter(([g])=>!e.includes(g))),f=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,p={...l.node().attrs};n.delete(l.pos,c.pos);const m=f?[{type:a,attrs:d},{type:f,attrs:p}]:[{type:a,attrs:d}];return tc(n.doc,l.pos,2)?(r&&r(n.split(l.pos,2,m).scrollIntoView()),!0):!1}}function tQ(t,e,n,r){const o=e.node,i=t.doc.resolve(e.start),s=i.node(-1),a=i.index(-1);if(!s||!s.canReplace(a,a+1,F.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 g=r.createChecked(null,m.content);l.push(g)}const c=n.createChecked(null,l),u=e.pos,d=u+o.nodeSize,f=t.selection.from;return t.replaceRangeWith(u,d,c),t.setSelection(t.selection.constructor.near(t.doc.resolve(f))),!0}function nQ({listType:t,itemType:e,tr:n,range:r}){var o;const i=r.parent,s=n.doc.slice(r.start,r.end);if(i.type===t&&((o=s.content.firstChild)==null?void 0:o.type)===e)return!1;const a=[];for(let c=0;c<s.content.childCount;c++){const u=s.content.child(c);if(!e.validContent(u.content))return!1;const d=e.createChecked(null,u.content);a.push(d)}const l=t.createChecked(null,a);return n.replaceRange(r.start,r.end,new J(F.from(l),0,0)),!0}function Oc({listType:t,itemType:e,tr:n}){const r=bm(n.selection);if(!r)return!1;const o=r.startIndex===0,{from:i,to:s}=n.selection;return nQ({listType:t,itemType:e,tr:n,range:r})?(n.setSelection(Ce.between(n.doc.resolve(o?i:i+2),n.doc.resolve(o?s:s+2))),n.scrollIntoView(),!0):!1}function rQ(t,e,n){const r=t.tr,o=n.parent,i=r.mapping.maps.length;for(let m=n.end,g=n.endIndex-1,y=n.startIndex;g>y;g--)m-=o.child(g).nodeSize,r.delete(m-1,m+1);const s=r.doc.resolve(n.start),a=s.nodeAfter;if(!a||r.mapping.slice(i).map(n.end)!==n.start+a.nodeSize)return!1;const l=n.startIndex===0,c=n.endIndex===o.childCount,u=s.node(-1),d=s.index(-1);if(!u.canReplace(d+(l?0:1),d+1,a.content.append(c?F.empty:F.from(o))))return!1;const f=s.pos,p=f+a.nodeSize;return r.step(new zt(f-(l?1:0),p+(c?1:0),f+1,p-1,new J((l?F.empty:F.from(o.copy(F.empty))).append(c?F.empty:F.from(o.copy(F.empty))),l?0:1,c?0:1),l?0:1)),e(r.scrollIntoView()),!0}function SP(t,e){const n=e||t.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&&js(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&&js(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)Pf(t.doc,c)&&(t.join(c),l=!0);return l}function EP(t){return e=>{const{dispatch:n,tr:r}=e,o=mb(r,e.state),i=oQ(t,r.selection);return i?(n&&rQ(o,n,i),!0):!1}}function oQ(t,e){const{$from:n,$to:r}=e;return n.blockRange(r,i=>{var s;return((s=i.firstChild)==null?void 0:s.type)===t})}function bm(t){const{$from:e,$to:n}=t;return e.blockRange(n,js)}function iQ(t){const e=t.selection.$from,n=e.blockRange();if(!n||!Es(n.parent)||n.startIndex!==0)return!1;const r=e.node(n.depth-2),o=e.index(n.depth),i=e.index(n.depth-1),s=e.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&&js(a)&&l&&Es(l))return Oc({listType:a.type,itemType:l.type,tr:t});if(Es(r)){const c=r,u=e.node(n.depth-3);if(js(u))return Oc({listType:u.type,itemType:c.type,tr:t})}return!1}function g_({view:t}){if(!t)return!1;{const e=t.state.selection.$cursor;if(!e||e.parentOffset>0)return!1;const n=e.blockRange();if(!n||!Es(n.parent)||n.startIndex!==0)return!1}{const e=t.state.tr;iQ(e)&&t.dispatch(e)}{const e=t.state.selection.$cursor;if(!e||e.parentOffset>0)return!1;const n=e.blockRange();if(!n||!Es(n.parent)||n.startIndex!==0)return!1;const r=e.index(n.depth),o=e.index(n.depth-1),i=e.index(n.depth-2),s=n.depth-2>=1&&Es(e.node(n.depth-2));r===0&&o===0&&i<=1&&s&&YX(n.parent.type)(t.state,t.dispatch)}return jN(t.state,t.dispatch,t),!0}function _P({node:t,mark:e,updateDOM:n,updateMark:r}){const o=document.createElement("label");o.contentEditable="false",o.classList.add(Ls.LIST_ITEM_MARKER_CONTAINER),o.append(e);const i=document.createElement("div"),s=document.createElement("li");s.classList.add(Ls.LIST_ITEM_WITH_CUSTOM_MARKER),s.append(o),s.append(i);const a=l=>l.type!==t.type?!1:(t=l,n(t,s),r(t,e),!0);return a(t),{dom:s,contentDOM:i,update:a}}function sQ(t,e){const n=t.node(e.depth-1),r=t.node(e.depth-2);return!Es(n)||!js(r)?!1:{parentItem:n,parentList:r}}function aQ(t,e){const n=e.parent,r=e.parent.child(e.endIndex-1),o=e.end,i=e.$to.end(e.depth);return o<i?(t.step(new zt(o-1,i,o,i,new J(F.from(r.type.create(null,n.copy())),1,0),1,!0)),new Fa(t.doc.resolve(e.$from.pos),t.doc.resolve(i),e.depth)):e}function lQ(t,e){const n=e.parent,r=e.parent.child(e.endIndex-1),o=e.end,i=e.$to.end(e.depth-1);return o+1<i?(t.step(new zt(o-1,i,o+1,i,new J(F.from(n.type.create(null,r.type.create(null))),2,0),0,!0)),new Fa(t.selection.$from,t.selection.$to,e.depth)):e}function cQ(t,e,n,r){return Oc({listType:n.type,itemType:r.type,tr:t})?new Fa(t.selection.$from,t.selection.$to,e.depth):e}function uQ(t){let e=bm(t.selection);if(!e)return!1;const n=sQ(t.selection.$from,e);if(!n)return!1;const{parentItem:r,parentList:o}=n;e=aQ(t,e),e=lQ(t,e),e=cQ(t,e,o,r);const i=Bc(e);return typeof i!="number"||(t.lift(e,i),e=bm(t.selection),e&&SP(t,t.doc.resolve(e.end-2))),!0}var dQ=({tr:t,dispatch:e})=>uQ(t)?(e==null||e(t.scrollIntoView()),!0):!1;function fQ(t,e,n){let r,o,i,s;const a=e.doc;if(n.startIndex>=1){r=t.child(n.startIndex-1),o=t,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=e.index(n.depth-1);if(l>=1){const c=e.node(n.depth-1),u=e.start(n.depth-1);if(o=c.child(l-1),!js(o))return!1;s=u+1;for(let d=0;d<l-1;d++)s+=c.child(d).nodeSize;if(r=o.child(o.childCount-1),i=s+o.nodeSize-r.nodeSize-1,!Es(r))return!1}else return!1}return{previousItem:r,previousList:o,previousItemStart:i,previousListStart:s}}function pQ(t,e,n){let r,o;const i=n.start,s=e.depth>=n.depth+2?e.end(n.depth+2):n.end-1,a=n.end;return s+1>=a?(r=t.slice(i,a),o=null):(r=t.slice(i,s),o=t.slice(s+1,a-1)),{selectedSlice:r,unselectedSlice:o}}function hQ(t){const{$from:e,$to:n}=t.selection,r=bm(t.selection);if(!r)return!1;const o=t.doc.resolve(r.start).node();if(!js(o))return!1;const i=fQ(o,e,r);if(!i)return!1;const{previousItem:s,previousList:a,previousItemStart:l}=i,{selectedSlice:c,unselectedSlice:u}=pQ(t.doc,n,r),d=s.content.append(F.fromArray([o.copy(c.content)])).append(u?u.content:F.empty);t.deleteRange(r.start,r.end);const f=l+s.nodeSize-2,p=s.copy(d);return p.check(),t.replaceRangeWith(l-1,f+1,p),t.setSelection(a===o?Ce.between(t.doc.resolve(e.pos),t.doc.resolve(n.pos)):Ce.between(t.doc.resolve(e.pos-2),t.doc.resolve(n.pos-2))),!0}var mQ=({tr:t,dispatch:e})=>hQ(t)?(e==null||e(t.scrollIntoView()),!0):!1,CP=class extends St{get name(){return"listItemShared"}createKeymap(){const t={Tab:mQ,"Shift-Tab":dQ,Backspace:g_,"Mod-Backspace":g_};if(Qr.isMac){const e={"Ctrl-h":t.Backspace,"Alt-Backspace":t["Mod-Backspace"]};return{...t,...e}}return t}createPlugin(){return{appendTransaction:(t,e,n)=>{const r=n.tr;return SP(r)?r:null}}}},Mc=class extends Fr{get name(){return"listItem"}createTags(){return[Ie.ListItemNode]}createNodeSpec(t,e){return{content:"paragraph block*",defining:!0,draggable:!1,...e,attrs:{...t.defaults(),closed:{default:!1},nested:{default:!1}},parseDOM:[{tag:"li",getAttrs:t.parse,priority:at.Lowest},...e.parseDOM??[]],toDOM:n=>["li",t.dom(n),0]}}createNodeViews(){return this.options.enableCollapsible?(t,e,n)=>{const r=document.createElement("div");return r.classList.add(Ls.COLLAPSIBLE_LIST_ITEM_BUTTON),r.contentEditable="false",r.addEventListener("click",()=>{if(r.classList.contains("disabled"))return;const o=n(),i=ye.create(e.state.doc,o);return e.dispatch(e.state.tr.setSelection(i)),this.store.commands.toggleListItemClosed(),!0}),_P({mark:r,node:t,updateDOM:gQ,updateMark:vQ})}:{}}createKeymap(){return{Enter:kP(this.type)}}createExtensions(){return[new CP]}toggleListItemClosed(t){return({state:{tr:e,selection:n},dispatch:r})=>{if(!Rg(n)||n.node.type.name!==this.name)return!1;const{node:o,from:i}=n;return t=fz(t)?t:!o.attrs.closed,r==null||r(e.setNodeMarkup(i,void 0,{...o.attrs,closed:t})),!0}}liftListItemOutOfList(t){return EP(t??this.type)}};Br([ue()],Mc.prototype,"toggleListItemClosed",1);Br([ue()],Mc.prototype,"liftListItemOutOfList",1);Mc=Br([Ze({defaultOptions:{enableCollapsible:!1},staticKeys:["enableCollapsible"]})],Mc);function gQ(t,e){t.attrs.closed?e.classList.add(Ls.COLLAPSIBLE_LIST_ITEM_CLOSED):e.classList.remove(Ls.COLLAPSIBLE_LIST_ITEM_CLOSED)}function vQ(t,e){t.childCount<=1?e.classList.add("disabled"):e.classList.remove("disabled")}var cf=class extends Fr{get name(){return"bulletList"}createTags(){return[Ie.Block,Ie.ListContainerNode]}createNodeSpec(t,e){return{content:"listItem+",...e,attrs:t.defaults(),parseDOM:[{tag:"ul",getAttrs:t.parse},...e.parseDOM??[]],toDOM:n=>["ul",t.dom(n),0]}}createNodeViews(){return this.options.enableSpine?(t,e,n)=>{var r;const o=document.createElement("div");o.style.position="relative";const i=n(),s=e.state.doc.resolve(i+1),a=s.node(s.depth-1);if(!(((r=a==null?void 0:a.type)==null?void 0:r.name)!=="listItem")){const u=document.createElement("div");u.contentEditable="false",u.classList.add(Ls.LIST_SPINE),u.addEventListener("click",d=>{const f=n(),p=e.state.doc.resolve(f+1),m=p.start(p.depth-1),g=ye.create(e.state.doc,m-1);e.dispatch(e.state.tr.setSelection(g)),this.store.commands.toggleListItemClosed(),d.preventDefault(),d.stopPropagation()}),o.append(u)}const c=document.createElement("ul");return c.classList.add(Ls.UL_LIST_CONTENT),o.append(c),{dom:o,contentDOM:c}}:{}}createExtensions(){return[new Mc({priority:at.Low,enableCollapsible:this.options.enableSpine})]}toggleBulletList(){return Db(this.type,Tt(this.store.schema.nodes,"listItem"))}listShortcut(t){return this.toggleBulletList()(t)}createInputRules(){const t=/^\s*([*+-])\s$/;return[ob(t,this.type),new zr(t,(e,n,r,o)=>{const i=e.tr;return i.deleteRange(r,o),Oc({listType:this.type,itemType:Tt(this.store.schema.nodes,"listItem"),tr:i})?i:null})]}};Br([ue({icon:"listUnordered",label:({t})=>t(rb.BULLET_LIST_LABEL)})],cf.prototype,"toggleBulletList",1);Br([wr({shortcut:q.BulletList,command:"toggleBulletList"})],cf.prototype,"listShortcut",1);cf=Br([Ze({defaultOptions:{enableSpine:!1},staticKeys:["enableSpine"]})],cf);var uf=class extends Fr{get name(){return"orderedList"}createTags(){return[Ie.Block,Ie.ListContainerNode]}createNodeSpec(t,e){return{content:"listItem+",...e,attrs:{...t.defaults(),order:{default:1}},parseDOM:[{tag:"ol",getAttrs:n=>Fo(n)?{...t.parse(n),order:+(n.getAttribute("start")??1)}:{}},...e.parseDOM??[]],toDOM:n=>{const r=t.dom(n);return n.attrs.order===1?["ol",r,0]:["ol",{...r,start:n.attrs.order},0]}}}createExtensions(){return[new Mc({priority:at.Low})]}toggleOrderedList(){return Db(this.type,Tt(this.store.schema.nodes,"listItem"))}listShortcut(t){return this.toggleOrderedList()(t)}createInputRules(){const t=/^(\d+)\.\s$/;return[ob(t,this.type,e=>({order:+Tt(e,1)}),(e,n)=>n.childCount+n.attrs.order===+Tt(e,1)),new zr(t,(e,n,r,o)=>{const i=e.tr;if(i.deleteRange(r,o),!Oc({listType:this.type,itemType:Tt(this.store.schema.nodes,"listItem"),tr:i}))return null;const a=+Tt(n,1);if(a!==1){const l=ef({selection:i.selection,types:this.type});l&&i.setNodeMarkup(l.pos,void 0,{order:a})}return i})]}};Br([ue({icon:"listOrdered",label:({t})=>t(rb.ORDERED_LIST_LABEL)})],uf.prototype,"toggleOrderedList",1);Br([wr({shortcut:q.OrderedList,command:"toggleOrderedList"})],uf.prototype,"listShortcut",1);uf=Br([Ze({})],uf);var TP=class extends Fr{get name(){return"taskListItem"}createTags(){return[Ie.ListItemNode]}createNodeSpec(t,e){return{content:"paragraph block*",defining:!0,draggable:!1,...e,attrs:{...t.defaults(),checked:{default:!1}},parseDOM:[{tag:"li[data-task-list-item]",getAttrs:n=>{let r=!1;return Fo(n)&&n.getAttribute("data-checked")!==null&&(r=!0),{checked:r,...t.parse(n)}},priority:at.Medium},...e.parseDOM??[]],toDOM:n=>["li",{...t.dom(n),"data-task-list-item":"","data-checked":n.attrs.checked?"":void 0},0]}}createNodeViews(){return(t,e,n)=>{const r=document.createElement("input");return r.type="checkbox",r.classList.add(Ls.LIST_ITEM_CHECKBOX),r.contentEditable="false",r.addEventListener("click",o=>{e.editable||o.preventDefault()}),r.addEventListener("change",()=>{const o=n(),i=e.state.doc.resolve(o+1);this.store.commands.toggleCheckboxChecked({$pos:i})}),r.checked=t.attrs.checked,_P({node:t,mark:r,updateDOM:yQ,updateMark:xQ})}}createKeymap(){return{Enter:kP(this.type)}}createExtensions(){return[new CP]}toggleCheckboxChecked(t){let e,n;return typeof t=="boolean"?e=t:t&&(e=t.checked,n=t.$pos),({tr:r,dispatch:o})=>{const i=ef({selection:n??r.selection.$from,types:this.type});if(!i)return!1;const{node:s,pos:a}=i,l={...s.attrs,checked:e??!s.attrs.checked};return o==null||o(r.setNodeMarkup(a,void 0,l)),!0}}createInputRules(){const t=/^\s*(\[( ?|x|X)]\s)$/;return[ob(t,this.type,e=>({checked:["x","X"].includes(cd(e,2))})),new zr(t,(e,n,r,o)=>{const i=e.tr;if(i.deleteRange(r,o),!Oc({listType:Tt(this.store.schema.nodes,"taskList"),itemType:this.type,tr:i}))return null;const a=["x","X"].includes(cd(n,2));if(a){const l=ef({selection:i.selection,types:this.type});l&&i.setNodeMarkup(l.pos,void 0,{checked:a})}return i})]}};Br([ue()],TP.prototype,"toggleCheckboxChecked",1);function yQ(t,e){t.attrs.checked?e.setAttribute("data-checked",""):e.removeAttribute("data-checked"),e.setAttribute("data-task-list-item","")}function xQ(t,e){e.checked=!!t.attrs.checked}var OP=class extends Fr{get name(){return"taskList"}createTags(){return[Ie.Block,Ie.ListContainerNode]}createNodeSpec(t,e){return{content:"taskListItem+",...e,attrs:t.defaults(),parseDOM:[{tag:"ul[data-task-list]",getAttrs:t.parse,priority:at.Medium},...e.parseDOM??[]],toDOM:n=>["ul",{...t.dom(n),"data-task-list":""},0]}}createExtensions(){return[new TP({})]}toggleTaskList(){return Db(this.type,Tt(this.store.schema.nodes,"taskListItem"))}listShortcut(t){return this.toggleTaskList()(t)}};Br([ue({icon:"checkboxMultipleLine",label:({t})=>t(rb.TASK_LIST_LABEL)})],OP.prototype,"toggleTaskList",1);Br([wr({shortcut:q.TaskList,command:"toggleTaskList"})],OP.prototype,"listShortcut",1);const ry="rovingFocusGroup.onEntryFocus",bQ={bubbles:!1,cancelable:!0},Lb="RovingFocusGroup",[fx,MP,wQ]=dg(Lb),[kQ,RP]=Lr(Lb,[wQ]),[SQ,EQ]=kQ(Lb),_Q=h.forwardRef((t,e)=>h.createElement(fx.Provider,{scope:t.__scopeRovingFocusGroup},h.createElement(fx.Slot,{scope:t.__scopeRovingFocusGroup},h.createElement(CQ,z({},t,{ref:e}))))),CQ=h.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,...u}=t,d=h.useRef(null),f=We(e,d),p=_f(i),[m=null,g]=Ao({prop:s,defaultProp:a,onChange:l}),[y,v]=h.useState(!1),x=rn(c),w=MP(n),S=h.useRef(!1),[_,k]=h.useState(0);return h.useEffect(()=>{const E=d.current;if(E)return E.addEventListener(ry,x),()=>E.removeEventListener(ry,x)},[x]),h.createElement(SQ,{scope:n,orientation:r,dir:p,loop:o,currentTabStopId:m,onItemFocus:h.useCallback(E=>g(E),[g]),onItemShiftTab:h.useCallback(()=>v(!0),[]),onFocusableItemAdd:h.useCallback(()=>k(E=>E+1),[]),onFocusableItemRemove:h.useCallback(()=>k(E=>E-1),[])},h.createElement(Re.div,z({tabIndex:y||_===0?-1:0,"data-orientation":r},u,{ref:f,style:{outline:"none",...t.style},onMouseDown:se(t.onMouseDown,()=>{S.current=!0}),onFocus:se(t.onFocus,E=>{const C=!S.current;if(E.target===E.currentTarget&&C&&!y){const T=new CustomEvent(ry,bQ);if(E.currentTarget.dispatchEvent(T),!T.defaultPrevented){const A=w().filter(G=>G.focusable),B=A.find(G=>G.active),D=A.find(G=>G.id===m),U=[B,D,...A].filter(Boolean).map(G=>G.ref.current);NP(U)}}S.current=!1}),onBlur:se(t.onBlur,()=>v(!1))})))}),TQ="RovingFocusGroupItem",OQ=h.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=t,a=ao(),l=i||a,c=EQ(TQ,n),u=c.currentTabStopId===l,d=MP(n),{onFocusableItemAdd:f,onFocusableItemRemove:p}=c;return h.useEffect(()=>{if(r)return f(),()=>p()},[r,f,p]),h.createElement(fx.ItemSlot,{scope:n,id:l,focusable:r,active:o},h.createElement(Re.span,z({tabIndex:u?0:-1,"data-orientation":c.orientation},s,{ref:e,onMouseDown:se(t.onMouseDown,m=>{r?c.onItemFocus(l):m.preventDefault()}),onFocus:se(t.onFocus,()=>c.onItemFocus(l)),onKeyDown:se(t.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){c.onItemShiftTab();return}if(m.target!==m.currentTarget)return;const g=NQ(m,c.orientation,c.dir);if(g!==void 0){m.preventDefault();let v=d().filter(x=>x.focusable).map(x=>x.ref.current);if(g==="last")v.reverse();else if(g==="prev"||g==="next"){g==="prev"&&v.reverse();const x=v.indexOf(m.currentTarget);v=c.loop?PQ(v,x+1):v.slice(x+1)}setTimeout(()=>NP(v))}})})))}),MQ={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function RQ(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function NQ(t,e,n){const r=RQ(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return MQ[r]}function NP(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function PQ(t,e){return t.map((n,r)=>t[(e+r)%t.length])}const $Q=_Q,AQ=OQ,px=["Enter"," "],IQ=["ArrowDown","PageUp","Home"],PP=["ArrowUp","PageDown","End"],DQ=[...IQ,...PP],LQ={ltr:[...px,"ArrowRight"],rtl:[...px,"ArrowLeft"]},jQ={ltr:["ArrowLeft"],rtl:["ArrowRight"]},zg="Menu",[df,zQ,FQ]=dg(zg),[rl,$P]=Lr(zg,[FQ,jc,RP]),jb=jc(),AP=RP(),[BQ,ol]=rl(zg),[UQ,Lf]=rl(zg),VQ=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=t,a=jb(e),[l,c]=h.useState(null),u=h.useRef(!1),d=rn(i),f=_f(o);return h.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})}},[]),h.createElement(R1,a,h.createElement(BQ,{scope:e,open:n,onOpenChange:d,content:l,onContentChange:c},h.createElement(UQ,{scope:e,onClose:h.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:s},r)))},IP=h.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,o=jb(n);return h.createElement(N1,z({},o,r,{ref:e}))}),DP="MenuPortal",[HQ,LP]=rl(DP,{forceMount:void 0}),WQ=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:o}=t,i=ol(DP,e);return h.createElement(HQ,{scope:e,forceMount:n},h.createElement(Hn,{present:n||i.open},h.createElement(sg,{asChild:!0,container:o},r)))},fo="MenuContent",[KQ,zb]=rl(fo),qQ=h.forwardRef((t,e)=>{const n=LP(fo,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,i=ol(fo,t.__scopeMenu),s=Lf(fo,t.__scopeMenu);return h.createElement(df.Provider,{scope:t.__scopeMenu},h.createElement(Hn,{present:r||i.open},h.createElement(df.Slot,{scope:t.__scopeMenu},s.modal?h.createElement(GQ,z({},o,{ref:e})):h.createElement(YQ,z({},o,{ref:e})))))}),GQ=h.forwardRef((t,e)=>{const n=ol(fo,t.__scopeMenu),r=h.useRef(null),o=We(e,r);return h.useEffect(()=>{const i=r.current;if(i)return ag(i)},[]),h.createElement(Fb,z({},t,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:se(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)}))}),YQ=h.forwardRef((t,e)=>{const n=ol(fo,t.__scopeMenu);return h.createElement(Fb,z({},t,{ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)}))}),Fb=h.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...g}=t,y=ol(fo,n),v=Lf(fo,n),x=jb(n),w=AP(n),S=zQ(n),[_,k]=h.useState(null),E=h.useRef(null),C=We(e,E,y.onContentChange),T=h.useRef(0),A=h.useRef(""),B=h.useRef(0),D=h.useRef(null),Z=h.useRef("right"),U=h.useRef(0),G=m?cg:h.Fragment,R=m?{as:mi,allowPinchZoom:!0}:void 0,N=P=>{var I,H;const le=A.current+P,Le=S().filter(tt=>!tt.disabled),Ee=document.activeElement,Je=(I=Le.find(tt=>tt.ref.current===Ee))===null||I===void 0?void 0:I.textValue,Ae=Le.map(tt=>tt.textValue),ne=dee(Ae,le,Je),et=(H=Le.find(tt=>tt.textValue===ne))===null||H===void 0?void 0:H.ref.current;(function tt(nt){A.current=nt,window.clearTimeout(T.current),nt!==""&&(T.current=window.setTimeout(()=>tt(""),1e3))})(le),et&&setTimeout(()=>et.focus())};h.useEffect(()=>()=>window.clearTimeout(T.current),[]),ng();const O=h.useCallback(P=>{var I,H;return Z.current===((I=D.current)===null||I===void 0?void 0:I.side)&&pee(P,(H=D.current)===null||H===void 0?void 0:H.area)},[]);return h.createElement(KQ,{scope:n,searchRef:A,onItemEnter:h.useCallback(P=>{O(P)&&P.preventDefault()},[O]),onItemLeave:h.useCallback(P=>{var I;O(P)||((I=E.current)===null||I===void 0||I.focus(),k(null))},[O]),onTriggerLeave:h.useCallback(P=>{O(P)&&P.preventDefault()},[O]),pointerGraceTimerRef:B,onPointerGraceIntentChange:h.useCallback(P=>{D.current=P},[])},h.createElement(G,R,h.createElement(rg,{asChild:!0,trapped:o,onMountAutoFocus:se(i,P=>{var I;P.preventDefault(),(I=E.current)===null||I===void 0||I.focus()}),onUnmountAutoFocus:s},h.createElement(tg,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p},h.createElement($Q,z({asChild:!0},w,{dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:_,onCurrentTabStopIdChange:k,onEntryFocus:se(l,P=>{v.isUsingKeyboardRef.current||P.preventDefault()})}),h.createElement(P1,z({role:"menu","aria-orientation":"vertical","data-state":UP(y.open),"data-radix-menu-content":"",dir:v.dir},x,g,{ref:C,style:{outline:"none",...g.style},onKeyDown:se(g.onKeyDown,P=>{const H=P.target.closest("[data-radix-menu-content]")===P.currentTarget,le=P.ctrlKey||P.altKey||P.metaKey,Le=P.key.length===1;H&&(P.key==="Tab"&&P.preventDefault(),!le&&Le&&N(P.key));const Ee=E.current;if(P.target!==Ee||!DQ.includes(P.key))return;P.preventDefault();const Ae=S().filter(ne=>!ne.disabled).map(ne=>ne.ref.current);PP.includes(P.key)&&Ae.reverse(),cee(Ae)}),onBlur:se(t.onBlur,P=>{P.currentTarget.contains(P.target)||(window.clearTimeout(T.current),A.current="")}),onPointerMove:se(t.onPointerMove,ff(P=>{const I=P.target,H=U.current!==P.clientX;if(P.currentTarget.contains(I)&&H){const le=P.clientX>U.current?"right":"left";Z.current=le,U.current=P.clientX}}))})))))))}),ZQ=h.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return h.createElement(Re.div,z({},r,{ref:e}))}),hx="MenuItem",v_="menu.itemSelect",Bb=h.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...o}=t,i=h.useRef(null),s=Lf(hx,t.__scopeMenu),a=zb(hx,t.__scopeMenu),l=We(e,i),c=h.useRef(!1),u=()=>{const d=i.current;if(!n&&d){const f=new CustomEvent(v_,{bubbles:!0,cancelable:!0});d.addEventListener(v_,p=>r==null?void 0:r(p),{once:!0}),mO(d,f),f.defaultPrevented?c.current=!1:s.onClose()}};return h.createElement(jP,z({},o,{ref:l,disabled:n,onClick:se(t.onClick,u),onPointerDown:d=>{var f;(f=t.onPointerDown)===null||f===void 0||f.call(t,d),c.current=!0},onPointerUp:se(t.onPointerUp,d=>{var f;c.current||(f=d.currentTarget)===null||f===void 0||f.click()}),onKeyDown:se(t.onKeyDown,d=>{const f=a.searchRef.current!=="";n||f&&d.key===" "||px.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})}))}),jP=h.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=t,s=zb(hx,n),a=AP(n),l=h.useRef(null),c=We(e,l),[u,d]=h.useState(!1),[f,p]=h.useState("");return h.useEffect(()=>{const m=l.current;if(m){var g;p(((g=m.textContent)!==null&&g!==void 0?g:"").trim())}},[i.children]),h.createElement(df.ItemSlot,{scope:n,disabled:r,textValue:o??f},h.createElement(AQ,z({asChild:!0},a,{focusable:!r}),h.createElement(Re.div,z({role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0},i,{ref:c,onPointerMove:se(t.onPointerMove,ff(m=>{r?s.onItemLeave(m):(s.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus())})),onPointerLeave:se(t.onPointerLeave,ff(m=>s.onItemLeave(m))),onFocus:se(t.onFocus,()=>d(!0)),onBlur:se(t.onBlur,()=>d(!1))}))))}),JQ=h.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...o}=t;return h.createElement(FP,{scope:t.__scopeMenu,checked:n},h.createElement(Bb,z({role:"menuitemcheckbox","aria-checked":wm(n)?"mixed":n},o,{ref:e,"data-state":Ub(n),onSelect:se(o.onSelect,()=>r==null?void 0:r(wm(n)?!0:!n),{checkForDefaultPrevented:!1})})))}),XQ="MenuRadioGroup",[Xoe,QQ]=rl(XQ,{value:void 0,onValueChange:()=>{}}),eee="MenuRadioItem",tee=h.forwardRef((t,e)=>{const{value:n,...r}=t,o=QQ(eee,t.__scopeMenu),i=n===o.value;return h.createElement(FP,{scope:t.__scopeMenu,checked:i},h.createElement(Bb,z({role:"menuitemradio","aria-checked":i},r,{ref:e,"data-state":Ub(i),onSelect:se(r.onSelect,()=>{var s;return(s=o.onValueChange)===null||s===void 0?void 0:s.call(o,n)},{checkForDefaultPrevented:!1})})))}),zP="MenuItemIndicator",[FP,nee]=rl(zP,{checked:!1}),ree=h.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...o}=t,i=nee(zP,n);return h.createElement(Hn,{present:r||wm(i.checked)||i.checked===!0},h.createElement(Re.span,z({},o,{ref:e,"data-state":Ub(i.checked)})))}),oee=h.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return h.createElement(Re.div,z({role:"separator","aria-orientation":"horizontal"},r,{ref:e}))}),iee="MenuSub",[Qoe,BP]=rl(iee),kp="MenuSubTrigger",see=h.forwardRef((t,e)=>{const n=ol(kp,t.__scopeMenu),r=Lf(kp,t.__scopeMenu),o=BP(kp,t.__scopeMenu),i=zb(kp,t.__scopeMenu),s=h.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=i,c={__scopeMenu:t.__scopeMenu},u=h.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return h.useEffect(()=>u,[u]),h.useEffect(()=>{const d=a.current;return()=>{window.clearTimeout(d),l(null)}},[a,l]),h.createElement(IP,z({asChild:!0},c),h.createElement(jP,z({id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":UP(n.open)},t,{ref:Gm(e,o.onTriggerChange),onClick:d=>{var f;(f=t.onClick)===null||f===void 0||f.call(t,d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:se(t.onPointerMove,ff(d=>{i.onItemEnter(d),!d.defaultPrevented&&!t.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:se(t.onPointerLeave,ff(d=>{var f;u();const p=(f=n.content)===null||f===void 0?void 0:f.getBoundingClientRect();if(p){var m;const g=(m=n.content)===null||m===void 0?void 0:m.dataset.side,y=g==="right",v=y?-5:5,x=p[y?"left":"right"],w=p[y?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+v,y:d.clientY},{x,y:p.top},{x:w,y:p.top},{x:w,y:p.bottom},{x,y:p.bottom}],side:g}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(d),d.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:se(t.onKeyDown,d=>{const f=i.searchRef.current!=="";if(!(t.disabled||f&&d.key===" ")&&LQ[r.dir].includes(d.key)){var p;n.onOpenChange(!0),(p=n.content)===null||p===void 0||p.focus(),d.preventDefault()}})})))}),aee="MenuSubContent",lee=h.forwardRef((t,e)=>{const n=LP(fo,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,i=ol(fo,t.__scopeMenu),s=Lf(fo,t.__scopeMenu),a=BP(aee,t.__scopeMenu),l=h.useRef(null),c=We(e,l);return h.createElement(df.Provider,{scope:t.__scopeMenu},h.createElement(Hn,{present:r||i.open},h.createElement(df.Slot,{scope:t.__scopeMenu},h.createElement(Fb,z({id:a.contentId,"aria-labelledby":a.triggerId},o,{ref:c,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var d;s.isUsingKeyboardRef.current&&((d=l.current)===null||d===void 0||d.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:se(t.onFocusOutside,u=>{u.target!==a.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:se(t.onEscapeKeyDown,u=>{s.onClose(),u.preventDefault()}),onKeyDown:se(t.onKeyDown,u=>{const d=u.currentTarget.contains(u.target),f=jQ[s.dir].includes(u.key);if(d&&f){var p;i.onOpenChange(!1),(p=a.trigger)===null||p===void 0||p.focus(),u.preventDefault()}})})))))});function UP(t){return t?"open":"closed"}function wm(t){return t==="indeterminate"}function Ub(t){return wm(t)?"indeterminate":t?"checked":"unchecked"}function cee(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function uee(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function dee(t,e,n){const o=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let s=uee(t,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 fee(t,e){const{x:n,y:r}=t;let o=!1;for(let i=0,s=e.length-1;i<e.length;s=i++){const a=e[i].x,l=e[i].y,c=e[s].x,u=e[s].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(o=!o)}return o}function pee(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return fee(n,e)}function ff(t){return e=>e.pointerType==="mouse"?t(e):void 0}const hee=VQ,mee=IP,gee=WQ,vee=qQ,yee=ZQ,xee=Bb,bee=JQ,wee=tee,kee=ree,See=oee,Eee=see,_ee=lee,VP="DropdownMenu",[Cee,eie]=Lr(VP,[$P]),Ur=$P(),[Tee,HP]=Cee(VP),Oee=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:s,modal:a=!0}=t,l=Ur(e),c=h.useRef(null),[u=!1,d]=Ao({prop:o,defaultProp:i,onChange:s});return h.createElement(Tee,{scope:e,triggerId:ao(),triggerRef:c,contentId:ao(),open:u,onOpenChange:d,onOpenToggle:h.useCallback(()=>d(f=>!f),[d]),modal:a},h.createElement(hee,z({},l,{open:u,onOpenChange:d,dir:r,modal:a}),n))},Mee="DropdownMenuTrigger",Ree=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=t,i=HP(Mee,n),s=Ur(n);return h.createElement(mee,z({asChild:!0},s),h.createElement(Re.button,z({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:Gm(e,i.triggerRef),onPointerDown:se(t.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(i.onOpenToggle(),i.open||a.preventDefault())}),onKeyDown:se(t.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&i.onOpenToggle(),a.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})))}),Nee=t=>{const{__scopeDropdownMenu:e,...n}=t,r=Ur(e);return h.createElement(gee,z({},r,n))},Pee="DropdownMenuContent",$ee=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=HP(Pee,n),i=Ur(n),s=h.useRef(!1);return h.createElement(vee,z({id:o.contentId,"aria-labelledby":o.triggerId},i,r,{ref:e,onCloseAutoFocus:se(t.onCloseAutoFocus,a=>{var l;s.current||(l=o.triggerRef.current)===null||l===void 0||l.focus(),s.current=!1,a.preventDefault()}),onInteractOutside:se(t.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:{...t.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)"}}))}),Aee=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Ur(n);return h.createElement(yee,z({},o,r,{ref:e}))}),Iee=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Ur(n);return h.createElement(xee,z({},o,r,{ref:e}))}),Dee=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Ur(n);return h.createElement(bee,z({},o,r,{ref:e}))}),Lee=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Ur(n);return h.createElement(wee,z({},o,r,{ref:e}))}),jee=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Ur(n);return h.createElement(kee,z({},o,r,{ref:e}))}),zee=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Ur(n);return h.createElement(See,z({},o,r,{ref:e}))}),Fee=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Ur(n);return h.createElement(Eee,z({},o,r,{ref:e}))}),Bee=h.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,o=Ur(n);return h.createElement(_ee,z({},o,r,{ref:e,style:{...t.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)"}}))}),Uee=Oee,Vee=Ree,Hee=Nee,WP=$ee,KP=Aee,qP=Iee,GP=Dee,YP=Lee,ZP=jee,JP=zee,XP=Fee,QP=Bee,Wee=Uee,Kee=Vee,qee=h.forwardRef(({className:t,inset:e,children:n,...r},o)=>b.jsxs(XP,{ref:o,className:ze("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",e&&"pl-8",t),...r,children:[n,b.jsx(z5,{className:"w-4 h-4 ml-auto"})]}));qee.displayName=XP.displayName;const Gee=h.forwardRef(({className:t,...e},n)=>b.jsx(QP,{ref:n,className:ze("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground 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",t),...e}));Gee.displayName=QP.displayName;const e$=h.forwardRef(({className:t,sideOffset:e=4,container:n,...r},o)=>b.jsx(Hee,{container:n,children:b.jsx(WP,{ref:o,sideOffset:e,className:ze("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground 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",t),...r})}));e$.displayName=WP.displayName;const qi=h.forwardRef(({className:t,inset:e,...n},r)=>b.jsx(qP,{ref:r,className:ze("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...n}));qi.displayName=qP.displayName;const Yee=h.forwardRef(({className:t,children:e,checked:n,...r},o)=>b.jsxs(GP,{ref:o,className:ze("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",t),checked:n,...r,children:[b.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:b.jsx(ZP,{children:b.jsx(y1,{className:"w-4 h-4"})})}),e]}));Yee.displayName=GP.displayName;const Zee=h.forwardRef(({className:t,children:e,...n},r)=>b.jsxs(YP,{ref:r,className:ze("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",t),...n,children:[b.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:b.jsx(ZP,{children:b.jsx(F5,{className:"w-2 h-2 fill-current"})})}),e]}));Zee.displayName=YP.displayName;const Jee=h.forwardRef(({className:t,inset:e,...n},r)=>b.jsx(KP,{ref:r,className:ze("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));Jee.displayName=KP.displayName;const Xee=h.forwardRef(({className:t,...e},n)=>b.jsx(JP,{ref:n,className:ze("-mx-1 my-1 h-px bg-muted",t),...e}));Xee.displayName=JP.displayName;function km(t){"@babel/helpers - typeof";return km=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},km(t)}function Ka(t){if(t===null||t===!0||t===!1)return NaN;var e=Number(t);return isNaN(e)?e:e<0?Math.ceil(e):Math.floor(e)}function cn(t,e){if(e.length<t)throw new TypeError(t+" argument"+(t>1?"s":"")+" required, but only "+e.length+" present")}function kr(t){cn(1,arguments);var e=Object.prototype.toString.call(t);return t instanceof Date||km(t)==="object"&&e==="[object Date]"?new Date(t.getTime()):typeof t=="number"||e==="[object Number]"?new Date(t):((typeof t=="string"||e==="[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 Qee(t,e){cn(2,arguments);var n=kr(t).getTime(),r=Ka(e);return new Date(n+r)}var ete={};function Fg(){return ete}function tte(t){var e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),t.getTime()-e.getTime()}function y_(t){cn(1,arguments);var e=kr(t);return e.setHours(0,0,0,0),e}function nte(t){return cn(1,arguments),t instanceof Date||km(t)==="object"&&Object.prototype.toString.call(t)==="[object Date]"}function rte(t){if(cn(1,arguments),!nte(t)&&typeof t!="number")return!1;var e=kr(t);return!isNaN(Number(e))}function ote(t){cn(1,arguments);var e=kr(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(23,59,59,999),e}function ite(t){cn(1,arguments);var e=kr(t);return e.setDate(1),e.setHours(0,0,0,0),e}function ste(t,e){cn(2,arguments);var n=Ka(e);return Qee(t,-n)}var ate=864e5;function lte(t){cn(1,arguments);var e=kr(t),n=e.getTime();e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0);var r=e.getTime(),o=n-r;return Math.floor(o/ate)+1}function Sm(t){cn(1,arguments);var e=1,n=kr(t),r=n.getUTCDay(),o=(r<e?7:0)+r-e;return n.setUTCDate(n.getUTCDate()-o),n.setUTCHours(0,0,0,0),n}function t$(t){cn(1,arguments);var e=kr(t),n=e.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(n+1,0,4),r.setUTCHours(0,0,0,0);var o=Sm(r),i=new Date(0);i.setUTCFullYear(n,0,4),i.setUTCHours(0,0,0,0);var s=Sm(i);return e.getTime()>=o.getTime()?n+1:e.getTime()>=s.getTime()?n:n-1}function cte(t){cn(1,arguments);var e=t$(t),n=new Date(0);n.setUTCFullYear(e,0,4),n.setUTCHours(0,0,0,0);var r=Sm(n);return r}var ute=6048e5;function dte(t){cn(1,arguments);var e=kr(t),n=Sm(e).getTime()-cte(e).getTime();return Math.round(n/ute)+1}function Em(t,e){var n,r,o,i,s,a,l,c;cn(1,arguments);var u=Fg(),d=Ka((n=(r=(o=(i=e==null?void 0:e.weekStartsOn)!==null&&i!==void 0?i:e==null||(s=e.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.weekStartsOn)!==null&&o!==void 0?o:u.weekStartsOn)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&n!==void 0?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var f=kr(t),p=f.getUTCDay(),m=(p<d?7:0)+p-d;return f.setUTCDate(f.getUTCDate()-m),f.setUTCHours(0,0,0,0),f}function n$(t,e){var n,r,o,i,s,a,l,c;cn(1,arguments);var u=kr(t),d=u.getUTCFullYear(),f=Fg(),p=Ka((n=(r=(o=(i=e==null?void 0:e.firstWeekContainsDate)!==null&&i!==void 0?i:e==null||(s=e.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.firstWeekContainsDate)!==null&&o!==void 0?o:f.firstWeekContainsDate)!==null&&r!==void 0?r:(l=f.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1);if(!(p>=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=new Date(0);m.setUTCFullYear(d+1,0,p),m.setUTCHours(0,0,0,0);var g=Em(m,e),y=new Date(0);y.setUTCFullYear(d,0,p),y.setUTCHours(0,0,0,0);var v=Em(y,e);return u.getTime()>=g.getTime()?d+1:u.getTime()>=v.getTime()?d:d-1}function fte(t,e){var n,r,o,i,s,a,l,c;cn(1,arguments);var u=Fg(),d=Ka((n=(r=(o=(i=e==null?void 0:e.firstWeekContainsDate)!==null&&i!==void 0?i:e==null||(s=e.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.firstWeekContainsDate)!==null&&o!==void 0?o:u.firstWeekContainsDate)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1),f=n$(t,e),p=new Date(0);p.setUTCFullYear(f,0,d),p.setUTCHours(0,0,0,0);var m=Em(p,e);return m}var pte=6048e5;function hte(t,e){cn(1,arguments);var n=kr(t),r=Em(n,e).getTime()-fte(n,e).getTime();return Math.round(r/pte)+1}function it(t,e){for(var n=t<0?"-":"",r=Math.abs(t).toString();r.length<e;)r="0"+r;return n+r}var mte={y:function(e,n){var r=e.getUTCFullYear(),o=r>0?r:1-r;return it(n==="yy"?o%100:o,n.length)},M:function(e,n){var r=e.getUTCMonth();return n==="M"?String(r+1):it(r+1,2)},d:function(e,n){return it(e.getUTCDate(),n.length)},a:function(e,n){var r=e.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(e,n){return it(e.getUTCHours()%12||12,n.length)},H:function(e,n){return it(e.getUTCHours(),n.length)},m:function(e,n){return it(e.getUTCMinutes(),n.length)},s:function(e,n){return it(e.getUTCSeconds(),n.length)},S:function(e,n){var r=n.length,o=e.getUTCMilliseconds(),i=Math.floor(o*Math.pow(10,r-3));return it(i,n.length)}};const zi=mte;var xl={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},gte={G:function(e,n,r){var o=e.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(e,n,r){if(n==="yo"){var o=e.getUTCFullYear(),i=o>0?o:1-o;return r.ordinalNumber(i,{unit:"year"})}return zi.y(e,n)},Y:function(e,n,r,o){var i=n$(e,o),s=i>0?i:1-i;if(n==="YY"){var a=s%100;return it(a,2)}return n==="Yo"?r.ordinalNumber(s,{unit:"year"}):it(s,n.length)},R:function(e,n){var r=t$(e);return it(r,n.length)},u:function(e,n){var r=e.getUTCFullYear();return it(r,n.length)},Q:function(e,n,r){var o=Math.ceil((e.getUTCMonth()+1)/3);switch(n){case"Q":return String(o);case"QQ":return it(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(e,n,r){var o=Math.ceil((e.getUTCMonth()+1)/3);switch(n){case"q":return String(o);case"qq":return it(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(e,n,r){var o=e.getUTCMonth();switch(n){case"M":case"MM":return zi.M(e,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(e,n,r){var o=e.getUTCMonth();switch(n){case"L":return String(o+1);case"LL":return it(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(e,n,r,o){var i=hte(e,o);return n==="wo"?r.ordinalNumber(i,{unit:"week"}):it(i,n.length)},I:function(e,n,r){var o=dte(e);return n==="Io"?r.ordinalNumber(o,{unit:"week"}):it(o,n.length)},d:function(e,n,r){return n==="do"?r.ordinalNumber(e.getUTCDate(),{unit:"date"}):zi.d(e,n)},D:function(e,n,r){var o=lte(e);return n==="Do"?r.ordinalNumber(o,{unit:"dayOfYear"}):it(o,n.length)},E:function(e,n,r){var o=e.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(e,n,r,o){var i=e.getUTCDay(),s=(i-o.weekStartsOn+8)%7||7;switch(n){case"e":return String(s);case"ee":return it(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(e,n,r,o){var i=e.getUTCDay(),s=(i-o.weekStartsOn+8)%7||7;switch(n){case"c":return String(s);case"cc":return it(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(e,n,r){var o=e.getUTCDay(),i=o===0?7:o;switch(n){case"i":return String(i);case"ii":return it(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(e,n,r){var o=e.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(e,n,r){var o=e.getUTCHours(),i;switch(o===12?i=xl.noon:o===0?i=xl.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(e,n,r){var o=e.getUTCHours(),i;switch(o>=17?i=xl.evening:o>=12?i=xl.afternoon:o>=4?i=xl.morning:i=xl.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(e,n,r){if(n==="ho"){var o=e.getUTCHours()%12;return o===0&&(o=12),r.ordinalNumber(o,{unit:"hour"})}return zi.h(e,n)},H:function(e,n,r){return n==="Ho"?r.ordinalNumber(e.getUTCHours(),{unit:"hour"}):zi.H(e,n)},K:function(e,n,r){var o=e.getUTCHours()%12;return n==="Ko"?r.ordinalNumber(o,{unit:"hour"}):it(o,n.length)},k:function(e,n,r){var o=e.getUTCHours();return o===0&&(o=24),n==="ko"?r.ordinalNumber(o,{unit:"hour"}):it(o,n.length)},m:function(e,n,r){return n==="mo"?r.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):zi.m(e,n)},s:function(e,n,r){return n==="so"?r.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):zi.s(e,n)},S:function(e,n){return zi.S(e,n)},X:function(e,n,r,o){var i=o._originalDate||e,s=i.getTimezoneOffset();if(s===0)return"Z";switch(n){case"X":return b_(s);case"XXXX":case"XX":return ta(s);case"XXXXX":case"XXX":default:return ta(s,":")}},x:function(e,n,r,o){var i=o._originalDate||e,s=i.getTimezoneOffset();switch(n){case"x":return b_(s);case"xxxx":case"xx":return ta(s);case"xxxxx":case"xxx":default:return ta(s,":")}},O:function(e,n,r,o){var i=o._originalDate||e,s=i.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+x_(s,":");case"OOOO":default:return"GMT"+ta(s,":")}},z:function(e,n,r,o){var i=o._originalDate||e,s=i.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+x_(s,":");case"zzzz":default:return"GMT"+ta(s,":")}},t:function(e,n,r,o){var i=o._originalDate||e,s=Math.floor(i.getTime()/1e3);return it(s,n.length)},T:function(e,n,r,o){var i=o._originalDate||e,s=i.getTime();return it(s,n.length)}};function x_(t,e){var n=t>0?"-":"+",r=Math.abs(t),o=Math.floor(r/60),i=r%60;if(i===0)return n+String(o);var s=e||"";return n+String(o)+s+it(i,2)}function b_(t,e){if(t%60===0){var n=t>0?"-":"+";return n+it(Math.abs(t)/60,2)}return ta(t,e)}function ta(t,e){var n=e||"",r=t>0?"-":"+",o=Math.abs(t),i=it(Math.floor(o/60),2),s=it(o%60,2);return r+i+n+s}var w_=function(e,n){switch(e){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"})}},r$=function(e,n){switch(e){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"})}},vte=function(e,n){var r=e.match(/(P+)(p+)?/)||[],o=r[1],i=r[2];if(!i)return w_(e,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}}",w_(o,n)).replace("{{time}}",r$(i,n))},yte={p:r$,P:vte},xte=["D","DD"],bte=["YY","YYYY"];function wte(t){return xte.indexOf(t)!==-1}function kte(t){return bte.indexOf(t)!==-1}function k_(t,e,n){if(t==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(e,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(t==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(e,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(t==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(e,"`) 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(t==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(e,"`) 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 Ste={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"}},Ete=function(e,n,r){var o,i=Ste[e];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};const _te=Ete;function oy(t){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.width?String(e.width):t.defaultWidth,r=t.formats[n]||t.formats[t.defaultWidth];return r}}var Cte={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Tte={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Ote={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Mte={date:oy({formats:Cte,defaultWidth:"full"}),time:oy({formats:Tte,defaultWidth:"full"}),dateTime:oy({formats:Ote,defaultWidth:"full"})};const Rte=Mte;var Nte={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Pte=function(e,n,r,o){return Nte[e]};const $te=Pte;function pu(t){return function(e,n){var r=n!=null&&n.context?String(n.context):"standalone",o;if(r==="formatting"&&t.formattingValues){var i=t.defaultFormattingWidth||t.defaultWidth,s=n!=null&&n.width?String(n.width):i;o=t.formattingValues[s]||t.formattingValues[i]}else{var a=t.defaultWidth,l=n!=null&&n.width?String(n.width):t.defaultWidth;o=t.values[l]||t.values[a]}var c=t.argumentCallback?t.argumentCallback(e):e;return o[c]}}var Ate={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Ite={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Dte={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"]},Lte={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"]},jte={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"}},zte={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"}},Fte=function(e,n){var r=Number(e),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"},Bte={ordinalNumber:Fte,era:pu({values:Ate,defaultWidth:"wide"}),quarter:pu({values:Ite,defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:pu({values:Dte,defaultWidth:"wide"}),day:pu({values:Lte,defaultWidth:"wide"}),dayPeriod:pu({values:jte,defaultWidth:"wide",formattingValues:zte,defaultFormattingWidth:"wide"})};const Ute=Bte;function hu(t){return function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.width,o=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(o);if(!i)return null;var s=i[0],a=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(a)?Hte(a,function(d){return d.test(s)}):Vte(a,function(d){return d.test(s)}),c;c=t.valueCallback?t.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;var u=e.slice(s.length);return{value:c,rest:u}}}function Vte(t,e){for(var n in t)if(t.hasOwnProperty(n)&&e(t[n]))return n}function Hte(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return n}function Wte(t){return function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=e.match(t.matchPattern);if(!r)return null;var o=r[0],i=e.match(t.parsePattern);if(!i)return null;var s=t.valueCallback?t.valueCallback(i[0]):i[0];s=n.valueCallback?n.valueCallback(s):s;var a=e.slice(o.length);return{value:s,rest:a}}}var Kte=/^(\d+)(th|st|nd|rd)?/i,qte=/\d+/i,Gte={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},Yte={any:[/^b/i,/^(a|c)/i]},Zte={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Jte={any:[/1/i,/2/i,/3/i,/4/i]},Xte={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},Qte={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]},ene={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},tne={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]},nne={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},rne={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}},one={ordinalNumber:Wte({matchPattern:Kte,parsePattern:qte,valueCallback:function(e){return parseInt(e,10)}}),era:hu({matchPatterns:Gte,defaultMatchWidth:"wide",parsePatterns:Yte,defaultParseWidth:"any"}),quarter:hu({matchPatterns:Zte,defaultMatchWidth:"wide",parsePatterns:Jte,defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:hu({matchPatterns:Xte,defaultMatchWidth:"wide",parsePatterns:Qte,defaultParseWidth:"any"}),day:hu({matchPatterns:ene,defaultMatchWidth:"wide",parsePatterns:tne,defaultParseWidth:"any"}),dayPeriod:hu({matchPatterns:nne,defaultMatchWidth:"any",parsePatterns:rne,defaultParseWidth:"any"})};const ine=one;var sne={code:"en-US",formatDistance:_te,formatLong:Rte,formatRelative:$te,localize:Ute,match:ine,options:{weekStartsOn:0,firstWeekContainsDate:1}};const o$=sne;var ane=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,lne=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,cne=/^'([^]*?)'?$/,une=/''/g,dne=/[a-zA-Z]/;function il(t,e,n){var r,o,i,s,a,l,c,u,d,f,p,m,g,y,v,x,w,S;cn(2,arguments);var _=String(e),k=Fg(),E=(r=(o=n==null?void 0:n.locale)!==null&&o!==void 0?o:k.locale)!==null&&r!==void 0?r:o$,C=Ka((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:k.firstWeekContainsDate)!==null&&s!==void 0?s:(d=k.locale)===null||d===void 0||(f=d.options)===null||f===void 0?void 0:f.firstWeekContainsDate)!==null&&i!==void 0?i:1);if(!(C>=1&&C<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var T=Ka((p=(m=(g=(y=n==null?void 0:n.weekStartsOn)!==null&&y!==void 0?y:n==null||(v=n.locale)===null||v===void 0||(x=v.options)===null||x===void 0?void 0:x.weekStartsOn)!==null&&g!==void 0?g:k.weekStartsOn)!==null&&m!==void 0?m:(w=k.locale)===null||w===void 0||(S=w.options)===null||S===void 0?void 0:S.weekStartsOn)!==null&&p!==void 0?p:0);if(!(T>=0&&T<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!E.localize)throw new RangeError("locale must contain localize property");if(!E.formatLong)throw new RangeError("locale must contain formatLong property");var A=kr(t);if(!rte(A))throw new RangeError("Invalid time value");var B=tte(A),D=ste(A,B),Z={firstWeekContainsDate:C,weekStartsOn:T,locale:E,_originalDate:A},U=_.match(lne).map(function(G){var R=G[0];if(R==="p"||R==="P"){var N=yte[R];return N(G,E.formatLong)}return G}).join("").match(ane).map(function(G){if(G==="''")return"'";var R=G[0];if(R==="'")return fne(G);var N=gte[R];if(N)return!(n!=null&&n.useAdditionalWeekYearTokens)&&kte(G)&&k_(G,e,String(t)),!(n!=null&&n.useAdditionalDayOfYearTokens)&&wte(G)&&k_(G,e,String(t)),N(D,G,E.localize,Z);if(R.match(dne))throw new RangeError("Format string contains an unescaped latin alphabet character `"+R+"`");return G}).join("");return U}function fne(t){var e=t.match(cne);return e?e[1].replace(une,"'"):t}var It=function(){return It=Object.assign||function(e){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)&&(e[i]=n[i])}return e},It.apply(this,arguments)};var i$={exports:{}},mu={};/**
219
219
  * @license React
220
220
  * react-jsx-runtime.production.min.js
221
221
  *
@@ -224,7 +224,7 @@ If you are using Node.js, you can install JSDOM and Remirror will try to use it
224
224
  * This source code is licensed under the MIT license found in the
225
225
  * LICENSE file in the root directory of this source tree.
226
226
  */var S_;function pne(){if(S_)return mu;S_=1;var t=oe,e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(a,l,c){var u,d={},f=null,p=null;c!==void 0&&(f=""+c),l.key!==void 0&&(f=""+l.key),l.ref!==void 0&&(p=l.ref);for(u in l)r.call(l,u)&&!i.hasOwnProperty(u)&&(d[u]=l[u]);if(a&&a.defaultProps)for(u in l=a.defaultProps,l)d[u]===void 0&&(d[u]=l[u]);return{$$typeof:e,type:a,key:f,ref:p,props:d,_owner:o.current}}return mu.Fragment=n,mu.jsx=s,mu.jsxs=s,mu}i$.exports=pne();var s$=i$.exports;function hne(t){return t.mode==="multiple"}function mne(t){return t.mode==="range"}function gne(t){return t.mode==="single"}var vne={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 yne(t,e){return il(t,"LLLL y",e)}function xne(t,e){return il(t,"d",e)}function bne(t,e){return il(t,"LLLL",e)}function wne(t){return"".concat(t)}function kne(t,e){return il(t,"cccccc",e)}function Sne(t,e){return il(t,"yyyy",e)}var Ene=Object.freeze({__proto__:null,formatCaption:yne,formatDay:xne,formatMonthCaption:bne,formatWeekNumber:wne,formatWeekdayName:kne,formatYearCaption:Sne}),_ne=function(t,e,n){return il(t,"do MMMM (EEEE)",n)},Cne=function(){return"Month: "},Tne=function(){return"Go to next month"},One=function(){return"Go to previous month"},Mne=function(t,e){return il(t,"cccc",e)},Rne=function(t){return"Week n. ".concat(t)},Nne=function(){return"Year: "},Pne=Object.freeze({__proto__:null,labelDay:_ne,labelMonthDropdown:Cne,labelNext:Tne,labelPrevious:One,labelWeekNumber:Rne,labelWeekday:Mne,labelYearDropdown:Nne});function $ne(){var t="buttons",e=vne,n=o$,r={},o={},i=1,s={},a=new Date;return{captionLayout:t,classNames:e,formatters:Ene,labels:Pne,locale:n,modifiersClassNames:r,modifiers:o,numberOfMonths:i,styles:s,today:a,mode:"default"}}function Ane(t){var e=t.fromYear,n=t.toYear,r=t.fromMonth,o=t.toMonth,i=t.fromDate,s=t.toDate;return r?i=ite(r):e&&(i=new Date(e,0,1)),o?s=ote(o):n&&(s=new Date(n,11,31)),{fromDate:i?y_(i):void 0,toDate:s?y_(s):void 0}}var a$=h.createContext(void 0);function Ine(t){var e,n=t.initialProps,r=$ne(),o=Ane(n),i=o.fromDate,s=o.toDate,a=(e=n.captionLayout)!==null&&e!==void 0?e:r.captionLayout;a!=="buttons"&&(!i||!s)&&(a="buttons");var l;(gne(n)||hne(n)||mne(n))&&(l=n.onSelect);var c=It(It(It({},r),n),{captionLayout:a,classNames:It(It({},r.classNames),n.classNames),components:It({},n.components),formatters:It(It({},r.formatters),n.formatters),fromDate:i,labels:It(It({},r.labels),n.labels),mode:n.mode||r.mode,modifiers:It(It({},r.modifiers),n.modifiers),modifiersClassNames:It(It({},r.modifiersClassNames),n.modifiersClassNames),onSelect:l,styles:It(It({},r.styles),n.styles),toDate:s});return s$.jsx(a$.Provider,{value:c,children:t.children})}function Dne(){var t=h.useContext(a$);if(!t)throw new Error("useDayPicker must be used within a DayPickerProvider.");return t}h.createContext(void 0);h.forwardRef(function(t,e){var n=Dne(),r=n.classNames,o=n.styles,i=[r.button_reset,r.button];t.className&&i.push(t.className);var s=i.join(" "),a=It(It({},o.button_reset),o.button);return t.style&&Object.assign(a,t.style),s$.jsx("button",It({},t,{ref:e,type:"button",className:s,style:a}))});h.createContext(void 0);h.createContext(void 0);var Uo;(function(t){t.Outside="outside",t.Disabled="disabled",t.Selected="selected",t.Hidden="hidden",t.Today="today",t.RangeStart="range_start",t.RangeEnd="range_end",t.RangeMiddle="range_middle"})(Uo||(Uo={}));Uo.Selected;Uo.Disabled;Uo.Hidden;Uo.Today;Uo.RangeEnd;Uo.RangeMiddle;Uo.RangeStart;Uo.Outside;h.createContext(void 0);h.createContext(void 0);h.createContext(void 0);var Lne=Object.defineProperty,jne=Object.getOwnPropertyDescriptor,jf=(t,e,n,r)=>{for(var o=r>1?void 0:r?jne(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&Lne(e,n,o),o},zne={icon:"bold",label:({t})=>t(XS.LABEL),description:({t})=>t(XS.DESCRIPTION)},qa=class extends If{get name(){return"bold"}createTags(){return[Ie.FormattingMark,Ie.FontStyle]}createMarkSpec(t,e){return{...e,attrs:t.defaults(),parseDOM:[{tag:"strong",getAttrs:t.parse},{tag:"b",getAttrs:n=>Fo(n)&&n.style.fontWeight!=="normal"?t.parse(n):!1},{style:"font-weight",getAttrs:n=>Se(n)&&/^(bold(er)?|[5-9]\d{2,})$/.test(n)?null:!1},...e.parseDOM??[]],toDOM:n=>{const{weight:r}=this.options;return r?["strong",{"font-weight":r.toString()},0]:["strong",t.dom(n),0]}}}createInputRules(){return[fm({regexp:/(?:\*\*|__)([^*_]+)(?:\*\*|__)$/,type:this.type,ignoreWhitespace:!0})]}toggleBold(t){return nf({type:this.type,selection:t})}setBold(t){return({tr:e,dispatch:n})=>{const{from:r,to:o}=Ir(t??e.selection,e.doc);return n==null||n(e.addMark(r,o,this.type.create())),!0}}removeBold(t){return({tr:e,dispatch:n})=>{const{from:r,to:o}=Ir(t??e.selection,e.doc);return e.doc.rangeHasMark(r,o,this.type)?(n==null||n(e.removeMark(r,o,this.type)),!0):!1}}shortcut(t){return this.toggleBold()(t)}};jf([ue(zne)],qa.prototype,"toggleBold",1);jf([ue()],qa.prototype,"setBold",1);jf([ue()],qa.prototype,"removeBold",1);jf([wr({shortcut:q.Bold,command:"toggleBold"})],qa.prototype,"shortcut",1);qa=jf([Ze({defaultOptions:{weight:void 0},staticKeys:["weight"]})],qa);var Fne=Object.defineProperty,Bne=Object.getOwnPropertyDescriptor,Vb=(t,e,n,r)=>{for(var o=r>1?void 0:r?Bne(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&Fne(e,n,o),o},Une={icon:"italic",label:({t})=>t(QS.LABEL),description:({t})=>t(QS.DESCRIPTION)},pf=class extends If{get name(){return"italic"}createTags(){return[Ie.FontStyle,Ie.FormattingMark]}createMarkSpec(t,e){return{...e,attrs:t.defaults(),parseDOM:[{tag:"i",getAttrs:t.parse},{tag:"em",getAttrs:t.parse},{style:"font-style=italic"},...e.parseDOM??[]],toDOM:n=>["em",t.dom(n),0]}}createKeymap(){return{"Mod-i":nf({type:this.type})}}createInputRules(){return[fm({regexp:/(?:^|[^*])\*([^*]+)\*$/,type:this.type,ignoreWhitespace:!0,updateCaptured:({fullMatch:t,start:e})=>t.startsWith("*")?{}:{fullMatch:t.slice(1),start:e+1}}),fm({regexp:/(?:^|\W)_([^_]+)_$/,type:this.type,ignoreWhitespace:!0,updateCaptured:({fullMatch:t,start:e})=>t.startsWith("_")?{}:{fullMatch:t.slice(1),start:e+1}})]}createPasteRules(){return[{type:"mark",markType:this.type,regexp:/(?:^|\W)_([^_]+)_/g},{type:"mark",markType:this.type,regexp:/\*([^*]+)\*/g}]}toggleItalic(t){return nf({type:this.type,selection:t})}shortcut(t){return this.toggleItalic()(t)}};Vb([ue(Une)],pf.prototype,"toggleItalic",1);Vb([wr({shortcut:q.Italic,command:"toggleItalic"})],pf.prototype,"shortcut",1);pf=Vb([Ze({})],pf);var Vne=Object.defineProperty,Hne=Object.getOwnPropertyDescriptor,Hb=(t,e,n,r)=>{for(var o=r>1?void 0:r?Hne(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&Vne(e,n,o),o},Wne={icon:"strikethrough",label:({t})=>t(eE.LABEL),description:({t})=>t(eE.DESCRIPTION)},hf=class extends If{get name(){return"strike"}createTags(){return[Ie.FontStyle,Ie.FormattingMark]}createMarkSpec(t,e){return{...e,attrs:t.defaults(),parseDOM:[{tag:"s",getAttrs:t.parse},{tag:"del",getAttrs:t.parse},{tag:"strike",getAttrs:t.parse},{style:"text-decoration",getAttrs:n=>n==="line-through"?{}:!1},...e.parseDOM??[]],toDOM:n=>["s",t.dom(n),0]}}toggleStrike(){return nf({type:this.type})}shortcut(t){return this.toggleStrike()(t)}createInputRules(){return[fm({regexp:/~([^~]+)~$/,type:this.type,ignoreWhitespace:!0})]}createPasteRules(){return[{regexp:/~([^~]+)~/g,type:"mark",markType:this.type}]}};Hb([ue(Wne)],hf.prototype,"toggleStrike",1);Hb([wr({shortcut:q.Strike,command:"toggleStrike"})],hf.prototype,"shortcut",1);hf=Hb([Ze({})],hf);var l$=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},Xe=(t,e,n)=>(l$(t,e,"read from private field"),n?n.call(t):e.get(t)),Rl=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},Gi=(t,e,n,r)=>(l$(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Kne='<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>',qne='<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>',Gne=encodeURIComponent(Kne),Yne=encodeURIComponent(qne),Wn,Zne=class{constructor(t){Rl(this,Wn,void 0);const e=document.createElement("div"),n=document.createElement("div");this.dom=e,Gi(this,Wn,n),this.type=t,this.createHandle(t)}createHandle(t){switch(Sn(this.dom,{position:"absolute",pointerEvents:"auto",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"100"}),Sn(Xe(this,Wn),{opacity:"0",transition:"opacity 300ms ease-in 0s"}),Xe(this,Wn).dataset.dragging="",t){case 0:Sn(this.dom,{right:"0px",top:"0px",height:"100%",width:"15px",cursor:"col-resize"}),Sn(Xe(this,Wn),{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:Sn(this.dom,{left:"0px",top:"0px",height:"100%",width:"15px",cursor:"col-resize"}),Sn(Xe(this,Wn),{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:Sn(this.dom,{bottom:"0px",width:"100%",height:"14px",cursor:"row-resize"}),Sn(Xe(this,Wn),{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:Sn(this.dom,{right:"-1px",bottom:"-2px",width:"30px",height:"30px",cursor:"nwse-resize",zIndex:"101"}),Sn(Xe(this,Wn),{height:"22px",width:"22px",backgroundRepeat:"no-repeat",backgroundImage:`url("data:image/svg+xml,${Yne}") `});break;case 4:Sn(this.dom,{left:"-1px",bottom:"-2px",width:"30px",height:"30px",cursor:"nesw-resize",zIndex:"101"}),Sn(Xe(this,Wn),{height:"22px",width:"22px",backgroundRepeat:"no-repeat",backgroundImage:`url("data:image/svg+xml,${Gne}") `});break}this.dom.append(Xe(this,Wn))}setHandleVisibility(t){const e=t||!!Xe(this,Wn).dataset.dragging;Xe(this,Wn).style.opacity=e?"1":"0"}dataSetDragging(t){Xe(this,Wn).dataset.dragging=t?"true":""}};Wn=new WeakMap;var Sp=50,c$=(t=>(t[t.Fixed=0]="Fixed",t[t.Flexible=1]="Flexible",t))(c$||{}),na,ra,oa,Jo,ia,Jne=class{constructor({node:t,view:e,getPos:n,aspectRatio:r=0,options:o,initialSize:i}){Rl(this,na,void 0),Rl(this,ra,void 0),Rl(this,oa,[]),Rl(this,Jo,void 0),Rl(this,ia,void 0);const s=this.createWrapper(t,i),a=this.createElement({node:t,view:e,getPos:n,options:o}),c=(r===1?[0,1,2,3,4]:[0,1]).map(f=>new Zne(f));for(const f of c){const p=m=>{this.startResizing(m,e,n,f)};f.dom.addEventListener("mousedown",p),Xe(this,oa).push(()=>f.dom.removeEventListener("mousedown",p)),s.append(f.dom)}const u=()=>{c.forEach(f=>f.setHandleVisibility(!0))},d=()=>{c.forEach(f=>f.setHandleVisibility(!1))};s.addEventListener("mouseover",u),s.addEventListener("mouseout",d),Xe(this,oa).push(()=>s.removeEventListener("mouseover",u),()=>s.removeEventListener("mouseout",d)),s.append(a),this.dom=s,Gi(this,ra,t),Gi(this,na,a),this.aspectRatio=r}createWrapper(t,e){const n=document.createElement("div");return n.classList.add("remirror-resizable-view"),n.style.position="relative",e?Sn(n,{width:E_(e.width),aspectRatio:`${e.width} / ${e.height}`}):Sn(n,{width:E_(t.attrs.width),aspectRatio:`${t.attrs.width} / ${t.attrs.height}`}),Sn(n,{maxWidth:"100%",minWidth:`${Sp}px`,verticalAlign:"bottom",display:"inline-block",lineHeight:"0",transition:"width 0.15s ease-out, height 0.15s ease-out"}),n}startResizing(t,e,n,r){var o,i;t.preventDefault(),r.dataSetDragging(!0),Xe(this,na).style.pointerEvents="none";const s=t.pageX,a=t.pageY,l=((o=Xe(this,na))==null?void 0:o.getBoundingClientRect().width)||0,c=((i=Xe(this,na))==null?void 0:i.getBoundingClientRect().height)||0,u=P0(100,!1,f=>{const p=f.pageX,m=f.pageY,g=p-s,y=m-a;let v=null,x=null;if(this.aspectRatio===0&&l&&c)switch(r.type){case 0:case 3:v=l+g,x=c/l*v;break;case 1:case 4:v=l-g,x=c/l*v;break;case 2:x=c+y,v=l/c*x;break}else if(this.aspectRatio===1)switch(r.type){case 0:v=l+g;break;case 1:v=l-g;break;case 2:x=c+y;break;case 3:v=l+g,x=c+y;break;case 4:v=l-g,x=c+y;break}typeof v=="number"&&v<Sp&&(this.aspectRatio===0&&l&&c?(v=Sp,x=c/l*v):this.aspectRatio===1&&(v=Sp)),v&&(Gi(this,Jo,Math.round(v)),this.dom.style.width=`${Xe(this,Jo)}px`),x&&Gi(this,ia,Math.round(x)),(v||x)&&(this.dom.style.aspectRatio=`${Xe(this,Jo)} / ${Xe(this,ia)}`)}),d=f=>{f.preventDefault(),r.dataSetDragging(!1),r.setHandleVisibility(!1),Xe(this,na).style.pointerEvents="auto",document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",d);const p=n(),m=e.state.tr.setNodeMarkup(p,void 0,{...Xe(this,ra).attrs,width:Xe(this,Jo),height:Xe(this,ia)});e.dispatch(m)};document.addEventListener("mousemove",u),document.addEventListener("mouseup",d),Xe(this,oa).push(()=>document.removeEventListener("mousemove",u)),Xe(this,oa).push(()=>document.removeEventListener("mouseup",d))}update(t){return t.type!==Xe(this,ra).type||this.aspectRatio===0&&t.attrs.width&&t.attrs.width!==Xe(this,Jo)||this.aspectRatio===1&&t.attrs.width&&t.attrs.height&&t.attrs.width!==Xe(this,Jo)&&t.attrs.height!==Xe(this,ia)||!Xne(Xe(this,ra),t,["width","height"])?!1:(Gi(this,ra,t),Gi(this,Jo,t.attrs.width),Gi(this,ia,t.attrs.height),!0)}destroy(){Xe(this,oa).forEach(t=>t())}};na=new WeakMap;ra=new WeakMap;oa=new WeakMap;Jo=new WeakMap;ia=new WeakMap;function Xne(t,e,n){return t===e||Qne(t,e,n)&&t.content.eq(e.content)}function Qne(t,e,n){const r=t.attrs,o=e.attrs,i={};for(const a of n)i[a]=null;t.attrs={...r,...i},e.attrs={...o,...i};const s=t.sameMarkup(e);return t.attrs=r,e.attrs=o,s}function E_(t){return typeof t=="number"?`${t}px`:t||void 0}var ere=Object.defineProperty,tre=Object.getOwnPropertyDescriptor,Wb=(t,e,n,r)=>{for(var o=r>1?void 0:r?tre(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&ere(e,n,o),o},nre=class extends Jne{constructor(t,e,n){super({node:t,view:e,getPos:n,aspectRatio:c$.Fixed})}createElement({node:t}){const e=document.createElement("img");return e.setAttribute("src",t.attrs.src),Sn(e,{width:"100%",minWidth:"50px",objectFit:"contain"}),e}},mf=class extends Fr{get name(){return"image"}createTags(){return[Ie.InlineNode,Ie.Media]}createNodeSpec(t,e){const{preferPastedTextContent:n}=this.options;return{inline:!0,draggable:!0,selectable:!1,...e,attrs:{...t.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(Fo(r)){const i=ore({element:r,parse:t.parse});return n&&((o=i.src)!=null&&o.startsWith("file:///"))?!1:i}return{}}},...e.parseDOM??[]],toDOM:r=>{const o=NN(r.attrs,t);return["img",{...t.dom(r),...o}]}}}insertImage(t,e){return({tr:n,dispatch:r})=>{const{from:o,to:i}=Ir(e??n.selection,n.doc),s=this.type.create(t);return r==null||r(n.replaceRangeWith(o,i,s)),!0}}uploadImage(t,e){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:t,placeholder:{type:"widget",get pos(){return a},createElement:(l,c)=>{const u=o(l,c);return e==null||e(u),u},onUpdate:(l,c,u,d)=>{n(l,c,u,d)},onDestroy:(l,c)=>{r(l,c)}},onSuccess:(l,c,u)=>this.insertImage(l,c)(u)}).validate(({tr:l,dispatch:c})=>{const u=_R(l.doc,a,this.type);return u==null?!1:(a=u,l.selection.empty||c==null||c(l.deleteSelection()),!0)},"unshift").generateCommand()(i)}}fileUploadFileHandler(t,e,n){var r;const{preferPastedTextContent:o,uploadHandler:i}=this.options;if(o&&are(e)&&((r=e.clipboardData)!=null&&r.getData("text/plain")))return!1;const{commands:s,chain:a}=this.store,l=t.map((u,d)=>({file:u,progress:f=>{s.updatePlaceholder(c[d],f)}})),c=i(l);mr(n)&&a.selectText(n);for(const u of c)a.uploadImage(u);return a.run(),!0}createPasteRules(){return[{type:"file",regexp:/image/i,fileHandler:t=>{const e=t.type==="drop"?t.pos:void 0;return this.fileUploadFileHandler(t.files,t.event,e)}}]}createNodeViews(){return this.options.enableResizing?(t,e,n)=>new nre(t,e,n):{}}};Wb([ue()],mf.prototype,"insertImage",1);Wb([ue()],mf.prototype,"uploadImage",1);mf=Wb([Ze({defaultOptions:{createPlaceholder:ire,updatePlaceholder:()=>{},destroyPlaceholder:()=>{},uploadHandler:sre,enableResizing:!1,preferPastedTextContent:!0}})],mf);function rre(t){let{width:e,height:n}=t.style;return e=e||t.getAttribute("width")||"",n=n||t.getAttribute("height")||"",{width:e,height:n}}function ore({element:t,parse:e}){const{width:n,height:r}=rre(t);return{...e(t),alt:t.getAttribute("alt")??"",height:Number.parseInt(r||"0",10)||null,src:t.getAttribute("src")??null,title:t.getAttribute("title")??"",width:Number.parseInt(n||"0",10)||null,fileName:t.getAttribute("data-file-name")??null}}function ire(t,e){const n=document.createElement("div");return n.classList.add(DJ.IMAGE_LOADER),n}function sre(t){ve(t.length>0,{code:K.EXTENSION,message:"The upload handler was applied for the image extension without any valid files"});let e=0;const n=[];for(const{file:r,progress:o}of t)n.push(()=>new Promise(i=>{const s=new FileReader;s.addEventListener("load",a=>{var l;e+=1,o(e/t.length),i({src:(l=a.target)==null?void 0:l.result,fileName:r.name})},{once:!0}),s.readAsDataURL(r)}));return n}function are(t){return t.clipboardData!==void 0}function lre(t={}){return new Ti({view(e){return new cre(e,t)}})}class cre{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r;if(n){let a=e.nodeBefore,l=e.nodeAfter;if(a||l){let c=this.editorView.nodeDOM(this.cursorPos-(a?a.nodeSize:0));if(c){let u=c.getBoundingClientRect(),d=a?u.bottom:u.top;a&&l&&(d=(d+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:u.left,right:u.right,top:d-this.width/2,bottom:d+this.width/2}}}}if(!r){let a=this.editorView.coordsAtPos(this.cursorPos);r={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let o=this.editorView.dom.offsetParent;this.element||(this.element=o.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let i,s;if(!o||o==document.body&&getComputedStyle(o).position=="static")i=-pageXOffset,s=-pageYOffset;else{let a=o.getBoundingClientRect();i=a.left-o.scrollLeft,s=a.top-o.scrollTop}this.element.style.left=r.left-i+"px",this.element.style.top=r.top-s+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,e):o;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=CR(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(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}var ure=Object.defineProperty,dre=Object.getOwnPropertyDescriptor,fre=(t,e,n,r)=>{for(var o=r>1?void 0:r?dre(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&ure(e,n,o),o},mx=class extends St{get name(){return"dropCursor"}createExternalPlugins(){const{color:t,width:e}=this.options;return[lre({color:t,width:e})]}};mx=fre([Ze({defaultOptions:{color:"black",width:1}})],mx);var pre=Object.defineProperty,hre=Object.getOwnPropertyDescriptor,u$=(t,e,n,r)=>{for(var o=r>1?void 0:r?hre(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&pre(e,n,o),o},{LABEL:mre}=$F,gre={icon:({attrs:t})=>`h${(t==null?void 0:t.level)??"1"}`,label:({t,attrs:e})=>t({...mre,values:{level:e==null?void 0:e.level}})},vre=[q.H1,q.H2,q.H3,q.H4,q.H5,q.H6],_m=class extends Fr{get name(){return"heading"}createTags(){return[Ie.Block,Ie.TextBlock,Ie.FormattingNode]}createNodeSpec(t,e){return{content:"inline*",defining:!0,draggable:!1,...e,attrs:{...t.defaults(),level:{default:this.options.defaultLevel}},parseDOM:[...this.options.levels.map(n=>({tag:`h${n}`,getAttrs:r=>({...t.parse(r),level:n})})),...e.parseDOM??[]],toDOM:n=>this.options.levels.includes(n.attrs.level)?[`h${n.attrs.level}`,t.dom(n),0]:[`h${this.options.defaultLevel}`,t.dom(n),0]}}toggleHeading(t={}){return AN({type:this.type,toggleType:"paragraph",attrs:t})}createKeymap(t){const e=this.store.getExtension(Fe),n=pe(),r=[];for(const o of this.options.levels){const i=vre[o-1]??q.H1;n[i]=dm(this.type,{level:o}),r.push({attrs:{level:o},shortcut:t(i)[0]})}return e.updateDecorated("toggleHeading",{shortcut:r}),n}createInputRules(){return this.options.levels.map(t=>QF(new RegExp(`^(#{1,${t}})\\s$`),this.type,()=>({level:t})))}createPasteRules(){return this.options.levels.map(t=>({type:"node",nodeType:this.type,regexp:new RegExp(`^#{${t}}\\s([\\s\\w]+)$`),getAttributes:()=>({level:t}),startOfTextBlock:!0}))}};u$([ue(gre)],_m.prototype,"toggleHeading",1);_m=u$([Ze({defaultOptions:{levels:[1,2,3,4,5,6],defaultLevel:1},staticKeys:["defaultLevel","levels"]})],_m);var d$={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(typeof self<"u"?self:W$,function(){return function(n){function r(i){if(o[i])return o[i].exports;var s=o[i]={i,l:!1,exports:{}};return n[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}var o={};return r.m=n,r.c=o,r.d=function(i,s,a){r.o(i,s)||Object.defineProperty(i,s,{configurable:!1,enumerable:!0,get:a})},r.n=function(i){var s=i&&i.__esModule?function(){return i.default}:function(){return i};return r.d(s,"a",s),s},r.o=function(i,s){return Object.prototype.hasOwnProperty.call(i,s)},r.p="",r(r.s=0)}([function(n,r,o){function i(){throw new TypeError("The given URL is not a string. Please verify your string|array.")}function s(c){typeof c!="string"&&i();for(var u=0,d=0,f=0,p=c.length,m=0;p--&&++m&&!(u&&-1<a.indexOf(c[m]));)c[m]==="."&&(++u,d=m);for(u=m,m=d;m--;)if(l.indexOf(c[m])!==-1){f=m+1;break}return 2>f?"":c.slice(f,u)}var a=["/",":","?","#"],l=[".","/","@"];n.exports=function(c){if(typeof c=="string")return s(c);if(Array.isArray(c)){var u=[],d,f=0;for(d=c.length;f<d;f++)u.push(s(c[f]));return u}i()}}])})})(d$);var yre=d$.exports;const xre=ki(yre);var bre=Object.defineProperty,wre=Object.getOwnPropertyDescriptor,zf=(t,e,n,r)=>{for(var o=r>1?void 0:r?wre(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&bre(e,n,o),o},kre=["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"],__="updateLink",Sre=/(?:(?:(?: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,Ga=class extends If{constructor(){super(...arguments),this._autoLinkRegexNonGlobal=void 0}get name(){return"link"}createTags(){return[Ie.Link,Ie.ExcludeInputRules]}createMarkSpec(t,e){const n="data-link-auto",r=o=>{const{defaultTarget:i,supportedTargets:s}=this.options,a=i?[...s,i]:s;return o&&mo(a,o)?{target:o}:void 0};return{inclusive:!1,excludes:"_",...e,attrs:{...t.defaults(),href:{},target:{default:this.options.defaultTarget},auto:{default:!1}},parseDOM:[{tag:"a[href]",getAttrs:o=>{if(!Fo(o))return!1;const i=o.getAttribute("href"),s=o.textContent,a=this.options.autoLink&&(o.hasAttribute(n)||i===s||(i==null?void 0:i.replace(`${this.options.defaultProtocol}//`,""))===s);return{...t.parse(o),href:i,auto:a,...r(o.getAttribute("target"))}}},...e.parseDOM??[]],toDOM:o=>{const{auto:i,target:s,...a}=NN(o.attrs,t),l=o.attrs.auto?{[n]:""}:{};return["a",{...t.dom(o),...a,rel:"noopener noreferrer nofollow",...l,...r(o.attrs.target)},0]}}}onCreate(){const{autoLinkRegex:t}=this.options;this._autoLinkRegexNonGlobal=new RegExp(`^${t.source}$`,t.flags.replace("g",""))}shortcut({tr:t}){let e="",{from:n,to:r,empty:o,$from:i}=t.selection,s=!1;const a=wi(i,this.type);if(o){const l=a??ON(t);if(!l)return!1;({text:e,from:n,to:r}=l),s=!0}return n===r?!1:(s||(e=t.doc.textBetween(n,r)),this.options.onActivateLink(e),this.options.onShortcut({activeLink:a?{attrs:a.mark.attrs,from:a.from,to:a.to}:void 0,selectedText:e,from:n,to:r}),!0)}updateLink(t,e){return n=>{const{tr:r}=n;return!(tl(r.selection)&&!vb(r.selection)||gV(r.selection)||um({trState:r,type:this.type}))&&!e?!1:(r.setMeta(this.name,{command:__,attrs:t,range:e}),DV({type:this.type,attrs:t,range:e})(n))}}selectLink(){return this.store.commands.selectMark.original(this.type)}removeLink(t){return e=>{const{tr:n}=e;return um({trState:n,type:this.type,...t})?DN({type:this.type,expand:!0,range:t})(e):!1}}createPasteRules(){return[{type:"mark",regexp:this.options.autoLinkRegex,markType:this.type,getAttributes:(t,e)=>({href:this.buildHref(cd(t)),auto:!e}),transformMatch:t=>{const e=cd(t);return!e||!this.isValidUrl(e)?!1:e}}]}createEventHandlers(){return{clickMark:(t,e)=>{const n=e.getMark(this.type);if(!n)return;const r=n.mark.attrs,o={...r,...n};if(this.options.onClick(t,o))return!0;if(!this.store.view.editable)return;let i=!1;if(this.options.openLinkOnClick){i=!0;const s=r.href;window.open(s,"_blank")}return this.options.selectTextOnClick&&(i=!0,this.store.commands.selectText(n)),i}}}createPlugin(){return{appendTransaction:(t,e,n)=>{if(t.filter(p=>!!p.getMeta(this.name)).forEach(p=>{const m=p.getMeta(this.name);if(m.command===__){const{range:g,attrs:y}=m,{selection:v,doc:x}=n,w={range:g,selection:v,doc:x,attrs:y},{from:S,to:_}=g??v;this.options.onUpdateLink(x.textBetween(S,_),w)}}),!this.options.autoLink||lx(e)-lx(n)===1||!t.some(p=>p.docChanged))return;const s=rV(t,e),a=wV(s,[zt,nn]),{mapping:l}=s,{tr:c,doc:u}=n,{updateLink:d,removeLink:f}=this.store.chain(c);if(a.forEach(({prevFrom:p,prevTo:m,from:g,to:y})=>{const v=[],x=y-g===2,w=this.getLinkMarksInRange(e.doc,p,m,!0).filter(S=>S.mark.type===this.type).map(({from:S,to:_,text:k})=>({mappedFrom:l.map(S),mappedTo:l.map(_),text:k,from:S,to:_}));w.forEach(({mappedFrom:S,mappedTo:_,from:k,to:E},C)=>this.getLinkMarksInRange(u,S,_,!0).filter(T=>T.mark.type===this.type).forEach(T=>{const A=e.doc.textBetween(k,E,void 0," "),B=u.textBetween(T.from,T.to+1,void 0," ").trim(),D=this.isValidUrl(A);this.isValidUrl(B)||(D&&(f({from:T.from,to:T.to}).tr(),w.splice(C,1)),!x&&g===y&&this.findAutoLinks(B).map(U=>this.addLinkProperties({...U,from:S+U.start,to:S+U.end})).forEach(({attrs:U,range:G,text:R})=>{d(U,G).tr(),v.push({attrs:U,range:G,text:R})}))})),this.findTextBlocksInRange(u,{from:g,to:y}).forEach(({text:S,positionStart:_})=>{this.findAutoLinks(S).map(k=>this.addLinkProperties({...k,from:_+k.start+1,to:_+k.end+1})).filter(({range:k})=>{const E=g>=k.from&&g<=k.to,C=y>=k.from&&y<=k.to;return E||C||x}).filter(({range:k})=>this.getLinkMarksInRange(c.doc,k.from,k.to,!1).length===0).filter(({range:{from:k},text:E})=>!w.some(({text:C,mappedFrom:T})=>T===k&&C===E)).forEach(({attrs:k,text:E,range:C})=>{d(k,C).tr(),v.push({attrs:k,range:C,text:E})})}),window.requestAnimationFrame(()=>{v.forEach(({attrs:S,range:_,text:k})=>{const{doc:E,selection:C}=c;this.options.onUpdateLink(k,{attrs:S,doc:E,range:_,selection:C})})})}),c.steps.length!==0)return c}}}buildHref(t){return this.options.extractHref({url:t,defaultProtocol:this.options.defaultProtocol})}getLinkMarksInRange(t,e,n,r){const o=[];if(e===n){const i=Math.max(e-1,0),s=t.resolve(i),a=wi(s,this.type);(a==null?void 0:a.mark.attrs.auto)===r&&o.push(a)}else t.nodesBetween(e,n,(i,s)=>{const l=(i.marks??[]).find(({type:c,attrs:u})=>c===this.type&&u.auto===r);l&&o.push({from:s,to:s+i.nodeSize,mark:l,text:i.textContent})});return o}findTextBlocksInRange(t,e){const n=[];return t.nodesBetween(e.from,e.to,(r,o)=>{!r.isTextblock||!r.type.allowsMarkType(this.type)||n.push({node:r,pos:o})}),n.map(r=>({text:t.textBetween(r.pos,r.pos+r.node.nodeSize,void 0," "),positionStart:r.pos}))}addLinkProperties({from:t,to:e,href:n,...r}){return{...r,range:{from:t,to:e},attrs:{href:n,auto:!0}}}findAutoLinks(t){if(this.options.findAutoLinks)return this.options.findAutoLinks(t,this.options.defaultProtocol);const e=[];for(const n of Sg(t,this.options.autoLinkRegex)){const r=cd(n);if(!r)continue;const o=this.buildHref(r);!this.isValidTLD(o)&&!o.startsWith("tel:")||e.push({text:r,href:o,start:n.index,end:n.index+r.length})}return e}isValidUrl(t){var e;return this.options.isValidUrl?this.options.isValidUrl(t,this.options.defaultProtocol):this.isValidTLD(this.buildHref(t))&&!!((e=this._autoLinkRegexNonGlobal)!=null&&e.test(t))}isValidTLD(t){const{autoLinkAllowedTLDs:e}=this.options;if(e.length===0)return!0;const n=xre(t);if(n==="")return!0;const r=wz(n.split("."));return e.includes(r)}};zf([wr({shortcut:q.InsertLink})],Ga.prototype,"shortcut",1);zf([ue()],Ga.prototype,"updateLink",1);zf([ue()],Ga.prototype,"selectLink",1);zf([ue()],Ga.prototype,"removeLink",1);Ga=zf([Ze({defaultOptions:{autoLink:!1,defaultProtocol:"",selectTextOnClick:!1,openLinkOnClick:!1,autoLinkRegex:Sre,autoLinkAllowedTLDs:kre,findAutoLinks:void 0,isValidUrl:void 0,defaultTarget:null,supportedTargets:[],extractHref:Ere},staticKeys:["autoLinkRegex"],handlerKeyOptions:{onClick:{earlyReturnValue:!0}},handlerKeys:["onActivateLink","onShortcut","onUpdateLink","onClick"],defaultPriority:at.Medium})],Ga);function Ere({url:t,defaultProtocol:e}){const n=/^((?:https?|ftp)?:)\/\//.test(t);return!n&&t.includes("@")?`mailto:${t}`:n?t:`${e}//${t}`}var _re=Object.defineProperty,Cre=Object.getOwnPropertyDescriptor,f$=(t,e,n,r)=>{for(var o=r>1?void 0:r?Cre(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(o=(r?s(e,n,o):s(o))||o);return r&&o&&_re(e,n,o),o},Cm=class extends Fr{get name(){return"hardBreak"}createTags(){return[Ie.InlineNode]}createNodeSpec(t,e){return{inline:!0,selectable:!1,atom:!0,leafText:()=>`
227
- `,...e,attrs:t.defaults(),parseDOM:[{tag:"br",getAttrs:t.parse},...e.parseDOM??[]],toDOM:n=>["br",t.dom(n)]}}createKeymap(){const t=nV(ld(BN),()=>(this.store.commands.insertHardBreak(),!0));return{"Mod-Enter":t,"Shift-Enter":t}}insertHardBreak(){return t=>{const{tr:e,dispatch:n}=t;return n==null||n(e.replaceSelectionWith(this.type.create()).scrollIntoView()),!0}}};f$([ue()],Cm.prototype,"insertHardBreak",1);Cm=f$([Ze({defaultPriority:at.Low})],Cm);const Tre=[new qa,new pf,new hf,new mf({enableResizing:!1}),new mx,new _m({levels:[1,2,3,4,5,6],defaultLevel:1}),new cf,new uf,new Ga({autoLink:!0}),new Cm];function Ore(t){const{manager:e,state:n}=VX({extensions:()=>Tre.slice(),content:t,selection:"start"});return{manager:e,state:n}}function Mre({state:t,manager:e,options:n,onChange:r,debug:o}){const i=n&&Object.entries(n).some(([,c])=>c),[s,a]=h.useState(i),l=Dn("p-4 border rounded-md outline-none appearance-none border-input bg-background",{"rounded-t-none border-t-0":s});return b.jsx("div",{className:"relative text-base val-rich-text-editor",children:b.jsx(Ine,{initialProps:{mode:"default"},children:b.jsxs(KX,{manager:e,initialContent:t,classNames:[l],children:[b.jsx(Rre,{hasOptions:i,options:n,debug:o,onShowToolbar:c=>{a(c)}}),b.jsx(ux,{}),r&&b.jsx(HX,{onChange:r})]})})})}const Rre=({options:t,hasOptions:e,onShowToolbar:n,debug:r})=>{var a,l,c,u,d,f;const o=Ib(),i=MX(),s=e||i.heading()||i.image()||i.link()||i.bulletList()||i.orderedList()||i.bold()||i.italic()||i.strike();return h.useEffect(()=>{n(s)},[s]),b.jsxs("div",{className:Dn("sticky top-0 flex flex-col py-2 border divide-y rounded-md rounded-b-none border-input bg-background divide-input",{hidden:!s}),children:[b.jsxs("div",{className:"flex flex-row items-center justify-start px-4 py-1 gap-x-2",children:[((t==null?void 0:t.headings)||i.heading())&&b.jsxs(Wee,{children:[b.jsx(Kee,{asChild:!0,className:"pr-4",children:b.jsxs("button",{children:[i.heading({level:1})&&b.jsx(Ek,{size:22}),i.heading({level:2})&&b.jsx(_k,{size:22}),i.heading({level:3})&&b.jsx(Ck,{size:22}),i.heading({level:4})&&b.jsx(Tk,{size:22}),i.heading({level:5})&&b.jsx(Ok,{size:22}),i.heading({level:6})&&b.jsx(Mk,{size:22}),!i.heading()&&"Normal"]})}),b.jsxs(e$,{children:[b.jsx(qi,{onClick:()=>{o.setBlockNodeType("paragraph").focus().run()},children:"Normal"}),((a=t==null?void 0:t.headings)==null?void 0:a.includes("h1"))&&b.jsx(qi,{onClick:()=>{o.setBlockNodeType("heading",{level:1}).focus().run()},children:b.jsx(Ek,{size:16})}),((l=t==null?void 0:t.headings)==null?void 0:l.includes("h2"))&&b.jsx(qi,{onClick:()=>{o.setBlockNodeType("heading",{level:2}).focus().run()},children:b.jsx(_k,{size:16})}),((c=t==null?void 0:t.headings)==null?void 0:c.includes("h3"))&&b.jsx(qi,{onClick:()=>{o.setBlockNodeType("heading",{level:3}).focus().run()},children:b.jsx(Ck,{size:16})}),((u=t==null?void 0:t.headings)==null?void 0:u.includes("h4"))&&b.jsx(qi,{onClick:()=>{o.setBlockNodeType("heading",{level:4}).focus().run()},children:b.jsx(Tk,{size:16})}),((d=t==null?void 0:t.headings)==null?void 0:d.includes("h5"))&&b.jsx(qi,{onClick:()=>{o.setBlockNodeType("heading",{level:5}).focus().run()},children:b.jsx(Ok,{size:16})}),((f=t==null?void 0:t.headings)==null?void 0:f.includes("h5"))&&b.jsx(qi,{onClick:()=>{o.setBlockNodeType("heading",{level:6}).focus().run()},children:b.jsx(Mk,{size:16})})]})]}),b.jsx(bl,{icon:b.jsx(L5,{size:18}),stroke:3,mark:"bold",isOption:t==null?void 0:t.bold,isActive:i.bold(),onToggle:p=>p.toggleBold().focus().run()}),b.jsx(bl,{icon:b.jsx(oL,{size:18}),stroke:3,mark:"strike",isOption:t==null?void 0:t.lineThrough,isActive:i.strike(),onToggle:p=>p.toggleStrike().focus().run()}),b.jsx(bl,{icon:b.jsx(W5,{size:18}),stroke:3,mark:"italic",isOption:t==null?void 0:t.italic,isActive:i.italic(),onToggle:p=>p.toggleItalic().focus().run()}),b.jsx(bl,{icon:b.jsx(G5,{size:18}),stroke:3,mark:"bulletList",isOption:t==null?void 0:t.ul,isActive:i.bulletList(),onToggle:p=>p.toggleBulletList().focus().run()}),b.jsx(bl,{icon:b.jsx(q5,{size:18}),stroke:3,mark:"list",isOption:t==null?void 0:t.ol,isActive:i.orderedList(),onToggle:p=>p.toggleOrderedList().focus().run()}),b.jsx(bl,{icon:b.jsx(K5,{size:18}),stroke:3,mark:"link",isOption:t==null?void 0:t.ol,isActive:i.link(),onToggle:p=>p.updateLink({href:""}).focus().run()}),((t==null?void 0:t.img)||i.image())&&b.jsxs("label",{className:"px-2 py-1 cursor-pointer",htmlFor:"val-toolbar-image-select",children:[b.jsx("input",{hidden:!0,id:"val-toolbar-image-select",accept:"image/*",type:"file",onChange:p=>{TM(p).then(m=>{o.insertImage({src:m.src,width:m.width,height:m.height,fileName:OM(m.src,m.filename??null,{width:m.width,height:m.height,sha256:m.sha256,mimeType:m.mimeType})??void 0}).focus().run()})}}),b.jsx(H5,{size:18,className:`${i.image()&&"stroke-[3px]"}`})]}),r&&b.jsx("button",{onMouseDown:p=>p.preventDefault(),onClick:()=>o.insertHardBreak().run(),children:"Br"})]}),b.jsx(Nre,{})]})};function Nre(){const t=Ib(),[e,n]=h.useState(),r=RX().link();return h.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?b.jsxs("div",{className:"flex items-center justify-start px-4 pt-1 gap-x-2",children:[b.jsx("input",{className:"bg-transparent text-accent",onChange:i=>{n(i.target.value)},defaultValue:e,placeholder:"https://"}),b.jsx("button",{className:"p-2",title:"Update",disabled:e===void 0,onClick:()=>{e!==void 0&&t.selectMark("link").updateLink({href:e}).focus().run()},children:b.jsx(y1,{size:14})}),b.jsx("button",{className:"p-2",title:"Remove",onClick:()=>{t.removeLink().focus().run()},children:b.jsx(sL,{size:13})})]}):null}function bl({stroke:t,mark:e,isOption:n,isActive:r,onToggle:o,icon:i}){const s=Ib();return!n&&!r?null:b.jsx("button",{className:Dn({"text-accent":r,"stroke-[2px]":r&&t===2,"stroke-[3px]":r&&t===3}),onClick:a=>{a.preventDefault(),o(n?s:s.selectMark(e))},children:i})}function p$({path:t,disabled:e,source:n,schema:r,registerPatchCallback:o,onSubmit:i}){return(typeof n=="string"||n===null)&&(r==null?void 0:r.type)==="string"?b.jsx(jre,{path:t,defaultValue:n,disabled:e,schema:r,registerPatchCallback:o,onSubmit:i}):(typeof n=="number"||n===null)&&(r==null?void 0:r.type)==="number"?b.jsx(T_,{defaultValue:n,disabled:e,registerPatchCallback:o,onSubmit:i}):(typeof n=="number"||typeof n=="string"||n===null)&&(r==null?void 0:r.type)==="keyOf"?b.jsx(C_,{defaultValue:n,disabled:e,registerPatchCallback:o,onSubmit:i,selector:r.selector}):(typeof n=="number"||n===null)&&(r==null?void 0:r.type)==="number"?b.jsx(T_,{defaultValue:n,disabled:e,registerPatchCallback:o,onSubmit:i}):(typeof n=="number"||typeof n=="string"||n===null)&&(r==null?void 0:r.type)==="keyOf"?b.jsx(C_,{defaultValue:n,disabled:e,registerPatchCallback:o,onSubmit:i,selector:r.selector}):(typeof n=="object"||n===null)&&(r==null?void 0:r.type)==="richtext"?b.jsx(Lre,{schema:r,onSubmit:i,defaultValue:n}):(typeof n=="object"||n===null)&&(r==null?void 0:r.type)==="image"?b.jsx(Ire,{path:t,registerPatchCallback:o,onSubmit:i,defaultValue:n}):(typeof n=="object"||n===null)&&(r==null?void 0:r.type)==="file"?b.jsx(Are,{path:t,registerPatchCallback:o,onSubmit:i,defaultValue:n}):b.jsxs("div",{children:["Unsupported schema: ",r.type," (source type: ",typeof n," source:"," ",JSON.stringify(n),")"]})}function Tm(t,e,n,r){const o=OM(e,n,r);return!o||!r?[]:[{value:{[gn]:`/public/${o}`,[sn]:"file",metadata:r},op:"replace",path:t},{value:e,op:"file",path:t,filePath:`/public/${o}`}]}function h$(t,e){const n=t+"/metadata";return[{value:e,op:"replace",path:n}]}const Pre=new TextEncoder;function $re(t){return new Promise((e,n)=>{var i;const r=(i=t.currentTarget.files)==null?void 0:i[0],o=new FileReader;o.addEventListener("load",()=>{const s=o.result;if(typeof s=="string"){const a=yt.getSHA256Hash(Pre.encode(s)),l=hg(s);e({src:s,filename:r==null?void 0:r.name,sha256:a,mimeType:l,fileExt:l&&mg(l)})}else n(s?{message:"Unexpected file result type",result:s}:{message:"Empty result"})}),r&&o.readAsDataURL(r)})}function Are({path:t,defaultValue:e,onSubmit:n,registerPatchCallback:r}){var f,p;const[o,i]=h.useState(null),[s,a]=h.useState(!1),[l,c]=h.useState(),[u,d]=h.useState();return h.useEffect(()=>{const m=e&&yt.convertFileSource(e).url;d(m)},[e]),h.useEffect(()=>{r&&r(async m=>Tm(m,(o==null?void 0:o.src)??null,(o==null?void 0:o.filename)??null,l))},[o,e]),b.jsxs(Ws,{children:[b.jsxs("div",{className:"w-fit",children:[b.jsx("div",{className:"flex flex-col justify-start p-2 border border-b-0 rounded-sm rounded-b-none gap-y-4 bg-background text-foreground border-input",children:o||u?b.jsxs("div",{className:"relative flex flex-col justify-center items-center min-h-[100px] min-w-[200px]",children:[b.jsx("div",{children:b.jsx(V5,{})}),b.jsx("div",{children:o==null?void 0:o.filename})]}):b.jsx("div",{children:"Select file below"})},t),b.jsxs("div",{className:"p-4 border border-t-0 rounded-b-sm bg-background border-input",children:[b.jsx("label",{htmlFor:`img_input:${t}`,className:"block px-1 py-2 text-sm text-center rounded-md cursor-pointer bg-primary text-background",children:"Update"}),b.jsx("input",{hidden:!0,id:`img_input:${t}`,type:"file",onChange:m=>{$re(m).then(g=>{i({src:g.src,filename:g.filename}),g.mimeType?c({sha256:g.sha256,mimeType:g.mimeType}):c(void 0)}).catch(g=>{console.error(g.message),i(null),c(void 0)})}})]})]}),n&&b.jsx(sl,{loading:s,enabled:!!o||((f=e==null?void 0:e.metadata)==null?void 0:f.mimeType)!==(l==null?void 0:l.mimeType)||((p=e==null?void 0:e.metadata)==null?void 0:p.sha256)!==(l==null?void 0:l.sha256),onClick:()=>{o?(a(!0),n(m=>Promise.resolve(Tm(m,o.src,o.filename??null,l))).finally(()=>{a(!1),i(null),c(void 0)})):l&&(a(!0),n(m=>Promise.resolve(h$(m,l))).finally(()=>{a(!1),i(null),c(void 0)}))}})]})}function Ire({path:t,defaultValue:e,onSubmit:n,registerPatchCallback:r}){var m,g,y,v,x,w,S,_,k,E,C,T;const[o,i]=h.useState(null),[s,a]=h.useState(!1),[l,c]=h.useState(),[u,d]=h.useState(),[f,p]=h.useState();return h.useEffect(()=>{p(e&&yt.convertFileSource(e).url)},[e]),h.useEffect(()=>{r&&r(async A=>Tm(A,(o==null?void 0:o.src)??null,(o==null?void 0:o.filename)??null,l))},[o,e]),h.useEffect(()=>{var A;if(u)if(l){const B={...l,hotspot:u};c(B)}else e!=null&&e.metadata?c({...e.metadata,hotspot:u}):console.error("Neither image metadata nor value is set");else(A=e==null?void 0:e.metadata)!=null&&A.hotspot&&d(e.metadata.hotspot)},[u,e]),b.jsxs(Ws,{children:[b.jsxs("div",{className:"w-fit",children:[b.jsx("div",{className:"flex flex-col justify-start p-2 border border-b-0 rounded-sm rounded-b-none gap-y-4 bg-background text-foreground border-input",children:o||f?b.jsxs("div",{className:"relative",children:[u&&b.jsx("div",{className:"rounded-full h-[12px] w-[12px] bg-background mix-blend-difference border-accent border-2 absolute pointer-events-none",style:{top:`${u.y*100}%`,left:`${u.x*100}%`}}),b.jsx("img",{src:(o==null?void 0:o.src)||f,draggable:!1,className:"object-contain w-full max-h-[500px]",style:{cursor:"crosshair"},onClick:A=>{const{width:B,height:D,left:Z,top:U}=A.currentTarget.getBoundingClientRect(),G=(A.clientX-6-Z)/B,R=(A.clientY-6-U)/D;d({x:G,y:R,width:1,height:1})}})]}):b.jsx("div",{children:"Select image below"})},t),b.jsxs("div",{className:"p-4 border border-t-0 rounded-b-sm bg-background border-input",children:[b.jsx("label",{htmlFor:`img_input:${t}`,className:"block px-1 py-2 text-sm text-center rounded-md cursor-pointer bg-primary text-background",children:"Update"}),b.jsx("input",{hidden:!0,id:`img_input:${t}`,type:"file",onChange:A=>{TM(A).then(B=>{i({src:B.src,filename:B.filename}),B.width&&B.height&&B.mimeType?c({sha256:B.sha256,width:B.width,height:B.height,mimeType:B.mimeType,hotspot:u}):(c(void 0),d(void 0))}).catch(B=>{console.error(B.message),i(null),d(void 0),c(void 0)})}})]})]}),n&&b.jsx(sl,{loading:s,enabled:!!o||((g=(m=e==null?void 0:e.metadata)==null?void 0:m.hotspot)==null?void 0:g.height)!==(u==null?void 0:u.height)||((v=(y=e==null?void 0:e.metadata)==null?void 0:y.hotspot)==null?void 0:v.width)!==(u==null?void 0:u.width)||((w=(x=e==null?void 0:e.metadata)==null?void 0:x.hotspot)==null?void 0:w.x)!==(u==null?void 0:u.x)||((_=(S=e==null?void 0:e.metadata)==null?void 0:S.hotspot)==null?void 0:_.y)!==(u==null?void 0:u.y)||((k=e==null?void 0:e.metadata)==null?void 0:k.width)!==(l==null?void 0:l.width)||((E=e==null?void 0:e.metadata)==null?void 0:E.height)!==(l==null?void 0:l.height)||((C=e==null?void 0:e.metadata)==null?void 0:C.mimeType)!==(l==null?void 0:l.mimeType)||((T=e==null?void 0:e.metadata)==null?void 0:T.sha256)!==(l==null?void 0:l.sha256),onClick:()=>{o?(a(!0),n(A=>Promise.resolve(Tm(A,o.src,o.filename??null,l))).finally(()=>{a(!1),i(null),c(void 0)})):l&&(a(!0),n(A=>Promise.resolve(h$(A,l))).finally(()=>{a(!1),i(null),c(void 0)}))}})]})}function Dre(t,e){const{templateStrings:n,exprs:r,files:o}=e?A8(e):{[sn]:"richtext",templateStrings:[""],exprs:[],files:{}};return[{op:"replace",path:t,value:{templateStrings:n,exprs:r,[sn]:"richtext"}},...Object.entries(o).map(([i,s])=>({op:"file",path:t,filePath:i,value:s}))]}function Lre({defaultValue:t,schema:e,onSubmit:n}){const[r,o]=h.useState(!1),[i,s]=h.useState(!1),[a,l]=h.useState();h.useEffect(()=>{o(!0),l(void 0)},[t]);const{state:c,manager:u}=Ore(t&&H8(hM(t)));return b.jsxs(Ws,{children:[b.jsx(Mre,{options:e.options,onChange:d=>{o(!0),l(d)},state:c,manager:u}),n&&b.jsx(sl,{loading:i,enabled:r,onClick:()=>{if(a){s(!0);const d=V8.safeParse(a);d.success?n(async f=>Dre(f,d.data)).finally(()=>{s(!1),o(!1)}):(s(!1),alert(`Could not parse Rich Text
227
+ `,...e,attrs:t.defaults(),parseDOM:[{tag:"br",getAttrs:t.parse},...e.parseDOM??[]],toDOM:n=>["br",t.dom(n)]}}createKeymap(){const t=nV(ld(BN),()=>(this.store.commands.insertHardBreak(),!0));return{"Mod-Enter":t,"Shift-Enter":t}}insertHardBreak(){return t=>{const{tr:e,dispatch:n}=t;return n==null||n(e.replaceSelectionWith(this.type.create()).scrollIntoView()),!0}}};f$([ue()],Cm.prototype,"insertHardBreak",1);Cm=f$([Ze({defaultPriority:at.Low})],Cm);const Tre=[new qa,new pf,new hf,new mf({enableResizing:!1}),new mx,new _m({levels:[1,2,3,4,5,6],defaultLevel:1}),new cf,new uf,new Ga({autoLink:!0}),new Cm];function Ore(t){const{manager:e,state:n}=VX({extensions:()=>Tre.slice(),content:t,selection:"start"});return{manager:e,state:n}}function Mre({state:t,manager:e,options:n,onChange:r,debug:o}){const i=n&&Object.entries(n).some(([,c])=>c),[s,a]=h.useState(i),l=Dn("p-4 border rounded-md outline-none appearance-none border-input bg-background",{"rounded-t-none border-t-0":s});return b.jsx("div",{className:"text-base val-rich-text-editor",children:b.jsx(KX,{manager:e,initialContent:t,classNames:[l],children:b.jsxs(Ine,{initialProps:{mode:"default"},children:[b.jsx(Rre,{hasOptions:i,options:n,debug:o,onShowToolbar:c=>{a(c)}}),b.jsx(ux,{}),r&&b.jsx(HX,{onChange:r})]})})})}const Rre=({options:t,hasOptions:e,onShowToolbar:n,debug:r})=>{var l,c,u,d,f,p;const o=Ib(),i=MX(),s=e||i.heading()||i.image()||i.link()||i.bulletList()||i.orderedList()||i.bold()||i.italic()||i.strike();h.useEffect(()=>{n(s)},[s]);const a=h.useRef(null);return b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"h-0",ref:a}),b.jsxs("div",{className:Dn("sticky top-0 flex flex-col py-2 z-[40] border divide-y rounded-md rounded-b-none border-input bg-background",{hidden:!s}),children:[b.jsxs("div",{className:"flex flex-row items-center justify-start px-4 py-1 gap-x-3",children:[((t==null?void 0:t.headings)||i.heading())&&b.jsxs(Wee,{children:[b.jsx(Kee,{asChild:!0,className:"pr-4",children:b.jsxs("button",{children:[i.heading({level:1})&&b.jsx(Ek,{size:22}),i.heading({level:2})&&b.jsx(_k,{size:22}),i.heading({level:3})&&b.jsx(Ck,{size:22}),i.heading({level:4})&&b.jsx(Tk,{size:22}),i.heading({level:5})&&b.jsx(Ok,{size:22}),i.heading({level:6})&&b.jsx(Mk,{size:22}),!i.heading()&&"Normal"]})}),b.jsxs(e$,{container:a.current,children:[b.jsx(qi,{onClick:()=>{o.setBlockNodeType("paragraph").focus().run()},children:"Normal"}),((l=t==null?void 0:t.headings)==null?void 0:l.includes("h1"))&&b.jsx(qi,{onClick:()=>{o.setBlockNodeType("heading",{level:1}).focus().run()},children:b.jsx(Ek,{size:16})}),((c=t==null?void 0:t.headings)==null?void 0:c.includes("h2"))&&b.jsx(qi,{onClick:()=>{o.setBlockNodeType("heading",{level:2}).focus().run()},children:b.jsx(_k,{size:16})}),((u=t==null?void 0:t.headings)==null?void 0:u.includes("h3"))&&b.jsx(qi,{onClick:()=>{o.setBlockNodeType("heading",{level:3}).focus().run()},children:b.jsx(Ck,{size:16})}),((d=t==null?void 0:t.headings)==null?void 0:d.includes("h4"))&&b.jsx(qi,{onClick:()=>{o.setBlockNodeType("heading",{level:4}).focus().run()},children:b.jsx(Tk,{size:16})}),((f=t==null?void 0:t.headings)==null?void 0:f.includes("h5"))&&b.jsx(qi,{onClick:()=>{o.setBlockNodeType("heading",{level:5}).focus().run()},children:b.jsx(Ok,{size:16})}),((p=t==null?void 0:t.headings)==null?void 0:p.includes("h5"))&&b.jsx(qi,{onClick:()=>{o.setBlockNodeType("heading",{level:6}).focus().run()},children:b.jsx(Mk,{size:16})})]})]}),b.jsx(bl,{icon:b.jsx(L5,{size:18}),stroke:3,mark:"bold",isOption:t==null?void 0:t.bold,isActive:i.bold(),onToggle:m=>m.toggleBold().focus().run()}),b.jsx(bl,{icon:b.jsx(oL,{size:18}),stroke:3,mark:"strike",isOption:t==null?void 0:t.lineThrough,isActive:i.strike(),onToggle:m=>m.toggleStrike().focus().run()}),b.jsx(bl,{icon:b.jsx(W5,{size:18}),stroke:3,mark:"italic",isOption:t==null?void 0:t.italic,isActive:i.italic(),onToggle:m=>m.toggleItalic().focus().run()}),b.jsx(bl,{icon:b.jsx(G5,{size:18}),stroke:3,mark:"bulletList",isOption:t==null?void 0:t.ul,isActive:i.bulletList(),onToggle:m=>m.toggleBulletList().focus().run()}),b.jsx(bl,{icon:b.jsx(q5,{size:18}),stroke:3,mark:"list",isOption:t==null?void 0:t.ol,isActive:i.orderedList(),onToggle:m=>m.toggleOrderedList().focus().run()}),b.jsx(bl,{icon:b.jsx(K5,{size:18}),stroke:3,mark:"link",isOption:t==null?void 0:t.ol,isActive:i.link(),onToggle:m=>m.updateLink({href:""}).focus().run()}),((t==null?void 0:t.img)||i.image())&&b.jsxs("label",{className:"cursor-pointer",htmlFor:"val-toolbar-image-select",children:[b.jsx("input",{hidden:!0,id:"val-toolbar-image-select",accept:"image/*",type:"file",onChange:m=>{TM(m).then(g=>{o.insertImage({src:g.src,width:g.width,height:g.height,fileName:OM(g.src,g.filename??null,{width:g.width,height:g.height,sha256:g.sha256,mimeType:g.mimeType})??void 0}).focus().run()})}}),b.jsx(H5,{size:18,className:`${i.image()&&"stroke-[3px]"}`})]}),r&&b.jsx("button",{onMouseDown:m=>m.preventDefault(),onClick:()=>o.insertHardBreak().run(),children:"Br"})]}),b.jsx(Nre,{})]})]})};function Nre(){const t=Ib(),[e,n]=h.useState(),r=RX().link();return h.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?b.jsxs("div",{className:"flex items-center justify-start px-4 pt-1 gap-x-2",children:[b.jsx("input",{className:"bg-transparent text-accent",onChange:i=>{n(i.target.value)},defaultValue:e,placeholder:"https://"}),b.jsx("button",{className:"p-2",title:"Update",disabled:e===void 0,onClick:()=>{e!==void 0&&t.selectMark("link").updateLink({href:e}).focus().run()},children:b.jsx(y1,{size:14})}),b.jsx("button",{className:"p-2",title:"Remove",onClick:()=>{t.removeLink().focus().run()},children:b.jsx(sL,{size:13})})]}):null}function bl({stroke:t,mark:e,isOption:n,isActive:r,onToggle:o,icon:i}){const s=Ib();return!n&&!r?null:b.jsx("button",{className:Dn({"text-accent":r,"stroke-[2px]":r&&t===2,"stroke-[3px]":r&&t===3}),onClick:a=>{a.preventDefault(),o(n?s:s.selectMark(e))},children:i})}function p$({path:t,disabled:e,source:n,schema:r,registerPatchCallback:o,onSubmit:i}){return(typeof n=="string"||n===null)&&(r==null?void 0:r.type)==="string"?b.jsx(jre,{path:t,defaultValue:n,disabled:e,schema:r,registerPatchCallback:o,onSubmit:i}):(typeof n=="number"||n===null)&&(r==null?void 0:r.type)==="number"?b.jsx(T_,{defaultValue:n,disabled:e,registerPatchCallback:o,onSubmit:i}):(typeof n=="number"||typeof n=="string"||n===null)&&(r==null?void 0:r.type)==="keyOf"?b.jsx(C_,{defaultValue:n,disabled:e,registerPatchCallback:o,onSubmit:i,selector:r.selector}):(typeof n=="number"||n===null)&&(r==null?void 0:r.type)==="number"?b.jsx(T_,{defaultValue:n,disabled:e,registerPatchCallback:o,onSubmit:i}):(typeof n=="number"||typeof n=="string"||n===null)&&(r==null?void 0:r.type)==="keyOf"?b.jsx(C_,{defaultValue:n,disabled:e,registerPatchCallback:o,onSubmit:i,selector:r.selector}):(typeof n=="object"||n===null)&&(r==null?void 0:r.type)==="richtext"?b.jsx(Lre,{schema:r,onSubmit:i,defaultValue:n}):(typeof n=="object"||n===null)&&(r==null?void 0:r.type)==="image"?b.jsx(Ire,{path:t,registerPatchCallback:o,onSubmit:i,defaultValue:n}):(typeof n=="object"||n===null)&&(r==null?void 0:r.type)==="file"?b.jsx(Are,{path:t,registerPatchCallback:o,onSubmit:i,defaultValue:n}):b.jsxs("div",{children:["Unsupported schema: ",r.type," (source type: ",typeof n," source:"," ",JSON.stringify(n),")"]})}function Tm(t,e,n,r){const o=OM(e,n,r);return!o||!r?[]:[{value:{[gn]:`/public/${o}`,[sn]:"file",metadata:r},op:"replace",path:t},{value:e,op:"file",path:t,filePath:`/public/${o}`}]}function h$(t,e){const n=t+"/metadata";return[{value:e,op:"replace",path:n}]}const Pre=new TextEncoder;function $re(t){return new Promise((e,n)=>{var i;const r=(i=t.currentTarget.files)==null?void 0:i[0],o=new FileReader;o.addEventListener("load",()=>{const s=o.result;if(typeof s=="string"){const a=yt.getSHA256Hash(Pre.encode(s)),l=hg(s);e({src:s,filename:r==null?void 0:r.name,sha256:a,mimeType:l,fileExt:l&&mg(l)})}else n(s?{message:"Unexpected file result type",result:s}:{message:"Empty result"})}),r&&o.readAsDataURL(r)})}function Are({path:t,defaultValue:e,onSubmit:n,registerPatchCallback:r}){var f,p;const[o,i]=h.useState(null),[s,a]=h.useState(!1),[l,c]=h.useState(),[u,d]=h.useState();return h.useEffect(()=>{const m=e&&yt.convertFileSource(e).url;d(m)},[e]),h.useEffect(()=>{r&&r(async m=>Tm(m,(o==null?void 0:o.src)??null,(o==null?void 0:o.filename)??null,l))},[o,e]),b.jsxs(Ws,{children:[b.jsxs("div",{className:"w-fit",children:[b.jsx("div",{className:"flex flex-col justify-start p-2 border border-b-0 rounded-sm rounded-b-none gap-y-4 bg-background text-foreground border-input",children:o||u?b.jsxs("div",{className:"relative flex flex-col justify-center items-center min-h-[100px] min-w-[200px]",children:[b.jsx("div",{children:b.jsx(V5,{})}),b.jsx("div",{children:o==null?void 0:o.filename})]}):b.jsx("div",{children:"Select file below"})},t),b.jsxs("div",{className:"p-4 border border-t-0 rounded-b-sm bg-background border-input",children:[b.jsx("label",{htmlFor:`img_input:${t}`,className:"block px-1 py-2 text-sm text-center rounded-md cursor-pointer bg-primary text-background",children:"Update"}),b.jsx("input",{hidden:!0,id:`img_input:${t}`,type:"file",onChange:m=>{$re(m).then(g=>{i({src:g.src,filename:g.filename}),g.mimeType?c({sha256:g.sha256,mimeType:g.mimeType}):c(void 0)}).catch(g=>{console.error(g.message),i(null),c(void 0)})}})]})]}),n&&b.jsx(sl,{loading:s,enabled:!!o||((f=e==null?void 0:e.metadata)==null?void 0:f.mimeType)!==(l==null?void 0:l.mimeType)||((p=e==null?void 0:e.metadata)==null?void 0:p.sha256)!==(l==null?void 0:l.sha256),onClick:()=>{o?(a(!0),n(m=>Promise.resolve(Tm(m,o.src,o.filename??null,l))).finally(()=>{a(!1),i(null),c(void 0)})):l&&(a(!0),n(m=>Promise.resolve(h$(m,l))).finally(()=>{a(!1),i(null),c(void 0)}))}})]})}function Ire({path:t,defaultValue:e,onSubmit:n,registerPatchCallback:r}){var m,g,y,v,x,w,S,_,k,E,C,T;const[o,i]=h.useState(null),[s,a]=h.useState(!1),[l,c]=h.useState(),[u,d]=h.useState(),[f,p]=h.useState();return h.useEffect(()=>{p(e&&yt.convertFileSource(e).url)},[e]),h.useEffect(()=>{r&&r(async A=>Tm(A,(o==null?void 0:o.src)??null,(o==null?void 0:o.filename)??null,l))},[o,e]),h.useEffect(()=>{var A;if(u)if(l){const B={...l,hotspot:u};c(B)}else e!=null&&e.metadata?c({...e.metadata,hotspot:u}):console.error("Neither image metadata nor value is set");else(A=e==null?void 0:e.metadata)!=null&&A.hotspot&&d(e.metadata.hotspot)},[u,e]),b.jsxs(Ws,{children:[b.jsxs("div",{className:"w-fit",children:[b.jsx("div",{className:"flex flex-col justify-start p-2 border border-b-0 rounded-sm rounded-b-none gap-y-4 bg-background text-foreground border-input",children:o||f?b.jsxs("div",{className:"relative",children:[u&&b.jsx("div",{className:"rounded-full h-[12px] w-[12px] bg-background mix-blend-difference border-accent border-2 absolute pointer-events-none",style:{top:`${u.y*100}%`,left:`${u.x*100}%`}}),b.jsx("img",{src:(o==null?void 0:o.src)||f,draggable:!1,className:"object-contain w-full max-h-[500px]",style:{cursor:"crosshair"},onClick:A=>{const{width:B,height:D,left:Z,top:U}=A.currentTarget.getBoundingClientRect(),G=(A.clientX-6-Z)/B,R=(A.clientY-6-U)/D;d({x:G,y:R,width:1,height:1})}})]}):b.jsx("div",{children:"Select image below"})},t),b.jsxs("div",{className:"p-4 border border-t-0 rounded-b-sm bg-background border-input",children:[b.jsx("label",{htmlFor:`img_input:${t}`,className:"block px-1 py-2 text-sm text-center rounded-md cursor-pointer bg-primary text-background",children:"Update"}),b.jsx("input",{hidden:!0,id:`img_input:${t}`,type:"file",onChange:A=>{TM(A).then(B=>{i({src:B.src,filename:B.filename}),B.width&&B.height&&B.mimeType?c({sha256:B.sha256,width:B.width,height:B.height,mimeType:B.mimeType,hotspot:u}):(c(void 0),d(void 0))}).catch(B=>{console.error(B.message),i(null),d(void 0),c(void 0)})}})]})]}),n&&b.jsx(sl,{loading:s,enabled:!!o||((g=(m=e==null?void 0:e.metadata)==null?void 0:m.hotspot)==null?void 0:g.height)!==(u==null?void 0:u.height)||((v=(y=e==null?void 0:e.metadata)==null?void 0:y.hotspot)==null?void 0:v.width)!==(u==null?void 0:u.width)||((w=(x=e==null?void 0:e.metadata)==null?void 0:x.hotspot)==null?void 0:w.x)!==(u==null?void 0:u.x)||((_=(S=e==null?void 0:e.metadata)==null?void 0:S.hotspot)==null?void 0:_.y)!==(u==null?void 0:u.y)||((k=e==null?void 0:e.metadata)==null?void 0:k.width)!==(l==null?void 0:l.width)||((E=e==null?void 0:e.metadata)==null?void 0:E.height)!==(l==null?void 0:l.height)||((C=e==null?void 0:e.metadata)==null?void 0:C.mimeType)!==(l==null?void 0:l.mimeType)||((T=e==null?void 0:e.metadata)==null?void 0:T.sha256)!==(l==null?void 0:l.sha256),onClick:()=>{o?(a(!0),n(A=>Promise.resolve(Tm(A,o.src,o.filename??null,l))).finally(()=>{a(!1),i(null),c(void 0)})):l&&(a(!0),n(A=>Promise.resolve(h$(A,l))).finally(()=>{a(!1),i(null),c(void 0)}))}})]})}function Dre(t,e){const{templateStrings:n,exprs:r,files:o}=e?A8(e):{[sn]:"richtext",templateStrings:[""],exprs:[],files:{}};return[{op:"replace",path:t,value:{templateStrings:n,exprs:r,[sn]:"richtext"}},...Object.entries(o).map(([i,s])=>({op:"file",path:t,filePath:i,value:s}))]}function Lre({defaultValue:t,schema:e,onSubmit:n}){const[r,o]=h.useState(!1),[i,s]=h.useState(!1),[a,l]=h.useState();h.useEffect(()=>{o(!0),l(void 0)},[t]);const{state:c,manager:u}=Ore(t&&H8(hM(t)));return b.jsxs(Ws,{children:[b.jsx(Mre,{options:e.options,onChange:d=>{o(!0),l(d)},state:c,manager:u}),n&&b.jsx(sl,{loading:i,enabled:r,onClick:()=>{if(a){s(!0);const d=V8.safeParse(a);d.success?n(async f=>Dre(f,d.data)).finally(()=>{s(!1),o(!1)}):(s(!1),alert(`Could not parse Rich Text
228
228
  `+JSON.stringify(d.error,null,2)))}}})]})}function C_({disabled:t,defaultValue:e,registerPatchCallback:n,onSubmit:r,selector:o}){const i=Eoe(o),a=(p=>Array.isArray(p.moduleSource)?{type:"number",values:Object.keys(p.moduleSource).map(m=>parseInt(m))}:{type:"string",values:Object.keys(p.moduleSource??["ERROR fetching source"])})(i),[l,c]=h.useState(e||a.values[0]),[u,d]=h.useState(!1);h.useEffect(()=>{d(t)},[t]);const f=p=>{if(a.type==="number"){if(p==="")throw new Error("Value cannot be empty");if(Number.isNaN(Number(p)))throw new Error("Value was not a number: "+JSON.stringify(p));return Number(p)}return p};return h.useEffect(()=>{n&&n(async p=>[{op:"replace",path:p,value:l}])},[l]),b.jsxs(Ws,{children:[b.jsxs(FM,{defaultValue:l.toString(),disabled:u,onValueChange:p=>{c(f(p))},children:[b.jsx(G1,{children:b.jsx(BM,{placeholder:"Select a value"})}),b.jsx(Y1,{children:a.values.map(p=>b.jsx(Z1,{value:p.toString(),children:p.toString()},p))})]}),r&&b.jsx(sl,{loading:u,enabled:e!==l,onClick:()=>{d(!0),r(async p=>[{op:"replace",path:p,value:l}]).finally(()=>{d(!1)})}})]})}function T_({disabled:t,defaultValue:e,registerPatchCallback:n,onSubmit:r}){const[o,i]=h.useState(e||0),[s,a]=h.useState(!1);h.useEffect(()=>{a(t)},[t]);const l=h.useRef(null);return h.useEffect(()=>{n&&n(async c=>{var u;return[{op:"replace",path:c,value:Number((u=l.current)==null?void 0:u.value)||0}]})},[]),b.jsxs(Ws,{children:[b.jsx(W1,{ref:l,disabled:s,defaultValue:o??0,onChange:c=>i(Number(c.target.value)),type:"number"}),r&&b.jsx(sl,{loading:s,enabled:e!==o,onClick:()=>{a(!0),r(async c=>{var u;return[{op:"replace",path:c,value:Number((u=l.current)==null?void 0:u.value)||0}]}).finally(()=>{a(!1)})}})]})}function jre({disabled:t,defaultValue:e,path:n,schema:r,registerPatchCallback:o,onSubmit:i}){const[s,a]=h.useState(e||""),[l,c]=h.useState(!1);h.useEffect(()=>{c(t)},[t]);const u=h.useRef(null);h.useEffect(()=>{o&&o(async p=>{var m;return[{op:"replace",path:p,value:((m=u.current)==null?void 0:m.value)||""}]})},[]);const f=new dO(r.options?{...r.options,regexp:r.options.regexp?new RegExp(r.options.regexp.source,r.options.regexp.flags):void 0}:void 0).validate(n,s);return b.jsxs(Ws,{children:[b.jsx(W1,{ref:u,disabled:l,defaultValue:s??"",onChange:p=>a(p.target.value)}),i&&b.jsx(sl,{validationErrors:f&&f[n],loading:l,enabled:e!==s&&!f,onClick:()=>{c(!0),i(async p=>{var m;return[{op:"replace",path:p,value:((m=u.current)==null?void 0:m.value)||""}]}).finally(()=>{c(!1)})}})]})}function zre({errors:t}){return b.jsx("div",{className:"flex flex-col p-2 text-sm rounded-md gap-y-1 text-destructive-foreground bg-destructive",children:t.map((e,n)=>b.jsx("div",{children:e.message},n))})}function Ws({children:t,className:e}){return b.jsx("div",{className:Dn("relative max-w-lg px-4 pt-4",e),children:t})}function sl({loading:t,enabled:e,validationErrors:n,onClick:r}){const{session:o}=x1(),i=o.status==="success"&&o.data.mode==="proxy";return b.jsx("div",{className:"sticky bottom-0 m-4 mt-2 ml-0",children:b.jsxs("div",{className:"flex justify-start w-full gap-2 text-sm",children:[b.jsx(vc,{disabled:t||!e,onClick:r,children:t?i?"Staging...":"Saving...":i?"Stage":"Save"})," ",n?b.jsx(zre,{errors:n||[]}):b.jsx("span",{})]})})}const Kb=h.forwardRef(({className:t,...e},n)=>b.jsx("div",{ref:n,className:ze("rounded-lg border bg-card text-card-foreground shadow-sm",t),...e}));Kb.displayName="Card";const Fre=h.forwardRef(({className:t,...e},n)=>b.jsx("div",{ref:n,className:ze("flex flex-col space-y-1.5 p-6",t),...e}));Fre.displayName="CardHeader";const Bre=h.forwardRef(({className:t,...e},n)=>b.jsx("h3",{ref:n,className:ze("text-2xl font-semibold leading-none tracking-tight",t),...e}));Bre.displayName="CardTitle";const Ure=h.forwardRef(({className:t,...e},n)=>b.jsx("p",{ref:n,className:ze("text-sm text-muted-foreground",t),...e}));Ure.displayName="CardDescription";const Vre=h.forwardRef(({className:t,...e},n)=>b.jsx("div",{ref:n,className:ze("p-6 pt-0",t),...e}));Vre.displayName="CardContent";const Hre=h.forwardRef(({className:t,...e},n)=>b.jsx("div",{ref:n,className:ze("flex items-center p-6 pt-0",t),...e}));Hre.displayName="CardFooter";const m$=h.forwardRef(({className:t,...e},n)=>b.jsx(S1,{className:ze("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:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-accent data-[state=unchecked]:bg-primary",t),...e,ref:n,children:b.jsx(S4,{className:ze("pointer-events-none block h-[18px] w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));m$.displayName=S1.displayName;const g$="Dialog",[v$,tie]=Lr(g$),[Wre,yo]=v$(g$),Kre=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!0}=t,a=h.useRef(null),l=h.useRef(null),[c=!1,u]=Ao({prop:r,defaultProp:o,onChange:i});return h.createElement(Wre,{scope:e,triggerRef:a,contentRef:l,contentId:ao(),titleId:ao(),descriptionId:ao(),open:c,onOpenChange:u,onOpenToggle:h.useCallback(()=>u(d=>!d),[u]),modal:s},n)},qre="DialogTrigger",Gre=h.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,o=yo(qre,n),i=We(e,o.triggerRef);return h.createElement(Re.button,z({type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":qb(o.open)},r,{ref:i,onClick:se(t.onClick,o.onOpenToggle)}))}),y$="DialogPortal",[Yre,x$]=v$(y$,{forceMount:void 0}),Zre=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:o}=t,i=yo(y$,e);return h.createElement(Yre,{scope:e,forceMount:n},h.Children.map(r,s=>h.createElement(Hn,{present:n||i.open},h.createElement(sg,{asChild:!0,container:o},s))))},gx="DialogOverlay",Jre=h.forwardRef((t,e)=>{const n=x$(gx,t.__scopeDialog),{forceMount:r=n.forceMount,...o}=t,i=yo(gx,t.__scopeDialog);return i.modal?h.createElement(Hn,{present:r||i.open},h.createElement(Xre,z({},o,{ref:e}))):null}),Xre=h.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,o=yo(gx,n);return h.createElement(cg,{as:mi,allowPinchZoom:!0,shards:[o.contentRef]},h.createElement(Re.div,z({"data-state":qb(o.open)},r,{ref:e,style:{pointerEvents:"auto",...r.style}})))}),gf="DialogContent",Qre=h.forwardRef((t,e)=>{const n=x$(gf,t.__scopeDialog),{forceMount:r=n.forceMount,...o}=t,i=yo(gf,t.__scopeDialog);return h.createElement(Hn,{present:r||i.open},i.modal?h.createElement(eoe,z({},o,{ref:e})):h.createElement(toe,z({},o,{ref:e})))}),eoe=h.forwardRef((t,e)=>{const n=yo(gf,t.__scopeDialog),r=h.useRef(null),o=We(e,n.contentRef,r);return h.useEffect(()=>{const i=r.current;if(i)return ag(i)},[]),h.createElement(b$,z({},t,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:se(t.onCloseAutoFocus,i=>{var s;i.preventDefault(),(s=n.triggerRef.current)===null||s===void 0||s.focus()}),onPointerDownOutside:se(t.onPointerDownOutside,i=>{const s=i.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&i.preventDefault()}),onFocusOutside:se(t.onFocusOutside,i=>i.preventDefault())}))}),toe=h.forwardRef((t,e)=>{const n=yo(gf,t.__scopeDialog),r=h.useRef(!1),o=h.useRef(!1);return h.createElement(b$,z({},t,{ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s;if((s=t.onCloseAutoFocus)===null||s===void 0||s.call(t,i),!i.defaultPrevented){var a;r.current||(a=n.triggerRef.current)===null||a===void 0||a.focus(),i.preventDefault()}r.current=!1,o.current=!1},onInteractOutside:i=>{var s,a;(s=t.onInteractOutside)===null||s===void 0||s.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const l=i.target;((a=n.triggerRef.current)===null||a===void 0?void 0:a.contains(l))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}}))}),b$=h.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...s}=t,a=yo(gf,n),l=h.useRef(null),c=We(e,l);return ng(),h.createElement(h.Fragment,null,h.createElement(rg,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i},h.createElement(tg,z({role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":qb(a.open)},s,{ref:c,onDismiss:()=>a.onOpenChange(!1)}))),!1)}),noe="DialogTitle",roe=h.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,o=yo(noe,n);return h.createElement(Re.h2,z({id:o.titleId},r,{ref:e}))}),ooe="DialogDescription",ioe=h.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,o=yo(ooe,n);return h.createElement(Re.p,z({id:o.descriptionId},r,{ref:e}))}),soe="DialogClose",aoe=h.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,o=yo(soe,n);return h.createElement(Re.button,z({type:"button"},r,{ref:e,onClick:se(t.onClick,()=>o.onOpenChange(!1))}))});function qb(t){return t?"open":"closed"}const loe=Kre,coe=Gre,uoe=Zre,w$=Jre,k$=Qre,S$=roe,E$=ioe,_$=aoe,doe=loe,foe=coe,poe=uoe,O_=_$,C$=h.forwardRef(({className:t,...e},n)=>b.jsx(w$,{ref:n,className:ze("fixed inset-0 z-50 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",t),...e}));C$.displayName=w$.displayName;const T$=h.forwardRef(({className:t,children:e,...n},r)=>b.jsxs(poe,{children:[b.jsx(C$,{}),b.jsxs(k$,{ref:r,className:ze("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background 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",t),...n,children:[e,b.jsxs(_$,{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-accent data-[state=open]:text-muted-foreground",children:[b.jsx(Oh,{className:"w-4 h-4"}),b.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));T$.displayName=k$.displayName;const O$=({className:t,...e})=>b.jsx("div",{className:ze("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});O$.displayName="DialogHeader";const M$=({className:t,...e})=>b.jsx("div",{className:ze("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});M$.displayName="DialogFooter";const R$=h.forwardRef(({className:t,...e},n)=>b.jsx(S$,{ref:n,className:ze("text-lg font-semibold leading-none tracking-tight",t),...e}));R$.displayName=S$.displayName;const hoe=h.forwardRef(({className:t,...e},n)=>b.jsx(E$,{ref:n,className:ze("text-sm text-muted-foreground",t),...e}));hoe.displayName=E$.displayName;function Gb({path:t,source:e,schema:n,setSelectedPath:r,field:o,initOnSubmit:i,top:s}){if(n.opt)return b.jsx(xoe,{path:t,source:e,schema:n,field:o,initOnSubmit:i,setSelectedPath:r});if(e===null)return b.jsx($$,{source:e,schema:n,path:t,setSelectedPath:r,initOnSubmit:i});if(n.type==="object")return typeof e!="object"||Wl(e)?b.jsxs("div",{children:["ERROR: expected object, but found ",typeof e]}):b.jsx(N$,{source:e,path:t,schema:n,initOnSubmit:i,setSelectedPath:r,top:s});if(n.type==="array")return typeof e!="object"||!Wl(e)?b.jsxs("div",{children:["ERROR: expected array, but found ",typeof e]}):b.jsxs("div",{children:[o?b.jsx("div",{className:"text-left",children:o}):b.jsx("div",{className:"truncate max-w-[300px] text-left",title:t,dir:"rtl",children:b.jsx(ka,{children:t})}),b.jsx(P$,{source:e,path:t,schema:n,initOnSubmit:i,setSelectedPath:r})]});if(n.type==="record")return typeof e!="object"?b.jsxs("div",{children:["ERROR: expected object for ",n.type,", but found ",typeof e]}):Wl(e)?b.jsxs("div",{children:["ERROR: did not expect array for ",n.type]}):b.jsxs("div",{children:[o?b.jsx("div",{className:"text-left",children:o}):b.jsx("div",{className:"truncate max-w-[300px] text-left",title:t,dir:"rtl",children:b.jsx(ka,{children:t})}),b.jsx(goe,{source:e,path:t,schema:n,setSelectedPath:r})]});if((n==null?void 0:n.type)==="union"){if(n.key&&typeof e=="object"&&!Wl(e))return b.jsx(moe,{field:o,tag:n.key,source:e,path:t,schema:n,initOnSubmit:i,setSelectedPath:r,top:s})}else if((n==null?void 0:n.type)==="literal")return b.jsx(b.Fragment,{});return b.jsxs("div",{className:"py-2 gap-y-4",children:[o?b.jsx("div",{className:"text-left",children:o}):b.jsx("div",{className:"truncate max-w-[300px] text-left",title:t,dir:"rtl",children:b.jsx(ka,{children:t})}),b.jsx(p$,{path:t,disabled:!1,source:e,schema:n,onSubmit:i(t)})]})}function moe({tag:t,field:e,path:n,source:r,schema:o,setSelectedPath:i,initOnSubmit:s,top:a}){const[l,c]=h.useState(null),[u,d]=h.useState(null),f=o.items.flatMap(g=>{if(g.type==="object"&&g.items[t]){const y=g.items[t];if(y.type==="literal")return[y.value]}return[]});h.useEffect(()=>{if(l){const g=r[t],y=o.items.find(v=>{if(v.type==="object"&&v.items[t]){const x=v.items[t];return x.type==="literal"?x.value===l:!1}});g&&typeof g=="string"&&y?d({source:r,schema:y}):y?d({schema:y}):(console.error("Could not find source or schema of key",l,r,o),d(null))}else{const g=r==null?void 0:r[t];g&&typeof g=="string"&&c(g)}},[l,r,t,o,f]),f.length!==o.items.length&&console.warn("Not all items have tag:",t);const p=!1,m=s(n);return b.jsxs(Ws,{className:Dn("flex flex-col gap-y-4",{"border-l-2 border-border pl-6":!a}),children:[e?b.jsx("div",{className:"text-left",children:e}):b.jsx("div",{className:"truncate max-w-[300px] text-left",title:n,dir:"rtl",children:b.jsx(ka,{children:n})}),b.jsxs(FM,{value:l??void 0,disabled:p,onValueChange:g=>{c(g)},children:[b.jsx(G1,{children:b.jsx(BM,{placeholder:"Select type"})}),b.jsx(Y1,{children:f.map(g=>b.jsx(Z1,{value:g.toString(),children:g.toString()},g))})]}),b.jsx(sl,{loading:p,enabled:!1,onClick:()=>m(async()=>[])}),u&&b.jsx(Gb,{path:n,source:u.source??null,schema:u.schema,setSelectedPath:i,initOnSubmit:s,top:a})]},n)}function N$({path:t,source:e,schema:n,setSelectedPath:r,initOnSubmit:o,top:i}){return b.jsx("div",{className:Dn("flex flex-col gap-y-1",{"border-l-2 border-border pl-6":!i}),children:Object.entries(n.items).map(([s,a])=>{const l=Rc(t,s);return b.jsx(Gb,{path:l,source:(e==null?void 0:e[s])??null,schema:a,setSelectedPath:r,field:s,initOnSubmit:o},l)})},t)}function goe({path:t,source:e,schema:n,setSelectedPath:r}){const o=k1();return b.jsx("div",{className:"flex flex-col gap-4 p-2",children:Object.entries(e).map(([i,s])=>{const a=Rc(t,i);return b.jsx("button",{onClick:()=>{r(a),o(a)},children:b.jsx(voe,{recordKey:i,path:a,source:s,schema:n.item})},a)})},t)}const vx=170;function voe({recordKey:t,path:e,source:n,schema:r}){const o=oe.useRef(null),[i,s]=h.useState(!1);return h.useEffect(()=>{o.current&&o.current.getBoundingClientRect().height>=vx&&s(!0)},[]),b.jsxs(Kb,{ref:o,className:"relative px-4 pt-2 pb-4 overflow-hidden border gap-y-2",style:{maxHeight:vx},children:[b.jsx("div",{className:"pb-4 font-serif text-left text-accent",children:t}),b.jsx("div",{className:"text-xs",children:b.jsx(Yb,{path:e,source:n,schema:r})}),i&&b.jsx("div",{className:"absolute bottom-0 left-0 w-full h-[20px] bg-gradient-to-b from-transparent to-background"})]},e)}function P$({path:t,source:e,schema:n,setSelectedPath:r,initOnSubmit:o}){const i=o(t),[s,a]=h.useState(),l=s!==e.length,[,c]=yt.splitModuleIdAndModulePath(t);return h.useEffect(()=>{a(e.length)},[n,e]),b.jsxs(Ws,{className:"flex flex-col gap-4 p-2 pb-8",children:[b.jsx("button",{disabled:l,onClick:()=>{a(e.length+1),i(async()=>{const u=[];return e===null&&u.push({op:"replace",path:yt.createPatchJSONPath(c),value:[]}),u.push({op:"add",path:yt.createPatchJSONPath(Rc(c,e.length)),value:Om(n.item)}),u})},children:l?b.jsx(AO,{className:"animate-spin"}):b.jsx(nL,{})}),e.map((u,d)=>{const f=Rc(t,d),p=o(f);return b.jsx(yoe,{index:d,path:f,source:u,loading:l,schema:n.item,onDelete:()=>{a(e.length-1),p(async m=>[{op:"remove",path:m}])},setSelectedPath:r},f)})]},t)}const M_=vx;function yoe({index:t,path:e,source:n,schema:r,loading:o,setSelectedPath:i,onDelete:s}){const a=k1(),l=oe.useRef(null),[c,u]=h.useState(!1);return h.useEffect(()=>{l.current&&l.current.getBoundingClientRect().height>=M_&&u(!0)},[]),b.jsxs(Kb,{ref:l,className:"relative px-4 pt-2 pb-4 overflow-hidden border gap-y-2",style:{maxHeight:M_},children:[b.jsx("button",{className:"block",disabled:o,onClick:s,children:o?b.jsx(AO,{className:"animate-spin"}):b.jsx(IO,{})}),b.jsxs("button",{className:"block",disabled:o,onClick:()=>{i(e),a(e)},children:[b.jsx("div",{className:"pb-4 font-serif text-left uppercase text-accent",children:t+1<10?`0${t+1}`:t+1}),b.jsx("div",{className:"text-xs",children:b.jsx(Yb,{path:e,source:n,schema:r})}),c&&b.jsx("div",{className:"absolute bottom-0 left-0 w-full h-[20px] bg-gradient-to-b from-transparent to-background"})]})]})}function Rc(t,e){const n=yt.createValPathOfItem(t,e);if(!n)throw Error(`Could not create val path: ${t} of ${e==null?void 0:e.toString()}`);return n}function Yb({path:t,source:e,schema:n}){var s;const[r,o]=h.useState(null),i=(s=Soe())==null?void 0:s.hoverElem;if(n.type==="object")return b.jsx("div",{className:"grid grid-cols-[min-content_1fr] gap-2 text-left",children:Object.entries(n.items).map(([a])=>b.jsxs(h.Fragment,{children:[b.jsxs("span",{className:"text-muted",children:[a,":"]}),b.jsx("span",{children:b.jsx(Yb,{source:(e==null?void 0:e[a])??null,schema:n.items[a],path:Rc(t,a)})})]},Rc(t,a)))},t);if(n.type==="array")return e===null?b.jsx("span",{className:"text-accent",children:"Empty"},t):Array.isArray(e)?b.jsxs("span",{children:[b.jsx("span",{className:"text-accent",children:e.length}),b.jsx("span",{children:e.length===1?" item":" items"})]},t):b.jsx("span",{className:"px-2 bg-destructive text-destructive-foreground",children:"Unknown length"},t);if(n.type==="richtext")return e===null?b.jsx("span",{className:"text-accent",children:"Empty"},t):typeof e!="object"?b.jsxs("div",{className:"p-4 text-destructive-foreground bg-destructive",children:["ERROR: ",typeof e," not an object"]},t):!(sn in e)||e[sn]!=="richtext"?b.jsx("div",{className:"p-4 text-destructive-foreground bg-destructive",children:"ERROR: object is not richtext"},t):b.jsx(koe,{children:hM(e)},t);if(n.type==="string")return e===null?b.jsx("span",{className:"text-accent",children:"Empty"},t):b.jsx("span",{children:e});if(n.type==="image"){if(e===null)return b.jsx("span",{className:"text-accent",children:"Empty"},t);if(typeof e!="object")return b.jsx("div",{className:"p-4 text-destructive-foreground bg-destructive",children:"ERROR: not an object"},t);if(!(gn in e)||typeof e[gn]!="string")return b.jsx("div",{className:"p-4 text-destructive-foreground bg-destructive",children:"ERROR: object is not an image"},t);const a=yt.convertFileSource(e).url;return b.jsxs("span",{onMouseOver:l=>{o({x:l.clientX,y:l.clientY})},onMouseLeave:()=>{o(null)},className:"relative flex items-center justify-start gap-1",children:[b.jsx("a",{href:a,className:"overflow-hidden underline truncate ",children:e[gn]}),r&&i&&Vo.createPortal(b.jsx("img",{className:"absolute z-[5] max-w-[10vw]",style:{left:r.x+10,top:r.y+10},src:a}),i)]},t)}else{if(n.type==="boolean")return e===null?b.jsx("span",{className:"text-accent",children:"Empty"},t):b.jsx("span",{className:"text-accent",children:e?"true":"false"},t);if(n.type==="number")return e===null?b.jsx("span",{className:"text-accent",children:"Empty"},t):b.jsx("span",{className:"text-accent",children:e.toString()});if(n.type==="keyOf")return e===null?b.jsx("span",{className:"text-accent",children:"Empty"},t):b.jsx("span",{className:"text-accent",children:e.toString()},t)}return b.jsxs("div",{children:["TODO: ",n.type]},t)}function xoe({path:t,source:e,schema:n,setSelectedPath:r,initOnSubmit:o,field:i}){const[s,a]=h.useState(e!==null),{editMode:l}=x1(),c=o(t),[u,d]=h.useState(!1);return b.jsxs("div",{className:"flex flex-col gap-y-2",children:[b.jsxs("div",{className:"relative flex items-center justify-start gap-x-4",children:[l==="full"&&!s&&b.jsx(m$,{disabled:u,checked:s,onClick:()=>{a(f=>!f)}}),l==="full"&&s&&b.jsxs(doe,{children:[b.jsx(foe,{children:b.jsx(IO,{})}),b.jsx(T$,{children:b.jsxs(O$,{children:[b.jsx(R$,{children:"About to delete. Are you sure?"}),b.jsxs(M$,{className:"sm:justify-start",children:[b.jsx(O_,{asChild:!0,children:b.jsx(vc,{type:"button",variant:"secondary",onClick:async()=>{d(!0),a(!1);const[,f]=yt.splitModuleIdAndModulePath(t);c(async()=>[{op:"replace",path:yt.createPatchJSONPath(f),value:null}]).catch(p=>{console.error(p),a(!0)}).finally(()=>{d(!1)})},children:"Yes"})}),b.jsx(O_,{asChild:!0,children:b.jsx(vc,{type:"button",children:"Cancel"})})]})]})})]}),b.jsx("div",{className:"truncate max-w-[300px] text-left",title:t,dir:"rtl",children:i||b.jsx(ka,{children:t})})]}),s&&b.jsx($$,{source:e===null?Om(n):e,schema:n,path:t,setSelectedPath:r,initOnSubmit:f=>async p=>{const[,m]=yt.splitModuleIdAndModulePath(t),[,g]=yt.splitModuleIdAndModulePath(f),y=await p(yt.createPatchJSONPath(g));c(async()=>e===null?[{op:"replace",path:yt.createPatchJSONPath(m),value:Om(n)}].concat(y):y)}})]},t)}function Om(t){if(t.type==="object")return Object.fromEntries(Object.keys(t.items).map(n=>[n,Om(t.items[n])]));if(t.type==="array")return[];if(t.type==="record")return{};if(t.type==="richtext")return{[sn]:"richtext",templateStrings:[""],exprs:[]};if(t.type==="string")return null;if(t.type==="boolean")return null;if(t.type==="number")return null;if(t.type==="keyOf")return null;if(t.type==="file")return null;if(t.type==="image")return null;if(t.type==="literal")return null;if(t.type==="union")return null;throw Error("Unexpected schema type: "+JSON.stringify(t))}function $$({source:t,path:e,schema:n,setSelectedPath:r,initOnSubmit:o}){if(n.type==="array"){if(typeof t=="object"&&(t===null||Wl(t)))return b.jsx(P$,{initOnSubmit:o,source:t===null?[]:t,path:e,schema:n,setSelectedPath:r})}else if(n.type==="object"){if(typeof t=="object"&&(t===null||!Wl(t)))return b.jsx(N$,{source:t,path:e,schema:n,setSelectedPath:r,initOnSubmit:o})}else if(n.type==="richtext"||n.type==="string"||n.type==="image"||n.type==="number"||n.type==="keyOf")return b.jsx(p$,{path:e,disabled:!1,source:t,schema:n,onSubmit:o(e)},e);return b.jsxs("div",{className:"p-4 bg-destructive text-destructive-foreground",children:["ERROR: unexpected source type ",typeof t," for schema type"," ",n.type]})}function Wl(t){return Array.isArray(t)}function boe(t){const e={};return t.forEach(n=>{const r=n.split("/").filter(o=>o!=="");if(r.length===1)e[""]||(e[""]=[]),e[""].push(r[0]);else if(r.length>1){const o=r.slice(0,r.length-1).join("/"),i=r.slice(-1)[0];e[o]||(e[o]=[]),e[o].push(i)}}),e}function woe({selectedPath:t,paths:e,setSelectedModuleId:n}){const r=boe(e),o=t&&yt.splitModuleIdAndModulePath(t)[0];return b.jsx("div",{className:"flex flex-col w-full py-2 text-xs",children:Object.entries(r).map(([i,s])=>b.jsxs("div",{className:"px-4 py-2",children:[i&&b.jsx("div",{className:"font-bold truncate max-w-[300px] text-left",title:i,children:b.jsx(ka,{children:i})}),b.jsx("div",{className:Dn({"flex flex-col py-2 justify-start items-start":!!i}),children:s.map(a=>{const l=`/${i}/${a}`;return b.jsx("button",{className:Dn("block px-2 py-1 rounded-full",{"bg-accent text-accent-foreground":o===l}),onClick:()=>{n(l)},children:a},l)})})]},`/${i}`))})}const R_={tags:{h1:"font-bold",h2:"font-bold",h3:"font-bold",h4:"font-bold",h5:"font-bold",h6:"font-bold",p:""},classes:{bold:"font-bold",italic:"italic",lineThrough:"line-through"}};function koe({children:t}){const e=t;function n(i,s){const a=R_.tags[i];return a&&s?[s,a].join(" "):a||s}function r(i,s){const a=R_.classes[i];return a&&s?[s,a].join(" "):a||s}function o(i,s){var c,u;if(typeof i=="string")return i;if(i.tag==="p")return b.jsx("p",{className:n("p"),children:i.children.map((d,f)=>o(d,f))},s);if(i.tag==="img")return b.jsx("img",{className:n("img"),src:i.src},s);if(i.tag==="ul")return b.jsx("ul",{className:n("ul"),children:i.children.map((d,f)=>o(d,f))},s);if(i.tag==="ol")return b.jsx("ol",{className:n("ol"),children:i.children.map((d,f)=>o(d,f))},s);if(i.tag==="li")return b.jsx("li",{className:n("li"),children:i.children.map((d,f)=>o(d,f))},s);if(i.tag==="span")return b.jsx("span",{className:i.classes.map(d=>{switch(d){case"bold":return r("bold");case"line-through":return r("lineThrough");case"italic":return r("italic")}}).join(" "),children:i.children.map((d,f)=>o(d,f))},s);if(i.tag==="h1")return b.jsx("h1",{className:n("h1"),children:i.children.map((d,f)=>o(d,f))},s);if(i.tag==="h2")return b.jsx("h2",{className:n("h2"),children:i.children.map((d,f)=>o(d,f))},s);if(i.tag==="h3")return b.jsx("h3",{className:n("h3"),children:i.children.map((d,f)=>o(d,f))},s);if(i.tag==="h4")return b.jsx("h4",{className:n("h4"),children:i.children.map((d,f)=>o(d,f))},s);if(i.tag==="h5")return b.jsx("h5",{className:n("h5"),children:i.children.map((d,f)=>o(d,f))},s);if(i.tag==="h6")return b.jsx("h6",{className:n("h6"),children:i.children.map((d,f)=>o(d,f))},s);if(i.tag==="br")return b.jsx("br",{},s);if(i.tag==="a")return b.jsx("a",{href:i.href,children:i.children.map((d,f)=>o(d,f))},s);console.error("Unknown tag",i.tag);const l=i.tag;return l!=null&&l.tag?oe.createElement(l.tag,{key:s,className:(c=l.class)==null?void 0:c.join(" "),children:(u=l.children)==null?void 0:u.map(o)}):null}return b.jsx("span",{"data-val-path":e.valPath,children:e.children.map((i,s)=>o(i,s))})}const A$=oe.createContext({hoverElem:null}),Soe=()=>oe.useContext(A$),I$=oe.createContext(null),Eoe=t=>{var a,l;const e=oe.useContext(I$),[n,r]=yt.splitModuleIdAndModulePath(t),o=(a=e==null?void 0:e[n])==null?void 0:a.source,i=(l=e==null?void 0:e[n])==null?void 0:l.schema;if(!o||!i)throw Error("Could not find module: "+n);const s=yt.resolvePath(r,o,i);return{moduleId:n,moduleSource:s.source,moduleSchema:s.schema}},_oe=({api:t})=>{var A,B;const{"*":e}=e4(),[n,r]=h.useState(null),[o,i]=h.useState(null),[s,a]=h.useState(),[l]=s?yt.splitModuleIdAndModulePath(s):[void 0,void 0],c=l&&((A=n==null?void 0:n[l])==null?void 0:A.source),u=l&&((B=n==null?void 0:n[l])==null?void 0:B.schema),d=Object.entries(n||{}).flatMap(([D,Z])=>Z.errors?Z.errors.fatal?Z.errors.fatal.map(U=>({id:D,...U})):[]:[]),f=Object.entries(n||{}).flatMap(([,D])=>D.errors&&D.errors.validation?[D.errors.validation]:[]);if(d&&d.length>0){const D=d.length===1?d[0].message:`Multiple errors detected:
229
229
  ${d.map((U,G)=>`${G+1}. [${U.id}]: ${U.message}`).join(`
230
230
  `)}
@@ -238,4 +238,4 @@ Showing stack trace of: 1. ${d[0].message}`,Z=new Error(D);throw Z.stack=d[0].st
238
238
  * LICENSE.md file in the root directory of this source tree.
239
239
  *
240
240
  * @license MIT
241
- */function Mm(){return Mm=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Mm.apply(this,arguments)}function Roe(t,e){return FL({basename:e==null?void 0:e.basename,future:Mm({},e==null?void 0:e.future,{v7_prependBasename:!0}),history:lL({window:e==null?void 0:e.window}),hydrationData:(e==null?void 0:e.hydrationData)||Noe(),routes:t,mapRouteProperties:h4,window:e==null?void 0:e.window}).initialize()}function Noe(){var t;let e=(t=window)==null?void 0:t.__staticRouterHydrationData;return e&&e.errors&&(e=Mm({},e,{errors:Poe(e.errors)})),e}function Poe(t){if(!t)return null;let e=Object.entries(t),n={};for(let[r,o]of e)if(o&&o.__type==="RouteErrorResponse")n[r]=new b1(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let i=window[o.__subType];if(typeof i=="function")try{let s=new i(o.message);s.stack="",n[r]=s}catch{}}if(n[r]==null){let i=new Error(o.message);i.stack="",n[r]=i}}else n[r]=o;return n}const $oe=h.createContext({isTransitioning:!1}),Aoe=h.createContext(new Map),Ioe="startTransition",N_=H_[Ioe],Doe="flushSync",P_=uD[Doe];function Loe(t){N_?N_(t):t()}function gu(t){P_?P_(t):t()}class joe{constructor(){this.status="pending",this.promise=new Promise((e,n)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",e(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",n(r))}})}}function zoe(t){let{fallbackElement:e,router:n,future:r}=t,[o,i]=h.useState(n.state),[s,a]=h.useState(),[l,c]=h.useState({isTransitioning:!1}),[u,d]=h.useState(),[f,p]=h.useState(),[m,g]=h.useState(),y=h.useRef(new Map),{v7_startTransition:v}=r||{},x=h.useCallback(E=>{v?Loe(E):E()},[v]),w=h.useCallback((E,C)=>{let{deletedFetchers:T,unstable_flushSync:A,unstable_viewTransitionOpts:B}=C;T.forEach(Z=>y.current.delete(Z)),E.fetchers.forEach((Z,U)=>{Z.data!==void 0&&y.current.set(U,Z.data)});let D=n.window==null||typeof n.window.document.startViewTransition!="function";if(!B||D){A?gu(()=>i(E)):x(()=>i(E));return}if(A){gu(()=>{f&&(u&&u.resolve(),f.skipTransition()),c({isTransitioning:!0,flushSync:!0,currentLocation:B.currentLocation,nextLocation:B.nextLocation})});let Z=n.window.document.startViewTransition(()=>{gu(()=>i(E))});Z.finished.finally(()=>{gu(()=>{d(void 0),p(void 0),a(void 0),c({isTransitioning:!1})})}),gu(()=>p(Z));return}f?(u&&u.resolve(),f.skipTransition(),g({state:E,currentLocation:B.currentLocation,nextLocation:B.nextLocation})):(a(E),c({isTransitioning:!0,flushSync:!1,currentLocation:B.currentLocation,nextLocation:B.nextLocation}))},[n.window,f,u,y,x]);h.useLayoutEffect(()=>n.subscribe(w),[n,w]),h.useEffect(()=>{l.isTransitioning&&!l.flushSync&&d(new joe)},[l]),h.useEffect(()=>{if(u&&s&&n.window){let E=s,C=u.promise,T=n.window.document.startViewTransition(async()=>{x(()=>i(E)),await C});T.finished.finally(()=>{d(void 0),p(void 0),a(void 0),c({isTransitioning:!1})}),p(T)}},[x,s,u,n.window]),h.useEffect(()=>{u&&s&&o.location.key===s.location.key&&u.resolve()},[u,f,o.location,s]),h.useEffect(()=>{!l.isTransitioning&&m&&(a(m.state),c({isTransitioning:!0,flushSync:!1,currentLocation:m.currentLocation,nextLocation:m.nextLocation}),g(void 0))},[l.isTransitioning,m]),h.useEffect(()=>{},[]);let S=h.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:E=>n.navigate(E),push:(E,C,T)=>n.navigate(E,{state:C,preventScrollReset:T==null?void 0:T.preventScrollReset}),replace:(E,C,T)=>n.navigate(E,{replace:!0,state:C,preventScrollReset:T==null?void 0:T.preventScrollReset})}),[n]),_=n.basename||"/",k=h.useMemo(()=>({router:n,navigator:S,static:!1,basename:_}),[n,S,_]);return h.createElement(h.Fragment,null,h.createElement(Jm.Provider,{value:k},h.createElement(ZO.Provider,{value:o},h.createElement(Aoe.Provider,{value:y.current},h.createElement($oe.Provider,{value:l},h.createElement(p4,{basename:_,location:o.location,navigationType:o.historyAction,navigator:S,future:{v7_relativeSplatPath:n.future.v7_relativeSplatPath}},o.initialized||n.future.v7_partialHydration?h.createElement(Foe,{routes:n.routes,future:n.future,state:o}):e))))),null)}function Foe(t){let{routes:e,future:n,state:r}=t;return t4(e,void 0,r,n)}var $_;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})($_||($_={}));var A_;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(A_||(A_={}));function Boe({error:t,resetErrorBoundary:e}){return console.error(t),b.jsx("div",{className:"absolute top-0 left-0 flex items-center justify-center w-screen h-screen bg-card-foreground",children:b.jsx("div",{className:"w-full h-full p-10",children:b.jsxs("div",{className:"w-full h-full p-10 bg-card text-primary",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsxs("div",{className:"flex items-center gap-[0.5em] text-lg font-bold text-center py-2",children:[b.jsx(DO,{})," encountered an error"]}),b.jsx("button",{onClick:e,children:b.jsx(Oh,{})})]}),b.jsx("div",{className:"text-4xl font-normal ",children:"Message:"}),b.jsx("pre",{children:t.message}),t.stack&&b.jsx(S0,{type:"single",className:"font-serif",collapsible:!0,defaultValue:"error",children:b.jsxs(oM,{value:"error",children:[b.jsx(iM,{children:"Stack trace:"}),b.jsx(Vh,{className:"p-4 bg-popover text-popover-foreground",children:t.stack&&b.jsx("pre",{children:t.stack})})]})})]})})})}function Uoe(){const t=Roe([{path:"/*",element:b.jsx(Ooe,{fallbackRender:Boe,children:b.jsx(_oe,{api:new T3("/api/val")})})}],{basename:"/api/val/static/edit"});return b.jsx(zoe,{router:t})}sy.createRoot(document.getElementById("root")).render(oe.createElement(oe.StrictMode,null,oe.createElement(Uoe,null)));
241
+ */function Mm(){return Mm=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Mm.apply(this,arguments)}function Roe(t,e){return FL({basename:e==null?void 0:e.basename,future:Mm({},e==null?void 0:e.future,{v7_prependBasename:!0}),history:lL({window:e==null?void 0:e.window}),hydrationData:(e==null?void 0:e.hydrationData)||Noe(),routes:t,mapRouteProperties:h4,window:e==null?void 0:e.window}).initialize()}function Noe(){var t;let e=(t=window)==null?void 0:t.__staticRouterHydrationData;return e&&e.errors&&(e=Mm({},e,{errors:Poe(e.errors)})),e}function Poe(t){if(!t)return null;let e=Object.entries(t),n={};for(let[r,o]of e)if(o&&o.__type==="RouteErrorResponse")n[r]=new b1(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let i=window[o.__subType];if(typeof i=="function")try{let s=new i(o.message);s.stack="",n[r]=s}catch{}}if(n[r]==null){let i=new Error(o.message);i.stack="",n[r]=i}}else n[r]=o;return n}const $oe=h.createContext({isTransitioning:!1}),Aoe=h.createContext(new Map),Ioe="startTransition",N_=H_[Ioe],Doe="flushSync",P_=uD[Doe];function Loe(t){N_?N_(t):t()}function gu(t){P_?P_(t):t()}class joe{constructor(){this.status="pending",this.promise=new Promise((e,n)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",e(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",n(r))}})}}function zoe(t){let{fallbackElement:e,router:n,future:r}=t,[o,i]=h.useState(n.state),[s,a]=h.useState(),[l,c]=h.useState({isTransitioning:!1}),[u,d]=h.useState(),[f,p]=h.useState(),[m,g]=h.useState(),y=h.useRef(new Map),{v7_startTransition:v}=r||{},x=h.useCallback(E=>{v?Loe(E):E()},[v]),w=h.useCallback((E,C)=>{let{deletedFetchers:T,unstable_flushSync:A,unstable_viewTransitionOpts:B}=C;T.forEach(Z=>y.current.delete(Z)),E.fetchers.forEach((Z,U)=>{Z.data!==void 0&&y.current.set(U,Z.data)});let D=n.window==null||typeof n.window.document.startViewTransition!="function";if(!B||D){A?gu(()=>i(E)):x(()=>i(E));return}if(A){gu(()=>{f&&(u&&u.resolve(),f.skipTransition()),c({isTransitioning:!0,flushSync:!0,currentLocation:B.currentLocation,nextLocation:B.nextLocation})});let Z=n.window.document.startViewTransition(()=>{gu(()=>i(E))});Z.finished.finally(()=>{gu(()=>{d(void 0),p(void 0),a(void 0),c({isTransitioning:!1})})}),gu(()=>p(Z));return}f?(u&&u.resolve(),f.skipTransition(),g({state:E,currentLocation:B.currentLocation,nextLocation:B.nextLocation})):(a(E),c({isTransitioning:!0,flushSync:!1,currentLocation:B.currentLocation,nextLocation:B.nextLocation}))},[n.window,f,u,y,x]);h.useLayoutEffect(()=>n.subscribe(w),[n,w]),h.useEffect(()=>{l.isTransitioning&&!l.flushSync&&d(new joe)},[l]),h.useEffect(()=>{if(u&&s&&n.window){let E=s,C=u.promise,T=n.window.document.startViewTransition(async()=>{x(()=>i(E)),await C});T.finished.finally(()=>{d(void 0),p(void 0),a(void 0),c({isTransitioning:!1})}),p(T)}},[x,s,u,n.window]),h.useEffect(()=>{u&&s&&o.location.key===s.location.key&&u.resolve()},[u,f,o.location,s]),h.useEffect(()=>{!l.isTransitioning&&m&&(a(m.state),c({isTransitioning:!0,flushSync:!1,currentLocation:m.currentLocation,nextLocation:m.nextLocation}),g(void 0))},[l.isTransitioning,m]),h.useEffect(()=>{},[]);let S=h.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:E=>n.navigate(E),push:(E,C,T)=>n.navigate(E,{state:C,preventScrollReset:T==null?void 0:T.preventScrollReset}),replace:(E,C,T)=>n.navigate(E,{replace:!0,state:C,preventScrollReset:T==null?void 0:T.preventScrollReset})}),[n]),_=n.basename||"/",k=h.useMemo(()=>({router:n,navigator:S,static:!1,basename:_}),[n,S,_]);return h.createElement(h.Fragment,null,h.createElement(Jm.Provider,{value:k},h.createElement(ZO.Provider,{value:o},h.createElement(Aoe.Provider,{value:y.current},h.createElement($oe.Provider,{value:l},h.createElement(p4,{basename:_,location:o.location,navigationType:o.historyAction,navigator:S,future:{v7_relativeSplatPath:n.future.v7_relativeSplatPath}},o.initialized||n.future.v7_partialHydration?h.createElement(Foe,{routes:n.routes,future:n.future,state:o}):e))))),null)}function Foe(t){let{routes:e,future:n,state:r}=t;return t4(e,void 0,r,n)}var $_;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})($_||($_={}));var A_;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(A_||(A_={}));function Boe({error:t,resetErrorBoundary:e}){return console.error(t),b.jsx("div",{className:"absolute top-0 left-0 flex items-center justify-center w-screen h-screen bg-card-foreground",children:b.jsx("div",{className:"w-full h-full p-10",children:b.jsxs("div",{className:"w-full h-full p-10 bg-card text-primary",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsxs("div",{className:"flex items-center gap-[0.5em] text-lg font-bold text-center py-2",children:[b.jsx(DO,{})," encountered an error"]}),b.jsx("button",{onClick:e,children:b.jsx(Oh,{})})]}),b.jsx("div",{className:"text-4xl font-normal ",children:"Message:"}),b.jsx("pre",{children:t.message}),t.stack&&b.jsx(S0,{type:"single",className:"font-serif",collapsible:!0,defaultValue:"error",children:b.jsxs(oM,{value:"error",children:[b.jsx(iM,{children:"Stack trace:"}),b.jsx(Vh,{className:"p-4 bg-popover text-popover-foreground",children:t.stack&&b.jsx("pre",{children:t.stack})})]})})]})})})}function Uoe(){const t=Roe([{path:"/*",element:b.jsx(Ooe,{fallbackRender:Boe,children:b.jsx(_oe,{api:new T3("/api/val")})})}],{basename:"/val"});return b.jsx(zoe,{router:t})}sy.createRoot(document.getElementById("val-app")).render(oe.createElement(oe.StrictMode,null,oe.createElement(Uoe,null)));