@romainbx/wpic-components 0.0.0 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,20 +1,20 @@
1
- (function(u,yr){typeof exports=="object"&&typeof module<"u"?module.exports=yr(require("vue")):typeof define=="function"&&define.amd?define(["vue"],yr):(u=typeof globalThis<"u"?globalThis:u||self,u.WpicComponents=yr(u.Vue))})(this,function(u){"use strict";function yr(){return cl().__VUE_DEVTOOLS_GLOBAL_HOOK__}function cl(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const Hu=typeof Proxy=="function",Wu="devtools-plugin:setup",Uu="plugin:settings:set";let Pn,uo;function qu(){var t;return Pn!==void 0||(typeof window<"u"&&window.performance?(Pn=!0,uo=window.performance):typeof globalThis<"u"&&(!((t=globalThis.perf_hooks)===null||t===void 0)&&t.performance)?(Pn=!0,uo=globalThis.perf_hooks.performance):Pn=!1),Pn}function Ku(){return qu()?uo.now():Date.now()}class Ju{constructor(e,n){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=n;const r={};if(e.settings)for(const s in e.settings){const l=e.settings[s];r[s]=l.defaultValue}const i=`__vue-devtools-plugin-settings__${e.id}`;let o=Object.assign({},r);try{const s=localStorage.getItem(i),l=JSON.parse(s);Object.assign(o,l)}catch{}this.fallbacks={getSettings(){return o},setSettings(s){try{localStorage.setItem(i,JSON.stringify(s))}catch{}o=s},now(){return Ku()}},n&&n.on(Uu,(s,l)=>{s===this.plugin.id&&this.fallbacks.setSettings(l)}),this.proxiedOn=new Proxy({},{get:(s,l)=>this.target?this.target.on[l]:(...a)=>{this.onQueue.push({method:l,args:a})}}),this.proxiedTarget=new Proxy({},{get:(s,l)=>this.target?this.target[l]:l==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(l)?(...a)=>(this.targetQueue.push({method:l,args:a,resolve:()=>{}}),this.fallbacks[l](...a)):(...a)=>new Promise(c=>{this.targetQueue.push({method:l,args:a,resolve:c})})})}async setRealTarget(e){this.target=e;for(const n of this.onQueue)this.target.on[n.method](...n.args);for(const n of this.targetQueue)n.resolve(await this.target[n.method](...n.args))}}function Gu(t,e){const n=t,r=cl(),i=yr(),o=Hu&&n.enableEarlyProxy;if(i&&(r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!o))i.emit(Wu,t,e);else{const s=o?new Ju(n,i):null;(r.__VUE_DEVTOOLS_PLUGINS__=r.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:n,setupFn:e,proxy:s}),s&&e(s.proxiedTarget)}}/**
1
+ (function(d,yi){typeof exports=="object"&&typeof module<"u"?module.exports=yi(require("vue")):typeof define=="function"&&define.amd?define(["vue"],yi):(d=typeof globalThis<"u"?globalThis:d||self,d.WpicComponents=yi(d.Vue))})(this,function(d){"use strict";function yi(){return kc().__VUE_DEVTOOLS_GLOBAL_HOOK__}function kc(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const nm=typeof Proxy=="function",rm="devtools-plugin:setup",im="plugin:settings:set";let Cr,Yo;function sm(){var t;return Cr!==void 0||(typeof window<"u"&&window.performance?(Cr=!0,Yo=window.performance):typeof globalThis<"u"&&(!((t=globalThis.perf_hooks)===null||t===void 0)&&t.performance)?(Cr=!0,Yo=globalThis.perf_hooks.performance):Cr=!1),Cr}function om(){return sm()?Yo.now():Date.now()}class am{constructor(e,n){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=n;const r={};if(e.settings)for(const o in e.settings){const a=e.settings[o];r[o]=a.defaultValue}const i=`__vue-devtools-plugin-settings__${e.id}`;let s=Object.assign({},r);try{const o=localStorage.getItem(i),a=JSON.parse(o);Object.assign(s,a)}catch{}this.fallbacks={getSettings(){return s},setSettings(o){try{localStorage.setItem(i,JSON.stringify(o))}catch{}s=o},now(){return om()}},n&&n.on(im,(o,a)=>{o===this.plugin.id&&this.fallbacks.setSettings(a)}),this.proxiedOn=new Proxy({},{get:(o,a)=>this.target?this.target.on[a]:(...l)=>{this.onQueue.push({method:a,args:l})}}),this.proxiedTarget=new Proxy({},{get:(o,a)=>this.target?this.target[a]:a==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(a)?(...l)=>(this.targetQueue.push({method:a,args:l,resolve:()=>{}}),this.fallbacks[a](...l)):(...l)=>new Promise(c=>{this.targetQueue.push({method:a,args:l,resolve:c})})})}async setRealTarget(e){this.target=e;for(const n of this.onQueue)this.target.on[n.method](...n.args);for(const n of this.targetQueue)n.resolve(await this.target[n.method](...n.args))}}function lm(t,e){const n=t,r=kc(),i=yi(),s=nm&&n.enableEarlyProxy;if(i&&(r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!s))i.emit(rm,t,e);else{const o=s?new am(n,i):null;(r.__VUE_DEVTOOLS_PLUGINS__=r.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:n,setupFn:e,proxy:o}),o&&e(o.proxiedTarget)}}/**
2
2
  * vee-validate v4.12.8
3
3
  * (c) 2024 Abdelrahman Awad
4
4
  * @license MIT
5
- */function ge(t){return typeof t=="function"}function dl(t){return t==null}const Wt=t=>t!==null&&!!t&&typeof t=="object"&&!Array.isArray(t);function fo(t){return Number(t)>=0}function Yu(t){const e=parseFloat(t);return isNaN(e)?t:e}function Zu(t){return typeof t=="object"&&t!==null}function Xu(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}function ul(t){if(!Zu(t)||Xu(t)!=="[object Object]")return!1;if(Object.getPrototypeOf(t)===null)return!0;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function br(t,e){return Object.keys(e).forEach(n=>{if(ul(e[n])&&ul(t[n])){t[n]||(t[n]={}),br(t[n],e[n]);return}t[n]=e[n]}),t}function vr(t){const e=t.split(".");if(!e.length)return"";let n=String(e[0]);for(let r=1;r<e.length;r++){if(fo(e[r])){n+=`[${e[r]}]`;continue}n+=`.${e[r]}`}return n}const fl={};function dt(t,e){ef(t,e),fl[t]=e}function Qu(t){return fl[t]}function ef(t,e){if(!ge(e))throw new Error(`Extension Error: The validator '${t}' must be a function.`)}function hl(t,e,n){typeof n.value=="object"&&(n.value=oe(n.value)),!n.enumerable||n.get||n.set||!n.configurable||!n.writable||e==="__proto__"?Object.defineProperty(t,e,n):t[e]=n.value}function oe(t){if(typeof t!="object")return t;var e=0,n,r,i,o=Object.prototype.toString.call(t);if(o==="[object Object]"?i=Object.create(t.__proto__||null):o==="[object Array]"?i=Array(t.length):o==="[object Set]"?(i=new Set,t.forEach(function(s){i.add(oe(s))})):o==="[object Map]"?(i=new Map,t.forEach(function(s,l){i.set(oe(l),oe(s))})):o==="[object Date]"?i=new Date(+t):o==="[object RegExp]"?i=new RegExp(t.source,t.flags):o==="[object DataView]"?i=new t.constructor(oe(t.buffer)):o==="[object ArrayBuffer]"?i=t.slice(0):o.slice(-6)==="Array]"&&(i=new t.constructor(t)),i){for(r=Object.getOwnPropertySymbols(t);e<r.length;e++)hl(i,r[e],Object.getOwnPropertyDescriptor(t,r[e]));for(e=0,r=Object.getOwnPropertyNames(t);e<r.length;e++)Object.hasOwnProperty.call(i,n=r[e])&&i[n]===t[n]||hl(i,n,Object.getOwnPropertyDescriptor(t,n))}return i||t}const kr=Symbol("vee-validate-form"),pl=Symbol("vee-validate-field-instance"),ri=Symbol("Default empty value"),tf=typeof window<"u";function ho(t){return ge(t)&&!!t.__locatorRef}function ut(t){return!!t&&ge(t.parse)&&t.__type==="VVTypedSchema"}function ii(t){return!!t&&ge(t.validate)}function wr(t){return t==="checkbox"||t==="radio"}function nf(t){return Wt(t)||Array.isArray(t)}function rf(t){return Array.isArray(t)?t.length===0:Wt(t)&&Object.keys(t).length===0}function oi(t){return/^\[.+\]$/i.test(t)}function of(t){return ml(t)&&t.multiple}function ml(t){return t.tagName==="SELECT"}function sf(t,e){const n=![!1,null,void 0,0].includes(e.multiple)&&!Number.isNaN(e.multiple);return t==="select"&&"multiple"in e&&n}function lf(t,e){return!sf(t,e)&&e.type!=="file"&&!wr(e.type)}function gl(t){return po(t)&&t.target&&"submit"in t.target}function po(t){return t?!!(typeof Event<"u"&&ge(Event)&&t instanceof Event||t&&t.srcElement):!1}function yl(t,e){return e in t&&t[e]!==ri}function Ae(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var n,r,i;if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!Ae(t[r],e[r]))return!1;return!0}if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(r of t.entries())if(!e.has(r[0]))return!1;for(r of t.entries())if(!Ae(r[1],e.get(r[0])))return!1;return!0}if(bl(t)&&bl(e))return!(t.size!==e.size||t.name!==e.name||t.lastModified!==e.lastModified||t.type!==e.type);if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(r of t.entries())if(!e.has(r[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(t[r]!==e[r])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();for(i=Object.keys(t),n=i.length,r=n;r--!==0;){var o=i[r];if(!Ae(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function bl(t){return tf?t instanceof File:!1}function mo(t){return oi(t)?t.replace(/\[|\]/gi,""):t}function Le(t,e,n){return t?oi(e)?t[mo(e)]:(e||"").split(/\.|\[(\d+)\]/).filter(Boolean).reduce((i,o)=>nf(i)&&o in i?i[o]:n,t):n}function It(t,e,n){if(oi(e)){t[mo(e)]=n;return}const r=e.split(/\.|\[(\d+)\]/).filter(Boolean);let i=t;for(let o=0;o<r.length;o++){if(o===r.length-1){i[r[o]]=n;return}(!(r[o]in i)||dl(i[r[o]]))&&(i[r[o]]=fo(r[o+1])?[]:{}),i=i[r[o]]}}function go(t,e){if(Array.isArray(t)&&fo(e)){t.splice(Number(e),1);return}Wt(t)&&delete t[e]}function vl(t,e){if(oi(e)){delete t[mo(e)];return}const n=e.split(/\.|\[(\d+)\]/).filter(Boolean);let r=t;for(let o=0;o<n.length;o++){if(o===n.length-1){go(r,n[o]);break}if(!(n[o]in r)||dl(r[n[o]]))break;r=r[n[o]]}const i=n.map((o,s)=>Le(t,n.slice(0,s).join(".")));for(let o=i.length-1;o>=0;o--)if(rf(i[o])){if(o===0){go(t,n[0]);continue}go(i[o-1],n[o-1])}}function ze(t){return Object.keys(t)}function yo(t,e=void 0){const n=u.getCurrentInstance();return(n==null?void 0:n.provides[t])||u.inject(t,e)}function kl(t,e,n){if(Array.isArray(t)){const r=[...t],i=r.findIndex(o=>Ae(o,e));return i>=0?r.splice(i,1):r.push(e),r}return Ae(t,e)?n:e}function af(t,e){let n,r;return function(...i){const o=this;return n||(n=!0,setTimeout(()=>n=!1,e),r=t.apply(o,i)),r}}function wl(t,e=0){let n=null,r=[];return function(...i){return n&&clearTimeout(n),n=setTimeout(()=>{const o=t(...i);r.forEach(s=>s(o)),r=[]},e),new Promise(o=>r.push(o))}}function cf(t,e){return Wt(e)&&e.number?Yu(t):t}function bo(t,e){let n;return async function(...i){const o=t(...i);n=o;const s=await o;return o!==n?s:(n=void 0,e(s,i))}}function vo(t){return Array.isArray(t)?t:t?[t]:[]}function si(t,e){const n={};for(const r in t)e.includes(r)||(n[r]=t[r]);return n}function df(t){let e=null,n=[];return function(...r){const i=u.nextTick(()=>{if(e!==i)return;const o=t(...r);n.forEach(s=>s(o)),n=[],e=null});return e=i,new Promise(o=>n.push(o))}}function ko(t,e,n){return e.slots.default?typeof t=="string"||!t?e.slots.default(n()):{default:()=>{var r,i;return(i=(r=e.slots).default)===null||i===void 0?void 0:i.call(r,n())}}:e.slots.default}function wo(t){if(xl(t))return t._value}function xl(t){return"_value"in t}function uf(t){return t.type==="number"||t.type==="range"?Number.isNaN(t.valueAsNumber)?t.value:t.valueAsNumber:t.value}function li(t){if(!po(t))return t;const e=t.target;if(wr(e.type)&&xl(e))return wo(e);if(e.type==="file"&&e.files){const n=Array.from(e.files);return e.multiple?n:n[0]}if(of(e))return Array.from(e.options).filter(n=>n.selected&&!n.disabled).map(wo);if(ml(e)){const n=Array.from(e.options).find(r=>r.selected);return n?wo(n):e.value}return uf(e)}function Sl(t){const e={};return Object.defineProperty(e,"_$$isNormalized",{value:!0,writable:!1,enumerable:!1,configurable:!1}),t?Wt(t)&&t._$$isNormalized?t:Wt(t)?Object.keys(t).reduce((n,r)=>{const i=ff(t[r]);return t[r]!==!1&&(n[r]=Cl(i)),n},e):typeof t!="string"?e:t.split("|").reduce((n,r)=>{const i=hf(r);return i.name&&(n[i.name]=Cl(i.params)),n},e):e}function ff(t){return t===!0?[]:Array.isArray(t)||Wt(t)?t:[t]}function Cl(t){const e=n=>typeof n=="string"&&n[0]==="@"?pf(n.slice(1)):n;return Array.isArray(t)?t.map(e):t instanceof RegExp?[t]:Object.keys(t).reduce((n,r)=>(n[r]=e(t[r]),n),{})}const hf=t=>{let e=[];const n=t.split(":")[0];return t.includes(":")&&(e=t.split(":").slice(1).join(":").split(",")),{name:n,params:e}};function pf(t){const e=n=>Le(n,t)||n[t];return e.__locatorRef=t,e}function mf(t){return Array.isArray(t)?t.filter(ho):ze(t).filter(e=>ho(t[e])).map(e=>t[e])}let gf=Object.assign({},{generateMessage:({field:t})=>`${t} is not valid.`,bails:!0,validateOnBlur:!0,validateOnChange:!0,validateOnInput:!1,validateOnModelUpdate:!0});const pn=()=>gf;async function Ol(t,e,n={}){const r=n==null?void 0:n.bails,i={name:(n==null?void 0:n.name)||"{field}",rules:e,label:n==null?void 0:n.label,bails:r??!0,formData:(n==null?void 0:n.values)||{}},s=(await yf(i,t)).errors;return{errors:s,valid:!s.length}}async function yf(t,e){if(ut(t.rules)||ii(t.rules))return vf(e,t.rules);if(ge(t.rules)||Array.isArray(t.rules)){const s={field:t.label||t.name,name:t.name,label:t.label,form:t.formData,value:e},l=Array.isArray(t.rules)?t.rules:[t.rules],a=l.length,c=[];for(let d=0;d<a;d++){const f=l[d],h=await f(e,s);if(!(typeof h!="string"&&!Array.isArray(h)&&h)){if(Array.isArray(h))c.push(...h);else{const m=typeof h=="string"?h:El(s);c.push(m)}if(t.bails)return{errors:c}}}return{errors:c}}const n=Object.assign(Object.assign({},t),{rules:Sl(t.rules)}),r=[],i=Object.keys(n.rules),o=i.length;for(let s=0;s<o;s++){const l=i[s],a=await kf(n,e,{name:l,params:n.rules[l]});if(a.error&&(r.push(a.error),t.bails))return{errors:r}}return{errors:r}}function bf(t){return!!t&&t.name==="ValidationError"}function Ml(t){return{__type:"VVTypedSchema",async parse(n){var r;try{return{output:await t.validate(n,{abortEarly:!1}),errors:[]}}catch(i){if(!bf(i))throw i;if(!(!((r=i.inner)===null||r===void 0)&&r.length)&&i.errors.length)return{errors:[{path:i.path,errors:i.errors}]};const o=i.inner.reduce((s,l)=>{const a=l.path||"";return s[a]||(s[a]={errors:[],path:a}),s[a].errors.push(...l.errors),s},{});return{errors:Object.values(o)}}}}}async function vf(t,e){const r=await(ut(e)?e:Ml(e)).parse(t),i=[];for(const o of r.errors)o.errors.length&&i.push(...o.errors);return{errors:i}}async function kf(t,e,n){const r=Qu(n.name);if(!r)throw new Error(`No such validator '${n.name}' exists.`);const i=wf(n.params,t.formData),o={field:t.label||t.name,name:t.name,label:t.label,value:e,form:t.formData,rule:Object.assign(Object.assign({},n),{params:i})},s=await r(e,i,o);return typeof s=="string"?{error:s}:{error:s?void 0:El(o)}}function El(t){const e=pn().generateMessage;return e?e(t):"Field is invalid"}function wf(t,e){const n=r=>ho(r)?r(e):r;return Array.isArray(t)?t.map(n):Object.keys(t).reduce((r,i)=>(r[i]=n(t[i]),r),{})}async function xf(t,e){const r=await(ut(t)?t:Ml(t)).parse(oe(e)),i={},o={};for(const s of r.errors){const l=s.errors,a=(s.path||"").replace(/\["(\d+)"\]/g,(c,d)=>`[${d}]`);i[a]={valid:!l.length,errors:l},l.length&&(o[a]=l[0])}return{valid:!r.errors.length,results:i,errors:o,values:r.value}}async function Sf(t,e,n){const i=ze(t).map(async c=>{var d,f,h;const p=(d=n==null?void 0:n.names)===null||d===void 0?void 0:d[c],m=await Ol(Le(e,c),t[c],{name:(p==null?void 0:p.name)||c,label:p==null?void 0:p.label,values:e,bails:(h=(f=n==null?void 0:n.bailsMap)===null||f===void 0?void 0:f[c])!==null&&h!==void 0?h:!0});return Object.assign(Object.assign({},m),{path:c})});let o=!0;const s=await Promise.all(i),l={},a={};for(const c of s)l[c.path]={valid:c.valid,errors:c.errors},c.valid||(o=!1,a[c.path]=c.errors[0]);return{valid:o,results:l,errors:a}}let Tl=0;function Cf(t,e){const{value:n,initialValue:r,setInitialValue:i}=Of(t,e.modelValue,e.form);if(!e.form){let h=function(p){var m;"value"in p&&(n.value=p.value),"errors"in p&&c(p.errors),"touched"in p&&(f.touched=(m=p.touched)!==null&&m!==void 0?m:f.touched),"initialValue"in p&&i(p.initialValue)};const{errors:a,setErrors:c}=Tf(),d=Tl>=Number.MAX_SAFE_INTEGER?0:++Tl,f=Ef(n,r,a,e.schema);return{id:d,path:t,value:n,initialValue:r,meta:f,flags:{pendingUnmount:{[d]:!1},pendingReset:!1},errors:a,setState:h}}const o=e.form.createPathState(t,{bails:e.bails,label:e.label,type:e.type,validate:e.validate,schema:e.schema}),s=u.computed(()=>o.errors);function l(a){var c,d,f;"value"in a&&(n.value=a.value),"errors"in a&&((c=e.form)===null||c===void 0||c.setFieldError(u.unref(t),a.errors)),"touched"in a&&((d=e.form)===null||d===void 0||d.setFieldTouched(u.unref(t),(f=a.touched)!==null&&f!==void 0?f:!1)),"initialValue"in a&&i(a.initialValue)}return{id:Array.isArray(o.id)?o.id[o.id.length-1]:o.id,path:t,value:n,errors:s,meta:o,initialValue:r,flags:o.__flags,setState:l}}function Of(t,e,n){const r=u.ref(u.unref(e));function i(){return n?Le(n.initialValues.value,u.unref(t),u.unref(r)):u.unref(r)}function o(c){if(!n){r.value=c;return}n.setFieldInitialValue(u.unref(t),c,!0)}const s=u.computed(i);if(!n)return{value:u.ref(i()),initialValue:s,setInitialValue:o};const l=Mf(e,n,s,t);return n.stageInitialValue(u.unref(t),l,!0),{value:u.computed({get(){return Le(n.values,u.unref(t))},set(c){n.setFieldValue(u.unref(t),c,!1)}}),initialValue:s,setInitialValue:o}}function Mf(t,e,n,r){return u.isRef(t)?u.unref(t):t!==void 0?t:Le(e.values,u.unref(r),u.unref(n))}function Ef(t,e,n,r){const i=u.computed(()=>{var s,l,a;return(a=(l=(s=u.toValue(r))===null||s===void 0?void 0:s.describe)===null||l===void 0?void 0:l.call(s).required)!==null&&a!==void 0?a:!1}),o=u.reactive({touched:!1,pending:!1,valid:!0,required:i,validated:!!u.unref(n).length,initialValue:u.computed(()=>u.unref(e)),dirty:u.computed(()=>!Ae(u.unref(t),u.unref(e)))});return u.watch(n,s=>{o.valid=!s.length},{immediate:!0,flush:"sync"}),o}function Tf(){const t=u.ref([]);return{errors:t,setErrors:e=>{t.value=vo(e)}}}function Nl(t){process.env.NODE_ENV!=="production"&&Gu({id:"vee-validate-devtools-plugin",label:"VeeValidate Plugin",packageName:"vee-validate",homepage:"https://vee-validate.logaretm.com/v4",app:t,logo:"https://vee-validate.logaretm.com/v4/logo.png"},Df)}const xr={},Sr={};let Pt;const $n=af(()=>{setTimeout(async()=>{await u.nextTick(),Pt==null||Pt.sendInspectorState(Rn),Pt==null||Pt.sendInspectorTree(Rn)},100)},100);function Nf(t){const e=u.getCurrentInstance();if(!Pt){const n=e==null?void 0:e.appContext.app;if(!n)return;Nl(n)}xr[t.formId]=Object.assign({},t),xr[t.formId]._vm=e,u.onUnmounted(()=>{delete xr[t.formId],$n()}),$n()}function Af(t){const e=u.getCurrentInstance();if(!Pt){const n=e==null?void 0:e.appContext.app;if(!n)return;Nl(n)}Sr[t.id]=Object.assign({},t),Sr[t.id]._vm=e,u.onUnmounted(()=>{delete Sr[t.id],$n()}),$n()}const Rn="vee-validate-inspector",Fe={error:12405579,success:448379,unknown:5522283,white:16777215,black:0,blue:218007,purple:12157168,orange:16099682,gray:12304330};let de=null;function Df(t){Pt=t,t.addInspector({id:Rn,icon:"rule",label:"vee-validate",noSelectionText:"Select a vee-validate node to inspect",actions:[{icon:"done_outline",tooltip:"Validate selected item",action:async()=>{if(!de){console.error("There is not a valid selected vee-validate node or component");return}if(de.type==="field"){await de.field.validate();return}if(de.type==="form"){await de.form.validate();return}de.type==="pathState"&&await de.form.validateField(de.state.path)}},{icon:"delete_sweep",tooltip:"Clear validation state of the selected item",action:()=>{if(!de){console.error("There is not a valid selected vee-validate node or component");return}if(de.type==="field"){de.field.resetField();return}de.type==="form"&&de.form.resetForm(),de.type==="pathState"&&de.form.resetField(de.state.path)}}]}),t.on.getInspectorTree(e=>{if(e.inspectorId!==Rn)return;const n=Object.values(xr),r=Object.values(Sr);e.rootNodes=[...n.map(Bf),...r.map(i=>If(i))]}),t.on.getInspectorState((e,n)=>{if(e.inspectorId!==Rn||n.currentTab!==`custom-inspector:${Rn}`)return;const{form:r,field:i,state:o,type:s}=Pf(e.nodeId);if(r&&s==="form"){e.state=$f(r),de={type:"form",form:r};return}if(o&&s==="pathState"&&r){e.state=Dl(o),de={type:"pathState",state:o,form:r};return}if(i&&s==="field"){e.state=Dl({errors:i.errors.value,dirty:i.meta.dirty,valid:i.meta.valid,touched:i.meta.touched,value:i.value.value,initialValue:i.meta.initialValue}),de={field:i,type:"field"};return}de=null})}function Bf(t){const{textColor:e,bgColor:n}=Bl(t.meta.value.valid),r={};Object.values(t.getAllPathStates()).forEach(s=>{It(r,u.unref(s.path),Vf(s,t))});function i(s,l=[]){const a=[...l].pop();return"id"in s?Object.assign(Object.assign({},s),{label:a||s.label}):Wt(s)?{id:`${l.join(".")}`,label:a||"",children:Object.keys(s).map(c=>i(s[c],[...l,c]))}:Array.isArray(s)?{id:`${l.join(".")}`,label:`${a}[]`,children:s.map((c,d)=>i(c,[...l,String(d)]))}:{id:"",label:"",children:[]}}const{children:o}=i(r);return{id:xo(t),label:"Form",children:o,tags:[{label:"Form",textColor:e,backgroundColor:n},{label:`${t.getAllPathStates().length} fields`,textColor:Fe.white,backgroundColor:Fe.unknown}]}}function Vf(t,e){return{id:xo(e,t),label:u.unref(t.path),tags:Al(t.multiple,t.fieldsCount,t.type,t.valid,e)}}function If(t,e){return{id:xo(e,t),label:u.unref(t.name),tags:Al(!1,1,t.type,t.meta.valid,e)}}function Al(t,e,n,r,i){const{textColor:o,bgColor:s}=Bl(r);return[t?void 0:{label:"Field",textColor:o,backgroundColor:s},i?void 0:{label:"Standalone",textColor:Fe.black,backgroundColor:Fe.gray},n==="checkbox"?{label:"Checkbox",textColor:Fe.white,backgroundColor:Fe.blue}:void 0,n==="radio"?{label:"Radio",textColor:Fe.white,backgroundColor:Fe.purple}:void 0,t?{label:"Multiple",textColor:Fe.black,backgroundColor:Fe.orange}:void 0].filter(Boolean)}function xo(t,e){const n=e?"path"in e?"pathState":"field":"form",r=e?"path"in e?e==null?void 0:e.path:u.unref(e==null?void 0:e.name):"",i={f:t==null?void 0:t.formId,ff:r,type:n};return btoa(encodeURIComponent(JSON.stringify(i)))}function Pf(t){try{const e=JSON.parse(decodeURIComponent(atob(t))),n=xr[e.f];if(!n&&e.ff){const i=Sr[e.ff];return i?{type:e.type,field:i}:{}}if(!n)return{};const r=n.getPathState(e.ff);return{type:e.type,form:n,state:r}}catch{}return{}}function Dl(t){return{"Field state":[{key:"errors",value:t.errors},{key:"initialValue",value:t.initialValue},{key:"currentValue",value:t.value},{key:"touched",value:t.touched},{key:"dirty",value:t.dirty},{key:"valid",value:t.valid}]}}function $f(t){const{errorBag:e,meta:n,values:r,isSubmitting:i,isValidating:o,submitCount:s}=t;return{"Form state":[{key:"submitCount",value:s.value},{key:"isSubmitting",value:i.value},{key:"isValidating",value:o.value},{key:"touched",value:n.value.touched},{key:"dirty",value:n.value.dirty},{key:"valid",value:n.value.valid},{key:"initialValues",value:n.value.initialValues},{key:"currentValues",value:r},{key:"errors",value:ze(e.value).reduce((l,a)=>{var c;const d=(c=e.value[a])===null||c===void 0?void 0:c[0];return d&&(l[a]=d),l},{})}]}}function Bl(t){return{bgColor:t?Fe.success:Fe.error,textColor:t?Fe.black:Fe.white}}function Rf(t,e,n){return wr(n==null?void 0:n.type)?Lf(t,e,n):Vl(t,e,n)}function Vl(t,e,n){const{initialValue:r,validateOnMount:i,bails:o,type:s,checkedValue:l,label:a,validateOnValueUpdate:c,uncheckedValue:d,controlled:f,keepValueOnUnmount:h,syncVModel:p,form:m}=_f(n),y=f?yo(kr):void 0,g=m||y,v=u.computed(()=>vr(u.toValue(t))),C=u.computed(()=>{if(u.toValue(g==null?void 0:g.schema))return;const W=u.unref(e);return ii(W)||ut(W)||ge(W)||Array.isArray(W)?W:Sl(W)}),M=!ge(C.value)&&ut(u.toValue(e)),{id:b,value:O,initialValue:S,meta:D,setState:V,errors:A,flags:L}=Cf(v,{modelValue:r,form:g,bails:o,label:a,type:s,validate:C.value?_:void 0,schema:M?e:void 0}),Y=u.computed(()=>A.value[0]);p&&zf({value:O,prop:p,handleChange:Q,shouldValidate:()=>c&&!L.pendingReset});const q=(B,W=!1)=>{D.touched=!0,W&&ee()};async function Z(B){var W,re;if(g!=null&&g.validateSchema){const{results:te}=await g.validateSchema(B);return(W=te[u.toValue(v)])!==null&&W!==void 0?W:{valid:!0,errors:[]}}return C.value?Ol(O.value,C.value,{name:u.toValue(v),label:u.toValue(a),values:(re=g==null?void 0:g.values)!==null&&re!==void 0?re:{},bails:o}):{valid:!0,errors:[]}}const ee=bo(async()=>(D.pending=!0,D.validated=!0,Z("validated-only")),B=>(L.pendingUnmount[le.id]||(V({errors:B.errors}),D.pending=!1,D.valid=B.valid),B)),X=bo(async()=>Z("silent"),B=>(D.valid=B.valid,B));function _(B){return(B==null?void 0:B.mode)==="silent"?X():ee()}function Q(B,W=!0){const re=li(B);qe(re,W)}u.onMounted(()=>{if(i)return ee();(!g||!g.validateSchema)&&X()});function ne(B){D.touched=B}function pe(B){var W;const re=B&&"value"in B?B.value:S.value;V({value:oe(re),initialValue:oe(re),touched:(W=B==null?void 0:B.touched)!==null&&W!==void 0?W:!1,errors:(B==null?void 0:B.errors)||[]}),D.pending=!1,D.validated=!1,X()}const $e=u.getCurrentInstance();function qe(B,W=!0){O.value=$e&&p?cf(B,$e.props.modelModifiers):B,(W?ee:X)()}function et(B){V({errors:Array.isArray(B)?B:[B]})}const tt=u.computed({get(){return O.value},set(B){qe(B,c)}}),le={id:b,name:v,label:a,value:tt,meta:D,errors:A,errorMessage:Y,type:s,checkedValue:l,uncheckedValue:d,bails:o,keepValueOnUnmount:h,resetField:pe,handleReset:()=>pe(),validate:_,handleChange:Q,handleBlur:q,setState:V,setTouched:ne,setErrors:et,setValue:qe};if(u.provide(pl,le),u.isRef(e)&&typeof u.unref(e)!="function"&&u.watch(e,(B,W)=>{Ae(B,W)||(D.validated?ee():X())},{deep:!0}),process.env.NODE_ENV!=="production"&&(le._vm=u.getCurrentInstance(),u.watch(()=>Object.assign(Object.assign({errors:A.value},D),{value:O.value}),$n,{deep:!0}),g||Af(le)),!g)return le;const Re=u.computed(()=>{const B=C.value;return!B||ge(B)||ii(B)||ut(B)||Array.isArray(B)?{}:Object.keys(B).reduce((W,re)=>{const te=mf(B[re]).map(we=>we.__locatorRef).reduce((we,xe)=>{const Ke=Le(g.values,xe)||g.values[xe];return Ke!==void 0&&(we[xe]=Ke),we},{});return Object.assign(W,te),W},{})});return u.watch(Re,(B,W)=>{if(!Object.keys(B).length)return;!Ae(B,W)&&(D.validated?ee():X())}),u.onBeforeUnmount(()=>{var B;const W=(B=u.toValue(le.keepValueOnUnmount))!==null&&B!==void 0?B:u.toValue(g.keepValuesOnUnmount),re=u.toValue(v);if(W||!g||L.pendingUnmount[le.id]){g==null||g.removePathState(re,b);return}L.pendingUnmount[le.id]=!0;const te=g.getPathState(re);if(Array.isArray(te==null?void 0:te.id)&&(te!=null&&te.multiple)?te!=null&&te.id.includes(le.id):(te==null?void 0:te.id)===le.id){if(te!=null&&te.multiple&&Array.isArray(te.value)){const xe=te.value.findIndex(Ke=>Ae(Ke,u.toValue(le.checkedValue)));if(xe>-1){const Ke=[...te.value];Ke.splice(xe,1),g.setFieldValue(re,Ke)}Array.isArray(te.id)&&te.id.splice(te.id.indexOf(le.id),1)}else g.unsetPathValue(u.toValue(v));g.removePathState(re,b)}}),le}function _f(t){const e=()=>({initialValue:void 0,validateOnMount:!1,bails:!0,label:void 0,validateOnValueUpdate:!0,keepValueOnUnmount:void 0,syncVModel:!1,controlled:!0}),n=!!(t!=null&&t.syncVModel),r=typeof(t==null?void 0:t.syncVModel)=="string"?t.syncVModel:(t==null?void 0:t.modelPropName)||"modelValue",i=n&&!("initialValue"in(t||{}))?So(u.getCurrentInstance(),r):t==null?void 0:t.initialValue;if(!t)return Object.assign(Object.assign({},e()),{initialValue:i});const o="valueProp"in t?t.valueProp:t.checkedValue,s="standalone"in t?!t.standalone:t.controlled,l=(t==null?void 0:t.modelPropName)||(t==null?void 0:t.syncVModel)||!1;return Object.assign(Object.assign(Object.assign({},e()),t||{}),{initialValue:i,controlled:s??!0,checkedValue:o,syncVModel:l})}function Lf(t,e,n){const r=n!=null&&n.standalone?void 0:yo(kr),i=n==null?void 0:n.checkedValue,o=n==null?void 0:n.uncheckedValue;function s(l){const a=l.handleChange,c=u.computed(()=>{const f=u.toValue(l.value),h=u.toValue(i);return Array.isArray(f)?f.findIndex(p=>Ae(p,h))>=0:Ae(h,f)});function d(f,h=!0){var p,m;if(c.value===((p=f==null?void 0:f.target)===null||p===void 0?void 0:p.checked)){h&&l.validate();return}const y=u.toValue(t),g=r==null?void 0:r.getPathState(y),v=li(f);let C=(m=u.toValue(i))!==null&&m!==void 0?m:v;r&&(g!=null&&g.multiple)&&g.type==="checkbox"?C=kl(Le(r.values,y)||[],C,void 0):(n==null?void 0:n.type)==="checkbox"&&(C=kl(u.toValue(l.value),C,u.toValue(o))),a(C,h)}return Object.assign(Object.assign({},l),{checked:c,checkedValue:i,uncheckedValue:o,handleChange:d})}return s(Vl(t,e,n))}function zf({prop:t,value:e,handleChange:n,shouldValidate:r}){const i=u.getCurrentInstance();if(!i||!t){process.env.NODE_ENV!=="production"&&console.warn("Failed to setup model events because `useField` was not called in setup.");return}const o=typeof t=="string"?t:"modelValue",s=`update:${o}`;o in i.props&&(u.watch(e,l=>{Ae(l,So(i,o))||i.emit(s,l)}),u.watch(()=>So(i,o),l=>{if(l===ri&&e.value===void 0)return;const a=l===ri?void 0:l;Ae(a,e.value)||n(a,r())}))}function So(t,e){if(t)return t.props[e]}const Ff=u.defineComponent({name:"Field",inheritAttrs:!1,props:{as:{type:[String,Object],default:void 0},name:{type:String,required:!0},rules:{type:[Object,String,Function],default:void 0},validateOnMount:{type:Boolean,default:!1},validateOnBlur:{type:Boolean,default:void 0},validateOnChange:{type:Boolean,default:void 0},validateOnInput:{type:Boolean,default:void 0},validateOnModelUpdate:{type:Boolean,default:void 0},bails:{type:Boolean,default:()=>pn().bails},label:{type:String,default:void 0},uncheckedValue:{type:null,default:void 0},modelValue:{type:null,default:ri},modelModifiers:{type:null,default:()=>({})},"onUpdate:modelValue":{type:null,default:void 0},standalone:{type:Boolean,default:!1},keepValue:{type:Boolean,default:void 0}},setup(t,e){const n=u.toRef(t,"rules"),r=u.toRef(t,"name"),i=u.toRef(t,"label"),o=u.toRef(t,"uncheckedValue"),s=u.toRef(t,"keepValue"),{errors:l,value:a,errorMessage:c,validate:d,handleChange:f,handleBlur:h,setTouched:p,resetField:m,handleReset:y,meta:g,checked:v,setErrors:C}=Rf(r,n,{validateOnMount:t.validateOnMount,bails:t.bails,standalone:t.standalone,type:e.attrs.type,initialValue:Hf(t,e),checkedValue:e.attrs.value,uncheckedValue:o,label:i,validateOnValueUpdate:t.validateOnModelUpdate,keepValueOnUnmount:s,syncVModel:!0}),M=function(A,L=!0){f(A,L)},b=u.computed(()=>{const{validateOnInput:V,validateOnChange:A,validateOnBlur:L,validateOnModelUpdate:Y}=jf(t);function q(_){h(_,L),ge(e.attrs.onBlur)&&e.attrs.onBlur(_)}function Z(_){M(_,V),ge(e.attrs.onInput)&&e.attrs.onInput(_)}function ee(_){M(_,A),ge(e.attrs.onChange)&&e.attrs.onChange(_)}const X={name:t.name,onBlur:q,onInput:Z,onChange:ee};return X["onUpdate:modelValue"]=_=>M(_,Y),X}),O=u.computed(()=>{const V=Object.assign({},b.value);wr(e.attrs.type)&&v&&(V.checked=v.value);const A=Il(t,e);return lf(A,e.attrs)&&(V.value=a.value),V}),S=u.computed(()=>Object.assign(Object.assign({},b.value),{modelValue:a.value}));function D(){return{field:O.value,componentField:S.value,value:a.value,meta:g,errors:l.value,errorMessage:c.value,validate:d,resetField:m,handleChange:M,handleInput:V=>M(V,!1),handleReset:y,handleBlur:b.value.onBlur,setTouched:p,setErrors:C}}return e.expose({value:a,meta:g,errors:l,errorMessage:c,setErrors:C,setTouched:p,reset:m,validate:d,handleChange:f}),()=>{const V=u.resolveDynamicComponent(Il(t,e)),A=ko(V,e,D);return V?u.h(V,Object.assign(Object.assign({},e.attrs),O.value),A):A}}});function Il(t,e){let n=t.as||"";return!t.as&&!e.slots.default&&(n="input"),n}function jf(t){var e,n,r,i;const{validateOnInput:o,validateOnChange:s,validateOnBlur:l,validateOnModelUpdate:a}=pn();return{validateOnInput:(e=t.validateOnInput)!==null&&e!==void 0?e:o,validateOnChange:(n=t.validateOnChange)!==null&&n!==void 0?n:s,validateOnBlur:(r=t.validateOnBlur)!==null&&r!==void 0?r:l,validateOnModelUpdate:(i=t.validateOnModelUpdate)!==null&&i!==void 0?i:a}}function Hf(t,e){return wr(e.attrs.type)?yl(t,"modelValue")?t.modelValue:void 0:yl(t,"modelValue")?t.modelValue:e.attrs.value}const ai=Ff;let Wf=0;const ci=["bails","fieldsCount","id","multiple","type","validate"];function Pl(t){const e=(t==null?void 0:t.initialValues)||{},n=Object.assign({},u.toValue(e)),r=u.unref(t==null?void 0:t.validationSchema);return r&&ut(r)&&ge(r.cast)?oe(r.cast(n)||{}):oe(n)}function Uf(t){var e;const n=Wf++;let r=0;const i=u.ref(!1),o=u.ref(!1),s=u.ref(0),l=[],a=u.reactive(Pl(t)),c=u.ref([]),d=u.ref({}),f=u.ref({}),h=df(()=>{f.value=c.value.reduce((x,w)=>(x[vr(u.toValue(w.path))]=w,x),{})});function p(x,w){const E=_(x);if(!E){typeof x=="string"&&(d.value[vr(x)]=vo(w));return}if(typeof x=="string"){const P=vr(x);d.value[P]&&delete d.value[P]}E.errors=vo(w),E.valid=!E.errors.length}function m(x){ze(x).forEach(w=>{p(w,x[w])})}t!=null&&t.initialErrors&&m(t.initialErrors);const y=u.computed(()=>{const x=c.value.reduce((w,E)=>(E.errors.length&&(w[E.path]=E.errors),w),{});return Object.assign(Object.assign({},d.value),x)}),g=u.computed(()=>ze(y.value).reduce((x,w)=>{const E=y.value[w];return E!=null&&E.length&&(x[w]=E[0]),x},{})),v=u.computed(()=>c.value.reduce((x,w)=>(x[w.path]={name:w.path||"",label:w.label||""},x),{})),C=u.computed(()=>c.value.reduce((x,w)=>{var E;return x[w.path]=(E=w.bails)!==null&&E!==void 0?E:!0,x},{})),M=Object.assign({},(t==null?void 0:t.initialErrors)||{}),b=(e=t==null?void 0:t.keepValuesOnUnmount)!==null&&e!==void 0?e:!1,{initialValues:O,originalInitialValues:S,setInitialValues:D}=Kf(c,a,t),V=qf(c,a,S,g),A=u.computed(()=>c.value.reduce((x,w)=>{const E=Le(a,w.path);return It(x,w.path,E),x},{})),L=t==null?void 0:t.validationSchema;function Y(x,w){var E,P;const j=u.computed(()=>Le(O.value,u.toValue(x))),k=f.value[u.toValue(x)],N=(w==null?void 0:w.type)==="checkbox"||(w==null?void 0:w.type)==="radio";if(k&&N){k.multiple=!0;const _e=r++;return Array.isArray(k.id)?k.id.push(_e):k.id=[k.id,_e],k.fieldsCount++,k.__flags.pendingUnmount[_e]=!1,k}const $=u.computed(()=>Le(a,u.toValue(x))),F=u.toValue(x),H=ne.findIndex(_e=>_e===F);H!==-1&&ne.splice(H,1);const K=u.computed(()=>{var _e,nt,In,hn;const Vt=u.toValue(L);if(ut(Vt))return(nt=(_e=Vt.describe)===null||_e===void 0?void 0:_e.call(Vt,u.toValue(x)).required)!==null&&nt!==void 0?nt:!1;const ni=u.toValue(w==null?void 0:w.schema);return ut(ni)&&(hn=(In=ni.describe)===null||In===void 0?void 0:In.call(ni).required)!==null&&hn!==void 0?hn:!1}),ie=r++,ce=u.reactive({id:ie,path:x,touched:!1,pending:!1,valid:!0,validated:!!(!((E=M[F])===null||E===void 0)&&E.length),required:K,initialValue:j,errors:u.shallowRef([]),bails:(P=w==null?void 0:w.bails)!==null&&P!==void 0?P:!1,label:w==null?void 0:w.label,type:(w==null?void 0:w.type)||"default",value:$,multiple:!1,__flags:{pendingUnmount:{[ie]:!1},pendingReset:!1},fieldsCount:1,validate:w==null?void 0:w.validate,dirty:u.computed(()=>!Ae(u.unref($),u.unref(j)))});return c.value.push(ce),f.value[F]=ce,h(),g.value[F]&&!M[F]&&u.nextTick(()=>{at(F,{mode:"silent"})}),u.isRef(x)&&u.watch(x,_e=>{h();const nt=oe($.value);f.value[_e]=ce,u.nextTick(()=>{It(a,_e,nt)})}),ce}const q=wl(Bt,5),Z=wl(Bt,5),ee=bo(async x=>await(x==="silent"?q():Z()),(x,[w])=>{const E=ze(B.errorBag.value),j=[...new Set([...ze(x.results),...c.value.map(k=>k.path),...E])].sort().reduce((k,N)=>{var $;const F=N,H=_(F)||Q(F),K=(($=x.results[F])===null||$===void 0?void 0:$.errors)||[],ie=u.toValue(H==null?void 0:H.path)||F,ce=Jf({errors:K,valid:!K.length},k.results[ie]);return k.results[ie]=ce,ce.valid||(k.errors[ie]=ce.errors[0]),H&&d.value[ie]&&delete d.value[ie],H?(H.valid=ce.valid,w==="silent"||w==="validated-only"&&!H.validated||p(H,ce.errors),k):(p(ie,K),k)},{valid:x.valid,results:{},errors:{}});return x.values&&(j.values=x.values),ze(j.results).forEach(k=>{var N;const $=_(k);$&&w!=="silent"&&(w==="validated-only"&&!$.validated||p($,(N=j.results[k])===null||N===void 0?void 0:N.errors))}),j});function X(x){c.value.forEach(x)}function _(x){const w=typeof x=="string"?vr(x):x;return typeof w=="string"?f.value[w]:w}function Q(x){return c.value.filter(E=>x.startsWith(E.path)).reduce((E,P)=>E?P.path.length>E.path.length?P:E:P,void 0)}let ne=[],pe;function $e(x){return ne.push(x),pe||(pe=u.nextTick(()=>{[...ne].sort().reverse().forEach(E=>{vl(a,E)}),ne=[],pe=null})),pe}function qe(x){return function(E,P){return function(k){return k instanceof Event&&(k.preventDefault(),k.stopPropagation()),X(N=>N.touched=!0),i.value=!0,s.value++,bt().then(N=>{const $=oe(a);if(N.valid&&typeof E=="function"){const F=oe(A.value);let H=x?F:$;return N.values&&(H=N.values),E(H,{evt:k,controlledValues:F,setErrors:m,setFieldError:p,setTouched:dn,setFieldTouched:xe,setValues:te,setFieldValue:W,resetForm:jt,resetField:un})}!N.valid&&typeof P=="function"&&P({values:$,evt:k,errors:N.errors,results:N.results})}).then(N=>(i.value=!1,N),N=>{throw i.value=!1,N})}}}const tt=qe(!1);tt.withControlled=qe(!0);function le(x,w){const E=c.value.findIndex(j=>j.path===x&&(Array.isArray(j.id)?j.id.includes(w):j.id===w)),P=c.value[E];if(!(E===-1||!P)){if(u.nextTick(()=>{at(x,{mode:"silent",warn:!1})}),P.multiple&&P.fieldsCount&&P.fieldsCount--,Array.isArray(P.id)){const j=P.id.indexOf(w);j>=0&&P.id.splice(j,1),delete P.__flags.pendingUnmount[w]}(!P.multiple||P.fieldsCount<=0)&&(c.value.splice(E,1),ct(x),h(),delete f.value[x])}}function Re(x){ze(f.value).forEach(w=>{w.startsWith(x)&&delete f.value[w]}),c.value=c.value.filter(w=>!w.path.startsWith(x)),u.nextTick(()=>{h()})}const B={formId:n,values:a,controlledValues:A,errorBag:y,errors:g,schema:L,submitCount:s,meta:V,isSubmitting:i,isValidating:o,fieldArrays:l,keepValuesOnUnmount:b,validateSchema:u.unref(L)?ee:void 0,validate:bt,setFieldError:p,validateField:at,setFieldValue:W,setValues:te,setErrors:m,setFieldTouched:xe,setTouched:dn,resetForm:jt,resetField:un,handleSubmit:tt,useFieldModel:pr,defineInputBinds:mr,defineComponentBinds:gr,defineField:fn,stageInitialValue:Dt,unsetInitialValue:ct,setFieldInitialValue:Ht,createPathState:Y,getPathState:_,unsetPathValue:$e,removePathState:le,initialValues:O,getAllPathStates:()=>c.value,destroyPath:Re,isFieldTouched:Ke,isFieldDirty:Bn,isFieldValid:hr};function W(x,w,E=!0){const P=oe(w),j=typeof x=="string"?x:x.path;_(j)||Y(j),It(a,j,P),E&&at(j)}function re(x,w=!0){ze(a).forEach(E=>{delete a[E]}),ze(x).forEach(E=>{W(E,x[E],!1)}),w&&bt()}function te(x,w=!0){br(a,x),l.forEach(E=>E&&E.reset()),w&&bt()}function we(x,w){const E=_(u.toValue(x))||Y(x);return u.computed({get(){return E.value},set(P){var j;const k=u.toValue(x);W(k,P,(j=u.toValue(w))!==null&&j!==void 0?j:!1)}})}function xe(x,w){const E=_(x);E&&(E.touched=w)}function Ke(x){const w=_(x);return w?w.touched:c.value.filter(E=>E.path.startsWith(x)).some(E=>E.touched)}function Bn(x){const w=_(x);return w?w.dirty:c.value.filter(E=>E.path.startsWith(x)).some(E=>E.dirty)}function hr(x){const w=_(x);return w?w.valid:c.value.filter(E=>E.path.startsWith(x)).every(E=>E.valid)}function dn(x){if(typeof x=="boolean"){X(w=>{w.touched=x});return}ze(x).forEach(w=>{xe(w,!!x[w])})}function un(x,w){var E;const P=w&&"value"in w?w.value:Le(O.value,x),j=_(x);j&&(j.__flags.pendingReset=!0),Ht(x,oe(P),!0),W(x,P,!1),xe(x,(E=w==null?void 0:w.touched)!==null&&E!==void 0?E:!1),p(x,(w==null?void 0:w.errors)||[]),u.nextTick(()=>{j&&(j.__flags.pendingReset=!1)})}function jt(x,w){let E=oe(x!=null&&x.values?x.values:S.value);E=w!=null&&w.force?E:br(S.value,E),E=ut(L)&&ge(L.cast)?L.cast(E):E,D(E),X(P=>{var j;P.__flags.pendingReset=!0,P.validated=!1,P.touched=((j=x==null?void 0:x.touched)===null||j===void 0?void 0:j[P.path])||!1,W(P.path,Le(E,P.path),!1),p(P.path,void 0)}),w!=null&&w.force?re(E,!1):te(E,!1),m((x==null?void 0:x.errors)||{}),s.value=(x==null?void 0:x.submitCount)||0,u.nextTick(()=>{bt({mode:"silent"}),X(P=>{P.__flags.pendingReset=!1})})}async function bt(x){const w=(x==null?void 0:x.mode)||"force";if(w==="force"&&X(k=>k.validated=!0),B.validateSchema)return B.validateSchema(w);o.value=!0;const E=await Promise.all(c.value.map(k=>k.validate?k.validate(x).then(N=>({key:k.path,valid:N.valid,errors:N.errors})):Promise.resolve({key:k.path,valid:!0,errors:[]})));o.value=!1;const P={},j={};for(const k of E)P[k.key]={valid:k.valid,errors:k.errors},k.errors.length&&(j[k.key]=k.errors[0]);return{valid:E.every(k=>k.valid),results:P,errors:j}}async function at(x,w){var E;const P=_(x);if(P&&(w==null?void 0:w.mode)!=="silent"&&(P.validated=!0),L){const{results:k}=await ee((w==null?void 0:w.mode)||"validated-only");return k[x]||{errors:[],valid:!0}}return P!=null&&P.validate?P.validate(w):(!P&&((E=w==null?void 0:w.warn)!==null&&E!==void 0?E:!0)&&process.env.NODE_ENV!=="production"&&u.warn(`field with path ${x} was not found`),Promise.resolve({errors:[],valid:!0}))}function ct(x){vl(O.value,x)}function Dt(x,w,E=!1){Ht(x,w),It(a,x,w),E&&!(t!=null&&t.initialValues)&&It(S.value,x,oe(w))}function Ht(x,w,E=!1){It(O.value,x,oe(w)),E&&It(S.value,x,oe(w))}async function Bt(){const x=u.unref(L);if(!x)return{valid:!0,results:{},errors:{}};o.value=!0;const w=ii(x)||ut(x)?await xf(x,a):await Sf(x,a,{names:v.value,bailsMap:C.value});return o.value=!1,w}const Vn=tt((x,{evt:w})=>{gl(w)&&w.target.submit()});u.onMounted(()=>{if(t!=null&&t.initialErrors&&m(t.initialErrors),t!=null&&t.initialTouched&&dn(t.initialTouched),t!=null&&t.validateOnMount){bt();return}B.validateSchema&&B.validateSchema("silent")}),u.isRef(L)&&u.watch(L,()=>{var x;(x=B.validateSchema)===null||x===void 0||x.call(B,"validated-only")}),u.provide(kr,B),process.env.NODE_ENV!=="production"&&(Nf(B),u.watch(()=>Object.assign(Object.assign({errors:y.value},V.value),{values:a,isSubmitting:i.value,isValidating:o.value,submitCount:s.value}),$n,{deep:!0}));function fn(x,w){const E=ge(w)||w==null?void 0:w.label,P=_(u.toValue(x))||Y(x,{label:E}),j=()=>ge(w)?w(si(P,ci)):w||{};function k(){var K;P.touched=!0,((K=j().validateOnBlur)!==null&&K!==void 0?K:pn().validateOnBlur)&&at(P.path)}function N(){var K;((K=j().validateOnInput)!==null&&K!==void 0?K:pn().validateOnInput)&&u.nextTick(()=>{at(P.path)})}function $(){var K;((K=j().validateOnChange)!==null&&K!==void 0?K:pn().validateOnChange)&&u.nextTick(()=>{at(P.path)})}const F=u.computed(()=>{const K={onChange:$,onInput:N,onBlur:k};return ge(w)?Object.assign(Object.assign({},K),w(si(P,ci)).props||{}):w!=null&&w.props?Object.assign(Object.assign({},K),w.props(si(P,ci))):K});return[we(x,()=>{var K,ie,ce;return(ce=(K=j().validateOnModelUpdate)!==null&&K!==void 0?K:(ie=pn())===null||ie===void 0?void 0:ie.validateOnModelUpdate)!==null&&ce!==void 0?ce:!0}),F]}function pr(x){return Array.isArray(x)?x.map(w=>we(w,!0)):we(x)}function mr(x,w){const[E,P]=fn(x,w);function j(){P.value.onBlur()}function k($){const F=li($);W(u.toValue(x),F,!1),P.value.onInput()}function N($){const F=li($);W(u.toValue(x),F,!1),P.value.onChange()}return u.computed(()=>Object.assign(Object.assign({},P.value),{onBlur:j,onInput:k,onChange:N,value:E.value}))}function gr(x,w){const[E,P]=fn(x,w),j=_(u.toValue(x));function k(N){E.value=N}return u.computed(()=>{const N=ge(w)?w(si(j,ci)):w||{};return Object.assign({[N.model||"modelValue"]:E.value,[`onUpdate:${N.model||"modelValue"}`]:k},P.value)})}return Object.assign(Object.assign({},B),{values:u.readonly(a),handleReset:()=>jt(),submitForm:Vn})}function qf(t,e,n,r){const i={touched:"some",pending:"some",valid:"every"},o=u.computed(()=>!Ae(e,u.unref(n)));function s(){const a=t.value;return ze(i).reduce((c,d)=>{const f=i[d];return c[d]=a[f](h=>h[d]),c},{})}const l=u.reactive(s());return u.watchEffect(()=>{const a=s();l.touched=a.touched,l.valid=a.valid,l.pending=a.pending}),u.computed(()=>Object.assign(Object.assign({initialValues:u.unref(n)},l),{valid:l.valid&&!ze(r.value).length,dirty:o.value}))}function Kf(t,e,n){const r=Pl(n),i=u.ref(r),o=u.ref(oe(r));function s(l,a=!1){i.value=br(oe(i.value)||{},oe(l)),o.value=br(oe(o.value)||{},oe(l)),a&&t.value.forEach(c=>{if(c.touched)return;const f=Le(i.value,c.path);It(e,c.path,oe(f))})}return{initialValues:i,originalInitialValues:o,setInitialValues:s}}function Jf(t,e){return e?{valid:t.valid&&e.valid,errors:[...t.errors,...e.errors]}:t}const Gf=u.defineComponent({name:"Form",inheritAttrs:!1,props:{as:{type:null,default:"form"},validationSchema:{type:Object,default:void 0},initialValues:{type:Object,default:void 0},initialErrors:{type:Object,default:void 0},initialTouched:{type:Object,default:void 0},validateOnMount:{type:Boolean,default:!1},onSubmit:{type:Function,default:void 0},onInvalidSubmit:{type:Function,default:void 0},keepValues:{type:Boolean,default:!1}},setup(t,e){const n=u.toRef(t,"validationSchema"),r=u.toRef(t,"keepValues"),{errors:i,errorBag:o,values:s,meta:l,isSubmitting:a,isValidating:c,submitCount:d,controlledValues:f,validate:h,validateField:p,handleReset:m,resetForm:y,handleSubmit:g,setErrors:v,setFieldError:C,setFieldValue:M,setValues:b,setFieldTouched:O,setTouched:S,resetField:D}=Uf({validationSchema:n.value?n:void 0,initialValues:t.initialValues,initialErrors:t.initialErrors,initialTouched:t.initialTouched,validateOnMount:t.validateOnMount,keepValuesOnUnmount:r}),V=g((_,{evt:Q})=>{gl(Q)&&Q.target.submit()},t.onInvalidSubmit),A=t.onSubmit?g(t.onSubmit,t.onInvalidSubmit):V;function L(_){po(_)&&_.preventDefault(),m(),typeof e.attrs.onReset=="function"&&e.attrs.onReset()}function Y(_,Q){return g(typeof _=="function"&&!Q?_:Q,t.onInvalidSubmit)(_)}function q(){return oe(s)}function Z(){return oe(l.value)}function ee(){return oe(i.value)}function X(){return{meta:l.value,errors:i.value,errorBag:o.value,values:s,isSubmitting:a.value,isValidating:c.value,submitCount:d.value,controlledValues:f.value,validate:h,validateField:p,handleSubmit:Y,handleReset:m,submitForm:V,setErrors:v,setFieldError:C,setFieldValue:M,setValues:b,setFieldTouched:O,setTouched:S,resetForm:y,resetField:D,getValues:q,getMeta:Z,getErrors:ee}}return e.expose({setFieldError:C,setErrors:v,setFieldValue:M,setValues:b,setFieldTouched:O,setTouched:S,resetForm:y,validate:h,validateField:p,resetField:D,getValues:q,getMeta:Z,getErrors:ee,values:s,meta:l,errors:i}),function(){const Q=t.as==="form"?t.as:t.as?u.resolveDynamicComponent(t.as):null,ne=ko(Q,e,X);if(!Q)return ne;const pe=Q==="form"?{novalidate:!0}:{};return u.h(Q,Object.assign(Object.assign(Object.assign({},pe),e.attrs),{onSubmit:A,onReset:L}),ne)}}}),Yf=u.defineComponent({name:"ErrorMessage",props:{as:{type:String,default:void 0},name:{type:String,required:!0}},setup(t,e){const n=u.inject(kr,void 0),r=u.computed(()=>n==null?void 0:n.errors.value[t.name]);function i(){return{message:r.value}}return()=>{if(!r.value)return;const o=t.as?u.resolveDynamicComponent(t.as):t.as,s=ko(o,e,i),l=Object.assign({role:"alert"},e.attrs);return!o&&(Array.isArray(s)||!s)&&(s!=null&&s.length)?s:(Array.isArray(s)||!s)&&!(s!=null&&s.length)?u.h(o||"span",l,r.value):u.h(o,l,s)}}});function Zf(t){const e=yo(kr),n=t?void 0:u.inject(pl);return u.computed(()=>t?e==null?void 0:e.errors.value[u.toValue(t)]:n==null?void 0:n.errorMessage.value)}dt("required",t=>typeof t=="object"&&t!=null||typeof t=="boolean"&&t===!0?!0:!t||!t.length?"This field is required":!0),dt("email",t=>{var e=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return e.test(String(t).trim().toLowerCase())?!0:"This field must be a valid email"}),dt("strong_password",t=>t?t.indexOf(" ")>-1?"Password shouldn't contain space":t.length<8||t.length>30?"Password must be between 8 and 30 characters":t.match(/[a-z]/)===null||t.match(/[A-Z]/)===null||t.match(/\d/)===null?"Password must contain at least one uppercase letter, one lowercase letter and one number digit":!0:"Password is required"),dt("no_space",t=>(t==null?void 0:t.indexOf(" "))>-1?"This field shouldn't contain space":!0),dt("minLength",(t,[e])=>!t||!t.length?!0:t.length<e?`This field must be at least ${e} characters`:!0),dt("hasUppercaseLetter",t=>/[A-Z]/.test(t)?!0:"This field must have at least one uppercase character"),dt("hasLowercaseLetter",t=>/[a-z]/.test(t)?!0:"This field must have at least one lowercase character"),dt("hasNumber",t=>/\d/.test(t)?!0:"This field must have at least one number"),dt("hasSpecialCharacter",t=>/[!@$%^&*(),.?":{}|]/.test(t)?!0:"This field must have at least one special character"),dt("url",t=>{var e=/(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})/gi;return e.test(String(t).trim().toLowerCase())?!0:"This field must be a valid URL"}),dt("number",t=>parseFloat(t)?!0:"This field must be a number");const ue=(t,e)=>{const n=t.__vccOpts||t;for(const[r,i]of e)n[r]=i;return n},Xf={},Qf={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",fill:"currentColor"},eh=[u.createElementVNode("path",{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200z"},null,-1)];function th(t,e){return u.openBlock(),u.createElementBlock("svg",Qf,eh)}const nh=ue(Xf,[["render",th]]),rh={},ih={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",fill:"currentColor"},oh=[u.createElementVNode("path",{d:"M460.116 373.846l-20.823-12.022c-5.541-3.199-7.54-10.159-4.663-15.874 30.137-59.886 28.343-131.652-5.386-189.946-33.641-58.394-94.896-95.833-161.827-99.676C261.028 55.961 256 50.751 256 44.352V20.309c0-6.904 5.808-12.337 12.703-11.982 83.556 4.306 160.163 50.864 202.11 123.677 42.063 72.696 44.079 162.316 6.031 236.832-3.14 6.148-10.75 8.461-16.728 5.01z"},null,-1)];function sh(t,e){return u.openBlock(),u.createElementBlock("svg",ih,oh)}const lh=ue(rh,[["render",sh]]),ah={class:"relative"},di=Object.assign({name:"WpicSpinner"},{props:{color:{type:String,default:""}},setup(t){return(e,n)=>(u.openBlock(),u.createElementBlock("div",ah,[u.createVNode(nh,{class:"absolute opacity-25"}),u.createVNode(lh,{class:u.normalizeClass(["animate-spin",{[`${t.color}`]:!0}])},null,8,["class"])]))}});let je={theme:"pmi"};const ch={key:0,class:"absolute inset-0 flex justify-center items-center"},dh=Object.assign({name:"WpicButton"},{props:{label:String,primary:Boolean,type:{type:String,default:"button"},secondary:Boolean,inverse:Boolean,disabled:Boolean,full:Boolean,loading:Boolean,outline:{type:Boolean,default:!0},medium:Boolean,small:Boolean,mini:Boolean,plain:Boolean,outlining:Boolean,square:Boolean,to:[String,Object]},setup(t){const e=t,n=u.computed(()=>e.to?"router-link":"button"),r={pmi:"bg-violet-800 border border-violet-800 focus:bg-violet-800 text-white disabled:bg-zinc-100 disabled:text-zinc-400 disabled:border-zinc-100 enabled:hover:bg-violet-900 enabled:hover:border-violet-900 active:scale-95 enabled:transform","wpic-tools":"text-white bg-lime-500 border-lime-500 enabled:hover:bg-lime-400 enabled:hover:border-lime-400 enabled:active:bg-lime-500 enabled:active:border-lime-500 enabled:active:shadow-inner disabled:bg-lime-600/25 disabled:text-white disabled:border-0"},i={pmi:"bg-white text-violet-800 border-zinc-400 dark:border-zinc-700 dark:text-zinc-200 dark:bg-zinc-700 dark:hover:bg-zinc-600 dark:hover:border-zinc-600 disabled:text-zinc-400 active:scale-95 enabled:transform","wpic-tools":"text-slate-700 bg-slate-100 border-slate-300 enabled:hover:bg-lime-50 enabled:hover:border-lime-300 enabled:hover:text-lime-600 enabled:active:shadow-inner disabled:border-slate-200 disabled:text-zinc-400 disabled:bg-slate-50/50"},o={pmi:"border-zinc-300 dark:border-zinc-700 dark:text-zinc-300","wpic-tools":"border-slate-200 bg-slate-200 enabled:hover:bg-slate-300 enabled:hover:border-slate-300 enabled:active:bg-slate-200 enabled:active:border-slate-200 enabled:active:shadow-inner disabled:bg-slate-100 disabled:text-zinc-400 disabled:border-0"},s={pmi:"text-violet-800 hover:underline","wpic-tools":"text-lime-800 hover:underline"},l={pmi:"hover:text-violet-800","wpic-tools":"hover:text-lime-800"};return(a,c)=>(u.openBlock(),u.createBlock(u.resolveDynamicComponent(n.value),{to:t.to,type:t.type,disabled:t.disabled,class:u.normalizeClass([{"cursor-pointer":!t.disabled&&!t.loading,"active:outline active:outline-2 active:outline-offset-4":!t.disabled&&!t.loading&&t.outlining,"cursor-not-allowed":t.disabled,border:t.outline&&!t.plain,[`${r[u.unref(je).theme]}`]:t.primary&&!t.plain&&!t.inverse,[`${i[u.unref(je).theme]}`]:t.secondary,[`${o[u.unref(je).theme]}`]:!t.primary&&!t.secondary&&!t.plain,[`${s[u.unref(je).theme]}`]:t.primary&&t.plain,[`${l[u.unref(je).theme]}`]:!t.primary&&t.plain,"bg-zinc-50 border-violet-800 text-violet-800":t.primary&&t.inverse,"hover:bg-white":t.primary&&t.inverse&&!t.disabled&&!t.loading,"w-full":t.full,"text-opacity-50":t.disabled,"text-sm":t.small,"px-4 py-1 rounded h-8":t.small&&!t.plain,"px-5 py-1 rounded h-10":t.medium&&!t.plain,"px-5 py-1 rounded h-12":!t.small&&!t.medium&&!t.plain,"px-0 aspect-square":t.square},"wpic-button leading-none font-medium no-underline appearance-none outline-zinc-600 focus:outline-none relative inline-flex justify-center items-center"])},{default:u.withCtx(()=>[t.loading?(u.openBlock(),u.createElementBlock("div",ch,[u.createVNode(di,{class:"w-6 h-6"})])):u.createCommentVNode("",!0),u.createElementVNode("span",{class:u.normalizeClass(["flex items-center select-none whitespace-nowrap",{"opacity-0":t.loading}])},[u.renderSlot(a.$slots,"default",{},()=>[u.createTextVNode(u.toDisplayString(t.label),1)])],2)]),_:3},8,["to","type","disabled","class"]))}}),uh={name:"WpicButtonGroup"},fh={class:"wpic-button-group flex flex-wrap"};function hh(t,e,n,r,i,o){return u.openBlock(),u.createElementBlock("div",fh,[u.renderSlot(t.$slots,"default")])}const ph=ue(uh,[["render",hh]]),mh={name:"WpicInputGroup"},gh={class:"wpic-input-group flex w-full"};function yh(t,e,n,r,i,o){return u.openBlock(),u.createElementBlock("div",gh,[u.renderSlot(t.$slots,"default")])}const bh=ue(mh,[["render",yh]]),vh=Object.assign({name:"WpicForm"},{setup(t){return(e,n)=>(u.openBlock(),u.createBlock(u.unref(Gf),null,{default:u.withCtx(({values:r,meta:i,errors:o})=>[u.renderSlot(e.$slots,"default")]),_:3}))}}),Co=Math.min,_n=Math.max,ui=Math.round,Ut=t=>({x:t,y:t}),kh={left:"right",right:"left",bottom:"top",top:"bottom"},wh={start:"end",end:"start"};function $l(t,e,n){return _n(t,Co(e,n))}function fi(t,e){return typeof t=="function"?t(e):t}function mn(t){return t.split("-")[0]}function hi(t){return t.split("-")[1]}function Rl(t){return t==="x"?"y":"x"}function _l(t){return t==="y"?"height":"width"}function pi(t){return["top","bottom"].includes(mn(t))?"y":"x"}function Ll(t){return Rl(pi(t))}function xh(t,e,n){n===void 0&&(n=!1);const r=hi(t),i=Ll(t),o=_l(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=mi(s)),[s,mi(s)]}function Sh(t){const e=mi(t);return[Oo(t),e,Oo(e)]}function Oo(t){return t.replace(/start|end/g,e=>wh[e])}function Ch(t,e,n){const r=["left","right"],i=["right","left"],o=["top","bottom"],s=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:r:e?r:i;case"left":case"right":return e?o:s;default:return[]}}function Oh(t,e,n,r){const i=hi(t);let o=Ch(mn(t),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),e&&(o=o.concat(o.map(Oo)))),o}function mi(t){return t.replace(/left|right|bottom|top/g,e=>kh[e])}function Mh(t){return{top:0,right:0,bottom:0,left:0,...t}}function Eh(t){return typeof t!="number"?Mh(t):{top:t,right:t,bottom:t,left:t}}function gi(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function zl(t,e,n){let{reference:r,floating:i}=t;const o=pi(e),s=Ll(e),l=_l(s),a=mn(e),c=o==="y",d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[l]/2-i[l]/2;let p;switch(a){case"top":p={x:d,y:r.y-i.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-i.width,y:f};break;default:p={x:r.x,y:r.y}}switch(hi(e)){case"start":p[s]-=h*(n&&c?-1:1);break;case"end":p[s]+=h*(n&&c?-1:1);break}return p}const Th=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,l=o.filter(Boolean),a=await(s.isRTL==null?void 0:s.isRTL(e));let c=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:d,y:f}=zl(c,r,a),h=r,p={},m=0;for(let y=0;y<l.length;y++){const{name:g,fn:v}=l[y],{x:C,y:M,data:b,reset:O}=await v({x:d,y:f,initialPlacement:r,placement:h,strategy:i,middlewareData:p,rects:c,platform:s,elements:{reference:t,floating:e}});d=C??d,f=M??f,p={...p,[g]:{...p[g],...b}},O&&m<=50&&(m++,typeof O=="object"&&(O.placement&&(h=O.placement),O.rects&&(c=O.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:i}):O.rects),{x:d,y:f}=zl(c,h,a)),y=-1)}return{x:d,y:f,placement:h,strategy:i,middlewareData:p}};async function Fl(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:o,rects:s,elements:l,strategy:a}=t,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=fi(e,t),m=Eh(p),g=l[h?f==="floating"?"reference":"floating":f],v=gi(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(g)))==null||n?g:g.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(l.floating)),boundary:c,rootBoundary:d,strategy:a})),C=f==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,M=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l.floating)),b=await(o.isElement==null?void 0:o.isElement(M))?await(o.getScale==null?void 0:o.getScale(M))||{x:1,y:1}:{x:1,y:1},O=gi(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:C,offsetParent:M,strategy:a}):C);return{top:(v.top-O.top+m.top)/b.y,bottom:(O.bottom-v.bottom+m.bottom)/b.y,left:(v.left-O.left+m.left)/b.x,right:(O.right-v.right+m.right)/b.x}}const Nh=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:l,platform:a,elements:c}=e,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...g}=fi(t,e);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const v=mn(i),C=mn(l)===l,M=await(a.isRTL==null?void 0:a.isRTL(c.floating)),b=h||(C||!y?[mi(l)]:Sh(l));!h&&m!=="none"&&b.push(...Oh(l,y,m,M));const O=[l,...b],S=await Fl(e,g),D=[];let V=((r=o.flip)==null?void 0:r.overflows)||[];if(d&&D.push(S[v]),f){const q=xh(i,s,M);D.push(S[q[0]],S[q[1]])}if(V=[...V,{placement:i,overflows:D}],!D.every(q=>q<=0)){var A,L;const q=(((A=o.flip)==null?void 0:A.index)||0)+1,Z=O[q];if(Z)return{data:{index:q,overflows:V},reset:{placement:Z}};let ee=(L=V.filter(X=>X.overflows[0]<=0).sort((X,_)=>X.overflows[1]-_.overflows[1])[0])==null?void 0:L.placement;if(!ee)switch(p){case"bestFit":{var Y;const X=(Y=V.map(_=>[_.placement,_.overflows.filter(Q=>Q>0).reduce((Q,ne)=>Q+ne,0)]).sort((_,Q)=>_[1]-Q[1])[0])==null?void 0:Y[0];X&&(ee=X);break}case"initialPlacement":ee=l;break}if(i!==ee)return{reset:{placement:ee}}}return{}}}};async function Ah(t,e){const{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=mn(n),l=hi(n),a=pi(n)==="y",c=["left","top"].includes(s)?-1:1,d=o&&a?-1:1,f=fi(e,t);let{mainAxis:h,crossAxis:p,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return l&&typeof m=="number"&&(p=l==="end"?m*-1:m),a?{x:p*d,y:h*c}:{x:h*c,y:p*d}}const Dh=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:o,placement:s,middlewareData:l}=e,a=await Ah(e,t);return s===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+a.x,y:o+a.y,data:{...a,placement:s}}}}},Bh=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:o=!0,crossAxis:s=!1,limiter:l={fn:g=>{let{x:v,y:C}=g;return{x:v,y:C}}},...a}=fi(t,e),c={x:n,y:r},d=await Fl(e,a),f=pi(mn(i)),h=Rl(f);let p=c[h],m=c[f];if(o){const g=h==="y"?"top":"left",v=h==="y"?"bottom":"right",C=p+d[g],M=p-d[v];p=$l(C,p,M)}if(s){const g=f==="y"?"top":"left",v=f==="y"?"bottom":"right",C=m+d[g],M=m-d[v];m=$l(C,m,M)}const y=l.fn({...e,[h]:p,[f]:m});return{...y,data:{x:y.x-n,y:y.y-r}}}}};function Ln(t){return jl(t)?(t.nodeName||"").toLowerCase():"#document"}function Je(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function qt(t){var e;return(e=(jl(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function jl(t){return t instanceof Node||t instanceof Je(t).Node}function vt(t){return t instanceof Element||t instanceof Je(t).Element}function kt(t){return t instanceof HTMLElement||t instanceof Je(t).HTMLElement}function Hl(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Je(t).ShadowRoot}function Cr(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=ft(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function Vh(t){return["table","td","th"].includes(Ln(t))}function Mo(t){const e=Eo(),n=ft(t);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function Ih(t){let e=Kt(t);for(;kt(e)&&!zn(e);){if(Mo(e))return e;e=Kt(e)}return null}function Eo(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function zn(t){return["html","body","#document"].includes(Ln(t))}function ft(t){return Je(t).getComputedStyle(t)}function yi(t){return vt(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Kt(t){if(Ln(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Hl(t)&&t.host||qt(t);return Hl(e)?e.host:e}function Wl(t){const e=Kt(t);return zn(e)?t.ownerDocument?t.ownerDocument.body:t.body:kt(e)&&Cr(e)?e:Wl(e)}function To(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=Wl(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),s=Je(i);return o?e.concat(s,s.visualViewport||[],Cr(i)?i:[],s.frameElement&&n?To(s.frameElement):[]):e.concat(i,To(i,[],n))}function Ul(t){const e=ft(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=kt(t),o=i?t.offsetWidth:n,s=i?t.offsetHeight:r,l=ui(n)!==o||ui(r)!==s;return l&&(n=o,r=s),{width:n,height:r,$:l}}function ql(t){return vt(t)?t:t.contextElement}function Fn(t){const e=ql(t);if(!kt(e))return Ut(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:o}=Ul(e);let s=(o?ui(n.width):n.width)/r,l=(o?ui(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const Ph=Ut(0);function Kl(t){const e=Je(t);return!Eo()||!e.visualViewport?Ph:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function $h(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Je(t)?!1:e}function Or(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),o=ql(t);let s=Ut(1);e&&(r?vt(r)&&(s=Fn(r)):s=Fn(t));const l=$h(o,n,r)?Kl(o):Ut(0);let a=(i.left+l.x)/s.x,c=(i.top+l.y)/s.y,d=i.width/s.x,f=i.height/s.y;if(o){const h=Je(o),p=r&&vt(r)?Je(r):r;let m=h,y=m.frameElement;for(;y&&r&&p!==m;){const g=Fn(y),v=y.getBoundingClientRect(),C=ft(y),M=v.left+(y.clientLeft+parseFloat(C.paddingLeft))*g.x,b=v.top+(y.clientTop+parseFloat(C.paddingTop))*g.y;a*=g.x,c*=g.y,d*=g.x,f*=g.y,a+=M,c+=b,m=Je(y),y=m.frameElement}}return gi({width:d,height:f,x:a,y:c})}const Rh=[":popover-open",":modal"];function No(t){return Rh.some(e=>{try{return t.matches(e)}catch{return!1}})}function _h(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const o=i==="fixed",s=qt(r),l=e?No(e.floating):!1;if(r===s||l&&o)return n;let a={scrollLeft:0,scrollTop:0},c=Ut(1);const d=Ut(0),f=kt(r);if((f||!f&&!o)&&((Ln(r)!=="body"||Cr(s))&&(a=yi(r)),kt(r))){const h=Or(r);c=Fn(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+d.x,y:n.y*c.y-a.scrollTop*c.y+d.y}}function Lh(t){return Array.from(t.getClientRects())}function Jl(t){return Or(qt(t)).left+yi(t).scrollLeft}function zh(t){const e=qt(t),n=yi(t),r=t.ownerDocument.body,i=_n(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=_n(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Jl(t);const l=-n.scrollTop;return ft(r).direction==="rtl"&&(s+=_n(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:l}}function Fh(t,e){const n=Je(t),r=qt(t),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,l=0,a=0;if(i){o=i.width,s=i.height;const c=Eo();(!c||c&&e==="fixed")&&(l=i.offsetLeft,a=i.offsetTop)}return{width:o,height:s,x:l,y:a}}function jh(t,e){const n=Or(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=kt(t)?Fn(t):Ut(1),s=t.clientWidth*o.x,l=t.clientHeight*o.y,a=i*o.x,c=r*o.y;return{width:s,height:l,x:a,y:c}}function Gl(t,e,n){let r;if(e==="viewport")r=Fh(t,n);else if(e==="document")r=zh(qt(t));else if(vt(e))r=jh(e,n);else{const i=Kl(t);r={...e,x:e.x-i.x,y:e.y-i.y}}return gi(r)}function Yl(t,e){const n=Kt(t);return n===e||!vt(n)||zn(n)?!1:ft(n).position==="fixed"||Yl(n,e)}function Hh(t,e){const n=e.get(t);if(n)return n;let r=To(t,[],!1).filter(l=>vt(l)&&Ln(l)!=="body"),i=null;const o=ft(t).position==="fixed";let s=o?Kt(t):t;for(;vt(s)&&!zn(s);){const l=ft(s),a=Mo(s);!a&&l.position==="fixed"&&(i=null),(o?!a&&!i:!a&&l.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Cr(s)&&!a&&Yl(t,s))?r=r.filter(d=>d!==s):i=l,s=Kt(s)}return e.set(t,r),r}function Wh(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const s=[...n==="clippingAncestors"?No(e)?[]:Hh(e,this._c):[].concat(n),r],l=s[0],a=s.reduce((c,d)=>{const f=Gl(e,d,i);return c.top=_n(f.top,c.top),c.right=Co(f.right,c.right),c.bottom=Co(f.bottom,c.bottom),c.left=_n(f.left,c.left),c},Gl(e,l,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Uh(t){const{width:e,height:n}=Ul(t);return{width:e,height:n}}function qh(t,e,n){const r=kt(e),i=qt(e),o=n==="fixed",s=Or(t,!0,o,e);let l={scrollLeft:0,scrollTop:0};const a=Ut(0);if(r||!r&&!o)if((Ln(e)!=="body"||Cr(i))&&(l=yi(e)),r){const f=Or(e,!0,o,e);a.x=f.x+e.clientLeft,a.y=f.y+e.clientTop}else i&&(a.x=Jl(i));const c=s.left+l.scrollLeft-a.x,d=s.top+l.scrollTop-a.y;return{x:c,y:d,width:s.width,height:s.height}}function Ao(t){return ft(t).position==="static"}function Zl(t,e){return!kt(t)||ft(t).position==="fixed"?null:e?e(t):t.offsetParent}function Xl(t,e){const n=Je(t);if(No(t))return n;if(!kt(t)){let i=Kt(t);for(;i&&!zn(i);){if(vt(i)&&!Ao(i))return i;i=Kt(i)}return n}let r=Zl(t,e);for(;r&&Vh(r)&&Ao(r);)r=Zl(r,e);return r&&zn(r)&&Ao(r)&&!Mo(r)?n:r||Ih(t)||n}const Kh=async function(t){const e=this.getOffsetParent||Xl,n=this.getDimensions,r=await n(t.floating);return{reference:qh(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Jh(t){return ft(t).direction==="rtl"}const Gh={convertOffsetParentRelativeRectToViewportRelativeRect:_h,getDocumentElement:qt,getClippingRect:Wh,getOffsetParent:Xl,getElementRects:Kh,getClientRects:Lh,getDimensions:Uh,getScale:Fn,isElement:vt,isRTL:Jh},Yh=Dh,Zh=Bh,Xh=Nh,Qh=(t,e,n)=>{const r=new Map,i={platform:Gh,...n},o={...i.platform,_c:r};return Th(t,e,{...i,platform:o})};function ep(t,e,n){if(!t)throw new Error("A target component has to be provided.");if(!e)throw new Error("A callback has to be provided.");const r=i=>{i.target===t.value||i.composedPath().includes(t.value)||i.target===n.value||i.composedPath().includes(n.value)||typeof e=="function"&&e()};u.onMounted(()=>{window.addEventListener("click",r)}),u.onBeforeUnmount(()=>{window.removeEventListener("click",r)})}const tp={},np={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},rp=[u.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"},null,-1)];function ip(t,e){return u.openBlock(),u.createElementBlock("svg",np,rp)}const Do=ue(tp,[["render",ip]]);let bi;const op=new Uint8Array(16);function sp(){if(!bi&&(bi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!bi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return bi(op)}const Se=[];for(let t=0;t<256;++t)Se.push((t+256).toString(16).slice(1));function lp(t,e=0){return Se[t[e+0]]+Se[t[e+1]]+Se[t[e+2]]+Se[t[e+3]]+"-"+Se[t[e+4]]+Se[t[e+5]]+"-"+Se[t[e+6]]+Se[t[e+7]]+"-"+Se[t[e+8]]+Se[t[e+9]]+"-"+Se[t[e+10]]+Se[t[e+11]]+Se[t[e+12]]+Se[t[e+13]]+Se[t[e+14]]+Se[t[e+15]]}const Ql={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ea(t,e,n){if(Ql.randomUUID&&!e&&!t)return Ql.randomUUID();t=t||{};const r=t.random||(t.rng||sp)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,lp(r)}let Bo={isMobile(){return!!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},capitalize(t){return t?(t=t.toString(),t=t.replace(/(?:^|\s)\S/g,function(e){return e.toUpperCase()}).trim(),t.charAt(0).toUpperCase()+t.slice(1)):""}};const ap={class:"bg-white rounded-t-lg w-full"},cp={class:"flex justify-between items-center border-b px-4 py-3"},Vo=Object.assign({name:"WpicPopover"},{props:{placement:{type:String,default:"bottom-start"},label:String,hover:Boolean,custom:Boolean,disabled:Boolean,offset:{type:Number,default:0}},setup(t,{expose:e}){const n=ea(),r=t,i={pmi:"lg:absolute shadow-[0_5px_30px_0px_rgba(0,0,0,0.25)]","wpic-tools":"mt-2 md:absolute border border-slate-300 shadow-md"},o={pmi:"lg:hidden","wpic-tools":"md:hidden"},s=u.ref(null),l=u.ref(null),a=u.ref(!0);Bo.isMobile()||ep(l,()=>{d()},s);function c(){Bo.isMobile()&&(document.documentElement.style.overflow="hidden",document.querySelector("#app").style.overflow="hidden"),r.disabled||(a.value=!1,f())}function d(){document.documentElement.style.overflow=null,document.querySelector("#app").style.overflow=null,a.value=!0}async function f(){const m=await Qh(s.value,l.value,{placement:r.placement,middleware:[Xh(),Zh(),Yh(r.offset)]});l.value.style.left=`${m.x}px`,l.value.style.top=`${m.y}px`}function h(){r.hover&&c()}function p(){r.hover&&d()}return e({hide:d}),(m,y)=>(u.openBlock(),u.createElementBlock(u.Fragment,null,[(u.openBlock(),u.createElementBlock("div",{class:"w-full",key:`reference_${u.unref(n)}`,ref_key:"reference",ref:s,onMouseenter:h,onMouseleave:p,onClick:y[0]||(y[0]=g=>a.value?c():d())},[u.renderSlot(m.$slots,"default",{isHidden:a.value})],32)),(u.openBlock(),u.createBlock(u.Teleport,{to:"body"},[(u.openBlock(),u.createElementBlock("div",{key:`floating_${u.unref(n)}`,ref_key:"floating",ref:l,class:u.normalizeClass(["z-10 bg-white rounded-md overflow-hidden",{hidden:a.value,[`${i[u.unref(je).theme]}`]:!a.value,"bg-white px-3 py-2 rounded-md":!t.custom}])},[u.renderSlot(m.$slots,"content")],2)),u.createElementVNode("div",{onClick:y[1]||(y[1]=g=>d()),class:u.normalizeClass(["fixed z-20 flex items-end w-screen h-screen top-0 bg-black/20",{hidden:a.value,[`${o[u.unref(je).theme]}`]:!0}])},[u.createElementVNode("div",ap,[u.createElementVNode("div",cp,[u.createElementVNode("span",null,u.toDisplayString(t.label),1),u.createVNode(Do,{onClick:d,class:"w-4 h-4"})]),u.renderSlot(m.$slots,"content")])],2)]))],64))}}),dp={},up={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},fp=[u.createElementVNode("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"},null,-1),u.createElementVNode("path",{"fill-rule":"evenodd",d:"M1.323 11.447C2.811 6.976 7.028 3.75 12.001 3.75c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113-1.487 4.471-5.705 7.697-10.677 7.697-4.97 0-9.186-3.223-10.675-7.69a1.762 1.762 0 0 1 0-1.113ZM17.25 12a5.25 5.25 0 1 1-10.5 0 5.25 5.25 0 0 1 10.5 0Z","clip-rule":"evenodd"},null,-1)];function hp(t,e){return u.openBlock(),u.createElementBlock("svg",up,fp)}const pp=ue(dp,[["render",hp]]),mp={},gp={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},yp=[u.createElementVNode("path",{d:"M3.53 2.47a.75.75 0 0 0-1.06 1.06l18 18a.75.75 0 1 0 1.06-1.06l-18-18ZM22.676 12.553a11.249 11.249 0 0 1-2.631 4.31l-3.099-3.099a5.25 5.25 0 0 0-6.71-6.71L7.759 4.577a11.217 11.217 0 0 1 4.242-.827c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113Z"},null,-1),u.createElementVNode("path",{d:"M15.75 12c0 .18-.013.357-.037.53l-4.244-4.243A3.75 3.75 0 0 1 15.75 12ZM12.53 15.713l-4.243-4.244a3.75 3.75 0 0 0 4.244 4.243Z"},null,-1),u.createElementVNode("path",{d:"M6.75 12c0-.619.107-1.213.304-1.764l-3.1-3.1a11.25 11.25 0 0 0-2.63 4.31c-.12.362-.12.752 0 1.114 1.489 4.467 5.704 7.69 10.675 7.69 1.5 0 2.933-.294 4.242-.827l-2.477-2.477A5.25 5.25 0 0 1 6.75 12Z"},null,-1)];function bp(t,e){return u.openBlock(),u.createElementBlock("svg",gp,yp)}const vp=ue(mp,[["render",bp]]),kp={},wp={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},xp=[u.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4.5 12.75l6 6 9-13.5"},null,-1)];function Sp(t,e){return u.openBlock(),u.createElementBlock("svg",wp,xp)}const ta=ue(kp,[["render",Sp]]),Cp={},Op={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},Mp=[u.createElementVNode("path",{"fill-rule":"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm8.706-1.442c1.146-.573 2.437.463 2.126 1.706l-.709 2.836.042-.02a.75.75 0 0 1 .67 1.34l-.04.022c-1.147.573-2.438-.463-2.127-1.706l.71-2.836-.042.02a.75.75 0 1 1-.671-1.34l.041-.022ZM12 9a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z","clip-rule":"evenodd"},null,-1)];function Ep(t,e){return u.openBlock(),u.createElementBlock("svg",Op,Mp)}const Tp=ue(Cp,[["render",Ep]]);var vi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Np(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Ap(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var na=Ap,Dp=typeof vi=="object"&&vi&&vi.Object===Object&&vi,Bp=Dp,Vp=Bp,Ip=typeof self=="object"&&self&&self.Object===Object&&self,Pp=Vp||Ip||Function("return this")(),ra=Pp,$p=ra,Rp=function(){return $p.Date.now()},_p=Rp,Lp=/\s/;function zp(t){for(var e=t.length;e--&&Lp.test(t.charAt(e)););return e}var Fp=zp,jp=Fp,Hp=/^\s+/;function Wp(t){return t&&t.slice(0,jp(t)+1).replace(Hp,"")}var Up=Wp,qp=ra,Kp=qp.Symbol,ia=Kp,oa=ia,sa=Object.prototype,Jp=sa.hasOwnProperty,Gp=sa.toString,Mr=oa?oa.toStringTag:void 0;function Yp(t){var e=Jp.call(t,Mr),n=t[Mr];try{t[Mr]=void 0;var r=!0}catch{}var i=Gp.call(t);return r&&(e?t[Mr]=n:delete t[Mr]),i}var Zp=Yp,Xp=Object.prototype,Qp=Xp.toString;function em(t){return Qp.call(t)}var tm=em,la=ia,nm=Zp,rm=tm,im="[object Null]",om="[object Undefined]",aa=la?la.toStringTag:void 0;function sm(t){return t==null?t===void 0?om:im:aa&&aa in Object(t)?nm(t):rm(t)}var lm=sm;function am(t){return t!=null&&typeof t=="object"}var cm=am,dm=lm,um=cm,fm="[object Symbol]";function hm(t){return typeof t=="symbol"||um(t)&&dm(t)==fm}var pm=hm,mm=Up,ca=na,gm=pm,da=NaN,ym=/^[-+]0x[0-9a-f]+$/i,bm=/^0b[01]+$/i,vm=/^0o[0-7]+$/i,km=parseInt;function wm(t){if(typeof t=="number")return t;if(gm(t))return da;if(ca(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=ca(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=mm(t);var n=bm.test(t);return n||vm.test(t)?km(t.slice(2),n?2:8):ym.test(t)?da:+t}var xm=wm,Sm=na,Io=_p,ua=xm,Cm="Expected a function",Om=Math.max,Mm=Math.min;function Em(t,e,n){var r,i,o,s,l,a,c=0,d=!1,f=!1,h=!0;if(typeof t!="function")throw new TypeError(Cm);e=ua(e)||0,Sm(n)&&(d=!!n.leading,f="maxWait"in n,o=f?Om(ua(n.maxWait)||0,e):o,h="trailing"in n?!!n.trailing:h);function p(S){var D=r,V=i;return r=i=void 0,c=S,s=t.apply(V,D),s}function m(S){return c=S,l=setTimeout(v,e),d?p(S):s}function y(S){var D=S-a,V=S-c,A=e-D;return f?Mm(A,o-V):A}function g(S){var D=S-a,V=S-c;return a===void 0||D>=e||D<0||f&&V>=o}function v(){var S=Io();if(g(S))return C(S);l=setTimeout(v,y(S))}function C(S){return l=void 0,h&&r?p(S):(r=i=void 0,s)}function M(){l!==void 0&&clearTimeout(l),c=0,r=a=i=l=void 0}function b(){return l===void 0?s:C(Io())}function O(){var S=Io(),D=g(S);if(r=arguments,i=this,a=S,D){if(l===void 0)return m(a);if(f)return clearTimeout(l),l=setTimeout(v,e),p(a)}return l===void 0&&(l=setTimeout(v,e)),s}return O.cancel=M,O.flush=b,O}var Tm=Em;const Nm=Np(Tm),Am={key:0,class:"mb-2 gap-2 wpic-form-label text-base text-zinc-600 dark:text-zinc-300 flex items-center"},Dm={class:""},Bm=["name","value","checked"],Vm={key:0,class:"absolute left-0 ml-3 h-full flex items-center justify-center text-center"},Im={class:"opacity-50 w-5 h-5 leading-tight"},Pm={key:3,class:"absolute z-10 right-0 mr-3 h-full flex items-center"},$m={class:"min-w-5 h-5 leading-tight cursor-pointer"},Rm={key:5,class:"text-red-700 mt-1 text-base"},_m=Object.assign({name:"WpicFormField"},{props:{label:{type:[String,Number]},placeholder:String,name:{type:String,default:null},select:Boolean,checkbox:Boolean,radio:Boolean,textarea:Boolean,rules:{},type:{type:String,default:"text"},tag:{type:String,default:null},options:{type:Array},required:Boolean,email:Boolean,multiple:Boolean,slim:Boolean,error:{type:Boolean,default:!0},clearable:Boolean,modelValue:{},checkboxValue:{},uncheckedValue:{},radioValue:{},disabled:Boolean,debounce:{type:Number,default:0},loading:Boolean,password:Boolean,addLabel:{type:String,default:"Add"},help:String,labelName:Boolean,half:Boolean,hideSelect:Boolean,date:Boolean,range:Boolean,rows:{type:[String,Number],default:3},transparent:Boolean,loadingPercent:{type:Number,default:null},loadingPulse:{type:Boolean,default:!1},blur:{type:Boolean,default:!1},large:Boolean,noResize:Boolean,autoResize:Boolean,minHeight:{type:[String,Number],default:50},maxHeight:{type:[String,Number],default:300},hideFocus:Boolean,min:{type:[String,Number],default:-1/0},max:{type:[String,Number],default:1/0},info:{type:String}},emits:["onChange","update:modelValue","onClear"],setup(t,{expose:e,emit:n}){const r=t,i=u.computed(()=>r.name?r.name:ea()),o=Zf(i.value),s=u.computed(()=>{if(r.label)return r.label;if(r.name&&r.labelName)return`${r.name}#${r.labelName}`}),l=u.ref(!0),a=u.computed(()=>(r.type=="password"||r.password)&&l.value?"password":r.type);function c(){l.value=!l.value}const d=u.computed(()=>{if(r.rules&&typeof r.rules=="string"){let O=r.rules.split("|");return r.required&&O.push("required"),r.email&&O.push("email"),O.join("|")}else if(!r.rules){let O=[];return r.required&&O.push("required"),r.email&&O.push("email"),O.join("|")}return"required"});function f(O){let S=O&&O.target?O.target.value:O;g(S)}const h=n;function p(O){O===!0||O===!1?h("update:modelValue",!O):h("update:modelValue",O)}function m(O){let S=O&&O.target?O.target.value:O;h("update:modelValue",S),h("onChange",S)}function y(){h("update:modelValue",null),h("onChange",null),h("onClear")}const g=Nm(function(O){h("update:modelValue",O),h("onChange",O)},r.debounce),v=u.ref(null),C=u.ref(!1);u.watch(()=>r.modelValue,O=>{r.tag=="textarea"&&(v.value.$el.style.height="auto",u.nextTick(()=>{r.minHeight&&(v.value.$el.style.height=`${v.value.$el.scrollHeight<r.minHeight?r.minHeight:v.value.$el.scrollHeight}px`),r.maxHeight&&(v.value.$el.scrollHeight>r.maxHeight?(v.value.$el.style.height=`${r.maxHeight}px`,C.value=!0):C.value=!1)}))},{deep:!0});function M(){var O;r.tag=="textarea"?v.value.$el.focus():(O=v.value)==null||O.$el.focus()}function b(){return v.value.meta.valid}return e({focus:M,isValid:b}),(O,S)=>{const D=u.resolveComponent("wpic-choice-list");return u.openBlock(),u.createElementBlock("div",{class:u.normalizeClass(["wpic-form-field",{"mb-6":!t.slim}])},[s.value&&!t.checkbox&&!t.radio?(u.openBlock(),u.createElementBlock("div",Am,[u.createTextVNode(u.toDisplayString(s.value)+" ",1),u.createElementVNode("div",Dm,[t.info?(u.openBlock(),u.createBlock(Vo,{key:0,hover:""},{content:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(t.info),1)]),default:u.withCtx(()=>[u.createVNode(Tp,{class:"w-4 h-4 text-zinc-600"})]),_:1})):u.createCommentVNode("",!0)])])):u.createCommentVNode("",!0),t.checkbox?(u.openBlock(),u.createBlock(u.unref(ai),{key:1,ref_key:"myInput",ref:v,name:i.value,rules:d.value,value:t.checkboxValue,"unchecked-value":t.uncheckedValue,modelValue:t.modelValue},{default:u.withCtx(({field:V})=>[u.createElementVNode("div",{class:"inline-flex items-center gap-2",onClick:S[0]||(S[0]=A=>t.disabled?void 0:p(t.modelValue))},[u.createElementVNode("div",{class:u.normalizeClass(["w-4 h-4 border rounded-sm cursor-pointer",{"border-zinc-400":!t.disabled&&!t.modelValue,"bg-violet-800 border-violet-800 text-white":t.modelValue===!0,"bg-opacity-50 border-opacity-50 text-opacity-75":t.disabled}])},[t.modelValue===!0?(u.openBlock(),u.createBlock(ta,{key:0})):u.createCommentVNode("",!0)],2),u.createElementVNode("span",{class:u.normalizeClass(["text-base cursor-pointer select-none",{"opacity-50":t.disabled}])},[u.renderSlot(O.$slots,"default",{},()=>[u.createTextVNode(u.toDisplayString(s.value),1)])],2)])]),_:3},8,["name","rules","value","unchecked-value","modelValue"])):t.radio?(u.openBlock(),u.createBlock(u.unref(ai),{key:2,ref_key:"myInput",ref:v,name:i.value,value:t.radioValue,modelValue:t.modelValue},{default:u.withCtx(({field:V})=>[u.createElementVNode("div",{onClick:S[2]||(S[2]=()=>{t.disabled||m(t.radioValue)}),class:u.normalizeClass([{"cursor-pointer":!t.disabled},"inline-flex items-center gap-2 select-none"])},[u.createElementVNode("span",{class:u.normalizeClass(["h-4 w-4 border border-zinc-400 rounded-full p-[2px]",{"border-opacity-50":t.disabled}])},[t.radioValue==t.modelValue?(u.openBlock(),u.createElementBlock("span",{key:0,class:u.normalizeClass(["flex rounded-full h-full w-full bg-violet-800",{"bg-opacity-50":t.disabled}])},null,2)):u.createCommentVNode("",!0)],2),u.createElementVNode("input",{class:"hidden",type:"radio",name:t.name,value:t.radioValue,onChange:S[1]||(S[1]=(...A)=>O.onChange&&O.onChange(...A)),checked:t.radioValue==t.modelValue},null,40,Bm),s.value?(u.openBlock(),u.createElementBlock("span",{key:0,class:u.normalizeClass(["text-base",{"opacity-50":t.disabled}])},u.toDisplayString(s.value),3)):u.createCommentVNode("",!0)],2)]),_:1},8,["name","value","modelValue"])):t.select?(u.openBlock(),u.createBlock(u.unref(ai),{key:3,ref_key:"myInput",ref:v,modelValue:t.modelValue,rules:d.value,name:i.value},{default:u.withCtx(({field:V})=>{var A;return[u.createVNode(D,{modelValue:t.modelValue,"onUpdate:modelValue":m,disabled:t.disabled,options:t.options,hideSelect:t.hideSelect,multiple:t.multiple,isInvalid:!!(t.error&&u.unref(o)),required:t.required||((A=d.value)==null?void 0:A.indexOf("required"))>=0,label:s.value,placeholder:"Select..."},null,8,["modelValue","disabled","options","hideSelect","multiple","isInvalid","required","label"])]}),_:1},8,["modelValue","rules","name"])):(u.openBlock(),u.createElementBlock("div",{key:4,class:u.normalizeClass(["wpic-input rounded flex relative border border-zinc-400 focus-within:border-zinc-500 focus-within:outline focus-within:outline-2 focus-within:outline-offset-3 shadow-inner bg-zinc-100 dark:bg-zinc-700/25 dark:border-zinc-700/50 dark:text-zinc-300",{"h-10":!t.textarea&&!t.large,"h-12":!t.textarea&&t.large,"border-opacity-50 border-zinc-300 text-zinc-400":t.disabled,"!border-red-600 focus-within:outline-red-600":u.unref(o)}])},[O.$slots.prepend?(u.openBlock(),u.createElementBlock("div",Vm,[u.createElementVNode("div",Im,[u.renderSlot(O.$slots,"prepend")])])):u.createCommentVNode("",!0),u.createVNode(u.unref(ai),{ref_key:"myInput",ref:v,as:t.textarea?"textarea":void 0,autocomplete:"off",style:{"z-index":"1"},class:u.normalizeClass(["flex w-full h-full rounded pr-4 bg-transparent outline-none appearance-none",{"pl-4":!O.$slots.prepend,"pl-12":O.$slots.prepend,"py-2":t.textarea,"cursor-not-allowed":t.disabled}]),type:a.value,min:t.min,max:t.max,rows:t.rows,name:i.value,disabled:t.disabled,modelValue:t.modelValue,onInput:f,placeholder:t.placeholder,validateOnInput:!!u.unref(o),rules:d.value},null,8,["as","class","type","min","max","rows","name","disabled","modelValue","placeholder","validateOnInput","rules"]),t.loading?(u.openBlock(),u.createElementBlock("div",{key:1,onClick:y,class:"absolute right-0 mr-3 h-full flex items-center cursor-pointer opacity-75 hover:opacity-100"},[u.createVNode(di,{class:"w-6 h-6 opacity-50"})])):t.clearable&&t.modelValue?(u.openBlock(),u.createElementBlock("div",{key:2,onClick:u.withModifiers(y,["stop"]),style:{"z-index":"2"},class:"absolute right-0 mr-3 h-full flex items-center cursor-pointer opacity-75 hover:opacity-100"},[u.createVNode(Do,{class:"w-5 h-5 opacity-50"})])):u.createCommentVNode("",!0),O.$slots.append||t.password||t.type=="password"?(u.openBlock(),u.createElementBlock("div",Pm,[u.createElementVNode("div",$m,[u.renderSlot(O.$slots,"append",{},()=>[u.withDirectives(u.createVNode(pp,{class:"text-zinc-600 select-none",onClick:c},null,512),[[u.vShow,l.value]]),u.withDirectives(u.createVNode(vp,{class:"text-zinc-600 select-none",onClick:c},null,512),[[u.vShow,!l.value]])])])])):u.createCommentVNode("",!0)],2)),t.error&&u.unref(o)?(u.openBlock(),u.createElementBlock("div",Rm,[u.createVNode(u.unref(Yf),{name:i.value},{default:u.withCtx(V=>[u.createTextVNode(u.toDisplayString(V.message),1)]),_:1},8,["name"])])):u.createCommentVNode("",!0),O.$slots.help||t.help?(u.openBlock(),u.createElementBlock("div",{key:6,class:u.normalizeClass(["text-base mt-1",{"ml-7":t.type=="checkbox","opacity-50":t.disabled}])},[u.renderSlot(O.$slots,"help",{},()=>[u.createTextVNode(u.toDisplayString(t.help),1)])],2)):u.createCommentVNode("",!0)],2)}}}),Lm={},zm={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},Fm=[u.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"},null,-1)];function jm(t,e){return u.openBlock(),u.createElementBlock("svg",zm,Fm)}const Hm=ue(Lm,[["render",jm]]),Wm=["disabled"],Um={key:0,class:"leading-none"},qm={key:0},Km={key:1,class:"flex flex-col max-h-80 overflow-y-auto"},Jm=["onClick"],Gm={class:"select-none flex w-full items-center justify-between"},Ym=Object.assign({name:"WpicChoiceList"},{props:{modelValue:{},value:{},name:String,small:Boolean,hideSelect:Boolean,label:String,placeholder:String,options:Array,multiple:Boolean,required:Boolean,disabled:Boolean,isInvalid:Boolean,maxDisplay:{type:Number}},emits:["blur","input","change","update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=u.ref();function o(f){if(n.multiple){if(f){let h=n.modelValue||[];h.indexOf(f)>=0?h.splice(h.indexOf(f),1):h.push(f),r("update:modelValue",h)}}else r("update:modelValue",f),i.value.hide()}const s=u.computed(()=>{var f,h,p,m;if(n.multiple)if(n.maxDisplay){let y=(h=n.options)==null?void 0:h.filter(v=>{var C;return((C=n.modelValue)==null?void 0:C.indexOf(v.value))>=0}).map(v=>v.label),g=y==null?void 0:y.slice(0,n.maxDisplay);return y.length-g.length>0?(g==null?void 0:g.join(", "))+` (+${y.length-g.length})`:g==null?void 0:g.join(", ")}else return(f=n.options)==null?void 0:f.filter(y=>{var g;return((g=n.modelValue)==null?void 0:g.indexOf(y.value))>=0}).map(y=>y.label).join(", ");else return((m=(p=n.options)==null?void 0:p.find(y=>y.value===n.modelValue))==null?void 0:m.label)||n.modelValue}),l=u.computed(()=>{if(n.required)return n.options;{let f=n.options;return f.unshift({label:n.placeholder||"-",value:null}),f}});function a(f){var h;return n.multiple?n.modelValue!==null&&((h=n.modelValue)==null?void 0:h.indexOf(f))>=0:n.modelValue!==null&&f===n.modelValue}const c={pmi:"text-zinc-800 dark:text-zinc-300 disabled:bg-zinc-50 disabled:border-zinc-300 disabled:text-zinc-400 enabled:bg-zinc-100 enabled:border-zinc-400 enabled:text-zinc-500 enabled:dark:bg-zinc-700/25 enabled:dark:border-zinc-700/50 enabled:dark:text-zinc-300","wpic-tools":"disabled:text-slate-400 disabled:border-slate-200 bg-white border-slate-300 focus-within:border-lime-400 disabled:bg-slate-50"},d={pmi:"group-[.is-selected]:bg-violet-50 group-[.is-selected]:hover:bg-violet-100","wpic-tools":"hover:bg-slate-50 group-[.is-selected]:text-lime-500 group-[.is-selected]:font-semibold"};return(f,h)=>(u.openBlock(),u.createBlock(Vo,{custom:"",ref_key:"myPopover",ref:i,label:t.label,disabled:t.disabled},{default:u.withCtx(({isHidden:p})=>{var m;return[u.createElementVNode("button",{class:u.normalizeClass(["flex appearance-none w-full items-center gap-2 px-3 lg:text-base rounded border overflow-hidden leading-none",{"h-10":!t.small,"h-8":t.small,"cursor-pointer":!t.disabled,"!border-red-600 focus-within:outline-red-600":t.isInvalid,[`${c[u.unref(je).theme]}`]:!0}]),disabled:t.disabled},[u.createElementVNode("span",{class:u.normalizeClass(["select-none w-full text-left flex-1",{"whitespace-pre":!t.multiple}])},[t.modelValue&&((m=t.modelValue)==null?void 0:m.length)>0&&!t.hideSelect?(u.openBlock(),u.createElementBlock("span",Um,u.toDisplayString(s.value),1)):u.renderSlot(f.$slots,"default",{key:1},()=>[u.createTextVNode(u.toDisplayString(t.placeholder),1)])],2),u.createVNode(Hm,{class:u.normalizeClass(["h-4 w-4 transition-all transform",{"rotate-180":!p}])},null,8,["class"])],10,Wm)]}),content:u.withCtx(()=>{var p;return[!t.options&&((p=t.options)==null?void 0:p.length)==0?(u.openBlock(),u.createElementBlock("span",qm,"No data.")):(u.openBlock(),u.createElementBlock("div",Km,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(l.value,m=>(u.openBlock(),u.createElementBlock("div",{class:u.normalizeClass(["group",{"is-selected":!!a(m.value)}])},[u.createElementVNode("div",{class:u.normalizeClass(["flex items-center py-2 px-4 min-w-64 text-base",{"cursor-pointer":!t.multiple||m.value,[`${d[u.unref(je).theme]}`]:!0}]),onClick:y=>o(m.value)},[u.createElementVNode("div",Gm,[u.createElementVNode("span",null,u.toDisplayString(m.label||m.value),1),a(m.value)?(u.openBlock(),u.createBlock(ta,{key:0,class:"w-4 h-4"})):u.createCommentVNode("",!0)])],10,Jm)],2))),256))]))]}),_:3},8,["label","disabled"]))}}),Zm={class:"bg-white dark:bg-zinc-800/50 rounded-lg wpic-card shadow-[0_4px_16px_0px_rgba(0,0,0,0.1)]"},Xm={key:0,class:"flex justify-between items-baseline pt-6 px-6"},Qm={key:0,class:"text-xl font-bold"},eg={class:""},tg={key:1,class:"flex items-center justify-end py-4 px-6"},ng=Object.assign({name:"WpicCard"},{props:{title:String},setup(t){return(e,n)=>(u.openBlock(),u.createElementBlock("div",Zm,[t.title||e.$slots.actions?(u.openBlock(),u.createElementBlock("div",Xm,[t.title?(u.openBlock(),u.createElementBlock("div",Qm,u.toDisplayString(t.title),1)):u.createCommentVNode("",!0),u.createElementVNode("div",eg,[u.renderSlot(e.$slots,"actions")])])):u.createCommentVNode("",!0),u.renderSlot(e.$slots,"default"),e.$slots.buttons?(u.openBlock(),u.createElementBlock("div",tg,[u.renderSlot(e.$slots,"buttons")])):u.createCommentVNode("",!0)]))}}),rg={name:"WpicCardSection"},ig={class:"py-6 border-b last:border-0 mx-6"};function og(t,e,n,r,i,o){return u.openBlock(),u.createElementBlock("div",ig,[u.renderSlot(t.$slots,"default")])}const sg=ue(rg,[["render",og]]),lg={class:"flex h-2 rounded-full w-full ring-1 ring-zinc-400"},ag=Object.assign({name:"WpicProgressBar"},{props:{value:Number},setup(t){return(e,n)=>(u.openBlock(),u.createElementBlock("div",lg,[t.value>0?(u.openBlock(),u.createElementBlock("div",{key:0,style:u.normalizeStyle({width:`${t.value}%`}),class:"flex h-full bg-cyan-400 ring-1 ring-cyan-400 rounded-full"},null,4)):u.createCommentVNode("",!0)]))}}),cg={class:"text-base leading-none"},dg=Object.assign({name:"WpicTag"},{props:{clearable:Boolean},emits:["clear"],setup(t,{emit:e}){const n=e;function r(){n("clear")}return(i,o)=>(u.openBlock(),u.createElementBlock("div",{class:u.normalizeClass(["wpic-tag select-none border border-cyan-500 bg-cyan-50 inline-flex rounded text-cyan-600 h-8 items-center justify-center pl-3 py-1",{"pr-3":!t.clearable,"pr-2":t.clearable}])},[u.createElementVNode("span",cg,[u.renderSlot(i.$slots,"default")]),t.clearable?(u.openBlock(),u.createElementBlock("span",{key:0,onClick:r,class:"ml-1 cursor-pointer opacity-75 hover:opacity-100"},[u.createVNode(Do,{class:"w-4 h-4"})])):u.createCommentVNode("",!0)],2))}}),ug=Object.assign({name:"WpicTagGroup"},{props:{full:Boolean},setup(t){return(e,n)=>(u.openBlock(),u.createElementBlock("div",{class:u.normalizeClass({"w-full":t.full})},[u.createElementVNode("div",{class:u.normalizeClass(["ui-tag-group flex flex-wrap gap-2",{"w-full":t.full}])},[u.renderSlot(e.$slots,"default")],2)],2))}}),fg={class:"w-full h-full flex items-center justify-center"},hg=Object.assign({name:"WpicLoadingPanel"},{props:{color:{type:String,default:""}},setup(t){return(e,n)=>(u.openBlock(),u.createElementBlock("div",fg,[u.createVNode(di,{color:t.color,class:"w-10 h-10"},null,8,["color"])]))}}),pg={class:"text-base font-medium"},fa=Object.assign({name:"WpicPaginationItem"},{props:{active:Boolean},setup(t){return(e,n)=>(u.openBlock(),u.createElementBlock("div",{class:u.normalizeClass(["border rounded flex items-center justify-center w-10 h-10 cursor-pointer",{"border-zinc-300 dark:border-zinc-700 text-zinc-600 dark:text-zinc-300 hover:bg-zinc-500 hover:text-white":!t.active,"bg-violet-800 border-violet-800 hover:bg-violet-900 hover:border-violet-900 text-white":t.active}])},[u.createElementVNode("span",pg,[u.renderSlot(e.$slots,"default")])],2))}}),mg={class:"wpic-pagination flex justify-between"},gg={class:"flex flex-wrap gap-2"},yg={class:"hidden lg:flex gap-2 items-center"},bg=u.createElementVNode("span",{class:"text-base text-zinc-500"},"Results per page",-1),vg={class:"flex gap-2"},kg=Object.assign({name:"WpicPagination"},{props:{total:Number,perPage:{type:Number,default:10},currentPage:Number},emits:["update:perPage","update:currentPage"],setup(t,{expose:e,emit:n}){const r=t,i=n,o=u.computed(()=>r.total&&r.perPage?Math.ceil(r.total/r.perPage):1),s=[10,25,50,100];function l(f){i("update:currentPage",f)}function a(f){i("update:perPage",f)}function c(){return r.perPage*(r.currentPage-1)+1}function d(){return r.perPage*r.currentPage>r.total?r.total:r.perPage*r.currentPage}return e({getStart:c,getEnd:d}),(f,h)=>(u.openBlock(),u.createElementBlock("div",mg,[u.createElementVNode("div",gg,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(o.value,p=>(u.openBlock(),u.createBlock(fa,{onClick:m=>l(p),active:p===t.currentPage},{default:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(p),1)]),_:2},1032,["onClick","active"]))),256))]),u.createElementVNode("div",yg,[bg,u.createElementVNode("div",vg,[(u.openBlock(),u.createElementBlock(u.Fragment,null,u.renderList(s,p=>u.createVNode(fa,{onClick:m=>a(p),active:p==t.perPage},{default:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(p),1)]),_:2},1032,["onClick","active"])),64))])])]))}}),ha=(t,e)=>t.column.children&&t.column.children.default&&typeof t.column.children.default=="function"?u.h("td",e.attrs,t.column.children.default({item:t.item})):u.h("td",e.attrs,t.column.children);ha.props=["column","item","rowIndex"];const wg=ha,xg={},Sg={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},Cg=[u.createElementVNode("path",{"fill-rule":"evenodd",d:"M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z","clip-rule":"evenodd"},null,-1)];function Og(t,e){return u.openBlock(),u.createElementBlock("svg",Sg,Cg)}const Mg=ue(xg,[["render",Og]]),Eg={class:"w-full rounded-lg"},Tg=["width","max-width"],Ng={key:0,class:"rounded-t-lg"},Ag=["onClick"],Dg={class:"select-none font-medium"},Bg={class:"rounded-b-lg"},Vg=Object.assign({name:"WpicTable"},{props:{data:{type:Array,default:()=>[]},hideHeaders:Boolean,sortOptions:{},border:Boolean,noXPadding:Boolean},emits:["changeSort"],setup(t,{expose:e,emit:n}){const r=t,i={pmi:"","wpic-tools":"border-slate-300"},o={pmi:"bg-zinc-50 dark:bg-zinc-800/60 text-zinc-500 dark:text-zinc-400 dark:border-zinc-900","wpic-tools":"bg-slate-100 dark:bg-slate-800/60 text-slate-400 dark:text-slate-400 border-slate-200 dark:border-slate-900"},s={pmi:"bg-white dark:text-zinc-300 dark:border-zinc-900 dark:bg-zinc-800","wpic-tools":"bg-white border-slate-200 dark:border-slate-900 dark:bg-slate-800"},l=n;u.onMounted(()=>{f()});const a=u.getCurrentInstance();u.provide("wtable",a==null?void 0:a.proxy);const c=u.useSlots(),d=u.ref([]);function f(){const p=(g,v)=>{let C={};for(let M in g){if(typeof g[M].default=="boolean"&&v[M]!==void 0){C[M]=v[M]!==!1;continue}if(v[M]!==void 0){C[M]=v[M];continue}if(typeof g[M].default=="function"){C[M]=g[M].default();continue}C[M]=g[M].default}return C};let m=[];(c.default&&c.default()||[]).forEach(g=>{var v,C;((v=g.type)==null?void 0:v.name)==="WpicTableColumn"?m.push(g):(C=g.children)!=null&&C.length&&g.children.forEach(M=>{var b;((b=M.type)==null?void 0:b.name)==="WpicTableColumn"&&m.push(M)})}),d.value=m.map(g=>{let v=g.children,C=g.props||{},{field:M,label:b,help:O,width:S,minWidth:D,maxWidth:V,sortable:A,selectable:L,render:Y,type:q,align:Z,visible:ee}=p(g.type.props,C);return{label:b,help:O,width:S,minWidth:D,maxWidth:V,type:q,align:Z,sortable:A,selectable:L,field:M,render:Y,children:v,visible:ee}}).filter(g=>g.visible||g.selectable)}function h(p){let m=r.sortOptions.sortDirection;r.sortOptions.sortBy===p&&(m=m==="asc"?"desc":"asc"),l("changeSort",{sortDirection:m,sortBy:p})}return u.watch(()=>c.default,p=>{console.log("watch slots.default",p),f()},{deep:!0}),e({buildColumns:f}),(p,m)=>(u.openBlock(),u.createElementBlock("div",{class:u.normalizeClass(["relative w-full rounded-lg",{border:t.border,[`${i[u.unref(je).theme]}`]:!0}])},[u.createElementVNode("table",Eg,[u.createElementVNode("colgroup",null,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(d.value,(y,g)=>(u.openBlock(),u.createElementBlock("col",{style:u.normalizeStyle({minWidth:`${y.minWidth}px`}),width:y.width,"max-width":y.maxWidth,key:g},null,12,Tg))),128))]),t.hideHeaders?u.createCommentVNode("",!0):(u.openBlock(),u.createElementBlock("thead",Ng,[u.createElementVNode("tr",null,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(d.value,(y,g)=>(u.openBlock(),u.createElementBlock("th",{class:u.normalizeClass(["first:rounded-tl-lg last:rounded-tr-lg p-0 border-b",[`${o[u.unref(je).theme]}`]])},[u.createElementVNode("div",{onClick:()=>{y.sortable&&h(y.field)},class:u.normalizeClass(["flex items-center py-3 px-6 lg:text-base rounded-lg",{"cursor-pointer":y.sortable&&y.field,"justify-center":y.align=="center","justify-end":y.align=="right"}])},[u.createElementVNode("span",Dg,u.toDisplayString(y.label),1),y.sortable&&y.field?(u.openBlock(),u.createElementBlock("span",{key:0,class:u.normalizeClass(["ml-1",{"opacity-25":y.field!=t.sortOptions.sortBy}])},[u.createVNode(Mg,{class:u.normalizeClass(["w-4 h-4",{"rotate-180":t.sortOptions.sortDirection==="asc"}])},null,8,["class"])],2)):u.createCommentVNode("",!0)],10,Ag)],2))),256))])])),u.createElementVNode("tbody",Bg,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(t.data,(y,g)=>(u.openBlock(),u.createElementBlock("tr",{class:u.normalizeClass(["tr border-b last:border-b-0 overflow-hidden",[`${s[u.unref(je).theme]}`]]),key:`tr_${g}`},[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(d.value,(v,C)=>{var M,b;return u.openBlock(),u.createBlock(wg,{class:u.normalizeClass(["py-3 px-6 lg:text-base",{"first:pl-0 last:pr-0":t.noXPadding,"last:rounded-br-lg":g===((M=t.data)==null?void 0:M.length)-1,"first:rounded-bl-lg":g===((b=t.data)==null?void 0:b.length)-1,"text-center":v.align=="center","text-right":v.align=="right"}]),id:`${g}_${C}`,column:v,item:y,rowIndex:g,key:C},null,8,["class","id","column","item","rowIndex"])}),128))],2))),128))])])],2))}}),Ig={name:"WpicTableColumn",props:{label:{type:String},help:{type:String},field:{type:String,default:""},selectable:{type:Boolean,default:!0},sortable:{type:Boolean,default:!1},type:{type:String,default:"default"},width:{type:[String,Number],default:null},minWidth:{type:[String,Number],default:null},maxWidth:{type:[String,Number],default:null},align:{type:String,default:"left"},visible:{type:Boolean,default:!0}},setup(t){const e=inject("wtable",null);return onMounted(()=>{e&&e.buildColumns&&e.buildColumns()}),onBeforeUnmount(()=>{e&&e.buildColumns&&e.buildColumns()}),()=>null}};function Ce(t){this.content=t}Ce.prototype={constructor:Ce,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),o=r.content.slice();return i==-1?o.push(n||t,e):(o[i+1]=e,n&&(o[i]=n)),new Ce(o)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Ce(n)},addToStart:function(t,e){return new Ce([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Ce(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),o=r.find(t);return i.splice(o==-1?i.length:o,0,e,n),new Ce(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Ce.from(t),t.size?new Ce(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Ce.from(t),t.size?new Ce(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Ce.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}},Ce.from=function(t){if(t instanceof Ce)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ce(e)};function pa(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),o=e.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)n++;return n}if(i.content.size||o.content.size){let s=pa(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function ma(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let s=t.child(--i),l=e.child(--o),a=s.nodeSize;if(s==l){n-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:n,b:r};if(s.isText&&s.text!=l.text){let c=0,d=Math.min(s.text.length,l.text.length);for(;c<d&&s.text[s.text.length-c-1]==l.text[l.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(s.content.size||l.content.size){let c=ma(s.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}class T{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,o){for(let s=0,l=0;l<n;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,i+l,o||null,s)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,n-d),r,i+d)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let o="",s=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new T(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let o=0,s=0;s<n;o++){let l=this.content[o],a=s+l.nodeSize;a>e&&((s<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),r.push(l),i+=l.nodeSize),s=a}return new T(r,i)}cutByIndex(e,n){return e==n?T.empty:e==0&&n==this.content.length?this:new T(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new T(i,o)}addToStart(e){return new T([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new T(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return pa(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return ma(this,e,n,r)}findIndex(e,n=-1){if(e==0)return ki(0,e);if(e==this.size)return ki(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),s=i+o.nodeSize;if(s>=e)return s==e||n>0?ki(r+1,s):ki(r,i);i=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return T.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new T(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return T.empty;let n,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(n||(n=e.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new T(n||e,r)}static from(e){if(!e)return T.empty;if(e instanceof T)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new T([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}T.empty=new T([],0);const Po={index:0,offset:0};function ki(t,e){return Po.index=t,Po.offset=e,Po}function wi(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!wi(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!wi(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let se=class sl{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))n||(n=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&wi(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);return r.create(n.attrs)}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return sl.none;if(e instanceof sl)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};se.none=[];class xi extends Error{}class I{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=ya(this.content,e+this.openStart,n);return r&&new I(r,this.openStart,this.openEnd)}removeBetween(e,n){return new I(ga(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return I.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new I(T.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new I(e,r,i)}}I.empty=new I(T.empty,0,0);function ga(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:l}=t.findIndex(n);if(i==e||o.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(ga(o.content,e-i-1,n-i-1)))}function ya(t,e,n,r){let{index:i,offset:o}=t.findIndex(e),s=t.maybeChild(i);if(o==e||s.isText)return t.cut(0,e).append(n).append(t.cut(e));let l=ya(s.content,e-o-1,n);return l&&t.replaceChild(i,s.copy(l))}function Pg(t,e,n){if(n.openStart>t.depth)throw new xi("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new xi("Inconsistent open depths");return ba(t,e,n,0)}function ba(t,e,n,r){let i=t.index(r),o=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=ba(t,e,n,r+1);return o.copy(o.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,l=s.content;return yn(s,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=$g(n,t);return yn(o,ka(t,s,l,e,r))}else return yn(o,Si(t,e,r))}function va(t,e){if(!e.type.compatibleContent(t.type))throw new xi("Cannot join "+e.type.name+" onto "+t.type.name)}function $o(t,e,n){let r=t.node(n);return va(r,e.node(n)),r}function gn(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Er(t,e,n,r){let i=(e||t).node(n),o=0,s=e?e.index(n):i.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(gn(t.nodeAfter,r),o++));for(let l=o;l<s;l++)gn(i.child(l),r);e&&e.depth==n&&e.textOffset&&gn(e.nodeBefore,r)}function yn(t,e){return t.type.checkContent(e),t.copy(e)}function ka(t,e,n,r,i){let o=t.depth>i&&$o(t,e,i+1),s=r.depth>i&&$o(n,r,i+1),l=[];return Er(null,t,i,l),o&&s&&e.index(i)==n.index(i)?(va(o,s),gn(yn(o,ka(t,e,n,r,i+1)),l)):(o&&gn(yn(o,Si(t,e,i+1)),l),Er(e,n,i,l),s&&gn(yn(s,Si(n,r,i+1)),l)),Er(r,null,i,l),new T(l)}function Si(t,e,n){let r=[];if(Er(null,t,n,r),t.depth>n){let i=$o(t,e,n+1);gn(yn(i,Si(t,e,n+1)),r)}return Er(e,null,n,r),new T(r)}function $g(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)i=e.node(o).copy(T.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Tr{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return se.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let l=r;r=i,i=l}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Ci(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,o=n;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(o),c=o-a;if(r.push(s,l,i+a),!c||(s=s.child(l),s.isText))break;o=c-1,i+=a+1}return new Tr(n,r,o)}static resolveCached(e,n){for(let i=0;i<Ro.length;i++){let o=Ro[i];if(o.pos==n&&o.doc==e)return o}let r=Ro[_o]=Tr.resolve(e,n);return _o=(_o+1)%Rg,r}}let Ro=[],_o=0,Rg=12;class Ci{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const _g=Object.create(null);let bn=class ll{constructor(e,n,r,i=se.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||T.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&wi(this.attrs,n||e.defaultAttrs||_g)&&se.sameSet(this.marks,r||se.none)}copy(e=null){return e==this.content?this:new ll(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ll(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return I.empty;let i=this.resolve(e),o=this.resolve(n),s=r?0:i.sharedDepth(n),l=i.start(s),c=i.node(s).content.cut(i.pos-l,o.pos-l);return new I(c,i.depth-s,o.depth-s)}replace(e,n,r){return Pg(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return Tr.resolveCached(this,e)}resolveNoCache(e){return Tr.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),wa(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=T.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=i;a<o;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content);let e=se.none;for(let n=0;n<this.marks.length;n++)e=this.marks[n].addToSet(e);if(!se.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=T.fromJSON(e,n.content);return e.nodeType(n.type).create(n.attrs,i,r)}};bn.prototype.text=void 0;class Oi extends bn{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):wa(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Oi(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Oi(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function wa(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class vn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new Lg(e,n);if(r.next==null)return vn.empty;let i=xa(r);r.next&&r.err("Unexpected trailing text");let o=qg(Ug(i));return Kg(o,r),o}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let o=n;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function o(s,l){let a=s.matchFragment(e,r);if(a&&(!n||a.validEnd))return T.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:d,next:f}=s.next[c];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let h=o(f,l.concat(d));if(h)return h}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let l=i;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:l,next:a}=o.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!i.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
6
- `)}}vn.empty=new vn(!0);class Lg{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function xa(t){let e=[];do e.push(zg(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function zg(t){let e=[];do e.push(Fg(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Fg(t){let e=Wg(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=jg(t,e);else break;return e}function Sa(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function jg(t,e){let n=Sa(t),r=n;return t.eat(",")&&(t.next!="}"?r=Sa(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Hg(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let o in n){let s=n[o];s.groups.indexOf(e)>-1&&i.push(s)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function Wg(t){if(t.eat("(")){let e=xa(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=Hg(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Ug(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function i(s,l){s.forEach(a=>a.to=l)}function o(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(o(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=o(s.exprs[a],l);if(a==s.exprs.length-1)return c;i(c,l=n())}else if(s.type=="star"){let a=n();return r(l,a),i(o(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=n();return i(o(s.expr,l),a),i(o(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(o(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let d=n();i(o(s.expr,a),d),a=d}if(s.max==-1)i(o(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let d=n();r(a,d),i(o(s.expr,a),d),a=d}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Ca(t,e){return e-t}function Oa(t,e){let n=[];return r(e),n.sort(Ca);function r(i){let o=t[i];if(o.length==1&&!o[0].term)return r(o[0].to);n.push(i);for(let s=0;s<o.length;s++){let{term:l,to:a}=o[s];!l&&n.indexOf(a)==-1&&r(a)}}}function qg(t){let e=Object.create(null);return n(Oa(t,0));function n(r){let i=[];r.forEach(s=>{t[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let d=0;d<i.length;d++)i[d][0]==l&&(c=i[d][1]);Oa(t,a).forEach(d=>{c||i.push([l,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let o=e[r.join(",")]=new vn(r.indexOf(t.length-1)>-1);for(let s=0;s<i.length;s++){let l=i[s][1].sort(Ca);o.next.push({type:i[s][0],next:e[l.join(",")]||n(l)})}return o}}function Kg(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],o=!i.validEnd,s=[];for(let l=0;l<i.next.length;l++){let{type:a,next:c}=i.next[l];s.push(a.name),o&&!(a.isText||a.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Ma(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function Ea(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let o=t[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function Ta(t){let e=Object.create(null);if(t)for(let n in t)e[n]=new Jg(t[n]);return e}let Na=class ju{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Ta(r.attrs),this.defaultAttrs=Ma(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==vn.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Ea(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new bn(this,this.computeAttrs(e),T.from(n),se.setFrom(r))}createChecked(e=null,n,r){return n=T.from(n),this.checkContent(n),new bn(this,this.computeAttrs(e),n,se.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=T.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let i=this.contentMatch.matchFragment(n),o=i&&i.fillBefore(T.empty,!0);return o?new bn(this,e,n.append(o),se.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:se.none:e}static compile(e,n){let r=Object.create(null);e.forEach((o,s)=>r[o]=new ju(o,n,s));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class Jg{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class Mi{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=Ta(i.attrs),this.excluded=null;let o=Ma(this.attrs);this.instance=o?new se(this,o):null}create(e=null){return!e&&this.instance?this.instance:new se(this,Ea(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new Mi(o,i++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}excludes(e){return this.excluded.indexOf(e)>-1}}class Gg{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Ce.from(e.nodes),n.marks=Ce.from(e.marks||{}),this.nodes=Na.compile(this.spec.nodes,this),this.marks=Mi.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",l=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=vn.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=l=="_"?null:l?Aa(this,l.split(" ")):l==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:Aa(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Na){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new Oi(r,r.defaultAttrs,e,se.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return bn.fromJSON(this,e)}markFromJSON(e){return se.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Aa(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],o=t.marks[i],s=o;if(o)n.push(o);else for(let l in t.marks){let a=t.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function Yg(t){return t.tag!=null}function Zg(t){return t.style!=null}class jn{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[],n.forEach(r=>{Yg(r)?this.tags.push(r):Zg(r)&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new Ia(this,n,!1);return r.addAll(e,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Ia(this,n,!0);return r.addAll(e,n.from,n.to),I.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(ey(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||n.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(e,n,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(s.getAttrs){let a=s.getAttrs(n);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let n=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<n.length;s++){let l=n[s];if((l.priority==null?50:l.priority)<o)break}n.splice(s,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=Pa(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=Pa(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new jn(e,jn.schemaRules(e)))}}const Da={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Xg={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ba={ol:!0,ul:!0},Ei=1,Ti=2,Nr=4;function Va(t,e,n){return e!=null?(e?Ei:0)|(e==="full"?Ti:0):t&&t.whitespace=="pre"?Ei|Ti:n&~Nr}class Ni{constructor(e,n,r,i,o,s,l){this.type=e,this.attrs=n,this.marks=r,this.pendingMarks=i,this.solid=o,this.options=l,this.content=[],this.activeMarks=se.none,this.stashMarks=[],this.match=s||(l&Nr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(T.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ei)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let n=T.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(T.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}popFromStashMark(e){for(let n=this.stashMarks.length-1;n>=0;n--)if(e.eq(this.stashMarks[n]))return this.stashMarks.splice(n,1)[0]}applyPending(e){for(let n=0,r=this.pendingMarks;n<r.length;n++){let i=r[n];(this.type?this.type.allowsMarkType(i.type):ty(i.type,e))&&!i.isInSet(this.activeMarks)&&(this.activeMarks=i.addToSet(this.activeMarks),this.pendingMarks=i.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Da.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Ia{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0;let i=n.topNode,o,s=Va(null,n.preserveWhitespace,0)|(r?Nr:0);i?o=new Ni(i.type,i.attrs,se.none,se.none,!0,n.topMatch||i.type.contentMatch,s):r?o=new Ni(null,null,se.none,se.none,!0,null,s):o=new Ni(e.schema.topNodeType,null,se.none,se.none,!0,null,s),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){e.nodeType==3?this.addTextNode(e):e.nodeType==1&&this.addElement(e)}withStyleRules(e,n){let r=e.style;if(!r||!r.length)return n();let i=this.readStyles(e.style);if(!i)return;let[o,s]=i,l=this.top;for(let a=0;a<s.length;a++)this.removePendingMark(s[a],l);for(let a=0;a<o.length;a++)this.addPendingMark(o[a]);n();for(let a=0;a<o.length;a++)this.removePendingMark(o[a],l);for(let a=0;a<s.length;a++)this.addPendingMark(s[a])}addTextNode(e){let n=e.nodeValue,r=this.top;if(r.options&Ti||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(r.options&Ei)r.options&Ti?n=n.replace(/\r\n?/g,`
7
- `):n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let i=r.content[r.content.length-1],o=e.previousSibling;(!i||o&&o.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(n=n.slice(1))}n&&this.insertNode(this.parser.schema.text(n)),this.findInText(e)}else this.findInside(e)}addElement(e,n){let r=e.nodeName.toLowerCase(),i;Ba.hasOwnProperty(r)&&this.parser.normalizeLists&&Qg(e);let o=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,n));if(o?o.ignore:Xg.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(e=o.skip);let s,l=this.top,a=this.needsBlock;if(Da.hasOwnProperty(r))l.content.length&&l.content[0].isInline&&this.open&&(this.open--,l=this.top),s=!0,l.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e);return}o&&o.skip?this.addAll(e):this.withStyleRules(e,()=>this.addAll(e)),s&&this.sync(l),this.needsBlock=a}else this.withStyleRules(e,()=>{this.addElementByRule(e,o,o.consuming===!1?i:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
8
- `))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let n=se.none,r=se.none;for(let i=0,o=e.length;i<o;i++){let s=e.item(i);for(let l=void 0;;){let a=this.parser.matchStyle(s,e.getPropertyValue(s),this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach(c=>{a.clearMark(c)&&(r=c.addToSet(r))}):n=this.parser.schema.marks[a.mark].create(a.attrs).addToSet(n),a.consuming===!1)l=a;else break}}return[n,r]}addElementByRule(e,n,r){let i,o,s;n.node?(o=this.parser.schema.nodes[n.node],o.isLeaf?this.insertNode(o.create(n.attrs))||this.leafFallback(e):i=this.enter(o,n.attrs||null,n.preserveWhitespace)):(s=this.parser.schema.marks[n.mark].create(n.attrs),this.addPendingMark(s));let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a)}i&&this.sync(l)&&this.open--,s&&this.removePendingMark(s,l)}addAll(e,n,r){let i=n||0;for(let o=n?e.childNodes[n]:e.firstChild,s=r==null?null:e.childNodes[r];o!=s;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o);this.findAtPoint(e,i)}findPlace(e){let n,r;for(let i=this.open;i>=0;i--){let o=this.nodes[i],s=o.findWrapping(e);if(s&&(!n||n.length>s.length)&&(n=s,r=o,!s.length)||o.solid)break}if(!n)return!1;this.sync(r);for(let i=0;i<n.length;i++)this.enterInner(n[i],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let n=this.textblockFromContext();n&&this.enterInner(n)}if(this.findPlace(e)){this.closeExtra();let n=this.top;n.applyPending(e.type),n.match&&(n.match=n.match.matchType(e.type));let r=n.activeMarks;for(let i=0;i<e.marks.length;i++)(!n.type||n.type.allowsMarkType(e.marks[i].type))&&(r=e.marks[i].addToSet(r));return n.content.push(e.mark(r)),!0}return!1}enter(e,n,r){let i=this.findPlace(e.create(n));return i&&this.enterInner(e,n,!0,r),i}enterInner(e,n=null,r=!1,i){this.closeExtra();let o=this.top;o.applyPending(e),o.match=o.match&&o.match.matchType(e);let s=Va(e,i,o.options);o.options&Nr&&o.content.length==0&&(s|=Nr),this.nodes.push(new Ni(e,n,o.activeMarks,o.pendingMarks,r,null,s)),this.open++}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let n=this.open;n>=0;n--)if(this.nodes[n]==e)return this.open=n,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(l,a)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;a>=o;a--)if(s(l-1,a))return!0;return!1}else{let d=a>0||a==0&&i?this.nodes[a].type:r&&a>=o?r.node(a-o).type:null;if(!d||d.name!=c&&d.groups.indexOf(c)==-1)return!1;a--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let n=ny(e,this.top.pendingMarks);n&&this.top.stashMarks.push(n),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,n){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(e)>-1)i.pendingMarks=e.removeFromSet(i.pendingMarks);else{i.activeMarks=e.removeFromSet(i.activeMarks);let s=i.popFromStashMark(e);s&&i.type&&i.type.allowsMarkType(s.type)&&(i.activeMarks=s.addToSet(i.activeMarks))}if(i==n)break}}}function Qg(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Ba.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function ey(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Pa(t){let e={};for(let n in t)e[n]=t[n];return e}function ty(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let o=[],s=l=>{o.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:d}=l.edge(a);if(c==e||o.indexOf(d)<0&&s(d))return!0}};if(s(i.contentMatch))return!0}}function ny(t,e){for(let n=0;n<e.length;n++)if(t.eq(e[n]))return e[n]}class wt{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Lo(n).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let l=0,a=0;for(;l<o.length&&a<s.marks.length;){let c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(o[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<o.length;)i=o.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],d=this.serializeMark(c,s.isInline,n);d&&(o.push([c,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom)}}i.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=wt.renderSpec(Lo(n),this.nodes[e.type.name](e));if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&wt.renderSpec(Lo(r),i(e,n))}static renderSpec(e,n,r=null){if(typeof n=="string")return{dom:e.createTextNode(n)};if(n.nodeType!=null)return{dom:n};if(n.dom&&n.dom.nodeType!=null)return n;let i=n[0],o=i.indexOf(" ");o>0&&(r=i.slice(0,o),i=i.slice(o+1));let s,l=r?e.createElementNS(r,i):e.createElement(i),a=n[1],c=1;if(a&&typeof a=="object"&&a.nodeType==null&&!Array.isArray(a)){c=2;for(let d in a)if(a[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),a[d]):l.setAttribute(d,a[d])}}for(let d=c;d<n.length;d++){let f=n[d];if(f===0){if(d<n.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:p}=wt.renderSpec(e,f,r);if(l.appendChild(h),p){if(s)throw new RangeError("Multiple content holes");s=p}}}return{dom:l,contentDOM:s}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new wt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=$a(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return $a(e.marks)}}function $a(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Lo(t){return t.document||window.document}const Ra=65535,_a=Math.pow(2,16);function ry(t,e){return t+e*_a}function La(t){return t&Ra}function iy(t){return(t-(t&Ra))/_a}const za=1,Fa=2,Ai=4,ja=8;class zo{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&ja)>0}get deletedBefore(){return(this.delInfo&(za|Ai))>0}get deletedAfter(){return(this.delInfo&(Fa|Ai))>0}get deletedAcross(){return(this.delInfo&Ai)>0}}class Ge{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Ge.empty)return Ge.empty}recover(e){let n=0,r=La(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+iy(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let c=this.ranges[l+o],d=this.ranges[l+s],f=a+c;if(e<=f){let h=c?e==a?-1:e==f?1:n:n,p=a+i+(h<0?0:d);if(r)return p;let m=e==(n<0?a:f)?null:ry(l/3,e-a),y=e==a?Fa:e==f?za:Ai;return(n<0?e!=a:e!=f)&&(y|=ja),new zo(p,y,m)}i+=d-c}return r?e+i:new zo(e+i,0,null)}touches(e,n){let r=0,i=La(n),o=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+o],d=a+c;if(e<=d&&l==i*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],l=s-(this.inverted?o:0),a=s+(this.inverted?0:o),c=this.ranges[i+n],d=this.ranges[i+r];e(l,l+c,a,a+d),o+=d-c}}invert(){return new Ge(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ge.empty:new Ge(e<0?[0,-e,0]:[0,0,e])}}Ge.empty=new Ge([]);class Hn{constructor(e=[],n,r=0,i=e.length){this.maps=e,this.mirror=n,this.from=r,this.to=i}slice(e=0,n=this.maps.length){return new Hn(this.maps,this.mirror,e,n)}copy(){return new Hn(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,n){this.to=this.maps.push(e),n!=null&&this.setMirror(this.maps.length-1,n)}appendMapping(e){for(let n=0,r=this.maps.length;n<e.maps.length;n++){let i=e.getMirror(n);this.appendMap(e.maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this.maps.length+e.maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e.maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Hn;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let o=this.from;o<this.to;o++){let s=this.maps[o],l=s.mapResult(e,n);if(l.recover!=null){let a=this.getMirror(o);if(a!=null&&a>o&&a<this.to){o=a,e=this.maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new zo(e,i,null)}}const Fo=Object.create(null);class Ee{getMap(){return Ge.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Fo[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Fo)throw new RangeError("Duplicate use of step JSON ID "+e);return Fo[e]=n,n.prototype.jsonID=e,n}}class fe{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new fe(e,null)}static fail(e){return new fe(null,e)}static fromReplace(e,n,r,i){try{return fe.ok(e.replace(n,r,i))}catch(o){if(o instanceof xi)return fe.fail(o.message);throw o}}}function jo(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let o=t.child(i);o.content.size&&(o=o.copy(jo(o.content,e,o))),o.isInline&&(o=e(o,n,i)),r.push(o)}return T.fromArray(r)}class Jt extends Ee{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new I(jo(n.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return fe.fromReplace(e,this.from,this.to,o)}invert(){return new xt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Jt(n.pos,r.pos,this.mark)}merge(e){return e instanceof Jt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Jt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Jt(n.from,n.to,e.markFromJSON(n.mark))}}Ee.jsonID("addMark",Jt);class xt extends Ee{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new I(jo(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return fe.fromReplace(e,this.from,this.to,r)}invert(){return new Jt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new xt(n.pos,r.pos,this.mark)}merge(e){return e instanceof xt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new xt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new xt(n.from,n.to,e.markFromJSON(n.mark))}}Ee.jsonID("removeMark",xt);class Gt extends Ee{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return fe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return fe.fromReplace(e,this.pos,this.pos+1,new I(T.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Gt(this.pos,n.marks[i]);return new Gt(this.pos,this.mark)}}return new Wn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Gt(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Gt(n.pos,e.markFromJSON(n.mark))}}Ee.jsonID("addNodeMark",Gt);class Wn extends Ee{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return fe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return fe.fromReplace(e,this.pos,this.pos+1,new I(T.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Gt(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Wn(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Wn(n.pos,e.markFromJSON(n.mark))}}Ee.jsonID("removeNodeMark",Wn);class ye extends Ee{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Ho(e,this.from,this.to)?fe.fail("Structure replace would overwrite content"):fe.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ge([this.from,this.to-this.from,this.slice.size])}invert(e){return new ye(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new ye(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(e){if(!(e instanceof ye)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?I.empty:new I(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ye(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?I.empty:new I(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ye(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ye(n.from,n.to,I.fromJSON(e,n.slice),!!n.structure)}}Ee.jsonID("replace",ye);class be extends Ee{constructor(e,n,r,i,o,s,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=l}apply(e){if(this.structure&&(Ho(e,this.from,this.gapFrom)||Ho(e,this.gapTo,this.to)))return fe.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return fe.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?fe.fromReplace(e,this.from,this.to,r):fe.fail("Content does not fit in gap")}getMap(){return new Ge([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new be(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new be(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new be(n.from,n.to,n.gapFrom,n.gapTo,I.fromJSON(e,n.slice),n.insert,!!n.structure)}}Ee.jsonID("replaceAround",be);function Ho(t,e,n){let r=t.resolve(e),i=n-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function oy(t,e,n,r){let i=[],o=[],s,l;t.doc.nodesBetween(e,n,(a,c,d)=>{if(!a.isInline)return;let f=a.marks;if(!r.isInSet(f)&&d.type.allowsMarkType(r.type)){let h=Math.max(c,e),p=Math.min(c+a.nodeSize,n),m=r.addToSet(f);for(let y=0;y<f.length;y++)f[y].isInSet(m)||(s&&s.to==h&&s.mark.eq(f[y])?s.to=p:i.push(s=new xt(h,p,f[y])));l&&l.to==h?l.to=p:o.push(l=new Jt(h,p,r))}}),i.forEach(a=>t.step(a)),o.forEach(a=>t.step(a))}function sy(t,e,n,r){let i=[],o=0;t.doc.nodesBetween(e,n,(s,l)=>{if(!s.isInline)return;o++;let a=null;if(r instanceof Mi){let c=s.marks,d;for(;d=r.isInSet(c);)(a||(a=[])).push(d),c=d.removeFromSet(c)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,n);for(let d=0;d<a.length;d++){let f=a[d],h;for(let p=0;p<i.length;p++){let m=i[p];m.step==o-1&&f.eq(i[p].style)&&(h=m)}h?(h.to=c,h.step=o):i.push({style:f,from:Math.max(l,e),to:c,step:o})}}}),i.forEach(s=>t.step(new xt(s.from,s.to,s.style)))}function Ha(t,e,n,r=n.contentMatch,i=!0){let o=t.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<o.childCount;a++){let c=o.child(a),d=l+c.nodeSize,f=r.matchType(c.type);if(!f)s.push(new ye(l,d,I.empty));else{r=f;for(let h=0;h<c.marks.length;h++)n.allowsMarkType(c.marks[h].type)||t.step(new xt(l,d,c.marks[h]));if(i&&c.isText&&n.whitespace!="pre"){let h,p=/\r?\n|\r/g,m;for(;h=p.exec(c.text);)m||(m=new I(T.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new ye(l+h.index,l+h.index+h[0].length,m))}}l=d}if(!r.validEnd){let a=r.fillBefore(T.empty,!0);t.replace(l,l,new I(a,0,0))}for(let a=s.length-1;a>=0;a--)t.step(s[a])}function ly(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Un(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let i=t.$from.node(r),o=t.$from.index(r),s=t.$to.indexAfter(r);if(r<t.depth&&i.canReplace(o,s,n))return r;if(r==0||i.type.spec.isolating||!ly(i,o,s))break}return null}function ay(t,e,n){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),l=i.after(o+1),a=s,c=l,d=T.empty,f=0;for(let m=o,y=!1;m>n;m--)y||r.index(m)>0?(y=!0,d=T.from(r.node(m).copy(d)),f++):a--;let h=T.empty,p=0;for(let m=o,y=!1;m>n;m--)y||i.after(m+1)<i.end(m)?(y=!0,h=T.from(i.node(m).copy(h)),p++):c++;t.step(new be(a,c,s,l,new I(d.append(h),f,p),d.size-f,!0))}function Wo(t,e,n=null,r=t){let i=cy(t,e),o=i&&dy(r,e);return o?i.map(Wa).concat({type:e,attrs:n}).concat(o.map(Wa)):null}function Wa(t){return{type:t,attrs:null}}function cy(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return n.canReplaceWith(r,i,s)?o:null}function dy(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;a&&c<i;c++)a=a.matchType(n.child(c).type);return!a||!a.validEnd?null:s}function uy(t,e,n){let r=T.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let l=n[s].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=T.from(n[s].type.create(n[s].attrs,r))}let i=e.start,o=e.end;t.step(new be(i,o,i,o,new I(r,0,0),n.length,!0))}function fy(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(s,l)=>{if(s.isTextblock&&!s.hasMarkup(r,i)&&my(t.doc,t.mapping.slice(o).map(l),r)){let a=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?a=!1:!h&&p&&(a=!0)}a===!1&&py(t,s,l,o),Ha(t,t.mapping.slice(o).map(l,1),r,void 0,a===null);let c=t.mapping.slice(o),d=c.map(l,1),f=c.map(l+s.nodeSize,1);return t.step(new be(d,f,d+1,f-1,new I(T.from(r.create(i,null,s.marks)),0,0),1,!0)),a===!0&&hy(t,s,l,o),!1}})}function hy(t,e,n,r){e.forEach((i,o)=>{if(i.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(i.text);){let a=t.mapping.slice(r).map(n+1+o+s.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function py(t,e,n,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+o);t.replaceWith(s,s+1,e.type.schema.text(`
9
- `))}})}function my(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function gy(t,e,n,r,i){let o=t.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let s=n.create(r,null,i||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,s);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new be(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new I(T.from(s),0,0),1,!0))}function qn(t,e,n=1,r){let i=t.resolve(e),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,d=n-2;c>o;c--,d--){let f=i.node(c),h=i.index(c);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(h,f.childCount),m=r&&r[d+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let y=r&&r[d]||f;if(!f.canReplace(h+1,f.childCount)||!y.type.validContent(p))return!1}let l=i.indexAfter(o),a=r&&r[0];return i.node(o).canReplaceWith(l,l,a?a.type:i.node(o+1).type)}function yy(t,e,n=1,r){let i=t.doc.resolve(e),o=T.empty,s=T.empty;for(let l=i.depth,a=i.depth-n,c=n-1;l>a;l--,c--){o=T.from(i.node(l).copy(o));let d=r&&r[c];s=T.from(d?d.type.create(d.attrs,s):i.node(l).copy(s))}t.step(new ye(e,e,new I(o.append(s),n,n),!0))}function Yt(t,e){let n=t.resolve(e),r=n.index();return Ua(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Ua(t,e){return!!(t&&e&&!t.isLeaf&&t.canAppend(e))}function Di(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let o,s,l=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):n>0?(o=r.node(i+1),l++,s=r.node(i).maybeChild(l)):(o=r.node(i).maybeChild(l-1),s=r.node(i+1)),o&&!o.isTextblock&&Ua(o,s)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function by(t,e,n){let r=new ye(e-n,e+n,I.empty,!0);t.step(r)}function vy(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,n))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,n))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function qa(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let o=0;o<n.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(n.openStart==0&&n.size?2:1);o++)for(let s=r.depth;s>=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,a=r.index(s)+(l>0?1:0),c=r.node(s),d=!1;if(o==1)d=c.canReplace(a,a,i);else{let f=c.contentMatchAt(a).findWrapping(i.firstChild.type);d=f&&c.canReplaceWith(a,a,f[0])}if(d)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function Bi(t,e,n=e,r=I.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),o=t.resolve(n);return Ka(i,o,r)?new ye(e,n,r):new ky(i,o,r).fit()}function Ka(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class ky{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=T.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=T.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,l=i.depth;for(;s&&l&&o.childCount==1;)o=o.firstChild.content,s--,l--;let a=new I(o,s,l);return e>-1?new be(r.pos,e,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new ye(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=n.firstChild;if(n.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}n=o.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=Uo(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],d,f=null;if(n==1&&(s?c.matchType(s.type)||(f=c.fillBefore(T.from(s),!1)):o&&a.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:l,parent:o,inject:f};if(n==2&&s&&(d=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:o,wrap:d};if(o&&c.matchType(o.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Uo(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new I(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Uo(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new I(Ar(e,n-1,1),n-1,o?n-1:r)}else this.unplaced=new I(Ar(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let y=0;y<o.length;y++)this.openFrontierNode(o[y]);let s=this.unplaced,l=r?r.content:s.content,a=s.openStart-e,c=0,d=[],{match:f,type:h}=this.frontier[n];if(i){for(let y=0;y<i.childCount;y++)d.push(i.child(y));f=f.matchFragment(i)}let p=l.size+e-(s.content.size-s.openEnd);for(;c<l.childCount;){let y=l.child(c),g=f.matchType(y.type);if(!g)break;c++,(c>1||a==0||y.content.size)&&(f=g,d.push(Ja(y.mark(h.allowedMarks(y.marks)),c==1?a:0,c==l.childCount?p:-1)))}let m=c==l.childCount;m||(p=-1),this.placed=Dr(this.placed,n,T.from(d)),this.frontier[n].match=f,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let y=0,g=l;y<p;y++){let v=g.lastChild;this.frontier.push({type:v.type,match:v.contentMatchAt(v.childCount)}),g=v.content}this.unplaced=m?e==0?I.empty:new I(Ar(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new I(Ar(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!qo(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],o=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=qo(e,n,i,r,o);if(s){for(let l=n-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],d=qo(e,l,c,a,!0);if(!d||d.childCount)continue e}return{depth:n,fit:s,move:o?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Dr(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Dr(this.placed,this.depth,T.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(T.empty,!0);n.childCount&&(this.placed=Dr(this.placed,this.frontier.length,n))}}function Ar(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Ar(t.firstChild.content,e-1,n)))}function Dr(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Dr(t.lastChild.content,e-1,n)))}function Uo(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Ja(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Ja(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(T.empty,!0)))),t.copy(r)}function qo(t,e,n,r,i){let o=t.node(e),s=i?t.indexAfter(e):t.index(e);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,s);return l&&!wy(n,o.content,s)?l:null}function wy(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function xy(t){return t.spec.defining||t.spec.definingForContent}function Sy(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),o=t.doc.resolve(n);if(Ka(i,o,r))return t.step(new ye(e,n,r));let s=Ya(i,t.doc.resolve(n));s[s.length-1]==0&&s.pop();let l=-(i.depth+1);s.unshift(l);for(let h=i.depth,p=i.pos-1;h>0;h--,p--){let m=i.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(h)>-1?l=h:i.before(h)==p&&s.splice(1,0,-h)}let a=s.indexOf(l),c=[],d=r.openStart;for(let h=r.content,p=0;;p++){let m=h.firstChild;if(c.push(m),p==r.openStart)break;h=m.content}for(let h=d-1;h>=0;h--){let p=c[h],m=xy(p.type);if(m&&!p.sameMarkup(i.node(Math.abs(l)-1)))d=h;else if(m||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+d+1)%(r.openStart+1),m=c[p];if(m)for(let y=0;y<s.length;y++){let g=s[(y+a)%s.length],v=!0;g<0&&(v=!1,g=-g);let C=i.node(g-1),M=i.index(g-1);if(C.canReplaceWith(M,M,m.type,m.marks))return t.replace(i.before(g),v?o.after(g):n,new I(Ga(r.content,0,r.openStart,p),p,r.openEnd))}}let f=t.steps.length;for(let h=s.length-1;h>=0&&(t.replace(e,n,r),!(t.steps.length>f));h--){let p=s[h];p<0||(e=i.before(p),n=o.after(p))}}function Ga(t,e,n,r,i){if(e<n){let o=t.firstChild;t=t.replaceChild(0,o.copy(Ga(o.content,e+1,n,r,o)))}if(e>r){let o=i.contentMatchAt(0),s=o.fillBefore(t).append(t);t=s.append(o.matchFragment(s).fillBefore(T.empty,!0))}return t}function Cy(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=vy(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new I(T.from(r),0,0))}function Oy(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),o=Ya(r,i);for(let s=0;s<o.length;s++){let l=o[s],a=s==o.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),i.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return t.delete(r.before(l),i.after(l))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&i.end(s)-n!=i.depth-s)return t.delete(r.before(s),n);t.delete(e,n)}function Ya(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let o=t.start(i);if(o<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&n.push(i)}return n}class Kn extends Ee{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return fe.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return fe.fromReplace(e,this.pos,this.pos+1,new I(T.from(i),0,n.isLeaf?0:1))}getMap(){return Ge.empty}invert(e){return new Kn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Kn(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Kn(n.pos,n.attr,n.value)}}Ee.jsonID("attr",Kn);class Br extends Ee{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return fe.ok(r)}getMap(){return Ge.empty}invert(e){return new Br(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Br(n.attr,n.value)}}Ee.jsonID("docAttr",Br);let Jn=class extends Error{};Jn=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},Jn.prototype=Object.create(Error.prototype),Jn.prototype.constructor=Jn,Jn.prototype.name="TransformError";class My{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Hn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Jn(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=I.empty){let i=Bi(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new I(T.from(r),0,0))}delete(e,n){return this.replace(e,n,I.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return Sy(this,e,n,r),this}replaceRangeWith(e,n,r){return Cy(this,e,n,r),this}deleteRange(e,n){return Oy(this,e,n),this}lift(e,n){return ay(this,e,n),this}join(e,n=1){return by(this,e,n),this}wrap(e,n){return uy(this,e,n),this}setBlockType(e,n=e,r,i=null){return fy(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return gy(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new Kn(e,n,r)),this}setDocAttribute(e,n){return this.step(new Br(e,n)),this}addNodeMark(e,n){return this.step(new Gt(e,n)),this}removeNodeMark(e,n){if(!(n instanceof se)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n=n.isInSet(r.marks),!n)return this}return this.step(new Wn(e,n)),this}split(e,n=1,r){return yy(this,e,n,r),this}addMark(e,n,r){return oy(this,e,n,r),this}removeMark(e,n,r){return sy(this,e,n,r),this}clearIncompatible(e,n,r){return Ha(this,e,n,r),this}}const Ko=Object.create(null);class J{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Ey(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=I.empty){let r=n.content.lastChild,i=null;for(let l=0;l<n.openEnd;l++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:c}=s[l],d=e.mapping.slice(o);e.replaceRange(d.map(a.pos),d.map(c.pos),l?I.empty:n),l==0&&Qa(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:l}=i[o],a=e.mapping.slice(r),c=a.map(s.pos),d=a.map(l.pos);o?e.deleteRange(c,d):(e.replaceRangeWith(c,d,n),Qa(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new U(e):Gn(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=n<0?Gn(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):Gn(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new ht(e.node(0))}static atStart(e){return Gn(e,e,0,0,1)||new ht(e)}static atEnd(e){return Gn(e,e,e.content.size,e.childCount,-1)||new ht(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ko[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Ko)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ko[e]=n,n.prototype.jsonID=e,n}getBookmark(){return U.between(this.$anchor,this.$head).getBookmark()}}J.prototype.visible=!0;class Ey{constructor(e,n){this.$from=e,this.$to=n}}let Za=!1;function Xa(t){!Za&&!t.parent.inlineContent&&(Za=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class U extends J{constructor(e,n=e){Xa(e),Xa(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return J.near(r);let i=e.resolve(n.map(this.anchor));return new U(i.parent.inlineContent?i:r,r)}replace(e,n=I.empty){if(super.replace(e,n),n==I.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof U&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Vi(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new U(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let o=J.findFrom(n,r,!0)||J.findFrom(n,-r,!0);if(o)n=o.$head;else return J.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(J.findFrom(e,-r,!0)||J.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new U(e,n)}}J.jsonID("text",U);class Vi{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Vi(e.map(this.anchor),e.map(this.head))}resolve(e){return U.between(e.resolve(this.anchor),e.resolve(this.head))}}class z extends J{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),o=e.resolve(i);return r?J.near(o):new z(o)}content(){return new I(T.from(this.node),0,0)}eq(e){return e instanceof z&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Jo(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new z(e.resolve(n.anchor))}static create(e,n){return new z(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}z.prototype.visible=!1,J.jsonID("node",z);class Jo{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Vi(r,r):new Jo(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&z.isSelectable(r)?new z(n):J.near(n)}}class ht extends J{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=I.empty){if(n==I.empty){e.delete(0,e.doc.content.size);let r=J.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new ht(e)}map(e){return new ht(e)}eq(e){return e instanceof ht}getBookmark(){return Ty}}J.jsonID("all",ht);const Ty={map(){return this},resolve(t){return new ht(t)}};function Gn(t,e,n,r,i,o=!1){if(e.inlineContent)return U.create(t,n);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let l=e.child(s);if(l.isAtom){if(!o&&z.isSelectable(l))return z.create(t,n-(i<0?l.nodeSize:0))}else{let a=Gn(t,l,n+i,i<0?l.childCount:0,i,o);if(a)return a}n+=l.nodeSize*i}return null}function Qa(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof ye||i instanceof be))return;let o=t.mapping.maps[r],s;o.forEach((l,a,c,d)=>{s==null&&(s=d)}),t.setSelection(J.near(t.doc.resolve(s),n))}const ec=1,Ii=2,tc=4;class Ny extends My{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|ec)&~Ii,this.storedMarks=null,this}get selectionSet(){return(this.updated&ec)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Ii,this}ensureMarks(e){return se.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Ii)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Ii,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||se.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(n);o=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,o)),this.selection.empty||this.setSelection(J.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=tc,this}get scrolledIntoView(){return(this.updated&tc)>0}}function nc(t,e){return!e||!t?t:t.bind(e)}class Vr{constructor(e,n,r){this.name=e,this.init=nc(n.init,r),this.apply=nc(n.apply,r)}}const Ay=[new Vr("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Vr("selection",{init(t,e){return t.selection||J.atStart(e.doc)},apply(t){return t.selection}}),new Vr("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Vr("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Go{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Ay.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Vr(r.key,r.spec.state,r))})}}class Yn{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=i?i[s].n:0,c=i?i[s].state:this,d=a<n.length&&l.spec.appendTransaction.call(l,a?n.slice(a):n,c,r);if(d&&r.filterTransaction(d,s)){if(d.setMeta("appendedTransaction",e),!i){i=[];for(let f=0;f<this.config.plugins.length;f++)i.push(f<s?{state:r,n:n.length}:{state:this,n:0})}n.push(d),r=r.applyInner(d),o=!0}i&&(i[s]={state:r,n:n.length})}}if(!o)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Yn(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];n[o.name]=o.apply(e,this[o.name],this,n)}return n}get tr(){return new Ny(this)}static create(e){let n=new Go(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Yn(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new Go(this.schema,e.plugins),r=n.fields,i=new Yn(n);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],o=i.spec.state;o&&o.toJSON&&(n[r]=o.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Go(e.schema,e.plugins),o=new Yn(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=bn.fromJSON(e.schema,n.doc);else if(s.name=="selection")o.selection=J.fromJSON(o.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){o[s.name]=c.fromJSON.call(a,e,n[l],o);return}}o[s.name]=s.init(e,o)}}),o}}function rc(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=rc(i,e,{})),n[r]=i}return n}class De{constructor(e){this.spec=e,this.props={},e.props&&rc(e.props,this,this.props),this.key=e.key?e.key.key:ic("plugin")}getState(e){return e[this.key]}}const Yo=Object.create(null);function ic(t){return t in Yo?t+"$"+ ++Yo[t]:(Yo[t]=0,t+"$")}class pt{constructor(e="key"){this.key=ic(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Oe=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Ir=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Zo=null;const $t=function(t,e,n){let r=Zo||(Zo=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},Dy=function(){Zo=null},kn=function(t,e,n,r){return n&&(oc(t,e,n,r,-1)||oc(t,e,n,r,1))},By=/^(img|br|input|textarea|hr)$/i;function oc(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:St(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Pr(t)||By.test(t.nodeName)||t.contentEditable=="false")return!1;e=Oe(t)+(i<0?0:1),t=o}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.contentEditable=="false")return!1;e=i<0?St(t):0}else return!1}}function St(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Vy(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=St(t)}else if(t.parentNode&&!Pr(t))e=Oe(t),t=t.parentNode;else return null}}function Iy(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Pr(t))e=Oe(t)+1,t=t.parentNode;else return null}}function Py(t,e,n){for(let r=e==0,i=e==St(t);r||i;){if(t==n)return!0;let o=Oe(t);if(t=t.parentNode,!t)return!1;r=r&&o==0,i=i&&o==St(t)}}function Pr(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Pi=function(t){return t.focusNode&&kn(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function wn(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function $y(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Ry(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:r.startOffset}}}const Ct=typeof navigator<"u"?navigator:null,sc=typeof document<"u"?document:null,Zt=Ct&&Ct.userAgent||"",Xo=/Edge\/(\d+)/.exec(Zt),lc=/MSIE \d/.exec(Zt),Qo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Zt),He=!!(lc||Qo||Xo),Xt=lc?document.documentMode:Qo?+Qo[1]:Xo?+Xo[1]:0,mt=!He&&/gecko\/(\d+)/i.test(Zt);mt&&+(/Firefox\/(\d+)/.exec(Zt)||[0,0])[1];const es=!He&&/Chrome\/(\d+)/.exec(Zt),Be=!!es,_y=es?+es[1]:0,Ve=!He&&!!Ct&&/Apple Computer/.test(Ct.vendor),Zn=Ve&&(/Mobile\/\w+/.test(Zt)||!!Ct&&Ct.maxTouchPoints>2),rt=Zn||(Ct?/Mac/.test(Ct.platform):!1),Ly=Ct?/Win/.test(Ct.platform):!1,gt=/Android \d/.test(Zt),$r=!!sc&&"webkitFontSmoothing"in sc.documentElement.style,zy=$r?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Fy(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Rt(t,e){return typeof t=="number"?t:t[e]}function jy(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function ac(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,o=t.dom.ownerDocument;for(let s=n||t.dom;s;s=Ir(s)){if(s.nodeType!=1)continue;let l=s,a=l==o.body,c=a?Fy(o):jy(l),d=0,f=0;if(e.top<c.top+Rt(r,"top")?f=-(c.top-e.top+Rt(i,"top")):e.bottom>c.bottom-Rt(r,"bottom")&&(f=e.bottom-e.top>c.bottom-c.top?e.top+Rt(i,"top")-c.top:e.bottom-c.bottom+Rt(i,"bottom")),e.left<c.left+Rt(r,"left")?d=-(c.left-e.left+Rt(i,"left")):e.right>c.right-Rt(r,"right")&&(d=e.right-c.right+Rt(i,"right")),d||f)if(a)o.defaultView.scrollBy(d,f);else{let h=l.scrollLeft,p=l.scrollTop;f&&(l.scrollTop+=f),d&&(l.scrollLeft+=d);let m=l.scrollLeft-h,y=l.scrollTop-p;e={left:e.left-m,top:e.top-y,right:e.right-m,bottom:e.bottom-y}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function Hy(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=t.root.elementFromPoint(o,s);if(!l||l==t.dom||!t.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:cc(t.dom)}}function cc(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Ir(r));return e}function Wy({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;dc(n,r==0?0:r-e)}function dc(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:o}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}let Xn=null;function Uy(t){if(t.setActive)return t.setActive();if(Xn)return t.focus(Xn);let e=cc(t);t.focus(Xn==null?{get preventScroll(){return Xn={preventScroll:!0},!0}}:void 0),Xn||(Xn=!1,dc(e,0))}function uc(t,e){let n,r=2e8,i,o=0,s=e.top,l=e.top,a,c;for(let d=t.firstChild,f=0;d;d=d.nextSibling,f++){let h;if(d.nodeType==1)h=d.getClientRects();else if(d.nodeType==3)h=$t(d).getClientRects();else continue;for(let p=0;p<h.length;p++){let m=h[p];if(m.top<=s&&m.bottom>=l){s=Math.max(m.bottom,s),l=Math.min(m.top,l);let y=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(y<r){n=d,r=y,i=y&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,d.nodeType==1&&y&&(o=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!a&&m.left<=e.left&&m.right>=e.left&&(a=d,c={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!n&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(o=f+1)}}return!n&&a&&(n=a,i=c,r=0),n&&n.nodeType==3?qy(n,i):!n||r&&n.nodeType==1?{node:t,offset:o}:uc(n,i)}function qy(t,e){let n=t.nodeValue.length,r=document.createRange();for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let o=Qt(r,1);if(o.top!=o.bottom&&ts(e,o))return{node:t,offset:i+(e.left>=(o.left+o.right)/2?1:0)}}return{node:t,offset:0}}function ts(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Ky(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Jy(t,e,n){let{node:r,offset:i}=uc(e,n),o=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();o=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,i,o)}function Gy(t,e,n,r){let i=-1;for(let o=e,s=!1;o!=t.dom;){let l=t.docView.nearestDesc(o,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)){let a=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&(!s&&a.left>r.left||a.top>r.top?i=l.posBefore:(!s&&a.right<r.left||a.bottom<r.top)&&(i=l.posAfter),s=!0),!l.contentDOM&&i<0&&!l.node.isText)return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter}o=l.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function fc(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),o=i;;){let s=t.childNodes[o];if(s.nodeType==1){let l=s.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(ts(e,c))return fc(s,e,c)}}if((o=(o+1)%r)==i)break}return t}function Yy(t,e){let n=t.dom.ownerDocument,r,i=0,o=Ry(n,e.left,e.top);o&&({node:r,offset:i}=o);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=t.dom.getBoundingClientRect();if(!ts(e,c)||(s=fc(t.dom,e,c),!s))return null}if(Ve)for(let c=s;r&&c;c=Ir(c))c.draggable&&(r=void 0);if(s=Ky(s,e),r){if(mt&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let d=r.childNodes[i],f;d.nodeName=="IMG"&&(f=d.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}let c;$r&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=Gy(t,r,i,e))}l==null&&(l=Jy(t,s,e));let a=t.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function hc(t){return t.top<t.bottom||t.left<t.right}function Qt(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(hc(r))return r}return Array.prototype.find.call(n,hc)||t.getBoundingClientRect()}const Zy=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function pc(t,e,n){let{node:r,offset:i,atom:o}=t.docView.domFromPos(e,n<0?-1:1),s=$r||mt;if(r.nodeType==3)if(s&&(Zy.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let a=Qt($t(r,i,i),n);if(mt&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=Qt($t(r,i-1,i-1),-1);if(c.top==a.top){let d=Qt($t(r,i,i+1),-1);if(d.top!=a.top)return Rr(d,d.left<c.left)}}return a}else{let a=i,c=i,d=n<0?1:-1;return n<0&&!i?(c++,d=-1):n>=0&&i==r.nodeValue.length?(a--,d=1):n<0?a--:c++,Rr(Qt($t(r,a,c),d),d<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==St(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return ns(a.getBoundingClientRect(),!1)}if(o==null&&i<St(r)){let a=r.childNodes[i];if(a.nodeType==1)return ns(a.getBoundingClientRect(),!0)}return ns(r.getBoundingClientRect(),n>=0)}if(o==null&&i&&(n<0||i==St(r))){let a=r.childNodes[i-1],c=a.nodeType==3?$t(a,St(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return Rr(Qt(c,1),!1)}if(o==null&&i<St(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?$t(a,0,s?0:1):a.nodeType==1?a:null:null;if(c)return Rr(Qt(c,-1),!0)}return Rr(Qt(r.nodeType==3?$t(r):r,-n),n>=0)}function Rr(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function ns(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function mc(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function Xy(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return mc(t,e,()=>{let{node:o}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(o,!0);if(!l)break;if(l.node.isBlock){o=l.contentDOM||l.dom;break}o=l.dom.parentNode}let s=pc(t,i.pos,1);for(let l=o.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=$t(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let d=a[c];if(d.bottom>d.top+1&&(n=="up"?s.top-d.top>(d.bottom-s.top)*2:d.bottom-s.bottom>(s.bottom-d.top)*2))return!1}}return!0})}const Qy=/[\u0590-\u08ac]/;function e0(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,l=t.domSelection();return!Qy.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?o:s:mc(t,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:d,anchorOffset:f}=t.domSelectionRange(),h=l.caretBidiLevel;l.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:m,focusOffset:y}=t.domSelectionRange(),g=m&&!p.contains(m.nodeType==1?m:m.parentNode)||a==m&&c==y;try{l.collapse(d,f),a&&(a!=d||c!=f)&&l.extend&&l.extend(a,c)}catch{}return h!=null&&(l.caretBidiLevel=h),g})}let gc=null,yc=null,bc=!1;function t0(t,e,n){return gc==e&&yc==n?bc:(gc=e,yc=n,bc=n=="up"||n=="down"?Xy(t,e,n):e0(t,e,n))}const it=0,vc=1,xn=2,Ot=3;class _r{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=it,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let o,s;if(e==this.contentDOM)o=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(s)+s.size:this.posAtStart}else{let o,s;if(e==this.contentDOM)o=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>Oe(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!n||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],o=r+i.size;if(r==e&&o!=r){for(;!i.border&&i.children.length;)i=i.children[0];return i}if(e<o)return i.descAt(e-r-i.border);r=o}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],l=o+s.size;if(l>e||s instanceof xc){i=e-o;break}o=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof kc&&o.side>=0;r--);if(n<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&n&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?Oe(o.dom)+1:0}}else{let o,s=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,s=!1);return o&&s&&!o.border&&!o.domAtom?o.domFromPos(0,n):{node:this.contentDOM,offset:o?Oe(o.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let s=r,l=0;;l++){let a=this.children[l],c=s+a.size;if(i==-1&&e<=c){let d=s+a.border;if(e>=d&&n<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,n,d);e=s;for(let f=l;f>0;f--){let h=this.children[f-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=Oe(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(c>n||l==this.children.length-1)){n=c;for(let d=l+1;d<this.children.length;d++){let f=this.children[d];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){o=Oe(f.dom);break}n+=f.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let o=Math.min(e,n),s=Math.max(e,n);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],y=p+m.size;if(o>p&&s<y)return m.setSelection(e-p-m.border,n-p-m.border,r,i);p=y}let l=this.domFromPos(e,e?-1:1),a=n==e?l:this.domFromPos(n,n?-1:1),c=r.getSelection(),d=!1;if((mt||Ve)&&e==n){let{node:h,offset:p}=l;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
10
- `),d&&p==h.nodeValue.length)for(let m=h,y;m;m=m.parentNode){if(y=m.nextSibling){y.nodeName=="BR"&&(l=a={node:y.parentNode,offset:Oe(y)+1});break}let g=m.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let m=h.childNodes[p-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(mt&&c.focusNode&&c.focusNode!=a.node&&c.focusNode.nodeType==1){let h=c.focusNode.childNodes[c.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||d&&Ve)&&kn(l.node,l.offset,c.anchorNode,c.anchorOffset)&&kn(a.node,a.offset,c.focusNode,c.focusOffset))return;let f=!1;if((c.extend||e==n)&&!d){c.collapse(l.node,l.offset);try{e!=n&&c.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>n){let p=l;l=a,a=p}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let o=this.children[i],s=r+o.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let l=r+o.border,a=s-o.border;if(e>=l&&n<=a){this.dirty=e==r||n==s?xn:vc,e==l&&n==a&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Ot:o.markDirty(e-l,n-l);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?xn:Ot}r=s}this.dirty=xn}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?xn:vc;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class kc extends _r{constructor(e,n,r,i){let o,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,o=this}matchesWidget(e){return this.dirty==it&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class n0 extends _r{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Sn extends _r{constructor(e,n,r,i){super(e,[],r,i),this.mark=n}static create(e,n,r,i){let o=i.nodeViews[n.type.name],s=o&&o(n,i,r);return(!s||!s.dom)&&(s=wt.renderSpec(document,n.type.spec.toDOM(n,r))),new Sn(e,n,s.dom,s.contentDOM||s.dom)}parseRule(){return this.dirty&Ot||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ot&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=it){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=it}}slice(e,n,r){let i=Sn.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;n<s&&(o=ss(o,n,s,r)),e>0&&(o=ss(o,0,e,r));for(let l=0;l<o.length;l++)o[l].parent=i;return i.children=o,i}}class en extends _r{constructor(e,n,r,i,o,s,l,a,c){super(e,[],o,s),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,n,r,i,o,s){let l=o.nodeViews[n.type.name],a,c=l&&l(n,o,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,i),d=c&&c.dom,f=c&&c.contentDOM;if(n.isText){if(!d)d=document.createTextNode(n.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:f}=wt.renderSpec(document,n.type.spec.toDOM(n)));!f&&!n.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),n.type.spec.draggable&&(d.draggable=!0));let h=d;return d=Oc(d,r,n),c?a=new r0(e,n,r,i,d,f||null,h,c,o,s+1):n.isText?new $i(e,n,r,i,d,h,o):new en(e,n,r,i,d,f||null,h,o,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>T.empty)}return e}matchesNode(e,n,r){return this.dirty==it&&e.eq(this.node)&&is(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,o=e.composing?this.localCompositionInfo(e,n):null,s=o&&o.pos>-1?o:null,l=o&&o.pos<0,a=new o0(this,s&&s.node,e);a0(this.node,this.innerDeco,(c,d,f)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!f&&a.syncToMarks(d==this.node.childCount?se.none:this.node.child(d).marks,r,e),a.placeWidget(c,e,i)},(c,d,f,h)=>{a.syncToMarks(c.marks,r,e);let p;a.findNodeMatch(c,d,f,h)||l&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(p=a.findIndexWithChild(o.node))>-1&&a.updateNodeAt(c,d,f,p,e)||a.updateNextNode(c,d,f,e,h,i)||a.addNode(c,d,f,e,i),i+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==xn)&&(s&&this.protectLocalComposition(e,s),Sc(this.contentDOM,this.children,e),Zn&&c0(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof U)||r<n||i>n+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,l=d0(this.node.content,s,r-n,i-n);return l<0?null:{node:o,pos:l,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new n0(this,o,n,i);e.input.compositionNodes.push(s),this.children=ss(this.children,r,r+i.length,e,s)}update(e,n,r,i){return this.dirty==Ot||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=it}updateOuterDeco(e){if(is(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Cc(this.dom,this.nodeDOM,rs(this.outerDeco,this.node,n),rs(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function wc(t,e,n,r,i){Oc(r,e,t);let o=new en(void 0,t,e,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class $i extends en{constructor(e,n,r,i,o,s,l){super(e,n,r,i,o,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==Ot||this.dirty!=it&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=it||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=it,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),o=document.createTextNode(i.text);return new $i(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Ot)}get domAtom(){return!1}isText(e){return this.node.text==e}}class xc extends _r{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==it&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class r0 extends en{constructor(e,n,r,i,o,s,l,a,c,d){super(e,n,r,i,o,s,l,c,d),this.spec=a}update(e,n,r,i){if(this.dirty==Ot)return!1;if(this.spec.update){let o=this.spec.update(e,n,r);return o&&this.updateInner(e,n,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Sc(t,e,n){let r=t.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],l=s.dom;if(l.parentNode==t){for(;l!=r;)r=Mc(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(l,r);if(s instanceof Sn){let a=r?r.previousSibling:t.lastChild;Sc(s.contentDOM,s.children,n),r=a?a.nextSibling:t.firstChild}}for(;r;)r=Mc(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const Lr=function(t){t&&(this.nodeName=t)};Lr.prototype=Object.create(null);const Cn=[new Lr];function rs(t,e,n){if(t.length==0)return Cn;let r=n?Cn[0]:new Lr,i=[r];for(let o=0;o<t.length;o++){let s=t[o].type.attrs;if(s){s.nodeName&&i.push(r=new Lr(s.nodeName));for(let l in s){let a=s[l];a!=null&&(n&&i.length==1&&i.push(r=new Lr(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return i}function Cc(t,e,n,r){if(n==Cn&&r==Cn)return e;let i=e;for(let o=0;o<r.length;o++){let s=r[o],l=n[o];if(o){let a;l&&l.nodeName==s.nodeName&&i!=t&&(a=i.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(i),l=Cn[0]),i=a}i0(i,l||Cn[0],s)}return i}function i0(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&t.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&t.classList.add(i[o]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function Oc(t,e,n){return Cc(t,t,Cn,rs(e,n,t.nodeType!=1))}function is(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Mc(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class o0{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=s0(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r){let i=0,o=this.stack.length>>1,s=Math.min(o,e.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=it,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){let c=this.top.children[a];if(c.matchesMark(e[o])&&!this.isLocked(c.dom)){l=a;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=Sn.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))o=this.top.children.indexOf(s,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){o=l;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,n,r,i,o){let s=this.top.children[i];return s.dirty==Ot&&s.dom==s.contentDOM&&(s.dirty=xn),s.update(e,n,r,o)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,o,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof en){let c=this.preMatch.matched.get(a);if(c!=null&&c!=o)return!1;let d=a.dom,f,h=this.isLocked(d)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=Ot&&is(n,a.outerDeco));if(!h&&a.update(e,n,r,i))return this.destroyBetween(this.index,l),a.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(f=this.recreateWrapper(a,e,n,r,i,s)))return this.top.children[this.index]=f,f.contentDOM&&(f.dirty=xn,f.updateChildren(i,s+1),f.dirty=it),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,o,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content))return null;let l=en.create(this.top,n,r,i,o,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,n,r,i,o){let s=en.create(this.top,e,n,r,i,o);s.contentDOM&&s.updateChildren(i,o+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let o=new kc(this.top,e,n,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Sn;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof $i)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ve||Be)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new xc(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function s0(t,e){let n=e,r=n.children.length,i=t.childCount,o=new Map,s=[];e:for(;i>0;){let l;for(;;)if(r){let c=n.children[r-1];if(c instanceof Sn)n=c,r=c.children.length;else{l=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=t.child(i-1))break;--i,o.set(l,i),s.push(l)}}return{index:i,matched:o,matches:s.reverse()}}function l0(t,e){return t.type.side-e.type.side}function a0(t,e,n,r){let i=e.locals(t),o=0;if(i.length==0){for(let c=0;c<t.childCount;c++){let d=t.child(c);r(d,i,e.forChild(o,d),c),o+=d.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let d,f;for(;s<i.length&&i[s].to==o;){let g=i[s++];g.widget&&(d?(f||(f=[d])).push(g):d=g)}if(d)if(f){f.sort(l0);for(let g=0;g<f.length;g++)n(f[g],c,!!a)}else n(d,c,!!a);let h,p;if(a)p=-1,h=a,a=null;else if(c<t.childCount)p=c,h=t.child(c++);else break;for(let g=0;g<l.length;g++)l[g].to<=o&&l.splice(g--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)l.push(i[s++]);let m=o+h.nodeSize;if(h.isText){let g=m;s<i.length&&i[s].from<g&&(g=i[s].from);for(let v=0;v<l.length;v++)l[v].to<g&&(g=l[v].to);g<m&&(a=h.cut(g-o),h=h.cut(0,g-o),m=g,p=-1)}else for(;s<i.length&&i[s].to<m;)s++;let y=h.isInline&&!h.isLeaf?l.filter(g=>!g.inline):l.slice();r(h,y,e.forChild(o,h),p),o=m}}function c0(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function d0(t,e,n,r){for(let i=0,o=0;i<t.childCount&&o<=r;){let s=t.child(i++),l=o;if(o+=s.nodeSize,!s.isText)continue;let a=s.text;for(;i<t.childCount;){let c=t.child(i++);if(o+=c.nodeSize,!c.isText)break;a+=c.text}if(o>=n){if(o>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=n)return l+c;if(n==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function ss(t,e,n,r,i){let o=[];for(let s=0,l=0;s<t.length;s++){let a=t[s],c=l,d=l+=a.size;c>=n||d<=e?o.push(a):(c<e&&o.push(a.slice(0,e-c,r)),i&&(o.push(i),i=void 0),d>n&&o.push(a.slice(n-c,a.size,r)))}return o}function ls(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),o=i&&i.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,c;if(Pi(n)){for(a=l;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&z.isSelectable(d)&&i.parent&&!(d.isInline&&Py(n.focusNode,n.focusOffset,i.dom))){let f=i.posBefore;c=new z(s==f?l:r.resolve(f))}}else{let d=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(d<0)return null;a=r.resolve(d)}if(!c){let d=e=="pointer"||t.state.selection.head<l.pos&&!o?1:-1;c=cs(t,a,l,d)}return c}function Ec(t){return t.editable?t.hasFocus():Ic(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function _t(t,e=!1){let n=t.state.selection;if(Dc(t,n),!!Ec(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Be){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&kn(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)f0(t);else{let{anchor:r,head:i}=n,o,s;Tc&&!(n instanceof U)&&(n.$from.parent.inlineContent||(o=Nc(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=Nc(t,n.to))),t.docView.setSelection(r,i,t.root,e),Tc&&(o&&Ac(o),s&&Ac(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&u0(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Tc=Ve||Be&&_y<63;function Nc(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(Ve&&i&&i.contentEditable=="false")return as(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return as(i);if(o)return as(o)}}function as(t){return t.contentEditable="true",Ve&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Ac(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function u0(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Ec(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function f0(t){let e=t.domSelection(),n=document.createRange(),r=t.cursorWrapper.dom,i=r.nodeName=="IMG";i?n.setEnd(r.parentNode,Oe(r)+1):n.setEnd(r,0),n.collapse(!1),e.removeAllRanges(),e.addRange(n),!i&&!t.state.selection.visible&&He&&Xt<=11&&(r.disabled=!0,r.disabled=!1)}function Dc(t,e){if(e instanceof z){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Bc(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Bc(t)}function Bc(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function cs(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||U.between(e,n,r)}function Vc(t){return t.editable&&!t.hasFocus()?!1:Ic(t)}function Ic(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function h0(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return kn(e.node,e.offset,n.anchorNode,n.anchorOffset)}function ds(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return o&&J.findFrom(o,e)}function tn(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Pc(t,e,n){let r=t.state.selection;if(r instanceof U)if(n.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=t.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return tn(t,new U(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=ds(t.state,e);return i&&i instanceof z?tn(t,i):!1}else if(!(rt&&n.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let l=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=t.docView.descAt(l))&&!s.contentDOM?z.isSelectable(o)?tn(t,new z(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):$r?tn(t,new U(t.state.doc.resolve(e<0?l:l+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof z&&r.node.isInline)return tn(t,new U(e>0?r.$to:r.$from));{let i=ds(t.state,e);return i?tn(t,i):!1}}}function Ri(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function zr(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Qn(t,e){return e<0?p0(t):m0(t)}function p0(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,o,s=!1;for(mt&&n.nodeType==1&&r<Ri(n)&&zr(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(zr(l,-1))i=n,o=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if($c(n))break;{let l=n.previousSibling;for(;l&&zr(l,-1);)i=n.parentNode,o=Oe(l),l=l.previousSibling;if(l)n=l,r=Ri(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?us(t,n,r):i&&us(t,i,o)}function m0(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Ri(n),o,s;for(;;)if(r<i){if(n.nodeType!=1)break;let l=n.childNodes[r];if(zr(l,1))o=n,s=++r;else break}else{if($c(n))break;{let l=n.nextSibling;for(;l&&zr(l,1);)o=l.parentNode,s=Oe(l)+1,l=l.nextSibling;if(l)n=l,r=0,i=Ri(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}o&&us(t,o,s)}function $c(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function g0(t,e){for(;t&&e==t.childNodes.length&&!Pr(t);)e=Oe(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function y0(t,e){for(;t&&!e&&!Pr(t);)e=Oe(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function us(t,e,n){if(e.nodeType!=3){let o,s;(s=g0(e,n))?(e=s,n=0):(o=y0(e,n))&&(e=o,n=o.nodeValue.length)}let r=t.domSelection();if(Pi(r)){let o=document.createRange();o.setEnd(e,n),o.setStart(e,n),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&_t(t)},50)}function Rc(t,e){let n=t.state.doc.resolve(e);if(!(Be||Ly)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let o=t.coordsAtPos(e-1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<n.end()){let o=t.coordsAtPos(e+1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function _c(t,e,n){let r=t.state.selection;if(r instanceof U&&!r.empty||n.indexOf("s")>-1||rt&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=ds(t.state,e);if(s&&s instanceof z)return tn(t,s)}if(!i.parent.inlineContent){let s=e<0?i:o,l=r instanceof ht?J.near(s,e):J.findFrom(s,e);return l?tn(t,l):!1}return!1}function Lc(t,e){if(!(t.state.selection instanceof U))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let s=t.state.tr;return e<0?s.delete(n.pos-o.nodeSize,n.pos):s.delete(n.pos,n.pos+o.nodeSize),t.dispatch(s),!0}return!1}function zc(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function b0(t){if(!Ve||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;zc(t,r,"true"),setTimeout(()=>zc(t,r,"false"),20)}return!1}function v0(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function k0(t,e){let n=e.keyCode,r=v0(e);if(n==8||rt&&n==72&&r=="c")return Lc(t,-1)||Qn(t,-1);if(n==46&&!e.shiftKey||rt&&n==68&&r=="c")return Lc(t,1)||Qn(t,1);if(n==13||n==27)return!0;if(n==37||rt&&n==66&&r=="c"){let i=n==37?Rc(t,t.state.selection.from)=="ltr"?-1:1:-1;return Pc(t,i,r)||Qn(t,i)}else if(n==39||rt&&n==70&&r=="c"){let i=n==39?Rc(t,t.state.selection.from)=="ltr"?1:-1:1;return Pc(t,i,r)||Qn(t,i)}else{if(n==38||rt&&n==80&&r=="c")return _c(t,-1,r)||Qn(t,-1);if(n==40||rt&&n==78&&r=="c")return b0(t)||_c(t,1,r)||Qn(t,1);if(r==(rt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Fc(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=t.someProp("clipboardSerializer")||wt.fromSchema(t.state.schema),l=Gc(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,d,f=0;for(;c&&c.nodeType==1&&(d=Kc[c.nodeName.toLowerCase()]);){for(let p=d.length-1;p>=0;p--){let m=l.createElement(d[p]);for(;a.firstChild;)m.appendChild(a.firstChild);a.appendChild(m),f++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${o}${f?` -${f}`:""} ${JSON.stringify(n)}`);let h=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,`
11
-
12
- `);return{dom:a,text:h,slice:e}}function jc(t,e,n,r,i){let o=i.parent.type.spec.code,s,l;if(!n&&!e)return null;let a=e&&(r||o||!n);if(a){if(t.someProp("transformPastedText",h=>{e=h(e,o||r,t)}),o)return e?new I(T.from(t.state.schema.text(e.replace(/\r\n?/g,`
13
- `))),0,0):I.empty;let f=t.someProp("clipboardTextParser",h=>h(e,i,r,t));if(f)l=f;else{let h=i.marks(),{schema:p}=t.state,m=wt.fromSchema(p);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(y=>{let g=s.appendChild(document.createElement("p"));y&&g.appendChild(m.serializeNode(p.text(y,h)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),s=S0(n),$r&&C0(s);let c=s&&s.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let f=+d[3];f>0;f--){let h=s.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;s=h}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||jn.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||d),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!w0.test(h.parentNode.nodeName)?{ignore:!0}:null}})),d)l=O0(qc(l,+d[1],+d[2]),d[4]);else if(l=I.maxOpen(x0(l.content,i),!0),l.openStart||l.openEnd){let f=0,h=0;for(let p=l.content.firstChild;f<l.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=l.content.lastChild;h<l.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);l=qc(l,f,h)}return t.someProp("transformPasted",f=>{l=f(l,t)}),l}const w0=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function x0(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),o,s=[];if(t.forEach(l=>{if(!s)return;let a=i.findWrapping(l.type),c;if(!a)return s=null;if(c=s.length&&o.length&&Wc(a,o,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=Uc(s[s.length-1],o.length));let d=Hc(l,a);s.push(d),i=i.matchType(d.type),o=a}}),s)return T.from(s)}return t}function Hc(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,T.from(t));return t}function Wc(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let o=Wc(t,e,n,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(T.from(Hc(n,t,i+1))))}}function Uc(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Uc(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(T.empty,!0);return t.copy(n.append(r))}function fs(t,e,n,r,i,o){let s=e<0?t.firstChild:t.lastChild,l=s.content;return t.childCount>1&&(o=0),i<r-1&&(l=fs(l,e,n,r,i+1,o)),i>=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,o<=i).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(T.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function qc(t,e,n){return e<t.openStart&&(t=new I(fs(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new I(fs(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Kc={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Jc=null;function Gc(){return Jc||(Jc=document.implementation.createHTMLDocument("title"))}function S0(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Gc().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&Kc[r[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>"</"+o+">").reverse().join("")),n.innerHTML=t,i)for(let o=0;o<i.length;o++)n=n.querySelector(i[o])||n;return n}function C0(t){let e=t.querySelectorAll(Be?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function O0(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:o,openEnd:s}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=T.from(a.create(r[l+1],i)),o++,s++}return new I(i,o,s)}const Ie={},Pe={},M0={touchstart:!0,touchmove:!0};class E0{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function T0(t){for(let e in Ie){let n=Ie[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{A0(t,r)&&!ps(t,r)&&(t.editable||!(r.type in Pe))&&n(t,r)},M0[e]?{passive:!0}:void 0)}Ve&&t.dom.addEventListener("input",()=>null),hs(t)}function nn(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function N0(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function hs(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>ps(t,r))})}function ps(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function A0(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function D0(t,e){!ps(t,e)&&Ie[e.type]&&(t.editable||!(e.type in Pe))&&Ie[e.type](t,e)}Pe.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Zc(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(gt&&Be&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Zn&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,wn(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||k0(t,n)?n.preventDefault():nn(t,"key")},Pe.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)},Pe.keypress=(t,e)=>{let n=e;if(Zc(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||rt&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof U)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode);!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i))&&t.dispatch(t.state.tr.insertText(i).scrollIntoView()),n.preventDefault()}};function _i(t){return{left:t.clientX,top:t.clientY}}function B0(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function ms(t,e,n,r,i){if(r==-1)return!1;let o=t.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(t.someProp(e,l=>s>o.depth?l(t,n,o.nodeAfter,o.before(s),i,!0):l(t,n,o.node(s),o.before(s),i,!1)))return!0;return!1}function er(t,e,n){t.focused||t.focus();let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function V0(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&z.isSelectable(r)?(er(t,new z(n)),!0):!1}function I0(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof z&&(r=n.node);let o=t.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let l=s>o.depth?o.nodeAfter:o.node(s);if(z.isSelectable(l)){r&&n.$from.depth>0&&s>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?i=o.before(n.$from.depth):i=o.before(s);break}}return i!=null?(er(t,z.create(t.state.doc,i)),!0):!1}function P0(t,e,n,r,i){return ms(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>o(t,e,r))||(i?I0(t,n):V0(t,n))}function $0(t,e,n,r){return ms(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function R0(t,e,n,r){return ms(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||_0(t,n,r)}function _0(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(er(t,U.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),l=i.before(o);if(s.inlineContent)er(t,U.create(r,l+1,l+1+s.content.size));else if(z.isSelectable(s))er(t,z.create(r,l));else continue;return!0}}function gs(t){return Li(t)}const Yc=rt?"metaKey":"ctrlKey";Ie.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=gs(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&B0(n,t.input.lastClick)&&!n[Yc]&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o};let s=t.posAtCoords(_i(n));s&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new L0(t,s,n,!!r)):(o=="doubleClick"?$0:R0)(t,s.pos,s.inside,n)?n.preventDefault():nn(t,"pointer"))};class L0{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Yc],this.allowDefault=r.shiftKey;let o,s;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),s=n.inside;else{let d=e.state.doc.resolve(n.pos);o=d.parent,s=d.depth?d.before():0}const l=i?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.dom.nodeType==1?a.dom:null;let{selection:c}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof z&&c.from<=s&&c.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&mt&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),nn(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>_t(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(_i(e))),this.updateAllowDefault(e),this.allowDefault||!n?nn(this.view,"pointer"):P0(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ve&&this.mightDrag&&!this.mightDrag.node.isAtom||Be&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(er(this.view,J.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):nn(this.view,"pointer")}move(e){this.updateAllowDefault(e),nn(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Ie.touchstart=t=>{t.input.lastTouch=Date.now(),gs(t),nn(t,"pointer")},Ie.touchmove=t=>{t.input.lastTouch=Date.now(),nn(t,"pointer")},Ie.contextmenu=t=>gs(t);function Zc(t,e){return t.composing?!0:Ve&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const z0=gt?5e3:-1;Pe.compositionstart=Pe.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),Li(t,!0),t.markCursor=null;else if(Li(t),mt&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){t.domSelection().collapse(s,s.nodeValue.length);break}else i=s,o=-1}}t.input.composing=!0}Xc(t,z0)},Pe.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Xc(t,20))};function Xc(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Li(t),e))}function Qc(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=j0());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function F0(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=Vy(e.focusNode,e.focusOffset),r=Iy(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,o=t.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function j0(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Li(t,e=!1){if(!(gt&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Qc(t),e||t.docView&&t.docView.dirty){let n=ls(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):t.updateState(t.state),!0}return!1}}function H0(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Fr=He&&Xt<15||Zn&&zy<604;Ie.copy=Pe.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let o=Fr?null:n.clipboardData,s=r.content(),{dom:l,text:a}=Fc(t,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",l.innerHTML),o.setData("text/plain",a)):H0(t,l),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function W0(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function U0(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?jr(t,r.value,null,i,e):jr(t,r.textContent,r.innerHTML,i,e)},50)}function jr(t,e,n,r,i){let o=jc(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,i,o||I.empty)))return!0;if(!o)return!1;let s=W0(o),l=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(o);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function ed(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Pe.paste=(t,e)=>{let n=e;if(t.composing&&!gt)return;let r=Fr?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&jr(t,ed(r),r.getData("text/html"),i,n)?n.preventDefault():U0(t,n)};class td{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const nd=rt?"altKey":"ctrlKey";Ie.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,o=i.empty?null:t.posAtCoords(_i(n)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof z?i.to-1:i.to))){if(r&&r.mightDrag)s=z.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(s=z.create(t.state.doc,f.posBefore))}}let l=(s||t.state.selection).content(),{dom:a,text:c,slice:d}=Fc(t,l);n.dataTransfer.clearData(),n.dataTransfer.setData(Fr?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",Fr||n.dataTransfer.setData("text/plain",c),t.dragging=new td(d,!n[nd],s)},Ie.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)},Pe.dragover=Pe.dragenter=(t,e)=>e.preventDefault(),Pe.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let i=t.posAtCoords(_i(n));if(!i)return;let o=t.state.doc.resolve(i.pos),s=r&&r.slice;s?t.someProp("transformPasted",m=>{s=m(s,t)}):s=jc(t,ed(n.dataTransfer),Fr?null:n.dataTransfer.getData("text/html"),!1,o);let l=!!(r&&!n[nd]);if(t.someProp("handleDrop",m=>m(t,n,s||I.empty,l))){n.preventDefault();return}if(!s)return;n.preventDefault();let a=s?qa(t.state.doc,o.pos,s):o.pos;a==null&&(a=o.pos);let c=t.state.tr;if(l){let{node:m}=r;m?m.replace(c):c.deleteSelection()}let d=c.mapping.map(a),f=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,h=c.doc;if(f?c.replaceRangeWith(d,d,s.content.firstChild):c.replaceRange(d,d,s),c.doc.eq(h))return;let p=c.doc.resolve(d);if(f&&z.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new z(p));else{let m=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((y,g,v,C)=>m=C),c.setSelection(cs(t,p,c.doc.resolve(m)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))},Ie.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&_t(t)},20))},Ie.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},Ie.beforeinput=(t,e)=>{if(Be&&gt&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",o=>o(t,wn(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Pe)Ie[t]=Pe[t];function Hr(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class zi{constructor(e,n){this.toDOM=e,this.spec=n||On,this.side=this.spec.side||0}map(e,n,r,i){let{pos:o,deleted:s}=e.mapResult(n.from+i,this.side<0?-1:1);return s?null:new Ye(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof zi&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Hr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class rn{constructor(e,n){this.attrs=e,this.spec=n||On}map(e,n,r,i){let o=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new Ye(o,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof rn&&Hr(this.attrs,e.attrs)&&Hr(this.spec,e.spec)}static is(e){return e.type instanceof rn}destroy(){}}class ys{constructor(e,n){this.attrs=e,this.spec=n||On}map(e,n,r,i){let o=e.mapResult(n.from+i,1);if(o.deleted)return null;let s=e.mapResult(n.to+i,-1);return s.deleted||s.pos<=o.pos?null:new Ye(o.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),o;return i==n.from&&!(o=e.child(r)).isText&&i+o.nodeSize==n.to}eq(e){return this==e||e instanceof ys&&Hr(this.attrs,e.attrs)&&Hr(this.spec,e.spec)}destroy(){}}class Ye{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Ye(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Ye(e,e,new zi(n,r))}static inline(e,n,r,i){return new Ye(e,n,new rn(r,i))}static node(e,n,r,i){return new Ye(e,n,new ys(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof rn}get widget(){return this.type instanceof zi}}const tr=[],On={};class he{constructor(e,n){this.local=e.length?e:tr,this.children=n.length?n:tr}static create(e,n){return n.length?Fi(n,e,0,On):Te}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,o){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=n&&l.to>=e&&(!o||o(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,n-l,r,i+l,o)}}map(e,n,r){return this==Te||e.maps.length==0?this:this.mapInner(e,n,0,0,r||On)}mapInner(e,n,r,i,o){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,i);a&&a.type.valid(n,a)?(s||(s=[])).push(a):o.onRemove&&o.onRemove(this.local[l].spec)}return this.children.length?q0(this.children,s||[],e,n,r,i,o):s?new he(s.sort(Mn),tr):Te}add(e,n){return n.length?this==Te?he.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,o=0;e.forEach((l,a)=>{let c=a+r,d;if(d=id(n,l,c)){for(i||(i=this.children.slice());o<i.length&&i[o]<a;)o+=3;i[o]==a?i[o+2]=i[o+2].addInner(l,d,c+1):i.splice(o,0,a,a+l.nodeSize,Fi(d,l,c+1,On)),o+=3}});let s=rd(o?od(n):n,-r);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new he(s.length?this.local.concat(s).sort(Mn):this.local,i||this.children)}remove(e){return e.length==0||this==Te?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,l=r[o]+n,a=r[o+1]+n;for(let d=0,f;d<e.length;d++)(f=e[d])&&f.from>l&&f.to<a&&(e[d]=null,(s||(s=[])).push(f));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[o+2].removeInner(s,l+1);c!=Te?r[o+2]=c:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,s;o<e.length;o++)if(s=e[o])for(let l=0;l<i.length;l++)i[l].eq(s,n)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new he(i,r):Te}forChild(e,n){if(this==Te)return this;if(n.isLeaf)return he.empty;let r,i;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let o=e+1,s=o+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>o&&a.type instanceof rn){let c=Math.max(o,a.from)-o,d=Math.min(s,a.to)-o;c<d&&(i||(i=[])).push(a.copy(c,d))}}if(i){let l=new he(i.sort(Mn),tr);return r?new on([l,r]):l}return r||Te}eq(e){if(this==e)return!0;if(!(e instanceof he)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return bs(this.localsInner(e))}localsInner(e){if(this==Te)return tr;if(e.inlineContent||!this.local.some(rn.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof rn||n.push(this.local[r]);return n}}he.empty=new he([],[]),he.removeOverlap=bs;const Te=he.empty;class on{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,On));return on.from(r)}forChild(e,n){if(n.isLeaf)return he.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,n);o!=Te&&(o instanceof on?r=r.concat(o.members):r.push(o))}return on.from(r)}eq(e){if(!(e instanceof on)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!n)n=o;else{r&&(n=n.slice(),r=!1);for(let s=0;s<o.length;s++)n.push(o[s])}}return n?bs(r?n:n.sort(Mn)):tr}static from(e){switch(e.length){case 0:return Te;case 1:return e[0];default:return new on(e.every(n=>n instanceof he)?e:e.reduce((n,r)=>n.concat(r instanceof he?r:r.members),[]))}}}function q0(t,e,n,r,i,o,s){let l=t.slice();for(let c=0,d=o;c<n.maps.length;c++){let f=0;n.maps[c].forEach((h,p,m,y)=>{let g=y-m-(p-h);for(let v=0;v<l.length;v+=3){let C=l[v+1];if(C<0||h>C+d-f)continue;let M=l[v]+d-f;p>=M?l[v+1]=h<=M?-2:-1:h>=d&&g&&(l[v]+=g,l[v+1]+=g)}f+=g}),d=n.maps[c].map(d,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let d=n.map(t[c]+o),f=d-i;if(f<0||f>=r.content.size){a=!0;continue}let h=n.map(t[c+1]+o,-1),p=h-i,{index:m,offset:y}=r.content.findIndex(f),g=r.maybeChild(m);if(g&&y==f&&y+g.nodeSize==p){let v=l[c+2].mapInner(n,g,d+1,t[c]+o+1,s);v!=Te?(l[c]=f,l[c+1]=p,l[c+2]=v):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=K0(l,t,e,n,i,o,s),d=Fi(c,r,0,s);e=d.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,h=0;f<d.children.length;f+=3){let p=d.children[f];for(;h<l.length&&l[h]<p;)h+=3;l.splice(h,0,d.children[f],d.children[f+1],d.children[f+2])}}return new he(e.sort(Mn),l)}function rd(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new Ye(i.from+e,i.to+e,i.type))}return n}function K0(t,e,n,r,i,o,s){function l(a,c){for(let d=0;d<a.local.length;d++){let f=a.local[d].map(r,i,c);f?n.push(f):s.onRemove&&s.onRemove(a.local[d].spec)}for(let d=0;d<a.children.length;d+=3)l(a.children[d+2],a.children[d]+c+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+o+1);return n}function id(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let o=0,s;o<t.length;o++)(s=t[o])&&s.from>n&&s.to<r&&((i||(i=[])).push(s),t[o]=null);return i}function od(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Fi(t,e,n,r){let i=[],o=!1;e.forEach((l,a)=>{let c=id(t,l,a+n);if(c){o=!0;let d=Fi(c,l,n+a+1,r);d!=Te&&i.push(a,a+l.nodeSize,d)}});let s=rd(o?od(t):t,-n).sort(Mn);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(r.onRemove&&r.onRemove(s[l].spec),s.splice(l--,1));return s.length||i.length?new he(s,i):Te}function Mn(t,e){return t.from-e.from||t.to-e.to}function bs(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==t&&(e=t.slice()),e[i]=o.copy(o.from,r.to),sd(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,o.from),sd(e,i,r.copy(o.from,r.to)));break}}}return e}function sd(t,e,n){for(;e<t.length&&Mn(n,t[e])>0;)e++;t.splice(e,0,n)}function vs(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Te&&e.push(r)}),t.cursorWrapper&&e.push(he.create(t.state.doc,[t.cursorWrapper.deco])),on.from(e)}const J0={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},G0=He&&Xt<=11;class Y0{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Z0{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Y0,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);He&&Xt<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),G0&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,J0)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Vc(this.view)){if(this.suppressingSelectionUpdates)return _t(this.view);if(He&&Xt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&kn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let o=e.focusNode;o;o=Ir(o))n.add(o);for(let o=e.anchorNode;o;o=Ir(o))if(n.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Vc(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,l=!1,a=[];if(e.editable)for(let d=0;d<n.length;d++){let f=this.registerMutation(n[d],a);f&&(o=o<0?f.from:Math.min(f.from,o),s=s<0?f.to:Math.max(f.to,s),f.typeOver&&(l=!0))}if(mt&&a.length){let d=a.filter(f=>f.nodeName=="BR");if(d.length==2){let[f,h]=d;f.parentNode&&f.parentNode.parentNode==h.parentNode?h.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let h of d){let p=h.parentNode;p&&p.nodeName=="LI"&&(!f||eb(e,f)!=p)&&h.remove()}}}let c=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Pi(r)&&(c=ls(e))&&c.eq(J.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,_t(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),X0(e)),this.handleDOMChange(o,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||_t(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let f=e.addedNodes[d];n.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,o=e.nextSibling;if(He&&Xt<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:f,nextSibling:h}=e.addedNodes[d];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(o=h)}let s=i&&i.parentNode==e.target?Oe(i)+1:0,l=r.localPosFromDOM(e.target,s,-1),a=o&&o.parentNode==e.target?Oe(o):e.target.childNodes.length,c=r.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let ld=new WeakMap,ad=!1;function X0(t){if(!ld.has(t)&&(ld.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=mt,ad)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),ad=!0}}function cd(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return kn(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function Q0(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return cd(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?cd(t,n):null}function eb(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function tb(t,e,n){let{node:r,fromOffset:i,toOffset:o,from:s,to:l}=t.docView.parseRange(e,n),a=t.domSelectionRange(),c,d=a.anchorNode;if(d&&t.dom.contains(d.nodeType==1?d:d.parentNode)&&(c=[{node:d,offset:a.anchorOffset}],Pi(a)||c.push({node:a.focusNode,offset:a.focusOffset})),Be&&t.input.lastKeyCode===8)for(let g=o;g>i;g--){let v=r.childNodes[g-1],C=v.pmViewDesc;if(v.nodeName=="BR"&&!C){o=g;break}if(!C||C.size)break}let f=t.state.doc,h=t.someProp("domParser")||jn.fromSchema(t.state.schema),p=f.resolve(s),m=null,y=h.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:o,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:nb,context:p});if(c&&c[0].pos!=null){let g=c[0].pos,v=c[1]&&c[1].pos;v==null&&(v=g),m={anchor:g+s,head:v+s}}return{doc:y,sel:m,from:s,to:l}}function nb(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Ve&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Ve&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const rb=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function ib(t,e,n,r,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let A=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,L=ls(t,A);if(L&&!t.state.selection.eq(L)){if(Be&&gt&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",q=>q(t,wn(13,"Enter"))))return;let Y=t.state.tr.setSelection(L);A=="pointer"?Y.setMeta("pointer",!0):A=="key"&&Y.scrollIntoView(),o&&Y.setMeta("composition",o),t.dispatch(Y)}return}let s=t.state.doc.resolve(e),l=s.sharedDepth(n);e=s.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,c=tb(t,e,n),d=t.state.doc,f=d.slice(c.from,c.to),h,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(h=t.state.selection.to,p="end"):(h=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let m=lb(f.content,c.doc.content,c.from,h,p);if((Zn&&t.input.lastIOSEnter>Date.now()-225||gt)&&i.some(A=>A.nodeType==1&&!rb.test(A.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",A=>A(t,wn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(r&&a instanceof U&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let A=dd(t,t.state.doc,c.sel);if(A&&!A.eq(t.state.selection)){let L=t.state.tr.setSelection(A);o&&L.setMeta("composition",o),t.dispatch(L)}}return}t.input.domChangeCount++,t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof U&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),He&&Xt<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>c.from&&c.doc.textBetween(m.start-c.from-1,m.start-c.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let y=c.doc.resolveNoCache(m.start-c.from),g=c.doc.resolveNoCache(m.endB-c.from),v=d.resolve(m.start),C=y.sameParent(g)&&y.parent.inlineContent&&v.end()>=m.endA,M;if((Zn&&t.input.lastIOSEnter>Date.now()-225&&(!C||i.some(A=>A.nodeName=="DIV"||A.nodeName=="P"))||!C&&y.pos<c.doc.content.size&&!y.sameParent(g)&&(M=J.findFrom(c.doc.resolve(y.pos+1),1,!0))&&M.head==g.pos)&&t.someProp("handleKeyDown",A=>A(t,wn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&sb(d,m.start,m.endA,y,g)&&t.someProp("handleKeyDown",A=>A(t,wn(8,"Backspace")))){gt&&Be&&t.domObserver.suppressSelectionUpdates();return}Be&&gt&&m.endB==m.start&&(t.input.lastAndroidDelete=Date.now()),gt&&!C&&y.start()!=g.start()&&g.parentOffset==0&&y.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,g=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(A){return A(t,wn(13,"Enter"))})},20));let b=m.start,O=m.endA,S,D,V;if(C){if(y.pos==g.pos)He&&Xt<=11&&y.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>_t(t),20)),S=t.state.tr.delete(b,O),D=d.resolve(m.start).marksAcross(d.resolve(m.endA));else if(m.endA==m.endB&&(V=ob(y.parent.content.cut(y.parentOffset,g.parentOffset),v.parent.content.cut(v.parentOffset,m.endA-v.start()))))S=t.state.tr,V.type=="add"?S.addMark(b,O,V.mark):S.removeMark(b,O,V.mark);else if(y.parent.child(y.index()).isText&&y.index()==g.index()-(g.textOffset?0:1)){let A=y.parent.textBetween(y.parentOffset,g.parentOffset);if(t.someProp("handleTextInput",L=>L(t,b,O,A)))return;S=t.state.tr.insertText(A,b,O)}}if(S||(S=t.state.tr.replace(b,O,c.doc.slice(m.start-c.from,m.endB-c.from))),c.sel){let A=dd(t,S.doc,c.sel);A&&!(Be&&gt&&t.composing&&A.empty&&(m.start!=m.endB||t.input.lastAndroidDelete<Date.now()-100)&&(A.head==b||A.head==S.mapping.map(O)-1)||He&&A.empty&&A.head==b)&&S.setSelection(A)}D&&S.ensureMarks(D),o&&S.setMeta("composition",o),t.dispatch(S.scrollIntoView())}function dd(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:cs(t,e.resolve(n.anchor),e.resolve(n.head))}function ob(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,o=r,s,l,a;for(let d=0;d<r.length;d++)i=r[d].removeFromSet(i);for(let d=0;d<n.length;d++)o=n[d].removeFromSet(o);if(i.length==1&&o.length==0)l=i[0],s="add",a=d=>d.mark(l.addToSet(d.marks));else if(i.length==0&&o.length==1)l=o[0],s="remove",a=d=>d.mark(l.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<e.childCount;d++)c.push(a(e.child(d)));if(T.from(c).eq(t))return{mark:l,type:s}}function sb(t,e,n,r,i){if(n-e<=i.pos-r.pos||ks(r,!0,!1)<i.pos)return!1;let o=t.resolve(e);if(!r.parent.isTextblock){let l=o.nodeAfter;return l!=null&&n==e+l.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=t.resolve(ks(o,!0,!0));return!s.parent.isTextblock||s.pos>n||ks(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function ks(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let o=t.node(r).maybeChild(t.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function lb(t,e,n,r,i){let o=t.findDiffStart(e,n);if(o==null)return null;let{a:s,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let a=Math.max(0,o-Math.min(s,l));r-=s+a-o}if(s<o&&t.size<e.size){let a=r<=o&&r>=s?o-r:0;o-=a,o&&o<e.size&&ud(e.textBetween(o-1,o+1))&&(o+=a?1:-1),l=o+(l-s),s=o}else if(l<o){let a=r<=o&&r>=l?o-r:0;o-=a,o&&o<t.size&&ud(t.textBetween(o-1,o+1))&&(o+=a?1:-1),s=o+(s-l),l=o}return{start:o,endA:s,endB:l}}function ud(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class ab{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new E0,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(gd),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=pd(this),hd(this),this.nodeViews=md(this),this.docView=wc(this.state.doc,fd(this),vs(this),this.dom,this),this.domObserver=new Z0(this,(r,i,o,s)=>ib(this,r,i,o,s)),this.domObserver.start(),T0(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&hs(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(gd),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(Qc(this),s=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=md(this);db(p,this.nodeViews)&&(this.nodeViews=p,o=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&hs(this),this.editable=pd(this),hd(this);let a=vs(this),c=fd(this),d=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=o||!this.docView.matchesNode(e.doc,c,a);(f||!e.selection.eq(i.selection))&&(s=!0);let h=d=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Hy(this);if(s){this.domObserver.stop();let p=f&&(He||Be)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&cb(i.selection,e.selection);if(f){let m=Be?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=F0(this)),(o||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=wc(e.doc,c,a,this.dom,this)),m&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&h0(this))?_t(this,p):(Dc(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():h&&Wy(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof z){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&ac(this,n.getBoundingClientRect(),e)}else ac(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let o=r.from+(this.state.doc.content.size-n.doc.content.size);(o>0&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new td(e.slice,e.move,i<0?void 0:z.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(i=n?n(l):l))return i}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let l=o[s].props[e];if(l!=null&&(i=n?n(l):l))return i}}hasFocus(){if(He){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Uy(this.dom),_t(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Yy(this,e)}coordsAtPos(e,n=1){return pc(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return t0(this,n||this.state,e)}pasteHTML(e,n){return jr(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return jr(this,e,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(N0(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],vs(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Dy())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return D0(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return Ve&&this.root.nodeType===11&&$y(this.dom.ownerDocument)==this.dom&&Q0(this,e)||e}domSelection(){return this.root.getSelection()}}function fd(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Ye.node(0,t.state.doc.content.size,e)]}function hd(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Ye.widget(t.state.selection.head,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function pd(t){return!t.someProp("editable",e=>e(t.state)===!1)}function cb(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function md(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function db(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function gd(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var sn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ji={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ub=typeof navigator<"u"&&/Mac/.test(navigator.platform),fb=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Me=0;Me<10;Me++)sn[48+Me]=sn[96+Me]=String(Me);for(var Me=1;Me<=24;Me++)sn[Me+111]="F"+Me;for(var Me=65;Me<=90;Me++)sn[Me]=String.fromCharCode(Me+32),ji[Me]=String.fromCharCode(Me);for(var ws in sn)ji.hasOwnProperty(ws)||(ji[ws]=sn[ws]);function hb(t){var e=ub&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||fb&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?ji:sn)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const pb=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function mb(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,o,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))o=!0;else if(/^mod$/i.test(a))pb?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),s&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function gb(t){let e=Object.create(null);for(let n in t)e[mb(n)]=t[n];return e}function xs(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function yb(t){return new De({props:{handleKeyDown:yd(t)}})}function yd(t){let e=gb(t);return function(n,r){let i=hb(r),o,s=e[xs(i,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[xs(i,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(o=sn[r.keyCode])&&o!=i){let l=e[xs(o,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}const bb=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function bd(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const vb=(t,e,n)=>{let r=bd(t,n);if(!r)return!1;let i=Ss(r);if(!i){let s=r.blockRange(),l=s&&Un(s);return l==null?!1:(e&&e(t.tr.lift(s,l).scrollIntoView()),!0)}let o=i.nodeBefore;if(!o.type.spec.isolating&&xd(t,i,e))return!0;if(r.parent.content.size==0&&(nr(o,"end")||z.isSelectable(o))){let s=Bi(t.doc,r.before(),r.after(),I.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=t.tr.step(s);l.setSelection(nr(o,"end")?J.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):z.create(l.doc,i.pos-o.nodeSize)),e(l.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},kb=(t,e,n)=>{let r=bd(t,n);if(!r)return!1;let i=Ss(r);return i?vd(t,i,e):!1},wb=(t,e,n)=>{let r=kd(t,n);if(!r)return!1;let i=Cs(r);return i?vd(t,i,e):!1};function vd(t,e,n){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let d=i.lastChild;if(!d)return!1;i=d}let s=e.nodeAfter,l=s,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let d=l.firstChild;if(!d)return!1;l=d}let c=Bi(t.doc,o,a,I.empty);if(!c||c.from!=o||c instanceof ye&&c.slice.size>=a-o)return!1;if(n){let d=t.tr.step(c);d.setSelection(U.create(d.doc,o)),n(d.scrollIntoView())}return!0}function nr(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const xb=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;o=Ss(r)}let s=o&&o.nodeBefore;return!s||!z.isSelectable(s)?!1:(e&&e(t.tr.setSelection(z.create(t.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function Ss(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function kd(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Sb=(t,e,n)=>{let r=kd(t,n);if(!r)return!1;let i=Cs(r);if(!i)return!1;let o=i.nodeAfter;if(xd(t,i,e))return!0;if(r.parent.content.size==0&&(nr(o,"start")||z.isSelectable(o))){let s=Bi(t.doc,r.before(),r.after(),I.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=t.tr.step(s);l.setSelection(nr(o,"start")?J.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):z.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},Cb=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;o=Cs(r)}let s=o&&o.nodeAfter;return!s||!z.isSelectable(s)?!1:(e&&e(t.tr.setSelection(z.create(t.doc,o.pos)).scrollIntoView()),!0)};function Cs(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const Ob=(t,e)=>{let n=t.selection,r=n instanceof z,i;if(r){if(n.node.isTextblock||!Yt(t.doc,n.from))return!1;i=n.from}else if(i=Di(t.doc,n.from,-1),i==null)return!1;if(e){let o=t.tr.join(i);r&&o.setSelection(z.create(o.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},Mb=(t,e)=>{let n=t.selection,r;if(n instanceof z){if(n.node.isTextblock||!Yt(t.doc,n.to))return!1;r=n.to}else if(r=Di(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},Eb=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),o=i&&Un(i);return o==null?!1:(e&&e(t.tr.lift(i,o).scrollIntoView()),!0)},Tb=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
14
- `).scrollIntoView()),!0)};function wd(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Nb=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),s=wd(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,s.createAndFill());a.setSelection(J.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Ab=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof ht||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=wd(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,l=t.tr.insert(s,o.createAndFill());l.setSelection(U.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},Db=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(qn(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Un(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)},Bb=(t,e)=>{let{$from:n,to:r}=t.selection,i,o=n.sharedDepth(r);return o==0?!1:(i=n.before(o),e&&e(t.tr.setSelection(z.create(t.doc,i))),!0)};function Vb(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||Yt(t.doc,e.pos))?!1:(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function xd(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,o,s;if(r.type.spec.isolating||i.type.spec.isolating)return!1;if(Vb(t,e,n))return!0;let l=e.parent.canReplace(e.index(),e.index()+1);if(l&&(o=(s=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&s.matchType(o[0]||i.type).validEnd){if(n){let f=e.pos+i.nodeSize,h=T.empty;for(let y=o.length-1;y>=0;y--)h=T.from(o[y].create(null,h));h=T.from(r.copy(h));let p=t.tr.step(new be(e.pos-1,f,e.pos,f,new I(h,1,0),o.length,!0)),m=f+2*o.length;Yt(p.doc,m)&&p.join(m),n(p.scrollIntoView())}return!0}let a=J.findFrom(e,1),c=a&&a.$from.blockRange(a.$to),d=c&&Un(c);if(d!=null&&d>=e.depth)return n&&n(t.tr.lift(c,d).scrollIntoView()),!0;if(l&&nr(i,"start",!0)&&nr(r,"end")){let f=r,h=[];for(;h.push(f),!f.isTextblock;)f=f.lastChild;let p=i,m=1;for(;!p.isTextblock;p=p.firstChild)m++;if(f.canReplace(f.childCount,f.childCount,p.content)){if(n){let y=T.empty;for(let v=h.length-1;v>=0;v--)y=T.from(h[v].copy(y));let g=t.tr.step(new be(e.pos-h.length,e.pos+i.nodeSize,e.pos+m,e.pos+i.nodeSize-m,new I(y,h.length,0),0,!0));n(g.scrollIntoView())}return!0}}return!1}function Sd(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(n&&n(e.tr.setSelection(U.create(e.doc,t<0?i.start(o):i.end(o)))),!0):!1}}const Ib=Sd(-1),Pb=Sd(1);function $b(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),l=s&&Wo(s,t,e);return l?(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Cd(t,e=null){return function(n,r){let i=!1;for(let o=0;o<n.selection.ranges.length&&!i;o++){let{$from:{pos:s},$to:{pos:l}}=n.selection.ranges[o];n.doc.nodesBetween(s,l,(a,c)=>{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(t,e)))if(a.type==t)i=!0;else{let d=n.doc.resolve(c),f=d.index();i=d.parent.canReplaceWith(f,f+1,t)}})}if(!i)return!1;if(r){let o=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[s];o.setBlockType(l,a,t,e)}r(o.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Rb(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),l=!1,a=s;if(!s)return!1;if(s.depth>=2&&i.node(s.depth-1).type.compatibleContent(t)&&s.startIndex==0){if(i.index(s.depth-1)==0)return!1;let d=n.doc.resolve(s.start-2);a=new Ci(d,d,s.depth),s.endIndex<s.parent.childCount&&(s=new Ci(i,n.doc.resolve(o.end(s.depth)),s.depth)),l=!0}let c=Wo(a,t,e,s);return c?(r&&r(_b(n.tr,s,c,l,t).scrollIntoView()),!0):!1}}function _b(t,e,n,r,i){let o=T.empty;for(let d=n.length-1;d>=0;d--)o=T.from(n[d].type.create(n[d].attrs,o));t.step(new be(e.start-(r?2:0),e.end,e.start,e.end,new I(o,0,0),n.length,!0));let s=0;for(let d=0;d<n.length;d++)n[d].type==i&&(s=d+1);let l=n.length-s,a=e.start+n.length-(r?2:0),c=e.parent;for(let d=e.startIndex,f=e.endIndex,h=!0;d<f;d++,h=!1)!h&&qn(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=c.child(d).nodeSize;return t}function Lb(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,s=>s.childCount>0&&s.firstChild.type==t);return o?n?r.node(o.depth-1).type==t?zb(e,n,t,o):Fb(e,n,o):!0:!1}}function zb(t,e,n,r){let i=t.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new be(o-1,s,o,s,new I(T.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Ci(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const l=Un(r);if(l==null)return!1;i.lift(r,l);let a=i.mapping.map(o,-1)-1;return Yt(i.doc,a)&&i.join(a),e(i.scrollIntoView()),!0}function Fb(t,e,n){let r=t.tr,i=n.parent;for(let p=n.end,m=n.endIndex-1,y=n.startIndex;m>y;m--)p-=i.child(m).nodeSize,r.delete(p-1,p+1);let o=r.doc.resolve(n.start),s=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==i.childCount,c=o.node(-1),d=o.index(-1);if(!c.canReplace(d+(l?0:1),d+1,s.content.append(a?T.empty:T.from(i))))return!1;let f=o.pos,h=f+s.nodeSize;return r.step(new be(f-(l?1:0),h+(a?1:0),f+1,h-1,new I((l?T.empty:T.from(i.copy(T.empty))).append(a?T.empty:T.from(i.copy(T.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function jb(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==t);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let l=o.parent,a=l.child(s-1);if(a.type!=t)return!1;if(n){let c=a.lastChild&&a.lastChild.type==l.type,d=T.from(c?t.create():null),f=new I(T.from(t.create(null,T.from(l.type.create(null,d)))),c?3:1,0),h=o.start,p=o.end;n(e.tr.step(new be(h-(c?3:1),p,h,p,f,1,!0)).scrollIntoView())}return!0}}function Hi(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}class Wi{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:o}=r,s=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...d)=>{const f=a(...d)(s);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:o}=this,{view:s}=i,l=[],a=!!e,c=e||o.tr,d=()=>(!a&&n&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),l.every(h=>h===!0)),f={...Object.fromEntries(Object.entries(r).map(([h,p])=>[h,(...y)=>{const g=this.buildProps(c,n),v=p(...y)(g);return l.push(v),f}])),run:d};return f}createCan(e){const{rawCommands:n,state:r}=this,i=!1,o=e||r.tr,s=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(n).map(([a,c])=>[a,(...d)=>c(...d)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:o}=this,{view:s}=i,l={tr:e,editor:i,view:s,state:Hi({state:o,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([a,c])=>[a,(...d)=>c(...d)(l)]))}};return l}}class Hb{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,n)),this}off(e,n){const r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(i=>i!==n):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}}function R(t,e,n){return t.config[e]===void 0&&t.parent?R(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?R(t.parent,e,n):null}):t.config[e]}function Ui(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function Od(t){const e=[],{nodeExtensions:n,markExtensions:r}=Ui(t),i=[...n,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},a=R(s,"addGlobalAttributes",l);if(!a)return;a().forEach(d=>{d.types.forEach(f=>{Object.entries(d.attributes).forEach(([h,p])=>{e.push({type:f,name:h,attribute:{...o,...p}})})})})}),i.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},a=R(s,"addAttributes",l);if(!a)return;const c=a();Object.entries(c).forEach(([d,f])=>{const h={...o,...f};typeof(h==null?void 0:h.default)=="function"&&(h.default=h.default()),h!=null&&h.isRequired&&(h==null?void 0:h.default)===void 0&&delete h.default,e.push({type:s.name,name:d,attribute:h})})}),e}function ve(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function me(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){const l=o?o.split(" "):[],a=r[i]?r[i].split(" "):[],c=l.filter(d=>!a.includes(d));r[i]=[...a,...c].join(" ")}else i==="style"?r[i]=[r[i],o].join("; "):r[i]=o}),r},{})}function Os(t,e){return e.filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>me(n,r),{})}function Md(t){return typeof t=="function"}function G(t,e=void 0,...n){return Md(t)?e?t.bind(e)(...n):t(...n):t}function Wb(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Ub(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Ed(t,e){return t.style?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((o,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(n):Ub(n.getAttribute(s.name));return l==null?o:{...o,[s.name]:l}},{});return{...r,...i}}}}function Td(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&Wb(n)?!1:n!=null))}function qb(t,e){var n;const r=Od(t),{nodeExtensions:i,markExtensions:o}=Ui(t),s=(n=i.find(c=>R(c,"topNode")))===null||n===void 0?void 0:n.name,l=Object.fromEntries(i.map(c=>{const d=r.filter(v=>v.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((v,C)=>{const M=R(C,"extendNodeSchema",f);return{...v,...M?M(c):{}}},{}),p=Td({...h,content:G(R(c,"content",f)),marks:G(R(c,"marks",f)),group:G(R(c,"group",f)),inline:G(R(c,"inline",f)),atom:G(R(c,"atom",f)),selectable:G(R(c,"selectable",f)),draggable:G(R(c,"draggable",f)),code:G(R(c,"code",f)),defining:G(R(c,"defining",f)),isolating:G(R(c,"isolating",f)),attrs:Object.fromEntries(d.map(v=>{var C;return[v.name,{default:(C=v==null?void 0:v.attribute)===null||C===void 0?void 0:C.default}]}))}),m=G(R(c,"parseHTML",f));m&&(p.parseDOM=m.map(v=>Ed(v,d)));const y=R(c,"renderHTML",f);y&&(p.toDOM=v=>y({node:v,HTMLAttributes:Os(v,d)}));const g=R(c,"renderText",f);return g&&(p.toText=g),[c.name,p]})),a=Object.fromEntries(o.map(c=>{const d=r.filter(g=>g.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((g,v)=>{const C=R(v,"extendMarkSchema",f);return{...g,...C?C(c):{}}},{}),p=Td({...h,inclusive:G(R(c,"inclusive",f)),excludes:G(R(c,"excludes",f)),group:G(R(c,"group",f)),spanning:G(R(c,"spanning",f)),code:G(R(c,"code",f)),attrs:Object.fromEntries(d.map(g=>{var v;return[g.name,{default:(v=g==null?void 0:g.attribute)===null||v===void 0?void 0:v.default}]}))}),m=G(R(c,"parseHTML",f));m&&(p.parseDOM=m.map(g=>Ed(g,d)));const y=R(c,"renderHTML",f);return y&&(p.toDOM=g=>y({mark:g,HTMLAttributes:Os(g,d)})),[c.name,p]}));return new Gg({topNode:s,nodes:l,marks:a})}function Ms(t,e){return e.nodes[t]||e.marks[t]||null}function Nd(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}const Kb=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,o,s,l)=>{var a,c;const d=((c=(a=i.type.spec).toText)===null||c===void 0?void 0:c.call(a,{node:i,pos:o,parent:s,index:l}))||i.textContent||"%leaf%";n+=d.slice(0,Math.max(0,r-o))}),n};function Es(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class qi{constructor(e){this.find=e.find,this.handler=e.handler}}const Jb=(t,e)=>{if(Es(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function Ki(t){var e;const{editor:n,from:r,to:i,text:o,rules:s,plugin:l}=t,{view:a}=n;if(a.composing)return!1;const c=a.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(h=>h.type.spec.code))return!1;let d=!1;const f=Kb(c)+o;return s.forEach(h=>{if(d)return;const p=Jb(f,h.find);if(!p)return;const m=a.state.tr,y=Hi({state:a.state,transaction:m}),g={from:r-(p[0].length-o.length),to:i},{commands:v,chain:C,can:M}=new Wi({editor:n,state:y});h.handler({state:y,range:g,match:p,commands:v,chain:C,can:M})===null||!m.steps.length||(m.setMeta(l,{transform:m,from:r,to:i,text:o}),a.dispatch(m),d=!0)}),d}function Gb(t){const{editor:e,rules:n}=t,r=new De({state:{init(){return null},apply(i,o){const s=i.getMeta(r);if(s)return s;const l=i.getMeta("applyInputRules");return!!l&&setTimeout(()=>{const{from:c,text:d}=l,f=c+d.length;Ki({editor:e,from:c,to:f,text:d,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,s,l){return Ki({editor:e,from:o,to:s,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&Ki({editor:e,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:s}=i.state.selection;return s?Ki({editor:e,from:s.pos,to:s.pos,text:`
15
- `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function Yb(t){return typeof t=="number"}class Zb{constructor(e){this.find=e.find,this.handler=e.handler}}const Xb=(t,e,n)=>{if(Es(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const o=[i.text];return o.index=i.index,o.input=t,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function Qb(t){const{editor:e,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:l}=t,{commands:a,chain:c,can:d}=new Wi({editor:e,state:n}),f=[];return n.doc.nodesBetween(r,i,(p,m)=>{if(!p.isTextblock||p.type.spec.code)return;const y=Math.max(r,m),g=Math.min(i,m+p.content.size),v=p.textBetween(y-m,g-m,void 0,"");Xb(v,o.find,s).forEach(M=>{if(M.index===void 0)return;const b=y+M.index+1,O=b+M[0].length,S={from:n.tr.mapping.map(b),to:n.tr.mapping.map(O)},D=o.handler({state:n,range:S,match:M,commands:a,chain:c,can:d,pasteEvent:s,dropEvent:l});f.push(D)})}),f.every(p=>p!==null)}const ev=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function tv(t){const{editor:e,rules:n}=t;let r=null,i=!1,o=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l=typeof DragEvent<"u"?new DragEvent("drop"):null;const a=({state:d,from:f,to:h,rule:p,pasteEvt:m})=>{const y=d.tr,g=Hi({state:d,transaction:y});if(!(!Qb({editor:e,state:g,from:Math.max(f-1,0),to:h.b-1,rule:p,pasteEvent:m,dropEvent:l})||!y.steps.length))return l=typeof DragEvent<"u"?new DragEvent("drop"):null,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,y};return n.map(d=>new De({view(f){const h=p=>{var m;r=!((m=f.dom.parentElement)===null||m===void 0)&&m.contains(p.target)?f.dom.parentElement:null};return window.addEventListener("dragstart",h),{destroy(){window.removeEventListener("dragstart",h)}}},props:{handleDOMEvents:{drop:(f,h)=>(o=r===f.dom.parentElement,l=h,!1),paste:(f,h)=>{var p;const m=(p=h.clipboardData)===null||p===void 0?void 0:p.getData("text/html");return s=h,i=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(f,h,p)=>{const m=f[0],y=m.getMeta("uiEvent")==="paste"&&!i,g=m.getMeta("uiEvent")==="drop"&&!o,v=m.getMeta("applyPasteRules"),C=!!v;if(!y&&!g&&!C)return;if(C){const{from:O,text:S}=v,D=O+S.length,V=ev(S);return a({rule:d,state:p,from:O,to:{b:D},pasteEvt:V})}const M=h.doc.content.findDiffStart(p.doc.content),b=h.doc.content.findDiffEnd(p.doc.content);if(!(!Yb(M)||!b||M===b.b))return a({rule:d,state:p,from:M,to:b,pasteEvt:s})}}))}function nv(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return[...new Set(e)]}class rr{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=rr.resolve(e),this.schema=qb(this.extensions,n),this.setupExtensions()}static resolve(e){const n=rr.sort(rr.flatten(e)),r=nv(n.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{const r={name:n.name,options:n.options,storage:n.storage},i=R(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{const o=R(r,"priority")||100,s=R(i,"priority")||100;return o>s?-1:o<s?1:0})}get commands(){return this.extensions.reduce((e,n)=>{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:Ms(n.name,this.schema)},i=R(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=rr.sort([...this.extensions].reverse()),r=[],i=[],o=n.map(s=>{const l={name:s.name,options:s.options,storage:s.storage,editor:e,type:Ms(s.name,this.schema)},a=[],c=R(s,"addKeyboardShortcuts",l);let d={};if(s.type==="mark"&&s.config.exitable&&(d.ArrowRight=()=>Mt.handleExit({editor:e,mark:s})),c){const y=Object.fromEntries(Object.entries(c()).map(([g,v])=>[g,()=>v({editor:e})]));d={...d,...y}}const f=yb(d);a.push(f);const h=R(s,"addInputRules",l);Nd(s,e.options.enableInputRules)&&h&&r.push(...h());const p=R(s,"addPasteRules",l);Nd(s,e.options.enablePasteRules)&&p&&i.push(...p());const m=R(s,"addProseMirrorPlugins",l);if(m){const y=m();a.push(...y)}return a}).flat();return[Gb({editor:e,rules:r}),...tv({editor:e,rules:i}),...o]}get attributes(){return Od(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=Ui(this.extensions);return Object.fromEntries(n.filter(r=>!!R(r,"addNodeView")).map(r=>{const i=this.attributes.filter(a=>a.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:e,type:ve(r.name,this.schema)},s=R(r,"addNodeView",o);if(!s)return[];const l=(a,c,d,f)=>{const h=Os(a,i);return s()({editor:e,node:a,getPos:d,decorations:f,HTMLAttributes:h,extension:r})};return[r.name,l]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:Ms(e.name,this.schema)};e.type==="mark"&&(!((n=G(R(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=R(e,"onBeforeCreate",r),o=R(e,"onCreate",r),s=R(e,"onUpdate",r),l=R(e,"onSelectionUpdate",r),a=R(e,"onTransaction",r),c=R(e,"onFocus",r),d=R(e,"onBlur",r),f=R(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),f&&this.editor.on("destroy",f)})}}function rv(t){return Object.prototype.toString.call(t).slice(8,-1)}function Ts(t){return rv(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Ji(t,e){const n={...t};return Ts(t)&&Ts(e)&&Object.keys(e).forEach(r=>{Ts(e[r])?r in t?n[r]=Ji(t[r],e[r]):Object.assign(n,{[r]:e[r]}):Object.assign(n,{[r]:e[r]})}),n}class Ne{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=G(R(this,"addOptions",{name:this.name}))),this.storage=G(R(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ne(e)}configure(e={}){const n=this.extend();return n.parent=this.parent,n.options=Ji(this.options,e),n.storage=G(R(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){const n=new Ne({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=G(R(n,"addOptions",{name:n.name})),n.storage=G(R(n,"addStorage",{name:n.name,options:n.options})),n}}function Ad(t,e,n){const{from:r,to:i}=e,{blockSeparator:o=`
16
-
17
- `,textSerializers:s={}}=n||{};let l="";return t.nodesBetween(r,i,(a,c,d,f)=>{var h;a.isBlock&&c>r&&(l+=o);const p=s==null?void 0:s[a.type.name];if(p)return d&&(l+=p({node:a,pos:c,parent:d,index:f,range:e})),!1;a.isText&&(l+=(h=a==null?void 0:a.text)===null||h===void 0?void 0:h.slice(Math.max(r,c)-c,i-c))}),l}function Dd(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const iv=Ne.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new De({key:new pt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:o}=i,s=Math.min(...o.map(d=>d.$from.pos)),l=Math.max(...o.map(d=>d.$to.pos)),a=Dd(n);return Ad(r,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),ov=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),sv=(t=!1)=>({commands:e})=>e.setContent("",t),lv=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:o,$to:s})=>{t.doc.nodesBetween(o.pos,s.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:d}=e,f=c.resolve(d.map(a)),h=c.resolve(d.map(a+l.nodeSize)),p=f.blockRange(h);if(!p)return;const m=Un(p);if(l.type.isTextblock){const{defaultType:y}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(p.start,y)}(m||m===0)&&e.lift(p,m)})}),!0},av=t=>e=>t(e),cv=()=>({state:t,dispatch:e})=>Ab(t,e),dv=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,o=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const s=r.mapping.map(e);return r.insert(s,o.content),r.setSelection(new U(r.doc.resolve(s-1))),!0},uv=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){const l=i.before(o),a=i.after(o);t.delete(l,a).scrollIntoView()}return!0}return!1},fv=t=>({tr:e,state:n,dispatch:r})=>{const i=ve(t,n.schema),o=e.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===i){if(r){const a=o.before(s),c=o.after(s);e.delete(a,c).scrollIntoView()}return!0}return!1},hv=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},pv=()=>({state:t,dispatch:e})=>bb(t,e),mv=()=>({commands:t})=>t.keyboardShortcut("Enter"),gv=()=>({state:t,dispatch:e})=>Nb(t,e);function Gi(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:Es(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function Ns(t,e,n={}){return t.find(r=>r.type===e&&Gi(r.attrs,n))}function yv(t,e,n={}){return!!Ns(t,e,n)}function As(t,e,n={}){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if(t.parentOffset===r.offset&&r.offset!==0&&(r=t.parent.childBefore(t.parentOffset)),!r.node)return;const i=Ns([...r.node.marks],e,n);if(!i)return;let o=r.index,s=t.start()+r.offset,l=o+1,a=s+r.node.nodeSize;for(Ns([...r.node.marks],e,n);o>0&&i.isInSet(t.parent.child(o-1).marks);)o-=1,s-=t.parent.child(o).nodeSize;for(;l<t.parent.childCount&&yv([...t.parent.child(l).marks],e,n);)a+=t.parent.child(l).nodeSize,l+=1;return{from:s,to:a}}function ln(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const bv=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const o=ln(t,r.schema),{doc:s,selection:l}=n,{$from:a,from:c,to:d}=l;if(i){const f=As(a,o,e);if(f&&f.from<=c&&f.to>=d){const h=U.create(s,f.from,f.to);n.setSelection(h)}}return!0},vv=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function Ds(t){return t instanceof U}function Lt(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Bd(t,e=null){if(!e)return null;const n=J.atStart(t),r=J.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,o=r.to;return e==="all"?U.create(t,Lt(0,i,o),Lt(t.content.size,i,o)):U.create(t,Lt(e,i,o),Lt(e,i,o))}function Bs(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const kv=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const s=()=>{Bs()&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(o&&t===null&&!Ds(n.state.selection))return s(),!0;const l=Bd(i.doc,t)||n.state.selection,a=n.state.selection.eq(l);return o&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},wv=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),xv=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Vd=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&Vd(r)}return t};function Id(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return Vd(n)}function Yi(t,e,n){n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{return Array.isArray(t)&&t.length>0?T.fromArray(t.map(s=>e.nodeFromJSON(s))):e.nodeFromJSON(t)}catch(o){return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),Yi("",e,n)}if(i){const o=jn.fromSchema(e);return n.slice?o.parseSlice(Id(t),n.parseOptions).content:o.parse(Id(t),n.parseOptions)}return Yi("",e,n)}function Sv(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof ye||i instanceof be))return;const o=t.mapping.maps[r];let s=0;o.forEach((l,a,c,d)=>{s===0&&(s=d)}),t.setSelection(J.near(t.doc.resolve(s),n))}const Cv=t=>t.toString().startsWith("<"),Ov=(t,e,n)=>({tr:r,dispatch:i,editor:o})=>{if(i){n={parseOptions:{},updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};const s=Yi(e,o.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions}});if(s.toString()==="<>")return!0;let{from:l,to:a}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},c=!0,d=!0;if((Cv(s)?s:[s]).forEach(p=>{p.check(),c=c?p.isText&&p.marks.length===0:!1,d=d?p.isBlock:!1}),l===a&&d){const{parent:p}=r.doc.resolve(l);p.isTextblock&&!p.type.spec.code&&!p.childCount&&(l-=1,a+=1)}let h;c?(Array.isArray(e)?h=e.map(p=>p.text||"").join(""):typeof e=="object"&&e&&e.text?h=e.text:h=e,r.insertText(h,l,a)):(h=s,r.replaceWith(l,a,h)),n.updateSelection&&Sv(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:l,text:h}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:l,text:h})}return!0},Mv=()=>({state:t,dispatch:e})=>Ob(t,e),Ev=()=>({state:t,dispatch:e})=>Mb(t,e),Tv=()=>({state:t,dispatch:e})=>vb(t,e),Nv=()=>({state:t,dispatch:e})=>Sb(t,e),Av=()=>({tr:t,state:e,dispatch:n})=>{try{const r=Di(e.doc,e.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),n&&n(t),!0)}catch{return!1}},Dv=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Di(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Bv=()=>({state:t,dispatch:e})=>kb(t,e),Vv=()=>({state:t,dispatch:e})=>wb(t,e);function Pd(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Iv(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,o,s;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))o=!0;else if(/^mod$/i.test(a))Bs()||Pd()?s=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),o&&(n=`Shift-${n}`),n}const Pv=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const o=Iv(t).split(/-(?!$)/),s=o.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,l))});return a==null||a.steps.forEach(c=>{const d=c.map(r.mapping);d&&i&&r.maybeStep(d)}),!0};function Wr(t,e,n={}){const{from:r,to:i,empty:o}=t.selection,s=e?ve(e,t.schema):null,l=[];t.doc.nodesBetween(r,i,(f,h)=>{if(f.isText)return;const p=Math.max(r,h),m=Math.min(i,h+f.nodeSize);l.push({node:f,from:p,to:m})});const a=i-r,c=l.filter(f=>s?s.name===f.node.type.name:!0).filter(f=>Gi(f.node.attrs,n,{strict:!1}));return o?!!c.length:c.reduce((f,h)=>f+h.to-h.from,0)>=a}const $v=(t,e={})=>({state:n,dispatch:r})=>{const i=ve(t,n.schema);return Wr(n,i,e)?Eb(n,r):!1},Rv=()=>({state:t,dispatch:e})=>Db(t,e),_v=t=>({state:e,dispatch:n})=>{const r=ve(t,e.schema);return Lb(r)(e,n)},Lv=()=>({state:t,dispatch:e})=>Tb(t,e);function Zi(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function $d(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}const zv=(t,e)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null;const l=Zi(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(o=ve(t,r.schema)),l==="mark"&&(s=ln(t,r.schema)),i&&n.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(c,d)=>{o&&o===c.type&&n.setNodeMarkup(d,void 0,$d(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(f=>{s===f.type&&n.addMark(d,d+c.nodeSize,s.create($d(f.attrs,e)))})})}),!0):!1},Fv=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),jv=()=>({tr:t,commands:e})=>e.setTextSelection({from:0,to:t.doc.content.size}),Hv=()=>({state:t,dispatch:e})=>xb(t,e),Wv=()=>({state:t,dispatch:e})=>Cb(t,e),Uv=()=>({state:t,dispatch:e})=>Bb(t,e),qv=()=>({state:t,dispatch:e})=>Pb(t,e),Kv=()=>({state:t,dispatch:e})=>Ib(t,e);function Rd(t,e,n={}){return Yi(t,e,{slice:!1,parseOptions:n})}const Jv=(t,e=!1,n={})=>({tr:r,editor:i,dispatch:o})=>{const{doc:s}=r,l=Rd(t,i.schema,n);return o&&r.replaceWith(0,s.content.size,l).setMeta("preventUpdate",!e),!0};function Xi(t,e){const n=ln(e,t.schema),{from:r,to:i,empty:o}=t.selection,s=[];o?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,a=>{s.push(...a.marks)});const l=s.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function Gv(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Yv(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Vs(t){return e=>Yv(e.$from,t)}function Zv(t,e){const n=wt.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function Xv(t,e){const n={from:0,to:t.content.size};return Ad(t,n,e)}function Qv(t,e){const n=ve(e,t.schema),{from:r,to:i}=t.selection,o=[];t.doc.nodesBetween(r,i,l=>{o.push(l)});const s=o.reverse().find(l=>l.type.name===n.name);return s?{...s.attrs}:{}}function e1(t,e){const n=Zi(typeof e=="string"?e:e.name,t.schema);return n==="node"?Qv(t,e):n==="mark"?Xi(t,e):{}}function _d(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const o=n.resolve(t-1),s=As(o,i.type);s&&r.push({mark:i,...s})}):n.nodesBetween(t,e,(i,o)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(s=>({from:o,to:o+i.nodeSize,mark:s})))}),r}function Qi(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}function Is(t,e,n={}){const{empty:r,ranges:i}=t.selection,o=e?ln(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>o?o.name===f.type.name:!0).find(f=>Gi(f.attrs,n,{strict:!1}));let s=0;const l=[];if(i.forEach(({$from:f,$to:h})=>{const p=f.pos,m=h.pos;t.doc.nodesBetween(p,m,(y,g)=>{if(!y.isText&&!y.marks.length)return;const v=Math.max(p,g),C=Math.min(m,g+y.nodeSize),M=C-v;s+=M,l.push(...y.marks.map(b=>({mark:b,from:v,to:C})))})}),s===0)return!1;const a=l.filter(f=>o?o.name===f.mark.type.name:!0).filter(f=>Gi(f.mark.attrs,n,{strict:!1})).reduce((f,h)=>f+h.to-h.from,0),c=l.filter(f=>o?f.mark.type!==o&&f.mark.type.excludes(o):!0).reduce((f,h)=>f+h.to-h.from,0);return(a>0?a+c:a)>=s}function t1(t,e,n={}){if(!e)return Wr(t,null,n)||Is(t,null,n);const r=Zi(e,t.schema);return r==="node"?Wr(t,e,n):r==="mark"?Is(t,e,n):!1}function Ld(t,e){const{nodeExtensions:n}=Ui(e),r=n.find(s=>s.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=G(R(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function n1(t){var e;const n=(e=t.type.createAndFill())===null||e===void 0?void 0:e.toJSON(),r=t.toJSON();return JSON.stringify(n)===JSON.stringify(r)}function r1(t){return t instanceof z}function zd(t,e,n){const i=t.state.doc.content.size,o=Lt(e,0,i),s=Lt(n,0,i),l=t.coordsAtPos(o),a=t.coordsAtPos(s,-1),c=Math.min(l.top,a.top),d=Math.max(l.bottom,a.bottom),f=Math.min(l.left,a.left),h=Math.max(l.right,a.right),p=h-f,m=d-c,v={top:c,bottom:d,left:f,right:h,width:p,height:m,x:f,y:c};return{...v,toJSON:()=>v}}function i1(t,e,n){var r;const{selection:i}=e;let o=null;if(Ds(i)&&(o=i.$cursor),o){const l=(r=t.storedMarks)!==null&&r!==void 0?r:o.marks();return!!n.isInSet(l)||!l.some(a=>a.type.excludes(n))}const{ranges:s}=i;return s.some(({$from:l,$to:a})=>{let c=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,a.pos,(d,f,h)=>{if(c)return!1;if(d.isInline){const p=!h||h.type.allowsMarkType(n),m=!!n.isInSet(d.marks)||!d.marks.some(y=>y.type.excludes(n));c=p&&m}return!c}),c})}const o1=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:o}=n,{empty:s,ranges:l}=o,a=ln(t,r.schema);if(i)if(s){const c=Xi(r,a);n.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{const d=c.$from.pos,f=c.$to.pos;r.doc.nodesBetween(d,f,(h,p)=>{const m=Math.max(p,d),y=Math.min(p+h.nodeSize,f);h.marks.find(v=>v.type===a)?h.marks.forEach(v=>{a===v.type&&n.addMark(m,y,a.create({...v.attrs,...e}))}):n.addMark(m,y,a.create(e))})});return i1(r,n,a)},s1=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),l1=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const o=ve(t,n.schema);return o.isTextblock?i().command(({commands:s})=>Cd(o,e)(n)?!0:s.clearNodes()).command(({state:s})=>Cd(o,e)(s,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},a1=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=Lt(t,0,r.content.size),o=z.create(r,i);e.setSelection(o)}return!0},c1=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:o}=typeof t=="number"?{from:t,to:t}:t,s=U.atStart(r).from,l=U.atEnd(r).to,a=Lt(i,s,l),c=Lt(o,s,l),d=U.create(r,a,c);e.setSelection(d)}return!0},d1=t=>({state:e,dispatch:n})=>{const r=ve(t,e.schema);return jb(r)(e,n)};function Fd(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e==null?void 0:e.includes(i.type.name));t.tr.ensureMarks(r)}}const u1=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:o,doc:s}=e,{$from:l,$to:a}=o,c=i.extensionManager.attributes,d=Qi(c,l.node().type.name,l.node().attrs);if(o instanceof z&&o.node.isBlock)return!l.parentOffset||!qn(s,l.pos)?!1:(r&&(t&&Fd(n,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;if(r){const f=a.parentOffset===a.parent.content.size;o instanceof U&&e.deleteSelection();const h=l.depth===0?void 0:Gv(l.node(-1).contentMatchAt(l.indexAfter(-1)));let p=f&&h?[{type:h,attrs:d}]:void 0,m=qn(e.doc,e.mapping.map(l.pos),1,p);if(!p&&!m&&qn(e.doc,e.mapping.map(l.pos),1,h?[{type:h}]:void 0)&&(m=!0,p=h?[{type:h,attrs:d}]:void 0),m&&(e.split(e.mapping.map(l.pos),1,p),h&&!f&&!l.parentOffset&&l.parent.type!==h)){const y=e.mapping.map(l.before()),g=e.doc.resolve(y);l.node(-1).canReplaceWith(g.index(),g.index()+1,h)&&e.setNodeMarkup(e.mapping.map(l.before()),h)}t&&Fd(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return!0},f1=t=>({tr:e,state:n,dispatch:r,editor:i})=>{var o;const s=ve(t,n.schema),{$from:l,$to:a}=n.selection,c=n.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(a))return!1;const d=l.node(-1);if(d.type!==s)return!1;const f=i.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==s||l.index(-2)!==l.node(-2).childCount-1)return!1;if(r){let g=T.empty;const v=l.index(-1)?1:l.index(-2)?2:3;for(let D=l.depth-v;D>=l.depth-3;D-=1)g=T.from(l.node(D).copy(g));const C=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,M=Qi(f,l.node().type.name,l.node().attrs),b=((o=s.contentMatch.defaultType)===null||o===void 0?void 0:o.createAndFill(M))||void 0;g=g.append(T.from(s.createAndFill(null,b)||void 0));const O=l.before(l.depth-(v-1));e.replace(O,l.after(-C),new I(g,4-v,0));let S=-1;e.doc.nodesBetween(O,e.doc.content.size,(D,V)=>{if(S>-1)return!1;D.isTextblock&&D.content.size===0&&(S=V+1)}),S>-1&&e.setSelection(U.near(e.doc.resolve(S))),e.scrollIntoView()}return!0}const h=a.pos===l.end()?d.contentMatchAt(0).defaultType:null,p=Qi(f,d.type.name,d.attrs),m=Qi(f,l.node().type.name,l.node().attrs);e.delete(l.pos,a.pos);const y=h?[{type:s,attrs:p},{type:h,attrs:m}]:[{type:s,attrs:p}];if(!qn(e.doc,l.pos,2))return!1;if(r){const{selection:g,storedMarks:v}=n,{splittableMarks:C}=i.extensionManager,M=v||g.$to.parentOffset&&g.$from.marks();if(e.split(l.pos,2,y).scrollIntoView(),!M||!r)return!0;const b=M.filter(O=>C.includes(O.type.name));e.ensureMarks(b)}return!0},Ps=(t,e)=>{const n=Vs(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Yt(t.doc,n.pos)&&t.join(n.pos),!0},$s=(t,e)=>{const n=Vs(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Yt(t.doc,r)&&t.join(r),!0};var h1=Object.freeze({__proto__:null,blur:ov,clearContent:sv,clearNodes:lv,command:av,createParagraphNear:cv,cut:dv,deleteCurrentNode:uv,deleteNode:fv,deleteRange:hv,deleteSelection:pv,enter:mv,exitCode:gv,extendMarkRange:bv,first:vv,focus:kv,forEach:wv,insertContent:xv,insertContentAt:Ov,joinUp:Mv,joinDown:Ev,joinBackward:Tv,joinForward:Nv,joinItemBackward:Av,joinItemForward:Dv,joinTextblockBackward:Bv,joinTextblockForward:Vv,keyboardShortcut:Pv,lift:$v,liftEmptyBlock:Rv,liftListItem:_v,newlineInCode:Lv,resetAttributes:zv,scrollIntoView:Fv,selectAll:jv,selectNodeBackward:Hv,selectNodeForward:Wv,selectParentNode:Uv,selectTextblockEnd:qv,selectTextblockStart:Kv,setContent:Jv,setMark:o1,setMeta:s1,setNode:l1,setNodeSelection:a1,setTextSelection:c1,sinkListItem:d1,splitBlock:u1,splitListItem:f1,toggleList:(t,e,n,r={})=>({editor:i,tr:o,state:s,dispatch:l,chain:a,commands:c,can:d})=>{const{extensions:f,splittableMarks:h}=i.extensionManager,p=ve(t,s.schema),m=ve(e,s.schema),{selection:y,storedMarks:g}=s,{$from:v,$to:C}=y,M=v.blockRange(C),b=g||y.$to.parentOffset&&y.$from.marks();if(!M)return!1;const O=Vs(S=>Ld(S.type.name,f))(y);if(M.depth>=1&&O&&M.depth-O.depth<=1){if(O.node.type===p)return c.liftListItem(m);if(Ld(O.node.type.name,f)&&p.validContent(O.node.content)&&l)return a().command(()=>(o.setNodeMarkup(O.pos,p),!0)).command(()=>Ps(o,p)).command(()=>$s(o,p)).run()}return!n||!b||!l?a().command(()=>d().wrapInList(p,r)?!0:c.clearNodes()).wrapInList(p,r).command(()=>Ps(o,p)).command(()=>$s(o,p)).run():a().command(()=>{const S=d().wrapInList(p,r),D=b.filter(V=>h.includes(V.type.name));return o.ensureMarks(D),S?!0:c.clearNodes()}).wrapInList(p,r).command(()=>Ps(o,p)).command(()=>$s(o,p)).run()},toggleMark:(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=n,s=ln(t,r.schema);return Is(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},toggleNode:(t,e,n={})=>({state:r,commands:i})=>{const o=ve(t,r.schema),s=ve(e,r.schema);return Wr(r,o,n)?i.setNode(s):i.setNode(o,n)},toggleWrap:(t,e={})=>({state:n,commands:r})=>{const i=ve(t,n.schema);return Wr(n,i,e)?r.lift(i):r.wrapIn(i,e)},undoInputRule:()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let o;if(i.spec.isInputRules&&(o=i.getState(t))){if(e){const s=t.tr,l=o.transform;for(let a=l.steps.length-1;a>=0;a-=1)s.step(l.steps[a].invert(l.docs[a]));if(o.text){const a=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,t.schema.text(o.text,a))}else s.delete(o.from,o.to)}return!0}}return!1},unsetAllMarks:()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(o=>{t.removeMark(o.$from.pos,o.$to.pos)}),!0},unsetMark:(t,e={})=>({tr:n,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=n,a=ln(t,r.schema),{$from:c,empty:d,ranges:f}=l;if(!i)return!0;if(d&&s){let{from:h,to:p}=l;const m=(o=c.marks().find(g=>g.type===a))===null||o===void 0?void 0:o.attrs,y=As(c,a,m);y&&(h=y.from,p=y.to),n.removeMark(h,p,a)}else f.forEach(h=>{n.removeMark(h.$from.pos,h.$to.pos,a)});return n.removeStoredMark(a),!0},updateAttributes:(t,e={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null;const l=Zi(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(o=ve(t,r.schema)),l==="mark"&&(s=ln(t,r.schema)),i&&n.selection.ranges.forEach(a=>{const c=a.$from.pos,d=a.$to.pos;r.doc.nodesBetween(c,d,(f,h)=>{o&&o===f.type&&n.setNodeMarkup(h,void 0,{...f.attrs,...e}),s&&f.marks.length&&f.marks.forEach(p=>{if(s===p.type){const m=Math.max(h,c),y=Math.min(h+f.nodeSize,d);n.addMark(m,y,s.create({...p.attrs,...e}))}})})}),!0):!1},wrapIn:(t,e={})=>({state:n,dispatch:r})=>{const i=ve(t,n.schema);return $b(i,e)(n,r)},wrapInList:(t,e={})=>({state:n,dispatch:r})=>{const i=ve(t,n.schema);return Rb(i,e)(n,r)}});const p1=Ne.create({name:"commands",addCommands(){return{...h1}}}),m1=Ne.create({name:"editable",addProseMirrorPlugins(){return[new De({key:new pt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),g1=Ne.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new De({key:new pt("focusEvents"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),y1=Ne.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:d,$anchor:f}=a,{pos:h,parent:p}=f,m=f.parent.isTextblock&&h>0?l.doc.resolve(h-1):f,y=m.parent.type.spec.isolating,g=f.pos-f.parentOffset,v=y&&m.parent.childCount===1?g===f.pos:J.atStart(c).from===h;return!d||!p.type.isTextblock||p.textContent.length||!v||v&&f.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Bs()||Pd()?o:i},addProseMirrorPlugins(){return[new De({key:new pt("clearDocument"),appendTransaction:(t,e,n)=>{if(!(t.some(m=>m.docChanged)&&!e.doc.eq(n.doc)))return;const{empty:i,from:o,to:s}=e.selection,l=J.atStart(e.doc).from,a=J.atEnd(e.doc).to;if(i||!(o===l&&s===a)||!(n.doc.textBetween(0,n.doc.content.size," "," ").length===0))return;const f=n.tr,h=Hi({state:n,transaction:f}),{commands:p}=new Wi({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),b1=Ne.create({name:"tabindex",addProseMirrorPlugins(){return[new De({key:new pt("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}});class En{constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new En(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new En(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new En(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,o=this.pos+r+1,s=this.resolvedPos.doc.resolve(o);if(!i&&s.depth<=this.depth)return;const l=new En(s,this.editor,i,i?n:null);i&&(l.actualDepth=this.depth+1),e.push(new En(s,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const o=i.node.attrs,s=Object.keys(n);for(let l=0;l<s.length;l+=1){const a=s[l];if(o[a]!==n[a])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const o=Object.keys(n);return this.children.forEach(s=>{r&&i.length>0||(s.node.type.name===e&&o.every(a=>n[a]===s.node.attrs[a])&&i.push(s),!(r&&i.length>0)&&(i=i.concat(s.querySelectorAll(e,n,r))))}),i}setAttribute(e){const n=this.editor.state.selection;this.editor.chain().setTextSelection(this.from).updateAttributes(this.node.type.name,e).setTextSelection(n.from).run()}}const v1=`.ProseMirror {
5
+ */function Ae(t){return typeof t=="function"}function wc(t){return t==null}const _n=t=>t!==null&&!!t&&typeof t=="object"&&!Array.isArray(t);function Uo(t){return Number(t)>=0}function cm(t){const e=parseFloat(t);return isNaN(e)?t:e}function dm(t){return typeof t=="object"&&t!==null}function um(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}function xc(t){if(!dm(t)||um(t)!=="[object Object]")return!1;if(Object.getPrototypeOf(t)===null)return!0;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function bi(t,e){return Object.keys(e).forEach(n=>{if(xc(e[n])&&xc(t[n])){t[n]||(t[n]={}),bi(t[n],e[n]);return}t[n]=e[n]}),t}function vi(t){const e=t.split(".");if(!e.length)return"";let n=String(e[0]);for(let r=1;r<e.length;r++){if(Uo(e[r])){n+=`[${e[r]}]`;continue}n+=`.${e[r]}`}return n}const Sc={};function Dt(t,e){hm(t,e),Sc[t]=e}function fm(t){return Sc[t]}function hm(t,e){if(!Ae(e))throw new Error(`Extension Error: The validator '${t}' must be a function.`)}function Mc(t,e,n){typeof n.value=="object"&&(n.value=pe(n.value)),!n.enumerable||n.get||n.set||!n.configurable||!n.writable||e==="__proto__"?Object.defineProperty(t,e,n):t[e]=n.value}function pe(t){if(typeof t!="object")return t;var e=0,n,r,i,s=Object.prototype.toString.call(t);if(s==="[object Object]"?i=Object.create(t.__proto__||null):s==="[object Array]"?i=Array(t.length):s==="[object Set]"?(i=new Set,t.forEach(function(o){i.add(pe(o))})):s==="[object Map]"?(i=new Map,t.forEach(function(o,a){i.set(pe(a),pe(o))})):s==="[object Date]"?i=new Date(+t):s==="[object RegExp]"?i=new RegExp(t.source,t.flags):s==="[object DataView]"?i=new t.constructor(pe(t.buffer)):s==="[object ArrayBuffer]"?i=t.slice(0):s.slice(-6)==="Array]"&&(i=new t.constructor(t)),i){for(r=Object.getOwnPropertySymbols(t);e<r.length;e++)Mc(i,r[e],Object.getOwnPropertyDescriptor(t,r[e]));for(e=0,r=Object.getOwnPropertyNames(t);e<r.length;e++)Object.hasOwnProperty.call(i,n=r[e])&&i[n]===t[n]||Mc(i,n,Object.getOwnPropertyDescriptor(t,n))}return i||t}const ki=Symbol("vee-validate-form"),Oc=Symbol("vee-validate-field-instance"),gs=Symbol("Default empty value"),pm=typeof window<"u";function qo(t){return Ae(t)&&!!t.__locatorRef}function At(t){return!!t&&Ae(t.parse)&&t.__type==="VVTypedSchema"}function ys(t){return!!t&&Ae(t.validate)}function wi(t){return t==="checkbox"||t==="radio"}function mm(t){return _n(t)||Array.isArray(t)}function gm(t){return Array.isArray(t)?t.length===0:_n(t)&&Object.keys(t).length===0}function bs(t){return/^\[.+\]$/i.test(t)}function ym(t){return Cc(t)&&t.multiple}function Cc(t){return t.tagName==="SELECT"}function bm(t,e){const n=![!1,null,void 0,0].includes(e.multiple)&&!Number.isNaN(e.multiple);return t==="select"&&"multiple"in e&&n}function vm(t,e){return!bm(t,e)&&e.type!=="file"&&!wi(e.type)}function Tc(t){return Ko(t)&&t.target&&"submit"in t.target}function Ko(t){return t?!!(typeof Event<"u"&&Ae(Event)&&t instanceof Event||t&&t.srcElement):!1}function Ec(t,e){return e in t&&t[e]!==gs}function qe(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var n,r,i;if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!qe(t[r],e[r]))return!1;return!0}if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(r of t.entries())if(!e.has(r[0]))return!1;for(r of t.entries())if(!qe(r[1],e.get(r[0])))return!1;return!0}if(_c(t)&&_c(e))return!(t.size!==e.size||t.name!==e.name||t.lastModified!==e.lastModified||t.type!==e.type);if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(r of t.entries())if(!e.has(r[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(t[r]!==e[r])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();for(i=Object.keys(t),n=i.length,r=n;r--!==0;){var s=i[r];if(!qe(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function _c(t){return pm?t instanceof File:!1}function Jo(t){return bs(t)?t.replace(/\[|\]/gi,""):t}function nt(t,e,n){return t?bs(e)?t[Jo(e)]:(e||"").split(/\.|\[(\d+)\]/).filter(Boolean).reduce((i,s)=>mm(i)&&s in i?i[s]:n,t):n}function dn(t,e,n){if(bs(e)){t[Jo(e)]=n;return}const r=e.split(/\.|\[(\d+)\]/).filter(Boolean);let i=t;for(let s=0;s<r.length;s++){if(s===r.length-1){i[r[s]]=n;return}(!(r[s]in i)||wc(i[r[s]]))&&(i[r[s]]=Uo(r[s+1])?[]:{}),i=i[r[s]]}}function Go(t,e){if(Array.isArray(t)&&Uo(e)){t.splice(Number(e),1);return}_n(t)&&delete t[e]}function Nc(t,e){if(bs(e)){delete t[Jo(e)];return}const n=e.split(/\.|\[(\d+)\]/).filter(Boolean);let r=t;for(let s=0;s<n.length;s++){if(s===n.length-1){Go(r,n[s]);break}if(!(n[s]in r)||wc(r[n[s]]))break;r=r[n[s]]}const i=n.map((s,o)=>nt(t,n.slice(0,o).join(".")));for(let s=i.length-1;s>=0;s--)if(gm(i[s])){if(s===0){Go(t,n[0]);continue}Go(i[s-1],n[s-1])}}function rt(t){return Object.keys(t)}function Zo(t,e=void 0){const n=d.getCurrentInstance();return(n==null?void 0:n.provides[t])||d.inject(t,e)}function Dc(t,e,n){if(Array.isArray(t)){const r=[...t],i=r.findIndex(s=>qe(s,e));return i>=0?r.splice(i,1):r.push(e),r}return qe(t,e)?n:e}function km(t,e){let n,r;return function(...i){const s=this;return n||(n=!0,setTimeout(()=>n=!1,e),r=t.apply(s,i)),r}}function Ac(t,e=0){let n=null,r=[];return function(...i){return n&&clearTimeout(n),n=setTimeout(()=>{const s=t(...i);r.forEach(o=>o(s)),r=[]},e),new Promise(s=>r.push(s))}}function wm(t,e){return _n(e)&&e.number?cm(t):t}function Xo(t,e){let n;return async function(...i){const s=t(...i);n=s;const o=await s;return s!==n?o:(n=void 0,e(o,i))}}function Qo(t){return Array.isArray(t)?t:t?[t]:[]}function vs(t,e){const n={};for(const r in t)e.includes(r)||(n[r]=t[r]);return n}function xm(t){let e=null,n=[];return function(...r){const i=d.nextTick(()=>{if(e!==i)return;const s=t(...r);n.forEach(o=>o(s)),n=[],e=null});return e=i,new Promise(s=>n.push(s))}}function ea(t,e,n){return e.slots.default?typeof t=="string"||!t?e.slots.default(n()):{default:()=>{var r,i;return(i=(r=e.slots).default)===null||i===void 0?void 0:i.call(r,n())}}:e.slots.default}function ta(t){if(Vc(t))return t._value}function Vc(t){return"_value"in t}function Sm(t){return t.type==="number"||t.type==="range"?Number.isNaN(t.valueAsNumber)?t.value:t.valueAsNumber:t.value}function ks(t){if(!Ko(t))return t;const e=t.target;if(wi(e.type)&&Vc(e))return ta(e);if(e.type==="file"&&e.files){const n=Array.from(e.files);return e.multiple?n:n[0]}if(ym(e))return Array.from(e.options).filter(n=>n.selected&&!n.disabled).map(ta);if(Cc(e)){const n=Array.from(e.options).find(r=>r.selected);return n?ta(n):e.value}return Sm(e)}function Bc(t){const e={};return Object.defineProperty(e,"_$$isNormalized",{value:!0,writable:!1,enumerable:!1,configurable:!1}),t?_n(t)&&t._$$isNormalized?t:_n(t)?Object.keys(t).reduce((n,r)=>{const i=Mm(t[r]);return t[r]!==!1&&(n[r]=Pc(i)),n},e):typeof t!="string"?e:t.split("|").reduce((n,r)=>{const i=Om(r);return i.name&&(n[i.name]=Pc(i.params)),n},e):e}function Mm(t){return t===!0?[]:Array.isArray(t)||_n(t)?t:[t]}function Pc(t){const e=n=>typeof n=="string"&&n[0]==="@"?Cm(n.slice(1)):n;return Array.isArray(t)?t.map(e):t instanceof RegExp?[t]:Object.keys(t).reduce((n,r)=>(n[r]=e(t[r]),n),{})}const Om=t=>{let e=[];const n=t.split(":")[0];return t.includes(":")&&(e=t.split(":").slice(1).join(":").split(",")),{name:n,params:e}};function Cm(t){const e=n=>nt(n,t)||n[t];return e.__locatorRef=t,e}function Tm(t){return Array.isArray(t)?t.filter(qo):rt(t).filter(e=>qo(t[e])).map(e=>t[e])}let Em=Object.assign({},{generateMessage:({field:t})=>`${t} is not valid.`,bails:!0,validateOnBlur:!0,validateOnChange:!0,validateOnInput:!1,validateOnModelUpdate:!0});const tr=()=>Em;async function Ic(t,e,n={}){const r=n==null?void 0:n.bails,i={name:(n==null?void 0:n.name)||"{field}",rules:e,label:n==null?void 0:n.label,bails:r??!0,formData:(n==null?void 0:n.values)||{}},o=(await _m(i,t)).errors;return{errors:o,valid:!o.length}}async function _m(t,e){if(At(t.rules)||ys(t.rules))return Dm(e,t.rules);if(Ae(t.rules)||Array.isArray(t.rules)){const o={field:t.label||t.name,name:t.name,label:t.label,form:t.formData,value:e},a=Array.isArray(t.rules)?t.rules:[t.rules],l=a.length,c=[];for(let u=0;u<l;u++){const f=a[u],h=await f(e,o);if(!(typeof h!="string"&&!Array.isArray(h)&&h)){if(Array.isArray(h))c.push(...h);else{const m=typeof h=="string"?h:$c(o);c.push(m)}if(t.bails)return{errors:c}}}return{errors:c}}const n=Object.assign(Object.assign({},t),{rules:Bc(t.rules)}),r=[],i=Object.keys(n.rules),s=i.length;for(let o=0;o<s;o++){const a=i[o],l=await Am(n,e,{name:a,params:n.rules[a]});if(l.error&&(r.push(l.error),t.bails))return{errors:r}}return{errors:r}}function Nm(t){return!!t&&t.name==="ValidationError"}function Rc(t){return{__type:"VVTypedSchema",async parse(n){var r;try{return{output:await t.validate(n,{abortEarly:!1}),errors:[]}}catch(i){if(!Nm(i))throw i;if(!(!((r=i.inner)===null||r===void 0)&&r.length)&&i.errors.length)return{errors:[{path:i.path,errors:i.errors}]};const s=i.inner.reduce((o,a)=>{const l=a.path||"";return o[l]||(o[l]={errors:[],path:l}),o[l].errors.push(...a.errors),o},{});return{errors:Object.values(s)}}}}}async function Dm(t,e){const r=await(At(e)?e:Rc(e)).parse(t),i=[];for(const s of r.errors)s.errors.length&&i.push(...s.errors);return{errors:i}}async function Am(t,e,n){const r=fm(n.name);if(!r)throw new Error(`No such validator '${n.name}' exists.`);const i=Vm(n.params,t.formData),s={field:t.label||t.name,name:t.name,label:t.label,value:e,form:t.formData,rule:Object.assign(Object.assign({},n),{params:i})},o=await r(e,i,s);return typeof o=="string"?{error:o}:{error:o?void 0:$c(s)}}function $c(t){const e=tr().generateMessage;return e?e(t):"Field is invalid"}function Vm(t,e){const n=r=>qo(r)?r(e):r;return Array.isArray(t)?t.map(n):Object.keys(t).reduce((r,i)=>(r[i]=n(t[i]),r),{})}async function Bm(t,e){const r=await(At(t)?t:Rc(t)).parse(pe(e)),i={},s={};for(const o of r.errors){const a=o.errors,l=(o.path||"").replace(/\["(\d+)"\]/g,(c,u)=>`[${u}]`);i[l]={valid:!a.length,errors:a},a.length&&(s[l]=a[0])}return{valid:!r.errors.length,results:i,errors:s,values:r.value}}async function Pm(t,e,n){const i=rt(t).map(async c=>{var u,f,h;const p=(u=n==null?void 0:n.names)===null||u===void 0?void 0:u[c],m=await Ic(nt(e,c),t[c],{name:(p==null?void 0:p.name)||c,label:p==null?void 0:p.label,values:e,bails:(h=(f=n==null?void 0:n.bailsMap)===null||f===void 0?void 0:f[c])!==null&&h!==void 0?h:!0});return Object.assign(Object.assign({},m),{path:c})});let s=!0;const o=await Promise.all(i),a={},l={};for(const c of o)a[c.path]={valid:c.valid,errors:c.errors},c.valid||(s=!1,l[c.path]=c.errors[0]);return{valid:s,results:a,errors:l}}let Lc=0;function Im(t,e){const{value:n,initialValue:r,setInitialValue:i}=Rm(t,e.modelValue,e.form);if(!e.form){let h=function(p){var m;"value"in p&&(n.value=p.value),"errors"in p&&c(p.errors),"touched"in p&&(f.touched=(m=p.touched)!==null&&m!==void 0?m:f.touched),"initialValue"in p&&i(p.initialValue)};const{errors:l,setErrors:c}=Fm(),u=Lc>=Number.MAX_SAFE_INTEGER?0:++Lc,f=Lm(n,r,l,e.schema);return{id:u,path:t,value:n,initialValue:r,meta:f,flags:{pendingUnmount:{[u]:!1},pendingReset:!1},errors:l,setState:h}}const s=e.form.createPathState(t,{bails:e.bails,label:e.label,type:e.type,validate:e.validate,schema:e.schema}),o=d.computed(()=>s.errors);function a(l){var c,u,f;"value"in l&&(n.value=l.value),"errors"in l&&((c=e.form)===null||c===void 0||c.setFieldError(d.unref(t),l.errors)),"touched"in l&&((u=e.form)===null||u===void 0||u.setFieldTouched(d.unref(t),(f=l.touched)!==null&&f!==void 0?f:!1)),"initialValue"in l&&i(l.initialValue)}return{id:Array.isArray(s.id)?s.id[s.id.length-1]:s.id,path:t,value:n,errors:o,meta:s,initialValue:r,flags:s.__flags,setState:a}}function Rm(t,e,n){const r=d.ref(d.unref(e));function i(){return n?nt(n.initialValues.value,d.unref(t),d.unref(r)):d.unref(r)}function s(c){if(!n){r.value=c;return}n.setFieldInitialValue(d.unref(t),c,!0)}const o=d.computed(i);if(!n)return{value:d.ref(i()),initialValue:o,setInitialValue:s};const a=$m(e,n,o,t);return n.stageInitialValue(d.unref(t),a,!0),{value:d.computed({get(){return nt(n.values,d.unref(t))},set(c){n.setFieldValue(d.unref(t),c,!1)}}),initialValue:o,setInitialValue:s}}function $m(t,e,n,r){return d.isRef(t)?d.unref(t):t!==void 0?t:nt(e.values,d.unref(r),d.unref(n))}function Lm(t,e,n,r){const i=d.computed(()=>{var o,a,l;return(l=(a=(o=d.toValue(r))===null||o===void 0?void 0:o.describe)===null||a===void 0?void 0:a.call(o).required)!==null&&l!==void 0?l:!1}),s=d.reactive({touched:!1,pending:!1,valid:!0,required:i,validated:!!d.unref(n).length,initialValue:d.computed(()=>d.unref(e)),dirty:d.computed(()=>!qe(d.unref(t),d.unref(e)))});return d.watch(n,o=>{s.valid=!o.length},{immediate:!0,flush:"sync"}),s}function Fm(){const t=d.ref([]);return{errors:t,setErrors:e=>{t.value=Qo(e)}}}function Fc(t){process.env.NODE_ENV!=="production"&&lm({id:"vee-validate-devtools-plugin",label:"VeeValidate Plugin",packageName:"vee-validate",homepage:"https://vee-validate.logaretm.com/v4",app:t,logo:"https://vee-validate.logaretm.com/v4/logo.png"},Wm)}const xi={},Si={};let un;const Tr=km(()=>{setTimeout(async()=>{await d.nextTick(),un==null||un.sendInspectorState(Er),un==null||un.sendInspectorTree(Er)},100)},100);function zm(t){const e=d.getCurrentInstance();if(!un){const n=e==null?void 0:e.appContext.app;if(!n)return;Fc(n)}xi[t.formId]=Object.assign({},t),xi[t.formId]._vm=e,d.onUnmounted(()=>{delete xi[t.formId],Tr()}),Tr()}function jm(t){const e=d.getCurrentInstance();if(!un){const n=e==null?void 0:e.appContext.app;if(!n)return;Fc(n)}Si[t.id]=Object.assign({},t),Si[t.id]._vm=e,d.onUnmounted(()=>{delete Si[t.id],Tr()}),Tr()}const Er="vee-validate-inspector",it={error:12405579,success:448379,unknown:5522283,white:16777215,black:0,blue:218007,purple:12157168,orange:16099682,gray:12304330};let Ce=null;function Wm(t){un=t,t.addInspector({id:Er,icon:"rule",label:"vee-validate",noSelectionText:"Select a vee-validate node to inspect",actions:[{icon:"done_outline",tooltip:"Validate selected item",action:async()=>{if(!Ce){console.error("There is not a valid selected vee-validate node or component");return}if(Ce.type==="field"){await Ce.field.validate();return}if(Ce.type==="form"){await Ce.form.validate();return}Ce.type==="pathState"&&await Ce.form.validateField(Ce.state.path)}},{icon:"delete_sweep",tooltip:"Clear validation state of the selected item",action:()=>{if(!Ce){console.error("There is not a valid selected vee-validate node or component");return}if(Ce.type==="field"){Ce.field.resetField();return}Ce.type==="form"&&Ce.form.resetForm(),Ce.type==="pathState"&&Ce.form.resetField(Ce.state.path)}}]}),t.on.getInspectorTree(e=>{if(e.inspectorId!==Er)return;const n=Object.values(xi),r=Object.values(Si);e.rootNodes=[...n.map(Hm),...r.map(i=>Um(i))]}),t.on.getInspectorState((e,n)=>{if(e.inspectorId!==Er||n.currentTab!==`custom-inspector:${Er}`)return;const{form:r,field:i,state:s,type:o}=qm(e.nodeId);if(r&&o==="form"){e.state=Km(r),Ce={type:"form",form:r};return}if(s&&o==="pathState"&&r){e.state=jc(s),Ce={type:"pathState",state:s,form:r};return}if(i&&o==="field"){e.state=jc({errors:i.errors.value,dirty:i.meta.dirty,valid:i.meta.valid,touched:i.meta.touched,value:i.value.value,initialValue:i.meta.initialValue}),Ce={field:i,type:"field"};return}Ce=null})}function Hm(t){const{textColor:e,bgColor:n}=Wc(t.meta.value.valid),r={};Object.values(t.getAllPathStates()).forEach(o=>{dn(r,d.unref(o.path),Ym(o,t))});function i(o,a=[]){const l=[...a].pop();return"id"in o?Object.assign(Object.assign({},o),{label:l||o.label}):_n(o)?{id:`${a.join(".")}`,label:l||"",children:Object.keys(o).map(c=>i(o[c],[...a,c]))}:Array.isArray(o)?{id:`${a.join(".")}`,label:`${l}[]`,children:o.map((c,u)=>i(c,[...a,String(u)]))}:{id:"",label:"",children:[]}}const{children:s}=i(r);return{id:na(t),label:"Form",children:s,tags:[{label:"Form",textColor:e,backgroundColor:n},{label:`${t.getAllPathStates().length} fields`,textColor:it.white,backgroundColor:it.unknown}]}}function Ym(t,e){return{id:na(e,t),label:d.unref(t.path),tags:zc(t.multiple,t.fieldsCount,t.type,t.valid,e)}}function Um(t,e){return{id:na(e,t),label:d.unref(t.name),tags:zc(!1,1,t.type,t.meta.valid,e)}}function zc(t,e,n,r,i){const{textColor:s,bgColor:o}=Wc(r);return[t?void 0:{label:"Field",textColor:s,backgroundColor:o},i?void 0:{label:"Standalone",textColor:it.black,backgroundColor:it.gray},n==="checkbox"?{label:"Checkbox",textColor:it.white,backgroundColor:it.blue}:void 0,n==="radio"?{label:"Radio",textColor:it.white,backgroundColor:it.purple}:void 0,t?{label:"Multiple",textColor:it.black,backgroundColor:it.orange}:void 0].filter(Boolean)}function na(t,e){const n=e?"path"in e?"pathState":"field":"form",r=e?"path"in e?e==null?void 0:e.path:d.unref(e==null?void 0:e.name):"",i={f:t==null?void 0:t.formId,ff:r,type:n};return btoa(encodeURIComponent(JSON.stringify(i)))}function qm(t){try{const e=JSON.parse(decodeURIComponent(atob(t))),n=xi[e.f];if(!n&&e.ff){const i=Si[e.ff];return i?{type:e.type,field:i}:{}}if(!n)return{};const r=n.getPathState(e.ff);return{type:e.type,form:n,state:r}}catch{}return{}}function jc(t){return{"Field state":[{key:"errors",value:t.errors},{key:"initialValue",value:t.initialValue},{key:"currentValue",value:t.value},{key:"touched",value:t.touched},{key:"dirty",value:t.dirty},{key:"valid",value:t.valid}]}}function Km(t){const{errorBag:e,meta:n,values:r,isSubmitting:i,isValidating:s,submitCount:o}=t;return{"Form state":[{key:"submitCount",value:o.value},{key:"isSubmitting",value:i.value},{key:"isValidating",value:s.value},{key:"touched",value:n.value.touched},{key:"dirty",value:n.value.dirty},{key:"valid",value:n.value.valid},{key:"initialValues",value:n.value.initialValues},{key:"currentValues",value:r},{key:"errors",value:rt(e.value).reduce((a,l)=>{var c;const u=(c=e.value[l])===null||c===void 0?void 0:c[0];return u&&(a[l]=u),a},{})}]}}function Wc(t){return{bgColor:t?it.success:it.error,textColor:t?it.black:it.white}}function Jm(t,e,n){return wi(n==null?void 0:n.type)?Zm(t,e,n):Hc(t,e,n)}function Hc(t,e,n){const{initialValue:r,validateOnMount:i,bails:s,type:o,checkedValue:a,label:l,validateOnValueUpdate:c,uncheckedValue:u,controlled:f,keepValueOnUnmount:h,syncVModel:p,form:m}=Gm(n),y=f?Zo(ki):void 0,g=m||y,k=d.computed(()=>vi(d.toValue(t))),x=d.computed(()=>{if(d.toValue(g==null?void 0:g.schema))return;const K=d.unref(e);return ys(K)||At(K)||Ae(K)||Array.isArray(K)?K:Bc(K)}),O=!Ae(x.value)&&At(d.toValue(e)),{id:b,value:C,initialValue:v,meta:T,setState:B,errors:V,flags:F}=Im(k,{modelValue:r,form:g,bails:s,label:l,type:o,validate:x.value?j:void 0,schema:O?e:void 0}),te=d.computed(()=>V.value[0]);p&&Xm({value:C,prop:p,handleChange:ie,shouldValidate:()=>c&&!F.pendingReset});const G=(P,K=!1)=>{T.touched=!0,K&&oe()};async function ne(P){var K,fe;if(g!=null&&g.validateSchema){const{results:ae}=await g.validateSchema(P);return(K=ae[d.toValue(k)])!==null&&K!==void 0?K:{valid:!0,errors:[]}}return x.value?Ic(C.value,x.value,{name:d.toValue(k),label:d.toValue(l),values:(fe=g==null?void 0:g.values)!==null&&fe!==void 0?fe:{},bails:s}):{valid:!0,errors:[]}}const oe=Xo(async()=>(T.pending=!0,T.validated=!0,ne("validated-only")),P=>(F.pendingUnmount[ke.id]||(B({errors:P.errors}),T.pending=!1,T.valid=P.valid),P)),re=Xo(async()=>ne("silent"),P=>(T.valid=P.valid,P));function j(P){return(P==null?void 0:P.mode)==="silent"?re():oe()}function ie(P,K=!0){const fe=ks(P);ct(fe,K)}d.onMounted(()=>{if(i)return oe();(!g||!g.validateSchema)&&re()});function ue(P){T.touched=P}function _e(P){var K;const fe=P&&"value"in P?P.value:v.value;B({value:pe(fe),initialValue:pe(fe),touched:(K=P==null?void 0:P.touched)!==null&&K!==void 0?K:!1,errors:(P==null?void 0:P.errors)||[]}),T.pending=!1,T.validated=!1,re()}const Qe=d.getCurrentInstance();function ct(P,K=!0){C.value=Qe&&p?wm(P,Qe.props.modelModifiers):P,(K?oe:re)()}function bt(P){B({errors:Array.isArray(P)?P:[P]})}const vt=d.computed({get(){return C.value},set(P){ct(P,c)}}),ke={id:b,name:k,label:l,value:vt,meta:T,errors:V,errorMessage:te,type:o,checkedValue:a,uncheckedValue:u,bails:s,keepValueOnUnmount:h,resetField:_e,handleReset:()=>_e(),validate:j,handleChange:ie,handleBlur:G,setState:B,setTouched:ue,setErrors:bt,setValue:ct};if(d.provide(Oc,ke),d.isRef(e)&&typeof d.unref(e)!="function"&&d.watch(e,(P,K)=>{qe(P,K)||(T.validated?oe():re())},{deep:!0}),process.env.NODE_ENV!=="production"&&(ke._vm=d.getCurrentInstance(),d.watch(()=>Object.assign(Object.assign({errors:V.value},T),{value:C.value}),Tr,{deep:!0}),g||jm(ke)),!g)return ke;const et=d.computed(()=>{const P=x.value;return!P||Ae(P)||ys(P)||At(P)||Array.isArray(P)?{}:Object.keys(P).reduce((K,fe)=>{const ae=Tm(P[fe]).map(Re=>Re.__locatorRef).reduce((Re,$e)=>{const dt=nt(g.values,$e)||g.values[$e];return dt!==void 0&&(Re[$e]=dt),Re},{});return Object.assign(K,ae),K},{})});return d.watch(et,(P,K)=>{if(!Object.keys(P).length)return;!qe(P,K)&&(T.validated?oe():re())}),d.onBeforeUnmount(()=>{var P;const K=(P=d.toValue(ke.keepValueOnUnmount))!==null&&P!==void 0?P:d.toValue(g.keepValuesOnUnmount),fe=d.toValue(k);if(K||!g||F.pendingUnmount[ke.id]){g==null||g.removePathState(fe,b);return}F.pendingUnmount[ke.id]=!0;const ae=g.getPathState(fe);if(Array.isArray(ae==null?void 0:ae.id)&&(ae!=null&&ae.multiple)?ae!=null&&ae.id.includes(ke.id):(ae==null?void 0:ae.id)===ke.id){if(ae!=null&&ae.multiple&&Array.isArray(ae.value)){const $e=ae.value.findIndex(dt=>qe(dt,d.toValue(ke.checkedValue)));if($e>-1){const dt=[...ae.value];dt.splice($e,1),g.setFieldValue(fe,dt)}Array.isArray(ae.id)&&ae.id.splice(ae.id.indexOf(ke.id),1)}else g.unsetPathValue(d.toValue(k));g.removePathState(fe,b)}}),ke}function Gm(t){const e=()=>({initialValue:void 0,validateOnMount:!1,bails:!0,label:void 0,validateOnValueUpdate:!0,keepValueOnUnmount:void 0,syncVModel:!1,controlled:!0}),n=!!(t!=null&&t.syncVModel),r=typeof(t==null?void 0:t.syncVModel)=="string"?t.syncVModel:(t==null?void 0:t.modelPropName)||"modelValue",i=n&&!("initialValue"in(t||{}))?ra(d.getCurrentInstance(),r):t==null?void 0:t.initialValue;if(!t)return Object.assign(Object.assign({},e()),{initialValue:i});const s="valueProp"in t?t.valueProp:t.checkedValue,o="standalone"in t?!t.standalone:t.controlled,a=(t==null?void 0:t.modelPropName)||(t==null?void 0:t.syncVModel)||!1;return Object.assign(Object.assign(Object.assign({},e()),t||{}),{initialValue:i,controlled:o??!0,checkedValue:s,syncVModel:a})}function Zm(t,e,n){const r=n!=null&&n.standalone?void 0:Zo(ki),i=n==null?void 0:n.checkedValue,s=n==null?void 0:n.uncheckedValue;function o(a){const l=a.handleChange,c=d.computed(()=>{const f=d.toValue(a.value),h=d.toValue(i);return Array.isArray(f)?f.findIndex(p=>qe(p,h))>=0:qe(h,f)});function u(f,h=!0){var p,m;if(c.value===((p=f==null?void 0:f.target)===null||p===void 0?void 0:p.checked)){h&&a.validate();return}const y=d.toValue(t),g=r==null?void 0:r.getPathState(y),k=ks(f);let x=(m=d.toValue(i))!==null&&m!==void 0?m:k;r&&(g!=null&&g.multiple)&&g.type==="checkbox"?x=Dc(nt(r.values,y)||[],x,void 0):(n==null?void 0:n.type)==="checkbox"&&(x=Dc(d.toValue(a.value),x,d.toValue(s))),l(x,h)}return Object.assign(Object.assign({},a),{checked:c,checkedValue:i,uncheckedValue:s,handleChange:u})}return o(Hc(t,e,n))}function Xm({prop:t,value:e,handleChange:n,shouldValidate:r}){const i=d.getCurrentInstance();if(!i||!t){process.env.NODE_ENV!=="production"&&console.warn("Failed to setup model events because `useField` was not called in setup.");return}const s=typeof t=="string"?t:"modelValue",o=`update:${s}`;s in i.props&&(d.watch(e,a=>{qe(a,ra(i,s))||i.emit(o,a)}),d.watch(()=>ra(i,s),a=>{if(a===gs&&e.value===void 0)return;const l=a===gs?void 0:a;qe(l,e.value)||n(l,r())}))}function ra(t,e){if(t)return t.props[e]}const Qm=d.defineComponent({name:"Field",inheritAttrs:!1,props:{as:{type:[String,Object],default:void 0},name:{type:String,required:!0},rules:{type:[Object,String,Function],default:void 0},validateOnMount:{type:Boolean,default:!1},validateOnBlur:{type:Boolean,default:void 0},validateOnChange:{type:Boolean,default:void 0},validateOnInput:{type:Boolean,default:void 0},validateOnModelUpdate:{type:Boolean,default:void 0},bails:{type:Boolean,default:()=>tr().bails},label:{type:String,default:void 0},uncheckedValue:{type:null,default:void 0},modelValue:{type:null,default:gs},modelModifiers:{type:null,default:()=>({})},"onUpdate:modelValue":{type:null,default:void 0},standalone:{type:Boolean,default:!1},keepValue:{type:Boolean,default:void 0}},setup(t,e){const n=d.toRef(t,"rules"),r=d.toRef(t,"name"),i=d.toRef(t,"label"),s=d.toRef(t,"uncheckedValue"),o=d.toRef(t,"keepValue"),{errors:a,value:l,errorMessage:c,validate:u,handleChange:f,handleBlur:h,setTouched:p,resetField:m,handleReset:y,meta:g,checked:k,setErrors:x}=Jm(r,n,{validateOnMount:t.validateOnMount,bails:t.bails,standalone:t.standalone,type:e.attrs.type,initialValue:tg(t,e),checkedValue:e.attrs.value,uncheckedValue:s,label:i,validateOnValueUpdate:t.validateOnModelUpdate,keepValueOnUnmount:o,syncVModel:!0}),O=function(V,F=!0){f(V,F)},b=d.computed(()=>{const{validateOnInput:B,validateOnChange:V,validateOnBlur:F,validateOnModelUpdate:te}=eg(t);function G(j){h(j,F),Ae(e.attrs.onBlur)&&e.attrs.onBlur(j)}function ne(j){O(j,B),Ae(e.attrs.onInput)&&e.attrs.onInput(j)}function oe(j){O(j,V),Ae(e.attrs.onChange)&&e.attrs.onChange(j)}const re={name:t.name,onBlur:G,onInput:ne,onChange:oe};return re["onUpdate:modelValue"]=j=>O(j,te),re}),C=d.computed(()=>{const B=Object.assign({},b.value);wi(e.attrs.type)&&k&&(B.checked=k.value);const V=Yc(t,e);return vm(V,e.attrs)&&(B.value=l.value),B}),v=d.computed(()=>Object.assign(Object.assign({},b.value),{modelValue:l.value}));function T(){return{field:C.value,componentField:v.value,value:l.value,meta:g,errors:a.value,errorMessage:c.value,validate:u,resetField:m,handleChange:O,handleInput:B=>O(B,!1),handleReset:y,handleBlur:b.value.onBlur,setTouched:p,setErrors:x}}return e.expose({value:l,meta:g,errors:a,errorMessage:c,setErrors:x,setTouched:p,reset:m,validate:u,handleChange:f}),()=>{const B=d.resolveDynamicComponent(Yc(t,e)),V=ea(B,e,T);return B?d.h(B,Object.assign(Object.assign({},e.attrs),C.value),V):V}}});function Yc(t,e){let n=t.as||"";return!t.as&&!e.slots.default&&(n="input"),n}function eg(t){var e,n,r,i;const{validateOnInput:s,validateOnChange:o,validateOnBlur:a,validateOnModelUpdate:l}=tr();return{validateOnInput:(e=t.validateOnInput)!==null&&e!==void 0?e:s,validateOnChange:(n=t.validateOnChange)!==null&&n!==void 0?n:o,validateOnBlur:(r=t.validateOnBlur)!==null&&r!==void 0?r:a,validateOnModelUpdate:(i=t.validateOnModelUpdate)!==null&&i!==void 0?i:l}}function tg(t,e){return wi(e.attrs.type)?Ec(t,"modelValue")?t.modelValue:void 0:Ec(t,"modelValue")?t.modelValue:e.attrs.value}const ws=Qm;let ng=0;const xs=["bails","fieldsCount","id","multiple","type","validate"];function Uc(t){const e=(t==null?void 0:t.initialValues)||{},n=Object.assign({},d.toValue(e)),r=d.unref(t==null?void 0:t.validationSchema);return r&&At(r)&&Ae(r.cast)?pe(r.cast(n)||{}):pe(n)}function rg(t){var e;const n=ng++;let r=0;const i=d.ref(!1),s=d.ref(!1),o=d.ref(0),a=[],l=d.reactive(Uc(t)),c=d.ref([]),u=d.ref({}),f=d.ref({}),h=xm(()=>{f.value=c.value.reduce((M,S)=>(M[vi(d.toValue(S.path))]=S,M),{})});function p(M,S){const E=j(M);if(!E){typeof M=="string"&&(u.value[vi(M)]=Qo(S));return}if(typeof M=="string"){const R=vi(M);u.value[R]&&delete u.value[R]}E.errors=Qo(S),E.valid=!E.errors.length}function m(M){rt(M).forEach(S=>{p(S,M[S])})}t!=null&&t.initialErrors&&m(t.initialErrors);const y=d.computed(()=>{const M=c.value.reduce((S,E)=>(E.errors.length&&(S[E.path]=E.errors),S),{});return Object.assign(Object.assign({},u.value),M)}),g=d.computed(()=>rt(y.value).reduce((M,S)=>{const E=y.value[S];return E!=null&&E.length&&(M[S]=E[0]),M},{})),k=d.computed(()=>c.value.reduce((M,S)=>(M[S.path]={name:S.path||"",label:S.label||""},M),{})),x=d.computed(()=>c.value.reduce((M,S)=>{var E;return M[S.path]=(E=S.bails)!==null&&E!==void 0?E:!0,M},{})),O=Object.assign({},(t==null?void 0:t.initialErrors)||{}),b=(e=t==null?void 0:t.keepValuesOnUnmount)!==null&&e!==void 0?e:!1,{initialValues:C,originalInitialValues:v,setInitialValues:T}=sg(c,l,t),B=ig(c,l,v,g),V=d.computed(()=>c.value.reduce((M,S)=>{const E=nt(l,S.path);return dn(M,S.path,E),M},{})),F=t==null?void 0:t.validationSchema;function te(M,S){var E,R;const U=d.computed(()=>nt(C.value,d.toValue(M))),w=f.value[d.toValue(M)],D=(S==null?void 0:S.type)==="checkbox"||(S==null?void 0:S.type)==="radio";if(w&&D){w.multiple=!0;const tt=r++;return Array.isArray(w.id)?w.id.push(tt):w.id=[w.id,tt],w.fieldsCount++,w.__flags.pendingUnmount[tt]=!1,w}const $=d.computed(()=>nt(l,d.toValue(M))),Y=d.toValue(M),q=ue.findIndex(tt=>tt===Y);q!==-1&&ue.splice(q,1);const X=d.computed(()=>{var tt,kt,Or,er;const cn=d.toValue(F);if(At(cn))return(kt=(tt=cn.describe)===null||tt===void 0?void 0:tt.call(cn,d.toValue(M)).required)!==null&&kt!==void 0?kt:!1;const ms=d.toValue(S==null?void 0:S.schema);return At(ms)&&(er=(Or=ms.describe)===null||Or===void 0?void 0:Or.call(ms).required)!==null&&er!==void 0?er:!1}),he=r++,Oe=d.reactive({id:he,path:M,touched:!1,pending:!1,valid:!0,validated:!!(!((E=O[Y])===null||E===void 0)&&E.length),required:X,initialValue:U,errors:d.shallowRef([]),bails:(R=S==null?void 0:S.bails)!==null&&R!==void 0?R:!1,label:S==null?void 0:S.label,type:(S==null?void 0:S.type)||"default",value:$,multiple:!1,__flags:{pendingUnmount:{[he]:!1},pendingReset:!1},fieldsCount:1,validate:S==null?void 0:S.validate,dirty:d.computed(()=>!qe(d.unref($),d.unref(U)))});return c.value.push(Oe),f.value[Y]=Oe,h(),g.value[Y]&&!O[Y]&&d.nextTick(()=>{_t(Y,{mode:"silent"})}),d.isRef(M)&&d.watch(M,tt=>{h();const kt=pe($.value);f.value[tt]=Oe,d.nextTick(()=>{dn(l,tt,kt)})}),Oe}const G=Ac(ln,5),ne=Ac(ln,5),oe=Xo(async M=>await(M==="silent"?G():ne()),(M,[S])=>{const E=rt(P.errorBag.value),U=[...new Set([...rt(M.results),...c.value.map(w=>w.path),...E])].sort().reduce((w,D)=>{var $;const Y=D,q=j(Y)||ie(Y),X=(($=M.results[Y])===null||$===void 0?void 0:$.errors)||[],he=d.toValue(q==null?void 0:q.path)||Y,Oe=og({errors:X,valid:!X.length},w.results[he]);return w.results[he]=Oe,Oe.valid||(w.errors[he]=Oe.errors[0]),q&&u.value[he]&&delete u.value[he],q?(q.valid=Oe.valid,S==="silent"||S==="validated-only"&&!q.validated||p(q,Oe.errors),w):(p(he,X),w)},{valid:M.valid,results:{},errors:{}});return M.values&&(U.values=M.values),rt(U.results).forEach(w=>{var D;const $=j(w);$&&S!=="silent"&&(S==="validated-only"&&!$.validated||p($,(D=U.results[w])===null||D===void 0?void 0:D.errors))}),U});function re(M){c.value.forEach(M)}function j(M){const S=typeof M=="string"?vi(M):M;return typeof S=="string"?f.value[S]:S}function ie(M){return c.value.filter(E=>M.startsWith(E.path)).reduce((E,R)=>E?R.path.length>E.path.length?R:E:R,void 0)}let ue=[],_e;function Qe(M){return ue.push(M),_e||(_e=d.nextTick(()=>{[...ue].sort().reverse().forEach(E=>{Nc(l,E)}),ue=[],_e=null})),_e}function ct(M){return function(E,R){return function(w){return w instanceof Event&&(w.preventDefault(),w.stopPropagation()),re(D=>D.touched=!0),i.value=!0,o.value++,Wt().then(D=>{const $=pe(l);if(D.valid&&typeof E=="function"){const Y=pe(V.value);let q=M?Y:$;return D.values&&(q=D.values),E(q,{evt:w,controlledValues:Y,setErrors:m,setFieldError:p,setTouched:Zn,setFieldTouched:$e,setValues:ae,setFieldValue:K,resetForm:Tn,resetField:Xn})}!D.valid&&typeof R=="function"&&R({values:$,evt:w,errors:D.errors,results:D.results})}).then(D=>(i.value=!1,D),D=>{throw i.value=!1,D})}}}const vt=ct(!1);vt.withControlled=ct(!0);function ke(M,S){const E=c.value.findIndex(U=>U.path===M&&(Array.isArray(U.id)?U.id.includes(S):U.id===S)),R=c.value[E];if(!(E===-1||!R)){if(d.nextTick(()=>{_t(M,{mode:"silent",warn:!1})}),R.multiple&&R.fieldsCount&&R.fieldsCount--,Array.isArray(R.id)){const U=R.id.indexOf(S);U>=0&&R.id.splice(U,1),delete R.__flags.pendingUnmount[S]}(!R.multiple||R.fieldsCount<=0)&&(c.value.splice(E,1),Nt(M),h(),delete f.value[M])}}function et(M){rt(f.value).forEach(S=>{S.startsWith(M)&&delete f.value[S]}),c.value=c.value.filter(S=>!S.path.startsWith(M)),d.nextTick(()=>{h()})}const P={formId:n,values:l,controlledValues:V,errorBag:y,errors:g,schema:F,submitCount:o,meta:B,isSubmitting:i,isValidating:s,fieldArrays:a,keepValuesOnUnmount:b,validateSchema:d.unref(F)?oe:void 0,validate:Wt,setFieldError:p,validateField:_t,setFieldValue:K,setValues:ae,setErrors:m,setFieldTouched:$e,setTouched:Zn,resetForm:Tn,resetField:Xn,handleSubmit:vt,useFieldModel:pi,defineInputBinds:mi,defineComponentBinds:gi,defineField:Qn,stageInitialValue:an,unsetInitialValue:Nt,setFieldInitialValue:En,createPathState:te,getPathState:j,unsetPathValue:Qe,removePathState:ke,initialValues:C,getAllPathStates:()=>c.value,destroyPath:et,isFieldTouched:dt,isFieldDirty:Sr,isFieldValid:hi};function K(M,S,E=!0){const R=pe(S),U=typeof M=="string"?M:M.path;j(U)||te(U),dn(l,U,R),E&&_t(U)}function fe(M,S=!0){rt(l).forEach(E=>{delete l[E]}),rt(M).forEach(E=>{K(E,M[E],!1)}),S&&Wt()}function ae(M,S=!0){bi(l,M),a.forEach(E=>E&&E.reset()),S&&Wt()}function Re(M,S){const E=j(d.toValue(M))||te(M);return d.computed({get(){return E.value},set(R){var U;const w=d.toValue(M);K(w,R,(U=d.toValue(S))!==null&&U!==void 0?U:!1)}})}function $e(M,S){const E=j(M);E&&(E.touched=S)}function dt(M){const S=j(M);return S?S.touched:c.value.filter(E=>E.path.startsWith(M)).some(E=>E.touched)}function Sr(M){const S=j(M);return S?S.dirty:c.value.filter(E=>E.path.startsWith(M)).some(E=>E.dirty)}function hi(M){const S=j(M);return S?S.valid:c.value.filter(E=>E.path.startsWith(M)).every(E=>E.valid)}function Zn(M){if(typeof M=="boolean"){re(S=>{S.touched=M});return}rt(M).forEach(S=>{$e(S,!!M[S])})}function Xn(M,S){var E;const R=S&&"value"in S?S.value:nt(C.value,M),U=j(M);U&&(U.__flags.pendingReset=!0),En(M,pe(R),!0),K(M,R,!1),$e(M,(E=S==null?void 0:S.touched)!==null&&E!==void 0?E:!1),p(M,(S==null?void 0:S.errors)||[]),d.nextTick(()=>{U&&(U.__flags.pendingReset=!1)})}function Tn(M,S){let E=pe(M!=null&&M.values?M.values:v.value);E=S!=null&&S.force?E:bi(v.value,E),E=At(F)&&Ae(F.cast)?F.cast(E):E,T(E),re(R=>{var U;R.__flags.pendingReset=!0,R.validated=!1,R.touched=((U=M==null?void 0:M.touched)===null||U===void 0?void 0:U[R.path])||!1,K(R.path,nt(E,R.path),!1),p(R.path,void 0)}),S!=null&&S.force?fe(E,!1):ae(E,!1),m((M==null?void 0:M.errors)||{}),o.value=(M==null?void 0:M.submitCount)||0,d.nextTick(()=>{Wt({mode:"silent"}),re(R=>{R.__flags.pendingReset=!1})})}async function Wt(M){const S=(M==null?void 0:M.mode)||"force";if(S==="force"&&re(w=>w.validated=!0),P.validateSchema)return P.validateSchema(S);s.value=!0;const E=await Promise.all(c.value.map(w=>w.validate?w.validate(M).then(D=>({key:w.path,valid:D.valid,errors:D.errors})):Promise.resolve({key:w.path,valid:!0,errors:[]})));s.value=!1;const R={},U={};for(const w of E)R[w.key]={valid:w.valid,errors:w.errors},w.errors.length&&(U[w.key]=w.errors[0]);return{valid:E.every(w=>w.valid),results:R,errors:U}}async function _t(M,S){var E;const R=j(M);if(R&&(S==null?void 0:S.mode)!=="silent"&&(R.validated=!0),F){const{results:w}=await oe((S==null?void 0:S.mode)||"validated-only");return w[M]||{errors:[],valid:!0}}return R!=null&&R.validate?R.validate(S):(!R&&((E=S==null?void 0:S.warn)!==null&&E!==void 0?E:!0)&&process.env.NODE_ENV!=="production"&&d.warn(`field with path ${M} was not found`),Promise.resolve({errors:[],valid:!0}))}function Nt(M){Nc(C.value,M)}function an(M,S,E=!1){En(M,S),dn(l,M,S),E&&!(t!=null&&t.initialValues)&&dn(v.value,M,pe(S))}function En(M,S,E=!1){dn(C.value,M,pe(S)),E&&dn(v.value,M,pe(S))}async function ln(){const M=d.unref(F);if(!M)return{valid:!0,results:{},errors:{}};s.value=!0;const S=ys(M)||At(M)?await Bm(M,l):await Pm(M,l,{names:k.value,bailsMap:x.value});return s.value=!1,S}const Mr=vt((M,{evt:S})=>{Tc(S)&&S.target.submit()});d.onMounted(()=>{if(t!=null&&t.initialErrors&&m(t.initialErrors),t!=null&&t.initialTouched&&Zn(t.initialTouched),t!=null&&t.validateOnMount){Wt();return}P.validateSchema&&P.validateSchema("silent")}),d.isRef(F)&&d.watch(F,()=>{var M;(M=P.validateSchema)===null||M===void 0||M.call(P,"validated-only")}),d.provide(ki,P),process.env.NODE_ENV!=="production"&&(zm(P),d.watch(()=>Object.assign(Object.assign({errors:y.value},B.value),{values:l,isSubmitting:i.value,isValidating:s.value,submitCount:o.value}),Tr,{deep:!0}));function Qn(M,S){const E=Ae(S)||S==null?void 0:S.label,R=j(d.toValue(M))||te(M,{label:E}),U=()=>Ae(S)?S(vs(R,xs)):S||{};function w(){var X;R.touched=!0,((X=U().validateOnBlur)!==null&&X!==void 0?X:tr().validateOnBlur)&&_t(R.path)}function D(){var X;((X=U().validateOnInput)!==null&&X!==void 0?X:tr().validateOnInput)&&d.nextTick(()=>{_t(R.path)})}function $(){var X;((X=U().validateOnChange)!==null&&X!==void 0?X:tr().validateOnChange)&&d.nextTick(()=>{_t(R.path)})}const Y=d.computed(()=>{const X={onChange:$,onInput:D,onBlur:w};return Ae(S)?Object.assign(Object.assign({},X),S(vs(R,xs)).props||{}):S!=null&&S.props?Object.assign(Object.assign({},X),S.props(vs(R,xs))):X});return[Re(M,()=>{var X,he,Oe;return(Oe=(X=U().validateOnModelUpdate)!==null&&X!==void 0?X:(he=tr())===null||he===void 0?void 0:he.validateOnModelUpdate)!==null&&Oe!==void 0?Oe:!0}),Y]}function pi(M){return Array.isArray(M)?M.map(S=>Re(S,!0)):Re(M)}function mi(M,S){const[E,R]=Qn(M,S);function U(){R.value.onBlur()}function w($){const Y=ks($);K(d.toValue(M),Y,!1),R.value.onInput()}function D($){const Y=ks($);K(d.toValue(M),Y,!1),R.value.onChange()}return d.computed(()=>Object.assign(Object.assign({},R.value),{onBlur:U,onInput:w,onChange:D,value:E.value}))}function gi(M,S){const[E,R]=Qn(M,S),U=j(d.toValue(M));function w(D){E.value=D}return d.computed(()=>{const D=Ae(S)?S(vs(U,xs)):S||{};return Object.assign({[D.model||"modelValue"]:E.value,[`onUpdate:${D.model||"modelValue"}`]:w},R.value)})}return Object.assign(Object.assign({},P),{values:d.readonly(l),handleReset:()=>Tn(),submitForm:Mr})}function ig(t,e,n,r){const i={touched:"some",pending:"some",valid:"every"},s=d.computed(()=>!qe(e,d.unref(n)));function o(){const l=t.value;return rt(i).reduce((c,u)=>{const f=i[u];return c[u]=l[f](h=>h[u]),c},{})}const a=d.reactive(o());return d.watchEffect(()=>{const l=o();a.touched=l.touched,a.valid=l.valid,a.pending=l.pending}),d.computed(()=>Object.assign(Object.assign({initialValues:d.unref(n)},a),{valid:a.valid&&!rt(r.value).length,dirty:s.value}))}function sg(t,e,n){const r=Uc(n),i=d.ref(r),s=d.ref(pe(r));function o(a,l=!1){i.value=bi(pe(i.value)||{},pe(a)),s.value=bi(pe(s.value)||{},pe(a)),l&&t.value.forEach(c=>{if(c.touched)return;const f=nt(i.value,c.path);dn(e,c.path,pe(f))})}return{initialValues:i,originalInitialValues:s,setInitialValues:o}}function og(t,e){return e?{valid:t.valid&&e.valid,errors:[...t.errors,...e.errors]}:t}const ag=d.defineComponent({name:"Form",inheritAttrs:!1,props:{as:{type:null,default:"form"},validationSchema:{type:Object,default:void 0},initialValues:{type:Object,default:void 0},initialErrors:{type:Object,default:void 0},initialTouched:{type:Object,default:void 0},validateOnMount:{type:Boolean,default:!1},onSubmit:{type:Function,default:void 0},onInvalidSubmit:{type:Function,default:void 0},keepValues:{type:Boolean,default:!1}},setup(t,e){const n=d.toRef(t,"validationSchema"),r=d.toRef(t,"keepValues"),{errors:i,errorBag:s,values:o,meta:a,isSubmitting:l,isValidating:c,submitCount:u,controlledValues:f,validate:h,validateField:p,handleReset:m,resetForm:y,handleSubmit:g,setErrors:k,setFieldError:x,setFieldValue:O,setValues:b,setFieldTouched:C,setTouched:v,resetField:T}=rg({validationSchema:n.value?n:void 0,initialValues:t.initialValues,initialErrors:t.initialErrors,initialTouched:t.initialTouched,validateOnMount:t.validateOnMount,keepValuesOnUnmount:r}),B=g((j,{evt:ie})=>{Tc(ie)&&ie.target.submit()},t.onInvalidSubmit),V=t.onSubmit?g(t.onSubmit,t.onInvalidSubmit):B;function F(j){Ko(j)&&j.preventDefault(),m(),typeof e.attrs.onReset=="function"&&e.attrs.onReset()}function te(j,ie){return g(typeof j=="function"&&!ie?j:ie,t.onInvalidSubmit)(j)}function G(){return pe(o)}function ne(){return pe(a.value)}function oe(){return pe(i.value)}function re(){return{meta:a.value,errors:i.value,errorBag:s.value,values:o,isSubmitting:l.value,isValidating:c.value,submitCount:u.value,controlledValues:f.value,validate:h,validateField:p,handleSubmit:te,handleReset:m,submitForm:B,setErrors:k,setFieldError:x,setFieldValue:O,setValues:b,setFieldTouched:C,setTouched:v,resetForm:y,resetField:T,getValues:G,getMeta:ne,getErrors:oe}}return e.expose({setFieldError:x,setErrors:k,setFieldValue:O,setValues:b,setFieldTouched:C,setTouched:v,resetForm:y,validate:h,validateField:p,resetField:T,getValues:G,getMeta:ne,getErrors:oe,values:o,meta:a,errors:i}),function(){const ie=t.as==="form"?t.as:t.as?d.resolveDynamicComponent(t.as):null,ue=ea(ie,e,re);if(!ie)return ue;const _e=ie==="form"?{novalidate:!0}:{};return d.h(ie,Object.assign(Object.assign(Object.assign({},_e),e.attrs),{onSubmit:V,onReset:F}),ue)}}}),lg=d.defineComponent({name:"ErrorMessage",props:{as:{type:String,default:void 0},name:{type:String,required:!0}},setup(t,e){const n=d.inject(ki,void 0),r=d.computed(()=>n==null?void 0:n.errors.value[t.name]);function i(){return{message:r.value}}return()=>{if(!r.value)return;const s=t.as?d.resolveDynamicComponent(t.as):t.as,o=ea(s,e,i),a=Object.assign({role:"alert"},e.attrs);return!s&&(Array.isArray(o)||!o)&&(o!=null&&o.length)?o:(Array.isArray(o)||!o)&&!(o!=null&&o.length)?d.h(s||"span",a,r.value):d.h(s,a,o)}}});function cg(t){const e=Zo(ki),n=t?void 0:d.inject(Oc);return d.computed(()=>t?e==null?void 0:e.errors.value[d.toValue(t)]:n==null?void 0:n.errorMessage.value)}Dt("required",t=>typeof t=="object"&&t!=null||typeof t=="boolean"&&t===!0?!0:!t||!t.length?"This field is required":!0),Dt("email",t=>{var e=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return e.test(String(t).trim().toLowerCase())?!0:"This field must be a valid email"}),Dt("strong_password",t=>t?t.indexOf(" ")>-1?"Password shouldn't contain space":t.length<8||t.length>30?"Password must be between 8 and 30 characters":t.match(/[a-z]/)===null||t.match(/[A-Z]/)===null||t.match(/\d/)===null?"Password must contain at least one uppercase letter, one lowercase letter and one number digit":!0:"Password is required"),Dt("no_space",t=>(t==null?void 0:t.indexOf(" "))>-1?"This field shouldn't contain space":!0),Dt("minLength",(t,[e])=>!t||!t.length?!0:t.length<e?`This field must be at least ${e} characters`:!0),Dt("hasUppercaseLetter",t=>/[A-Z]/.test(t)?!0:"This field must have at least one uppercase character"),Dt("hasLowercaseLetter",t=>/[a-z]/.test(t)?!0:"This field must have at least one lowercase character"),Dt("hasNumber",t=>/\d/.test(t)?!0:"This field must have at least one number"),Dt("hasSpecialCharacter",t=>/[!@$%^&*(),.?":{}|]/.test(t)?!0:"This field must have at least one special character"),Dt("url",t=>{var e=/(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})/gi;return e.test(String(t).trim().toLowerCase())?!0:"This field must be a valid URL"}),Dt("number",t=>parseFloat(t)?!0:"This field must be a number");const ye=(t,e)=>{const n=t.__vccOpts||t;for(const[r,i]of e)n[r]=i;return n},dg={},ug={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",fill:"currentColor"},fg=[d.createElementVNode("path",{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200z"},null,-1)];function hg(t,e){return d.openBlock(),d.createElementBlock("svg",ug,fg)}const pg=ye(dg,[["render",hg]]),mg={},gg={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",fill:"currentColor"},yg=[d.createElementVNode("path",{d:"M460.116 373.846l-20.823-12.022c-5.541-3.199-7.54-10.159-4.663-15.874 30.137-59.886 28.343-131.652-5.386-189.946-33.641-58.394-94.896-95.833-161.827-99.676C261.028 55.961 256 50.751 256 44.352V20.309c0-6.904 5.808-12.337 12.703-11.982 83.556 4.306 160.163 50.864 202.11 123.677 42.063 72.696 44.079 162.316 6.031 236.832-3.14 6.148-10.75 8.461-16.728 5.01z"},null,-1)];function bg(t,e){return d.openBlock(),d.createElementBlock("svg",gg,yg)}const vg=ye(mg,[["render",bg]]),kg={class:"relative"},Ss=Object.assign({name:"WpicSpinner"},{props:{color:{type:String,default:""}},setup(t){return(e,n)=>(d.openBlock(),d.createElementBlock("div",kg,[d.createVNode(pg,{class:"absolute opacity-25"}),d.createVNode(vg,{class:d.normalizeClass(["animate-spin",{[`${t.color}`]:!0}])},null,8,["class"])]))}});let Se={theme:"pmi"};const wg={key:0,class:"absolute inset-0 flex justify-center items-center"},xg=Object.assign({name:"WpicButton"},{props:{label:String,primary:Boolean,type:{type:String,default:"button"},secondary:Boolean,inverse:Boolean,disabled:Boolean,full:Boolean,loading:Boolean,outline:{type:Boolean,default:!0},medium:Boolean,small:Boolean,mini:Boolean,plain:Boolean,outlining:Boolean,square:Boolean,to:[String,Object]},setup(t){const e=t,n=d.computed(()=>e.to?"router-link":"button"),r={pmi:"bg-violet-800 border border-violet-800 focus:bg-violet-800 text-white disabled:bg-zinc-100 disabled:text-zinc-400 disabled:border-zinc-100 enabled:hover:bg-violet-900 enabled:hover:border-violet-900 active:scale-95 enabled:transform","wpic-tools":"text-white bg-lime-500 border-lime-500 enabled:hover:bg-lime-400 enabled:hover:border-lime-400 enabled:active:bg-lime-500 enabled:active:border-lime-500 enabled:active:shadow-inner disabled:bg-lime-600/25 disabled:text-white disabled:border-0"},i={pmi:"bg-white text-violet-800 border-zinc-400 dark:border-zinc-700 dark:text-zinc-200 dark:bg-zinc-700 dark:hover:bg-zinc-600 dark:hover:border-zinc-600 disabled:text-zinc-400 active:scale-95 enabled:transform","wpic-tools":"text-slate-700 bg-slate-100 border-slate-300 enabled:hover:bg-lime-50 enabled:hover:border-lime-300 enabled:hover:text-lime-600 enabled:active:shadow-inner disabled:border-slate-200 disabled:text-zinc-400 disabled:bg-slate-50/50"},s={pmi:"border-zinc-300 dark:border-zinc-700 dark:text-zinc-300","wpic-tools":"border-slate-200 bg-slate-200 enabled:hover:bg-slate-300 enabled:hover:border-slate-300 enabled:active:bg-slate-200 enabled:active:border-slate-200 enabled:active:shadow-inner disabled:bg-slate-100 disabled:text-zinc-400 disabled:border-0"},o={pmi:"text-violet-800 hover:underline","wpic-tools":"text-lime-800 hover:underline"},a={pmi:"hover:text-violet-800","wpic-tools":"hover:text-lime-800"};return(l,c)=>(d.openBlock(),d.createBlock(d.resolveDynamicComponent(n.value),{to:t.to,type:t.type,disabled:t.disabled,class:d.normalizeClass([{"cursor-pointer":!t.disabled&&!t.loading,"active:outline active:outline-2 active:outline-offset-4":!t.disabled&&!t.loading&&t.outlining,"cursor-not-allowed":t.disabled,border:t.outline&&!t.plain,[`${r[d.unref(Se).theme]}`]:t.primary&&!t.plain&&!t.inverse,[`${i[d.unref(Se).theme]}`]:t.secondary,[`${s[d.unref(Se).theme]}`]:!t.primary&&!t.secondary&&!t.plain,[`${o[d.unref(Se).theme]}`]:t.primary&&t.plain,[`${a[d.unref(Se).theme]}`]:!t.primary&&t.plain,"bg-zinc-50 border-violet-800 text-violet-800":t.primary&&t.inverse,"hover:bg-white":t.primary&&t.inverse&&!t.disabled&&!t.loading,"w-full":t.full,"text-opacity-50":t.disabled,"text-sm":t.small,"px-4 py-1 rounded h-8":t.small&&!t.plain,"px-5 py-1 rounded h-10":t.medium&&!t.plain,"px-5 py-1 rounded h-12":!t.small&&!t.medium&&!t.plain,"px-0 aspect-square":t.square},"wpic-button leading-none font-medium no-underline appearance-none outline-zinc-600 focus:outline-none relative inline-flex justify-center items-center"])},{default:d.withCtx(()=>[t.loading?(d.openBlock(),d.createElementBlock("div",wg,[d.createVNode(Ss,{class:"w-6 h-6"})])):d.createCommentVNode("",!0),d.createElementVNode("span",{class:d.normalizeClass(["flex items-center select-none whitespace-nowrap",{"opacity-0":t.loading}])},[d.renderSlot(l.$slots,"default",{},()=>[d.createTextVNode(d.toDisplayString(t.label),1)])],2)]),_:3},8,["to","type","disabled","class"]))}}),Sg={name:"WpicButtonGroup"},Mg={class:"wpic-button-group flex flex-wrap"};function Og(t,e,n,r,i,s){return d.openBlock(),d.createElementBlock("div",Mg,[d.renderSlot(t.$slots,"default")])}const Cg=ye(Sg,[["render",Og]]),Tg={name:"WpicInputGroup"},Eg={class:"wpic-input-group flex w-full"};function _g(t,e,n,r,i,s){return d.openBlock(),d.createElementBlock("div",Eg,[d.renderSlot(t.$slots,"default")])}const Ng=ye(Tg,[["render",_g]]),Dg=Object.assign({name:"WpicForm"},{setup(t){return(e,n)=>(d.openBlock(),d.createBlock(d.unref(ag),null,{default:d.withCtx(({values:r,meta:i,errors:s})=>[d.renderSlot(e.$slots,"default")]),_:3}))}}),ia=Math.min,_r=Math.max,Ms=Math.round,Nn=t=>({x:t,y:t}),Ag={left:"right",right:"left",bottom:"top",top:"bottom"},Vg={start:"end",end:"start"};function qc(t,e,n){return _r(t,ia(e,n))}function Os(t,e){return typeof t=="function"?t(e):t}function nr(t){return t.split("-")[0]}function Cs(t){return t.split("-")[1]}function Kc(t){return t==="x"?"y":"x"}function Jc(t){return t==="y"?"height":"width"}function Ts(t){return["top","bottom"].includes(nr(t))?"y":"x"}function Gc(t){return Kc(Ts(t))}function Bg(t,e,n){n===void 0&&(n=!1);const r=Cs(t),i=Gc(t),s=Jc(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=Es(o)),[o,Es(o)]}function Pg(t){const e=Es(t);return[sa(t),e,sa(e)]}function sa(t){return t.replace(/start|end/g,e=>Vg[e])}function Ig(t,e,n){const r=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:r:e?r:i;case"left":case"right":return e?s:o;default:return[]}}function Rg(t,e,n,r){const i=Cs(t);let s=Ig(nr(t),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(sa)))),s}function Es(t){return t.replace(/left|right|bottom|top/g,e=>Ag[e])}function $g(t){return{top:0,right:0,bottom:0,left:0,...t}}function Lg(t){return typeof t!="number"?$g(t):{top:t,right:t,bottom:t,left:t}}function _s(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function Zc(t,e,n){let{reference:r,floating:i}=t;const s=Ts(e),o=Gc(e),a=Jc(o),l=nr(e),c=s==="y",u=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let p;switch(l){case"top":p={x:u,y:r.y-i.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-i.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Cs(e)){case"start":p[o]-=h*(n&&c?-1:1);break;case"end":p[o]+=h*(n&&c?-1:1);break}return p}const Fg=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:f}=Zc(c,r,l),h=r,p={},m=0;for(let y=0;y<a.length;y++){const{name:g,fn:k}=a[y],{x,y:O,data:b,reset:C}=await k({x:u,y:f,initialPlacement:r,placement:h,strategy:i,middlewareData:p,rects:c,platform:o,elements:{reference:t,floating:e}});u=x??u,f=O??f,p={...p,[g]:{...p[g],...b}},C&&m<=50&&(m++,typeof C=="object"&&(C.placement&&(h=C.placement),C.rects&&(c=C.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):C.rects),{x:u,y:f}=Zc(c,h,l)),y=-1)}return{x:u,y:f,placement:h,strategy:i,middlewareData:p}};async function Xc(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=Os(e,t),m=Lg(p),g=a[h?f==="floating"?"reference":"floating":f],k=_s(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(g)))==null||n?g:g.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),x=f==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,O=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),b=await(s.isElement==null?void 0:s.isElement(O))?await(s.getScale==null?void 0:s.getScale(O))||{x:1,y:1}:{x:1,y:1},C=_s(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:O,strategy:l}):x);return{top:(k.top-C.top+m.top)/b.y,bottom:(C.bottom-k.bottom+m.bottom)/b.y,left:(k.left-C.left+m.left)/b.x,right:(C.right-k.right+m.right)/b.x}}const zg=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...g}=Os(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const k=nr(i),x=nr(a)===a,O=await(l.isRTL==null?void 0:l.isRTL(c.floating)),b=h||(x||!y?[Es(a)]:Pg(a));!h&&m!=="none"&&b.push(...Rg(a,y,m,O));const C=[a,...b],v=await Xc(e,g),T=[];let B=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&T.push(v[k]),f){const G=Bg(i,o,O);T.push(v[G[0]],v[G[1]])}if(B=[...B,{placement:i,overflows:T}],!T.every(G=>G<=0)){var V,F;const G=(((V=s.flip)==null?void 0:V.index)||0)+1,ne=C[G];if(ne)return{data:{index:G,overflows:B},reset:{placement:ne}};let oe=(F=B.filter(re=>re.overflows[0]<=0).sort((re,j)=>re.overflows[1]-j.overflows[1])[0])==null?void 0:F.placement;if(!oe)switch(p){case"bestFit":{var te;const re=(te=B.map(j=>[j.placement,j.overflows.filter(ie=>ie>0).reduce((ie,ue)=>ie+ue,0)]).sort((j,ie)=>j[1]-ie[1])[0])==null?void 0:te[0];re&&(oe=re);break}case"initialPlacement":oe=a;break}if(i!==oe)return{reset:{placement:oe}}}return{}}}};async function jg(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=nr(n),a=Cs(n),l=Ts(n)==="y",c=["left","top"].includes(o)?-1:1,u=s&&l?-1:1,f=Os(e,t);let{mainAxis:h,crossAxis:p,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return a&&typeof m=="number"&&(p=a==="end"?m*-1:m),l?{x:p*u,y:h*c}:{x:h*c,y:p*u}}const Wg=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=e,l=await jg(e,t);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},Hg=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:g=>{let{x:k,y:x}=g;return{x:k,y:x}}},...l}=Os(t,e),c={x:n,y:r},u=await Xc(e,l),f=Ts(nr(i)),h=Kc(f);let p=c[h],m=c[f];if(s){const g=h==="y"?"top":"left",k=h==="y"?"bottom":"right",x=p+u[g],O=p-u[k];p=qc(x,p,O)}if(o){const g=f==="y"?"top":"left",k=f==="y"?"bottom":"right",x=m+u[g],O=m-u[k];m=qc(x,m,O)}const y=a.fn({...e,[h]:p,[f]:m});return{...y,data:{x:y.x-n,y:y.y-r}}}}};function Nr(t){return Qc(t)?(t.nodeName||"").toLowerCase():"#document"}function ut(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Dn(t){var e;return(e=(Qc(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Qc(t){return t instanceof Node||t instanceof ut(t).Node}function Ht(t){return t instanceof Element||t instanceof ut(t).Element}function Yt(t){return t instanceof HTMLElement||t instanceof ut(t).HTMLElement}function ed(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof ut(t).ShadowRoot}function Mi(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=Vt(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function Yg(t){return["table","td","th"].includes(Nr(t))}function oa(t){const e=aa(),n=Vt(t);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function Ug(t){let e=An(t);for(;Yt(e)&&!Dr(e);){if(oa(e))return e;e=An(e)}return null}function aa(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Dr(t){return["html","body","#document"].includes(Nr(t))}function Vt(t){return ut(t).getComputedStyle(t)}function Ns(t){return Ht(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function An(t){if(Nr(t)==="html")return t;const e=t.assignedSlot||t.parentNode||ed(t)&&t.host||Dn(t);return ed(e)?e.host:e}function td(t){const e=An(t);return Dr(e)?t.ownerDocument?t.ownerDocument.body:t.body:Yt(e)&&Mi(e)?e:td(e)}function la(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=td(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),o=ut(i);return s?e.concat(o,o.visualViewport||[],Mi(i)?i:[],o.frameElement&&n?la(o.frameElement):[]):e.concat(i,la(i,[],n))}function nd(t){const e=Vt(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Yt(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r,a=Ms(n)!==s||Ms(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function rd(t){return Ht(t)?t:t.contextElement}function Ar(t){const e=rd(t);if(!Yt(e))return Nn(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=nd(e);let o=(s?Ms(n.width):n.width)/r,a=(s?Ms(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const qg=Nn(0);function id(t){const e=ut(t);return!aa()||!e.visualViewport?qg:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Kg(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==ut(t)?!1:e}function Oi(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=rd(t);let o=Nn(1);e&&(r?Ht(r)&&(o=Ar(r)):o=Ar(t));const a=Kg(s,n,r)?id(s):Nn(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,f=i.height/o.y;if(s){const h=ut(s),p=r&&Ht(r)?ut(r):r;let m=h,y=m.frameElement;for(;y&&r&&p!==m;){const g=Ar(y),k=y.getBoundingClientRect(),x=Vt(y),O=k.left+(y.clientLeft+parseFloat(x.paddingLeft))*g.x,b=k.top+(y.clientTop+parseFloat(x.paddingTop))*g.y;l*=g.x,c*=g.y,u*=g.x,f*=g.y,l+=O,c+=b,m=ut(y),y=m.frameElement}}return _s({width:u,height:f,x:l,y:c})}const Jg=[":popover-open",":modal"];function ca(t){return Jg.some(e=>{try{return t.matches(e)}catch{return!1}})}function Gg(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",o=Dn(r),a=e?ca(e.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=Nn(1);const u=Nn(0),f=Yt(r);if((f||!f&&!s)&&((Nr(r)!=="body"||Mi(o))&&(l=Ns(r)),Yt(r))){const h=Oi(r);c=Ar(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x,y:n.y*c.y-l.scrollTop*c.y+u.y}}function Zg(t){return Array.from(t.getClientRects())}function sd(t){return Oi(Dn(t)).left+Ns(t).scrollLeft}function Xg(t){const e=Dn(t),n=Ns(t),r=t.ownerDocument.body,i=_r(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=_r(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+sd(t);const a=-n.scrollTop;return Vt(r).direction==="rtl"&&(o+=_r(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}function Qg(t,e){const n=ut(t),r=Dn(t),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const c=aa();(!c||c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a,y:l}}function e0(t,e){const n=Oi(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=Yt(t)?Ar(t):Nn(1),o=t.clientWidth*s.x,a=t.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:o,height:a,x:l,y:c}}function od(t,e,n){let r;if(e==="viewport")r=Qg(t,n);else if(e==="document")r=Xg(Dn(t));else if(Ht(e))r=e0(e,n);else{const i=id(t);r={...e,x:e.x-i.x,y:e.y-i.y}}return _s(r)}function ad(t,e){const n=An(t);return n===e||!Ht(n)||Dr(n)?!1:Vt(n).position==="fixed"||ad(n,e)}function t0(t,e){const n=e.get(t);if(n)return n;let r=la(t,[],!1).filter(a=>Ht(a)&&Nr(a)!=="body"),i=null;const s=Vt(t).position==="fixed";let o=s?An(t):t;for(;Ht(o)&&!Dr(o);){const a=Vt(o),l=oa(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Mi(o)&&!l&&ad(t,o))?r=r.filter(u=>u!==o):i=a,o=An(o)}return e.set(t,r),r}function n0(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?ca(e)?[]:t0(e,this._c):[].concat(n),r],a=o[0],l=o.reduce((c,u)=>{const f=od(e,u,i);return c.top=_r(f.top,c.top),c.right=ia(f.right,c.right),c.bottom=ia(f.bottom,c.bottom),c.left=_r(f.left,c.left),c},od(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function r0(t){const{width:e,height:n}=nd(t);return{width:e,height:n}}function i0(t,e,n){const r=Yt(e),i=Dn(e),s=n==="fixed",o=Oi(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=Nn(0);if(r||!r&&!s)if((Nr(e)!=="body"||Mi(i))&&(a=Ns(e)),r){const f=Oi(e,!0,s,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}else i&&(l.x=sd(i));const c=o.left+a.scrollLeft-l.x,u=o.top+a.scrollTop-l.y;return{x:c,y:u,width:o.width,height:o.height}}function da(t){return Vt(t).position==="static"}function ld(t,e){return!Yt(t)||Vt(t).position==="fixed"?null:e?e(t):t.offsetParent}function cd(t,e){const n=ut(t);if(ca(t))return n;if(!Yt(t)){let i=An(t);for(;i&&!Dr(i);){if(Ht(i)&&!da(i))return i;i=An(i)}return n}let r=ld(t,e);for(;r&&Yg(r)&&da(r);)r=ld(r,e);return r&&Dr(r)&&da(r)&&!oa(r)?n:r||Ug(t)||n}const s0=async function(t){const e=this.getOffsetParent||cd,n=this.getDimensions,r=await n(t.floating);return{reference:i0(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function o0(t){return Vt(t).direction==="rtl"}const a0={convertOffsetParentRelativeRectToViewportRelativeRect:Gg,getDocumentElement:Dn,getClippingRect:n0,getOffsetParent:cd,getElementRects:s0,getClientRects:Zg,getDimensions:r0,getScale:Ar,isElement:Ht,isRTL:o0},l0=Wg,c0=Hg,d0=zg,u0=(t,e,n)=>{const r=new Map,i={platform:a0,...n},s={...i.platform,_c:r};return Fg(t,e,{...i,platform:s})};function f0(t,e,n){if(!t)throw new Error("A target component has to be provided.");if(!e)throw new Error("A callback has to be provided.");const r=i=>{i.target===t.value||i.composedPath().includes(t.value)||i.target===n.value||i.composedPath().includes(n.value)||typeof e=="function"&&e()};d.onMounted(()=>{window.addEventListener("click",r)}),d.onBeforeUnmount(()=>{window.removeEventListener("click",r)})}const h0={},p0={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},m0=[d.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"},null,-1)];function g0(t,e){return d.openBlock(),d.createElementBlock("svg",p0,m0)}const ua=ye(h0,[["render",g0]]);let Ds;const y0=new Uint8Array(16);function b0(){if(!Ds&&(Ds=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ds))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ds(y0)}const Le=[];for(let t=0;t<256;++t)Le.push((t+256).toString(16).slice(1));function v0(t,e=0){return Le[t[e+0]]+Le[t[e+1]]+Le[t[e+2]]+Le[t[e+3]]+"-"+Le[t[e+4]]+Le[t[e+5]]+"-"+Le[t[e+6]]+Le[t[e+7]]+"-"+Le[t[e+8]]+Le[t[e+9]]+"-"+Le[t[e+10]]+Le[t[e+11]]+Le[t[e+12]]+Le[t[e+13]]+Le[t[e+14]]+Le[t[e+15]]}const dd={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ud(t,e,n){if(dd.randomUUID&&!e&&!t)return dd.randomUUID();t=t||{};const r=t.random||(t.rng||b0)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,v0(r)}let fa={isMobile(){return!!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},capitalize(t){return t?(t=t.toString(),t=t.replace(/(?:^|\s)\S/g,function(e){return e.toUpperCase()}).trim(),t.charAt(0).toUpperCase()+t.slice(1)):""}};const k0={class:"bg-white rounded-t-lg w-full"},w0={class:"flex justify-between items-center border-b px-4 py-3"},Ci=Object.assign({name:"WpicPopover"},{props:{placement:{type:String,default:"bottom-start"},label:String,hover:Boolean,custom:Boolean,disabled:Boolean,offset:{type:Number,default:0},customWidth:{}},setup(t,{expose:e}){const n=ud(),r=t,i={pmi:"lg:absolute shadow-[0_5px_30px_0px_rgba(0,0,0,0.25)]","wpic-tools":"mt-2 md:absolute border border-slate-300 shadow-md"},s={pmi:"lg:hidden","wpic-tools":"md:hidden"},o=d.ref(null),a=d.ref(null),l=d.ref(!0);fa.isMobile()||f0(a,()=>{u()},o);function c(){fa.isMobile()&&(document.documentElement.style.overflow="hidden",document.querySelector("#app").style.overflow="hidden"),r.disabled||(l.value=!1,f())}function u(){document.documentElement.style.overflow=null,document.querySelector("#app").style.overflow=null,l.value=!0}async function f(){const m=await u0(o.value,a.value,{placement:r.placement,middleware:[d0(),c0(),l0(r.offset)]});a.value.style.left=`${m.x}px`,a.value.style.top=`${m.y}px`}function h(){r.hover&&c()}function p(){r.hover&&u()}return e({hide:u}),(m,y)=>(d.openBlock(),d.createElementBlock(d.Fragment,null,[(d.openBlock(),d.createElementBlock("div",{class:"w-full",key:`reference_${d.unref(n)}`,ref_key:"reference",ref:o,onMouseenter:h,onMouseleave:p,onClick:y[0]||(y[0]=g=>l.value?c():u())},[d.renderSlot(m.$slots,"default",{isHidden:l.value})],32)),(d.openBlock(),d.createBlock(d.Teleport,{to:"body"},[(d.openBlock(),d.createElementBlock("div",{key:`floating_${d.unref(n)}`,ref_key:"floating",ref:a,class:d.normalizeClass(["z-10 bg-white rounded-md overflow-hidden",{[`${t.customWidth}`]:!0,hidden:l.value,[`${i[d.unref(Se).theme]}`]:!l.value,"bg-white px-3 py-2 rounded-md":!t.custom}])},[d.renderSlot(m.$slots,"content")],2)),d.createElementVNode("div",{onClick:y[1]||(y[1]=g=>u()),class:d.normalizeClass(["fixed z-20 flex items-end w-screen h-screen top-0 bg-black/20",{hidden:l.value,[`${s[d.unref(Se).theme]}`]:!0}])},[d.createElementVNode("div",k0,[d.createElementVNode("div",w0,[d.createElementVNode("span",null,d.toDisplayString(t.label),1),d.createVNode(ua,{onClick:u,class:"w-4 h-4"})]),d.renderSlot(m.$slots,"content")])],2)]))],64))}}),x0={},S0={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},M0=[d.createElementVNode("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"},null,-1),d.createElementVNode("path",{"fill-rule":"evenodd",d:"M1.323 11.447C2.811 6.976 7.028 3.75 12.001 3.75c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113-1.487 4.471-5.705 7.697-10.677 7.697-4.97 0-9.186-3.223-10.675-7.69a1.762 1.762 0 0 1 0-1.113ZM17.25 12a5.25 5.25 0 1 1-10.5 0 5.25 5.25 0 0 1 10.5 0Z","clip-rule":"evenodd"},null,-1)];function O0(t,e){return d.openBlock(),d.createElementBlock("svg",S0,M0)}const C0=ye(x0,[["render",O0]]),T0={},E0={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},_0=[d.createElementVNode("path",{d:"M3.53 2.47a.75.75 0 0 0-1.06 1.06l18 18a.75.75 0 1 0 1.06-1.06l-18-18ZM22.676 12.553a11.249 11.249 0 0 1-2.631 4.31l-3.099-3.099a5.25 5.25 0 0 0-6.71-6.71L7.759 4.577a11.217 11.217 0 0 1 4.242-.827c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113Z"},null,-1),d.createElementVNode("path",{d:"M15.75 12c0 .18-.013.357-.037.53l-4.244-4.243A3.75 3.75 0 0 1 15.75 12ZM12.53 15.713l-4.243-4.244a3.75 3.75 0 0 0 4.244 4.243Z"},null,-1),d.createElementVNode("path",{d:"M6.75 12c0-.619.107-1.213.304-1.764l-3.1-3.1a11.25 11.25 0 0 0-2.63 4.31c-.12.362-.12.752 0 1.114 1.489 4.467 5.704 7.69 10.675 7.69 1.5 0 2.933-.294 4.242-.827l-2.477-2.477A5.25 5.25 0 0 1 6.75 12Z"},null,-1)];function N0(t,e){return d.openBlock(),d.createElementBlock("svg",E0,_0)}const D0=ye(T0,[["render",N0]]),A0={},V0={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},B0=[d.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4.5 12.75l6 6 9-13.5"},null,-1)];function P0(t,e){return d.openBlock(),d.createElementBlock("svg",V0,B0)}const fd=ye(A0,[["render",P0]]),I0={},R0={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},$0=[d.createElementVNode("path",{"fill-rule":"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm8.706-1.442c1.146-.573 2.437.463 2.126 1.706l-.709 2.836.042-.02a.75.75 0 0 1 .67 1.34l-.04.022c-1.147.573-2.438-.463-2.127-1.706l.71-2.836-.042.02a.75.75 0 1 1-.671-1.34l.041-.022ZM12 9a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z","clip-rule":"evenodd"},null,-1)];function L0(t,e){return d.openBlock(),d.createElementBlock("svg",R0,$0)}const hd=ye(I0,[["render",L0]]);var As=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function F0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function z0(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var pd=z0,j0=typeof As=="object"&&As&&As.Object===Object&&As,W0=j0,H0=W0,Y0=typeof self=="object"&&self&&self.Object===Object&&self,U0=H0||Y0||Function("return this")(),md=U0,q0=md,K0=function(){return q0.Date.now()},J0=K0,G0=/\s/;function Z0(t){for(var e=t.length;e--&&G0.test(t.charAt(e)););return e}var X0=Z0,Q0=X0,ey=/^\s+/;function ty(t){return t&&t.slice(0,Q0(t)+1).replace(ey,"")}var ny=ty,ry=md,iy=ry.Symbol,gd=iy,yd=gd,bd=Object.prototype,sy=bd.hasOwnProperty,oy=bd.toString,Ti=yd?yd.toStringTag:void 0;function ay(t){var e=sy.call(t,Ti),n=t[Ti];try{t[Ti]=void 0;var r=!0}catch{}var i=oy.call(t);return r&&(e?t[Ti]=n:delete t[Ti]),i}var ly=ay,cy=Object.prototype,dy=cy.toString;function uy(t){return dy.call(t)}var fy=uy,vd=gd,hy=ly,py=fy,my="[object Null]",gy="[object Undefined]",kd=vd?vd.toStringTag:void 0;function yy(t){return t==null?t===void 0?gy:my:kd&&kd in Object(t)?hy(t):py(t)}var by=yy;function vy(t){return t!=null&&typeof t=="object"}var ky=vy,wy=by,xy=ky,Sy="[object Symbol]";function My(t){return typeof t=="symbol"||xy(t)&&wy(t)==Sy}var Oy=My,Cy=ny,wd=pd,Ty=Oy,xd=NaN,Ey=/^[-+]0x[0-9a-f]+$/i,_y=/^0b[01]+$/i,Ny=/^0o[0-7]+$/i,Dy=parseInt;function Ay(t){if(typeof t=="number")return t;if(Ty(t))return xd;if(wd(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=wd(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=Cy(t);var n=_y.test(t);return n||Ny.test(t)?Dy(t.slice(2),n?2:8):Ey.test(t)?xd:+t}var Vy=Ay,By=pd,ha=J0,Sd=Vy,Py="Expected a function",Iy=Math.max,Ry=Math.min;function $y(t,e,n){var r,i,s,o,a,l,c=0,u=!1,f=!1,h=!0;if(typeof t!="function")throw new TypeError(Py);e=Sd(e)||0,By(n)&&(u=!!n.leading,f="maxWait"in n,s=f?Iy(Sd(n.maxWait)||0,e):s,h="trailing"in n?!!n.trailing:h);function p(v){var T=r,B=i;return r=i=void 0,c=v,o=t.apply(B,T),o}function m(v){return c=v,a=setTimeout(k,e),u?p(v):o}function y(v){var T=v-l,B=v-c,V=e-T;return f?Ry(V,s-B):V}function g(v){var T=v-l,B=v-c;return l===void 0||T>=e||T<0||f&&B>=s}function k(){var v=ha();if(g(v))return x(v);a=setTimeout(k,y(v))}function x(v){return a=void 0,h&&r?p(v):(r=i=void 0,o)}function O(){a!==void 0&&clearTimeout(a),c=0,r=l=i=a=void 0}function b(){return a===void 0?o:x(ha())}function C(){var v=ha(),T=g(v);if(r=arguments,i=this,l=v,T){if(a===void 0)return m(l);if(f)return clearTimeout(a),a=setTimeout(k,e),p(l)}return a===void 0&&(a=setTimeout(k,e)),o}return C.cancel=O,C.flush=b,C}var Ly=$y;const Fy=F0(Ly),zy={key:0,class:"mb-2 gap-2 wpic-form-label text-base text-zinc-600 dark:text-zinc-300 flex items-center"},jy={class:""},Wy=["name","value","checked"],Hy={key:0,class:"absolute left-0 ml-3 h-full flex items-center justify-center text-center"},Yy={class:"opacity-50 w-4 h-4 leading-tight"},Uy={key:3,class:"absolute z-10 right-0 mr-3 h-full flex items-center"},qy={class:"min-w-5 h-5 leading-tight cursor-pointer"},Ky={key:5,class:"text-red-700 mt-1 text-base"},Jy=Object.assign({name:"WpicFormField"},{props:{label:{type:[String,Number]},placeholder:String,name:{type:String,default:null},select:Boolean,checkbox:Boolean,radio:Boolean,textarea:Boolean,rules:{},type:{type:String,default:"text"},tag:{type:String,default:null},options:{type:Array},required:Boolean,email:Boolean,multiple:Boolean,slim:Boolean,error:{type:Boolean,default:!0},clearable:Boolean,modelValue:{},checkboxValue:{},uncheckedValue:{},radioValue:{},disabled:Boolean,debounce:{type:Number,default:0},loading:Boolean,password:Boolean,addLabel:{type:String,default:"Add"},help:String,labelName:Boolean,half:Boolean,hideSelect:Boolean,date:Boolean,range:Boolean,rows:{type:[String,Number],default:3},transparent:Boolean,loadingPercent:{type:Number,default:null},loadingPulse:{type:Boolean,default:!1},blur:{type:Boolean,default:!1},large:Boolean,noResize:Boolean,autoResize:Boolean,minHeight:{type:[String,Number],default:50},maxHeight:{type:[String,Number],default:300},hideFocus:Boolean,min:{type:[String,Number],default:-1/0},max:{type:[String,Number],default:1/0},info:{type:String}},emits:["onChange","update:modelValue","onClear"],setup(t,{expose:e,emit:n}){const r={pmi:"shadow-inner border-zinc-400 focus-within:border-zinc-500 focus-within:outline focus-within:outline-2 focus-within:outline-offset-3 bg-zinc-100 dark:bg-zinc-700/25 dark:border-zinc-700/50 dark:text-zinc-300","wpic-tools":"border-slate-300 bg-white focus-within:border-blue-400 outline-blue-200 focus-within:outline focus-within:outline-[3px]"},i=t,s=d.computed(()=>i.name?i.name:ud()),o=cg(s.value),a=d.computed(()=>{if(i.label)return i.label;if(i.name&&i.labelName)return`${i.name}#${i.labelName}`}),l=d.ref(!0),c=d.computed(()=>(i.type=="password"||i.password)&&l.value?"password":i.type);function u(){l.value=!l.value}const f=d.computed(()=>{if(i.rules&&typeof i.rules=="string"){let v=i.rules.split("|");return i.required&&v.push("required"),i.email&&v.push("email"),v.join("|")}else if(!i.rules){let v=[];return i.required&&v.push("required"),i.email&&v.push("email"),v.join("|")}return"required"});function h(v){let T=v&&v.target?v.target.value:v;k(T)}const p=n;function m(v){v===!0||v===!1?p("update:modelValue",!v):p("update:modelValue",v)}function y(v){let T=v&&v.target?v.target.value:v;p("update:modelValue",T),p("onChange",T)}function g(){p("update:modelValue",null),p("onChange",null),p("onClear")}const k=Fy(function(v){p("update:modelValue",v),p("onChange",v)},i.debounce),x=d.ref(null),O=d.ref(!1);d.watch(()=>i.modelValue,v=>{i.tag=="textarea"&&(x.value.$el.style.height="auto",d.nextTick(()=>{i.minHeight&&(x.value.$el.style.height=`${x.value.$el.scrollHeight<i.minHeight?i.minHeight:x.value.$el.scrollHeight}px`),i.maxHeight&&(x.value.$el.scrollHeight>i.maxHeight?(x.value.$el.style.height=`${i.maxHeight}px`,O.value=!0):O.value=!1)}))},{deep:!0});function b(){var v;i.tag=="textarea"?x.value.$el.focus():(v=x.value)==null||v.$el.focus()}function C(){return x.value.meta.valid}return e({focus:b,isValid:C}),(v,T)=>{const B=d.resolveComponent("wpic-choice-list");return d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["wpic-form-field",{"mb-6":!t.slim}])},[a.value&&!t.checkbox&&!t.radio?(d.openBlock(),d.createElementBlock("div",zy,[d.createTextVNode(d.toDisplayString(a.value)+" ",1),d.createElementVNode("div",jy,[t.info?(d.openBlock(),d.createBlock(Ci,{key:0,hover:""},{content:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(t.info),1)]),default:d.withCtx(()=>[d.createVNode(hd,{class:"w-4 h-4 text-zinc-600"})]),_:1})):d.createCommentVNode("",!0)])])):d.createCommentVNode("",!0),t.checkbox?(d.openBlock(),d.createBlock(d.unref(ws),{key:1,ref_key:"myInput",ref:x,name:s.value,rules:f.value,value:t.checkboxValue,"unchecked-value":t.uncheckedValue,modelValue:t.modelValue},{default:d.withCtx(({field:V})=>[d.createElementVNode("div",{class:"inline-flex items-center gap-2",onClick:T[0]||(T[0]=F=>t.disabled?void 0:m(t.modelValue))},[d.createElementVNode("div",{class:d.normalizeClass(["w-4 h-4 border rounded-sm cursor-pointer",{"border-zinc-400":!t.disabled&&!t.modelValue,"bg-violet-800 border-violet-800 text-white":t.modelValue===!0,"bg-opacity-50 border-opacity-50 text-opacity-75":t.disabled}])},[t.modelValue===!0?(d.openBlock(),d.createBlock(fd,{key:0})):d.createCommentVNode("",!0)],2),d.createElementVNode("span",{class:d.normalizeClass(["text-base cursor-pointer select-none",{"opacity-50":t.disabled}])},[d.renderSlot(v.$slots,"default",{},()=>[d.createTextVNode(d.toDisplayString(a.value),1)])],2)])]),_:3},8,["name","rules","value","unchecked-value","modelValue"])):t.radio?(d.openBlock(),d.createBlock(d.unref(ws),{key:2,ref_key:"myInput",ref:x,name:s.value,value:t.radioValue,modelValue:t.modelValue},{default:d.withCtx(({field:V})=>[d.createElementVNode("div",{onClick:T[2]||(T[2]=()=>{t.disabled||y(t.radioValue)}),class:d.normalizeClass([{"cursor-pointer":!t.disabled},"inline-flex items-center gap-2 select-none"])},[d.createElementVNode("span",{class:d.normalizeClass(["h-4 w-4 border border-zinc-400 rounded-full p-[2px]",{"border-opacity-50":t.disabled}])},[t.radioValue==t.modelValue?(d.openBlock(),d.createElementBlock("span",{key:0,class:d.normalizeClass(["flex rounded-full h-full w-full bg-violet-800",{"bg-opacity-50":t.disabled}])},null,2)):d.createCommentVNode("",!0)],2),d.createElementVNode("input",{class:"hidden",type:"radio",name:t.name,value:t.radioValue,onChange:T[1]||(T[1]=(...F)=>v.onChange&&v.onChange(...F)),checked:t.radioValue==t.modelValue},null,40,Wy),a.value?(d.openBlock(),d.createElementBlock("span",{key:0,class:d.normalizeClass(["text-base",{"opacity-50":t.disabled}])},d.toDisplayString(a.value),3)):d.createCommentVNode("",!0)],2)]),_:1},8,["name","value","modelValue"])):t.select?(d.openBlock(),d.createBlock(d.unref(ws),{key:3,ref_key:"myInput",ref:x,modelValue:t.modelValue,rules:f.value,name:s.value},{default:d.withCtx(({field:V})=>{var F;return[d.createVNode(B,{modelValue:t.modelValue,"onUpdate:modelValue":y,disabled:t.disabled,options:t.options,hideSelect:t.hideSelect,multiple:t.multiple,isInvalid:!!(t.error&&d.unref(o)),required:t.required||((F=f.value)==null?void 0:F.indexOf("required"))>=0,label:a.value,placeholder:"Select..."},null,8,["modelValue","disabled","options","hideSelect","multiple","isInvalid","required","label"])]}),_:1},8,["modelValue","rules","name"])):(d.openBlock(),d.createElementBlock("div",{key:4,class:d.normalizeClass(["wpic-input rounded flex relative border",{[`${r[d.unref(Se).theme]}`]:!0,"h-10":!t.textarea&&!t.large,"h-12":!t.textarea&&t.large,"border-opacity-50 border-zinc-300 text-zinc-400":t.disabled,"!border-red-600 focus-within:outline-red-600":d.unref(o)}])},[v.$slots.prepend?(d.openBlock(),d.createElementBlock("div",Hy,[d.createElementVNode("div",Yy,[d.renderSlot(v.$slots,"prepend")])])):d.createCommentVNode("",!0),d.createVNode(d.unref(ws),{ref_key:"myInput",ref:x,as:t.textarea?"textarea":void 0,autocomplete:"off",style:{"z-index":"1"},class:d.normalizeClass(["flex w-full h-full rounded pr-4 bg-transparent outline-none appearance-none",{"pl-4":!v.$slots.prepend,"pl-12":v.$slots.prepend,"py-2":t.textarea,"cursor-not-allowed":t.disabled}]),type:c.value,min:t.min,max:t.max,rows:t.rows,name:s.value,disabled:t.disabled,modelValue:t.modelValue,onInput:h,placeholder:t.placeholder,validateOnInput:!!d.unref(o),rules:f.value},null,8,["as","class","type","min","max","rows","name","disabled","modelValue","placeholder","validateOnInput","rules"]),t.loading?(d.openBlock(),d.createElementBlock("div",{key:1,onClick:g,class:"absolute right-0 mr-3 h-full flex items-center cursor-pointer opacity-75 hover:opacity-100"},[d.createVNode(Ss,{class:"w-6 h-6 opacity-50"})])):t.clearable&&t.modelValue?(d.openBlock(),d.createElementBlock("div",{key:2,onClick:d.withModifiers(g,["stop"]),style:{"z-index":"2"},class:"absolute right-0 mr-3 h-full flex items-center cursor-pointer opacity-75 hover:opacity-100"},[d.createVNode(ua,{class:"w-5 h-5 opacity-50"})])):d.createCommentVNode("",!0),v.$slots.append||t.password||t.type=="password"?(d.openBlock(),d.createElementBlock("div",Uy,[d.createElementVNode("div",qy,[d.renderSlot(v.$slots,"append",{},()=>[d.withDirectives(d.createVNode(C0,{class:"text-zinc-600 select-none",onClick:u},null,512),[[d.vShow,l.value]]),d.withDirectives(d.createVNode(D0,{class:"text-zinc-600 select-none",onClick:u},null,512),[[d.vShow,!l.value]])])])])):d.createCommentVNode("",!0)],2)),t.error&&d.unref(o)?(d.openBlock(),d.createElementBlock("div",Ky,[d.createVNode(d.unref(lg),{name:s.value},{default:d.withCtx(V=>[d.createTextVNode(d.toDisplayString(V.message),1)]),_:1},8,["name"])])):d.createCommentVNode("",!0),v.$slots.help||t.help?(d.openBlock(),d.createElementBlock("div",{key:6,class:d.normalizeClass(["text-base mt-1",{"ml-7":t.type=="checkbox","opacity-50":t.disabled}])},[d.renderSlot(v.$slots,"help",{},()=>[d.createTextVNode(d.toDisplayString(t.help),1)])],2)):d.createCommentVNode("",!0)],2)}}}),Gy={key:0,class:"mb-2 gap-2 wpic-form-label text-base text-zinc-600 dark:text-zinc-300 flex items-center"},Zy={class:""},Xy={key:0,class:"absolute left-0 ml-3 h-full flex items-center justify-center text-center"},Qy={class:"opacity-50 w-4 h-4 leading-tight"},Md=Object.assign({name:"WpicFormInput"},{props:{label:String,info:String,disabled:Boolean,large:Boolean},setup(t){const e={pmi:"shadow-inner border-zinc-400 focus-within:border-zinc-500 focus-within:outline focus-within:outline-2 focus-within:outline-offset-3 bg-zinc-100 dark:bg-zinc-700/25 dark:border-zinc-700/50 dark:text-zinc-300","wpic-tools":"border-slate-300 bg-white focus-within:border-blue-400 outline-blue-200 focus-within:outline focus-within:outline-[3px]"},n={pmi:"border-opacity-50 border-zinc-300 text-zinc-400","wpic-tools":"border-slate-200 text-slate-400"};return(r,i)=>(d.openBlock(),d.createElementBlock(d.Fragment,null,[t.label?(d.openBlock(),d.createElementBlock("div",Gy,[d.createTextVNode(d.toDisplayString(t.label)+" ",1),d.createElementVNode("div",Zy,[t.info?(d.openBlock(),d.createBlock(Ci,{key:0,hover:""},{content:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(t.info),1)]),default:d.withCtx(()=>[d.createVNode(hd,{class:"w-4 h-4 text-zinc-600"})]),_:1})):d.createCommentVNode("",!0)])])):d.createCommentVNode("",!0),d.createElementVNode("div",{class:d.normalizeClass(["wpic-input rounded flex relative border pr-4 items-center",{"pl-4":!r.$slots.prepend,"pl-10":r.$slots.prepend,[`${e[d.unref(Se).theme]}`]:!0,"h-10":!t.large,"h-12":t.large,[`${n[d.unref(Se).theme]}`]:t.disabled,"cursor-pointer":!t.disabled}])},[r.$slots.prepend?(d.openBlock(),d.createElementBlock("div",Xy,[d.createElementVNode("div",Qy,[d.renderSlot(r.$slots,"prepend")])])):d.createCommentVNode("",!0),d.renderSlot(r.$slots,"default")],2)],64))}}),eb={},tb={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},nb=[d.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"},null,-1)];function rb(t,e){return d.openBlock(),d.createElementBlock("svg",tb,nb)}const ib=ye(eb,[["render",rb]]),sb=["disabled"],ob={key:0,class:"leading-none"},ab={key:0},lb={key:1,class:"flex flex-col max-h-80 overflow-y-auto"},cb=["onClick"],db={class:"select-none flex w-full items-center justify-between"},ub=Object.assign({name:"WpicChoiceList"},{props:{modelValue:{},value:{},name:String,small:Boolean,hideSelect:Boolean,label:String,placeholder:String,options:Array,multiple:Boolean,required:Boolean,disabled:Boolean,isInvalid:Boolean,maxDisplay:{type:Number}},emits:["blur","input","change","update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=d.ref();function s(f){if(n.multiple){if(f){let h=n.modelValue||[];h.indexOf(f)>=0?h.splice(h.indexOf(f),1):h.push(f),r("update:modelValue",h)}}else r("update:modelValue",f),i.value.hide()}const o=d.computed(()=>{var f,h,p,m;if(n.multiple)if(n.maxDisplay){let y=(h=n.options)==null?void 0:h.filter(k=>{var x;return((x=n.modelValue)==null?void 0:x.indexOf(k.value))>=0}).map(k=>k.label),g=y==null?void 0:y.slice(0,n.maxDisplay);return y.length-g.length>0?(g==null?void 0:g.join(", "))+` (+${y.length-g.length})`:g==null?void 0:g.join(", ")}else return(f=n.options)==null?void 0:f.filter(y=>{var g;return((g=n.modelValue)==null?void 0:g.indexOf(y.value))>=0}).map(y=>y.label).join(", ");else return((m=(p=n.options)==null?void 0:p.find(y=>y.value===n.modelValue))==null?void 0:m.label)||n.modelValue}),a=d.computed(()=>{if(n.required)return n.options;{let f=n.options;return f.unshift({label:n.placeholder||"-",value:null}),f}});function l(f){var h;return n.multiple?n.modelValue!==null&&((h=n.modelValue)==null?void 0:h.indexOf(f))>=0:n.modelValue!==null&&f===n.modelValue}const c={pmi:"text-zinc-800 dark:text-zinc-300 disabled:bg-zinc-50 disabled:border-zinc-300 disabled:text-zinc-400 enabled:bg-zinc-100 enabled:border-zinc-400 enabled:text-zinc-500 enabled:dark:bg-zinc-700/25 enabled:dark:border-zinc-700/50 enabled:dark:text-zinc-300","wpic-tools":"disabled:text-slate-400 disabled:border-slate-200 bg-white border-slate-300 focus-within:border-lime-400 disabled:bg-slate-50"},u={pmi:"group-[.is-selected]:bg-violet-50 group-[.is-selected]:hover:bg-violet-100","wpic-tools":"hover:bg-slate-50 group-[.is-selected]:text-lime-500 group-[.is-selected]:font-semibold"};return(f,h)=>(d.openBlock(),d.createBlock(Ci,{custom:"",ref_key:"myPopover",ref:i,label:t.label,disabled:t.disabled},{default:d.withCtx(({isHidden:p})=>{var m;return[d.createElementVNode("button",{class:d.normalizeClass(["flex appearance-none w-full items-center gap-2 px-3 lg:text-base rounded border overflow-hidden leading-none",{"h-10":!t.small,"h-8":t.small,"cursor-pointer":!t.disabled,"!border-red-600 focus-within:outline-red-600":t.isInvalid,[`${c[d.unref(Se).theme]}`]:!0}]),disabled:t.disabled},[d.createElementVNode("span",{class:d.normalizeClass(["select-none w-full text-left flex-1",{"whitespace-pre":!t.multiple}])},[t.modelValue&&((m=t.modelValue)==null?void 0:m.length)>0&&!t.hideSelect?(d.openBlock(),d.createElementBlock("span",ob,d.toDisplayString(o.value),1)):d.renderSlot(f.$slots,"default",{key:1},()=>[d.createTextVNode(d.toDisplayString(t.placeholder),1)])],2),d.createVNode(ib,{class:d.normalizeClass(["h-4 w-4 transition-all transform",{"rotate-180":!p}])},null,8,["class"])],10,sb)]}),content:d.withCtx(()=>{var p;return[!t.options&&((p=t.options)==null?void 0:p.length)==0?(d.openBlock(),d.createElementBlock("span",ab,"No data.")):(d.openBlock(),d.createElementBlock("div",lb,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(a.value,m=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["group",{"is-selected":!!l(m.value)}])},[d.createElementVNode("div",{class:d.normalizeClass(["flex items-center py-2 px-4 min-w-64 text-base",{"cursor-pointer":!t.multiple||m.value,[`${u[d.unref(Se).theme]}`]:!0}]),onClick:y=>s(m.value)},[d.createElementVNode("div",db,[d.createElementVNode("span",null,d.toDisplayString(m.label||m.value),1),l(m.value)?(d.openBlock(),d.createBlock(fd,{key:0,class:"w-4 h-4"})):d.createCommentVNode("",!0)])],10,cb)],2))),256))]))]}),_:3},8,["label","disabled"]))}}),fb={class:"bg-white dark:bg-zinc-800/50 rounded-lg wpic-card shadow-[0_4px_16px_0px_rgba(0,0,0,0.1)]"},hb={key:0,class:"flex justify-between items-baseline pt-6 px-6"},pb={key:0,class:"text-xl font-bold"},mb={class:""},gb={key:1,class:"flex items-center justify-end py-4 px-6"},yb=Object.assign({name:"WpicCard"},{props:{title:String},setup(t){return(e,n)=>(d.openBlock(),d.createElementBlock("div",fb,[t.title||e.$slots.actions?(d.openBlock(),d.createElementBlock("div",hb,[t.title?(d.openBlock(),d.createElementBlock("div",pb,d.toDisplayString(t.title),1)):d.createCommentVNode("",!0),d.createElementVNode("div",mb,[d.renderSlot(e.$slots,"actions")])])):d.createCommentVNode("",!0),d.renderSlot(e.$slots,"default"),e.$slots.buttons?(d.openBlock(),d.createElementBlock("div",gb,[d.renderSlot(e.$slots,"buttons")])):d.createCommentVNode("",!0)]))}}),bb={name:"WpicCardSection"},vb={class:"py-6 border-b last:border-0 mx-6"};function kb(t,e,n,r,i,s){return d.openBlock(),d.createElementBlock("div",vb,[d.renderSlot(t.$slots,"default")])}const wb=ye(bb,[["render",kb]]),xb={class:"flex h-2 rounded-full w-full ring-1 ring-zinc-400"},Sb=Object.assign({name:"WpicProgressBar"},{props:{value:Number},setup(t){return(e,n)=>(d.openBlock(),d.createElementBlock("div",xb,[t.value>0?(d.openBlock(),d.createElementBlock("div",{key:0,style:d.normalizeStyle({width:`${t.value}%`}),class:"flex h-full bg-cyan-400 ring-1 ring-cyan-400 rounded-full"},null,4)):d.createCommentVNode("",!0)]))}}),Mb={class:"text-base leading-none"},Ob=Object.assign({name:"WpicTag"},{props:{clearable:Boolean},emits:["clear"],setup(t,{emit:e}){const n=e;function r(){n("clear")}return(i,s)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["wpic-tag select-none border border-cyan-500 bg-cyan-50 inline-flex rounded text-cyan-600 h-8 items-center justify-center pl-3 py-1",{"pr-3":!t.clearable,"pr-2":t.clearable}])},[d.createElementVNode("span",Mb,[d.renderSlot(i.$slots,"default")]),t.clearable?(d.openBlock(),d.createElementBlock("span",{key:0,onClick:r,class:"ml-1 cursor-pointer opacity-75 hover:opacity-100"},[d.createVNode(ua,{class:"w-4 h-4"})])):d.createCommentVNode("",!0)],2))}}),Cb=Object.assign({name:"WpicTagGroup"},{props:{full:Boolean},setup(t){return(e,n)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass({"w-full":t.full})},[d.createElementVNode("div",{class:d.normalizeClass(["ui-tag-group flex flex-wrap gap-2",{"w-full":t.full}])},[d.renderSlot(e.$slots,"default")],2)],2))}}),Tb={class:"w-full h-full flex items-center justify-center"},Eb=Object.assign({name:"WpicLoadingPanel"},{props:{color:{type:String,default:""}},setup(t){return(e,n)=>(d.openBlock(),d.createElementBlock("div",Tb,[d.createVNode(Ss,{color:t.color,class:"w-10 h-10"},null,8,["color"])]))}}),_b={class:"text-base font-medium"},Od=Object.assign({name:"WpicPaginationItem"},{props:{active:Boolean},setup(t){return(e,n)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["border rounded flex items-center justify-center w-10 h-10 cursor-pointer",{"border-zinc-300 dark:border-zinc-700 text-zinc-600 dark:text-zinc-300 hover:bg-zinc-500 hover:text-white":!t.active,"bg-violet-800 border-violet-800 hover:bg-violet-900 hover:border-violet-900 text-white":t.active}])},[d.createElementVNode("span",_b,[d.renderSlot(e.$slots,"default")])],2))}}),Nb={class:"wpic-pagination flex justify-between"},Db={class:"flex flex-wrap gap-2"},Ab={class:"hidden lg:flex gap-2 items-center"},Vb=d.createElementVNode("span",{class:"text-base text-zinc-500"},"Results per page",-1),Bb={class:"flex gap-2"},Pb=Object.assign({name:"WpicPagination"},{props:{total:Number,perPage:{type:Number,default:10},currentPage:Number},emits:["update:perPage","update:currentPage"],setup(t,{expose:e,emit:n}){const r=t,i=n,s=d.computed(()=>r.total&&r.perPage?Math.ceil(r.total/r.perPage):1),o=[10,25,50,100];function a(f){i("update:currentPage",f)}function l(f){i("update:perPage",f)}function c(){return r.perPage*(r.currentPage-1)+1}function u(){return r.perPage*r.currentPage>r.total?r.total:r.perPage*r.currentPage}return e({getStart:c,getEnd:u}),(f,h)=>(d.openBlock(),d.createElementBlock("div",Nb,[d.createElementVNode("div",Db,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(s.value,p=>(d.openBlock(),d.createBlock(Od,{onClick:m=>a(p),active:p===t.currentPage},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(p),1)]),_:2},1032,["onClick","active"]))),256))]),d.createElementVNode("div",Ab,[Vb,d.createElementVNode("div",Bb,[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(o,p=>d.createVNode(Od,{onClick:m=>l(p),active:p==t.perPage},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(p),1)]),_:2},1032,["onClick","active"])),64))])])]))}}),Cd=(t,e)=>t.column.children&&t.column.children.default&&typeof t.column.children.default=="function"?d.h("td",e.attrs,t.column.children.default({item:t.item})):d.h("td",e.attrs,t.column.children);Cd.props=["column","item","rowIndex"];const Ib=Cd,Rb={},$b={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},Lb=[d.createElementVNode("path",{"fill-rule":"evenodd",d:"M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z","clip-rule":"evenodd"},null,-1)];function Fb(t,e){return d.openBlock(),d.createElementBlock("svg",$b,Lb)}const zb=ye(Rb,[["render",Fb]]),jb={class:"w-full rounded-lg"},Wb=["width","max-width"],Hb={key:0,class:"rounded-t-lg"},Yb=["onClick"],Ub={class:"select-none font-medium"},qb={class:"rounded-b-lg"},Kb=Object.assign({name:"WpicTable"},{props:{data:{type:Array,default:()=>[]},hideHeaders:Boolean,sortOptions:{},border:Boolean,noXPadding:Boolean},emits:["changeSort"],setup(t,{expose:e,emit:n}){const r=t,i={pmi:"","wpic-tools":"border-slate-300"},s={pmi:"bg-zinc-50 dark:bg-zinc-800/60 text-zinc-500 dark:text-zinc-400 dark:border-zinc-900","wpic-tools":"bg-slate-100 dark:bg-slate-800/60 text-slate-400 dark:text-slate-400 border-slate-200 dark:border-slate-900"},o={pmi:"bg-white dark:text-zinc-300 dark:border-zinc-900 dark:bg-zinc-800","wpic-tools":"bg-white border-slate-200 dark:border-slate-900 dark:bg-slate-800"},a=n;d.onMounted(()=>{f()});const l=d.getCurrentInstance();d.provide("wtable",l==null?void 0:l.proxy);const c=d.useSlots(),u=d.ref([]);function f(){const p=(g,k)=>{let x={};for(let O in g){if(typeof g[O].default=="boolean"&&k[O]!==void 0){x[O]=k[O]!==!1;continue}if(k[O]!==void 0){x[O]=k[O];continue}if(typeof g[O].default=="function"){x[O]=g[O].default();continue}x[O]=g[O].default}return x};let m=[];(c.default&&c.default()||[]).forEach(g=>{var k,x;((k=g.type)==null?void 0:k.name)==="WpicTableColumn"?m.push(g):(x=g.children)!=null&&x.length&&g.children.forEach(O=>{var b;((b=O.type)==null?void 0:b.name)==="WpicTableColumn"&&m.push(O)})}),u.value=m.map(g=>{let k=g.children,x=g.props||{},{field:O,label:b,help:C,width:v,minWidth:T,maxWidth:B,sortable:V,selectable:F,render:te,type:G,align:ne,visible:oe}=p(g.type.props,x);return{label:b,help:C,width:v,minWidth:T,maxWidth:B,type:G,align:ne,sortable:V,selectable:F,field:O,render:te,children:k,visible:oe}}).filter(g=>g.visible||g.selectable)}function h(p){let m=r.sortOptions.sortDirection;r.sortOptions.sortBy===p&&(m=m==="asc"?"desc":"asc"),a("changeSort",{sortDirection:m,sortBy:p})}return d.watch(()=>c.default,p=>{console.log("watch slots.default",p),f()},{deep:!0}),e({buildColumns:f}),(p,m)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["relative w-full rounded-lg",{border:t.border,[`${i[d.unref(Se).theme]}`]:!0}])},[d.createElementVNode("table",jb,[d.createElementVNode("colgroup",null,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(u.value,(y,g)=>(d.openBlock(),d.createElementBlock("col",{style:d.normalizeStyle({minWidth:`${y.minWidth}px`}),width:y.width,"max-width":y.maxWidth,key:g},null,12,Wb))),128))]),t.hideHeaders?d.createCommentVNode("",!0):(d.openBlock(),d.createElementBlock("thead",Hb,[d.createElementVNode("tr",null,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(u.value,(y,g)=>(d.openBlock(),d.createElementBlock("th",{class:d.normalizeClass(["first:rounded-tl-lg last:rounded-tr-lg p-0 border-b",[`${s[d.unref(Se).theme]}`]])},[d.createElementVNode("div",{onClick:()=>{y.sortable&&h(y.field)},class:d.normalizeClass(["flex items-center py-3 px-6 lg:text-base rounded-lg",{"cursor-pointer":y.sortable&&y.field,"justify-center":y.align=="center","justify-end":y.align=="right"}])},[d.createElementVNode("span",Ub,d.toDisplayString(y.label),1),y.sortable&&y.field?(d.openBlock(),d.createElementBlock("span",{key:0,class:d.normalizeClass(["ml-1",{"opacity-25":y.field!=t.sortOptions.sortBy}])},[d.createVNode(zb,{class:d.normalizeClass(["w-4 h-4",{"rotate-180":t.sortOptions.sortDirection==="asc"}])},null,8,["class"])],2)):d.createCommentVNode("",!0)],10,Yb)],2))),256))])])),d.createElementVNode("tbody",qb,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(t.data,(y,g)=>(d.openBlock(),d.createElementBlock("tr",{class:d.normalizeClass(["tr border-b last:border-b-0 overflow-hidden",[`${o[d.unref(Se).theme]}`]]),key:`tr_${g}`},[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(u.value,(k,x)=>{var O,b;return d.openBlock(),d.createBlock(Ib,{class:d.normalizeClass(["py-3 px-6 lg:text-base",{"first:pl-0 last:pr-0":t.noXPadding,"last:rounded-br-lg":g===((O=t.data)==null?void 0:O.length)-1,"first:rounded-bl-lg":g===((b=t.data)==null?void 0:b.length)-1,"text-center":k.align=="center","text-right":k.align=="right"}]),id:`${g}_${x}`,column:k,item:y,rowIndex:g,key:x},null,8,["class","id","column","item","rowIndex"])}),128))],2))),128))])])],2))}}),Jb={name:"WpicTableColumn",props:{label:{type:String},help:{type:String},field:{type:String,default:""},selectable:{type:Boolean,default:!0},sortable:{type:Boolean,default:!1},type:{type:String,default:"default"},width:{type:[String,Number],default:null},minWidth:{type:[String,Number],default:null},maxWidth:{type:[String,Number],default:null},align:{type:String,default:"left"},visible:{type:Boolean,default:!0}},setup(t){const e=inject("wtable",null);return onMounted(()=>{e&&e.buildColumns&&e.buildColumns()}),onBeforeUnmount(()=>{e&&e.buildColumns&&e.buildColumns()}),()=>null}};function Fe(t){this.content=t}Fe.prototype={constructor:Fe,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new Fe(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Fe(n)},addToStart:function(t,e){return new Fe([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Fe(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new Fe(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Fe.from(t),t.size?new Fe(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Fe.from(t),t.size?new Fe(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Fe.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}},Fe.from=function(t){if(t instanceof Fe)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Fe(e)};function Td(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)n++;return n}if(i.content.size||s.content.size){let o=Td(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function Ed(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){n-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let c=0,u=Math.min(o.text.length,a.text.length);for(;c<u&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(o.content.size||a.content.size){let c=Ed(o.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class N{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let o=0,a=0;a<n;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,i+a,s||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new N(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,o=0;o<n;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),i+=a.nodeSize),o=l}return new N(r,i)}cutByIndex(e,n){return e==n?N.empty:e==0&&n==this.content.length?this:new N(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new N(i,s)}addToStart(e){return new N([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new N(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return Td(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Ed(this,e,n,r)}findIndex(e,n=-1){if(e==0)return Vs(0,e);if(e==this.size)return Vs(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let s=this.child(r),o=i+s.nodeSize;if(o>=e)return o==e||n>0?Vs(r+1,o):Vs(r,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return N.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new N(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return N.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new N(n||e,r)}static from(e){if(!e)return N.empty;if(e instanceof N)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new N([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}N.empty=new N([],0);const pa={index:0,offset:0};function Vs(t,e){return pa.index=t,pa.offset=e,pa}function Bs(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Bs(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Bs(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let me=class yc{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Bs(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);return r.create(n.attrs)}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return yc.none;if(e instanceof yc)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};me.none=[];class Ps extends Error{}class I{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Nd(this.content,e+this.openStart,n);return r&&new I(r,this.openStart,this.openEnd)}removeBetween(e,n){return new I(_d(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return I.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new I(N.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new I(e,r,i)}}I.empty=new I(N.empty,0,0);function _d(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(i==e||s.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(_d(s.content,e-i-1,n-i-1)))}function Nd(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),o=t.maybeChild(i);if(s==e||o.isText)return t.cut(0,e).append(n).append(t.cut(e));let a=Nd(o.content,e-s-1,n);return a&&t.replaceChild(i,o.copy(a))}function Gb(t,e,n){if(n.openStart>t.depth)throw new Ps("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Ps("Inconsistent open depths");return Dd(t,e,n,0)}function Dd(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let o=Dd(t,e,n,r+1);return s.copy(s.content.replaceChild(i,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,a=o.content;return ir(o,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=Zb(n,t);return ir(s,Vd(t,o,a,e,r))}else return ir(s,Is(t,e,r))}function Ad(t,e){if(!e.type.compatibleContent(t.type))throw new Ps("Cannot join "+e.type.name+" onto "+t.type.name)}function ma(t,e,n){let r=t.node(n);return Ad(r,e.node(n)),r}function rr(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Ei(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(rr(t.nodeAfter,r),s++));for(let a=s;a<o;a++)rr(i.child(a),r);e&&e.depth==n&&e.textOffset&&rr(e.nodeBefore,r)}function ir(t,e){return t.type.checkContent(e),t.copy(e)}function Vd(t,e,n,r,i){let s=t.depth>i&&ma(t,e,i+1),o=r.depth>i&&ma(n,r,i+1),a=[];return Ei(null,t,i,a),s&&o&&e.index(i)==n.index(i)?(Ad(s,o),rr(ir(s,Vd(t,e,n,r,i+1)),a)):(s&&rr(ir(s,Is(t,e,i+1)),a),Ei(e,n,i,a),o&&rr(ir(o,Is(n,r,i+1)),a)),Ei(r,null,i,a),new N(a)}function Is(t,e,n){let r=[];if(Ei(null,t,n,r),t.depth>n){let i=ma(t,e,n+1);rr(ir(i,Is(t,e,n+1)),r)}return Ei(e,null,n,r),new N(r)}function Zb(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(N.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class _i{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return me.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let a=r;r=i,i=a}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Rs(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),c=s-l;if(r.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;s=c-1,i+=l+1}return new _i(n,r,s)}static resolveCached(e,n){for(let i=0;i<ga.length;i++){let s=ga[i];if(s.pos==n&&s.doc==e)return s}let r=ga[ya]=_i.resolve(e,n);return ya=(ya+1)%Xb,r}}let ga=[],ya=0,Xb=12;class Rs{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Qb=Object.create(null);let sr=class bc{constructor(e,n,r,i=me.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||N.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Bs(this.attrs,n||e.defaultAttrs||Qb)&&me.sameSet(this.marks,r||me.none)}copy(e=null){return e==this.content?this:new bc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new bc(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return I.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),a=i.start(o),c=i.node(o).content.cut(i.pos-a,s.pos-a);return new I(c,i.depth-o,s.depth-o)}replace(e,n,r){return Gb(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return _i.resolveCached(this,e)}resolveNoCache(e){return _i.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Bd(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=N.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content);let e=me.none;for(let n=0;n<this.marks.length;n++)e=this.marks[n].addToSet(e);if(!me.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=N.fromJSON(e,n.content);return e.nodeType(n.type).create(n.attrs,i,r)}};sr.prototype.text=void 0;class $s extends sr{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Bd(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new $s(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new $s(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Bd(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class or{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new ev(e,n);if(r.next==null)return or.empty;let i=Pd(r);r.next&&r.err("Unexpected trailing text");let s=av(ov(i));return lv(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(o,a){let l=o.matchFragment(e,r);if(l&&(!n||l.validEnd))return N.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:f}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let h=s(f,a.concat(u));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
6
+ `)}}or.empty=new or(!0);class ev{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Pd(t){let e=[];do e.push(tv(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function tv(t){let e=[];do e.push(nv(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function nv(t){let e=sv(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=rv(t,e);else break;return e}function Id(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function rv(t,e){let n=Id(t),r=n;return t.eat(",")&&(t.next!="}"?r=Id(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function iv(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let o=n[s];o.groups.indexOf(e)>-1&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function sv(t){if(t.eat("(")){let e=Pd(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=iv(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function ov(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(s(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=s(o.exprs[l],a);if(l==o.exprs.length-1)return c;i(c,a=n())}else if(o.type=="star"){let l=n();return r(a,l),i(s(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=n();return i(s(o.expr,a),l),i(s(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let u=n();i(s(o.expr,l),u),l=u}if(o.max==-1)i(s(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let u=n();r(l,u),i(s(o.expr,l),u),l=u}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Rd(t,e){return e-t}function $d(t,e){let n=[];return r(e),n.sort(Rd);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&n.indexOf(l)==-1&&r(l)}}}function av(t){let e=Object.create(null);return n($d(t,0));function n(r){let i=[];r.forEach(o=>{t[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<i.length;u++)i[u][0]==a&&(c=i[u][1]);$d(t,l).forEach(u=>{c||i.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new or(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(Rd);s.next.push({type:i[o][0],next:e[a.join(",")]||n(a)})}return s}}function lv(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Ld(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function Fd(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function zd(t){let e=Object.create(null);if(t)for(let n in t)e[n]=new cv(t[n]);return e}let jd=class tm{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=zd(r.attrs),this.defaultAttrs=Ld(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==or.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Fd(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new sr(this,this.computeAttrs(e),N.from(n),me.setFrom(r))}createChecked(e=null,n,r){return n=N.from(n),this.checkContent(n),new sr(this,this.computeAttrs(e),n,me.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=N.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(N.empty,!0);return s?new sr(this,e,n.append(s),me.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:me.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new tm(s,n,o));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class cv{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class Ls{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=zd(i.attrs),this.excluded=null;let s=Ld(this.attrs);this.instance=s?new me(this,s):null}create(e=null){return!e&&this.instance?this.instance:new me(this,Fd(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new Ls(s,i++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}excludes(e){return this.excluded.indexOf(e)>-1}}class dv{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Fe.from(e.nodes),n.marks=Fe.from(e.marks||{}),this.nodes=jd.compile(this.spec.nodes,this),this.marks=Ls.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=or.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?Wd(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:Wd(this,o.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof jd){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new $s(r,r.defaultAttrs,e,me.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return sr.fromJSON(this,e)}markFromJSON(e){return me.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Wd(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let a in t.marks){let l=t.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function uv(t){return t.tag!=null}function fv(t){return t.style!=null}class Vr{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[],n.forEach(r=>{uv(r)?this.tags.push(r):fv(r)&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new qd(this,n,!1);return r.addAll(e,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new qd(this,n,!0);return r.addAll(e,n.from,n.to),I.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(mv(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(o.getAttrs){let l=o.getAttrs(n);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<n.length;o++){let a=n[o];if((a.priority==null?50:a.priority)<s)break}n.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Kd(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Kd(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Vr(e,Vr.schemaRules(e)))}}const Hd={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},hv={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Yd={ol:!0,ul:!0},Fs=1,zs=2,Ni=4;function Ud(t,e,n){return e!=null?(e?Fs:0)|(e==="full"?zs:0):t&&t.whitespace=="pre"?Fs|zs:n&~Ni}class js{constructor(e,n,r,i,s,o,a){this.type=e,this.attrs=n,this.marks=r,this.pendingMarks=i,this.solid=s,this.options=a,this.content=[],this.activeMarks=me.none,this.stashMarks=[],this.match=o||(a&Ni?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(N.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Fs)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let n=N.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(N.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}popFromStashMark(e){for(let n=this.stashMarks.length-1;n>=0;n--)if(e.eq(this.stashMarks[n]))return this.stashMarks.splice(n,1)[0]}applyPending(e){for(let n=0,r=this.pendingMarks;n<r.length;n++){let i=r[n];(this.type?this.type.allowsMarkType(i.type):gv(i.type,e))&&!i.isInSet(this.activeMarks)&&(this.activeMarks=i.addToSet(this.activeMarks),this.pendingMarks=i.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Hd.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class qd{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0;let i=n.topNode,s,o=Ud(null,n.preserveWhitespace,0)|(r?Ni:0);i?s=new js(i.type,i.attrs,me.none,me.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new js(null,null,me.none,me.none,!0,null,o):s=new js(e.schema.topNodeType,null,me.none,me.none,!0,null,o),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){e.nodeType==3?this.addTextNode(e):e.nodeType==1&&this.addElement(e)}withStyleRules(e,n){let r=e.style;if(!r||!r.length)return n();let i=this.readStyles(e.style);if(!i)return;let[s,o]=i,a=this.top;for(let l=0;l<o.length;l++)this.removePendingMark(o[l],a);for(let l=0;l<s.length;l++)this.addPendingMark(s[l]);n();for(let l=0;l<s.length;l++)this.removePendingMark(s[l],a);for(let l=0;l<o.length;l++)this.addPendingMark(o[l])}addTextNode(e){let n=e.nodeValue,r=this.top;if(r.options&zs||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(r.options&Fs)r.options&zs?n=n.replace(/\r\n?/g,`
7
+ `):n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let i=r.content[r.content.length-1],s=e.previousSibling;(!i||s&&s.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(n=n.slice(1))}n&&this.insertNode(this.parser.schema.text(n)),this.findInText(e)}else this.findInside(e)}addElement(e,n){let r=e.nodeName.toLowerCase(),i;Yd.hasOwnProperty(r)&&this.parser.normalizeLists&&pv(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,n));if(s?s.ignore:hv.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let o,a=this.top,l=this.needsBlock;if(Hd.hasOwnProperty(r))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),o=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e);return}s&&s.skip?this.addAll(e):this.withStyleRules(e,()=>this.addAll(e)),o&&this.sync(a),this.needsBlock=l}else this.withStyleRules(e,()=>{this.addElementByRule(e,s,s.consuming===!1?i:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
8
+ `))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let n=me.none,r=me.none;for(let i=0,s=e.length;i<s;i++){let o=e.item(i);for(let a=void 0;;){let l=this.parser.matchStyle(o,e.getPropertyValue(o),this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach(c=>{l.clearMark(c)&&(r=c.addToSet(r))}):n=this.parser.schema.marks[l.mark].create(l.attrs).addToSet(n),l.consuming===!1)a=l;else break}}return[n,r]}addElementByRule(e,n,r){let i,s,o;n.node?(s=this.parser.schema.nodes[n.node],s.isLeaf?this.insertNode(s.create(n.attrs))||this.leafFallback(e):i=this.enter(s,n.attrs||null,n.preserveWhitespace)):(o=this.parser.schema.marks[n.mark].create(n.attrs),this.addPendingMark(o));let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l)}i&&this.sync(a)&&this.open--,o&&this.removePendingMark(o,a)}addAll(e,n,r){let i=n||0;for(let s=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];s!=o;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s);this.findAtPoint(e,i)}findPlace(e){let n,r;for(let i=this.open;i>=0;i--){let s=this.nodes[i],o=s.findWrapping(e);if(o&&(!n||n.length>o.length)&&(n=o,r=s,!o.length)||s.solid)break}if(!n)return!1;this.sync(r);for(let i=0;i<n.length;i++)this.enterInner(n[i],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let n=this.textblockFromContext();n&&this.enterInner(n)}if(this.findPlace(e)){this.closeExtra();let n=this.top;n.applyPending(e.type),n.match&&(n.match=n.match.matchType(e.type));let r=n.activeMarks;for(let i=0;i<e.marks.length;i++)(!n.type||n.type.allowsMarkType(e.marks[i].type))&&(r=e.marks[i].addToSet(r));return n.content.push(e.mark(r)),!0}return!1}enter(e,n,r){let i=this.findPlace(e.create(n));return i&&this.enterInner(e,n,!0,r),i}enterInner(e,n=null,r=!1,i){this.closeExtra();let s=this.top;s.applyPending(e),s.match=s.match&&s.match.matchType(e);let o=Ud(e,i,s.options);s.options&Ni&&s.content.length==0&&(o|=Ni),this.nodes.push(new js(e,n,s.activeMarks,s.pendingMarks,r,null,o)),this.open++}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let n=this.open;n>=0;n--)if(this.nodes[n]==e)return this.open=n,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let u=l>0||l==0&&i?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!u||u.name!=c&&u.groups.indexOf(c)==-1)return!1;l--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let n=yv(e,this.top.pendingMarks);n&&this.top.stashMarks.push(n),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,n){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(e)>-1)i.pendingMarks=e.removeFromSet(i.pendingMarks);else{i.activeMarks=e.removeFromSet(i.activeMarks);let o=i.popFromStashMark(e);o&&i.type&&i.type.allowsMarkType(o.type)&&(i.activeMarks=o.addToSet(i.activeMarks))}if(i==n)break}}}function pv(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Yd.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function mv(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Kd(t){let e={};for(let n in t)e[n]=t[n];return e}function gv(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||s.indexOf(u)<0&&o(u))return!0}};if(o(i.contentMatch))return!0}}function yv(t,e){for(let n=0;n<e.length;n++)if(t.eq(e[n]))return e[n]}class Ut{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=ba(n).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(s[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],u=this.serializeMark(c,o.isInline,n);u&&(s.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=Ut.renderSpec(ba(n),this.nodes[e.type.name](e));if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Ut.renderSpec(ba(r),i(e,n))}static renderSpec(e,n,r=null){if(typeof n=="string")return{dom:e.createTextNode(n)};if(n.nodeType!=null)return{dom:n};if(n.dom&&n.dom.nodeType!=null)return n;let i=n[0],s=i.indexOf(" ");s>0&&(r=i.slice(0,s),i=i.slice(s+1));let o,a=r?e.createElementNS(r,i):e.createElement(i),l=n[1],c=1;if(l&&typeof l=="object"&&l.nodeType==null&&!Array.isArray(l)){c=2;for(let u in l)if(l[u]!=null){let f=u.indexOf(" ");f>0?a.setAttributeNS(u.slice(0,f),u.slice(f+1),l[u]):a.setAttribute(u,l[u])}}for(let u=c;u<n.length;u++){let f=n[u];if(f===0){if(u<n.length-1||u>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=Ut.renderSpec(e,f,r);if(a.appendChild(h),p){if(o)throw new RangeError("Multiple content holes");o=p}}}return{dom:a,contentDOM:o}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ut(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Jd(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Jd(e.marks)}}function Jd(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function ba(t){return t.document||window.document}const Gd=65535,Zd=Math.pow(2,16);function bv(t,e){return t+e*Zd}function Xd(t){return t&Gd}function vv(t){return(t-(t&Gd))/Zd}const Qd=1,eu=2,Ws=4,tu=8;class va{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&tu)>0}get deletedBefore(){return(this.delInfo&(Qd|Ws))>0}get deletedAfter(){return(this.delInfo&(eu|Ws))>0}get deletedAcross(){return(this.delInfo&Ws)>0}}class ft{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&ft.empty)return ft.empty}recover(e){let n=0,r=Xd(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+vv(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+s],u=this.ranges[a+o],f=l+c;if(e<=f){let h=c?e==l?-1:e==f?1:n:n,p=l+i+(h<0?0:u);if(r)return p;let m=e==(n<0?l:f)?null:bv(a/3,e-l),y=e==l?eu:e==f?Qd:Ws;return(n<0?e!=l:e!=f)&&(y|=tu),new va(p,y,m)}i+=u-c}return r?e+i:new va(e+i,0,null)}touches(e,n){let r=0,i=Xd(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+s],u=l+c;if(e<=u&&a==i*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),c=this.ranges[i+n],u=this.ranges[i+r];e(a,a+c,l,l+u),s+=u-c}}invert(){return new ft(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?ft.empty:new ft(e<0?[0,-e,0]:[0,0,e])}}ft.empty=new ft([]);class Br{constructor(e=[],n,r=0,i=e.length){this.maps=e,this.mirror=n,this.from=r,this.to=i}slice(e=0,n=this.maps.length){return new Br(this.maps,this.mirror,e,n)}copy(){return new Br(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,n){this.to=this.maps.push(e),n!=null&&this.setMirror(this.maps.length-1,n)}appendMapping(e){for(let n=0,r=this.maps.length;n<e.maps.length;n++){let i=e.getMirror(n);this.appendMap(e.maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this.maps.length+e.maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e.maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Br;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this.maps[s],a=o.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this.maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new va(e,i,null)}}const ka=Object.create(null);class We{getMap(){return ft.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=ka[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in ka)throw new RangeError("Duplicate use of step JSON ID "+e);return ka[e]=n,n.prototype.jsonID=e,n}}class Te{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Te(e,null)}static fail(e){return new Te(null,e)}static fromReplace(e,n,r,i){try{return Te.ok(e.replace(n,r,i))}catch(s){if(s instanceof Ps)return Te.fail(s.message);throw s}}}function wa(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(wa(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return N.fromArray(r)}class Vn extends We{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new I(wa(n.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return Te.fromReplace(e,this.from,this.to,s)}invert(){return new qt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Vn(n.pos,r.pos,this.mark)}merge(e){return e instanceof Vn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Vn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Vn(n.from,n.to,e.markFromJSON(n.mark))}}We.jsonID("addMark",Vn);class qt extends We{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new I(wa(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Te.fromReplace(e,this.from,this.to,r)}invert(){return new Vn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new qt(n.pos,r.pos,this.mark)}merge(e){return e instanceof qt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new qt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new qt(n.from,n.to,e.markFromJSON(n.mark))}}We.jsonID("removeMark",qt);class Bn extends We{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Te.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Te.fromReplace(e,this.pos,this.pos+1,new I(N.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Bn(this.pos,n.marks[i]);return new Bn(this.pos,this.mark)}}return new Pr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Bn(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Bn(n.pos,e.markFromJSON(n.mark))}}We.jsonID("addNodeMark",Bn);class Pr extends We{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Te.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Te.fromReplace(e,this.pos,this.pos+1,new I(N.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Bn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Pr(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Pr(n.pos,e.markFromJSON(n.mark))}}We.jsonID("removeNodeMark",Pr);class Ve extends We{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&xa(e,this.from,this.to)?Te.fail("Structure replace would overwrite content"):Te.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ft([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ve(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Ve(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(e){if(!(e instanceof Ve)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?I.empty:new I(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ve(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?I.empty:new I(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ve(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ve(n.from,n.to,I.fromJSON(e,n.slice),!!n.structure)}}We.jsonID("replace",Ve);class Be extends We{constructor(e,n,r,i,s,o,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(xa(e,this.from,this.gapFrom)||xa(e,this.gapTo,this.to)))return Te.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Te.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Te.fromReplace(e,this.from,this.to,r):Te.fail("Content does not fit in gap")}getMap(){return new ft([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Be(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new Be(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Be(n.from,n.to,n.gapFrom,n.gapTo,I.fromJSON(e,n.slice),n.insert,!!n.structure)}}We.jsonID("replaceAround",Be);function xa(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function kv(t,e,n,r){let i=[],s=[],o,a;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let f=l.marks;if(!r.isInSet(f)&&u.type.allowsMarkType(r.type)){let h=Math.max(c,e),p=Math.min(c+l.nodeSize,n),m=r.addToSet(f);for(let y=0;y<f.length;y++)f[y].isInSet(m)||(o&&o.to==h&&o.mark.eq(f[y])?o.to=p:i.push(o=new qt(h,p,f[y])));a&&a.to==h?a.to=p:s.push(a=new Vn(h,p,r))}}),i.forEach(l=>t.step(l)),s.forEach(l=>t.step(l))}function wv(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(r instanceof Ls){let c=o.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,n);for(let u=0;u<l.length;u++){let f=l[u],h;for(let p=0;p<i.length;p++){let m=i[p];m.step==s-1&&f.eq(i[p].style)&&(h=m)}h?(h.to=c,h.step=s):i.push({style:f,from:Math.max(a,e),to:c,step:s})}}}),i.forEach(o=>t.step(new qt(o.from,o.to,o.style)))}function nu(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let c=s.child(l),u=a+c.nodeSize,f=r.matchType(c.type);if(!f)o.push(new Ve(a,u,I.empty));else{r=f;for(let h=0;h<c.marks.length;h++)n.allowsMarkType(c.marks[h].type)||t.step(new qt(a,u,c.marks[h]));if(i&&c.isText&&n.whitespace!="pre"){let h,p=/\r?\n|\r/g,m;for(;h=p.exec(c.text);)m||(m=new I(N.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),o.push(new Ve(a+h.index,a+h.index+h[0].length,m))}}a=u}if(!r.validEnd){let l=r.fillBefore(N.empty,!0);t.replace(a,a,new I(l,0,0))}for(let l=o.length-1;l>=0;l--)t.step(o[l])}function xv(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Ir(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let i=t.$from.node(r),s=t.$from.index(r),o=t.$to.indexAfter(r);if(r<t.depth&&i.canReplace(s,o,n))return r;if(r==0||i.type.spec.isolating||!xv(i,s,o))break}return null}function Sv(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),a=i.after(s+1),l=o,c=a,u=N.empty,f=0;for(let m=s,y=!1;m>n;m--)y||r.index(m)>0?(y=!0,u=N.from(r.node(m).copy(u)),f++):l--;let h=N.empty,p=0;for(let m=s,y=!1;m>n;m--)y||i.after(m+1)<i.end(m)?(y=!0,h=N.from(i.node(m).copy(h)),p++):c++;t.step(new Be(l,c,o,a,new I(u.append(h),f,p),u.size-f,!0))}function Sa(t,e,n=null,r=t){let i=Mv(t,e),s=i&&Ov(r,e);return s?i.map(ru).concat({type:e,attrs:n}).concat(s.map(ru)):null}function ru(t){return{type:t,attrs:null}}function Mv(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function Ov(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;l&&c<i;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:o}function Cv(t,e,n){let r=N.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let a=n[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=N.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new Be(i,s,i,s,new I(r,0,0),n.length,!0))}function Tv(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{if(o.isTextblock&&!o.hasMarkup(r,i)&&Nv(t.doc,t.mapping.slice(s).map(a),r)){let l=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?l=!1:!h&&p&&(l=!0)}l===!1&&_v(t,o,a,s),nu(t,t.mapping.slice(s).map(a,1),r,void 0,l===null);let c=t.mapping.slice(s),u=c.map(a,1),f=c.map(a+o.nodeSize,1);return t.step(new Be(u,f,u+1,f-1,new I(N.from(r.create(i,null,o.marks)),0,0),1,!0)),l===!0&&Ev(t,o,a,s),!1}})}function Ev(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function _v(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
9
+ `))}})}function Nv(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function Dv(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Be(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new I(N.from(o),0,0),1,!0))}function Rr(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=n-2;c>s;c--,u--){let f=i.node(c),h=i.index(c);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(h,f.childCount),m=r&&r[u+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let y=r&&r[u]||f;if(!f.canReplace(h+1,f.childCount)||!y.type.validContent(p))return!1}let a=i.indexAfter(s),l=r&&r[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function Av(t,e,n=1,r){let i=t.doc.resolve(e),s=N.empty,o=N.empty;for(let a=i.depth,l=i.depth-n,c=n-1;a>l;a--,c--){s=N.from(i.node(a).copy(s));let u=r&&r[c];o=N.from(u?u.type.create(u.attrs,o):i.node(a).copy(o))}t.step(new Ve(e,e,new I(s.append(o),n,n),!0))}function Pn(t,e){let n=t.resolve(e),r=n.index();return iu(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function iu(t,e){return!!(t&&e&&!t.isLeaf&&t.canAppend(e))}function Hs(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,o,a=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):n>0?(s=r.node(i+1),a++,o=r.node(i).maybeChild(a)):(s=r.node(i).maybeChild(a-1),o=r.node(i+1)),s&&!s.isTextblock&&iu(s,o)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function Vv(t,e,n){let r=new Ve(e-n,e+n,I.empty,!0);t.step(r)}function Bv(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function su(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),c=r.node(o),u=!1;if(s==1)u=c.canReplace(l,l,i);else{let f=c.contentMatchAt(l).findWrapping(i.firstChild.type);u=f&&c.canReplaceWith(l,l,f[0])}if(u)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function Ys(t,e,n=e,r=I.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return ou(i,s,r)?new Ve(e,n,r):new Pv(i,s,r).fit()}function ou(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Pv{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=N.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=N.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new I(s,o,a);return e>-1?new Be(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Ve(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Ma(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,f=null;if(n==1&&(o?c.matchType(o.type)||(f=c.fillBefore(N.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:f};if(n==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Ma(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new I(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Ma(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new I(Di(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new I(Di(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let y=0;y<s.length;y++)this.openFrontierNode(s[y]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,c=0,u=[],{match:f,type:h}=this.frontier[n];if(i){for(let y=0;y<i.childCount;y++)u.push(i.child(y));f=f.matchFragment(i)}let p=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let y=a.child(c),g=f.matchType(y.type);if(!g)break;c++,(c>1||l==0||y.content.size)&&(f=g,u.push(au(y.mark(h.allowedMarks(y.marks)),c==1?l:0,c==a.childCount?p:-1)))}let m=c==a.childCount;m||(p=-1),this.placed=Ai(this.placed,n,N.from(u)),this.frontier[n].match=f,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let y=0,g=a;y<p;y++){let k=g.lastChild;this.frontier.push({type:k.type,match:k.contentMatchAt(k.childCount)}),g=k.content}this.unplaced=m?e==0?I.empty:new I(Di(o.content,e-1,1),e-1,p<0?o.openEnd:e-1):new I(Di(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Oa(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=Oa(e,n,i,r,s);if(o){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=Oa(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Ai(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Ai(this.placed,this.depth,N.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(N.empty,!0);n.childCount&&(this.placed=Ai(this.placed,this.frontier.length,n))}}function Di(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Di(t.firstChild.content,e-1,n)))}function Ai(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Ai(t.lastChild.content,e-1,n)))}function Ma(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function au(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,au(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(N.empty,!0)))),t.copy(r)}function Oa(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!Iv(n,s.content,o)?a:null}function Iv(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function Rv(t){return t.spec.defining||t.spec.definingForContent}function $v(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(ou(i,s,r))return t.step(new Ve(e,n,r));let o=cu(i,t.doc.resolve(n));o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let h=i.depth,p=i.pos-1;h>0;h--,p--){let m=i.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(h)>-1?a=h:i.before(h)==p&&o.splice(1,0,-h)}let l=o.indexOf(a),c=[],u=r.openStart;for(let h=r.content,p=0;;p++){let m=h.firstChild;if(c.push(m),p==r.openStart)break;h=m.content}for(let h=u-1;h>=0;h--){let p=c[h],m=Rv(p.type);if(m&&!p.sameMarkup(i.node(Math.abs(a)-1)))u=h;else if(m||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+u+1)%(r.openStart+1),m=c[p];if(m)for(let y=0;y<o.length;y++){let g=o[(y+l)%o.length],k=!0;g<0&&(k=!1,g=-g);let x=i.node(g-1),O=i.index(g-1);if(x.canReplaceWith(O,O,m.type,m.marks))return t.replace(i.before(g),k?s.after(g):n,new I(lu(r.content,0,r.openStart,p),p,r.openEnd))}}let f=t.steps.length;for(let h=o.length-1;h>=0&&(t.replace(e,n,r),!(t.steps.length>f));h--){let p=o[h];p<0||(e=i.before(p),n=s.after(p))}}function lu(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(lu(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(N.empty,!0))}return t}function Lv(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=Bv(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new I(N.from(r),0,0))}function Fv(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),s=cu(r,i);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.delete(r.before(a),i.after(a))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o)return t.delete(r.before(o),n);t.delete(e,n)}function cu(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}class $r extends We{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Te.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Te.fromReplace(e,this.pos,this.pos+1,new I(N.from(i),0,n.isLeaf?0:1))}getMap(){return ft.empty}invert(e){return new $r(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new $r(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new $r(n.pos,n.attr,n.value)}}We.jsonID("attr",$r);class Vi extends We{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Te.ok(r)}getMap(){return ft.empty}invert(e){return new Vi(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Vi(n.attr,n.value)}}We.jsonID("docAttr",Vi);let Lr=class extends Error{};Lr=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},Lr.prototype=Object.create(Error.prototype),Lr.prototype.constructor=Lr,Lr.prototype.name="TransformError";class zv{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Br}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Lr(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=I.empty){let i=Ys(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new I(N.from(r),0,0))}delete(e,n){return this.replace(e,n,I.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return $v(this,e,n,r),this}replaceRangeWith(e,n,r){return Lv(this,e,n,r),this}deleteRange(e,n){return Fv(this,e,n),this}lift(e,n){return Sv(this,e,n),this}join(e,n=1){return Vv(this,e,n),this}wrap(e,n){return Cv(this,e,n),this}setBlockType(e,n=e,r,i=null){return Tv(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return Dv(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new $r(e,n,r)),this}setDocAttribute(e,n){return this.step(new Vi(e,n)),this}addNodeMark(e,n){return this.step(new Bn(e,n)),this}removeNodeMark(e,n){if(!(n instanceof me)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n=n.isInSet(r.marks),!n)return this}return this.step(new Pr(e,n)),this}split(e,n=1,r){return Av(this,e,n,r),this}addMark(e,n,r){return kv(this,e,n,r),this}removeMark(e,n,r){return wv(this,e,n,r),this}clearIncompatible(e,n,r){return nu(this,e,n,r),this}}const Ca=Object.create(null);class Q{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new jv(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=I.empty){let r=n.content.lastChild,i=null;for(let a=0;a<n.openEnd;a++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],u=e.mapping.slice(s);e.replaceRange(u.map(l.pos),u.map(c.pos),a?I.empty:n),a==0&&fu(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],l=e.mapping.slice(r),c=l.map(o.pos),u=l.map(a.pos);s?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),fu(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new J(e):Fr(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=n<0?Fr(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):Fr(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Bt(e.node(0))}static atStart(e){return Fr(e,e,0,0,1)||new Bt(e)}static atEnd(e){return Fr(e,e,e.content.size,e.childCount,-1)||new Bt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ca[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Ca)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ca[e]=n,n.prototype.jsonID=e,n}getBookmark(){return J.between(this.$anchor,this.$head).getBookmark()}}Q.prototype.visible=!0;class jv{constructor(e,n){this.$from=e,this.$to=n}}let du=!1;function uu(t){!du&&!t.parent.inlineContent&&(du=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class J extends Q{constructor(e,n=e){uu(e),uu(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Q.near(r);let i=e.resolve(n.map(this.anchor));return new J(i.parent.inlineContent?i:r,r)}replace(e,n=I.empty){if(super.replace(e,n),n==I.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof J&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Us(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new J(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=Q.findFrom(n,r,!0)||Q.findFrom(n,-r,!0);if(s)n=s.$head;else return Q.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(Q.findFrom(e,-r,!0)||Q.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new J(e,n)}}Q.jsonID("text",J);class Us{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Us(e.map(this.anchor),e.map(this.head))}resolve(e){return J.between(e.resolve(this.anchor),e.resolve(this.head))}}class H extends Q{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?Q.near(s):new H(s)}content(){return new I(N.from(this.node),0,0)}eq(e){return e instanceof H&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Ta(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new H(e.resolve(n.anchor))}static create(e,n){return new H(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}H.prototype.visible=!1,Q.jsonID("node",H);class Ta{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Us(r,r):new Ta(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&H.isSelectable(r)?new H(n):Q.near(n)}}class Bt extends Q{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=I.empty){if(n==I.empty){e.delete(0,e.doc.content.size);let r=Q.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Bt(e)}map(e){return new Bt(e)}eq(e){return e instanceof Bt}getBookmark(){return Wv}}Q.jsonID("all",Bt);const Wv={map(){return this},resolve(t){return new Bt(t)}};function Fr(t,e,n,r,i,s=!1){if(e.inlineContent)return J.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&H.isSelectable(a))return H.create(t,n-(i<0?a.nodeSize:0))}else{let l=Fr(t,a,n+i,i<0?a.childCount:0,i,s);if(l)return l}n+=a.nodeSize*i}return null}function fu(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof Ve||i instanceof Be))return;let s=t.mapping.maps[r],o;s.forEach((a,l,c,u)=>{o==null&&(o=u)}),t.setSelection(Q.near(t.doc.resolve(o),n))}const hu=1,qs=2,pu=4;class Hv extends zv{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|hu)&~qs,this.storedMarks=null,this}get selectionSet(){return(this.updated&hu)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=qs,this}ensureMarks(e){return me.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&qs)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~qs,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||me.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),this.selection.empty||this.setSelection(Q.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=pu,this}get scrolledIntoView(){return(this.updated&pu)>0}}function mu(t,e){return!e||!t?t:t.bind(e)}class Bi{constructor(e,n,r){this.name=e,this.init=mu(n.init,r),this.apply=mu(n.apply,r)}}const Yv=[new Bi("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Bi("selection",{init(t,e){return t.selection||Q.atStart(e.doc)},apply(t){return t.selection}}),new Bi("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Bi("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Ea{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Yv.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Bi(r.key,r.spec.state,r))})}}class zr{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=i?i[o].n:0,c=i?i[o].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let f=0;f<this.config.plugins.length;f++)i.push(f<o?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),s=!0}i&&(i[o]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new zr(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new Hv(this)}static create(e){let n=new Ea(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new zr(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new Ea(this.schema,e.plugins),r=n.fields,i=new zr(n);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Ea(e.schema,e.plugins),s=new zr(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=sr.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=Q.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){s[o.name]=c.fromJSON.call(l,e,n[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function gu(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=gu(i,e,{})),n[r]=i}return n}class Ke{constructor(e){this.spec=e,this.props={},e.props&&gu(e.props,this,this.props),this.key=e.key?e.key.key:yu("plugin")}getState(e){return e[this.key]}}const _a=Object.create(null);function yu(t){return t in _a?t+"$"+ ++_a[t]:(_a[t]=0,t+"$")}class Pt{constructor(e="key"){this.key=yu(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const ze=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Pi=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Na=null;const fn=function(t,e,n){let r=Na||(Na=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},Uv=function(){Na=null},ar=function(t,e,n,r){return n&&(bu(t,e,n,r,-1)||bu(t,e,n,r,1))},qv=/^(img|br|input|textarea|hr)$/i;function bu(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Kt(t))){let s=t.parentNode;if(!s||s.nodeType!=1||Ii(t)||qv.test(t.nodeName)||t.contentEditable=="false")return!1;e=ze(t)+(i<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.contentEditable=="false")return!1;e=i<0?Kt(t):0}else return!1}}function Kt(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Kv(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Kt(t)}else if(t.parentNode&&!Ii(t))e=ze(t),t=t.parentNode;else return null}}function Jv(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Ii(t))e=ze(t)+1,t=t.parentNode;else return null}}function Gv(t,e,n){for(let r=e==0,i=e==Kt(t);r||i;){if(t==n)return!0;let s=ze(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Kt(t)}}function Ii(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Ks=function(t){return t.focusNode&&ar(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function lr(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Zv(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Xv(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:r.startOffset}}}const Jt=typeof navigator<"u"?navigator:null,vu=typeof document<"u"?document:null,In=Jt&&Jt.userAgent||"",Da=/Edge\/(\d+)/.exec(In),ku=/MSIE \d/.exec(In),Aa=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(In),st=!!(ku||Aa||Da),Rn=ku?document.documentMode:Aa?+Aa[1]:Da?+Da[1]:0,It=!st&&/gecko\/(\d+)/i.test(In);It&&+(/Firefox\/(\d+)/.exec(In)||[0,0])[1];const Va=!st&&/Chrome\/(\d+)/.exec(In),Je=!!Va,Qv=Va?+Va[1]:0,Ge=!st&&!!Jt&&/Apple Computer/.test(Jt.vendor),jr=Ge&&(/Mobile\/\w+/.test(In)||!!Jt&&Jt.maxTouchPoints>2),wt=jr||(Jt?/Mac/.test(Jt.platform):!1),e1=Jt?/Win/.test(Jt.platform):!1,Rt=/Android \d/.test(In),Ri=!!vu&&"webkitFontSmoothing"in vu.documentElement.style,t1=Ri?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function n1(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function hn(t,e){return typeof t=="number"?t:t[e]}function r1(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function wu(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;o=Pi(o)){if(o.nodeType!=1)continue;let a=o,l=a==s.body,c=l?n1(s):r1(a),u=0,f=0;if(e.top<c.top+hn(r,"top")?f=-(c.top-e.top+hn(i,"top")):e.bottom>c.bottom-hn(r,"bottom")&&(f=e.bottom-e.top>c.bottom-c.top?e.top+hn(i,"top")-c.top:e.bottom-c.bottom+hn(i,"bottom")),e.left<c.left+hn(r,"left")?u=-(c.left-e.left+hn(i,"left")):e.right>c.right-hn(r,"right")&&(u=e.right-c.right+hn(i,"right")),u||f)if(l)s.defaultView.scrollBy(u,f);else{let h=a.scrollLeft,p=a.scrollTop;f&&(a.scrollTop+=f),u&&(a.scrollLeft+=u);let m=a.scrollLeft-h,y=a.scrollTop-p;e={left:e.left-m,top:e.top-y,right:e.right-m,bottom:e.bottom-y}}if(l||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function i1(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=t.root.elementFromPoint(s,o);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:xu(t.dom)}}function xu(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Pi(r));return e}function s1({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Su(n,r==0?0:r-e)}function Su(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Wr=null;function o1(t){if(t.setActive)return t.setActive();if(Wr)return t.focus(Wr);let e=xu(t);t.focus(Wr==null?{get preventScroll(){return Wr={preventScroll:!0},!0}}:void 0),Wr||(Wr=!1,Su(e,0))}function Mu(t,e){let n,r=2e8,i,s=0,o=e.top,a=e.top,l,c;for(let u=t.firstChild,f=0;u;u=u.nextSibling,f++){let h;if(u.nodeType==1)h=u.getClientRects();else if(u.nodeType==3)h=fn(u).getClientRects();else continue;for(let p=0;p<h.length;p++){let m=h[p];if(m.top<=o&&m.bottom>=a){o=Math.max(m.bottom,o),a=Math.min(m.top,a);let y=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(y<r){n=u,r=y,i=y&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&y&&(s=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!l&&m.left<=e.left&&m.right>=e.left&&(l=u,c={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!n&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(s=f+1)}}return!n&&l&&(n=l,i=c,r=0),n&&n.nodeType==3?a1(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:Mu(n,i)}function a1(t,e){let n=t.nodeValue.length,r=document.createRange();for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let s=$n(r,1);if(s.top!=s.bottom&&Ba(e,s))return{node:t,offset:i+(e.left>=(s.left+s.right)/2?1:0)}}return{node:t,offset:0}}function Ba(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function l1(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function c1(t,e,n){let{node:r,offset:i}=Mu(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function d1(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let a=t.docView.nearestDesc(s,!0);if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)){let l=a.dom.getBoundingClientRect();if(a.node.isBlock&&a.parent&&(!o&&l.left>r.left||l.top>r.top?i=a.posBefore:(!o&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText)return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter}s=a.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function Ou(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let o=t.childNodes[s];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(Ba(e,c))return Ou(o,e,c)}}if((s=(s+1)%r)==i)break}return t}function u1(t,e){let n=t.dom.ownerDocument,r,i=0,s=Xv(n,e.left,e.top);s&&({node:r,offset:i}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=t.dom.getBoundingClientRect();if(!Ba(e,c)||(o=Ou(t.dom,e,c),!o))return null}if(Ge)for(let c=o;r&&c;c=Pi(c))c.draggable&&(r=void 0);if(o=l1(o,e),r){if(It&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],f;u.nodeName=="IMG"&&(f=u.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}let c;Ri&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=d1(t,r,i,e))}a==null&&(a=c1(t,o,e));let l=t.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Cu(t){return t.top<t.bottom||t.left<t.right}function $n(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Cu(r))return r}return Array.prototype.find.call(n,Cu)||t.getBoundingClientRect()}const f1=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Tu(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=Ri||It;if(r.nodeType==3)if(o&&(f1.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let l=$n(fn(r,i,i),n);if(It&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=$n(fn(r,i-1,i-1),-1);if(c.top==l.top){let u=$n(fn(r,i,i+1),-1);if(u.top!=l.top)return $i(u,u.left<c.left)}}return l}else{let l=i,c=i,u=n<0?1:-1;return n<0&&!i?(c++,u=-1):n>=0&&i==r.nodeValue.length?(l--,u=1):n<0?l--:c++,$i($n(fn(r,l,c),u),u<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==Kt(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return Pa(l.getBoundingClientRect(),!1)}if(s==null&&i<Kt(r)){let l=r.childNodes[i];if(l.nodeType==1)return Pa(l.getBoundingClientRect(),!0)}return Pa(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==Kt(r))){let l=r.childNodes[i-1],c=l.nodeType==3?fn(l,Kt(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return $i($n(c,1),!1)}if(s==null&&i<Kt(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?fn(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return $i($n(c,-1),!0)}return $i($n(r.nodeType==3?fn(r):r,-n),n>=0)}function $i(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Pa(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Eu(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function h1(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return Eu(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=Tu(t,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=fn(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(n=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const p1=/[\u0590-\u08ac]/;function m1(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=t.domSelection();return!p1.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?s:o:Eu(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:f}=t.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:m,focusOffset:y}=t.domSelectionRange(),g=m&&!p.contains(m.nodeType==1?m:m.parentNode)||l==m&&c==y;try{a.collapse(u,f),l&&(l!=u||c!=f)&&a.extend&&a.extend(l,c)}catch{}return h!=null&&(a.caretBidiLevel=h),g})}let _u=null,Nu=null,Du=!1;function g1(t,e,n){return _u==e&&Nu==n?Du:(_u=e,Nu=n,Du=n=="up"||n=="down"?h1(t,e,n):m1(t,e,n))}const xt=0,Au=1,cr=2,Gt=3;class Li{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=xt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>ze(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!n||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)i=i.children[0];return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],a=s+o.size;if(a>e||o instanceof Pu){i=e-s;break}s=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof Vu&&s.side>=0;r--);if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?ze(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?ze(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,a=0;;a++){let l=this.children[a],c=o+l.size;if(i==-1&&e<=c){let u=o+l.border;if(e>=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,u);e=o;for(let f=a;f>0;f--){let h=this.children[f-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=ze(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(c>n||a==this.children.length-1)){n=c;for(let u=a+1;u<this.children.length;u++){let f=this.children[u];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){s=ze(f.dom);break}n+=f.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),o=Math.max(e,n);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],y=p+m.size;if(s>p&&o<y)return m.setSelection(e-p-m.border,n-p-m.border,r,i);p=y}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),c=r.getSelection(),u=!1;if((It||Ge)&&e==n){let{node:h,offset:p}=a;if(h.nodeType==3){if(u=!!(p&&h.nodeValue[p-1]==`
10
+ `),u&&p==h.nodeValue.length)for(let m=h,y;m;m=m.parentNode){if(y=m.nextSibling){y.nodeName=="BR"&&(a=l={node:y.parentNode,offset:ze(y)+1});break}let g=m.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let m=h.childNodes[p-1];u=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(It&&c.focusNode&&c.focusNode!=l.node&&c.focusNode.nodeType==1){let h=c.focusNode.childNodes[c.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||u&&Ge)&&ar(a.node,a.offset,c.anchorNode,c.anchorOffset)&&ar(l.node,l.offset,c.focusNode,c.focusOffset))return;let f=!1;if((c.extend||e==n)&&!u){c.collapse(a.node,a.offset);try{e!=n&&c.extend(l.node,l.offset),f=!0}catch{}}if(!f){if(e>n){let p=a;a=l,l=p}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let a=r+s.border,l=o-s.border;if(e>=a&&n<=l){this.dirty=e==r||n==o?cr:Au,e==a&&n==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Gt:s.markDirty(e-a,n-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?cr:Gt}r=o}this.dirty=cr}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?cr:Au;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class Vu extends Li{constructor(e,n,r,i){let s,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==xt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class y1 extends Li{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class dr extends Li{constructor(e,n,r,i){super(e,[],r,i),this.mark=n}static create(e,n,r,i){let s=i.nodeViews[n.type.name],o=s&&s(n,i,r);return(!o||!o.dom)&&(o=Ut.renderSpec(document,n.type.spec.toDOM(n,r))),new dr(e,n,o.dom,o.contentDOM||o.dom)}parseRule(){return this.dirty&Gt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Gt&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=xt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=xt}}slice(e,n,r){let i=dr.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=$a(s,n,o,r)),e>0&&(s=$a(s,0,e,r));for(let a=0;a<s.length;a++)s[a].parent=i;return i.children=s,i}}class Ln extends Li{constructor(e,n,r,i,s,o,a,l,c){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,n,r,i,s,o){let a=s.nodeViews[n.type.name],l,c=a&&a(n,s,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,i),u=c&&c.dom,f=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:f}=Ut.renderSpec(document,n.type.spec.toDOM(n)));!f&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let h=u;return u=$u(u,r,n),c?l=new b1(e,n,r,i,u,f||null,h,c,s,o+1):n.isText?new Js(e,n,r,i,u,h,s):new Ln(e,n,r,i,u,f||null,h,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>N.empty)}return e}matchesNode(e,n,r){return this.dirty==xt&&e.eq(this.node)&&Ra(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new k1(this,o&&o.node,e);S1(this.node,this.innerDeco,(c,u,f)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!f&&l.syncToMarks(u==this.node.childCount?me.none:this.node.child(u).marks,r,e),l.placeWidget(c,e,i)},(c,u,f,h)=>{l.syncToMarks(c.marks,r,e);let p;l.findNodeMatch(c,u,f,h)||a&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(p=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(c,u,f,p,e)||l.updateNextNode(c,u,f,e,h,i)||l.addNode(c,u,f,e,i),i+=c.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==cr)&&(o&&this.protectLocalComposition(e,o),Iu(this.contentDOM,this.children,e),jr&&M1(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof J)||r<n||i>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,a=O1(this.node.content,o,r-n,i-n);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new y1(this,s,n,i);e.input.compositionNodes.push(o),this.children=$a(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==Gt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=xt}updateOuterDeco(e){if(Ra(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Ru(this.dom,this.nodeDOM,Ia(this.outerDeco,this.node,n),Ia(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Bu(t,e,n,r,i){$u(r,e,t);let s=new Ln(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Js extends Ln{constructor(e,n,r,i,s,o,a){super(e,n,r,i,s,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==Gt||this.dirty!=xt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=xt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=xt,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new Js(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Gt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Pu extends Li{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==xt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class b1 extends Ln{constructor(e,n,r,i,s,o,a,l,c,u){super(e,n,r,i,s,o,a,c,u),this.spec=l}update(e,n,r,i){if(this.dirty==Gt)return!1;if(this.spec.update){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Iu(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],a=o.dom;if(a.parentNode==t){for(;a!=r;)r=Lu(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(a,r);if(o instanceof dr){let l=r?r.previousSibling:t.lastChild;Iu(o.contentDOM,o.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=Lu(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const Fi=function(t){t&&(this.nodeName=t)};Fi.prototype=Object.create(null);const ur=[new Fi];function Ia(t,e,n){if(t.length==0)return ur;let r=n?ur[0]:new Fi,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new Fi(o.nodeName));for(let a in o){let l=o[a];l!=null&&(n&&i.length==1&&i.push(r=new Fi(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function Ru(t,e,n,r){if(n==ur&&r==ur)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],a=n[s];if(s){let l;a&&a.nodeName==o.nodeName&&i!=t&&(l=i.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=ur[0]),i=l}v1(i,a||ur[0],o)}return i}function v1(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&t.classList.add(i[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function $u(t,e,n){return Ru(t,t,ur,Ia(e,n,t.nodeType!=1))}function Ra(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Lu(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class k1{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=w1(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r){let i=0,s=this.stack.length>>1,o=Math.min(s,e.length);for(;i<o&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=xt,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let c=this.top.children[l];if(c.matchesMark(e[s])&&!this.isLocked(c.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=dr.create(this.top,e[s],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let o=this.top.children[i];return o.dirty==Gt&&o.dom==o.contentDOM&&(o.dirty=cr),o.update(e,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Ln){let c=this.preMatch.matched.get(l);if(c!=null&&c!=s)return!1;let u=l.dom,f,h=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Gt&&Ra(n,l.outerDeco));if(!h&&l.update(e,n,r,i))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!h&&(f=this.recreateWrapper(l,e,n,r,i,o)))return this.top.children[this.index]=f,f.contentDOM&&(f.dirty=cr,f.updateChildren(i,o+1),f.dirty=xt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content))return null;let a=Ln.create(this.top,n,r,i,s,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,i,s){let o=Ln.create(this.top,e,n,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new Vu(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof dr;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Js)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ge||Je)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new Pu(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function w1(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof dr)n=c,r=c.children.length;else{a=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function x1(t,e){return t.type.side-e.type.side}function S1(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,i,e.forChild(s,u),c),s+=u.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let u,f;for(;o<i.length&&i[o].to==s;){let g=i[o++];g.widget&&(u?(f||(f=[u])).push(g):u=g)}if(u)if(f){f.sort(x1);for(let g=0;g<f.length;g++)n(f[g],c,!!l)}else n(u,c,!!l);let h,p;if(l)p=-1,h=l,l=null;else if(c<t.childCount)p=c,h=t.child(c++);else break;for(let g=0;g<a.length;g++)a[g].to<=s&&a.splice(g--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let m=s+h.nodeSize;if(h.isText){let g=m;o<i.length&&i[o].from<g&&(g=i[o].from);for(let k=0;k<a.length;k++)a[k].to<g&&(g=a[k].to);g<m&&(l=h.cut(g-s),h=h.cut(0,g-s),m=g,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let y=h.isInline&&!h.isLeaf?a.filter(g=>!g.inline):a.slice();r(h,y,e.forChild(s,h),p),s=m}}function M1(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function O1(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<t.childCount;){let c=t.child(i++);if(s+=c.nodeSize,!c.isText)break;l+=c.text}if(s>=n){if(s>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=n)return a+c;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function $a(t,e,n,r,i){let s=[];for(let o=0,a=0;o<t.length;o++){let l=t[o],c=a,u=a+=l.size;c>=n||u<=e?s.push(l):(c<e&&s.push(l.slice(0,e-c,r)),i&&(s.push(i),i=void 0),u>n&&s.push(l.slice(n-c,l.size,r)))}return s}function La(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,c;if(Ks(n)){for(l=a;i&&!i.node;)i=i.parent;let u=i.node;if(i&&u.isAtom&&H.isSelectable(u)&&i.parent&&!(u.isInline&&Gv(n.focusNode,n.focusOffset,i.dom))){let f=i.posBefore;c=new H(o==f?a:r.resolve(f))}}else{let u=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(u<0)return null;l=r.resolve(u)}if(!c){let u=e=="pointer"||t.state.selection.head<a.pos&&!s?1:-1;c=za(t,l,a,u)}return c}function Fu(t){return t.editable?t.hasFocus():qu(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function pn(t,e=!1){let n=t.state.selection;if(Hu(t,n),!!Fu(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Je){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&ar(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)T1(t);else{let{anchor:r,head:i}=n,s,o;zu&&!(n instanceof J)&&(n.$from.parent.inlineContent||(s=ju(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=ju(t,n.to))),t.docView.setSelection(r,i,t.root,e),zu&&(s&&Wu(s),o&&Wu(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&C1(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const zu=Ge||Je&&Qv<63;function ju(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(Ge&&i&&i.contentEditable=="false")return Fa(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Fa(i);if(s)return Fa(s)}}function Fa(t){return t.contentEditable="true",Ge&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Wu(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function C1(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Fu(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function T1(t){let e=t.domSelection(),n=document.createRange(),r=t.cursorWrapper.dom,i=r.nodeName=="IMG";i?n.setEnd(r.parentNode,ze(r)+1):n.setEnd(r,0),n.collapse(!1),e.removeAllRanges(),e.addRange(n),!i&&!t.state.selection.visible&&st&&Rn<=11&&(r.disabled=!0,r.disabled=!1)}function Hu(t,e){if(e instanceof H){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Yu(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Yu(t)}function Yu(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function za(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||J.between(e,n,r)}function Uu(t){return t.editable&&!t.hasFocus()?!1:qu(t)}function qu(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function E1(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return ar(e.node,e.offset,n.anchorNode,n.anchorOffset)}function ja(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&Q.findFrom(s,e)}function Fn(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Ku(t,e,n){let r=t.state.selection;if(r instanceof J)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Fn(t,new J(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=ja(t.state,e);return i&&i instanceof H?Fn(t,i):!1}else if(!(wt&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(a))&&!o.contentDOM?H.isSelectable(s)?Fn(t,new H(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):Ri?Fn(t,new J(t.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof H&&r.node.isInline)return Fn(t,new J(e>0?r.$to:r.$from));{let i=ja(t.state,e);return i?Fn(t,i):!1}}}function Gs(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function zi(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Hr(t,e){return e<0?_1(t):N1(t)}function _1(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(It&&n.nodeType==1&&r<Gs(n)&&zi(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(zi(a,-1))i=n,s=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(Ju(n))break;{let a=n.previousSibling;for(;a&&zi(a,-1);)i=n.parentNode,s=ze(a),a=a.previousSibling;if(a)n=a,r=Gs(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Wa(t,n,r):i&&Wa(t,i,s)}function N1(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Gs(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let a=n.childNodes[r];if(zi(a,1))s=n,o=++r;else break}else{if(Ju(n))break;{let a=n.nextSibling;for(;a&&zi(a,1);)s=a.parentNode,o=ze(a)+1,a=a.nextSibling;if(a)n=a,r=0,i=Gs(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&Wa(t,s,o)}function Ju(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function D1(t,e){for(;t&&e==t.childNodes.length&&!Ii(t);)e=ze(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function A1(t,e){for(;t&&!e&&!Ii(t);)e=ze(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Wa(t,e,n){if(e.nodeType!=3){let s,o;(o=D1(e,n))?(e=o,n=0):(s=A1(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(Ks(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&pn(t)},50)}function Gu(t,e){let n=t.state.doc.resolve(e);if(!(Je||e1)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Zu(t,e,n){let r=t.state.selection;if(r instanceof J&&!r.empty||n.indexOf("s")>-1||wt&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=ja(t.state,e);if(o&&o instanceof H)return Fn(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=r instanceof Bt?Q.near(o,e):Q.findFrom(o,e);return a?Fn(t,a):!1}return!1}function Xu(t,e){if(!(t.state.selection instanceof J))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function Qu(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function V1(t){if(!Ge||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Qu(t,r,"true"),setTimeout(()=>Qu(t,r,"false"),20)}return!1}function B1(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function P1(t,e){let n=e.keyCode,r=B1(e);if(n==8||wt&&n==72&&r=="c")return Xu(t,-1)||Hr(t,-1);if(n==46&&!e.shiftKey||wt&&n==68&&r=="c")return Xu(t,1)||Hr(t,1);if(n==13||n==27)return!0;if(n==37||wt&&n==66&&r=="c"){let i=n==37?Gu(t,t.state.selection.from)=="ltr"?-1:1:-1;return Ku(t,i,r)||Hr(t,i)}else if(n==39||wt&&n==70&&r=="c"){let i=n==39?Gu(t,t.state.selection.from)=="ltr"?1:-1:1;return Ku(t,i,r)||Hr(t,i)}else{if(n==38||wt&&n==80&&r=="c")return Zu(t,-1,r)||Hr(t,-1);if(n==40||wt&&n==78&&r=="c")return V1(t)||Zu(t,1,r)||Hr(t,1);if(r==(wt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function ef(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let o=t.someProp("clipboardSerializer")||Ut.fromSchema(t.state.schema),a=cf(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let c=l.firstChild,u,f=0;for(;c&&c.nodeType==1&&(u=af[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let m=a.createElement(u[p]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),f++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${f?` -${f}`:""} ${JSON.stringify(n)}`);let h=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,`
11
+
12
+ `);return{dom:l,text:h,slice:e}}function tf(t,e,n,r,i){let s=i.parent.type.spec.code,o,a;if(!n&&!e)return null;let l=e&&(r||s||!n);if(l){if(t.someProp("transformPastedText",h=>{e=h(e,s||r,t)}),s)return e?new I(N.from(t.state.schema.text(e.replace(/\r\n?/g,`
13
+ `))),0,0):I.empty;let f=t.someProp("clipboardTextParser",h=>h(e,i,r,t));if(f)a=f;else{let h=i.marks(),{schema:p}=t.state,m=Ut.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(y=>{let g=o.appendChild(document.createElement("p"));y&&g.appendChild(m.serializeNode(p.text(y,h)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),o=$1(n),Ri&&L1(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||Vr.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||u),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!I1.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)a=F1(of(a,+u[1],+u[2]),u[4]);else if(a=I.maxOpen(R1(a.content,i),!0),a.openStart||a.openEnd){let f=0,h=0;for(let p=a.content.firstChild;f<a.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=a.content.lastChild;h<a.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);a=of(a,f,h)}return t.someProp("transformPasted",f=>{a=f(a,t)}),a}const I1=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function R1(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&s.length&&rf(l,s,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=sf(o[o.length-1],s.length));let u=nf(a,l);o.push(u),i=i.matchType(u.type),s=l}}),o)return N.from(o)}return t}function nf(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,N.from(t));return t}function rf(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=rf(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(N.from(nf(n,t,i+1))))}}function sf(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,sf(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(N.empty,!0);return t.copy(n.append(r))}function Ha(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,a=o.content;return t.childCount>1&&(s=0),i<r-1&&(a=Ha(a,e,n,r,i+1,s)),i>=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(N.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function of(t,e,n){return e<t.openStart&&(t=new I(Ha(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new I(Ha(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const af={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let lf=null;function cf(){return lf||(lf=document.implementation.createHTMLDocument("title"))}function $1(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=cf().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&af[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=t,i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function L1(t){let e=t.querySelectorAll(Je?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function F1(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=N.from(l.create(r[a+1],i)),s++,o++}return new I(i,s,o)}const Ze={},Xe={},z1={touchstart:!0,touchmove:!0};class j1{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function W1(t){for(let e in Ze){let n=Ze[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{Y1(t,r)&&!Ua(t,r)&&(t.editable||!(r.type in Xe))&&n(t,r)},z1[e]?{passive:!0}:void 0)}Ge&&t.dom.addEventListener("input",()=>null),Ya(t)}function zn(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function H1(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Ya(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Ua(t,r))})}function Ua(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function Y1(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function U1(t,e){!Ua(t,e)&&Ze[e.type]&&(t.editable||!(e.type in Xe))&&Ze[e.type](t,e)}Xe.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!uf(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Rt&&Je&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),jr&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,lr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||P1(t,n)?n.preventDefault():zn(t,"key")},Xe.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)},Xe.keypress=(t,e)=>{let n=e;if(uf(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||wt&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof J)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode);!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,i))&&t.dispatch(t.state.tr.insertText(i).scrollIntoView()),n.preventDefault()}};function Zs(t){return{left:t.clientX,top:t.clientY}}function q1(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function qa(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,a=>o>s.depth?a(t,n,s.nodeAfter,s.before(o),i,!0):a(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function Yr(t,e,n){t.focused||t.focus();let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function K1(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&H.isSelectable(r)?(Yr(t,new H(n)),!0):!1}function J1(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof H&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(H.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(Yr(t,H.create(t.state.doc,i)),!0):!1}function G1(t,e,n,r,i){return qa(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?J1(t,n):K1(t,n))}function Z1(t,e,n,r){return qa(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function X1(t,e,n,r){return qa(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||Q1(t,n,r)}function Q1(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Yr(t,J.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)Yr(t,J.create(r,a+1,a+1+o.content.size));else if(H.isSelectable(o))Yr(t,H.create(r,a));else continue;return!0}}function Ka(t){return Xs(t)}const df=wt?"metaKey":"ctrlKey";Ze.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Ka(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&q1(n,t.input.lastClick)&&!n[df]&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s};let o=t.posAtCoords(Zs(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new ek(t,o,n,!!r)):(s=="doubleClick"?Z1:X1)(t,o.pos,o.inside,n)?n.preventDefault():zn(t,"pointer"))};class ek{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[df],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let u=e.state.doc.resolve(n.pos);s=u.parent,o=u.depth?u.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.dom.nodeType==1?l.dom:null;let{selection:c}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof H&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&It&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),zn(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>pn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Zs(e))),this.updateAllowDefault(e),this.allowDefault||!n?zn(this.view,"pointer"):G1(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ge&&this.mightDrag&&!this.mightDrag.node.isAtom||Je&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Yr(this.view,Q.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):zn(this.view,"pointer")}move(e){this.updateAllowDefault(e),zn(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Ze.touchstart=t=>{t.input.lastTouch=Date.now(),Ka(t),zn(t,"pointer")},Ze.touchmove=t=>{t.input.lastTouch=Date.now(),zn(t,"pointer")},Ze.contextmenu=t=>Ka(t);function uf(t,e){return t.composing?!0:Ge&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const tk=Rt?5e3:-1;Xe.compositionstart=Xe.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),Xs(t,!0),t.markCursor=null;else if(Xs(t),It&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){t.domSelection().collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}ff(t,tk)},Xe.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,ff(t,20))};function ff(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Xs(t),e))}function hf(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=rk());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function nk(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=Kv(e.focusNode,e.focusOffset),r=Jv(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function rk(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Xs(t,e=!1){if(!(Rt&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),hf(t),e||t.docView&&t.docView.dirty){let n=La(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):t.updateState(t.state),!0}return!1}}function ik(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const ji=st&&Rn<15||jr&&t1<604;Ze.copy=Xe.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=ji?null:n.clipboardData,o=r.content(),{dom:a,text:l}=ef(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):ik(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function sk(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function ok(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Wi(t,r.value,null,i,e):Wi(t,r.textContent,r.innerHTML,i,e)},50)}function Wi(t,e,n,r,i){let s=tf(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,s||I.empty)))return!0;if(!s)return!1;let o=sk(s),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function pf(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Xe.paste=(t,e)=>{let n=e;if(t.composing&&!Rt)return;let r=ji?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Wi(t,pf(r),r.getData("text/html"),i,n)?n.preventDefault():ok(t,n)};class mf{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const gf=wt?"altKey":"ctrlKey";Ze.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(Zs(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof H?i.to-1:i.to))){if(r&&r.mightDrag)o=H.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(o=H.create(t.state.doc,f.posBefore))}}let a=(o||t.state.selection).content(),{dom:l,text:c,slice:u}=ef(t,a);n.dataTransfer.clearData(),n.dataTransfer.setData(ji?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",ji||n.dataTransfer.setData("text/plain",c),t.dragging=new mf(u,!n[gf],o)},Ze.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)},Xe.dragover=Xe.dragenter=(t,e)=>e.preventDefault(),Xe.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let i=t.posAtCoords(Zs(n));if(!i)return;let s=t.state.doc.resolve(i.pos),o=r&&r.slice;o?t.someProp("transformPasted",m=>{o=m(o,t)}):o=tf(t,pf(n.dataTransfer),ji?null:n.dataTransfer.getData("text/html"),!1,s);let a=!!(r&&!n[gf]);if(t.someProp("handleDrop",m=>m(t,n,o||I.empty,a))){n.preventDefault();return}if(!o)return;n.preventDefault();let l=o?su(t.state.doc,s.pos,o):s.pos;l==null&&(l=s.pos);let c=t.state.tr;if(a){let{node:m}=r;m?m.replace(c):c.deleteSelection()}let u=c.mapping.map(l),f=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,h=c.doc;if(f?c.replaceRangeWith(u,u,o.content.firstChild):c.replaceRange(u,u,o),c.doc.eq(h))return;let p=c.doc.resolve(u);if(f&&H.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new H(p));else{let m=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((y,g,k,x)=>m=x),c.setSelection(za(t,p,c.doc.resolve(m)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))},Ze.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&pn(t)},20))},Ze.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},Ze.beforeinput=(t,e)=>{if(Je&&Rt&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,lr(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Xe)Ze[t]=Xe[t];function Hi(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Qs{constructor(e,n){this.toDOM=e,this.spec=n||fr,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new ht(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Qs&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Hi(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class jn{constructor(e,n){this.attrs=e,this.spec=n||fr}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new ht(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof jn&&Hi(this.attrs,e.attrs)&&Hi(this.spec,e.spec)}static is(e){return e.type instanceof jn}destroy(){}}class Ja{constructor(e,n){this.attrs=e,this.spec=n||fr}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new ht(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof Ja&&Hi(this.attrs,e.attrs)&&Hi(this.spec,e.spec)}destroy(){}}class ht{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new ht(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new ht(e,e,new Qs(n,r))}static inline(e,n,r,i){return new ht(e,n,new jn(r,i))}static node(e,n,r,i){return new ht(e,n,new Ja(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof jn}get widget(){return this.type instanceof Qs}}const Ur=[],fr={};class Ee{constructor(e,n){this.local=e.length?e:Ur,this.children=n.length?n:Ur}static create(e,n){return n.length?eo(n,e,0,fr):He}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=n&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,i+a,s)}}map(e,n,r){return this==He||e.maps.length==0?this:this.mapInner(e,n,0,0,r||fr)}mapInner(e,n,r,i,s){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(n,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?ak(this.children,o||[],e,n,r,i,s):o?new Ee(o.sort(hr),Ur):He}add(e,n){return n.length?this==He?Ee.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((a,l)=>{let c=l+r,u;if(u=bf(n,a,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<l;)s+=3;i[s]==l?i[s+2]=i[s+2].addInner(a,u,c+1):i.splice(s,0,l,l+a.nodeSize,eo(u,a,c+1,fr)),s+=3}});let o=yf(s?vf(n):n,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new Ee(o.length?this.local.concat(o).sort(hr):this.local,i||this.children)}remove(e){return e.length==0||this==He?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,a=r[s]+n,l=r[s+1]+n;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>a&&f.to<l&&(e[u]=null,(o||(o=[])).push(f));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(o,a+1);c!=He?r[s+2]=c:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Ee(i,r):He}forChild(e,n){if(this==He)return this;if(n.isLeaf)return Ee.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,o=s+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>s&&l.type instanceof jn){let c=Math.max(s,l.from)-s,u=Math.min(o,l.to)-s;c<u&&(i||(i=[])).push(l.copy(c,u))}}if(i){let a=new Ee(i.sort(hr),Ur);return r?new Wn([a,r]):a}return r||He}eq(e){if(this==e)return!0;if(!(e instanceof Ee)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Ga(this.localsInner(e))}localsInner(e){if(this==He)return Ur;if(e.inlineContent||!this.local.some(jn.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof jn||n.push(this.local[r]);return n}}Ee.empty=new Ee([],[]),Ee.removeOverlap=Ga;const He=Ee.empty;class Wn{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,fr));return Wn.from(r)}forChild(e,n){if(n.isLeaf)return Ee.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=He&&(s instanceof Wn?r=r.concat(s.members):r.push(s))}return Wn.from(r)}eq(e){if(!(e instanceof Wn)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?Ga(r?n:n.sort(hr)):Ur}static from(e){switch(e.length){case 0:return He;case 1:return e[0];default:return new Wn(e.every(n=>n instanceof Ee)?e:e.reduce((n,r)=>n.concat(r instanceof Ee?r:r.members),[]))}}}function ak(t,e,n,r,i,s,o){let a=t.slice();for(let c=0,u=s;c<n.maps.length;c++){let f=0;n.maps[c].forEach((h,p,m,y)=>{let g=y-m-(p-h);for(let k=0;k<a.length;k+=3){let x=a[k+1];if(x<0||h>x+u-f)continue;let O=a[k]+u-f;p>=O?a[k+1]=h<=O?-2:-1:h>=u&&g&&(a[k]+=g,a[k+1]+=g)}f+=g}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=n.map(t[c]+s),f=u-i;if(f<0||f>=r.content.size){l=!0;continue}let h=n.map(t[c+1]+s,-1),p=h-i,{index:m,offset:y}=r.content.findIndex(f),g=r.maybeChild(m);if(g&&y==f&&y+g.nodeSize==p){let k=a[c+2].mapInner(n,g,u+1,t[c]+s+1,o);k!=He?(a[c]=f,a[c+1]=p,a[c+2]=k):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=lk(a,t,e,n,i,s,o),u=eo(c,r,0,o);e=u.local;for(let f=0;f<a.length;f+=3)a[f+1]<0&&(a.splice(f,3),f-=3);for(let f=0,h=0;f<u.children.length;f+=3){let p=u.children[f];for(;h<a.length&&a[h]<p;)h+=3;a.splice(h,0,u.children[f],u.children[f+1],u.children[f+2])}}return new Ee(e.sort(hr),a)}function yf(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new ht(i.from+e,i.to+e,i.type))}return n}function lk(t,e,n,r,i,s,o){function a(l,c){for(let u=0;u<l.local.length;u++){let f=l.local[u].map(r,i,c);f?n.push(f):o.onRemove&&o.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+s+1);return n}function bf(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function vf(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function eo(t,e,n,r){let i=[],s=!1;e.forEach((a,l)=>{let c=bf(t,a,l+n);if(c){s=!0;let u=eo(c,a,n+l+1,r);u!=He&&i.push(l,l+a.nodeSize,u)}});let o=yf(s?vf(t):t,-n).sort(hr);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new Ee(o,i):He}function hr(t,e){return t.from-e.from||t.to-e.to}function Ga(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),kf(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),kf(e,i,r.copy(s.from,r.to)));break}}}return e}function kf(t,e,n){for(;e<t.length&&hr(n,t[e])>0;)e++;t.splice(e,0,n)}function Za(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=He&&e.push(r)}),t.cursorWrapper&&e.push(Ee.create(t.state.doc,[t.cursorWrapper.deco])),Wn.from(e)}const ck={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},dk=st&&Rn<=11;class uk{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class fk{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new uk,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);st&&Rn<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),dk&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,ck)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Uu(this.view)){if(this.suppressingSelectionUpdates)return pn(this.view);if(st&&Rn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ar(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let s=e.focusNode;s;s=Pi(s))n.add(s);for(let s=e.anchorNode;s;s=Pi(s))if(n.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Uu(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let u=0;u<n.length;u++){let f=this.registerMutation(n[u],l);f&&(s=s<0?f.from:Math.min(f.from,s),o=o<0?f.to:Math.max(f.to,o),f.typeOver&&(a=!0))}if(It&&l.length){let u=l.filter(f=>f.nodeName=="BR");if(u.length==2){let[f,h]=u;f.parentNode&&f.parentNode.parentNode==h.parentNode?h.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let h of u){let p=h.parentNode;p&&p.nodeName=="LI"&&(!f||mk(e,f)!=p)&&h.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ks(r)&&(c=La(e))&&c.eq(Q.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,pn(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),hk(e)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||pn(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let f=e.addedNodes[u];n.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(st&&Rn<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:f,nextSibling:h}=e.addedNodes[u];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(s=h)}let o=i&&i.parentNode==e.target?ze(i)+1:0,a=r.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?ze(s):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let wf=new WeakMap,xf=!1;function hk(t){if(!wf.has(t)&&(wf.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=It,xf)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),xf=!0}}function Sf(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return ar(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function pk(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Sf(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Sf(t,n):null}function mk(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function gk(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:o,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),c,u=l.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],Ks(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Je&&t.input.lastKeyCode===8)for(let g=s;g>i;g--){let k=r.childNodes[g-1],x=k.pmViewDesc;if(k.nodeName=="BR"&&!x){s=g;break}if(!x||x.size)break}let f=t.state.doc,h=t.someProp("domParser")||Vr.fromSchema(t.state.schema),p=f.resolve(o),m=null,y=h.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:s,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:yk,context:p});if(c&&c[0].pos!=null){let g=c[0].pos,k=c[1]&&c[1].pos;k==null&&(k=g),m={anchor:g+o,head:k+o}}return{doc:y,sel:m,from:o,to:a}}function yk(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Ge&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Ge&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const bk=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function vk(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let V=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,F=La(t,V);if(F&&!t.state.selection.eq(F)){if(Je&&Rt&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",G=>G(t,lr(13,"Enter"))))return;let te=t.state.tr.setSelection(F);V=="pointer"?te.setMeta("pointer",!0):V=="key"&&te.scrollIntoView(),s&&te.setMeta("composition",s),t.dispatch(te)}return}let o=t.state.doc.resolve(e),a=o.sharedDepth(n);e=o.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,c=gk(t,e,n),u=t.state.doc,f=u.slice(c.from,c.to),h,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(h=t.state.selection.to,p="end"):(h=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let m=xk(f.content,c.doc.content,c.from,h,p);if((jr&&t.input.lastIOSEnter>Date.now()-225||Rt)&&i.some(V=>V.nodeType==1&&!bk.test(V.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",V=>V(t,lr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof J&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let V=Mf(t,t.state.doc,c.sel);if(V&&!V.eq(t.state.selection)){let F=t.state.tr.setSelection(V);s&&F.setMeta("composition",s),t.dispatch(F)}}return}t.input.domChangeCount++,t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof J&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),st&&Rn<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>c.from&&c.doc.textBetween(m.start-c.from-1,m.start-c.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let y=c.doc.resolveNoCache(m.start-c.from),g=c.doc.resolveNoCache(m.endB-c.from),k=u.resolve(m.start),x=y.sameParent(g)&&y.parent.inlineContent&&k.end()>=m.endA,O;if((jr&&t.input.lastIOSEnter>Date.now()-225&&(!x||i.some(V=>V.nodeName=="DIV"||V.nodeName=="P"))||!x&&y.pos<c.doc.content.size&&!y.sameParent(g)&&(O=Q.findFrom(c.doc.resolve(y.pos+1),1,!0))&&O.head==g.pos)&&t.someProp("handleKeyDown",V=>V(t,lr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&wk(u,m.start,m.endA,y,g)&&t.someProp("handleKeyDown",V=>V(t,lr(8,"Backspace")))){Rt&&Je&&t.domObserver.suppressSelectionUpdates();return}Je&&Rt&&m.endB==m.start&&(t.input.lastAndroidDelete=Date.now()),Rt&&!x&&y.start()!=g.start()&&g.parentOffset==0&&y.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,g=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(V){return V(t,lr(13,"Enter"))})},20));let b=m.start,C=m.endA,v,T,B;if(x){if(y.pos==g.pos)st&&Rn<=11&&y.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>pn(t),20)),v=t.state.tr.delete(b,C),T=u.resolve(m.start).marksAcross(u.resolve(m.endA));else if(m.endA==m.endB&&(B=kk(y.parent.content.cut(y.parentOffset,g.parentOffset),k.parent.content.cut(k.parentOffset,m.endA-k.start()))))v=t.state.tr,B.type=="add"?v.addMark(b,C,B.mark):v.removeMark(b,C,B.mark);else if(y.parent.child(y.index()).isText&&y.index()==g.index()-(g.textOffset?0:1)){let V=y.parent.textBetween(y.parentOffset,g.parentOffset);if(t.someProp("handleTextInput",F=>F(t,b,C,V)))return;v=t.state.tr.insertText(V,b,C)}}if(v||(v=t.state.tr.replace(b,C,c.doc.slice(m.start-c.from,m.endB-c.from))),c.sel){let V=Mf(t,v.doc,c.sel);V&&!(Je&&Rt&&t.composing&&V.empty&&(m.start!=m.endB||t.input.lastAndroidDelete<Date.now()-100)&&(V.head==b||V.head==v.mapping.map(C)-1)||st&&V.empty&&V.head==b)&&v.setSelection(V)}T&&v.ensureMarks(T),s&&v.setMeta("composition",s),t.dispatch(v.scrollIntoView())}function Mf(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:za(t,e.resolve(n.anchor),e.resolve(n.head))}function kk(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,a,l;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<n.length;u++)s=n[u].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",l=u=>u.mark(a.addToSet(u.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(N.from(c).eq(t))return{mark:a,type:o}}function wk(t,e,n,r,i){if(n-e<=i.pos-r.pos||Xa(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&n==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(Xa(s,!0,!0));return!o.parent.isTextblock||o.pos>n||Xa(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Xa(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function xk(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:o,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let l=Math.max(0,s-Math.min(o,a));r-=o+l-s}if(o<s&&t.size<e.size){let l=r<=s&&r>=o?s-r:0;s-=l,s&&s<e.size&&Of(e.textBetween(s-1,s+1))&&(s+=l?1:-1),a=s+(a-o),o=s}else if(a<s){let l=r<=s&&r>=a?s-r:0;s-=l,s&&s<t.size&&Of(t.textBetween(s-1,s+1))&&(s+=l?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}function Of(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class Sk{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new j1,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Nf),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Ef(this),Tf(this),this.nodeViews=_f(this),this.docView=Bu(this.state.doc,Cf(this),Za(this),this.dom,this),this.domObserver=new fk(this,(r,i,s,o)=>vk(this,r,i,s,o)),this.domObserver.start(),W1(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ya(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Nf),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(hf(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=_f(this);Ok(p,this.nodeViews)&&(this.nodeViews=p,s=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Ya(this),this.editable=Ef(this),Tf(this);let l=Za(this),c=Cf(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=s||!this.docView.matchesNode(e.doc,c,l);(f||!e.selection.eq(i.selection))&&(o=!0);let h=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&i1(this);if(o){this.domObserver.stop();let p=f&&(st||Je)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Mk(i.selection,e.selection);if(f){let m=Je?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=nk(this)),(s||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Bu(e.doc,c,l,this.dom,this)),m&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&E1(this))?pn(this,p):(Hu(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():h&&s1(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof H){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&wu(this,n.getBoundingClientRect(),e)}else wu(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new mf(e.slice,e.move,i<0?void 0:H.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=n?n(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=n?n(a):a))return i}}hasFocus(){if(st){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&o1(this.dom),pn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return u1(this,e)}coordsAtPos(e,n=1){return Tu(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return g1(this,n||this.state,e)}pasteHTML(e,n){return Wi(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Wi(this,e,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(H1(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Za(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Uv())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return U1(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return Ge&&this.root.nodeType===11&&Zv(this.dom.ownerDocument)==this.dom&&pk(this,e)||e}domSelection(){return this.root.getSelection()}}function Cf(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[ht.node(0,t.state.doc.content.size,e)]}function Tf(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:ht.widget(t.state.selection.head,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Ef(t){return!t.someProp("editable",e=>e(t.state)===!1)}function Mk(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function _f(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Ok(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function Nf(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var Hn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},to={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Ck=typeof navigator<"u"&&/Mac/.test(navigator.platform),Tk=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),je=0;je<10;je++)Hn[48+je]=Hn[96+je]=String(je);for(var je=1;je<=24;je++)Hn[je+111]="F"+je;for(var je=65;je<=90;je++)Hn[je]=String.fromCharCode(je+32),to[je]=String.fromCharCode(je);for(var Qa in Hn)to.hasOwnProperty(Qa)||(to[Qa]=Hn[Qa]);function Ek(t){var e=Ck&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Tk&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?to:Hn)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const _k=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Nk(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))_k?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function Dk(t){let e=Object.create(null);for(let n in t)e[Nk(n)]=t[n];return e}function el(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function Ak(t){return new Ke({props:{handleKeyDown:Df(t)}})}function Df(t){let e=Dk(t);return function(n,r){let i=Ek(r),s,o=e[el(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[el(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(s=Hn[r.keyCode])&&s!=i){let a=e[el(s,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}const Vk=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Af(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Bk=(t,e,n)=>{let r=Af(t,n);if(!r)return!1;let i=tl(r);if(!i){let o=r.blockRange(),a=o&&Ir(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(!s.type.spec.isolating&&If(t,i,e))return!0;if(r.parent.content.size==0&&(qr(s,"end")||H.isSelectable(s))){let o=Ys(t.doc,r.before(),r.after(),I.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(qr(s,"end")?Q.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):H.create(a.doc,i.pos-s.nodeSize)),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},Pk=(t,e,n)=>{let r=Af(t,n);if(!r)return!1;let i=tl(r);return i?Vf(t,i,e):!1},Ik=(t,e,n)=>{let r=Bf(t,n);if(!r)return!1;let i=nl(r);return i?Vf(t,i,e):!1};function Vf(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=Ys(t.doc,s,l,I.empty);if(!c||c.from!=s||c instanceof Ve&&c.slice.size>=l-s)return!1;if(n){let u=t.tr.step(c);u.setSelection(J.create(u.doc,s)),n(u.scrollIntoView())}return!0}function qr(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const Rk=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=tl(r)}let o=s&&s.nodeBefore;return!o||!H.isSelectable(o)?!1:(e&&e(t.tr.setSelection(H.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function tl(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Bf(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const $k=(t,e,n)=>{let r=Bf(t,n);if(!r)return!1;let i=nl(r);if(!i)return!1;let s=i.nodeAfter;if(If(t,i,e))return!0;if(r.parent.content.size==0&&(qr(s,"start")||H.isSelectable(s))){let o=Ys(t.doc,r.before(),r.after(),I.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(qr(s,"start")?Q.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):H.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},Lk=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=nl(r)}let o=s&&s.nodeAfter;return!o||!H.isSelectable(o)?!1:(e&&e(t.tr.setSelection(H.create(t.doc,s.pos)).scrollIntoView()),!0)};function nl(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const Fk=(t,e)=>{let n=t.selection,r=n instanceof H,i;if(r){if(n.node.isTextblock||!Pn(t.doc,n.from))return!1;i=n.from}else if(i=Hs(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(H.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},zk=(t,e)=>{let n=t.selection,r;if(n instanceof H){if(n.node.isTextblock||!Pn(t.doc,n.to))return!1;r=n.to}else if(r=Hs(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},jk=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&Ir(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},Wk=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
14
+ `).scrollIntoView()),!0)};function Pf(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Hk=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=Pf(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,o.createAndFill());l.setSelection(Q.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Yk=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Bt||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=Pf(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=t.tr.insert(o,s.createAndFill());a.setSelection(J.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},Uk=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(Rr(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Ir(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)},qk=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(H.create(t.doc,i))),!0)};function Kk(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Pn(t.doc,e.pos))?!1:(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function If(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s,o;if(r.type.spec.isolating||i.type.spec.isolating)return!1;if(Kk(t,e,n))return!0;let a=e.parent.canReplace(e.index(),e.index()+1);if(a&&(s=(o=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&o.matchType(s[0]||i.type).validEnd){if(n){let f=e.pos+i.nodeSize,h=N.empty;for(let y=s.length-1;y>=0;y--)h=N.from(s[y].create(null,h));h=N.from(r.copy(h));let p=t.tr.step(new Be(e.pos-1,f,e.pos,f,new I(h,1,0),s.length,!0)),m=f+2*s.length;Pn(p.doc,m)&&p.join(m),n(p.scrollIntoView())}return!0}let l=Q.findFrom(e,1),c=l&&l.$from.blockRange(l.$to),u=c&&Ir(c);if(u!=null&&u>=e.depth)return n&&n(t.tr.lift(c,u).scrollIntoView()),!0;if(a&&qr(i,"start",!0)&&qr(r,"end")){let f=r,h=[];for(;h.push(f),!f.isTextblock;)f=f.lastChild;let p=i,m=1;for(;!p.isTextblock;p=p.firstChild)m++;if(f.canReplace(f.childCount,f.childCount,p.content)){if(n){let y=N.empty;for(let k=h.length-1;k>=0;k--)y=N.from(h[k].copy(y));let g=t.tr.step(new Be(e.pos-h.length,e.pos+i.nodeSize,e.pos+m,e.pos+i.nodeSize-m,new I(y,h.length,0),0,!0));n(g.scrollIntoView())}return!0}}return!1}function Rf(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(J.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const Jk=Rf(-1),Gk=Rf(1);function Zk(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),a=o&&Sa(o,t,e);return a?(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0):!1}}function $f(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=n.selection.ranges[s];n.doc.nodesBetween(o,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)i=!0;else{let u=n.doc.resolve(c),f=u.index();i=u.parent.canReplaceWith(f,f+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[o];s.setBlockType(a,l,t,e)}r(s.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Xk(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),a=!1,l=o;if(!o)return!1;if(o.depth>=2&&i.node(o.depth-1).type.compatibleContent(t)&&o.startIndex==0){if(i.index(o.depth-1)==0)return!1;let u=n.doc.resolve(o.start-2);l=new Rs(u,u,o.depth),o.endIndex<o.parent.childCount&&(o=new Rs(i,n.doc.resolve(s.end(o.depth)),o.depth)),a=!0}let c=Sa(l,t,e,o);return c?(r&&r(Qk(n.tr,o,c,a,t).scrollIntoView()),!0):!1}}function Qk(t,e,n,r,i){let s=N.empty;for(let u=n.length-1;u>=0;u--)s=N.from(n[u].type.create(n[u].attrs,s));t.step(new Be(e.start-(r?2:0),e.end,e.start,e.end,new I(s,0,0),n.length,!0));let o=0;for(let u=0;u<n.length;u++)n[u].type==i&&(o=u+1);let a=n.length-o,l=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,f=e.endIndex,h=!0;u<f;u++,h=!1)!h&&Rr(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function ew(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?tw(e,n,t,s):nw(e,n,s):!0:!1}}function tw(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new Be(s-1,o,s,o,new I(N.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Rs(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const a=Ir(r);if(a==null)return!1;i.lift(r,a);let l=i.mapping.map(s,-1)-1;return Pn(i.doc,l)&&i.join(l),e(i.scrollIntoView()),!0}function nw(t,e,n){let r=t.tr,i=n.parent;for(let p=n.end,m=n.endIndex-1,y=n.startIndex;m>y;m--)p-=i.child(m).nodeSize,r.delete(p-1,p+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==i.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(a?0:1),u+1,o.content.append(l?N.empty:N.from(i))))return!1;let f=s.pos,h=f+o.nodeSize;return r.step(new Be(f-(a?1:0),h+(l?1:0),f+1,h-1,new I((a?N.empty:N.from(i.copy(N.empty))).append(l?N.empty:N.from(i.copy(N.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function rw(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=t)return!1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,u=N.from(c?t.create():null),f=new I(N.from(t.create(null,N.from(a.type.create(null,u)))),c?3:1,0),h=s.start,p=s.end;n(e.tr.step(new Be(h-(c?3:1),p,h,p,f,1,!0)).scrollIntoView())}return!0}}function no(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,s=n.storedMarks,n}}}class ro{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...u)=>{const f=l(...u)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a=[],l=!!e,c=e||s.tr,u=()=>(!l&&n&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(c),a.every(h=>h===!0)),f={...Object.fromEntries(Object.entries(r).map(([h,p])=>[h,(...y)=>{const g=this.buildProps(c,n),k=p(...y)(g);return a.push(k),f}])),run:u};return f}createCan(e){const{rawCommands:n,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(n).map(([l,c])=>[l,(...u)=>c(...u)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a={tr:e,editor:i,view:o,state:no({state:s,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([l,c])=>[l,(...u)=>c(...u)(a)]))}};return a}}class iw{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,n)),this}off(e,n){const r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(i=>i!==n):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}}function z(t,e,n){return t.config[e]===void 0&&t.parent?z(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?z(t.parent,e,n):null}):t.config[e]}function io(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function Lf(t){const e=[],{nodeExtensions:n,markExtensions:r}=io(t),i=[...n,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=z(o,"addGlobalAttributes",a);if(!l)return;l().forEach(u=>{u.types.forEach(f=>{Object.entries(u.attributes).forEach(([h,p])=>{e.push({type:f,name:h,attribute:{...s,...p}})})})})}),i.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=z(o,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([u,f])=>{const h={...s,...f};typeof(h==null?void 0:h.default)=="function"&&(h.default=h.default()),h!=null&&h.isRequired&&(h==null?void 0:h.default)===void 0&&delete h.default,e.push({type:o.name,name:u,attribute:h})})}),e}function Pe(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function Ne(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const a=s?s.split(" "):[],l=r[i]?r[i].split(" "):[],c=a.filter(u=>!l.includes(u));r[i]=[...l,...c].join(" ")}else i==="style"?r[i]=[r[i],s].join("; "):r[i]=s}),r},{})}function rl(t,e){return e.filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Ne(n,r),{})}function Ff(t){return typeof t=="function"}function ee(t,e=void 0,...n){return Ff(t)?e?t.bind(e)(...n):t(...n):t}function sw(t={}){return Object.keys(t).length===0&&t.constructor===Object}function ow(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function zf(t,e){return t.style?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(n):ow(n.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...r,...i}}}}function jf(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&sw(n)?!1:n!=null))}function aw(t,e){var n;const r=Lf(t),{nodeExtensions:i,markExtensions:s}=io(t),o=(n=i.find(c=>z(c,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(i.map(c=>{const u=r.filter(k=>k.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((k,x)=>{const O=z(x,"extendNodeSchema",f);return{...k,...O?O(c):{}}},{}),p=jf({...h,content:ee(z(c,"content",f)),marks:ee(z(c,"marks",f)),group:ee(z(c,"group",f)),inline:ee(z(c,"inline",f)),atom:ee(z(c,"atom",f)),selectable:ee(z(c,"selectable",f)),draggable:ee(z(c,"draggable",f)),code:ee(z(c,"code",f)),defining:ee(z(c,"defining",f)),isolating:ee(z(c,"isolating",f)),attrs:Object.fromEntries(u.map(k=>{var x;return[k.name,{default:(x=k==null?void 0:k.attribute)===null||x===void 0?void 0:x.default}]}))}),m=ee(z(c,"parseHTML",f));m&&(p.parseDOM=m.map(k=>zf(k,u)));const y=z(c,"renderHTML",f);y&&(p.toDOM=k=>y({node:k,HTMLAttributes:rl(k,u)}));const g=z(c,"renderText",f);return g&&(p.toText=g),[c.name,p]})),l=Object.fromEntries(s.map(c=>{const u=r.filter(g=>g.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((g,k)=>{const x=z(k,"extendMarkSchema",f);return{...g,...x?x(c):{}}},{}),p=jf({...h,inclusive:ee(z(c,"inclusive",f)),excludes:ee(z(c,"excludes",f)),group:ee(z(c,"group",f)),spanning:ee(z(c,"spanning",f)),code:ee(z(c,"code",f)),attrs:Object.fromEntries(u.map(g=>{var k;return[g.name,{default:(k=g==null?void 0:g.attribute)===null||k===void 0?void 0:k.default}]}))}),m=ee(z(c,"parseHTML",f));m&&(p.parseDOM=m.map(g=>zf(g,u)));const y=z(c,"renderHTML",f);return y&&(p.toDOM=g=>y({mark:g,HTMLAttributes:rl(g,u)})),[c.name,p]}));return new dv({topNode:o,nodes:a,marks:l})}function il(t,e){return e.nodes[t]||e.marks[t]||null}function Wf(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}const lw=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,a)=>{var l,c;const u=((c=(l=i.type.spec).toText)===null||c===void 0?void 0:c.call(l,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";n+=u.slice(0,Math.max(0,r-s))}),n};function sl(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class so{constructor(e){this.find=e.find,this.handler=e.handler}}const cw=(t,e)=>{if(sl(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function oo(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(h=>h.type.spec.code))return!1;let u=!1;const f=lw(c)+s;return o.forEach(h=>{if(u)return;const p=cw(f,h.find);if(!p)return;const m=l.state.tr,y=no({state:l.state,transaction:m}),g={from:r-(p[0].length-s.length),to:i},{commands:k,chain:x,can:O}=new ro({editor:n,state:y});h.handler({state:y,range:g,match:p,commands:k,chain:x,can:O})===null||!m.steps.length||(m.setMeta(a,{transform:m,from:r,to:i,text:s}),l.dispatch(m),u=!0)}),u}function dw(t){const{editor:e,rules:n}=t,r=new Ke({state:{init(){return null},apply(i,s){const o=i.getMeta(r);if(o)return o;const a=i.getMeta("applyInputRules");return!!a&&setTimeout(()=>{const{from:c,text:u}=a,f=c+u.length;oo({editor:e,from:c,to:f,text:u,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return oo({editor:e,from:s,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&oo({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?oo({editor:e,from:o.pos,to:o.pos,text:`
15
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function uw(t){return typeof t=="number"}class fw{constructor(e){this.find=e.find,this.handler=e.handler}}const hw=(t,e,n)=>{if(sl(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=t,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function pw(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:a}=t,{commands:l,chain:c,can:u}=new ro({editor:e,state:n}),f=[];return n.doc.nodesBetween(r,i,(p,m)=>{if(!p.isTextblock||p.type.spec.code)return;const y=Math.max(r,m),g=Math.min(i,m+p.content.size),k=p.textBetween(y-m,g-m,void 0,"");hw(k,s.find,o).forEach(O=>{if(O.index===void 0)return;const b=y+O.index+1,C=b+O[0].length,v={from:n.tr.mapping.map(b),to:n.tr.mapping.map(C)},T=s.handler({state:n,range:v,match:O,commands:l,chain:c,can:u,pasteEvent:o,dropEvent:a});f.push(T)})}),f.every(p=>p!==null)}const mw=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function gw(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a=typeof DragEvent<"u"?new DragEvent("drop"):null;const l=({state:u,from:f,to:h,rule:p,pasteEvt:m})=>{const y=u.tr,g=no({state:u,transaction:y});if(!(!pw({editor:e,state:g,from:Math.max(f-1,0),to:h.b-1,rule:p,pasteEvent:m,dropEvent:a})||!y.steps.length))return a=typeof DragEvent<"u"?new DragEvent("drop"):null,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,y};return n.map(u=>new Ke({view(f){const h=p=>{var m;r=!((m=f.dom.parentElement)===null||m===void 0)&&m.contains(p.target)?f.dom.parentElement:null};return window.addEventListener("dragstart",h),{destroy(){window.removeEventListener("dragstart",h)}}},props:{handleDOMEvents:{drop:(f,h)=>(s=r===f.dom.parentElement,a=h,!1),paste:(f,h)=>{var p;const m=(p=h.clipboardData)===null||p===void 0?void 0:p.getData("text/html");return o=h,i=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(f,h,p)=>{const m=f[0],y=m.getMeta("uiEvent")==="paste"&&!i,g=m.getMeta("uiEvent")==="drop"&&!s,k=m.getMeta("applyPasteRules"),x=!!k;if(!y&&!g&&!x)return;if(x){const{from:C,text:v}=k,T=C+v.length,B=mw(v);return l({rule:u,state:p,from:C,to:{b:T},pasteEvt:B})}const O=h.doc.content.findDiffStart(p.doc.content),b=h.doc.content.findDiffEnd(p.doc.content);if(!(!uw(O)||!b||O===b.b))return l({rule:u,state:p,from:O,to:b,pasteEvt:o})}}))}function yw(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return[...new Set(e)]}class Kr{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=Kr.resolve(e),this.schema=aw(this.extensions,n),this.setupExtensions()}static resolve(e){const n=Kr.sort(Kr.flatten(e)),r=yw(n.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{const r={name:n.name,options:n.options,storage:n.storage},i=z(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{const s=z(r,"priority")||100,o=z(i,"priority")||100;return s>o?-1:s<o?1:0})}get commands(){return this.extensions.reduce((e,n)=>{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:il(n.name,this.schema)},i=z(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=Kr.sort([...this.extensions].reverse()),r=[],i=[],s=n.map(o=>{const a={name:o.name,options:o.options,storage:o.storage,editor:e,type:il(o.name,this.schema)},l=[],c=z(o,"addKeyboardShortcuts",a);let u={};if(o.type==="mark"&&o.config.exitable&&(u.ArrowRight=()=>Zt.handleExit({editor:e,mark:o})),c){const y=Object.fromEntries(Object.entries(c()).map(([g,k])=>[g,()=>k({editor:e})]));u={...u,...y}}const f=Ak(u);l.push(f);const h=z(o,"addInputRules",a);Wf(o,e.options.enableInputRules)&&h&&r.push(...h());const p=z(o,"addPasteRules",a);Wf(o,e.options.enablePasteRules)&&p&&i.push(...p());const m=z(o,"addProseMirrorPlugins",a);if(m){const y=m();l.push(...y)}return l}).flat();return[dw({editor:e,rules:r}),...gw({editor:e,rules:i}),...s]}get attributes(){return Lf(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=io(this.extensions);return Object.fromEntries(n.filter(r=>!!z(r,"addNodeView")).map(r=>{const i=this.attributes.filter(l=>l.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:Pe(r.name,this.schema)},o=z(r,"addNodeView",s);if(!o)return[];const a=(l,c,u,f)=>{const h=rl(l,i);return o()({editor:e,node:l,getPos:u,decorations:f,HTMLAttributes:h,extension:r})};return[r.name,a]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:il(e.name,this.schema)};e.type==="mark"&&(!((n=ee(z(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=z(e,"onBeforeCreate",r),s=z(e,"onCreate",r),o=z(e,"onUpdate",r),a=z(e,"onSelectionUpdate",r),l=z(e,"onTransaction",r),c=z(e,"onFocus",r),u=z(e,"onBlur",r),f=z(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),f&&this.editor.on("destroy",f)})}}function bw(t){return Object.prototype.toString.call(t).slice(8,-1)}function ol(t){return bw(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function ao(t,e){const n={...t};return ol(t)&&ol(e)&&Object.keys(e).forEach(r=>{ol(e[r])?r in t?n[r]=ao(t[r],e[r]):Object.assign(n,{[r]:e[r]}):Object.assign(n,{[r]:e[r]})}),n}class Ye{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ee(z(this,"addOptions",{name:this.name}))),this.storage=ee(z(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ye(e)}configure(e={}){const n=this.extend();return n.parent=this.parent,n.options=ao(this.options,e),n.storage=ee(z(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){const n=new Ye({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=ee(z(n,"addOptions",{name:n.name})),n.storage=ee(z(n,"addStorage",{name:n.name,options:n.options})),n}}function Hf(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
16
+
17
+ `,textSerializers:o={}}=n||{};let a="";return t.nodesBetween(r,i,(l,c,u,f)=>{var h;l.isBlock&&c>r&&(a+=s);const p=o==null?void 0:o[l.type.name];if(p)return u&&(a+=p({node:l,pos:c,parent:u,index:f,range:e})),!1;l.isText&&(a+=(h=l==null?void 0:l.text)===null||h===void 0?void 0:h.slice(Math.max(r,c)-c,i-c))}),a}function Yf(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const vw=Ye.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ke({key:new Pt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(u=>u.$from.pos)),a=Math.max(...s.map(u=>u.$to.pos)),l=Yf(n);return Hf(r,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),kw=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),ww=(t=!1)=>({commands:e})=>e.setContent("",t),xw=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:o})=>{t.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,f=c.resolve(u.map(l)),h=c.resolve(u.map(l+a.nodeSize)),p=f.blockRange(h);if(!p)return;const m=Ir(p);if(a.type.isTextblock){const{defaultType:y}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(p.start,y)}(m||m===0)&&e.lift(p,m)})}),!0},Sw=t=>e=>t(e),Mw=()=>({state:t,dispatch:e})=>Yk(t,e),Ow=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new J(r.doc.resolve(o-1))),!0},Cw=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const a=i.before(s),l=i.after(s);t.delete(a,l).scrollIntoView()}return!0}return!1},Tw=t=>({tr:e,state:n,dispatch:r})=>{const i=Pe(t,n.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const l=s.before(o),c=s.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1},Ew=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},_w=()=>({state:t,dispatch:e})=>Vk(t,e),Nw=()=>({commands:t})=>t.keyboardShortcut("Enter"),Dw=()=>({state:t,dispatch:e})=>Hk(t,e);function lo(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:sl(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function al(t,e,n={}){return t.find(r=>r.type===e&&lo(r.attrs,n))}function Aw(t,e,n={}){return!!al(t,e,n)}function ll(t,e,n={}){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if(t.parentOffset===r.offset&&r.offset!==0&&(r=t.parent.childBefore(t.parentOffset)),!r.node)return;const i=al([...r.node.marks],e,n);if(!i)return;let s=r.index,o=t.start()+r.offset,a=s+1,l=o+r.node.nodeSize;for(al([...r.node.marks],e,n);s>0&&i.isInSet(t.parent.child(s-1).marks);)s-=1,o-=t.parent.child(s).nodeSize;for(;a<t.parent.childCount&&Aw([...t.parent.child(a).marks],e,n);)l+=t.parent.child(a).nodeSize,a+=1;return{from:o,to:l}}function Yn(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const Vw=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const s=Yn(t,r.schema),{doc:o,selection:a}=n,{$from:l,from:c,to:u}=a;if(i){const f=ll(l,s,e);if(f&&f.from<=c&&f.to>=u){const h=J.create(o,f.from,f.to);n.setSelection(h)}}return!0},Bw=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function cl(t){return t instanceof J}function mn(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Uf(t,e=null){if(!e)return null;const n=Q.atStart(t),r=Q.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?J.create(t,mn(0,i,s),mn(t.content.size,i,s)):J.create(t,mn(e,i,s),mn(e,i,s))}function dl(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const Pw=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{dl()&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!cl(n.state.selection))return o(),!0;const a=Uf(i.doc,t)||n.state.selection,l=n.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},Iw=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),Rw=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),qf=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&qf(r)}return t};function Kf(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return qf(n)}function co(t,e,n){n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{return Array.isArray(t)&&t.length>0?N.fromArray(t.map(o=>e.nodeFromJSON(o))):e.nodeFromJSON(t)}catch(s){return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),co("",e,n)}if(i){const s=Vr.fromSchema(e);return n.slice?s.parseSlice(Kf(t),n.parseOptions).content:s.parse(Kf(t),n.parseOptions)}return co("",e,n)}function $w(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof Ve||i instanceof Be))return;const s=t.mapping.maps[r];let o=0;s.forEach((a,l,c,u)=>{o===0&&(o=u)}),t.setSelection(Q.near(t.doc.resolve(o),n))}const Lw=t=>t.toString().startsWith("<"),Fw=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{if(i){n={parseOptions:{},updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};const o=co(e,s.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions}});if(o.toString()==="<>")return!0;let{from:a,to:l}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},c=!0,u=!0;if((Lw(o)?o:[o]).forEach(p=>{p.check(),c=c?p.isText&&p.marks.length===0:!1,u=u?p.isBlock:!1}),a===l&&u){const{parent:p}=r.doc.resolve(a);p.isTextblock&&!p.type.spec.code&&!p.childCount&&(a-=1,l+=1)}let h;c?(Array.isArray(e)?h=e.map(p=>p.text||"").join(""):typeof e=="object"&&e&&e.text?h=e.text:h=e,r.insertText(h,a,l)):(h=o,r.replaceWith(a,l,h)),n.updateSelection&&$w(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:a,text:h}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:a,text:h})}return!0},zw=()=>({state:t,dispatch:e})=>Fk(t,e),jw=()=>({state:t,dispatch:e})=>zk(t,e),Ww=()=>({state:t,dispatch:e})=>Bk(t,e),Hw=()=>({state:t,dispatch:e})=>$k(t,e),Yw=()=>({tr:t,state:e,dispatch:n})=>{try{const r=Hs(e.doc,e.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),n&&n(t),!0)}catch{return!1}},Uw=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Hs(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},qw=()=>({state:t,dispatch:e})=>Pk(t,e),Kw=()=>({state:t,dispatch:e})=>Ik(t,e);function Jf(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Jw(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))dl()||Jf()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const Gw=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=Jw(t).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,a))});return l==null||l.steps.forEach(c=>{const u=c.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function Yi(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?Pe(e,t.schema):null,a=[];t.doc.nodesBetween(r,i,(f,h)=>{if(f.isText)return;const p=Math.max(r,h),m=Math.min(i,h+f.nodeSize);a.push({node:f,from:p,to:m})});const l=i-r,c=a.filter(f=>o?o.name===f.node.type.name:!0).filter(f=>lo(f.node.attrs,n,{strict:!1}));return s?!!c.length:c.reduce((f,h)=>f+h.to-h.from,0)>=l}const Zw=(t,e={})=>({state:n,dispatch:r})=>{const i=Pe(t,n.schema);return Yi(n,i,e)?jk(n,r):!1},Xw=()=>({state:t,dispatch:e})=>Uk(t,e),Qw=t=>({state:e,dispatch:n})=>{const r=Pe(t,e.schema);return ew(r)(e,n)},ex=()=>({state:t,dispatch:e})=>Wk(t,e);function uo(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Gf(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}const tx=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=uo(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(s=Pe(t,r.schema)),a==="mark"&&(o=Yn(t,r.schema)),i&&n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,u)=>{s&&s===c.type&&n.setNodeMarkup(u,void 0,Gf(c.attrs,e)),o&&c.marks.length&&c.marks.forEach(f=>{o===f.type&&n.addMark(u,u+c.nodeSize,o.create(Gf(f.attrs,e)))})})}),!0):!1},nx=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),rx=()=>({tr:t,commands:e})=>e.setTextSelection({from:0,to:t.doc.content.size}),ix=()=>({state:t,dispatch:e})=>Rk(t,e),sx=()=>({state:t,dispatch:e})=>Lk(t,e),ox=()=>({state:t,dispatch:e})=>qk(t,e),ax=()=>({state:t,dispatch:e})=>Gk(t,e),lx=()=>({state:t,dispatch:e})=>Jk(t,e);function Zf(t,e,n={}){return co(t,e,{slice:!1,parseOptions:n})}const cx=(t,e=!1,n={})=>({tr:r,editor:i,dispatch:s})=>{const{doc:o}=r,a=Zf(t,i.schema,n);return s&&r.replaceWith(0,o.content.size,a).setMeta("preventUpdate",!e),!0};function fo(t,e){const n=Yn(e,t.schema),{from:r,to:i,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function dx(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function ux(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function ul(t){return e=>ux(e.$from,t)}function fx(t,e){const n=Ut.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function hx(t,e){const n={from:0,to:t.content.size};return Hf(t,n,e)}function px(t,e){const n=Pe(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===n.name);return o?{...o.attrs}:{}}function mx(t,e){const n=uo(typeof e=="string"?e:e.name,t.schema);return n==="node"?px(t,e):n==="mark"?fo(t,e):{}}function Xf(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t-1),o=ll(s,i.type);o&&r.push({mark:i,...o})}):n.nodesBetween(t,e,(i,s)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}function ho(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}function fl(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?Yn(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>s?s.name===f.type.name:!0).find(f=>lo(f.attrs,n,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:f,$to:h})=>{const p=f.pos,m=h.pos;t.doc.nodesBetween(p,m,(y,g)=>{if(!y.isText&&!y.marks.length)return;const k=Math.max(p,g),x=Math.min(m,g+y.nodeSize),O=x-k;o+=O,a.push(...y.marks.map(b=>({mark:b,from:k,to:x})))})}),o===0)return!1;const l=a.filter(f=>s?s.name===f.mark.type.name:!0).filter(f=>lo(f.mark.attrs,n,{strict:!1})).reduce((f,h)=>f+h.to-h.from,0),c=a.filter(f=>s?f.mark.type!==s&&f.mark.type.excludes(s):!0).reduce((f,h)=>f+h.to-h.from,0);return(l>0?l+c:l)>=o}function gx(t,e,n={}){if(!e)return Yi(t,null,n)||fl(t,null,n);const r=uo(e,t.schema);return r==="node"?Yi(t,e,n):r==="mark"?fl(t,e,n):!1}function Qf(t,e){const{nodeExtensions:n}=io(e),r=n.find(o=>o.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=ee(z(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function yx(t){var e;const n=(e=t.type.createAndFill())===null||e===void 0?void 0:e.toJSON(),r=t.toJSON();return JSON.stringify(n)===JSON.stringify(r)}function bx(t){return t instanceof H}function eh(t,e,n){const i=t.state.doc.content.size,s=mn(e,0,i),o=mn(n,0,i),a=t.coordsAtPos(s),l=t.coordsAtPos(o,-1),c=Math.min(a.top,l.top),u=Math.max(a.bottom,l.bottom),f=Math.min(a.left,l.left),h=Math.max(a.right,l.right),p=h-f,m=u-c,k={top:c,bottom:u,left:f,right:h,width:p,height:m,x:f,y:c};return{...k,toJSON:()=>k}}function vx(t,e,n){var r;const{selection:i}=e;let s=null;if(cl(i)&&(s=i.$cursor),s){const a=(r=t.storedMarks)!==null&&r!==void 0?r:s.marks();return!!n.isInSet(a)||!a.some(l=>l.type.excludes(n))}const{ranges:o}=i;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(u,f,h)=>{if(c)return!1;if(u.isInline){const p=!h||h.type.allowsMarkType(n),m=!!n.isInSet(u.marks)||!u.marks.some(y=>y.type.excludes(n));c=p&&m}return!c}),c})}const kx=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:a}=s,l=Yn(t,r.schema);if(i)if(o){const c=fo(r,l);n.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,f=c.$to.pos;r.doc.nodesBetween(u,f,(h,p)=>{const m=Math.max(p,u),y=Math.min(p+h.nodeSize,f);h.marks.find(k=>k.type===l)?h.marks.forEach(k=>{l===k.type&&n.addMark(m,y,l.create({...k.attrs,...e}))}):n.addMark(m,y,l.create(e))})});return vx(r,n,l)},wx=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),xx=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=Pe(t,n.schema);return s.isTextblock?i().command(({commands:o})=>$f(s,e)(n)?!0:o.clearNodes()).command(({state:o})=>$f(s,e)(o,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Sx=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=mn(t,0,r.content.size),s=H.create(r,i);e.setSelection(s)}return!0},Mx=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,o=J.atStart(r).from,a=J.atEnd(r).to,l=mn(i,o,a),c=mn(s,o,a),u=J.create(r,l,c);e.setSelection(u)}return!0},Ox=t=>({state:e,dispatch:n})=>{const r=Pe(t,e.schema);return rw(r)(e,n)};function th(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e==null?void 0:e.includes(i.type.name));t.tr.ensureMarks(r)}}const Cx=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,c=i.extensionManager.attributes,u=ho(c,a.node().type.name,a.node().attrs);if(s instanceof H&&s.node.isBlock)return!a.parentOffset||!Rr(o,a.pos)?!1:(r&&(t&&th(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;if(r){const f=l.parentOffset===l.parent.content.size;s instanceof J&&e.deleteSelection();const h=a.depth===0?void 0:dx(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=f&&h?[{type:h,attrs:u}]:void 0,m=Rr(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!m&&Rr(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(m=!0,p=h?[{type:h,attrs:u}]:void 0),m&&(e.split(e.mapping.map(a.pos),1,p),h&&!f&&!a.parentOffset&&a.parent.type!==h)){const y=e.mapping.map(a.before()),g=e.doc.resolve(y);a.node(-1).canReplaceWith(g.index(),g.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}t&&th(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return!0},Tx=t=>({tr:e,state:n,dispatch:r,editor:i})=>{var s;const o=Pe(t,n.schema),{$from:a,$to:l}=n.selection,c=n.selection.node;if(c&&c.isBlock||a.depth<2||!a.sameParent(l))return!1;const u=a.node(-1);if(u.type!==o)return!1;const f=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==o||a.index(-2)!==a.node(-2).childCount-1)return!1;if(r){let g=N.empty;const k=a.index(-1)?1:a.index(-2)?2:3;for(let T=a.depth-k;T>=a.depth-3;T-=1)g=N.from(a.node(T).copy(g));const x=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,O=ho(f,a.node().type.name,a.node().attrs),b=((s=o.contentMatch.defaultType)===null||s===void 0?void 0:s.createAndFill(O))||void 0;g=g.append(N.from(o.createAndFill(null,b)||void 0));const C=a.before(a.depth-(k-1));e.replace(C,a.after(-x),new I(g,4-k,0));let v=-1;e.doc.nodesBetween(C,e.doc.content.size,(T,B)=>{if(v>-1)return!1;T.isTextblock&&T.content.size===0&&(v=B+1)}),v>-1&&e.setSelection(J.near(e.doc.resolve(v))),e.scrollIntoView()}return!0}const h=l.pos===a.end()?u.contentMatchAt(0).defaultType:null,p=ho(f,u.type.name,u.attrs),m=ho(f,a.node().type.name,a.node().attrs);e.delete(a.pos,l.pos);const y=h?[{type:o,attrs:p},{type:h,attrs:m}]:[{type:o,attrs:p}];if(!Rr(e.doc,a.pos,2))return!1;if(r){const{selection:g,storedMarks:k}=n,{splittableMarks:x}=i.extensionManager,O=k||g.$to.parentOffset&&g.$from.marks();if(e.split(a.pos,2,y).scrollIntoView(),!O||!r)return!0;const b=O.filter(C=>x.includes(C.type.name));e.ensureMarks(b)}return!0},hl=(t,e)=>{const n=ul(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Pn(t.doc,n.pos)&&t.join(n.pos),!0},pl=(t,e)=>{const n=ul(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Pn(t.doc,r)&&t.join(r),!0};var Ex=Object.freeze({__proto__:null,blur:kw,clearContent:ww,clearNodes:xw,command:Sw,createParagraphNear:Mw,cut:Ow,deleteCurrentNode:Cw,deleteNode:Tw,deleteRange:Ew,deleteSelection:_w,enter:Nw,exitCode:Dw,extendMarkRange:Vw,first:Bw,focus:Pw,forEach:Iw,insertContent:Rw,insertContentAt:Fw,joinUp:zw,joinDown:jw,joinBackward:Ww,joinForward:Hw,joinItemBackward:Yw,joinItemForward:Uw,joinTextblockBackward:qw,joinTextblockForward:Kw,keyboardShortcut:Gw,lift:Zw,liftEmptyBlock:Xw,liftListItem:Qw,newlineInCode:ex,resetAttributes:tx,scrollIntoView:nx,selectAll:rx,selectNodeBackward:ix,selectNodeForward:sx,selectParentNode:ox,selectTextblockEnd:ax,selectTextblockStart:lx,setContent:cx,setMark:kx,setMeta:wx,setNode:xx,setNodeSelection:Sx,setTextSelection:Mx,sinkListItem:Ox,splitBlock:Cx,splitListItem:Tx,toggleList:(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:f,splittableMarks:h}=i.extensionManager,p=Pe(t,o.schema),m=Pe(e,o.schema),{selection:y,storedMarks:g}=o,{$from:k,$to:x}=y,O=k.blockRange(x),b=g||y.$to.parentOffset&&y.$from.marks();if(!O)return!1;const C=ul(v=>Qf(v.type.name,f))(y);if(O.depth>=1&&C&&O.depth-C.depth<=1){if(C.node.type===p)return c.liftListItem(m);if(Qf(C.node.type.name,f)&&p.validContent(C.node.content)&&a)return l().command(()=>(s.setNodeMarkup(C.pos,p),!0)).command(()=>hl(s,p)).command(()=>pl(s,p)).run()}return!n||!b||!a?l().command(()=>u().wrapInList(p,r)?!0:c.clearNodes()).wrapInList(p,r).command(()=>hl(s,p)).command(()=>pl(s,p)).run():l().command(()=>{const v=u().wrapInList(p,r),T=b.filter(B=>h.includes(B.type.name));return s.ensureMarks(T),v?!0:c.clearNodes()}).wrapInList(p,r).command(()=>hl(s,p)).command(()=>pl(s,p)).run()},toggleMark:(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=Yn(t,r.schema);return fl(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},toggleNode:(t,e,n={})=>({state:r,commands:i})=>{const s=Pe(t,r.schema),o=Pe(e,r.schema);return Yi(r,s,n)?i.setNode(o):i.setNode(s,n)},toggleWrap:(t,e={})=>({state:n,commands:r})=>{const i=Pe(t,n.schema);return Yi(n,i,e)?r.lift(i):r.wrapIn(i,e)},undoInputRule:()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const o=t.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},unsetAllMarks:()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},unsetMark:(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=n,l=Yn(t,r.schema),{$from:c,empty:u,ranges:f}=a;if(!i)return!0;if(u&&o){let{from:h,to:p}=a;const m=(s=c.marks().find(g=>g.type===l))===null||s===void 0?void 0:s.attrs,y=ll(c,l,m);y&&(h=y.from,p=y.to),n.removeMark(h,p,l)}else f.forEach(h=>{n.removeMark(h.$from.pos,h.$to.pos,l)});return n.removeStoredMark(l),!0},updateAttributes:(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=uo(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(s=Pe(t,r.schema)),a==="mark"&&(o=Yn(t,r.schema)),i&&n.selection.ranges.forEach(l=>{const c=l.$from.pos,u=l.$to.pos;r.doc.nodesBetween(c,u,(f,h)=>{s&&s===f.type&&n.setNodeMarkup(h,void 0,{...f.attrs,...e}),o&&f.marks.length&&f.marks.forEach(p=>{if(o===p.type){const m=Math.max(h,c),y=Math.min(h+f.nodeSize,u);n.addMark(m,y,o.create({...p.attrs,...e}))}})})}),!0):!1},wrapIn:(t,e={})=>({state:n,dispatch:r})=>{const i=Pe(t,n.schema);return Zk(i,e)(n,r)},wrapInList:(t,e={})=>({state:n,dispatch:r})=>{const i=Pe(t,n.schema);return Xk(i,e)(n,r)}});const _x=Ye.create({name:"commands",addCommands(){return{...Ex}}}),Nx=Ye.create({name:"editable",addProseMirrorPlugins(){return[new Ke({key:new Pt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Dx=Ye.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ke({key:new Pt("focusEvents"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Ax=Ye.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:f}=l,{pos:h,parent:p}=f,m=f.parent.isTextblock&&h>0?a.doc.resolve(h-1):f,y=m.parent.type.spec.isolating,g=f.pos-f.parentOffset,k=y&&m.parent.childCount===1?g===f.pos:Q.atStart(c).from===h;return!u||!p.type.isTextblock||p.textContent.length||!k||k&&f.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return dl()||Jf()?s:i},addProseMirrorPlugins(){return[new Ke({key:new Pt("clearDocument"),appendTransaction:(t,e,n)=>{if(!(t.some(m=>m.docChanged)&&!e.doc.eq(n.doc)))return;const{empty:i,from:s,to:o}=e.selection,a=Q.atStart(e.doc).from,l=Q.atEnd(e.doc).to;if(i||!(s===a&&o===l)||!(n.doc.textBetween(0,n.doc.content.size," "," ").length===0))return;const f=n.tr,h=no({state:n,transaction:f}),{commands:p}=new ro({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),Vx=Ye.create({name:"tabindex",addProseMirrorPlugins(){return[new Ke({key:new Pt("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}});class pr{constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new pr(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new pr(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new pr(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=this.pos+r+1,o=this.resolvedPos.doc.resolve(s);if(!i&&o.depth<=this.depth)return;const a=new pr(o,this.editor,i,i?n:null);i&&(a.actualDepth=this.depth+1),e.push(new pr(o,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,o=Object.keys(n);for(let a=0;a<o.length;a+=1){const l=o[a];if(s[l]!==n[l])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(l=>n[l]===o.node.attrs[l])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,n,r))))}),i}setAttribute(e){const n=this.editor.state.selection;this.editor.chain().setTextSelection(this.from).updateAttributes(this.node.type.name,e).setTextSelection(n.from).run()}}const Bx=`.ProseMirror {
18
18
  position: relative;
19
19
  }
20
20
 
@@ -88,33 +88,42 @@ img.ProseMirror-separator {
88
88
 
89
89
  .tippy-box[data-animation=fade][data-state=hidden] {
90
90
  opacity: 0
91
- }`;function k1(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}let w1=class extends Hb{constructor(e={}){super(),this.isFocused=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}))},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=k1(v1,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,n){const r=Md(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});this.view.updateState(i)}unregisterPlugin(e){if(this.isDestroyed)return;const n=typeof e=="string"?`${e}$`:e.key,r=this.state.reconfigure({plugins:this.state.plugins.filter(i=>!i.key.startsWith(n))});this.view.updateState(r)}createExtensionManager(){var e,n;const i=[...this.options.enableCoreExtensions?[m1,iv.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),p1,g1,y1,b1]:[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o==null?void 0:o.type));this.extensionManager=new rr(i,this)}createCommandManager(){this.commandManager=new Wi({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){const e=Rd(this.options.content,this.schema,this.options.parseOptions),n=Bd(e,this.options.autofocus);this.view=new ab(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:Yn.create({doc:e,selection:n||void 0})});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews(),this.prependClass();const i=this.view.dom;i.editor=this}createNodeViews(){this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(s=>{var l;return(l=this.capturedTransaction)===null||l===void 0?void 0:l.step(s)});return}const n=this.state.apply(e),r=!this.state.selection.eq(n.selection);this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),o=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),o&&this.emit("blur",{editor:this,event:o.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return e1(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return t1(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Zv(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
91
+ }`;function Px(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}let Ix=class extends iw{constructor(e={}){super(),this.isFocused=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}))},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=Px(Bx,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,n){const r=Ff(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});this.view.updateState(i)}unregisterPlugin(e){if(this.isDestroyed)return;const n=typeof e=="string"?`${e}$`:e.key,r=this.state.reconfigure({plugins:this.state.plugins.filter(i=>!i.key.startsWith(n))});this.view.updateState(r)}createExtensionManager(){var e,n;const i=[...this.options.enableCoreExtensions?[Nx,vw.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),_x,Dx,Ax,Vx]:[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s==null?void 0:s.type));this.extensionManager=new Kr(i,this)}createCommandManager(){this.commandManager=new ro({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){const e=Zf(this.options.content,this.schema,this.options.parseOptions),n=Uf(e,this.options.autofocus);this.view=new Sk(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:zr.create({doc:e,selection:n||void 0})});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews(),this.prependClass();const i=this.view.dom;i.editor=this}createNodeViews(){this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(o=>{var a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.step(o)});return}const n=this.state.apply(e),r=!this.state.selection.eq(n.selection);this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),s=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),s&&this.emit("blur",{editor:this,event:s.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return mx(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return gx(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return fx(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
92
92
 
93
- `,textSerializers:r={}}=e||{};return Xv(this.state.doc,{blockSeparator:n,textSerializers:{...Dd(this.schema),...r}})}get isEmpty(){return n1(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,n))||null}$nodes(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new En(n,this)}get $doc(){return this.$pos(0)}};function ir(t){return new qi({find:t.find,handler:({state:e,range:n,match:r})=>{const i=G(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:o}=e,s=r[r.length-1],l=r[0];if(s){const a=l.search(/\S/),c=n.from+l.indexOf(s),d=c+s.length;if(_d(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(y=>y===t.type&&y!==p.mark.type)).filter(p=>p.to>c).length)return null;d<n.to&&o.delete(d,n.to),c>n.from&&o.delete(n.from+a,c);const h=n.from+a+s.length;o.addMark(n.from+a,h,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}function x1(t){return new qi({find:t.find,handler:({state:e,range:n,match:r})=>{const i=G(t.getAttributes,void 0,r)||{},{tr:o}=e,s=n.from;let l=n.to;const a=t.type.create(i);if(r[1]){const c=r[0].lastIndexOf(r[1]);let d=s+c;d>l?d=l:l=d+r[1].length;const f=r[0][r[0].length-1];o.insertText(f,s+r[0].length-1),o.replaceWith(d,l,a)}else r[0]&&o.insert(s-1,t.type.create(i)).delete(o.mapping.map(s),o.mapping.map(l));o.scrollIntoView()}})}function Rs(t){return new qi({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),o=G(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,o)}})}function Ur(t){return new qi({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const o=G(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),c=a&&Wo(a,t.type,o);if(!c)return null;if(s.wrap(a,c),t.keepMarks&&t.editor){const{selection:f,storedMarks:h}=e,{splittableMarks:p}=t.editor.extensionManager,m=h||f.$to.parentOffset&&f.$from.marks();if(m){const y=m.filter(g=>p.includes(g.type.name));s.ensureMarks(y)}}if(t.keepAttributes){const f=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(f,o).run()}const d=s.doc.resolve(n.from-1).nodeBefore;d&&d.type===t.type&&Yt(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,d))&&s.join(n.from-1)}})}class Mt{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=G(R(this,"addOptions",{name:this.name}))),this.storage=G(R(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Mt(e)}configure(e={}){const n=this.extend();return n.options=Ji(this.options,e),n.storage=G(R(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){const n=new Mt({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=G(R(n,"addOptions",{name:n.name})),n.storage=G(R(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const s=i.marks();if(!!!s.find(c=>(c==null?void 0:c.type.name)===n.name))return!1;const a=s.find(c=>(c==null?void 0:c.type.name)===n.name);return a&&r.removeStoredMark(a),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}let Ze=class al{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=G(R(this,"addOptions",{name:this.name}))),this.storage=G(R(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new al(e)}configure(e={}){const n=this.extend();return n.options=Ji(this.options,e),n.storage=G(R(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){const n=new al({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=G(R(n,"addOptions",{name:n.name})),n.storage=G(R(n,"addStorage",{name:n.name,options:n.options})),n}};function or(t){return new Zb({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const o=G(t.getAttributes,void 0,r,i);if(o===!1||o===null)return null;const{tr:s}=e,l=r[r.length-1],a=r[0];let c=n.to;if(l){const d=a.search(/\S/),f=n.from+a.indexOf(l),h=f+l.length;if(_d(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(g=>g===t.type&&g!==m.mark.type)).filter(m=>m.to>f).length)return null;h<n.to&&s.delete(h,n.to),f>n.from&&s.delete(n.from+d,f),c=n.from+d+l.length,s.addMark(n.from+d,c,t.type.create(o||{})),s.removeStoredMark(t.type)}}})}var We="top",ot="bottom",st="right",Ue="left",_s="auto",qr=[We,ot,st,Ue],sr="start",Kr="end",S1="clippingParents",jd="viewport",Jr="popper",C1="reference",Hd=qr.reduce(function(t,e){return t.concat([e+"-"+sr,e+"-"+Kr])},[]),Wd=[].concat(qr,[_s]).reduce(function(t,e){return t.concat([e,e+"-"+sr,e+"-"+Kr])},[]),O1="beforeRead",M1="read",E1="afterRead",T1="beforeMain",N1="main",A1="afterMain",D1="beforeWrite",B1="write",V1="afterWrite",I1=[O1,M1,E1,T1,N1,A1,D1,B1,V1];function Et(t){return t?(t.nodeName||"").toLowerCase():null}function Xe(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Tn(t){var e=Xe(t).Element;return t instanceof e||t instanceof Element}function lt(t){var e=Xe(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Ls(t){if(typeof ShadowRoot>"u")return!1;var e=Xe(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function P1(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},i=e.attributes[n]||{},o=e.elements[n];!lt(o)||!Et(o)||(Object.assign(o.style,r),Object.keys(i).forEach(function(s){var l=i[s];l===!1?o.removeAttribute(s):o.setAttribute(s,l===!0?"":l)}))})}function $1(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var i=e.elements[r],o=e.attributes[r]||{},s=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),l=s.reduce(function(a,c){return a[c]="",a},{});!lt(i)||!Et(i)||(Object.assign(i.style,l),Object.keys(o).forEach(function(a){i.removeAttribute(a)}))})}}const Ud={name:"applyStyles",enabled:!0,phase:"write",fn:P1,effect:$1,requires:["computeStyles"]};function Tt(t){return t.split("-")[0]}var Nn=Math.max,eo=Math.min,lr=Math.round;function zs(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function qd(){return!/^((?!chrome|android).)*safari/i.test(zs())}function ar(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),i=1,o=1;e&&lt(t)&&(i=t.offsetWidth>0&&lr(r.width)/t.offsetWidth||1,o=t.offsetHeight>0&&lr(r.height)/t.offsetHeight||1);var s=Tn(t)?Xe(t):window,l=s.visualViewport,a=!qd()&&n,c=(r.left+(a&&l?l.offsetLeft:0))/i,d=(r.top+(a&&l?l.offsetTop:0))/o,f=r.width/i,h=r.height/o;return{width:f,height:h,top:d,right:c+f,bottom:d+h,left:c,x:c,y:d}}function Fs(t){var e=ar(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function Kd(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&Ls(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function zt(t){return Xe(t).getComputedStyle(t)}function R1(t){return["table","td","th"].indexOf(Et(t))>=0}function an(t){return((Tn(t)?t.ownerDocument:t.document)||window.document).documentElement}function to(t){return Et(t)==="html"?t:t.assignedSlot||t.parentNode||(Ls(t)?t.host:null)||an(t)}function Jd(t){return!lt(t)||zt(t).position==="fixed"?null:t.offsetParent}function _1(t){var e=/firefox/i.test(zs()),n=/Trident/i.test(zs());if(n&&lt(t)){var r=zt(t);if(r.position==="fixed")return null}var i=to(t);for(Ls(i)&&(i=i.host);lt(i)&&["html","body"].indexOf(Et(i))<0;){var o=zt(i);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||e&&o.willChange==="filter"||e&&o.filter&&o.filter!=="none")return i;i=i.parentNode}return null}function Gr(t){for(var e=Xe(t),n=Jd(t);n&&R1(n)&&zt(n).position==="static";)n=Jd(n);return n&&(Et(n)==="html"||Et(n)==="body"&&zt(n).position==="static")?e:n||_1(t)||e}function js(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Yr(t,e,n){return Nn(t,eo(e,n))}function L1(t,e,n){var r=Yr(t,e,n);return r>n?n:r}function Gd(){return{top:0,right:0,bottom:0,left:0}}function Yd(t){return Object.assign({},Gd(),t)}function Zd(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var z1=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,Yd(typeof e!="number"?e:Zd(e,qr))};function F1(t){var e,n=t.state,r=t.name,i=t.options,o=n.elements.arrow,s=n.modifiersData.popperOffsets,l=Tt(n.placement),a=js(l),c=[Ue,st].indexOf(l)>=0,d=c?"height":"width";if(!(!o||!s)){var f=z1(i.padding,n),h=Fs(o),p=a==="y"?We:Ue,m=a==="y"?ot:st,y=n.rects.reference[d]+n.rects.reference[a]-s[a]-n.rects.popper[d],g=s[a]-n.rects.reference[a],v=Gr(o),C=v?a==="y"?v.clientHeight||0:v.clientWidth||0:0,M=y/2-g/2,b=f[p],O=C-h[d]-f[m],S=C/2-h[d]/2+M,D=Yr(b,S,O),V=a;n.modifiersData[r]=(e={},e[V]=D,e.centerOffset=D-S,e)}}function j1(t){var e=t.state,n=t.options,r=n.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||Kd(e.elements.popper,i)&&(e.elements.arrow=i))}const H1={name:"arrow",enabled:!0,phase:"main",fn:F1,effect:j1,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function cr(t){return t.split("-")[1]}var W1={top:"auto",right:"auto",bottom:"auto",left:"auto"};function U1(t,e){var n=t.x,r=t.y,i=e.devicePixelRatio||1;return{x:lr(n*i)/i||0,y:lr(r*i)/i||0}}function Xd(t){var e,n=t.popper,r=t.popperRect,i=t.placement,o=t.variation,s=t.offsets,l=t.position,a=t.gpuAcceleration,c=t.adaptive,d=t.roundOffsets,f=t.isFixed,h=s.x,p=h===void 0?0:h,m=s.y,y=m===void 0?0:m,g=typeof d=="function"?d({x:p,y}):{x:p,y};p=g.x,y=g.y;var v=s.hasOwnProperty("x"),C=s.hasOwnProperty("y"),M=Ue,b=We,O=window;if(c){var S=Gr(n),D="clientHeight",V="clientWidth";if(S===Xe(n)&&(S=an(n),zt(S).position!=="static"&&l==="absolute"&&(D="scrollHeight",V="scrollWidth")),S=S,i===We||(i===Ue||i===st)&&o===Kr){b=ot;var A=f&&S===O&&O.visualViewport?O.visualViewport.height:S[D];y-=A-r.height,y*=a?1:-1}if(i===Ue||(i===We||i===ot)&&o===Kr){M=st;var L=f&&S===O&&O.visualViewport?O.visualViewport.width:S[V];p-=L-r.width,p*=a?1:-1}}var Y=Object.assign({position:l},c&&W1),q=d===!0?U1({x:p,y},Xe(n)):{x:p,y};if(p=q.x,y=q.y,a){var Z;return Object.assign({},Y,(Z={},Z[b]=C?"0":"",Z[M]=v?"0":"",Z.transform=(O.devicePixelRatio||1)<=1?"translate("+p+"px, "+y+"px)":"translate3d("+p+"px, "+y+"px, 0)",Z))}return Object.assign({},Y,(e={},e[b]=C?y+"px":"",e[M]=v?p+"px":"",e.transform="",e))}function q1(t){var e=t.state,n=t.options,r=n.gpuAcceleration,i=r===void 0?!0:r,o=n.adaptive,s=o===void 0?!0:o,l=n.roundOffsets,a=l===void 0?!0:l,c={placement:Tt(e.placement),variation:cr(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Xd(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:a})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Xd(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:a})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const K1={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:q1,data:{}};var no={passive:!0};function J1(t){var e=t.state,n=t.instance,r=t.options,i=r.scroll,o=i===void 0?!0:i,s=r.resize,l=s===void 0?!0:s,a=Xe(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&c.forEach(function(d){d.addEventListener("scroll",n.update,no)}),l&&a.addEventListener("resize",n.update,no),function(){o&&c.forEach(function(d){d.removeEventListener("scroll",n.update,no)}),l&&a.removeEventListener("resize",n.update,no)}}const G1={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:J1,data:{}};var Y1={left:"right",right:"left",bottom:"top",top:"bottom"};function ro(t){return t.replace(/left|right|bottom|top/g,function(e){return Y1[e]})}var Z1={start:"end",end:"start"};function Qd(t){return t.replace(/start|end/g,function(e){return Z1[e]})}function Hs(t){var e=Xe(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Ws(t){return ar(an(t)).left+Hs(t).scrollLeft}function X1(t,e){var n=Xe(t),r=an(t),i=n.visualViewport,o=r.clientWidth,s=r.clientHeight,l=0,a=0;if(i){o=i.width,s=i.height;var c=qd();(c||!c&&e==="fixed")&&(l=i.offsetLeft,a=i.offsetTop)}return{width:o,height:s,x:l+Ws(t),y:a}}function Q1(t){var e,n=an(t),r=Hs(t),i=(e=t.ownerDocument)==null?void 0:e.body,o=Nn(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=Nn(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),l=-r.scrollLeft+Ws(t),a=-r.scrollTop;return zt(i||n).direction==="rtl"&&(l+=Nn(n.clientWidth,i?i.clientWidth:0)-o),{width:o,height:s,x:l,y:a}}function Us(t){var e=zt(t),n=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function eu(t){return["html","body","#document"].indexOf(Et(t))>=0?t.ownerDocument.body:lt(t)&&Us(t)?t:eu(to(t))}function Zr(t,e){var n;e===void 0&&(e=[]);var r=eu(t),i=r===((n=t.ownerDocument)==null?void 0:n.body),o=Xe(r),s=i?[o].concat(o.visualViewport||[],Us(r)?r:[]):r,l=e.concat(s);return i?l:l.concat(Zr(to(s)))}function qs(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function ek(t,e){var n=ar(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function tu(t,e,n){return e===jd?qs(X1(t,n)):Tn(e)?ek(e,n):qs(Q1(an(t)))}function tk(t){var e=Zr(to(t)),n=["absolute","fixed"].indexOf(zt(t).position)>=0,r=n&&lt(t)?Gr(t):t;return Tn(r)?e.filter(function(i){return Tn(i)&&Kd(i,r)&&Et(i)!=="body"}):[]}function nk(t,e,n,r){var i=e==="clippingParents"?tk(t):[].concat(e),o=[].concat(i,[n]),s=o[0],l=o.reduce(function(a,c){var d=tu(t,c,r);return a.top=Nn(d.top,a.top),a.right=eo(d.right,a.right),a.bottom=eo(d.bottom,a.bottom),a.left=Nn(d.left,a.left),a},tu(t,s,r));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function nu(t){var e=t.reference,n=t.element,r=t.placement,i=r?Tt(r):null,o=r?cr(r):null,s=e.x+e.width/2-n.width/2,l=e.y+e.height/2-n.height/2,a;switch(i){case We:a={x:s,y:e.y-n.height};break;case ot:a={x:s,y:e.y+e.height};break;case st:a={x:e.x+e.width,y:l};break;case Ue:a={x:e.x-n.width,y:l};break;default:a={x:e.x,y:e.y}}var c=i?js(i):null;if(c!=null){var d=c==="y"?"height":"width";switch(o){case sr:a[c]=a[c]-(e[d]/2-n[d]/2);break;case Kr:a[c]=a[c]+(e[d]/2-n[d]/2);break}}return a}function Xr(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=r===void 0?t.placement:r,o=n.strategy,s=o===void 0?t.strategy:o,l=n.boundary,a=l===void 0?S1:l,c=n.rootBoundary,d=c===void 0?jd:c,f=n.elementContext,h=f===void 0?Jr:f,p=n.altBoundary,m=p===void 0?!1:p,y=n.padding,g=y===void 0?0:y,v=Yd(typeof g!="number"?g:Zd(g,qr)),C=h===Jr?C1:Jr,M=t.rects.popper,b=t.elements[m?C:h],O=nk(Tn(b)?b:b.contextElement||an(t.elements.popper),a,d,s),S=ar(t.elements.reference),D=nu({reference:S,element:M,strategy:"absolute",placement:i}),V=qs(Object.assign({},M,D)),A=h===Jr?V:S,L={top:O.top-A.top+v.top,bottom:A.bottom-O.bottom+v.bottom,left:O.left-A.left+v.left,right:A.right-O.right+v.right},Y=t.modifiersData.offset;if(h===Jr&&Y){var q=Y[i];Object.keys(L).forEach(function(Z){var ee=[st,ot].indexOf(Z)>=0?1:-1,X=[We,ot].indexOf(Z)>=0?"y":"x";L[Z]+=q[X]*ee})}return L}function rk(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=n.boundary,o=n.rootBoundary,s=n.padding,l=n.flipVariations,a=n.allowedAutoPlacements,c=a===void 0?Wd:a,d=cr(r),f=d?l?Hd:Hd.filter(function(m){return cr(m)===d}):qr,h=f.filter(function(m){return c.indexOf(m)>=0});h.length===0&&(h=f);var p=h.reduce(function(m,y){return m[y]=Xr(t,{placement:y,boundary:i,rootBoundary:o,padding:s})[Tt(y)],m},{});return Object.keys(p).sort(function(m,y){return p[m]-p[y]})}function ik(t){if(Tt(t)===_s)return[];var e=ro(t);return[Qd(t),e,Qd(e)]}function ok(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var i=n.mainAxis,o=i===void 0?!0:i,s=n.altAxis,l=s===void 0?!0:s,a=n.fallbackPlacements,c=n.padding,d=n.boundary,f=n.rootBoundary,h=n.altBoundary,p=n.flipVariations,m=p===void 0?!0:p,y=n.allowedAutoPlacements,g=e.options.placement,v=Tt(g),C=v===g,M=a||(C||!m?[ro(g)]:ik(g)),b=[g].concat(M).reduce(function(le,Re){return le.concat(Tt(Re)===_s?rk(e,{placement:Re,boundary:d,rootBoundary:f,padding:c,flipVariations:m,allowedAutoPlacements:y}):Re)},[]),O=e.rects.reference,S=e.rects.popper,D=new Map,V=!0,A=b[0],L=0;L<b.length;L++){var Y=b[L],q=Tt(Y),Z=cr(Y)===sr,ee=[We,ot].indexOf(q)>=0,X=ee?"width":"height",_=Xr(e,{placement:Y,boundary:d,rootBoundary:f,altBoundary:h,padding:c}),Q=ee?Z?st:Ue:Z?ot:We;O[X]>S[X]&&(Q=ro(Q));var ne=ro(Q),pe=[];if(o&&pe.push(_[q]<=0),l&&pe.push(_[Q]<=0,_[ne]<=0),pe.every(function(le){return le})){A=Y,V=!1;break}D.set(Y,pe)}if(V)for(var $e=m?3:1,qe=function(Re){var B=b.find(function(W){var re=D.get(W);if(re)return re.slice(0,Re).every(function(te){return te})});if(B)return A=B,"break"},et=$e;et>0;et--){var tt=qe(et);if(tt==="break")break}e.placement!==A&&(e.modifiersData[r]._skip=!0,e.placement=A,e.reset=!0)}}const sk={name:"flip",enabled:!0,phase:"main",fn:ok,requiresIfExists:["offset"],data:{_skip:!1}};function ru(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function iu(t){return[We,st,ot,Ue].some(function(e){return t[e]>=0})}function lk(t){var e=t.state,n=t.name,r=e.rects.reference,i=e.rects.popper,o=e.modifiersData.preventOverflow,s=Xr(e,{elementContext:"reference"}),l=Xr(e,{altBoundary:!0}),a=ru(s,r),c=ru(l,i,o),d=iu(a),f=iu(c);e.modifiersData[n]={referenceClippingOffsets:a,popperEscapeOffsets:c,isReferenceHidden:d,hasPopperEscaped:f},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":f})}const ak={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:lk};function ck(t,e,n){var r=Tt(t),i=[Ue,We].indexOf(r)>=0?-1:1,o=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,s=o[0],l=o[1];return s=s||0,l=(l||0)*i,[Ue,st].indexOf(r)>=0?{x:l,y:s}:{x:s,y:l}}function dk(t){var e=t.state,n=t.options,r=t.name,i=n.offset,o=i===void 0?[0,0]:i,s=Wd.reduce(function(d,f){return d[f]=ck(f,e.rects,o),d},{}),l=s[e.placement],a=l.x,c=l.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=a,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=s}const uk={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:dk};function fk(t){var e=t.state,n=t.name;e.modifiersData[n]=nu({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const hk={name:"popperOffsets",enabled:!0,phase:"read",fn:fk,data:{}};function pk(t){return t==="x"?"y":"x"}function mk(t){var e=t.state,n=t.options,r=t.name,i=n.mainAxis,o=i===void 0?!0:i,s=n.altAxis,l=s===void 0?!1:s,a=n.boundary,c=n.rootBoundary,d=n.altBoundary,f=n.padding,h=n.tether,p=h===void 0?!0:h,m=n.tetherOffset,y=m===void 0?0:m,g=Xr(e,{boundary:a,rootBoundary:c,padding:f,altBoundary:d}),v=Tt(e.placement),C=cr(e.placement),M=!C,b=js(v),O=pk(b),S=e.modifiersData.popperOffsets,D=e.rects.reference,V=e.rects.popper,A=typeof y=="function"?y(Object.assign({},e.rects,{placement:e.placement})):y,L=typeof A=="number"?{mainAxis:A,altAxis:A}:Object.assign({mainAxis:0,altAxis:0},A),Y=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,q={x:0,y:0};if(S){if(o){var Z,ee=b==="y"?We:Ue,X=b==="y"?ot:st,_=b==="y"?"height":"width",Q=S[b],ne=Q+g[ee],pe=Q-g[X],$e=p?-V[_]/2:0,qe=C===sr?D[_]:V[_],et=C===sr?-V[_]:-D[_],tt=e.elements.arrow,le=p&&tt?Fs(tt):{width:0,height:0},Re=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Gd(),B=Re[ee],W=Re[X],re=Yr(0,D[_],le[_]),te=M?D[_]/2-$e-re-B-L.mainAxis:qe-re-B-L.mainAxis,we=M?-D[_]/2+$e+re+W+L.mainAxis:et+re+W+L.mainAxis,xe=e.elements.arrow&&Gr(e.elements.arrow),Ke=xe?b==="y"?xe.clientTop||0:xe.clientLeft||0:0,Bn=(Z=Y==null?void 0:Y[b])!=null?Z:0,hr=Q+te-Bn-Ke,dn=Q+we-Bn,un=Yr(p?eo(ne,hr):ne,Q,p?Nn(pe,dn):pe);S[b]=un,q[b]=un-Q}if(l){var jt,bt=b==="x"?We:Ue,at=b==="x"?ot:st,ct=S[O],Dt=O==="y"?"height":"width",Ht=ct+g[bt],Bt=ct-g[at],Vn=[We,Ue].indexOf(v)!==-1,fn=(jt=Y==null?void 0:Y[O])!=null?jt:0,pr=Vn?Ht:ct-D[Dt]-V[Dt]-fn+L.altAxis,mr=Vn?ct+D[Dt]+V[Dt]-fn-L.altAxis:Bt,gr=p&&Vn?L1(pr,ct,mr):Yr(p?pr:Ht,ct,p?mr:Bt);S[O]=gr,q[O]=gr-ct}e.modifiersData[r]=q}}const gk={name:"preventOverflow",enabled:!0,phase:"main",fn:mk,requiresIfExists:["offset"]};function yk(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function bk(t){return t===Xe(t)||!lt(t)?Hs(t):yk(t)}function vk(t){var e=t.getBoundingClientRect(),n=lr(e.width)/t.offsetWidth||1,r=lr(e.height)/t.offsetHeight||1;return n!==1||r!==1}function kk(t,e,n){n===void 0&&(n=!1);var r=lt(e),i=lt(e)&&vk(e),o=an(e),s=ar(t,i,n),l={scrollLeft:0,scrollTop:0},a={x:0,y:0};return(r||!r&&!n)&&((Et(e)!=="body"||Us(o))&&(l=bk(e)),lt(e)?(a=ar(e,!0),a.x+=e.clientLeft,a.y+=e.clientTop):o&&(a.x=Ws(o))),{x:s.left+l.scrollLeft-a.x,y:s.top+l.scrollTop-a.y,width:s.width,height:s.height}}function wk(t){var e=new Map,n=new Set,r=[];t.forEach(function(o){e.set(o.name,o)});function i(o){n.add(o.name);var s=[].concat(o.requires||[],o.requiresIfExists||[]);s.forEach(function(l){if(!n.has(l)){var a=e.get(l);a&&i(a)}}),r.push(o)}return t.forEach(function(o){n.has(o.name)||i(o)}),r}function xk(t){var e=wk(t);return I1.reduce(function(n,r){return n.concat(e.filter(function(i){return i.phase===r}))},[])}function Sk(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function Ck(t){var e=t.reduce(function(n,r){var i=n[r.name];return n[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var ou={placement:"bottom",modifiers:[],strategy:"absolute"};function su(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return!e.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function Ok(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,i=e.defaultOptions,o=i===void 0?ou:i;return function(l,a,c){c===void 0&&(c=o);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},ou,o),modifiersData:{},elements:{reference:l,popper:a},attributes:{},styles:{}},f=[],h=!1,p={state:d,setOptions:function(v){var C=typeof v=="function"?v(d.options):v;y(),d.options=Object.assign({},o,d.options,C),d.scrollParents={reference:Tn(l)?Zr(l):l.contextElement?Zr(l.contextElement):[],popper:Zr(a)};var M=xk(Ck([].concat(r,d.options.modifiers)));return d.orderedModifiers=M.filter(function(b){return b.enabled}),m(),p.update()},forceUpdate:function(){if(!h){var v=d.elements,C=v.reference,M=v.popper;if(su(C,M)){d.rects={reference:kk(C,Gr(M),d.options.strategy==="fixed"),popper:Fs(M)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function(L){return d.modifiersData[L.name]=Object.assign({},L.data)});for(var b=0;b<d.orderedModifiers.length;b++){if(d.reset===!0){d.reset=!1,b=-1;continue}var O=d.orderedModifiers[b],S=O.fn,D=O.options,V=D===void 0?{}:D,A=O.name;typeof S=="function"&&(d=S({state:d,options:V,name:A,instance:p})||d)}}}},update:Sk(function(){return new Promise(function(g){p.forceUpdate(),g(d)})}),destroy:function(){y(),h=!0}};if(!su(l,a))return p;p.setOptions(c).then(function(g){!h&&c.onFirstUpdate&&c.onFirstUpdate(g)});function m(){d.orderedModifiers.forEach(function(g){var v=g.name,C=g.options,M=C===void 0?{}:C,b=g.effect;if(typeof b=="function"){var O=b({state:d,name:v,instance:p,options:M}),S=function(){};f.push(O||S)}})}function y(){f.forEach(function(g){return g()}),f=[]}return p}}var Mk=[G1,hk,K1,Ud,uk,sk,gk,H1,ak],Ek=Ok({defaultModifiers:Mk}),Tk="tippy-box",lu="tippy-content",Nk="tippy-backdrop",au="tippy-arrow",cu="tippy-svg-arrow",An={passive:!0,capture:!0},du=function(){return document.body};function Ak(t,e){return{}.hasOwnProperty.call(t,e)}function Ks(t,e,n){if(Array.isArray(t)){var r=t[e];return r??(Array.isArray(n)?n[e]:n)}return t}function Js(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function uu(t,e){return typeof t=="function"?t.apply(void 0,e):t}function fu(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function Dk(t,e){var n=Object.assign({},t);return e.forEach(function(r){delete n[r]}),n}function Bk(t){return t.split(/\s+/).filter(Boolean)}function dr(t){return[].concat(t)}function hu(t,e){t.indexOf(e)===-1&&t.push(e)}function Vk(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function Ik(t){return t.split("-")[0]}function io(t){return[].slice.call(t)}function pu(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function Qr(){return document.createElement("div")}function ei(t){return["Element","Fragment"].some(function(e){return Js(t,e)})}function Pk(t){return Js(t,"NodeList")}function $k(t){return Js(t,"MouseEvent")}function Rk(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function _k(t){return ei(t)?[t]:Pk(t)?io(t):Array.isArray(t)?t:io(document.querySelectorAll(t))}function Gs(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function mu(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function Lk(t){var e,n=dr(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function zk(t,e){var n=e.clientX,r=e.clientY;return t.every(function(i){var o=i.popperRect,s=i.popperState,l=i.props,a=l.interactiveBorder,c=Ik(s.placement),d=s.modifiersData.offset;if(!d)return!0;var f=c==="bottom"?d.top.y:0,h=c==="top"?d.bottom.y:0,p=c==="right"?d.left.x:0,m=c==="left"?d.right.x:0,y=o.top-r+f>a,g=r-o.bottom-h>a,v=o.left-n+p>a,C=n-o.right-m>a;return y||g||v||C})}function Ys(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){t[r](i,n)})}function gu(t,e){for(var n=e;n;){var r;if(t.contains(n))return!0;n=n.getRootNode==null||(r=n.getRootNode())==null?void 0:r.host}return!1}var Nt={isTouch:!1},yu=0;function Fk(){Nt.isTouch||(Nt.isTouch=!0,window.performance&&document.addEventListener("mousemove",bu))}function bu(){var t=performance.now();t-yu<20&&(Nt.isTouch=!1,document.removeEventListener("mousemove",bu)),yu=t}function jk(){var t=document.activeElement;if(Rk(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function Hk(){document.addEventListener("touchstart",Fk,An),window.addEventListener("blur",jk)}var Wk=typeof window<"u"&&typeof document<"u",Uk=Wk?!!window.msCrypto:!1;function ur(t){var e=t==="destroy"?"n already-":" ";return[t+"() was called on a"+e+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function vu(t){var e=/[ \t]{2,}/g,n=/^[ \t]*/gm;return t.replace(e," ").replace(n,"").trim()}function qk(t){return vu(`
93
+ `,textSerializers:r={}}=e||{};return hx(this.state.doc,{blockSeparator:n,textSerializers:{...Yf(this.schema),...r}})}get isEmpty(){return yx(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,n))||null}$nodes(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new pr(n,this)}get $doc(){return this.$pos(0)}};function Jr(t){return new so({find:t.find,handler:({state:e,range:n,match:r})=>{const i=ee(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),c=n.from+a.indexOf(o),u=c+o.length;if(Xf(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(y=>y===t.type&&y!==p.mark.type)).filter(p=>p.to>c).length)return null;u<n.to&&s.delete(u,n.to),c>n.from&&s.delete(n.from+l,c);const h=n.from+l+o.length;s.addMark(n.from+l,h,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}function Rx(t){return new so({find:t.find,handler:({state:e,range:n,match:r})=>{const i=ee(t.getAttributes,void 0,r)||{},{tr:s}=e,o=n.from;let a=n.to;const l=t.type.create(i);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=o+c;u>a?u=a:a=u+r[1].length;const f=r[0][r[0].length-1];s.insertText(f,o+r[0].length-1),s.replaceWith(u,a,l)}else r[0]&&s.insert(o-1,t.type.create(i)).delete(s.mapping.map(o),s.mapping.map(a));s.scrollIntoView()}})}function ml(t){return new so({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=ee(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)}})}function Ui(t){return new so({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=ee(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),l=o.doc.resolve(n.from).blockRange(),c=l&&Sa(l,t.type,s);if(!c)return null;if(o.wrap(l,c),t.keepMarks&&t.editor){const{selection:f,storedMarks:h}=e,{splittableMarks:p}=t.editor.extensionManager,m=h||f.$to.parentOffset&&f.$from.marks();if(m){const y=m.filter(g=>p.includes(g.type.name));o.ensureMarks(y)}}if(t.keepAttributes){const f=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(f,s).run()}const u=o.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&Pn(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&o.join(n.from-1)}})}class Zt{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ee(z(this,"addOptions",{name:this.name}))),this.storage=ee(z(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Zt(e)}configure(e={}){const n=this.extend();return n.options=ao(this.options,e),n.storage=ee(z(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){const n=new Zt({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=ee(z(n,"addOptions",{name:n.name})),n.storage=ee(z(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(c=>(c==null?void 0:c.type.name)===n.name))return!1;const l=o.find(c=>(c==null?void 0:c.type.name)===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}let pt=class vc{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ee(z(this,"addOptions",{name:this.name}))),this.storage=ee(z(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new vc(e)}configure(e={}){const n=this.extend();return n.options=ao(this.options,e),n.storage=ee(z(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){const n=new vc({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=ee(z(n,"addOptions",{name:n.name})),n.storage=ee(z(n,"addStorage",{name:n.name,options:n.options})),n}};function Gr(t){return new fw({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=ee(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let c=n.to;if(a){const u=l.search(/\S/),f=n.from+l.indexOf(a),h=f+a.length;if(Xf(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(g=>g===t.type&&g!==m.mark.type)).filter(m=>m.to>f).length)return null;h<n.to&&o.delete(h,n.to),f>n.from&&o.delete(n.from+u,f),c=n.from+u+a.length,o.addMark(n.from+u,c,t.type.create(s||{})),o.removeStoredMark(t.type)}}})}var ot="top",St="bottom",Mt="right",at="left",gl="auto",qi=[ot,St,Mt,at],Zr="start",Ki="end",$x="clippingParents",nh="viewport",Ji="popper",Lx="reference",rh=qi.reduce(function(t,e){return t.concat([e+"-"+Zr,e+"-"+Ki])},[]),ih=[].concat(qi,[gl]).reduce(function(t,e){return t.concat([e,e+"-"+Zr,e+"-"+Ki])},[]),Fx="beforeRead",zx="read",jx="afterRead",Wx="beforeMain",Hx="main",Yx="afterMain",Ux="beforeWrite",qx="write",Kx="afterWrite",Jx=[Fx,zx,jx,Wx,Hx,Yx,Ux,qx,Kx];function Xt(t){return t?(t.nodeName||"").toLowerCase():null}function mt(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function mr(t){var e=mt(t).Element;return t instanceof e||t instanceof Element}function Ot(t){var e=mt(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function yl(t){if(typeof ShadowRoot>"u")return!1;var e=mt(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function Gx(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},i=e.attributes[n]||{},s=e.elements[n];!Ot(s)||!Xt(s)||(Object.assign(s.style,r),Object.keys(i).forEach(function(o){var a=i[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function Zx(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var i=e.elements[r],s=e.attributes[r]||{},o=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),a=o.reduce(function(l,c){return l[c]="",l},{});!Ot(i)||!Xt(i)||(Object.assign(i.style,a),Object.keys(s).forEach(function(l){i.removeAttribute(l)}))})}}const sh={name:"applyStyles",enabled:!0,phase:"write",fn:Gx,effect:Zx,requires:["computeStyles"]};function Qt(t){return t.split("-")[0]}var gr=Math.max,po=Math.min,Xr=Math.round;function bl(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function oh(){return!/^((?!chrome|android).)*safari/i.test(bl())}function Qr(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),i=1,s=1;e&&Ot(t)&&(i=t.offsetWidth>0&&Xr(r.width)/t.offsetWidth||1,s=t.offsetHeight>0&&Xr(r.height)/t.offsetHeight||1);var o=mr(t)?mt(t):window,a=o.visualViewport,l=!oh()&&n,c=(r.left+(l&&a?a.offsetLeft:0))/i,u=(r.top+(l&&a?a.offsetTop:0))/s,f=r.width/i,h=r.height/s;return{width:f,height:h,top:u,right:c+f,bottom:u+h,left:c,x:c,y:u}}function vl(t){var e=Qr(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function ah(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&yl(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function gn(t){return mt(t).getComputedStyle(t)}function Xx(t){return["table","td","th"].indexOf(Xt(t))>=0}function Un(t){return((mr(t)?t.ownerDocument:t.document)||window.document).documentElement}function mo(t){return Xt(t)==="html"?t:t.assignedSlot||t.parentNode||(yl(t)?t.host:null)||Un(t)}function lh(t){return!Ot(t)||gn(t).position==="fixed"?null:t.offsetParent}function Qx(t){var e=/firefox/i.test(bl()),n=/Trident/i.test(bl());if(n&&Ot(t)){var r=gn(t);if(r.position==="fixed")return null}var i=mo(t);for(yl(i)&&(i=i.host);Ot(i)&&["html","body"].indexOf(Xt(i))<0;){var s=gn(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function Gi(t){for(var e=mt(t),n=lh(t);n&&Xx(n)&&gn(n).position==="static";)n=lh(n);return n&&(Xt(n)==="html"||Xt(n)==="body"&&gn(n).position==="static")?e:n||Qx(t)||e}function kl(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Zi(t,e,n){return gr(t,po(e,n))}function eS(t,e,n){var r=Zi(t,e,n);return r>n?n:r}function ch(){return{top:0,right:0,bottom:0,left:0}}function dh(t){return Object.assign({},ch(),t)}function uh(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var tS=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,dh(typeof e!="number"?e:uh(e,qi))};function nS(t){var e,n=t.state,r=t.name,i=t.options,s=n.elements.arrow,o=n.modifiersData.popperOffsets,a=Qt(n.placement),l=kl(a),c=[at,Mt].indexOf(a)>=0,u=c?"height":"width";if(!(!s||!o)){var f=tS(i.padding,n),h=vl(s),p=l==="y"?ot:at,m=l==="y"?St:Mt,y=n.rects.reference[u]+n.rects.reference[l]-o[l]-n.rects.popper[u],g=o[l]-n.rects.reference[l],k=Gi(s),x=k?l==="y"?k.clientHeight||0:k.clientWidth||0:0,O=y/2-g/2,b=f[p],C=x-h[u]-f[m],v=x/2-h[u]/2+O,T=Zi(b,v,C),B=l;n.modifiersData[r]=(e={},e[B]=T,e.centerOffset=T-v,e)}}function rS(t){var e=t.state,n=t.options,r=n.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||ah(e.elements.popper,i)&&(e.elements.arrow=i))}const iS={name:"arrow",enabled:!0,phase:"main",fn:nS,effect:rS,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ei(t){return t.split("-")[1]}var sS={top:"auto",right:"auto",bottom:"auto",left:"auto"};function oS(t,e){var n=t.x,r=t.y,i=e.devicePixelRatio||1;return{x:Xr(n*i)/i||0,y:Xr(r*i)/i||0}}function fh(t){var e,n=t.popper,r=t.popperRect,i=t.placement,s=t.variation,o=t.offsets,a=t.position,l=t.gpuAcceleration,c=t.adaptive,u=t.roundOffsets,f=t.isFixed,h=o.x,p=h===void 0?0:h,m=o.y,y=m===void 0?0:m,g=typeof u=="function"?u({x:p,y}):{x:p,y};p=g.x,y=g.y;var k=o.hasOwnProperty("x"),x=o.hasOwnProperty("y"),O=at,b=ot,C=window;if(c){var v=Gi(n),T="clientHeight",B="clientWidth";if(v===mt(n)&&(v=Un(n),gn(v).position!=="static"&&a==="absolute"&&(T="scrollHeight",B="scrollWidth")),v=v,i===ot||(i===at||i===Mt)&&s===Ki){b=St;var V=f&&v===C&&C.visualViewport?C.visualViewport.height:v[T];y-=V-r.height,y*=l?1:-1}if(i===at||(i===ot||i===St)&&s===Ki){O=Mt;var F=f&&v===C&&C.visualViewport?C.visualViewport.width:v[B];p-=F-r.width,p*=l?1:-1}}var te=Object.assign({position:a},c&&sS),G=u===!0?oS({x:p,y},mt(n)):{x:p,y};if(p=G.x,y=G.y,l){var ne;return Object.assign({},te,(ne={},ne[b]=x?"0":"",ne[O]=k?"0":"",ne.transform=(C.devicePixelRatio||1)<=1?"translate("+p+"px, "+y+"px)":"translate3d("+p+"px, "+y+"px, 0)",ne))}return Object.assign({},te,(e={},e[b]=x?y+"px":"",e[O]=k?p+"px":"",e.transform="",e))}function aS(t){var e=t.state,n=t.options,r=n.gpuAcceleration,i=r===void 0?!0:r,s=n.adaptive,o=s===void 0?!0:s,a=n.roundOffsets,l=a===void 0?!0:a,c={placement:Qt(e.placement),variation:ei(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,fh(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,fh(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const lS={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:aS,data:{}};var go={passive:!0};function cS(t){var e=t.state,n=t.instance,r=t.options,i=r.scroll,s=i===void 0?!0:i,o=r.resize,a=o===void 0?!0:o,l=mt(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&c.forEach(function(u){u.addEventListener("scroll",n.update,go)}),a&&l.addEventListener("resize",n.update,go),function(){s&&c.forEach(function(u){u.removeEventListener("scroll",n.update,go)}),a&&l.removeEventListener("resize",n.update,go)}}const dS={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:cS,data:{}};var uS={left:"right",right:"left",bottom:"top",top:"bottom"};function yo(t){return t.replace(/left|right|bottom|top/g,function(e){return uS[e]})}var fS={start:"end",end:"start"};function hh(t){return t.replace(/start|end/g,function(e){return fS[e]})}function wl(t){var e=mt(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function xl(t){return Qr(Un(t)).left+wl(t).scrollLeft}function hS(t,e){var n=mt(t),r=Un(t),i=n.visualViewport,s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;var c=oh();(c||!c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a+xl(t),y:l}}function pS(t){var e,n=Un(t),r=wl(t),i=(e=t.ownerDocument)==null?void 0:e.body,s=gr(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=gr(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-r.scrollLeft+xl(t),l=-r.scrollTop;return gn(i||n).direction==="rtl"&&(a+=gr(n.clientWidth,i?i.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}function Sl(t){var e=gn(t),n=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function ph(t){return["html","body","#document"].indexOf(Xt(t))>=0?t.ownerDocument.body:Ot(t)&&Sl(t)?t:ph(mo(t))}function Xi(t,e){var n;e===void 0&&(e=[]);var r=ph(t),i=r===((n=t.ownerDocument)==null?void 0:n.body),s=mt(r),o=i?[s].concat(s.visualViewport||[],Sl(r)?r:[]):r,a=e.concat(o);return i?a:a.concat(Xi(mo(o)))}function Ml(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function mS(t,e){var n=Qr(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function mh(t,e,n){return e===nh?Ml(hS(t,n)):mr(e)?mS(e,n):Ml(pS(Un(t)))}function gS(t){var e=Xi(mo(t)),n=["absolute","fixed"].indexOf(gn(t).position)>=0,r=n&&Ot(t)?Gi(t):t;return mr(r)?e.filter(function(i){return mr(i)&&ah(i,r)&&Xt(i)!=="body"}):[]}function yS(t,e,n,r){var i=e==="clippingParents"?gS(t):[].concat(e),s=[].concat(i,[n]),o=s[0],a=s.reduce(function(l,c){var u=mh(t,c,r);return l.top=gr(u.top,l.top),l.right=po(u.right,l.right),l.bottom=po(u.bottom,l.bottom),l.left=gr(u.left,l.left),l},mh(t,o,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function gh(t){var e=t.reference,n=t.element,r=t.placement,i=r?Qt(r):null,s=r?ei(r):null,o=e.x+e.width/2-n.width/2,a=e.y+e.height/2-n.height/2,l;switch(i){case ot:l={x:o,y:e.y-n.height};break;case St:l={x:o,y:e.y+e.height};break;case Mt:l={x:e.x+e.width,y:a};break;case at:l={x:e.x-n.width,y:a};break;default:l={x:e.x,y:e.y}}var c=i?kl(i):null;if(c!=null){var u=c==="y"?"height":"width";switch(s){case Zr:l[c]=l[c]-(e[u]/2-n[u]/2);break;case Ki:l[c]=l[c]+(e[u]/2-n[u]/2);break}}return l}function Qi(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=r===void 0?t.placement:r,s=n.strategy,o=s===void 0?t.strategy:s,a=n.boundary,l=a===void 0?$x:a,c=n.rootBoundary,u=c===void 0?nh:c,f=n.elementContext,h=f===void 0?Ji:f,p=n.altBoundary,m=p===void 0?!1:p,y=n.padding,g=y===void 0?0:y,k=dh(typeof g!="number"?g:uh(g,qi)),x=h===Ji?Lx:Ji,O=t.rects.popper,b=t.elements[m?x:h],C=yS(mr(b)?b:b.contextElement||Un(t.elements.popper),l,u,o),v=Qr(t.elements.reference),T=gh({reference:v,element:O,strategy:"absolute",placement:i}),B=Ml(Object.assign({},O,T)),V=h===Ji?B:v,F={top:C.top-V.top+k.top,bottom:V.bottom-C.bottom+k.bottom,left:C.left-V.left+k.left,right:V.right-C.right+k.right},te=t.modifiersData.offset;if(h===Ji&&te){var G=te[i];Object.keys(F).forEach(function(ne){var oe=[Mt,St].indexOf(ne)>=0?1:-1,re=[ot,St].indexOf(ne)>=0?"y":"x";F[ne]+=G[re]*oe})}return F}function bS(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=n.boundary,s=n.rootBoundary,o=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,c=l===void 0?ih:l,u=ei(r),f=u?a?rh:rh.filter(function(m){return ei(m)===u}):qi,h=f.filter(function(m){return c.indexOf(m)>=0});h.length===0&&(h=f);var p=h.reduce(function(m,y){return m[y]=Qi(t,{placement:y,boundary:i,rootBoundary:s,padding:o})[Qt(y)],m},{});return Object.keys(p).sort(function(m,y){return p[m]-p[y]})}function vS(t){if(Qt(t)===gl)return[];var e=yo(t);return[hh(t),e,hh(e)]}function kS(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var i=n.mainAxis,s=i===void 0?!0:i,o=n.altAxis,a=o===void 0?!0:o,l=n.fallbackPlacements,c=n.padding,u=n.boundary,f=n.rootBoundary,h=n.altBoundary,p=n.flipVariations,m=p===void 0?!0:p,y=n.allowedAutoPlacements,g=e.options.placement,k=Qt(g),x=k===g,O=l||(x||!m?[yo(g)]:vS(g)),b=[g].concat(O).reduce(function(ke,et){return ke.concat(Qt(et)===gl?bS(e,{placement:et,boundary:u,rootBoundary:f,padding:c,flipVariations:m,allowedAutoPlacements:y}):et)},[]),C=e.rects.reference,v=e.rects.popper,T=new Map,B=!0,V=b[0],F=0;F<b.length;F++){var te=b[F],G=Qt(te),ne=ei(te)===Zr,oe=[ot,St].indexOf(G)>=0,re=oe?"width":"height",j=Qi(e,{placement:te,boundary:u,rootBoundary:f,altBoundary:h,padding:c}),ie=oe?ne?Mt:at:ne?St:ot;C[re]>v[re]&&(ie=yo(ie));var ue=yo(ie),_e=[];if(s&&_e.push(j[G]<=0),a&&_e.push(j[ie]<=0,j[ue]<=0),_e.every(function(ke){return ke})){V=te,B=!1;break}T.set(te,_e)}if(B)for(var Qe=m?3:1,ct=function(et){var P=b.find(function(K){var fe=T.get(K);if(fe)return fe.slice(0,et).every(function(ae){return ae})});if(P)return V=P,"break"},bt=Qe;bt>0;bt--){var vt=ct(bt);if(vt==="break")break}e.placement!==V&&(e.modifiersData[r]._skip=!0,e.placement=V,e.reset=!0)}}const wS={name:"flip",enabled:!0,phase:"main",fn:kS,requiresIfExists:["offset"],data:{_skip:!1}};function yh(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function bh(t){return[ot,Mt,St,at].some(function(e){return t[e]>=0})}function xS(t){var e=t.state,n=t.name,r=e.rects.reference,i=e.rects.popper,s=e.modifiersData.preventOverflow,o=Qi(e,{elementContext:"reference"}),a=Qi(e,{altBoundary:!0}),l=yh(o,r),c=yh(a,i,s),u=bh(l),f=bh(c);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:f},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":f})}const SS={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:xS};function MS(t,e,n){var r=Qt(t),i=[at,ot].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,o=s[0],a=s[1];return o=o||0,a=(a||0)*i,[at,Mt].indexOf(r)>=0?{x:a,y:o}:{x:o,y:a}}function OS(t){var e=t.state,n=t.options,r=t.name,i=n.offset,s=i===void 0?[0,0]:i,o=ih.reduce(function(u,f){return u[f]=MS(f,e.rects,s),u},{}),a=o[e.placement],l=a.x,c=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=o}const CS={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:OS};function TS(t){var e=t.state,n=t.name;e.modifiersData[n]=gh({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const ES={name:"popperOffsets",enabled:!0,phase:"read",fn:TS,data:{}};function _S(t){return t==="x"?"y":"x"}function NS(t){var e=t.state,n=t.options,r=t.name,i=n.mainAxis,s=i===void 0?!0:i,o=n.altAxis,a=o===void 0?!1:o,l=n.boundary,c=n.rootBoundary,u=n.altBoundary,f=n.padding,h=n.tether,p=h===void 0?!0:h,m=n.tetherOffset,y=m===void 0?0:m,g=Qi(e,{boundary:l,rootBoundary:c,padding:f,altBoundary:u}),k=Qt(e.placement),x=ei(e.placement),O=!x,b=kl(k),C=_S(b),v=e.modifiersData.popperOffsets,T=e.rects.reference,B=e.rects.popper,V=typeof y=="function"?y(Object.assign({},e.rects,{placement:e.placement})):y,F=typeof V=="number"?{mainAxis:V,altAxis:V}:Object.assign({mainAxis:0,altAxis:0},V),te=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,G={x:0,y:0};if(v){if(s){var ne,oe=b==="y"?ot:at,re=b==="y"?St:Mt,j=b==="y"?"height":"width",ie=v[b],ue=ie+g[oe],_e=ie-g[re],Qe=p?-B[j]/2:0,ct=x===Zr?T[j]:B[j],bt=x===Zr?-B[j]:-T[j],vt=e.elements.arrow,ke=p&&vt?vl(vt):{width:0,height:0},et=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:ch(),P=et[oe],K=et[re],fe=Zi(0,T[j],ke[j]),ae=O?T[j]/2-Qe-fe-P-F.mainAxis:ct-fe-P-F.mainAxis,Re=O?-T[j]/2+Qe+fe+K+F.mainAxis:bt+fe+K+F.mainAxis,$e=e.elements.arrow&&Gi(e.elements.arrow),dt=$e?b==="y"?$e.clientTop||0:$e.clientLeft||0:0,Sr=(ne=te==null?void 0:te[b])!=null?ne:0,hi=ie+ae-Sr-dt,Zn=ie+Re-Sr,Xn=Zi(p?po(ue,hi):ue,ie,p?gr(_e,Zn):_e);v[b]=Xn,G[b]=Xn-ie}if(a){var Tn,Wt=b==="x"?ot:at,_t=b==="x"?St:Mt,Nt=v[C],an=C==="y"?"height":"width",En=Nt+g[Wt],ln=Nt-g[_t],Mr=[ot,at].indexOf(k)!==-1,Qn=(Tn=te==null?void 0:te[C])!=null?Tn:0,pi=Mr?En:Nt-T[an]-B[an]-Qn+F.altAxis,mi=Mr?Nt+T[an]+B[an]-Qn-F.altAxis:ln,gi=p&&Mr?eS(pi,Nt,mi):Zi(p?pi:En,Nt,p?mi:ln);v[C]=gi,G[C]=gi-Nt}e.modifiersData[r]=G}}const DS={name:"preventOverflow",enabled:!0,phase:"main",fn:NS,requiresIfExists:["offset"]};function AS(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function VS(t){return t===mt(t)||!Ot(t)?wl(t):AS(t)}function BS(t){var e=t.getBoundingClientRect(),n=Xr(e.width)/t.offsetWidth||1,r=Xr(e.height)/t.offsetHeight||1;return n!==1||r!==1}function PS(t,e,n){n===void 0&&(n=!1);var r=Ot(e),i=Ot(e)&&BS(e),s=Un(e),o=Qr(t,i,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((Xt(e)!=="body"||Sl(s))&&(a=VS(e)),Ot(e)?(l=Qr(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=xl(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function IS(t){var e=new Map,n=new Set,r=[];t.forEach(function(s){e.set(s.name,s)});function i(s){n.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(a){if(!n.has(a)){var l=e.get(a);l&&i(l)}}),r.push(s)}return t.forEach(function(s){n.has(s.name)||i(s)}),r}function RS(t){var e=IS(t);return Jx.reduce(function(n,r){return n.concat(e.filter(function(i){return i.phase===r}))},[])}function $S(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function LS(t){var e=t.reduce(function(n,r){var i=n[r.name];return n[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var vh={placement:"bottom",modifiers:[],strategy:"absolute"};function kh(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return!e.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function FS(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,i=e.defaultOptions,s=i===void 0?vh:i;return function(a,l,c){c===void 0&&(c=s);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},vh,s),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},f=[],h=!1,p={state:u,setOptions:function(k){var x=typeof k=="function"?k(u.options):k;y(),u.options=Object.assign({},s,u.options,x),u.scrollParents={reference:mr(a)?Xi(a):a.contextElement?Xi(a.contextElement):[],popper:Xi(l)};var O=RS(LS([].concat(r,u.options.modifiers)));return u.orderedModifiers=O.filter(function(b){return b.enabled}),m(),p.update()},forceUpdate:function(){if(!h){var k=u.elements,x=k.reference,O=k.popper;if(kh(x,O)){u.rects={reference:PS(x,Gi(O),u.options.strategy==="fixed"),popper:vl(O)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(F){return u.modifiersData[F.name]=Object.assign({},F.data)});for(var b=0;b<u.orderedModifiers.length;b++){if(u.reset===!0){u.reset=!1,b=-1;continue}var C=u.orderedModifiers[b],v=C.fn,T=C.options,B=T===void 0?{}:T,V=C.name;typeof v=="function"&&(u=v({state:u,options:B,name:V,instance:p})||u)}}}},update:$S(function(){return new Promise(function(g){p.forceUpdate(),g(u)})}),destroy:function(){y(),h=!0}};if(!kh(a,l))return p;p.setOptions(c).then(function(g){!h&&c.onFirstUpdate&&c.onFirstUpdate(g)});function m(){u.orderedModifiers.forEach(function(g){var k=g.name,x=g.options,O=x===void 0?{}:x,b=g.effect;if(typeof b=="function"){var C=b({state:u,name:k,instance:p,options:O}),v=function(){};f.push(C||v)}})}function y(){f.forEach(function(g){return g()}),f=[]}return p}}var zS=[dS,ES,lS,sh,CS,wS,DS,iS,SS],jS=FS({defaultModifiers:zS}),WS="tippy-box",wh="tippy-content",HS="tippy-backdrop",xh="tippy-arrow",Sh="tippy-svg-arrow",yr={passive:!0,capture:!0},Mh=function(){return document.body};function YS(t,e){return{}.hasOwnProperty.call(t,e)}function Ol(t,e,n){if(Array.isArray(t)){var r=t[e];return r??(Array.isArray(n)?n[e]:n)}return t}function Cl(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function Oh(t,e){return typeof t=="function"?t.apply(void 0,e):t}function Ch(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function US(t,e){var n=Object.assign({},t);return e.forEach(function(r){delete n[r]}),n}function qS(t){return t.split(/\s+/).filter(Boolean)}function ti(t){return[].concat(t)}function Th(t,e){t.indexOf(e)===-1&&t.push(e)}function KS(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function JS(t){return t.split("-")[0]}function bo(t){return[].slice.call(t)}function Eh(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function es(){return document.createElement("div")}function ts(t){return["Element","Fragment"].some(function(e){return Cl(t,e)})}function GS(t){return Cl(t,"NodeList")}function ZS(t){return Cl(t,"MouseEvent")}function XS(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function QS(t){return ts(t)?[t]:GS(t)?bo(t):Array.isArray(t)?t:bo(document.querySelectorAll(t))}function Tl(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function _h(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function eM(t){var e,n=ti(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function tM(t,e){var n=e.clientX,r=e.clientY;return t.every(function(i){var s=i.popperRect,o=i.popperState,a=i.props,l=a.interactiveBorder,c=JS(o.placement),u=o.modifiersData.offset;if(!u)return!0;var f=c==="bottom"?u.top.y:0,h=c==="top"?u.bottom.y:0,p=c==="right"?u.left.x:0,m=c==="left"?u.right.x:0,y=s.top-r+f>l,g=r-s.bottom-h>l,k=s.left-n+p>l,x=n-s.right-m>l;return y||g||k||x})}function El(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){t[r](i,n)})}function Nh(t,e){for(var n=e;n;){var r;if(t.contains(n))return!0;n=n.getRootNode==null||(r=n.getRootNode())==null?void 0:r.host}return!1}var en={isTouch:!1},Dh=0;function nM(){en.isTouch||(en.isTouch=!0,window.performance&&document.addEventListener("mousemove",Ah))}function Ah(){var t=performance.now();t-Dh<20&&(en.isTouch=!1,document.removeEventListener("mousemove",Ah)),Dh=t}function rM(){var t=document.activeElement;if(XS(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function iM(){document.addEventListener("touchstart",nM,yr),window.addEventListener("blur",rM)}var sM=typeof window<"u"&&typeof document<"u",oM=sM?!!window.msCrypto:!1;function ni(t){var e=t==="destroy"?"n already-":" ";return[t+"() was called on a"+e+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function Vh(t){var e=/[ \t]{2,}/g,n=/^[ \t]*/gm;return t.replace(e," ").replace(n,"").trim()}function aM(t){return Vh(`
94
94
  %ctippy.js
95
95
 
96
- %c`+vu(t)+`
96
+ %c`+Vh(t)+`
97
97
 
98
98
  %c👷‍ This is a development-only message. It will be removed in production.
99
- `)}function ku(t){return[qk(t),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var ti;process.env.NODE_ENV!=="production"&&Kk();function Kk(){ti=new Set}function Ft(t,e){if(t&&!ti.has(e)){var n;ti.add(e),(n=console).warn.apply(n,ku(e))}}function Zs(t,e){if(t&&!ti.has(e)){var n;ti.add(e),(n=console).error.apply(n,ku(e))}}function Jk(t){var e=!t,n=Object.prototype.toString.call(t)==="[object Object]"&&!t.addEventListener;Zs(e,["tippy() was passed","`"+String(t)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),Zs(n,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var wu={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},Gk={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Qe=Object.assign({appendTo:du,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},wu,Gk),Yk=Object.keys(Qe),Zk=function(e){process.env.NODE_ENV!=="production"&&Cu(e,[]);var n=Object.keys(e);n.forEach(function(r){Qe[r]=e[r]})};function xu(t){var e=t.plugins||[],n=e.reduce(function(r,i){var o=i.name,s=i.defaultValue;if(o){var l;r[o]=t[o]!==void 0?t[o]:(l=Qe[o])!=null?l:s}return r},{});return Object.assign({},t,n)}function Xk(t,e){var n=e?Object.keys(xu(Object.assign({},Qe,{plugins:e}))):Yk,r=n.reduce(function(i,o){var s=(t.getAttribute("data-tippy-"+o)||"").trim();if(!s)return i;if(o==="content")i[o]=s;else try{i[o]=JSON.parse(s)}catch{i[o]=s}return i},{});return r}function Su(t,e){var n=Object.assign({},e,{content:uu(e.content,[t])},e.ignoreAttributes?{}:Xk(t,e.plugins));return n.aria=Object.assign({},Qe.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?e.interactive:n.aria.expanded,content:n.aria.content==="auto"?e.interactive?null:"describedby":n.aria.content},n}function Cu(t,e){t===void 0&&(t={}),e===void 0&&(e=[]);var n=Object.keys(t);n.forEach(function(r){var i=Dk(Qe,Object.keys(wu)),o=!Ak(i,r);o&&(o=e.filter(function(s){return s.name===r}).length===0),Ft(o,["`"+r+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.",`
99
+ `)}function Bh(t){return[aM(t),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var ns;process.env.NODE_ENV!=="production"&&lM();function lM(){ns=new Set}function yn(t,e){if(t&&!ns.has(e)){var n;ns.add(e),(n=console).warn.apply(n,Bh(e))}}function _l(t,e){if(t&&!ns.has(e)){var n;ns.add(e),(n=console).error.apply(n,Bh(e))}}function cM(t){var e=!t,n=Object.prototype.toString.call(t)==="[object Object]"&&!t.addEventListener;_l(e,["tippy() was passed","`"+String(t)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),_l(n,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var Ph={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},dM={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},gt=Object.assign({appendTo:Mh,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},Ph,dM),uM=Object.keys(gt),fM=function(e){process.env.NODE_ENV!=="production"&&$h(e,[]);var n=Object.keys(e);n.forEach(function(r){gt[r]=e[r]})};function Ih(t){var e=t.plugins||[],n=e.reduce(function(r,i){var s=i.name,o=i.defaultValue;if(s){var a;r[s]=t[s]!==void 0?t[s]:(a=gt[s])!=null?a:o}return r},{});return Object.assign({},t,n)}function hM(t,e){var n=e?Object.keys(Ih(Object.assign({},gt,{plugins:e}))):uM,r=n.reduce(function(i,s){var o=(t.getAttribute("data-tippy-"+s)||"").trim();if(!o)return i;if(s==="content")i[s]=o;else try{i[s]=JSON.parse(o)}catch{i[s]=o}return i},{});return r}function Rh(t,e){var n=Object.assign({},e,{content:Oh(e.content,[t])},e.ignoreAttributes?{}:hM(t,e.plugins));return n.aria=Object.assign({},gt.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?e.interactive:n.aria.expanded,content:n.aria.content==="auto"?e.interactive?null:"describedby":n.aria.content},n}function $h(t,e){t===void 0&&(t={}),e===void 0&&(e=[]);var n=Object.keys(t);n.forEach(function(r){var i=US(gt,Object.keys(Ph)),s=!YS(i,r);s&&(s=e.filter(function(o){return o.name===r}).length===0),yn(s,["`"+r+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.",`
100
100
 
101
101
  `,`All props: https://atomiks.github.io/tippyjs/v6/all-props/
102
- `,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var Qk=function(){return"innerHTML"};function Xs(t,e){t[Qk()]=e}function Ou(t){var e=Qr();return t===!0?e.className=au:(e.className=cu,ei(t)?e.appendChild(t):Xs(e,t)),e}function Mu(t,e){ei(e.content)?(Xs(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Xs(t,e.content):t.textContent=e.content)}function Qs(t){var e=t.firstElementChild,n=io(e.children);return{box:e,content:n.find(function(r){return r.classList.contains(lu)}),arrow:n.find(function(r){return r.classList.contains(au)||r.classList.contains(cu)}),backdrop:n.find(function(r){return r.classList.contains(Nk)})}}function Eu(t){var e=Qr(),n=Qr();n.className=Tk,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=Qr();r.className=lu,r.setAttribute("data-state","hidden"),Mu(r,t.props),e.appendChild(n),n.appendChild(r),i(t.props,t.props);function i(o,s){var l=Qs(e),a=l.box,c=l.content,d=l.arrow;s.theme?a.setAttribute("data-theme",s.theme):a.removeAttribute("data-theme"),typeof s.animation=="string"?a.setAttribute("data-animation",s.animation):a.removeAttribute("data-animation"),s.inertia?a.setAttribute("data-inertia",""):a.removeAttribute("data-inertia"),a.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?a.setAttribute("role",s.role):a.removeAttribute("role"),(o.content!==s.content||o.allowHTML!==s.allowHTML)&&Mu(c,t.props),s.arrow?d?o.arrow!==s.arrow&&(a.removeChild(d),a.appendChild(Ou(s.arrow))):a.appendChild(Ou(s.arrow)):d&&a.removeChild(d)}return{popper:e,onUpdate:i}}Eu.$$tippy=!0;var ew=1,oo=[],el=[];function tw(t,e){var n=Su(t,Object.assign({},Qe,xu(pu(e)))),r,i,o,s=!1,l=!1,a=!1,c=!1,d,f,h,p=[],m=fu(hr,n.interactiveDebounce),y,g=ew++,v=null,C=Vk(n.plugins),M={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},b={id:g,reference:t,popper:Qr(),popperInstance:v,props:n,state:M,plugins:C,clearDelayTimeouts:pr,setProps:mr,setContent:gr,show:x,hide:w,hideWithInteractivity:E,enable:Vn,disable:fn,unmount:P,destroy:j};if(!n.render)return process.env.NODE_ENV!=="production"&&Zs(!0,"render() function has not been supplied."),b;var O=n.render(b),S=O.popper,D=O.onUpdate;S.setAttribute("data-tippy-root",""),S.id="tippy-"+b.id,b.popper=S,t._tippy=b,S._tippy=b;var V=C.map(function(k){return k.fn(b)}),A=t.hasAttribute("aria-expanded");return xe(),$e(),Q(),ne("onCreate",[b]),n.showOnCreate&&Ht(),S.addEventListener("mouseenter",function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()}),S.addEventListener("mouseleave",function(){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&ee().addEventListener("mousemove",m)}),b;function L(){var k=b.props.touch;return Array.isArray(k)?k:[k,0]}function Y(){return L()[0]==="hold"}function q(){var k;return!!((k=b.props.render)!=null&&k.$$tippy)}function Z(){return y||t}function ee(){var k=Z().parentNode;return k?Lk(k):document}function X(){return Qs(S)}function _(k){return b.state.isMounted&&!b.state.isVisible||Nt.isTouch||d&&d.type==="focus"?0:Ks(b.props.delay,k?0:1,Qe.delay)}function Q(k){k===void 0&&(k=!1),S.style.pointerEvents=b.props.interactive&&!k?"":"none",S.style.zIndex=""+b.props.zIndex}function ne(k,N,$){if($===void 0&&($=!0),V.forEach(function(H){H[k]&&H[k].apply(H,N)}),$){var F;(F=b.props)[k].apply(F,N)}}function pe(){var k=b.props.aria;if(k.content){var N="aria-"+k.content,$=S.id,F=dr(b.props.triggerTarget||t);F.forEach(function(H){var K=H.getAttribute(N);if(b.state.isVisible)H.setAttribute(N,K?K+" "+$:$);else{var ie=K&&K.replace($,"").trim();ie?H.setAttribute(N,ie):H.removeAttribute(N)}})}}function $e(){if(!(A||!b.props.aria.expanded)){var k=dr(b.props.triggerTarget||t);k.forEach(function(N){b.props.interactive?N.setAttribute("aria-expanded",b.state.isVisible&&N===Z()?"true":"false"):N.removeAttribute("aria-expanded")})}}function qe(){ee().removeEventListener("mousemove",m),oo=oo.filter(function(k){return k!==m})}function et(k){if(!(Nt.isTouch&&(a||k.type==="mousedown"))){var N=k.composedPath&&k.composedPath()[0]||k.target;if(!(b.props.interactive&&gu(S,N))){if(dr(b.props.triggerTarget||t).some(function($){return gu($,N)})){if(Nt.isTouch||b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else ne("onClickOutside",[b,k]);b.props.hideOnClick===!0&&(b.clearDelayTimeouts(),b.hide(),l=!0,setTimeout(function(){l=!1}),b.state.isMounted||B())}}}function tt(){a=!0}function le(){a=!1}function Re(){var k=ee();k.addEventListener("mousedown",et,!0),k.addEventListener("touchend",et,An),k.addEventListener("touchstart",le,An),k.addEventListener("touchmove",tt,An)}function B(){var k=ee();k.removeEventListener("mousedown",et,!0),k.removeEventListener("touchend",et,An),k.removeEventListener("touchstart",le,An),k.removeEventListener("touchmove",tt,An)}function W(k,N){te(k,function(){!b.state.isVisible&&S.parentNode&&S.parentNode.contains(S)&&N()})}function re(k,N){te(k,N)}function te(k,N){var $=X().box;function F(H){H.target===$&&(Ys($,"remove",F),N())}if(k===0)return N();Ys($,"remove",f),Ys($,"add",F),f=F}function we(k,N,$){$===void 0&&($=!1);var F=dr(b.props.triggerTarget||t);F.forEach(function(H){H.addEventListener(k,N,$),p.push({node:H,eventType:k,handler:N,options:$})})}function xe(){Y()&&(we("touchstart",Bn,{passive:!0}),we("touchend",dn,{passive:!0})),Bk(b.props.trigger).forEach(function(k){if(k!=="manual")switch(we(k,Bn),k){case"mouseenter":we("mouseleave",dn);break;case"focus":we(Uk?"focusout":"blur",un);break;case"focusin":we("focusout",un);break}})}function Ke(){p.forEach(function(k){var N=k.node,$=k.eventType,F=k.handler,H=k.options;N.removeEventListener($,F,H)}),p=[]}function Bn(k){var N,$=!1;if(!(!b.state.isEnabled||jt(k)||l)){var F=((N=d)==null?void 0:N.type)==="focus";d=k,y=k.currentTarget,$e(),!b.state.isVisible&&$k(k)&&oo.forEach(function(H){return H(k)}),k.type==="click"&&(b.props.trigger.indexOf("mouseenter")<0||s)&&b.props.hideOnClick!==!1&&b.state.isVisible?$=!0:Ht(k),k.type==="click"&&(s=!$),$&&!F&&Bt(k)}}function hr(k){var N=k.target,$=Z().contains(N)||S.contains(N);if(!(k.type==="mousemove"&&$)){var F=Dt().concat(S).map(function(H){var K,ie=H._tippy,ce=(K=ie.popperInstance)==null?void 0:K.state;return ce?{popperRect:H.getBoundingClientRect(),popperState:ce,props:n}:null}).filter(Boolean);zk(F,k)&&(qe(),Bt(k))}}function dn(k){var N=jt(k)||b.props.trigger.indexOf("click")>=0&&s;if(!N){if(b.props.interactive){b.hideWithInteractivity(k);return}Bt(k)}}function un(k){b.props.trigger.indexOf("focusin")<0&&k.target!==Z()||b.props.interactive&&k.relatedTarget&&S.contains(k.relatedTarget)||Bt(k)}function jt(k){return Nt.isTouch?Y()!==k.type.indexOf("touch")>=0:!1}function bt(){at();var k=b.props,N=k.popperOptions,$=k.placement,F=k.offset,H=k.getReferenceClientRect,K=k.moveTransition,ie=q()?Qs(S).arrow:null,ce=H?{getBoundingClientRect:H,contextElement:H.contextElement||Z()}:t,_e={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(hn){var Vt=hn.state;if(q()){var ni=X(),ol=ni.box;["placement","reference-hidden","escaped"].forEach(function(co){co==="placement"?ol.setAttribute("data-placement",Vt.placement):Vt.attributes.popper["data-popper-"+co]?ol.setAttribute("data-"+co,""):ol.removeAttribute("data-"+co)}),Vt.attributes.popper={}}}},nt=[{name:"offset",options:{offset:F}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!K}},_e];q()&&ie&&nt.push({name:"arrow",options:{element:ie,padding:3}}),nt.push.apply(nt,(N==null?void 0:N.modifiers)||[]),b.popperInstance=Ek(ce,S,Object.assign({},N,{placement:$,onFirstUpdate:h,modifiers:nt}))}function at(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function ct(){var k=b.props.appendTo,N,$=Z();b.props.interactive&&k===du||k==="parent"?N=$.parentNode:N=uu(k,[$]),N.contains(S)||N.appendChild(S),b.state.isMounted=!0,bt(),process.env.NODE_ENV!=="production"&&Ft(b.props.interactive&&k===Qe.appendTo&&$.nextElementSibling!==S,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.",`
102
+ `,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var pM=function(){return"innerHTML"};function Nl(t,e){t[pM()]=e}function Lh(t){var e=es();return t===!0?e.className=xh:(e.className=Sh,ts(t)?e.appendChild(t):Nl(e,t)),e}function Fh(t,e){ts(e.content)?(Nl(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Nl(t,e.content):t.textContent=e.content)}function Dl(t){var e=t.firstElementChild,n=bo(e.children);return{box:e,content:n.find(function(r){return r.classList.contains(wh)}),arrow:n.find(function(r){return r.classList.contains(xh)||r.classList.contains(Sh)}),backdrop:n.find(function(r){return r.classList.contains(HS)})}}function zh(t){var e=es(),n=es();n.className=WS,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=es();r.className=wh,r.setAttribute("data-state","hidden"),Fh(r,t.props),e.appendChild(n),n.appendChild(r),i(t.props,t.props);function i(s,o){var a=Dl(e),l=a.box,c=a.content,u=a.arrow;o.theme?l.setAttribute("data-theme",o.theme):l.removeAttribute("data-theme"),typeof o.animation=="string"?l.setAttribute("data-animation",o.animation):l.removeAttribute("data-animation"),o.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?l.setAttribute("role",o.role):l.removeAttribute("role"),(s.content!==o.content||s.allowHTML!==o.allowHTML)&&Fh(c,t.props),o.arrow?u?s.arrow!==o.arrow&&(l.removeChild(u),l.appendChild(Lh(o.arrow))):l.appendChild(Lh(o.arrow)):u&&l.removeChild(u)}return{popper:e,onUpdate:i}}zh.$$tippy=!0;var mM=1,vo=[],Al=[];function gM(t,e){var n=Rh(t,Object.assign({},gt,Ih(Eh(e)))),r,i,s,o=!1,a=!1,l=!1,c=!1,u,f,h,p=[],m=Ch(hi,n.interactiveDebounce),y,g=mM++,k=null,x=KS(n.plugins),O={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},b={id:g,reference:t,popper:es(),popperInstance:k,props:n,state:O,plugins:x,clearDelayTimeouts:pi,setProps:mi,setContent:gi,show:M,hide:S,hideWithInteractivity:E,enable:Mr,disable:Qn,unmount:R,destroy:U};if(!n.render)return process.env.NODE_ENV!=="production"&&_l(!0,"render() function has not been supplied."),b;var C=n.render(b),v=C.popper,T=C.onUpdate;v.setAttribute("data-tippy-root",""),v.id="tippy-"+b.id,b.popper=v,t._tippy=b,v._tippy=b;var B=x.map(function(w){return w.fn(b)}),V=t.hasAttribute("aria-expanded");return $e(),Qe(),ie(),ue("onCreate",[b]),n.showOnCreate&&En(),v.addEventListener("mouseenter",function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()}),v.addEventListener("mouseleave",function(){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&oe().addEventListener("mousemove",m)}),b;function F(){var w=b.props.touch;return Array.isArray(w)?w:[w,0]}function te(){return F()[0]==="hold"}function G(){var w;return!!((w=b.props.render)!=null&&w.$$tippy)}function ne(){return y||t}function oe(){var w=ne().parentNode;return w?eM(w):document}function re(){return Dl(v)}function j(w){return b.state.isMounted&&!b.state.isVisible||en.isTouch||u&&u.type==="focus"?0:Ol(b.props.delay,w?0:1,gt.delay)}function ie(w){w===void 0&&(w=!1),v.style.pointerEvents=b.props.interactive&&!w?"":"none",v.style.zIndex=""+b.props.zIndex}function ue(w,D,$){if($===void 0&&($=!0),B.forEach(function(q){q[w]&&q[w].apply(q,D)}),$){var Y;(Y=b.props)[w].apply(Y,D)}}function _e(){var w=b.props.aria;if(w.content){var D="aria-"+w.content,$=v.id,Y=ti(b.props.triggerTarget||t);Y.forEach(function(q){var X=q.getAttribute(D);if(b.state.isVisible)q.setAttribute(D,X?X+" "+$:$);else{var he=X&&X.replace($,"").trim();he?q.setAttribute(D,he):q.removeAttribute(D)}})}}function Qe(){if(!(V||!b.props.aria.expanded)){var w=ti(b.props.triggerTarget||t);w.forEach(function(D){b.props.interactive?D.setAttribute("aria-expanded",b.state.isVisible&&D===ne()?"true":"false"):D.removeAttribute("aria-expanded")})}}function ct(){oe().removeEventListener("mousemove",m),vo=vo.filter(function(w){return w!==m})}function bt(w){if(!(en.isTouch&&(l||w.type==="mousedown"))){var D=w.composedPath&&w.composedPath()[0]||w.target;if(!(b.props.interactive&&Nh(v,D))){if(ti(b.props.triggerTarget||t).some(function($){return Nh($,D)})){if(en.isTouch||b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else ue("onClickOutside",[b,w]);b.props.hideOnClick===!0&&(b.clearDelayTimeouts(),b.hide(),a=!0,setTimeout(function(){a=!1}),b.state.isMounted||P())}}}function vt(){l=!0}function ke(){l=!1}function et(){var w=oe();w.addEventListener("mousedown",bt,!0),w.addEventListener("touchend",bt,yr),w.addEventListener("touchstart",ke,yr),w.addEventListener("touchmove",vt,yr)}function P(){var w=oe();w.removeEventListener("mousedown",bt,!0),w.removeEventListener("touchend",bt,yr),w.removeEventListener("touchstart",ke,yr),w.removeEventListener("touchmove",vt,yr)}function K(w,D){ae(w,function(){!b.state.isVisible&&v.parentNode&&v.parentNode.contains(v)&&D()})}function fe(w,D){ae(w,D)}function ae(w,D){var $=re().box;function Y(q){q.target===$&&(El($,"remove",Y),D())}if(w===0)return D();El($,"remove",f),El($,"add",Y),f=Y}function Re(w,D,$){$===void 0&&($=!1);var Y=ti(b.props.triggerTarget||t);Y.forEach(function(q){q.addEventListener(w,D,$),p.push({node:q,eventType:w,handler:D,options:$})})}function $e(){te()&&(Re("touchstart",Sr,{passive:!0}),Re("touchend",Zn,{passive:!0})),qS(b.props.trigger).forEach(function(w){if(w!=="manual")switch(Re(w,Sr),w){case"mouseenter":Re("mouseleave",Zn);break;case"focus":Re(oM?"focusout":"blur",Xn);break;case"focusin":Re("focusout",Xn);break}})}function dt(){p.forEach(function(w){var D=w.node,$=w.eventType,Y=w.handler,q=w.options;D.removeEventListener($,Y,q)}),p=[]}function Sr(w){var D,$=!1;if(!(!b.state.isEnabled||Tn(w)||a)){var Y=((D=u)==null?void 0:D.type)==="focus";u=w,y=w.currentTarget,Qe(),!b.state.isVisible&&ZS(w)&&vo.forEach(function(q){return q(w)}),w.type==="click"&&(b.props.trigger.indexOf("mouseenter")<0||o)&&b.props.hideOnClick!==!1&&b.state.isVisible?$=!0:En(w),w.type==="click"&&(o=!$),$&&!Y&&ln(w)}}function hi(w){var D=w.target,$=ne().contains(D)||v.contains(D);if(!(w.type==="mousemove"&&$)){var Y=an().concat(v).map(function(q){var X,he=q._tippy,Oe=(X=he.popperInstance)==null?void 0:X.state;return Oe?{popperRect:q.getBoundingClientRect(),popperState:Oe,props:n}:null}).filter(Boolean);tM(Y,w)&&(ct(),ln(w))}}function Zn(w){var D=Tn(w)||b.props.trigger.indexOf("click")>=0&&o;if(!D){if(b.props.interactive){b.hideWithInteractivity(w);return}ln(w)}}function Xn(w){b.props.trigger.indexOf("focusin")<0&&w.target!==ne()||b.props.interactive&&w.relatedTarget&&v.contains(w.relatedTarget)||ln(w)}function Tn(w){return en.isTouch?te()!==w.type.indexOf("touch")>=0:!1}function Wt(){_t();var w=b.props,D=w.popperOptions,$=w.placement,Y=w.offset,q=w.getReferenceClientRect,X=w.moveTransition,he=G()?Dl(v).arrow:null,Oe=q?{getBoundingClientRect:q,contextElement:q.contextElement||ne()}:t,tt={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(er){var cn=er.state;if(G()){var ms=re(),gc=ms.box;["placement","reference-hidden","escaped"].forEach(function(Ho){Ho==="placement"?gc.setAttribute("data-placement",cn.placement):cn.attributes.popper["data-popper-"+Ho]?gc.setAttribute("data-"+Ho,""):gc.removeAttribute("data-"+Ho)}),cn.attributes.popper={}}}},kt=[{name:"offset",options:{offset:Y}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!X}},tt];G()&&he&&kt.push({name:"arrow",options:{element:he,padding:3}}),kt.push.apply(kt,(D==null?void 0:D.modifiers)||[]),b.popperInstance=jS(Oe,v,Object.assign({},D,{placement:$,onFirstUpdate:h,modifiers:kt}))}function _t(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function Nt(){var w=b.props.appendTo,D,$=ne();b.props.interactive&&w===Mh||w==="parent"?D=$.parentNode:D=Oh(w,[$]),D.contains(v)||D.appendChild(v),b.state.isMounted=!0,Wt(),process.env.NODE_ENV!=="production"&&yn(b.props.interactive&&w===gt.appendTo&&$.nextElementSibling!==v,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.",`
103
103
 
104
104
  `,"Using a wrapper <div> or <span> tag around the reference element","solves this by creating a new parentNode context.",`
105
105
 
106
106
  `,"Specifying `appendTo: document.body` silences this warning, but it","assumes you are using a focus management solution to handle","keyboard navigation.",`
107
107
 
108
- `,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function Dt(){return io(S.querySelectorAll("[data-tippy-root]"))}function Ht(k){b.clearDelayTimeouts(),k&&ne("onTrigger",[b,k]),Re();var N=_(!0),$=L(),F=$[0],H=$[1];Nt.isTouch&&F==="hold"&&H&&(N=H),N?r=setTimeout(function(){b.show()},N):b.show()}function Bt(k){if(b.clearDelayTimeouts(),ne("onUntrigger",[b,k]),!b.state.isVisible){B();return}if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(k.type)>=0&&s)){var N=_(!1);N?i=setTimeout(function(){b.state.isVisible&&b.hide()},N):o=requestAnimationFrame(function(){b.hide()})}}function Vn(){b.state.isEnabled=!0}function fn(){b.hide(),b.state.isEnabled=!1}function pr(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(o)}function mr(k){if(process.env.NODE_ENV!=="production"&&Ft(b.state.isDestroyed,ur("setProps")),!b.state.isDestroyed){ne("onBeforeUpdate",[b,k]),Ke();var N=b.props,$=Su(t,Object.assign({},N,pu(k),{ignoreAttributes:!0}));b.props=$,xe(),N.interactiveDebounce!==$.interactiveDebounce&&(qe(),m=fu(hr,$.interactiveDebounce)),N.triggerTarget&&!$.triggerTarget?dr(N.triggerTarget).forEach(function(F){F.removeAttribute("aria-expanded")}):$.triggerTarget&&t.removeAttribute("aria-expanded"),$e(),Q(),D&&D(N,$),b.popperInstance&&(bt(),Dt().forEach(function(F){requestAnimationFrame(F._tippy.popperInstance.forceUpdate)})),ne("onAfterUpdate",[b,k])}}function gr(k){b.setProps({content:k})}function x(){process.env.NODE_ENV!=="production"&&Ft(b.state.isDestroyed,ur("show"));var k=b.state.isVisible,N=b.state.isDestroyed,$=!b.state.isEnabled,F=Nt.isTouch&&!b.props.touch,H=Ks(b.props.duration,0,Qe.duration);if(!(k||N||$||F)&&!Z().hasAttribute("disabled")&&(ne("onShow",[b],!1),b.props.onShow(b)!==!1)){if(b.state.isVisible=!0,q()&&(S.style.visibility="visible"),Q(),Re(),b.state.isMounted||(S.style.transition="none"),q()){var K=X(),ie=K.box,ce=K.content;Gs([ie,ce],0)}h=function(){var nt;if(!(!b.state.isVisible||c)){if(c=!0,S.offsetHeight,S.style.transition=b.props.moveTransition,q()&&b.props.animation){var In=X(),hn=In.box,Vt=In.content;Gs([hn,Vt],H),mu([hn,Vt],"visible")}pe(),$e(),hu(el,b),(nt=b.popperInstance)==null||nt.forceUpdate(),ne("onMount",[b]),b.props.animation&&q()&&re(H,function(){b.state.isShown=!0,ne("onShown",[b])})}},ct()}}function w(){process.env.NODE_ENV!=="production"&&Ft(b.state.isDestroyed,ur("hide"));var k=!b.state.isVisible,N=b.state.isDestroyed,$=!b.state.isEnabled,F=Ks(b.props.duration,1,Qe.duration);if(!(k||N||$)&&(ne("onHide",[b],!1),b.props.onHide(b)!==!1)){if(b.state.isVisible=!1,b.state.isShown=!1,c=!1,s=!1,q()&&(S.style.visibility="hidden"),qe(),B(),Q(!0),q()){var H=X(),K=H.box,ie=H.content;b.props.animation&&(Gs([K,ie],F),mu([K,ie],"hidden"))}pe(),$e(),b.props.animation?q()&&W(F,b.unmount):b.unmount()}}function E(k){process.env.NODE_ENV!=="production"&&Ft(b.state.isDestroyed,ur("hideWithInteractivity")),ee().addEventListener("mousemove",m),hu(oo,m),m(k)}function P(){process.env.NODE_ENV!=="production"&&Ft(b.state.isDestroyed,ur("unmount")),b.state.isVisible&&b.hide(),b.state.isMounted&&(at(),Dt().forEach(function(k){k._tippy.unmount()}),S.parentNode&&S.parentNode.removeChild(S),el=el.filter(function(k){return k!==b}),b.state.isMounted=!1,ne("onHidden",[b]))}function j(){process.env.NODE_ENV!=="production"&&Ft(b.state.isDestroyed,ur("destroy")),!b.state.isDestroyed&&(b.clearDelayTimeouts(),b.unmount(),Ke(),delete t._tippy,b.state.isDestroyed=!0,ne("onDestroy",[b]))}}function fr(t,e){e===void 0&&(e={});var n=Qe.plugins.concat(e.plugins||[]);process.env.NODE_ENV!=="production"&&(Jk(t),Cu(e,n)),Hk();var r=Object.assign({},e,{plugins:n}),i=_k(t);if(process.env.NODE_ENV!=="production"){var o=ei(r.content),s=i.length>1;Ft(o&&s,["tippy() was passed an Element as the `content` prop, but more than","one tippy instance was created by this invocation. This means the","content element will only be appended to the last tippy instance.",`
108
+ `,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function an(){return bo(v.querySelectorAll("[data-tippy-root]"))}function En(w){b.clearDelayTimeouts(),w&&ue("onTrigger",[b,w]),et();var D=j(!0),$=F(),Y=$[0],q=$[1];en.isTouch&&Y==="hold"&&q&&(D=q),D?r=setTimeout(function(){b.show()},D):b.show()}function ln(w){if(b.clearDelayTimeouts(),ue("onUntrigger",[b,w]),!b.state.isVisible){P();return}if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(w.type)>=0&&o)){var D=j(!1);D?i=setTimeout(function(){b.state.isVisible&&b.hide()},D):s=requestAnimationFrame(function(){b.hide()})}}function Mr(){b.state.isEnabled=!0}function Qn(){b.hide(),b.state.isEnabled=!1}function pi(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(s)}function mi(w){if(process.env.NODE_ENV!=="production"&&yn(b.state.isDestroyed,ni("setProps")),!b.state.isDestroyed){ue("onBeforeUpdate",[b,w]),dt();var D=b.props,$=Rh(t,Object.assign({},D,Eh(w),{ignoreAttributes:!0}));b.props=$,$e(),D.interactiveDebounce!==$.interactiveDebounce&&(ct(),m=Ch(hi,$.interactiveDebounce)),D.triggerTarget&&!$.triggerTarget?ti(D.triggerTarget).forEach(function(Y){Y.removeAttribute("aria-expanded")}):$.triggerTarget&&t.removeAttribute("aria-expanded"),Qe(),ie(),T&&T(D,$),b.popperInstance&&(Wt(),an().forEach(function(Y){requestAnimationFrame(Y._tippy.popperInstance.forceUpdate)})),ue("onAfterUpdate",[b,w])}}function gi(w){b.setProps({content:w})}function M(){process.env.NODE_ENV!=="production"&&yn(b.state.isDestroyed,ni("show"));var w=b.state.isVisible,D=b.state.isDestroyed,$=!b.state.isEnabled,Y=en.isTouch&&!b.props.touch,q=Ol(b.props.duration,0,gt.duration);if(!(w||D||$||Y)&&!ne().hasAttribute("disabled")&&(ue("onShow",[b],!1),b.props.onShow(b)!==!1)){if(b.state.isVisible=!0,G()&&(v.style.visibility="visible"),ie(),et(),b.state.isMounted||(v.style.transition="none"),G()){var X=re(),he=X.box,Oe=X.content;Tl([he,Oe],0)}h=function(){var kt;if(!(!b.state.isVisible||c)){if(c=!0,v.offsetHeight,v.style.transition=b.props.moveTransition,G()&&b.props.animation){var Or=re(),er=Or.box,cn=Or.content;Tl([er,cn],q),_h([er,cn],"visible")}_e(),Qe(),Th(Al,b),(kt=b.popperInstance)==null||kt.forceUpdate(),ue("onMount",[b]),b.props.animation&&G()&&fe(q,function(){b.state.isShown=!0,ue("onShown",[b])})}},Nt()}}function S(){process.env.NODE_ENV!=="production"&&yn(b.state.isDestroyed,ni("hide"));var w=!b.state.isVisible,D=b.state.isDestroyed,$=!b.state.isEnabled,Y=Ol(b.props.duration,1,gt.duration);if(!(w||D||$)&&(ue("onHide",[b],!1),b.props.onHide(b)!==!1)){if(b.state.isVisible=!1,b.state.isShown=!1,c=!1,o=!1,G()&&(v.style.visibility="hidden"),ct(),P(),ie(!0),G()){var q=re(),X=q.box,he=q.content;b.props.animation&&(Tl([X,he],Y),_h([X,he],"hidden"))}_e(),Qe(),b.props.animation?G()&&K(Y,b.unmount):b.unmount()}}function E(w){process.env.NODE_ENV!=="production"&&yn(b.state.isDestroyed,ni("hideWithInteractivity")),oe().addEventListener("mousemove",m),Th(vo,m),m(w)}function R(){process.env.NODE_ENV!=="production"&&yn(b.state.isDestroyed,ni("unmount")),b.state.isVisible&&b.hide(),b.state.isMounted&&(_t(),an().forEach(function(w){w._tippy.unmount()}),v.parentNode&&v.parentNode.removeChild(v),Al=Al.filter(function(w){return w!==b}),b.state.isMounted=!1,ue("onHidden",[b]))}function U(){process.env.NODE_ENV!=="production"&&yn(b.state.isDestroyed,ni("destroy")),!b.state.isDestroyed&&(b.clearDelayTimeouts(),b.unmount(),dt(),delete t._tippy,b.state.isDestroyed=!0,ue("onDestroy",[b]))}}function ri(t,e){e===void 0&&(e={});var n=gt.plugins.concat(e.plugins||[]);process.env.NODE_ENV!=="production"&&(cM(t),$h(e,n)),iM();var r=Object.assign({},e,{plugins:n}),i=QS(t);if(process.env.NODE_ENV!=="production"){var s=ts(r.content),o=i.length>1;yn(s&&o,["tippy() was passed an Element as the `content` prop, but more than","one tippy instance was created by this invocation. This means the","content element will only be appended to the last tippy instance.",`
109
109
 
110
110
  `,"Instead, pass the .innerHTML of the element, or use a function that","returns a cloned version of the element instead.",`
111
111
 
112
112
  `,`1) content: element.innerHTML
113
- `,"2) content: () => element.cloneNode(true)"].join(" "))}var l=i.reduce(function(a,c){var d=c&&tw(c,r);return d&&a.push(d),a},[]);return ei(t)?l[0]:l}fr.defaultProps=Qe,fr.setDefaultProps=Zk,fr.currentInput=Nt,Object.assign({},Ud,{effect:function(e){var n=e.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}}),fr.setDefaultProps({render:Eu});class nw{constructor({editor:e,element:n,view:r,tippyOptions:i={},updateDelay:o=250,shouldShow:s}){this.preventHide=!1,this.shouldShow=({view:l,state:a,from:c,to:d})=>{const{doc:f,selection:h}=a,{empty:p}=h,m=!f.textBetween(c,d).length&&Ds(a.selection),y=this.element.contains(document.activeElement);return!(!(l.hasFocus()||y)||p||m||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:l})=>{var a;if(this.preventHide){this.preventHide=!1;return}l!=null&&l.relatedTarget&&(!((a=this.element.parentNode)===null||a===void 0)&&a.contains(l.relatedTarget))||this.hide()},this.tippyBlurHandler=l=>{this.blurHandler({event:l})},this.handleDebouncedUpdate=(l,a)=>{const c=!(a!=null&&a.selection.eq(l.state.selection)),d=!(a!=null&&a.doc.eq(l.state.doc));!c&&!d||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(l,c,d,a)},this.updateDelay))},this.updateHandler=(l,a,c,d)=>{var f,h,p;const{state:m,composing:y}=l,{selection:g}=m;if(y||!a&&!c)return;this.createTooltip();const{ranges:C}=g,M=Math.min(...C.map(S=>S.$from.pos)),b=Math.max(...C.map(S=>S.$to.pos));if(!((f=this.shouldShow)===null||f===void 0?void 0:f.call(this,{editor:this.editor,view:l,state:m,oldState:d,from:M,to:b}))){this.hide();return}(h=this.tippy)===null||h===void 0||h.setProps({getReferenceClientRect:((p=this.tippyOptions)===null||p===void 0?void 0:p.getReferenceClientRect)||(()=>{if(r1(m.selection)){let S=l.nodeDOM(M);const D=S.dataset.nodeViewWrapper?S:S.querySelector("[data-node-view-wrapper]");if(D&&(S=D.firstChild),S)return S.getBoundingClientRect()}return zd(l,M,b)})}),this.show()},this.editor=e,this.element=n,this.view=r,this.updateDelay=o,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=fr(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){const{state:r}=e,i=r.selection.$from.pos!==r.selection.$to.pos;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(e,n);return}const o=!(n!=null&&n.selection.eq(e.state.selection)),s=!(n!=null&&n.doc.eq(e.state.doc));this.updateHandler(e,o,s,n)}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const Tu=t=>new De({key:typeof t.pluginKey=="string"?new pt(t.pluginKey):t.pluginKey,view:e=>new nw({view:e,...t})});Ne.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Tu({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});class rw{constructor({editor:e,element:n,view:r,tippyOptions:i={},shouldShow:o}){this.preventHide=!1,this.shouldShow=({view:s,state:l})=>{const{selection:a}=l,{$anchor:c,empty:d}=a,f=c.depth===1,h=c.parent.isTextblock&&!c.parent.type.spec.code&&!c.parent.textContent;return!(!s.hasFocus()||!d||!f||!h||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:s})=>{var l;if(this.preventHide){this.preventHide=!1;return}s!=null&&s.relatedTarget&&(!((l=this.element.parentNode)===null||l===void 0)&&l.contains(s.relatedTarget))||this.hide()},this.tippyBlurHandler=s=>{this.blurHandler({event:s})},this.editor=e,this.element=n,this.view=r,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=fr(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"right",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){var r,i,o;const{state:s}=e,{doc:l,selection:a}=s,{from:c,to:d}=a;if(n&&n.doc.eq(l)&&n.selection.eq(a))return;if(this.createTooltip(),!((r=this.shouldShow)===null||r===void 0?void 0:r.call(this,{editor:this.editor,view:e,state:s,oldState:n}))){this.hide();return}(i=this.tippy)===null||i===void 0||i.setProps({getReferenceClientRect:((o=this.tippyOptions)===null||o===void 0?void 0:o.getReferenceClientRect)||(()=>zd(e,c,d))}),this.show()}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const Nu=t=>new De({key:typeof t.pluginKey=="string"?new pt(t.pluginKey):t.pluginKey,view:e=>new rw({view:e,...t})});Ne.create({name:"floatingMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Nu({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}}),u.defineComponent({name:"BubbleMenu",props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(t,{slots:e}){const n=u.ref(null);return u.onMounted(()=>{const{updateDelay:r,editor:i,pluginKey:o,shouldShow:s,tippyOptions:l}=t;i.registerPlugin(Tu({updateDelay:r,editor:i,element:n.value,pluginKey:o,shouldShow:s,tippyOptions:l}))}),u.onBeforeUnmount(()=>{const{pluginKey:r,editor:i}=t;i.unregisterPlugin(r)}),()=>{var r;return u.h("div",{ref:n},(r=e.default)===null||r===void 0?void 0:r.call(e))}}});function Au(t){return u.customRef((e,n)=>({get(){return e(),t},set(r){t=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}class iw extends w1{constructor(e={}){return super(e),this.vueRenderers=u.reactive(new Map),this.contentComponent=null,this.reactiveState=Au(this.view.state),this.reactiveExtensionStorage=Au(this.extensionStorage),this.on("transaction",()=>{this.reactiveState.value=this.view.state,this.reactiveExtensionStorage.value=this.extensionStorage}),u.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,n){super.registerPlugin(e,n),this.reactiveState.value=this.view.state}unregisterPlugin(e){super.unregisterPlugin(e),this.reactiveState.value=this.view.state}}const ow=u.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(t){const e=u.ref(),n=u.getCurrentInstance();return u.watchEffect(()=>{const r=t.editor;r&&r.options.element&&e.value&&u.nextTick(()=>{if(!e.value||!r.options.element.firstChild)return;const i=u.unref(e.value);e.value.append(...r.options.element.childNodes),r.contentComponent=n.ctx._,r.setOptions({element:i}),r.createNodeViews()})}),u.onBeforeUnmount(()=>{const r=t.editor;if(!r||(r.isDestroyed||r.view.setProps({nodeViews:{}}),r.contentComponent=null,!r.options.element.firstChild))return;const i=document.createElement("div");i.append(...r.options.element.childNodes),r.setOptions({element:i})}),{rootEl:e}},render(){const t=[];return this.editor&&this.editor.vueRenderers.forEach(e=>{const n=u.h(u.Teleport,{to:e.teleportElement,key:e.id},u.h(e.component,{ref:e.id,...e.props}));t.push(n)}),u.h("div",{ref:e=>{this.rootEl=e}},...t)}});u.defineComponent({name:"FloatingMenu",props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(t,{slots:e}){const n=u.ref(null);return u.onMounted(()=>{const{pluginKey:r,editor:i,tippyOptions:o,shouldShow:s}=t;i.registerPlugin(Nu({pluginKey:r,editor:i,element:n.value,tippyOptions:o,shouldShow:s}))}),u.onBeforeUnmount(()=>{const{pluginKey:r,editor:i}=t;i.unregisterPlugin(r)}),()=>{var r;return u.h("div",{ref:n},(r=e.default)===null||r===void 0?void 0:r.call(e))}}}),u.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return u.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),u.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var t,e;return u.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(t=this.$slots).default)===null||e===void 0?void 0:e.call(t))}});const sw=(t={})=>{const e=u.shallowRef();return u.onMounted(()=>{e.value=new iw(t)}),u.onBeforeUnmount(()=>{var n;(n=e.value)===null||n===void 0||n.destroy()}),e},lw=/^\s*>\s$/,aw=Ze.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",me(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Ur({find:lw,type:this.type})]}}),cw=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,dw=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,uw=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,fw=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,hw=Mt.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",me(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[ir({find:cw,type:this.type}),ir({find:uw,type:this.type})]},addPasteRules(){return[or({find:dw,type:this.type}),or({find:fw,type:this.type})]}}),pw=Ze.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",me(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Du=Mt.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",me(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const n=Xi(t,this.type);return Object.entries(n).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),Bu=/^\s*([-+*])\s$/,mw=Ze.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",me(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(pw.name,this.editor.getAttributes(Du.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Ur({find:Bu,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ur({find:Bu,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Du.name),editor:this.editor})),[t]}}),gw=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/,yw=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g,bw=Mt.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",me(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[ir({find:gw,type:this.type})]},addPasteRules(){return[or({find:yw,type:this.type})]}}),vw=/^```([a-z]+)?[\s\n]$/,kw=/^~~~([a-z]+)?[\s\n]$/,ww=Ze.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:null,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options,o=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(s=>s.startsWith(n)).map(s=>s.replace(n,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",me(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const o=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(`
113
+ `,"2) content: () => element.cloneNode(true)"].join(" "))}var a=i.reduce(function(l,c){var u=c&&gM(c,r);return u&&l.push(u),l},[]);return ts(t)?a[0]:a}ri.defaultProps=gt,ri.setDefaultProps=fM,ri.currentInput=en,Object.assign({},sh,{effect:function(e){var n=e.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}}),ri.setDefaultProps({render:zh});class yM{constructor({editor:e,element:n,view:r,tippyOptions:i={},updateDelay:s=250,shouldShow:o}){this.preventHide=!1,this.shouldShow=({view:a,state:l,from:c,to:u})=>{const{doc:f,selection:h}=l,{empty:p}=h,m=!f.textBetween(c,u).length&&cl(l.selection),y=this.element.contains(document.activeElement);return!(!(a.hasFocus()||y)||p||m||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:a})=>{var l;if(this.preventHide){this.preventHide=!1;return}a!=null&&a.relatedTarget&&(!((l=this.element.parentNode)===null||l===void 0)&&l.contains(a.relatedTarget))||this.hide()},this.tippyBlurHandler=a=>{this.blurHandler({event:a})},this.handleDebouncedUpdate=(a,l)=>{const c=!(l!=null&&l.selection.eq(a.state.selection)),u=!(l!=null&&l.doc.eq(a.state.doc));!c&&!u||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(a,c,u,l)},this.updateDelay))},this.updateHandler=(a,l,c,u)=>{var f,h,p;const{state:m,composing:y}=a,{selection:g}=m;if(y||!l&&!c)return;this.createTooltip();const{ranges:x}=g,O=Math.min(...x.map(v=>v.$from.pos)),b=Math.max(...x.map(v=>v.$to.pos));if(!((f=this.shouldShow)===null||f===void 0?void 0:f.call(this,{editor:this.editor,view:a,state:m,oldState:u,from:O,to:b}))){this.hide();return}(h=this.tippy)===null||h===void 0||h.setProps({getReferenceClientRect:((p=this.tippyOptions)===null||p===void 0?void 0:p.getReferenceClientRect)||(()=>{if(bx(m.selection)){let v=a.nodeDOM(O);const T=v.dataset.nodeViewWrapper?v:v.querySelector("[data-node-view-wrapper]");if(T&&(v=T.firstChild),v)return v.getBoundingClientRect()}return eh(a,O,b)})}),this.show()},this.editor=e,this.element=n,this.view=r,this.updateDelay=s,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=ri(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){const{state:r}=e,i=r.selection.$from.pos!==r.selection.$to.pos;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(e,n);return}const s=!(n!=null&&n.selection.eq(e.state.selection)),o=!(n!=null&&n.doc.eq(e.state.doc));this.updateHandler(e,s,o,n)}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const jh=t=>new Ke({key:typeof t.pluginKey=="string"?new Pt(t.pluginKey):t.pluginKey,view:e=>new yM({view:e,...t})});Ye.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[jh({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});class bM{constructor({editor:e,element:n,view:r,tippyOptions:i={},shouldShow:s}){this.preventHide=!1,this.shouldShow=({view:o,state:a})=>{const{selection:l}=a,{$anchor:c,empty:u}=l,f=c.depth===1,h=c.parent.isTextblock&&!c.parent.type.spec.code&&!c.parent.textContent;return!(!o.hasFocus()||!u||!f||!h||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:o})=>{var a;if(this.preventHide){this.preventHide=!1;return}o!=null&&o.relatedTarget&&(!((a=this.element.parentNode)===null||a===void 0)&&a.contains(o.relatedTarget))||this.hide()},this.tippyBlurHandler=o=>{this.blurHandler({event:o})},this.editor=e,this.element=n,this.view=r,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=ri(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"right",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){var r,i,s;const{state:o}=e,{doc:a,selection:l}=o,{from:c,to:u}=l;if(n&&n.doc.eq(a)&&n.selection.eq(l))return;if(this.createTooltip(),!((r=this.shouldShow)===null||r===void 0?void 0:r.call(this,{editor:this.editor,view:e,state:o,oldState:n}))){this.hide();return}(i=this.tippy)===null||i===void 0||i.setProps({getReferenceClientRect:((s=this.tippyOptions)===null||s===void 0?void 0:s.getReferenceClientRect)||(()=>eh(e,c,u))}),this.show()}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const Wh=t=>new Ke({key:typeof t.pluginKey=="string"?new Pt(t.pluginKey):t.pluginKey,view:e=>new bM({view:e,...t})});Ye.create({name:"floatingMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Wh({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}}),d.defineComponent({name:"BubbleMenu",props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(t,{slots:e}){const n=d.ref(null);return d.onMounted(()=>{const{updateDelay:r,editor:i,pluginKey:s,shouldShow:o,tippyOptions:a}=t;i.registerPlugin(jh({updateDelay:r,editor:i,element:n.value,pluginKey:s,shouldShow:o,tippyOptions:a}))}),d.onBeforeUnmount(()=>{const{pluginKey:r,editor:i}=t;i.unregisterPlugin(r)}),()=>{var r;return d.h("div",{ref:n},(r=e.default)===null||r===void 0?void 0:r.call(e))}}});function Hh(t){return d.customRef((e,n)=>({get(){return e(),t},set(r){t=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}class vM extends Ix{constructor(e={}){return super(e),this.vueRenderers=d.reactive(new Map),this.contentComponent=null,this.reactiveState=Hh(this.view.state),this.reactiveExtensionStorage=Hh(this.extensionStorage),this.on("transaction",()=>{this.reactiveState.value=this.view.state,this.reactiveExtensionStorage.value=this.extensionStorage}),d.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,n){super.registerPlugin(e,n),this.reactiveState.value=this.view.state}unregisterPlugin(e){super.unregisterPlugin(e),this.reactiveState.value=this.view.state}}const kM=d.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(t){const e=d.ref(),n=d.getCurrentInstance();return d.watchEffect(()=>{const r=t.editor;r&&r.options.element&&e.value&&d.nextTick(()=>{if(!e.value||!r.options.element.firstChild)return;const i=d.unref(e.value);e.value.append(...r.options.element.childNodes),r.contentComponent=n.ctx._,r.setOptions({element:i}),r.createNodeViews()})}),d.onBeforeUnmount(()=>{const r=t.editor;if(!r||(r.isDestroyed||r.view.setProps({nodeViews:{}}),r.contentComponent=null,!r.options.element.firstChild))return;const i=document.createElement("div");i.append(...r.options.element.childNodes),r.setOptions({element:i})}),{rootEl:e}},render(){const t=[];return this.editor&&this.editor.vueRenderers.forEach(e=>{const n=d.h(d.Teleport,{to:e.teleportElement,key:e.id},d.h(e.component,{ref:e.id,...e.props}));t.push(n)}),d.h("div",{ref:e=>{this.rootEl=e}},...t)}});d.defineComponent({name:"FloatingMenu",props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(t,{slots:e}){const n=d.ref(null);return d.onMounted(()=>{const{pluginKey:r,editor:i,tippyOptions:s,shouldShow:o}=t;i.registerPlugin(Wh({pluginKey:r,editor:i,element:n.value,tippyOptions:s,shouldShow:o}))}),d.onBeforeUnmount(()=>{const{pluginKey:r,editor:i}=t;i.unregisterPlugin(r)}),()=>{var r;return d.h("div",{ref:n},(r=e.default)===null||r===void 0?void 0:r.call(e))}}}),d.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return d.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),d.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var t,e;return d.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(t=this.$slots).default)===null||e===void 0?void 0:e.call(t))}});const wM=(t={})=>{const e=d.shallowRef();return d.onMounted(()=>{e.value=new vM(t)}),d.onBeforeUnmount(()=>{var n;(n=e.value)===null||n===void 0||n.destroy()}),e},xM=/^\s*>\s$/,SM=pt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Ui({find:xM,type:this.type})]}}),MM=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,OM=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,CM=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,TM=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,EM=Zt.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Jr({find:MM,type:this.type}),Jr({find:CM,type:this.type})]},addPasteRules(){return[Gr({find:OM,type:this.type}),Gr({find:TM,type:this.type})]}}),_M=pt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ne(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Yh=Zt.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const n=fo(t,this.type);return Object.entries(n).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),Uh=/^\s*([-+*])\s$/,NM=pt.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(_M.name,this.editor.getAttributes(Yh.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Ui({find:Uh,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ui({find:Uh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Yh.name),editor:this.editor})),[t]}}),DM=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/,AM=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g,VM=Zt.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Jr({find:DM,type:this.type})]},addPasteRules(){return[Gr({find:AM,type:this.type})]}}),BM=/^```([a-z]+)?[\s\n]$/,PM=/^~~~([a-z]+)?[\s\n]$/,IM=pt.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:null,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options,s=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Ne(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
114
114
 
115
- `);return!o||!s?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const l=i.after();return l===void 0||r.nodeAt(l)?!1:t.commands.exitCode()}}},addInputRules(){return[Rs({find:vw,type:this.type,getAttributes:t=>({language:t[1]})}),Rs({find:kw,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new De({key:new pt("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=i==null?void 0:i.mode;if(!n||!o)return!1;const{tr:s}=t.state;return t.state.selection.from===t.state.doc.nodeSize-(1+t.state.selection.$to.depth*2)?s.insert(t.state.selection.from-1,this.type.create({language:o})):s.replaceSelectionWith(this.type.create({language:o})),s.setSelection(U.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.insertText(n.replace(/\r\n?/g,`
116
- `)),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}}),xw=Ze.create({name:"doc",topNode:!0,content:"block+"});function Sw(t={}){return new De({view(e){return new Cw(e,t)}})}class Cw{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}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 l=e.nodeBefore,a=e.nodeAfter;if(l||a){let c=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(c){let d=c.getBoundingClientRect(),f=l?d.bottom:d.top;l&&a&&(f=(f+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:d.left,right:d.right,top:f-this.width/2,bottom:f+this.width/2}}}}if(!r){let l=this.editorView.coordsAtPos(this.cursorPos);r={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}let i=this.editorView.dom.offsetParent;this.element||(this.element=i.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 o,s;if(!i||i==document.body&&getComputedStyle(i).position=="static")o=-pageXOffset,s=-pageYOffset;else{let l=i.getBoundingClientRect();o=l.left-i.scrollLeft,s=l.top-i.scrollTop}this.element.style.left=r.left-o+"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),i=r&&r.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!o){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=qa(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}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)}}const Ow=Ne.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Sw(this.options)]}});class ae extends J{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return ae.valid(r)?new ae(r):J.near(r)}content(){return I.empty}eq(e){return e instanceof ae&&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 ae(e.resolve(n.pos))}getBookmark(){return new tl(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!Mw(e)||!Ew(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&ae.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let l=e.node(s);if(n>0?e.indexAfter(s)<l.childCount:e.index(s)>0){o=l.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=n;let a=e.doc.resolve(i);if(ae.valid(a))return a}for(;;){let s=n>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!z.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*n),r=!1;continue e}break}o=s,i+=n;let l=e.doc.resolve(i);if(ae.valid(l))return l}return null}}}ae.prototype.visible=!1,ae.findFrom=ae.findGapCursorFrom,J.jsonID("gapcursor",ae);class tl{constructor(e){this.pos=e}map(e){return new tl(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ae.valid(n)?new ae(n):J.near(n)}}function Mw(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function Ew(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function Tw(){return new De({props:{decorations:Bw,createSelectionBetween(t,e,n){return e.pos==n.pos&&ae.valid(n)?new ae(n):null},handleClick:Aw,handleKeyDown:Nw,handleDOMEvents:{beforeinput:Dw}}})}const Nw=yd({ArrowLeft:so("horiz",-1),ArrowRight:so("horiz",1),ArrowUp:so("vert",-1),ArrowDown:so("vert",1)});function so(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof U){if(!o.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=ae.findGapCursorFrom(l,e,a);return c?(i&&i(r.tr.setSelection(new ae(c))),!0):!1}}function Aw(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!ae.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&z.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ae(r))),!0)}function Dw(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ae))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=T.empty;for(let s=r.length-1;s>=0;s--)i=T.from(r[s].createAndFill(null,i));let o=t.state.tr.replace(n.pos,n.pos,new I(i,0,0));return o.setSelection(U.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function Bw(t){if(!(t.selection instanceof ae))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",he.create(t.doc,[Ye.widget(t.selection.head,e,{key:"gapcursor"})])}const Vw=Ne.create({name:"gapCursor",addProseMirrorPlugins(){return[Tw()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=G(R(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),Iw=Ze.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",me(this.options.HTMLAttributes,t)]},renderText(){return`
117
- `},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:o}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:l}=r.extensionManager,a=o||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&a&&s){const f=a.filter(h=>l.includes(h.type.name));c.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Pw=Ze.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,me(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Rs({find:new RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var lo=200,ke=function(){};ke.prototype.append=function(e){return e.length?(e=ke.from(e),!this.length&&e||e.length<lo&&this.leafAppend(e)||this.length<lo&&e.leafPrepend(this)||this.appendInner(e)):this},ke.prototype.prepend=function(e){return e.length?ke.from(e).append(this):this},ke.prototype.appendInner=function(e){return new $w(this,e)},ke.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?ke.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))},ke.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},ke.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)},ke.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},n,r),i},ke.from=function(e){return e instanceof ke?e:e&&e.length?new Vu(e):ke.empty};var Vu=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,l){for(var a=o;a<s;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,l){for(var a=o-1;a>=s;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=lo)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=lo)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(ke);ke.empty=new Vu([]);var $w=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,o,s){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(o,l),s)===!1||o>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,o)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(o,l)-l,s+l)===!1||o<l&&this.left.forEachInvertedInner(r,Math.min(i,l),o,s)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(ke);const Rw=500;class yt{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;n&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,l,a,c=[],d=[];return this.items.forEach((f,h)=>{if(!f.step){i||(i=this.remapping(r,h+1),o=i.maps.length),o--,d.push(f);return}if(i){d.push(new At(f.map));let p=f.step.map(i.slice(o)),m;p&&s.maybeStep(p).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],c.push(new At(m,void 0,void 0,c.length+d.length))),o--,m&&i.appendMap(m,o)}else s.maybeStep(f.step);if(f.selection)return l=i?f.selection.map(i.slice(o)):f.selection,a=new yt(this.items.slice(0,r).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,n,r,i){let o=[],s=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let d=0;d<e.steps.length;d++){let f=e.steps[d].invert(e.docs[d]),h=new At(e.mapping.maps[d],f,n),p;(p=a&&a.merge(h))&&(h=p,d?o.pop():l=l.slice(0,l.length-1)),o.push(h),n&&(s++,n=void 0),i||(a=h)}let c=s-r.depth;return c>Lw&&(l=_w(l,c),s-=c),new yt(l.append(o),s)}remapping(e,n){let r=new Hn;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new yt(this.items.append(e.map(n=>new At(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},i);let a=n;this.items.forEach(h=>{let p=o.getMirror(--a);if(p==null)return;s=Math.min(s,p);let m=o.maps[p];if(h.step){let y=e.steps[p].invert(e.docs[p]),g=h.selection&&h.selection.map(o.slice(a+1,p));g&&l++,r.push(new At(m,y,g))}else r.push(new At(m))},i);let c=[];for(let h=n;h<s;h++)c.push(new At(o.maps[h]));let d=this.items.slice(0,i).append(c).append(r),f=new yt(d,l);return f.emptyItemCount()>Rw&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],o=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&o++;else if(s.step){let a=s.step.map(n.slice(r)),c=a&&a.getMap();if(r--,c&&n.appendMap(c,r),a){let d=s.selection&&s.selection.map(n.slice(r));d&&o++;let f=new At(c.invert(),a,d),h,p=i.length-1;(h=i.length&&i[p].merge(f))?i[p]=h:i.push(f)}}else s.map&&r--},this.items.length,0),new yt(ke.from(i.reverse()),o)}}yt.empty=new yt(ke.empty,0);function _w(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class At{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new At(n.getMap().invert(),n,this.selection)}}}class cn{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const Lw=20;function zw(t,e,n,r){let i=n.getMeta(Dn),o;if(i)return i.historyState;n.getMeta(Hw)&&(t=new cn(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(Dn))return s.getMeta(Dn).redo?new cn(t.done.addTransform(n,void 0,r,ao(e)),t.undone,Iu(n.mapping.maps[n.steps.length-1]),t.prevTime,t.prevComposition):new cn(t.done,t.undone.addTransform(n,void 0,r,ao(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!s&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!Fw(n,t.prevRanges)),c=s?nl(t.prevRanges,n.mapping):Iu(n.mapping.maps[n.steps.length-1]);return new cn(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,ao(e)),yt.empty,c,n.time,l??t.prevComposition)}else return(o=n.getMeta("rebased"))?new cn(t.done.rebased(n,o),t.undone.rebased(n,o),nl(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new cn(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),nl(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Fw(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(n=!0)}),n}function Iu(t){let e=[];return t.forEach((n,r,i,o)=>e.push(i,o)),e}function nl(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),o=e.map(t[r+1],-1);i<=o&&n.push(i,o)}return n}function jw(t,e,n){let r=ao(e),i=Dn.get(e).spec.config,o=(n?t.undone:t.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(n?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),a=new cn(n?l:o.remaining,n?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(Dn,{redo:n,historyState:a})}let rl=!1,Pu=null;function ao(t){let e=t.plugins;if(Pu!=e){rl=!1,Pu=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){rl=!0;break}}return rl}const Dn=new pt("history"),Hw=new pt("closeHistory");function Ww(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new De({key:Dn,state:{init(){return new cn(yt.empty,yt.empty,null,0,-1)},apply(e,n,r){return zw(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?Ru:r=="historyRedo"?_u:null;return i?(n.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function $u(t,e){return(n,r)=>{let i=Dn.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let o=jw(i,n,t);o&&r(e?o.scrollIntoView():o)}return!0}}const Ru=$u(!1,!0),_u=$u(!0,!0),Uw=Ne.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Ru(t,e),redo:()=>({state:t,dispatch:e})=>_u(t,e)}},addProseMirrorPlugins(){return[Ww(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),qw=Ze.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",me(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{const{$to:n}=e.selection,r=t();return n.parentOffset===0?r.insertContentAt(Math.max(n.pos-2,0),{type:this.name}):r.insertContent({type:this.name}),r.command(({tr:i,dispatch:o})=>{var s;if(o){const{$to:l}=i.selection,a=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?i.setSelection(U.create(i.doc,l.pos+1)):l.nodeAfter.isBlock?i.setSelection(z.create(i.doc,l.pos)):i.setSelection(U.create(i.doc,l.pos));else{const c=(s=l.parent.type.contentMatch.defaultType)===null||s===void 0?void 0:s.create();c&&(i.insert(a,c),i.setSelection(U.create(i.doc,a+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[x1({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Kw=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Jw=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Gw=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Yw=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Zw=Mt.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",me(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[ir({find:Kw,type:this.type}),ir({find:Gw,type:this.type})]},addPasteRules(){return[or({find:Jw,type:this.type}),or({find:Yw,type:this.type})]}}),Xw=Ze.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",me(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Qw=Ze.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",me(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Lu=Mt.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",me(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const n=Xi(t,this.type);return Object.entries(n).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),zu=/^(\d+)\.\s$/,ex=Ze.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",me(this.options.HTMLAttributes,n),0]:["ol",me(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Qw.name,this.editor.getAttributes(Lu.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Ur({find:zu,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ur({find:zu,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Lu.name)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),tx=Ze.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",me(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),nx=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,rx=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,ix=Mt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",me(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[ir({find:nx,type:this.type})]},addPasteRules(){return[or({find:rx,type:this.type})]}}),ox=Ze.create({name:"text",group:"inline"}),sx=Ne.create({name:"starterKit",addExtensions(){var t,e,n,r,i,o,s,l,a,c,d,f,h,p,m,y,g,v;const C=[];return this.options.blockquote!==!1&&C.push(aw.configure((t=this.options)===null||t===void 0?void 0:t.blockquote)),this.options.bold!==!1&&C.push(hw.configure((e=this.options)===null||e===void 0?void 0:e.bold)),this.options.bulletList!==!1&&C.push(mw.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&C.push(bw.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&C.push(ww.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&C.push(xw.configure((o=this.options)===null||o===void 0?void 0:o.document)),this.options.dropcursor!==!1&&C.push(Ow.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&C.push(Vw.configure((l=this.options)===null||l===void 0?void 0:l.gapcursor)),this.options.hardBreak!==!1&&C.push(Iw.configure((a=this.options)===null||a===void 0?void 0:a.hardBreak)),this.options.heading!==!1&&C.push(Pw.configure((c=this.options)===null||c===void 0?void 0:c.heading)),this.options.history!==!1&&C.push(Uw.configure((d=this.options)===null||d===void 0?void 0:d.history)),this.options.horizontalRule!==!1&&C.push(qw.configure((f=this.options)===null||f===void 0?void 0:f.horizontalRule)),this.options.italic!==!1&&C.push(Zw.configure((h=this.options)===null||h===void 0?void 0:h.italic)),this.options.listItem!==!1&&C.push(Xw.configure((p=this.options)===null||p===void 0?void 0:p.listItem)),this.options.orderedList!==!1&&C.push(ex.configure((m=this.options)===null||m===void 0?void 0:m.orderedList)),this.options.paragraph!==!1&&C.push(tx.configure((y=this.options)===null||y===void 0?void 0:y.paragraph)),this.options.strike!==!1&&C.push(ix.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&C.push(ox.configure((v=this.options)===null||v===void 0?void 0:v.text)),C}}),lx=Ne.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,considerAnyAsEmpty:!1,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new De({key:new pt("placeholder"),props:{decorations:({doc:t,selection:e})=>{var n;const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=e,o=[];if(!r)return null;const{firstChild:s}=t.content,l=s&&s.type.isLeaf,a=s&&s.isAtom,c=this.options.considerAnyAsEmpty?!0:s&&s.type.name===((n=t.type.contentMatch.defaultType)===null||n===void 0?void 0:n.name),d=t.content.childCount<=1&&s&&c&&s.nodeSize<=2&&(!l||!a);return t.descendants((f,h)=>{const p=i>=h&&i<=h+f.nodeSize,m=!f.isLeaf&&!f.childCount;if((p||!this.options.showOnlyCurrent)&&m){const y=[this.options.emptyNodeClass];d&&y.push(this.options.emptyEditorClass);const g=Ye.node(h,h+f.nodeSize,{class:y.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:f,pos:h,hasAnchor:p}):this.options.placeholder});o.push(g)}return this.options.includeChildren}),he.create(t,o)}}})]}}),ax={},cx={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},dx=[u.createElementVNode("path",{d:"M3 4.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM6.25 3a.75.75 0 0 0 0 1.5h7a.75.75 0 0 0 0-1.5h-7ZM6.25 7.25a.75.75 0 0 0 0 1.5h7a.75.75 0 0 0 0-1.5h-7ZM6.25 11.5a.75.75 0 0 0 0 1.5h7a.75.75 0 0 0 0-1.5h-7ZM4 12.25a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM3 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"},null,-1)];function ux(t,e){return u.openBlock(),u.createElementBlock("svg",cx,dx)}const fx=ue(ax,[["render",ux]]),hx={},px={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},mx=[u.createElementVNode("path",{"fill-rule":"evenodd",d:"M12.5 9.75A2.75 2.75 0 0 0 9.75 7H4.56l2.22 2.22a.75.75 0 1 1-1.06 1.06l-3.5-3.5a.75.75 0 0 1 0-1.06l3.5-3.5a.75.75 0 0 1 1.06 1.06L4.56 5.5h5.19a4.25 4.25 0 0 1 0 8.5h-1a.75.75 0 0 1 0-1.5h1a2.75 2.75 0 0 0 2.75-2.75Z","clip-rule":"evenodd"},null,-1)];function gx(t,e){return u.openBlock(),u.createElementBlock("svg",px,mx)}const yx=ue(hx,[["render",gx]]),bx={},vx={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},kx=[u.createElementVNode("path",{"fill-rule":"evenodd",d:"M3.5 9.75A2.75 2.75 0 0 1 6.25 7h5.19L9.22 9.22a.75.75 0 1 0 1.06 1.06l3.5-3.5a.75.75 0 0 0 0-1.06l-3.5-3.5a.75.75 0 1 0-1.06 1.06l2.22 2.22H6.25a4.25 4.25 0 0 0 0 8.5h1a.75.75 0 0 0 0-1.5h-1A2.75 2.75 0 0 1 3.5 9.75Z","clip-rule":"evenodd"},null,-1)];function wx(t,e){return u.openBlock(),u.createElementBlock("svg",vx,kx)}const xx=ue(bx,[["render",wx]]),Sx={},Cx={fill:"#000000",width:"800px",height:"800px",viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},Ox=[u.createElementVNode("path",{d:"M754.429 0v274.423h235.885L647.457 1645.85H343V1920h822.994v-274.149H930.11l342.857-1371.428h304.32V0z","fill-rule":"evenodd"},null,-1)];function Mx(t,e){return u.openBlock(),u.createElementBlock("svg",Cx,Ox)}const Ex=ue(Sx,[["render",Mx]]),Tx={},Nx={fill:"#000000",viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},Ax=[u.createElementVNode("path",{d:"M480.286 822.857h548.571c151.269 0 274.286-123.017 274.286-274.286 0-151.268-123.017-274.285-274.286-274.285H480.286v548.571Zm0 822.857H1166c151.269 0 274.286-123.017 274.286-274.285 0-151.269-123.017-274.286-274.286-274.286H480.286v548.571ZM1166 1920H206V0h822.857c302.537 0 548.572 246.034 548.572 548.571 0 134.263-48.549 257.418-128.778 352.732 159.223 96.137 265.92 270.994 265.92 470.126 0 302.537-246.034 548.571-548.571 548.571Z","fill-rule":"evenodd"},null,-1)];function Dx(t,e){return u.openBlock(),u.createElementBlock("svg",Nx,Ax)}const Bx=ue(Tx,[["render",Dx]]),Vx={},Ix={fill:"#000000",width:"800px",height:"800px",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},Px=[u.createElementVNode("path",{d:"M3.59 3.03h12.2v1.26H3.59zm0 4.29h12.2v1.26H3.59zm0 4.35h12.2v1.26H3.59zM.99 4.79h.49V2.52H.6v.45h.39v1.82zm.87 3.88H.91l.14-.11.3-.24c.35-.28.49-.5.49-.79A.74.74 0 0 0 1 6.8a.77.77 0 0 0-.81.84h.52A.34.34 0 0 1 1 7.25a.31.31 0 0 1 .31.31.6.6 0 0 1-.22.44l-.87.75v.39h1.64zm-.36 3.56a.52.52 0 0 0 .28-.48.67.67 0 0 0-.78-.62.71.71 0 0 0-.77.75h.5a.3.3 0 0 1 .27-.32.26.26 0 1 1 0 .51H.91v.38H1c.23 0 .37.11.37.29a.29.29 0 0 1-.33.29.35.35 0 0 1-.36-.35H.21a.76.76 0 0 0 .83.8.74.74 0 0 0 .83-.72.53.53 0 0 0-.37-.53z"},null,-1)];function $x(t,e){return u.openBlock(),u.createElementBlock("svg",Ix,Px)}const Rx=ue(Vx,[["render",$x]]),_x={},Lx={fill:"#000000",version:"1.1",id:"Capa_1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",width:"800px",height:"800px",viewBox:"0 0 96.639 96.639","xml:space":"preserve"},zx=[u.createElementVNode("g",null,[u.createElementVNode("g",null,[u.createElementVNode("path",{d:`M95.263,12.29V2.277C95.263,1.019,94.245,0,92.987,0H36.921C25.539,0,17.05,2.442,10.969,7.47\r
115
+ `);return!s||!o?!1:t.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const a=i.after();return a===void 0||r.nodeAt(a)?!1:t.commands.exitCode()}}},addInputRules(){return[ml({find:BM,type:this.type,getAttributes:t=>({language:t[1]})}),ml({find:PM,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Ke({key:new Pt("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i==null?void 0:i.mode;if(!n||!s)return!1;const{tr:o}=t.state;return t.state.selection.from===t.state.doc.nodeSize-(1+t.state.selection.$to.depth*2)?o.insert(t.state.selection.from-1,this.type.create({language:s})):o.replaceSelectionWith(this.type.create({language:s})),o.setSelection(J.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.insertText(n.replace(/\r\n?/g,`
116
+ `)),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),RM=pt.create({name:"doc",topNode:!0,content:"block+"});function $M(t={}){return new Ke({view(e){return new LM(e,t)}})}class LM{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r;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(),f=a?u.bottom:u.top;a&&l&&(f=(f+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:u.left,right:u.right,top:f-this.width/2,bottom:f+this.width/2}}}}if(!r){let a=this.editorView.coordsAtPos(this.cursorPos);r={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let i=this.editorView.dom.offsetParent;this.element||(this.element=i.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 s,o;if(!i||i==document.body&&getComputedStyle(i).position=="static")s=-pageXOffset,o=-pageYOffset;else{let a=i.getBoundingClientRect();s=a.left-i.scrollLeft,o=a.top-i.scrollTop}this.element.style.left=r.left-s+"px",this.element.style.top=r.top-o+"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),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!s){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=su(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const FM=Ye.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[$M(this.options)]}});class xe extends Q{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return xe.valid(r)?new xe(r):Q.near(r)}content(){return I.empty}eq(e){return e instanceof xe&&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 xe(e.resolve(n.pos))}getBookmark(){return new Vl(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!zM(e)||!jM(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&xe.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let a=e.node(o);if(n>0?e.indexAfter(o)<a.childCount:e.index(o)>0){s=a.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=n;let l=e.doc.resolve(i);if(xe.valid(l))return l}for(;;){let o=n>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!H.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=o,i+=n;let a=e.doc.resolve(i);if(xe.valid(a))return a}return null}}}xe.prototype.visible=!1,xe.findFrom=xe.findGapCursorFrom,Q.jsonID("gapcursor",xe);class Vl{constructor(e){this.pos=e}map(e){return new Vl(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return xe.valid(n)?new xe(n):Q.near(n)}}function zM(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function jM(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function WM(){return new Ke({props:{decorations:qM,createSelectionBetween(t,e,n){return e.pos==n.pos&&xe.valid(n)?new xe(n):null},handleClick:YM,handleKeyDown:HM,handleDOMEvents:{beforeinput:UM}}})}const HM=Df({ArrowLeft:ko("horiz",-1),ArrowRight:ko("horiz",1),ArrowUp:ko("vert",-1),ArrowDown:ko("vert",1)});function ko(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof J){if(!s.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=xe.findGapCursorFrom(a,e,l);return c?(i&&i(r.tr.setSelection(new xe(c))),!0):!1}}function YM(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!xe.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&H.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new xe(r))),!0)}function UM(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof xe))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=N.empty;for(let o=r.length-1;o>=0;o--)i=N.from(r[o].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new I(i,0,0));return s.setSelection(J.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function qM(t){if(!(t.selection instanceof xe))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Ee.create(t.doc,[ht.widget(t.selection.head,e,{key:"gapcursor"})])}const KM=Ye.create({name:"gapCursor",addProseMirrorPlugins(){return[WM()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=ee(z(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),JM=pt.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Ne(this.options.HTMLAttributes,t)]},renderText(){return`
117
+ `},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:s}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,l=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&o){const f=l.filter(h=>a.includes(h.type.name));c.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),GM=pt.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Ne(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>ml({find:new RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var wo=200,Ie=function(){};Ie.prototype.append=function(e){return e.length?(e=Ie.from(e),!this.length&&e||e.length<wo&&this.leafAppend(e)||this.length<wo&&e.leafPrepend(this)||this.appendInner(e)):this},Ie.prototype.prepend=function(e){return e.length?Ie.from(e).append(this):this},Ie.prototype.appendInner=function(e){return new ZM(this,e)},Ie.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Ie.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))},Ie.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Ie.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)},Ie.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},n,r),i},Ie.from=function(e){return e instanceof Ie?e:e&&e.length?new qh(e):Ie.empty};var qh=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l<o;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var l=s-1;l>=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=wo)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=wo)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Ie);Ie.empty=new qh([]);var ZM=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(Ie);const XM=500;class $t{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,a,l,c=[],u=[];return this.items.forEach((f,h)=>{if(!f.step){i||(i=this.remapping(r,h+1),s=i.maps.length),s--,u.push(f);return}if(i){u.push(new tn(f.map));let p=f.step.map(i.slice(s)),m;p&&o.maybeStep(p).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],c.push(new tn(m,void 0,void 0,c.length+u.length))),s--,m&&i.appendMap(m,s)}else o.maybeStep(f.step);if(f.selection)return a=i?f.selection.map(i.slice(s)):f.selection,l=new $t(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,n,r,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let f=e.steps[u].invert(e.docs[u]),h=new tn(e.mapping.maps[u],f,n),p;(p=l&&l.merge(h))&&(h=p,u?s.pop():a=a.slice(0,a.length-1)),s.push(h),n&&(o++,n=void 0),i||(l=h)}let c=o-r.depth;return c>eO&&(a=QM(a,c),o-=c),new $t(a.append(s),o)}remapping(e,n){let r=new Br;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new $t(this.items.append(e.map(n=>new tn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let l=n;this.items.forEach(h=>{let p=s.getMirror(--l);if(p==null)return;o=Math.min(o,p);let m=s.maps[p];if(h.step){let y=e.steps[p].invert(e.docs[p]),g=h.selection&&h.selection.map(s.slice(l+1,p));g&&a++,r.push(new tn(m,y,g))}else r.push(new tn(m))},i);let c=[];for(let h=n;h<o;h++)c.push(new tn(s.maps[h]));let u=this.items.slice(0,i).append(c).append(r),f=new $t(u,a);return f.emptyItemCount()>XM&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=o.selection&&o.selection.map(n.slice(r));u&&s++;let f=new tn(c.invert(),l,u),h,p=i.length-1;(h=i.length&&i[p].merge(f))?i[p]=h:i.push(f)}}else o.map&&r--},this.items.length,0),new $t(Ie.from(i.reverse()),s)}}$t.empty=new $t(Ie.empty,0);function QM(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class tn{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new tn(n.getMap().invert(),n,this.selection)}}}class qn{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const eO=20;function tO(t,e,n,r){let i=n.getMeta(br),s;if(i)return i.historyState;n.getMeta(iO)&&(t=new qn(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(br))return o.getMeta(br).redo?new qn(t.done.addTransform(n,void 0,r,xo(e)),t.undone,Kh(n.mapping.maps[n.steps.length-1]),t.prevTime,t.prevComposition):new qn(t.done,t.undone.addTransform(n,void 0,r,xo(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!o&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!nO(n,t.prevRanges)),c=o?Bl(t.prevRanges,n.mapping):Kh(n.mapping.maps[n.steps.length-1]);return new qn(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,xo(e)),$t.empty,c,n.time,a??t.prevComposition)}else return(s=n.getMeta("rebased"))?new qn(t.done.rebased(n,s),t.undone.rebased(n,s),Bl(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new qn(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Bl(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function nO(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function Kh(t){let e=[];return t.forEach((n,r,i,s)=>e.push(i,s)),e}function Bl(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function rO(t,e,n){let r=xo(e),i=br.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),l=new qn(n?a:s.remaining,n?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(br,{redo:n,historyState:l})}let Pl=!1,Jh=null;function xo(t){let e=t.plugins;if(Jh!=e){Pl=!1,Jh=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Pl=!0;break}}return Pl}const br=new Pt("history"),iO=new Pt("closeHistory");function sO(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ke({key:br,state:{init(){return new qn($t.empty,$t.empty,null,0,-1)},apply(e,n,r){return tO(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?Zh:r=="historyRedo"?Xh:null;return i?(n.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function Gh(t,e){return(n,r)=>{let i=br.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=rO(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const Zh=Gh(!1,!0),Xh=Gh(!0,!0),oO=Ye.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Zh(t,e),redo:()=>({state:t,dispatch:e})=>Xh(t,e)}},addProseMirrorPlugins(){return[sO(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),aO=pt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Ne(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{const{$to:n}=e.selection,r=t();return n.parentOffset===0?r.insertContentAt(Math.max(n.pos-2,0),{type:this.name}):r.insertContent({type:this.name}),r.command(({tr:i,dispatch:s})=>{var o;if(s){const{$to:a}=i.selection,l=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?i.setSelection(J.create(i.doc,a.pos+1)):a.nodeAfter.isBlock?i.setSelection(H.create(i.doc,a.pos)):i.setSelection(J.create(i.doc,a.pos));else{const c=(o=a.parent.type.contentMatch.defaultType)===null||o===void 0?void 0:o.create();c&&(i.insert(l,c),i.setSelection(J.create(i.doc,l+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Rx({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),lO=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,cO=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,dO=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,uO=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,fO=Zt.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Jr({find:lO,type:this.type}),Jr({find:dO,type:this.type})]},addPasteRules(){return[Gr({find:cO,type:this.type}),Gr({find:uO,type:this.type})]}}),hO=pt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ne(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),pO=pt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ne(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Qh=Zt.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const n=fo(t,this.type);return Object.entries(n).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),ep=/^(\d+)\.\s$/,mO=pt.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Ne(this.options.HTMLAttributes,n),0]:["ol",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(pO.name,this.editor.getAttributes(Qh.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Ui({find:ep,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ui({find:ep,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Qh.name)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),gO=pt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),yO=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,bO=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,vO=Zt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Jr({find:yO,type:this.type})]},addPasteRules(){return[Gr({find:bO,type:this.type})]}}),kO=pt.create({name:"text",group:"inline"}),wO=Ye.create({name:"starterKit",addExtensions(){var t,e,n,r,i,s,o,a,l,c,u,f,h,p,m,y,g,k;const x=[];return this.options.blockquote!==!1&&x.push(SM.configure((t=this.options)===null||t===void 0?void 0:t.blockquote)),this.options.bold!==!1&&x.push(EM.configure((e=this.options)===null||e===void 0?void 0:e.bold)),this.options.bulletList!==!1&&x.push(NM.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&x.push(VM.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&x.push(IM.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&x.push(RM.configure((s=this.options)===null||s===void 0?void 0:s.document)),this.options.dropcursor!==!1&&x.push(FM.configure((o=this.options)===null||o===void 0?void 0:o.dropcursor)),this.options.gapcursor!==!1&&x.push(KM.configure((a=this.options)===null||a===void 0?void 0:a.gapcursor)),this.options.hardBreak!==!1&&x.push(JM.configure((l=this.options)===null||l===void 0?void 0:l.hardBreak)),this.options.heading!==!1&&x.push(GM.configure((c=this.options)===null||c===void 0?void 0:c.heading)),this.options.history!==!1&&x.push(oO.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&x.push(aO.configure((f=this.options)===null||f===void 0?void 0:f.horizontalRule)),this.options.italic!==!1&&x.push(fO.configure((h=this.options)===null||h===void 0?void 0:h.italic)),this.options.listItem!==!1&&x.push(hO.configure((p=this.options)===null||p===void 0?void 0:p.listItem)),this.options.orderedList!==!1&&x.push(mO.configure((m=this.options)===null||m===void 0?void 0:m.orderedList)),this.options.paragraph!==!1&&x.push(gO.configure((y=this.options)===null||y===void 0?void 0:y.paragraph)),this.options.strike!==!1&&x.push(vO.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&x.push(kO.configure((k=this.options)===null||k===void 0?void 0:k.text)),x}}),xO=Ye.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,considerAnyAsEmpty:!1,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Ke({key:new Pt("placeholder"),props:{decorations:({doc:t,selection:e})=>{var n;const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=e,s=[];if(!r)return null;const{firstChild:o}=t.content,a=o&&o.type.isLeaf,l=o&&o.isAtom,c=this.options.considerAnyAsEmpty?!0:o&&o.type.name===((n=t.type.contentMatch.defaultType)===null||n===void 0?void 0:n.name),u=t.content.childCount<=1&&o&&c&&o.nodeSize<=2&&(!a||!l);return t.descendants((f,h)=>{const p=i>=h&&i<=h+f.nodeSize,m=!f.isLeaf&&!f.childCount;if((p||!this.options.showOnlyCurrent)&&m){const y=[this.options.emptyNodeClass];u&&y.push(this.options.emptyEditorClass);const g=ht.node(h,h+f.nodeSize,{class:y.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:f,pos:h,hasAnchor:p}):this.options.placeholder});s.push(g)}return this.options.includeChildren}),Ee.create(t,s)}}})]}}),SO={},MO={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},OO=[d.createElementVNode("path",{d:"M3 4.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM6.25 3a.75.75 0 0 0 0 1.5h7a.75.75 0 0 0 0-1.5h-7ZM6.25 7.25a.75.75 0 0 0 0 1.5h7a.75.75 0 0 0 0-1.5h-7ZM6.25 11.5a.75.75 0 0 0 0 1.5h7a.75.75 0 0 0 0-1.5h-7ZM4 12.25a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM3 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"},null,-1)];function CO(t,e){return d.openBlock(),d.createElementBlock("svg",MO,OO)}const TO=ye(SO,[["render",CO]]),EO={},_O={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},NO=[d.createElementVNode("path",{"fill-rule":"evenodd",d:"M12.5 9.75A2.75 2.75 0 0 0 9.75 7H4.56l2.22 2.22a.75.75 0 1 1-1.06 1.06l-3.5-3.5a.75.75 0 0 1 0-1.06l3.5-3.5a.75.75 0 0 1 1.06 1.06L4.56 5.5h5.19a4.25 4.25 0 0 1 0 8.5h-1a.75.75 0 0 1 0-1.5h1a2.75 2.75 0 0 0 2.75-2.75Z","clip-rule":"evenodd"},null,-1)];function DO(t,e){return d.openBlock(),d.createElementBlock("svg",_O,NO)}const AO=ye(EO,[["render",DO]]),VO={},BO={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},PO=[d.createElementVNode("path",{"fill-rule":"evenodd",d:"M3.5 9.75A2.75 2.75 0 0 1 6.25 7h5.19L9.22 9.22a.75.75 0 1 0 1.06 1.06l3.5-3.5a.75.75 0 0 0 0-1.06l-3.5-3.5a.75.75 0 1 0-1.06 1.06l2.22 2.22H6.25a4.25 4.25 0 0 0 0 8.5h1a.75.75 0 0 0 0-1.5h-1A2.75 2.75 0 0 1 3.5 9.75Z","clip-rule":"evenodd"},null,-1)];function IO(t,e){return d.openBlock(),d.createElementBlock("svg",BO,PO)}const RO=ye(VO,[["render",IO]]),$O={},LO={fill:"#000000",width:"800px",height:"800px",viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},FO=[d.createElementVNode("path",{d:"M754.429 0v274.423h235.885L647.457 1645.85H343V1920h822.994v-274.149H930.11l342.857-1371.428h304.32V0z","fill-rule":"evenodd"},null,-1)];function zO(t,e){return d.openBlock(),d.createElementBlock("svg",LO,FO)}const jO=ye($O,[["render",zO]]),WO={},HO={fill:"#000000",viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},YO=[d.createElementVNode("path",{d:"M480.286 822.857h548.571c151.269 0 274.286-123.017 274.286-274.286 0-151.268-123.017-274.285-274.286-274.285H480.286v548.571Zm0 822.857H1166c151.269 0 274.286-123.017 274.286-274.285 0-151.269-123.017-274.286-274.286-274.286H480.286v548.571ZM1166 1920H206V0h822.857c302.537 0 548.572 246.034 548.572 548.571 0 134.263-48.549 257.418-128.778 352.732 159.223 96.137 265.92 270.994 265.92 470.126 0 302.537-246.034 548.571-548.571 548.571Z","fill-rule":"evenodd"},null,-1)];function UO(t,e){return d.openBlock(),d.createElementBlock("svg",HO,YO)}const qO=ye(WO,[["render",UO]]),KO={},JO={fill:"#000000",width:"800px",height:"800px",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},GO=[d.createElementVNode("path",{d:"M3.59 3.03h12.2v1.26H3.59zm0 4.29h12.2v1.26H3.59zm0 4.35h12.2v1.26H3.59zM.99 4.79h.49V2.52H.6v.45h.39v1.82zm.87 3.88H.91l.14-.11.3-.24c.35-.28.49-.5.49-.79A.74.74 0 0 0 1 6.8a.77.77 0 0 0-.81.84h.52A.34.34 0 0 1 1 7.25a.31.31 0 0 1 .31.31.6.6 0 0 1-.22.44l-.87.75v.39h1.64zm-.36 3.56a.52.52 0 0 0 .28-.48.67.67 0 0 0-.78-.62.71.71 0 0 0-.77.75h.5a.3.3 0 0 1 .27-.32.26.26 0 1 1 0 .51H.91v.38H1c.23 0 .37.11.37.29a.29.29 0 0 1-.33.29.35.35 0 0 1-.36-.35H.21a.76.76 0 0 0 .83.8.74.74 0 0 0 .83-.72.53.53 0 0 0-.37-.53z"},null,-1)];function ZO(t,e){return d.openBlock(),d.createElementBlock("svg",JO,GO)}const XO=ye(KO,[["render",ZO]]),QO={},eC={fill:"#000000",version:"1.1",id:"Capa_1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",width:"800px",height:"800px",viewBox:"0 0 96.639 96.639","xml:space":"preserve"},tC=[d.createElementVNode("g",null,[d.createElementVNode("g",null,[d.createElementVNode("path",{d:`M95.263,12.29V2.277C95.263,1.019,94.245,0,92.987,0H36.921C25.539,0,17.05,2.442,10.969,7.47\r
118
118
  c-6.364,5.265-9.594,12.724-9.594,22.167c0,10.367,3.124,18.054,9.547,23.499c6.399,5.423,15.696,8.175,27.63,8.175h10.38v33.051\r
119
119
  c0,1.258,1.02,2.277,2.278,2.277h7.096c1.257,0,2.276-1.02,2.276-2.277V14.566h9.146v79.795c0,1.258,1.021,2.276,2.277,2.276\r
120
- h6.873c1.257,0,2.277-1.021,2.277-2.276V14.566h11.83C94.247,14.566,95.263,13.547,95.263,12.29z`})])],-1)];function Fx(t,e){return u.openBlock(),u.createElementBlock("svg",Lx,zx)}const jx=ue(_x,[["render",Fx]]),Hx={},Wx={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},Ux=[u.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M17.25 6.75 22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3-4.5 16.5"},null,-1)];function qx(t,e){return u.openBlock(),u.createElementBlock("svg",Wx,Ux)}const Kx=ue(Hx,[["render",qx]]),Jx={key:0,class:"pt-px relative flex flex-col dark:text-zinc-300 bg-zinc-100 dark:bg-zinc-700/25 rounded border border-zinc-400 dark:border-zinc-700/50 shadow-inner focus-within:border-zinc-500 focus-within:outline focus-within:outline-2 focus-within:outline-offset-3"},Gx={class:"py-1 px-1 border-b"},Yx={class:"flex gap-px"},Zx=["onClick"],Xx={key:1,class:"text-sm"},Qx={class:"max-h-72 w-full overflow-auto px-4 py-3"},il={WpicButton:dh,WpicBadge:Object.assign({name:"WpicBadge"},{props:{success:Boolean,warning:Boolean,error:Boolean},setup(t){return(e,n)=>(u.openBlock(),u.createElementBlock("span",{class:u.normalizeClass(["inline-flex items-center justify-center border font-medium rounded-md h-6 text-xs px-2",{"bg-green-50 border-green-200 text-green-700 dark:border-green-600/30 dark:bg-green-800 dark:bg-opacity-20 dark:text-opacity-85 dark:text-green-500":t.success,"bg-yellow-50 border-yellow-200 text-yellow-700 dark:border-yellow-600/30 dark:bg-yellow-800 dark:bg-opacity-10 dark:text-opacity-85 dark:text-yellow-500":t.warning,"bg-red-50 border-red-200 text-red-700 dark:border-red-600/30 dark:bg-red-800 dark:bg-opacity-10 dark:text-opacity-85 dark:text-red-500":t.error,"bg-zinc-50 border-zinc-200 text-zinc-700 dark:border-zinc-600/30 dark:bg-zinc-800 dark:bg-opacity-5 dark:text-opacity-85 dark:text-zinc-400":!t.success&&!t.warning&&!t.error}])},[u.renderSlot(e.$slots,"default")],2))}}),WpicTextEditor:Object.assign({name:"WpicTextEditor"},{props:{modelValue:{type:String,default:""}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=[{method:"toggleBold",type:"chain",label:"bold",icon:Bx,smallIcon:!0,disableCheck:!0},{method:"toggleItalic",type:"chain",label:"italic",icon:Ex,smallIcon:!0,disableCheck:!0},{method:"setParagraph",type:"chain",label:"paragraph",icon:jx,smallIcon:!0,disableCheck:!1},{method:"toggleBulletList",type:"chain",label:"bullet list",icon:fx,disableCheck:!1},{method:"toggleOrderedList",type:"chain",label:"ordered list",icon:Rx,disableCheck:!1},{method:"undo",type:"chain",label:"undo",icon:yx,disableCheck:!0},{method:"redo",type:"chain",label:"redo",icon:xx,disableCheck:!0},{method:"redo",type:"chain",label:"redo",icon:Kx,disableCheck:!0}],i=e,o=sw({content:n.modelValue,extensions:[sx,lx.configure({placeholder:"..."})],onUpdate:()=>{i("update:modelValue",o.value.getHTML())}});u.onBeforeUnmount(()=>{o.value.destroy()}),u.watch(()=>n.modelValue,a=>{a!==o.value.getHTML()&&o.value.commands.setContent(a,!1)});function s(a,c,d){c==="chain"?d?o.value.chain().focus()[a](d).run():o.value.chain().focus()[a]().run():this.editor[a]()()}function l(a,c,d,f){return f?c==="chain"?d?!o.value.can().chain().focus()[a](d).run():!o.value.can().chain().focus()[a]().run():!o.value.can()[a]().run():!1}return(a,c)=>u.unref(o)?(u.openBlock(),u.createElementBlock("div",Jx,[u.createElementVNode("div",Gx,[u.createElementVNode("div",Yx,[(u.openBlock(),u.createElementBlock(u.Fragment,null,u.renderList(r,d=>u.createElementVNode("div",{key:d.method,class:u.normalizeClass(["w-8 h-8 flex items-center justify-center text-xs rounded",{"cursor-pointer":!l(d.method,d.type,d.params,d.disableCheck),"is-active text-white !bg-zinc-200":u.unref(o).isActive(d.label)}]),onClick:f=>s(d.method,d.type,d.params)},[d.icon?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(d.icon),{key:0,class:u.normalizeClass(["",{"w-3 h-3":d.smallIcon,"w-4 h-4":!d.smallIcon}])},null,8,["class"])):(u.openBlock(),u.createElementBlock("span",Xx,u.toDisplayString(u.unref(Bo).capitalize(d.label)),1))],10,Zx)),64))])]),u.createElementVNode("div",Qx,[u.createVNode(u.unref(ow),{editor:u.unref(o)},null,8,["editor"])])])):u.createCommentVNode("",!0)}}),WpicInputGroup:bh,WpicButtonGroup:ph,WpicForm:vh,WpicFormField:_m,WpicSpinner:di,WpicPopover:Vo,WpicChoiceList:Ym,WpicCard:ng,WpicCardSection:sg,WpicProgressBar:ag,WpicTag:dg,WpicTagGroup:ug,WpicPagination:kg,WpicLoadingPanel:hg,WpicTable:Vg,WpicTableColumn:Ig};function Fu(t,e){for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(typeof e[n]=="object"&&t[n]?Fu(t[n],e[n]):t[n]=e[n])}function eS(t,e){Fu(je,e);for(const n in il)if(il.hasOwnProperty(n)){const r=il[n];t.component(r.name,r)}}return{install:eS,options:je}});
120
+ h6.873c1.257,0,2.277-1.021,2.277-2.276V14.566h11.83C94.247,14.566,95.263,13.547,95.263,12.29z`})])],-1)];function nC(t,e){return d.openBlock(),d.createElementBlock("svg",eC,tC)}const rC=ye(QO,[["render",nC]]),iC={},sC={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},oC=[d.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M17.25 6.75 22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3-4.5 16.5"},null,-1)];function aC(t,e){return d.openBlock(),d.createElementBlock("svg",sC,oC)}const lC=ye(iC,[["render",aC]]),cC={key:0,class:"pt-px relative flex flex-col dark:text-zinc-300 bg-zinc-100 dark:bg-zinc-700/25 rounded border border-zinc-400 dark:border-zinc-700/50 shadow-inner focus-within:border-zinc-500 focus-within:outline focus-within:outline-2 focus-within:outline-offset-3"},dC={class:"py-1 px-1 border-b"},uC={class:"flex gap-px"},fC=["onClick"],hC={key:1,class:"text-sm"},pC={class:"max-h-72 w-full overflow-auto px-4 py-3"},mC=Object.assign({name:"WpicTextEditor"},{props:{modelValue:{type:String,default:""}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=[{method:"toggleBold",type:"chain",label:"bold",icon:qO,smallIcon:!0,disableCheck:!0},{method:"toggleItalic",type:"chain",label:"italic",icon:jO,smallIcon:!0,disableCheck:!0},{method:"setParagraph",type:"chain",label:"paragraph",icon:rC,smallIcon:!0,disableCheck:!1},{method:"toggleBulletList",type:"chain",label:"bullet list",icon:TO,disableCheck:!1},{method:"toggleOrderedList",type:"chain",label:"ordered list",icon:XO,disableCheck:!1},{method:"undo",type:"chain",label:"undo",icon:AO,disableCheck:!0},{method:"redo",type:"chain",label:"redo",icon:RO,disableCheck:!0},{method:"redo",type:"chain",label:"redo",icon:lC,disableCheck:!0}],i=e,s=wM({content:n.modelValue,extensions:[wO,xO.configure({placeholder:"..."})],onUpdate:()=>{i("update:modelValue",s.value.getHTML())}});d.onBeforeUnmount(()=>{s.value.destroy()}),d.watch(()=>n.modelValue,l=>{l!==s.value.getHTML()&&s.value.commands.setContent(l,!1)});function o(l,c,u){c==="chain"?u?s.value.chain().focus()[l](u).run():s.value.chain().focus()[l]().run():this.editor[l]()()}function a(l,c,u,f){return f?c==="chain"?u?!s.value.can().chain().focus()[l](u).run():!s.value.can().chain().focus()[l]().run():!s.value.can()[l]().run():!1}return(l,c)=>d.unref(s)?(d.openBlock(),d.createElementBlock("div",cC,[d.createElementVNode("div",dC,[d.createElementVNode("div",uC,[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(r,u=>d.createElementVNode("div",{key:u.method,class:d.normalizeClass(["w-8 h-8 flex items-center justify-center text-xs rounded",{"cursor-pointer":!a(u.method,u.type,u.params,u.disableCheck),"is-active text-white !bg-zinc-200":d.unref(s).isActive(u.label)}]),onClick:f=>o(u.method,u.type,u.params)},[u.icon?(d.openBlock(),d.createBlock(d.resolveDynamicComponent(u.icon),{key:0,class:d.normalizeClass(["",{"w-3 h-3":u.smallIcon,"w-4 h-4":!u.smallIcon}])},null,8,["class"])):(d.openBlock(),d.createElementBlock("span",hC,d.toDisplayString(d.unref(fa).capitalize(u.label)),1))],10,fC)),64))])]),d.createElementVNode("div",pC,[d.createVNode(d.unref(kM),{editor:d.unref(s)},null,8,["editor"])])])):d.createCommentVNode("",!0)}}),gC=Object.assign({name:"WpicBadge"},{props:{success:Boolean,warning:Boolean,error:Boolean},setup(t){return(e,n)=>(d.openBlock(),d.createElementBlock("span",{class:d.normalizeClass(["inline-flex items-center justify-center border font-medium rounded-md h-6 text-xs px-2",{"bg-green-50 border-green-200 text-green-700 dark:border-green-600/30 dark:bg-green-800 dark:bg-opacity-20 dark:text-opacity-85 dark:text-green-500":t.success,"bg-yellow-50 border-yellow-200 text-yellow-700 dark:border-yellow-600/30 dark:bg-yellow-800 dark:bg-opacity-10 dark:text-opacity-85 dark:text-yellow-500":t.warning,"bg-red-50 border-red-200 text-red-700 dark:border-red-600/30 dark:bg-red-800 dark:bg-opacity-10 dark:text-opacity-85 dark:text-red-500":t.error,"bg-zinc-50 border-zinc-200 text-zinc-700 dark:border-zinc-600/30 dark:bg-zinc-800 dark:bg-opacity-5 dark:text-opacity-85 dark:text-zinc-400":!t.success&&!t.warning&&!t.error}])},[d.renderSlot(e.$slots,"default")],2))}});//! moment.js
121
+ //! version : 2.30.1
122
+ //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
123
+ //! license : MIT
124
+ //! momentjs.com
125
+ var tp;function _(){return tp.apply(null,arguments)}function yC(t){tp=t}function Lt(t){return t instanceof Array||Object.prototype.toString.call(t)==="[object Array]"}function vr(t){return t!=null&&Object.prototype.toString.call(t)==="[object Object]"}function ce(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Il(t){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(t).length===0;var e;for(e in t)if(ce(t,e))return!1;return!0}function lt(t){return t===void 0}function bn(t){return typeof t=="number"||Object.prototype.toString.call(t)==="[object Number]"}function rs(t){return t instanceof Date||Object.prototype.toString.call(t)==="[object Date]"}function np(t,e){var n=[],r,i=t.length;for(r=0;r<i;++r)n.push(e(t[r],r));return n}function Kn(t,e){for(var n in e)ce(e,n)&&(t[n]=e[n]);return ce(e,"toString")&&(t.toString=e.toString),ce(e,"valueOf")&&(t.valueOf=e.valueOf),t}function nn(t,e,n,r){return _p(t,e,n,r,!0).utc()}function bC(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function Z(t){return t._pf==null&&(t._pf=bC()),t._pf}var Rl;Array.prototype.some?Rl=Array.prototype.some:Rl=function(t){var e=Object(this),n=e.length>>>0,r;for(r=0;r<n;r++)if(r in e&&t.call(this,e[r],r,e))return!0;return!1};function $l(t){var e=null,n=!1,r=t._d&&!isNaN(t._d.getTime());if(r&&(e=Z(t),n=Rl.call(e.parsedDateParts,function(i){return i!=null}),r=e.overflow<0&&!e.empty&&!e.invalidEra&&!e.invalidMonth&&!e.invalidWeekday&&!e.weekdayMismatch&&!e.nullInput&&!e.invalidFormat&&!e.userInvalidated&&(!e.meridiem||e.meridiem&&n),t._strict&&(r=r&&e.charsLeftOver===0&&e.unusedTokens.length===0&&e.bigHour===void 0)),Object.isFrozen==null||!Object.isFrozen(t))t._isValid=r;else return r;return t._isValid}function So(t){var e=nn(NaN);return t!=null?Kn(Z(e),t):Z(e).userInvalidated=!0,e}var rp=_.momentProperties=[],Ll=!1;function Fl(t,e){var n,r,i,s=rp.length;if(lt(e._isAMomentObject)||(t._isAMomentObject=e._isAMomentObject),lt(e._i)||(t._i=e._i),lt(e._f)||(t._f=e._f),lt(e._l)||(t._l=e._l),lt(e._strict)||(t._strict=e._strict),lt(e._tzm)||(t._tzm=e._tzm),lt(e._isUTC)||(t._isUTC=e._isUTC),lt(e._offset)||(t._offset=e._offset),lt(e._pf)||(t._pf=Z(e)),lt(e._locale)||(t._locale=e._locale),s>0)for(n=0;n<s;n++)r=rp[n],i=e[r],lt(i)||(t[r]=i);return t}function is(t){Fl(this,t),this._d=new Date(t._d!=null?t._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),Ll===!1&&(Ll=!0,_.updateOffset(this),Ll=!1)}function Ft(t){return t instanceof is||t!=null&&t._isAMomentObject!=null}function ip(t){_.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+t)}function Ct(t,e){var n=!0;return Kn(function(){if(_.deprecationHandler!=null&&_.deprecationHandler(null,t),n){var r=[],i,s,o,a=arguments.length;for(s=0;s<a;s++){if(i="",typeof arguments[s]=="object"){i+=`
126
+ [`+s+"] ";for(o in arguments[0])ce(arguments[0],o)&&(i+=o+": "+arguments[0][o]+", ");i=i.slice(0,-2)}else i=arguments[s];r.push(i)}ip(t+`
127
+ Arguments: `+Array.prototype.slice.call(r).join("")+`
128
+ `+new Error().stack),n=!1}return e.apply(this,arguments)},e)}var sp={};function op(t,e){_.deprecationHandler!=null&&_.deprecationHandler(t,e),sp[t]||(ip(e),sp[t]=!0)}_.suppressDeprecationWarnings=!1,_.deprecationHandler=null;function rn(t){return typeof Function<"u"&&t instanceof Function||Object.prototype.toString.call(t)==="[object Function]"}function vC(t){var e,n;for(n in t)ce(t,n)&&(e=t[n],rn(e)?this[n]=e:this["_"+n]=e);this._config=t,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function zl(t,e){var n=Kn({},t),r;for(r in e)ce(e,r)&&(vr(t[r])&&vr(e[r])?(n[r]={},Kn(n[r],t[r]),Kn(n[r],e[r])):e[r]!=null?n[r]=e[r]:delete n[r]);for(r in t)ce(t,r)&&!ce(e,r)&&vr(t[r])&&(n[r]=Kn({},n[r]));return n}function jl(t){t!=null&&this.set(t)}var Wl;Object.keys?Wl=Object.keys:Wl=function(t){var e,n=[];for(e in t)ce(t,e)&&n.push(e);return n};var kC={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function wC(t,e,n){var r=this._calendar[t]||this._calendar.sameElse;return rn(r)?r.call(e,n):r}function sn(t,e,n){var r=""+Math.abs(t),i=e-r.length,s=t>=0;return(s?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+r}var Hl=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Mo=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Yl={},ii={};function W(t,e,n,r){var i=r;typeof r=="string"&&(i=function(){return this[r]()}),t&&(ii[t]=i),e&&(ii[e[0]]=function(){return sn(i.apply(this,arguments),e[1],e[2])}),n&&(ii[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),t)})}function xC(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function SC(t){var e=t.match(Hl),n,r;for(n=0,r=e.length;n<r;n++)ii[e[n]]?e[n]=ii[e[n]]:e[n]=xC(e[n]);return function(i){var s="",o;for(o=0;o<r;o++)s+=rn(e[o])?e[o].call(i,t):e[o];return s}}function Oo(t,e){return t.isValid()?(e=ap(e,t.localeData()),Yl[e]=Yl[e]||SC(e),Yl[e](t)):t.localeData().invalidDate()}function ap(t,e){var n=5;function r(i){return e.longDateFormat(i)||i}for(Mo.lastIndex=0;n>=0&&Mo.test(t);)t=t.replace(Mo,r),Mo.lastIndex=0,n-=1;return t}var MC={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function OC(t){var e=this._longDateFormat[t],n=this._longDateFormat[t.toUpperCase()];return e||!n?e:(this._longDateFormat[t]=n.match(Hl).map(function(r){return r==="MMMM"||r==="MM"||r==="DD"||r==="dddd"?r.slice(1):r}).join(""),this._longDateFormat[t])}var CC="Invalid date";function TC(){return this._invalidDate}var EC="%d",_C=/\d{1,2}/;function NC(t){return this._ordinal.replace("%d",t)}var DC={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function AC(t,e,n,r){var i=this._relativeTime[n];return rn(i)?i(t,e,n,r):i.replace(/%d/i,t)}function VC(t,e){var n=this._relativeTime[t>0?"future":"past"];return rn(n)?n(e):n.replace(/%s/i,e)}var lp={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function Tt(t){return typeof t=="string"?lp[t]||lp[t.toLowerCase()]:void 0}function Ul(t){var e={},n,r;for(r in t)ce(t,r)&&(n=Tt(r),n&&(e[n]=t[r]));return e}var BC={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function PC(t){var e=[],n;for(n in t)ce(t,n)&&e.push({unit:n,priority:BC[n]});return e.sort(function(r,i){return r.priority-i.priority}),e}var cp=/\d/,yt=/\d\d/,dp=/\d{3}/,ql=/\d{4}/,Co=/[+-]?\d{6}/,be=/\d\d?/,up=/\d\d\d\d?/,fp=/\d\d\d\d\d\d?/,To=/\d{1,3}/,Kl=/\d{1,4}/,Eo=/[+-]?\d{1,6}/,si=/\d+/,_o=/[+-]?\d+/,IC=/Z|[+-]\d\d:?\d\d/gi,No=/Z|[+-]\d\d(?::?\d\d)?/gi,RC=/[+-]?\d+(\.\d{1,3})?/,ss=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,oi=/^[1-9]\d?/,Jl=/^([1-9]\d|\d)/,Do;Do={};function L(t,e,n){Do[t]=rn(e)?e:function(r,i){return r&&n?n:e}}function $C(t,e){return ce(Do,t)?Do[t](e._strict,e._locale):new RegExp(LC(t))}function LC(t){return vn(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,n,r,i,s){return n||r||i||s}))}function vn(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Et(t){return t<0?Math.ceil(t)||0:Math.floor(t)}function se(t){var e=+t,n=0;return e!==0&&isFinite(e)&&(n=Et(e)),n}var Gl={};function ge(t,e){var n,r=e,i;for(typeof t=="string"&&(t=[t]),bn(e)&&(r=function(s,o){o[e]=se(s)}),i=t.length,n=0;n<i;n++)Gl[t[n]]=r}function as(t,e){ge(t,function(n,r,i,s){i._w=i._w||{},e(n,i._w,i,s)})}function FC(t,e,n){e!=null&&ce(Gl,t)&&Gl[t](e,n._a,n,t)}function Ao(t){return t%4===0&&t%100!==0||t%400===0}var Ue=0,kn=1,on=2,De=3,zt=4,wn=5,kr=6,zC=7,jC=8;W("Y",0,0,function(){var t=this.year();return t<=9999?sn(t,4):"+"+t}),W(0,["YY",2],0,function(){return this.year()%100}),W(0,["YYYY",4],0,"year"),W(0,["YYYYY",5],0,"year"),W(0,["YYYYYY",6,!0],0,"year"),L("Y",_o),L("YY",be,yt),L("YYYY",Kl,ql),L("YYYYY",Eo,Co),L("YYYYYY",Eo,Co),ge(["YYYYY","YYYYYY"],Ue),ge("YYYY",function(t,e){e[Ue]=t.length===2?_.parseTwoDigitYear(t):se(t)}),ge("YY",function(t,e){e[Ue]=_.parseTwoDigitYear(t)}),ge("Y",function(t,e){e[Ue]=parseInt(t,10)});function ls(t){return Ao(t)?366:365}_.parseTwoDigitYear=function(t){return se(t)+(se(t)>68?1900:2e3)};var hp=ai("FullYear",!0);function WC(){return Ao(this.year())}function ai(t,e){return function(n){return n!=null?(pp(this,t,n),_.updateOffset(this,e),this):cs(this,t)}}function cs(t,e){if(!t.isValid())return NaN;var n=t._d,r=t._isUTC;switch(e){case"Milliseconds":return r?n.getUTCMilliseconds():n.getMilliseconds();case"Seconds":return r?n.getUTCSeconds():n.getSeconds();case"Minutes":return r?n.getUTCMinutes():n.getMinutes();case"Hours":return r?n.getUTCHours():n.getHours();case"Date":return r?n.getUTCDate():n.getDate();case"Day":return r?n.getUTCDay():n.getDay();case"Month":return r?n.getUTCMonth():n.getMonth();case"FullYear":return r?n.getUTCFullYear():n.getFullYear();default:return NaN}}function pp(t,e,n){var r,i,s,o,a;if(!(!t.isValid()||isNaN(n))){switch(r=t._d,i=t._isUTC,e){case"Milliseconds":return void(i?r.setUTCMilliseconds(n):r.setMilliseconds(n));case"Seconds":return void(i?r.setUTCSeconds(n):r.setSeconds(n));case"Minutes":return void(i?r.setUTCMinutes(n):r.setMinutes(n));case"Hours":return void(i?r.setUTCHours(n):r.setHours(n));case"Date":return void(i?r.setUTCDate(n):r.setDate(n));case"FullYear":break;default:return}s=n,o=t.month(),a=t.date(),a=a===29&&o===1&&!Ao(s)?28:a,i?r.setUTCFullYear(s,o,a):r.setFullYear(s,o,a)}}function HC(t){return t=Tt(t),rn(this[t])?this[t]():this}function YC(t,e){if(typeof t=="object"){t=Ul(t);var n=PC(t),r,i=n.length;for(r=0;r<i;r++)this[n[r].unit](t[n[r].unit])}else if(t=Tt(t),rn(this[t]))return this[t](e);return this}function UC(t,e){return(t%e+e)%e}var Me;Array.prototype.indexOf?Me=Array.prototype.indexOf:Me=function(t){var e;for(e=0;e<this.length;++e)if(this[e]===t)return e;return-1};function Zl(t,e){if(isNaN(t)||isNaN(e))return NaN;var n=UC(e,12);return t+=(e-n)/12,n===1?Ao(t)?29:28:31-n%7%2}W("M",["MM",2],"Mo",function(){return this.month()+1}),W("MMM",0,0,function(t){return this.localeData().monthsShort(this,t)}),W("MMMM",0,0,function(t){return this.localeData().months(this,t)}),L("M",be,oi),L("MM",be,yt),L("MMM",function(t,e){return e.monthsShortRegex(t)}),L("MMMM",function(t,e){return e.monthsRegex(t)}),ge(["M","MM"],function(t,e){e[kn]=se(t)-1}),ge(["MMM","MMMM"],function(t,e,n,r){var i=n._locale.monthsParse(t,r,n._strict);i!=null?e[kn]=i:Z(n).invalidMonth=t});var qC="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),mp="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),gp=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,KC=ss,JC=ss;function GC(t,e){return t?Lt(this._months)?this._months[t.month()]:this._months[(this._months.isFormat||gp).test(e)?"format":"standalone"][t.month()]:Lt(this._months)?this._months:this._months.standalone}function ZC(t,e){return t?Lt(this._monthsShort)?this._monthsShort[t.month()]:this._monthsShort[gp.test(e)?"format":"standalone"][t.month()]:Lt(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function XC(t,e,n){var r,i,s,o=t.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],r=0;r<12;++r)s=nn([2e3,r]),this._shortMonthsParse[r]=this.monthsShort(s,"").toLocaleLowerCase(),this._longMonthsParse[r]=this.months(s,"").toLocaleLowerCase();return n?e==="MMM"?(i=Me.call(this._shortMonthsParse,o),i!==-1?i:null):(i=Me.call(this._longMonthsParse,o),i!==-1?i:null):e==="MMM"?(i=Me.call(this._shortMonthsParse,o),i!==-1?i:(i=Me.call(this._longMonthsParse,o),i!==-1?i:null)):(i=Me.call(this._longMonthsParse,o),i!==-1?i:(i=Me.call(this._shortMonthsParse,o),i!==-1?i:null))}function QC(t,e,n){var r,i,s;if(this._monthsParseExact)return XC.call(this,t,e,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),r=0;r<12;r++){if(i=nn([2e3,r]),n&&!this._longMonthsParse[r]&&(this._longMonthsParse[r]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[r]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),!n&&!this._monthsParse[r]&&(s="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[r]=new RegExp(s.replace(".",""),"i")),n&&e==="MMMM"&&this._longMonthsParse[r].test(t))return r;if(n&&e==="MMM"&&this._shortMonthsParse[r].test(t))return r;if(!n&&this._monthsParse[r].test(t))return r}}function yp(t,e){if(!t.isValid())return t;if(typeof e=="string"){if(/^\d+$/.test(e))e=se(e);else if(e=t.localeData().monthsParse(e),!bn(e))return t}var n=e,r=t.date();return r=r<29?r:Math.min(r,Zl(t.year(),n)),t._isUTC?t._d.setUTCMonth(n,r):t._d.setMonth(n,r),t}function bp(t){return t!=null?(yp(this,t),_.updateOffset(this,!0),this):cs(this,"Month")}function eT(){return Zl(this.year(),this.month())}function tT(t){return this._monthsParseExact?(ce(this,"_monthsRegex")||vp.call(this),t?this._monthsShortStrictRegex:this._monthsShortRegex):(ce(this,"_monthsShortRegex")||(this._monthsShortRegex=KC),this._monthsShortStrictRegex&&t?this._monthsShortStrictRegex:this._monthsShortRegex)}function nT(t){return this._monthsParseExact?(ce(this,"_monthsRegex")||vp.call(this),t?this._monthsStrictRegex:this._monthsRegex):(ce(this,"_monthsRegex")||(this._monthsRegex=JC),this._monthsStrictRegex&&t?this._monthsStrictRegex:this._monthsRegex)}function vp(){function t(l,c){return c.length-l.length}var e=[],n=[],r=[],i,s,o,a;for(i=0;i<12;i++)s=nn([2e3,i]),o=vn(this.monthsShort(s,"")),a=vn(this.months(s,"")),e.push(o),n.push(a),r.push(a),r.push(o);e.sort(t),n.sort(t),r.sort(t),this._monthsRegex=new RegExp("^("+r.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+e.join("|")+")","i")}function rT(t,e,n,r,i,s,o){var a;return t<100&&t>=0?(a=new Date(t+400,e,n,r,i,s,o),isFinite(a.getFullYear())&&a.setFullYear(t)):a=new Date(t,e,n,r,i,s,o),a}function ds(t){var e,n;return t<100&&t>=0?(n=Array.prototype.slice.call(arguments),n[0]=t+400,e=new Date(Date.UTC.apply(null,n)),isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t)):e=new Date(Date.UTC.apply(null,arguments)),e}function Vo(t,e,n){var r=7+e-n,i=(7+ds(t,0,r).getUTCDay()-e)%7;return-i+r-1}function kp(t,e,n,r,i){var s=(7+n-r)%7,o=Vo(t,r,i),a=1+7*(e-1)+s+o,l,c;return a<=0?(l=t-1,c=ls(l)+a):a>ls(t)?(l=t+1,c=a-ls(t)):(l=t,c=a),{year:l,dayOfYear:c}}function us(t,e,n){var r=Vo(t.year(),e,n),i=Math.floor((t.dayOfYear()-r-1)/7)+1,s,o;return i<1?(o=t.year()-1,s=i+xn(o,e,n)):i>xn(t.year(),e,n)?(s=i-xn(t.year(),e,n),o=t.year()+1):(o=t.year(),s=i),{week:s,year:o}}function xn(t,e,n){var r=Vo(t,e,n),i=Vo(t+1,e,n);return(ls(t)-r+i)/7}W("w",["ww",2],"wo","week"),W("W",["WW",2],"Wo","isoWeek"),L("w",be,oi),L("ww",be,yt),L("W",be,oi),L("WW",be,yt),as(["w","ww","W","WW"],function(t,e,n,r){e[r.substr(0,1)]=se(t)});function iT(t){return us(t,this._week.dow,this._week.doy).week}var sT={dow:0,doy:6};function oT(){return this._week.dow}function aT(){return this._week.doy}function lT(t){var e=this.localeData().week(this);return t==null?e:this.add((t-e)*7,"d")}function cT(t){var e=us(this,1,4).week;return t==null?e:this.add((t-e)*7,"d")}W("d",0,"do","day"),W("dd",0,0,function(t){return this.localeData().weekdaysMin(this,t)}),W("ddd",0,0,function(t){return this.localeData().weekdaysShort(this,t)}),W("dddd",0,0,function(t){return this.localeData().weekdays(this,t)}),W("e",0,0,"weekday"),W("E",0,0,"isoWeekday"),L("d",be),L("e",be),L("E",be),L("dd",function(t,e){return e.weekdaysMinRegex(t)}),L("ddd",function(t,e){return e.weekdaysShortRegex(t)}),L("dddd",function(t,e){return e.weekdaysRegex(t)}),as(["dd","ddd","dddd"],function(t,e,n,r){var i=n._locale.weekdaysParse(t,r,n._strict);i!=null?e.d=i:Z(n).invalidWeekday=t}),as(["d","e","E"],function(t,e,n,r){e[r]=se(t)});function dT(t,e){return typeof t!="string"?t:isNaN(t)?(t=e.weekdaysParse(t),typeof t=="number"?t:null):parseInt(t,10)}function uT(t,e){return typeof t=="string"?e.weekdaysParse(t)%7||7:isNaN(t)?null:t}function Xl(t,e){return t.slice(e,7).concat(t.slice(0,e))}var fT="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),wp="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),hT="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),pT=ss,mT=ss,gT=ss;function yT(t,e){var n=Lt(this._weekdays)?this._weekdays:this._weekdays[t&&t!==!0&&this._weekdays.isFormat.test(e)?"format":"standalone"];return t===!0?Xl(n,this._week.dow):t?n[t.day()]:n}function bT(t){return t===!0?Xl(this._weekdaysShort,this._week.dow):t?this._weekdaysShort[t.day()]:this._weekdaysShort}function vT(t){return t===!0?Xl(this._weekdaysMin,this._week.dow):t?this._weekdaysMin[t.day()]:this._weekdaysMin}function kT(t,e,n){var r,i,s,o=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],r=0;r<7;++r)s=nn([2e3,1]).day(r),this._minWeekdaysParse[r]=this.weekdaysMin(s,"").toLocaleLowerCase(),this._shortWeekdaysParse[r]=this.weekdaysShort(s,"").toLocaleLowerCase(),this._weekdaysParse[r]=this.weekdays(s,"").toLocaleLowerCase();return n?e==="dddd"?(i=Me.call(this._weekdaysParse,o),i!==-1?i:null):e==="ddd"?(i=Me.call(this._shortWeekdaysParse,o),i!==-1?i:null):(i=Me.call(this._minWeekdaysParse,o),i!==-1?i:null):e==="dddd"?(i=Me.call(this._weekdaysParse,o),i!==-1||(i=Me.call(this._shortWeekdaysParse,o),i!==-1)?i:(i=Me.call(this._minWeekdaysParse,o),i!==-1?i:null)):e==="ddd"?(i=Me.call(this._shortWeekdaysParse,o),i!==-1||(i=Me.call(this._weekdaysParse,o),i!==-1)?i:(i=Me.call(this._minWeekdaysParse,o),i!==-1?i:null)):(i=Me.call(this._minWeekdaysParse,o),i!==-1||(i=Me.call(this._weekdaysParse,o),i!==-1)?i:(i=Me.call(this._shortWeekdaysParse,o),i!==-1?i:null))}function wT(t,e,n){var r,i,s;if(this._weekdaysParseExact)return kT.call(this,t,e,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;r<7;r++){if(i=nn([2e3,1]).day(r),n&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[r]||(s="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[r]=new RegExp(s.replace(".",""),"i")),n&&e==="dddd"&&this._fullWeekdaysParse[r].test(t))return r;if(n&&e==="ddd"&&this._shortWeekdaysParse[r].test(t))return r;if(n&&e==="dd"&&this._minWeekdaysParse[r].test(t))return r;if(!n&&this._weekdaysParse[r].test(t))return r}}function xT(t){if(!this.isValid())return t!=null?this:NaN;var e=cs(this,"Day");return t!=null?(t=dT(t,this.localeData()),this.add(t-e,"d")):e}function ST(t){if(!this.isValid())return t!=null?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return t==null?e:this.add(t-e,"d")}function MT(t){if(!this.isValid())return t!=null?this:NaN;if(t!=null){var e=uT(t,this.localeData());return this.day(this.day()%7?e:e-7)}else return this.day()||7}function OT(t){return this._weekdaysParseExact?(ce(this,"_weekdaysRegex")||Ql.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(ce(this,"_weekdaysRegex")||(this._weekdaysRegex=pT),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)}function CT(t){return this._weekdaysParseExact?(ce(this,"_weekdaysRegex")||Ql.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(ce(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=mT),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function TT(t){return this._weekdaysParseExact?(ce(this,"_weekdaysRegex")||Ql.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(ce(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=gT),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Ql(){function t(u,f){return f.length-u.length}var e=[],n=[],r=[],i=[],s,o,a,l,c;for(s=0;s<7;s++)o=nn([2e3,1]).day(s),a=vn(this.weekdaysMin(o,"")),l=vn(this.weekdaysShort(o,"")),c=vn(this.weekdays(o,"")),e.push(a),n.push(l),r.push(c),i.push(a),i.push(l),i.push(c);e.sort(t),n.sort(t),r.sort(t),i.sort(t),this._weekdaysRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+e.join("|")+")","i")}function ec(){return this.hours()%12||12}function ET(){return this.hours()||24}W("H",["HH",2],0,"hour"),W("h",["hh",2],0,ec),W("k",["kk",2],0,ET),W("hmm",0,0,function(){return""+ec.apply(this)+sn(this.minutes(),2)}),W("hmmss",0,0,function(){return""+ec.apply(this)+sn(this.minutes(),2)+sn(this.seconds(),2)}),W("Hmm",0,0,function(){return""+this.hours()+sn(this.minutes(),2)}),W("Hmmss",0,0,function(){return""+this.hours()+sn(this.minutes(),2)+sn(this.seconds(),2)});function xp(t,e){W(t,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}xp("a",!0),xp("A",!1);function Sp(t,e){return e._meridiemParse}L("a",Sp),L("A",Sp),L("H",be,Jl),L("h",be,oi),L("k",be,oi),L("HH",be,yt),L("hh",be,yt),L("kk",be,yt),L("hmm",up),L("hmmss",fp),L("Hmm",up),L("Hmmss",fp),ge(["H","HH"],De),ge(["k","kk"],function(t,e,n){var r=se(t);e[De]=r===24?0:r}),ge(["a","A"],function(t,e,n){n._isPm=n._locale.isPM(t),n._meridiem=t}),ge(["h","hh"],function(t,e,n){e[De]=se(t),Z(n).bigHour=!0}),ge("hmm",function(t,e,n){var r=t.length-2;e[De]=se(t.substr(0,r)),e[zt]=se(t.substr(r)),Z(n).bigHour=!0}),ge("hmmss",function(t,e,n){var r=t.length-4,i=t.length-2;e[De]=se(t.substr(0,r)),e[zt]=se(t.substr(r,2)),e[wn]=se(t.substr(i)),Z(n).bigHour=!0}),ge("Hmm",function(t,e,n){var r=t.length-2;e[De]=se(t.substr(0,r)),e[zt]=se(t.substr(r))}),ge("Hmmss",function(t,e,n){var r=t.length-4,i=t.length-2;e[De]=se(t.substr(0,r)),e[zt]=se(t.substr(r,2)),e[wn]=se(t.substr(i))});function _T(t){return(t+"").toLowerCase().charAt(0)==="p"}var NT=/[ap]\.?m?\.?/i,DT=ai("Hours",!0);function AT(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"}var Mp={calendar:kC,longDateFormat:MC,invalidDate:CC,ordinal:EC,dayOfMonthOrdinalParse:_C,relativeTime:DC,months:qC,monthsShort:mp,week:sT,weekdays:fT,weekdaysMin:hT,weekdaysShort:wp,meridiemParse:NT},we={},fs={},hs;function VT(t,e){var n,r=Math.min(t.length,e.length);for(n=0;n<r;n+=1)if(t[n]!==e[n])return n;return r}function Op(t){return t&&t.toLowerCase().replace("_","-")}function BT(t){for(var e=0,n,r,i,s;e<t.length;){for(s=Op(t[e]).split("-"),n=s.length,r=Op(t[e+1]),r=r?r.split("-"):null;n>0;){if(i=Bo(s.slice(0,n).join("-")),i)return i;if(r&&r.length>=n&&VT(s,r)>=n-1)break;n--}e++}return hs}function PT(t){return!!(t&&t.match("^[^/\\\\]*$"))}function Bo(t){var e=null,n;if(we[t]===void 0&&typeof module<"u"&&module&&module.exports&&PT(t))try{e=hs._abbr,n=require,n("./locale/"+t),Jn(e)}catch{we[t]=null}return we[t]}function Jn(t,e){var n;return t&&(lt(e)?n=Sn(t):n=tc(t,e),n?hs=n:typeof console<"u"&&console.warn&&console.warn("Locale "+t+" not found. Did you forget to load it?")),hs._abbr}function tc(t,e){if(e!==null){var n,r=Mp;if(e.abbr=t,we[t]!=null)op("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),r=we[t]._config;else if(e.parentLocale!=null)if(we[e.parentLocale]!=null)r=we[e.parentLocale]._config;else if(n=Bo(e.parentLocale),n!=null)r=n._config;else return fs[e.parentLocale]||(fs[e.parentLocale]=[]),fs[e.parentLocale].push({name:t,config:e}),null;return we[t]=new jl(zl(r,e)),fs[t]&&fs[t].forEach(function(i){tc(i.name,i.config)}),Jn(t),we[t]}else return delete we[t],null}function IT(t,e){if(e!=null){var n,r,i=Mp;we[t]!=null&&we[t].parentLocale!=null?we[t].set(zl(we[t]._config,e)):(r=Bo(t),r!=null&&(i=r._config),e=zl(i,e),r==null&&(e.abbr=t),n=new jl(e),n.parentLocale=we[t],we[t]=n),Jn(t)}else we[t]!=null&&(we[t].parentLocale!=null?(we[t]=we[t].parentLocale,t===Jn()&&Jn(t)):we[t]!=null&&delete we[t]);return we[t]}function Sn(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return hs;if(!Lt(t)){if(e=Bo(t),e)return e;t=[t]}return BT(t)}function RT(){return Wl(we)}function nc(t){var e,n=t._a;return n&&Z(t).overflow===-2&&(e=n[kn]<0||n[kn]>11?kn:n[on]<1||n[on]>Zl(n[Ue],n[kn])?on:n[De]<0||n[De]>24||n[De]===24&&(n[zt]!==0||n[wn]!==0||n[kr]!==0)?De:n[zt]<0||n[zt]>59?zt:n[wn]<0||n[wn]>59?wn:n[kr]<0||n[kr]>999?kr:-1,Z(t)._overflowDayOfYear&&(e<Ue||e>on)&&(e=on),Z(t)._overflowWeeks&&e===-1&&(e=zC),Z(t)._overflowWeekday&&e===-1&&(e=jC),Z(t).overflow=e),t}var $T=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,LT=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,FT=/Z|[+-]\d\d(?::?\d\d)?/,Po=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],rc=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],zT=/^\/?Date\((-?\d+)/i,jT=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,WT={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Cp(t){var e,n,r=t._i,i=$T.exec(r)||LT.exec(r),s,o,a,l,c=Po.length,u=rc.length;if(i){for(Z(t).iso=!0,e=0,n=c;e<n;e++)if(Po[e][1].exec(i[1])){o=Po[e][0],s=Po[e][2]!==!1;break}if(o==null){t._isValid=!1;return}if(i[3]){for(e=0,n=u;e<n;e++)if(rc[e][1].exec(i[3])){a=(i[2]||" ")+rc[e][0];break}if(a==null){t._isValid=!1;return}}if(!s&&a!=null){t._isValid=!1;return}if(i[4])if(FT.exec(i[4]))l="Z";else{t._isValid=!1;return}t._f=o+(a||"")+(l||""),sc(t)}else t._isValid=!1}function HT(t,e,n,r,i,s){var o=[YT(t),mp.indexOf(e),parseInt(n,10),parseInt(r,10),parseInt(i,10)];return s&&o.push(parseInt(s,10)),o}function YT(t){var e=parseInt(t,10);return e<=49?2e3+e:e<=999?1900+e:e}function UT(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function qT(t,e,n){if(t){var r=wp.indexOf(t),i=new Date(e[0],e[1],e[2]).getDay();if(r!==i)return Z(n).weekdayMismatch=!0,n._isValid=!1,!1}return!0}function KT(t,e,n){if(t)return WT[t];if(e)return 0;var r=parseInt(n,10),i=r%100,s=(r-i)/100;return s*60+i}function Tp(t){var e=jT.exec(UT(t._i)),n;if(e){if(n=HT(e[4],e[3],e[2],e[5],e[6],e[7]),!qT(e[1],n,t))return;t._a=n,t._tzm=KT(e[8],e[9],e[10]),t._d=ds.apply(null,t._a),t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),Z(t).rfc2822=!0}else t._isValid=!1}function JT(t){var e=zT.exec(t._i);if(e!==null){t._d=new Date(+e[1]);return}if(Cp(t),t._isValid===!1)delete t._isValid;else return;if(Tp(t),t._isValid===!1)delete t._isValid;else return;t._strict?t._isValid=!1:_.createFromInputFallback(t)}_.createFromInputFallback=Ct("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(t){t._d=new Date(t._i+(t._useUTC?" UTC":""))});function li(t,e,n){return t??e??n}function GT(t){var e=new Date(_.now());return t._useUTC?[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()]:[e.getFullYear(),e.getMonth(),e.getDate()]}function ic(t){var e,n,r=[],i,s,o;if(!t._d){for(i=GT(t),t._w&&t._a[on]==null&&t._a[kn]==null&&ZT(t),t._dayOfYear!=null&&(o=li(t._a[Ue],i[Ue]),(t._dayOfYear>ls(o)||t._dayOfYear===0)&&(Z(t)._overflowDayOfYear=!0),n=ds(o,0,t._dayOfYear),t._a[kn]=n.getUTCMonth(),t._a[on]=n.getUTCDate()),e=0;e<3&&t._a[e]==null;++e)t._a[e]=r[e]=i[e];for(;e<7;e++)t._a[e]=r[e]=t._a[e]==null?e===2?1:0:t._a[e];t._a[De]===24&&t._a[zt]===0&&t._a[wn]===0&&t._a[kr]===0&&(t._nextDay=!0,t._a[De]=0),t._d=(t._useUTC?ds:rT).apply(null,r),s=t._useUTC?t._d.getUTCDay():t._d.getDay(),t._tzm!=null&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[De]=24),t._w&&typeof t._w.d<"u"&&t._w.d!==s&&(Z(t).weekdayMismatch=!0)}}function ZT(t){var e,n,r,i,s,o,a,l,c;e=t._w,e.GG!=null||e.W!=null||e.E!=null?(s=1,o=4,n=li(e.GG,t._a[Ue],us(ve(),1,4).year),r=li(e.W,1),i=li(e.E,1),(i<1||i>7)&&(l=!0)):(s=t._locale._week.dow,o=t._locale._week.doy,c=us(ve(),s,o),n=li(e.gg,t._a[Ue],c.year),r=li(e.w,c.week),e.d!=null?(i=e.d,(i<0||i>6)&&(l=!0)):e.e!=null?(i=e.e+s,(e.e<0||e.e>6)&&(l=!0)):i=s),r<1||r>xn(n,s,o)?Z(t)._overflowWeeks=!0:l!=null?Z(t)._overflowWeekday=!0:(a=kp(n,r,i,s,o),t._a[Ue]=a.year,t._dayOfYear=a.dayOfYear)}_.ISO_8601=function(){},_.RFC_2822=function(){};function sc(t){if(t._f===_.ISO_8601){Cp(t);return}if(t._f===_.RFC_2822){Tp(t);return}t._a=[],Z(t).empty=!0;var e=""+t._i,n,r,i,s,o,a=e.length,l=0,c,u;for(i=ap(t._f,t._locale).match(Hl)||[],u=i.length,n=0;n<u;n++)s=i[n],r=(e.match($C(s,t))||[])[0],r&&(o=e.substr(0,e.indexOf(r)),o.length>0&&Z(t).unusedInput.push(o),e=e.slice(e.indexOf(r)+r.length),l+=r.length),ii[s]?(r?Z(t).empty=!1:Z(t).unusedTokens.push(s),FC(s,r,t)):t._strict&&!r&&Z(t).unusedTokens.push(s);Z(t).charsLeftOver=a-l,e.length>0&&Z(t).unusedInput.push(e),t._a[De]<=12&&Z(t).bigHour===!0&&t._a[De]>0&&(Z(t).bigHour=void 0),Z(t).parsedDateParts=t._a.slice(0),Z(t).meridiem=t._meridiem,t._a[De]=XT(t._locale,t._a[De],t._meridiem),c=Z(t).era,c!==null&&(t._a[Ue]=t._locale.erasConvertYear(c,t._a[Ue])),ic(t),nc(t)}function XT(t,e,n){var r;return n==null?e:t.meridiemHour!=null?t.meridiemHour(e,n):(t.isPM!=null&&(r=t.isPM(n),r&&e<12&&(e+=12),!r&&e===12&&(e=0)),e)}function QT(t){var e,n,r,i,s,o,a=!1,l=t._f.length;if(l===0){Z(t).invalidFormat=!0,t._d=new Date(NaN);return}for(i=0;i<l;i++)s=0,o=!1,e=Fl({},t),t._useUTC!=null&&(e._useUTC=t._useUTC),e._f=t._f[i],sc(e),$l(e)&&(o=!0),s+=Z(e).charsLeftOver,s+=Z(e).unusedTokens.length*10,Z(e).score=s,a?s<r&&(r=s,n=e):(r==null||s<r||o)&&(r=s,n=e,o&&(a=!0));Kn(t,n||e)}function eE(t){if(!t._d){var e=Ul(t._i),n=e.day===void 0?e.date:e.day;t._a=np([e.year,e.month,n,e.hour,e.minute,e.second,e.millisecond],function(r){return r&&parseInt(r,10)}),ic(t)}}function tE(t){var e=new is(nc(Ep(t)));return e._nextDay&&(e.add(1,"d"),e._nextDay=void 0),e}function Ep(t){var e=t._i,n=t._f;return t._locale=t._locale||Sn(t._l),e===null||n===void 0&&e===""?So({nullInput:!0}):(typeof e=="string"&&(t._i=e=t._locale.preparse(e)),Ft(e)?new is(nc(e)):(rs(e)?t._d=e:Lt(n)?QT(t):n?sc(t):nE(t),$l(t)||(t._d=null),t))}function nE(t){var e=t._i;lt(e)?t._d=new Date(_.now()):rs(e)?t._d=new Date(e.valueOf()):typeof e=="string"?JT(t):Lt(e)?(t._a=np(e.slice(0),function(n){return parseInt(n,10)}),ic(t)):vr(e)?eE(t):bn(e)?t._d=new Date(e):_.createFromInputFallback(t)}function _p(t,e,n,r,i){var s={};return(e===!0||e===!1)&&(r=e,e=void 0),(n===!0||n===!1)&&(r=n,n=void 0),(vr(t)&&Il(t)||Lt(t)&&t.length===0)&&(t=void 0),s._isAMomentObject=!0,s._useUTC=s._isUTC=i,s._l=n,s._i=t,s._f=e,s._strict=r,tE(s)}function ve(t,e,n,r){return _p(t,e,n,r,!1)}var rE=Ct("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var t=ve.apply(null,arguments);return this.isValid()&&t.isValid()?t<this?this:t:So()}),iE=Ct("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var t=ve.apply(null,arguments);return this.isValid()&&t.isValid()?t>this?this:t:So()});function Np(t,e){var n,r;if(e.length===1&&Lt(e[0])&&(e=e[0]),!e.length)return ve();for(n=e[0],r=1;r<e.length;++r)(!e[r].isValid()||e[r][t](n))&&(n=e[r]);return n}function sE(){var t=[].slice.call(arguments,0);return Np("isBefore",t)}function oE(){var t=[].slice.call(arguments,0);return Np("isAfter",t)}var aE=function(){return Date.now?Date.now():+new Date},ps=["year","quarter","month","week","day","hour","minute","second","millisecond"];function lE(t){var e,n=!1,r,i=ps.length;for(e in t)if(ce(t,e)&&!(Me.call(ps,e)!==-1&&(t[e]==null||!isNaN(t[e]))))return!1;for(r=0;r<i;++r)if(t[ps[r]]){if(n)return!1;parseFloat(t[ps[r]])!==se(t[ps[r]])&&(n=!0)}return!0}function cE(){return this._isValid}function dE(){return jt(NaN)}function Io(t){var e=Ul(t),n=e.year||0,r=e.quarter||0,i=e.month||0,s=e.week||e.isoWeek||0,o=e.day||0,a=e.hour||0,l=e.minute||0,c=e.second||0,u=e.millisecond||0;this._isValid=lE(e),this._milliseconds=+u+c*1e3+l*6e4+a*1e3*60*60,this._days=+o+s*7,this._months=+i+r*3+n*12,this._data={},this._locale=Sn(),this._bubble()}function Ro(t){return t instanceof Io}function oc(t){return t<0?Math.round(-1*t)*-1:Math.round(t)}function uE(t,e,n){var r=Math.min(t.length,e.length),i=Math.abs(t.length-e.length),s=0,o;for(o=0;o<r;o++)se(t[o])!==se(e[o])&&s++;return s+i}function Dp(t,e){W(t,0,0,function(){var n=this.utcOffset(),r="+";return n<0&&(n=-n,r="-"),r+sn(~~(n/60),2)+e+sn(~~n%60,2)})}Dp("Z",":"),Dp("ZZ",""),L("Z",No),L("ZZ",No),ge(["Z","ZZ"],function(t,e,n){n._useUTC=!0,n._tzm=ac(No,t)});var fE=/([\+\-]|\d\d)/gi;function ac(t,e){var n=(e||"").match(t),r,i,s;return n===null?null:(r=n[n.length-1]||[],i=(r+"").match(fE)||["-",0,0],s=+(i[1]*60)+se(i[2]),s===0?0:i[0]==="+"?s:-s)}function lc(t,e){var n,r;return e._isUTC?(n=e.clone(),r=(Ft(t)||rs(t)?t.valueOf():ve(t).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+r),_.updateOffset(n,!1),n):ve(t).local()}function cc(t){return-Math.round(t._d.getTimezoneOffset())}_.updateOffset=function(){};function hE(t,e,n){var r=this._offset||0,i;if(!this.isValid())return t!=null?this:NaN;if(t!=null){if(typeof t=="string"){if(t=ac(No,t),t===null)return this}else Math.abs(t)<16&&!n&&(t=t*60);return!this._isUTC&&e&&(i=cc(this)),this._offset=t,this._isUTC=!0,i!=null&&this.add(i,"m"),r!==t&&(!e||this._changeInProgress?Pp(this,jt(t-r,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,_.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?r:cc(this)}function pE(t,e){return t!=null?(typeof t!="string"&&(t=-t),this.utcOffset(t,e),this):-this.utcOffset()}function mE(t){return this.utcOffset(0,t)}function gE(t){return this._isUTC&&(this.utcOffset(0,t),this._isUTC=!1,t&&this.subtract(cc(this),"m")),this}function yE(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var t=ac(IC,this._i);t!=null?this.utcOffset(t):this.utcOffset(0,!0)}return this}function bE(t){return this.isValid()?(t=t?ve(t).utcOffset():0,(this.utcOffset()-t)%60===0):!1}function vE(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function kE(){if(!lt(this._isDSTShifted))return this._isDSTShifted;var t={},e;return Fl(t,this),t=Ep(t),t._a?(e=t._isUTC?nn(t._a):ve(t._a),this._isDSTShifted=this.isValid()&&uE(t._a,e.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function wE(){return this.isValid()?!this._isUTC:!1}function xE(){return this.isValid()?this._isUTC:!1}function Ap(){return this.isValid()?this._isUTC&&this._offset===0:!1}var SE=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,ME=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function jt(t,e){var n=t,r=null,i,s,o;return Ro(t)?n={ms:t._milliseconds,d:t._days,M:t._months}:bn(t)||!isNaN(+t)?(n={},e?n[e]=+t:n.milliseconds=+t):(r=SE.exec(t))?(i=r[1]==="-"?-1:1,n={y:0,d:se(r[on])*i,h:se(r[De])*i,m:se(r[zt])*i,s:se(r[wn])*i,ms:se(oc(r[kr]*1e3))*i}):(r=ME.exec(t))?(i=r[1]==="-"?-1:1,n={y:wr(r[2],i),M:wr(r[3],i),w:wr(r[4],i),d:wr(r[5],i),h:wr(r[6],i),m:wr(r[7],i),s:wr(r[8],i)}):n==null?n={}:typeof n=="object"&&("from"in n||"to"in n)&&(o=OE(ve(n.from),ve(n.to)),n={},n.ms=o.milliseconds,n.M=o.months),s=new Io(n),Ro(t)&&ce(t,"_locale")&&(s._locale=t._locale),Ro(t)&&ce(t,"_isValid")&&(s._isValid=t._isValid),s}jt.fn=Io.prototype,jt.invalid=dE;function wr(t,e){var n=t&&parseFloat(t.replace(",","."));return(isNaN(n)?0:n)*e}function Vp(t,e){var n={};return n.months=e.month()-t.month()+(e.year()-t.year())*12,t.clone().add(n.months,"M").isAfter(e)&&--n.months,n.milliseconds=+e-+t.clone().add(n.months,"M"),n}function OE(t,e){var n;return t.isValid()&&e.isValid()?(e=lc(e,t),t.isBefore(e)?n=Vp(t,e):(n=Vp(e,t),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function Bp(t,e){return function(n,r){var i,s;return r!==null&&!isNaN(+r)&&(op(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),s=n,n=r,r=s),i=jt(n,r),Pp(this,i,t),this}}function Pp(t,e,n,r){var i=e._milliseconds,s=oc(e._days),o=oc(e._months);t.isValid()&&(r=r??!0,o&&yp(t,cs(t,"Month")+o*n),s&&pp(t,"Date",cs(t,"Date")+s*n),i&&t._d.setTime(t._d.valueOf()+i*n),r&&_.updateOffset(t,s||o))}var CE=Bp(1,"add"),TE=Bp(-1,"subtract");function Ip(t){return typeof t=="string"||t instanceof String}function EE(t){return Ft(t)||rs(t)||Ip(t)||bn(t)||NE(t)||_E(t)||t===null||t===void 0}function _E(t){var e=vr(t)&&!Il(t),n=!1,r=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],i,s,o=r.length;for(i=0;i<o;i+=1)s=r[i],n=n||ce(t,s);return e&&n}function NE(t){var e=Lt(t),n=!1;return e&&(n=t.filter(function(r){return!bn(r)&&Ip(t)}).length===0),e&&n}function DE(t){var e=vr(t)&&!Il(t),n=!1,r=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],i,s;for(i=0;i<r.length;i+=1)s=r[i],n=n||ce(t,s);return e&&n}function AE(t,e){var n=t.diff(e,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"}function VE(t,e){arguments.length===1&&(arguments[0]?EE(arguments[0])?(t=arguments[0],e=void 0):DE(arguments[0])&&(e=arguments[0],t=void 0):(t=void 0,e=void 0));var n=t||ve(),r=lc(n,this).startOf("day"),i=_.calendarFormat(this,r)||"sameElse",s=e&&(rn(e[i])?e[i].call(this,n):e[i]);return this.format(s||this.localeData().calendar(i,this,ve(n)))}function BE(){return new is(this)}function PE(t,e){var n=Ft(t)?t:ve(t);return this.isValid()&&n.isValid()?(e=Tt(e)||"millisecond",e==="millisecond"?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(e).valueOf()):!1}function IE(t,e){var n=Ft(t)?t:ve(t);return this.isValid()&&n.isValid()?(e=Tt(e)||"millisecond",e==="millisecond"?this.valueOf()<n.valueOf():this.clone().endOf(e).valueOf()<n.valueOf()):!1}function RE(t,e,n,r){var i=Ft(t)?t:ve(t),s=Ft(e)?e:ve(e);return this.isValid()&&i.isValid()&&s.isValid()?(r=r||"()",(r[0]==="("?this.isAfter(i,n):!this.isBefore(i,n))&&(r[1]===")"?this.isBefore(s,n):!this.isAfter(s,n))):!1}function $E(t,e){var n=Ft(t)?t:ve(t),r;return this.isValid()&&n.isValid()?(e=Tt(e)||"millisecond",e==="millisecond"?this.valueOf()===n.valueOf():(r=n.valueOf(),this.clone().startOf(e).valueOf()<=r&&r<=this.clone().endOf(e).valueOf())):!1}function LE(t,e){return this.isSame(t,e)||this.isAfter(t,e)}function FE(t,e){return this.isSame(t,e)||this.isBefore(t,e)}function zE(t,e,n){var r,i,s;if(!this.isValid())return NaN;if(r=lc(t,this),!r.isValid())return NaN;switch(i=(r.utcOffset()-this.utcOffset())*6e4,e=Tt(e),e){case"year":s=$o(this,r)/12;break;case"month":s=$o(this,r);break;case"quarter":s=$o(this,r)/3;break;case"second":s=(this-r)/1e3;break;case"minute":s=(this-r)/6e4;break;case"hour":s=(this-r)/36e5;break;case"day":s=(this-r-i)/864e5;break;case"week":s=(this-r-i)/6048e5;break;default:s=this-r}return n?s:Et(s)}function $o(t,e){if(t.date()<e.date())return-$o(e,t);var n=(e.year()-t.year())*12+(e.month()-t.month()),r=t.clone().add(n,"months"),i,s;return e-r<0?(i=t.clone().add(n-1,"months"),s=(e-r)/(r-i)):(i=t.clone().add(n+1,"months"),s=(e-r)/(i-r)),-(n+s)||0}_.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",_.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function jE(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function WE(t){if(!this.isValid())return null;var e=t!==!0,n=e?this.clone().utc():this;return n.year()<0||n.year()>9999?Oo(n,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):rn(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",Oo(n,"Z")):Oo(n,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function HE(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var t="moment",e="",n,r,i,s;return this.isLocal()||(t=this.utcOffset()===0?"moment.utc":"moment.parseZone",e="Z"),n="["+t+'("]',r=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i="-MM-DD[T]HH:mm:ss.SSS",s=e+'[")]',this.format(n+r+i+s)}function YE(t){t||(t=this.isUtc()?_.defaultFormatUtc:_.defaultFormat);var e=Oo(this,t);return this.localeData().postformat(e)}function UE(t,e){return this.isValid()&&(Ft(t)&&t.isValid()||ve(t).isValid())?jt({to:this,from:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function qE(t){return this.from(ve(),t)}function KE(t,e){return this.isValid()&&(Ft(t)&&t.isValid()||ve(t).isValid())?jt({from:this,to:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function JE(t){return this.to(ve(),t)}function Rp(t){var e;return t===void 0?this._locale._abbr:(e=Sn(t),e!=null&&(this._locale=e),this)}var $p=Ct("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return t===void 0?this.localeData():this.locale(t)});function Lp(){return this._locale}var Lo=1e3,ci=60*Lo,Fo=60*ci,Fp=(365*400+97)*24*Fo;function di(t,e){return(t%e+e)%e}function zp(t,e,n){return t<100&&t>=0?new Date(t+400,e,n)-Fp:new Date(t,e,n).valueOf()}function jp(t,e,n){return t<100&&t>=0?Date.UTC(t+400,e,n)-Fp:Date.UTC(t,e,n)}function GE(t){var e,n;if(t=Tt(t),t===void 0||t==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?jp:zp,t){case"year":e=n(this.year(),0,1);break;case"quarter":e=n(this.year(),this.month()-this.month()%3,1);break;case"month":e=n(this.year(),this.month(),1);break;case"week":e=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":e=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":e=n(this.year(),this.month(),this.date());break;case"hour":e=this._d.valueOf(),e-=di(e+(this._isUTC?0:this.utcOffset()*ci),Fo);break;case"minute":e=this._d.valueOf(),e-=di(e,ci);break;case"second":e=this._d.valueOf(),e-=di(e,Lo);break}return this._d.setTime(e),_.updateOffset(this,!0),this}function ZE(t){var e,n;if(t=Tt(t),t===void 0||t==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?jp:zp,t){case"year":e=n(this.year()+1,0,1)-1;break;case"quarter":e=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":e=n(this.year(),this.month()+1,1)-1;break;case"week":e=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":e=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":e=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":e=this._d.valueOf(),e+=Fo-di(e+(this._isUTC?0:this.utcOffset()*ci),Fo)-1;break;case"minute":e=this._d.valueOf(),e+=ci-di(e,ci)-1;break;case"second":e=this._d.valueOf(),e+=Lo-di(e,Lo)-1;break}return this._d.setTime(e),_.updateOffset(this,!0),this}function XE(){return this._d.valueOf()-(this._offset||0)*6e4}function QE(){return Math.floor(this.valueOf()/1e3)}function e_(){return new Date(this.valueOf())}function t_(){var t=this;return[t.year(),t.month(),t.date(),t.hour(),t.minute(),t.second(),t.millisecond()]}function n_(){var t=this;return{years:t.year(),months:t.month(),date:t.date(),hours:t.hours(),minutes:t.minutes(),seconds:t.seconds(),milliseconds:t.milliseconds()}}function r_(){return this.isValid()?this.toISOString():null}function i_(){return $l(this)}function s_(){return Kn({},Z(this))}function o_(){return Z(this).overflow}function a_(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}W("N",0,0,"eraAbbr"),W("NN",0,0,"eraAbbr"),W("NNN",0,0,"eraAbbr"),W("NNNN",0,0,"eraName"),W("NNNNN",0,0,"eraNarrow"),W("y",["y",1],"yo","eraYear"),W("y",["yy",2],0,"eraYear"),W("y",["yyy",3],0,"eraYear"),W("y",["yyyy",4],0,"eraYear"),L("N",dc),L("NN",dc),L("NNN",dc),L("NNNN",b_),L("NNNNN",v_),ge(["N","NN","NNN","NNNN","NNNNN"],function(t,e,n,r){var i=n._locale.erasParse(t,r,n._strict);i?Z(n).era=i:Z(n).invalidEra=t}),L("y",si),L("yy",si),L("yyy",si),L("yyyy",si),L("yo",k_),ge(["y","yy","yyy","yyyy"],Ue),ge(["yo"],function(t,e,n,r){var i;n._locale._eraYearOrdinalRegex&&(i=t.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?e[Ue]=n._locale.eraYearOrdinalParse(t,i):e[Ue]=parseInt(t,10)});function l_(t,e){var n,r,i,s=this._eras||Sn("en")._eras;for(n=0,r=s.length;n<r;++n){switch(typeof s[n].since){case"string":i=_(s[n].since).startOf("day"),s[n].since=i.valueOf();break}switch(typeof s[n].until){case"undefined":s[n].until=1/0;break;case"string":i=_(s[n].until).startOf("day").valueOf(),s[n].until=i.valueOf();break}}return s}function c_(t,e,n){var r,i,s=this.eras(),o,a,l;for(t=t.toUpperCase(),r=0,i=s.length;r<i;++r)if(o=s[r].name.toUpperCase(),a=s[r].abbr.toUpperCase(),l=s[r].narrow.toUpperCase(),n)switch(e){case"N":case"NN":case"NNN":if(a===t)return s[r];break;case"NNNN":if(o===t)return s[r];break;case"NNNNN":if(l===t)return s[r];break}else if([o,a,l].indexOf(t)>=0)return s[r]}function d_(t,e){var n=t.since<=t.until?1:-1;return e===void 0?_(t.since).year():_(t.since).year()+(e-t.offset)*n}function u_(){var t,e,n,r=this.localeData().eras();for(t=0,e=r.length;t<e;++t)if(n=this.clone().startOf("day").valueOf(),r[t].since<=n&&n<=r[t].until||r[t].until<=n&&n<=r[t].since)return r[t].name;return""}function f_(){var t,e,n,r=this.localeData().eras();for(t=0,e=r.length;t<e;++t)if(n=this.clone().startOf("day").valueOf(),r[t].since<=n&&n<=r[t].until||r[t].until<=n&&n<=r[t].since)return r[t].narrow;return""}function h_(){var t,e,n,r=this.localeData().eras();for(t=0,e=r.length;t<e;++t)if(n=this.clone().startOf("day").valueOf(),r[t].since<=n&&n<=r[t].until||r[t].until<=n&&n<=r[t].since)return r[t].abbr;return""}function p_(){var t,e,n,r,i=this.localeData().eras();for(t=0,e=i.length;t<e;++t)if(n=i[t].since<=i[t].until?1:-1,r=this.clone().startOf("day").valueOf(),i[t].since<=r&&r<=i[t].until||i[t].until<=r&&r<=i[t].since)return(this.year()-_(i[t].since).year())*n+i[t].offset;return this.year()}function m_(t){return ce(this,"_erasNameRegex")||uc.call(this),t?this._erasNameRegex:this._erasRegex}function g_(t){return ce(this,"_erasAbbrRegex")||uc.call(this),t?this._erasAbbrRegex:this._erasRegex}function y_(t){return ce(this,"_erasNarrowRegex")||uc.call(this),t?this._erasNarrowRegex:this._erasRegex}function dc(t,e){return e.erasAbbrRegex(t)}function b_(t,e){return e.erasNameRegex(t)}function v_(t,e){return e.erasNarrowRegex(t)}function k_(t,e){return e._eraYearOrdinalRegex||si}function uc(){var t=[],e=[],n=[],r=[],i,s,o,a,l,c=this.eras();for(i=0,s=c.length;i<s;++i)o=vn(c[i].name),a=vn(c[i].abbr),l=vn(c[i].narrow),e.push(o),t.push(a),n.push(l),r.push(o),r.push(a),r.push(l);this._erasRegex=new RegExp("^("+r.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+e.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+t.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+n.join("|")+")","i")}W(0,["gg",2],0,function(){return this.weekYear()%100}),W(0,["GG",2],0,function(){return this.isoWeekYear()%100});function zo(t,e){W(0,[t,t.length],0,e)}zo("gggg","weekYear"),zo("ggggg","weekYear"),zo("GGGG","isoWeekYear"),zo("GGGGG","isoWeekYear"),L("G",_o),L("g",_o),L("GG",be,yt),L("gg",be,yt),L("GGGG",Kl,ql),L("gggg",Kl,ql),L("GGGGG",Eo,Co),L("ggggg",Eo,Co),as(["gggg","ggggg","GGGG","GGGGG"],function(t,e,n,r){e[r.substr(0,2)]=se(t)}),as(["gg","GG"],function(t,e,n,r){e[r]=_.parseTwoDigitYear(t)});function w_(t){return Wp.call(this,t,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function x_(t){return Wp.call(this,t,this.isoWeek(),this.isoWeekday(),1,4)}function S_(){return xn(this.year(),1,4)}function M_(){return xn(this.isoWeekYear(),1,4)}function O_(){var t=this.localeData()._week;return xn(this.year(),t.dow,t.doy)}function C_(){var t=this.localeData()._week;return xn(this.weekYear(),t.dow,t.doy)}function Wp(t,e,n,r,i){var s;return t==null?us(this,r,i).year:(s=xn(t,r,i),e>s&&(e=s),T_.call(this,t,e,n,r,i))}function T_(t,e,n,r,i){var s=kp(t,e,n,r,i),o=ds(s.year,0,s.dayOfYear);return this.year(o.getUTCFullYear()),this.month(o.getUTCMonth()),this.date(o.getUTCDate()),this}W("Q",0,"Qo","quarter"),L("Q",cp),ge("Q",function(t,e){e[kn]=(se(t)-1)*3});function E_(t){return t==null?Math.ceil((this.month()+1)/3):this.month((t-1)*3+this.month()%3)}W("D",["DD",2],"Do","date"),L("D",be,oi),L("DD",be,yt),L("Do",function(t,e){return t?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient}),ge(["D","DD"],on),ge("Do",function(t,e){e[on]=se(t.match(be)[0])});var Hp=ai("Date",!0);W("DDD",["DDDD",3],"DDDo","dayOfYear"),L("DDD",To),L("DDDD",dp),ge(["DDD","DDDD"],function(t,e,n){n._dayOfYear=se(t)});function __(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return t==null?e:this.add(t-e,"d")}W("m",["mm",2],0,"minute"),L("m",be,Jl),L("mm",be,yt),ge(["m","mm"],zt);var N_=ai("Minutes",!1);W("s",["ss",2],0,"second"),L("s",be,Jl),L("ss",be,yt),ge(["s","ss"],wn);var D_=ai("Seconds",!1);W("S",0,0,function(){return~~(this.millisecond()/100)}),W(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),W(0,["SSS",3],0,"millisecond"),W(0,["SSSS",4],0,function(){return this.millisecond()*10}),W(0,["SSSSS",5],0,function(){return this.millisecond()*100}),W(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),W(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),W(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),W(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),L("S",To,cp),L("SS",To,yt),L("SSS",To,dp);var Gn,Yp;for(Gn="SSSS";Gn.length<=9;Gn+="S")L(Gn,si);function A_(t,e){e[kr]=se(("0."+t)*1e3)}for(Gn="S";Gn.length<=9;Gn+="S")ge(Gn,A_);Yp=ai("Milliseconds",!1),W("z",0,0,"zoneAbbr"),W("zz",0,0,"zoneName");function V_(){return this._isUTC?"UTC":""}function B_(){return this._isUTC?"Coordinated Universal Time":""}var A=is.prototype;A.add=CE,A.calendar=VE,A.clone=BE,A.diff=zE,A.endOf=ZE,A.format=YE,A.from=UE,A.fromNow=qE,A.to=KE,A.toNow=JE,A.get=HC,A.invalidAt=o_,A.isAfter=PE,A.isBefore=IE,A.isBetween=RE,A.isSame=$E,A.isSameOrAfter=LE,A.isSameOrBefore=FE,A.isValid=i_,A.lang=$p,A.locale=Rp,A.localeData=Lp,A.max=iE,A.min=rE,A.parsingFlags=s_,A.set=YC,A.startOf=GE,A.subtract=TE,A.toArray=t_,A.toObject=n_,A.toDate=e_,A.toISOString=WE,A.inspect=HE,typeof Symbol<"u"&&Symbol.for!=null&&(A[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),A.toJSON=r_,A.toString=jE,A.unix=QE,A.valueOf=XE,A.creationData=a_,A.eraName=u_,A.eraNarrow=f_,A.eraAbbr=h_,A.eraYear=p_,A.year=hp,A.isLeapYear=WC,A.weekYear=w_,A.isoWeekYear=x_,A.quarter=A.quarters=E_,A.month=bp,A.daysInMonth=eT,A.week=A.weeks=lT,A.isoWeek=A.isoWeeks=cT,A.weeksInYear=O_,A.weeksInWeekYear=C_,A.isoWeeksInYear=S_,A.isoWeeksInISOWeekYear=M_,A.date=Hp,A.day=A.days=xT,A.weekday=ST,A.isoWeekday=MT,A.dayOfYear=__,A.hour=A.hours=DT,A.minute=A.minutes=N_,A.second=A.seconds=D_,A.millisecond=A.milliseconds=Yp,A.utcOffset=hE,A.utc=mE,A.local=gE,A.parseZone=yE,A.hasAlignedHourOffset=bE,A.isDST=vE,A.isLocal=wE,A.isUtcOffset=xE,A.isUtc=Ap,A.isUTC=Ap,A.zoneAbbr=V_,A.zoneName=B_,A.dates=Ct("dates accessor is deprecated. Use date instead.",Hp),A.months=Ct("months accessor is deprecated. Use month instead",bp),A.years=Ct("years accessor is deprecated. Use year instead",hp),A.zone=Ct("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",pE),A.isDSTShifted=Ct("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",kE);function P_(t){return ve(t*1e3)}function I_(){return ve.apply(null,arguments).parseZone()}function Up(t){return t}var de=jl.prototype;de.calendar=wC,de.longDateFormat=OC,de.invalidDate=TC,de.ordinal=NC,de.preparse=Up,de.postformat=Up,de.relativeTime=AC,de.pastFuture=VC,de.set=vC,de.eras=l_,de.erasParse=c_,de.erasConvertYear=d_,de.erasAbbrRegex=g_,de.erasNameRegex=m_,de.erasNarrowRegex=y_,de.months=GC,de.monthsShort=ZC,de.monthsParse=QC,de.monthsRegex=nT,de.monthsShortRegex=tT,de.week=iT,de.firstDayOfYear=aT,de.firstDayOfWeek=oT,de.weekdays=yT,de.weekdaysMin=vT,de.weekdaysShort=bT,de.weekdaysParse=wT,de.weekdaysRegex=OT,de.weekdaysShortRegex=CT,de.weekdaysMinRegex=TT,de.isPM=_T,de.meridiem=AT;function jo(t,e,n,r){var i=Sn(),s=nn().set(r,e);return i[n](s,t)}function qp(t,e,n){if(bn(t)&&(e=t,t=void 0),t=t||"",e!=null)return jo(t,e,n,"month");var r,i=[];for(r=0;r<12;r++)i[r]=jo(t,r,n,"month");return i}function fc(t,e,n,r){typeof t=="boolean"?(bn(e)&&(n=e,e=void 0),e=e||""):(e=t,n=e,t=!1,bn(e)&&(n=e,e=void 0),e=e||"");var i=Sn(),s=t?i._week.dow:0,o,a=[];if(n!=null)return jo(e,(n+s)%7,r,"day");for(o=0;o<7;o++)a[o]=jo(e,(o+s)%7,r,"day");return a}function R_(t,e){return qp(t,e,"months")}function $_(t,e){return qp(t,e,"monthsShort")}function L_(t,e,n){return fc(t,e,n,"weekdays")}function F_(t,e,n){return fc(t,e,n,"weekdaysShort")}function z_(t,e,n){return fc(t,e,n,"weekdaysMin")}Jn("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10,n=se(t%100/10)===1?"th":e===1?"st":e===2?"nd":e===3?"rd":"th";return t+n}}),_.lang=Ct("moment.lang is deprecated. Use moment.locale instead.",Jn),_.langData=Ct("moment.langData is deprecated. Use moment.localeData instead.",Sn);var Mn=Math.abs;function j_(){var t=this._data;return this._milliseconds=Mn(this._milliseconds),this._days=Mn(this._days),this._months=Mn(this._months),t.milliseconds=Mn(t.milliseconds),t.seconds=Mn(t.seconds),t.minutes=Mn(t.minutes),t.hours=Mn(t.hours),t.months=Mn(t.months),t.years=Mn(t.years),this}function Kp(t,e,n,r){var i=jt(e,n);return t._milliseconds+=r*i._milliseconds,t._days+=r*i._days,t._months+=r*i._months,t._bubble()}function W_(t,e){return Kp(this,t,e,1)}function H_(t,e){return Kp(this,t,e,-1)}function Jp(t){return t<0?Math.floor(t):Math.ceil(t)}function Y_(){var t=this._milliseconds,e=this._days,n=this._months,r=this._data,i,s,o,a,l;return t>=0&&e>=0&&n>=0||t<=0&&e<=0&&n<=0||(t+=Jp(hc(n)+e)*864e5,e=0,n=0),r.milliseconds=t%1e3,i=Et(t/1e3),r.seconds=i%60,s=Et(i/60),r.minutes=s%60,o=Et(s/60),r.hours=o%24,e+=Et(o/24),l=Et(Gp(e)),n+=l,e-=Jp(hc(l)),a=Et(n/12),n%=12,r.days=e,r.months=n,r.years=a,this}function Gp(t){return t*4800/146097}function hc(t){return t*146097/4800}function U_(t){if(!this.isValid())return NaN;var e,n,r=this._milliseconds;if(t=Tt(t),t==="month"||t==="quarter"||t==="year")switch(e=this._days+r/864e5,n=this._months+Gp(e),t){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(e=this._days+Math.round(hc(this._months)),t){case"week":return e/7+r/6048e5;case"day":return e+r/864e5;case"hour":return e*24+r/36e5;case"minute":return e*1440+r/6e4;case"second":return e*86400+r/1e3;case"millisecond":return Math.floor(e*864e5)+r;default:throw new Error("Unknown unit "+t)}}function On(t){return function(){return this.as(t)}}var Zp=On("ms"),q_=On("s"),K_=On("m"),J_=On("h"),G_=On("d"),Z_=On("w"),X_=On("M"),Q_=On("Q"),eN=On("y"),tN=Zp;function nN(){return jt(this)}function rN(t){return t=Tt(t),this.isValid()?this[t+"s"]():NaN}function xr(t){return function(){return this.isValid()?this._data[t]:NaN}}var iN=xr("milliseconds"),sN=xr("seconds"),oN=xr("minutes"),aN=xr("hours"),lN=xr("days"),cN=xr("months"),dN=xr("years");function uN(){return Et(this.days()/7)}var Cn=Math.round,ui={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function fN(t,e,n,r,i){return i.relativeTime(e||1,!!n,t,r)}function hN(t,e,n,r){var i=jt(t).abs(),s=Cn(i.as("s")),o=Cn(i.as("m")),a=Cn(i.as("h")),l=Cn(i.as("d")),c=Cn(i.as("M")),u=Cn(i.as("w")),f=Cn(i.as("y")),h=s<=n.ss&&["s",s]||s<n.s&&["ss",s]||o<=1&&["m"]||o<n.m&&["mm",o]||a<=1&&["h"]||a<n.h&&["hh",a]||l<=1&&["d"]||l<n.d&&["dd",l];return n.w!=null&&(h=h||u<=1&&["w"]||u<n.w&&["ww",u]),h=h||c<=1&&["M"]||c<n.M&&["MM",c]||f<=1&&["y"]||["yy",f],h[2]=e,h[3]=+t>0,h[4]=r,fN.apply(null,h)}function pN(t){return t===void 0?Cn:typeof t=="function"?(Cn=t,!0):!1}function mN(t,e){return ui[t]===void 0?!1:e===void 0?ui[t]:(ui[t]=e,t==="s"&&(ui.ss=e-1),!0)}function gN(t,e){if(!this.isValid())return this.localeData().invalidDate();var n=!1,r=ui,i,s;return typeof t=="object"&&(e=t,t=!1),typeof t=="boolean"&&(n=t),typeof e=="object"&&(r=Object.assign({},ui,e),e.s!=null&&e.ss==null&&(r.ss=e.s-1)),i=this.localeData(),s=hN(this,!n,r,i),n&&(s=i.pastFuture(+this,s)),i.postformat(s)}var pc=Math.abs;function fi(t){return(t>0)-(t<0)||+t}function Wo(){if(!this.isValid())return this.localeData().invalidDate();var t=pc(this._milliseconds)/1e3,e=pc(this._days),n=pc(this._months),r,i,s,o,a=this.asSeconds(),l,c,u,f;return a?(r=Et(t/60),i=Et(r/60),t%=60,r%=60,s=Et(n/12),n%=12,o=t?t.toFixed(3).replace(/\.?0+$/,""):"",l=a<0?"-":"",c=fi(this._months)!==fi(a)?"-":"",u=fi(this._days)!==fi(a)?"-":"",f=fi(this._milliseconds)!==fi(a)?"-":"",l+"P"+(s?c+s+"Y":"")+(n?c+n+"M":"")+(e?u+e+"D":"")+(i||r||t?"T":"")+(i?f+i+"H":"")+(r?f+r+"M":"")+(t?f+o+"S":"")):"P0D"}var le=Io.prototype;le.isValid=cE,le.abs=j_,le.add=W_,le.subtract=H_,le.as=U_,le.asMilliseconds=Zp,le.asSeconds=q_,le.asMinutes=K_,le.asHours=J_,le.asDays=G_,le.asWeeks=Z_,le.asMonths=X_,le.asQuarters=Q_,le.asYears=eN,le.valueOf=tN,le._bubble=Y_,le.clone=nN,le.get=rN,le.milliseconds=iN,le.seconds=sN,le.minutes=oN,le.hours=aN,le.days=lN,le.weeks=uN,le.months=cN,le.years=dN,le.humanize=gN,le.toISOString=Wo,le.toString=Wo,le.toJSON=Wo,le.locale=Rp,le.localeData=Lp,le.toIsoString=Ct("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Wo),le.lang=$p,W("X",0,0,"unix"),W("x",0,0,"valueOf"),L("x",_o),L("X",RC),ge("X",function(t,e,n){n._d=new Date(parseFloat(t)*1e3)}),ge("x",function(t,e,n){n._d=new Date(se(t))});//! moment.js
129
+ _.version="2.30.1",yC(ve),_.fn=A,_.min=sE,_.max=oE,_.now=aE,_.utc=nn,_.unix=P_,_.months=R_,_.isDate=rs,_.locale=Jn,_.invalid=So,_.duration=jt,_.isMoment=Ft,_.weekdays=L_,_.parseZone=I_,_.localeData=Sn,_.isDuration=Ro,_.monthsShort=$_,_.weekdaysMin=z_,_.defineLocale=tc,_.updateLocale=IT,_.locales=RT,_.weekdaysShort=F_,_.normalizeUnits=Tt,_.relativeTimeRounding=pN,_.relativeTimeThreshold=mN,_.calendarFormat=AE,_.prototype=A,_.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const Xp={__name:"DayItem",props:{day:{},today:Boolean,selected:Boolean,off:Boolean,between:Boolean,firstDay:Boolean,lastDay:Boolean},setup(t){const e={pmi:"","wpic-tools":"hover:text-lime-500 group-[.is-off]:text-slate-400 group-[.is-today]:text-lime-500 group-[.is-today]:font-medium group-[.is-selected]:bg-lime-500 group-[.is-selected]:text-white rounded-full"},n={pmi:"","wpic-tools":"bg-slate-100"},r={pmi:"","wpic-tools":"bg-slate-100 rounded-l-0"},i={pmi:"","wpic-tools":"bg-slate-100 rounded-r-0"};return(s,o)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["relative flex items-center justify-center text-sm py-2 group",{"is-today":t.today&&!t.selected,"is-selected":t.selected,"is-off":t.off,"cursor-pointer":!t.off}])},[d.createElementVNode("div",{class:d.normalizeClass(["h-8 w-full flex justify-center items-center",{[`${n[d.unref(Se).theme]}`]:t.between,[`${r[d.unref(Se).theme]}`]:t.firstDay,[`${i[d.unref(Se).theme]}`]:t.lastDay}]),style:d.normalizeStyle({marginLeft:t.firstDay?"50%":void 0,marginRight:t.lastDay?"50%":void 0})},[d.createElementVNode("span",{class:d.normalizeClass(["absolute w-8 h-8 flex items-center justify-center",[`${e[d.unref(Se).theme]}`]]),style:{left:"50%",transform:"translateX(-50%)"}},[d.renderSlot(s.$slots,"default",{},()=>[d.createTextVNode(d.toDisplayString(t.day),1)])],2)],6)],2))}},yN={},bN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},vN=[d.createElementVNode("path",{"fill-rule":"evenodd",d:"M4.72 9.47a.75.75 0 0 0 0 1.06l4.25 4.25a.75.75 0 1 0 1.06-1.06L6.31 10l3.72-3.72a.75.75 0 1 0-1.06-1.06L4.72 9.47Zm9.25-4.25L9.72 9.47a.75.75 0 0 0 0 1.06l4.25 4.25a.75.75 0 1 0 1.06-1.06L11.31 10l3.72-3.72a.75.75 0 0 0-1.06-1.06Z","clip-rule":"evenodd"},null,-1)];function kN(t,e){return d.openBlock(),d.createElementBlock("svg",bN,vN)}const wN=ye(yN,[["render",kN]]),xN={},SN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},MN=[d.createElementVNode("path",{"fill-rule":"evenodd",d:"M15.28 9.47a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 1 1-1.06-1.06L13.69 10 9.97 6.28a.75.75 0 0 1 1.06-1.06l4.25 4.25ZM6.03 5.22l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L8.69 10 4.97 6.28a.75.75 0 0 1 1.06-1.06Z","clip-rule":"evenodd"},null,-1)];function ON(t,e){return d.openBlock(),d.createElementBlock("svg",SN,MN)}const CN=ye(xN,[["render",ON]]),TN={},EN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},_N=[d.createElementVNode("path",{"fill-rule":"evenodd",d:"M11.78 5.22a.75.75 0 0 1 0 1.06L8.06 10l3.72 3.72a.75.75 0 1 1-1.06 1.06l-4.25-4.25a.75.75 0 0 1 0-1.06l4.25-4.25a.75.75 0 0 1 1.06 0Z","clip-rule":"evenodd"},null,-1)];function NN(t,e){return d.openBlock(),d.createElementBlock("svg",EN,_N)}const DN=ye(TN,[["render",NN]]),AN={},VN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},BN=[d.createElementVNode("path",{"fill-rule":"evenodd",d:"M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z","clip-rule":"evenodd"},null,-1)];function PN(t,e){return d.openBlock(),d.createElementBlock("svg",VN,BN)}const IN=ye(AN,[["render",PN]]),RN={class:"w-full"},$N={class:"flex justify-between items-center mb-3"},LN={class:"flex"},FN={class:"font-medium"},zN={class:"flex"},jN={class:"grid grid-cols-7 border-b mb-2 pb-2"},WN={class:"flex justify-center text-sm"},HN={class:"grid grid-cols-7"},Qp=Object.assign({name:"WpicCalendar"},{props:{modelValue:{},range:Boolean,doubleMonths:Boolean},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=d.ref([_(new Date),_(new Date).add(1,"month")]);d.onMounted(()=>{});const i=e,s=d.computed(()=>n.doubleMonths?[0,1]:[0]);function o(b){var C,v,T;if(n.range){if(((C=n.modelValue)==null?void 0:C.length)==0)i("update:modelValue",[b]);else if(((v=n.modelValue)==null?void 0:v.length)==2)i("update:modelValue",[b]);else if(((T=n.modelValue)==null?void 0:T.length)==1){let B=[_(n.modelValue[0]),_(b)];B=B.sort((V,F)=>V-F),i("update:modelValue",B)}}else i("update:modelValue",_(b))}function a(b){const C=_(b).daysInMonth(),v=[];for(let T=1;T<=C;T++){let B=_().date(T).month(_(b).month()).year(_(b).year());v.push(B)}return v}function l(b){return _(b).startOf("month").day()}function c(b){return _(b).subtract(1,"month")}function u(b){const C=_();return _(b).isSame(C,"day")}function f(b){var C,v;if(n.range){if(((C=n.modelValue)==null?void 0:C.length)==1)return _(b).isSame(_(n.modelValue[0]),"day");if(((v=n.modelValue)==null?void 0:v.length)==2)return _(b).isSame(_(n.modelValue[0]),"day")||_(b).isSame(_(n.modelValue[1]),"day")}else if(n.modelValue)return _(b).isSame(_(n.modelValue),"day")}function h(b){var C;if(n.range&&((C=n.modelValue)==null?void 0:C.length)==2)return _(b).isBetween(_(n.modelValue[0]),_(n.modelValue[1]))}function p(b){var C;if(n.range&&((C=n.modelValue)==null?void 0:C.length)==2)return _(b).isSame(_(n.modelValue[0]),"day")}function m(b){var C;if(n.range&&((C=n.modelValue)==null?void 0:C.length)==2)return _(b).isSame(_(n.modelValue[1]),"day")}function y(b){O(b,r.value[b].subtract(1,"month"))}function g(b){O(b,r.value[b].add(1,"month"))}function k(b){O(b,r.value[b].subtract(1,"year"))}function x(b){O(b,r.value[b].add(1,"year"))}function O(b,C){b==0?r.value=[C,r.value[1]]:r.value=[r.value[0],C]}return(b,C)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["flex-shrink-0 flex gap-6",{"min-w-96":s.value.length===1,"min-w-192":s.value.length===2}])},[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(s.value,v=>(d.openBlock(),d.createElementBlock("div",RN,[d.createElementVNode("div",$N,[d.createElementVNode("div",LN,[d.createVNode(wN,{class:"w-5 h-5 cursor-pointer select-none opacity-50 hover:opacity-100",onClick:T=>k(v)},null,8,["onClick"]),d.createVNode(DN,{class:"w-5 h-5 cursor-pointer select-none opacity-50 hover:opacity-100",onClick:T=>y(v)},null,8,["onClick"])]),d.createElementVNode("div",FN,d.toDisplayString(r.value[v].format("YYYY MMMM")),1),d.createElementVNode("div",zN,[d.createVNode(IN,{class:"w-5 h-5 cursor-pointer select-none opacity-50 hover:opacity-100",onClick:T=>g(v)},null,8,["onClick"]),d.createVNode(CN,{class:"w-5 h-5 cursor-pointer select-none opacity-50 hover:opacity-100",onClick:T=>x(v)},null,8,["onClick"])])]),d.createElementVNode("div",jN,[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(7,T=>{var B;return d.createElementVNode("div",WN,d.toDisplayString((B=r.value[v])==null?void 0:B.clone().startOf("week").subtract(1,"days").add(T,"days").format("ddd")),1)}),64))]),d.createElementVNode("div",HN,[l(r.value[v])>0?(d.openBlock(!0),d.createElementBlock(d.Fragment,{key:0},d.renderList(l(r.value[v]),T=>(d.openBlock(),d.createBlock(Xp,{off:""},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(c(r.value[v]).clone().endOf("month").subtract(l(r.value[v])-T,"days").format("D")),1)]),_:2},1024))),256)):d.createCommentVNode("",!0),(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(a(r.value[v].clone()),T=>(d.openBlock(),d.createBlock(Xp,{onClick:B=>o(T),today:u(T),selected:f(T,r.value[v]),firstDay:p(T,r.value[v]),lastDay:m(T,r.value[v]),between:h(T,r.value[v])},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(d.unref(_)(T).format("D")),1)]),_:2},1032,["onClick","today","selected","firstDay","lastDay","between"]))),256))])]))),256))],2))}}),YN={},UN={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},qN=[d.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6.75 2.994v2.25m10.5-2.25v2.25m-14.252 13.5V7.491a2.25 2.25 0 0 1 2.25-2.25h13.5a2.25 2.25 0 0 1 2.25 2.25v11.251m-18 0a2.25 2.25 0 0 0 2.25 2.25h13.5a2.25 2.25 0 0 0 2.25-2.25m-18 0v-7.5a2.25 2.25 0 0 1 2.25-2.25h13.5a2.25 2.25 0 0 1 2.25 2.25v7.5m-6.75-6h2.25m-9 2.25h4.5m.002-2.25h.005v.006H12v-.006Zm-.001 4.5h.006v.006h-.006v-.005Zm-2.25.001h.005v.006H9.75v-.006Zm-2.25 0h.005v.005h-.006v-.005Zm6.75-2.247h.005v.005h-.005v-.005Zm0 2.247h.006v.006h-.006v-.006Zm2.25-2.248h.006V15H16.5v-.005Z"},null,-1)];function KN(t,e){return d.openBlock(),d.createElementBlock("svg",UN,qN)}const JN=ye(YN,[["render",KN]]),GN={},ZN={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},XN=[d.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5m-9-6h.008v.008H12v-.008ZM12 15h.008v.008H12V15Zm0 2.25h.008v.008H12v-.008ZM9.75 15h.008v.008H9.75V15Zm0 2.25h.008v.008H9.75v-.008ZM7.5 15h.008v.008H7.5V15Zm0 2.25h.008v.008H7.5v-.008Zm6.75-4.5h.008v.008h-.008v-.008Zm0 2.25h.008v.008h-.008V15Zm0 2.25h.008v.008h-.008v-.008Zm2.25-4.5h.008v.008H16.5v-.008Zm0 2.25h.008v.008H16.5V15Z"},null,-1)];function QN(t,e){return d.openBlock(),d.createElementBlock("svg",ZN,XN)}const e2=ye(GN,[["render",QN]]),mc={WpicCalendar:Qp,WpicDateField:Object.assign({name:"WpicDateField"},{props:{modelValue:{},label:String,placeholder:{type:String,default:"Select date"},range:Boolean,disabled:Boolean,large:Boolean,info:String,doubleMonths:Boolean},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e;function i(o){r("update:modelValue",o)}const s=d.computed(()=>{var o;if(n.range)return(o=n.modelValue)==null?void 0:o.map(a=>_(a).format("YYYY-MM-DD")).join(" to ");if(n.modelValue)return _(n.modelValue).format("YYYY-MM-DD")});return(o,a)=>(d.openBlock(),d.createBlock(Ci,{disabled:t.disabled},{content:d.withCtx(()=>[d.createVNode(Qp,{doubleMonths:t.doubleMonths,modelValue:t.modelValue,"onUpdate:modelValue":i,range:t.range},null,8,["doubleMonths","modelValue","range"])]),default:d.withCtx(()=>[d.createVNode(Md,{label:t.label,disabled:t.disabled,large:t.large,info:t.info},{prepend:d.withCtx(()=>[t.range?(d.openBlock(),d.createBlock(JN,{key:0})):(d.openBlock(),d.createBlock(e2,{key:1}))]),default:d.withCtx(()=>[d.createTextVNode(" "+d.toDisplayString(s.value||t.placeholder),1)]),_:1},8,["label","disabled","large","info"])]),_:1},8,["disabled"]))}}),WpicFormInput:Md,WpicButton:xg,WpicBadge:gC,WpicTextEditor:mC,WpicInputGroup:Ng,WpicButtonGroup:Cg,WpicForm:Dg,WpicFormField:Jy,WpicSpinner:Ss,WpicPopover:Ci,WpicChoiceList:ub,WpicCard:yb,WpicCardSection:wb,WpicProgressBar:Sb,WpicTag:Ob,WpicTagGroup:Cb,WpicPagination:Pb,WpicLoadingPanel:Eb,WpicTable:Kb,WpicTableColumn:Jb};function em(t,e){for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(typeof e[n]=="object"&&t[n]?em(t[n],e[n]):t[n]=e[n])}function t2(t,e){em(Se,e);for(const n in mc)if(mc.hasOwnProperty(n)){const r=mc[n];t.component(r.name,r)}}return{install:t2,options:Se}});