@romainbx/wpic-components 0.0.61 → 0.0.62

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(Jt,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],l):(Jt=typeof globalThis<"u"?globalThis:Jt||self,l(Jt.WpicComponents={},Jt.Vue))})(this,function(Jt,l){"use strict";function qh(){return il().__VUE_DEVTOOLS_GLOBAL_HOOK__}function il(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const Uh=typeof Proxy=="function",Kh="devtools-plugin:setup",Yh="plugin:settings:set";let Wn,Ro;function Jh(){var t;return Wn!==void 0||(typeof window<"u"&&window.performance?(Wn=!0,Ro=window.performance):typeof globalThis<"u"&&(!((t=globalThis.perf_hooks)===null||t===void 0)&&t.performance)?(Wn=!0,Ro=globalThis.perf_hooks.performance):Wn=!1),Wn}function Gh(){return Jh()?Ro.now():Date.now()}class Zh{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 a=e.settings[s];r[s]=a.defaultValue}const i=`__vue-devtools-plugin-settings__${e.id}`;let o=Object.assign({},r);try{const s=localStorage.getItem(i),a=JSON.parse(s);Object.assign(o,a)}catch{}this.fallbacks={getSettings(){return o},setSettings(s){try{localStorage.setItem(i,JSON.stringify(s))}catch{}o=s},now(){return Gh()}},n&&n.on(Yh,(s,a)=>{s===this.plugin.id&&this.fallbacks.setSettings(a)}),this.proxiedOn=new Proxy({},{get:(s,a)=>this.target?this.target.on[a]:(...c)=>{this.onQueue.push({method:a,args:c})}}),this.proxiedTarget=new Proxy({},{get:(s,a)=>this.target?this.target[a]:a==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(a)?(...c)=>(this.targetQueue.push({method:a,args:c,resolve:()=>{}}),this.fallbacks[a](...c)):(...c)=>new Promise(d=>{this.targetQueue.push({method:a,args:c,resolve:d})})})}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 Xh(t,e){const n=t,r=il(),i=qh(),o=Uh&&n.enableEarlyProxy;if(i&&(r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!o))i.emit(Kh,t,e);else{const s=o?new Zh(n,i):null;(r.__VUE_DEVTOOLS_PLUGINS__=r.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:n,setupFn:e,proxy:s}),s&&e(s.proxiedTarget)}}/**
1
+ (function(Jt,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],l):(Jt=typeof globalThis<"u"?globalThis:Jt||self,l(Jt.WpicComponents={},Jt.Vue))})(this,function(Jt,l){"use strict";function Kh(){return ol().__VUE_DEVTOOLS_GLOBAL_HOOK__}function ol(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const Yh=typeof Proxy=="function",Jh="devtools-plugin:setup",Gh="plugin:settings:set";let Wn,Ro;function Zh(){var t;return Wn!==void 0||(typeof window<"u"&&window.performance?(Wn=!0,Ro=window.performance):typeof globalThis<"u"&&(!((t=globalThis.perf_hooks)===null||t===void 0)&&t.performance)?(Wn=!0,Ro=globalThis.perf_hooks.performance):Wn=!1),Wn}function Xh(){return Zh()?Ro.now():Date.now()}class Qh{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 a=e.settings[s];r[s]=a.defaultValue}const i=`__vue-devtools-plugin-settings__${e.id}`;let o=Object.assign({},r);try{const s=localStorage.getItem(i),a=JSON.parse(s);Object.assign(o,a)}catch{}this.fallbacks={getSettings(){return o},setSettings(s){try{localStorage.setItem(i,JSON.stringify(s))}catch{}o=s},now(){return Xh()}},n&&n.on(Gh,(s,a)=>{s===this.plugin.id&&this.fallbacks.setSettings(a)}),this.proxiedOn=new Proxy({},{get:(s,a)=>this.target?this.target.on[a]:(...c)=>{this.onQueue.push({method:a,args:c})}}),this.proxiedTarget=new Proxy({},{get:(s,a)=>this.target?this.target[a]:a==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(a)?(...c)=>(this.targetQueue.push({method:a,args:c,resolve:()=>{}}),this.fallbacks[a](...c)):(...c)=>new Promise(d=>{this.targetQueue.push({method:a,args:c,resolve:d})})})}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 ep(t,e){const n=t,r=ol(),i=Kh(),o=Yh&&n.enableEarlyProxy;if(i&&(r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!o))i.emit(Jh,t,e);else{const s=o?new Qh(n,i):null;(r.__VUE_DEVTOOLS_PLUGINS__=r.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:n,setupFn:e,proxy:s}),s&&e(s.proxiedTarget)}}/**
2
2
  * vee-validate v4.12.8
3
3
  * (c) 2024 Abdelrahman Awad
4
4
  * @license MIT
5
- */function Me(t){return typeof t=="function"}function ol(t){return t==null}const Gt=t=>t!==null&&!!t&&typeof t=="object"&&!Array.isArray(t);function Lo(t){return Number(t)>=0}function Qh(t){const e=parseFloat(t);return isNaN(e)?t:e}function ep(t){return typeof t=="object"&&t!==null}function tp(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}function sl(t){if(!ep(t)||tp(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(sl(e[n])&&sl(t[n])){t[n]||(t[n]={}),Br(t[n],e[n]);return}t[n]=e[n]}),t}function Ar(t){const e=t.split(".");if(!e.length)return"";let n=String(e[0]);for(let r=1;r<e.length;r++){if(Lo(e[r])){n+=`[${e[r]}]`;continue}n+=`.${e[r]}`}return n}const al={};function pt(t,e){rp(t,e),al[t]=e}function np(t){return al[t]}function rp(t,e){if(!Me(e))throw new Error(`Extension Error: The validator '${t}' must be a function.`)}function ll(t,e,n){typeof n.value=="object"&&(n.value=me(n.value)),!n.enumerable||n.get||n.set||!n.configurable||!n.writable||e==="__proto__"?Object.defineProperty(t,e,n):t[e]=n.value}function me(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(me(s))})):o==="[object Map]"?(i=new Map,t.forEach(function(s,a){i.set(me(a),me(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(me(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++)ll(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]||ll(i,n,Object.getOwnPropertyDescriptor(t,n))}return i||t}const Dr=Symbol("vee-validate-form"),cl=Symbol("vee-validate-field-instance"),Ci=Symbol("Default empty value"),ip=typeof window<"u";function zo(t){return Me(t)&&!!t.__locatorRef}function mt(t){return!!t&&Me(t.parse)&&t.__type==="VVTypedSchema"}function Oi(t){return!!t&&Me(t.validate)}function Vr(t){return t==="checkbox"||t==="radio"}function op(t){return Gt(t)||Array.isArray(t)}function sp(t){return Array.isArray(t)?t.length===0:Gt(t)&&Object.keys(t).length===0}function Ei(t){return/^\[.+\]$/i.test(t)}function ap(t){return dl(t)&&t.multiple}function dl(t){return t.tagName==="SELECT"}function lp(t,e){const n=![!1,null,void 0,0].includes(e.multiple)&&!Number.isNaN(e.multiple);return t==="select"&&"multiple"in e&&n}function cp(t,e){return!lp(t,e)&&e.type!=="file"&&!Vr(e.type)}function ul(t){return Fo(t)&&t.target&&"submit"in t.target}function Fo(t){return t?!!(typeof Event<"u"&&Me(Event)&&t instanceof Event||t&&t.srcElement):!1}function fl(t,e){return e in t&&t[e]!==Ci}function Le(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(!Le(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(!Le(r[1],e.get(r[0])))return!1;return!0}if(hl(t)&&hl(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(!Le(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function hl(t){return ip?t instanceof File:!1}function jo(t){return Ei(t)?t.replace(/\[|\]/gi,""):t}function Ue(t,e,n){return t?Ei(e)?t[jo(e)]:(e||"").split(/\.|\[(\d+)\]/).filter(Boolean).reduce((i,o)=>op(i)&&o in i?i[o]:n,t):n}function Rt(t,e,n){if(Ei(e)){t[jo(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)||ol(i[r[o]]))&&(i[r[o]]=Lo(r[o+1])?[]:{}),i=i[r[o]]}}function Ho(t,e){if(Array.isArray(t)&&Lo(e)){t.splice(Number(e),1);return}Gt(t)&&delete t[e]}function pl(t,e){if(Ei(e)){delete t[jo(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){Ho(r,n[o]);break}if(!(n[o]in r)||ol(r[n[o]]))break;r=r[n[o]]}const i=n.map((o,s)=>Ue(t,n.slice(0,s).join(".")));for(let o=i.length-1;o>=0;o--)if(sp(i[o])){if(o===0){Ho(t,n[0]);continue}Ho(i[o-1],n[o-1])}}function Ke(t){return Object.keys(t)}function Wo(t,e=void 0){const n=l.getCurrentInstance();return(n==null?void 0:n.provides[t])||l.inject(t,e)}function ml(t,e,n){if(Array.isArray(t)){const r=[...t],i=r.findIndex(o=>Le(o,e));return i>=0?r.splice(i,1):r.push(e),r}return Le(t,e)?n:e}function dp(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 gl(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 up(t,e){return Gt(e)&&e.number?Qh(t):t}function qo(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 Uo(t){return Array.isArray(t)?t:t?[t]:[]}function Mi(t,e){const n={};for(const r in t)e.includes(r)||(n[r]=t[r]);return n}function fp(t){let e=null,n=[];return function(...r){const i=l.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 Yo(t){if(yl(t))return t._value}function yl(t){return"_value"in t}function hp(t){return t.type==="number"||t.type==="range"?Number.isNaN(t.valueAsNumber)?t.value:t.valueAsNumber:t.value}function Ti(t){if(!Fo(t))return t;const e=t.target;if(Vr(e.type)&&yl(e))return Yo(e);if(e.type==="file"&&e.files){const n=Array.from(e.files);return e.multiple?n:n[0]}if(ap(e))return Array.from(e.options).filter(n=>n.selected&&!n.disabled).map(Yo);if(dl(e)){const n=Array.from(e.options).find(r=>r.selected);return n?Yo(n):e.value}return hp(e)}function bl(t){const e={};return Object.defineProperty(e,"_$$isNormalized",{value:!0,writable:!1,enumerable:!1,configurable:!1}),t?Gt(t)&&t._$$isNormalized?t:Gt(t)?Object.keys(t).reduce((n,r)=>{const i=pp(t[r]);return t[r]!==!1&&(n[r]=kl(i)),n},e):typeof t!="string"?e:t.split("|").reduce((n,r)=>{const i=mp(r);return i.name&&(n[i.name]=kl(i.params)),n},e):e}function pp(t){return t===!0?[]:Array.isArray(t)||Gt(t)?t:[t]}function kl(t){const e=n=>typeof n=="string"&&n[0]==="@"?gp(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 mp=t=>{let e=[];const n=t.split(":")[0];return t.includes(":")&&(e=t.split(":").slice(1).join(":").split(",")),{name:n,params:e}};function gp(t){const e=n=>Ue(n,t)||n[t];return e.__locatorRef=t,e}function yp(t){return Array.isArray(t)?t.filter(zo):Ke(t).filter(e=>zo(t[e])).map(e=>t[e])}let bp=Object.assign({},{generateMessage:({field:t})=>`${t} is not valid.`,bails:!0,validateOnBlur:!0,validateOnChange:!0,validateOnInput:!1,validateOnModelUpdate:!0});const vn=()=>bp;async function vl(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 kp(i,t)).errors;return{errors:s,valid:!s.length}}async function kp(t,e){if(mt(t.rules)||Oi(t.rules))return xp(e,t.rules);if(Me(t.rules)||Array.isArray(t.rules)){const s={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],c=a.length,d=[];for(let u=0;u<c;u++){const f=a[u],h=await f(e,s);if(!(typeof h!="string"&&!Array.isArray(h)&&h)){if(Array.isArray(h))d.push(...h);else{const m=typeof h=="string"?h:wl(s);d.push(m)}if(t.bails)return{errors:d}}}return{errors:d}}const n=Object.assign(Object.assign({},t),{rules:bl(t.rules)}),r=[],i=Object.keys(n.rules),o=i.length;for(let s=0;s<o;s++){const a=i[s],c=await wp(n,e,{name:a,params:n.rules[a]});if(c.error&&(r.push(c.error),t.bails))return{errors:r}}return{errors:r}}function vp(t){return!!t&&t.name==="ValidationError"}function xl(t){return{__type:"VVTypedSchema",async parse(n){var r;try{return{output:await t.validate(n,{abortEarly:!1}),errors:[]}}catch(i){if(!vp(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,a)=>{const c=a.path||"";return s[c]||(s[c]={errors:[],path:c}),s[c].errors.push(...a.errors),s},{});return{errors:Object.values(o)}}}}}async function xp(t,e){const r=await(mt(e)?e:xl(e)).parse(t),i=[];for(const o of r.errors)o.errors.length&&i.push(...o.errors);return{errors:i}}async function wp(t,e,n){const r=np(n.name);if(!r)throw new Error(`No such validator '${n.name}' exists.`);const i=Sp(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:wl(o)}}function wl(t){const e=vn().generateMessage;return e?e(t):"Field is invalid"}function Sp(t,e){const n=r=>zo(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 Cp(t,e){const r=await(mt(t)?t:xl(t)).parse(me(e)),i={},o={};for(const s of r.errors){const a=s.errors,c=(s.path||"").replace(/\["(\d+)"\]/g,(d,u)=>`[${u}]`);i[c]={valid:!a.length,errors:a},a.length&&(o[c]=a[0])}return{valid:!r.errors.length,results:i,errors:o,values:r.value}}async function Op(t,e,n){const i=Ke(t).map(async d=>{var u,f,h;const p=(u=n==null?void 0:n.names)===null||u===void 0?void 0:u[d],m=await vl(Ue(e,d),t[d],{name:(p==null?void 0:p.name)||d,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[d])!==null&&h!==void 0?h:!0});return Object.assign(Object.assign({},m),{path:d})});let o=!0;const s=await Promise.all(i),a={},c={};for(const d of s)a[d.path]={valid:d.valid,errors:d.errors},d.valid||(o=!1,c[d.path]=d.errors[0]);return{valid:o,results:a,errors:c}}let Sl=0;function Ep(t,e){const{value:n,initialValue:r,setInitialValue:i}=Mp(t,e.modelValue,e.form);if(!e.form){let h=function(p){var m;"value"in p&&(n.value=p.value),"errors"in p&&d(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:c,setErrors:d}=Np(),u=Sl>=Number.MAX_SAFE_INTEGER?0:++Sl,f=$p(n,r,c,e.schema);return{id:u,path:t,value:n,initialValue:r,meta:f,flags:{pendingUnmount:{[u]:!1},pendingReset:!1},errors:c,setState:h}}const o=e.form.createPathState(t,{bails:e.bails,label:e.label,type:e.type,validate:e.validate,schema:e.schema}),s=l.computed(()=>o.errors);function a(c){var d,u,f;"value"in c&&(n.value=c.value),"errors"in c&&((d=e.form)===null||d===void 0||d.setFieldError(l.unref(t),c.errors)),"touched"in c&&((u=e.form)===null||u===void 0||u.setFieldTouched(l.unref(t),(f=c.touched)!==null&&f!==void 0?f:!1)),"initialValue"in c&&i(c.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:a}}function Mp(t,e,n){const r=l.ref(l.unref(e));function i(){return n?Ue(n.initialValues.value,l.unref(t),l.unref(r)):l.unref(r)}function o(d){if(!n){r.value=d;return}n.setFieldInitialValue(l.unref(t),d,!0)}const s=l.computed(i);if(!n)return{value:l.ref(i()),initialValue:s,setInitialValue:o};const a=Tp(e,n,s,t);return n.stageInitialValue(l.unref(t),a,!0),{value:l.computed({get(){return Ue(n.values,l.unref(t))},set(d){n.setFieldValue(l.unref(t),d,!1)}}),initialValue:s,setInitialValue:o}}function Tp(t,e,n,r){return l.isRef(t)?l.unref(t):t!==void 0?t:Ue(e.values,l.unref(r),l.unref(n))}function $p(t,e,n,r){const i=l.computed(()=>{var s,a,c;return(c=(a=(s=l.toValue(r))===null||s===void 0?void 0:s.describe)===null||a===void 0?void 0:a.call(s).required)!==null&&c!==void 0?c:!1}),o=l.reactive({touched:!1,pending:!1,valid:!0,required:i,validated:!!l.unref(n).length,initialValue:l.computed(()=>l.unref(e)),dirty:l.computed(()=>!Le(l.unref(t),l.unref(e)))});return l.watch(n,s=>{o.valid=!s.length},{immediate:!0,flush:"sync"}),o}function Np(){const t=l.ref([]);return{errors:t,setErrors:e=>{t.value=Uo(e)}}}function Cl(t){process.env.NODE_ENV!=="production"&&Xh({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"},Dp)}const Ir={},Pr={};let Lt;const qn=dp(()=>{setTimeout(async()=>{await l.nextTick(),Lt==null||Lt.sendInspectorState(Un),Lt==null||Lt.sendInspectorTree(Un)},100)},100);function Bp(t){const e=l.getCurrentInstance();if(!Lt){const n=e==null?void 0:e.appContext.app;if(!n)return;Cl(n)}Ir[t.formId]=Object.assign({},t),Ir[t.formId]._vm=e,l.onUnmounted(()=>{delete Ir[t.formId],qn()}),qn()}function Ap(t){const e=l.getCurrentInstance();if(!Lt){const n=e==null?void 0:e.appContext.app;if(!n)return;Cl(n)}Pr[t.id]=Object.assign({},t),Pr[t.id]._vm=e,l.onUnmounted(()=>{delete Pr[t.id],qn()}),qn()}const Un="vee-validate-inspector",Ye={error:12405579,success:448379,unknown:5522283,white:16777215,black:0,blue:218007,purple:12157168,orange:16099682,gray:12304330};let we=null;function Dp(t){Lt=t,t.addInspector({id:Un,icon:"rule",label:"vee-validate",noSelectionText:"Select a vee-validate node to inspect",actions:[{icon:"done_outline",tooltip:"Validate selected item",action:async()=>{if(!we){console.error("There is not a valid selected vee-validate node or component");return}if(we.type==="field"){await we.field.validate();return}if(we.type==="form"){await we.form.validate();return}we.type==="pathState"&&await we.form.validateField(we.state.path)}},{icon:"delete_sweep",tooltip:"Clear validation state of the selected item",action:()=>{if(!we){console.error("There is not a valid selected vee-validate node or component");return}if(we.type==="field"){we.field.resetField();return}we.type==="form"&&we.form.resetForm(),we.type==="pathState"&&we.form.resetField(we.state.path)}}]}),t.on.getInspectorTree(e=>{if(e.inspectorId!==Un)return;const n=Object.values(Ir),r=Object.values(Pr);e.rootNodes=[...n.map(Vp),...r.map(i=>Pp(i))]}),t.on.getInspectorState((e,n)=>{if(e.inspectorId!==Un||n.currentTab!==`custom-inspector:${Un}`)return;const{form:r,field:i,state:o,type:s}=_p(e.nodeId);if(r&&s==="form"){e.state=Rp(r),we={type:"form",form:r};return}if(o&&s==="pathState"&&r){e.state=El(o),we={type:"pathState",state:o,form:r};return}if(i&&s==="field"){e.state=El({errors:i.errors.value,dirty:i.meta.dirty,valid:i.meta.valid,touched:i.meta.touched,value:i.value.value,initialValue:i.meta.initialValue}),we={field:i,type:"field"};return}we=null})}function Vp(t){const{textColor:e,bgColor:n}=Ml(t.meta.value.valid),r={};Object.values(t.getAllPathStates()).forEach(s=>{Rt(r,l.unref(s.path),Ip(s,t))});function i(s,a=[]){const c=[...a].pop();return"id"in s?Object.assign(Object.assign({},s),{label:c||s.label}):Gt(s)?{id:`${a.join(".")}`,label:c||"",children:Object.keys(s).map(d=>i(s[d],[...a,d]))}:Array.isArray(s)?{id:`${a.join(".")}`,label:`${c}[]`,children:s.map((d,u)=>i(d,[...a,String(u)]))}:{id:"",label:"",children:[]}}const{children:o}=i(r);return{id:Jo(t),label:"Form",children:o,tags:[{label:"Form",textColor:e,backgroundColor:n},{label:`${t.getAllPathStates().length} fields`,textColor:Ye.white,backgroundColor:Ye.unknown}]}}function Ip(t,e){return{id:Jo(e,t),label:l.unref(t.path),tags:Ol(t.multiple,t.fieldsCount,t.type,t.valid,e)}}function Pp(t,e){return{id:Jo(e,t),label:l.unref(t.name),tags:Ol(!1,1,t.type,t.meta.valid,e)}}function Ol(t,e,n,r,i){const{textColor:o,bgColor:s}=Ml(r);return[t?void 0:{label:"Field",textColor:o,backgroundColor:s},i?void 0:{label:"Standalone",textColor:Ye.black,backgroundColor:Ye.gray},n==="checkbox"?{label:"Checkbox",textColor:Ye.white,backgroundColor:Ye.blue}:void 0,n==="radio"?{label:"Radio",textColor:Ye.white,backgroundColor:Ye.purple}:void 0,t?{label:"Multiple",textColor:Ye.black,backgroundColor:Ye.orange}:void 0].filter(Boolean)}function Jo(t,e){const n=e?"path"in e?"pathState":"field":"form",r=e?"path"in e?e==null?void 0:e.path:l.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 _p(t){try{const e=JSON.parse(decodeURIComponent(atob(t))),n=Ir[e.f];if(!n&&e.ff){const i=Pr[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 El(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 Rp(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:Ke(e.value).reduce((a,c)=>{var d;const u=(d=e.value[c])===null||d===void 0?void 0:d[0];return u&&(a[c]=u),a},{})}]}}function Ml(t){return{bgColor:t?Ye.success:Ye.error,textColor:t?Ye.black:Ye.white}}function Lp(t,e,n){return Vr(n==null?void 0:n.type)?Fp(t,e,n):Tl(t,e,n)}function Tl(t,e,n){const{initialValue:r,validateOnMount:i,bails:o,type:s,checkedValue:a,label:c,validateOnValueUpdate:d,uncheckedValue:u,controlled:f,keepValueOnUnmount:h,syncVModel:p,form:m}=zp(n),g=f?Wo(Dr):void 0,y=m||g,k=l.computed(()=>Ar(l.toValue(t))),C=l.computed(()=>{if(l.toValue(y==null?void 0:y.schema))return;const X=l.unref(e);return Oi(X)||mt(X)||Me(X)||Array.isArray(X)?X:bl(X)}),N=!Me(C.value)&&mt(l.toValue(e)),{id:b,value:S,initialValue:v,meta:$,setState:D,errors:A,flags:B}=Ep(k,{modelValue:r,form:y,bails:o,label:c,type:s,validate:C.value?T:void 0,schema:N?e:void 0}),P=l.computed(()=>A.value[0]);p&&jp({value:S,prop:p,handleChange:x,shouldValidate:()=>d&&!B.pendingReset});const F=(H,X=!1)=>{$.touched=!0,X&&L()};async function G(H){var X,fe;if(y!=null&&y.validateSchema){const{results:oe}=await y.validateSchema(H);return(X=oe[l.toValue(k)])!==null&&X!==void 0?X:{valid:!0,errors:[]}}return C.value?vl(S.value,C.value,{name:l.toValue(k),label:l.toValue(c),values:(fe=y==null?void 0:y.values)!==null&&fe!==void 0?fe:{},bails:o}):{valid:!0,errors:[]}}const L=qo(async()=>($.pending=!0,$.validated=!0,G("validated-only")),H=>(B.pendingUnmount[se.id]||(D({errors:H.errors}),$.pending=!1,$.valid=H.valid),H)),I=qo(async()=>G("silent"),H=>($.valid=H.valid,H));function T(H){return(H==null?void 0:H.mode)==="silent"?I():L()}function x(H,X=!0){const fe=Ti(H);W(fe,X)}l.onMounted(()=>{if(i)return L();(!y||!y.validateSchema)&&I()});function M(H){$.touched=H}function V(H){var X;const fe=H&&"value"in H?H.value:v.value;D({value:me(fe),initialValue:me(fe),touched:(X=H==null?void 0:H.touched)!==null&&X!==void 0?X:!1,errors:(H==null?void 0:H.errors)||[]}),$.pending=!1,$.validated=!1,I()}const U=l.getCurrentInstance();function W(H,X=!0){S.value=U&&p?up(H,U.props.modelModifiers):H,(X?L:I)()}function re(H){D({errors:Array.isArray(H)?H:[H]})}const de=l.computed({get(){return S.value},set(H){W(H,d)}}),se={id:b,name:k,label:c,value:de,meta:$,errors:A,errorMessage:P,type:s,checkedValue:a,uncheckedValue:u,bails:o,keepValueOnUnmount:h,resetField:V,handleReset:()=>V(),validate:T,handleChange:x,handleBlur:F,setState:D,setTouched:M,setErrors:re,setValue:W};if(l.provide(cl,se),l.isRef(e)&&typeof l.unref(e)!="function"&&l.watch(e,(H,X)=>{Le(H,X)||($.validated?L():I())},{deep:!0}),process.env.NODE_ENV!=="production"&&(se._vm=l.getCurrentInstance(),l.watch(()=>Object.assign(Object.assign({errors:A.value},$),{value:S.value}),qn,{deep:!0}),y||Ap(se)),!y)return se;const ye=l.computed(()=>{const H=C.value;return!H||Me(H)||Oi(H)||mt(H)||Array.isArray(H)?{}:Object.keys(H).reduce((X,fe)=>{const oe=yp(H[fe]).map(he=>he.__locatorRef).reduce((he,be)=>{const Oe=Ue(y.values,be)||y.values[be];return Oe!==void 0&&(he[be]=Oe),he},{});return Object.assign(X,oe),X},{})});return l.watch(ye,(H,X)=>{if(!Object.keys(H).length)return;!Le(H,X)&&($.validated?L():I())}),l.onBeforeUnmount(()=>{var H;const X=(H=l.toValue(se.keepValueOnUnmount))!==null&&H!==void 0?H:l.toValue(y.keepValuesOnUnmount),fe=l.toValue(k);if(X||!y||B.pendingUnmount[se.id]){y==null||y.removePathState(fe,b);return}B.pendingUnmount[se.id]=!0;const oe=y.getPathState(fe);if(Array.isArray(oe==null?void 0:oe.id)&&(oe!=null&&oe.multiple)?oe!=null&&oe.id.includes(se.id):(oe==null?void 0:oe.id)===se.id){if(oe!=null&&oe.multiple&&Array.isArray(oe.value)){const be=oe.value.findIndex(Oe=>Le(Oe,l.toValue(se.checkedValue)));if(be>-1){const Oe=[...oe.value];Oe.splice(be,1),y.setFieldValue(fe,Oe)}Array.isArray(oe.id)&&oe.id.splice(oe.id.indexOf(se.id),1)}else y.unsetPathValue(l.toValue(k));y.removePathState(fe,b)}}),se}function zp(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||{}))?Go(l.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,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:s??!0,checkedValue:o,syncVModel:a})}function Fp(t,e,n){const r=n!=null&&n.standalone?void 0:Wo(Dr),i=n==null?void 0:n.checkedValue,o=n==null?void 0:n.uncheckedValue;function s(a){const c=a.handleChange,d=l.computed(()=>{const f=l.toValue(a.value),h=l.toValue(i);return Array.isArray(f)?f.findIndex(p=>Le(p,h))>=0:Le(h,f)});function u(f,h=!0){var p,m;if(d.value===((p=f==null?void 0:f.target)===null||p===void 0?void 0:p.checked)){h&&a.validate();return}const g=l.toValue(t),y=r==null?void 0:r.getPathState(g),k=Ti(f);let C=(m=l.toValue(i))!==null&&m!==void 0?m:k;r&&(y!=null&&y.multiple)&&y.type==="checkbox"?C=ml(Ue(r.values,g)||[],C,void 0):(n==null?void 0:n.type)==="checkbox"&&(C=ml(l.toValue(a.value),C,l.toValue(o))),c(C,h)}return Object.assign(Object.assign({},a),{checked:d,checkedValue:i,uncheckedValue:o,handleChange:u})}return s(Tl(t,e,n))}function jp({prop:t,value:e,handleChange:n,shouldValidate:r}){const i=l.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&&(l.watch(e,a=>{Le(a,Go(i,o))||i.emit(s,a)}),l.watch(()=>Go(i,o),a=>{if(a===Ci&&e.value===void 0)return;const c=a===Ci?void 0:a;Le(c,e.value)||n(c,r())}))}function Go(t,e){if(t)return t.props[e]}const Hp=l.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:()=>vn().bails},label:{type:String,default:void 0},uncheckedValue:{type:null,default:void 0},modelValue:{type:null,default:Ci},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=l.toRef(t,"rules"),r=l.toRef(t,"name"),i=l.toRef(t,"label"),o=l.toRef(t,"uncheckedValue"),s=l.toRef(t,"keepValue"),{errors:a,value:c,errorMessage:d,validate:u,handleChange:f,handleBlur:h,setTouched:p,resetField:m,handleReset:g,meta:y,checked:k,setErrors:C}=Lp(r,n,{validateOnMount:t.validateOnMount,bails:t.bails,standalone:t.standalone,type:e.attrs.type,initialValue:qp(t,e),checkedValue:e.attrs.value,uncheckedValue:o,label:i,validateOnValueUpdate:t.validateOnModelUpdate,keepValueOnUnmount:s,syncVModel:!0}),N=function(A,B=!0){f(A,B)},b=l.computed(()=>{const{validateOnInput:D,validateOnChange:A,validateOnBlur:B,validateOnModelUpdate:P}=Wp(t);function F(T){h(T,B),Me(e.attrs.onBlur)&&e.attrs.onBlur(T)}function G(T){N(T,D),Me(e.attrs.onInput)&&e.attrs.onInput(T)}function L(T){N(T,A),Me(e.attrs.onChange)&&e.attrs.onChange(T)}const I={name:t.name,onBlur:F,onInput:G,onChange:L};return I["onUpdate:modelValue"]=T=>N(T,P),I}),S=l.computed(()=>{const D=Object.assign({},b.value);Vr(e.attrs.type)&&k&&(D.checked=k.value);const A=$l(t,e);return cp(A,e.attrs)&&(D.value=c.value),D}),v=l.computed(()=>Object.assign(Object.assign({},b.value),{modelValue:c.value}));function $(){return{field:S.value,componentField:v.value,value:c.value,meta:y,errors:a.value,errorMessage:d.value,validate:u,resetField:m,handleChange:N,handleInput:D=>N(D,!1),handleReset:g,handleBlur:b.value.onBlur,setTouched:p,setErrors:C}}return e.expose({value:c,meta:y,errors:a,errorMessage:d,setErrors:C,setTouched:p,reset:m,validate:u,handleChange:f}),()=>{const D=l.resolveDynamicComponent($l(t,e)),A=Ko(D,e,$);return D?l.h(D,Object.assign(Object.assign({},e.attrs),S.value),A):A}}});function $l(t,e){let n=t.as||"";return!t.as&&!e.slots.default&&(n="input"),n}function Wp(t){var e,n,r,i;const{validateOnInput:o,validateOnChange:s,validateOnBlur:a,validateOnModelUpdate:c}=vn();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:a,validateOnModelUpdate:(i=t.validateOnModelUpdate)!==null&&i!==void 0?i:c}}function qp(t,e){return Vr(e.attrs.type)?fl(t,"modelValue")?t.modelValue:void 0:fl(t,"modelValue")?t.modelValue:e.attrs.value}const _r=Hp;let Up=0;const $i=["bails","fieldsCount","id","multiple","type","validate"];function Nl(t){const e=(t==null?void 0:t.initialValues)||{},n=Object.assign({},l.toValue(e)),r=l.unref(t==null?void 0:t.validationSchema);return r&&mt(r)&&Me(r.cast)?me(r.cast(n)||{}):me(n)}function Kp(t){var e;const n=Up++;let r=0;const i=l.ref(!1),o=l.ref(!1),s=l.ref(0),a=[],c=l.reactive(Nl(t)),d=l.ref([]),u=l.ref({}),f=l.ref({}),h=fp(()=>{f.value=d.value.reduce((E,O)=>(E[Ar(l.toValue(O.path))]=O,E),{})});function p(E,O){const _=T(E);if(!_){typeof E=="string"&&(u.value[Ar(E)]=Uo(O));return}if(typeof E=="string"){const K=Ar(E);u.value[K]&&delete u.value[K]}_.errors=Uo(O),_.valid=!_.errors.length}function m(E){Ke(E).forEach(O=>{p(O,E[O])})}t!=null&&t.initialErrors&&m(t.initialErrors);const g=l.computed(()=>{const E=d.value.reduce((O,_)=>(_.errors.length&&(O[_.path]=_.errors),O),{});return Object.assign(Object.assign({},u.value),E)}),y=l.computed(()=>Ke(g.value).reduce((E,O)=>{const _=g.value[O];return _!=null&&_.length&&(E[O]=_[0]),E},{})),k=l.computed(()=>d.value.reduce((E,O)=>(E[O.path]={name:O.path||"",label:O.label||""},E),{})),C=l.computed(()=>d.value.reduce((E,O)=>{var _;return E[O.path]=(_=O.bails)!==null&&_!==void 0?_:!0,E},{})),N=Object.assign({},(t==null?void 0:t.initialErrors)||{}),b=(e=t==null?void 0:t.keepValuesOnUnmount)!==null&&e!==void 0?e:!1,{initialValues:S,originalInitialValues:v,setInitialValues:$}=Jp(d,c,t),D=Yp(d,c,v,y),A=l.computed(()=>d.value.reduce((E,O)=>{const _=Ue(c,O.path);return Rt(E,O.path,_),E},{})),B=t==null?void 0:t.validationSchema;function P(E,O){var _,K;const ee=l.computed(()=>Ue(S.value,l.toValue(E))),w=f.value[l.toValue(E)],z=(O==null?void 0:O.type)==="checkbox"||(O==null?void 0:O.type)==="radio";if(w&&z){w.multiple=!0;const qe=r++;return Array.isArray(w.id)?w.id.push(qe):w.id=[w.id,qe],w.fieldsCount++,w.__flags.pendingUnmount[qe]=!1,w}const Y=l.computed(()=>Ue(c,l.toValue(E))),Q=l.toValue(E),te=M.findIndex(qe=>qe===Q);te!==-1&&M.splice(te,1);const ae=l.computed(()=>{var qe,it,Hn,kn;const _t=l.toValue(B);if(mt(_t))return(it=(qe=_t.describe)===null||qe===void 0?void 0:qe.call(_t,l.toValue(E)).required)!==null&&it!==void 0?it:!1;const Si=l.toValue(O==null?void 0:O.schema);return mt(Si)&&(kn=(Hn=Si.describe)===null||Hn===void 0?void 0:Hn.call(Si).required)!==null&&kn!==void 0?kn:!1}),pe=r++,xe=l.reactive({id:pe,path:E,touched:!1,pending:!1,valid:!0,validated:!!(!((_=N[Q])===null||_===void 0)&&_.length),required:ae,initialValue:ee,errors:l.shallowRef([]),bails:(K=O==null?void 0:O.bails)!==null&&K!==void 0?K:!1,label:O==null?void 0:O.label,type:(O==null?void 0:O.type)||"default",value:Y,multiple:!1,__flags:{pendingUnmount:{[pe]:!1},pendingReset:!1},fieldsCount:1,validate:O==null?void 0:O.validate,dirty:l.computed(()=>!Le(l.unref(Y),l.unref(ee)))});return d.value.push(xe),f.value[Q]=xe,h(),y.value[Q]&&!N[Q]&&l.nextTick(()=>{ft(Q,{mode:"silent"})}),l.isRef(E)&&l.watch(E,qe=>{h();const it=me(Y.value);f.value[qe]=xe,l.nextTick(()=>{Rt(c,qe,it)})}),xe}const F=gl(Pt,5),G=gl(Pt,5),L=qo(async E=>await(E==="silent"?F():G()),(E,[O])=>{const _=Ke(H.errorBag.value),ee=[...new Set([...Ke(E.results),...d.value.map(w=>w.path),..._])].sort().reduce((w,z)=>{var Y;const Q=z,te=T(Q)||x(Q),ae=((Y=E.results[Q])===null||Y===void 0?void 0:Y.errors)||[],pe=l.toValue(te==null?void 0:te.path)||Q,xe=Gp({errors:ae,valid:!ae.length},w.results[pe]);return w.results[pe]=xe,xe.valid||(w.errors[pe]=xe.errors[0]),te&&u.value[pe]&&delete u.value[pe],te?(te.valid=xe.valid,O==="silent"||O==="validated-only"&&!te.validated||p(te,xe.errors),w):(p(pe,ae),w)},{valid:E.valid,results:{},errors:{}});return E.values&&(ee.values=E.values),Ke(ee.results).forEach(w=>{var z;const Y=T(w);Y&&O!=="silent"&&(O==="validated-only"&&!Y.validated||p(Y,(z=ee.results[w])===null||z===void 0?void 0:z.errors))}),ee});function I(E){d.value.forEach(E)}function T(E){const O=typeof E=="string"?Ar(E):E;return typeof O=="string"?f.value[O]:O}function x(E){return d.value.filter(_=>E.startsWith(_.path)).reduce((_,K)=>_?K.path.length>_.path.length?K:_:K,void 0)}let M=[],V;function U(E){return M.push(E),V||(V=l.nextTick(()=>{[...M].sort().reverse().forEach(_=>{pl(c,_)}),M=[],V=null})),V}function W(E){return function(_,K){return function(w){return w instanceof Event&&(w.preventDefault(),w.stopPropagation()),I(z=>z.touched=!0),i.value=!0,s.value++,xt().then(z=>{const Y=me(c);if(z.valid&&typeof _=="function"){const Q=me(A.value);let te=E?Q:Y;return z.values&&(te=z.values),_(te,{evt:w,controlledValues:Q,setErrors:m,setFieldError:p,setTouched:gn,setFieldTouched:be,setValues:oe,setFieldValue:X,resetForm:Kt,resetField:yn})}!z.valid&&typeof K=="function"&&K({values:Y,evt:w,errors:z.errors,results:z.results})}).then(z=>(i.value=!1,z),z=>{throw i.value=!1,z})}}}const de=W(!1);de.withControlled=W(!0);function se(E,O){const _=d.value.findIndex(ee=>ee.path===E&&(Array.isArray(ee.id)?ee.id.includes(O):ee.id===O)),K=d.value[_];if(!(_===-1||!K)){if(l.nextTick(()=>{ft(E,{mode:"silent",warn:!1})}),K.multiple&&K.fieldsCount&&K.fieldsCount--,Array.isArray(K.id)){const ee=K.id.indexOf(O);ee>=0&&K.id.splice(ee,1),delete K.__flags.pendingUnmount[O]}(!K.multiple||K.fieldsCount<=0)&&(d.value.splice(_,1),ht(E),h(),delete f.value[E])}}function ye(E){Ke(f.value).forEach(O=>{O.startsWith(E)&&delete f.value[O]}),d.value=d.value.filter(O=>!O.path.startsWith(E)),l.nextTick(()=>{h()})}const H={formId:n,values:c,controlledValues:A,errorBag:g,errors:y,schema:B,submitCount:s,meta:D,isSubmitting:i,isValidating:o,fieldArrays:a,keepValuesOnUnmount:b,validateSchema:l.unref(B)?L:void 0,validate:xt,setFieldError:p,validateField:ft,setFieldValue:X,setValues:oe,setErrors:m,setFieldTouched:be,setTouched:gn,resetForm:Kt,resetField:yn,handleSubmit:de,useFieldModel:Tr,defineInputBinds:$r,defineComponentBinds:Nr,defineField:bn,stageInitialValue:It,unsetInitialValue:ht,setFieldInitialValue:Yt,createPathState:P,getPathState:T,unsetPathValue:U,removePathState:se,initialValues:S,getAllPathStates:()=>d.value,destroyPath:ye,isFieldTouched:Oe,isFieldDirty:ut,isFieldValid:Mr};function X(E,O,_=!0){const K=me(O),ee=typeof E=="string"?E:E.path;T(ee)||P(ee),Rt(c,ee,K),_&&ft(ee)}function fe(E,O=!0){Ke(c).forEach(_=>{delete c[_]}),Ke(E).forEach(_=>{X(_,E[_],!1)}),O&&xt()}function oe(E,O=!0){Br(c,E),a.forEach(_=>_&&_.reset()),O&&xt()}function he(E,O){const _=T(l.toValue(E))||P(E);return l.computed({get(){return _.value},set(K){var ee;const w=l.toValue(E);X(w,K,(ee=l.toValue(O))!==null&&ee!==void 0?ee:!1)}})}function be(E,O){const _=T(E);_&&(_.touched=O)}function Oe(E){const O=T(E);return O?O.touched:d.value.filter(_=>_.path.startsWith(E)).some(_=>_.touched)}function ut(E){const O=T(E);return O?O.dirty:d.value.filter(_=>_.path.startsWith(E)).some(_=>_.dirty)}function Mr(E){const O=T(E);return O?O.valid:d.value.filter(_=>_.path.startsWith(E)).every(_=>_.valid)}function gn(E){if(typeof E=="boolean"){I(O=>{O.touched=E});return}Ke(E).forEach(O=>{be(O,!!E[O])})}function yn(E,O){var _;const K=O&&"value"in O?O.value:Ue(S.value,E),ee=T(E);ee&&(ee.__flags.pendingReset=!0),Yt(E,me(K),!0),X(E,K,!1),be(E,(_=O==null?void 0:O.touched)!==null&&_!==void 0?_:!1),p(E,(O==null?void 0:O.errors)||[]),l.nextTick(()=>{ee&&(ee.__flags.pendingReset=!1)})}function Kt(E,O){let _=me(E!=null&&E.values?E.values:v.value);_=O!=null&&O.force?_:Br(v.value,_),_=mt(B)&&Me(B.cast)?B.cast(_):_,$(_),I(K=>{var ee;K.__flags.pendingReset=!0,K.validated=!1,K.touched=((ee=E==null?void 0:E.touched)===null||ee===void 0?void 0:ee[K.path])||!1,X(K.path,Ue(_,K.path),!1),p(K.path,void 0)}),O!=null&&O.force?fe(_,!1):oe(_,!1),m((E==null?void 0:E.errors)||{}),s.value=(E==null?void 0:E.submitCount)||0,l.nextTick(()=>{xt({mode:"silent"}),I(K=>{K.__flags.pendingReset=!1})})}async function xt(E){const O=(E==null?void 0:E.mode)||"force";if(O==="force"&&I(w=>w.validated=!0),H.validateSchema)return H.validateSchema(O);o.value=!0;const _=await Promise.all(d.value.map(w=>w.validate?w.validate(E).then(z=>({key:w.path,valid:z.valid,errors:z.errors})):Promise.resolve({key:w.path,valid:!0,errors:[]})));o.value=!1;const K={},ee={};for(const w of _)K[w.key]={valid:w.valid,errors:w.errors},w.errors.length&&(ee[w.key]=w.errors[0]);return{valid:_.every(w=>w.valid),results:K,errors:ee}}async function ft(E,O){var _;const K=T(E);if(K&&(O==null?void 0:O.mode)!=="silent"&&(K.validated=!0),B){const{results:w}=await L((O==null?void 0:O.mode)||"validated-only");return w[E]||{errors:[],valid:!0}}return K!=null&&K.validate?K.validate(O):(!K&&((_=O==null?void 0:O.warn)!==null&&_!==void 0?_:!0)&&process.env.NODE_ENV!=="production"&&l.warn(`field with path ${E} was not found`),Promise.resolve({errors:[],valid:!0}))}function ht(E){pl(S.value,E)}function It(E,O,_=!1){Yt(E,O),Rt(c,E,O),_&&!(t!=null&&t.initialValues)&&Rt(v.value,E,me(O))}function Yt(E,O,_=!1){Rt(S.value,E,me(O)),_&&Rt(v.value,E,me(O))}async function Pt(){const E=l.unref(B);if(!E)return{valid:!0,results:{},errors:{}};o.value=!0;const O=Oi(E)||mt(E)?await Cp(E,c):await Op(E,c,{names:k.value,bailsMap:C.value});return o.value=!1,O}const jn=de((E,{evt:O})=>{ul(O)&&O.target.submit()});l.onMounted(()=>{if(t!=null&&t.initialErrors&&m(t.initialErrors),t!=null&&t.initialTouched&&gn(t.initialTouched),t!=null&&t.validateOnMount){xt();return}H.validateSchema&&H.validateSchema("silent")}),l.isRef(B)&&l.watch(B,()=>{var E;(E=H.validateSchema)===null||E===void 0||E.call(H,"validated-only")}),l.provide(Dr,H),process.env.NODE_ENV!=="production"&&(Bp(H),l.watch(()=>Object.assign(Object.assign({errors:g.value},D.value),{values:c,isSubmitting:i.value,isValidating:o.value,submitCount:s.value}),qn,{deep:!0}));function bn(E,O){const _=Me(O)||O==null?void 0:O.label,K=T(l.toValue(E))||P(E,{label:_}),ee=()=>Me(O)?O(Mi(K,$i)):O||{};function w(){var ae;K.touched=!0,((ae=ee().validateOnBlur)!==null&&ae!==void 0?ae:vn().validateOnBlur)&&ft(K.path)}function z(){var ae;((ae=ee().validateOnInput)!==null&&ae!==void 0?ae:vn().validateOnInput)&&l.nextTick(()=>{ft(K.path)})}function Y(){var ae;((ae=ee().validateOnChange)!==null&&ae!==void 0?ae:vn().validateOnChange)&&l.nextTick(()=>{ft(K.path)})}const Q=l.computed(()=>{const ae={onChange:Y,onInput:z,onBlur:w};return Me(O)?Object.assign(Object.assign({},ae),O(Mi(K,$i)).props||{}):O!=null&&O.props?Object.assign(Object.assign({},ae),O.props(Mi(K,$i))):ae});return[he(E,()=>{var ae,pe,xe;return(xe=(ae=ee().validateOnModelUpdate)!==null&&ae!==void 0?ae:(pe=vn())===null||pe===void 0?void 0:pe.validateOnModelUpdate)!==null&&xe!==void 0?xe:!0}),Q]}function Tr(E){return Array.isArray(E)?E.map(O=>he(O,!0)):he(E)}function $r(E,O){const[_,K]=bn(E,O);function ee(){K.value.onBlur()}function w(Y){const Q=Ti(Y);X(l.toValue(E),Q,!1),K.value.onInput()}function z(Y){const Q=Ti(Y);X(l.toValue(E),Q,!1),K.value.onChange()}return l.computed(()=>Object.assign(Object.assign({},K.value),{onBlur:ee,onInput:w,onChange:z,value:_.value}))}function Nr(E,O){const[_,K]=bn(E,O),ee=T(l.toValue(E));function w(z){_.value=z}return l.computed(()=>{const z=Me(O)?O(Mi(ee,$i)):O||{};return Object.assign({[z.model||"modelValue"]:_.value,[`onUpdate:${z.model||"modelValue"}`]:w},K.value)})}return Object.assign(Object.assign({},H),{values:l.readonly(c),handleReset:()=>Kt(),submitForm:jn})}function Yp(t,e,n,r){const i={touched:"some",pending:"some",valid:"every"},o=l.computed(()=>!Le(e,l.unref(n)));function s(){const c=t.value;return Ke(i).reduce((d,u)=>{const f=i[u];return d[u]=c[f](h=>h[u]),d},{})}const a=l.reactive(s());return l.watchEffect(()=>{const c=s();a.touched=c.touched,a.valid=c.valid,a.pending=c.pending}),l.computed(()=>Object.assign(Object.assign({initialValues:l.unref(n)},a),{valid:a.valid&&!Ke(r.value).length,dirty:o.value}))}function Jp(t,e,n){const r=Nl(n),i=l.ref(r),o=l.ref(me(r));function s(a,c=!1){i.value=Br(me(i.value)||{},me(a)),o.value=Br(me(o.value)||{},me(a)),c&&t.value.forEach(d=>{if(d.touched)return;const f=Ue(i.value,d.path);Rt(e,d.path,me(f))})}return{initialValues:i,originalInitialValues:o,setInitialValues:s}}function Gp(t,e){return e?{valid:t.valid&&e.valid,errors:[...t.errors,...e.errors]}:t}const Zp=l.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=l.toRef(t,"validationSchema"),r=l.toRef(t,"keepValues"),{errors:i,errorBag:o,values:s,meta:a,isSubmitting:c,isValidating:d,submitCount:u,controlledValues:f,validate:h,validateField:p,handleReset:m,resetForm:g,handleSubmit:y,setErrors:k,setFieldError:C,setFieldValue:N,setValues:b,setFieldTouched:S,setTouched:v,resetField:$}=Kp({validationSchema:n.value?n:void 0,initialValues:t.initialValues,initialErrors:t.initialErrors,initialTouched:t.initialTouched,validateOnMount:t.validateOnMount,keepValuesOnUnmount:r}),D=y((T,{evt:x})=>{ul(x)&&x.target.submit()},t.onInvalidSubmit),A=t.onSubmit?y(t.onSubmit,t.onInvalidSubmit):D;function B(T){Fo(T)&&T.preventDefault(),m(),typeof e.attrs.onReset=="function"&&e.attrs.onReset()}function P(T,x){return y(typeof T=="function"&&!x?T:x,t.onInvalidSubmit)(T)}function F(){return me(s)}function G(){return me(a.value)}function L(){return me(i.value)}function I(){return{meta:a.value,errors:i.value,errorBag:o.value,values:s,isSubmitting:c.value,isValidating:d.value,submitCount:u.value,controlledValues:f.value,validate:h,validateField:p,handleSubmit:P,handleReset:m,submitForm:D,setErrors:k,setFieldError:C,setFieldValue:N,setValues:b,setFieldTouched:S,setTouched:v,resetForm:g,resetField:$,getValues:F,getMeta:G,getErrors:L}}return e.expose({setFieldError:C,setErrors:k,setFieldValue:N,setValues:b,setFieldTouched:S,setTouched:v,resetForm:g,validate:h,validateField:p,resetField:$,getValues:F,getMeta:G,getErrors:L,values:s,meta:a,errors:i}),function(){const x=t.as==="form"?t.as:t.as?l.resolveDynamicComponent(t.as):null,M=Ko(x,e,I);if(!x)return M;const V=x==="form"?{novalidate:!0}:{};return l.h(x,Object.assign(Object.assign(Object.assign({},V),e.attrs),{onSubmit:A,onReset:B}),M)}}}),Xp=l.defineComponent({name:"ErrorMessage",props:{as:{type:String,default:void 0},name:{type:String,required:!0}},setup(t,e){const n=l.inject(Dr,void 0),r=l.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?l.resolveDynamicComponent(t.as):t.as,s=Ko(o,e,i),a=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)?l.h(o||"span",a,r.value):l.h(o,a,s)}}});function Qp(t){const e=Wo(Dr),n=t?void 0:l.inject(cl);return l.computed(()=>t?e==null?void 0:e.errors.value[l.toValue(t)]:n==null?void 0:n.errorMessage.value)}pt("required",t=>typeof t=="number"&&t!=null||typeof t=="object"&&t!=null||typeof t=="boolean"&&t===!0?!0:!t||!t.length?"This field is required":!0),pt("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"}),pt("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"),pt("no_space",t=>(t==null?void 0:t.indexOf(" "))>-1?"This field shouldn't contain space":!0),pt("minLength",(t,[e])=>!t||!t.length?!0:t.length<e?`This field must be at least ${e} characters`:!0),pt("hasUppercaseLetter",t=>/[A-Z]/.test(t)?!0:"This field must have at least one uppercase character"),pt("hasLowercaseLetter",t=>/[a-z]/.test(t)?!0:"This field must have at least one lowercase character"),pt("hasNumber",t=>/\d/.test(t)?!0:"This field must have at least one number"),pt("hasSpecialCharacter",t=>/[!@$%^&*(),.?":{}|]/.test(t)?!0:"This field must have at least one special character"),pt("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"}),pt("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},em={},tm={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",fill:"currentColor"},nm=[l.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 rm(t,e){return l.openBlock(),l.createElementBlock("svg",tm,nm)}const im=ue(em,[["render",rm]]),om={},sm={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",fill:"currentColor"},am=[l.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 lm(t,e){return l.openBlock(),l.createElementBlock("svg",sm,am)}const cm=ue(om,[["render",lm]]),dm={class:"relative"},Kn=Object.assign({name:"WpicSpinner"},{props:{color:{type:String,default:""}},setup(t){return(e,n)=>(l.openBlock(),l.createElementBlock("div",dm,[l.createVNode(im,{class:"absolute opacity-25"}),l.createVNode(cm,{class:l.normalizeClass(["animate-spin",{[`${t.color}`]:!0}])},null,8,["class"])]))}});let ne={theme:"wpic-tools",popoverTarget:"body"};const um=["is","type","disabled"],fm={key:0,class:"absolute inset-0 flex justify-center items-center"},hm={class:"rounded-lg py-1 min-w-48 bg-white border border-gray-300 dark:bg-gray-930 dark:border-gray-920 shadow-md"},pm=["onClick"],Ni=Object.assign({name:"WpicButton"},{props:{label:String,primary:Boolean,type:{type:String,default:"button"},secondary:Boolean,destructive:Boolean,inverse:Boolean,disabled:Boolean,full:Boolean,loading:Boolean,colorless:Boolean,outline:{type:Boolean,default:!0},medium:Boolean,small:Boolean,plain:Boolean,outlining:Boolean,square:Boolean,to:[String,Object],actions:{}},setup(t){const e=t,n=l.ref(null),r=l.ref(null),i=l.ref(!1),o=l.computed(()=>e.to?"router-link":"div"),s=k=>{r.value&&!r.value.contains(k.target)&&n.value&&!n.value.contains(k.target)&&(i.value=!1)};l.onMounted(()=>{document.addEventListener("click",s)}),l.onUnmounted(()=>{document.removeEventListener("click",s)});const a={pmi:"has-[.medium]:h-10 has-[.medium]:text-sm has-[.small]:h-8 has-[.small]:text-xs h-12","wpic-tools":"rounded-md has-[.medium]:h-8 has-[.medium]:text-sm has-[.small]:h-6 has-[.small]:text-xs h-10"},c={pmi:"","wpic-tools":"bg-transparent text-gray-700 disabled:text-gray-700/50 enabled:hover:bg-gray-900/5 enabled:active:bg-gray-200 enabled:active:shadow-inner dark:enabled:border-gray-900 dark:text-gray-400 dark:enabled:hover:bg-gray-900 dark:enabled:active:bg-gray-930 dark:disabled:text-gray-400/50"},d={pmi:"","wpic-tools":"bg-transparent text-red-600 disabled:text-red-600/50 enabled:hover:bg-red-500/5 enabled:active:bg-red-100 enabled:active:shadow-inner dark:text-red-400 dark:enabled:hover:bg-red-500/10 dark:enabled:active:bg-red-500/25 dark:disabled:text-red-500/50"},u={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":"border-none! bg-linear-to-b bg-lime-500 text-white disabled:text-white/50 border-none shadow-[0_1px_0_0_--theme(--color-white/30%)_inset,0_-1px_1px_0_--theme(--color-black/5%)_inset] enabled:active:shadow-inner enabled:hover:bg-lime-400 enabled:active:text-white/80 dark:shadow-[0_1px_0_0_--theme(--color-white/5%)_inset,0_0_0_1px_--theme(--color-white/2%)_inset] dark:bg-lime-700 dark:enabled:active:shadow-inner dark:enabled:hover:bg-lime-600"},f={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":"border-none! bg-linear-to-b bg-gray-500 text-white disabled:text-white/50 shadow-[0_1px_0_0_--theme(--color-white/30%)_inset,0_-1px_1px_0_--theme(--color-black/5%)_inset] enabled:active:shadow-inner enabled:hover:bg-gray-400 enabled:active:text-white/80 dark:shadow-[0_1px_0_0_--theme(--color-white/5%)_inset,0_0_0_1px_--theme(--color-white/2%)_inset] dark:bg-gray-700 dark:enabled:active:shadow-inner dark:enabled:hover:bg-gray-600"},h={pmi:"","wpic-tools":"border-none! text-white bg-linear-to-b bg-red-500 disabled:text-red-600/50 border-red-500 enabled:hover:bg-red-400 shadow-[0_1px_0_0_--theme(--color-white/30%)_inset,0_-1px_1px_0_--theme(--color-black/5%)_inset] enabled:hover:border-red-600 enabled:active:shadow-inner enabled:active:text-white/80 enabled:active:bg-red-700 enabled:active:border-red-700 dark:bg-red-400/70 dark:border-red-400/70"},p={pmi:"border-zinc-300 dark:border-zinc-700 dark:text-zinc-300","wpic-tools":" text-gray-950 disabled:text-gray-950/50 border-none ring-1 ring-black/5 shadow-xs enabled:hover:bg-gray-50 enabled:active:text-gray-950/60 dark:bg-gray-900 dark:text-white dark:disabled:text-white/50 dark:shadow-[0_1px_0_0_--theme(--color-white/5%)_inset,0_0_0_1px_--theme(--color-white/2%)_inset] enabled:active:shadow-inner dark:hover:bg-gray-800 dark:enabled:active:text-white/80"},m={pmi:"text-violet-800 hover:underline","wpic-tools":"text-lime-800 hover:underline"},g={pmi:"text-red-600 hover:text-red-500 hover:underline","wpic-tools":"text-red-600 disabled:text-red-600/50 hover:text-red-500 dark:text-red-400 dark:hover:text-red-500 hover:underline"},y={pmi:"hover:text-violet-800 hover:underline","wpic-tools":"dark:text-gray-200 hover:text-lime-800 hover:underline"};return(k,C)=>{var N;return l.openBlock(),l.createElementBlock("button",{ref_key:"reference",ref:n,is:o.value,type:t.type,disabled:t.disabled,onClick:C[0]||(C[0]=b=>{var S;return(S=t.actions)!=null&&S.length?i.value=!i.value:null}),class:l.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,[`${a[l.unref(ne).theme]}`]:!0,[`${u[l.unref(ne).theme]}`]:t.primary&&!t.plain&&!t.inverse,[`${f[l.unref(ne).theme]}`]:t.secondary,[`${p[l.unref(ne).theme]}`]:!t.primary&&!t.secondary&&!t.plain&&!t.colorless&&!t.destructive,[`${m[l.unref(ne).theme]}`]:t.primary&&t.plain,[`${y[l.unref(ne).theme]}`]:!t.primary&&!t.destructive&&t.plain,[`${c[l.unref(ne).theme]}`]:t.colorless,[`${h[l.unref(ne).theme]}`]:t.destructive&&!t.plain&&!t.colorless,[`${g[l.unref(ne).theme]}`]:t.destructive&&t.plain,[`${d[l.unref(ne).theme]}`]:t.destructive&&t.colorless,"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,"h-auto":t.plain,"rounded-sm":!t.plain,"aspect-square":t.square},"wpic-button leading-none font-medium no-underline appearance-none outline-zinc-600 focus:outline-hidden relative inline-flex justify-center items-center"])},[t.loading?(l.openBlock(),l.createElementBlock("div",fm,[l.createVNode(Kn,{class:"w-6 h-6"})])):l.createCommentVNode("",!0),(l.openBlock(),l.createBlock(l.resolveDynamicComponent(o.value),{to:t.to,class:l.normalizeClass(["flex items-center justify-center select-none whitespace-nowrap py-1 h-full",{medium:t.medium,small:t.small,"opacity-0":t.loading,"px-2":!!(t.small&&!t.plain),"px-3":!!(t.medium&&!t.plain),"px-4":!t.small&&!t.medium&&!t.plain,"px-0! aspect-square":t.square}])},{default:l.withCtx(()=>[l.renderSlot(k.$slots,"default",{},()=>[l.createTextVNode(l.toDisplayString(t.label),1)])]),_:3},8,["to","class"])),(N=t.actions)!=null&&N.length&&i.value?(l.openBlock(),l.createElementBlock("div",{key:1,ref_key:"floating",ref:r,class:"absolute z-30 top-12 left-0"},[l.createElementVNode("div",hm,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(t.actions,b=>(l.openBlock(),l.createElementBlock("div",{onClick:b.value,class:"font-normal h-10 flex items-center px-4 hover:bg-gray-100 dark:hover:bg-white/5"},l.toDisplayString(b.label),9,pm))),256))])],512)):l.createCommentVNode("",!0)],10,um)}}}),mm=Object.assign({name:"WpicButtonGroup"},{setup(t){const e={pmi:"border","wpic-tools":"border-gray-300"};return(n,r)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["wpic-button-group flex flex-wrap h-10",[e[l.unref(ne).theme]]])},[l.renderSlot(n.$slots,"default")],2))}}),gm={name:"WpicInputGroup"},ym={class:"wpic-input-group flex w-full"};function bm(t,e,n,r,i,o){return l.openBlock(),l.createElementBlock("div",ym,[l.renderSlot(t.$slots,"default")])}const km=ue(gm,[["render",bm]]),vm=Object.assign({name:"WpicForm"},{setup(t,{expose:e}){const n=l.ref();async function r(){return await n.value.validate()}function i(){n.value.resetForm()}function o(){return n.value}function s(){return n.value.errors}return e({validate:r,resetForm:i,getForm:o,errors:s}),(a,c)=>(l.openBlock(),l.createBlock(l.unref(Zp),{ref_key:"myForm",ref:n},{default:l.withCtx(({values:d,meta:u,errors:f})=>[l.renderSlot(a.$slots,"default")]),_:3},512))}}),Rr=Math.min,Yn=Math.max,Bi=Math.round,Zt=t=>({x:t,y:t}),xm={left:"right",right:"left",bottom:"top",top:"bottom"},wm={start:"end",end:"start"};function Zo(t,e,n){return Yn(t,Rr(e,n))}function Lr(t,e){return typeof t=="function"?t(e):t}function xn(t){return t.split("-")[0]}function zr(t){return t.split("-")[1]}function Bl(t){return t==="x"?"y":"x"}function Xo(t){return t==="y"?"height":"width"}function Ai(t){return["top","bottom"].includes(xn(t))?"y":"x"}function Qo(t){return Bl(Ai(t))}function Sm(t,e,n){n===void 0&&(n=!1);const r=zr(t),i=Qo(t),o=Xo(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=Di(s)),[s,Di(s)]}function Cm(t){const e=Di(t);return[es(t),e,es(e)]}function es(t){return t.replace(/start|end/g,e=>wm[e])}function Om(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 Em(t,e,n,r){const i=zr(t);let o=Om(xn(t),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),e&&(o=o.concat(o.map(es)))),o}function Di(t){return t.replace(/left|right|bottom|top/g,e=>xm[e])}function Mm(t){return{top:0,right:0,bottom:0,left:0,...t}}function Al(t){return typeof t!="number"?Mm(t):{top:t,right:t,bottom:t,left:t}}function Vi(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 Dl(t,e,n){let{reference:r,floating:i}=t;const o=Ai(e),s=Qo(e),a=Xo(s),c=xn(e),d=o==="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(c){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(zr(e)){case"start":p[s]-=h*(n&&d?-1:1);break;case"end":p[s]+=h*(n&&d?-1:1);break}return p}const Tm=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(e));let d=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:f}=Dl(d,r,c),h=r,p={},m=0;for(let g=0;g<a.length;g++){const{name:y,fn:k}=a[g],{x:C,y:N,data:b,reset:S}=await k({x:u,y:f,initialPlacement:r,placement:h,strategy:i,middlewareData:p,rects:d,platform:s,elements:{reference:t,floating:e}});u=C??u,f=N??f,p={...p,[y]:{...p[y],...b}},S&&m<=50&&(m++,typeof S=="object"&&(S.placement&&(h=S.placement),S.rects&&(d=S.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:i}):S.rects),{x:u,y:f}=Dl(d,h,c)),g=-1)}return{x:u,y:f,placement:h,strategy:i,middlewareData:p}};async function Vl(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:c}=t,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=Lr(e,t),m=Al(p),y=a[h?f==="floating"?"reference":"floating":f],k=Vi(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(y)))==null||n?y:y.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:d,rootBoundary:u,strategy:c})),C=f==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),b=await(o.isElement==null?void 0:o.isElement(N))?await(o.getScale==null?void 0:o.getScale(N))||{x:1,y:1}:{x:1,y:1},S=Vi(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:C,offsetParent:N,strategy:c}):C);return{top:(k.top-S.top+m.top)/b.y,bottom:(S.bottom-k.bottom+m.bottom)/b.y,left:(k.left-S.left+m.left)/b.x,right:(S.right-k.right+m.right)/b.x}}const $m=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:c}=e,{element:d,padding:u=0}=Lr(t,e)||{};if(d==null)return{};const f=Al(u),h={x:n,y:r},p=Qo(i),m=Xo(p),g=await s.getDimensions(d),y=p==="y",k=y?"top":"left",C=y?"bottom":"right",N=y?"clientHeight":"clientWidth",b=o.reference[m]+o.reference[p]-h[p]-o.floating[m],S=h[p]-o.reference[p],v=await(s.getOffsetParent==null?void 0:s.getOffsetParent(d));let $=v?v[N]:0;(!$||!await(s.isElement==null?void 0:s.isElement(v)))&&($=a.floating[N]||o.floating[m]);const D=b/2-S/2,A=$/2-g[m]/2-1,B=Rr(f[k],A),P=Rr(f[C],A),F=B,G=$-g[m]-P,L=$/2-g[m]/2+D,I=Zo(F,L,G),T=!c.arrow&&zr(i)!=null&&L!==I&&o.reference[m]/2-(L<F?B:P)-g[m]/2<0,x=T?L<F?L-F:L-G:0;return{[p]:h[p]+x,data:{[p]:I,centerOffset:L-I-x,...T&&{alignmentOffset:x}},reset:T}}}),Nm=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:a,platform:c,elements:d}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...y}=Lr(t,e);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const k=xn(i),C=xn(a)===a,N=await(c.isRTL==null?void 0:c.isRTL(d.floating)),b=h||(C||!g?[Di(a)]:Cm(a));!h&&m!=="none"&&b.push(...Em(a,g,m,N));const S=[a,...b],v=await Vl(e,y),$=[];let D=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&$.push(v[k]),f){const F=Sm(i,s,N);$.push(v[F[0]],v[F[1]])}if(D=[...D,{placement:i,overflows:$}],!$.every(F=>F<=0)){var A,B;const F=(((A=o.flip)==null?void 0:A.index)||0)+1,G=S[F];if(G)return{data:{index:F,overflows:D},reset:{placement:G}};let L=(B=D.filter(I=>I.overflows[0]<=0).sort((I,T)=>I.overflows[1]-T.overflows[1])[0])==null?void 0:B.placement;if(!L)switch(p){case"bestFit":{var P;const I=(P=D.map(T=>[T.placement,T.overflows.filter(x=>x>0).reduce((x,M)=>x+M,0)]).sort((T,x)=>T[1]-x[1])[0])==null?void 0:P[0];I&&(L=I);break}case"initialPlacement":L=a;break}if(i!==L)return{reset:{placement:L}}}return{}}}};async function Bm(t,e){const{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=xn(n),a=zr(n),c=Ai(n)==="y",d=["left","top"].includes(s)?-1:1,u=o&&c?-1:1,f=Lr(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),c?{x:p*u,y:h*d}:{x:h*d,y:p*u}}const Am=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:a}=e,c=await Bm(e,t);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:o+c.y,data:{...c,placement:s}}}}},Dm=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:a={fn:y=>{let{x:k,y:C}=y;return{x:k,y:C}}},...c}=Lr(t,e),d={x:n,y:r},u=await Vl(e,c),f=Ai(xn(i)),h=Bl(f);let p=d[h],m=d[f];if(o){const y=h==="y"?"top":"left",k=h==="y"?"bottom":"right",C=p+u[y],N=p-u[k];p=Zo(C,p,N)}if(s){const y=f==="y"?"top":"left",k=f==="y"?"bottom":"right",C=m+u[y],N=m-u[k];m=Zo(C,m,N)}const g=a.fn({...e,[h]:p,[f]:m});return{...g,data:{x:g.x-n,y:g.y-r}}}}};function wn(t){return ts(t)?(t.nodeName||"").toLowerCase():"#document"}function Xe(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Xt(t){var e;return(e=(ts(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function ts(t){return t instanceof Node||t instanceof Xe(t).Node}function wt(t){return t instanceof Element||t instanceof Xe(t).Element}function St(t){return t instanceof HTMLElement||t instanceof Xe(t).HTMLElement}function Il(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Xe(t).ShadowRoot}function Fr(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=gt(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function Vm(t){return["table","td","th"].includes(wn(t))}function ns(t){const e=rs(),n=gt(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 Im(t){let e=Qt(t);for(;St(e)&&!Jn(e);){if(ns(e))return e;e=Qt(e)}return null}function rs(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Jn(t){return["html","body","#document"].includes(wn(t))}function gt(t){return Xe(t).getComputedStyle(t)}function Ii(t){return wt(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Qt(t){if(wn(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Il(t)&&t.host||Xt(t);return Il(e)?e.host:e}function Pl(t){const e=Qt(t);return Jn(e)?t.ownerDocument?t.ownerDocument.body:t.body:St(e)&&Fr(e)?e:Pl(e)}function is(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=Pl(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),s=Xe(i);return o?e.concat(s,s.visualViewport||[],Fr(i)?i:[],s.frameElement&&n?is(s.frameElement):[]):e.concat(i,is(i,[],n))}function _l(t){const e=gt(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=St(t),o=i?t.offsetWidth:n,s=i?t.offsetHeight:r,a=Bi(n)!==o||Bi(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function Rl(t){return wt(t)?t:t.contextElement}function Gn(t){const e=Rl(t);if(!St(e))return Zt(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:o}=_l(e);let s=(o?Bi(n.width):n.width)/r,a=(o?Bi(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const Pm=Zt(0);function Ll(t){const e=Xe(t);return!rs()||!e.visualViewport?Pm:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function _m(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Xe(t)?!1:e}function jr(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),o=Rl(t);let s=Zt(1);e&&(r?wt(r)&&(s=Gn(r)):s=Gn(t));const a=_m(o,n,r)?Ll(o):Zt(0);let c=(i.left+a.x)/s.x,d=(i.top+a.y)/s.y,u=i.width/s.x,f=i.height/s.y;if(o){const h=Xe(o),p=r&&wt(r)?Xe(r):r;let m=h,g=m.frameElement;for(;g&&r&&p!==m;){const y=Gn(g),k=g.getBoundingClientRect(),C=gt(g),N=k.left+(g.clientLeft+parseFloat(C.paddingLeft))*y.x,b=k.top+(g.clientTop+parseFloat(C.paddingTop))*y.y;c*=y.x,d*=y.y,u*=y.x,f*=y.y,c+=N,d+=b,m=Xe(g),g=m.frameElement}}return Vi({width:u,height:f,x:c,y:d})}const Rm=[":popover-open",":modal"];function ss(t){return Rm.some(e=>{try{return t.matches(e)}catch{return!1}})}function Lm(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const o=i==="fixed",s=Xt(r),a=e?ss(e.floating):!1;if(r===s||a&&o)return n;let c={scrollLeft:0,scrollTop:0},d=Zt(1);const u=Zt(0),f=St(r);if((f||!f&&!o)&&((wn(r)!=="body"||Fr(s))&&(c=Ii(r)),St(r))){const h=jr(r);d=Gn(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+u.x,y:n.y*d.y-c.scrollTop*d.y+u.y}}function zm(t){return Array.from(t.getClientRects())}function zl(t){return jr(Xt(t)).left+Ii(t).scrollLeft}function Fm(t){const e=Xt(t),n=Ii(t),r=t.ownerDocument.body,i=Yn(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=Yn(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+zl(t);const a=-n.scrollTop;return gt(r).direction==="rtl"&&(s+=Yn(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}function jm(t,e){const n=Xe(t),r=Xt(t),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,c=0;if(i){o=i.width,s=i.height;const d=rs();(!d||d&&e==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:o,height:s,x:a,y:c}}function Hm(t,e){const n=jr(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=St(t)?Gn(t):Zt(1),s=t.clientWidth*o.x,a=t.clientHeight*o.y,c=i*o.x,d=r*o.y;return{width:s,height:a,x:c,y:d}}function Fl(t,e,n){let r;if(e==="viewport")r=jm(t,n);else if(e==="document")r=Fm(Xt(t));else if(wt(e))r=Hm(e,n);else{const i=Ll(t);r={...e,x:e.x-i.x,y:e.y-i.y}}return Vi(r)}function jl(t,e){const n=Qt(t);return n===e||!wt(n)||Jn(n)?!1:gt(n).position==="fixed"||jl(n,e)}function Wm(t,e){const n=e.get(t);if(n)return n;let r=is(t,[],!1).filter(a=>wt(a)&&wn(a)!=="body"),i=null;const o=gt(t).position==="fixed";let s=o?Qt(t):t;for(;wt(s)&&!Jn(s);){const a=gt(s),c=ns(s);!c&&a.position==="fixed"&&(i=null),(o?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Fr(s)&&!c&&jl(t,s))?r=r.filter(u=>u!==s):i=a,s=Qt(s)}return e.set(t,r),r}function qm(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const s=[...n==="clippingAncestors"?ss(e)?[]:Wm(e,this._c):[].concat(n),r],a=s[0],c=s.reduce((d,u)=>{const f=Fl(e,u,i);return d.top=Yn(f.top,d.top),d.right=Rr(f.right,d.right),d.bottom=Rr(f.bottom,d.bottom),d.left=Yn(f.left,d.left),d},Fl(e,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Um(t){const{width:e,height:n}=_l(t);return{width:e,height:n}}function Km(t,e,n){const r=St(e),i=Xt(e),o=n==="fixed",s=jr(t,!0,o,e);let a={scrollLeft:0,scrollTop:0};const c=Zt(0);if(r||!r&&!o)if((wn(e)!=="body"||Fr(i))&&(a=Ii(e)),r){const f=jr(e,!0,o,e);c.x=f.x+e.clientLeft,c.y=f.y+e.clientTop}else i&&(c.x=zl(i));const d=s.left+a.scrollLeft-c.x,u=s.top+a.scrollTop-c.y;return{x:d,y:u,width:s.width,height:s.height}}function as(t){return gt(t).position==="static"}function Hl(t,e){return!St(t)||gt(t).position==="fixed"?null:e?e(t):t.offsetParent}function Wl(t,e){const n=Xe(t);if(ss(t))return n;if(!St(t)){let i=Qt(t);for(;i&&!Jn(i);){if(wt(i)&&!as(i))return i;i=Qt(i)}return n}let r=Hl(t,e);for(;r&&Vm(r)&&as(r);)r=Hl(r,e);return r&&Jn(r)&&as(r)&&!ns(r)?n:r||Im(t)||n}const Ym=async function(t){const e=this.getOffsetParent||Wl,n=this.getDimensions,r=await n(t.floating);return{reference:Km(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Jm(t){return gt(t).direction==="rtl"}const Gm={convertOffsetParentRelativeRectToViewportRelativeRect:Lm,getDocumentElement:Xt,getClippingRect:qm,getOffsetParent:Wl,getElementRects:Ym,getClientRects:zm,getDimensions:Um,getScale:Gn,isElement:wt,isRTL:Jm},ql=Am,Ul=Dm,Kl=Nm,Zm=$m,Yl=(t,e,n)=>{const r=new Map,i={platform:Gm,...n},o={...i.platform,_c:r};return Tm(t,e,{...i,platform:o})};function Xm(t){return t!=null&&typeof t=="object"&&"$el"in t}function Qm(t){if(Xm(t)){const e=t.$el;return ts(e)&&wn(e)==="#comment"?null:e}return t}function eg(t){return{name:"arrow",options:t,fn(e){const n=Qm(l.unref(t.element));return n==null?{}:Zm({element:n,padding:t.padding}).fn(e)}}}const tg={},ng={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},rg=[l.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"},null,-1)];function ig(t,e){return l.openBlock(),l.createElementBlock("svg",ng,rg)}const Hr=ue(tg,[["render",ig]]);let Pi;const og=new Uint8Array(16);function sg(){if(!Pi&&(Pi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Pi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Pi(og)}const Ae=[];for(let t=0;t<256;++t)Ae.push((t+256).toString(16).slice(1));function ag(t,e=0){return Ae[t[e+0]]+Ae[t[e+1]]+Ae[t[e+2]]+Ae[t[e+3]]+"-"+Ae[t[e+4]]+Ae[t[e+5]]+"-"+Ae[t[e+6]]+Ae[t[e+7]]+"-"+Ae[t[e+8]]+Ae[t[e+9]]+"-"+Ae[t[e+10]]+Ae[t[e+11]]+Ae[t[e+12]]+Ae[t[e+13]]+Ae[t[e+14]]+Ae[t[e+15]]}const Jl={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ls(t,e,n){if(Jl.randomUUID&&!t)return Jl.randomUUID();t=t||{};const r=t.random||(t.rng||sg)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,ag(r)}let lg={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 Sn=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:{},maxWidth:{type:String,default:"600px"},expand:Boolean,noCloseClasses:{type:Array,default:()=>[]}},emits:["show","hide"],setup(t,{expose:e,emit:n}){const r=ls(),i=n,o=t,s={pmi:"md:absolute md:block bg-white shadow-[0_5px_30px_0px_rgba(0,0,0,0.25)]","wpic-tools":"block absolute mt-2 bg-white border border-gray-300 dark:bg-gray-930 dark:border-gray-920 shadow-md"},a=l.ref(null),c=l.ref(null),d=l.ref(!0);function u(){o.disabled||(d.value=!1,p()),i("show"),document.dispatchEvent(new CustomEvent("submenu-open",{detail:{uuid:r}}))}function f(k){if(d.value)u();else{if(o.noCloseClasses.some(C=>k.target.closest(`.${C}`))){console.log(`Click inside ${o.noCloseClasses} ignored.`);return}h()}}function h(){i("hide"),document.documentElement.style.overflow=null,document.querySelector("#app").style.overflow=null,d.value=!0}async function p(){const k=await Yl(a.value,c.value,{placement:o.placement,middleware:[Kl(),Ul(),ql(o.offset)]});c.value.style.left=`${k.x}px`,c.value.style.top=`${k.y}px`}const m=k=>{c.value&&!c.value.contains(k.target)&&a.value&&!a.value.contains(k.target)&&h()};l.onMounted(()=>{document.addEventListener("click",m),document.addEventListener("submenu-open",k=>{k.detail.uuid!==r&&h()})}),l.onUnmounted(()=>{document.removeEventListener("click",m),document.removeEventListener("submenu-open",h)});function g(){o.hover&&u()}function y(){o.hover&&h()}return e({hide:h}),(k,C)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[(l.openBlock(),l.createElementBlock("div",{class:"flex-1",key:`reference_${l.unref(r)}`,ref_key:"reference",ref:a,onMouseenter:g,onMouseleave:y,onClick:C[0]||(C[0]=l.withModifiers(N=>f(N),["stop"]))},[l.renderSlot(k.$slots,"default",{isHidden:d.value})],32)),(l.openBlock(),l.createBlock(l.Teleport,{to:l.unref(ne).popoverTarget},[(l.openBlock(),l.createElementBlock("div",{key:`floating_${l.unref(r)}`,ref_key:"floating",ref:c,style:l.normalizeStyle({maxWidth:t.maxWidth}),class:l.normalizeClass(["z-30 rounded-md overflow-hidden",{[`${t.customWidth}`]:!0,hidden:d.value,[`${s[l.unref(ne).theme]}`]:!d.value,"rounded-md":!t.custom,"px-3 py-2":!t.custom&&!t.expand}])},[l.renderSlot(k.$slots,"content")],6))],8,["to"]))],64))}}),cg={},dg={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},ug=[l.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4.5 12.75l6 6 9-13.5"},null,-1)];function fg(t,e){return l.openBlock(),l.createElementBlock("svg",dg,ug)}const Gl=ue(cg,[["render",fg]]),hg={},pg={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},mg=[l.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"},null,-1)];function gg(t,e){return l.openBlock(),l.createElementBlock("svg",pg,mg)}const yg=ue(hg,[["render",gg]]),bg={},kg={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},vg=[l.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 xg(t,e){return l.openBlock(),l.createElementBlock("svg",kg,vg)}const cs=ue(bg,[["render",xg]]),wg={key:0,class:"mb-2 wpic-form-label text-base text-gray-500 dark:text-gray-500 flex items-center justify-between"},Sg={class:"flex items-center gap-2"},Cg={key:0},Og={class:""},Eg={class:"flex justify-end"},Mg={key:0,class:"absolute dark:text-gray-400 left-0 ml-0 w-9 h-full flex items-center justify-center text-center"},Tg={class:"flex items-center justify-center text-center opacity-50 w-4 h-4 leading-none overflow-hidden"},$g={key:1,class:"absolute right-0 mr-2 h-full flex items-center cursor-pointer opacity-75 hover:opacity-100"},_i=Object.assign({name:"WpicFormInput"},{props:{label:String,info:String,disabled:Boolean,large:Boolean,small:Boolean,clearable:Boolean,loading:Boolean,invalid:Boolean,slim:Boolean,required:Boolean,hideRequired:Boolean,material:Boolean,naked:Boolean},emits:["onClear","update:modelValue"],setup(t,{emit:e}){const n={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":"text-gray-800 bg-white border-gray-300 focus:border-lime-400 focus-within:border-lime-400 dark:bg-gray-930 dark:border-gray-920 dark:hover:bg-gray-920 dark:text-gray-400"},r={pmi:"border-opacity-50 border-zinc-300 text-zinc-400","wpic-tools":"border-gray-200! text-gray-400! bg-gray-50!"},i=e;function o(){i("onClear")}return(s,a)=>(l.openBlock(),l.createElementBlock("div",null,[t.label?(l.openBlock(),l.createElementBlock("div",wg,[l.createElementVNode("div",Sg,[l.createElementVNode("span",null,l.toDisplayString(t.label),1),t.required&&!t.hideRequired?(l.openBlock(),l.createElementBlock("span",Cg,"*")):l.createCommentVNode("",!0),l.createElementVNode("div",Og,[t.info?(l.openBlock(),l.createBlock(Sn,{key:0,hover:""},{content:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(t.info),1)]),default:l.withCtx(()=>[l.createVNode(cs,{class:"w-4 h-4 text-zinc-600"})]),_:1})):l.createCommentVNode("",!0)])]),l.createElementVNode("div",Eg,[l.renderSlot(s.$slots,"more")])])):l.createCommentVNode("",!0),l.createElementVNode("div",{class:l.normalizeClass(["wpic-input overflow-auto leading-none flex relative items-center",{"border rounded-sm pr-3":!t.naked,"!pl-0 pr-1 !bg-transparent":t.naked,"border-b":t.material,"pl-4":!s.$slots.prepend,"pl-8":s.$slots.prepend,[`${n[l.unref(ne).theme]}`]:!0,"h-8 text-sm":t.small,"h-10":!t.large&&!t.small,"h-12":t.large,[`${r[l.unref(ne).theme]}`]:t.disabled,"cursor-pointer":!t.disabled,"border-red-600! focus-within:outline-red-600":t.invalid}])},[s.$slots.prepend?(l.openBlock(),l.createElementBlock("div",Mg,[l.createElementVNode("div",Tg,[l.renderSlot(s.$slots,"prepend")])])):l.createCommentVNode("",!0),l.renderSlot(s.$slots,"default"),t.loading?(l.openBlock(),l.createElementBlock("div",$g,[l.createVNode(Kn,{class:"w-6 h-6 opacity-50"})])):t.clearable?(l.openBlock(),l.createElementBlock("div",{key:2,onClick:l.withModifiers(o,["stop"]),style:{"z-index":"2"},class:"absolute right-0 mr-2 h-full flex items-center cursor-pointer opacity-75 hover:opacity-100"},[l.createVNode(Hr,{class:"w-5 h-5 opacity-50"})])):l.createCommentVNode("",!0)],2)]))}});var Cn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Wr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Ng(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Ri=Ng,Bg=typeof Cn=="object"&&Cn&&Cn.Object===Object&&Cn,Zl=Bg,Ag=Zl,Dg=typeof self=="object"&&self&&self.Object===Object&&self,Vg=Ag||Dg||Function("return this")(),Ct=Vg,Ig=Ct,Pg=function(){return Ig.Date.now()},_g=Pg,Rg=/\s/;function Lg(t){for(var e=t.length;e--&&Rg.test(t.charAt(e)););return e}var zg=Lg,Fg=zg,jg=/^\s+/;function Hg(t){return t&&t.slice(0,Fg(t)+1).replace(jg,"")}var Wg=Hg,qg=Ct,Ug=qg.Symbol,ds=Ug,Xl=ds,Ql=Object.prototype,Kg=Ql.hasOwnProperty,Yg=Ql.toString,qr=Xl?Xl.toStringTag:void 0;function Jg(t){var e=Kg.call(t,qr),n=t[qr];try{t[qr]=void 0;var r=!0}catch{}var i=Yg.call(t);return r&&(e?t[qr]=n:delete t[qr]),i}var Gg=Jg,Zg=Object.prototype,Xg=Zg.toString;function Qg(t){return Xg.call(t)}var e0=Qg,ec=ds,t0=Gg,n0=e0,r0="[object Null]",i0="[object Undefined]",tc=ec?ec.toStringTag:void 0;function o0(t){return t==null?t===void 0?i0:r0:tc&&tc in Object(t)?t0(t):n0(t)}var Ur=o0;function s0(t){return t!=null&&typeof t=="object"}var Kr=s0,a0=Ur,l0=Kr,c0="[object Symbol]";function d0(t){return typeof t=="symbol"||l0(t)&&a0(t)==c0}var u0=d0,f0=Wg,nc=Ri,h0=u0,rc=NaN,p0=/^[-+]0x[0-9a-f]+$/i,m0=/^0b[01]+$/i,g0=/^0o[0-7]+$/i,y0=parseInt;function b0(t){if(typeof t=="number")return t;if(h0(t))return rc;if(nc(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=nc(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=f0(t);var n=m0.test(t);return n||g0.test(t)?y0(t.slice(2),n?2:8):p0.test(t)?rc:+t}var k0=b0,v0=Ri,us=_g,ic=k0,x0="Expected a function",w0=Math.max,S0=Math.min;function C0(t,e,n){var r,i,o,s,a,c,d=0,u=!1,f=!1,h=!0;if(typeof t!="function")throw new TypeError(x0);e=ic(e)||0,v0(n)&&(u=!!n.leading,f="maxWait"in n,o=f?w0(ic(n.maxWait)||0,e):o,h="trailing"in n?!!n.trailing:h);function p(v){var $=r,D=i;return r=i=void 0,d=v,s=t.apply(D,$),s}function m(v){return d=v,a=setTimeout(k,e),u?p(v):s}function g(v){var $=v-c,D=v-d,A=e-$;return f?S0(A,o-D):A}function y(v){var $=v-c,D=v-d;return c===void 0||$>=e||$<0||f&&D>=o}function k(){var v=us();if(y(v))return C(v);a=setTimeout(k,g(v))}function C(v){return a=void 0,h&&r?p(v):(r=i=void 0,s)}function N(){a!==void 0&&clearTimeout(a),d=0,r=c=i=a=void 0}function b(){return a===void 0?s:C(us())}function S(){var v=us(),$=y(v);if(r=arguments,i=this,c=v,$){if(a===void 0)return m(c);if(f)return clearTimeout(a),a=setTimeout(k,e),p(c)}return a===void 0&&(a=setTimeout(k,e)),s}return S.cancel=N,S.flush=b,S}var O0=C0;const oc=Wr(O0);function E0(){this.__data__=[],this.size=0}var M0=E0;function T0(t,e){return t===e||t!==t&&e!==e}var sc=T0,$0=sc;function N0(t,e){for(var n=t.length;n--;)if($0(t[n][0],e))return n;return-1}var Li=N0,B0=Li,A0=Array.prototype,D0=A0.splice;function V0(t){var e=this.__data__,n=B0(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():D0.call(e,n,1),--this.size,!0}var I0=V0,P0=Li;function _0(t){var e=this.__data__,n=P0(e,t);return n<0?void 0:e[n][1]}var R0=_0,L0=Li;function z0(t){return L0(this.__data__,t)>-1}var F0=z0,j0=Li;function H0(t,e){var n=this.__data__,r=j0(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var W0=H0,q0=M0,U0=I0,K0=R0,Y0=F0,J0=W0;function Zn(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Zn.prototype.clear=q0,Zn.prototype.delete=U0,Zn.prototype.get=K0,Zn.prototype.has=Y0,Zn.prototype.set=J0;var zi=Zn,G0=zi;function Z0(){this.__data__=new G0,this.size=0}var X0=Z0;function Q0(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}var ey=Q0;function ty(t){return this.__data__.get(t)}var ny=ty;function ry(t){return this.__data__.has(t)}var iy=ry,oy=Ur,sy=Ri,ay="[object AsyncFunction]",ly="[object Function]",cy="[object GeneratorFunction]",dy="[object Proxy]";function uy(t){if(!sy(t))return!1;var e=oy(t);return e==ly||e==cy||e==ay||e==dy}var ac=uy,fy=Ct,hy=fy["__core-js_shared__"],py=hy,fs=py,lc=function(){var t=/[^.]+$/.exec(fs&&fs.keys&&fs.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function my(t){return!!lc&&lc in t}var gy=my,yy=Function.prototype,by=yy.toString;function ky(t){if(t!=null){try{return by.call(t)}catch{}try{return t+""}catch{}}return""}var cc=ky,vy=ac,xy=gy,wy=Ri,Sy=cc,Cy=/[\\^$.*+?()[\]{}|]/g,Oy=/^\[object .+?Constructor\]$/,Ey=Function.prototype,My=Object.prototype,Ty=Ey.toString,$y=My.hasOwnProperty,Ny=RegExp("^"+Ty.call($y).replace(Cy,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function By(t){if(!wy(t)||xy(t))return!1;var e=vy(t)?Ny:Oy;return e.test(Sy(t))}var Ay=By;function Dy(t,e){return t==null?void 0:t[e]}var Vy=Dy,Iy=Ay,Py=Vy;function _y(t,e){var n=Py(t,e);return Iy(n)?n:void 0}var Xn=_y,Ry=Xn,Ly=Ct,zy=Ry(Ly,"Map"),hs=zy,Fy=Xn,jy=Fy(Object,"create"),Fi=jy,dc=Fi;function Hy(){this.__data__=dc?dc(null):{},this.size=0}var Wy=Hy;function qy(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Uy=qy,Ky=Fi,Yy="__lodash_hash_undefined__",Jy=Object.prototype,Gy=Jy.hasOwnProperty;function Zy(t){var e=this.__data__;if(Ky){var n=e[t];return n===Yy?void 0:n}return Gy.call(e,t)?e[t]:void 0}var Xy=Zy,Qy=Fi,eb=Object.prototype,tb=eb.hasOwnProperty;function nb(t){var e=this.__data__;return Qy?e[t]!==void 0:tb.call(e,t)}var rb=nb,ib=Fi,ob="__lodash_hash_undefined__";function sb(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=ib&&e===void 0?ob:e,this}var ab=sb,lb=Wy,cb=Uy,db=Xy,ub=rb,fb=ab;function Qn(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Qn.prototype.clear=lb,Qn.prototype.delete=cb,Qn.prototype.get=db,Qn.prototype.has=ub,Qn.prototype.set=fb;var hb=Qn,uc=hb,pb=zi,mb=hs;function gb(){this.size=0,this.__data__={hash:new uc,map:new(mb||pb),string:new uc}}var yb=gb;function bb(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var kb=bb,vb=kb;function xb(t,e){var n=t.__data__;return vb(e)?n[typeof e=="string"?"string":"hash"]:n.map}var ji=xb,wb=ji;function Sb(t){var e=wb(this,t).delete(t);return this.size-=e?1:0,e}var Cb=Sb,Ob=ji;function Eb(t){return Ob(this,t).get(t)}var Mb=Eb,Tb=ji;function $b(t){return Tb(this,t).has(t)}var Nb=$b,Bb=ji;function Ab(t,e){var n=Bb(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}var Db=Ab,Vb=yb,Ib=Cb,Pb=Mb,_b=Nb,Rb=Db;function er(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}er.prototype.clear=Vb,er.prototype.delete=Ib,er.prototype.get=Pb,er.prototype.has=_b,er.prototype.set=Rb;var fc=er,Lb=zi,zb=hs,Fb=fc,jb=200;function Hb(t,e){var n=this.__data__;if(n instanceof Lb){var r=n.__data__;if(!zb||r.length<jb-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Fb(r)}return n.set(t,e),this.size=n.size,this}var Wb=Hb,qb=zi,Ub=X0,Kb=ey,Yb=ny,Jb=iy,Gb=Wb;function tr(t){var e=this.__data__=new qb(t);this.size=e.size}tr.prototype.clear=Ub,tr.prototype.delete=Kb,tr.prototype.get=Yb,tr.prototype.has=Jb,tr.prototype.set=Gb;var Zb=tr,Xb="__lodash_hash_undefined__";function Qb(t){return this.__data__.set(t,Xb),this}var e1=Qb;function t1(t){return this.__data__.has(t)}var n1=t1,r1=fc,i1=e1,o1=n1;function Hi(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new r1;++e<n;)this.add(t[e])}Hi.prototype.add=Hi.prototype.push=i1,Hi.prototype.has=o1;var s1=Hi;function a1(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var l1=a1;function c1(t,e){return t.has(e)}var d1=c1,u1=s1,f1=l1,h1=d1,p1=1,m1=2;function g1(t,e,n,r,i,o){var s=n&p1,a=t.length,c=e.length;if(a!=c&&!(s&&c>a))return!1;var d=o.get(t),u=o.get(e);if(d&&u)return d==e&&u==t;var f=-1,h=!0,p=n&m1?new u1:void 0;for(o.set(t,e),o.set(e,t);++f<a;){var m=t[f],g=e[f];if(r)var y=s?r(g,m,f,e,t,o):r(m,g,f,t,e,o);if(y!==void 0){if(y)continue;h=!1;break}if(p){if(!f1(e,function(k,C){if(!h1(p,C)&&(m===k||i(m,k,n,r,o)))return p.push(C)})){h=!1;break}}else if(!(m===g||i(m,g,n,r,o))){h=!1;break}}return o.delete(t),o.delete(e),h}var hc=g1,y1=Ct,b1=y1.Uint8Array,k1=b1;function v1(t){var e=-1,n=Array(t.size);return t.forEach(function(r,i){n[++e]=[i,r]}),n}var x1=v1;function w1(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}var S1=w1,pc=ds,mc=k1,C1=sc,O1=hc,E1=x1,M1=S1,T1=1,$1=2,N1="[object Boolean]",B1="[object Date]",A1="[object Error]",D1="[object Map]",V1="[object Number]",I1="[object RegExp]",P1="[object Set]",_1="[object String]",R1="[object Symbol]",L1="[object ArrayBuffer]",z1="[object DataView]",gc=pc?pc.prototype:void 0,ps=gc?gc.valueOf:void 0;function F1(t,e,n,r,i,o,s){switch(n){case z1:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case L1:return!(t.byteLength!=e.byteLength||!o(new mc(t),new mc(e)));case N1:case B1:case V1:return C1(+t,+e);case A1:return t.name==e.name&&t.message==e.message;case I1:case _1:return t==e+"";case D1:var a=E1;case P1:var c=r&T1;if(a||(a=M1),t.size!=e.size&&!c)return!1;var d=s.get(t);if(d)return d==e;r|=$1,s.set(t,e);var u=O1(a(t),a(e),r,i,o,s);return s.delete(t),u;case R1:if(ps)return ps.call(t)==ps.call(e)}return!1}var j1=F1;function H1(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}var W1=H1,q1=Array.isArray,ms=q1,U1=W1,K1=ms;function Y1(t,e,n){var r=e(t);return K1(t)?r:U1(r,n(t))}var J1=Y1;function G1(t,e){for(var n=-1,r=t==null?0:t.length,i=0,o=[];++n<r;){var s=t[n];e(s,n,t)&&(o[i++]=s)}return o}var Z1=G1;function X1(){return[]}var Q1=X1,ek=Z1,tk=Q1,nk=Object.prototype,rk=nk.propertyIsEnumerable,yc=Object.getOwnPropertySymbols,ik=yc?function(t){return t==null?[]:(t=Object(t),ek(yc(t),function(e){return rk.call(t,e)}))}:tk,ok=ik;function sk(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}var ak=sk,lk=Ur,ck=Kr,dk="[object Arguments]";function uk(t){return ck(t)&&lk(t)==dk}var fk=uk,bc=fk,hk=Kr,kc=Object.prototype,pk=kc.hasOwnProperty,mk=kc.propertyIsEnumerable,gk=bc(function(){return arguments}())?bc:function(t){return hk(t)&&pk.call(t,"callee")&&!mk.call(t,"callee")},yk=gk,Wi={exports:{}};function bk(){return!1}var kk=bk;Wi.exports,function(t,e){var n=Ct,r=kk,i=e&&!e.nodeType&&e,o=i&&!0&&t&&!t.nodeType&&t,s=o&&o.exports===i,a=s?n.Buffer:void 0,c=a?a.isBuffer:void 0,d=c||r;t.exports=d}(Wi,Wi.exports);var vc=Wi.exports,vk=9007199254740991,xk=/^(?:0|[1-9]\d*)$/;function wk(t,e){var n=typeof t;return e=e??vk,!!e&&(n=="number"||n!="symbol"&&xk.test(t))&&t>-1&&t%1==0&&t<e}var Sk=wk,Ck=9007199254740991;function Ok(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Ck}var xc=Ok,Ek=Ur,Mk=xc,Tk=Kr,$k="[object Arguments]",Nk="[object Array]",Bk="[object Boolean]",Ak="[object Date]",Dk="[object Error]",Vk="[object Function]",Ik="[object Map]",Pk="[object Number]",_k="[object Object]",Rk="[object RegExp]",Lk="[object Set]",zk="[object String]",Fk="[object WeakMap]",jk="[object ArrayBuffer]",Hk="[object DataView]",Wk="[object Float32Array]",qk="[object Float64Array]",Uk="[object Int8Array]",Kk="[object Int16Array]",Yk="[object Int32Array]",Jk="[object Uint8Array]",Gk="[object Uint8ClampedArray]",Zk="[object Uint16Array]",Xk="[object Uint32Array]",ke={};ke[Wk]=ke[qk]=ke[Uk]=ke[Kk]=ke[Yk]=ke[Jk]=ke[Gk]=ke[Zk]=ke[Xk]=!0,ke[$k]=ke[Nk]=ke[jk]=ke[Bk]=ke[Hk]=ke[Ak]=ke[Dk]=ke[Vk]=ke[Ik]=ke[Pk]=ke[_k]=ke[Rk]=ke[Lk]=ke[zk]=ke[Fk]=!1;function Qk(t){return Tk(t)&&Mk(t.length)&&!!ke[Ek(t)]}var ev=Qk;function tv(t){return function(e){return t(e)}}var nv=tv,qi={exports:{}};qi.exports,function(t,e){var n=Zl,r=e&&!e.nodeType&&e,i=r&&!0&&t&&!t.nodeType&&t,o=i&&i.exports===r,s=o&&n.process,a=function(){try{var c=i&&i.require&&i.require("util").types;return c||s&&s.binding&&s.binding("util")}catch{}}();t.exports=a}(qi,qi.exports);var rv=qi.exports,iv=ev,ov=nv,wc=rv,Sc=wc&&wc.isTypedArray,sv=Sc?ov(Sc):iv,Cc=sv,av=ak,lv=yk,cv=ms,dv=vc,uv=Sk,fv=Cc,hv=Object.prototype,pv=hv.hasOwnProperty;function mv(t,e){var n=cv(t),r=!n&&lv(t),i=!n&&!r&&dv(t),o=!n&&!r&&!i&&fv(t),s=n||r||i||o,a=s?av(t.length,String):[],c=a.length;for(var d in t)(e||pv.call(t,d))&&!(s&&(d=="length"||i&&(d=="offset"||d=="parent")||o&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||uv(d,c)))&&a.push(d);return a}var gv=mv,yv=Object.prototype;function bv(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||yv;return t===n}var kv=bv;function vv(t,e){return function(n){return t(e(n))}}var xv=vv,wv=xv,Sv=wv(Object.keys,Object),Cv=Sv,Ov=kv,Ev=Cv,Mv=Object.prototype,Tv=Mv.hasOwnProperty;function $v(t){if(!Ov(t))return Ev(t);var e=[];for(var n in Object(t))Tv.call(t,n)&&n!="constructor"&&e.push(n);return e}var Nv=$v,Bv=ac,Av=xc;function Dv(t){return t!=null&&Av(t.length)&&!Bv(t)}var Vv=Dv,Iv=gv,Pv=Nv,_v=Vv;function Rv(t){return _v(t)?Iv(t):Pv(t)}var Lv=Rv,zv=J1,Fv=ok,jv=Lv;function Hv(t){return zv(t,jv,Fv)}var Wv=Hv,Oc=Wv,qv=1,Uv=Object.prototype,Kv=Uv.hasOwnProperty;function Yv(t,e,n,r,i,o){var s=n&qv,a=Oc(t),c=a.length,d=Oc(e),u=d.length;if(c!=u&&!s)return!1;for(var f=c;f--;){var h=a[f];if(!(s?h in e:Kv.call(e,h)))return!1}var p=o.get(t),m=o.get(e);if(p&&m)return p==e&&m==t;var g=!0;o.set(t,e),o.set(e,t);for(var y=s;++f<c;){h=a[f];var k=t[h],C=e[h];if(r)var N=s?r(C,k,h,e,t,o):r(k,C,h,t,e,o);if(!(N===void 0?k===C||i(k,C,n,r,o):N)){g=!1;break}y||(y=h=="constructor")}if(g&&!y){var b=t.constructor,S=e.constructor;b!=S&&"constructor"in t&&"constructor"in e&&!(typeof b=="function"&&b instanceof b&&typeof S=="function"&&S instanceof S)&&(g=!1)}return o.delete(t),o.delete(e),g}var Jv=Yv,Gv=Xn,Zv=Ct,Xv=Gv(Zv,"DataView"),Qv=Xv,ex=Xn,tx=Ct,nx=ex(tx,"Promise"),rx=nx,ix=Xn,ox=Ct,sx=ix(ox,"Set"),ax=sx,lx=Xn,cx=Ct,dx=lx(cx,"WeakMap"),ux=dx,gs=Qv,ys=hs,bs=rx,ks=ax,vs=ux,Ec=Ur,nr=cc,Mc="[object Map]",fx="[object Object]",Tc="[object Promise]",$c="[object Set]",Nc="[object WeakMap]",Bc="[object DataView]",hx=nr(gs),px=nr(ys),mx=nr(bs),gx=nr(ks),yx=nr(vs),On=Ec;(gs&&On(new gs(new ArrayBuffer(1)))!=Bc||ys&&On(new ys)!=Mc||bs&&On(bs.resolve())!=Tc||ks&&On(new ks)!=$c||vs&&On(new vs)!=Nc)&&(On=function(t){var e=Ec(t),n=e==fx?t.constructor:void 0,r=n?nr(n):"";if(r)switch(r){case hx:return Bc;case px:return Mc;case mx:return Tc;case gx:return $c;case yx:return Nc}return e});var bx=On,xs=Zb,kx=hc,vx=j1,xx=Jv,Ac=bx,Dc=ms,Vc=vc,wx=Cc,Sx=1,Ic="[object Arguments]",Pc="[object Array]",Ui="[object Object]",Cx=Object.prototype,_c=Cx.hasOwnProperty;function Ox(t,e,n,r,i,o){var s=Dc(t),a=Dc(e),c=s?Pc:Ac(t),d=a?Pc:Ac(e);c=c==Ic?Ui:c,d=d==Ic?Ui:d;var u=c==Ui,f=d==Ui,h=c==d;if(h&&Vc(t)){if(!Vc(e))return!1;s=!0,u=!1}if(h&&!u)return o||(o=new xs),s||wx(t)?kx(t,e,n,r,i,o):vx(t,e,c,n,r,i,o);if(!(n&Sx)){var p=u&&_c.call(t,"__wrapped__"),m=f&&_c.call(e,"__wrapped__");if(p||m){var g=p?t.value():t,y=m?e.value():e;return o||(o=new xs),i(g,y,n,r,o)}}return h?(o||(o=new xs),xx(t,e,n,r,i,o)):!1}var Ex=Ox,Mx=Ex,Rc=Kr;function Lc(t,e,n,r,i){return t===e?!0:t==null||e==null||!Rc(t)&&!Rc(e)?t!==t&&e!==e:Mx(t,e,n,r,Lc,i)}var Tx=Lc,$x=Tx;function Nx(t,e){return $x(t,e)}var Bx=Nx;const zc=Wr(Bx),Ax={key:0,class:"leading-none"},Dx={key:1},Vx={class:"flex flex-col max-h-80 overflow-y-auto"},Ix={key:0,class:"p-3"},Px={key:1},_x={key:0,class:"px-4 py-2 flex items-center justify-between text-sm gap-6 dark:text-gray-400"},Rx=["onClick"],Lx={class:"select-none flex w-full items-center justify-between"},Fc=Object.assign({name:"WpicChoiceList"},{props:{modelValue:{},value:{},name:String,small:Boolean,hideSelect:Boolean,label:String,placeholder:{type:String,default:"Select..."},options:Array,multiple:Boolean,required:Boolean,disabled:Boolean,isInvalid:Boolean,maxDisplay:{type:Number},batchSelect:{type:Boolean,default:!1},allSelectedText:String,filterable:Boolean,remoteMethod:{},noDataText:String,clearable:Boolean,debounce:{type:Number,default:0},loading:Boolean,material:Boolean,naked:Boolean},emits:["blur-sm","input","change","update:modelValue"],setup(t,{expose:e,emit:n}){const r=t,i=l.ref(!1),o=l.ref(r.options);l.watch(()=>r.options,()=>{var b;(b=r.options)!=null&&b.length&&(o.value=[...r.options])},{immediate:!0,deep:!0});const s=n,a=l.ref(),c=l.ref();function d(b){var S,v;if(r.multiple){if(b){let $=r.modelValue||[];$.indexOf(b)>=0?$.splice($.indexOf(b),1):$.push(b),s("update:modelValue",$),p($),((S=r.modelValue)==null?void 0:S.length)===((v=r.options)==null?void 0:v.length)?i.value=!0:i.value=!1}}else s("update:modelValue",b),p(b),a.value=null,c.value.hide()}async function u(b){var S,v;s("update:modelValue",b),p(b),await l.nextTick(),((S=r.modelValue)==null?void 0:S.length)===((v=r.options)==null?void 0:v.length)&&(i.value=!0)}function f(b){s("update:modelValue",b),i.value=!1,p(b)}function h(){i.value=!1,r.multiple?(s("update:modelValue",[]),p([])):(s("update:modelValue",null),p(null))}const p=oc(function(b){s("change",b)},r.debounce),m=l.computed(()=>{var b,S,v,$;if(r.multiple)if(r.maxDisplay){let D=(S=o.value)==null?void 0:S.filter(B=>{var P;return((P=r.modelValue)==null?void 0:P.indexOf(B.value))>=0}).map(B=>B.label),A=D==null?void 0:D.slice(0,r.maxDisplay);return(D==null?void 0:D.length)-(A==null?void 0:A.length)>0?(A==null?void 0:A.join(", "))+` (+${(D==null?void 0:D.length)-A.length})`:A==null?void 0:A.join(", ")}else return(b=o.value)==null?void 0:b.filter(D=>{var A;return((A=r.modelValue)==null?void 0:A.indexOf(D.value))>=0}).map(D=>D.label).join(", ");else return(($=(v=o.value)==null?void 0:v.find(D=>D.value===r.modelValue))==null?void 0:$.label)||r.modelValue});function g(b){var S;try{return r.multiple?r.modelValue!==null&&((S=r.modelValue)==null?void 0:S.some(v=>zc(v,b))):r.modelValue!==null&&zc(b,r.modelValue)}catch(v){return console.log(v),!1}}const y={pmi:"group-[.is-selected]:bg-violet-50 hover:group-[.is-selected]:bg-violet-100","wpic-tools":"hover:bg-gray-50 group-[.is-selected]:text-lime-500 group-[.is-selected]:font-medium text-gray-600 dark:hover:bg-white/5 dark:text-gray-400 dark:group-[.is-selected]:text-lime-700"},k=l.computed(()=>{var b,S;return((b=r.modelValue)==null?void 0:b.length)===((S=r.options)==null?void 0:S.length)}),C=l.computed(()=>{var b;if(r.filterable&&!r.remoteMethod&&((b=a.value)!=null&&b.trim().length)){const S=a.value.trim().toLowerCase();return r.options.filter(v=>{var $;return($=v.label)==null?void 0:$.toLowerCase().includes(S)})}return r.options});function N(){r.remoteMethod&&r.remoteMethod(a.value)}return e({allSelected:i,isAllSelected:k}),(b,S)=>(l.openBlock(),l.createBlock(Sn,{custom:"",ref_key:"myPopover",ref:c,label:t.label,disabled:t.disabled},{default:l.withCtx(({isHidden:v})=>[l.createVNode(_i,{material:t.material,naked:t.naked,disabled:t.disabled,small:t.small,invalid:t.isInvalid,loading:t.loading},{default:l.withCtx(()=>{var $,D,A,B,P,F;return[l.createElementVNode("span",{class:l.normalizeClass(["select-none w-full text-left flex-1",{"whitespace-pre":!t.multiple}])},[t.modelValue&&(!t.multiple||t.multiple&&(($=t.modelValue)==null?void 0:$.length)>0)&&!t.hideSelect?(l.openBlock(),l.createElementBlock("span",Ax,[k.value&&((D=t.allSelectedText)!=null&&D.length)?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[l.createTextVNode(l.toDisplayString(t.allSelectedText)+" ("+l.toDisplayString((A=t.options)==null?void 0:A.length)+")",1)],64)):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[l.createTextVNode(l.toDisplayString(m.value),1)],64))])):!t.multiple&&((B=t.options)!=null&&B.find(G=>G.value===null))?(l.openBlock(),l.createElementBlock("span",Dx,l.toDisplayString((F=(P=t.options)==null?void 0:P.find(G=>G.value===null))==null?void 0:F.label),1)):l.renderSlot(b.$slots,"default",{key:2},()=>[l.createTextVNode(l.toDisplayString(t.placeholder),1)])],2),t.modelValue&&t.clearable?(l.openBlock(),l.createElementBlock("div",{key:0,onClick:l.withModifiers(h,["stop"]),style:{"z-index":"2"},class:"absolute right-6 mr-3 h-full flex items-center cursor-pointer opacity-75 hover:opacity-100"},[l.createVNode(Hr,{class:"w-4 h-4"})])):l.createCommentVNode("",!0),l.createVNode(yg,{class:l.normalizeClass(["h-4 w-4 transition-all transform",{"rotate-180":!v}])},null,8,["class"])]}),_:2},1032,["material","naked","disabled","small","invalid","loading"])]),content:l.withCtx(()=>{var v;return[l.createElementVNode("div",Vx,[t.filterable?(l.openBlock(),l.createElementBlock("div",Ix,[l.createVNode(Hc,{slim:"",placeholder:"Search...",clearable:"",modelValue:a.value,"onUpdate:modelValue":[S[0]||(S[0]=$=>a.value=$),N]},null,8,["modelValue"])])):l.createCommentVNode("",!0),!t.options&&((v=t.options)==null?void 0:v.length)==0?(l.openBlock(),l.createElementBlock("span",Px,"No data.")):(l.openBlock(),l.createElementBlock(l.Fragment,{key:2},[t.multiple&&t.batchSelect?(l.openBlock(),l.createElementBlock("div",_x,[l.createElementVNode("span",{class:"cursor-pointer opacity-50 hover:opacity-100",onClick:S[1]||(S[1]=$=>{var D;return u((D=C.value)==null?void 0:D.filter(A=>A.value).map(A=>A.value))})},"Select all"),l.createElementVNode("span",{class:"cursor-pointer opacity-50 hover:opacity-100",onClick:S[2]||(S[2]=$=>f([]))},"Select none")])):l.createCommentVNode("",!0),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(C.value,$=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["group",{"is-selected":!!g($.value)}])},[l.createElementVNode("div",{class:l.normalizeClass(["flex items-center py-2 px-4 min-w-64 text-base",{"cursor-pointer":!t.multiple||$.value,[`${y[l.unref(ne).theme]}`]:!0}]),onClick:D=>$.disabled?null:d($.value)},[l.createElementVNode("div",Lx,[l.createElementVNode("span",{class:l.normalizeClass(["",{"opacity-25":$.disabled}])},l.toDisplayString($.label||$.value),3),t.multiple&&g($.value)?(l.openBlock(),l.createBlock(Gl,{key:0,class:"w-4 h-4"})):l.createCommentVNode("",!0)])],10,Rx)],2))),256))],64))])]}),_:3},8,["label","disabled"]))}}),zx={key:0,class:"mb-2 gap-2 wpic-form-label text-base text-zinc-600 dark:text-zinc-300 flex items-center"},Fx={class:""},jx=["value","disabled","rows","placeholder"],jc=Object.assign({name:"WpicTextarea"},{props:{modelValue:{},label:String,disabled:Boolean,noResize:Boolean,autoResize:Boolean,placeholder:String,isInvalid:Boolean,required:Boolean,minHeight:{type:[String,Number],default:50},maxHeight:{type:[String,Number],default:300},rows:{type:[String,Number],default:3}},emits:["update:modelValue"],setup(t,{expose:e,emit:n}){const r=t,i=l.ref(null),o=l.ref(!1);l.watch(()=>r.modelValue,d=>{i.value.style.height="auto",r.autoResize&&l.nextTick(()=>{r.minHeight&&(i.value.style.height=`${i.value.scrollHeight<r.minHeight?r.minHeight:i.value.scrollHeight}px`),r.maxHeight&&(i.value.scrollHeight>r.maxHeight?(i.value.style.height=`${r.maxHeight}px`,o.value=!0):o.value=!1)})},{deep:!0});const s=n;function a(d){s("update:modelValue",d==null?void 0:d.target.value)}function c(){i.value.focus()}return e({focus:c}),(d,u)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[t.label?(l.openBlock(),l.createElementBlock("div",zx,[l.createTextVNode(l.toDisplayString(t.label)+" ",1),l.createElementVNode("div",Fx,[d.info?(l.openBlock(),l.createBlock(Sn,{key:0,hover:""},{content:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(d.info),1)]),default:l.withCtx(()=>[l.createVNode(cs,{class:"w-4 h-4 text-zinc-600"})]),_:1})):l.createCommentVNode("",!0)])])):l.createCommentVNode("",!0),l.createElementVNode("textarea",{ref_key:"myTextarea",ref:i,class:l.normalizeClass(["relative appearance-none outline-hidden flex w-full h-full rounded-sm px-4 py-2 bg-transparent opacity-100 active:border-lime-400 focus:border-lime-400 focus-visible:border-none placeholder:opacity-30 dark:text-gray-400",{"cursor-not-allowed":t.disabled,"resize-none":t.noResize,"overflow-hidden":t.autoResize&&!o.value,"overflow-auto":t.autoResize||o.value}]),style:l.normalizeStyle({"min-height":t.autoResize&&`${t.minHeight}px`,maxHeight:t.autoResize&&`${t.maxHeight}px`}),value:t.modelValue,disabled:t.disabled,rows:t.rows,onInput:a,placeholder:t.placeholder},null,46,jx)],64))}}),Hx={},Wx={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},qx=[l.createElementVNode("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"},null,-1),l.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 Ux(t,e){return l.openBlock(),l.createElementBlock("svg",Wx,qx)}const Kx=ue(Hx,[["render",Ux]]),Yx={},Jx={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},Gx=[l.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),l.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),l.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 Zx(t,e){return l.openBlock(),l.createElementBlock("svg",Jx,Gx)}const Xx=ue(Yx,[["render",Zx]]),Qx={},ew={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},tw=[l.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 12h-15"},null,-1)];function nw(t,e){return l.openBlock(),l.createElementBlock("svg",ew,tw)}const rw=ue(Qx,[["render",nw]]),iw={class:"flex items-center gap-2"},ow={key:0},sw={class:""},aw=["innerHTML"],lw={class:"flex justify-end"},cw=["name","value","checked"],dw={class:"flex items-center justify-center text-center opacity-50 w-4 h-4 leading-none"},uw={key:5,class:"absolute z-10 right-0 mr-3 h-full flex items-center"},fw={class:"min-w-5 h-5 leading-tight cursor-pointer dark:text-gray-400"},hw={key:5,class:"text-red-700 dark:text-red-400/90 mt-1 text-base"},Hc=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},small:Boolean,maxDisplay:{type:Number},filterable:Boolean,remoteMethod:{},noDataText:String,batchSelect:{type:Boolean,default:!1},allSelectedText:String,hideRequired:Boolean,material:Boolean,naked:Boolean},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":"text-gray-800 disabled:text-gray-400 disabled:border-gray-200 bg-white border-gray-300 dark:bg-gray-930 dark:border-gray-920 focus-within:border-lime-400 dark:focus-within:bg-gray-920 disabled:bg-gray-50"},i={pmi:"rounded-xs group-[.is-active]:border-zinc-400 group-[.is-selected]:bg-violet-800 group-[.is-selected]:border-violet-800 group-[.is-selected]:text-white group-[.is-disabled]:bg-opacity-50 group-[.is-disabled]:border-opacity-50 group-[.is-disabled]:text-opacity-75","wpic-tools":"rounded-sm group-[.is-active]:border-gray-300 dark:group-[.is-active]:bg-gray-950 dark:group-[.is-active]:border-gray-800 group-[.is-selected]:bg-lime-600 group-[.is-selected]:border-lime-600 group-[.is-selected]:text-white dark:group-[.is-disabled]:border-gray-800/50 group-[.is-disabled]:!text-gray-300 group-[.is-disabled]:!border-gray-100 group-[.is-disabled]:!bg-gray-100 dark:group-[.is-disabled]:!border-gray-900 dark:group-[.is-disabled]:!text-gray-700 dark:group-[.is-disabled]:!bg-gray-900"},o=t,s=l.computed(()=>o.name?o.name:ls()),a=Qp(s.value),c=l.computed(()=>{if(o.label)return o.label;if(o.name&&o.labelName)return`${o.name}#${o.labelName}`}),d=l.ref(!0),u=l.computed(()=>(o.type=="password"||o.password)&&d.value?"password":o.type);function f(){d.value=!d.value}const h=l.computed(()=>{var B;if(o.rules&&typeof o.rules=="string"){let P=(B=o.rules)==null?void 0:B.split("|");return o.required&&P.push("required"),o.email&&P.push("email"),P.join("|")}else if(!o.rules){let P=[];return o.required&&P.push("required"),o.email&&P.push("email"),P.join("|")}return"required"});function p(B){let P=B&&B.target?B.target.value:B;C(P)}const m=n;function g(B){B===!0||B===!1?m("update:modelValue",!B):m("update:modelValue",B)}function y(B){let P=B&&B.target?B.target.value:B;m("update:modelValue",P),m("onChange",P)}function k(){m("update:modelValue",null),m("onChange",null),m("onClear")}const C=oc(function(B){m("update:modelValue",B),m("onChange",B)},o.debounce),N=l.ref(null),b=l.ref();function S(){var B,P;o.textarea?(B=b.value)==null||B.focus():(P=N.value)==null||P.$el.focus()}function v(){return N.value.meta.valid}const $=l.ref(),D=l.computed(()=>$.value.allSelected),A=l.computed(()=>$.value.isAllSelected);return e({focus:S,isValid:v,allSelected:D,isAllSelected:A}),(B,P)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["wpic-form-field",{"mb-6":!t.slim}])},[c.value&&!t.checkbox&&!t.radio?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass([{"text-sm":t.small,"text-base":!t.small},"mb-2 wpic-form-label text-gray-500 dark:text-gray-500 flex items-center justify-between"])},[l.createElementVNode("div",iw,[l.createElementVNode("span",null,l.toDisplayString(c.value),1),t.required&&!t.hideRequired?(l.openBlock(),l.createElementBlock("span",ow,"*")):l.createCommentVNode("",!0),l.createElementVNode("div",sw,[t.info?(l.openBlock(),l.createBlock(Sn,{key:0,hover:""},{content:l.withCtx(()=>[l.createElementVNode("div",{class:"whitespace-break-spaces",innerHTML:t.info},null,8,aw)]),default:l.withCtx(()=>[l.createVNode(cs,{class:"w-4 h-4 text-zinc-600"})]),_:1})):l.createCommentVNode("",!0)])]),l.createElementVNode("div",lw,[l.renderSlot(B.$slots,"more")])],2)):l.createCommentVNode("",!0),t.checkbox?(l.openBlock(),l.createBlock(l.unref(_r),{key:1,ref_key:"myInput",ref:N,name:s.value,rules:h.value,value:t.checkboxValue,"unchecked-value":t.uncheckedValue,modelValue:t.modelValue},{default:l.withCtx(({field:F})=>[l.createElementVNode("div",{class:l.normalizeClass(["inline-flex group items-center gap-2",{"is-disabled":t.disabled,"is-active":!t.disabled&&!t.modelValue,"is-selected":t.modelValue===!0}]),onClick:P[0]||(P[0]=G=>t.disabled?void 0:g(t.modelValue))},[l.createElementVNode("div",{class:l.normalizeClass(["w-4 h-4 border dark:border-gray-800 cursor-pointer",{[`${i[l.unref(ne).theme]}`]:!0}])},[t.modelValue===!0?(l.openBlock(),l.createBlock(Gl,{key:0})):l.createCommentVNode("",!0)],2),l.createElementVNode("span",{class:l.normalizeClass(["text-base cursor-pointer select-none text-gray-600 dark:text-gray-500",{"!text-gray-500/50 dark:text-gray-700/50":t.disabled}])},[l.renderSlot(B.$slots,"default",{},()=>[l.createTextVNode(l.toDisplayString(c.value),1)])],2)],2)]),_:3},8,["name","rules","value","unchecked-value","modelValue"])):t.radio?(l.openBlock(),l.createBlock(l.unref(_r),{key:2,ref_key:"myInput",ref:N,name:s.value,value:t.radioValue,modelValue:t.modelValue},{default:l.withCtx(({field:F})=>[l.createElementVNode("div",{onClick:P[2]||(P[2]=()=>{t.disabled||y(t.radioValue)}),class:l.normalizeClass([{"cursor-pointer":!t.disabled},"inline-flex items-center gap-2 select-none"])},[l.createElementVNode("span",{class:l.normalizeClass(["h-4 w-4 border border-zinc-400 rounded-full p-[2px]",{"border-opacity-50":t.disabled}])},[t.radioValue==t.modelValue?(l.openBlock(),l.createElementBlock("span",{key:0,class:l.normalizeClass(["flex rounded-full h-full w-full bg-violet-800",{"bg-opacity-50":t.disabled}])},null,2)):l.createCommentVNode("",!0)],2),l.createElementVNode("input",{class:"hidden",type:"radio",name:t.name,value:t.radioValue,onChange:P[1]||(P[1]=(...G)=>B.onChange&&B.onChange(...G)),checked:t.radioValue==t.modelValue},null,40,cw),c.value?(l.openBlock(),l.createElementBlock("span",{key:0,class:l.normalizeClass(["text-base",{"opacity-50":t.disabled}])},l.toDisplayString(c.value),3)):l.createCommentVNode("",!0)],2)]),_:1},8,["name","value","modelValue"])):t.select?(l.openBlock(),l.createBlock(l.unref(_r),{key:3,ref_key:"myInput",ref:N,modelValue:t.modelValue,rules:h.value,name:s.value},{default:l.withCtx(({field:F})=>{var G;return[l.createVNode(Fc,{ref_key:"myChoiceList",ref:$,modelValue:t.modelValue,"onUpdate:modelValue":y,disabled:t.disabled,options:t.options,small:t.small,clearable:t.clearable,hideSelect:t.hideSelect,"remote-method":t.remoteMethod,multiple:t.multiple,filterable:t.filterable,maxDisplay:t.maxDisplay,batchSelect:t.batchSelect,allSelectedText:t.allSelectedText,isInvalid:!!(t.error&&l.unref(a)),required:t.required||((G=h.value)==null?void 0:G.indexOf("required"))>=0,label:c.value,placeholder:t.placeholder,loading:t.loading,material:t.material,naked:t.naked},null,8,["modelValue","disabled","options","small","clearable","hideSelect","remote-method","multiple","filterable","maxDisplay","batchSelect","allSelectedText","isInvalid","required","label","placeholder","loading","material","naked"])]}),_:1},8,["modelValue","rules","name"])):(l.openBlock(),l.createElementBlock("div",{key:4,class:l.normalizeClass(["wpic-input flex relative",{"rounded-sm border":!t.naked,"border-b":t.material,"!bg-transparent":t.naked,[`${r[l.unref(ne).theme]}`]:!0,"bg-transparent!":t.transparent,"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 dark:border-red-400/70!":l.unref(a)}])},[B.$slots.prepend?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["absolute dark:text-gray-400 left-0 ml-0 w-9 h-full flex items-center text-center",{"justify-center":!t.naked}])},[l.createElementVNode("div",dw,[l.renderSlot(B.$slots,"prepend")])],2)):l.createCommentVNode("",!0),t.textarea?(l.openBlock(),l.createBlock(l.unref(_r),{key:1,ref_key:"myInput",ref:N,modelValue:t.modelValue,rules:h.value,name:s.value},{default:l.withCtx(()=>{var F;return[l.createVNode(jc,{ref_key:"myTextarea",ref:b,modelValue:t.modelValue,"onUpdate:modelValue":p,rows:t.rows,disabled:t.disabled,noResize:t.noResize,autoResize:t.autoResize,placeholder:t.placeholder,minHeight:t.minHeight,maxHeight:t.maxHeight,isInvalid:!!(t.error&&l.unref(a)),required:t.required||((F=h.value)==null?void 0:F.indexOf("required"))>=0},null,8,["modelValue","rows","disabled","noResize","autoResize","placeholder","minHeight","maxHeight","isInvalid","required"])]}),_:1},8,["modelValue","rules","name"])):(l.openBlock(),l.createBlock(l.unref(_r),{key:2,ref_key:"myInput",ref:N,autocomplete:"off",style:{"z-index":"1"},class:l.normalizeClass(["flex w-full h-full rounded-sm pr-4 bg-transparent outline-hidden appearance-none dark:text-gray-400 dark:placeholder:text-gray-700",{"pl-4":!B.$slots.prepend&&!t.naked,"pl-8":B.$slots.prepend&&!t.naked,"pl-6":B.$slots.prepend&&t.naked,"py-2":t.textarea,"text-sm":t.small,"cursor-not-allowed":t.disabled}]),type:u.value,min:t.min,max:t.max,rows:t.rows,name:s.value,disabled:t.disabled,modelValue:t.modelValue,onInput:p,"no-data-text":t.noDataText,placeholder:t.placeholder,validateOnInput:!!l.unref(a),rules:h.value},null,8,["class","type","min","max","rows","name","disabled","modelValue","no-data-text","placeholder","validateOnInput","rules"])),t.loading?(l.openBlock(),l.createElementBlock("div",{key:3,onClick:l.withModifiers(k,["stop"]),class:"absolute right-0 mr-3 h-full flex items-center cursor-pointer opacity-75 hover:opacity-100"},[l.createVNode(Kn,{class:"w-6 h-6 opacity-50"})])):t.clearable&&t.modelValue?(l.openBlock(),l.createElementBlock("div",{key:4,onClick:l.withModifiers(k,["stop"]),style:{"z-index":"2"},class:"absolute right-0 mr-3 h-full flex items-center cursor-pointer opacity-75 hover:opacity-100"},[l.createVNode(Hr,{class:"w-5 h-5 opacity-50"})])):l.createCommentVNode("",!0),B.$slots.append||t.password||t.type=="password"?(l.openBlock(),l.createElementBlock("div",uw,[l.createElementVNode("div",fw,[l.renderSlot(B.$slots,"append",{},()=>[l.withDirectives(l.createVNode(Kx,{class:"text-zinc-600 select-none",onClick:f},null,512),[[l.vShow,d.value]]),l.withDirectives(l.createVNode(Xx,{class:"text-zinc-600 select-none",onClick:f},null,512),[[l.vShow,!d.value]])])])])):l.createCommentVNode("",!0)],2)),t.error&&l.unref(a)?(l.openBlock(),l.createElementBlock("div",hw,[l.createVNode(l.unref(Xp),{name:s.value},{default:l.withCtx(F=>[l.createTextVNode(l.toDisplayString(F.message),1)]),_:1},8,["name"])])):l.createCommentVNode("",!0),B.$slots.help||t.help?(l.openBlock(),l.createElementBlock("div",{key:6,class:l.normalizeClass(["text-base mt-1",{"ml-7":t.type=="checkbox","opacity-50":t.disabled}])},[l.renderSlot(B.$slots,"help",{},()=>[l.createTextVNode(l.toDisplayString(t.help),1)])],2)):l.createCommentVNode("",!0)],2))}}),pw=["innerHTML"],Wc=Object.assign({name:"WpicTooltip"},{props:{placement:{type:String,default:"top"},full:Boolean,text:String,offset:{type:Number,default:5},delay:{type:Number,default:500}},setup(t){const e=l.ref(),n=l.ref(),r=l.ref();ls();const i=t;function o(){i.text&&(n.value.style.display="block",a())}function s(){n.value.style.display=""}async function a(){var h,p;await l.nextTick();const c=await Yl(e.value,n.value,{placement:i.placement,middleware:[Kl(),Ul(),ql(i.offset),eg({element:r.value})]});n.value.style.left=`${c.x}px`,n.value.style.top=`${c.y}px`;const{x:d,y:u}=c.middlewareData.arrow,f={top:"bottom",right:"left",bottom:"top",left:"right"}[(h=i.placement)==null?void 0:h.split("-")[0]];r.value&&Object.assign((p=r.value)==null?void 0:p.style,{left:d!=null?`${d}px`:"",top:u!=null?`${u}px`:"",right:"",bottom:"",[f]:"-4px"})}return(c,d)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("span",{ref_key:"button",ref:e,class:l.normalizeClass({"w-full h-full":t.full}),"aria-describedby":"tooltip",onMouseenter:o,onMouseleave:s},[l.renderSlot(c.$slots,"default")],34),l.createElementVNode("div",{ref_key:"tooltip",ref:n,class:"tooltip z-30 px-3 py-2 border border-zinc-200 dark:border-gray-900 text-sm absolute top-0 left-0 bg-black text-white rounded-md hidden",role:"tooltip"},[l.createElementVNode("span",{innerHTML:t.text},null,8,pw),l.createElementVNode("div",{ref_key:"arrowElement",ref:r,class:"arrow"},null,512)],512)],64))}}),mw={key:1,class:"flex justify-between items-baseline pt-4 px-6"},gw={class:""},yw={key:2,class:"flex items-center justify-end py-4 px-6"},bw=Object.assign({name:"WpicCard"},{props:{title:String,inline:Boolean,loading:Boolean},setup(t){const e={pmi:"bg-white dark:bg-zinc-800/50 shadow-[0_4px_16px_0px_rgba(0,0,0,0.1)]","wpic-tools":"bg-white border border-gray-200 dark:bg-gray-940 dark:border-gray-920"},n={pmi:"font-bold","wpic-tools":"font-medium dark:text-gray-300"};return(r,i)=>{const o=l.resolveComponent("wpic-loading-panel");return l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["rounded-lg wpic-card relative",{[e[l.unref(ne).theme]]:!0,"wpic-card-inline":t.inline,"has-header":t.title||r.$slots.actions}])},[t.loading?(l.openBlock(),l.createBlock(o,{key:0,class:"absolute top-0 left-0 z-10",wave:""})):l.createCommentVNode("",!0),t.title||r.$slots.actions?(l.openBlock(),l.createElementBlock("div",mw,[t.title||r.$slots.actions?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["text-lg 2xl:text-xl",[n[l.unref(ne).theme]]])},l.toDisplayString(t.title),3)):l.createCommentVNode("",!0),l.createElementVNode("div",gw,[l.renderSlot(r.$slots,"actions")])])):l.createCommentVNode("",!0),l.renderSlot(r.$slots,"default"),r.$slots.buttons?(l.openBlock(),l.createElementBlock("div",yw,[l.renderSlot(r.$slots,"buttons")])):l.createCommentVNode("",!0)],2)}}}),kw={key:0,class:"pb-3 flex justify-betweeen h-12 items-center"},vw={class:"flex-1 text-lg dark:text-gray-300 font-semibold"},xw=Object.assign({name:"WpicCardSection"},{props:{title:String,sub:Boolean},setup(t){const e={pmi:"mx-6","wpic-tools":"px-6"};return(n,r)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["border-b relative dark:border-gray-900 dark:text-gray-300 last:border-0 pb-6",{[`${e[l.unref(ne).theme]}`]:!0,"pt-3":!(t.title&&n.$slots.actions),"pt-6":!t.title&&!n.$slots.actions,"bg-gray-50 dark:bg-gray-930":t.sub}])},[t.title||n.$slots.actions?(l.openBlock(),l.createElementBlock("div",kw,[l.createElementVNode("div",vw,l.toDisplayString(t.title),1),l.renderSlot(n.$slots,"actions")])):l.createCommentVNode("",!0),l.renderSlot(n.$slots,"default")],2))}}),ww=l.createElementVNode("div",{class:""},null,-1),Sw=l.createStaticVNode('<div class="-mt-2"><div class="absolute left-1/4 h-8 border-r border-gray-100 dark:border-gray-900"></div><div class="absolute left-1/2 h-8 border-r border-gray-100 dark:border-gray-900"></div><div class="absolute left-3/4 h-8 border-r border-gray-100 dark:border-gray-900"></div></div><div class="mt-7 text-gray-500 dark:text-gray-600"><div class="absolute left-0 text-xs">0%</div><div class="absolute left-1/4 -translate-x-1/4 text-xs">25%</div><div class="absolute left-1/2 -translate-x-1/2 text-xs">50%</div><div class="absolute right-1/4 translate-x-3/4 text-xs">75%</div><div class="absolute right-0 text-xs">100%</div></div>',2),Cw=Object.assign({name:"WpicProgressBar"},{props:{percent:Number,value:Number,indicators:Boolean,background:{type:String,default:null},max:{type:Number,default:100},text:String},setup(t){const e=t,n=l.computed(()=>e.percent?e.percent:100/e.max*e.value),r={pmi:"h-2 ring-1 rounded-full ring-zinc-400","wpic-tools":"bg-gray-100 rounded-xs h-4 dark:bg-gray-900"},i={pmi:"bg-cyan-400 rounded-full ring-1 ring-cyan-400","wpic-tools":"bg-lime-500 rounded-xs dark:bg-lime-700"};return(o,s)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["relative flex",{"mb-4":t.indicators}])},[l.createElementVNode("div",{class:l.normalizeClass(["flex w-full relative",r[l.unref(ne).theme]]),style:{"z-index":"1"}},[n.value>0?(l.openBlock(),l.createElementBlock("div",{key:0,style:l.normalizeStyle({width:`${n.value}%`}),class:l.normalizeClass(["flex h-full",{[`${t.background}`]:!0,[`${i[l.unref(ne).theme]}`]:!0}])},[l.createVNode(Wc,{full:"",text:`${n.value}%${t.text?t.text:""}`},{default:l.withCtx(()=>[ww]),_:1},8,["text"])],6)):l.createCommentVNode("",!0)],2),t.indicators?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[Sw],64)):l.createCommentVNode("",!0)],2))}}),Ow={class:"leading-none"},Ew=Object.assign({name:"WpicTag"},{props:{clearable:Boolean,small:Boolean},emits:["clear"],setup(t,{emit:e}){const n={pmi:"border-cyan-500 bg-cyan-50 text-cyan-600 text-base ","wpic-tools":"border-none bg-gray-200 text-gray-700 text-sm dark:text-gray-400 dark:bg-gray-810"},r=e;function i(){r("clear")}return(o,s)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["wpic-tag select-none border inline-flex rounded-sm h-8 items-center justify-center pl-3 py-1",{"pr-3":!t.clearable,"pr-1":t.clearable,[n[l.unref(ne).theme]]:!0}])},[l.createElementVNode("span",Ow,[l.renderSlot(o.$slots,"default")]),t.clearable?(l.openBlock(),l.createElementBlock("span",{key:0,onClick:i,class:"ml-2 mt-px cursor-pointer opacity-75 hover:opacity-100"},[l.createVNode(Hr,{class:"w-4 h-4"})])):l.createCommentVNode("",!0)],2))}}),Mw=Object.assign({name:"WpicTagGroup"},{props:{full:Boolean},setup(t){return(e,n)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass({"w-full":t.full})},[l.createElementVNode("div",{class:l.normalizeClass(["ui-tag-group flex flex-wrap gap-2",{"w-full":t.full}])},[l.renderSlot(e.$slots,"default")],2)],2))}}),Tw=t=>(l.pushScopeId("data-v-947735f2"),t=t(),l.popScopeId(),t),$w={key:1,class:"w-full min-h-10 h-full rounded-lg bg-gray-100 dark:bg-gray-940 relative overflow-hidden"},Nw=[Tw(()=>l.createElementVNode("div",{class:"absolute top-0 left-0 h-full w-full shimmer dark:dark-shimmer"},null,-1))],Bw=ue(Object.assign({name:"WpicLoadingPanel"},{props:{color:{type:String,default:""},wave:{type:Boolean,default:!1}},setup(t){return(e,n)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["w-full h-full flex items-center justify-center",{"py-3":!t.wave}])},[t.wave?(l.openBlock(),l.createElementBlock("div",$w,Nw)):(l.openBlock(),l.createBlock(Kn,{key:0,color:t.color,class:"w-10 h-10"},null,8,["color"]))],2))}}),[["__scopeId","data-v-947735f2"]]),Aw={class:"text-base font-medium select-none"},Yr=Object.assign({name:"WpicPaginationItem"},{props:{active:Boolean,disabled:Boolean},setup(t){const e={pmi:"border-zinc-300 dark:border-zinc-700 text-zinc-600 dark:text-zinc-300 hover:bg-zinc-500 hover:text-white","wpic-tools":"dark:text-gray-400 hover:text-lime-600 dark:border-gray-900"},n={pmi:"bg-violet-800 border-violet-800 hover:bg-violet-900 hover:border-violet-900 text-white","wpic-tools":"bg-lime-500 border-lime-500 text-white dark:bg-lime-700 dark:border-lime-700"},r={pmi:"text-zinc-300","wpic-tools":"text-gray-300 dark:text-gray-700 dark:border-gray-900"};return(i,o)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["border rounded-sm flex items-center justify-center w-10 h-10 cursor-pointer",{[e[l.unref(ne).theme]]:!t.active&&!t.disabled,[n[l.unref(ne).theme]]:t.active&&!t.disabled,[r[l.unref(ne).theme]]:t.disabled}])},[l.createElementVNode("span",Aw,[l.renderSlot(i.$slots,"default")])],2))}}),Dw={},Vw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},Iw=[l.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 Pw(t,e){return l.openBlock(),l.createElementBlock("svg",Vw,Iw)}const qc=ue(Dw,[["render",Pw]]),_w={},Rw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},Lw=[l.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 zw(t,e){return l.openBlock(),l.createElementBlock("svg",Rw,Lw)}const Uc=ue(_w,[["render",zw]]),Fw={},jw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},Hw=[l.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 Ww(t,e){return l.openBlock(),l.createElementBlock("svg",jw,Hw)}const Kc=ue(Fw,[["render",Ww]]),qw={},Uw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},Kw=[l.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 Yw(t,e){return l.openBlock(),l.createElementBlock("svg",Uw,Kw)}const Yc=ue(qw,[["render",Yw]]),Jw={class:"wpic-pagination flex justify-between"},Gw={key:0,class:"flex items-center"},Zw={key:0},Xw={key:1,class:"flex flex-wrap gap-2"},Qw=Object.assign({name:"WpicPagination"},{props:{info:{type:Boolean,default:!0},pages:{type:Boolean,default:!0},perPages:Boolean,total:Number,perPage:{type:Number,default:10},currentPage:{type:Number,default:1}},emits:["update:perPage","update:currentPage"],setup(t,{expose:e,emit:n}){const r=t,i=n,o=l.computed(()=>Math.ceil(r.total/r.perPage)),s=l.computed(()=>{const u=o.value;if(!u||u===1)return[1];const f=r.currentPage,h=1;let p=Math.max(2,f-h),m=Math.min(u-1,f+h);f<=h+2&&(p=2,m=Math.min(2*h+2,u-1)),f>=u-h-1&&(p=Math.max(2,u-2*h-1),m=u-1);const g=[];for(let y=p;y<=m;y++)g.push(y);return p>2&&g.unshift("..."),m<u-1&&g.push("..."),[1,...g,u]});function a(u){u>=1&&u<=o.value&&i("update:currentPage",u)}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}),(u,f)=>(l.openBlock(),l.createElementBlock("div",Jw,[t.info?(l.openBlock(),l.createElementBlock("div",Gw,[t.total>0?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[l.createTextVNode(l.toDisplayString(c())+" - "+l.toDisplayString(d()),1),t.total?(l.openBlock(),l.createElementBlock("span",Zw," / "+l.toDisplayString(t.total),1)):l.createCommentVNode("",!0)],64)):l.createCommentVNode("",!0)])):l.createCommentVNode("",!0),t.pages?(l.openBlock(),l.createElementBlock("div",Xw,[l.createVNode(Yr,{onClick:f[0]||(f[0]=h=>a(1)),disabled:t.currentPage===1||o.value==0||!o.value},{default:l.withCtx(()=>[l.createVNode(qc,{class:"w-5 h-5 select-none"})]),_:1},8,["disabled"]),l.createVNode(Yr,{onClick:f[1]||(f[1]=h=>a(t.currentPage-1)),disabled:t.currentPage===1||o.value==0||!o.value},{default:l.withCtx(()=>[l.createVNode(Uc,{class:"w-5 h-5 select-none"})]),_:1},8,["disabled"]),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(s.value,h=>(l.openBlock(),l.createBlock(Yr,{key:`page_${h}`,onClick:p=>a(h),active:h===t.currentPage,disabled:o.value==0||!o.value},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(h),1)]),_:2},1032,["onClick","active","disabled"]))),128)),l.createVNode(Yr,{onClick:f[2]||(f[2]=h=>a(t.currentPage+1)),disabled:t.currentPage===o.value||o.value==0||!o.value},{default:l.withCtx(()=>[l.createVNode(Yc,{class:"w-5 h-5 select-none"})]),_:1},8,["disabled"]),l.createVNode(Yr,{onClick:f[3]||(f[3]=h=>a(o.value)),disabled:t.currentPage===o.value||o.value==0||!o.value},{default:l.withCtx(()=>[l.createVNode(Kc,{class:"w-5 h-5 select-none"})]),_:1},8,["disabled"])])):l.createCommentVNode("",!0),l.createCommentVNode("",!0)]))}}),Jc=(t,e)=>{const n=t.column.children&&t.column.children.default&&typeof t.column.children.default=="function"?t.column.children.default({item:t.item}):t.column.children;return l.h("td",e.attrs,n)};Jc.props=["column","item","rowIndex"];const ws=Jc,eS={},tS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},nS=[l.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 rS(t,e){return l.openBlock(),l.createElementBlock("svg",tS,nS)}const iS=ue(eS,[["render",rS]]),oS={class:"font-semibold"},Gc={__name:"TotalRow",props:{columns:Array,noXPadding:Boolean,totalItem:{},position:String},setup(t){const e={pmi:"bg-white dark:text-zinc-300 dark:border-zinc-900 dark:bg-zinc-800","wpic-tools":"bg-gray-50 border-gray-200 dark:border-gray-900 dark:bg-gray-800"};return(n,r)=>(l.openBlock(),l.createElementBlock("tr",oS,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(t.columns,(i,o)=>(l.openBlock(),l.createBlock(ws,{class:l.normalizeClass(["py-3 first:pl-6 pr-6 border-t",{[`${e[l.unref(ne).theme]}`]:!0,"sticky left-0":o===0,"border-b":t.position==="header","border-t":t.position==="footer","first:pl-0 last:pr-0":t.noXPadding,"last:rounded-br-lg":!0,"first:rounded-bl-lg":!0,"text-center":i.align=="center","text-right":i.align=="right"}]),id:`total_${o}`,column:i,item:t.totalItem,key:`tr_total_${o}`},null,8,["class","id","column","item"]))),128))]))}},sS={},aS={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-6"},lS=[l.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 4.5v15m7.5-7.5h-15"},null,-1)];function cS(t,e){return l.openBlock(),l.createElementBlock("svg",aS,lS)}const dS=ue(sS,[["render",cS]]),uS={class:"overflow-auto"},fS={class:"w-full rounded-lg"},hS=["width"],pS=["width"],mS={key:0,class:"rounded-t-lg"},gS=["onClick"],yS={class:"rounded-b-lg relative"},bS={key:0},kS=[l.createElementVNode("td",{class:"text-center py-3"},"   ",-1)],vS={key:1},xS={key:0,class:"text-center text-gray-400 py-3"},wS=Object.assign({name:"WpicTable"},{props:{data:{type:Array,default:()=>[]},stripe:Boolean,loading:Boolean,hideHeaders:Boolean,sortOptions:{},border:Boolean,noXPadding:Boolean,totalItem:{},totalOnBottom:Boolean,totalOnTop:Boolean,valign:{type:String,default:"center"},small:Boolean,noRadius:Boolean},emits:["changeSort","expandRow"],setup(t,{expose:e,emit:n}){const r=t,i={pmi:"","wpic-tools":"border-gray-300 dark:border-gray-700"},o={pmi:"bg-zinc-50 dark:bg-zinc-800/60 text-zinc-500 dark:text-zinc-400 dark:border-zinc-900","wpic-tools":"bg-gray-100 text-gray-400 border-gray-200 dark:bg-gray-930 dark:border-gray-900 dark:text-gray-500"},s={pmi:"","wpic-tools":"dark:border-gray-900"},a={pmi:"","wpic-tools":""},c={pmi:"bg-white dark:bg-zinc-800 dark:text-zinc-300 dark:border-zinc-900","wpic-tools":"bg-white border-gray-200 dark:bg-gray-940 dark:border-gray-920 dark:text-gray-300"},d={pmi:"group-[.is-odd]:bg-white group-[.is-even]:bg-gray-50","wpic-tools":"group-[.is-odd]:bg-white group-[.is-even]:bg-gray-50 border-gray-200 dark:group-[.is-odd]:bg-gray-940 dark:group-[.is-even]:bg-gray-930"},u={pmi:"bg-zinc-900/10","wpic-tools":"bg-gray-900/10"},f=n;l.onMounted(()=>{g()});const h=l.getCurrentInstance();l.provide("wtable",h==null?void 0:h.proxy);const p=l.useSlots(),m=l.ref([]);function g(){const N=(v,$)=>{let D={};for(let A in v){if(typeof v[A].default=="boolean"&&$[A]!==void 0){D[A]=$[A]!==!1;continue}if($[A]!==void 0){D[A]=$[A];continue}if(typeof v[A].default=="function"){D[A]=v[A].default();continue}D[A]=v[A].default}return D};let b=[];(p.default&&p.default()||[]).forEach(v=>{var $,D;(($=v.type)==null?void 0:$.name)==="WpicTableColumn"?b.push(v):(D=v.children)!=null&&D.length&&v.children.forEach(A=>{var B;((B=A.type)==null?void 0:B.name)==="WpicTableColumn"&&b.push(A)})}),m.value=b.map(v=>{let $=v.children,D=v.props||{},{field:A,label:B,help:P,width:F,minWidth:G,maxWidth:L,sortable:I,selectable:T,render:x,type:M,align:V,visible:U,noPadding:W}=N(v.type.props,D);return{label:B,help:P,width:F,minWidth:G,maxWidth:L,type:M,align:V,sortable:I,selectable:T,field:A,render:x,children:$,visible:U,noPadding:W}}).filter(v=>v.visible||v.selectable)}function y(N){var S,v;let b=(S=r.sortOptions)==null?void 0:S.sortDirection;((v=r.sortOptions)==null?void 0:v.sortBy)===N&&(b=b==="asc"?"desc":"asc"),f("changeSort",{sortDirection:b,sortBy:N})}l.watch(()=>p.default,N=>{g()},{deep:!0}),e({buildColumns:g});const k=l.reactive({});function C({index:N,item:b}){k[N]?k[N]=null:(k[N]=!0,f("expandRow",{index:N,item:b}))}return(N,b)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["wpic-table relative w-full rounded-lg overflow-hidden",{"no-radius rounded-none":t.noRadius,border:t.border,[`${i[l.unref(ne).theme]}`]:!0}])},[l.createElementVNode("div",uS,[l.createElementVNode("table",fS,[l.createElementVNode("colgroup",null,[m.value.find(S=>S.type=="expand")?(l.openBlock(),l.createElementBlock("col",{key:0,style:l.normalizeStyle({minWidth:`${m.value.find(S=>S.type=="expand").minWidth}px`}),width:m.value.find(S=>S.type=="expand").width,class:"w-16"},null,12,hS)):l.createCommentVNode("",!0),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(m.value.filter(S=>S.type!="expand"),(S,v)=>(l.openBlock(),l.createElementBlock("col",{style:l.normalizeStyle({minWidth:`${S.minWidth}px`,maxWidth:`${S.maxWidth}px`}),width:S.width,key:v},null,12,pS))),128))]),t.hideHeaders?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("thead",mS,[l.createElementVNode("tr",null,[m.value.find(S=>S.type=="expand")?(l.openBlock(),l.createElementBlock("th",{key:0,class:l.normalizeClass(["first:rounded-tl-lg last:rounded-tr-lg py-0 border-b first:pl-6 pr-6",[`${o[l.unref(ne).theme]}`]])},null,2)):l.createCommentVNode("",!0),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(m.value.filter(S=>S.type!="expand"),(S,v)=>{var $,D;return l.openBlock(),l.createElementBlock("th",{class:l.normalizeClass(["first:rounded-tl-lg last:rounded-tr-lg py-0 border-b first:pl-6 pr-6",{[`${o[l.unref(ne).theme]}`]:!0,"sticky left-0":v===0}]),style:l.normalizeStyle({maxWidth:`${S.maxWidth}px`})},[l.createElementVNode("div",{onClick:()=>{S.sortable&&y(S.field)},class:l.normalizeClass(["flex items-center lg:text-base rounded-lg",{"py-3":!t.small,"py-1 text-sm":t.small,"cursor-pointer":S.sortable&&S.field,"justify-center":S.align=="center","justify-end":S.align=="right"}])},[l.createElementVNode("span",{class:l.normalizeClass(["select-none font-medium",{"text-right":S.align=="right"}])},l.toDisplayString(S.label),3),S.sortable&&S.field?(l.openBlock(),l.createElementBlock("span",{key:0,class:l.normalizeClass(["ml-1",{"opacity-25":S.field!=(($=t.sortOptions)==null?void 0:$.sortBy)}])},[l.createVNode(iS,{class:l.normalizeClass(["w-4 h-4",{"rotate-180":((D=t.sortOptions)==null?void 0:D.sortDirection)==="asc"}])},null,8,["class"])],2)):l.createCommentVNode("",!0)],10,gS)],6)}),256))])])),l.createElementVNode("tbody",yS,[t.loading?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[l.createElementVNode("div",{class:l.normalizeClass(["inset-0 z-10 absolute flex items-center justify-center",[u[l.unref(ne).theme]]])},[l.createVNode(Kn,{class:"w-6 h-6"})],2),t.data.length?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("tr",bS,kS))],64)):l.createCommentVNode("",!0),t.totalItem&&t.totalOnTop?(l.openBlock(),l.createBlock(Gc,{key:1,position:"header",columns:m.value,noXPadding:t.noXPadding,totalItem:t.totalItem},null,8,["columns","noXPadding","totalItem"])):l.createCommentVNode("",!0),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(t.data,(S,v)=>{var $,D,A,B,P;return l.openBlock(),l.createElementBlock(l.Fragment,{key:`tr_${v}`},[l.createElementVNode("tr",{class:l.normalizeClass(["tr group border-b last:border-b-0 overflow-hidden",{"is-odd":v%2==0,"is-even":v%2!=0,[s[l.unref(ne).theme]]:!0}])},[m.value.find(F=>F.type=="expand")?(l.openBlock(),l.createElementBlock("td",{key:0,class:l.normalizeClass([[{"first:pl-6 pr-6 last:pr-6":!t.noXPadding,"first:pl-0 pr-6 last:pr-0":t.noXPadding,"align-top py-5":t.valign=="top"}],"border-t border-gray-200 leading-tight h-16 py-2 dark:border-gray-920"])},[l.createVNode(Ni,{small:"",square:"",onClick:F=>C({item:S,index:v})},{default:l.withCtx(()=>[k[v]?(l.openBlock(),l.createBlock(rw,{key:0,class:"w-4 h-4"})):(l.openBlock(),l.createBlock(dS,{key:1,class:"w-4 h-4"}))]),_:2},1032,["onClick"])],2)):l.createCommentVNode("",!0),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(m.value.filter(F=>F.type!="expand"),(F,G)=>{var L,I;return l.openBlock(),l.createBlock(ws,{class:l.normalizeClass(["lg:text-base h-full table-cell",{"text-sm lg:text-sm py-1!":t.small,"sticky left-0 shadow-sm":G===0,[`${c[l.unref(ne).theme]}`]:!0,[`${d[l.unref(ne).theme]}`]:t.stripe,"py-3 first:pl-6 pr-6":!F.noPadding,"first:pl-0 last:pr-0":t.noXPadding,"last:rounded-br-lg":v===((L=t.data)==null?void 0:L.length)-1&&!t.totalItem&&!m.value.find(T=>T.type=="expand")&&!t.noRadius,"first:rounded-bl-lg":v===((I=t.data)==null?void 0:I.length)-1&&!t.totalItem&&!m.value.find(T=>T.type=="expand")&&!t.noRadius,"text-center justify-center":F.align=="center","text-right justify-end":F.align=="right","align-top py-5":t.valign=="top"}]),style:l.normalizeStyle({maxWidth:`${F.maxWidth}px`}),id:`${v}_${G}`,column:F,item:S,rowIndex:v,key:G},null,8,["class","style","id","column","item","rowIndex"])}),128))],2),m.value.find(F=>F.type=="expand")?l.withDirectives((l.openBlock(),l.createElementBlock("tr",{key:0,class:l.normalizeClass([{[s[l.unref(ne).theme]]:!t.stripe,[a[l.unref(ne).theme]]:t.stripe},"tr border-b last:border-b-0 overflow-hidden"])},[l.createVNode(ws,{class:l.normalizeClass(["lg:text-base bg-gray-50! dark:bg-gray-940!",{[`${c[l.unref(ne).theme]}`]:!0,"py-3 first:pl-6 pr-6":!(($=m.value.find(F=>F.type=="expand"))!=null&&$.noPadding),"p-0":(D=m.value.find(F=>F.type=="expand"))==null?void 0:D.noPadding,"first:pl-0 last:pr-0":t.noXPadding,"last:rounded-br-lg":v===((A=t.data)==null?void 0:A.length)-1&&!t.totalItem,"first:rounded-bl-lg":v===((B=t.data)==null?void 0:B.length)-1&&!t.totalItem,"text-center":m.value.find(F=>F.type=="expand").align=="center","text-right":m.value.find(F=>F.type=="expand").align=="right"}]),column:m.value.find(F=>F.type=="expand"),rowIndex:v,colspan:(P=m.value)==null?void 0:P.length,item:S},null,8,["class","column","rowIndex","colspan","item"])],2)),[[l.vShow,k[v]]]):l.createCommentVNode("",!0)],64)}),128))]),t.totalItem&&t.totalOnBottom?(l.openBlock(),l.createElementBlock("tfoot",vS,[l.createVNode(Gc,{position:"footer",columns:m.value,noXPadding:t.noXPadding,totalItem:t.totalItem},null,8,["columns","noXPadding","totalItem"])])):l.createCommentVNode("",!0)])]),!t.loading&&!t.data.length?(l.openBlock(),l.createElementBlock("div",xS," No Data ")):l.createCommentVNode("",!0)],2))}}),SS={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},noPadding:{type:Boolean,default:!1}},setup(t){const e=inject("wtable",null);return onMounted(()=>{e&&e.buildColumns&&e.buildColumns()}),onBeforeUnmount(()=>{e&&e.buildColumns&&e.buildColumns()}),()=>null}};function De(t){this.content=t}De.prototype={constructor:De,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 De(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 De(n)},addToStart:function(t,e){return new De([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new De(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 De(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=De.from(t),t.size?new De(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=De.from(t),t.size?new De(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=De.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}},De.from=function(t){if(t instanceof De)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new De(e)};function Zc(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=Zc(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function Xc(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),a=e.child(--o),c=s.nodeSize;if(s==a){n-=c,r-=c;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let d=0,u=Math.min(s.text.length,a.text.length);for(;d<u&&s.text[s.text.length-d-1]==a.text[a.text.length-d-1];)d++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let d=Xc(s.content,a.content,n-1,r-1);if(d)return d}n-=c,r-=c}}class R{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,a=0;a<n;s++){let c=this.content[s],d=a+c.nodeSize;if(d>e&&r(c,i+a,o||null,s)!==!1&&c.content.size){let u=a+1;c.nodesBetween(Math.max(0,e-u),Math.min(c.content.size,n-u),r,i+u)}a=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let o="",s=!0;return this.nodesBetween(e,n,(a,c)=>{let d=a.isText?a.text.slice(Math.max(e,c)-c,n-c):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&d||a.isTextblock)&&r&&(s?s=!1:o+=r),o+=d},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 R(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 a=this.content[o],c=s+a.nodeSize;c>e&&((s<e||c>n)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),i+=a.nodeSize),s=c}return new R(r,i)}cutByIndex(e,n){return e==n?R.empty:e==0&&n==this.content.length?this:new R(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 R(i,o)}addToStart(e){return new R([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new R(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 Zc(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Xc(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 R.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new R(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return R.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 R(n||e,r)}static from(e){if(!e)return R.empty;if(e instanceof R)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new R([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}R.empty=new R([],0);const Ss={index:0,offset:0};function Ki(t,e){return Ss.index=t,Ss.offset=e,Ss}function Yi(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(!Yi(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Yi(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let ge=class tl{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&&Yi(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 tl.none;if(e instanceof tl)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};ge.none=[];class Ji extends Error{}class q{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=ed(this.content,e+this.openStart,n);return r&&new q(r,this.openStart,this.openEnd)}removeBetween(e,n){return new q(Qc(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 q.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 q(R.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 q(e,r,i)}}q.empty=new q(R.empty,0,0);function Qc(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(i==e||o.isText){if(a!=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(Qc(o.content,e-i-1,n-i-1)))}function ed(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 a=ed(s.content,e-o-1,n);return a&&t.replaceChild(i,s.copy(a))}function CS(t,e,n){if(n.openStart>t.depth)throw new Ji("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Ji("Inconsistent open depths");return td(t,e,n,0)}function td(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=td(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,a=s.content;return Mn(s,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=OS(n,t);return Mn(o,rd(t,s,a,e,r))}else return Mn(o,Gi(t,e,r))}function nd(t,e){if(!e.type.compatibleContent(t.type))throw new Ji("Cannot join "+e.type.name+" onto "+t.type.name)}function Cs(t,e,n){let r=t.node(n);return nd(r,e.node(n)),r}function En(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 Jr(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&&(En(t.nodeAfter,r),o++));for(let a=o;a<s;a++)En(i.child(a),r);e&&e.depth==n&&e.textOffset&&En(e.nodeBefore,r)}function Mn(t,e){return t.type.checkContent(e),t.copy(e)}function rd(t,e,n,r,i){let o=t.depth>i&&Cs(t,e,i+1),s=r.depth>i&&Cs(n,r,i+1),a=[];return Jr(null,t,i,a),o&&s&&e.index(i)==n.index(i)?(nd(o,s),En(Mn(o,rd(t,e,n,r,i+1)),a)):(o&&En(Mn(o,Gi(t,e,i+1)),a),Jr(e,n,i,a),s&&En(Mn(s,Gi(n,r,i+1)),a)),Jr(r,null,i,a),new R(a)}function Gi(t,e,n){let r=[];if(Jr(null,t,n,r),t.depth>n){let i=Cs(t,e,n+1);En(Mn(i,Gi(t,e,n+1)),r)}return Jr(e,null,n,r),new R(r)}function OS(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(R.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Gr{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 ge.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 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 Zi(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:a,offset:c}=s.content.findIndex(o),d=o-c;if(r.push(s,a,i+c),!d||(s=s.child(a),s.isText))break;o=d-1,i+=c+1}return new Gr(n,r,o)}static resolveCached(e,n){for(let i=0;i<Os.length;i++){let o=Os[i];if(o.pos==n&&o.doc==e)return o}let r=Os[Es]=Gr.resolve(e,n);return Es=(Es+1)%ES,r}}let Os=[],Es=0,ES=12;class Zi{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 MS=Object.create(null);let Tn=class nl{constructor(e,n,r,i=ge.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||R.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&&Yi(this.attrs,n||e.defaultAttrs||MS)&&ge.sameSet(this.marks,r||ge.none)}copy(e=null){return e==this.content?this:new nl(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new nl(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 q.empty;let i=this.resolve(e),o=this.resolve(n),s=r?0:i.sharedDepth(n),a=i.start(s),d=i.node(s).content.cut(i.pos-a,o.pos-a);return new q(d,i.depth-s,o.depth-s)}replace(e,n,r){return CS(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 Gr.resolveCached(this,e)}resolveNoCache(e){return Gr.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()+")"),id(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=R.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let c=i;c<o;c++)if(!this.type.allowsMarks(r.child(c).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=ge.none;for(let n=0;n<this.marks.length;n++)e=this.marks[n].addToSet(e);if(!ge.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=R.fromJSON(e,n.content);return e.nodeType(n.type).create(n.attrs,i,r)}};Tn.prototype.text=void 0;class Xi extends Tn{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):id(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 Xi(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Xi(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 id(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class $n{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new TS(e,n);if(r.next==null)return $n.empty;let i=od(r);r.next&&r.err("Unexpected trailing text");let o=IS(VS(i));return PS(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,a){let c=s.matchFragment(e,r);if(c&&(!n||c.validEnd))return R.from(a.map(d=>d.createAndFill()));for(let d=0;d<s.next.length;d++){let{type:u,next:f}=s.next[d];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let h=o(f,a.concat(u));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 a=i;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:a,next:c}=o.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||c.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 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
- `)}}$n.empty=new $n(!0);class TS{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 od(t){let e=[];do e.push($S(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function $S(t){let e=[];do e.push(NS(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function NS(t){let e=DS(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=BS(t,e);else break;return e}function sd(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function BS(t,e){let n=sd(t),r=n;return t.eat(",")&&(t.next!="}"?r=sd(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function AS(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 DS(t){if(t.eat("(")){let e=od(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=AS(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 VS(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function r(s,a,c){let d={term:c,to:a};return e[s].push(d),d}function i(s,a){s.forEach(c=>c.to=a)}function o(s,a){if(s.type=="choice")return s.exprs.reduce((c,d)=>c.concat(o(d,a)),[]);if(s.type=="seq")for(let c=0;;c++){let d=o(s.exprs[c],a);if(c==s.exprs.length-1)return d;i(d,a=n())}else if(s.type=="star"){let c=n();return r(a,c),i(o(s.expr,c),c),[r(c)]}else if(s.type=="plus"){let c=n();return i(o(s.expr,a),c),i(o(s.expr,c),c),[r(c)]}else{if(s.type=="opt")return[r(a)].concat(o(s.expr,a));if(s.type=="range"){let c=a;for(let d=0;d<s.min;d++){let u=n();i(o(s.expr,c),u),c=u}if(s.max==-1)i(o(s.expr,c),c);else for(let d=s.min;d<s.max;d++){let u=n();r(c,u),i(o(s.expr,c),u),c=u}return[r(c)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function ad(t,e){return e-t}function ld(t,e){let n=[];return r(e),n.sort(ad);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:a,to:c}=o[s];!a&&n.indexOf(c)==-1&&r(c)}}}function IS(t){let e=Object.create(null);return n(ld(t,0));function n(r){let i=[];r.forEach(s=>{t[s].forEach(({term:a,to:c})=>{if(!a)return;let d;for(let u=0;u<i.length;u++)i[u][0]==a&&(d=i[u][1]);ld(t,c).forEach(u=>{d||i.push([a,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let o=e[r.join(",")]=new $n(r.indexOf(t.length-1)>-1);for(let s=0;s<i.length;s++){let a=i[s][1].sort(ad);o.next.push({type:i[s][0],next:e[a.join(",")]||n(a)})}return o}}function PS(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],o=!i.validEnd,s=[];for(let a=0;a<i.next.length;a++){let{type:c,next:d}=i.next[a];s.push(c.name),o&&!(c.isText||c.hasRequiredAttrs())&&(o=!1),r.indexOf(d)==-1&&r.push(d)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function cd(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 dd(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 ud(t){let e=Object.create(null);if(t)for(let n in t)e[n]=new _S(t[n]);return e}let fd=class Wh{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=ud(r.attrs),this.defaultAttrs=cd(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==$n.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:dd(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Tn(this,this.computeAttrs(e),R.from(n),ge.setFrom(r))}createChecked(e=null,n,r){return n=R.from(n),this.checkContent(n),new Tn(this,this.computeAttrs(e),n,ge.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=R.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(R.empty,!0);return o?new Tn(this,e,n.append(o),ge.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:ge.none:e}static compile(e,n){let r=Object.create(null);e.forEach((o,s)=>r[o]=new Wh(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 _S{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class Qi{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=ud(i.attrs),this.excluded=null;let o=cd(this.attrs);this.instance=o?new ge(this,o):null}create(e=null){return!e&&this.instance?this.instance:new ge(this,dd(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new Qi(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 RS{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=De.from(e.nodes),n.marks=De.from(e.marks||{}),this.nodes=fd.compile(this.spec.nodes,this),this.marks=Qi.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||"",a=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=$n.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=a=="_"?null:a?hd(this,a.split(" ")):a==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:hd(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 fd){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 Xi(r,r.defaultAttrs,e,ge.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return Tn.fromJSON(this,e)}markFromJSON(e){return ge.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function hd(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 a in t.marks){let c=t.marks[a];(i=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function LS(t){return t.tag!=null}function zS(t){return t.style!=null}class rr{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[],n.forEach(r=>{LS(r)?this.tags.push(r):zS(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 yd(this,n,!1);return r.addAll(e,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new yd(this,n,!0);return r.addAll(e,n.from,n.to),q.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(HS(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],a=s.style;if(!(a.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(s.getAttrs){let c=s.getAttrs(n);if(c===!1)continue;s.attrs=c||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 a=n[s];if((a.priority==null?50:a.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=bd(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=bd(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new rr(e,rr.schemaRules(e)))}}const pd={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},FS={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},md={ol:!0,ul:!0},eo=1,to=2,no=4;function gd(t,e,n){return e!=null?(e?eo:0)|(e==="full"?to:0):t&&t.whitespace=="pre"?eo|to:n&-5}class ro{constructor(e,n,r,i,o,s,a){this.type=e,this.attrs=n,this.marks=r,this.pendingMarks=i,this.solid=o,this.options=a,this.content=[],this.activeMarks=ge.none,this.stashMarks=[],this.match=s||(a&no?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(R.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&eo)){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=R.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(R.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):WS(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&&!pd.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class yd{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0;let i=n.topNode,o,s=gd(null,n.preserveWhitespace,0)|(r?no:0);i?o=new ro(i.type,i.attrs,ge.none,ge.none,!0,n.topMatch||i.type.contentMatch,s):r?o=new ro(null,null,ge.none,ge.none,!0,null,s):o=new ro(e.schema.topNodeType,null,ge.none,ge.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,a=this.top;for(let c=0;c<s.length;c++)this.removePendingMark(s[c],a);for(let c=0;c<o.length;c++)this.addPendingMark(o[c]);n();for(let c=0;c<o.length;c++)this.removePendingMark(o[c],a);for(let c=0;c<s.length;c++)this.addPendingMark(s[c])}addTextNode(e){let n=e.nodeValue,r=this.top;if(r.options&to||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(r.options&eo)r.options&to?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;md.hasOwnProperty(r)&&this.parser.normalizeLists&&jS(e);let o=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,n));if(o?o.ignore:FS.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,a=this.top,c=this.needsBlock;if(pd.hasOwnProperty(r))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),s=!0,a.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(a),this.needsBlock=c}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=ge.none,r=ge.none;for(let i=0,o=e.length;i<o;i++){let s=e.item(i);for(let a=void 0;;){let c=this.parser.matchStyle(s,e.getPropertyValue(s),this,a);if(!c)break;if(c.ignore)return null;if(c.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach(d=>{c.clearMark(d)&&(r=d.addToSet(r))}):n=this.parser.schema.marks[c.mark].create(c.attrs).addToSet(n),c.consuming===!1)a=c;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 a=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(c=>this.insertNode(c));else{let c=e;typeof n.contentElement=="string"?c=e.querySelector(n.contentElement):typeof n.contentElement=="function"?c=n.contentElement(e):n.contentElement&&(c=n.contentElement),this.findAround(e,c,!0),this.addAll(c)}i&&this.sync(a)&&this.open--,s&&this.removePendingMark(s,a)}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=gd(e,i,o.options);o.options&no&&o.content.length==0&&(s|=no),this.nodes.push(new ro(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=(a,c)=>{for(;a>=0;a--){let d=n[a];if(d==""){if(a==n.length-1||a==0)continue;for(;c>=o;c--)if(s(a-1,c))return!0;return!1}else{let u=c>0||c==0&&i?this.nodes[c].type:r&&c>=o?r.node(c-o).type:null;if(!u||u.name!=d&&u.groups.indexOf(d)==-1)return!1;c--}}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=qS(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 jS(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&md.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function HS(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function bd(t){let e={};for(let n in t)e[n]=t[n];return e}function WS(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let o=[],s=a=>{o.push(a);for(let c=0;c<a.edgeCount;c++){let{type:d,next:u}=a.edge(c);if(d==e||o.indexOf(u)<0&&s(u))return!0}};if(s(i.contentMatch))return!0}}function qS(t,e){for(let n=0;n<e.length;n++)if(t.eq(e[n]))return e[n]}class Ot{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Ms(n).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let a=0,c=0;for(;a<o.length&&c<s.marks.length;){let d=s.marks[c];if(!this.marks[d.type.name]){c++;continue}if(!d.eq(o[a][0])||d.type.spec.spanning===!1)break;a++,c++}for(;a<o.length;)i=o.pop()[1];for(;c<s.marks.length;){let d=s.marks[c++],u=this.serializeMark(d,s.isInline,n);u&&(o.push([d,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=Ot.renderSpec(Ms(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&&Ot.renderSpec(Ms(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,a=r?e.createElementNS(r,i):e.createElement(i),c=n[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let f=u.indexOf(" ");f>0?a.setAttributeNS(u.slice(0,f),u.slice(f+1),c[u]):a.setAttribute(u,c[u])}}for(let u=d;u<n.length;u++){let f=n[u];if(f===0){if(u<n.length-1||u>d)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}=Ot.renderSpec(e,f,r);if(a.appendChild(h),p){if(s)throw new RangeError("Multiple content holes");s=p}}}return{dom:a,contentDOM:s}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ot(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=kd(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return kd(e.marks)}}function kd(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Ms(t){return t.document||window.document}const vd=65535,xd=Math.pow(2,16);function US(t,e){return t+e*xd}function wd(t){return t&vd}function KS(t){return(t-(t&vd))/xd}const Sd=1,Cd=2,io=4,Od=8;class Ts{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Od)>0}get deletedBefore(){return(this.delInfo&(Sd|io))>0}get deletedAfter(){return(this.delInfo&(Cd|io))>0}get deletedAcross(){return(this.delInfo&io)>0}}class Qe{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Qe.empty)return Qe.empty}recover(e){let n=0,r=wd(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+KS(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 a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?i:0);if(c>e)break;let d=this.ranges[a+o],u=this.ranges[a+s],f=c+d;if(e<=f){let h=d?e==c?-1:e==f?1:n:n,p=c+i+(h<0?0:u);if(r)return p;let m=e==(n<0?c:f)?null:US(a/3,e-c),g=e==c?Cd:e==f?Sd:io;return(n<0?e!=c:e!=f)&&(g|=Od),new Ts(p,g,m)}i+=u-d}return r?e+i:new Ts(e+i,0,null)}touches(e,n){let r=0,i=wd(n),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?r:0);if(c>e)break;let d=this.ranges[a+o],u=c+d;if(e<=u&&a==i*3)return!0;r+=this.ranges[a+s]-d}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],a=s-(this.inverted?o:0),c=s+(this.inverted?0:o),d=this.ranges[i+n],u=this.ranges[i+r];e(a,a+d,c,c+u),o+=u-d}}invert(){return new Qe(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Qe.empty:new Qe(e<0?[0,-e,0]:[0,0,e])}}Qe.empty=new Qe([]);class ir{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 ir(this.maps,this.mirror,e,n)}copy(){return new ir(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 ir;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],a=s.mapResult(e,n);if(a.recover!=null){let c=this.getMirror(o);if(c!=null&&c>o&&c<this.to){o=c,e=this.maps[c].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new Ts(e,i,null)}}const $s=Object.create(null);class Pe{getMap(){return Qe.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=$s[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 $s)throw new RangeError("Duplicate use of step JSON ID "+e);return $s[e]=n,n.prototype.jsonID=e,n}}class Se{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Se(e,null)}static fail(e){return new Se(null,e)}static fromReplace(e,n,r,i){try{return Se.ok(e.replace(n,r,i))}catch(o){if(o instanceof Ji)return Se.fail(o.message);throw o}}}function Ns(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let o=t.child(i);o.content.size&&(o=o.copy(Ns(o.content,e,o))),o.isInline&&(o=e(o,n,i)),r.push(o)}return R.fromArray(r)}class en extends Pe{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 q(Ns(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return Se.fromReplace(e,this.from,this.to,o)}invert(){return new Et(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 en(n.pos,r.pos,this.mark)}merge(e){return e instanceof en&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new en(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 en(n.from,n.to,e.markFromJSON(n.mark))}}Pe.jsonID("addMark",en);class Et extends Pe{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 q(Ns(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Se.fromReplace(e,this.from,this.to,r)}invert(){return new en(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 Et(n.pos,r.pos,this.mark)}merge(e){return e instanceof Et&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Et(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 Et(n.from,n.to,e.markFromJSON(n.mark))}}Pe.jsonID("removeMark",Et);class tn extends Pe{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Se.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Se.fromReplace(e,this.pos,this.pos+1,new q(R.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 tn(this.pos,n.marks[i]);return new tn(this.pos,this.mark)}}return new or(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new tn(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 tn(n.pos,e.markFromJSON(n.mark))}}Pe.jsonID("addNodeMark",tn);class or extends Pe{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Se.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Se.fromReplace(e,this.pos,this.pos+1,new q(R.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new tn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new or(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 or(n.pos,e.markFromJSON(n.mark))}}Pe.jsonID("removeNodeMark",or);class Te extends Pe{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Bs(e,this.from,this.to)?Se.fail("Structure replace would overwrite content"):Se.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Qe([this.from,this.to-this.from,this.slice.size])}invert(e){return new Te(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 Te(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(e){if(!(e instanceof Te)||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?q.empty:new q(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Te(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?q.empty:new q(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Te(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 Te(n.from,n.to,q.fromJSON(e,n.slice),!!n.structure)}}Pe.jsonID("replace",Te);class $e extends Pe{constructor(e,n,r,i,o,s,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a}apply(e){if(this.structure&&(Bs(e,this.from,this.gapFrom)||Bs(e,this.gapTo,this.to)))return Se.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Se.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Se.fromReplace(e,this.from,this.to,r):Se.fail("Content does not fit in gap")}getMap(){return new Qe([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 $e(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 $e(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 $e(n.from,n.to,n.gapFrom,n.gapTo,q.fromJSON(e,n.slice),n.insert,!!n.structure)}}Pe.jsonID("replaceAround",$e);function Bs(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 YS(t,e,n,r){let i=[],o=[],s,a;t.doc.nodesBetween(e,n,(c,d,u)=>{if(!c.isInline)return;let f=c.marks;if(!r.isInSet(f)&&u.type.allowsMarkType(r.type)){let h=Math.max(d,e),p=Math.min(d+c.nodeSize,n),m=r.addToSet(f);for(let g=0;g<f.length;g++)f[g].isInSet(m)||(s&&s.to==h&&s.mark.eq(f[g])?s.to=p:i.push(s=new Et(h,p,f[g])));a&&a.to==h?a.to=p:o.push(a=new en(h,p,r))}}),i.forEach(c=>t.step(c)),o.forEach(c=>t.step(c))}function JS(t,e,n,r){let i=[],o=0;t.doc.nodesBetween(e,n,(s,a)=>{if(!s.isInline)return;o++;let c=null;if(r instanceof Qi){let d=s.marks,u;for(;u=r.isInSet(d);)(c||(c=[])).push(u),d=u.removeFromSet(d)}else r?r.isInSet(s.marks)&&(c=[r]):c=s.marks;if(c&&c.length){let d=Math.min(a+s.nodeSize,n);for(let u=0;u<c.length;u++){let f=c[u],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=d,h.step=o):i.push({style:f,from:Math.max(a,e),to:d,step:o})}}}),i.forEach(s=>t.step(new Et(s.from,s.to,s.style)))}function Ed(t,e,n,r=n.contentMatch,i=!0){let o=t.doc.nodeAt(e),s=[],a=e+1;for(let c=0;c<o.childCount;c++){let d=o.child(c),u=a+d.nodeSize,f=r.matchType(d.type);if(!f)s.push(new Te(a,u,q.empty));else{r=f;for(let h=0;h<d.marks.length;h++)n.allowsMarkType(d.marks[h].type)||t.step(new Et(a,u,d.marks[h]));if(i&&d.isText&&n.whitespace!="pre"){let h,p=/\r?\n|\r/g,m;for(;h=p.exec(d.text);)m||(m=new q(R.from(n.schema.text(" ",n.allowedMarks(d.marks))),0,0)),s.push(new Te(a+h.index,a+h.index+h[0].length,m))}}a=u}if(!r.validEnd){let c=r.fillBefore(R.empty,!0);t.replace(a,a,new q(c,0,0))}for(let c=s.length-1;c>=0;c--)t.step(s[c])}function GS(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function sr(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||!GS(i,o,s))break}return null}function ZS(t,e,n){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),a=i.after(o+1),c=s,d=a,u=R.empty,f=0;for(let m=o,g=!1;m>n;m--)g||r.index(m)>0?(g=!0,u=R.from(r.node(m).copy(u)),f++):c--;let h=R.empty,p=0;for(let m=o,g=!1;m>n;m--)g||i.after(m+1)<i.end(m)?(g=!0,h=R.from(i.node(m).copy(h)),p++):d++;t.step(new $e(c,d,s,a,new q(u.append(h),f,p),u.size-f,!0))}function As(t,e,n=null,r=t){let i=XS(t,e),o=i&&QS(r,e);return o?i.map(Md).concat({type:e,attrs:n}).concat(o.map(Md)):null}function Md(t){return{type:t,attrs:null}}function XS(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 QS(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 c=(s.length?s[s.length-1]:e).contentMatch;for(let d=r;c&&d<i;d++)c=c.matchType(n.child(d).type);return!c||!c.validEnd?null:s}function eC(t,e,n){let r=R.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let a=n[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=R.from(n[s].type.create(n[s].attrs,r))}let i=e.start,o=e.end;t.step(new $e(i,o,i,o,new q(r,0,0),n.length,!0))}function tC(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,a)=>{if(s.isTextblock&&!s.hasMarkup(r,i)&&iC(t.doc,t.mapping.slice(o).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&rC(t,s,a,o),Ed(t,t.mapping.slice(o).map(a,1),r,void 0,c===null);let d=t.mapping.slice(o),u=d.map(a,1),f=d.map(a+s.nodeSize,1);return t.step(new $e(u,f,u+1,f-1,new q(R.from(r.create(i,null,s.marks)),0,0),1,!0)),c===!0&&nC(t,s,a,o),!1}})}function nC(t,e,n,r){e.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let c=t.mapping.slice(r).map(n+1+o+s.index);t.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function rC(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 iC(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function oC(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 $e(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new q(R.from(s),0,0),1,!0))}function zt(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 d=i.depth-1,u=n-2;d>o;d--,u--){let f=i.node(d),h=i.index(d);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 g=r&&r[u]||f;if(!f.canReplace(h+1,f.childCount)||!g.type.validContent(p))return!1}let a=i.indexAfter(o),c=r&&r[0];return i.node(o).canReplaceWith(a,a,c?c.type:i.node(o+1).type)}function sC(t,e,n=1,r){let i=t.doc.resolve(e),o=R.empty,s=R.empty;for(let a=i.depth,c=i.depth-n,d=n-1;a>c;a--,d--){o=R.from(i.node(a).copy(o));let u=r&&r[d];s=R.from(u?u.type.create(u.attrs,s):i.node(a).copy(s))}t.step(new Te(e,e,new q(o.append(s),n,n),!0))}function nn(t,e){let n=t.resolve(e),r=n.index();return Td(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Td(t,e){return!!(t&&e&&!t.isLeaf&&t.canAppend(e))}function oo(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let o,s,a=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):n>0?(o=r.node(i+1),a++,s=r.node(i).maybeChild(a)):(o=r.node(i).maybeChild(a-1),s=r.node(i+1)),o&&!o.isTextblock&&Td(o,s)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function aC(t,e,n){let r=new Te(e-n,e+n,q.empty,!0);t.step(r)}function lC(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 $d(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 a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,c=r.index(s)+(a>0?1:0),d=r.node(s),u=!1;if(o==1)u=d.canReplace(c,c,i);else{let f=d.contentMatchAt(c).findWrapping(i.firstChild.type);u=f&&d.canReplaceWith(c,c,f[0])}if(u)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function so(t,e,n=e,r=q.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),o=t.resolve(n);return Nd(i,o,r)?new Te(e,n,r):new cC(i,o,r).fit()}function Nd(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class cC{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=R.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=R.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,a=i.depth;for(;s&&a&&o.childCount==1;)o=o.firstChild.content,s--,a--;let c=new q(o,s,a);return e>-1?new $e(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new Te(r.pos,i.pos,c):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=Ds(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:c,match:d}=this.frontier[a],u,f=null;if(n==1&&(s?d.matchType(s.type)||(f=d.fillBefore(R.from(s),!1)):o&&c.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:a,parent:o,inject:f};if(n==2&&s&&(u=d.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:o,wrap:u};if(o&&d.matchType(o.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Ds(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new q(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=Ds(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new q(Zr(e,n-1,1),n-1,o?n-1:r)}else this.unplaced=new q(Zr(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 g=0;g<o.length;g++)this.openFrontierNode(o[g]);let s=this.unplaced,a=r?r.content:s.content,c=s.openStart-e,d=0,u=[],{match:f,type:h}=this.frontier[n];if(i){for(let g=0;g<i.childCount;g++)u.push(i.child(g));f=f.matchFragment(i)}let p=a.size+e-(s.content.size-s.openEnd);for(;d<a.childCount;){let g=a.child(d),y=f.matchType(g.type);if(!y)break;d++,(d>1||c==0||g.content.size)&&(f=y,u.push(Bd(g.mark(h.allowedMarks(g.marks)),d==1?c:0,d==a.childCount?p:-1)))}let m=d==a.childCount;m||(p=-1),this.placed=Xr(this.placed,n,R.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 g=0,y=a;g<p;g++){let k=y.lastChild;this.frontier.push({type:k.type,match:k.contentMatchAt(k.childCount)}),y=k.content}this.unplaced=m?e==0?q.empty:new q(Zr(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new q(Zr(s.content,e,d),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Vs(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=Vs(e,n,i,r,o);if(s){for(let a=n-1;a>=0;a--){let{match:c,type:d}=this.frontier[a],u=Vs(e,a,d,c,!0);if(!u||u.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=Xr(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=Xr(this.placed,this.depth,R.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(R.empty,!0);n.childCount&&(this.placed=Xr(this.placed,this.frontier.length,n))}}function Zr(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Zr(t.firstChild.content,e-1,n)))}function Xr(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Xr(t.lastChild.content,e-1,n)))}function Ds(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Bd(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Bd(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(R.empty,!0)))),t.copy(r)}function Vs(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 a=r.fillBefore(o.content,!0,s);return a&&!dC(n,o.content,s)?a:null}function dC(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function uC(t){return t.spec.defining||t.spec.definingForContent}function fC(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),o=t.doc.resolve(n);if(Nd(i,o,r))return t.step(new Te(e,n,r));let s=Dd(i,t.doc.resolve(n));s[s.length-1]==0&&s.pop();let a=-(i.depth+1);s.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;s.indexOf(h)>-1?a=h:i.before(h)==p&&s.splice(1,0,-h)}let c=s.indexOf(a),d=[],u=r.openStart;for(let h=r.content,p=0;;p++){let m=h.firstChild;if(d.push(m),p==r.openStart)break;h=m.content}for(let h=u-1;h>=0;h--){let p=d[h],m=uC(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=d[p];if(m)for(let g=0;g<s.length;g++){let y=s[(g+c)%s.length],k=!0;y<0&&(k=!1,y=-y);let C=i.node(y-1),N=i.index(y-1);if(C.canReplaceWith(N,N,m.type,m.marks))return t.replace(i.before(y),k?o.after(y):n,new q(Ad(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 Ad(t,e,n,r,i){if(e<n){let o=t.firstChild;t=t.replaceChild(0,o.copy(Ad(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(R.empty,!0))}return t}function hC(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=lC(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new q(R.from(r),0,0))}function pC(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),o=Dd(r,i);for(let s=0;s<o.length;s++){let a=o[s],c=s==o.length-1;if(c&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),i.end(a));if(a>0&&(c||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.delete(r.before(a),i.after(a))}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 Dd(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 ar extends Pe{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 Se.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 Se.fromReplace(e,this.pos,this.pos+1,new q(R.from(i),0,n.isLeaf?0:1))}getMap(){return Qe.empty}invert(e){return new ar(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 ar(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 ar(n.pos,n.attr,n.value)}}Pe.jsonID("attr",ar);class Qr extends Pe{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 Se.ok(r)}getMap(){return Qe.empty}invert(e){return new Qr(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 Qr(n.attr,n.value)}}Pe.jsonID("docAttr",Qr);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 mC{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ir}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=q.empty){let i=so(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new q(R.from(r),0,0))}delete(e,n){return this.replace(e,n,q.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return fC(this,e,n,r),this}replaceRangeWith(e,n,r){return hC(this,e,n,r),this}deleteRange(e,n){return pC(this,e,n),this}lift(e,n){return ZS(this,e,n),this}join(e,n=1){return aC(this,e,n),this}wrap(e,n){return eC(this,e,n),this}setBlockType(e,n=e,r,i=null){return tC(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return oC(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new ar(e,n,r)),this}setDocAttribute(e,n){return this.step(new Qr(e,n)),this}addNodeMark(e,n){return this.step(new tn(e,n)),this}removeNodeMark(e,n){if(!(n instanceof ge)){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 or(e,n)),this}split(e,n=1,r){return sC(this,e,n,r),this}addMark(e,n,r){return YS(this,e,n,r),this}removeMark(e,n,r){return JS(this,e,n,r),this}clearIncompatible(e,n,r){return Ed(this,e,n,r),this}}const Is=Object.create(null);class le{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new gC(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=q.empty){let r=n.content.lastChild,i=null;for(let a=0;a<n.openEnd;a++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:c,$to:d}=s[a],u=e.mapping.slice(o);e.replaceRange(u.map(c.pos),u.map(d.pos),a?q.empty:n),a==0&&Pd(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:a}=i[o],c=e.mapping.slice(r),d=c.map(s.pos),u=c.map(a.pos);o?e.deleteRange(d,u):(e.replaceRangeWith(d,u,n),Pd(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new ie(e):cr(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?cr(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):cr(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 ot(e.node(0))}static atStart(e){return cr(e,e,0,0,1)||new ot(e)}static atEnd(e){return cr(e,e,e.content.size,e.childCount,-1)||new ot(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Is[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 Is)throw new RangeError("Duplicate use of selection JSON ID "+e);return Is[e]=n,n.prototype.jsonID=e,n}getBookmark(){return ie.between(this.$anchor,this.$head).getBookmark()}}le.prototype.visible=!0;class gC{constructor(e,n){this.$from=e,this.$to=n}}let Vd=!1;function Id(t){!Vd&&!t.parent.inlineContent&&(Vd=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class ie extends le{constructor(e,n=e){Id(e),Id(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 le.near(r);let i=e.resolve(n.map(this.anchor));return new ie(i.parent.inlineContent?i:r,r)}replace(e,n=q.empty){if(super.replace(e,n),n==q.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ie&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new ao(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 ie(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=le.findFrom(n,r,!0)||le.findFrom(n,-r,!0);if(o)n=o.$head;else return le.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(le.findFrom(e,-r,!0)||le.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new ie(e,n)}}le.jsonID("text",ie);class ao{constructor(e,n){this.anchor=e,this.head=n}map(e){return new ao(e.map(this.anchor),e.map(this.head))}resolve(e){return ie.between(e.resolve(this.anchor),e.resolve(this.head))}}class Z extends le{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?le.near(o):new Z(o)}content(){return new q(R.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 Ps(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,le.jsonID("node",Z);class Ps{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new ao(r,r):new Ps(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Z.isSelectable(r)?new Z(n):le.near(n)}}class ot extends le{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=q.empty){if(n==q.empty){e.delete(0,e.doc.content.size);let r=le.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new ot(e)}map(e){return new ot(e)}eq(e){return e instanceof ot}getBookmark(){return yC}}le.jsonID("all",ot);const yC={map(){return this},resolve(t){return new ot(t)}};function cr(t,e,n,r,i,o=!1){if(e.inlineContent)return ie.create(t,n);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let a=e.child(s);if(a.isAtom){if(!o&&Z.isSelectable(a))return Z.create(t,n-(i<0?a.nodeSize:0))}else{let c=cr(t,a,n+i,i<0?a.childCount:0,i,o);if(c)return c}n+=a.nodeSize*i}return null}function Pd(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof Te||i instanceof $e))return;let o=t.mapping.maps[r],s;o.forEach((a,c,d,u)=>{s==null&&(s=u)}),t.setSelection(le.near(t.doc.resolve(s),n))}const _d=1,Rd=2,Ld=4;class bC extends mC{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|_d)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&_d)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Rd,this}ensureMarks(e){return ge.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&Rd)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&-3,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)||ge.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(le.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|=Ld,this}get scrolledIntoView(){return(this.updated&Ld)>0}}function zd(t,e){return!e||!t?t:t.bind(e)}class ei{constructor(e,n,r){this.name=e,this.init=zd(n.init,r),this.apply=zd(n.apply,r)}}const kC=[new ei("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new ei("selection",{init(t,e){return t.selection||le.atStart(e.doc)},apply(t){return t.selection}}),new ei("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new ei("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class _s{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=kC.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 ei(r.key,r.spec.state,r))})}}class dr{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 a=this.config.plugins[s];if(a.spec.appendTransaction){let c=i?i[s].n:0,d=i?i[s].state:this,u=c<n.length&&a.spec.appendTransaction.call(a,c?n.slice(c):n,d,r);if(u&&r.filterTransaction(u,s)){if(u.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(u),r=r.applyInner(u),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 dr(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 bC(this)}static create(e){let n=new _s(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new dr(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 _s(this.schema,e.plugins),r=n.fields,i=new dr(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 _s(e.schema,e.plugins),o=new dr(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=Tn.fromJSON(e.schema,n.doc);else if(s.name=="selection")o.selection=le.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 a in r){let c=r[a],d=c.spec.state;if(c.key==s.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){o[s.name]=d.fromJSON.call(c,e,n[a],o);return}}o[s.name]=s.init(e,o)}}),o}}function Fd(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Fd(i,e,{})),n[r]=i}return n}class ze{constructor(e){this.spec=e,this.props={},e.props&&Fd(e.props,this,this.props),this.key=e.key?e.key.key:jd("plugin")}getState(e){return e[this.key]}}const Rs=Object.create(null);function jd(t){return t in Rs?t+"$"+ ++Rs[t]:(Rs[t]=0,t+"$")}class yt{constructor(e="key"){this.key=jd(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ve=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},ti=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Ls=null;const Ft=function(t,e,n){let r=Ls||(Ls=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},vC=function(){Ls=null},Nn=function(t,e,n,r){return n&&(Hd(t,e,n,r,-1)||Hd(t,e,n,r,1))},xC=/^(img|br|input|textarea|hr)$/i;function Hd(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Mt(t))){let o=t.parentNode;if(!o||o.nodeType!=1||ni(t)||xC.test(t.nodeName)||t.contentEditable=="false")return!1;e=Ve(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?Mt(t):0}else return!1}}function Mt(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function wC(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=Mt(t)}else if(t.parentNode&&!ni(t))e=Ve(t),t=t.parentNode;else return null}}function SC(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&&!ni(t))e=Ve(t)+1,t=t.parentNode;else return null}}function CC(t,e,n){for(let r=e==0,i=e==Mt(t);r||i;){if(t==n)return!0;let o=Ve(t);if(t=t.parentNode,!t)return!1;r=r&&o==0,i=i&&o==Mt(t)}}function ni(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 lo=function(t){return t.focusNode&&Nn(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Bn(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function OC(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function EC(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 Tt=typeof navigator<"u"?navigator:null,Wd=typeof document<"u"?document:null,rn=Tt&&Tt.userAgent||"",zs=/Edge\/(\d+)/.exec(rn),qd=/MSIE \d/.exec(rn),Fs=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(rn),Je=!!(qd||Fs||zs),on=qd?document.documentMode:Fs?+Fs[1]:zs?+zs[1]:0,bt=!Je&&/gecko\/(\d+)/i.test(rn);bt&&+(/Firefox\/(\d+)/.exec(rn)||[0,0])[1];const js=!Je&&/Chrome\/(\d+)/.exec(rn),Fe=!!js,MC=js?+js[1]:0,je=!Je&&!!Tt&&/Apple Computer/.test(Tt.vendor),ur=je&&(/Mobile\/\w+/.test(rn)||!!Tt&&Tt.maxTouchPoints>2),st=ur||(Tt?/Mac/.test(Tt.platform):!1),TC=Tt?/Win/.test(Tt.platform):!1,kt=/Android \d/.test(rn),ri=!!Wd&&"webkitFontSmoothing"in Wd.documentElement.style,$C=ri?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function NC(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 jt(t,e){return typeof t=="number"?t:t[e]}function BC(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 Ud(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=ti(s)){if(s.nodeType!=1)continue;let a=s,c=a==o.body,d=c?NC(o):BC(a),u=0,f=0;if(e.top<d.top+jt(r,"top")?f=-(d.top-e.top+jt(i,"top")):e.bottom>d.bottom-jt(r,"bottom")&&(f=e.bottom-e.top>d.bottom-d.top?e.top+jt(i,"top")-d.top:e.bottom-d.bottom+jt(i,"bottom")),e.left<d.left+jt(r,"left")?u=-(d.left-e.left+jt(i,"left")):e.right>d.right-jt(r,"right")&&(u=e.right-d.right+jt(i,"right")),u||f)if(c)o.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,g=a.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}if(c||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function AC(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 a=t.root.elementFromPoint(o,s);if(!a||a==t.dom||!t.dom.contains(a))continue;let c=a.getBoundingClientRect();if(c.top>=n-20){r=a,i=c.top;break}}return{refDOM:r,refTop:i,stack:Kd(t.dom)}}function Kd(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=ti(r));return e}function DC({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Yd(n,r==0?0:r-e)}function Yd(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 fr=null;function VC(t){if(t.setActive)return t.setActive();if(fr)return t.focus(fr);let e=Kd(t);t.focus(fr==null?{get preventScroll(){return fr={preventScroll:!0},!0}}:void 0),fr||(fr=!1,Yd(e,0))}function Jd(t,e){let n,r=2e8,i,o=0,s=e.top,a=e.top,c,d;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=Ft(u).getClientRects();else continue;for(let p=0;p<h.length;p++){let m=h[p];if(m.top<=s&&m.bottom>=a){s=Math.max(m.bottom,s),a=Math.min(m.top,a);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<r){n=u,r=g,i=g&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&g&&(o=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!c&&m.left<=e.left&&m.right>=e.left&&(c=u,d={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&&c&&(n=c,i=d,r=0),n&&n.nodeType==3?IC(n,i):!n||r&&n.nodeType==1?{node:t,offset:o}:Jd(n,i)}function IC(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=sn(r,1);if(o.top!=o.bottom&&Hs(e,o))return{node:t,offset:i+(e.left>=(o.left+o.right)/2?1:0)}}return{node:t,offset:0}}function Hs(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function PC(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function _C(t,e,n){let{node:r,offset:i}=Jd(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 RC(t,e,n,r){let i=-1;for(let o=e,s=!1;o!=t.dom;){let a=t.docView.nearestDesc(o,!0);if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)){let c=a.dom.getBoundingClientRect();if(a.node.isBlock&&a.parent&&(!s&&c.left>r.left||c.top>r.top?i=a.posBefore:(!s&&c.right<r.left||c.bottom<r.top)&&(i=a.posAfter),s=!0),!a.contentDOM&&i<0&&!a.node.isText)return(a.node.isBlock?r.top<(c.top+c.bottom)/2:r.left<(c.left+c.right)/2)?a.posBefore:a.posAfter}o=a.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function Gd(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 a=s.getClientRects();for(let c=0;c<a.length;c++){let d=a[c];if(Hs(e,d))return Gd(s,e,d)}}if((o=(o+1)%r)==i)break}return t}function LC(t,e){let n=t.dom.ownerDocument,r,i=0,o=EC(n,e.left,e.top);o&&({node:r,offset:i}=o);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let d=t.dom.getBoundingClientRect();if(!Hs(e,d)||(s=Gd(t.dom,e,d),!s))return null}if(je)for(let d=s;r&&d;d=ti(d))d.draggable&&(r=void 0);if(s=PC(s,e),r){if(bt&&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 d;ri&&i&&r.nodeType==1&&(d=r.childNodes[i-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=RC(t,r,i,e))}a==null&&(a=_C(t,s,e));let c=t.docView.nearestDesc(s,!0);return{pos:a,inside:c?c.posAtStart-c.border:-1}}function Zd(t){return t.top<t.bottom||t.left<t.right}function sn(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Zd(r))return r}return Array.prototype.find.call(n,Zd)||t.getBoundingClientRect()}const zC=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Xd(t,e,n){let{node:r,offset:i,atom:o}=t.docView.domFromPos(e,n<0?-1:1),s=ri||bt;if(r.nodeType==3)if(s&&(zC.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let c=sn(Ft(r,i,i),n);if(bt&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let d=sn(Ft(r,i-1,i-1),-1);if(d.top==c.top){let u=sn(Ft(r,i,i+1),-1);if(u.top!=c.top)return ii(u,u.left<d.left)}}return c}else{let c=i,d=i,u=n<0?1:-1;return n<0&&!i?(d++,u=-1):n>=0&&i==r.nodeValue.length?(c--,u=1):n<0?c--:d++,ii(sn(Ft(r,c,d),u),u<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==Mt(r))){let c=r.childNodes[i-1];if(c.nodeType==1)return Ws(c.getBoundingClientRect(),!1)}if(o==null&&i<Mt(r)){let c=r.childNodes[i];if(c.nodeType==1)return Ws(c.getBoundingClientRect(),!0)}return Ws(r.getBoundingClientRect(),n>=0)}if(o==null&&i&&(n<0||i==Mt(r))){let c=r.childNodes[i-1],d=c.nodeType==3?Ft(c,Mt(c)-(s?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(d)return ii(sn(d,1),!1)}if(o==null&&i<Mt(r)){let c=r.childNodes[i];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let d=c?c.nodeType==3?Ft(c,0,s?0:1):c.nodeType==1?c:null:null;if(d)return ii(sn(d,-1),!0)}return ii(sn(r.nodeType==3?Ft(r):r,-n),n>=0)}function ii(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 Ws(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 Qd(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 FC(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return Qd(t,e,()=>{let{node:o}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(o,!0);if(!a)break;if(a.node.isBlock){o=a.contentDOM||a.dom;break}o=a.dom.parentNode}let s=Xd(t,i.pos,1);for(let a=o.firstChild;a;a=a.nextSibling){let c;if(a.nodeType==1)c=a.getClientRects();else if(a.nodeType==3)c=Ft(a,0,a.nodeValue.length).getClientRects();else continue;for(let d=0;d<c.length;d++){let u=c[d];if(u.bottom>u.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const jC=/[\u0590-\u08ac]/;function HC(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,a=t.domSelection();return!jC.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?o:s:Qd(t,e,()=>{let{focusNode:c,focusOffset:d,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:g}=t.domSelectionRange(),y=m&&!p.contains(m.nodeType==1?m:m.parentNode)||c==m&&d==g;try{a.collapse(u,f),c&&(c!=u||d!=f)&&a.extend&&a.extend(c,d)}catch{}return h!=null&&(a.caretBidiLevel=h),y})}let eu=null,tu=null,nu=!1;function WC(t,e,n){return eu==e&&tu==n?nu:(eu=e,tu=n,nu=n=="up"||n=="down"?FC(t,e,n):HC(t,e,n))}const at=0,ru=1,An=2,$t=3;class oi{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=at,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>Ve(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],a=o+s.size;if(a>e||s instanceof su){i=e-o;break}o=a}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 iu&&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?Ve(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?Ve(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,a=0;;a++){let c=this.children[a],d=s+c.size;if(i==-1&&e<=d){let u=s+c.border;if(e>=u&&n<=d-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,n,u);e=s;for(let f=a;f>0;f--){let h=this.children[f-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=Ve(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(d>n||a==this.children.length-1)){n=d;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)){o=Ve(f.dom);break}n+=f.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=d}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],g=p+m.size;if(o>p&&s<g)return m.setSelection(e-p-m.border,n-p-m.border,r,i);p=g}let a=this.domFromPos(e,e?-1:1),c=n==e?a:this.domFromPos(n,n?-1:1),d=r.getSelection(),u=!1;if((bt||je)&&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,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(a=c={node:g.parentNode,offset:Ve(g)+1});break}let y=m.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let m=h.childNodes[p-1];u=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(bt&&d.focusNode&&d.focusNode!=c.node&&d.focusNode.nodeType==1){let h=d.focusNode.childNodes[d.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||u&&je)&&Nn(a.node,a.offset,d.anchorNode,d.anchorOffset)&&Nn(c.node,c.offset,d.focusNode,d.focusOffset))return;let f=!1;if((d.extend||e==n)&&!u){d.collapse(a.node,a.offset);try{e!=n&&d.extend(c.node,c.offset),f=!0}catch{}}if(!f){if(e>n){let p=a;a=c,c=p}let h=document.createRange();h.setEnd(c.node,c.offset),h.setStart(a.node,a.offset),d.removeAllRanges(),d.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 a=r+o.border,c=s-o.border;if(e>=a&&n<=c){this.dirty=e==r||n==s?An:ru,e==a&&n==c&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=$t:o.markDirty(e-a,n-a);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?An:$t}r=s}this.dirty=An}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?An:ru;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class iu extends oi{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 a=document.createElement("span");a.appendChild(s),s=a}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==at&&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 qC extends oi{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 Dn extends oi{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=Ot.renderSpec(document,n.type.spec.toDOM(n,r))),new Dn(e,n,s.dom,s.contentDOM||s.dom)}parseRule(){return this.dirty&$t||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=$t&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=at){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=at}}slice(e,n,r){let i=Dn.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;n<s&&(o=Ks(o,n,s,r)),e>0&&(o=Ks(o,0,e,r));for(let a=0;a<o.length;a++)o[a].parent=i;return i.children=o,i}}class an extends oi{constructor(e,n,r,i,o,s,a,c,d){super(e,[],o,s),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,n,r,i,o,s){let a=o.nodeViews[n.type.name],c,d=a&&a(n,o,()=>{if(!c)return s;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=d&&d.dom,f=d&&d.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}=Ot.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=cu(u,r,n),d?c=new UC(e,n,r,i,u,f||null,h,d,o,s+1):n.isText?new co(e,n,r,i,u,h,o):new an(e,n,r,i,u,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=()=>R.empty)}return e}matchesNode(e,n,r){return this.dirty==at&&e.eq(this.node)&&Us(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,a=o&&o.pos<0,c=new YC(this,s&&s.node,e);ZC(this.node,this.innerDeco,(d,u,f)=>{d.spec.marks?c.syncToMarks(d.spec.marks,r,e):d.type.side>=0&&!f&&c.syncToMarks(u==this.node.childCount?ge.none:this.node.child(u).marks,r,e),c.placeWidget(d,e,i)},(d,u,f,h)=>{c.syncToMarks(d.marks,r,e);let p;c.findNodeMatch(d,u,f,h)||a&&e.state.selection.from>i&&e.state.selection.to<i+d.nodeSize&&(p=c.findIndexWithChild(o.node))>-1&&c.updateNodeAt(d,u,f,p,e)||c.updateNextNode(d,u,f,e,h,i)||c.addNode(d,u,f,e,i),i+=d.nodeSize}),c.syncToMarks([],r,e),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==An)&&(s&&this.protectLocalComposition(e,s),au(this.contentDOM,this.children,e),ur&&XC(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof ie)||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,a=QC(this.node.content,s,r-n,i-n);return a<0?null:{node:o,pos:a,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 qC(this,o,n,i);e.input.compositionNodes.push(s),this.children=Ks(this.children,r,r+i.length,e,s)}update(e,n,r,i){return this.dirty==$t||!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=at}updateOuterDeco(e){if(Us(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=lu(this.dom,this.nodeDOM,qs(this.outerDeco,this.node,n),qs(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 ou(t,e,n,r,i){cu(r,e,t);let o=new an(void 0,t,e,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class co extends an{constructor(e,n,r,i,o,s,a){super(e,n,r,i,o,null,s,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==$t||this.dirty!=at&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=at||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=at,!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 co(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=$t)}get domAtom(){return!1}isText(e){return this.node.text==e}}class su extends oi{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==at&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class UC extends an{constructor(e,n,r,i,o,s,a,c,d,u){super(e,n,r,i,o,s,a,d,u),this.spec=c}update(e,n,r,i){if(this.dirty==$t)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 au(t,e,n){let r=t.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],a=s.dom;if(a.parentNode==t){for(;a!=r;)r=du(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(a,r);if(s instanceof Dn){let c=r?r.previousSibling:t.lastChild;au(s.contentDOM,s.children,n),r=c?c.nextSibling:t.firstChild}}for(;r;)r=du(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const si=function(t){t&&(this.nodeName=t)};si.prototype=Object.create(null);const Vn=[new si];function qs(t,e,n){if(t.length==0)return Vn;let r=n?Vn[0]:new si,i=[r];for(let o=0;o<t.length;o++){let s=t[o].type.attrs;if(s){s.nodeName&&i.push(r=new si(s.nodeName));for(let a in s){let c=s[a];c!=null&&(n&&i.length==1&&i.push(r=new si(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+c:a=="style"?r.style=(r.style?r.style+";":"")+c:a!="nodeName"&&(r[a]=c))}}}return i}function lu(t,e,n,r){if(n==Vn&&r==Vn)return e;let i=e;for(let o=0;o<r.length;o++){let s=r[o],a=n[o];if(o){let c;a&&a.nodeName==s.nodeName&&i!=t&&(c=i.parentNode)&&c.nodeName.toLowerCase()==s.nodeName||(c=document.createElement(s.nodeName),c.pmIsDeco=!0,c.appendChild(i),a=Vn[0]),i=c}KC(i,a||Vn[0],s)}return i}function KC(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 cu(t,e,n){return lu(t,t,Vn,qs(e,n,t.nodeType!=1))}function Us(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 du(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class YC{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=JC(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=at,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let c=this.index;c<Math.min(this.index+3,this.top.children.length);c++){let d=this.top.children[c];if(d.matchesMark(e[o])&&!this.isLocked(d.dom)){a=c;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let c=Dn.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,c),this.top=c,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 a=this.index,c=Math.min(this.top.children.length,a+5);a<c;a++){let d=this.top.children[a];if(d.matchesNode(e,n,r)&&!this.preMatch.matched.has(d)){o=a;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==$t&&s.dom==s.contentDOM&&(s.dirty=An),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 a=this.index;a<this.top.children.length;a++){let c=this.top.children[a];if(c instanceof an){let d=this.preMatch.matched.get(c);if(d!=null&&d!=o)return!1;let u=c.dom,f,h=this.isLocked(u)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=$t&&Us(n,c.outerDeco));if(!h&&c.update(e,n,r,i))return this.destroyBetween(this.index,a),c.dom!=u&&(this.changed=!0),this.index++,!0;if(!h&&(f=this.recreateWrapper(c,e,n,r,i,s)))return this.top.children[this.index]=f,f.contentDOM&&(f.dirty=An,f.updateChildren(i,s+1),f.dirty=at),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 a=an.create(this.top,n,r,i,o,s);if(a.contentDOM){a.children=e.children,e.children=[];for(let c of a.children)c.parent=a}return e.destroy(),a}addNode(e,n,r,i,o){let s=an.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 iu(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 Dn;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof co)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((je||Fe)&&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 su(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 JC(t,e){let n=e,r=n.children.length,i=t.childCount,o=new Map,s=[];e:for(;i>0;){let a;for(;;)if(r){let d=n.children[r-1];if(d instanceof Dn)n=d,r=d.children.length;else{a=d,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let c=a.node;if(c){if(c!=t.child(i-1))break;--i,o.set(a,i),s.push(a)}}return{index:i,matched:o,matches:s.reverse()}}function GC(t,e){return t.type.side-e.type.side}function ZC(t,e,n,r){let i=e.locals(t),o=0;if(i.length==0){for(let d=0;d<t.childCount;d++){let u=t.child(d);r(u,i,e.forChild(o,u),d),o+=u.nodeSize}return}let s=0,a=[],c=null;for(let d=0;;){let u,f;for(;s<i.length&&i[s].to==o;){let y=i[s++];y.widget&&(u?(f||(f=[u])).push(y):u=y)}if(u)if(f){f.sort(GC);for(let y=0;y<f.length;y++)n(f[y],d,!!c)}else n(u,d,!!c);let h,p;if(c)p=-1,h=c,c=null;else if(d<t.childCount)p=d,h=t.child(d++);else break;for(let y=0;y<a.length;y++)a[y].to<=o&&a.splice(y--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)a.push(i[s++]);let m=o+h.nodeSize;if(h.isText){let y=m;s<i.length&&i[s].from<y&&(y=i[s].from);for(let k=0;k<a.length;k++)a[k].to<y&&(y=a[k].to);y<m&&(c=h.cut(y-o),h=h.cut(0,y-o),m=y,p=-1)}else for(;s<i.length&&i[s].to<m;)s++;let g=h.isInline&&!h.isLeaf?a.filter(y=>!y.inline):a.slice();r(h,g,e.forChild(o,h),p),o=m}}function XC(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 QC(t,e,n,r){for(let i=0,o=0;i<t.childCount&&o<=r;){let s=t.child(i++),a=o;if(o+=s.nodeSize,!s.isText)continue;let c=s.text;for(;i<t.childCount;){let d=t.child(i++);if(o+=d.nodeSize,!d.isText)break;c+=d.text}if(o>=n){if(o>=r&&c.slice(r-e.length-a,r-a)==e)return r-e.length;let d=a<r?c.lastIndexOf(e,r-a-1):-1;if(d>=0&&d+e.length+a>=n)return a+d;if(n==r&&c.length>=r+e.length-a&&c.slice(r-a,r-a+e.length)==e)return r}}return-1}function Ks(t,e,n,r,i){let o=[];for(let s=0,a=0;s<t.length;s++){let c=t[s],d=a,u=a+=c.size;d>=n||u<=e?o.push(c):(d<e&&o.push(c.slice(0,e-d,r)),i&&(o.push(i),i=void 0),u>n&&o.push(c.slice(n-d,c.size,r)))}return o}function Ys(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 a=r.resolve(s),c,d;if(lo(n)){for(c=a;i&&!i.node;)i=i.parent;let u=i.node;if(i&&u.isAtom&&Z.isSelectable(u)&&i.parent&&!(u.isInline&&CC(n.focusNode,n.focusOffset,i.dom))){let f=i.posBefore;d=new Z(s==f?a:r.resolve(f))}}else{let u=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(u<0)return null;c=r.resolve(u)}if(!d){let u=e=="pointer"||t.state.selection.head<a.pos&&!o?1:-1;d=Gs(t,c,a,u)}return d}function uu(t){return t.editable?t.hasFocus():bu(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Ht(t,e=!1){let n=t.state.selection;if(mu(t,n),!!uu(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Fe){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Nn(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)tO(t);else{let{anchor:r,head:i}=n,o,s;fu&&!(n instanceof ie)&&(n.$from.parent.inlineContent||(o=hu(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=hu(t,n.to))),t.docView.setSelection(r,i,t.root,e),fu&&(o&&pu(o),s&&pu(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&eO(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const fu=je||Fe&&MC<63;function hu(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(je&&i&&i.contentEditable=="false")return Js(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return Js(i);if(o)return Js(o)}}function Js(t){return t.contentEditable="true",je&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function pu(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function eO(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(()=>{(!uu(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function tO(t){let e=t.domSelection(),n=document.createRange(),r=t.cursorWrapper.dom,i=r.nodeName=="IMG";i?n.setEnd(r.parentNode,Ve(r)+1):n.setEnd(r,0),n.collapse(!1),e.removeAllRanges(),e.addRange(n),!i&&!t.state.selection.visible&&Je&&on<=11&&(r.disabled=!0,r.disabled=!1)}function mu(t,e){if(e instanceof Z){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(gu(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else gu(t)}function gu(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Gs(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||ie.between(e,n,r)}function yu(t){return t.editable&&!t.hasFocus()?!1:bu(t)}function bu(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 nO(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Nn(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Zs(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&&le.findFrom(o,e)}function ln(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 ie)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 ln(t,new ie(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Zs(t.state,e);return i&&i instanceof Z?ln(t,i):!1}else if(!(st&&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 a=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=t.docView.descAt(a))&&!s.contentDOM?Z.isSelectable(o)?ln(t,new Z(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):ri?ln(t,new ie(t.state.doc.resolve(e<0?a:a+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Z&&r.node.isInline)return ln(t,new ie(e>0?r.$to:r.$from));{let i=Zs(t.state,e);return i?ln(t,i):!1}}}function uo(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function ai(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?rO(t):iO(t)}function rO(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,o,s=!1;for(bt&&n.nodeType==1&&r<uo(n)&&ai(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(ai(a,-1))i=n,o=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(vu(n))break;{let a=n.previousSibling;for(;a&&ai(a,-1);)i=n.parentNode,o=Ve(a),a=a.previousSibling;if(a)n=a,r=uo(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?Xs(t,n,r):i&&Xs(t,i,o)}function iO(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=uo(n),o,s;for(;;)if(r<i){if(n.nodeType!=1)break;let a=n.childNodes[r];if(ai(a,1))o=n,s=++r;else break}else{if(vu(n))break;{let a=n.nextSibling;for(;a&&ai(a,1);)o=a.parentNode,s=Ve(a)+1,a=a.nextSibling;if(a)n=a,r=0,i=uo(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}o&&Xs(t,o,s)}function vu(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function oO(t,e){for(;t&&e==t.childNodes.length&&!ni(t);)e=Ve(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 sO(t,e){for(;t&&!e&&!ni(t);)e=Ve(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 Xs(t,e,n){if(e.nodeType!=3){let o,s;(s=oO(e,n))?(e=s,n=0):(o=sO(e,n))&&(e=o,n=o.nodeValue.length)}let r=t.domSelection();if(lo(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&&Ht(t)},50)}function xu(t,e){let n=t.state.doc.resolve(e);if(!(Fe||TC)&&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 wu(t,e,n){let r=t.state.selection;if(r instanceof ie&&!r.empty||n.indexOf("s")>-1||st&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Zs(t.state,e);if(s&&s instanceof Z)return ln(t,s)}if(!i.parent.inlineContent){let s=e<0?i:o,a=r instanceof ot?le.near(s,e):le.findFrom(s,e);return a?ln(t,a):!1}return!1}function Su(t,e){if(!(t.state.selection instanceof ie))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 Cu(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function aO(t){if(!je||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;Cu(t,r,"true"),setTimeout(()=>Cu(t,r,"false"),20)}return!1}function lO(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function cO(t,e){let n=e.keyCode,r=lO(e);if(n==8||st&&n==72&&r=="c")return Su(t,-1)||hr(t,-1);if(n==46&&!e.shiftKey||st&&n==68&&r=="c")return Su(t,1)||hr(t,1);if(n==13||n==27)return!0;if(n==37||st&&n==66&&r=="c"){let i=n==37?xu(t,t.state.selection.from)=="ltr"?-1:1:-1;return ku(t,i,r)||hr(t,i)}else if(n==39||st&&n==70&&r=="c"){let i=n==39?xu(t,t.state.selection.from)=="ltr"?1:-1:1;return ku(t,i,r)||hr(t,i)}else{if(n==38||st&&n==80&&r=="c")return wu(t,-1,r)||hr(t,-1);if(n==40||st&&n==78&&r=="c")return aO(t)||wu(t,1,r)||hr(t,1);if(r==(st?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Ou(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")||Ot.fromSchema(t.state.schema),a=Du(),c=a.createElement("div");c.appendChild(s.serializeFragment(r,{document:a}));let d=c.firstChild,u,f=0;for(;d&&d.nodeType==1&&(u=Bu[d.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let m=a.createElement(u[p]);for(;c.firstChild;)m.appendChild(c.firstChild);c.appendChild(m),f++}d=c.firstChild}d&&d.nodeType==1&&d.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:c,text:h,slice:e}}function Eu(t,e,n,r,i){let o=i.parent.type.spec.code,s,a;if(!n&&!e)return null;let c=e&&(r||o||!n);if(c){if(t.someProp("transformPastedText",h=>{e=h(e,o||r,t)}),o)return e?new q(R.from(t.state.schema.text(e.replace(/\r\n?/g,`
13
- `))),0,0):q.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=Ot.fromSchema(p);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=s.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(p.text(g,h)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),s=fO(n),ri&&hO(s);let d=s&&s.querySelector("[data-pm-slice]"),u=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let h=s.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;s=h}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||rr.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!dO.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)a=pO(Nu(a,+u[1],+u[2]),u[4]);else if(a=q.maxOpen(uO(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=Nu(a,f,h)}return t.someProp("transformPasted",f=>{a=f(a,t)}),a}const dO=/^(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 uO(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(a=>{if(!s)return;let c=i.findWrapping(a.type),d;if(!c)return s=null;if(d=s.length&&o.length&&Tu(c,o,a,s[s.length-1],0))s[s.length-1]=d;else{s.length&&(s[s.length-1]=$u(s[s.length-1],o.length));let u=Mu(a,c);s.push(u),i=i.matchType(u.type),o=c}}),s)return R.from(s)}return t}function Mu(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,R.from(t));return t}function Tu(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let o=Tu(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(R.from(Mu(n,t,i+1))))}}function $u(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,$u(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(R.empty,!0);return t.copy(n.append(r))}function Qs(t,e,n,r,i,o){let s=e<0?t.firstChild:t.lastChild,a=s.content;return t.childCount>1&&(o=0),i<r-1&&(a=Qs(a,e,n,r,i+1,o)),i>=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(R.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function Nu(t,e,n){return e<t.openStart&&(t=new q(Qs(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new q(Qs(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Bu={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 Au=null;function Du(){return Au||(Au=document.implementation.createHTMLDocument("title"))}function fO(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Du().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&Bu[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 hO(t){let e=t.querySelectorAll(Fe?"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 pO(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 a=r.length-2;a>=0;a-=2){let c=n.nodes[r[a]];if(!c||c.hasRequiredAttrs())break;i=R.from(c.create(r[a+1],i)),o++,s++}return new q(i,o,s)}const He={},We={},mO={touchstart:!0,touchmove:!0};class gO{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 yO(t){for(let e in He){let n=He[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{kO(t,r)&&!ta(t,r)&&(t.editable||!(r.type in We))&&n(t,r)},mO[e]?{passive:!0}:void 0)}je&&t.dom.addEventListener("input",()=>null),ea(t)}function cn(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function bO(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 ea(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>ta(t,r))})}function ta(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function kO(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 vO(t,e){!ta(t,e)&&He[e.type]&&(t.editable||!(e.type in We))&&He[e.type](t,e)}We.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Iu(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(kt&&Fe&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),ur&&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,Bn(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||cO(t,n)?n.preventDefault():cn(t,"key")},We.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)},We.keypress=(t,e)=>{let n=e;if(Iu(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||st&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof ie)||!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 fo(t){return{left:t.clientX,top:t.clientY}}function xO(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function na(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,a=>s>o.depth?a(t,n,o.nodeAfter,o.before(s),i,!0):a(t,n,o.node(s),o.before(s),i,!1)))return!0;return!1}function pr(t,e,n){t.focused||t.focus();let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function wO(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Z.isSelectable(r)?(pr(t,new Z(n)),!0):!1}function SO(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 a=s>o.depth?o.nodeAfter:o.node(s);if(Z.isSelectable(a)){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?(pr(t,Z.create(t.state.doc,i)),!0):!1}function CO(t,e,n,r,i){return na(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>o(t,e,r))||(i?SO(t,n):wO(t,n))}function OO(t,e,n,r){return na(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function EO(t,e,n,r){return na(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||MO(t,n,r)}function MO(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(pr(t,ie.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),a=i.before(o);if(s.inlineContent)pr(t,ie.create(r,a+1,a+1+s.content.size));else if(Z.isSelectable(s))pr(t,Z.create(r,a));else continue;return!0}}function ra(t){return ho(t)}const Vu=st?"metaKey":"ctrlKey";He.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=ra(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&xO(n,t.input.lastClick)&&!n[Vu]&&(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(fo(n));s&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new TO(t,s,n,!!r)):(o=="doubleClick"?OO:EO)(t,s.pos,s.inside,n)?n.preventDefault():cn(t,"pointer"))};class TO{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[Vu],this.allowDefault=r.shiftKey;let o,s;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);o=u.parent,s=u.depth?u.before():0}const a=i?null:r.target,c=a?e.docView.nearestDesc(a,!0):null;this.target=c&&c.dom.nodeType==1?c.dom:null;let{selection:d}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||d instanceof Z&&d.from<=s&&d.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&bt&&!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)),cn(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(()=>Ht(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(fo(e))),this.updateAllowDefault(e),this.allowDefault||!n?cn(this.view,"pointer"):CO(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||je&&this.mightDrag&&!this.mightDrag.node.isAtom||Fe&&!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)?(pr(this.view,le.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):cn(this.view,"pointer")}move(e){this.updateAllowDefault(e),cn(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)}}He.touchstart=t=>{t.input.lastTouch=Date.now(),ra(t),cn(t,"pointer")},He.touchmove=t=>{t.input.lastTouch=Date.now(),cn(t,"pointer")},He.contextmenu=t=>ra(t);function Iu(t,e){return t.composing?!0:je&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const $O=kt?5e3:-1;We.compositionstart=We.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(),ho(t,!0),t.markCursor=null;else if(ho(t),bt&&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}Pu(t,$O)},We.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++,Pu(t,20))};function Pu(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>ho(t),e))}function _u(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=BO());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function NO(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=wC(e.focusNode,e.focusOffset),r=SC(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 BO(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function ho(t,e=!1){if(!(kt&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),_u(t),e||t.docView&&t.docView.dirty){let n=Ys(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):t.updateState(t.state),!0}return!1}}function AO(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 li=Je&&on<15||ur&&$C<604;He.copy=We.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let o=li?null:n.clipboardData,s=r.content(),{dom:a,text:c}=Ou(t,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",c)):AO(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function DO(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function VO(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?ci(t,r.value,null,i,e):ci(t,r.textContent,r.innerHTML,i,e)},50)}function ci(t,e,n,r,i){let o=Eu(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,i,o||q.empty)))return!0;if(!o)return!1;let s=DO(o),a=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(o);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Ru(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," "):""}We.paste=(t,e)=>{let n=e;if(t.composing&&!kt)return;let r=li?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&ci(t,Ru(r),r.getData("text/html"),i,n)?n.preventDefault():VO(t,n)};class Lu{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const zu=st?"altKey":"ctrlKey";He.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(fo(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 a=(s||t.state.selection).content(),{dom:c,text:d,slice:u}=Ou(t,a);n.dataTransfer.clearData(),n.dataTransfer.setData(li?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",li||n.dataTransfer.setData("text/plain",d),t.dragging=new Lu(u,!n[zu],s)},He.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)},We.dragover=We.dragenter=(t,e)=>e.preventDefault(),We.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let i=t.posAtCoords(fo(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=Eu(t,Ru(n.dataTransfer),li?null:n.dataTransfer.getData("text/html"),!1,o);let a=!!(r&&!n[zu]);if(t.someProp("handleDrop",m=>m(t,n,s||q.empty,a))){n.preventDefault();return}if(!s)return;n.preventDefault();let c=s?$d(t.state.doc,o.pos,s):o.pos;c==null&&(c=o.pos);let d=t.state.tr;if(a){let{node:m}=r;m?m.replace(d):d.deleteSelection()}let u=d.mapping.map(c),f=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,h=d.doc;if(f?d.replaceRangeWith(u,u,s.content.firstChild):d.replaceRange(u,u,s),d.doc.eq(h))return;let p=d.doc.resolve(u);if(f&&Z.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))d.setSelection(new Z(p));else{let m=d.mapping.map(c);d.mapping.maps[d.mapping.maps.length-1].forEach((g,y,k,C)=>m=C),d.setSelection(Gs(t,p,d.doc.resolve(m)))}t.focus(),t.dispatch(d.setMeta("uiEvent","drop"))},He.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())&&Ht(t)},20))},He.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)},He.beforeinput=(t,e)=>{if(Fe&&kt&&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,Bn(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 We)He[t]=We[t];function di(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 po{constructor(e,n){this.toDOM=e,this.spec=n||In,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 et(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof po&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&di(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class dn{constructor(e,n){this.attrs=e,this.spec=n||In}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 et(o,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof dn&&di(this.attrs,e.attrs)&&di(this.spec,e.spec)}static is(e){return e.type instanceof dn}destroy(){}}class ia{constructor(e,n){this.attrs=e,this.spec=n||In}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 et(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 ia&&di(this.attrs,e.attrs)&&di(this.spec,e.spec)}destroy(){}}class et{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new et(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 et(e,e,new po(n,r))}static inline(e,n,r,i){return new et(e,n,new dn(r,i))}static node(e,n,r,i){return new et(e,n,new ia(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof dn}get widget(){return this.type instanceof po}}const mr=[],In={};class Ce{constructor(e,n){this.local=e.length?e:mr,this.children=n.length?n:mr}static create(e,n){return n.length?mo(n,e,0,In):_e}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 a=this.local[s];a.from<=n&&a.to>=e&&(!o||o(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let a=this.children[s]+1;this.children[s+2].findInner(e-a,n-a,r,i+a,o)}}map(e,n,r){return this==_e||e.maps.length==0?this:this.mapInner(e,n,0,0,r||In)}mapInner(e,n,r,i,o){let s;for(let a=0;a<this.local.length;a++){let c=this.local[a].map(e,r,i);c&&c.type.valid(n,c)?(s||(s=[])).push(c):o.onRemove&&o.onRemove(this.local[a].spec)}return this.children.length?IO(this.children,s||[],e,n,r,i,o):s?new Ce(s.sort(Pn),mr):_e}add(e,n){return n.length?this==_e?Ce.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,o=0;e.forEach((a,c)=>{let d=c+r,u;if(u=ju(n,a,d)){for(i||(i=this.children.slice());o<i.length&&i[o]<c;)o+=3;i[o]==c?i[o+2]=i[o+2].addInner(a,u,d+1):i.splice(o,0,c,c+a.nodeSize,mo(u,a,d+1,In)),o+=3}});let s=Fu(o?Hu(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new Ce(s.length?this.local.concat(s).sort(Pn):this.local,i||this.children)}remove(e){return e.length==0||this==_e?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,a=r[o]+n,c=r[o+1]+n;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>a&&f.to<c&&(e[u]=null,(s||(s=[])).push(f));if(!s)continue;r==this.children&&(r=this.children.slice());let d=r[o+2].removeInner(s,a+1);d!=_e?r[o+2]=d:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,s;o<e.length;o++)if(s=e[o])for(let a=0;a<i.length;a++)i[a].eq(s,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 Ce(i,r):_e}forChild(e,n){if(this==_e)return this;if(n.isLeaf)return Ce.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 o=e+1,s=o+n.content.size;for(let a=0;a<this.local.length;a++){let c=this.local[a];if(c.from<s&&c.to>o&&c.type instanceof dn){let d=Math.max(o,c.from)-o,u=Math.min(s,c.to)-o;d<u&&(i||(i=[])).push(c.copy(d,u))}}if(i){let a=new Ce(i.sort(Pn),mr);return r?new un([a,r]):a}return r||_e}eq(e){if(this==e)return!0;if(!(e instanceof Ce)||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 oa(this.localsInner(e))}localsInner(e){if(this==_e)return mr;if(e.inlineContent||!this.local.some(dn.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof dn||n.push(this.local[r]);return n}}Ce.empty=new Ce([],[]),Ce.removeOverlap=oa;const _e=Ce.empty;class un{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,In));return un.from(r)}forChild(e,n){if(n.isLeaf)return Ce.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,n);o!=_e&&(o instanceof un?r=r.concat(o.members):r.push(o))}return un.from(r)}eq(e){if(!(e instanceof un)||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?oa(r?n:n.sort(Pn)):mr}static from(e){switch(e.length){case 0:return _e;case 1:return e[0];default:return new un(e.every(n=>n instanceof Ce)?e:e.reduce((n,r)=>n.concat(r instanceof Ce?r:r.members),[]))}}}function IO(t,e,n,r,i,o,s){let a=t.slice();for(let d=0,u=o;d<n.maps.length;d++){let f=0;n.maps[d].forEach((h,p,m,g)=>{let y=g-m-(p-h);for(let k=0;k<a.length;k+=3){let C=a[k+1];if(C<0||h>C+u-f)continue;let N=a[k]+u-f;p>=N?a[k+1]=h<=N?-2:-1:h>=u&&y&&(a[k]+=y,a[k+1]+=y)}f+=y}),u=n.maps[d].map(u,-1)}let c=!1;for(let d=0;d<a.length;d+=3)if(a[d+1]<0){if(a[d+1]==-2){c=!0,a[d+1]=-1;continue}let u=n.map(t[d]+o),f=u-i;if(f<0||f>=r.content.size){c=!0;continue}let h=n.map(t[d+1]+o,-1),p=h-i,{index:m,offset:g}=r.content.findIndex(f),y=r.maybeChild(m);if(y&&g==f&&g+y.nodeSize==p){let k=a[d+2].mapInner(n,y,u+1,t[d]+o+1,s);k!=_e?(a[d]=f,a[d+1]=p,a[d+2]=k):(a[d+1]=-2,c=!0)}else c=!0}if(c){let d=PO(a,t,e,n,i,o,s),u=mo(d,r,0,s);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 Ce(e.sort(Pn),a)}function Fu(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 et(i.from+e,i.to+e,i.type))}return n}function PO(t,e,n,r,i,o,s){function a(c,d){for(let u=0;u<c.local.length;u++){let f=c.local[u].map(r,i,d);f?n.push(f):s.onRemove&&s.onRemove(c.local[u].spec)}for(let u=0;u<c.children.length;u+=3)a(c.children[u+2],c.children[u]+d+1)}for(let c=0;c<t.length;c+=3)t[c+1]==-1&&a(t[c+2],e[c]+o+1);return n}function ju(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 Hu(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function mo(t,e,n,r){let i=[],o=!1;e.forEach((a,c)=>{let d=ju(t,a,c+n);if(d){o=!0;let u=mo(d,a,n+c+1,r);u!=_e&&i.push(c,c+a.nodeSize,u)}});let s=Fu(o?Hu(t):t,-n).sort(Pn);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||i.length?new Ce(s,i):_e}function Pn(t,e){return t.from-e.from||t.to-e.to}function oa(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),Wu(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),Wu(e,i,r.copy(o.from,r.to)));break}}}return e}function Wu(t,e,n){for(;e<t.length&&Pn(n,t[e])>0;)e++;t.splice(e,0,n)}function sa(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=_e&&e.push(r)}),t.cursorWrapper&&e.push(Ce.create(t.state.doc,[t.cursorWrapper.deco])),un.from(e)}const _O={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},RO=Je&&on<=11;class LO{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 zO{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new LO,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]);Je&&on<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),RO&&(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,_O)),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(yu(this.view)){if(this.suppressingSelectionUpdates)return Ht(this.view);if(Je&&on<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Nn(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=ti(o))n.add(o);for(let o=e.anchorNode;o;o=ti(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)&&yu(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,a=!1,c=[];if(e.editable)for(let u=0;u<n.length;u++){let f=this.registerMutation(n[u],c);f&&(o=o<0?f.from:Math.min(f.from,o),s=s<0?f.to:Math.max(f.to,s),f.typeOver&&(a=!0))}if(bt&&c.length){let u=c.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||HO(e,f)!=p)&&h.remove()}}}let d=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&lo(r)&&(d=Ys(e))&&d.eq(le.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Ht(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),FO(e)),this.handleDOMChange(o,s,a,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Ht(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,o=e.nextSibling;if(Je&&on<=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)&&(o=h)}let s=i&&i.parentNode==e.target?Ve(i)+1:0,a=r.localPosFromDOM(e.target,s,-1),c=o&&o.parentNode==e.target?Ve(o):e.target.childNodes.length,d=r.localPosFromDOM(e.target,c,1);return{from:a,to:d}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let qu=new WeakMap,Uu=!1;function FO(t){if(!qu.has(t)&&(qu.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=bt,Uu)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."),Uu=!0}}function Ku(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return Nn(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function jO(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Ku(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?Ku(t,n):null}function HO(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 WO(t,e,n){let{node:r,fromOffset:i,toOffset:o,from:s,to:a}=t.docView.parseRange(e,n),c=t.domSelectionRange(),d,u=c.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],lo(c)||d.push({node:c.focusNode,offset:c.focusOffset})),Fe&&t.input.lastKeyCode===8)for(let y=o;y>i;y--){let k=r.childNodes[y-1],C=k.pmViewDesc;if(k.nodeName=="BR"&&!C){o=y;break}if(!C||C.size)break}let f=t.state.doc,h=t.someProp("domParser")||rr.fromSchema(t.state.schema),p=f.resolve(s),m=null,g=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:d,ruleFromNode:qO,context:p});if(d&&d[0].pos!=null){let y=d[0].pos,k=d[1]&&d[1].pos;k==null&&(k=y),m={anchor:y+s,head:k+s}}return{doc:g,sel:m,from:s,to:a}}function qO(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(je&&/^(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||je&&/^(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 UO=/^(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 KO(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,B=Ys(t,A);if(B&&!t.state.selection.eq(B)){if(Fe&&kt&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",F=>F(t,Bn(13,"Enter"))))return;let P=t.state.tr.setSelection(B);A=="pointer"?P.setMeta("pointer",!0):A=="key"&&P.scrollIntoView(),o&&P.setMeta("composition",o),t.dispatch(P)}return}let s=t.state.doc.resolve(e),a=s.sharedDepth(n);e=s.before(a+1),n=t.state.doc.resolve(n).after(a+1);let c=t.state.selection,d=WO(t,e,n),u=t.state.doc,f=u.slice(d.from,d.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=GO(f.content,d.doc.content,d.from,h,p);if((ur&&t.input.lastIOSEnter>Date.now()-225||kt)&&i.some(A=>A.nodeType==1&&!UO.test(A.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",A=>A(t,Bn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof ie&&!c.empty&&c.$head.sameParent(c.$anchor)&&!t.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(d.sel){let A=Yu(t,t.state.doc,d.sel);if(A&&!A.eq(t.state.selection)){let B=t.state.tr.setSelection(A);o&&B.setMeta("composition",o),t.dispatch(B)}}return}t.input.domChangeCount++,t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof ie&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=d.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=d.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),Je&&on<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>d.from&&d.doc.textBetween(m.start-d.from-1,m.start-d.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let g=d.doc.resolveNoCache(m.start-d.from),y=d.doc.resolveNoCache(m.endB-d.from),k=u.resolve(m.start),C=g.sameParent(y)&&g.parent.inlineContent&&k.end()>=m.endA,N;if((ur&&t.input.lastIOSEnter>Date.now()-225&&(!C||i.some(A=>A.nodeName=="DIV"||A.nodeName=="P"))||!C&&g.pos<d.doc.content.size&&!g.sameParent(y)&&(N=le.findFrom(d.doc.resolve(g.pos+1),1,!0))&&N.head==y.pos)&&t.someProp("handleKeyDown",A=>A(t,Bn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&JO(u,m.start,m.endA,g,y)&&t.someProp("handleKeyDown",A=>A(t,Bn(8,"Backspace")))){kt&&Fe&&t.domObserver.suppressSelectionUpdates();return}Fe&&kt&&m.endB==m.start&&(t.input.lastAndroidDelete=Date.now()),kt&&!C&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==m.endA&&(m.endB-=2,y=d.doc.resolveNoCache(m.endB-d.from),setTimeout(()=>{t.someProp("handleKeyDown",function(A){return A(t,Bn(13,"Enter"))})},20));let b=m.start,S=m.endA,v,$,D;if(C){if(g.pos==y.pos)Je&&on<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ht(t),20)),v=t.state.tr.delete(b,S),$=u.resolve(m.start).marksAcross(u.resolve(m.endA));else if(m.endA==m.endB&&(D=YO(g.parent.content.cut(g.parentOffset,y.parentOffset),k.parent.content.cut(k.parentOffset,m.endA-k.start()))))v=t.state.tr,D.type=="add"?v.addMark(b,S,D.mark):v.removeMark(b,S,D.mark);else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let A=g.parent.textBetween(g.parentOffset,y.parentOffset);if(t.someProp("handleTextInput",B=>B(t,b,S,A)))return;v=t.state.tr.insertText(A,b,S)}}if(v||(v=t.state.tr.replace(b,S,d.doc.slice(m.start-d.from,m.endB-d.from))),d.sel){let A=Yu(t,v.doc,d.sel);A&&!(Fe&&kt&&t.composing&&A.empty&&(m.start!=m.endB||t.input.lastAndroidDelete<Date.now()-100)&&(A.head==b||A.head==v.mapping.map(S)-1)||Je&&A.empty&&A.head==b)&&v.setSelection(A)}$&&v.ensureMarks($),o&&v.setMeta("composition",o),t.dispatch(v.scrollIntoView())}function Yu(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Gs(t,e.resolve(n.anchor),e.resolve(n.head))}function YO(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,o=r,s,a,c;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<n.length;u++)o=n[u].removeFromSet(o);if(i.length==1&&o.length==0)a=i[0],s="add",c=u=>u.mark(a.addToSet(u.marks));else if(i.length==0&&o.length==1)a=o[0],s="remove",c=u=>u.mark(a.removeFromSet(u.marks));else return null;let d=[];for(let u=0;u<e.childCount;u++)d.push(c(e.child(u)));if(R.from(d).eq(t))return{mark:a,type:s}}function JO(t,e,n,r,i){if(n-e<=i.pos-r.pos||aa(r,!0,!1)<i.pos)return!1;let o=t.resolve(e);if(!r.parent.isTextblock){let a=o.nodeAfter;return a!=null&&n==e+a.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=t.resolve(aa(o,!0,!0));return!s.parent.isTextblock||s.pos>n||aa(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function aa(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 GO(t,e,n,r,i){let o=t.findDiffStart(e,n);if(o==null)return null;let{a:s,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let c=Math.max(0,o-Math.min(s,a));r-=s+c-o}if(s<o&&t.size<e.size){let c=r<=o&&r>=s?o-r:0;o-=c,o&&o<e.size&&Ju(e.textBetween(o-1,o+1))&&(o+=c?1:-1),a=o+(a-s),s=o}else if(a<o){let c=r<=o&&r>=a?o-r:0;o-=c,o&&o<t.size&&Ju(t.textBetween(o-1,o+1))&&(o+=c?1:-1),s=o+(s-a),a=o}return{start:o,endA:s,endB:a}}function Ju(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 ZO{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 gO,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(ef),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=Xu(this),Zu(this),this.nodeViews=Qu(this),this.docView=ou(this.state.doc,Gu(this),sa(this),this.dom,this),this.domObserver=new zO(this,(r,i,o,s)=>KO(this,r,i,o,s)),this.domObserver.start(),yO(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&&ea(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ef),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&&(_u(this),s=!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=Qu(this);QO(p,this.nodeViews)&&(this.nodeViews=p,o=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&ea(this),this.editable=Xu(this),Zu(this);let c=sa(this),d=Gu(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=o||!this.docView.matchesNode(e.doc,d,c);(f||!e.selection.eq(i.selection))&&(s=!0);let h=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&AC(this);if(s){this.domObserver.stop();let p=f&&(Je||Fe)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&XO(i.selection,e.selection);if(f){let m=Fe?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=NO(this)),(o||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=ou(e.doc,d,c,this.dom,this)),m&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&nO(this))?Ht(this,p):(mu(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&&DC(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&&Ud(this,n.getBoundingClientRect(),e)}else Ud(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 Lu(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 a=this.directPlugins[s].props[e];if(a!=null&&(i=n?n(a):a))return i}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let a=o[s].props[e];if(a!=null&&(i=n?n(a):a))return i}}hasFocus(){if(Je){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&&VC(this.dom),Ht(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 LC(this,e)}coordsAtPos(e,n=1){return Xd(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 WC(this,n||this.state,e)}pasteHTML(e,n){return ci(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ci(this,e,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(bO(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],sa(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,vC())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return vO(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 je&&this.root.nodeType===11&&OC(this.dom.ownerDocument)==this.dom&&jO(this,e)||e}domSelection(){return this.root.getSelection()}}function Gu(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"),[et.node(0,t.state.doc.content.size,e)]}function Zu(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:et.widget(t.state.selection.head,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Xu(t){return!t.someProp("editable",e=>e(t.state)===!1)}function XO(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 Qu(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 QO(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 ef(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 fn={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:"'"},go={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},eE=typeof navigator<"u"&&/Mac/.test(navigator.platform),tE=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Ie=0;Ie<10;Ie++)fn[48+Ie]=fn[96+Ie]=String(Ie);for(var Ie=1;Ie<=24;Ie++)fn[Ie+111]="F"+Ie;for(var Ie=65;Ie<=90;Ie++)fn[Ie]=String.fromCharCode(Ie+32),go[Ie]=String.fromCharCode(Ie);for(var la in fn)go.hasOwnProperty(la)||(go[la]=fn[la]);function nE(t){var e=eE&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||tE&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?go:fn)[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 rE=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function iE(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,o,s;for(let a=0;a<e.length-1;a++){let c=e[a];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))rE?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),s&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function oE(t){let e=Object.create(null);for(let n in t)e[iE(n)]=t[n];return e}function ca(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 sE(t){return new ze({props:{handleKeyDown:tf(t)}})}function tf(t){let e=oE(t);return function(n,r){let i=nE(r),o,s=e[ca(i,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[ca(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(o=fn[r.keyCode])&&o!=i){let a=e[ca(o,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}const da=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function nf(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const rf=(t,e,n)=>{let r=nf(t,n);if(!r)return!1;let i=ua(r);if(!i){let s=r.blockRange(),a=s&&sr(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(!o.type.spec.isolating&&hf(t,i,e))return!0;if(r.parent.content.size==0&&(gr(o,"end")||Z.isSelectable(o))){let s=so(t.doc,r.before(),r.after(),q.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=t.tr.step(s);a.setSelection(gr(o,"end")?le.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):Z.create(a.doc,i.pos-o.nodeSize)),e(a.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},aE=(t,e,n)=>{let r=nf(t,n);if(!r)return!1;let i=ua(r);return i?of(t,i,e):!1},lE=(t,e,n)=>{let r=af(t,n);if(!r)return!1;let i=fa(r);return i?of(t,i,e):!1};function of(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 u=i.lastChild;if(!u)return!1;i=u}let s=e.nodeAfter,a=s,c=e.pos+1;for(;!a.isTextblock;c++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let d=so(t.doc,o,c,q.empty);if(!d||d.from!=o||d instanceof Te&&d.slice.size>=c-o)return!1;if(n){let u=t.tr.step(d);u.setSelection(ie.create(u.doc,o)),n(u.scrollIntoView())}return!0}function gr(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 sf=(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=ua(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 ua(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 af(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const lf=(t,e,n)=>{let r=af(t,n);if(!r)return!1;let i=fa(r);if(!i)return!1;let o=i.nodeAfter;if(hf(t,i,e))return!0;if(r.parent.content.size==0&&(gr(o,"start")||Z.isSelectable(o))){let s=so(t.doc,r.before(),r.after(),q.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=t.tr.step(s);a.setSelection(gr(o,"start")?le.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):Z.create(a.doc,a.mapping.map(i.pos))),e(a.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},cf=(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=fa(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 fa(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 cE=(t,e)=>{let n=t.selection,r=n instanceof Z,i;if(r){if(n.node.isTextblock||!nn(t.doc,n.from))return!1;i=n.from}else if(i=oo(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},dE=(t,e)=>{let n=t.selection,r;if(n instanceof Z){if(n.node.isTextblock||!nn(t.doc,n.to))return!1;r=n.to}else if(r=oo(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},uE=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),o=i&&sr(i);return o==null?!1:(e&&e(t.tr.lift(i,o).scrollIntoView()),!0)},df=(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 ha(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 fE=(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=ha(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let a=n.after(),c=t.tr.replaceWith(a,a,s.createAndFill());c.setSelection(le.near(c.doc.resolve(a),1)),e(c.scrollIntoView())}return!0},uf=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof ot||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=ha(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,a=t.tr.insert(s,o.createAndFill());a.setSelection(ie.create(a.doc,s+1)),e(a.scrollIntoView())}return!0},ff=(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(zt(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&sr(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function hE(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Z&&e.selection.node.isBlock)return!r.parentOffset||!zt(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.parent.isBlock)return!1;if(n){let o=i.parentOffset==i.parent.content.size,s=e.tr;(e.selection instanceof ie||e.selection instanceof ot)&&s.deleteSelection();let a=r.depth==0?null:ha(r.node(-1).contentMatchAt(r.indexAfter(-1))),c=o&&a?[{type:a}]:void 0,d=zt(s.doc,s.mapping.map(r.pos),1,c);if(!c&&!d&&zt(s.doc,s.mapping.map(r.pos),1,a?[{type:a}]:void 0)&&(a&&(c=[{type:a}]),d=!0),d&&(s.split(s.mapping.map(r.pos),1,c),!o&&!r.parentOffset&&r.parent.type!=a)){let u=s.mapping.map(r.before()),f=s.doc.resolve(u);a&&r.node(-1).canReplaceWith(f.index(),f.index()+1,a)&&s.setNodeMarkup(s.mapping.map(r.before()),a)}n(s.scrollIntoView())}return!0}}const pE=hE(),mE=(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 gE(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||nn(t.doc,e.pos))?!1:(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function hf(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,o,s;if(r.type.spec.isolating||i.type.spec.isolating)return!1;if(gE(t,e,n))return!0;let a=e.parent.canReplace(e.index(),e.index()+1);if(a&&(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=R.empty;for(let g=o.length-1;g>=0;g--)h=R.from(o[g].create(null,h));h=R.from(r.copy(h));let p=t.tr.step(new $e(e.pos-1,f,e.pos,f,new q(h,1,0),o.length,!0)),m=f+2*o.length;nn(p.doc,m)&&p.join(m),n(p.scrollIntoView())}return!0}let c=le.findFrom(e,1),d=c&&c.$from.blockRange(c.$to),u=d&&sr(d);if(u!=null&&u>=e.depth)return n&&n(t.tr.lift(d,u).scrollIntoView()),!0;if(a&&gr(i,"start",!0)&&gr(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 g=R.empty;for(let k=h.length-1;k>=0;k--)g=R.from(h[k].copy(g));let y=t.tr.step(new $e(e.pos-h.length,e.pos+i.nodeSize,e.pos+m,e.pos+i.nodeSize-m,new q(g,h.length,0),0,!0));n(y.scrollIntoView())}return!0}}return!1}function pf(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(ie.create(e.doc,t<0?i.start(o):i.end(o)))),!0):!1}}const yE=pf(-1),bE=pf(1);function kE(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),a=s&&As(s,t,e);return a?(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0):!1}}function mf(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:a}}=n.selection.ranges[o];n.doc.nodesBetween(s,a,(c,d)=>{if(i)return!1;if(!(!c.isTextblock||c.hasMarkup(t,e)))if(c.type==t)i=!0;else{let u=n.doc.resolve(d),f=u.index();i=u.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:a},$to:{pos:c}}=n.selection.ranges[s];o.setBlockType(a,c,t,e)}r(o.scrollIntoView())}return!0}}function pa(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}pa(da,rf,sf),pa(da,lf,cf),pa(df,uf,ff,pE),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function vE(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),a=!1,c=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 u=n.doc.resolve(s.start-2);c=new Zi(u,u,s.depth),s.endIndex<s.parent.childCount&&(s=new Zi(i,n.doc.resolve(o.end(s.depth)),s.depth)),a=!0}let d=As(c,t,e,s);return d?(r&&r(xE(n.tr,s,d,a,t).scrollIntoView()),!0):!1}}function xE(t,e,n,r,i){let o=R.empty;for(let u=n.length-1;u>=0;u--)o=R.from(n[u].type.create(n[u].attrs,o));t.step(new $e(e.start-(r?2:0),e.end,e.start,e.end,new q(o,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==i&&(s=u+1);let a=n.length-s,c=e.start+n.length-(r?2:0),d=e.parent;for(let u=e.startIndex,f=e.endIndex,h=!0;u<f;u++,h=!1)!h&&zt(t.doc,c,a)&&(t.split(c,a),c+=2*a),c+=d.child(u).nodeSize;return t}function wE(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?SE(e,n,t,o):CE(e,n,o):!0:!1}}function SE(t,e,n,r){let i=t.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new $e(o-1,s,o,s,new q(R.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Zi(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const a=sr(r);if(a==null)return!1;i.lift(r,a);let c=i.mapping.map(o,-1)-1;return nn(i.doc,c)&&i.join(c),e(i.scrollIntoView()),!0}function CE(t,e,n){let r=t.tr,i=n.parent;for(let p=n.end,m=n.endIndex-1,g=n.startIndex;m>g;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 a=n.startIndex==0,c=n.endIndex==i.childCount,d=o.node(-1),u=o.index(-1);if(!d.canReplace(u+(a?0:1),u+1,s.content.append(c?R.empty:R.from(i))))return!1;let f=o.pos,h=f+s.nodeSize;return r.step(new $e(f-(a?1:0),h+(c?1:0),f+1,h-1,new q((a?R.empty:R.from(i.copy(R.empty))).append(c?R.empty:R.from(i.copy(R.empty))),a?0:1,c?0:1),a?0:1)),e(r.scrollIntoView()),!0}function OE(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,d=>d.childCount>0&&d.firstChild.type==t);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let a=o.parent,c=a.child(s-1);if(c.type!=t)return!1;if(n){let d=c.lastChild&&c.lastChild.type==a.type,u=R.from(d?t.create():null),f=new q(R.from(t.create(null,R.from(a.type.create(null,u)))),d?3:1,0),h=o.start,p=o.end;n(e.tr.step(new $e(h-(d?3:1),p,h,p,f,1,!0)).scrollIntoView())}return!0}}function yo(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 bo{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(([a,c])=>[a,(...u)=>{const f=c(...u)(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,a=[],c=!!e,d=e||o.tr,u=()=>(!c&&n&&!d.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(d),a.every(h=>h===!0)),f={...Object.fromEntries(Object.entries(r).map(([h,p])=>[h,(...g)=>{const y=this.buildProps(d,n),k=p(...g)(y);return a.push(k),f}])),run:u};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(([c,d])=>[c,(...u)=>d(...u)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:o}=this,{view:s}=i,a={tr:e,editor:i,view:s,state:yo({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(([c,d])=>[c,(...u)=>d(...u)(a)]))}};return a}}class EE{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 J(t,e,n){return t.config[e]===void 0&&t.parent?J(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?J(t.parent,e,n):null}):t.config[e]}function ko(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 gf(t){const e=[],{nodeExtensions:n,markExtensions:r}=ko(t),i=[...n,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage},c=J(s,"addGlobalAttributes",a);if(!c)return;c().forEach(u=>{u.types.forEach(f=>{Object.entries(u.attributes).forEach(([h,p])=>{e.push({type:f,name:h,attribute:{...o,...p}})})})})}),i.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage},c=J(s,"addAttributes",a);if(!c)return;const d=c();Object.entries(d).forEach(([u,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:u,attribute:h})})}),e}function Ne(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 Ee(...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 a=o?o.split(" "):[],c=r[i]?r[i].split(" "):[],d=a.filter(u=>!c.includes(u));r[i]=[...c,...d].join(" ")}else i==="style"?r[i]=[r[i],o].join("; "):r[i]=o}),r},{})}function ma(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)=>Ee(n,r),{})}function yf(t){return typeof t=="function"}function ce(t,e=void 0,...n){return yf(t)?e?t.bind(e)(...n):t(...n):t}function ME(t={}){return Object.keys(t).length===0&&t.constructor===Object}function TE(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function bf(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 a=s.attribute.parseHTML?s.attribute.parseHTML(n):TE(n.getAttribute(s.name));return a==null?o:{...o,[s.name]:a}},{});return{...r,...i}}}}function kf(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&ME(n)?!1:n!=null))}function $E(t,e){var n;const r=gf(t),{nodeExtensions:i,markExtensions:o}=ko(t),s=(n=i.find(d=>J(d,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(i.map(d=>{const u=r.filter(k=>k.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},h=t.reduce((k,C)=>{const N=J(C,"extendNodeSchema",f);return{...k,...N?N(d):{}}},{}),p=kf({...h,content:ce(J(d,"content",f)),marks:ce(J(d,"marks",f)),group:ce(J(d,"group",f)),inline:ce(J(d,"inline",f)),atom:ce(J(d,"atom",f)),selectable:ce(J(d,"selectable",f)),draggable:ce(J(d,"draggable",f)),code:ce(J(d,"code",f)),defining:ce(J(d,"defining",f)),isolating:ce(J(d,"isolating",f)),attrs:Object.fromEntries(u.map(k=>{var C;return[k.name,{default:(C=k==null?void 0:k.attribute)===null||C===void 0?void 0:C.default}]}))}),m=ce(J(d,"parseHTML",f));m&&(p.parseDOM=m.map(k=>bf(k,u)));const g=J(d,"renderHTML",f);g&&(p.toDOM=k=>g({node:k,HTMLAttributes:ma(k,u)}));const y=J(d,"renderText",f);return y&&(p.toText=y),[d.name,p]})),c=Object.fromEntries(o.map(d=>{const u=r.filter(y=>y.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},h=t.reduce((y,k)=>{const C=J(k,"extendMarkSchema",f);return{...y,...C?C(d):{}}},{}),p=kf({...h,inclusive:ce(J(d,"inclusive",f)),excludes:ce(J(d,"excludes",f)),group:ce(J(d,"group",f)),spanning:ce(J(d,"spanning",f)),code:ce(J(d,"code",f)),attrs:Object.fromEntries(u.map(y=>{var k;return[y.name,{default:(k=y==null?void 0:y.attribute)===null||k===void 0?void 0:k.default}]}))}),m=ce(J(d,"parseHTML",f));m&&(p.parseDOM=m.map(y=>bf(y,u)));const g=J(d,"renderHTML",f);return g&&(p.toDOM=y=>g({mark:y,HTMLAttributes:ma(y,u)})),[d.name,p]}));return new RS({topNode:s,nodes:a,marks:c})}function ga(t,e){return e.nodes[t]||e.marks[t]||null}function vf(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}const NE=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,o,s,a)=>{var c,d;const u=((d=(c=i.type.spec).toText)===null||d===void 0?void 0:d.call(c,{node:i,pos:o,parent:s,index:a}))||i.textContent||"%leaf%";n+=u.slice(0,Math.max(0,r-o))}),n};function ya(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class vo{constructor(e){this.find=e.find,this.handler=e.handler}}const BE=(t,e)=>{if(ya(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 xo(t){var e;const{editor:n,from:r,to:i,text:o,rules:s,plugin:a}=t,{view:c}=n;if(c.composing)return!1;const d=c.state.doc.resolve(r);if(d.parent.type.spec.code||!((e=d.nodeBefore||d.nodeAfter)===null||e===void 0)&&e.marks.find(h=>h.type.spec.code))return!1;let u=!1;const f=NE(d)+o;return s.forEach(h=>{if(u)return;const p=BE(f,h.find);if(!p)return;const m=c.state.tr,g=yo({state:c.state,transaction:m}),y={from:r-(p[0].length-o.length),to:i},{commands:k,chain:C,can:N}=new bo({editor:n,state:g});h.handler({state:g,range:y,match:p,commands:k,chain:C,can:N})===null||!m.steps.length||(m.setMeta(a,{transform:m,from:r,to:i,text:o}),c.dispatch(m),u=!0)}),u}function AE(t){const{editor:e,rules:n}=t,r=new ze({state:{init(){return null},apply(i,o){const s=i.getMeta(r);if(s)return s;const a=i.getMeta("applyInputRules");return!!a&&setTimeout(()=>{const{from:d,text:u}=a,f=d+u.length;xo({editor:e,from:d,to:f,text:u,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,s,a){return xo({editor:e,from:o,to:s,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&xo({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?xo({editor:e,from:s.pos,to:s.pos,text:`
15
- `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function DE(t){return typeof t=="number"}class VE{constructor(e){this.find=e.find,this.handler=e.handler}}const IE=(t,e,n)=>{if(ya(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 PE(t){const{editor:e,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:a}=t,{commands:c,chain:d,can:u}=new bo({editor:e,state:n}),f=[];return n.doc.nodesBetween(r,i,(p,m)=>{if(!p.isTextblock||p.type.spec.code)return;const g=Math.max(r,m),y=Math.min(i,m+p.content.size),k=p.textBetween(g-m,y-m,void 0,"");IE(k,o.find,s).forEach(N=>{if(N.index===void 0)return;const b=g+N.index+1,S=b+N[0].length,v={from:n.tr.mapping.map(b),to:n.tr.mapping.map(S)},$=o.handler({state:n,range:v,match:N,commands:c,chain:d,can:u,pasteEvent:s,dropEvent:a});f.push($)})}),f.every(p=>p!==null)}const _E=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 RE(t){const{editor:e,rules:n}=t;let r=null,i=!1,o=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a=typeof DragEvent<"u"?new DragEvent("drop"):null;const c=({state:u,from:f,to:h,rule:p,pasteEvt:m})=>{const g=u.tr,y=yo({state:u,transaction:g});if(!(!PE({editor:e,state:y,from:Math.max(f-1,0),to:h.b-1,rule:p,pasteEvent:m,dropEvent:a})||!g.steps.length))return a=typeof DragEvent<"u"?new DragEvent("drop"):null,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g};return n.map(u=>new ze({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,a=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],g=m.getMeta("uiEvent")==="paste"&&!i,y=m.getMeta("uiEvent")==="drop"&&!o,k=m.getMeta("applyPasteRules"),C=!!k;if(!g&&!y&&!C)return;if(C){const{from:S,text:v}=k,$=S+v.length,D=_E(v);return c({rule:u,state:p,from:S,to:{b:$},pasteEvt:D})}const N=h.doc.content.findDiffStart(p.doc.content),b=h.doc.content.findDiffEnd(p.doc.content);if(!(!DE(N)||!b||N===b.b))return c({rule:u,state:p,from:N,to:b,pasteEvt:s})}}))}function LE(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return[...new Set(e)]}class yr{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=yr.resolve(e),this.schema=$E(this.extensions,n),this.setupExtensions()}static resolve(e){const n=yr.sort(yr.flatten(e)),r=LE(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=J(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{const o=J(r,"priority")||100,s=J(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:ga(n.name,this.schema)},i=J(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=yr.sort([...this.extensions].reverse()),r=[],i=[],o=n.map(s=>{const a={name:s.name,options:s.options,storage:s.storage,editor:e,type:ga(s.name,this.schema)},c=[],d=J(s,"addKeyboardShortcuts",a);let u={};if(s.type==="mark"&&s.config.exitable&&(u.ArrowRight=()=>Nt.handleExit({editor:e,mark:s})),d){const g=Object.fromEntries(Object.entries(d()).map(([y,k])=>[y,()=>k({editor:e})]));u={...u,...g}}const f=sE(u);c.push(f);const h=J(s,"addInputRules",a);vf(s,e.options.enableInputRules)&&h&&r.push(...h());const p=J(s,"addPasteRules",a);vf(s,e.options.enablePasteRules)&&p&&i.push(...p());const m=J(s,"addProseMirrorPlugins",a);if(m){const g=m();c.push(...g)}return c}).flat();return[AE({editor:e,rules:r}),...RE({editor:e,rules:i}),...o]}get attributes(){return gf(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=ko(this.extensions);return Object.fromEntries(n.filter(r=>!!J(r,"addNodeView")).map(r=>{const i=this.attributes.filter(c=>c.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:e,type:Ne(r.name,this.schema)},s=J(r,"addNodeView",o);if(!s)return[];const a=(c,d,u,f)=>{const h=ma(c,i);return s()({editor:e,node:c,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:ga(e.name,this.schema)};e.type==="mark"&&(!((n=ce(J(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=J(e,"onBeforeCreate",r),o=J(e,"onCreate",r),s=J(e,"onUpdate",r),a=J(e,"onSelectionUpdate",r),c=J(e,"onTransaction",r),d=J(e,"onFocus",r),u=J(e,"onBlur",r),f=J(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),s&&this.editor.on("update",s),a&&this.editor.on("selectionUpdate",a),c&&this.editor.on("transaction",c),d&&this.editor.on("focus",d),u&&this.editor.on("blur",u),f&&this.editor.on("destroy",f)})}}function zE(t){return Object.prototype.toString.call(t).slice(8,-1)}function ba(t){return zE(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function wo(t,e){const n={...t};return ba(t)&&ba(e)&&Object.keys(e).forEach(r=>{ba(e[r])?r in t?n[r]=wo(t[r],e[r]):Object.assign(n,{[r]:e[r]}):Object.assign(n,{[r]:e[r]})}),n}class Re{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=ce(J(this,"addOptions",{name:this.name}))),this.storage=ce(J(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Re(e)}configure(e={}){const n=this.extend();return n.parent=this.parent,n.options=wo(this.options,e),n.storage=ce(J(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){const n=new Re({...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=ce(J(n,"addOptions",{name:n.name})),n.storage=ce(J(n,"addStorage",{name:n.name,options:n.options})),n}}function xf(t,e,n){const{from:r,to:i}=e,{blockSeparator:o=`
16
-
17
- `,textSerializers:s={}}=n||{};let a="";return t.nodesBetween(r,i,(c,d,u,f)=>{var h;c.isBlock&&d>r&&(a+=o);const p=s==null?void 0:s[c.type.name];if(p)return u&&(a+=p({node:c,pos:d,parent:u,index:f,range:e})),!1;c.isText&&(a+=(h=c==null?void 0:c.text)===null||h===void 0?void 0:h.slice(Math.max(r,d)-d,i-d))}),a}function wf(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const FE=Re.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ze({key:new yt("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(u=>u.$from.pos)),a=Math.max(...o.map(u=>u.$to.pos)),c=wf(n);return xf(r,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),jE=()=>({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),HE=(t=!1)=>({commands:e})=>e.setContent("",t),WE=()=>({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,(a,c)=>{if(a.type.isText)return;const{doc:d,mapping:u}=e,f=d.resolve(u.map(c)),h=d.resolve(u.map(c+a.nodeSize)),p=f.blockRange(h);if(!p)return;const m=sr(p);if(a.type.isTextblock){const{defaultType:g}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(p.start,g)}(m||m===0)&&e.lift(p,m)})}),!0},qE=t=>e=>t(e),UE=()=>({state:t,dispatch:e})=>uf(t,e),KE=(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 ie(r.doc.resolve(s-1))),!0},YE=()=>({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 a=i.before(o),c=i.after(o);t.delete(a,c).scrollIntoView()}return!0}return!1},JE=t=>({tr:e,state:n,dispatch:r})=>{const i=Ne(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 c=o.before(s),d=o.after(s);e.delete(c,d).scrollIntoView()}return!0}return!1},GE=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},ZE=()=>({state:t,dispatch:e})=>da(t,e),XE=()=>({commands:t})=>t.keyboardShortcut("Enter"),QE=()=>({state:t,dispatch:e})=>fE(t,e);function So(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:ya(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function ka(t,e,n={}){return t.find(r=>r.type===e&&So(r.attrs,n))}function eM(t,e,n={}){return!!ka(t,e,n)}function va(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=ka([...r.node.marks],e,n);if(!i)return;let o=r.index,s=t.start()+r.offset,a=o+1,c=s+r.node.nodeSize;for(ka([...r.node.marks],e,n);o>0&&i.isInSet(t.parent.child(o-1).marks);)o-=1,s-=t.parent.child(o).nodeSize;for(;a<t.parent.childCount&&eM([...t.parent.child(a).marks],e,n);)c+=t.parent.child(a).nodeSize,a+=1;return{from:s,to:c}}function hn(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 tM=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const o=hn(t,r.schema),{doc:s,selection:a}=n,{$from:c,from:d,to:u}=a;if(i){const f=va(c,o,e);if(f&&f.from<=d&&f.to>=u){const h=ie.create(s,f.from,f.to);n.setSelection(h)}}return!0},nM=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 xa(t){return t instanceof ie}function Wt(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Sf(t,e=null){if(!e)return null;const n=le.atStart(t),r=le.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,o=r.to;return e==="all"?ie.create(t,Wt(0,i,o),Wt(t.content.size,i,o)):ie.create(t,Wt(e,i,o),Wt(e,i,o))}function wa(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const rM=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const s=()=>{wa()&&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&&!xa(n.state.selection))return s(),!0;const a=Sf(i.doc,t)||n.state.selection,c=n.state.selection.eq(a);return o&&(c||i.setSelection(a),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},iM=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),oM=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Cf=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&&Cf(r)}return t};function Of(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return Cf(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?R.fromArray(t.map(s=>e.nodeFromJSON(s))):e.nodeFromJSON(t)}catch(o){return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),Co("",e,n)}if(i){const o=rr.fromSchema(e);return n.slice?o.parseSlice(Of(t),n.parseOptions).content:o.parse(Of(t),n.parseOptions)}return Co("",e,n)}function sM(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof Te||i instanceof $e))return;const o=t.mapping.maps[r];let s=0;o.forEach((a,c,d,u)=>{s===0&&(s=u)}),t.setSelection(le.near(t.doc.resolve(s),n))}const aM=t=>t.toString().startsWith("<"),lM=(t,e,n)=>({tr:r,dispatch:i,editor:o})=>{if(i){n={parseOptions:{},updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};const s=Co(e,o.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions}});if(s.toString()==="<>")return!0;let{from:a,to:c}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},d=!0,u=!0;if((aM(s)?s:[s]).forEach(p=>{p.check(),d=d?p.isText&&p.marks.length===0:!1,u=u?p.isBlock:!1}),a===c&&u){const{parent:p}=r.doc.resolve(a);p.isTextblock&&!p.type.spec.code&&!p.childCount&&(a-=1,c+=1)}let h;d?(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,c)):(h=s,r.replaceWith(a,c,h)),n.updateSelection&&sM(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},cM=()=>({state:t,dispatch:e})=>cE(t,e),dM=()=>({state:t,dispatch:e})=>dE(t,e),uM=()=>({state:t,dispatch:e})=>rf(t,e),fM=()=>({state:t,dispatch:e})=>lf(t,e),hM=()=>({tr:t,state:e,dispatch:n})=>{try{const r=oo(e.doc,e.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),n&&n(t),!0)}catch{return!1}},pM=()=>({state:t,dispatch:e,tr:n})=>{try{const r=oo(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},mM=()=>({state:t,dispatch:e})=>aE(t,e),gM=()=>({state:t,dispatch:e})=>lE(t,e);function Ef(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function yM(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,o,s;for(let a=0;a<e.length-1;a+=1){const c=e[a];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))wa()||Ef()?s=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),o&&(n=`Shift-${n}`),n}const bM=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const o=yM(t).split(/-(?!$)/),s=o.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),a=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}),c=e.captureTransaction(()=>{n.someProp("handleKeyDown",d=>d(n,a))});return c==null||c.steps.forEach(d=>{const u=d.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function ui(t,e,n={}){const{from:r,to:i,empty:o}=t.selection,s=e?Ne(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 c=i-r,d=a.filter(f=>s?s.name===f.node.type.name:!0).filter(f=>So(f.node.attrs,n,{strict:!1}));return o?!!d.length:d.reduce((f,h)=>f+h.to-h.from,0)>=c}const kM=(t,e={})=>({state:n,dispatch:r})=>{const i=Ne(t,n.schema);return ui(n,i,e)?uE(n,r):!1},vM=()=>({state:t,dispatch:e})=>ff(t,e),xM=t=>({state:e,dispatch:n})=>{const r=Ne(t,e.schema);return wE(r)(e,n)},wM=()=>({state:t,dispatch:e})=>df(t,e);function Oo(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Mf(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 SM=(t,e)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null;const a=Oo(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(o=Ne(t,r.schema)),a==="mark"&&(s=hn(t,r.schema)),i&&n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(d,u)=>{o&&o===d.type&&n.setNodeMarkup(u,void 0,Mf(d.attrs,e)),s&&d.marks.length&&d.marks.forEach(f=>{s===f.type&&n.addMark(u,u+d.nodeSize,s.create(Mf(f.attrs,e)))})})}),!0):!1},CM=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),OM=()=>({tr:t,commands:e})=>e.setTextSelection({from:0,to:t.doc.content.size}),EM=()=>({state:t,dispatch:e})=>sf(t,e),MM=()=>({state:t,dispatch:e})=>cf(t,e),TM=()=>({state:t,dispatch:e})=>mE(t,e),$M=()=>({state:t,dispatch:e})=>bE(t,e),NM=()=>({state:t,dispatch:e})=>yE(t,e);function Tf(t,e,n={}){return Co(t,e,{slice:!1,parseOptions:n})}const BM=(t,e=!1,n={})=>({tr:r,editor:i,dispatch:o})=>{const{doc:s}=r,a=Tf(t,i.schema,n);return o&&r.replaceWith(0,s.content.size,a).setMeta("preventUpdate",!e),!0};function Eo(t,e){const n=hn(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,c=>{s.push(...c.marks)});const a=s.find(c=>c.type.name===n.name);return a?{...a.attrs}:{}}function AM(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 DM(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 Sa(t){return e=>DM(e.$from,t)}function VM(t,e){const n=Ot.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function IM(t,e){const n={from:0,to:t.content.size};return xf(t,n,e)}function PM(t,e){const n=Ne(e,t.schema),{from:r,to:i}=t.selection,o=[];t.doc.nodesBetween(r,i,a=>{o.push(a)});const s=o.reverse().find(a=>a.type.name===n.name);return s?{...s.attrs}:{}}function _M(t,e){const n=Oo(typeof e=="string"?e:e.name,t.schema);return n==="node"?PM(t,e):n==="mark"?Eo(t,e):{}}function $f(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const o=n.resolve(t-1),s=va(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 Mo(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 Ca(t,e,n={}){const{empty:r,ranges:i}=t.selection,o=e?hn(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>o?o.name===f.type.name:!0).find(f=>So(f.attrs,n,{strict:!1}));let s=0;const a=[];if(i.forEach(({$from:f,$to:h})=>{const p=f.pos,m=h.pos;t.doc.nodesBetween(p,m,(g,y)=>{if(!g.isText&&!g.marks.length)return;const k=Math.max(p,y),C=Math.min(m,y+g.nodeSize),N=C-k;s+=N,a.push(...g.marks.map(b=>({mark:b,from:k,to:C})))})}),s===0)return!1;const c=a.filter(f=>o?o.name===f.mark.type.name:!0).filter(f=>So(f.mark.attrs,n,{strict:!1})).reduce((f,h)=>f+h.to-h.from,0),d=a.filter(f=>o?f.mark.type!==o&&f.mark.type.excludes(o):!0).reduce((f,h)=>f+h.to-h.from,0);return(c>0?c+d:c)>=s}function RM(t,e,n={}){if(!e)return ui(t,null,n)||Ca(t,null,n);const r=Oo(e,t.schema);return r==="node"?ui(t,e,n):r==="mark"?Ca(t,e,n):!1}function Nf(t,e){const{nodeExtensions:n}=ko(e),r=n.find(s=>s.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=ce(J(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function LM(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 zM(t){return t instanceof Z}function Bf(t,e,n){const i=t.state.doc.content.size,o=Wt(e,0,i),s=Wt(n,0,i),a=t.coordsAtPos(o),c=t.coordsAtPos(s,-1),d=Math.min(a.top,c.top),u=Math.max(a.bottom,c.bottom),f=Math.min(a.left,c.left),h=Math.max(a.right,c.right),p=h-f,m=u-d,k={top:d,bottom:u,left:f,right:h,width:p,height:m,x:f,y:d};return{...k,toJSON:()=>k}}function FM(t,e,n){var r;const{selection:i}=e;let o=null;if(xa(i)&&(o=i.$cursor),o){const a=(r=t.storedMarks)!==null&&r!==void 0?r:o.marks();return!!n.isInSet(a)||!a.some(c=>c.type.excludes(n))}const{ranges:s}=i;return s.some(({$from:a,$to:c})=>{let d=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,c.pos,(u,f,h)=>{if(d)return!1;if(u.isInline){const p=!h||h.type.allowsMarkType(n),m=!!n.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(n));d=p&&m}return!d}),d})}const jM=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:o}=n,{empty:s,ranges:a}=o,c=hn(t,r.schema);if(i)if(s){const d=Eo(r,c);n.addStoredMark(c.create({...d,...e}))}else a.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;r.doc.nodesBetween(u,f,(h,p)=>{const m=Math.max(p,u),g=Math.min(p+h.nodeSize,f);h.marks.find(k=>k.type===c)?h.marks.forEach(k=>{c===k.type&&n.addMark(m,g,c.create({...k.attrs,...e}))}):n.addMark(m,g,c.create(e))})});return FM(r,n,c)},HM=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),WM=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const o=Ne(t,n.schema);return o.isTextblock?i().command(({commands:s})=>mf(o,e)(n)?!0:s.clearNodes()).command(({state:s})=>mf(o,e)(s,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},qM=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=Wt(t,0,r.content.size),o=Z.create(r,i);e.setSelection(o)}return!0},UM=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:o}=typeof t=="number"?{from:t,to:t}:t,s=ie.atStart(r).from,a=ie.atEnd(r).to,c=Wt(i,s,a),d=Wt(o,s,a),u=ie.create(r,c,d);e.setSelection(u)}return!0},KM=t=>({state:e,dispatch:n})=>{const r=Ne(t,e.schema);return OE(r)(e,n)};function Af(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 YM=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:o,doc:s}=e,{$from:a,$to:c}=o,d=i.extensionManager.attributes,u=Mo(d,a.node().type.name,a.node().attrs);if(o instanceof Z&&o.node.isBlock)return!a.parentOffset||!zt(s,a.pos)?!1:(r&&(t&&Af(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;if(r){const f=c.parentOffset===c.parent.content.size;o instanceof ie&&e.deleteSelection();const h=a.depth===0?void 0:AM(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=f&&h?[{type:h,attrs:u}]:void 0,m=zt(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!m&&zt(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 g=e.mapping.map(a.before()),y=e.doc.resolve(g);a.node(-1).canReplaceWith(y.index(),y.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}t&&Af(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return!0},JM=t=>({tr:e,state:n,dispatch:r,editor:i})=>{var o;const s=Ne(t,n.schema),{$from:a,$to:c}=n.selection,d=n.selection.node;if(d&&d.isBlock||a.depth<2||!a.sameParent(c))return!1;const u=a.node(-1);if(u.type!==s)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!==s||a.index(-2)!==a.node(-2).childCount-1)return!1;if(r){let y=R.empty;const k=a.index(-1)?1:a.index(-2)?2:3;for(let $=a.depth-k;$>=a.depth-3;$-=1)y=R.from(a.node($).copy(y));const C=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,N=Mo(f,a.node().type.name,a.node().attrs),b=((o=s.contentMatch.defaultType)===null||o===void 0?void 0:o.createAndFill(N))||void 0;y=y.append(R.from(s.createAndFill(null,b)||void 0));const S=a.before(a.depth-(k-1));e.replace(S,a.after(-C),new q(y,4-k,0));let v=-1;e.doc.nodesBetween(S,e.doc.content.size,($,D)=>{if(v>-1)return!1;$.isTextblock&&$.content.size===0&&(v=D+1)}),v>-1&&e.setSelection(ie.near(e.doc.resolve(v))),e.scrollIntoView()}return!0}const h=c.pos===a.end()?u.contentMatchAt(0).defaultType:null,p=Mo(f,u.type.name,u.attrs),m=Mo(f,a.node().type.name,a.node().attrs);e.delete(a.pos,c.pos);const g=h?[{type:s,attrs:p},{type:h,attrs:m}]:[{type:s,attrs:p}];if(!zt(e.doc,a.pos,2))return!1;if(r){const{selection:y,storedMarks:k}=n,{splittableMarks:C}=i.extensionManager,N=k||y.$to.parentOffset&&y.$from.marks();if(e.split(a.pos,2,g).scrollIntoView(),!N||!r)return!0;const b=N.filter(S=>C.includes(S.type.name));e.ensureMarks(b)}return!0},Oa=(t,e)=>{const n=Sa(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)&&nn(t.doc,n.pos)&&t.join(n.pos),!0},Ea=(t,e)=>{const n=Sa(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)&&nn(t.doc,r)&&t.join(r),!0};var GM=Object.freeze({__proto__:null,blur:jE,clearContent:HE,clearNodes:WE,command:qE,createParagraphNear:UE,cut:KE,deleteCurrentNode:YE,deleteNode:JE,deleteRange:GE,deleteSelection:ZE,enter:XE,exitCode:QE,extendMarkRange:tM,first:nM,focus:rM,forEach:iM,insertContent:oM,insertContentAt:lM,joinUp:cM,joinDown:dM,joinBackward:uM,joinForward:fM,joinItemBackward:hM,joinItemForward:pM,joinTextblockBackward:mM,joinTextblockForward:gM,keyboardShortcut:bM,lift:kM,liftEmptyBlock:vM,liftListItem:xM,newlineInCode:wM,resetAttributes:SM,scrollIntoView:CM,selectAll:OM,selectNodeBackward:EM,selectNodeForward:MM,selectParentNode:TM,selectTextblockEnd:$M,selectTextblockStart:NM,setContent:BM,setMark:jM,setMeta:HM,setNode:WM,setNodeSelection:qM,setTextSelection:UM,sinkListItem:KM,splitBlock:YM,splitListItem:JM,toggleList:(t,e,n,r={})=>({editor:i,tr:o,state:s,dispatch:a,chain:c,commands:d,can:u})=>{const{extensions:f,splittableMarks:h}=i.extensionManager,p=Ne(t,s.schema),m=Ne(e,s.schema),{selection:g,storedMarks:y}=s,{$from:k,$to:C}=g,N=k.blockRange(C),b=y||g.$to.parentOffset&&g.$from.marks();if(!N)return!1;const S=Sa(v=>Nf(v.type.name,f))(g);if(N.depth>=1&&S&&N.depth-S.depth<=1){if(S.node.type===p)return d.liftListItem(m);if(Nf(S.node.type.name,f)&&p.validContent(S.node.content)&&a)return c().command(()=>(o.setNodeMarkup(S.pos,p),!0)).command(()=>Oa(o,p)).command(()=>Ea(o,p)).run()}return!n||!b||!a?c().command(()=>u().wrapInList(p,r)?!0:d.clearNodes()).wrapInList(p,r).command(()=>Oa(o,p)).command(()=>Ea(o,p)).run():c().command(()=>{const v=u().wrapInList(p,r),$=b.filter(D=>h.includes(D.type.name));return o.ensureMarks($),v?!0:d.clearNodes()}).wrapInList(p,r).command(()=>Oa(o,p)).command(()=>Ea(o,p)).run()},toggleMark:(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=n,s=hn(t,r.schema);return Ca(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},toggleNode:(t,e,n={})=>({state:r,commands:i})=>{const o=Ne(t,r.schema),s=Ne(e,r.schema);return ui(r,o,n)?i.setNode(s):i.setNode(o,n)},toggleWrap:(t,e={})=>({state:n,commands:r})=>{const i=Ne(t,n.schema);return ui(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,a=o.transform;for(let c=a.steps.length-1;c>=0;c-=1)s.step(a.steps[c].invert(a.docs[c]));if(o.text){const c=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,t.schema.text(o.text,c))}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:a}=n,c=hn(t,r.schema),{$from:d,empty:u,ranges:f}=a;if(!i)return!0;if(u&&s){let{from:h,to:p}=a;const m=(o=d.marks().find(y=>y.type===c))===null||o===void 0?void 0:o.attrs,g=va(d,c,m);g&&(h=g.from,p=g.to),n.removeMark(h,p,c)}else f.forEach(h=>{n.removeMark(h.$from.pos,h.$to.pos,c)});return n.removeStoredMark(c),!0},updateAttributes:(t,e={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null;const a=Oo(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(o=Ne(t,r.schema)),a==="mark"&&(s=hn(t,r.schema)),i&&n.selection.ranges.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;r.doc.nodesBetween(d,u,(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,d),g=Math.min(h+f.nodeSize,u);n.addMark(m,g,s.create({...p.attrs,...e}))}})})}),!0):!1},wrapIn:(t,e={})=>({state:n,dispatch:r})=>{const i=Ne(t,n.schema);return kE(i,e)(n,r)},wrapInList:(t,e={})=>({state:n,dispatch:r})=>{const i=Ne(t,n.schema);return vE(i,e)(n,r)}});const ZM=Re.create({name:"commands",addCommands(){return{...GM}}}),XM=Re.create({name:"editable",addProseMirrorPlugins(){return[new ze({key:new yt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),QM=Re.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new ze({key:new yt("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}}}})]}}),e2=Re.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:a})=>{const{selection:c,doc:d}=a,{empty:u,$anchor:f}=c,{pos:h,parent:p}=f,m=f.parent.isTextblock&&h>0?a.doc.resolve(h-1):f,g=m.parent.type.spec.isolating,y=f.pos-f.parentOffset,k=g&&m.parent.childCount===1?y===f.pos:le.atStart(d).from===h;return!u||!p.type.isTextblock||p.textContent.length||!k||k&&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 wa()||Ef()?o:i},addProseMirrorPlugins(){return[new ze({key:new yt("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,a=le.atStart(e.doc).from,c=le.atEnd(e.doc).to;if(i||!(o===a&&s===c)||!(n.doc.textBetween(0,n.doc.content.size," "," ").length===0))return;const f=n.tr,h=yo({state:n,transaction:f}),{commands:p}=new bo({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),t2=Re.create({name:"tabindex",addProseMirrorPlugins(){return[new ze({key:new yt("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}});class _n{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 _n(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 _n(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 _n(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 a=new _n(s,this.editor,i,i?n:null);i&&(a.actualDepth=this.depth+1),e.push(new _n(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 a=0;a<s.length;a+=1){const c=s[a];if(o[c]!==n[c])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(c=>n[c]===s.node.attrs[c])&&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 n2=`.ProseMirror {
5
+ */function Me(t){return typeof t=="function"}function sl(t){return t==null}const Gt=t=>t!==null&&!!t&&typeof t=="object"&&!Array.isArray(t);function Lo(t){return Number(t)>=0}function tp(t){const e=parseFloat(t);return isNaN(e)?t:e}function np(t){return typeof t=="object"&&t!==null}function rp(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}function al(t){if(!np(t)||rp(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 Ar(t,e){return Object.keys(e).forEach(n=>{if(al(e[n])&&al(t[n])){t[n]||(t[n]={}),Ar(t[n],e[n]);return}t[n]=e[n]}),t}function Dr(t){const e=t.split(".");if(!e.length)return"";let n=String(e[0]);for(let r=1;r<e.length;r++){if(Lo(e[r])){n+=`[${e[r]}]`;continue}n+=`.${e[r]}`}return n}const ll={};function pt(t,e){op(t,e),ll[t]=e}function ip(t){return ll[t]}function op(t,e){if(!Me(e))throw new Error(`Extension Error: The validator '${t}' must be a function.`)}function cl(t,e,n){typeof n.value=="object"&&(n.value=me(n.value)),!n.enumerable||n.get||n.set||!n.configurable||!n.writable||e==="__proto__"?Object.defineProperty(t,e,n):t[e]=n.value}function me(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(me(s))})):o==="[object Map]"?(i=new Map,t.forEach(function(s,a){i.set(me(a),me(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(me(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++)cl(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]||cl(i,n,Object.getOwnPropertyDescriptor(t,n))}return i||t}const Vr=Symbol("vee-validate-form"),dl=Symbol("vee-validate-field-instance"),Ci=Symbol("Default empty value"),sp=typeof window<"u";function zo(t){return Me(t)&&!!t.__locatorRef}function mt(t){return!!t&&Me(t.parse)&&t.__type==="VVTypedSchema"}function Oi(t){return!!t&&Me(t.validate)}function Ir(t){return t==="checkbox"||t==="radio"}function ap(t){return Gt(t)||Array.isArray(t)}function lp(t){return Array.isArray(t)?t.length===0:Gt(t)&&Object.keys(t).length===0}function Ei(t){return/^\[.+\]$/i.test(t)}function cp(t){return ul(t)&&t.multiple}function ul(t){return t.tagName==="SELECT"}function dp(t,e){const n=![!1,null,void 0,0].includes(e.multiple)&&!Number.isNaN(e.multiple);return t==="select"&&"multiple"in e&&n}function up(t,e){return!dp(t,e)&&e.type!=="file"&&!Ir(e.type)}function fl(t){return Fo(t)&&t.target&&"submit"in t.target}function Fo(t){return t?!!(typeof Event<"u"&&Me(Event)&&t instanceof Event||t&&t.srcElement):!1}function hl(t,e){return e in t&&t[e]!==Ci}function Le(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(!Le(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(!Le(r[1],e.get(r[0])))return!1;return!0}if(pl(t)&&pl(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(!Le(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function pl(t){return sp?t instanceof File:!1}function jo(t){return Ei(t)?t.replace(/\[|\]/gi,""):t}function Ue(t,e,n){return t?Ei(e)?t[jo(e)]:(e||"").split(/\.|\[(\d+)\]/).filter(Boolean).reduce((i,o)=>ap(i)&&o in i?i[o]:n,t):n}function Rt(t,e,n){if(Ei(e)){t[jo(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)||sl(i[r[o]]))&&(i[r[o]]=Lo(r[o+1])?[]:{}),i=i[r[o]]}}function Ho(t,e){if(Array.isArray(t)&&Lo(e)){t.splice(Number(e),1);return}Gt(t)&&delete t[e]}function ml(t,e){if(Ei(e)){delete t[jo(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){Ho(r,n[o]);break}if(!(n[o]in r)||sl(r[n[o]]))break;r=r[n[o]]}const i=n.map((o,s)=>Ue(t,n.slice(0,s).join(".")));for(let o=i.length-1;o>=0;o--)if(lp(i[o])){if(o===0){Ho(t,n[0]);continue}Ho(i[o-1],n[o-1])}}function Ke(t){return Object.keys(t)}function Wo(t,e=void 0){const n=l.getCurrentInstance();return(n==null?void 0:n.provides[t])||l.inject(t,e)}function gl(t,e,n){if(Array.isArray(t)){const r=[...t],i=r.findIndex(o=>Le(o,e));return i>=0?r.splice(i,1):r.push(e),r}return Le(t,e)?n:e}function fp(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 yl(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 hp(t,e){return Gt(e)&&e.number?tp(t):t}function qo(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 Uo(t){return Array.isArray(t)?t:t?[t]:[]}function Mi(t,e){const n={};for(const r in t)e.includes(r)||(n[r]=t[r]);return n}function pp(t){let e=null,n=[];return function(...r){const i=l.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 Yo(t){if(bl(t))return t._value}function bl(t){return"_value"in t}function mp(t){return t.type==="number"||t.type==="range"?Number.isNaN(t.valueAsNumber)?t.value:t.valueAsNumber:t.value}function Ti(t){if(!Fo(t))return t;const e=t.target;if(Ir(e.type)&&bl(e))return Yo(e);if(e.type==="file"&&e.files){const n=Array.from(e.files);return e.multiple?n:n[0]}if(cp(e))return Array.from(e.options).filter(n=>n.selected&&!n.disabled).map(Yo);if(ul(e)){const n=Array.from(e.options).find(r=>r.selected);return n?Yo(n):e.value}return mp(e)}function kl(t){const e={};return Object.defineProperty(e,"_$$isNormalized",{value:!0,writable:!1,enumerable:!1,configurable:!1}),t?Gt(t)&&t._$$isNormalized?t:Gt(t)?Object.keys(t).reduce((n,r)=>{const i=gp(t[r]);return t[r]!==!1&&(n[r]=xl(i)),n},e):typeof t!="string"?e:t.split("|").reduce((n,r)=>{const i=yp(r);return i.name&&(n[i.name]=xl(i.params)),n},e):e}function gp(t){return t===!0?[]:Array.isArray(t)||Gt(t)?t:[t]}function xl(t){const e=n=>typeof n=="string"&&n[0]==="@"?bp(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 yp=t=>{let e=[];const n=t.split(":")[0];return t.includes(":")&&(e=t.split(":").slice(1).join(":").split(",")),{name:n,params:e}};function bp(t){const e=n=>Ue(n,t)||n[t];return e.__locatorRef=t,e}function kp(t){return Array.isArray(t)?t.filter(zo):Ke(t).filter(e=>zo(t[e])).map(e=>t[e])}let xp=Object.assign({},{generateMessage:({field:t})=>`${t} is not valid.`,bails:!0,validateOnBlur:!0,validateOnChange:!0,validateOnInput:!1,validateOnModelUpdate:!0});const xn=()=>xp;async function vl(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 vp(i,t)).errors;return{errors:s,valid:!s.length}}async function vp(t,e){if(mt(t.rules)||Oi(t.rules))return Sp(e,t.rules);if(Me(t.rules)||Array.isArray(t.rules)){const s={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],c=a.length,d=[];for(let u=0;u<c;u++){const f=a[u],h=await f(e,s);if(!(typeof h!="string"&&!Array.isArray(h)&&h)){if(Array.isArray(h))d.push(...h);else{const m=typeof h=="string"?h:Sl(s);d.push(m)}if(t.bails)return{errors:d}}}return{errors:d}}const n=Object.assign(Object.assign({},t),{rules:kl(t.rules)}),r=[],i=Object.keys(n.rules),o=i.length;for(let s=0;s<o;s++){const a=i[s],c=await Cp(n,e,{name:a,params:n.rules[a]});if(c.error&&(r.push(c.error),t.bails))return{errors:r}}return{errors:r}}function wp(t){return!!t&&t.name==="ValidationError"}function wl(t){return{__type:"VVTypedSchema",async parse(n){var r;try{return{output:await t.validate(n,{abortEarly:!1}),errors:[]}}catch(i){if(!wp(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,a)=>{const c=a.path||"";return s[c]||(s[c]={errors:[],path:c}),s[c].errors.push(...a.errors),s},{});return{errors:Object.values(o)}}}}}async function Sp(t,e){const r=await(mt(e)?e:wl(e)).parse(t),i=[];for(const o of r.errors)o.errors.length&&i.push(...o.errors);return{errors:i}}async function Cp(t,e,n){const r=ip(n.name);if(!r)throw new Error(`No such validator '${n.name}' exists.`);const i=Op(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:Sl(o)}}function Sl(t){const e=xn().generateMessage;return e?e(t):"Field is invalid"}function Op(t,e){const n=r=>zo(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 Ep(t,e){const r=await(mt(t)?t:wl(t)).parse(me(e)),i={},o={};for(const s of r.errors){const a=s.errors,c=(s.path||"").replace(/\["(\d+)"\]/g,(d,u)=>`[${u}]`);i[c]={valid:!a.length,errors:a},a.length&&(o[c]=a[0])}return{valid:!r.errors.length,results:i,errors:o,values:r.value}}async function Mp(t,e,n){const i=Ke(t).map(async d=>{var u,f,h;const p=(u=n==null?void 0:n.names)===null||u===void 0?void 0:u[d],m=await vl(Ue(e,d),t[d],{name:(p==null?void 0:p.name)||d,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[d])!==null&&h!==void 0?h:!0});return Object.assign(Object.assign({},m),{path:d})});let o=!0;const s=await Promise.all(i),a={},c={};for(const d of s)a[d.path]={valid:d.valid,errors:d.errors},d.valid||(o=!1,c[d.path]=d.errors[0]);return{valid:o,results:a,errors:c}}let Cl=0;function Tp(t,e){const{value:n,initialValue:r,setInitialValue:i}=$p(t,e.modelValue,e.form);if(!e.form){let h=function(p){var m;"value"in p&&(n.value=p.value),"errors"in p&&d(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:c,setErrors:d}=Ap(),u=Cl>=Number.MAX_SAFE_INTEGER?0:++Cl,f=Bp(n,r,c,e.schema);return{id:u,path:t,value:n,initialValue:r,meta:f,flags:{pendingUnmount:{[u]:!1},pendingReset:!1},errors:c,setState:h}}const o=e.form.createPathState(t,{bails:e.bails,label:e.label,type:e.type,validate:e.validate,schema:e.schema}),s=l.computed(()=>o.errors);function a(c){var d,u,f;"value"in c&&(n.value=c.value),"errors"in c&&((d=e.form)===null||d===void 0||d.setFieldError(l.unref(t),c.errors)),"touched"in c&&((u=e.form)===null||u===void 0||u.setFieldTouched(l.unref(t),(f=c.touched)!==null&&f!==void 0?f:!1)),"initialValue"in c&&i(c.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:a}}function $p(t,e,n){const r=l.ref(l.unref(e));function i(){return n?Ue(n.initialValues.value,l.unref(t),l.unref(r)):l.unref(r)}function o(d){if(!n){r.value=d;return}n.setFieldInitialValue(l.unref(t),d,!0)}const s=l.computed(i);if(!n)return{value:l.ref(i()),initialValue:s,setInitialValue:o};const a=Np(e,n,s,t);return n.stageInitialValue(l.unref(t),a,!0),{value:l.computed({get(){return Ue(n.values,l.unref(t))},set(d){n.setFieldValue(l.unref(t),d,!1)}}),initialValue:s,setInitialValue:o}}function Np(t,e,n,r){return l.isRef(t)?l.unref(t):t!==void 0?t:Ue(e.values,l.unref(r),l.unref(n))}function Bp(t,e,n,r){const i=l.computed(()=>{var s,a,c;return(c=(a=(s=l.toValue(r))===null||s===void 0?void 0:s.describe)===null||a===void 0?void 0:a.call(s).required)!==null&&c!==void 0?c:!1}),o=l.reactive({touched:!1,pending:!1,valid:!0,required:i,validated:!!l.unref(n).length,initialValue:l.computed(()=>l.unref(e)),dirty:l.computed(()=>!Le(l.unref(t),l.unref(e)))});return l.watch(n,s=>{o.valid=!s.length},{immediate:!0,flush:"sync"}),o}function Ap(){const t=l.ref([]);return{errors:t,setErrors:e=>{t.value=Uo(e)}}}function Ol(t){process.env.NODE_ENV!=="production"&&ep({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"},Ip)}const Pr={},_r={};let Lt;const qn=fp(()=>{setTimeout(async()=>{await l.nextTick(),Lt==null||Lt.sendInspectorState(Un),Lt==null||Lt.sendInspectorTree(Un)},100)},100);function Dp(t){const e=l.getCurrentInstance();if(!Lt){const n=e==null?void 0:e.appContext.app;if(!n)return;Ol(n)}Pr[t.formId]=Object.assign({},t),Pr[t.formId]._vm=e,l.onUnmounted(()=>{delete Pr[t.formId],qn()}),qn()}function Vp(t){const e=l.getCurrentInstance();if(!Lt){const n=e==null?void 0:e.appContext.app;if(!n)return;Ol(n)}_r[t.id]=Object.assign({},t),_r[t.id]._vm=e,l.onUnmounted(()=>{delete _r[t.id],qn()}),qn()}const Un="vee-validate-inspector",Ye={error:12405579,success:448379,unknown:5522283,white:16777215,black:0,blue:218007,purple:12157168,orange:16099682,gray:12304330};let we=null;function Ip(t){Lt=t,t.addInspector({id:Un,icon:"rule",label:"vee-validate",noSelectionText:"Select a vee-validate node to inspect",actions:[{icon:"done_outline",tooltip:"Validate selected item",action:async()=>{if(!we){console.error("There is not a valid selected vee-validate node or component");return}if(we.type==="field"){await we.field.validate();return}if(we.type==="form"){await we.form.validate();return}we.type==="pathState"&&await we.form.validateField(we.state.path)}},{icon:"delete_sweep",tooltip:"Clear validation state of the selected item",action:()=>{if(!we){console.error("There is not a valid selected vee-validate node or component");return}if(we.type==="field"){we.field.resetField();return}we.type==="form"&&we.form.resetForm(),we.type==="pathState"&&we.form.resetField(we.state.path)}}]}),t.on.getInspectorTree(e=>{if(e.inspectorId!==Un)return;const n=Object.values(Pr),r=Object.values(_r);e.rootNodes=[...n.map(Pp),...r.map(i=>Rp(i))]}),t.on.getInspectorState((e,n)=>{if(e.inspectorId!==Un||n.currentTab!==`custom-inspector:${Un}`)return;const{form:r,field:i,state:o,type:s}=Lp(e.nodeId);if(r&&s==="form"){e.state=zp(r),we={type:"form",form:r};return}if(o&&s==="pathState"&&r){e.state=Ml(o),we={type:"pathState",state:o,form:r};return}if(i&&s==="field"){e.state=Ml({errors:i.errors.value,dirty:i.meta.dirty,valid:i.meta.valid,touched:i.meta.touched,value:i.value.value,initialValue:i.meta.initialValue}),we={field:i,type:"field"};return}we=null})}function Pp(t){const{textColor:e,bgColor:n}=Tl(t.meta.value.valid),r={};Object.values(t.getAllPathStates()).forEach(s=>{Rt(r,l.unref(s.path),_p(s,t))});function i(s,a=[]){const c=[...a].pop();return"id"in s?Object.assign(Object.assign({},s),{label:c||s.label}):Gt(s)?{id:`${a.join(".")}`,label:c||"",children:Object.keys(s).map(d=>i(s[d],[...a,d]))}:Array.isArray(s)?{id:`${a.join(".")}`,label:`${c}[]`,children:s.map((d,u)=>i(d,[...a,String(u)]))}:{id:"",label:"",children:[]}}const{children:o}=i(r);return{id:Jo(t),label:"Form",children:o,tags:[{label:"Form",textColor:e,backgroundColor:n},{label:`${t.getAllPathStates().length} fields`,textColor:Ye.white,backgroundColor:Ye.unknown}]}}function _p(t,e){return{id:Jo(e,t),label:l.unref(t.path),tags:El(t.multiple,t.fieldsCount,t.type,t.valid,e)}}function Rp(t,e){return{id:Jo(e,t),label:l.unref(t.name),tags:El(!1,1,t.type,t.meta.valid,e)}}function El(t,e,n,r,i){const{textColor:o,bgColor:s}=Tl(r);return[t?void 0:{label:"Field",textColor:o,backgroundColor:s},i?void 0:{label:"Standalone",textColor:Ye.black,backgroundColor:Ye.gray},n==="checkbox"?{label:"Checkbox",textColor:Ye.white,backgroundColor:Ye.blue}:void 0,n==="radio"?{label:"Radio",textColor:Ye.white,backgroundColor:Ye.purple}:void 0,t?{label:"Multiple",textColor:Ye.black,backgroundColor:Ye.orange}:void 0].filter(Boolean)}function Jo(t,e){const n=e?"path"in e?"pathState":"field":"form",r=e?"path"in e?e==null?void 0:e.path:l.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 Lp(t){try{const e=JSON.parse(decodeURIComponent(atob(t))),n=Pr[e.f];if(!n&&e.ff){const i=_r[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 Ml(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 zp(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:Ke(e.value).reduce((a,c)=>{var d;const u=(d=e.value[c])===null||d===void 0?void 0:d[0];return u&&(a[c]=u),a},{})}]}}function Tl(t){return{bgColor:t?Ye.success:Ye.error,textColor:t?Ye.black:Ye.white}}function Fp(t,e,n){return Ir(n==null?void 0:n.type)?Hp(t,e,n):$l(t,e,n)}function $l(t,e,n){const{initialValue:r,validateOnMount:i,bails:o,type:s,checkedValue:a,label:c,validateOnValueUpdate:d,uncheckedValue:u,controlled:f,keepValueOnUnmount:h,syncVModel:p,form:m}=jp(n),y=f?Wo(Vr):void 0,g=m||y,k=l.computed(()=>Dr(l.toValue(t))),C=l.computed(()=>{if(l.toValue(g==null?void 0:g.schema))return;const X=l.unref(e);return Oi(X)||mt(X)||Me(X)||Array.isArray(X)?X:kl(X)}),N=!Me(C.value)&&mt(l.toValue(e)),{id:b,value:S,initialValue:x,meta:$,setState:D,errors:A,flags:B}=Tp(k,{modelValue:r,form:g,bails:o,label:c,type:s,validate:C.value?T:void 0,schema:N?e:void 0}),P=l.computed(()=>A.value[0]);p&&Wp({value:S,prop:p,handleChange:v,shouldValidate:()=>d&&!B.pendingReset});const F=(W,X=!1)=>{$.touched=!0,X&&L()};async function G(W){var X,fe;if(g!=null&&g.validateSchema){const{results:oe}=await g.validateSchema(W);return(X=oe[l.toValue(k)])!==null&&X!==void 0?X:{valid:!0,errors:[]}}return C.value?vl(S.value,C.value,{name:l.toValue(k),label:l.toValue(c),values:(fe=g==null?void 0:g.values)!==null&&fe!==void 0?fe:{},bails:o}):{valid:!0,errors:[]}}const L=qo(async()=>($.pending=!0,$.validated=!0,G("validated-only")),W=>(B.pendingUnmount[se.id]||(D({errors:W.errors}),$.pending=!1,$.valid=W.valid),W)),I=qo(async()=>G("silent"),W=>($.valid=W.valid,W));function T(W){return(W==null?void 0:W.mode)==="silent"?I():L()}function v(W,X=!0){const fe=Ti(W);j(fe,X)}l.onMounted(()=>{if(i)return L();(!g||!g.validateSchema)&&I()});function M(W){$.touched=W}function V(W){var X;const fe=W&&"value"in W?W.value:x.value;D({value:me(fe),initialValue:me(fe),touched:(X=W==null?void 0:W.touched)!==null&&X!==void 0?X:!1,errors:(W==null?void 0:W.errors)||[]}),$.pending=!1,$.validated=!1,I()}const U=l.getCurrentInstance();function j(W,X=!0){S.value=U&&p?hp(W,U.props.modelModifiers):W,(X?L:I)()}function Q(W){D({errors:Array.isArray(W)?W:[W]})}const de=l.computed({get(){return S.value},set(W){j(W,d)}}),se={id:b,name:k,label:c,value:de,meta:$,errors:A,errorMessage:P,type:s,checkedValue:a,uncheckedValue:u,bails:o,keepValueOnUnmount:h,resetField:V,handleReset:()=>V(),validate:T,handleChange:v,handleBlur:F,setState:D,setTouched:M,setErrors:Q,setValue:j};if(l.provide(dl,se),l.isRef(e)&&typeof l.unref(e)!="function"&&l.watch(e,(W,X)=>{Le(W,X)||($.validated?L():I())},{deep:!0}),process.env.NODE_ENV!=="production"&&(se._vm=l.getCurrentInstance(),l.watch(()=>Object.assign(Object.assign({errors:A.value},$),{value:S.value}),qn,{deep:!0}),g||Vp(se)),!g)return se;const ye=l.computed(()=>{const W=C.value;return!W||Me(W)||Oi(W)||mt(W)||Array.isArray(W)?{}:Object.keys(W).reduce((X,fe)=>{const oe=kp(W[fe]).map(he=>he.__locatorRef).reduce((he,be)=>{const Oe=Ue(g.values,be)||g.values[be];return Oe!==void 0&&(he[be]=Oe),he},{});return Object.assign(X,oe),X},{})});return l.watch(ye,(W,X)=>{if(!Object.keys(W).length)return;!Le(W,X)&&($.validated?L():I())}),l.onBeforeUnmount(()=>{var W;const X=(W=l.toValue(se.keepValueOnUnmount))!==null&&W!==void 0?W:l.toValue(g.keepValuesOnUnmount),fe=l.toValue(k);if(X||!g||B.pendingUnmount[se.id]){g==null||g.removePathState(fe,b);return}B.pendingUnmount[se.id]=!0;const oe=g.getPathState(fe);if(Array.isArray(oe==null?void 0:oe.id)&&(oe!=null&&oe.multiple)?oe!=null&&oe.id.includes(se.id):(oe==null?void 0:oe.id)===se.id){if(oe!=null&&oe.multiple&&Array.isArray(oe.value)){const be=oe.value.findIndex(Oe=>Le(Oe,l.toValue(se.checkedValue)));if(be>-1){const Oe=[...oe.value];Oe.splice(be,1),g.setFieldValue(fe,Oe)}Array.isArray(oe.id)&&oe.id.splice(oe.id.indexOf(se.id),1)}else g.unsetPathValue(l.toValue(k));g.removePathState(fe,b)}}),se}function jp(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||{}))?Go(l.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,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:s??!0,checkedValue:o,syncVModel:a})}function Hp(t,e,n){const r=n!=null&&n.standalone?void 0:Wo(Vr),i=n==null?void 0:n.checkedValue,o=n==null?void 0:n.uncheckedValue;function s(a){const c=a.handleChange,d=l.computed(()=>{const f=l.toValue(a.value),h=l.toValue(i);return Array.isArray(f)?f.findIndex(p=>Le(p,h))>=0:Le(h,f)});function u(f,h=!0){var p,m;if(d.value===((p=f==null?void 0:f.target)===null||p===void 0?void 0:p.checked)){h&&a.validate();return}const y=l.toValue(t),g=r==null?void 0:r.getPathState(y),k=Ti(f);let C=(m=l.toValue(i))!==null&&m!==void 0?m:k;r&&(g!=null&&g.multiple)&&g.type==="checkbox"?C=gl(Ue(r.values,y)||[],C,void 0):(n==null?void 0:n.type)==="checkbox"&&(C=gl(l.toValue(a.value),C,l.toValue(o))),c(C,h)}return Object.assign(Object.assign({},a),{checked:d,checkedValue:i,uncheckedValue:o,handleChange:u})}return s($l(t,e,n))}function Wp({prop:t,value:e,handleChange:n,shouldValidate:r}){const i=l.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&&(l.watch(e,a=>{Le(a,Go(i,o))||i.emit(s,a)}),l.watch(()=>Go(i,o),a=>{if(a===Ci&&e.value===void 0)return;const c=a===Ci?void 0:a;Le(c,e.value)||n(c,r())}))}function Go(t,e){if(t)return t.props[e]}const qp=l.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:()=>xn().bails},label:{type:String,default:void 0},uncheckedValue:{type:null,default:void 0},modelValue:{type:null,default:Ci},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=l.toRef(t,"rules"),r=l.toRef(t,"name"),i=l.toRef(t,"label"),o=l.toRef(t,"uncheckedValue"),s=l.toRef(t,"keepValue"),{errors:a,value:c,errorMessage:d,validate:u,handleChange:f,handleBlur:h,setTouched:p,resetField:m,handleReset:y,meta:g,checked:k,setErrors:C}=Fp(r,n,{validateOnMount:t.validateOnMount,bails:t.bails,standalone:t.standalone,type:e.attrs.type,initialValue:Kp(t,e),checkedValue:e.attrs.value,uncheckedValue:o,label:i,validateOnValueUpdate:t.validateOnModelUpdate,keepValueOnUnmount:s,syncVModel:!0}),N=function(A,B=!0){f(A,B)},b=l.computed(()=>{const{validateOnInput:D,validateOnChange:A,validateOnBlur:B,validateOnModelUpdate:P}=Up(t);function F(T){h(T,B),Me(e.attrs.onBlur)&&e.attrs.onBlur(T)}function G(T){N(T,D),Me(e.attrs.onInput)&&e.attrs.onInput(T)}function L(T){N(T,A),Me(e.attrs.onChange)&&e.attrs.onChange(T)}const I={name:t.name,onBlur:F,onInput:G,onChange:L};return I["onUpdate:modelValue"]=T=>N(T,P),I}),S=l.computed(()=>{const D=Object.assign({},b.value);Ir(e.attrs.type)&&k&&(D.checked=k.value);const A=Nl(t,e);return up(A,e.attrs)&&(D.value=c.value),D}),x=l.computed(()=>Object.assign(Object.assign({},b.value),{modelValue:c.value}));function $(){return{field:S.value,componentField:x.value,value:c.value,meta:g,errors:a.value,errorMessage:d.value,validate:u,resetField:m,handleChange:N,handleInput:D=>N(D,!1),handleReset:y,handleBlur:b.value.onBlur,setTouched:p,setErrors:C}}return e.expose({value:c,meta:g,errors:a,errorMessage:d,setErrors:C,setTouched:p,reset:m,validate:u,handleChange:f}),()=>{const D=l.resolveDynamicComponent(Nl(t,e)),A=Ko(D,e,$);return D?l.h(D,Object.assign(Object.assign({},e.attrs),S.value),A):A}}});function Nl(t,e){let n=t.as||"";return!t.as&&!e.slots.default&&(n="input"),n}function Up(t){var e,n,r,i;const{validateOnInput:o,validateOnChange:s,validateOnBlur:a,validateOnModelUpdate:c}=xn();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:a,validateOnModelUpdate:(i=t.validateOnModelUpdate)!==null&&i!==void 0?i:c}}function Kp(t,e){return Ir(e.attrs.type)?hl(t,"modelValue")?t.modelValue:void 0:hl(t,"modelValue")?t.modelValue:e.attrs.value}const Kn=qp;let Yp=0;const $i=["bails","fieldsCount","id","multiple","type","validate"];function Bl(t){const e=(t==null?void 0:t.initialValues)||{},n=Object.assign({},l.toValue(e)),r=l.unref(t==null?void 0:t.validationSchema);return r&&mt(r)&&Me(r.cast)?me(r.cast(n)||{}):me(n)}function Jp(t){var e;const n=Yp++;let r=0;const i=l.ref(!1),o=l.ref(!1),s=l.ref(0),a=[],c=l.reactive(Bl(t)),d=l.ref([]),u=l.ref({}),f=l.ref({}),h=pp(()=>{f.value=d.value.reduce((E,O)=>(E[Dr(l.toValue(O.path))]=O,E),{})});function p(E,O){const _=T(E);if(!_){typeof E=="string"&&(u.value[Dr(E)]=Uo(O));return}if(typeof E=="string"){const K=Dr(E);u.value[K]&&delete u.value[K]}_.errors=Uo(O),_.valid=!_.errors.length}function m(E){Ke(E).forEach(O=>{p(O,E[O])})}t!=null&&t.initialErrors&&m(t.initialErrors);const y=l.computed(()=>{const E=d.value.reduce((O,_)=>(_.errors.length&&(O[_.path]=_.errors),O),{});return Object.assign(Object.assign({},u.value),E)}),g=l.computed(()=>Ke(y.value).reduce((E,O)=>{const _=y.value[O];return _!=null&&_.length&&(E[O]=_[0]),E},{})),k=l.computed(()=>d.value.reduce((E,O)=>(E[O.path]={name:O.path||"",label:O.label||""},E),{})),C=l.computed(()=>d.value.reduce((E,O)=>{var _;return E[O.path]=(_=O.bails)!==null&&_!==void 0?_:!0,E},{})),N=Object.assign({},(t==null?void 0:t.initialErrors)||{}),b=(e=t==null?void 0:t.keepValuesOnUnmount)!==null&&e!==void 0?e:!1,{initialValues:S,originalInitialValues:x,setInitialValues:$}=Zp(d,c,t),D=Gp(d,c,x,g),A=l.computed(()=>d.value.reduce((E,O)=>{const _=Ue(c,O.path);return Rt(E,O.path,_),E},{})),B=t==null?void 0:t.validationSchema;function P(E,O){var _,K;const te=l.computed(()=>Ue(S.value,l.toValue(E))),w=f.value[l.toValue(E)],z=(O==null?void 0:O.type)==="checkbox"||(O==null?void 0:O.type)==="radio";if(w&&z){w.multiple=!0;const qe=r++;return Array.isArray(w.id)?w.id.push(qe):w.id=[w.id,qe],w.fieldsCount++,w.__flags.pendingUnmount[qe]=!1,w}const Y=l.computed(()=>Ue(c,l.toValue(E))),ee=l.toValue(E),ne=M.findIndex(qe=>qe===ee);ne!==-1&&M.splice(ne,1);const ae=l.computed(()=>{var qe,it,Hn,kn;const _t=l.toValue(B);if(mt(_t))return(it=(qe=_t.describe)===null||qe===void 0?void 0:qe.call(_t,l.toValue(E)).required)!==null&&it!==void 0?it:!1;const Si=l.toValue(O==null?void 0:O.schema);return mt(Si)&&(kn=(Hn=Si.describe)===null||Hn===void 0?void 0:Hn.call(Si).required)!==null&&kn!==void 0?kn:!1}),pe=r++,ve=l.reactive({id:pe,path:E,touched:!1,pending:!1,valid:!0,validated:!!(!((_=N[ee])===null||_===void 0)&&_.length),required:ae,initialValue:te,errors:l.shallowRef([]),bails:(K=O==null?void 0:O.bails)!==null&&K!==void 0?K:!1,label:O==null?void 0:O.label,type:(O==null?void 0:O.type)||"default",value:Y,multiple:!1,__flags:{pendingUnmount:{[pe]:!1},pendingReset:!1},fieldsCount:1,validate:O==null?void 0:O.validate,dirty:l.computed(()=>!Le(l.unref(Y),l.unref(te)))});return d.value.push(ve),f.value[ee]=ve,h(),g.value[ee]&&!N[ee]&&l.nextTick(()=>{ft(ee,{mode:"silent"})}),l.isRef(E)&&l.watch(E,qe=>{h();const it=me(Y.value);f.value[qe]=ve,l.nextTick(()=>{Rt(c,qe,it)})}),ve}const F=yl(Pt,5),G=yl(Pt,5),L=qo(async E=>await(E==="silent"?F():G()),(E,[O])=>{const _=Ke(W.errorBag.value),te=[...new Set([...Ke(E.results),...d.value.map(w=>w.path),..._])].sort().reduce((w,z)=>{var Y;const ee=z,ne=T(ee)||v(ee),ae=((Y=E.results[ee])===null||Y===void 0?void 0:Y.errors)||[],pe=l.toValue(ne==null?void 0:ne.path)||ee,ve=Xp({errors:ae,valid:!ae.length},w.results[pe]);return w.results[pe]=ve,ve.valid||(w.errors[pe]=ve.errors[0]),ne&&u.value[pe]&&delete u.value[pe],ne?(ne.valid=ve.valid,O==="silent"||O==="validated-only"&&!ne.validated||p(ne,ve.errors),w):(p(pe,ae),w)},{valid:E.valid,results:{},errors:{}});return E.values&&(te.values=E.values),Ke(te.results).forEach(w=>{var z;const Y=T(w);Y&&O!=="silent"&&(O==="validated-only"&&!Y.validated||p(Y,(z=te.results[w])===null||z===void 0?void 0:z.errors))}),te});function I(E){d.value.forEach(E)}function T(E){const O=typeof E=="string"?Dr(E):E;return typeof O=="string"?f.value[O]:O}function v(E){return d.value.filter(_=>E.startsWith(_.path)).reduce((_,K)=>_?K.path.length>_.path.length?K:_:K,void 0)}let M=[],V;function U(E){return M.push(E),V||(V=l.nextTick(()=>{[...M].sort().reverse().forEach(_=>{ml(c,_)}),M=[],V=null})),V}function j(E){return function(_,K){return function(w){return w instanceof Event&&(w.preventDefault(),w.stopPropagation()),I(z=>z.touched=!0),i.value=!0,s.value++,vt().then(z=>{const Y=me(c);if(z.valid&&typeof _=="function"){const ee=me(A.value);let ne=E?ee:Y;return z.values&&(ne=z.values),_(ne,{evt:w,controlledValues:ee,setErrors:m,setFieldError:p,setTouched:gn,setFieldTouched:be,setValues:oe,setFieldValue:X,resetForm:Kt,resetField:yn})}!z.valid&&typeof K=="function"&&K({values:Y,evt:w,errors:z.errors,results:z.results})}).then(z=>(i.value=!1,z),z=>{throw i.value=!1,z})}}}const de=j(!1);de.withControlled=j(!0);function se(E,O){const _=d.value.findIndex(te=>te.path===E&&(Array.isArray(te.id)?te.id.includes(O):te.id===O)),K=d.value[_];if(!(_===-1||!K)){if(l.nextTick(()=>{ft(E,{mode:"silent",warn:!1})}),K.multiple&&K.fieldsCount&&K.fieldsCount--,Array.isArray(K.id)){const te=K.id.indexOf(O);te>=0&&K.id.splice(te,1),delete K.__flags.pendingUnmount[O]}(!K.multiple||K.fieldsCount<=0)&&(d.value.splice(_,1),ht(E),h(),delete f.value[E])}}function ye(E){Ke(f.value).forEach(O=>{O.startsWith(E)&&delete f.value[O]}),d.value=d.value.filter(O=>!O.path.startsWith(E)),l.nextTick(()=>{h()})}const W={formId:n,values:c,controlledValues:A,errorBag:y,errors:g,schema:B,submitCount:s,meta:D,isSubmitting:i,isValidating:o,fieldArrays:a,keepValuesOnUnmount:b,validateSchema:l.unref(B)?L:void 0,validate:vt,setFieldError:p,validateField:ft,setFieldValue:X,setValues:oe,setErrors:m,setFieldTouched:be,setTouched:gn,resetForm:Kt,resetField:yn,handleSubmit:de,useFieldModel:$r,defineInputBinds:Nr,defineComponentBinds:Br,defineField:bn,stageInitialValue:It,unsetInitialValue:ht,setFieldInitialValue:Yt,createPathState:P,getPathState:T,unsetPathValue:U,removePathState:se,initialValues:S,getAllPathStates:()=>d.value,destroyPath:ye,isFieldTouched:Oe,isFieldDirty:ut,isFieldValid:Tr};function X(E,O,_=!0){const K=me(O),te=typeof E=="string"?E:E.path;T(te)||P(te),Rt(c,te,K),_&&ft(te)}function fe(E,O=!0){Ke(c).forEach(_=>{delete c[_]}),Ke(E).forEach(_=>{X(_,E[_],!1)}),O&&vt()}function oe(E,O=!0){Ar(c,E),a.forEach(_=>_&&_.reset()),O&&vt()}function he(E,O){const _=T(l.toValue(E))||P(E);return l.computed({get(){return _.value},set(K){var te;const w=l.toValue(E);X(w,K,(te=l.toValue(O))!==null&&te!==void 0?te:!1)}})}function be(E,O){const _=T(E);_&&(_.touched=O)}function Oe(E){const O=T(E);return O?O.touched:d.value.filter(_=>_.path.startsWith(E)).some(_=>_.touched)}function ut(E){const O=T(E);return O?O.dirty:d.value.filter(_=>_.path.startsWith(E)).some(_=>_.dirty)}function Tr(E){const O=T(E);return O?O.valid:d.value.filter(_=>_.path.startsWith(E)).every(_=>_.valid)}function gn(E){if(typeof E=="boolean"){I(O=>{O.touched=E});return}Ke(E).forEach(O=>{be(O,!!E[O])})}function yn(E,O){var _;const K=O&&"value"in O?O.value:Ue(S.value,E),te=T(E);te&&(te.__flags.pendingReset=!0),Yt(E,me(K),!0),X(E,K,!1),be(E,(_=O==null?void 0:O.touched)!==null&&_!==void 0?_:!1),p(E,(O==null?void 0:O.errors)||[]),l.nextTick(()=>{te&&(te.__flags.pendingReset=!1)})}function Kt(E,O){let _=me(E!=null&&E.values?E.values:x.value);_=O!=null&&O.force?_:Ar(x.value,_),_=mt(B)&&Me(B.cast)?B.cast(_):_,$(_),I(K=>{var te;K.__flags.pendingReset=!0,K.validated=!1,K.touched=((te=E==null?void 0:E.touched)===null||te===void 0?void 0:te[K.path])||!1,X(K.path,Ue(_,K.path),!1),p(K.path,void 0)}),O!=null&&O.force?fe(_,!1):oe(_,!1),m((E==null?void 0:E.errors)||{}),s.value=(E==null?void 0:E.submitCount)||0,l.nextTick(()=>{vt({mode:"silent"}),I(K=>{K.__flags.pendingReset=!1})})}async function vt(E){const O=(E==null?void 0:E.mode)||"force";if(O==="force"&&I(w=>w.validated=!0),W.validateSchema)return W.validateSchema(O);o.value=!0;const _=await Promise.all(d.value.map(w=>w.validate?w.validate(E).then(z=>({key:w.path,valid:z.valid,errors:z.errors})):Promise.resolve({key:w.path,valid:!0,errors:[]})));o.value=!1;const K={},te={};for(const w of _)K[w.key]={valid:w.valid,errors:w.errors},w.errors.length&&(te[w.key]=w.errors[0]);return{valid:_.every(w=>w.valid),results:K,errors:te}}async function ft(E,O){var _;const K=T(E);if(K&&(O==null?void 0:O.mode)!=="silent"&&(K.validated=!0),B){const{results:w}=await L((O==null?void 0:O.mode)||"validated-only");return w[E]||{errors:[],valid:!0}}return K!=null&&K.validate?K.validate(O):(!K&&((_=O==null?void 0:O.warn)!==null&&_!==void 0?_:!0)&&process.env.NODE_ENV!=="production"&&l.warn(`field with path ${E} was not found`),Promise.resolve({errors:[],valid:!0}))}function ht(E){ml(S.value,E)}function It(E,O,_=!1){Yt(E,O),Rt(c,E,O),_&&!(t!=null&&t.initialValues)&&Rt(x.value,E,me(O))}function Yt(E,O,_=!1){Rt(S.value,E,me(O)),_&&Rt(x.value,E,me(O))}async function Pt(){const E=l.unref(B);if(!E)return{valid:!0,results:{},errors:{}};o.value=!0;const O=Oi(E)||mt(E)?await Ep(E,c):await Mp(E,c,{names:k.value,bailsMap:C.value});return o.value=!1,O}const jn=de((E,{evt:O})=>{fl(O)&&O.target.submit()});l.onMounted(()=>{if(t!=null&&t.initialErrors&&m(t.initialErrors),t!=null&&t.initialTouched&&gn(t.initialTouched),t!=null&&t.validateOnMount){vt();return}W.validateSchema&&W.validateSchema("silent")}),l.isRef(B)&&l.watch(B,()=>{var E;(E=W.validateSchema)===null||E===void 0||E.call(W,"validated-only")}),l.provide(Vr,W),process.env.NODE_ENV!=="production"&&(Dp(W),l.watch(()=>Object.assign(Object.assign({errors:y.value},D.value),{values:c,isSubmitting:i.value,isValidating:o.value,submitCount:s.value}),qn,{deep:!0}));function bn(E,O){const _=Me(O)||O==null?void 0:O.label,K=T(l.toValue(E))||P(E,{label:_}),te=()=>Me(O)?O(Mi(K,$i)):O||{};function w(){var ae;K.touched=!0,((ae=te().validateOnBlur)!==null&&ae!==void 0?ae:xn().validateOnBlur)&&ft(K.path)}function z(){var ae;((ae=te().validateOnInput)!==null&&ae!==void 0?ae:xn().validateOnInput)&&l.nextTick(()=>{ft(K.path)})}function Y(){var ae;((ae=te().validateOnChange)!==null&&ae!==void 0?ae:xn().validateOnChange)&&l.nextTick(()=>{ft(K.path)})}const ee=l.computed(()=>{const ae={onChange:Y,onInput:z,onBlur:w};return Me(O)?Object.assign(Object.assign({},ae),O(Mi(K,$i)).props||{}):O!=null&&O.props?Object.assign(Object.assign({},ae),O.props(Mi(K,$i))):ae});return[he(E,()=>{var ae,pe,ve;return(ve=(ae=te().validateOnModelUpdate)!==null&&ae!==void 0?ae:(pe=xn())===null||pe===void 0?void 0:pe.validateOnModelUpdate)!==null&&ve!==void 0?ve:!0}),ee]}function $r(E){return Array.isArray(E)?E.map(O=>he(O,!0)):he(E)}function Nr(E,O){const[_,K]=bn(E,O);function te(){K.value.onBlur()}function w(Y){const ee=Ti(Y);X(l.toValue(E),ee,!1),K.value.onInput()}function z(Y){const ee=Ti(Y);X(l.toValue(E),ee,!1),K.value.onChange()}return l.computed(()=>Object.assign(Object.assign({},K.value),{onBlur:te,onInput:w,onChange:z,value:_.value}))}function Br(E,O){const[_,K]=bn(E,O),te=T(l.toValue(E));function w(z){_.value=z}return l.computed(()=>{const z=Me(O)?O(Mi(te,$i)):O||{};return Object.assign({[z.model||"modelValue"]:_.value,[`onUpdate:${z.model||"modelValue"}`]:w},K.value)})}return Object.assign(Object.assign({},W),{values:l.readonly(c),handleReset:()=>Kt(),submitForm:jn})}function Gp(t,e,n,r){const i={touched:"some",pending:"some",valid:"every"},o=l.computed(()=>!Le(e,l.unref(n)));function s(){const c=t.value;return Ke(i).reduce((d,u)=>{const f=i[u];return d[u]=c[f](h=>h[u]),d},{})}const a=l.reactive(s());return l.watchEffect(()=>{const c=s();a.touched=c.touched,a.valid=c.valid,a.pending=c.pending}),l.computed(()=>Object.assign(Object.assign({initialValues:l.unref(n)},a),{valid:a.valid&&!Ke(r.value).length,dirty:o.value}))}function Zp(t,e,n){const r=Bl(n),i=l.ref(r),o=l.ref(me(r));function s(a,c=!1){i.value=Ar(me(i.value)||{},me(a)),o.value=Ar(me(o.value)||{},me(a)),c&&t.value.forEach(d=>{if(d.touched)return;const f=Ue(i.value,d.path);Rt(e,d.path,me(f))})}return{initialValues:i,originalInitialValues:o,setInitialValues:s}}function Xp(t,e){return e?{valid:t.valid&&e.valid,errors:[...t.errors,...e.errors]}:t}const Qp=l.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=l.toRef(t,"validationSchema"),r=l.toRef(t,"keepValues"),{errors:i,errorBag:o,values:s,meta:a,isSubmitting:c,isValidating:d,submitCount:u,controlledValues:f,validate:h,validateField:p,handleReset:m,resetForm:y,handleSubmit:g,setErrors:k,setFieldError:C,setFieldValue:N,setValues:b,setFieldTouched:S,setTouched:x,resetField:$}=Jp({validationSchema:n.value?n:void 0,initialValues:t.initialValues,initialErrors:t.initialErrors,initialTouched:t.initialTouched,validateOnMount:t.validateOnMount,keepValuesOnUnmount:r}),D=g((T,{evt:v})=>{fl(v)&&v.target.submit()},t.onInvalidSubmit),A=t.onSubmit?g(t.onSubmit,t.onInvalidSubmit):D;function B(T){Fo(T)&&T.preventDefault(),m(),typeof e.attrs.onReset=="function"&&e.attrs.onReset()}function P(T,v){return g(typeof T=="function"&&!v?T:v,t.onInvalidSubmit)(T)}function F(){return me(s)}function G(){return me(a.value)}function L(){return me(i.value)}function I(){return{meta:a.value,errors:i.value,errorBag:o.value,values:s,isSubmitting:c.value,isValidating:d.value,submitCount:u.value,controlledValues:f.value,validate:h,validateField:p,handleSubmit:P,handleReset:m,submitForm:D,setErrors:k,setFieldError:C,setFieldValue:N,setValues:b,setFieldTouched:S,setTouched:x,resetForm:y,resetField:$,getValues:F,getMeta:G,getErrors:L}}return e.expose({setFieldError:C,setErrors:k,setFieldValue:N,setValues:b,setFieldTouched:S,setTouched:x,resetForm:y,validate:h,validateField:p,resetField:$,getValues:F,getMeta:G,getErrors:L,values:s,meta:a,errors:i}),function(){const v=t.as==="form"?t.as:t.as?l.resolveDynamicComponent(t.as):null,M=Ko(v,e,I);if(!v)return M;const V=v==="form"?{novalidate:!0}:{};return l.h(v,Object.assign(Object.assign(Object.assign({},V),e.attrs),{onSubmit:A,onReset:B}),M)}}}),em=l.defineComponent({name:"ErrorMessage",props:{as:{type:String,default:void 0},name:{type:String,required:!0}},setup(t,e){const n=l.inject(Vr,void 0),r=l.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?l.resolveDynamicComponent(t.as):t.as,s=Ko(o,e,i),a=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)?l.h(o||"span",a,r.value):l.h(o,a,s)}}});function tm(t){const e=Wo(Vr),n=t?void 0:l.inject(dl);return l.computed(()=>t?e==null?void 0:e.errors.value[l.toValue(t)]:n==null?void 0:n.errorMessage.value)}pt("required",t=>typeof t=="number"&&t!=null||typeof t=="object"&&t!=null||typeof t=="boolean"&&t===!0?!0:!t||!t.length?"This field is required":!0),pt("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"}),pt("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"),pt("no_space",t=>(t==null?void 0:t.indexOf(" "))>-1?"This field shouldn't contain space":!0),pt("minLength",(t,[e])=>!t||!t.length?!0:t.length<e?`This field must be at least ${e} characters`:!0),pt("hasUppercaseLetter",t=>/[A-Z]/.test(t)?!0:"This field must have at least one uppercase character"),pt("hasLowercaseLetter",t=>/[a-z]/.test(t)?!0:"This field must have at least one lowercase character"),pt("hasNumber",t=>/\d/.test(t)?!0:"This field must have at least one number"),pt("hasSpecialCharacter",t=>/[!@$%^&*(),.?":{}|]/.test(t)?!0:"This field must have at least one special character"),pt("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"}),pt("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},nm={},rm={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",fill:"currentColor"},im=[l.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 om(t,e){return l.openBlock(),l.createElementBlock("svg",rm,im)}const sm=ue(nm,[["render",om]]),am={},lm={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",fill:"currentColor"},cm=[l.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 dm(t,e){return l.openBlock(),l.createElementBlock("svg",lm,cm)}const um=ue(am,[["render",dm]]),fm={class:"relative"},Yn=Object.assign({name:"WpicSpinner"},{props:{color:{type:String,default:""}},setup(t){return(e,n)=>(l.openBlock(),l.createElementBlock("div",fm,[l.createVNode(sm,{class:"absolute opacity-25"}),l.createVNode(um,{class:l.normalizeClass(["animate-spin",{[`${t.color}`]:!0}])},null,8,["class"])]))}});let re={theme:"wpic-tools",popoverTarget:"body"};const hm=["is","type","disabled"],pm={key:0,class:"absolute inset-0 flex justify-center items-center"},mm={class:"rounded-lg py-1 min-w-48 bg-white border border-gray-300 dark:bg-gray-930 dark:border-gray-920 shadow-md"},gm=["onClick"],Ni=Object.assign({name:"WpicButton"},{props:{label:String,primary:Boolean,type:{type:String,default:"button"},secondary:Boolean,destructive:Boolean,inverse:Boolean,disabled:Boolean,full:Boolean,loading:Boolean,colorless:Boolean,outline:{type:Boolean,default:!0},medium:Boolean,small:Boolean,plain:Boolean,outlining:Boolean,square:Boolean,to:[String,Object],actions:{}},setup(t){const e=t,n=l.ref(null),r=l.ref(null),i=l.ref(!1),o=l.computed(()=>e.to?"router-link":"div"),s=k=>{r.value&&!r.value.contains(k.target)&&n.value&&!n.value.contains(k.target)&&(i.value=!1)};l.onMounted(()=>{document.addEventListener("click",s)}),l.onUnmounted(()=>{document.removeEventListener("click",s)});const a={pmi:"has-[.medium]:h-10 has-[.medium]:text-sm has-[.small]:h-8 has-[.small]:text-xs h-12","wpic-tools":"rounded-md has-[.medium]:h-8 has-[.medium]:text-sm has-[.small]:h-6 has-[.small]:text-xs h-10"},c={pmi:"","wpic-tools":"bg-transparent text-gray-700 disabled:text-gray-700/50 enabled:hover:bg-gray-900/5 enabled:active:bg-gray-200 enabled:active:shadow-inner dark:enabled:border-gray-900 dark:text-gray-400 dark:enabled:hover:bg-gray-900 dark:enabled:active:bg-gray-930 dark:disabled:text-gray-400/50"},d={pmi:"","wpic-tools":"bg-transparent text-red-600 disabled:text-red-600/50 enabled:hover:bg-red-500/5 enabled:active:bg-red-100 enabled:active:shadow-inner dark:text-red-400 dark:enabled:hover:bg-red-500/10 dark:enabled:active:bg-red-500/25 dark:disabled:text-red-500/50"},u={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":"border-none! bg-linear-to-b bg-lime-500 text-white disabled:text-white/50 border-none shadow-[0_1px_0_0_--theme(--color-white/30%)_inset,0_-1px_1px_0_--theme(--color-black/5%)_inset] enabled:active:shadow-inner enabled:hover:bg-lime-400 enabled:active:text-white/80 dark:shadow-[0_1px_0_0_--theme(--color-white/5%)_inset,0_0_0_1px_--theme(--color-white/2%)_inset] dark:bg-lime-700 dark:enabled:active:shadow-inner dark:enabled:hover:bg-lime-600"},f={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":"border-none! bg-linear-to-b bg-gray-500 text-white disabled:text-white/50 shadow-[0_1px_0_0_--theme(--color-white/30%)_inset,0_-1px_1px_0_--theme(--color-black/5%)_inset] enabled:active:shadow-inner enabled:hover:bg-gray-400 enabled:active:text-white/80 dark:shadow-[0_1px_0_0_--theme(--color-white/5%)_inset,0_0_0_1px_--theme(--color-white/2%)_inset] dark:bg-gray-700 dark:enabled:active:shadow-inner dark:enabled:hover:bg-gray-600"},h={pmi:"","wpic-tools":"border-none! text-white bg-linear-to-b bg-red-500 disabled:text-red-600/50 border-red-500 enabled:hover:bg-red-400 shadow-[0_1px_0_0_--theme(--color-white/30%)_inset,0_-1px_1px_0_--theme(--color-black/5%)_inset] enabled:hover:border-red-600 enabled:active:shadow-inner enabled:active:text-white/80 enabled:active:bg-red-700 enabled:active:border-red-700 dark:bg-red-400/70 dark:border-red-400/70"},p={pmi:"border-zinc-300 dark:border-zinc-700 dark:text-zinc-300","wpic-tools":" text-gray-950 disabled:text-gray-950/50 border-none ring-1 ring-black/5 shadow-xs enabled:hover:bg-gray-50 enabled:active:text-gray-950/60 dark:bg-gray-900 dark:text-white dark:disabled:text-white/50 dark:shadow-[0_1px_0_0_--theme(--color-white/5%)_inset,0_0_0_1px_--theme(--color-white/2%)_inset] enabled:active:shadow-inner dark:hover:bg-gray-800 dark:enabled:active:text-white/80"},m={pmi:"text-violet-800 hover:underline","wpic-tools":"text-lime-800 hover:underline"},y={pmi:"text-red-600 hover:text-red-500 hover:underline","wpic-tools":"text-red-600 disabled:text-red-600/50 hover:text-red-500 dark:text-red-400 dark:hover:text-red-500 hover:underline"},g={pmi:"hover:text-violet-800 hover:underline","wpic-tools":"dark:text-gray-200 hover:text-lime-800 hover:underline"};return(k,C)=>{var N;return l.openBlock(),l.createElementBlock("button",{ref_key:"reference",ref:n,is:o.value,type:t.type,disabled:t.disabled,onClick:C[0]||(C[0]=b=>{var S;return(S=t.actions)!=null&&S.length?i.value=!i.value:null}),class:l.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,[`${a[l.unref(re).theme]}`]:!0,[`${u[l.unref(re).theme]}`]:t.primary&&!t.plain&&!t.inverse,[`${f[l.unref(re).theme]}`]:t.secondary,[`${p[l.unref(re).theme]}`]:!t.primary&&!t.secondary&&!t.plain&&!t.colorless&&!t.destructive,[`${m[l.unref(re).theme]}`]:t.primary&&t.plain,[`${g[l.unref(re).theme]}`]:!t.primary&&!t.destructive&&t.plain,[`${c[l.unref(re).theme]}`]:t.colorless,[`${h[l.unref(re).theme]}`]:t.destructive&&!t.plain&&!t.colorless,[`${y[l.unref(re).theme]}`]:t.destructive&&t.plain,[`${d[l.unref(re).theme]}`]:t.destructive&&t.colorless,"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,"h-auto":t.plain,"rounded-sm":!t.plain,"aspect-square":t.square},"wpic-button leading-none font-medium no-underline appearance-none outline-zinc-600 focus:outline-hidden relative inline-flex justify-center items-center"])},[t.loading?(l.openBlock(),l.createElementBlock("div",pm,[l.createVNode(Yn,{class:"w-6 h-6"})])):l.createCommentVNode("",!0),(l.openBlock(),l.createBlock(l.resolveDynamicComponent(o.value),{to:t.to,class:l.normalizeClass(["flex items-center justify-center select-none whitespace-nowrap py-1 h-full",{medium:t.medium,small:t.small,"opacity-0":t.loading,"px-2":!!(t.small&&!t.plain),"px-3":!!(t.medium&&!t.plain),"px-4":!t.small&&!t.medium&&!t.plain,"px-0! aspect-square":t.square}])},{default:l.withCtx(()=>[l.renderSlot(k.$slots,"default",{},()=>[l.createTextVNode(l.toDisplayString(t.label),1)])]),_:3},8,["to","class"])),(N=t.actions)!=null&&N.length&&i.value?(l.openBlock(),l.createElementBlock("div",{key:1,ref_key:"floating",ref:r,class:"absolute z-30 top-12 left-0"},[l.createElementVNode("div",mm,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(t.actions,b=>(l.openBlock(),l.createElementBlock("div",{onClick:b.value,class:"font-normal h-10 flex items-center px-4 hover:bg-gray-100 dark:hover:bg-white/5"},l.toDisplayString(b.label),9,gm))),256))])],512)):l.createCommentVNode("",!0)],10,hm)}}}),ym=Object.assign({name:"WpicButtonGroup"},{setup(t){const e={pmi:"border","wpic-tools":"border-gray-300"};return(n,r)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["wpic-button-group flex flex-wrap h-10",[e[l.unref(re).theme]]])},[l.renderSlot(n.$slots,"default")],2))}}),bm={name:"WpicInputGroup"},km={class:"wpic-input-group flex w-full"};function xm(t,e,n,r,i,o){return l.openBlock(),l.createElementBlock("div",km,[l.renderSlot(t.$slots,"default")])}const vm=ue(bm,[["render",xm]]),wm=Object.assign({name:"WpicForm"},{setup(t,{expose:e}){const n=l.ref();async function r(){return await n.value.validate()}function i(){n.value.resetForm()}function o(){return n.value}function s(){return n.value.errors}return e({validate:r,resetForm:i,getForm:o,errors:s}),(a,c)=>(l.openBlock(),l.createBlock(l.unref(Qp),{ref_key:"myForm",ref:n},{default:l.withCtx(({values:d,meta:u,errors:f})=>[l.renderSlot(a.$slots,"default")]),_:3},512))}}),Rr=Math.min,Jn=Math.max,Bi=Math.round,Zt=t=>({x:t,y:t}),Sm={left:"right",right:"left",bottom:"top",top:"bottom"},Cm={start:"end",end:"start"};function Zo(t,e,n){return Jn(t,Rr(e,n))}function Lr(t,e){return typeof t=="function"?t(e):t}function vn(t){return t.split("-")[0]}function zr(t){return t.split("-")[1]}function Al(t){return t==="x"?"y":"x"}function Xo(t){return t==="y"?"height":"width"}function Ai(t){return["top","bottom"].includes(vn(t))?"y":"x"}function Qo(t){return Al(Ai(t))}function Om(t,e,n){n===void 0&&(n=!1);const r=zr(t),i=Qo(t),o=Xo(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=Di(s)),[s,Di(s)]}function Em(t){const e=Di(t);return[es(t),e,es(e)]}function es(t){return t.replace(/start|end/g,e=>Cm[e])}function Mm(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 Tm(t,e,n,r){const i=zr(t);let o=Mm(vn(t),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),e&&(o=o.concat(o.map(es)))),o}function Di(t){return t.replace(/left|right|bottom|top/g,e=>Sm[e])}function $m(t){return{top:0,right:0,bottom:0,left:0,...t}}function Dl(t){return typeof t!="number"?$m(t):{top:t,right:t,bottom:t,left:t}}function Vi(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 Vl(t,e,n){let{reference:r,floating:i}=t;const o=Ai(e),s=Qo(e),a=Xo(s),c=vn(e),d=o==="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(c){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(zr(e)){case"start":p[s]-=h*(n&&d?-1:1);break;case"end":p[s]+=h*(n&&d?-1:1);break}return p}const Nm=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(e));let d=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:f}=Vl(d,r,c),h=r,p={},m=0;for(let y=0;y<a.length;y++){const{name:g,fn:k}=a[y],{x:C,y:N,data:b,reset:S}=await k({x:u,y:f,initialPlacement:r,placement:h,strategy:i,middlewareData:p,rects:d,platform:s,elements:{reference:t,floating:e}});u=C??u,f=N??f,p={...p,[g]:{...p[g],...b}},S&&m<=50&&(m++,typeof S=="object"&&(S.placement&&(h=S.placement),S.rects&&(d=S.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:i}):S.rects),{x:u,y:f}=Vl(d,h,c)),y=-1)}return{x:u,y:f,placement:h,strategy:i,middlewareData:p}};async function Il(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:c}=t,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=Lr(e,t),m=Dl(p),g=a[h?f==="floating"?"reference":"floating":f],k=Vi(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(a.floating)),boundary:d,rootBoundary:u,strategy:c})),C=f==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),b=await(o.isElement==null?void 0:o.isElement(N))?await(o.getScale==null?void 0:o.getScale(N))||{x:1,y:1}:{x:1,y:1},S=Vi(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:C,offsetParent:N,strategy:c}):C);return{top:(k.top-S.top+m.top)/b.y,bottom:(S.bottom-k.bottom+m.bottom)/b.y,left:(k.left-S.left+m.left)/b.x,right:(S.right-k.right+m.right)/b.x}}const Bm=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:c}=e,{element:d,padding:u=0}=Lr(t,e)||{};if(d==null)return{};const f=Dl(u),h={x:n,y:r},p=Qo(i),m=Xo(p),y=await s.getDimensions(d),g=p==="y",k=g?"top":"left",C=g?"bottom":"right",N=g?"clientHeight":"clientWidth",b=o.reference[m]+o.reference[p]-h[p]-o.floating[m],S=h[p]-o.reference[p],x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(d));let $=x?x[N]:0;(!$||!await(s.isElement==null?void 0:s.isElement(x)))&&($=a.floating[N]||o.floating[m]);const D=b/2-S/2,A=$/2-y[m]/2-1,B=Rr(f[k],A),P=Rr(f[C],A),F=B,G=$-y[m]-P,L=$/2-y[m]/2+D,I=Zo(F,L,G),T=!c.arrow&&zr(i)!=null&&L!==I&&o.reference[m]/2-(L<F?B:P)-y[m]/2<0,v=T?L<F?L-F:L-G:0;return{[p]:h[p]+v,data:{[p]:I,centerOffset:L-I-v,...T&&{alignmentOffset:v}},reset:T}}}),Am=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:a,platform:c,elements:d}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...g}=Lr(t,e);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const k=vn(i),C=vn(a)===a,N=await(c.isRTL==null?void 0:c.isRTL(d.floating)),b=h||(C||!y?[Di(a)]:Em(a));!h&&m!=="none"&&b.push(...Tm(a,y,m,N));const S=[a,...b],x=await Il(e,g),$=[];let D=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&$.push(x[k]),f){const F=Om(i,s,N);$.push(x[F[0]],x[F[1]])}if(D=[...D,{placement:i,overflows:$}],!$.every(F=>F<=0)){var A,B;const F=(((A=o.flip)==null?void 0:A.index)||0)+1,G=S[F];if(G)return{data:{index:F,overflows:D},reset:{placement:G}};let L=(B=D.filter(I=>I.overflows[0]<=0).sort((I,T)=>I.overflows[1]-T.overflows[1])[0])==null?void 0:B.placement;if(!L)switch(p){case"bestFit":{var P;const I=(P=D.map(T=>[T.placement,T.overflows.filter(v=>v>0).reduce((v,M)=>v+M,0)]).sort((T,v)=>T[1]-v[1])[0])==null?void 0:P[0];I&&(L=I);break}case"initialPlacement":L=a;break}if(i!==L)return{reset:{placement:L}}}return{}}}};async function Dm(t,e){const{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=vn(n),a=zr(n),c=Ai(n)==="y",d=["left","top"].includes(s)?-1:1,u=o&&c?-1:1,f=Lr(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),c?{x:p*u,y:h*d}:{x:h*d,y:p*u}}const Vm=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:a}=e,c=await Dm(e,t);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:o+c.y,data:{...c,placement:s}}}}},Im=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:a={fn:g=>{let{x:k,y:C}=g;return{x:k,y:C}}},...c}=Lr(t,e),d={x:n,y:r},u=await Il(e,c),f=Ai(vn(i)),h=Al(f);let p=d[h],m=d[f];if(o){const g=h==="y"?"top":"left",k=h==="y"?"bottom":"right",C=p+u[g],N=p-u[k];p=Zo(C,p,N)}if(s){const g=f==="y"?"top":"left",k=f==="y"?"bottom":"right",C=m+u[g],N=m-u[k];m=Zo(C,m,N)}const y=a.fn({...e,[h]:p,[f]:m});return{...y,data:{x:y.x-n,y:y.y-r}}}}};function wn(t){return ts(t)?(t.nodeName||"").toLowerCase():"#document"}function Xe(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Xt(t){var e;return(e=(ts(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function ts(t){return t instanceof Node||t instanceof Xe(t).Node}function wt(t){return t instanceof Element||t instanceof Xe(t).Element}function St(t){return t instanceof HTMLElement||t instanceof Xe(t).HTMLElement}function Pl(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Xe(t).ShadowRoot}function Fr(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=gt(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function Pm(t){return["table","td","th"].includes(wn(t))}function ns(t){const e=rs(),n=gt(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 _m(t){let e=Qt(t);for(;St(e)&&!Gn(e);){if(ns(e))return e;e=Qt(e)}return null}function rs(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Gn(t){return["html","body","#document"].includes(wn(t))}function gt(t){return Xe(t).getComputedStyle(t)}function Ii(t){return wt(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Qt(t){if(wn(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Pl(t)&&t.host||Xt(t);return Pl(e)?e.host:e}function _l(t){const e=Qt(t);return Gn(e)?t.ownerDocument?t.ownerDocument.body:t.body:St(e)&&Fr(e)?e:_l(e)}function is(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=_l(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),s=Xe(i);return o?e.concat(s,s.visualViewport||[],Fr(i)?i:[],s.frameElement&&n?is(s.frameElement):[]):e.concat(i,is(i,[],n))}function Rl(t){const e=gt(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=St(t),o=i?t.offsetWidth:n,s=i?t.offsetHeight:r,a=Bi(n)!==o||Bi(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function Ll(t){return wt(t)?t:t.contextElement}function Zn(t){const e=Ll(t);if(!St(e))return Zt(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:o}=Rl(e);let s=(o?Bi(n.width):n.width)/r,a=(o?Bi(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const Rm=Zt(0);function zl(t){const e=Xe(t);return!rs()||!e.visualViewport?Rm:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Lm(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Xe(t)?!1:e}function jr(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),o=Ll(t);let s=Zt(1);e&&(r?wt(r)&&(s=Zn(r)):s=Zn(t));const a=Lm(o,n,r)?zl(o):Zt(0);let c=(i.left+a.x)/s.x,d=(i.top+a.y)/s.y,u=i.width/s.x,f=i.height/s.y;if(o){const h=Xe(o),p=r&&wt(r)?Xe(r):r;let m=h,y=m.frameElement;for(;y&&r&&p!==m;){const g=Zn(y),k=y.getBoundingClientRect(),C=gt(y),N=k.left+(y.clientLeft+parseFloat(C.paddingLeft))*g.x,b=k.top+(y.clientTop+parseFloat(C.paddingTop))*g.y;c*=g.x,d*=g.y,u*=g.x,f*=g.y,c+=N,d+=b,m=Xe(y),y=m.frameElement}}return Vi({width:u,height:f,x:c,y:d})}const zm=[":popover-open",":modal"];function ss(t){return zm.some(e=>{try{return t.matches(e)}catch{return!1}})}function Fm(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const o=i==="fixed",s=Xt(r),a=e?ss(e.floating):!1;if(r===s||a&&o)return n;let c={scrollLeft:0,scrollTop:0},d=Zt(1);const u=Zt(0),f=St(r);if((f||!f&&!o)&&((wn(r)!=="body"||Fr(s))&&(c=Ii(r)),St(r))){const h=jr(r);d=Zn(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+u.x,y:n.y*d.y-c.scrollTop*d.y+u.y}}function jm(t){return Array.from(t.getClientRects())}function Fl(t){return jr(Xt(t)).left+Ii(t).scrollLeft}function Hm(t){const e=Xt(t),n=Ii(t),r=t.ownerDocument.body,i=Jn(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=Jn(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Fl(t);const a=-n.scrollTop;return gt(r).direction==="rtl"&&(s+=Jn(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}function Wm(t,e){const n=Xe(t),r=Xt(t),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,c=0;if(i){o=i.width,s=i.height;const d=rs();(!d||d&&e==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:o,height:s,x:a,y:c}}function qm(t,e){const n=jr(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=St(t)?Zn(t):Zt(1),s=t.clientWidth*o.x,a=t.clientHeight*o.y,c=i*o.x,d=r*o.y;return{width:s,height:a,x:c,y:d}}function jl(t,e,n){let r;if(e==="viewport")r=Wm(t,n);else if(e==="document")r=Hm(Xt(t));else if(wt(e))r=qm(e,n);else{const i=zl(t);r={...e,x:e.x-i.x,y:e.y-i.y}}return Vi(r)}function Hl(t,e){const n=Qt(t);return n===e||!wt(n)||Gn(n)?!1:gt(n).position==="fixed"||Hl(n,e)}function Um(t,e){const n=e.get(t);if(n)return n;let r=is(t,[],!1).filter(a=>wt(a)&&wn(a)!=="body"),i=null;const o=gt(t).position==="fixed";let s=o?Qt(t):t;for(;wt(s)&&!Gn(s);){const a=gt(s),c=ns(s);!c&&a.position==="fixed"&&(i=null),(o?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Fr(s)&&!c&&Hl(t,s))?r=r.filter(u=>u!==s):i=a,s=Qt(s)}return e.set(t,r),r}function Km(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const s=[...n==="clippingAncestors"?ss(e)?[]:Um(e,this._c):[].concat(n),r],a=s[0],c=s.reduce((d,u)=>{const f=jl(e,u,i);return d.top=Jn(f.top,d.top),d.right=Rr(f.right,d.right),d.bottom=Rr(f.bottom,d.bottom),d.left=Jn(f.left,d.left),d},jl(e,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Ym(t){const{width:e,height:n}=Rl(t);return{width:e,height:n}}function Jm(t,e,n){const r=St(e),i=Xt(e),o=n==="fixed",s=jr(t,!0,o,e);let a={scrollLeft:0,scrollTop:0};const c=Zt(0);if(r||!r&&!o)if((wn(e)!=="body"||Fr(i))&&(a=Ii(e)),r){const f=jr(e,!0,o,e);c.x=f.x+e.clientLeft,c.y=f.y+e.clientTop}else i&&(c.x=Fl(i));const d=s.left+a.scrollLeft-c.x,u=s.top+a.scrollTop-c.y;return{x:d,y:u,width:s.width,height:s.height}}function as(t){return gt(t).position==="static"}function Wl(t,e){return!St(t)||gt(t).position==="fixed"?null:e?e(t):t.offsetParent}function ql(t,e){const n=Xe(t);if(ss(t))return n;if(!St(t)){let i=Qt(t);for(;i&&!Gn(i);){if(wt(i)&&!as(i))return i;i=Qt(i)}return n}let r=Wl(t,e);for(;r&&Pm(r)&&as(r);)r=Wl(r,e);return r&&Gn(r)&&as(r)&&!ns(r)?n:r||_m(t)||n}const Gm=async function(t){const e=this.getOffsetParent||ql,n=this.getDimensions,r=await n(t.floating);return{reference:Jm(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Zm(t){return gt(t).direction==="rtl"}const Xm={convertOffsetParentRelativeRectToViewportRelativeRect:Fm,getDocumentElement:Xt,getClippingRect:Km,getOffsetParent:ql,getElementRects:Gm,getClientRects:jm,getDimensions:Ym,getScale:Zn,isElement:wt,isRTL:Zm},Ul=Vm,Kl=Im,Yl=Am,Qm=Bm,Jl=(t,e,n)=>{const r=new Map,i={platform:Xm,...n},o={...i.platform,_c:r};return Nm(t,e,{...i,platform:o})};function eg(t){return t!=null&&typeof t=="object"&&"$el"in t}function tg(t){if(eg(t)){const e=t.$el;return ts(e)&&wn(e)==="#comment"?null:e}return t}function ng(t){return{name:"arrow",options:t,fn(e){const n=tg(l.unref(t.element));return n==null?{}:Qm({element:n,padding:t.padding}).fn(e)}}}const rg={},ig={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},og=[l.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"},null,-1)];function sg(t,e){return l.openBlock(),l.createElementBlock("svg",ig,og)}const Hr=ue(rg,[["render",sg]]);let Pi;const ag=new Uint8Array(16);function lg(){if(!Pi&&(Pi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Pi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Pi(ag)}const Ae=[];for(let t=0;t<256;++t)Ae.push((t+256).toString(16).slice(1));function cg(t,e=0){return Ae[t[e+0]]+Ae[t[e+1]]+Ae[t[e+2]]+Ae[t[e+3]]+"-"+Ae[t[e+4]]+Ae[t[e+5]]+"-"+Ae[t[e+6]]+Ae[t[e+7]]+"-"+Ae[t[e+8]]+Ae[t[e+9]]+"-"+Ae[t[e+10]]+Ae[t[e+11]]+Ae[t[e+12]]+Ae[t[e+13]]+Ae[t[e+14]]+Ae[t[e+15]]}const Gl={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ls(t,e,n){if(Gl.randomUUID&&!t)return Gl.randomUUID();t=t||{};const r=t.random||(t.rng||lg)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,cg(r)}let dg={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 Sn=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:{},maxWidth:{type:String,default:"600px"},expand:Boolean,noCloseClasses:{type:Array,default:()=>[]}},emits:["show","hide"],setup(t,{expose:e,emit:n}){const r=ls(),i=n,o=t,s={pmi:"md:absolute md:block bg-white shadow-[0_5px_30px_0px_rgba(0,0,0,0.25)]","wpic-tools":"block absolute mt-2 bg-white border border-gray-300 dark:bg-gray-930 dark:border-gray-920 shadow-md"},a=l.ref(null),c=l.ref(null),d=l.ref(!0);function u(){o.disabled||(d.value=!1,p()),i("show"),document.dispatchEvent(new CustomEvent("submenu-open",{detail:{uuid:r}}))}function f(k){if(d.value)u();else{if(o.noCloseClasses.some(C=>k.target.closest(`.${C}`)))return;h()}}function h(){i("hide"),document.documentElement.style.overflow=null,document.querySelector("#app").style.overflow=null,d.value=!0}async function p(){const k=await Jl(a.value,c.value,{placement:o.placement,middleware:[Yl(),Kl(),Ul(o.offset)]});c.value.style.left=`${k.x}px`,c.value.style.top=`${k.y}px`}const m=k=>{c.value&&!c.value.contains(k.target)&&a.value&&!a.value.contains(k.target)&&h()};l.onMounted(()=>{document.addEventListener("click",m),document.addEventListener("submenu-open",k=>{k.detail.uuid!==r&&h()})}),l.onUnmounted(()=>{document.removeEventListener("click",m),document.removeEventListener("submenu-open",h)});function y(){o.hover&&u()}function g(){o.hover&&h()}return e({hide:h}),(k,C)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[(l.openBlock(),l.createElementBlock("div",{class:"flex-1",key:`reference_${l.unref(r)}`,ref_key:"reference",ref:a,onMouseenter:y,onMouseleave:g,onClick:C[0]||(C[0]=l.withModifiers(N=>f(N),["stop"]))},[l.renderSlot(k.$slots,"default",{isHidden:d.value})],32)),(l.openBlock(),l.createBlock(l.Teleport,{to:l.unref(re).popoverTarget},[(l.openBlock(),l.createElementBlock("div",{key:`floating_${l.unref(r)}`,ref_key:"floating",ref:c,style:l.normalizeStyle({maxWidth:t.maxWidth}),class:l.normalizeClass(["z-30 rounded-md overflow-hidden",{[`${t.customWidth}`]:!0,hidden:d.value,[`${s[l.unref(re).theme]}`]:!d.value,"rounded-md":!t.custom,"px-3 py-2":!t.custom&&!t.expand}])},[l.renderSlot(k.$slots,"content")],6))],8,["to"]))],64))}}),ug={},fg={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},hg=[l.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4.5 12.75l6 6 9-13.5"},null,-1)];function pg(t,e){return l.openBlock(),l.createElementBlock("svg",fg,hg)}const Zl=ue(ug,[["render",pg]]),mg={},gg={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},yg=[l.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"},null,-1)];function bg(t,e){return l.openBlock(),l.createElementBlock("svg",gg,yg)}const kg=ue(mg,[["render",bg]]),xg={},vg={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},wg=[l.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 Sg(t,e){return l.openBlock(),l.createElementBlock("svg",vg,wg)}const cs=ue(xg,[["render",Sg]]),Cg={key:0,class:"mb-2 wpic-form-label text-base text-gray-500 dark:text-gray-500 flex items-center justify-between"},Og={class:"flex items-center gap-2"},Eg={key:0},Mg={class:""},Tg={class:"flex justify-end"},$g={key:0,class:"absolute dark:text-gray-400 left-0 ml-0 w-9 h-full flex items-center justify-center text-center"},Ng={class:"flex items-center justify-center text-center opacity-50 w-4 h-4 leading-none overflow-hidden"},Bg={key:1,class:"absolute right-0 mr-2 h-full flex items-center cursor-pointer opacity-75 hover:opacity-100"},_i=Object.assign({name:"WpicFormInput"},{props:{label:String,info:String,disabled:Boolean,large:Boolean,small:Boolean,clearable:Boolean,loading:Boolean,invalid:Boolean,slim:Boolean,required:Boolean,hideRequired:Boolean,material:Boolean,naked:Boolean},emits:["onClear","update:modelValue"],setup(t,{emit:e}){const n={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":"text-gray-800 bg-white border-gray-300 focus:border-lime-400 focus-within:border-lime-400 dark:bg-gray-930 dark:border-gray-920 dark:hover:bg-gray-920 dark:text-gray-400"},r={pmi:"border-opacity-50 border-zinc-300 text-zinc-400","wpic-tools":"border-gray-200! text-gray-400! bg-gray-50!"},i=e;function o(){i("onClear")}return(s,a)=>(l.openBlock(),l.createElementBlock("div",null,[t.label?(l.openBlock(),l.createElementBlock("div",Cg,[l.createElementVNode("div",Og,[l.createElementVNode("span",null,l.toDisplayString(t.label),1),t.required&&!t.hideRequired?(l.openBlock(),l.createElementBlock("span",Eg,"*")):l.createCommentVNode("",!0),l.createElementVNode("div",Mg,[t.info?(l.openBlock(),l.createBlock(Sn,{key:0,hover:""},{content:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(t.info),1)]),default:l.withCtx(()=>[l.createVNode(cs,{class:"w-4 h-4 text-zinc-600"})]),_:1})):l.createCommentVNode("",!0)])]),l.createElementVNode("div",Tg,[l.renderSlot(s.$slots,"more")])])):l.createCommentVNode("",!0),l.createElementVNode("div",{class:l.normalizeClass(["wpic-input overflow-auto leading-none flex relative items-center",{"border rounded-sm pr-3":!t.naked,"!pl-0 pr-1 !bg-transparent":t.naked,"border-b":t.material,"pl-4":!s.$slots.prepend,"pl-8":s.$slots.prepend,[`${n[l.unref(re).theme]}`]:!0,"h-8 text-sm":t.small,"h-10":!t.large&&!t.small,"h-12":t.large,[`${r[l.unref(re).theme]}`]:t.disabled,"cursor-pointer":!t.disabled,"border-red-600! focus-within:outline-red-600":t.invalid}])},[s.$slots.prepend?(l.openBlock(),l.createElementBlock("div",$g,[l.createElementVNode("div",Ng,[l.renderSlot(s.$slots,"prepend")])])):l.createCommentVNode("",!0),l.renderSlot(s.$slots,"default"),t.loading?(l.openBlock(),l.createElementBlock("div",Bg,[l.createVNode(Yn,{class:"w-6 h-6 opacity-50"})])):t.clearable?(l.openBlock(),l.createElementBlock("div",{key:2,onClick:l.withModifiers(o,["stop"]),style:{"z-index":"2"},class:"absolute right-0 mr-2 h-full flex items-center cursor-pointer opacity-75 hover:opacity-100"},[l.createVNode(Hr,{class:"w-5 h-5 opacity-50"})])):l.createCommentVNode("",!0)],2)]))}});var Cn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Wr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Ag(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Ri=Ag,Dg=typeof Cn=="object"&&Cn&&Cn.Object===Object&&Cn,Xl=Dg,Vg=Xl,Ig=typeof self=="object"&&self&&self.Object===Object&&self,Pg=Vg||Ig||Function("return this")(),Ct=Pg,_g=Ct,Rg=function(){return _g.Date.now()},Lg=Rg,zg=/\s/;function Fg(t){for(var e=t.length;e--&&zg.test(t.charAt(e)););return e}var jg=Fg,Hg=jg,Wg=/^\s+/;function qg(t){return t&&t.slice(0,Hg(t)+1).replace(Wg,"")}var Ug=qg,Kg=Ct,Yg=Kg.Symbol,ds=Yg,Ql=ds,ec=Object.prototype,Jg=ec.hasOwnProperty,Gg=ec.toString,qr=Ql?Ql.toStringTag:void 0;function Zg(t){var e=Jg.call(t,qr),n=t[qr];try{t[qr]=void 0;var r=!0}catch{}var i=Gg.call(t);return r&&(e?t[qr]=n:delete t[qr]),i}var Xg=Zg,Qg=Object.prototype,e0=Qg.toString;function t0(t){return e0.call(t)}var n0=t0,tc=ds,r0=Xg,i0=n0,o0="[object Null]",s0="[object Undefined]",nc=tc?tc.toStringTag:void 0;function a0(t){return t==null?t===void 0?s0:o0:nc&&nc in Object(t)?r0(t):i0(t)}var Ur=a0;function l0(t){return t!=null&&typeof t=="object"}var Kr=l0,c0=Ur,d0=Kr,u0="[object Symbol]";function f0(t){return typeof t=="symbol"||d0(t)&&c0(t)==u0}var h0=f0,p0=Ug,rc=Ri,m0=h0,ic=NaN,g0=/^[-+]0x[0-9a-f]+$/i,y0=/^0b[01]+$/i,b0=/^0o[0-7]+$/i,k0=parseInt;function x0(t){if(typeof t=="number")return t;if(m0(t))return ic;if(rc(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=rc(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=p0(t);var n=y0.test(t);return n||b0.test(t)?k0(t.slice(2),n?2:8):g0.test(t)?ic:+t}var v0=x0,w0=Ri,us=Lg,oc=v0,S0="Expected a function",C0=Math.max,O0=Math.min;function E0(t,e,n){var r,i,o,s,a,c,d=0,u=!1,f=!1,h=!0;if(typeof t!="function")throw new TypeError(S0);e=oc(e)||0,w0(n)&&(u=!!n.leading,f="maxWait"in n,o=f?C0(oc(n.maxWait)||0,e):o,h="trailing"in n?!!n.trailing:h);function p(x){var $=r,D=i;return r=i=void 0,d=x,s=t.apply(D,$),s}function m(x){return d=x,a=setTimeout(k,e),u?p(x):s}function y(x){var $=x-c,D=x-d,A=e-$;return f?O0(A,o-D):A}function g(x){var $=x-c,D=x-d;return c===void 0||$>=e||$<0||f&&D>=o}function k(){var x=us();if(g(x))return C(x);a=setTimeout(k,y(x))}function C(x){return a=void 0,h&&r?p(x):(r=i=void 0,s)}function N(){a!==void 0&&clearTimeout(a),d=0,r=c=i=a=void 0}function b(){return a===void 0?s:C(us())}function S(){var x=us(),$=g(x);if(r=arguments,i=this,c=x,$){if(a===void 0)return m(c);if(f)return clearTimeout(a),a=setTimeout(k,e),p(c)}return a===void 0&&(a=setTimeout(k,e)),s}return S.cancel=N,S.flush=b,S}var M0=E0;const sc=Wr(M0);function T0(){this.__data__=[],this.size=0}var $0=T0;function N0(t,e){return t===e||t!==t&&e!==e}var ac=N0,B0=ac;function A0(t,e){for(var n=t.length;n--;)if(B0(t[n][0],e))return n;return-1}var Li=A0,D0=Li,V0=Array.prototype,I0=V0.splice;function P0(t){var e=this.__data__,n=D0(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():I0.call(e,n,1),--this.size,!0}var _0=P0,R0=Li;function L0(t){var e=this.__data__,n=R0(e,t);return n<0?void 0:e[n][1]}var z0=L0,F0=Li;function j0(t){return F0(this.__data__,t)>-1}var H0=j0,W0=Li;function q0(t,e){var n=this.__data__,r=W0(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var U0=q0,K0=$0,Y0=_0,J0=z0,G0=H0,Z0=U0;function Xn(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Xn.prototype.clear=K0,Xn.prototype.delete=Y0,Xn.prototype.get=J0,Xn.prototype.has=G0,Xn.prototype.set=Z0;var zi=Xn,X0=zi;function Q0(){this.__data__=new X0,this.size=0}var ey=Q0;function ty(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}var ny=ty;function ry(t){return this.__data__.get(t)}var iy=ry;function oy(t){return this.__data__.has(t)}var sy=oy,ay=Ur,ly=Ri,cy="[object AsyncFunction]",dy="[object Function]",uy="[object GeneratorFunction]",fy="[object Proxy]";function hy(t){if(!ly(t))return!1;var e=ay(t);return e==dy||e==uy||e==cy||e==fy}var lc=hy,py=Ct,my=py["__core-js_shared__"],gy=my,fs=gy,cc=function(){var t=/[^.]+$/.exec(fs&&fs.keys&&fs.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function yy(t){return!!cc&&cc in t}var by=yy,ky=Function.prototype,xy=ky.toString;function vy(t){if(t!=null){try{return xy.call(t)}catch{}try{return t+""}catch{}}return""}var dc=vy,wy=lc,Sy=by,Cy=Ri,Oy=dc,Ey=/[\\^$.*+?()[\]{}|]/g,My=/^\[object .+?Constructor\]$/,Ty=Function.prototype,$y=Object.prototype,Ny=Ty.toString,By=$y.hasOwnProperty,Ay=RegExp("^"+Ny.call(By).replace(Ey,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Dy(t){if(!Cy(t)||Sy(t))return!1;var e=wy(t)?Ay:My;return e.test(Oy(t))}var Vy=Dy;function Iy(t,e){return t==null?void 0:t[e]}var Py=Iy,_y=Vy,Ry=Py;function Ly(t,e){var n=Ry(t,e);return _y(n)?n:void 0}var Qn=Ly,zy=Qn,Fy=Ct,jy=zy(Fy,"Map"),hs=jy,Hy=Qn,Wy=Hy(Object,"create"),Fi=Wy,uc=Fi;function qy(){this.__data__=uc?uc(null):{},this.size=0}var Uy=qy;function Ky(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Yy=Ky,Jy=Fi,Gy="__lodash_hash_undefined__",Zy=Object.prototype,Xy=Zy.hasOwnProperty;function Qy(t){var e=this.__data__;if(Jy){var n=e[t];return n===Gy?void 0:n}return Xy.call(e,t)?e[t]:void 0}var eb=Qy,tb=Fi,nb=Object.prototype,rb=nb.hasOwnProperty;function ib(t){var e=this.__data__;return tb?e[t]!==void 0:rb.call(e,t)}var ob=ib,sb=Fi,ab="__lodash_hash_undefined__";function lb(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=sb&&e===void 0?ab:e,this}var cb=lb,db=Uy,ub=Yy,fb=eb,hb=ob,pb=cb;function er(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}er.prototype.clear=db,er.prototype.delete=ub,er.prototype.get=fb,er.prototype.has=hb,er.prototype.set=pb;var mb=er,fc=mb,gb=zi,yb=hs;function bb(){this.size=0,this.__data__={hash:new fc,map:new(yb||gb),string:new fc}}var kb=bb;function xb(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var vb=xb,wb=vb;function Sb(t,e){var n=t.__data__;return wb(e)?n[typeof e=="string"?"string":"hash"]:n.map}var ji=Sb,Cb=ji;function Ob(t){var e=Cb(this,t).delete(t);return this.size-=e?1:0,e}var Eb=Ob,Mb=ji;function Tb(t){return Mb(this,t).get(t)}var $b=Tb,Nb=ji;function Bb(t){return Nb(this,t).has(t)}var Ab=Bb,Db=ji;function Vb(t,e){var n=Db(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}var Ib=Vb,Pb=kb,_b=Eb,Rb=$b,Lb=Ab,zb=Ib;function tr(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}tr.prototype.clear=Pb,tr.prototype.delete=_b,tr.prototype.get=Rb,tr.prototype.has=Lb,tr.prototype.set=zb;var hc=tr,Fb=zi,jb=hs,Hb=hc,Wb=200;function qb(t,e){var n=this.__data__;if(n instanceof Fb){var r=n.__data__;if(!jb||r.length<Wb-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Hb(r)}return n.set(t,e),this.size=n.size,this}var Ub=qb,Kb=zi,Yb=ey,Jb=ny,Gb=iy,Zb=sy,Xb=Ub;function nr(t){var e=this.__data__=new Kb(t);this.size=e.size}nr.prototype.clear=Yb,nr.prototype.delete=Jb,nr.prototype.get=Gb,nr.prototype.has=Zb,nr.prototype.set=Xb;var Qb=nr,e1="__lodash_hash_undefined__";function t1(t){return this.__data__.set(t,e1),this}var n1=t1;function r1(t){return this.__data__.has(t)}var i1=r1,o1=hc,s1=n1,a1=i1;function Hi(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new o1;++e<n;)this.add(t[e])}Hi.prototype.add=Hi.prototype.push=s1,Hi.prototype.has=a1;var l1=Hi;function c1(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var d1=c1;function u1(t,e){return t.has(e)}var f1=u1,h1=l1,p1=d1,m1=f1,g1=1,y1=2;function b1(t,e,n,r,i,o){var s=n&g1,a=t.length,c=e.length;if(a!=c&&!(s&&c>a))return!1;var d=o.get(t),u=o.get(e);if(d&&u)return d==e&&u==t;var f=-1,h=!0,p=n&y1?new h1:void 0;for(o.set(t,e),o.set(e,t);++f<a;){var m=t[f],y=e[f];if(r)var g=s?r(y,m,f,e,t,o):r(m,y,f,t,e,o);if(g!==void 0){if(g)continue;h=!1;break}if(p){if(!p1(e,function(k,C){if(!m1(p,C)&&(m===k||i(m,k,n,r,o)))return p.push(C)})){h=!1;break}}else if(!(m===y||i(m,y,n,r,o))){h=!1;break}}return o.delete(t),o.delete(e),h}var pc=b1,k1=Ct,x1=k1.Uint8Array,v1=x1;function w1(t){var e=-1,n=Array(t.size);return t.forEach(function(r,i){n[++e]=[i,r]}),n}var S1=w1;function C1(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}var O1=C1,mc=ds,gc=v1,E1=ac,M1=pc,T1=S1,$1=O1,N1=1,B1=2,A1="[object Boolean]",D1="[object Date]",V1="[object Error]",I1="[object Map]",P1="[object Number]",_1="[object RegExp]",R1="[object Set]",L1="[object String]",z1="[object Symbol]",F1="[object ArrayBuffer]",j1="[object DataView]",yc=mc?mc.prototype:void 0,ps=yc?yc.valueOf:void 0;function H1(t,e,n,r,i,o,s){switch(n){case j1:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case F1:return!(t.byteLength!=e.byteLength||!o(new gc(t),new gc(e)));case A1:case D1:case P1:return E1(+t,+e);case V1:return t.name==e.name&&t.message==e.message;case _1:case L1:return t==e+"";case I1:var a=T1;case R1:var c=r&N1;if(a||(a=$1),t.size!=e.size&&!c)return!1;var d=s.get(t);if(d)return d==e;r|=B1,s.set(t,e);var u=M1(a(t),a(e),r,i,o,s);return s.delete(t),u;case z1:if(ps)return ps.call(t)==ps.call(e)}return!1}var W1=H1;function q1(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}var U1=q1,K1=Array.isArray,ms=K1,Y1=U1,J1=ms;function G1(t,e,n){var r=e(t);return J1(t)?r:Y1(r,n(t))}var Z1=G1;function X1(t,e){for(var n=-1,r=t==null?0:t.length,i=0,o=[];++n<r;){var s=t[n];e(s,n,t)&&(o[i++]=s)}return o}var Q1=X1;function ek(){return[]}var tk=ek,nk=Q1,rk=tk,ik=Object.prototype,ok=ik.propertyIsEnumerable,bc=Object.getOwnPropertySymbols,sk=bc?function(t){return t==null?[]:(t=Object(t),nk(bc(t),function(e){return ok.call(t,e)}))}:rk,ak=sk;function lk(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}var ck=lk,dk=Ur,uk=Kr,fk="[object Arguments]";function hk(t){return uk(t)&&dk(t)==fk}var pk=hk,kc=pk,mk=Kr,xc=Object.prototype,gk=xc.hasOwnProperty,yk=xc.propertyIsEnumerable,bk=kc(function(){return arguments}())?kc:function(t){return mk(t)&&gk.call(t,"callee")&&!yk.call(t,"callee")},kk=bk,Wi={exports:{}};function xk(){return!1}var vk=xk;Wi.exports,function(t,e){var n=Ct,r=vk,i=e&&!e.nodeType&&e,o=i&&!0&&t&&!t.nodeType&&t,s=o&&o.exports===i,a=s?n.Buffer:void 0,c=a?a.isBuffer:void 0,d=c||r;t.exports=d}(Wi,Wi.exports);var vc=Wi.exports,wk=9007199254740991,Sk=/^(?:0|[1-9]\d*)$/;function Ck(t,e){var n=typeof t;return e=e??wk,!!e&&(n=="number"||n!="symbol"&&Sk.test(t))&&t>-1&&t%1==0&&t<e}var Ok=Ck,Ek=9007199254740991;function Mk(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Ek}var wc=Mk,Tk=Ur,$k=wc,Nk=Kr,Bk="[object Arguments]",Ak="[object Array]",Dk="[object Boolean]",Vk="[object Date]",Ik="[object Error]",Pk="[object Function]",_k="[object Map]",Rk="[object Number]",Lk="[object Object]",zk="[object RegExp]",Fk="[object Set]",jk="[object String]",Hk="[object WeakMap]",Wk="[object ArrayBuffer]",qk="[object DataView]",Uk="[object Float32Array]",Kk="[object Float64Array]",Yk="[object Int8Array]",Jk="[object Int16Array]",Gk="[object Int32Array]",Zk="[object Uint8Array]",Xk="[object Uint8ClampedArray]",Qk="[object Uint16Array]",ex="[object Uint32Array]",ke={};ke[Uk]=ke[Kk]=ke[Yk]=ke[Jk]=ke[Gk]=ke[Zk]=ke[Xk]=ke[Qk]=ke[ex]=!0,ke[Bk]=ke[Ak]=ke[Wk]=ke[Dk]=ke[qk]=ke[Vk]=ke[Ik]=ke[Pk]=ke[_k]=ke[Rk]=ke[Lk]=ke[zk]=ke[Fk]=ke[jk]=ke[Hk]=!1;function tx(t){return Nk(t)&&$k(t.length)&&!!ke[Tk(t)]}var nx=tx;function rx(t){return function(e){return t(e)}}var ix=rx,qi={exports:{}};qi.exports,function(t,e){var n=Xl,r=e&&!e.nodeType&&e,i=r&&!0&&t&&!t.nodeType&&t,o=i&&i.exports===r,s=o&&n.process,a=function(){try{var c=i&&i.require&&i.require("util").types;return c||s&&s.binding&&s.binding("util")}catch{}}();t.exports=a}(qi,qi.exports);var ox=qi.exports,sx=nx,ax=ix,Sc=ox,Cc=Sc&&Sc.isTypedArray,lx=Cc?ax(Cc):sx,Oc=lx,cx=ck,dx=kk,ux=ms,fx=vc,hx=Ok,px=Oc,mx=Object.prototype,gx=mx.hasOwnProperty;function yx(t,e){var n=ux(t),r=!n&&dx(t),i=!n&&!r&&fx(t),o=!n&&!r&&!i&&px(t),s=n||r||i||o,a=s?cx(t.length,String):[],c=a.length;for(var d in t)(e||gx.call(t,d))&&!(s&&(d=="length"||i&&(d=="offset"||d=="parent")||o&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||hx(d,c)))&&a.push(d);return a}var bx=yx,kx=Object.prototype;function xx(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||kx;return t===n}var vx=xx;function wx(t,e){return function(n){return t(e(n))}}var Sx=wx,Cx=Sx,Ox=Cx(Object.keys,Object),Ex=Ox,Mx=vx,Tx=Ex,$x=Object.prototype,Nx=$x.hasOwnProperty;function Bx(t){if(!Mx(t))return Tx(t);var e=[];for(var n in Object(t))Nx.call(t,n)&&n!="constructor"&&e.push(n);return e}var Ax=Bx,Dx=lc,Vx=wc;function Ix(t){return t!=null&&Vx(t.length)&&!Dx(t)}var Px=Ix,_x=bx,Rx=Ax,Lx=Px;function zx(t){return Lx(t)?_x(t):Rx(t)}var Fx=zx,jx=Z1,Hx=ak,Wx=Fx;function qx(t){return jx(t,Wx,Hx)}var Ux=qx,Ec=Ux,Kx=1,Yx=Object.prototype,Jx=Yx.hasOwnProperty;function Gx(t,e,n,r,i,o){var s=n&Kx,a=Ec(t),c=a.length,d=Ec(e),u=d.length;if(c!=u&&!s)return!1;for(var f=c;f--;){var h=a[f];if(!(s?h in e:Jx.call(e,h)))return!1}var p=o.get(t),m=o.get(e);if(p&&m)return p==e&&m==t;var y=!0;o.set(t,e),o.set(e,t);for(var g=s;++f<c;){h=a[f];var k=t[h],C=e[h];if(r)var N=s?r(C,k,h,e,t,o):r(k,C,h,t,e,o);if(!(N===void 0?k===C||i(k,C,n,r,o):N)){y=!1;break}g||(g=h=="constructor")}if(y&&!g){var b=t.constructor,S=e.constructor;b!=S&&"constructor"in t&&"constructor"in e&&!(typeof b=="function"&&b instanceof b&&typeof S=="function"&&S instanceof S)&&(y=!1)}return o.delete(t),o.delete(e),y}var Zx=Gx,Xx=Qn,Qx=Ct,ev=Xx(Qx,"DataView"),tv=ev,nv=Qn,rv=Ct,iv=nv(rv,"Promise"),ov=iv,sv=Qn,av=Ct,lv=sv(av,"Set"),cv=lv,dv=Qn,uv=Ct,fv=dv(uv,"WeakMap"),hv=fv,gs=tv,ys=hs,bs=ov,ks=cv,xs=hv,Mc=Ur,rr=dc,Tc="[object Map]",pv="[object Object]",$c="[object Promise]",Nc="[object Set]",Bc="[object WeakMap]",Ac="[object DataView]",mv=rr(gs),gv=rr(ys),yv=rr(bs),bv=rr(ks),kv=rr(xs),On=Mc;(gs&&On(new gs(new ArrayBuffer(1)))!=Ac||ys&&On(new ys)!=Tc||bs&&On(bs.resolve())!=$c||ks&&On(new ks)!=Nc||xs&&On(new xs)!=Bc)&&(On=function(t){var e=Mc(t),n=e==pv?t.constructor:void 0,r=n?rr(n):"";if(r)switch(r){case mv:return Ac;case gv:return Tc;case yv:return $c;case bv:return Nc;case kv:return Bc}return e});var xv=On,vs=Qb,vv=pc,wv=W1,Sv=Zx,Dc=xv,Vc=ms,Ic=vc,Cv=Oc,Ov=1,Pc="[object Arguments]",_c="[object Array]",Ui="[object Object]",Ev=Object.prototype,Rc=Ev.hasOwnProperty;function Mv(t,e,n,r,i,o){var s=Vc(t),a=Vc(e),c=s?_c:Dc(t),d=a?_c:Dc(e);c=c==Pc?Ui:c,d=d==Pc?Ui:d;var u=c==Ui,f=d==Ui,h=c==d;if(h&&Ic(t)){if(!Ic(e))return!1;s=!0,u=!1}if(h&&!u)return o||(o=new vs),s||Cv(t)?vv(t,e,n,r,i,o):wv(t,e,c,n,r,i,o);if(!(n&Ov)){var p=u&&Rc.call(t,"__wrapped__"),m=f&&Rc.call(e,"__wrapped__");if(p||m){var y=p?t.value():t,g=m?e.value():e;return o||(o=new vs),i(y,g,n,r,o)}}return h?(o||(o=new vs),Sv(t,e,n,r,i,o)):!1}var Tv=Mv,$v=Tv,Lc=Kr;function zc(t,e,n,r,i){return t===e?!0:t==null||e==null||!Lc(t)&&!Lc(e)?t!==t&&e!==e:$v(t,e,n,r,zc,i)}var Nv=zc,Bv=Nv;function Av(t,e){return Bv(t,e)}var Dv=Av;const Fc=Wr(Dv),Vv={key:0,class:"leading-none"},Iv={key:1},Pv={class:"flex flex-col max-h-80 overflow-y-auto"},_v={key:0,class:"p-3"},Rv={key:1},Lv={key:0,class:"px-4 py-2 flex items-center justify-between text-sm gap-6 dark:text-gray-400"},zv=["onClick"],Fv={class:"select-none flex w-full items-center justify-between"},jc=Object.assign({name:"WpicChoiceList"},{props:{modelValue:{},value:{},name:String,small:Boolean,hideSelect:Boolean,label:String,placeholder:{type:String,default:"Select..."},options:Array,multiple:Boolean,required:Boolean,disabled:Boolean,isInvalid:Boolean,maxDisplay:{type:Number},batchSelect:{type:Boolean,default:!1},allSelectedText:String,filterable:Boolean,remoteMethod:{},noDataText:String,clearable:Boolean,debounce:{type:Number,default:0},loading:Boolean,material:Boolean,naked:Boolean},emits:["blur-sm","input","change","update:modelValue"],setup(t,{expose:e,emit:n}){const r=t,i=l.ref(!1),o=l.ref(r.options);l.watch(()=>r.options,()=>{var b;(b=r.options)!=null&&b.length&&(o.value=[...r.options])},{immediate:!0,deep:!0});const s=n,a=l.ref(),c=l.ref();function d(b){var S,x;if(r.multiple){if(b){let $=r.modelValue||[];$.indexOf(b)>=0?$.splice($.indexOf(b),1):$.push(b),s("update:modelValue",$),p($),((S=r.modelValue)==null?void 0:S.length)===((x=r.options)==null?void 0:x.length)?i.value=!0:i.value=!1}}else s("update:modelValue",b),p(b),a.value=null,c.value.hide()}async function u(b){var S,x;s("update:modelValue",b),p(b),await l.nextTick(),((S=r.modelValue)==null?void 0:S.length)===((x=r.options)==null?void 0:x.length)&&(i.value=!0)}function f(b){s("update:modelValue",b),i.value=!1,p(b)}function h(){i.value=!1,r.multiple?(s("update:modelValue",[]),p([])):(s("update:modelValue",null),p(null))}const p=sc(function(b){s("change",b)},r.debounce),m=l.computed(()=>{var b,S,x,$;if(r.multiple)if(r.maxDisplay){let D=(S=o.value)==null?void 0:S.filter(B=>{var P;return((P=r.modelValue)==null?void 0:P.indexOf(B.value))>=0}).map(B=>B.label),A=D==null?void 0:D.slice(0,r.maxDisplay);return(D==null?void 0:D.length)-(A==null?void 0:A.length)>0?(A==null?void 0:A.join(", "))+` (+${(D==null?void 0:D.length)-A.length})`:A==null?void 0:A.join(", ")}else return(b=o.value)==null?void 0:b.filter(D=>{var A;return((A=r.modelValue)==null?void 0:A.indexOf(D.value))>=0}).map(D=>D.label).join(", ");else return(($=(x=o.value)==null?void 0:x.find(D=>D.value===r.modelValue))==null?void 0:$.label)||r.modelValue});function y(b){var S;try{return r.multiple?r.modelValue!==null&&((S=r.modelValue)==null?void 0:S.some(x=>Fc(x,b))):r.modelValue!==null&&Fc(b,r.modelValue)}catch(x){return console.log(x),!1}}const g={pmi:"group-[.is-selected]:bg-violet-50 hover:group-[.is-selected]:bg-violet-100","wpic-tools":"hover:bg-gray-50 group-[.is-selected]:text-lime-500 group-[.is-selected]:font-medium text-gray-600 dark:hover:bg-white/5 dark:text-gray-400 dark:group-[.is-selected]:text-lime-700"},k=l.computed(()=>{var b,S;return((b=r.modelValue)==null?void 0:b.length)===((S=r.options)==null?void 0:S.length)}),C=l.computed(()=>{var b;if(r.filterable&&!r.remoteMethod&&((b=a.value)!=null&&b.trim().length)){const S=a.value.trim().toLowerCase();return r.options.filter(x=>{var $;return($=x.label)==null?void 0:$.toLowerCase().includes(S)})}return r.options});function N(){r.remoteMethod&&r.remoteMethod(a.value)}return e({allSelected:i,isAllSelected:k}),(b,S)=>(l.openBlock(),l.createBlock(Sn,{custom:"",ref_key:"myPopover",ref:c,label:t.label,disabled:t.disabled},{default:l.withCtx(({isHidden:x})=>[l.createVNode(_i,{material:t.material,naked:t.naked,disabled:t.disabled,small:t.small,invalid:t.isInvalid,loading:t.loading},{default:l.withCtx(()=>{var $,D,A,B,P,F;return[l.createElementVNode("span",{class:l.normalizeClass(["select-none w-full text-left flex-1",{"whitespace-pre":!t.multiple}])},[t.modelValue&&(!t.multiple||t.multiple&&(($=t.modelValue)==null?void 0:$.length)>0)&&!t.hideSelect?(l.openBlock(),l.createElementBlock("span",Vv,[k.value&&((D=t.allSelectedText)!=null&&D.length)?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[l.createTextVNode(l.toDisplayString(t.allSelectedText)+" ("+l.toDisplayString((A=t.options)==null?void 0:A.length)+")",1)],64)):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[l.createTextVNode(l.toDisplayString(m.value),1)],64))])):!t.multiple&&((B=t.options)!=null&&B.find(G=>G.value===null))?(l.openBlock(),l.createElementBlock("span",Iv,l.toDisplayString((F=(P=t.options)==null?void 0:P.find(G=>G.value===null))==null?void 0:F.label),1)):l.renderSlot(b.$slots,"default",{key:2},()=>[l.createTextVNode(l.toDisplayString(t.placeholder),1)])],2),t.modelValue&&t.clearable?(l.openBlock(),l.createElementBlock("div",{key:0,onClick:l.withModifiers(h,["stop"]),style:{"z-index":"2"},class:"absolute right-6 mr-3 h-full flex items-center cursor-pointer opacity-75 hover:opacity-100"},[l.createVNode(Hr,{class:"w-4 h-4"})])):l.createCommentVNode("",!0),l.createVNode(kg,{class:l.normalizeClass(["h-4 w-4 transition-all transform",{"rotate-180":!x}])},null,8,["class"])]}),_:2},1032,["material","naked","disabled","small","invalid","loading"])]),content:l.withCtx(()=>{var x;return[l.createElementVNode("div",Pv,[t.filterable?(l.openBlock(),l.createElementBlock("div",_v,[l.createVNode(qc,{slim:"",placeholder:"Search...",clearable:"",modelValue:a.value,"onUpdate:modelValue":[S[0]||(S[0]=$=>a.value=$),N]},null,8,["modelValue"])])):l.createCommentVNode("",!0),!t.options&&((x=t.options)==null?void 0:x.length)==0?(l.openBlock(),l.createElementBlock("span",Rv,"No data.")):(l.openBlock(),l.createElementBlock(l.Fragment,{key:2},[t.multiple&&t.batchSelect?(l.openBlock(),l.createElementBlock("div",Lv,[l.createElementVNode("span",{class:"cursor-pointer opacity-50 hover:opacity-100",onClick:S[1]||(S[1]=$=>{var D;return u((D=C.value)==null?void 0:D.filter(A=>A.value).map(A=>A.value))})},"Select all"),l.createElementVNode("span",{class:"cursor-pointer opacity-50 hover:opacity-100",onClick:S[2]||(S[2]=$=>f([]))},"Select none")])):l.createCommentVNode("",!0),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(C.value,$=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["group",{"is-selected":!!y($.value)}])},[l.createElementVNode("div",{class:l.normalizeClass(["flex items-center py-2 px-4 min-w-64 text-base",{"cursor-pointer":!t.multiple||$.value,[`${g[l.unref(re).theme]}`]:!0}]),onClick:D=>$.disabled?null:d($.value)},[l.createElementVNode("div",Fv,[l.createElementVNode("span",{class:l.normalizeClass(["",{"opacity-25":$.disabled}])},l.toDisplayString($.label||$.value),3),t.multiple&&y($.value)?(l.openBlock(),l.createBlock(Zl,{key:0,class:"w-4 h-4"})):l.createCommentVNode("",!0)])],10,zv)],2))),256))],64))])]}),_:3},8,["label","disabled"]))}}),Hc={__name:"ToggleSwitch",props:{modelValue:Boolean,label:String},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e;function i(){r("update:modelValue",!n.modelValue)}return(o,s)=>(l.openBlock(),l.createElementBlock("div",{class:"inline-flex items-center gap-3 cursor-pointer select-none",onClick:i},[l.createElementVNode("div",{class:l.normalizeClass(["w-11 h-6 rounded-full shadow-inner flex items-center transition-all duration-100",{"bg-lime-500 dark:bg-lime-600":t.modelValue,"bg-gray-300 dark:bg-gray-800":!t.modelValue}])},[l.createElementVNode("div",{class:l.normalizeClass(["w-5 h-5 rounded-full bg-white dark:bg-gray-500 shadow-md transition-all duration-100 transform",{"translate-x-[calc(100%+3px)] dark:!bg-gray-200":t.modelValue,"translate-x-px":!t.modelValue}])},null,2)],2),l.createElementVNode("span",{class:l.normalizeClass({"text-gray-500":!t.modelValue,"text-gray-700 dark:text-gray-300":t.modelValue})},l.toDisplayString(t.label),3)]))}},jv={key:0,class:"mb-2 gap-2 wpic-form-label text-base text-zinc-600 dark:text-zinc-300 flex items-center"},Hv={class:""},Wv=["value","disabled","rows","placeholder"],Wc=Object.assign({name:"WpicTextarea"},{props:{modelValue:{},label:String,disabled:Boolean,noResize:Boolean,autoResize:Boolean,placeholder:String,isInvalid:Boolean,required:Boolean,minHeight:{type:[String,Number],default:50},maxHeight:{type:[String,Number],default:300},rows:{type:[String,Number],default:3}},emits:["update:modelValue"],setup(t,{expose:e,emit:n}){const r=t,i=l.ref(null),o=l.ref(!1);l.watch(()=>r.modelValue,d=>{i.value.style.height="auto",r.autoResize&&l.nextTick(()=>{r.minHeight&&(i.value.style.height=`${i.value.scrollHeight<r.minHeight?r.minHeight:i.value.scrollHeight}px`),r.maxHeight&&(i.value.scrollHeight>r.maxHeight?(i.value.style.height=`${r.maxHeight}px`,o.value=!0):o.value=!1)})},{deep:!0});const s=n;function a(d){s("update:modelValue",d==null?void 0:d.target.value)}function c(){i.value.focus()}return e({focus:c}),(d,u)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[t.label?(l.openBlock(),l.createElementBlock("div",jv,[l.createTextVNode(l.toDisplayString(t.label)+" ",1),l.createElementVNode("div",Hv,[d.info?(l.openBlock(),l.createBlock(Sn,{key:0,hover:""},{content:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(d.info),1)]),default:l.withCtx(()=>[l.createVNode(cs,{class:"w-4 h-4 text-zinc-600"})]),_:1})):l.createCommentVNode("",!0)])])):l.createCommentVNode("",!0),l.createElementVNode("textarea",{ref_key:"myTextarea",ref:i,class:l.normalizeClass(["relative appearance-none outline-hidden flex w-full h-full rounded-sm px-4 py-2 bg-transparent opacity-100 active:border-lime-400 focus:border-lime-400 focus-visible:border-none placeholder:opacity-30 dark:text-gray-400",{"cursor-not-allowed":t.disabled,"resize-none":t.noResize,"overflow-hidden":t.autoResize&&!o.value,"overflow-auto":t.autoResize||o.value}]),style:l.normalizeStyle({"min-height":t.autoResize&&`${t.minHeight}px`,maxHeight:t.autoResize&&`${t.maxHeight}px`}),value:t.modelValue,disabled:t.disabled,rows:t.rows,onInput:a,placeholder:t.placeholder},null,46,Wv)],64))}}),qv={},Uv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},Kv=[l.createElementVNode("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"},null,-1),l.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 Yv(t,e){return l.openBlock(),l.createElementBlock("svg",Uv,Kv)}const Jv=ue(qv,[["render",Yv]]),Gv={},Zv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},Xv=[l.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),l.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),l.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 Qv(t,e){return l.openBlock(),l.createElementBlock("svg",Zv,Xv)}const ew=ue(Gv,[["render",Qv]]),tw={},nw={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},rw=[l.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 12h-15"},null,-1)];function iw(t,e){return l.openBlock(),l.createElementBlock("svg",nw,rw)}const ow=ue(tw,[["render",iw]]),sw={class:"flex items-center gap-2"},aw={key:0},lw={class:""},cw=["innerHTML"],dw={class:"flex justify-end"},uw=["name","value","checked"],fw={class:"flex items-center justify-center text-center opacity-50 w-4 h-4 leading-none"},hw={key:5,class:"absolute z-10 right-0 mr-3 h-full flex items-center"},pw={class:"min-w-5 h-5 leading-tight cursor-pointer dark:text-gray-400"},mw={key:6,class:"text-red-700 dark:text-red-400/90 mt-1 text-base"},qc=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},small:Boolean,maxDisplay:{type:Number},filterable:Boolean,remoteMethod:{},noDataText:String,batchSelect:{type:Boolean,default:!1},allSelectedText:String,hideRequired:Boolean,material:Boolean,naked:Boolean,toggleSwitch:Boolean},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":"text-gray-800 disabled:text-gray-400 disabled:border-gray-200 bg-white border-gray-300 dark:bg-gray-930 dark:border-gray-920 focus-within:border-lime-400 dark:focus-within:bg-gray-920 disabled:bg-gray-50"},i={pmi:"rounded-xs group-[.is-active]:border-zinc-400 group-[.is-selected]:bg-violet-800 group-[.is-selected]:border-violet-800 group-[.is-selected]:text-white group-[.is-disabled]:bg-opacity-50 group-[.is-disabled]:border-opacity-50 group-[.is-disabled]:text-opacity-75","wpic-tools":"rounded-sm group-[.is-active]:border-gray-300 dark:group-[.is-active]:bg-gray-950 dark:group-[.is-active]:border-gray-800 group-[.is-selected]:bg-lime-600 group-[.is-selected]:border-lime-600 group-[.is-selected]:text-white dark:group-[.is-disabled]:border-gray-800/50 group-[.is-disabled]:!text-gray-300 group-[.is-disabled]:!border-gray-100 group-[.is-disabled]:!bg-gray-100 dark:group-[.is-disabled]:!border-gray-900 dark:group-[.is-disabled]:!text-gray-700 dark:group-[.is-disabled]:!bg-gray-900"},o=t,s=l.computed(()=>o.name?o.name:ls()),a=tm(s.value),c=l.computed(()=>{if(o.label)return o.label;if(o.name&&o.labelName)return`${o.name}#${o.labelName}`}),d=l.ref(!0),u=l.computed(()=>(o.type=="password"||o.password)&&d.value?"password":o.type);function f(){d.value=!d.value}const h=l.computed(()=>{var B;if(o.rules&&typeof o.rules=="string"){let P=(B=o.rules)==null?void 0:B.split("|");return o.required&&P.push("required"),o.email&&P.push("email"),P.join("|")}else if(!o.rules){let P=[];return o.required&&P.push("required"),o.email&&P.push("email"),P.join("|")}return"required"});function p(B){let P=B&&B.target?B.target.value:B;C(P)}const m=n;function y(B){B===!0||B===!1?m("update:modelValue",!B):m("update:modelValue",B)}function g(B){let P=B&&B.target?B.target.value:B;m("update:modelValue",P),m("onChange",P)}function k(){m("update:modelValue",null),m("onChange",null),m("onClear")}const C=sc(function(B){m("update:modelValue",B),m("onChange",B)},o.debounce),N=l.ref(null),b=l.ref();function S(){var B,P;o.textarea?(B=b.value)==null||B.focus():(P=N.value)==null||P.$el.focus()}function x(){return N.value.meta.valid}const $=l.ref(),D=l.computed(()=>$.value.allSelected),A=l.computed(()=>$.value.isAllSelected);return e({focus:S,isValid:x,allSelected:D,isAllSelected:A}),(B,P)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["wpic-form-field",{"mb-6":!t.slim}])},[c.value&&!t.checkbox&&!t.radio&&!t.toggleSwitch?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass([{"text-sm":t.small,"text-base":!t.small},"mb-2 wpic-form-label text-gray-500 dark:text-gray-500 flex items-center justify-between"])},[l.createElementVNode("div",sw,[l.createElementVNode("span",null,l.toDisplayString(c.value),1),t.required&&!t.hideRequired?(l.openBlock(),l.createElementBlock("span",aw,"*")):l.createCommentVNode("",!0),l.createElementVNode("div",lw,[t.info?(l.openBlock(),l.createBlock(Sn,{key:0,hover:""},{content:l.withCtx(()=>[l.createElementVNode("div",{class:"whitespace-break-spaces",innerHTML:t.info},null,8,cw)]),default:l.withCtx(()=>[l.createVNode(cs,{class:"w-4 h-4 text-zinc-600"})]),_:1})):l.createCommentVNode("",!0)])]),l.createElementVNode("div",dw,[l.renderSlot(B.$slots,"more")])],2)):l.createCommentVNode("",!0),t.checkbox?(l.openBlock(),l.createBlock(l.unref(Kn),{key:1,ref_key:"myInput",ref:N,name:s.value,rules:h.value,value:t.checkboxValue,"unchecked-value":t.uncheckedValue,modelValue:t.modelValue},{default:l.withCtx(({field:F})=>[l.createElementVNode("div",{class:l.normalizeClass(["inline-flex group items-center gap-2",{"is-disabled":t.disabled,"is-active":!t.disabled&&!t.modelValue,"is-selected":t.modelValue===!0}]),onClick:P[0]||(P[0]=G=>t.disabled?void 0:y(t.modelValue))},[l.createElementVNode("div",{class:l.normalizeClass(["w-4 h-4 border dark:border-gray-800 cursor-pointer",{[`${i[l.unref(re).theme]}`]:!0}])},[t.modelValue===!0?(l.openBlock(),l.createBlock(Zl,{key:0})):l.createCommentVNode("",!0)],2),l.createElementVNode("span",{class:l.normalizeClass(["text-base cursor-pointer select-none text-gray-600 dark:text-gray-500",{"!text-gray-500/50 dark:text-gray-700/50":t.disabled}])},[l.renderSlot(B.$slots,"default",{},()=>[l.createTextVNode(l.toDisplayString(c.value),1)])],2)],2)]),_:3},8,["name","rules","value","unchecked-value","modelValue"])):t.radio?(l.openBlock(),l.createBlock(l.unref(Kn),{key:2,ref_key:"myInput",ref:N,name:s.value,value:t.radioValue,modelValue:t.modelValue},{default:l.withCtx(({field:F})=>[l.createElementVNode("div",{onClick:P[2]||(P[2]=()=>{t.disabled||g(t.radioValue)}),class:l.normalizeClass([{"cursor-pointer":!t.disabled},"inline-flex items-center gap-2 select-none"])},[l.createElementVNode("span",{class:l.normalizeClass(["h-4 w-4 border border-zinc-400 rounded-full p-[2px]",{"border-opacity-50":t.disabled}])},[t.radioValue==t.modelValue?(l.openBlock(),l.createElementBlock("span",{key:0,class:l.normalizeClass(["flex rounded-full h-full w-full bg-violet-800",{"bg-opacity-50":t.disabled}])},null,2)):l.createCommentVNode("",!0)],2),l.createElementVNode("input",{class:"hidden",type:"radio",name:t.name,value:t.radioValue,onChange:P[1]||(P[1]=(...G)=>B.onChange&&B.onChange(...G)),checked:t.radioValue==t.modelValue},null,40,uw),c.value?(l.openBlock(),l.createElementBlock("span",{key:0,class:l.normalizeClass(["text-base",{"opacity-50":t.disabled}])},l.toDisplayString(c.value),3)):l.createCommentVNode("",!0)],2)]),_:1},8,["name","value","modelValue"])):t.select?(l.openBlock(),l.createBlock(l.unref(Kn),{key:3,ref_key:"myInput",ref:N,modelValue:t.modelValue,rules:h.value,name:s.value},{default:l.withCtx(({field:F})=>{var G;return[l.createVNode(jc,{ref_key:"myChoiceList",ref:$,modelValue:t.modelValue,"onUpdate:modelValue":g,disabled:t.disabled,options:t.options,small:t.small,clearable:t.clearable,hideSelect:t.hideSelect,"remote-method":t.remoteMethod,multiple:t.multiple,filterable:t.filterable,maxDisplay:t.maxDisplay,batchSelect:t.batchSelect,allSelectedText:t.allSelectedText,isInvalid:!!(t.error&&l.unref(a)),required:t.required||((G=h.value)==null?void 0:G.indexOf("required"))>=0,label:c.value,placeholder:t.placeholder,loading:t.loading,material:t.material,naked:t.naked},null,8,["modelValue","disabled","options","small","clearable","hideSelect","remote-method","multiple","filterable","maxDisplay","batchSelect","allSelectedText","isInvalid","required","label","placeholder","loading","material","naked"])]}),_:1},8,["modelValue","rules","name"])):t.toggleSwitch?(l.openBlock(),l.createBlock(l.unref(Kn),{key:4,ref_key:"myInput",ref:N,modelValue:t.modelValue,rules:h.value,name:s.value},{default:l.withCtx(({field:F})=>[l.createVNode(Hc,{modelValue:t.modelValue,"onUpdate:modelValue":g,label:c.value},null,8,["modelValue","label"])]),_:1},8,["modelValue","rules","name"])):(l.openBlock(),l.createElementBlock("div",{key:5,class:l.normalizeClass(["wpic-input flex relative",{"rounded-sm border":!t.naked,"border-b":t.material,"!bg-transparent":t.naked,[`${r[l.unref(re).theme]}`]:!0,"bg-transparent!":t.transparent,"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 dark:border-red-400/70!":l.unref(a)}])},[B.$slots.prepend?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["absolute dark:text-gray-400 left-0 ml-0 w-9 h-full flex items-center text-center",{"justify-center":!t.naked}])},[l.createElementVNode("div",fw,[l.renderSlot(B.$slots,"prepend")])],2)):l.createCommentVNode("",!0),t.textarea?(l.openBlock(),l.createBlock(l.unref(Kn),{key:1,ref_key:"myInput",ref:N,modelValue:t.modelValue,rules:h.value,name:s.value},{default:l.withCtx(()=>{var F;return[l.createVNode(Wc,{ref_key:"myTextarea",ref:b,modelValue:t.modelValue,"onUpdate:modelValue":p,rows:t.rows,disabled:t.disabled,noResize:t.noResize,autoResize:t.autoResize,placeholder:t.placeholder,minHeight:t.minHeight,maxHeight:t.maxHeight,isInvalid:!!(t.error&&l.unref(a)),required:t.required||((F=h.value)==null?void 0:F.indexOf("required"))>=0},null,8,["modelValue","rows","disabled","noResize","autoResize","placeholder","minHeight","maxHeight","isInvalid","required"])]}),_:1},8,["modelValue","rules","name"])):(l.openBlock(),l.createBlock(l.unref(Kn),{key:2,ref_key:"myInput",ref:N,autocomplete:"off",style:{"z-index":"1"},class:l.normalizeClass(["flex w-full h-full rounded-sm pr-4 bg-transparent outline-hidden appearance-none dark:text-gray-400 dark:placeholder:text-gray-700",{"pl-4":!B.$slots.prepend&&!t.naked,"pl-8":B.$slots.prepend&&!t.naked,"pl-6":B.$slots.prepend&&t.naked,"py-2":t.textarea,"text-sm":t.small,"cursor-not-allowed":t.disabled}]),type:u.value,min:t.min,max:t.max,rows:t.rows,name:s.value,disabled:t.disabled,modelValue:t.modelValue,onInput:p,"no-data-text":t.noDataText,placeholder:t.placeholder,validateOnInput:!!l.unref(a),rules:h.value},null,8,["class","type","min","max","rows","name","disabled","modelValue","no-data-text","placeholder","validateOnInput","rules"])),t.loading?(l.openBlock(),l.createElementBlock("div",{key:3,onClick:l.withModifiers(k,["stop"]),class:"absolute right-0 mr-3 h-full flex items-center cursor-pointer opacity-75 hover:opacity-100"},[l.createVNode(Yn,{class:"w-6 h-6 opacity-50"})])):t.clearable&&t.modelValue?(l.openBlock(),l.createElementBlock("div",{key:4,onClick:l.withModifiers(k,["stop"]),style:{"z-index":"2"},class:"absolute right-0 mr-3 h-full flex items-center cursor-pointer opacity-75 hover:opacity-100"},[l.createVNode(Hr,{class:"w-5 h-5 opacity-50"})])):l.createCommentVNode("",!0),B.$slots.append||t.password||t.type=="password"?(l.openBlock(),l.createElementBlock("div",hw,[l.createElementVNode("div",pw,[l.renderSlot(B.$slots,"append",{},()=>[l.withDirectives(l.createVNode(Jv,{class:"text-zinc-600 select-none",onClick:f},null,512),[[l.vShow,d.value]]),l.withDirectives(l.createVNode(ew,{class:"text-zinc-600 select-none",onClick:f},null,512),[[l.vShow,!d.value]])])])])):l.createCommentVNode("",!0)],2)),t.error&&l.unref(a)?(l.openBlock(),l.createElementBlock("div",mw,[l.createVNode(l.unref(em),{name:s.value},{default:l.withCtx(F=>[l.createTextVNode(l.toDisplayString(F.message),1)]),_:1},8,["name"])])):l.createCommentVNode("",!0),B.$slots.help||t.help?(l.openBlock(),l.createElementBlock("div",{key:7,class:l.normalizeClass(["text-base mt-1",{"ml-7":t.type=="checkbox","opacity-50":t.disabled}])},[l.renderSlot(B.$slots,"help",{},()=>[l.createTextVNode(l.toDisplayString(t.help),1)])],2)):l.createCommentVNode("",!0)],2))}}),gw=["innerHTML"],Uc=Object.assign({name:"WpicTooltip"},{props:{placement:{type:String,default:"top"},full:Boolean,text:String,offset:{type:Number,default:5},delay:{type:Number,default:500}},setup(t){const e=l.ref(),n=l.ref(),r=l.ref();ls();const i=t;function o(){i.text&&(n.value.style.display="block",a())}function s(){n.value.style.display=""}async function a(){var h,p;await l.nextTick();const c=await Jl(e.value,n.value,{placement:i.placement,middleware:[Yl(),Kl(),Ul(i.offset),ng({element:r.value})]});n.value.style.left=`${c.x}px`,n.value.style.top=`${c.y}px`;const{x:d,y:u}=c.middlewareData.arrow,f={top:"bottom",right:"left",bottom:"top",left:"right"}[(h=i.placement)==null?void 0:h.split("-")[0]];r.value&&Object.assign((p=r.value)==null?void 0:p.style,{left:d!=null?`${d}px`:"",top:u!=null?`${u}px`:"",right:"",bottom:"",[f]:"-4px"})}return(c,d)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("span",{ref_key:"button",ref:e,class:l.normalizeClass({"w-full h-full":t.full}),"aria-describedby":"tooltip",onMouseenter:o,onMouseleave:s},[l.renderSlot(c.$slots,"default")],34),l.createElementVNode("div",{ref_key:"tooltip",ref:n,class:"tooltip z-30 px-3 py-2 border border-zinc-200 dark:border-gray-900 text-sm absolute top-0 left-0 bg-black text-white rounded-md hidden",role:"tooltip"},[l.createElementVNode("span",{innerHTML:t.text},null,8,gw),l.createElementVNode("div",{ref_key:"arrowElement",ref:r,class:"arrow"},null,512)],512)],64))}}),yw={key:1,class:"flex justify-between items-baseline pt-4 px-6"},bw={class:""},kw={key:2,class:"flex items-center justify-end py-4 px-6"},xw=Object.assign({name:"WpicCard"},{props:{title:String,inline:Boolean,loading:Boolean},setup(t){const e={pmi:"bg-white dark:bg-zinc-800/50 shadow-[0_4px_16px_0px_rgba(0,0,0,0.1)]","wpic-tools":"bg-white border border-gray-200 dark:bg-gray-940 dark:border-gray-920"},n={pmi:"font-bold","wpic-tools":"font-medium dark:text-gray-300"};return(r,i)=>{const o=l.resolveComponent("wpic-loading-panel");return l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["rounded-lg wpic-card relative",{[e[l.unref(re).theme]]:!0,"wpic-card-inline":t.inline,"has-header":t.title||r.$slots.actions}])},[t.loading?(l.openBlock(),l.createBlock(o,{key:0,class:"absolute top-0 left-0 z-10",wave:""})):l.createCommentVNode("",!0),t.title||r.$slots.actions?(l.openBlock(),l.createElementBlock("div",yw,[t.title||r.$slots.actions?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["text-lg 2xl:text-xl",[n[l.unref(re).theme]]])},l.toDisplayString(t.title),3)):l.createCommentVNode("",!0),l.createElementVNode("div",bw,[l.renderSlot(r.$slots,"actions")])])):l.createCommentVNode("",!0),l.renderSlot(r.$slots,"default"),r.$slots.buttons?(l.openBlock(),l.createElementBlock("div",kw,[l.renderSlot(r.$slots,"buttons")])):l.createCommentVNode("",!0)],2)}}}),vw={key:0,class:"pb-3 flex justify-betweeen h-12 items-center"},ww={class:"flex-1 text-lg dark:text-gray-300 font-semibold"},Sw=Object.assign({name:"WpicCardSection"},{props:{title:String,sub:Boolean},setup(t){const e={pmi:"mx-6","wpic-tools":"px-6"};return(n,r)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["border-b relative dark:border-gray-900 dark:text-gray-300 last:border-0 pb-6",{[`${e[l.unref(re).theme]}`]:!0,"pt-3":!(t.title&&n.$slots.actions),"pt-6":!t.title&&!n.$slots.actions,"bg-gray-50 dark:bg-gray-930":t.sub}])},[t.title||n.$slots.actions?(l.openBlock(),l.createElementBlock("div",vw,[l.createElementVNode("div",ww,l.toDisplayString(t.title),1),l.renderSlot(n.$slots,"actions")])):l.createCommentVNode("",!0),l.renderSlot(n.$slots,"default")],2))}}),Cw=l.createElementVNode("div",{class:""},null,-1),Ow=l.createStaticVNode('<div class="-mt-2"><div class="absolute left-1/4 h-8 border-r border-gray-100 dark:border-gray-900"></div><div class="absolute left-1/2 h-8 border-r border-gray-100 dark:border-gray-900"></div><div class="absolute left-3/4 h-8 border-r border-gray-100 dark:border-gray-900"></div></div><div class="mt-7 text-gray-500 dark:text-gray-600"><div class="absolute left-0 text-xs">0%</div><div class="absolute left-1/4 -translate-x-1/4 text-xs">25%</div><div class="absolute left-1/2 -translate-x-1/2 text-xs">50%</div><div class="absolute right-1/4 translate-x-3/4 text-xs">75%</div><div class="absolute right-0 text-xs">100%</div></div>',2),Ew=Object.assign({name:"WpicProgressBar"},{props:{percent:Number,value:Number,indicators:Boolean,background:{type:String,default:null},max:{type:Number,default:100},text:String},setup(t){const e=t,n=l.computed(()=>e.percent?e.percent:100/e.max*e.value),r={pmi:"h-2 ring-1 rounded-full ring-zinc-400","wpic-tools":"bg-gray-100 rounded-xs h-4 dark:bg-gray-900"},i={pmi:"bg-cyan-400 rounded-full ring-1 ring-cyan-400","wpic-tools":"bg-lime-500 rounded-xs dark:bg-lime-700"};return(o,s)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["relative flex",{"mb-4":t.indicators}])},[l.createElementVNode("div",{class:l.normalizeClass(["flex w-full relative",r[l.unref(re).theme]]),style:{"z-index":"1"}},[n.value>0?(l.openBlock(),l.createElementBlock("div",{key:0,style:l.normalizeStyle({width:`${n.value}%`}),class:l.normalizeClass(["flex h-full",{[`${t.background}`]:!0,[`${i[l.unref(re).theme]}`]:!0}])},[l.createVNode(Uc,{full:"",text:`${n.value}%${t.text?t.text:""}`},{default:l.withCtx(()=>[Cw]),_:1},8,["text"])],6)):l.createCommentVNode("",!0)],2),t.indicators?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[Ow],64)):l.createCommentVNode("",!0)],2))}}),Mw={class:"leading-none"},Tw=Object.assign({name:"WpicTag"},{props:{clearable:Boolean,small:Boolean},emits:["clear"],setup(t,{emit:e}){const n={pmi:"border-cyan-500 bg-cyan-50 text-cyan-600 text-base ","wpic-tools":"border-none bg-gray-200 text-gray-700 text-sm dark:text-gray-400 dark:bg-gray-810"},r=e;function i(){r("clear")}return(o,s)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["wpic-tag select-none border inline-flex rounded-sm h-8 items-center justify-center pl-3 py-1",{"pr-3":!t.clearable,"pr-1":t.clearable,[n[l.unref(re).theme]]:!0}])},[l.createElementVNode("span",Mw,[l.renderSlot(o.$slots,"default")]),t.clearable?(l.openBlock(),l.createElementBlock("span",{key:0,onClick:i,class:"ml-2 mt-px cursor-pointer opacity-75 hover:opacity-100"},[l.createVNode(Hr,{class:"w-4 h-4"})])):l.createCommentVNode("",!0)],2))}}),$w=Object.assign({name:"WpicTagGroup"},{props:{full:Boolean},setup(t){return(e,n)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass({"w-full":t.full})},[l.createElementVNode("div",{class:l.normalizeClass(["ui-tag-group flex flex-wrap gap-2",{"w-full":t.full}])},[l.renderSlot(e.$slots,"default")],2)],2))}}),Nw=t=>(l.pushScopeId("data-v-947735f2"),t=t(),l.popScopeId(),t),Bw={key:1,class:"w-full min-h-10 h-full rounded-lg bg-gray-100 dark:bg-gray-940 relative overflow-hidden"},Aw=[Nw(()=>l.createElementVNode("div",{class:"absolute top-0 left-0 h-full w-full shimmer dark:dark-shimmer"},null,-1))],Dw=ue(Object.assign({name:"WpicLoadingPanel"},{props:{color:{type:String,default:""},wave:{type:Boolean,default:!1}},setup(t){return(e,n)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["w-full h-full flex items-center justify-center",{"py-3":!t.wave}])},[t.wave?(l.openBlock(),l.createElementBlock("div",Bw,Aw)):(l.openBlock(),l.createBlock(Yn,{key:0,color:t.color,class:"w-10 h-10"},null,8,["color"]))],2))}}),[["__scopeId","data-v-947735f2"]]),Vw={class:"text-base font-medium select-none"},Yr=Object.assign({name:"WpicPaginationItem"},{props:{active:Boolean,disabled:Boolean},setup(t){const e={pmi:"border-zinc-300 dark:border-zinc-700 text-zinc-600 dark:text-zinc-300 hover:bg-zinc-500 hover:text-white","wpic-tools":"dark:text-gray-400 hover:text-lime-600 dark:border-gray-900"},n={pmi:"bg-violet-800 border-violet-800 hover:bg-violet-900 hover:border-violet-900 text-white","wpic-tools":"bg-lime-500 border-lime-500 text-white dark:bg-lime-700 dark:border-lime-700"},r={pmi:"text-zinc-300","wpic-tools":"text-gray-300 dark:text-gray-700 dark:border-gray-900"};return(i,o)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["border rounded-sm flex items-center justify-center w-10 h-10 cursor-pointer",{[e[l.unref(re).theme]]:!t.active&&!t.disabled,[n[l.unref(re).theme]]:t.active&&!t.disabled,[r[l.unref(re).theme]]:t.disabled}])},[l.createElementVNode("span",Vw,[l.renderSlot(i.$slots,"default")])],2))}}),Iw={},Pw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},_w=[l.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 Rw(t,e){return l.openBlock(),l.createElementBlock("svg",Pw,_w)}const Kc=ue(Iw,[["render",Rw]]),Lw={},zw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},Fw=[l.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 jw(t,e){return l.openBlock(),l.createElementBlock("svg",zw,Fw)}const Yc=ue(Lw,[["render",jw]]),Hw={},Ww={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},qw=[l.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 Uw(t,e){return l.openBlock(),l.createElementBlock("svg",Ww,qw)}const Jc=ue(Hw,[["render",Uw]]),Kw={},Yw={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},Jw=[l.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 Gw(t,e){return l.openBlock(),l.createElementBlock("svg",Yw,Jw)}const Gc=ue(Kw,[["render",Gw]]),Zw={class:"wpic-pagination flex justify-between"},Xw={key:0,class:"flex items-center"},Qw={key:0},eS={key:1,class:"flex flex-wrap gap-2"},tS=Object.assign({name:"WpicPagination"},{props:{info:{type:Boolean,default:!0},pages:{type:Boolean,default:!0},perPages:Boolean,total:Number,perPage:{type:Number,default:10},currentPage:{type:Number,default:1}},emits:["update:perPage","update:currentPage"],setup(t,{expose:e,emit:n}){const r=t,i=n,o=l.computed(()=>Math.ceil(r.total/r.perPage)),s=l.computed(()=>{const u=o.value;if(!u||u===1)return[1];const f=r.currentPage,h=1;let p=Math.max(2,f-h),m=Math.min(u-1,f+h);f<=h+2&&(p=2,m=Math.min(2*h+2,u-1)),f>=u-h-1&&(p=Math.max(2,u-2*h-1),m=u-1);const y=[];for(let g=p;g<=m;g++)y.push(g);return p>2&&y.unshift("..."),m<u-1&&y.push("..."),[1,...y,u]});function a(u){u>=1&&u<=o.value&&i("update:currentPage",u)}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}),(u,f)=>(l.openBlock(),l.createElementBlock("div",Zw,[t.info?(l.openBlock(),l.createElementBlock("div",Xw,[t.total>0?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[l.createTextVNode(l.toDisplayString(c())+" - "+l.toDisplayString(d()),1),t.total?(l.openBlock(),l.createElementBlock("span",Qw," / "+l.toDisplayString(t.total),1)):l.createCommentVNode("",!0)],64)):l.createCommentVNode("",!0)])):l.createCommentVNode("",!0),t.pages?(l.openBlock(),l.createElementBlock("div",eS,[l.createVNode(Yr,{onClick:f[0]||(f[0]=h=>a(1)),disabled:t.currentPage===1||o.value==0||!o.value},{default:l.withCtx(()=>[l.createVNode(Kc,{class:"w-5 h-5 select-none"})]),_:1},8,["disabled"]),l.createVNode(Yr,{onClick:f[1]||(f[1]=h=>a(t.currentPage-1)),disabled:t.currentPage===1||o.value==0||!o.value},{default:l.withCtx(()=>[l.createVNode(Yc,{class:"w-5 h-5 select-none"})]),_:1},8,["disabled"]),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(s.value,h=>(l.openBlock(),l.createBlock(Yr,{key:`page_${h}`,onClick:p=>a(h),active:h===t.currentPage,disabled:o.value==0||!o.value},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(h),1)]),_:2},1032,["onClick","active","disabled"]))),128)),l.createVNode(Yr,{onClick:f[2]||(f[2]=h=>a(t.currentPage+1)),disabled:t.currentPage===o.value||o.value==0||!o.value},{default:l.withCtx(()=>[l.createVNode(Gc,{class:"w-5 h-5 select-none"})]),_:1},8,["disabled"]),l.createVNode(Yr,{onClick:f[3]||(f[3]=h=>a(o.value)),disabled:t.currentPage===o.value||o.value==0||!o.value},{default:l.withCtx(()=>[l.createVNode(Jc,{class:"w-5 h-5 select-none"})]),_:1},8,["disabled"])])):l.createCommentVNode("",!0),l.createCommentVNode("",!0)]))}}),Zc=(t,e)=>{const n=t.column.children&&t.column.children.default&&typeof t.column.children.default=="function"?t.column.children.default({item:t.item}):t.column.children;return l.h("td",e.attrs,n)};Zc.props=["column","item","rowIndex"];const ws=Zc,nS={},rS={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},iS=[l.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 oS(t,e){return l.openBlock(),l.createElementBlock("svg",rS,iS)}const sS=ue(nS,[["render",oS]]),aS={class:"font-semibold"},Xc={__name:"TotalRow",props:{columns:Array,noXPadding:Boolean,totalItem:{},position:String},setup(t){const e={pmi:"bg-white dark:text-zinc-300 dark:border-zinc-900 dark:bg-zinc-800","wpic-tools":"bg-gray-50 border-gray-200 dark:border-gray-900 dark:bg-gray-800"};return(n,r)=>(l.openBlock(),l.createElementBlock("tr",aS,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(t.columns,(i,o)=>(l.openBlock(),l.createBlock(ws,{class:l.normalizeClass(["py-3 first:pl-6 pr-6 border-t",{[`${e[l.unref(re).theme]}`]:!0,"sticky left-0":o===0,"border-b":t.position==="header","border-t":t.position==="footer","first:pl-0 last:pr-0":t.noXPadding,"last:rounded-br-lg":!0,"first:rounded-bl-lg":!0,"text-center":i.align=="center","text-right":i.align=="right"}]),id:`total_${o}`,column:i,item:t.totalItem,key:`tr_total_${o}`},null,8,["class","id","column","item"]))),128))]))}},lS={},cS={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-6"},dS=[l.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 4.5v15m7.5-7.5h-15"},null,-1)];function uS(t,e){return l.openBlock(),l.createElementBlock("svg",cS,dS)}const fS=ue(lS,[["render",uS]]),hS={class:"overflow-auto"},pS={class:"w-full rounded-lg"},mS=["width"],gS=["width"],yS={key:0,class:"rounded-t-lg"},bS=["onClick"],kS={class:"rounded-b-lg relative"},xS={key:0},vS=[l.createElementVNode("td",{class:"text-center py-3"},"   ",-1)],wS={key:1},SS={key:0,class:"text-center text-gray-400 py-3"},CS=Object.assign({name:"WpicTable"},{props:{data:{type:Array,default:()=>[]},stripe:Boolean,loading:Boolean,hideHeaders:Boolean,sortOptions:{},border:Boolean,noXPadding:Boolean,totalItem:{},totalOnBottom:Boolean,totalOnTop:Boolean,valign:{type:String,default:"center"},small:Boolean,noRadius:Boolean},emits:["changeSort","expandRow"],setup(t,{expose:e,emit:n}){const r=t,i={pmi:"","wpic-tools":"border-gray-300 dark:border-gray-700"},o={pmi:"bg-zinc-50 dark:bg-zinc-800/60 text-zinc-500 dark:text-zinc-400 dark:border-zinc-900","wpic-tools":"bg-gray-100 text-gray-400 border-gray-200 dark:bg-gray-930 dark:border-gray-900 dark:text-gray-500"},s={pmi:"","wpic-tools":"dark:border-gray-900"},a={pmi:"","wpic-tools":""},c={pmi:"bg-white dark:bg-zinc-800 dark:text-zinc-300 dark:border-zinc-900","wpic-tools":"bg-white border-gray-200 dark:bg-gray-940 dark:border-gray-920 dark:text-gray-300"},d={pmi:"group-[.is-odd]:bg-white group-[.is-even]:bg-gray-50","wpic-tools":"group-[.is-odd]:bg-white group-[.is-even]:bg-gray-50 border-gray-200 dark:group-[.is-odd]:bg-gray-940 dark:group-[.is-even]:bg-gray-930"},u={pmi:"bg-zinc-900/10","wpic-tools":"bg-gray-900/10"},f=n;l.onMounted(()=>{y()});const h=l.getCurrentInstance();l.provide("wtable",h==null?void 0:h.proxy);const p=l.useSlots(),m=l.ref([]);function y(){const N=(x,$)=>{let D={};for(let A in x){if(typeof x[A].default=="boolean"&&$[A]!==void 0){D[A]=$[A]!==!1;continue}if($[A]!==void 0){D[A]=$[A];continue}if(typeof x[A].default=="function"){D[A]=x[A].default();continue}D[A]=x[A].default}return D};let b=[];(p.default&&p.default()||[]).forEach(x=>{var $,D;(($=x.type)==null?void 0:$.name)==="WpicTableColumn"?b.push(x):(D=x.children)!=null&&D.length&&x.children.forEach(A=>{var B;((B=A.type)==null?void 0:B.name)==="WpicTableColumn"&&b.push(A)})}),m.value=b.map(x=>{let $=x.children,D=x.props||{},{field:A,label:B,help:P,width:F,minWidth:G,maxWidth:L,sortable:I,selectable:T,render:v,type:M,align:V,visible:U,noPadding:j}=N(x.type.props,D);return{label:B,help:P,width:F,minWidth:G,maxWidth:L,type:M,align:V,sortable:I,selectable:T,field:A,render:v,children:$,visible:U,noPadding:j}}).filter(x=>x.visible||x.selectable)}function g(N){var S,x;let b=(S=r.sortOptions)==null?void 0:S.sortDirection;((x=r.sortOptions)==null?void 0:x.sortBy)===N&&(b=b==="asc"?"desc":"asc"),f("changeSort",{sortDirection:b,sortBy:N})}l.watch(()=>p.default,N=>{y()},{deep:!0}),e({buildColumns:y});const k=l.reactive({});function C({index:N,item:b}){k[N]?k[N]=null:(k[N]=!0,f("expandRow",{index:N,item:b}))}return(N,b)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["wpic-table relative w-full rounded-lg overflow-hidden",{"no-radius rounded-none":t.noRadius,border:t.border,[`${i[l.unref(re).theme]}`]:!0}])},[l.createElementVNode("div",hS,[l.createElementVNode("table",pS,[l.createElementVNode("colgroup",null,[m.value.find(S=>S.type=="expand")?(l.openBlock(),l.createElementBlock("col",{key:0,style:l.normalizeStyle({minWidth:`${m.value.find(S=>S.type=="expand").minWidth}px`}),width:m.value.find(S=>S.type=="expand").width,class:"w-16"},null,12,mS)):l.createCommentVNode("",!0),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(m.value.filter(S=>S.type!="expand"),(S,x)=>(l.openBlock(),l.createElementBlock("col",{style:l.normalizeStyle({minWidth:`${S.minWidth}px`,maxWidth:`${S.maxWidth}px`}),width:S.width,key:x},null,12,gS))),128))]),t.hideHeaders?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("thead",yS,[l.createElementVNode("tr",null,[m.value.find(S=>S.type=="expand")?(l.openBlock(),l.createElementBlock("th",{key:0,class:l.normalizeClass(["first:rounded-tl-lg last:rounded-tr-lg py-0 border-b first:pl-6 pr-6",[`${o[l.unref(re).theme]}`]])},null,2)):l.createCommentVNode("",!0),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(m.value.filter(S=>S.type!="expand"),(S,x)=>{var $,D;return l.openBlock(),l.createElementBlock("th",{class:l.normalizeClass(["first:rounded-tl-lg last:rounded-tr-lg py-0 border-b first:pl-6 pr-6",{[`${o[l.unref(re).theme]}`]:!0,"sticky left-0":x===0}]),style:l.normalizeStyle({maxWidth:`${S.maxWidth}px`})},[l.createElementVNode("div",{onClick:()=>{S.sortable&&g(S.field)},class:l.normalizeClass(["flex items-center lg:text-base rounded-lg",{"py-3":!t.small,"py-1 text-sm":t.small,"cursor-pointer":S.sortable&&S.field,"justify-center":S.align=="center","justify-end":S.align=="right"}])},[l.createElementVNode("span",{class:l.normalizeClass(["select-none font-medium",{"text-right":S.align=="right"}])},l.toDisplayString(S.label),3),S.sortable&&S.field?(l.openBlock(),l.createElementBlock("span",{key:0,class:l.normalizeClass(["ml-1",{"opacity-25":S.field!=(($=t.sortOptions)==null?void 0:$.sortBy)}])},[l.createVNode(sS,{class:l.normalizeClass(["w-4 h-4",{"rotate-180":((D=t.sortOptions)==null?void 0:D.sortDirection)==="asc"}])},null,8,["class"])],2)):l.createCommentVNode("",!0)],10,bS)],6)}),256))])])),l.createElementVNode("tbody",kS,[t.loading?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[l.createElementVNode("div",{class:l.normalizeClass(["inset-0 z-10 absolute flex items-center justify-center",[u[l.unref(re).theme]]])},[l.createVNode(Yn,{class:"w-6 h-6"})],2),t.data.length?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("tr",xS,vS))],64)):l.createCommentVNode("",!0),t.totalItem&&t.totalOnTop?(l.openBlock(),l.createBlock(Xc,{key:1,position:"header",columns:m.value,noXPadding:t.noXPadding,totalItem:t.totalItem},null,8,["columns","noXPadding","totalItem"])):l.createCommentVNode("",!0),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(t.data,(S,x)=>{var $,D,A,B,P;return l.openBlock(),l.createElementBlock(l.Fragment,{key:`tr_${x}`},[l.createElementVNode("tr",{class:l.normalizeClass(["tr group border-b last:border-b-0 overflow-hidden",{"is-odd":x%2==0,"is-even":x%2!=0,[s[l.unref(re).theme]]:!0}])},[m.value.find(F=>F.type=="expand")?(l.openBlock(),l.createElementBlock("td",{key:0,class:l.normalizeClass([[{"first:pl-6 pr-6 last:pr-6":!t.noXPadding,"first:pl-0 pr-6 last:pr-0":t.noXPadding,"align-top py-5":t.valign=="top"}],"border-t border-gray-200 leading-tight h-16 py-2 dark:border-gray-920"])},[l.createVNode(Ni,{small:"",square:"",onClick:F=>C({item:S,index:x})},{default:l.withCtx(()=>[k[x]?(l.openBlock(),l.createBlock(ow,{key:0,class:"w-4 h-4"})):(l.openBlock(),l.createBlock(fS,{key:1,class:"w-4 h-4"}))]),_:2},1032,["onClick"])],2)):l.createCommentVNode("",!0),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(m.value.filter(F=>F.type!="expand"),(F,G)=>{var L,I;return l.openBlock(),l.createBlock(ws,{class:l.normalizeClass(["lg:text-base h-full table-cell",{"text-sm lg:text-sm py-1!":t.small,"sticky left-0 shadow-sm":G===0,[`${c[l.unref(re).theme]}`]:!0,[`${d[l.unref(re).theme]}`]:t.stripe,"py-3 first:pl-6 pr-6":!F.noPadding,"first:pl-0 last:pr-0":t.noXPadding,"last:rounded-br-lg":x===((L=t.data)==null?void 0:L.length)-1&&!t.totalItem&&!m.value.find(T=>T.type=="expand")&&!t.noRadius,"first:rounded-bl-lg":x===((I=t.data)==null?void 0:I.length)-1&&!t.totalItem&&!m.value.find(T=>T.type=="expand")&&!t.noRadius,"text-center justify-center":F.align=="center","text-right justify-end":F.align=="right","align-top py-5":t.valign=="top"}]),style:l.normalizeStyle({maxWidth:`${F.maxWidth}px`}),id:`${x}_${G}`,column:F,item:S,rowIndex:x,key:G},null,8,["class","style","id","column","item","rowIndex"])}),128))],2),m.value.find(F=>F.type=="expand")?l.withDirectives((l.openBlock(),l.createElementBlock("tr",{key:0,class:l.normalizeClass([{[s[l.unref(re).theme]]:!t.stripe,[a[l.unref(re).theme]]:t.stripe},"tr border-b last:border-b-0 overflow-hidden"])},[l.createVNode(ws,{class:l.normalizeClass(["lg:text-base bg-gray-50! dark:bg-gray-940!",{[`${c[l.unref(re).theme]}`]:!0,"py-3 first:pl-6 pr-6":!(($=m.value.find(F=>F.type=="expand"))!=null&&$.noPadding),"p-0":(D=m.value.find(F=>F.type=="expand"))==null?void 0:D.noPadding,"first:pl-0 last:pr-0":t.noXPadding,"last:rounded-br-lg":x===((A=t.data)==null?void 0:A.length)-1&&!t.totalItem,"first:rounded-bl-lg":x===((B=t.data)==null?void 0:B.length)-1&&!t.totalItem,"text-center":m.value.find(F=>F.type=="expand").align=="center","text-right":m.value.find(F=>F.type=="expand").align=="right"}]),column:m.value.find(F=>F.type=="expand"),rowIndex:x,colspan:(P=m.value)==null?void 0:P.length,item:S},null,8,["class","column","rowIndex","colspan","item"])],2)),[[l.vShow,k[x]]]):l.createCommentVNode("",!0)],64)}),128))]),t.totalItem&&t.totalOnBottom?(l.openBlock(),l.createElementBlock("tfoot",wS,[l.createVNode(Xc,{position:"footer",columns:m.value,noXPadding:t.noXPadding,totalItem:t.totalItem},null,8,["columns","noXPadding","totalItem"])])):l.createCommentVNode("",!0)])]),!t.loading&&!t.data.length?(l.openBlock(),l.createElementBlock("div",SS," No Data ")):l.createCommentVNode("",!0)],2))}}),OS={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},noPadding:{type:Boolean,default:!1}},setup(t){const e=inject("wtable",null);return onMounted(()=>{e&&e.buildColumns&&e.buildColumns()}),onBeforeUnmount(()=>{e&&e.buildColumns&&e.buildColumns()}),()=>null}};function De(t){this.content=t}De.prototype={constructor:De,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 De(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 De(n)},addToStart:function(t,e){return new De([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new De(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 De(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=De.from(t),t.size?new De(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=De.from(t),t.size?new De(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=De.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}},De.from=function(t){if(t instanceof De)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new De(e)};function Qc(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=Qc(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function ed(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),a=e.child(--o),c=s.nodeSize;if(s==a){n-=c,r-=c;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let d=0,u=Math.min(s.text.length,a.text.length);for(;d<u&&s.text[s.text.length-d-1]==a.text[a.text.length-d-1];)d++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let d=ed(s.content,a.content,n-1,r-1);if(d)return d}n-=c,r-=c}}class R{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,a=0;a<n;s++){let c=this.content[s],d=a+c.nodeSize;if(d>e&&r(c,i+a,o||null,s)!==!1&&c.content.size){let u=a+1;c.nodesBetween(Math.max(0,e-u),Math.min(c.content.size,n-u),r,i+u)}a=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let o="",s=!0;return this.nodesBetween(e,n,(a,c)=>{let d=a.isText?a.text.slice(Math.max(e,c)-c,n-c):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&d||a.isTextblock)&&r&&(s?s=!1:o+=r),o+=d},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 R(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 a=this.content[o],c=s+a.nodeSize;c>e&&((s<e||c>n)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),i+=a.nodeSize),s=c}return new R(r,i)}cutByIndex(e,n){return e==n?R.empty:e==0&&n==this.content.length?this:new R(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 R(i,o)}addToStart(e){return new R([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new R(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 Qc(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 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 R.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new R(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return R.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 R(n||e,r)}static from(e){if(!e)return R.empty;if(e instanceof R)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new R([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}R.empty=new R([],0);const Ss={index:0,offset:0};function Ki(t,e){return Ss.index=t,Ss.offset=e,Ss}function Yi(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(!Yi(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Yi(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let ge=class nl{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&&Yi(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 nl.none;if(e instanceof nl)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};ge.none=[];class Ji extends Error{}class q{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 q(r,this.openStart,this.openEnd)}removeBetween(e,n){return new q(td(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 q.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 q(R.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 q(e,r,i)}}q.empty=new q(R.empty,0,0);function td(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(i==e||o.isText){if(a!=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(td(o.content,e-i-1,n-i-1)))}function nd(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 a=nd(s.content,e-o-1,n);return a&&t.replaceChild(i,s.copy(a))}function ES(t,e,n){if(n.openStart>t.depth)throw new Ji("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Ji("Inconsistent open depths");return rd(t,e,n,0)}function rd(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=rd(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,a=s.content;return Mn(s,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=MS(n,t);return Mn(o,od(t,s,a,e,r))}else return Mn(o,Gi(t,e,r))}function id(t,e){if(!e.type.compatibleContent(t.type))throw new Ji("Cannot join "+e.type.name+" onto "+t.type.name)}function Cs(t,e,n){let r=t.node(n);return id(r,e.node(n)),r}function En(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 Jr(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&&(En(t.nodeAfter,r),o++));for(let a=o;a<s;a++)En(i.child(a),r);e&&e.depth==n&&e.textOffset&&En(e.nodeBefore,r)}function Mn(t,e){return t.type.checkContent(e),t.copy(e)}function od(t,e,n,r,i){let o=t.depth>i&&Cs(t,e,i+1),s=r.depth>i&&Cs(n,r,i+1),a=[];return Jr(null,t,i,a),o&&s&&e.index(i)==n.index(i)?(id(o,s),En(Mn(o,od(t,e,n,r,i+1)),a)):(o&&En(Mn(o,Gi(t,e,i+1)),a),Jr(e,n,i,a),s&&En(Mn(s,Gi(n,r,i+1)),a)),Jr(r,null,i,a),new R(a)}function Gi(t,e,n){let r=[];if(Jr(null,t,n,r),t.depth>n){let i=Cs(t,e,n+1);En(Mn(i,Gi(t,e,n+1)),r)}return Jr(e,null,n,r),new R(r)}function MS(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(R.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Gr{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 ge.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 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 Zi(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:a,offset:c}=s.content.findIndex(o),d=o-c;if(r.push(s,a,i+c),!d||(s=s.child(a),s.isText))break;o=d-1,i+=c+1}return new Gr(n,r,o)}static resolveCached(e,n){for(let i=0;i<Os.length;i++){let o=Os[i];if(o.pos==n&&o.doc==e)return o}let r=Os[Es]=Gr.resolve(e,n);return Es=(Es+1)%TS,r}}let Os=[],Es=0,TS=12;class Zi{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 $S=Object.create(null);let Tn=class rl{constructor(e,n,r,i=ge.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||R.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&&Yi(this.attrs,n||e.defaultAttrs||$S)&&ge.sameSet(this.marks,r||ge.none)}copy(e=null){return e==this.content?this:new rl(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new rl(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 q.empty;let i=this.resolve(e),o=this.resolve(n),s=r?0:i.sharedDepth(n),a=i.start(s),d=i.node(s).content.cut(i.pos-a,o.pos-a);return new q(d,i.depth-s,o.depth-s)}replace(e,n,r){return ES(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 Gr.resolveCached(this,e)}resolveNoCache(e){return Gr.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()+")"),sd(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=R.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let c=i;c<o;c++)if(!this.type.allowsMarks(r.child(c).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=ge.none;for(let n=0;n<this.marks.length;n++)e=this.marks[n].addToSet(e);if(!ge.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=R.fromJSON(e,n.content);return e.nodeType(n.type).create(n.attrs,i,r)}};Tn.prototype.text=void 0;class Xi extends Tn{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):sd(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 Xi(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Xi(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 sd(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class $n{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new NS(e,n);if(r.next==null)return $n.empty;let i=ad(r);r.next&&r.err("Unexpected trailing text");let o=_S(PS(i));return RS(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,a){let c=s.matchFragment(e,r);if(c&&(!n||c.validEnd))return R.from(a.map(d=>d.createAndFill()));for(let d=0;d<s.next.length;d++){let{type:u,next:f}=s.next[d];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let h=o(f,a.concat(u));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 a=i;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:a,next:c}=o.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||c.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 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
+ `)}}$n.empty=new $n(!0);class NS{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 ad(t){let e=[];do e.push(BS(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function BS(t){let e=[];do e.push(AS(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function AS(t){let e=IS(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=DS(t,e);else break;return e}function ld(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function DS(t,e){let n=ld(t),r=n;return t.eat(",")&&(t.next!="}"?r=ld(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function VS(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 IS(t){if(t.eat("(")){let e=ad(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=VS(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 PS(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function r(s,a,c){let d={term:c,to:a};return e[s].push(d),d}function i(s,a){s.forEach(c=>c.to=a)}function o(s,a){if(s.type=="choice")return s.exprs.reduce((c,d)=>c.concat(o(d,a)),[]);if(s.type=="seq")for(let c=0;;c++){let d=o(s.exprs[c],a);if(c==s.exprs.length-1)return d;i(d,a=n())}else if(s.type=="star"){let c=n();return r(a,c),i(o(s.expr,c),c),[r(c)]}else if(s.type=="plus"){let c=n();return i(o(s.expr,a),c),i(o(s.expr,c),c),[r(c)]}else{if(s.type=="opt")return[r(a)].concat(o(s.expr,a));if(s.type=="range"){let c=a;for(let d=0;d<s.min;d++){let u=n();i(o(s.expr,c),u),c=u}if(s.max==-1)i(o(s.expr,c),c);else for(let d=s.min;d<s.max;d++){let u=n();r(c,u),i(o(s.expr,c),u),c=u}return[r(c)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function cd(t,e){return e-t}function dd(t,e){let n=[];return r(e),n.sort(cd);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:a,to:c}=o[s];!a&&n.indexOf(c)==-1&&r(c)}}}function _S(t){let e=Object.create(null);return n(dd(t,0));function n(r){let i=[];r.forEach(s=>{t[s].forEach(({term:a,to:c})=>{if(!a)return;let d;for(let u=0;u<i.length;u++)i[u][0]==a&&(d=i[u][1]);dd(t,c).forEach(u=>{d||i.push([a,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let o=e[r.join(",")]=new $n(r.indexOf(t.length-1)>-1);for(let s=0;s<i.length;s++){let a=i[s][1].sort(cd);o.next.push({type:i[s][0],next:e[a.join(",")]||n(a)})}return o}}function RS(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],o=!i.validEnd,s=[];for(let a=0;a<i.next.length;a++){let{type:c,next:d}=i.next[a];s.push(c.name),o&&!(c.isText||c.hasRequiredAttrs())&&(o=!1),r.indexOf(d)==-1&&r.push(d)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function ud(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 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 hd(t){let e=Object.create(null);if(t)for(let n in t)e[n]=new LS(t[n]);return e}let pd=class Uh{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=hd(r.attrs),this.defaultAttrs=ud(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==$n.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 Tn(this,this.computeAttrs(e),R.from(n),ge.setFrom(r))}createChecked(e=null,n,r){return n=R.from(n),this.checkContent(n),new Tn(this,this.computeAttrs(e),n,ge.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=R.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(R.empty,!0);return o?new Tn(this,e,n.append(o),ge.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:ge.none:e}static compile(e,n){let r=Object.create(null);e.forEach((o,s)=>r[o]=new Uh(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 LS{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class Qi{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=hd(i.attrs),this.excluded=null;let o=ud(this.attrs);this.instance=o?new ge(this,o):null}create(e=null){return!e&&this.instance?this.instance:new ge(this,fd(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new Qi(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 zS{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=De.from(e.nodes),n.marks=De.from(e.marks||{}),this.nodes=pd.compile(this.spec.nodes,this),this.marks=Qi.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||"",a=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=$n.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=a=="_"?null:a?md(this,a.split(" ")):a==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:md(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 pd){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 Xi(r,r.defaultAttrs,e,ge.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return Tn.fromJSON(this,e)}markFromJSON(e){return ge.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function md(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 a in t.marks){let c=t.marks[a];(i=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function FS(t){return t.tag!=null}function jS(t){return t.style!=null}class ir{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[],n.forEach(r=>{FS(r)?this.tags.push(r):jS(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 kd(this,n,!1);return r.addAll(e,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new kd(this,n,!0);return r.addAll(e,n.from,n.to),q.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(qS(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],a=s.style;if(!(a.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(s.getAttrs){let c=s.getAttrs(n);if(c===!1)continue;s.attrs=c||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 a=n[s];if((a.priority==null?50:a.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=xd(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=xd(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ir(e,ir.schemaRules(e)))}}const gd={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},HS={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},yd={ol:!0,ul:!0},eo=1,to=2,no=4;function bd(t,e,n){return e!=null?(e?eo:0)|(e==="full"?to:0):t&&t.whitespace=="pre"?eo|to:n&-5}class ro{constructor(e,n,r,i,o,s,a){this.type=e,this.attrs=n,this.marks=r,this.pendingMarks=i,this.solid=o,this.options=a,this.content=[],this.activeMarks=ge.none,this.stashMarks=[],this.match=s||(a&no?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(R.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&eo)){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=R.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(R.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):US(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&&!gd.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class kd{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0;let i=n.topNode,o,s=bd(null,n.preserveWhitespace,0)|(r?no:0);i?o=new ro(i.type,i.attrs,ge.none,ge.none,!0,n.topMatch||i.type.contentMatch,s):r?o=new ro(null,null,ge.none,ge.none,!0,null,s):o=new ro(e.schema.topNodeType,null,ge.none,ge.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,a=this.top;for(let c=0;c<s.length;c++)this.removePendingMark(s[c],a);for(let c=0;c<o.length;c++)this.addPendingMark(o[c]);n();for(let c=0;c<o.length;c++)this.removePendingMark(o[c],a);for(let c=0;c<s.length;c++)this.addPendingMark(s[c])}addTextNode(e){let n=e.nodeValue,r=this.top;if(r.options&to||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(r.options&eo)r.options&to?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;yd.hasOwnProperty(r)&&this.parser.normalizeLists&&WS(e);let o=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,n));if(o?o.ignore:HS.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,a=this.top,c=this.needsBlock;if(gd.hasOwnProperty(r))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),s=!0,a.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(a),this.needsBlock=c}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=ge.none,r=ge.none;for(let i=0,o=e.length;i<o;i++){let s=e.item(i);for(let a=void 0;;){let c=this.parser.matchStyle(s,e.getPropertyValue(s),this,a);if(!c)break;if(c.ignore)return null;if(c.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach(d=>{c.clearMark(d)&&(r=d.addToSet(r))}):n=this.parser.schema.marks[c.mark].create(c.attrs).addToSet(n),c.consuming===!1)a=c;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 a=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(c=>this.insertNode(c));else{let c=e;typeof n.contentElement=="string"?c=e.querySelector(n.contentElement):typeof n.contentElement=="function"?c=n.contentElement(e):n.contentElement&&(c=n.contentElement),this.findAround(e,c,!0),this.addAll(c)}i&&this.sync(a)&&this.open--,s&&this.removePendingMark(s,a)}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=bd(e,i,o.options);o.options&no&&o.content.length==0&&(s|=no),this.nodes.push(new ro(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=(a,c)=>{for(;a>=0;a--){let d=n[a];if(d==""){if(a==n.length-1||a==0)continue;for(;c>=o;c--)if(s(a-1,c))return!0;return!1}else{let u=c>0||c==0&&i?this.nodes[c].type:r&&c>=o?r.node(c-o).type:null;if(!u||u.name!=d&&u.groups.indexOf(d)==-1)return!1;c--}}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=KS(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 WS(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 qS(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function xd(t){let e={};for(let n in t)e[n]=t[n];return e}function US(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let o=[],s=a=>{o.push(a);for(let c=0;c<a.edgeCount;c++){let{type:d,next:u}=a.edge(c);if(d==e||o.indexOf(u)<0&&s(u))return!0}};if(s(i.contentMatch))return!0}}function KS(t,e){for(let n=0;n<e.length;n++)if(t.eq(e[n]))return e[n]}class Ot{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Ms(n).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let a=0,c=0;for(;a<o.length&&c<s.marks.length;){let d=s.marks[c];if(!this.marks[d.type.name]){c++;continue}if(!d.eq(o[a][0])||d.type.spec.spanning===!1)break;a++,c++}for(;a<o.length;)i=o.pop()[1];for(;c<s.marks.length;){let d=s.marks[c++],u=this.serializeMark(d,s.isInline,n);u&&(o.push([d,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=Ot.renderSpec(Ms(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&&Ot.renderSpec(Ms(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,a=r?e.createElementNS(r,i):e.createElement(i),c=n[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let f=u.indexOf(" ");f>0?a.setAttributeNS(u.slice(0,f),u.slice(f+1),c[u]):a.setAttribute(u,c[u])}}for(let u=d;u<n.length;u++){let f=n[u];if(f===0){if(u<n.length-1||u>d)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}=Ot.renderSpec(e,f,r);if(a.appendChild(h),p){if(s)throw new RangeError("Multiple content holes");s=p}}}return{dom:a,contentDOM:s}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ot(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=vd(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return vd(e.marks)}}function vd(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Ms(t){return t.document||window.document}const wd=65535,Sd=Math.pow(2,16);function YS(t,e){return t+e*Sd}function Cd(t){return t&wd}function JS(t){return(t-(t&wd))/Sd}const Od=1,Ed=2,io=4,Md=8;class Ts{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Md)>0}get deletedBefore(){return(this.delInfo&(Od|io))>0}get deletedAfter(){return(this.delInfo&(Ed|io))>0}get deletedAcross(){return(this.delInfo&io)>0}}class Qe{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Qe.empty)return Qe.empty}recover(e){let n=0,r=Cd(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+JS(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 a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?i:0);if(c>e)break;let d=this.ranges[a+o],u=this.ranges[a+s],f=c+d;if(e<=f){let h=d?e==c?-1:e==f?1:n:n,p=c+i+(h<0?0:u);if(r)return p;let m=e==(n<0?c:f)?null:YS(a/3,e-c),y=e==c?Ed:e==f?Od:io;return(n<0?e!=c:e!=f)&&(y|=Md),new Ts(p,y,m)}i+=u-d}return r?e+i:new Ts(e+i,0,null)}touches(e,n){let r=0,i=Cd(n),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?r:0);if(c>e)break;let d=this.ranges[a+o],u=c+d;if(e<=u&&a==i*3)return!0;r+=this.ranges[a+s]-d}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],a=s-(this.inverted?o:0),c=s+(this.inverted?0:o),d=this.ranges[i+n],u=this.ranges[i+r];e(a,a+d,c,c+u),o+=u-d}}invert(){return new Qe(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Qe.empty:new Qe(e<0?[0,-e,0]:[0,0,e])}}Qe.empty=new Qe([]);class or{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 or(this.maps,this.mirror,e,n)}copy(){return new or(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 or;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],a=s.mapResult(e,n);if(a.recover!=null){let c=this.getMirror(o);if(c!=null&&c>o&&c<this.to){o=c,e=this.maps[c].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new Ts(e,i,null)}}const $s=Object.create(null);class Pe{getMap(){return Qe.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=$s[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 $s)throw new RangeError("Duplicate use of step JSON ID "+e);return $s[e]=n,n.prototype.jsonID=e,n}}class Se{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Se(e,null)}static fail(e){return new Se(null,e)}static fromReplace(e,n,r,i){try{return Se.ok(e.replace(n,r,i))}catch(o){if(o instanceof Ji)return Se.fail(o.message);throw o}}}function Ns(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let o=t.child(i);o.content.size&&(o=o.copy(Ns(o.content,e,o))),o.isInline&&(o=e(o,n,i)),r.push(o)}return R.fromArray(r)}class en extends Pe{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 q(Ns(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return Se.fromReplace(e,this.from,this.to,o)}invert(){return new Et(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 en(n.pos,r.pos,this.mark)}merge(e){return e instanceof en&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new en(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 en(n.from,n.to,e.markFromJSON(n.mark))}}Pe.jsonID("addMark",en);class Et extends Pe{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 q(Ns(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Se.fromReplace(e,this.from,this.to,r)}invert(){return new en(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 Et(n.pos,r.pos,this.mark)}merge(e){return e instanceof Et&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Et(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 Et(n.from,n.to,e.markFromJSON(n.mark))}}Pe.jsonID("removeMark",Et);class tn extends Pe{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Se.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Se.fromReplace(e,this.pos,this.pos+1,new q(R.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 tn(this.pos,n.marks[i]);return new tn(this.pos,this.mark)}}return new sr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new tn(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 tn(n.pos,e.markFromJSON(n.mark))}}Pe.jsonID("addNodeMark",tn);class sr extends Pe{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Se.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Se.fromReplace(e,this.pos,this.pos+1,new q(R.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new tn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new sr(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 sr(n.pos,e.markFromJSON(n.mark))}}Pe.jsonID("removeNodeMark",sr);class Te extends Pe{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Bs(e,this.from,this.to)?Se.fail("Structure replace would overwrite content"):Se.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Qe([this.from,this.to-this.from,this.slice.size])}invert(e){return new Te(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 Te(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(e){if(!(e instanceof Te)||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?q.empty:new q(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Te(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?q.empty:new q(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Te(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 Te(n.from,n.to,q.fromJSON(e,n.slice),!!n.structure)}}Pe.jsonID("replace",Te);class $e extends Pe{constructor(e,n,r,i,o,s,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a}apply(e){if(this.structure&&(Bs(e,this.from,this.gapFrom)||Bs(e,this.gapTo,this.to)))return Se.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Se.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Se.fromReplace(e,this.from,this.to,r):Se.fail("Content does not fit in gap")}getMap(){return new Qe([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 $e(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 $e(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 $e(n.from,n.to,n.gapFrom,n.gapTo,q.fromJSON(e,n.slice),n.insert,!!n.structure)}}Pe.jsonID("replaceAround",$e);function Bs(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 GS(t,e,n,r){let i=[],o=[],s,a;t.doc.nodesBetween(e,n,(c,d,u)=>{if(!c.isInline)return;let f=c.marks;if(!r.isInSet(f)&&u.type.allowsMarkType(r.type)){let h=Math.max(d,e),p=Math.min(d+c.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 Et(h,p,f[y])));a&&a.to==h?a.to=p:o.push(a=new en(h,p,r))}}),i.forEach(c=>t.step(c)),o.forEach(c=>t.step(c))}function ZS(t,e,n,r){let i=[],o=0;t.doc.nodesBetween(e,n,(s,a)=>{if(!s.isInline)return;o++;let c=null;if(r instanceof Qi){let d=s.marks,u;for(;u=r.isInSet(d);)(c||(c=[])).push(u),d=u.removeFromSet(d)}else r?r.isInSet(s.marks)&&(c=[r]):c=s.marks;if(c&&c.length){let d=Math.min(a+s.nodeSize,n);for(let u=0;u<c.length;u++){let f=c[u],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=d,h.step=o):i.push({style:f,from:Math.max(a,e),to:d,step:o})}}}),i.forEach(s=>t.step(new Et(s.from,s.to,s.style)))}function Td(t,e,n,r=n.contentMatch,i=!0){let o=t.doc.nodeAt(e),s=[],a=e+1;for(let c=0;c<o.childCount;c++){let d=o.child(c),u=a+d.nodeSize,f=r.matchType(d.type);if(!f)s.push(new Te(a,u,q.empty));else{r=f;for(let h=0;h<d.marks.length;h++)n.allowsMarkType(d.marks[h].type)||t.step(new Et(a,u,d.marks[h]));if(i&&d.isText&&n.whitespace!="pre"){let h,p=/\r?\n|\r/g,m;for(;h=p.exec(d.text);)m||(m=new q(R.from(n.schema.text(" ",n.allowedMarks(d.marks))),0,0)),s.push(new Te(a+h.index,a+h.index+h[0].length,m))}}a=u}if(!r.validEnd){let c=r.fillBefore(R.empty,!0);t.replace(a,a,new q(c,0,0))}for(let c=s.length-1;c>=0;c--)t.step(s[c])}function XS(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function ar(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||!XS(i,o,s))break}return null}function QS(t,e,n){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),a=i.after(o+1),c=s,d=a,u=R.empty,f=0;for(let m=o,y=!1;m>n;m--)y||r.index(m)>0?(y=!0,u=R.from(r.node(m).copy(u)),f++):c--;let h=R.empty,p=0;for(let m=o,y=!1;m>n;m--)y||i.after(m+1)<i.end(m)?(y=!0,h=R.from(i.node(m).copy(h)),p++):d++;t.step(new $e(c,d,s,a,new q(u.append(h),f,p),u.size-f,!0))}function As(t,e,n=null,r=t){let i=eC(t,e),o=i&&tC(r,e);return o?i.map($d).concat({type:e,attrs:n}).concat(o.map($d)):null}function $d(t){return{type:t,attrs:null}}function eC(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 tC(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 c=(s.length?s[s.length-1]:e).contentMatch;for(let d=r;c&&d<i;d++)c=c.matchType(n.child(d).type);return!c||!c.validEnd?null:s}function nC(t,e,n){let r=R.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let a=n[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=R.from(n[s].type.create(n[s].attrs,r))}let i=e.start,o=e.end;t.step(new $e(i,o,i,o,new q(r,0,0),n.length,!0))}function rC(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,a)=>{if(s.isTextblock&&!s.hasMarkup(r,i)&&sC(t.doc,t.mapping.slice(o).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&oC(t,s,a,o),Td(t,t.mapping.slice(o).map(a,1),r,void 0,c===null);let d=t.mapping.slice(o),u=d.map(a,1),f=d.map(a+s.nodeSize,1);return t.step(new $e(u,f,u+1,f-1,new q(R.from(r.create(i,null,s.marks)),0,0),1,!0)),c===!0&&iC(t,s,a,o),!1}})}function iC(t,e,n,r){e.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let c=t.mapping.slice(r).map(n+1+o+s.index);t.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function oC(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 sC(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function aC(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 $e(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new q(R.from(s),0,0),1,!0))}function zt(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 d=i.depth-1,u=n-2;d>o;d--,u--){let f=i.node(d),h=i.index(d);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(o),c=r&&r[0];return i.node(o).canReplaceWith(a,a,c?c.type:i.node(o+1).type)}function lC(t,e,n=1,r){let i=t.doc.resolve(e),o=R.empty,s=R.empty;for(let a=i.depth,c=i.depth-n,d=n-1;a>c;a--,d--){o=R.from(i.node(a).copy(o));let u=r&&r[d];s=R.from(u?u.type.create(u.attrs,s):i.node(a).copy(s))}t.step(new Te(e,e,new q(o.append(s),n,n),!0))}function nn(t,e){let n=t.resolve(e),r=n.index();return Nd(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Nd(t,e){return!!(t&&e&&!t.isLeaf&&t.canAppend(e))}function oo(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let o,s,a=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):n>0?(o=r.node(i+1),a++,s=r.node(i).maybeChild(a)):(o=r.node(i).maybeChild(a-1),s=r.node(i+1)),o&&!o.isTextblock&&Nd(o,s)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function cC(t,e,n){let r=new Te(e-n,e+n,q.empty,!0);t.step(r)}function dC(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 Bd(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 a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,c=r.index(s)+(a>0?1:0),d=r.node(s),u=!1;if(o==1)u=d.canReplace(c,c,i);else{let f=d.contentMatchAt(c).findWrapping(i.firstChild.type);u=f&&d.canReplaceWith(c,c,f[0])}if(u)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function so(t,e,n=e,r=q.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),o=t.resolve(n);return Ad(i,o,r)?new Te(e,n,r):new uC(i,o,r).fit()}function Ad(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class uC{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=R.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=R.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,a=i.depth;for(;s&&a&&o.childCount==1;)o=o.firstChild.content,s--,a--;let c=new q(o,s,a);return e>-1?new $e(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new Te(r.pos,i.pos,c):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=Ds(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:c,match:d}=this.frontier[a],u,f=null;if(n==1&&(s?d.matchType(s.type)||(f=d.fillBefore(R.from(s),!1)):o&&c.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:a,parent:o,inject:f};if(n==2&&s&&(u=d.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:o,wrap:u};if(o&&d.matchType(o.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Ds(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new q(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=Ds(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new q(Zr(e,n-1,1),n-1,o?n-1:r)}else this.unplaced=new q(Zr(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,a=r?r.content:s.content,c=s.openStart-e,d=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-(s.content.size-s.openEnd);for(;d<a.childCount;){let y=a.child(d),g=f.matchType(y.type);if(!g)break;d++,(d>1||c==0||y.content.size)&&(f=g,u.push(Dd(y.mark(h.allowedMarks(y.marks)),d==1?c:0,d==a.childCount?p:-1)))}let m=d==a.childCount;m||(p=-1),this.placed=Xr(this.placed,n,R.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?q.empty:new q(Zr(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new q(Zr(s.content,e,d),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Vs(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=Vs(e,n,i,r,o);if(s){for(let a=n-1;a>=0;a--){let{match:c,type:d}=this.frontier[a],u=Vs(e,a,d,c,!0);if(!u||u.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=Xr(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=Xr(this.placed,this.depth,R.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(R.empty,!0);n.childCount&&(this.placed=Xr(this.placed,this.frontier.length,n))}}function Zr(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Zr(t.firstChild.content,e-1,n)))}function Xr(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Xr(t.lastChild.content,e-1,n)))}function Ds(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Dd(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Dd(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(R.empty,!0)))),t.copy(r)}function Vs(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 a=r.fillBefore(o.content,!0,s);return a&&!fC(n,o.content,s)?a:null}function fC(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function hC(t){return t.spec.defining||t.spec.definingForContent}function pC(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),o=t.doc.resolve(n);if(Ad(i,o,r))return t.step(new Te(e,n,r));let s=Id(i,t.doc.resolve(n));s[s.length-1]==0&&s.pop();let a=-(i.depth+1);s.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;s.indexOf(h)>-1?a=h:i.before(h)==p&&s.splice(1,0,-h)}let c=s.indexOf(a),d=[],u=r.openStart;for(let h=r.content,p=0;;p++){let m=h.firstChild;if(d.push(m),p==r.openStart)break;h=m.content}for(let h=u-1;h>=0;h--){let p=d[h],m=hC(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=d[p];if(m)for(let y=0;y<s.length;y++){let g=s[(y+c)%s.length],k=!0;g<0&&(k=!1,g=-g);let C=i.node(g-1),N=i.index(g-1);if(C.canReplaceWith(N,N,m.type,m.marks))return t.replace(i.before(g),k?o.after(g):n,new q(Vd(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 Vd(t,e,n,r,i){if(e<n){let o=t.firstChild;t=t.replaceChild(0,o.copy(Vd(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(R.empty,!0))}return t}function mC(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=dC(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new q(R.from(r),0,0))}function gC(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),o=Id(r,i);for(let s=0;s<o.length;s++){let a=o[s],c=s==o.length-1;if(c&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),i.end(a));if(a>0&&(c||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.delete(r.before(a),i.after(a))}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 Id(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 lr extends Pe{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 Se.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 Se.fromReplace(e,this.pos,this.pos+1,new q(R.from(i),0,n.isLeaf?0:1))}getMap(){return Qe.empty}invert(e){return new lr(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 lr(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 lr(n.pos,n.attr,n.value)}}Pe.jsonID("attr",lr);class Qr extends Pe{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 Se.ok(r)}getMap(){return Qe.empty}invert(e){return new Qr(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 Qr(n.attr,n.value)}}Pe.jsonID("docAttr",Qr);let cr=class extends Error{};cr=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},cr.prototype=Object.create(Error.prototype),cr.prototype.constructor=cr,cr.prototype.name="TransformError";class yC{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new or}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new cr(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=q.empty){let i=so(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new q(R.from(r),0,0))}delete(e,n){return this.replace(e,n,q.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return pC(this,e,n,r),this}replaceRangeWith(e,n,r){return mC(this,e,n,r),this}deleteRange(e,n){return gC(this,e,n),this}lift(e,n){return QS(this,e,n),this}join(e,n=1){return cC(this,e,n),this}wrap(e,n){return nC(this,e,n),this}setBlockType(e,n=e,r,i=null){return rC(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return aC(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new lr(e,n,r)),this}setDocAttribute(e,n){return this.step(new Qr(e,n)),this}addNodeMark(e,n){return this.step(new tn(e,n)),this}removeNodeMark(e,n){if(!(n instanceof ge)){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 sr(e,n)),this}split(e,n=1,r){return lC(this,e,n,r),this}addMark(e,n,r){return GS(this,e,n,r),this}removeMark(e,n,r){return ZS(this,e,n,r),this}clearIncompatible(e,n,r){return Td(this,e,n,r),this}}const Is=Object.create(null);class le{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new bC(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=q.empty){let r=n.content.lastChild,i=null;for(let a=0;a<n.openEnd;a++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:c,$to:d}=s[a],u=e.mapping.slice(o);e.replaceRange(u.map(c.pos),u.map(d.pos),a?q.empty:n),a==0&&Rd(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:a}=i[o],c=e.mapping.slice(r),d=c.map(s.pos),u=c.map(a.pos);o?e.deleteRange(d,u):(e.replaceRangeWith(d,u,n),Rd(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new ie(e):dr(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?dr(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):dr(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 ot(e.node(0))}static atStart(e){return dr(e,e,0,0,1)||new ot(e)}static atEnd(e){return dr(e,e,e.content.size,e.childCount,-1)||new ot(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Is[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 Is)throw new RangeError("Duplicate use of selection JSON ID "+e);return Is[e]=n,n.prototype.jsonID=e,n}getBookmark(){return ie.between(this.$anchor,this.$head).getBookmark()}}le.prototype.visible=!0;class bC{constructor(e,n){this.$from=e,this.$to=n}}let Pd=!1;function _d(t){!Pd&&!t.parent.inlineContent&&(Pd=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class ie extends le{constructor(e,n=e){_d(e),_d(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 le.near(r);let i=e.resolve(n.map(this.anchor));return new ie(i.parent.inlineContent?i:r,r)}replace(e,n=q.empty){if(super.replace(e,n),n==q.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ie&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new ao(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 ie(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=le.findFrom(n,r,!0)||le.findFrom(n,-r,!0);if(o)n=o.$head;else return le.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(le.findFrom(e,-r,!0)||le.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new ie(e,n)}}le.jsonID("text",ie);class ao{constructor(e,n){this.anchor=e,this.head=n}map(e){return new ao(e.map(this.anchor),e.map(this.head))}resolve(e){return ie.between(e.resolve(this.anchor),e.resolve(this.head))}}class Z extends le{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?le.near(o):new Z(o)}content(){return new q(R.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 Ps(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,le.jsonID("node",Z);class Ps{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new ao(r,r):new Ps(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Z.isSelectable(r)?new Z(n):le.near(n)}}class ot extends le{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=q.empty){if(n==q.empty){e.delete(0,e.doc.content.size);let r=le.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new ot(e)}map(e){return new ot(e)}eq(e){return e instanceof ot}getBookmark(){return kC}}le.jsonID("all",ot);const kC={map(){return this},resolve(t){return new ot(t)}};function dr(t,e,n,r,i,o=!1){if(e.inlineContent)return ie.create(t,n);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let a=e.child(s);if(a.isAtom){if(!o&&Z.isSelectable(a))return Z.create(t,n-(i<0?a.nodeSize:0))}else{let c=dr(t,a,n+i,i<0?a.childCount:0,i,o);if(c)return c}n+=a.nodeSize*i}return null}function Rd(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof Te||i instanceof $e))return;let o=t.mapping.maps[r],s;o.forEach((a,c,d,u)=>{s==null&&(s=u)}),t.setSelection(le.near(t.doc.resolve(s),n))}const Ld=1,zd=2,Fd=4;class xC extends yC{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|Ld)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&Ld)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=zd,this}ensureMarks(e){return ge.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&zd)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&-3,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)||ge.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(le.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|=Fd,this}get scrolledIntoView(){return(this.updated&Fd)>0}}function jd(t,e){return!e||!t?t:t.bind(e)}class ei{constructor(e,n,r){this.name=e,this.init=jd(n.init,r),this.apply=jd(n.apply,r)}}const vC=[new ei("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new ei("selection",{init(t,e){return t.selection||le.atStart(e.doc)},apply(t){return t.selection}}),new ei("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new ei("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class _s{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=vC.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 ei(r.key,r.spec.state,r))})}}class ur{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 a=this.config.plugins[s];if(a.spec.appendTransaction){let c=i?i[s].n:0,d=i?i[s].state:this,u=c<n.length&&a.spec.appendTransaction.call(a,c?n.slice(c):n,d,r);if(u&&r.filterTransaction(u,s)){if(u.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(u),r=r.applyInner(u),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 ur(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 xC(this)}static create(e){let n=new _s(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new ur(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 _s(this.schema,e.plugins),r=n.fields,i=new ur(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 _s(e.schema,e.plugins),o=new ur(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=Tn.fromJSON(e.schema,n.doc);else if(s.name=="selection")o.selection=le.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 a in r){let c=r[a],d=c.spec.state;if(c.key==s.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){o[s.name]=d.fromJSON.call(c,e,n[a],o);return}}o[s.name]=s.init(e,o)}}),o}}function Hd(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Hd(i,e,{})),n[r]=i}return n}class ze{constructor(e){this.spec=e,this.props={},e.props&&Hd(e.props,this,this.props),this.key=e.key?e.key.key:Wd("plugin")}getState(e){return e[this.key]}}const Rs=Object.create(null);function Wd(t){return t in Rs?t+"$"+ ++Rs[t]:(Rs[t]=0,t+"$")}class yt{constructor(e="key"){this.key=Wd(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ve=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},ti=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Ls=null;const Ft=function(t,e,n){let r=Ls||(Ls=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},wC=function(){Ls=null},Nn=function(t,e,n,r){return n&&(qd(t,e,n,r,-1)||qd(t,e,n,r,1))},SC=/^(img|br|input|textarea|hr)$/i;function qd(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Mt(t))){let o=t.parentNode;if(!o||o.nodeType!=1||ni(t)||SC.test(t.nodeName)||t.contentEditable=="false")return!1;e=Ve(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?Mt(t):0}else return!1}}function Mt(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function CC(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=Mt(t)}else if(t.parentNode&&!ni(t))e=Ve(t),t=t.parentNode;else return null}}function OC(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&&!ni(t))e=Ve(t)+1,t=t.parentNode;else return null}}function EC(t,e,n){for(let r=e==0,i=e==Mt(t);r||i;){if(t==n)return!0;let o=Ve(t);if(t=t.parentNode,!t)return!1;r=r&&o==0,i=i&&o==Mt(t)}}function ni(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 lo=function(t){return t.focusNode&&Nn(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Bn(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function MC(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function TC(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 Tt=typeof navigator<"u"?navigator:null,Ud=typeof document<"u"?document:null,rn=Tt&&Tt.userAgent||"",zs=/Edge\/(\d+)/.exec(rn),Kd=/MSIE \d/.exec(rn),Fs=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(rn),Je=!!(Kd||Fs||zs),on=Kd?document.documentMode:Fs?+Fs[1]:zs?+zs[1]:0,bt=!Je&&/gecko\/(\d+)/i.test(rn);bt&&+(/Firefox\/(\d+)/.exec(rn)||[0,0])[1];const js=!Je&&/Chrome\/(\d+)/.exec(rn),Fe=!!js,$C=js?+js[1]:0,je=!Je&&!!Tt&&/Apple Computer/.test(Tt.vendor),fr=je&&(/Mobile\/\w+/.test(rn)||!!Tt&&Tt.maxTouchPoints>2),st=fr||(Tt?/Mac/.test(Tt.platform):!1),NC=Tt?/Win/.test(Tt.platform):!1,kt=/Android \d/.test(rn),ri=!!Ud&&"webkitFontSmoothing"in Ud.documentElement.style,BC=ri?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function AC(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 jt(t,e){return typeof t=="number"?t:t[e]}function DC(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 Yd(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=ti(s)){if(s.nodeType!=1)continue;let a=s,c=a==o.body,d=c?AC(o):DC(a),u=0,f=0;if(e.top<d.top+jt(r,"top")?f=-(d.top-e.top+jt(i,"top")):e.bottom>d.bottom-jt(r,"bottom")&&(f=e.bottom-e.top>d.bottom-d.top?e.top+jt(i,"top")-d.top:e.bottom-d.bottom+jt(i,"bottom")),e.left<d.left+jt(r,"left")?u=-(d.left-e.left+jt(i,"left")):e.right>d.right-jt(r,"right")&&(u=e.right-d.right+jt(i,"right")),u||f)if(c)o.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(c||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function VC(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 a=t.root.elementFromPoint(o,s);if(!a||a==t.dom||!t.dom.contains(a))continue;let c=a.getBoundingClientRect();if(c.top>=n-20){r=a,i=c.top;break}}return{refDOM:r,refTop:i,stack:Jd(t.dom)}}function Jd(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=ti(r));return e}function IC({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Gd(n,r==0?0:r-e)}function Gd(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 hr=null;function PC(t){if(t.setActive)return t.setActive();if(hr)return t.focus(hr);let e=Jd(t);t.focus(hr==null?{get preventScroll(){return hr={preventScroll:!0},!0}}:void 0),hr||(hr=!1,Gd(e,0))}function Zd(t,e){let n,r=2e8,i,o=0,s=e.top,a=e.top,c,d;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=Ft(u).getClientRects();else continue;for(let p=0;p<h.length;p++){let m=h[p];if(m.top<=s&&m.bottom>=a){s=Math.max(m.bottom,s),a=Math.min(m.top,a);let 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&&(o=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!c&&m.left<=e.left&&m.right>=e.left&&(c=u,d={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&&c&&(n=c,i=d,r=0),n&&n.nodeType==3?_C(n,i):!n||r&&n.nodeType==1?{node:t,offset:o}:Zd(n,i)}function _C(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=sn(r,1);if(o.top!=o.bottom&&Hs(e,o))return{node:t,offset:i+(e.left>=(o.left+o.right)/2?1:0)}}return{node:t,offset:0}}function Hs(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function RC(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function LC(t,e,n){let{node:r,offset:i}=Zd(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 zC(t,e,n,r){let i=-1;for(let o=e,s=!1;o!=t.dom;){let a=t.docView.nearestDesc(o,!0);if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)){let c=a.dom.getBoundingClientRect();if(a.node.isBlock&&a.parent&&(!s&&c.left>r.left||c.top>r.top?i=a.posBefore:(!s&&c.right<r.left||c.bottom<r.top)&&(i=a.posAfter),s=!0),!a.contentDOM&&i<0&&!a.node.isText)return(a.node.isBlock?r.top<(c.top+c.bottom)/2:r.left<(c.left+c.right)/2)?a.posBefore:a.posAfter}o=a.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function Xd(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 a=s.getClientRects();for(let c=0;c<a.length;c++){let d=a[c];if(Hs(e,d))return Xd(s,e,d)}}if((o=(o+1)%r)==i)break}return t}function FC(t,e){let n=t.dom.ownerDocument,r,i=0,o=TC(n,e.left,e.top);o&&({node:r,offset:i}=o);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let d=t.dom.getBoundingClientRect();if(!Hs(e,d)||(s=Xd(t.dom,e,d),!s))return null}if(je)for(let d=s;r&&d;d=ti(d))d.draggable&&(r=void 0);if(s=RC(s,e),r){if(bt&&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 d;ri&&i&&r.nodeType==1&&(d=r.childNodes[i-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=zC(t,r,i,e))}a==null&&(a=LC(t,s,e));let c=t.docView.nearestDesc(s,!0);return{pos:a,inside:c?c.posAtStart-c.border:-1}}function Qd(t){return t.top<t.bottom||t.left<t.right}function sn(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Qd(r))return r}return Array.prototype.find.call(n,Qd)||t.getBoundingClientRect()}const jC=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function eu(t,e,n){let{node:r,offset:i,atom:o}=t.docView.domFromPos(e,n<0?-1:1),s=ri||bt;if(r.nodeType==3)if(s&&(jC.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let c=sn(Ft(r,i,i),n);if(bt&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let d=sn(Ft(r,i-1,i-1),-1);if(d.top==c.top){let u=sn(Ft(r,i,i+1),-1);if(u.top!=c.top)return ii(u,u.left<d.left)}}return c}else{let c=i,d=i,u=n<0?1:-1;return n<0&&!i?(d++,u=-1):n>=0&&i==r.nodeValue.length?(c--,u=1):n<0?c--:d++,ii(sn(Ft(r,c,d),u),u<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==Mt(r))){let c=r.childNodes[i-1];if(c.nodeType==1)return Ws(c.getBoundingClientRect(),!1)}if(o==null&&i<Mt(r)){let c=r.childNodes[i];if(c.nodeType==1)return Ws(c.getBoundingClientRect(),!0)}return Ws(r.getBoundingClientRect(),n>=0)}if(o==null&&i&&(n<0||i==Mt(r))){let c=r.childNodes[i-1],d=c.nodeType==3?Ft(c,Mt(c)-(s?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(d)return ii(sn(d,1),!1)}if(o==null&&i<Mt(r)){let c=r.childNodes[i];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let d=c?c.nodeType==3?Ft(c,0,s?0:1):c.nodeType==1?c:null:null;if(d)return ii(sn(d,-1),!0)}return ii(sn(r.nodeType==3?Ft(r):r,-n),n>=0)}function ii(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 Ws(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 tu(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 HC(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return tu(t,e,()=>{let{node:o}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(o,!0);if(!a)break;if(a.node.isBlock){o=a.contentDOM||a.dom;break}o=a.dom.parentNode}let s=eu(t,i.pos,1);for(let a=o.firstChild;a;a=a.nextSibling){let c;if(a.nodeType==1)c=a.getClientRects();else if(a.nodeType==3)c=Ft(a,0,a.nodeValue.length).getClientRects();else continue;for(let d=0;d<c.length;d++){let u=c[d];if(u.bottom>u.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const WC=/[\u0590-\u08ac]/;function qC(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,a=t.domSelection();return!WC.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?o:s:tu(t,e,()=>{let{focusNode:c,focusOffset:d,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)||c==m&&d==y;try{a.collapse(u,f),c&&(c!=u||d!=f)&&a.extend&&a.extend(c,d)}catch{}return h!=null&&(a.caretBidiLevel=h),g})}let nu=null,ru=null,iu=!1;function UC(t,e,n){return nu==e&&ru==n?iu:(nu=e,ru=n,iu=n=="up"||n=="down"?HC(t,e,n):qC(t,e,n))}const at=0,ou=1,An=2,$t=3;class oi{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=at,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>Ve(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],a=o+s.size;if(a>e||s instanceof lu){i=e-o;break}o=a}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 su&&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?Ve(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?Ve(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,a=0;;a++){let c=this.children[a],d=s+c.size;if(i==-1&&e<=d){let u=s+c.border;if(e>=u&&n<=d-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,n,u);e=s;for(let f=a;f>0;f--){let h=this.children[f-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=Ve(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(d>n||a==this.children.length-1)){n=d;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)){o=Ve(f.dom);break}n+=f.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=d}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 a=this.domFromPos(e,e?-1:1),c=n==e?a:this.domFromPos(n,n?-1:1),d=r.getSelection(),u=!1;if((bt||je)&&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=c={node:y.parentNode,offset:Ve(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(bt&&d.focusNode&&d.focusNode!=c.node&&d.focusNode.nodeType==1){let h=d.focusNode.childNodes[d.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||u&&je)&&Nn(a.node,a.offset,d.anchorNode,d.anchorOffset)&&Nn(c.node,c.offset,d.focusNode,d.focusOffset))return;let f=!1;if((d.extend||e==n)&&!u){d.collapse(a.node,a.offset);try{e!=n&&d.extend(c.node,c.offset),f=!0}catch{}}if(!f){if(e>n){let p=a;a=c,c=p}let h=document.createRange();h.setEnd(c.node,c.offset),h.setStart(a.node,a.offset),d.removeAllRanges(),d.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 a=r+o.border,c=s-o.border;if(e>=a&&n<=c){this.dirty=e==r||n==s?An:ou,e==a&&n==c&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=$t:o.markDirty(e-a,n-a);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?An:$t}r=s}this.dirty=An}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?An:ou;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class su extends oi{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 a=document.createElement("span");a.appendChild(s),s=a}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==at&&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 KC extends oi{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 Dn extends oi{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=Ot.renderSpec(document,n.type.spec.toDOM(n,r))),new Dn(e,n,s.dom,s.contentDOM||s.dom)}parseRule(){return this.dirty&$t||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=$t&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=at){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=at}}slice(e,n,r){let i=Dn.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;n<s&&(o=Ks(o,n,s,r)),e>0&&(o=Ks(o,0,e,r));for(let a=0;a<o.length;a++)o[a].parent=i;return i.children=o,i}}class an extends oi{constructor(e,n,r,i,o,s,a,c,d){super(e,[],o,s),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,n,r,i,o,s){let a=o.nodeViews[n.type.name],c,d=a&&a(n,o,()=>{if(!c)return s;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=d&&d.dom,f=d&&d.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}=Ot.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=uu(u,r,n),d?c=new YC(e,n,r,i,u,f||null,h,d,o,s+1):n.isText?new co(e,n,r,i,u,h,o):new an(e,n,r,i,u,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=()=>R.empty)}return e}matchesNode(e,n,r){return this.dirty==at&&e.eq(this.node)&&Us(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,a=o&&o.pos<0,c=new GC(this,s&&s.node,e);QC(this.node,this.innerDeco,(d,u,f)=>{d.spec.marks?c.syncToMarks(d.spec.marks,r,e):d.type.side>=0&&!f&&c.syncToMarks(u==this.node.childCount?ge.none:this.node.child(u).marks,r,e),c.placeWidget(d,e,i)},(d,u,f,h)=>{c.syncToMarks(d.marks,r,e);let p;c.findNodeMatch(d,u,f,h)||a&&e.state.selection.from>i&&e.state.selection.to<i+d.nodeSize&&(p=c.findIndexWithChild(o.node))>-1&&c.updateNodeAt(d,u,f,p,e)||c.updateNextNode(d,u,f,e,h,i)||c.addNode(d,u,f,e,i),i+=d.nodeSize}),c.syncToMarks([],r,e),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==An)&&(s&&this.protectLocalComposition(e,s),cu(this.contentDOM,this.children,e),fr&&eO(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof ie)||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,a=tO(this.node.content,s,r-n,i-n);return a<0?null:{node:o,pos:a,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 KC(this,o,n,i);e.input.compositionNodes.push(s),this.children=Ks(this.children,r,r+i.length,e,s)}update(e,n,r,i){return this.dirty==$t||!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=at}updateOuterDeco(e){if(Us(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=du(this.dom,this.nodeDOM,qs(this.outerDeco,this.node,n),qs(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 au(t,e,n,r,i){uu(r,e,t);let o=new an(void 0,t,e,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class co extends an{constructor(e,n,r,i,o,s,a){super(e,n,r,i,o,null,s,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==$t||this.dirty!=at&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=at||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=at,!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 co(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=$t)}get domAtom(){return!1}isText(e){return this.node.text==e}}class lu extends oi{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==at&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class YC extends an{constructor(e,n,r,i,o,s,a,c,d,u){super(e,n,r,i,o,s,a,d,u),this.spec=c}update(e,n,r,i){if(this.dirty==$t)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 cu(t,e,n){let r=t.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],a=s.dom;if(a.parentNode==t){for(;a!=r;)r=fu(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(a,r);if(s instanceof Dn){let c=r?r.previousSibling:t.lastChild;cu(s.contentDOM,s.children,n),r=c?c.nextSibling:t.firstChild}}for(;r;)r=fu(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const si=function(t){t&&(this.nodeName=t)};si.prototype=Object.create(null);const Vn=[new si];function qs(t,e,n){if(t.length==0)return Vn;let r=n?Vn[0]:new si,i=[r];for(let o=0;o<t.length;o++){let s=t[o].type.attrs;if(s){s.nodeName&&i.push(r=new si(s.nodeName));for(let a in s){let c=s[a];c!=null&&(n&&i.length==1&&i.push(r=new si(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+c:a=="style"?r.style=(r.style?r.style+";":"")+c:a!="nodeName"&&(r[a]=c))}}}return i}function du(t,e,n,r){if(n==Vn&&r==Vn)return e;let i=e;for(let o=0;o<r.length;o++){let s=r[o],a=n[o];if(o){let c;a&&a.nodeName==s.nodeName&&i!=t&&(c=i.parentNode)&&c.nodeName.toLowerCase()==s.nodeName||(c=document.createElement(s.nodeName),c.pmIsDeco=!0,c.appendChild(i),a=Vn[0]),i=c}JC(i,a||Vn[0],s)}return i}function JC(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 uu(t,e,n){return du(t,t,Vn,qs(e,n,t.nodeType!=1))}function Us(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 fu(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class GC{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=ZC(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=at,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let c=this.index;c<Math.min(this.index+3,this.top.children.length);c++){let d=this.top.children[c];if(d.matchesMark(e[o])&&!this.isLocked(d.dom)){a=c;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let c=Dn.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,c),this.top=c,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 a=this.index,c=Math.min(this.top.children.length,a+5);a<c;a++){let d=this.top.children[a];if(d.matchesNode(e,n,r)&&!this.preMatch.matched.has(d)){o=a;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==$t&&s.dom==s.contentDOM&&(s.dirty=An),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 a=this.index;a<this.top.children.length;a++){let c=this.top.children[a];if(c instanceof an){let d=this.preMatch.matched.get(c);if(d!=null&&d!=o)return!1;let u=c.dom,f,h=this.isLocked(u)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=$t&&Us(n,c.outerDeco));if(!h&&c.update(e,n,r,i))return this.destroyBetween(this.index,a),c.dom!=u&&(this.changed=!0),this.index++,!0;if(!h&&(f=this.recreateWrapper(c,e,n,r,i,s)))return this.top.children[this.index]=f,f.contentDOM&&(f.dirty=An,f.updateChildren(i,s+1),f.dirty=at),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 a=an.create(this.top,n,r,i,o,s);if(a.contentDOM){a.children=e.children,e.children=[];for(let c of a.children)c.parent=a}return e.destroy(),a}addNode(e,n,r,i,o){let s=an.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 su(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 Dn;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof co)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((je||Fe)&&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 lu(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 ZC(t,e){let n=e,r=n.children.length,i=t.childCount,o=new Map,s=[];e:for(;i>0;){let a;for(;;)if(r){let d=n.children[r-1];if(d instanceof Dn)n=d,r=d.children.length;else{a=d,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let c=a.node;if(c){if(c!=t.child(i-1))break;--i,o.set(a,i),s.push(a)}}return{index:i,matched:o,matches:s.reverse()}}function XC(t,e){return t.type.side-e.type.side}function QC(t,e,n,r){let i=e.locals(t),o=0;if(i.length==0){for(let d=0;d<t.childCount;d++){let u=t.child(d);r(u,i,e.forChild(o,u),d),o+=u.nodeSize}return}let s=0,a=[],c=null;for(let d=0;;){let u,f;for(;s<i.length&&i[s].to==o;){let g=i[s++];g.widget&&(u?(f||(f=[u])).push(g):u=g)}if(u)if(f){f.sort(XC);for(let g=0;g<f.length;g++)n(f[g],d,!!c)}else n(u,d,!!c);let h,p;if(c)p=-1,h=c,c=null;else if(d<t.childCount)p=d,h=t.child(d++);else break;for(let g=0;g<a.length;g++)a[g].to<=o&&a.splice(g--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)a.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 k=0;k<a.length;k++)a[k].to<g&&(g=a[k].to);g<m&&(c=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?a.filter(g=>!g.inline):a.slice();r(h,y,e.forChild(o,h),p),o=m}}function eO(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 tO(t,e,n,r){for(let i=0,o=0;i<t.childCount&&o<=r;){let s=t.child(i++),a=o;if(o+=s.nodeSize,!s.isText)continue;let c=s.text;for(;i<t.childCount;){let d=t.child(i++);if(o+=d.nodeSize,!d.isText)break;c+=d.text}if(o>=n){if(o>=r&&c.slice(r-e.length-a,r-a)==e)return r-e.length;let d=a<r?c.lastIndexOf(e,r-a-1):-1;if(d>=0&&d+e.length+a>=n)return a+d;if(n==r&&c.length>=r+e.length-a&&c.slice(r-a,r-a+e.length)==e)return r}}return-1}function Ks(t,e,n,r,i){let o=[];for(let s=0,a=0;s<t.length;s++){let c=t[s],d=a,u=a+=c.size;d>=n||u<=e?o.push(c):(d<e&&o.push(c.slice(0,e-d,r)),i&&(o.push(i),i=void 0),u>n&&o.push(c.slice(n-d,c.size,r)))}return o}function Ys(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 a=r.resolve(s),c,d;if(lo(n)){for(c=a;i&&!i.node;)i=i.parent;let u=i.node;if(i&&u.isAtom&&Z.isSelectable(u)&&i.parent&&!(u.isInline&&EC(n.focusNode,n.focusOffset,i.dom))){let f=i.posBefore;d=new Z(s==f?a:r.resolve(f))}}else{let u=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(u<0)return null;c=r.resolve(u)}if(!d){let u=e=="pointer"||t.state.selection.head<a.pos&&!o?1:-1;d=Gs(t,c,a,u)}return d}function hu(t){return t.editable?t.hasFocus():xu(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Ht(t,e=!1){let n=t.state.selection;if(yu(t,n),!!hu(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Fe){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Nn(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)rO(t);else{let{anchor:r,head:i}=n,o,s;pu&&!(n instanceof ie)&&(n.$from.parent.inlineContent||(o=mu(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=mu(t,n.to))),t.docView.setSelection(r,i,t.root,e),pu&&(o&&gu(o),s&&gu(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&nO(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const pu=je||Fe&&$C<63;function mu(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(je&&i&&i.contentEditable=="false")return Js(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return Js(i);if(o)return Js(o)}}function Js(t){return t.contentEditable="true",je&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function gu(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function nO(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(()=>{(!hu(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function rO(t){let e=t.domSelection(),n=document.createRange(),r=t.cursorWrapper.dom,i=r.nodeName=="IMG";i?n.setEnd(r.parentNode,Ve(r)+1):n.setEnd(r,0),n.collapse(!1),e.removeAllRanges(),e.addRange(n),!i&&!t.state.selection.visible&&Je&&on<=11&&(r.disabled=!0,r.disabled=!1)}function yu(t,e){if(e instanceof Z){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(bu(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else bu(t)}function bu(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Gs(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||ie.between(e,n,r)}function ku(t){return t.editable&&!t.hasFocus()?!1:xu(t)}function xu(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 iO(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Nn(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Zs(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&&le.findFrom(o,e)}function ln(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function vu(t,e,n){let r=t.state.selection;if(r instanceof ie)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 ln(t,new ie(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Zs(t.state,e);return i&&i instanceof Z?ln(t,i):!1}else if(!(st&&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 a=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=t.docView.descAt(a))&&!s.contentDOM?Z.isSelectable(o)?ln(t,new Z(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):ri?ln(t,new ie(t.state.doc.resolve(e<0?a:a+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Z&&r.node.isInline)return ln(t,new ie(e>0?r.$to:r.$from));{let i=Zs(t.state,e);return i?ln(t,i):!1}}}function uo(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function ai(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function pr(t,e){return e<0?oO(t):sO(t)}function oO(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,o,s=!1;for(bt&&n.nodeType==1&&r<uo(n)&&ai(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(ai(a,-1))i=n,o=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(wu(n))break;{let a=n.previousSibling;for(;a&&ai(a,-1);)i=n.parentNode,o=Ve(a),a=a.previousSibling;if(a)n=a,r=uo(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?Xs(t,n,r):i&&Xs(t,i,o)}function sO(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=uo(n),o,s;for(;;)if(r<i){if(n.nodeType!=1)break;let a=n.childNodes[r];if(ai(a,1))o=n,s=++r;else break}else{if(wu(n))break;{let a=n.nextSibling;for(;a&&ai(a,1);)o=a.parentNode,s=Ve(a)+1,a=a.nextSibling;if(a)n=a,r=0,i=uo(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}o&&Xs(t,o,s)}function wu(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function aO(t,e){for(;t&&e==t.childNodes.length&&!ni(t);)e=Ve(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 lO(t,e){for(;t&&!e&&!ni(t);)e=Ve(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 Xs(t,e,n){if(e.nodeType!=3){let o,s;(s=aO(e,n))?(e=s,n=0):(o=lO(e,n))&&(e=o,n=o.nodeValue.length)}let r=t.domSelection();if(lo(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&&Ht(t)},50)}function Su(t,e){let n=t.state.doc.resolve(e);if(!(Fe||NC)&&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 Cu(t,e,n){let r=t.state.selection;if(r instanceof ie&&!r.empty||n.indexOf("s")>-1||st&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Zs(t.state,e);if(s&&s instanceof Z)return ln(t,s)}if(!i.parent.inlineContent){let s=e<0?i:o,a=r instanceof ot?le.near(s,e):le.findFrom(s,e);return a?ln(t,a):!1}return!1}function Ou(t,e){if(!(t.state.selection instanceof ie))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 Eu(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function cO(t){if(!je||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;Eu(t,r,"true"),setTimeout(()=>Eu(t,r,"false"),20)}return!1}function dO(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function uO(t,e){let n=e.keyCode,r=dO(e);if(n==8||st&&n==72&&r=="c")return Ou(t,-1)||pr(t,-1);if(n==46&&!e.shiftKey||st&&n==68&&r=="c")return Ou(t,1)||pr(t,1);if(n==13||n==27)return!0;if(n==37||st&&n==66&&r=="c"){let i=n==37?Su(t,t.state.selection.from)=="ltr"?-1:1:-1;return vu(t,i,r)||pr(t,i)}else if(n==39||st&&n==70&&r=="c"){let i=n==39?Su(t,t.state.selection.from)=="ltr"?1:-1:1;return vu(t,i,r)||pr(t,i)}else{if(n==38||st&&n==80&&r=="c")return Cu(t,-1,r)||pr(t,-1);if(n==40||st&&n==78&&r=="c")return cO(t)||Cu(t,1,r)||pr(t,1);if(r==(st?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Mu(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")||Ot.fromSchema(t.state.schema),a=Iu(),c=a.createElement("div");c.appendChild(s.serializeFragment(r,{document:a}));let d=c.firstChild,u,f=0;for(;d&&d.nodeType==1&&(u=Du[d.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let m=a.createElement(u[p]);for(;c.firstChild;)m.appendChild(c.firstChild);c.appendChild(m),f++}d=c.firstChild}d&&d.nodeType==1&&d.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:c,text:h,slice:e}}function Tu(t,e,n,r,i){let o=i.parent.type.spec.code,s,a;if(!n&&!e)return null;let c=e&&(r||o||!n);if(c){if(t.someProp("transformPastedText",h=>{e=h(e,o||r,t)}),o)return e?new q(R.from(t.state.schema.text(e.replace(/\r\n?/g,`
13
+ `))),0,0):q.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=Ot.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=pO(n),ri&&mO(s);let d=s&&s.querySelector("[data-pm-slice]"),u=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let h=s.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;s=h}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||ir.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!fO.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)a=gO(Au(a,+u[1],+u[2]),u[4]);else if(a=q.maxOpen(hO(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=Au(a,f,h)}return t.someProp("transformPasted",f=>{a=f(a,t)}),a}const fO=/^(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 hO(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(a=>{if(!s)return;let c=i.findWrapping(a.type),d;if(!c)return s=null;if(d=s.length&&o.length&&Nu(c,o,a,s[s.length-1],0))s[s.length-1]=d;else{s.length&&(s[s.length-1]=Bu(s[s.length-1],o.length));let u=$u(a,c);s.push(u),i=i.matchType(u.type),o=c}}),s)return R.from(s)}return t}function $u(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,R.from(t));return t}function Nu(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let o=Nu(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(R.from($u(n,t,i+1))))}}function Bu(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Bu(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(R.empty,!0);return t.copy(n.append(r))}function Qs(t,e,n,r,i,o){let s=e<0?t.firstChild:t.lastChild,a=s.content;return t.childCount>1&&(o=0),i<r-1&&(a=Qs(a,e,n,r,i+1,o)),i>=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(R.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function Au(t,e,n){return e<t.openStart&&(t=new q(Qs(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new q(Qs(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Du={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 Vu=null;function Iu(){return Vu||(Vu=document.implementation.createHTMLDocument("title"))}function pO(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Iu().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&Du[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 mO(t){let e=t.querySelectorAll(Fe?"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 gO(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 a=r.length-2;a>=0;a-=2){let c=n.nodes[r[a]];if(!c||c.hasRequiredAttrs())break;i=R.from(c.create(r[a+1],i)),o++,s++}return new q(i,o,s)}const He={},We={},yO={touchstart:!0,touchmove:!0};class bO{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 kO(t){for(let e in He){let n=He[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{vO(t,r)&&!ta(t,r)&&(t.editable||!(r.type in We))&&n(t,r)},yO[e]?{passive:!0}:void 0)}je&&t.dom.addEventListener("input",()=>null),ea(t)}function cn(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function xO(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 ea(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>ta(t,r))})}function ta(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function vO(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 wO(t,e){!ta(t,e)&&He[e.type]&&(t.editable||!(e.type in We))&&He[e.type](t,e)}We.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!_u(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(kt&&Fe&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),fr&&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,Bn(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||uO(t,n)?n.preventDefault():cn(t,"key")},We.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)},We.keypress=(t,e)=>{let n=e;if(_u(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||st&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof ie)||!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 fo(t){return{left:t.clientX,top:t.clientY}}function SO(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function na(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,a=>s>o.depth?a(t,n,o.nodeAfter,o.before(s),i,!0):a(t,n,o.node(s),o.before(s),i,!1)))return!0;return!1}function mr(t,e,n){t.focused||t.focus();let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function CO(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Z.isSelectable(r)?(mr(t,new Z(n)),!0):!1}function OO(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 a=s>o.depth?o.nodeAfter:o.node(s);if(Z.isSelectable(a)){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?(mr(t,Z.create(t.state.doc,i)),!0):!1}function EO(t,e,n,r,i){return na(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>o(t,e,r))||(i?OO(t,n):CO(t,n))}function MO(t,e,n,r){return na(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function TO(t,e,n,r){return na(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||$O(t,n,r)}function $O(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(mr(t,ie.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),a=i.before(o);if(s.inlineContent)mr(t,ie.create(r,a+1,a+1+s.content.size));else if(Z.isSelectable(s))mr(t,Z.create(r,a));else continue;return!0}}function ra(t){return ho(t)}const Pu=st?"metaKey":"ctrlKey";He.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=ra(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&SO(n,t.input.lastClick)&&!n[Pu]&&(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(fo(n));s&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new NO(t,s,n,!!r)):(o=="doubleClick"?MO:TO)(t,s.pos,s.inside,n)?n.preventDefault():cn(t,"pointer"))};class NO{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[Pu],this.allowDefault=r.shiftKey;let o,s;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);o=u.parent,s=u.depth?u.before():0}const a=i?null:r.target,c=a?e.docView.nearestDesc(a,!0):null;this.target=c&&c.dom.nodeType==1?c.dom:null;let{selection:d}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||d instanceof Z&&d.from<=s&&d.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&bt&&!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)),cn(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(()=>Ht(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(fo(e))),this.updateAllowDefault(e),this.allowDefault||!n?cn(this.view,"pointer"):EO(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||je&&this.mightDrag&&!this.mightDrag.node.isAtom||Fe&&!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)?(mr(this.view,le.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):cn(this.view,"pointer")}move(e){this.updateAllowDefault(e),cn(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)}}He.touchstart=t=>{t.input.lastTouch=Date.now(),ra(t),cn(t,"pointer")},He.touchmove=t=>{t.input.lastTouch=Date.now(),cn(t,"pointer")},He.contextmenu=t=>ra(t);function _u(t,e){return t.composing?!0:je&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const BO=kt?5e3:-1;We.compositionstart=We.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(),ho(t,!0),t.markCursor=null;else if(ho(t),bt&&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}Ru(t,BO)},We.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++,Ru(t,20))};function Ru(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>ho(t),e))}function Lu(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=DO());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function AO(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=CC(e.focusNode,e.focusOffset),r=OC(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 DO(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function ho(t,e=!1){if(!(kt&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Lu(t),e||t.docView&&t.docView.dirty){let n=Ys(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):t.updateState(t.state),!0}return!1}}function VO(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 li=Je&&on<15||fr&&BC<604;He.copy=We.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let o=li?null:n.clipboardData,s=r.content(),{dom:a,text:c}=Mu(t,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",c)):VO(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function IO(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function PO(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?ci(t,r.value,null,i,e):ci(t,r.textContent,r.innerHTML,i,e)},50)}function ci(t,e,n,r,i){let o=Tu(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,i,o||q.empty)))return!0;if(!o)return!1;let s=IO(o),a=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(o);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function zu(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," "):""}We.paste=(t,e)=>{let n=e;if(t.composing&&!kt)return;let r=li?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&ci(t,zu(r),r.getData("text/html"),i,n)?n.preventDefault():PO(t,n)};class Fu{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const ju=st?"altKey":"ctrlKey";He.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(fo(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 a=(s||t.state.selection).content(),{dom:c,text:d,slice:u}=Mu(t,a);n.dataTransfer.clearData(),n.dataTransfer.setData(li?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",li||n.dataTransfer.setData("text/plain",d),t.dragging=new Fu(u,!n[ju],s)},He.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)},We.dragover=We.dragenter=(t,e)=>e.preventDefault(),We.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let i=t.posAtCoords(fo(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=Tu(t,zu(n.dataTransfer),li?null:n.dataTransfer.getData("text/html"),!1,o);let a=!!(r&&!n[ju]);if(t.someProp("handleDrop",m=>m(t,n,s||q.empty,a))){n.preventDefault();return}if(!s)return;n.preventDefault();let c=s?Bd(t.state.doc,o.pos,s):o.pos;c==null&&(c=o.pos);let d=t.state.tr;if(a){let{node:m}=r;m?m.replace(d):d.deleteSelection()}let u=d.mapping.map(c),f=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,h=d.doc;if(f?d.replaceRangeWith(u,u,s.content.firstChild):d.replaceRange(u,u,s),d.doc.eq(h))return;let p=d.doc.resolve(u);if(f&&Z.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))d.setSelection(new Z(p));else{let m=d.mapping.map(c);d.mapping.maps[d.mapping.maps.length-1].forEach((y,g,k,C)=>m=C),d.setSelection(Gs(t,p,d.doc.resolve(m)))}t.focus(),t.dispatch(d.setMeta("uiEvent","drop"))},He.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())&&Ht(t)},20))},He.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)},He.beforeinput=(t,e)=>{if(Fe&&kt&&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,Bn(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 We)He[t]=We[t];function di(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 po{constructor(e,n){this.toDOM=e,this.spec=n||In,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 et(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof po&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&di(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class dn{constructor(e,n){this.attrs=e,this.spec=n||In}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 et(o,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof dn&&di(this.attrs,e.attrs)&&di(this.spec,e.spec)}static is(e){return e.type instanceof dn}destroy(){}}class ia{constructor(e,n){this.attrs=e,this.spec=n||In}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 et(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 ia&&di(this.attrs,e.attrs)&&di(this.spec,e.spec)}destroy(){}}class et{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new et(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 et(e,e,new po(n,r))}static inline(e,n,r,i){return new et(e,n,new dn(r,i))}static node(e,n,r,i){return new et(e,n,new ia(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof dn}get widget(){return this.type instanceof po}}const gr=[],In={};class Ce{constructor(e,n){this.local=e.length?e:gr,this.children=n.length?n:gr}static create(e,n){return n.length?mo(n,e,0,In):_e}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 a=this.local[s];a.from<=n&&a.to>=e&&(!o||o(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let a=this.children[s]+1;this.children[s+2].findInner(e-a,n-a,r,i+a,o)}}map(e,n,r){return this==_e||e.maps.length==0?this:this.mapInner(e,n,0,0,r||In)}mapInner(e,n,r,i,o){let s;for(let a=0;a<this.local.length;a++){let c=this.local[a].map(e,r,i);c&&c.type.valid(n,c)?(s||(s=[])).push(c):o.onRemove&&o.onRemove(this.local[a].spec)}return this.children.length?_O(this.children,s||[],e,n,r,i,o):s?new Ce(s.sort(Pn),gr):_e}add(e,n){return n.length?this==_e?Ce.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,o=0;e.forEach((a,c)=>{let d=c+r,u;if(u=Wu(n,a,d)){for(i||(i=this.children.slice());o<i.length&&i[o]<c;)o+=3;i[o]==c?i[o+2]=i[o+2].addInner(a,u,d+1):i.splice(o,0,c,c+a.nodeSize,mo(u,a,d+1,In)),o+=3}});let s=Hu(o?qu(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new Ce(s.length?this.local.concat(s).sort(Pn):this.local,i||this.children)}remove(e){return e.length==0||this==_e?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,a=r[o]+n,c=r[o+1]+n;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>a&&f.to<c&&(e[u]=null,(s||(s=[])).push(f));if(!s)continue;r==this.children&&(r=this.children.slice());let d=r[o+2].removeInner(s,a+1);d!=_e?r[o+2]=d:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,s;o<e.length;o++)if(s=e[o])for(let a=0;a<i.length;a++)i[a].eq(s,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 Ce(i,r):_e}forChild(e,n){if(this==_e)return this;if(n.isLeaf)return Ce.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 o=e+1,s=o+n.content.size;for(let a=0;a<this.local.length;a++){let c=this.local[a];if(c.from<s&&c.to>o&&c.type instanceof dn){let d=Math.max(o,c.from)-o,u=Math.min(s,c.to)-o;d<u&&(i||(i=[])).push(c.copy(d,u))}}if(i){let a=new Ce(i.sort(Pn),gr);return r?new un([a,r]):a}return r||_e}eq(e){if(this==e)return!0;if(!(e instanceof Ce)||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 oa(this.localsInner(e))}localsInner(e){if(this==_e)return gr;if(e.inlineContent||!this.local.some(dn.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof dn||n.push(this.local[r]);return n}}Ce.empty=new Ce([],[]),Ce.removeOverlap=oa;const _e=Ce.empty;class un{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,In));return un.from(r)}forChild(e,n){if(n.isLeaf)return Ce.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,n);o!=_e&&(o instanceof un?r=r.concat(o.members):r.push(o))}return un.from(r)}eq(e){if(!(e instanceof un)||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?oa(r?n:n.sort(Pn)):gr}static from(e){switch(e.length){case 0:return _e;case 1:return e[0];default:return new un(e.every(n=>n instanceof Ce)?e:e.reduce((n,r)=>n.concat(r instanceof Ce?r:r.members),[]))}}}function _O(t,e,n,r,i,o,s){let a=t.slice();for(let d=0,u=o;d<n.maps.length;d++){let f=0;n.maps[d].forEach((h,p,m,y)=>{let g=y-m-(p-h);for(let k=0;k<a.length;k+=3){let C=a[k+1];if(C<0||h>C+u-f)continue;let N=a[k]+u-f;p>=N?a[k+1]=h<=N?-2:-1:h>=u&&g&&(a[k]+=g,a[k+1]+=g)}f+=g}),u=n.maps[d].map(u,-1)}let c=!1;for(let d=0;d<a.length;d+=3)if(a[d+1]<0){if(a[d+1]==-2){c=!0,a[d+1]=-1;continue}let u=n.map(t[d]+o),f=u-i;if(f<0||f>=r.content.size){c=!0;continue}let h=n.map(t[d+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 k=a[d+2].mapInner(n,g,u+1,t[d]+o+1,s);k!=_e?(a[d]=f,a[d+1]=p,a[d+2]=k):(a[d+1]=-2,c=!0)}else c=!0}if(c){let d=RO(a,t,e,n,i,o,s),u=mo(d,r,0,s);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 Ce(e.sort(Pn),a)}function Hu(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 et(i.from+e,i.to+e,i.type))}return n}function RO(t,e,n,r,i,o,s){function a(c,d){for(let u=0;u<c.local.length;u++){let f=c.local[u].map(r,i,d);f?n.push(f):s.onRemove&&s.onRemove(c.local[u].spec)}for(let u=0;u<c.children.length;u+=3)a(c.children[u+2],c.children[u]+d+1)}for(let c=0;c<t.length;c+=3)t[c+1]==-1&&a(t[c+2],e[c]+o+1);return n}function Wu(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 qu(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function mo(t,e,n,r){let i=[],o=!1;e.forEach((a,c)=>{let d=Wu(t,a,c+n);if(d){o=!0;let u=mo(d,a,n+c+1,r);u!=_e&&i.push(c,c+a.nodeSize,u)}});let s=Hu(o?qu(t):t,-n).sort(Pn);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||i.length?new Ce(s,i):_e}function Pn(t,e){return t.from-e.from||t.to-e.to}function oa(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),Uu(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),Uu(e,i,r.copy(o.from,r.to)));break}}}return e}function Uu(t,e,n){for(;e<t.length&&Pn(n,t[e])>0;)e++;t.splice(e,0,n)}function sa(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=_e&&e.push(r)}),t.cursorWrapper&&e.push(Ce.create(t.state.doc,[t.cursorWrapper.deco])),un.from(e)}const LO={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},zO=Je&&on<=11;class FO{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 jO{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new FO,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]);Je&&on<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),zO&&(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,LO)),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(ku(this.view)){if(this.suppressingSelectionUpdates)return Ht(this.view);if(Je&&on<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Nn(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=ti(o))n.add(o);for(let o=e.anchorNode;o;o=ti(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)&&ku(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,a=!1,c=[];if(e.editable)for(let u=0;u<n.length;u++){let f=this.registerMutation(n[u],c);f&&(o=o<0?f.from:Math.min(f.from,o),s=s<0?f.to:Math.max(f.to,s),f.typeOver&&(a=!0))}if(bt&&c.length){let u=c.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||qO(e,f)!=p)&&h.remove()}}}let d=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&lo(r)&&(d=Ys(e))&&d.eq(le.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Ht(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),HO(e)),this.handleDOMChange(o,s,a,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Ht(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,o=e.nextSibling;if(Je&&on<=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)&&(o=h)}let s=i&&i.parentNode==e.target?Ve(i)+1:0,a=r.localPosFromDOM(e.target,s,-1),c=o&&o.parentNode==e.target?Ve(o):e.target.childNodes.length,d=r.localPosFromDOM(e.target,c,1);return{from:a,to:d}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Ku=new WeakMap,Yu=!1;function HO(t){if(!Ku.has(t)&&(Ku.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=bt,Yu)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."),Yu=!0}}function Ju(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return Nn(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function WO(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Ju(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?Ju(t,n):null}function qO(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 UO(t,e,n){let{node:r,fromOffset:i,toOffset:o,from:s,to:a}=t.docView.parseRange(e,n),c=t.domSelectionRange(),d,u=c.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],lo(c)||d.push({node:c.focusNode,offset:c.focusOffset})),Fe&&t.input.lastKeyCode===8)for(let g=o;g>i;g--){let k=r.childNodes[g-1],C=k.pmViewDesc;if(k.nodeName=="BR"&&!C){o=g;break}if(!C||C.size)break}let f=t.state.doc,h=t.someProp("domParser")||ir.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:d,ruleFromNode:KO,context:p});if(d&&d[0].pos!=null){let g=d[0].pos,k=d[1]&&d[1].pos;k==null&&(k=g),m={anchor:g+s,head:k+s}}return{doc:y,sel:m,from:s,to:a}}function KO(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(je&&/^(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||je&&/^(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 YO=/^(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 JO(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,B=Ys(t,A);if(B&&!t.state.selection.eq(B)){if(Fe&&kt&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",F=>F(t,Bn(13,"Enter"))))return;let P=t.state.tr.setSelection(B);A=="pointer"?P.setMeta("pointer",!0):A=="key"&&P.scrollIntoView(),o&&P.setMeta("composition",o),t.dispatch(P)}return}let s=t.state.doc.resolve(e),a=s.sharedDepth(n);e=s.before(a+1),n=t.state.doc.resolve(n).after(a+1);let c=t.state.selection,d=UO(t,e,n),u=t.state.doc,f=u.slice(d.from,d.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=XO(f.content,d.doc.content,d.from,h,p);if((fr&&t.input.lastIOSEnter>Date.now()-225||kt)&&i.some(A=>A.nodeType==1&&!YO.test(A.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",A=>A(t,Bn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof ie&&!c.empty&&c.$head.sameParent(c.$anchor)&&!t.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(d.sel){let A=Gu(t,t.state.doc,d.sel);if(A&&!A.eq(t.state.selection)){let B=t.state.tr.setSelection(A);o&&B.setMeta("composition",o),t.dispatch(B)}}return}t.input.domChangeCount++,t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof ie&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=d.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=d.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),Je&&on<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>d.from&&d.doc.textBetween(m.start-d.from-1,m.start-d.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let y=d.doc.resolveNoCache(m.start-d.from),g=d.doc.resolveNoCache(m.endB-d.from),k=u.resolve(m.start),C=y.sameParent(g)&&y.parent.inlineContent&&k.end()>=m.endA,N;if((fr&&t.input.lastIOSEnter>Date.now()-225&&(!C||i.some(A=>A.nodeName=="DIV"||A.nodeName=="P"))||!C&&y.pos<d.doc.content.size&&!y.sameParent(g)&&(N=le.findFrom(d.doc.resolve(y.pos+1),1,!0))&&N.head==g.pos)&&t.someProp("handleKeyDown",A=>A(t,Bn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&ZO(u,m.start,m.endA,y,g)&&t.someProp("handleKeyDown",A=>A(t,Bn(8,"Backspace")))){kt&&Fe&&t.domObserver.suppressSelectionUpdates();return}Fe&&kt&&m.endB==m.start&&(t.input.lastAndroidDelete=Date.now()),kt&&!C&&y.start()!=g.start()&&g.parentOffset==0&&y.depth==g.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==m.endA&&(m.endB-=2,g=d.doc.resolveNoCache(m.endB-d.from),setTimeout(()=>{t.someProp("handleKeyDown",function(A){return A(t,Bn(13,"Enter"))})},20));let b=m.start,S=m.endA,x,$,D;if(C){if(y.pos==g.pos)Je&&on<=11&&y.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ht(t),20)),x=t.state.tr.delete(b,S),$=u.resolve(m.start).marksAcross(u.resolve(m.endA));else if(m.endA==m.endB&&(D=GO(y.parent.content.cut(y.parentOffset,g.parentOffset),k.parent.content.cut(k.parentOffset,m.endA-k.start()))))x=t.state.tr,D.type=="add"?x.addMark(b,S,D.mark):x.removeMark(b,S,D.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",B=>B(t,b,S,A)))return;x=t.state.tr.insertText(A,b,S)}}if(x||(x=t.state.tr.replace(b,S,d.doc.slice(m.start-d.from,m.endB-d.from))),d.sel){let A=Gu(t,x.doc,d.sel);A&&!(Fe&&kt&&t.composing&&A.empty&&(m.start!=m.endB||t.input.lastAndroidDelete<Date.now()-100)&&(A.head==b||A.head==x.mapping.map(S)-1)||Je&&A.empty&&A.head==b)&&x.setSelection(A)}$&&x.ensureMarks($),o&&x.setMeta("composition",o),t.dispatch(x.scrollIntoView())}function Gu(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Gs(t,e.resolve(n.anchor),e.resolve(n.head))}function GO(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,o=r,s,a,c;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<n.length;u++)o=n[u].removeFromSet(o);if(i.length==1&&o.length==0)a=i[0],s="add",c=u=>u.mark(a.addToSet(u.marks));else if(i.length==0&&o.length==1)a=o[0],s="remove",c=u=>u.mark(a.removeFromSet(u.marks));else return null;let d=[];for(let u=0;u<e.childCount;u++)d.push(c(e.child(u)));if(R.from(d).eq(t))return{mark:a,type:s}}function ZO(t,e,n,r,i){if(n-e<=i.pos-r.pos||aa(r,!0,!1)<i.pos)return!1;let o=t.resolve(e);if(!r.parent.isTextblock){let a=o.nodeAfter;return a!=null&&n==e+a.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=t.resolve(aa(o,!0,!0));return!s.parent.isTextblock||s.pos>n||aa(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function aa(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 XO(t,e,n,r,i){let o=t.findDiffStart(e,n);if(o==null)return null;let{a:s,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let c=Math.max(0,o-Math.min(s,a));r-=s+c-o}if(s<o&&t.size<e.size){let c=r<=o&&r>=s?o-r:0;o-=c,o&&o<e.size&&Zu(e.textBetween(o-1,o+1))&&(o+=c?1:-1),a=o+(a-s),s=o}else if(a<o){let c=r<=o&&r>=a?o-r:0;o-=c,o&&o<t.size&&Zu(t.textBetween(o-1,o+1))&&(o+=c?1:-1),s=o+(s-a),a=o}return{start:o,endA:s,endB:a}}function Zu(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 QO{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 bO,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),Qu(this),this.nodeViews=tf(this),this.docView=au(this.state.doc,Xu(this),sa(this),this.dom,this),this.domObserver=new jO(this,(r,i,o,s)=>JO(this,r,i,o,s)),this.domObserver.start(),kO(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&&ea(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,o=!1,s=!1;e.storedMarks&&this.composing&&(Lu(this),s=!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=tf(this);tE(p,this.nodeViews)&&(this.nodeViews=p,o=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&ea(this),this.editable=ef(this),Qu(this);let c=sa(this),d=Xu(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=o||!this.docView.matchesNode(e.doc,d,c);(f||!e.selection.eq(i.selection))&&(s=!0);let h=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&VC(this);if(s){this.domObserver.stop();let p=f&&(Je||Fe)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&eE(i.selection,e.selection);if(f){let m=Fe?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=AO(this)),(o||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=au(e.doc,d,c,this.dom,this)),m&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&iO(this))?Ht(this,p):(yu(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&&IC(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&&Yd(this,n.getBoundingClientRect(),e)}else Yd(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 Fu(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 a=this.directPlugins[s].props[e];if(a!=null&&(i=n?n(a):a))return i}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let a=o[s].props[e];if(a!=null&&(i=n?n(a):a))return i}}hasFocus(){if(Je){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&&PC(this.dom),Ht(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 FC(this,e)}coordsAtPos(e,n=1){return eu(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 UC(this,n||this.state,e)}pasteHTML(e,n){return ci(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ci(this,e,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(xO(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],sa(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,wC())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return wO(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 je&&this.root.nodeType===11&&MC(this.dom.ownerDocument)==this.dom&&WO(this,e)||e}domSelection(){return this.root.getSelection()}}function Xu(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"),[et.node(0,t.state.doc.content.size,e)]}function Qu(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:et.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 eE(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 tf(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 tE(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 fn={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:"'"},go={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},nE=typeof navigator<"u"&&/Mac/.test(navigator.platform),rE=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Ie=0;Ie<10;Ie++)fn[48+Ie]=fn[96+Ie]=String(Ie);for(var Ie=1;Ie<=24;Ie++)fn[Ie+111]="F"+Ie;for(var Ie=65;Ie<=90;Ie++)fn[Ie]=String.fromCharCode(Ie+32),go[Ie]=String.fromCharCode(Ie);for(var la in fn)go.hasOwnProperty(la)||(go[la]=fn[la]);function iE(t){var e=nE&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||rE&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?go:fn)[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 oE=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function sE(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,o,s;for(let a=0;a<e.length-1;a++){let c=e[a];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))oE?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),s&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function aE(t){let e=Object.create(null);for(let n in t)e[sE(n)]=t[n];return e}function ca(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 lE(t){return new ze({props:{handleKeyDown:rf(t)}})}function rf(t){let e=aE(t);return function(n,r){let i=iE(r),o,s=e[ca(i,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[ca(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(o=fn[r.keyCode])&&o!=i){let a=e[ca(o,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}const da=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function of(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const sf=(t,e,n)=>{let r=of(t,n);if(!r)return!1;let i=ua(r);if(!i){let s=r.blockRange(),a=s&&ar(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(!o.type.spec.isolating&&mf(t,i,e))return!0;if(r.parent.content.size==0&&(yr(o,"end")||Z.isSelectable(o))){let s=so(t.doc,r.before(),r.after(),q.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=t.tr.step(s);a.setSelection(yr(o,"end")?le.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):Z.create(a.doc,i.pos-o.nodeSize)),e(a.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},cE=(t,e,n)=>{let r=of(t,n);if(!r)return!1;let i=ua(r);return i?af(t,i,e):!1},dE=(t,e,n)=>{let r=cf(t,n);if(!r)return!1;let i=fa(r);return i?af(t,i,e):!1};function af(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 u=i.lastChild;if(!u)return!1;i=u}let s=e.nodeAfter,a=s,c=e.pos+1;for(;!a.isTextblock;c++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let d=so(t.doc,o,c,q.empty);if(!d||d.from!=o||d instanceof Te&&d.slice.size>=c-o)return!1;if(n){let u=t.tr.step(d);u.setSelection(ie.create(u.doc,o)),n(u.scrollIntoView())}return!0}function yr(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 lf=(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=ua(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 ua(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 cf(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const df=(t,e,n)=>{let r=cf(t,n);if(!r)return!1;let i=fa(r);if(!i)return!1;let o=i.nodeAfter;if(mf(t,i,e))return!0;if(r.parent.content.size==0&&(yr(o,"start")||Z.isSelectable(o))){let s=so(t.doc,r.before(),r.after(),q.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=t.tr.step(s);a.setSelection(yr(o,"start")?le.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):Z.create(a.doc,a.mapping.map(i.pos))),e(a.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},uf=(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=fa(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 fa(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 uE=(t,e)=>{let n=t.selection,r=n instanceof Z,i;if(r){if(n.node.isTextblock||!nn(t.doc,n.from))return!1;i=n.from}else if(i=oo(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},fE=(t,e)=>{let n=t.selection,r;if(n instanceof Z){if(n.node.isTextblock||!nn(t.doc,n.to))return!1;r=n.to}else if(r=oo(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},hE=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),o=i&&ar(i);return o==null?!1:(e&&e(t.tr.lift(i,o).scrollIntoView()),!0)},ff=(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 ha(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 pE=(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=ha(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let a=n.after(),c=t.tr.replaceWith(a,a,s.createAndFill());c.setSelection(le.near(c.doc.resolve(a),1)),e(c.scrollIntoView())}return!0},hf=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof ot||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=ha(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,a=t.tr.insert(s,o.createAndFill());a.setSelection(ie.create(a.doc,s+1)),e(a.scrollIntoView())}return!0},pf=(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(zt(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&ar(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function mE(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Z&&e.selection.node.isBlock)return!r.parentOffset||!zt(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.parent.isBlock)return!1;if(n){let o=i.parentOffset==i.parent.content.size,s=e.tr;(e.selection instanceof ie||e.selection instanceof ot)&&s.deleteSelection();let a=r.depth==0?null:ha(r.node(-1).contentMatchAt(r.indexAfter(-1))),c=o&&a?[{type:a}]:void 0,d=zt(s.doc,s.mapping.map(r.pos),1,c);if(!c&&!d&&zt(s.doc,s.mapping.map(r.pos),1,a?[{type:a}]:void 0)&&(a&&(c=[{type:a}]),d=!0),d&&(s.split(s.mapping.map(r.pos),1,c),!o&&!r.parentOffset&&r.parent.type!=a)){let u=s.mapping.map(r.before()),f=s.doc.resolve(u);a&&r.node(-1).canReplaceWith(f.index(),f.index()+1,a)&&s.setNodeMarkup(s.mapping.map(r.before()),a)}n(s.scrollIntoView())}return!0}}const gE=mE(),yE=(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 bE(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||nn(t.doc,e.pos))?!1:(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function mf(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,o,s;if(r.type.spec.isolating||i.type.spec.isolating)return!1;if(bE(t,e,n))return!0;let a=e.parent.canReplace(e.index(),e.index()+1);if(a&&(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=R.empty;for(let y=o.length-1;y>=0;y--)h=R.from(o[y].create(null,h));h=R.from(r.copy(h));let p=t.tr.step(new $e(e.pos-1,f,e.pos,f,new q(h,1,0),o.length,!0)),m=f+2*o.length;nn(p.doc,m)&&p.join(m),n(p.scrollIntoView())}return!0}let c=le.findFrom(e,1),d=c&&c.$from.blockRange(c.$to),u=d&&ar(d);if(u!=null&&u>=e.depth)return n&&n(t.tr.lift(d,u).scrollIntoView()),!0;if(a&&yr(i,"start",!0)&&yr(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=R.empty;for(let k=h.length-1;k>=0;k--)y=R.from(h[k].copy(y));let g=t.tr.step(new $e(e.pos-h.length,e.pos+i.nodeSize,e.pos+m,e.pos+i.nodeSize-m,new q(y,h.length,0),0,!0));n(g.scrollIntoView())}return!0}}return!1}function gf(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(ie.create(e.doc,t<0?i.start(o):i.end(o)))),!0):!1}}const kE=gf(-1),xE=gf(1);function vE(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),a=s&&As(s,t,e);return a?(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0):!1}}function yf(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:a}}=n.selection.ranges[o];n.doc.nodesBetween(s,a,(c,d)=>{if(i)return!1;if(!(!c.isTextblock||c.hasMarkup(t,e)))if(c.type==t)i=!0;else{let u=n.doc.resolve(d),f=u.index();i=u.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:a},$to:{pos:c}}=n.selection.ranges[s];o.setBlockType(a,c,t,e)}r(o.scrollIntoView())}return!0}}function pa(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}pa(da,sf,lf),pa(da,df,uf),pa(ff,hf,pf,gE),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function wE(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),a=!1,c=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 u=n.doc.resolve(s.start-2);c=new Zi(u,u,s.depth),s.endIndex<s.parent.childCount&&(s=new Zi(i,n.doc.resolve(o.end(s.depth)),s.depth)),a=!0}let d=As(c,t,e,s);return d?(r&&r(SE(n.tr,s,d,a,t).scrollIntoView()),!0):!1}}function SE(t,e,n,r,i){let o=R.empty;for(let u=n.length-1;u>=0;u--)o=R.from(n[u].type.create(n[u].attrs,o));t.step(new $e(e.start-(r?2:0),e.end,e.start,e.end,new q(o,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==i&&(s=u+1);let a=n.length-s,c=e.start+n.length-(r?2:0),d=e.parent;for(let u=e.startIndex,f=e.endIndex,h=!0;u<f;u++,h=!1)!h&&zt(t.doc,c,a)&&(t.split(c,a),c+=2*a),c+=d.child(u).nodeSize;return t}function CE(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?OE(e,n,t,o):EE(e,n,o):!0:!1}}function OE(t,e,n,r){let i=t.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new $e(o-1,s,o,s,new q(R.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Zi(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const a=ar(r);if(a==null)return!1;i.lift(r,a);let c=i.mapping.map(o,-1)-1;return nn(i.doc,c)&&i.join(c),e(i.scrollIntoView()),!0}function EE(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 a=n.startIndex==0,c=n.endIndex==i.childCount,d=o.node(-1),u=o.index(-1);if(!d.canReplace(u+(a?0:1),u+1,s.content.append(c?R.empty:R.from(i))))return!1;let f=o.pos,h=f+s.nodeSize;return r.step(new $e(f-(a?1:0),h+(c?1:0),f+1,h-1,new q((a?R.empty:R.from(i.copy(R.empty))).append(c?R.empty:R.from(i.copy(R.empty))),a?0:1,c?0:1),a?0:1)),e(r.scrollIntoView()),!0}function ME(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,d=>d.childCount>0&&d.firstChild.type==t);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let a=o.parent,c=a.child(s-1);if(c.type!=t)return!1;if(n){let d=c.lastChild&&c.lastChild.type==a.type,u=R.from(d?t.create():null),f=new q(R.from(t.create(null,R.from(a.type.create(null,u)))),d?3:1,0),h=o.start,p=o.end;n(e.tr.step(new $e(h-(d?3:1),p,h,p,f,1,!0)).scrollIntoView())}return!0}}function yo(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 bo{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(([a,c])=>[a,(...u)=>{const f=c(...u)(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,a=[],c=!!e,d=e||o.tr,u=()=>(!c&&n&&!d.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(d),a.every(h=>h===!0)),f={...Object.fromEntries(Object.entries(r).map(([h,p])=>[h,(...y)=>{const g=this.buildProps(d,n),k=p(...y)(g);return a.push(k),f}])),run:u};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(([c,d])=>[c,(...u)=>d(...u)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:o}=this,{view:s}=i,a={tr:e,editor:i,view:s,state:yo({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(([c,d])=>[c,(...u)=>d(...u)(a)]))}};return a}}class TE{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 J(t,e,n){return t.config[e]===void 0&&t.parent?J(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?J(t.parent,e,n):null}):t.config[e]}function ko(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 bf(t){const e=[],{nodeExtensions:n,markExtensions:r}=ko(t),i=[...n,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage},c=J(s,"addGlobalAttributes",a);if(!c)return;c().forEach(u=>{u.types.forEach(f=>{Object.entries(u.attributes).forEach(([h,p])=>{e.push({type:f,name:h,attribute:{...o,...p}})})})})}),i.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage},c=J(s,"addAttributes",a);if(!c)return;const d=c();Object.entries(d).forEach(([u,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:u,attribute:h})})}),e}function Ne(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 Ee(...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 a=o?o.split(" "):[],c=r[i]?r[i].split(" "):[],d=a.filter(u=>!c.includes(u));r[i]=[...c,...d].join(" ")}else i==="style"?r[i]=[r[i],o].join("; "):r[i]=o}),r},{})}function ma(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)=>Ee(n,r),{})}function kf(t){return typeof t=="function"}function ce(t,e=void 0,...n){return kf(t)?e?t.bind(e)(...n):t(...n):t}function $E(t={}){return Object.keys(t).length===0&&t.constructor===Object}function NE(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function xf(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 a=s.attribute.parseHTML?s.attribute.parseHTML(n):NE(n.getAttribute(s.name));return a==null?o:{...o,[s.name]:a}},{});return{...r,...i}}}}function vf(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&$E(n)?!1:n!=null))}function BE(t,e){var n;const r=bf(t),{nodeExtensions:i,markExtensions:o}=ko(t),s=(n=i.find(d=>J(d,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(i.map(d=>{const u=r.filter(k=>k.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},h=t.reduce((k,C)=>{const N=J(C,"extendNodeSchema",f);return{...k,...N?N(d):{}}},{}),p=vf({...h,content:ce(J(d,"content",f)),marks:ce(J(d,"marks",f)),group:ce(J(d,"group",f)),inline:ce(J(d,"inline",f)),atom:ce(J(d,"atom",f)),selectable:ce(J(d,"selectable",f)),draggable:ce(J(d,"draggable",f)),code:ce(J(d,"code",f)),defining:ce(J(d,"defining",f)),isolating:ce(J(d,"isolating",f)),attrs:Object.fromEntries(u.map(k=>{var C;return[k.name,{default:(C=k==null?void 0:k.attribute)===null||C===void 0?void 0:C.default}]}))}),m=ce(J(d,"parseHTML",f));m&&(p.parseDOM=m.map(k=>xf(k,u)));const y=J(d,"renderHTML",f);y&&(p.toDOM=k=>y({node:k,HTMLAttributes:ma(k,u)}));const g=J(d,"renderText",f);return g&&(p.toText=g),[d.name,p]})),c=Object.fromEntries(o.map(d=>{const u=r.filter(g=>g.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},h=t.reduce((g,k)=>{const C=J(k,"extendMarkSchema",f);return{...g,...C?C(d):{}}},{}),p=vf({...h,inclusive:ce(J(d,"inclusive",f)),excludes:ce(J(d,"excludes",f)),group:ce(J(d,"group",f)),spanning:ce(J(d,"spanning",f)),code:ce(J(d,"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=ce(J(d,"parseHTML",f));m&&(p.parseDOM=m.map(g=>xf(g,u)));const y=J(d,"renderHTML",f);return y&&(p.toDOM=g=>y({mark:g,HTMLAttributes:ma(g,u)})),[d.name,p]}));return new zS({topNode:s,nodes:a,marks:c})}function ga(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 AE=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,o,s,a)=>{var c,d;const u=((d=(c=i.type.spec).toText)===null||d===void 0?void 0:d.call(c,{node:i,pos:o,parent:s,index:a}))||i.textContent||"%leaf%";n+=u.slice(0,Math.max(0,r-o))}),n};function ya(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class xo{constructor(e){this.find=e.find,this.handler=e.handler}}const DE=(t,e)=>{if(ya(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 vo(t){var e;const{editor:n,from:r,to:i,text:o,rules:s,plugin:a}=t,{view:c}=n;if(c.composing)return!1;const d=c.state.doc.resolve(r);if(d.parent.type.spec.code||!((e=d.nodeBefore||d.nodeAfter)===null||e===void 0)&&e.marks.find(h=>h.type.spec.code))return!1;let u=!1;const f=AE(d)+o;return s.forEach(h=>{if(u)return;const p=DE(f,h.find);if(!p)return;const m=c.state.tr,y=yo({state:c.state,transaction:m}),g={from:r-(p[0].length-o.length),to:i},{commands:k,chain:C,can:N}=new bo({editor:n,state:y});h.handler({state:y,range:g,match:p,commands:k,chain:C,can:N})===null||!m.steps.length||(m.setMeta(a,{transform:m,from:r,to:i,text:o}),c.dispatch(m),u=!0)}),u}function VE(t){const{editor:e,rules:n}=t,r=new ze({state:{init(){return null},apply(i,o){const s=i.getMeta(r);if(s)return s;const a=i.getMeta("applyInputRules");return!!a&&setTimeout(()=>{const{from:d,text:u}=a,f=d+u.length;vo({editor:e,from:d,to:f,text:u,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,s,a){return vo({editor:e,from:o,to:s,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&vo({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?vo({editor:e,from:s.pos,to:s.pos,text:`
15
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function IE(t){return typeof t=="number"}class PE{constructor(e){this.find=e.find,this.handler=e.handler}}const _E=(t,e,n)=>{if(ya(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 RE(t){const{editor:e,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:a}=t,{commands:c,chain:d,can:u}=new bo({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,"");_E(k,o.find,s).forEach(N=>{if(N.index===void 0)return;const b=y+N.index+1,S=b+N[0].length,x={from:n.tr.mapping.map(b),to:n.tr.mapping.map(S)},$=o.handler({state:n,range:x,match:N,commands:c,chain:d,can:u,pasteEvent:s,dropEvent:a});f.push($)})}),f.every(p=>p!==null)}const LE=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 zE(t){const{editor:e,rules:n}=t;let r=null,i=!1,o=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a=typeof DragEvent<"u"?new DragEvent("drop"):null;const c=({state:u,from:f,to:h,rule:p,pasteEvt:m})=>{const y=u.tr,g=yo({state:u,transaction:y});if(!(!RE({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,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,y};return n.map(u=>new ze({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,a=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,k=m.getMeta("applyPasteRules"),C=!!k;if(!y&&!g&&!C)return;if(C){const{from:S,text:x}=k,$=S+x.length,D=LE(x);return c({rule:u,state:p,from:S,to:{b:$},pasteEvt:D})}const N=h.doc.content.findDiffStart(p.doc.content),b=h.doc.content.findDiffEnd(p.doc.content);if(!(!IE(N)||!b||N===b.b))return c({rule:u,state:p,from:N,to:b,pasteEvt:s})}}))}function FE(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return[...new Set(e)]}class br{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=br.resolve(e),this.schema=BE(this.extensions,n),this.setupExtensions()}static resolve(e){const n=br.sort(br.flatten(e)),r=FE(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=J(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{const o=J(r,"priority")||100,s=J(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:ga(n.name,this.schema)},i=J(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=br.sort([...this.extensions].reverse()),r=[],i=[],o=n.map(s=>{const a={name:s.name,options:s.options,storage:s.storage,editor:e,type:ga(s.name,this.schema)},c=[],d=J(s,"addKeyboardShortcuts",a);let u={};if(s.type==="mark"&&s.config.exitable&&(u.ArrowRight=()=>Nt.handleExit({editor:e,mark:s})),d){const y=Object.fromEntries(Object.entries(d()).map(([g,k])=>[g,()=>k({editor:e})]));u={...u,...y}}const f=lE(u);c.push(f);const h=J(s,"addInputRules",a);wf(s,e.options.enableInputRules)&&h&&r.push(...h());const p=J(s,"addPasteRules",a);wf(s,e.options.enablePasteRules)&&p&&i.push(...p());const m=J(s,"addProseMirrorPlugins",a);if(m){const y=m();c.push(...y)}return c}).flat();return[VE({editor:e,rules:r}),...zE({editor:e,rules:i}),...o]}get attributes(){return bf(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=ko(this.extensions);return Object.fromEntries(n.filter(r=>!!J(r,"addNodeView")).map(r=>{const i=this.attributes.filter(c=>c.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:e,type:Ne(r.name,this.schema)},s=J(r,"addNodeView",o);if(!s)return[];const a=(c,d,u,f)=>{const h=ma(c,i);return s()({editor:e,node:c,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:ga(e.name,this.schema)};e.type==="mark"&&(!((n=ce(J(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=J(e,"onBeforeCreate",r),o=J(e,"onCreate",r),s=J(e,"onUpdate",r),a=J(e,"onSelectionUpdate",r),c=J(e,"onTransaction",r),d=J(e,"onFocus",r),u=J(e,"onBlur",r),f=J(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),s&&this.editor.on("update",s),a&&this.editor.on("selectionUpdate",a),c&&this.editor.on("transaction",c),d&&this.editor.on("focus",d),u&&this.editor.on("blur",u),f&&this.editor.on("destroy",f)})}}function jE(t){return Object.prototype.toString.call(t).slice(8,-1)}function ba(t){return jE(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function wo(t,e){const n={...t};return ba(t)&&ba(e)&&Object.keys(e).forEach(r=>{ba(e[r])?r in t?n[r]=wo(t[r],e[r]):Object.assign(n,{[r]:e[r]}):Object.assign(n,{[r]:e[r]})}),n}class Re{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=ce(J(this,"addOptions",{name:this.name}))),this.storage=ce(J(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Re(e)}configure(e={}){const n=this.extend();return n.parent=this.parent,n.options=wo(this.options,e),n.storage=ce(J(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){const n=new Re({...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=ce(J(n,"addOptions",{name:n.name})),n.storage=ce(J(n,"addStorage",{name:n.name,options:n.options})),n}}function Sf(t,e,n){const{from:r,to:i}=e,{blockSeparator:o=`
16
+
17
+ `,textSerializers:s={}}=n||{};let a="";return t.nodesBetween(r,i,(c,d,u,f)=>{var h;c.isBlock&&d>r&&(a+=o);const p=s==null?void 0:s[c.type.name];if(p)return u&&(a+=p({node:c,pos:d,parent:u,index:f,range:e})),!1;c.isText&&(a+=(h=c==null?void 0:c.text)===null||h===void 0?void 0:h.slice(Math.max(r,d)-d,i-d))}),a}function Cf(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const HE=Re.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ze({key:new yt("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(u=>u.$from.pos)),a=Math.max(...o.map(u=>u.$to.pos)),c=Cf(n);return Sf(r,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),WE=()=>({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),qE=(t=!1)=>({commands:e})=>e.setContent("",t),UE=()=>({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,(a,c)=>{if(a.type.isText)return;const{doc:d,mapping:u}=e,f=d.resolve(u.map(c)),h=d.resolve(u.map(c+a.nodeSize)),p=f.blockRange(h);if(!p)return;const m=ar(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},KE=t=>e=>t(e),YE=()=>({state:t,dispatch:e})=>hf(t,e),JE=(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 ie(r.doc.resolve(s-1))),!0},GE=()=>({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 a=i.before(o),c=i.after(o);t.delete(a,c).scrollIntoView()}return!0}return!1},ZE=t=>({tr:e,state:n,dispatch:r})=>{const i=Ne(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 c=o.before(s),d=o.after(s);e.delete(c,d).scrollIntoView()}return!0}return!1},XE=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},QE=()=>({state:t,dispatch:e})=>da(t,e),e2=()=>({commands:t})=>t.keyboardShortcut("Enter"),t2=()=>({state:t,dispatch:e})=>pE(t,e);function So(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:ya(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function ka(t,e,n={}){return t.find(r=>r.type===e&&So(r.attrs,n))}function n2(t,e,n={}){return!!ka(t,e,n)}function xa(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=ka([...r.node.marks],e,n);if(!i)return;let o=r.index,s=t.start()+r.offset,a=o+1,c=s+r.node.nodeSize;for(ka([...r.node.marks],e,n);o>0&&i.isInSet(t.parent.child(o-1).marks);)o-=1,s-=t.parent.child(o).nodeSize;for(;a<t.parent.childCount&&n2([...t.parent.child(a).marks],e,n);)c+=t.parent.child(a).nodeSize,a+=1;return{from:s,to:c}}function hn(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 r2=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const o=hn(t,r.schema),{doc:s,selection:a}=n,{$from:c,from:d,to:u}=a;if(i){const f=xa(c,o,e);if(f&&f.from<=d&&f.to>=u){const h=ie.create(s,f.from,f.to);n.setSelection(h)}}return!0},i2=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 va(t){return t instanceof ie}function Wt(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Of(t,e=null){if(!e)return null;const n=le.atStart(t),r=le.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,o=r.to;return e==="all"?ie.create(t,Wt(0,i,o),Wt(t.content.size,i,o)):ie.create(t,Wt(e,i,o),Wt(e,i,o))}function wa(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const o2=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const s=()=>{wa()&&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&&!va(n.state.selection))return s(),!0;const a=Of(i.doc,t)||n.state.selection,c=n.state.selection.eq(a);return o&&(c||i.setSelection(a),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},s2=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),a2=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Ef=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&&Ef(r)}return t};function Mf(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return Ef(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?R.fromArray(t.map(s=>e.nodeFromJSON(s))):e.nodeFromJSON(t)}catch(o){return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),Co("",e,n)}if(i){const o=ir.fromSchema(e);return n.slice?o.parseSlice(Mf(t),n.parseOptions).content:o.parse(Mf(t),n.parseOptions)}return Co("",e,n)}function l2(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof Te||i instanceof $e))return;const o=t.mapping.maps[r];let s=0;o.forEach((a,c,d,u)=>{s===0&&(s=u)}),t.setSelection(le.near(t.doc.resolve(s),n))}const c2=t=>t.toString().startsWith("<"),d2=(t,e,n)=>({tr:r,dispatch:i,editor:o})=>{if(i){n={parseOptions:{},updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};const s=Co(e,o.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions}});if(s.toString()==="<>")return!0;let{from:a,to:c}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},d=!0,u=!0;if((c2(s)?s:[s]).forEach(p=>{p.check(),d=d?p.isText&&p.marks.length===0:!1,u=u?p.isBlock:!1}),a===c&&u){const{parent:p}=r.doc.resolve(a);p.isTextblock&&!p.type.spec.code&&!p.childCount&&(a-=1,c+=1)}let h;d?(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,c)):(h=s,r.replaceWith(a,c,h)),n.updateSelection&&l2(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},u2=()=>({state:t,dispatch:e})=>uE(t,e),f2=()=>({state:t,dispatch:e})=>fE(t,e),h2=()=>({state:t,dispatch:e})=>sf(t,e),p2=()=>({state:t,dispatch:e})=>df(t,e),m2=()=>({tr:t,state:e,dispatch:n})=>{try{const r=oo(e.doc,e.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),n&&n(t),!0)}catch{return!1}},g2=()=>({state:t,dispatch:e,tr:n})=>{try{const r=oo(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},y2=()=>({state:t,dispatch:e})=>cE(t,e),b2=()=>({state:t,dispatch:e})=>dE(t,e);function Tf(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function k2(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,o,s;for(let a=0;a<e.length-1;a+=1){const c=e[a];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))wa()||Tf()?s=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),o&&(n=`Shift-${n}`),n}const x2=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const o=k2(t).split(/-(?!$)/),s=o.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),a=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}),c=e.captureTransaction(()=>{n.someProp("handleKeyDown",d=>d(n,a))});return c==null||c.steps.forEach(d=>{const u=d.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function ui(t,e,n={}){const{from:r,to:i,empty:o}=t.selection,s=e?Ne(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 c=i-r,d=a.filter(f=>s?s.name===f.node.type.name:!0).filter(f=>So(f.node.attrs,n,{strict:!1}));return o?!!d.length:d.reduce((f,h)=>f+h.to-h.from,0)>=c}const v2=(t,e={})=>({state:n,dispatch:r})=>{const i=Ne(t,n.schema);return ui(n,i,e)?hE(n,r):!1},w2=()=>({state:t,dispatch:e})=>pf(t,e),S2=t=>({state:e,dispatch:n})=>{const r=Ne(t,e.schema);return CE(r)(e,n)},C2=()=>({state:t,dispatch:e})=>ff(t,e);function Oo(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function $f(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 O2=(t,e)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null;const a=Oo(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(o=Ne(t,r.schema)),a==="mark"&&(s=hn(t,r.schema)),i&&n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(d,u)=>{o&&o===d.type&&n.setNodeMarkup(u,void 0,$f(d.attrs,e)),s&&d.marks.length&&d.marks.forEach(f=>{s===f.type&&n.addMark(u,u+d.nodeSize,s.create($f(f.attrs,e)))})})}),!0):!1},E2=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),M2=()=>({tr:t,commands:e})=>e.setTextSelection({from:0,to:t.doc.content.size}),T2=()=>({state:t,dispatch:e})=>lf(t,e),$2=()=>({state:t,dispatch:e})=>uf(t,e),N2=()=>({state:t,dispatch:e})=>yE(t,e),B2=()=>({state:t,dispatch:e})=>xE(t,e),A2=()=>({state:t,dispatch:e})=>kE(t,e);function Nf(t,e,n={}){return Co(t,e,{slice:!1,parseOptions:n})}const D2=(t,e=!1,n={})=>({tr:r,editor:i,dispatch:o})=>{const{doc:s}=r,a=Nf(t,i.schema,n);return o&&r.replaceWith(0,s.content.size,a).setMeta("preventUpdate",!e),!0};function Eo(t,e){const n=hn(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,c=>{s.push(...c.marks)});const a=s.find(c=>c.type.name===n.name);return a?{...a.attrs}:{}}function V2(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 I2(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 Sa(t){return e=>I2(e.$from,t)}function P2(t,e){const n=Ot.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function _2(t,e){const n={from:0,to:t.content.size};return Sf(t,n,e)}function R2(t,e){const n=Ne(e,t.schema),{from:r,to:i}=t.selection,o=[];t.doc.nodesBetween(r,i,a=>{o.push(a)});const s=o.reverse().find(a=>a.type.name===n.name);return s?{...s.attrs}:{}}function L2(t,e){const n=Oo(typeof e=="string"?e:e.name,t.schema);return n==="node"?R2(t,e):n==="mark"?Eo(t,e):{}}function Bf(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const o=n.resolve(t-1),s=xa(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 Mo(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 Ca(t,e,n={}){const{empty:r,ranges:i}=t.selection,o=e?hn(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>o?o.name===f.type.name:!0).find(f=>So(f.attrs,n,{strict:!1}));let s=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),C=Math.min(m,g+y.nodeSize),N=C-k;s+=N,a.push(...y.marks.map(b=>({mark:b,from:k,to:C})))})}),s===0)return!1;const c=a.filter(f=>o?o.name===f.mark.type.name:!0).filter(f=>So(f.mark.attrs,n,{strict:!1})).reduce((f,h)=>f+h.to-h.from,0),d=a.filter(f=>o?f.mark.type!==o&&f.mark.type.excludes(o):!0).reduce((f,h)=>f+h.to-h.from,0);return(c>0?c+d:c)>=s}function z2(t,e,n={}){if(!e)return ui(t,null,n)||Ca(t,null,n);const r=Oo(e,t.schema);return r==="node"?ui(t,e,n):r==="mark"?Ca(t,e,n):!1}function Af(t,e){const{nodeExtensions:n}=ko(e),r=n.find(s=>s.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=ce(J(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function F2(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 j2(t){return t instanceof Z}function Df(t,e,n){const i=t.state.doc.content.size,o=Wt(e,0,i),s=Wt(n,0,i),a=t.coordsAtPos(o),c=t.coordsAtPos(s,-1),d=Math.min(a.top,c.top),u=Math.max(a.bottom,c.bottom),f=Math.min(a.left,c.left),h=Math.max(a.right,c.right),p=h-f,m=u-d,k={top:d,bottom:u,left:f,right:h,width:p,height:m,x:f,y:d};return{...k,toJSON:()=>k}}function H2(t,e,n){var r;const{selection:i}=e;let o=null;if(va(i)&&(o=i.$cursor),o){const a=(r=t.storedMarks)!==null&&r!==void 0?r:o.marks();return!!n.isInSet(a)||!a.some(c=>c.type.excludes(n))}const{ranges:s}=i;return s.some(({$from:a,$to:c})=>{let d=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,c.pos,(u,f,h)=>{if(d)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));d=p&&m}return!d}),d})}const W2=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:o}=n,{empty:s,ranges:a}=o,c=hn(t,r.schema);if(i)if(s){const d=Eo(r,c);n.addStoredMark(c.create({...d,...e}))}else a.forEach(d=>{const u=d.$from.pos,f=d.$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===c)?h.marks.forEach(k=>{c===k.type&&n.addMark(m,y,c.create({...k.attrs,...e}))}):n.addMark(m,y,c.create(e))})});return H2(r,n,c)},q2=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),U2=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const o=Ne(t,n.schema);return o.isTextblock?i().command(({commands:s})=>yf(o,e)(n)?!0:s.clearNodes()).command(({state:s})=>yf(o,e)(s,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},K2=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=Wt(t,0,r.content.size),o=Z.create(r,i);e.setSelection(o)}return!0},Y2=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:o}=typeof t=="number"?{from:t,to:t}:t,s=ie.atStart(r).from,a=ie.atEnd(r).to,c=Wt(i,s,a),d=Wt(o,s,a),u=ie.create(r,c,d);e.setSelection(u)}return!0},J2=t=>({state:e,dispatch:n})=>{const r=Ne(t,e.schema);return ME(r)(e,n)};function Vf(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 G2=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:o,doc:s}=e,{$from:a,$to:c}=o,d=i.extensionManager.attributes,u=Mo(d,a.node().type.name,a.node().attrs);if(o instanceof Z&&o.node.isBlock)return!a.parentOffset||!zt(s,a.pos)?!1:(r&&(t&&Vf(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;if(r){const f=c.parentOffset===c.parent.content.size;o instanceof ie&&e.deleteSelection();const h=a.depth===0?void 0:V2(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=f&&h?[{type:h,attrs:u}]:void 0,m=zt(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!m&&zt(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&&Vf(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return!0},Z2=t=>({tr:e,state:n,dispatch:r,editor:i})=>{var o;const s=Ne(t,n.schema),{$from:a,$to:c}=n.selection,d=n.selection.node;if(d&&d.isBlock||a.depth<2||!a.sameParent(c))return!1;const u=a.node(-1);if(u.type!==s)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!==s||a.index(-2)!==a.node(-2).childCount-1)return!1;if(r){let g=R.empty;const k=a.index(-1)?1:a.index(-2)?2:3;for(let $=a.depth-k;$>=a.depth-3;$-=1)g=R.from(a.node($).copy(g));const C=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,N=Mo(f,a.node().type.name,a.node().attrs),b=((o=s.contentMatch.defaultType)===null||o===void 0?void 0:o.createAndFill(N))||void 0;g=g.append(R.from(s.createAndFill(null,b)||void 0));const S=a.before(a.depth-(k-1));e.replace(S,a.after(-C),new q(g,4-k,0));let x=-1;e.doc.nodesBetween(S,e.doc.content.size,($,D)=>{if(x>-1)return!1;$.isTextblock&&$.content.size===0&&(x=D+1)}),x>-1&&e.setSelection(ie.near(e.doc.resolve(x))),e.scrollIntoView()}return!0}const h=c.pos===a.end()?u.contentMatchAt(0).defaultType:null,p=Mo(f,u.type.name,u.attrs),m=Mo(f,a.node().type.name,a.node().attrs);e.delete(a.pos,c.pos);const y=h?[{type:s,attrs:p},{type:h,attrs:m}]:[{type:s,attrs:p}];if(!zt(e.doc,a.pos,2))return!1;if(r){const{selection:g,storedMarks:k}=n,{splittableMarks:C}=i.extensionManager,N=k||g.$to.parentOffset&&g.$from.marks();if(e.split(a.pos,2,y).scrollIntoView(),!N||!r)return!0;const b=N.filter(S=>C.includes(S.type.name));e.ensureMarks(b)}return!0},Oa=(t,e)=>{const n=Sa(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)&&nn(t.doc,n.pos)&&t.join(n.pos),!0},Ea=(t,e)=>{const n=Sa(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)&&nn(t.doc,r)&&t.join(r),!0};var X2=Object.freeze({__proto__:null,blur:WE,clearContent:qE,clearNodes:UE,command:KE,createParagraphNear:YE,cut:JE,deleteCurrentNode:GE,deleteNode:ZE,deleteRange:XE,deleteSelection:QE,enter:e2,exitCode:t2,extendMarkRange:r2,first:i2,focus:o2,forEach:s2,insertContent:a2,insertContentAt:d2,joinUp:u2,joinDown:f2,joinBackward:h2,joinForward:p2,joinItemBackward:m2,joinItemForward:g2,joinTextblockBackward:y2,joinTextblockForward:b2,keyboardShortcut:x2,lift:v2,liftEmptyBlock:w2,liftListItem:S2,newlineInCode:C2,resetAttributes:O2,scrollIntoView:E2,selectAll:M2,selectNodeBackward:T2,selectNodeForward:$2,selectParentNode:N2,selectTextblockEnd:B2,selectTextblockStart:A2,setContent:D2,setMark:W2,setMeta:q2,setNode:U2,setNodeSelection:K2,setTextSelection:Y2,sinkListItem:J2,splitBlock:G2,splitListItem:Z2,toggleList:(t,e,n,r={})=>({editor:i,tr:o,state:s,dispatch:a,chain:c,commands:d,can:u})=>{const{extensions:f,splittableMarks:h}=i.extensionManager,p=Ne(t,s.schema),m=Ne(e,s.schema),{selection:y,storedMarks:g}=s,{$from:k,$to:C}=y,N=k.blockRange(C),b=g||y.$to.parentOffset&&y.$from.marks();if(!N)return!1;const S=Sa(x=>Af(x.type.name,f))(y);if(N.depth>=1&&S&&N.depth-S.depth<=1){if(S.node.type===p)return d.liftListItem(m);if(Af(S.node.type.name,f)&&p.validContent(S.node.content)&&a)return c().command(()=>(o.setNodeMarkup(S.pos,p),!0)).command(()=>Oa(o,p)).command(()=>Ea(o,p)).run()}return!n||!b||!a?c().command(()=>u().wrapInList(p,r)?!0:d.clearNodes()).wrapInList(p,r).command(()=>Oa(o,p)).command(()=>Ea(o,p)).run():c().command(()=>{const x=u().wrapInList(p,r),$=b.filter(D=>h.includes(D.type.name));return o.ensureMarks($),x?!0:d.clearNodes()}).wrapInList(p,r).command(()=>Oa(o,p)).command(()=>Ea(o,p)).run()},toggleMark:(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=n,s=hn(t,r.schema);return Ca(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},toggleNode:(t,e,n={})=>({state:r,commands:i})=>{const o=Ne(t,r.schema),s=Ne(e,r.schema);return ui(r,o,n)?i.setNode(s):i.setNode(o,n)},toggleWrap:(t,e={})=>({state:n,commands:r})=>{const i=Ne(t,n.schema);return ui(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,a=o.transform;for(let c=a.steps.length-1;c>=0;c-=1)s.step(a.steps[c].invert(a.docs[c]));if(o.text){const c=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,t.schema.text(o.text,c))}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:a}=n,c=hn(t,r.schema),{$from:d,empty:u,ranges:f}=a;if(!i)return!0;if(u&&s){let{from:h,to:p}=a;const m=(o=d.marks().find(g=>g.type===c))===null||o===void 0?void 0:o.attrs,y=xa(d,c,m);y&&(h=y.from,p=y.to),n.removeMark(h,p,c)}else f.forEach(h=>{n.removeMark(h.$from.pos,h.$to.pos,c)});return n.removeStoredMark(c),!0},updateAttributes:(t,e={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null;const a=Oo(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(o=Ne(t,r.schema)),a==="mark"&&(s=hn(t,r.schema)),i&&n.selection.ranges.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;r.doc.nodesBetween(d,u,(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,d),y=Math.min(h+f.nodeSize,u);n.addMark(m,y,s.create({...p.attrs,...e}))}})})}),!0):!1},wrapIn:(t,e={})=>({state:n,dispatch:r})=>{const i=Ne(t,n.schema);return vE(i,e)(n,r)},wrapInList:(t,e={})=>({state:n,dispatch:r})=>{const i=Ne(t,n.schema);return wE(i,e)(n,r)}});const Q2=Re.create({name:"commands",addCommands(){return{...X2}}}),eM=Re.create({name:"editable",addProseMirrorPlugins(){return[new ze({key:new yt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),tM=Re.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new ze({key:new yt("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}}}})]}}),nM=Re.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:a})=>{const{selection:c,doc:d}=a,{empty:u,$anchor:f}=c,{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:le.atStart(d).from===h;return!u||!p.type.isTextblock||p.textContent.length||!k||k&&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 wa()||Tf()?o:i},addProseMirrorPlugins(){return[new ze({key:new yt("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,a=le.atStart(e.doc).from,c=le.atEnd(e.doc).to;if(i||!(o===a&&s===c)||!(n.doc.textBetween(0,n.doc.content.size," "," ").length===0))return;const f=n.tr,h=yo({state:n,transaction:f}),{commands:p}=new bo({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),rM=Re.create({name:"tabindex",addProseMirrorPlugins(){return[new ze({key:new yt("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}});class _n{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 _n(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 _n(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 _n(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 a=new _n(s,this.editor,i,i?n:null);i&&(a.actualDepth=this.depth+1),e.push(new _n(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 a=0;a<s.length;a+=1){const c=s[a];if(o[c]!==n[c])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(c=>n[c]===s.node.attrs[c])&&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 iM=`.ProseMirror {
18
18
  position: relative;
19
19
  }
20
20
 
@@ -88,33 +88,46 @@ img.ProseMirror-separator {
88
88
 
89
89
  .tippy-box[data-animation=fade][data-state=hidden] {
90
90
  opacity: 0
91
- }`;function r2(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 i2=class extends EE{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=r2(n2,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=yf(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?[XM,FE.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),ZM,QM,e2,t2]:[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o==null?void 0:o.type));this.extensionManager=new yr(i,this)}createCommandManager(){this.commandManager=new bo({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){const e=Tf(this.options.content,this.schema,this.options.parseOptions),n=Sf(e,this.options.autofocus);this.view=new ZO(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:dr.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 a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.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 _M(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return RM(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return VM(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
91
+ }`;function oM(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 sM=class extends TE{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=oM(iM,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=kf(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?[eM,HE.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),Q2,tM,nM,rM]:[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o==null?void 0:o.type));this.extensionManager=new br(i,this)}createCommandManager(){this.commandManager=new bo({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){const e=Nf(this.options.content,this.schema,this.options.parseOptions),n=Of(e,this.options.autofocus);this.view=new QO(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:ur.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 a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.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 L2(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return z2(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return P2(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
92
92
 
93
- `,textSerializers:r={}}=e||{};return IM(this.state.doc,{blockSeparator:n,textSerializers:{...wf(this.schema),...r}})}get isEmpty(){return LM(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 _n(n,this)}get $doc(){return this.$pos(0)}};function br(t){return new vo({find:t.find,handler:({state:e,range:n,match:r})=>{const i=ce(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:o}=e,s=r[r.length-1],a=r[0];if(s){const c=a.search(/\S/),d=n.from+a.indexOf(s),u=d+s.length;if($f(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===t.type&&g!==p.mark.type)).filter(p=>p.to>d).length)return null;u<n.to&&o.delete(u,n.to),d>n.from&&o.delete(n.from+c,d);const h=n.from+c+s.length;o.addMark(n.from+c,h,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}function o2(t){return new vo({find:t.find,handler:({state:e,range:n,match:r})=>{const i=ce(t.getAttributes,void 0,r)||{},{tr:o}=e,s=n.from;let a=n.to;const c=t.type.create(i);if(r[1]){const d=r[0].lastIndexOf(r[1]);let u=s+d;u>a?u=a:a=u+r[1].length;const f=r[0][r[0].length-1];o.insertText(f,s+r[0].length-1),o.replaceWith(u,a,c)}else r[0]&&o.insert(s-1,t.type.create(i)).delete(o.mapping.map(s),o.mapping.map(a));o.scrollIntoView()}})}function Ma(t){return new vo({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),o=ce(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 fi(t){return new vo({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const o=ce(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),c=s.doc.resolve(n.from).blockRange(),d=c&&As(c,t.type,o);if(!d)return null;if(s.wrap(c,d),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 g=m.filter(y=>p.includes(y.type.name));s.ensureMarks(g)}}if(t.keepAttributes){const f=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(f,o).run()}const u=s.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&nn(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&s.join(n.from-1)}})}class Nt{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=ce(J(this,"addOptions",{name:this.name}))),this.storage=ce(J(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Nt(e)}configure(e={}){const n=this.extend();return n.options=wo(this.options,e),n.storage=ce(J(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){const n=new Nt({...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=ce(J(n,"addOptions",{name:n.name})),n.storage=ce(J(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(d=>(d==null?void 0:d.type.name)===n.name))return!1;const c=s.find(d=>(d==null?void 0:d.type.name)===n.name);return c&&r.removeStoredMark(c),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}let tt=class rl{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=ce(J(this,"addOptions",{name:this.name}))),this.storage=ce(J(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new rl(e)}configure(e={}){const n=this.extend();return n.options=wo(this.options,e),n.storage=ce(J(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){const n=new rl({...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=ce(J(n,"addOptions",{name:n.name})),n.storage=ce(J(n,"addStorage",{name:n.name,options:n.options})),n}};function kr(t){return new VE({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const o=ce(t.getAttributes,void 0,r,i);if(o===!1||o===null)return null;const{tr:s}=e,a=r[r.length-1],c=r[0];let d=n.to;if(a){const u=c.search(/\S/),f=n.from+c.indexOf(a),h=f+a.length;if($f(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(y=>y===t.type&&y!==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+u,f),d=n.from+u+a.length,s.addMark(n.from+u,d,t.type.create(o||{})),s.removeStoredMark(t.type)}}})}var Ge="top",lt="bottom",ct="right",Ze="left",Ta="auto",hi=[Ge,lt,ct,Ze],vr="start",pi="end",s2="clippingParents",Df="viewport",mi="popper",a2="reference",Vf=hi.reduce(function(t,e){return t.concat([e+"-"+vr,e+"-"+pi])},[]),If=[].concat(hi,[Ta]).reduce(function(t,e){return t.concat([e,e+"-"+vr,e+"-"+pi])},[]),l2="beforeRead",c2="read",d2="afterRead",u2="beforeMain",f2="main",h2="afterMain",p2="beforeWrite",m2="write",g2="afterWrite",y2=[l2,c2,d2,u2,f2,h2,p2,m2,g2];function Bt(t){return t?(t.nodeName||"").toLowerCase():null}function nt(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Rn(t){var e=nt(t).Element;return t instanceof e||t instanceof Element}function dt(t){var e=nt(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function $a(t){if(typeof ShadowRoot>"u")return!1;var e=nt(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function b2(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];!dt(o)||!Bt(o)||(Object.assign(o.style,r),Object.keys(i).forEach(function(s){var a=i[s];a===!1?o.removeAttribute(s):o.setAttribute(s,a===!0?"":a)}))})}function k2(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]),a=s.reduce(function(c,d){return c[d]="",c},{});!dt(i)||!Bt(i)||(Object.assign(i.style,a),Object.keys(o).forEach(function(c){i.removeAttribute(c)}))})}}const Pf={name:"applyStyles",enabled:!0,phase:"write",fn:b2,effect:k2,requires:["computeStyles"]};function At(t){return t.split("-")[0]}var Ln=Math.max,To=Math.min,xr=Math.round;function Na(){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 _f(){return!/^((?!chrome|android).)*safari/i.test(Na())}function wr(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),i=1,o=1;e&&dt(t)&&(i=t.offsetWidth>0&&xr(r.width)/t.offsetWidth||1,o=t.offsetHeight>0&&xr(r.height)/t.offsetHeight||1);var s=Rn(t)?nt(t):window,a=s.visualViewport,c=!_f()&&n,d=(r.left+(c&&a?a.offsetLeft:0))/i,u=(r.top+(c&&a?a.offsetTop:0))/o,f=r.width/i,h=r.height/o;return{width:f,height:h,top:u,right:d+f,bottom:u+h,left:d,x:d,y:u}}function Ba(t){var e=wr(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 Rf(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&$a(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function qt(t){return nt(t).getComputedStyle(t)}function v2(t){return["table","td","th"].indexOf(Bt(t))>=0}function pn(t){return((Rn(t)?t.ownerDocument:t.document)||window.document).documentElement}function $o(t){return Bt(t)==="html"?t:t.assignedSlot||t.parentNode||($a(t)?t.host:null)||pn(t)}function Lf(t){return!dt(t)||qt(t).position==="fixed"?null:t.offsetParent}function x2(t){var e=/firefox/i.test(Na()),n=/Trident/i.test(Na());if(n&&dt(t)){var r=qt(t);if(r.position==="fixed")return null}var i=$o(t);for($a(i)&&(i=i.host);dt(i)&&["html","body"].indexOf(Bt(i))<0;){var o=qt(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 gi(t){for(var e=nt(t),n=Lf(t);n&&v2(n)&&qt(n).position==="static";)n=Lf(n);return n&&(Bt(n)==="html"||Bt(n)==="body"&&qt(n).position==="static")?e:n||x2(t)||e}function Aa(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function yi(t,e,n){return Ln(t,To(e,n))}function w2(t,e,n){var r=yi(t,e,n);return r>n?n:r}function zf(){return{top:0,right:0,bottom:0,left:0}}function Ff(t){return Object.assign({},zf(),t)}function jf(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var S2=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,Ff(typeof e!="number"?e:jf(e,hi))};function C2(t){var e,n=t.state,r=t.name,i=t.options,o=n.elements.arrow,s=n.modifiersData.popperOffsets,a=At(n.placement),c=Aa(a),d=[Ze,ct].indexOf(a)>=0,u=d?"height":"width";if(!(!o||!s)){var f=S2(i.padding,n),h=Ba(o),p=c==="y"?Ge:Ze,m=c==="y"?lt:ct,g=n.rects.reference[u]+n.rects.reference[c]-s[c]-n.rects.popper[u],y=s[c]-n.rects.reference[c],k=gi(o),C=k?c==="y"?k.clientHeight||0:k.clientWidth||0:0,N=g/2-y/2,b=f[p],S=C-h[u]-f[m],v=C/2-h[u]/2+N,$=yi(b,v,S),D=c;n.modifiersData[r]=(e={},e[D]=$,e.centerOffset=$-v,e)}}function O2(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)||Rf(e.elements.popper,i)&&(e.elements.arrow=i))}const E2={name:"arrow",enabled:!0,phase:"main",fn:C2,effect:O2,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Sr(t){return t.split("-")[1]}var M2={top:"auto",right:"auto",bottom:"auto",left:"auto"};function T2(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 Hf(t){var e,n=t.popper,r=t.popperRect,i=t.placement,o=t.variation,s=t.offsets,a=t.position,c=t.gpuAcceleration,d=t.adaptive,u=t.roundOffsets,f=t.isFixed,h=s.x,p=h===void 0?0:h,m=s.y,g=m===void 0?0:m,y=typeof u=="function"?u({x:p,y:g}):{x:p,y:g};p=y.x,g=y.y;var k=s.hasOwnProperty("x"),C=s.hasOwnProperty("y"),N=Ze,b=Ge,S=window;if(d){var v=gi(n),$="clientHeight",D="clientWidth";if(v===nt(n)&&(v=pn(n),qt(v).position!=="static"&&a==="absolute"&&($="scrollHeight",D="scrollWidth")),v=v,i===Ge||(i===Ze||i===ct)&&o===pi){b=lt;var A=f&&v===S&&S.visualViewport?S.visualViewport.height:v[$];g-=A-r.height,g*=c?1:-1}if(i===Ze||(i===Ge||i===lt)&&o===pi){N=ct;var B=f&&v===S&&S.visualViewport?S.visualViewport.width:v[D];p-=B-r.width,p*=c?1:-1}}var P=Object.assign({position:a},d&&M2),F=u===!0?T2({x:p,y:g},nt(n)):{x:p,y:g};if(p=F.x,g=F.y,c){var G;return Object.assign({},P,(G={},G[b]=C?"0":"",G[N]=k?"0":"",G.transform=(S.devicePixelRatio||1)<=1?"translate("+p+"px, "+g+"px)":"translate3d("+p+"px, "+g+"px, 0)",G))}return Object.assign({},P,(e={},e[b]=C?g+"px":"",e[N]=k?p+"px":"",e.transform="",e))}function $2(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,a=n.roundOffsets,c=a===void 0?!0:a,d={placement:At(e.placement),variation:Sr(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,Hf(Object.assign({},d,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:c})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Hf(Object.assign({},d,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const N2={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:$2,data:{}};var No={passive:!0};function B2(t){var e=t.state,n=t.instance,r=t.options,i=r.scroll,o=i===void 0?!0:i,s=r.resize,a=s===void 0?!0:s,c=nt(e.elements.popper),d=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&d.forEach(function(u){u.addEventListener("scroll",n.update,No)}),a&&c.addEventListener("resize",n.update,No),function(){o&&d.forEach(function(u){u.removeEventListener("scroll",n.update,No)}),a&&c.removeEventListener("resize",n.update,No)}}const A2={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:B2,data:{}};var D2={left:"right",right:"left",bottom:"top",top:"bottom"};function Bo(t){return t.replace(/left|right|bottom|top/g,function(e){return D2[e]})}var V2={start:"end",end:"start"};function Wf(t){return t.replace(/start|end/g,function(e){return V2[e]})}function Da(t){var e=nt(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Va(t){return wr(pn(t)).left+Da(t).scrollLeft}function I2(t,e){var n=nt(t),r=pn(t),i=n.visualViewport,o=r.clientWidth,s=r.clientHeight,a=0,c=0;if(i){o=i.width,s=i.height;var d=_f();(d||!d&&e==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:o,height:s,x:a+Va(t),y:c}}function P2(t){var e,n=pn(t),r=Da(t),i=(e=t.ownerDocument)==null?void 0:e.body,o=Ln(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=Ln(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-r.scrollLeft+Va(t),c=-r.scrollTop;return qt(i||n).direction==="rtl"&&(a+=Ln(n.clientWidth,i?i.clientWidth:0)-o),{width:o,height:s,x:a,y:c}}function Ia(t){var e=qt(t),n=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function qf(t){return["html","body","#document"].indexOf(Bt(t))>=0?t.ownerDocument.body:dt(t)&&Ia(t)?t:qf($o(t))}function bi(t,e){var n;e===void 0&&(e=[]);var r=qf(t),i=r===((n=t.ownerDocument)==null?void 0:n.body),o=nt(r),s=i?[o].concat(o.visualViewport||[],Ia(r)?r:[]):r,a=e.concat(s);return i?a:a.concat(bi($o(s)))}function Pa(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function _2(t,e){var n=wr(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 Uf(t,e,n){return e===Df?Pa(I2(t,n)):Rn(e)?_2(e,n):Pa(P2(pn(t)))}function R2(t){var e=bi($o(t)),n=["absolute","fixed"].indexOf(qt(t).position)>=0,r=n&&dt(t)?gi(t):t;return Rn(r)?e.filter(function(i){return Rn(i)&&Rf(i,r)&&Bt(i)!=="body"}):[]}function L2(t,e,n,r){var i=e==="clippingParents"?R2(t):[].concat(e),o=[].concat(i,[n]),s=o[0],a=o.reduce(function(c,d){var u=Uf(t,d,r);return c.top=Ln(u.top,c.top),c.right=To(u.right,c.right),c.bottom=To(u.bottom,c.bottom),c.left=Ln(u.left,c.left),c},Uf(t,s,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Kf(t){var e=t.reference,n=t.element,r=t.placement,i=r?At(r):null,o=r?Sr(r):null,s=e.x+e.width/2-n.width/2,a=e.y+e.height/2-n.height/2,c;switch(i){case Ge:c={x:s,y:e.y-n.height};break;case lt:c={x:s,y:e.y+e.height};break;case ct:c={x:e.x+e.width,y:a};break;case Ze:c={x:e.x-n.width,y:a};break;default:c={x:e.x,y:e.y}}var d=i?Aa(i):null;if(d!=null){var u=d==="y"?"height":"width";switch(o){case vr:c[d]=c[d]-(e[u]/2-n[u]/2);break;case pi:c[d]=c[d]+(e[u]/2-n[u]/2);break}}return c}function ki(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,a=n.boundary,c=a===void 0?s2:a,d=n.rootBoundary,u=d===void 0?Df:d,f=n.elementContext,h=f===void 0?mi:f,p=n.altBoundary,m=p===void 0?!1:p,g=n.padding,y=g===void 0?0:g,k=Ff(typeof y!="number"?y:jf(y,hi)),C=h===mi?a2:mi,N=t.rects.popper,b=t.elements[m?C:h],S=L2(Rn(b)?b:b.contextElement||pn(t.elements.popper),c,u,s),v=wr(t.elements.reference),$=Kf({reference:v,element:N,placement:i}),D=Pa(Object.assign({},N,$)),A=h===mi?D:v,B={top:S.top-A.top+k.top,bottom:A.bottom-S.bottom+k.bottom,left:S.left-A.left+k.left,right:A.right-S.right+k.right},P=t.modifiersData.offset;if(h===mi&&P){var F=P[i];Object.keys(B).forEach(function(G){var L=[ct,lt].indexOf(G)>=0?1:-1,I=[Ge,lt].indexOf(G)>=0?"y":"x";B[G]+=F[I]*L})}return B}function z2(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=n.boundary,o=n.rootBoundary,s=n.padding,a=n.flipVariations,c=n.allowedAutoPlacements,d=c===void 0?If:c,u=Sr(r),f=u?a?Vf:Vf.filter(function(m){return Sr(m)===u}):hi,h=f.filter(function(m){return d.indexOf(m)>=0});h.length===0&&(h=f);var p=h.reduce(function(m,g){return m[g]=ki(t,{placement:g,boundary:i,rootBoundary:o,padding:s})[At(g)],m},{});return Object.keys(p).sort(function(m,g){return p[m]-p[g]})}function F2(t){if(At(t)===Ta)return[];var e=Bo(t);return[Wf(t),e,Wf(e)]}function j2(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,a=s===void 0?!0:s,c=n.fallbackPlacements,d=n.padding,u=n.boundary,f=n.rootBoundary,h=n.altBoundary,p=n.flipVariations,m=p===void 0?!0:p,g=n.allowedAutoPlacements,y=e.options.placement,k=At(y),C=k===y,N=c||(C||!m?[Bo(y)]:F2(y)),b=[y].concat(N).reduce(function(se,ye){return se.concat(At(ye)===Ta?z2(e,{placement:ye,boundary:u,rootBoundary:f,padding:d,flipVariations:m,allowedAutoPlacements:g}):ye)},[]),S=e.rects.reference,v=e.rects.popper,$=new Map,D=!0,A=b[0],B=0;B<b.length;B++){var P=b[B],F=At(P),G=Sr(P)===vr,L=[Ge,lt].indexOf(F)>=0,I=L?"width":"height",T=ki(e,{placement:P,boundary:u,rootBoundary:f,altBoundary:h,padding:d}),x=L?G?ct:Ze:G?lt:Ge;S[I]>v[I]&&(x=Bo(x));var M=Bo(x),V=[];if(o&&V.push(T[F]<=0),a&&V.push(T[x]<=0,T[M]<=0),V.every(function(se){return se})){A=P,D=!1;break}$.set(P,V)}if(D)for(var U=m?3:1,W=function(ye){var H=b.find(function(X){var fe=$.get(X);if(fe)return fe.slice(0,ye).every(function(oe){return oe})});if(H)return A=H,"break"},re=U;re>0;re--){var de=W(re);if(de==="break")break}e.placement!==A&&(e.modifiersData[r]._skip=!0,e.placement=A,e.reset=!0)}}const H2={name:"flip",enabled:!0,phase:"main",fn:j2,requiresIfExists:["offset"],data:{_skip:!1}};function Yf(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 Jf(t){return[Ge,ct,lt,Ze].some(function(e){return t[e]>=0})}function W2(t){var e=t.state,n=t.name,r=e.rects.reference,i=e.rects.popper,o=e.modifiersData.preventOverflow,s=ki(e,{elementContext:"reference"}),a=ki(e,{altBoundary:!0}),c=Yf(s,r),d=Yf(a,i,o),u=Jf(c),f=Jf(d);e.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:d,isReferenceHidden:u,hasPopperEscaped:f},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":f})}const q2={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:W2};function U2(t,e,n){var r=At(t),i=[Ze,Ge].indexOf(r)>=0?-1:1,o=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,s=o[0],a=o[1];return s=s||0,a=(a||0)*i,[Ze,ct].indexOf(r)>=0?{x:a,y:s}:{x:s,y:a}}function K2(t){var e=t.state,n=t.options,r=t.name,i=n.offset,o=i===void 0?[0,0]:i,s=If.reduce(function(u,f){return u[f]=U2(f,e.rects,o),u},{}),a=s[e.placement],c=a.x,d=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=c,e.modifiersData.popperOffsets.y+=d),e.modifiersData[r]=s}const Y2={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:K2};function J2(t){var e=t.state,n=t.name;e.modifiersData[n]=Kf({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const G2={name:"popperOffsets",enabled:!0,phase:"read",fn:J2,data:{}};function Z2(t){return t==="x"?"y":"x"}function X2(t){var e=t.state,n=t.options,r=t.name,i=n.mainAxis,o=i===void 0?!0:i,s=n.altAxis,a=s===void 0?!1:s,c=n.boundary,d=n.rootBoundary,u=n.altBoundary,f=n.padding,h=n.tether,p=h===void 0?!0:h,m=n.tetherOffset,g=m===void 0?0:m,y=ki(e,{boundary:c,rootBoundary:d,padding:f,altBoundary:u}),k=At(e.placement),C=Sr(e.placement),N=!C,b=Aa(k),S=Z2(b),v=e.modifiersData.popperOffsets,$=e.rects.reference,D=e.rects.popper,A=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,B=typeof A=="number"?{mainAxis:A,altAxis:A}:Object.assign({mainAxis:0,altAxis:0},A),P=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,F={x:0,y:0};if(v){if(o){var G,L=b==="y"?Ge:Ze,I=b==="y"?lt:ct,T=b==="y"?"height":"width",x=v[b],M=x+y[L],V=x-y[I],U=p?-D[T]/2:0,W=C===vr?$[T]:D[T],re=C===vr?-D[T]:-$[T],de=e.elements.arrow,se=p&&de?Ba(de):{width:0,height:0},ye=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:zf(),H=ye[L],X=ye[I],fe=yi(0,$[T],se[T]),oe=N?$[T]/2-U-fe-H-B.mainAxis:W-fe-H-B.mainAxis,he=N?-$[T]/2+U+fe+X+B.mainAxis:re+fe+X+B.mainAxis,be=e.elements.arrow&&gi(e.elements.arrow),Oe=be?b==="y"?be.clientTop||0:be.clientLeft||0:0,ut=(G=P==null?void 0:P[b])!=null?G:0,Mr=x+oe-ut-Oe,gn=x+he-ut,yn=yi(p?To(M,Mr):M,x,p?Ln(V,gn):V);v[b]=yn,F[b]=yn-x}if(a){var Kt,xt=b==="x"?Ge:Ze,ft=b==="x"?lt:ct,ht=v[S],It=S==="y"?"height":"width",Yt=ht+y[xt],Pt=ht-y[ft],jn=[Ge,Ze].indexOf(k)!==-1,bn=(Kt=P==null?void 0:P[S])!=null?Kt:0,Tr=jn?Yt:ht-$[It]-D[It]-bn+B.altAxis,$r=jn?ht+$[It]+D[It]-bn-B.altAxis:Pt,Nr=p&&jn?w2(Tr,ht,$r):yi(p?Tr:Yt,ht,p?$r:Pt);v[S]=Nr,F[S]=Nr-ht}e.modifiersData[r]=F}}const Q2={name:"preventOverflow",enabled:!0,phase:"main",fn:X2,requiresIfExists:["offset"]};function eT(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function tT(t){return t===nt(t)||!dt(t)?Da(t):eT(t)}function nT(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 rT(t,e,n){n===void 0&&(n=!1);var r=dt(e),i=dt(e)&&nT(e),o=pn(e),s=wr(t,i,n),a={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!n)&&((Bt(e)!=="body"||Ia(o))&&(a=tT(e)),dt(e)?(c=wr(e,!0),c.x+=e.clientLeft,c.y+=e.clientTop):o&&(c.x=Va(o))),{x:s.left+a.scrollLeft-c.x,y:s.top+a.scrollTop-c.y,width:s.width,height:s.height}}function iT(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(a){if(!n.has(a)){var c=e.get(a);c&&i(c)}}),r.push(o)}return t.forEach(function(o){n.has(o.name)||i(o)}),r}function oT(t){var e=iT(t);return y2.reduce(function(n,r){return n.concat(e.filter(function(i){return i.phase===r}))},[])}function sT(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function aT(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 Gf={placement:"bottom",modifiers:[],strategy:"absolute"};function Zf(){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 lT(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,i=e.defaultOptions,o=i===void 0?Gf:i;return function(a,c,d){d===void 0&&(d=o);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},Gf,o),modifiersData:{},elements:{reference:a,popper:c},attributes:{},styles:{}},f=[],h=!1,p={state:u,setOptions:function(k){var C=typeof k=="function"?k(u.options):k;g(),u.options=Object.assign({},o,u.options,C),u.scrollParents={reference:Rn(a)?bi(a):a.contextElement?bi(a.contextElement):[],popper:bi(c)};var N=oT(aT([].concat(r,u.options.modifiers)));return u.orderedModifiers=N.filter(function(b){return b.enabled}),m(),p.update()},forceUpdate:function(){if(!h){var k=u.elements,C=k.reference,N=k.popper;if(Zf(C,N)){u.rects={reference:rT(C,gi(N),u.options.strategy==="fixed"),popper:Ba(N)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(B){return u.modifiersData[B.name]=Object.assign({},B.data)});for(var b=0;b<u.orderedModifiers.length;b++){if(u.reset===!0){u.reset=!1,b=-1;continue}var S=u.orderedModifiers[b],v=S.fn,$=S.options,D=$===void 0?{}:$,A=S.name;typeof v=="function"&&(u=v({state:u,options:D,name:A,instance:p})||u)}}}},update:sT(function(){return new Promise(function(y){p.forceUpdate(),y(u)})}),destroy:function(){g(),h=!0}};if(!Zf(a,c))return p;p.setOptions(d).then(function(y){!h&&d.onFirstUpdate&&d.onFirstUpdate(y)});function m(){u.orderedModifiers.forEach(function(y){var k=y.name,C=y.options,N=C===void 0?{}:C,b=y.effect;if(typeof b=="function"){var S=b({state:u,name:k,instance:p,options:N}),v=function(){};f.push(S||v)}})}function g(){f.forEach(function(y){return y()}),f=[]}return p}}var cT=[A2,G2,N2,Pf,Y2,H2,Q2,E2,q2],dT=lT({defaultModifiers:cT}),uT="tippy-box",Xf="tippy-content",fT="tippy-backdrop",Qf="tippy-arrow",eh="tippy-svg-arrow",zn={passive:!0,capture:!0},th=function(){return document.body};function hT(t,e){return{}.hasOwnProperty.call(t,e)}function _a(t,e,n){if(Array.isArray(t)){var r=t[e];return r??(Array.isArray(n)?n[e]:n)}return t}function Ra(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function nh(t,e){return typeof t=="function"?t.apply(void 0,e):t}function rh(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function pT(t,e){var n=Object.assign({},t);return e.forEach(function(r){delete n[r]}),n}function mT(t){return t.split(/\s+/).filter(Boolean)}function Cr(t){return[].concat(t)}function ih(t,e){t.indexOf(e)===-1&&t.push(e)}function gT(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function yT(t){return t.split("-")[0]}function Ao(t){return[].slice.call(t)}function oh(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function vi(){return document.createElement("div")}function xi(t){return["Element","Fragment"].some(function(e){return Ra(t,e)})}function bT(t){return Ra(t,"NodeList")}function kT(t){return Ra(t,"MouseEvent")}function vT(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function xT(t){return xi(t)?[t]:bT(t)?Ao(t):Array.isArray(t)?t:Ao(document.querySelectorAll(t))}function La(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function sh(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function wT(t){var e,n=Cr(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function ST(t,e){var n=e.clientX,r=e.clientY;return t.every(function(i){var o=i.popperRect,s=i.popperState,a=i.props,c=a.interactiveBorder,d=yT(s.placement),u=s.modifiersData.offset;if(!u)return!0;var f=d==="bottom"?u.top.y:0,h=d==="top"?u.bottom.y:0,p=d==="right"?u.left.x:0,m=d==="left"?u.right.x:0,g=o.top-r+f>c,y=r-o.bottom-h>c,k=o.left-n+p>c,C=n-o.right-m>c;return g||y||k||C})}function za(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){t[r](i,n)})}function ah(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 Dt={isTouch:!1},lh=0;function CT(){Dt.isTouch||(Dt.isTouch=!0,window.performance&&document.addEventListener("mousemove",ch))}function ch(){var t=performance.now();t-lh<20&&(Dt.isTouch=!1,document.removeEventListener("mousemove",ch)),lh=t}function OT(){var t=document.activeElement;if(vT(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function ET(){document.addEventListener("touchstart",CT,zn),window.addEventListener("blur",OT)}var MT=typeof window<"u"&&typeof document<"u",TT=MT?!!window.msCrypto:!1;function Or(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 dh(t){var e=/[ \t]{2,}/g,n=/^[ \t]*/gm;return t.replace(e," ").replace(n,"").trim()}function $T(t){return dh(`
93
+ `,textSerializers:r={}}=e||{};return _2(this.state.doc,{blockSeparator:n,textSerializers:{...Cf(this.schema),...r}})}get isEmpty(){return F2(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 _n(n,this)}get $doc(){return this.$pos(0)}};function kr(t){return new xo({find:t.find,handler:({state:e,range:n,match:r})=>{const i=ce(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:o}=e,s=r[r.length-1],a=r[0];if(s){const c=a.search(/\S/),d=n.from+a.indexOf(s),u=d+s.length;if(Bf(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>d).length)return null;u<n.to&&o.delete(u,n.to),d>n.from&&o.delete(n.from+c,d);const h=n.from+c+s.length;o.addMark(n.from+c,h,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}function aM(t){return new xo({find:t.find,handler:({state:e,range:n,match:r})=>{const i=ce(t.getAttributes,void 0,r)||{},{tr:o}=e,s=n.from;let a=n.to;const c=t.type.create(i);if(r[1]){const d=r[0].lastIndexOf(r[1]);let u=s+d;u>a?u=a:a=u+r[1].length;const f=r[0][r[0].length-1];o.insertText(f,s+r[0].length-1),o.replaceWith(u,a,c)}else r[0]&&o.insert(s-1,t.type.create(i)).delete(o.mapping.map(s),o.mapping.map(a));o.scrollIntoView()}})}function Ma(t){return new xo({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),o=ce(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 fi(t){return new xo({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const o=ce(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),c=s.doc.resolve(n.from).blockRange(),d=c&&As(c,t.type,o);if(!d)return null;if(s.wrap(c,d),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 u=s.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&nn(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&s.join(n.from-1)}})}class Nt{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=ce(J(this,"addOptions",{name:this.name}))),this.storage=ce(J(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Nt(e)}configure(e={}){const n=this.extend();return n.options=wo(this.options,e),n.storage=ce(J(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){const n=new Nt({...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=ce(J(n,"addOptions",{name:n.name})),n.storage=ce(J(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(d=>(d==null?void 0:d.type.name)===n.name))return!1;const c=s.find(d=>(d==null?void 0:d.type.name)===n.name);return c&&r.removeStoredMark(c),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}let tt=class il{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=ce(J(this,"addOptions",{name:this.name}))),this.storage=ce(J(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new il(e)}configure(e={}){const n=this.extend();return n.options=wo(this.options,e),n.storage=ce(J(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){const n=new il({...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=ce(J(n,"addOptions",{name:n.name})),n.storage=ce(J(n,"addStorage",{name:n.name,options:n.options})),n}};function xr(t){return new PE({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const o=ce(t.getAttributes,void 0,r,i);if(o===!1||o===null)return null;const{tr:s}=e,a=r[r.length-1],c=r[0];let d=n.to;if(a){const u=c.search(/\S/),f=n.from+c.indexOf(a),h=f+a.length;if(Bf(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+u,f),d=n.from+u+a.length,s.addMark(n.from+u,d,t.type.create(o||{})),s.removeStoredMark(t.type)}}})}var Ge="top",lt="bottom",ct="right",Ze="left",Ta="auto",hi=[Ge,lt,ct,Ze],vr="start",pi="end",lM="clippingParents",If="viewport",mi="popper",cM="reference",Pf=hi.reduce(function(t,e){return t.concat([e+"-"+vr,e+"-"+pi])},[]),_f=[].concat(hi,[Ta]).reduce(function(t,e){return t.concat([e,e+"-"+vr,e+"-"+pi])},[]),dM="beforeRead",uM="read",fM="afterRead",hM="beforeMain",pM="main",mM="afterMain",gM="beforeWrite",yM="write",bM="afterWrite",kM=[dM,uM,fM,hM,pM,mM,gM,yM,bM];function Bt(t){return t?(t.nodeName||"").toLowerCase():null}function nt(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Rn(t){var e=nt(t).Element;return t instanceof e||t instanceof Element}function dt(t){var e=nt(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function $a(t){if(typeof ShadowRoot>"u")return!1;var e=nt(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function xM(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];!dt(o)||!Bt(o)||(Object.assign(o.style,r),Object.keys(i).forEach(function(s){var a=i[s];a===!1?o.removeAttribute(s):o.setAttribute(s,a===!0?"":a)}))})}function vM(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]),a=s.reduce(function(c,d){return c[d]="",c},{});!dt(i)||!Bt(i)||(Object.assign(i.style,a),Object.keys(o).forEach(function(c){i.removeAttribute(c)}))})}}const Rf={name:"applyStyles",enabled:!0,phase:"write",fn:xM,effect:vM,requires:["computeStyles"]};function At(t){return t.split("-")[0]}var Ln=Math.max,To=Math.min,wr=Math.round;function Na(){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 Lf(){return!/^((?!chrome|android).)*safari/i.test(Na())}function Sr(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),i=1,o=1;e&&dt(t)&&(i=t.offsetWidth>0&&wr(r.width)/t.offsetWidth||1,o=t.offsetHeight>0&&wr(r.height)/t.offsetHeight||1);var s=Rn(t)?nt(t):window,a=s.visualViewport,c=!Lf()&&n,d=(r.left+(c&&a?a.offsetLeft:0))/i,u=(r.top+(c&&a?a.offsetTop:0))/o,f=r.width/i,h=r.height/o;return{width:f,height:h,top:u,right:d+f,bottom:u+h,left:d,x:d,y:u}}function Ba(t){var e=Sr(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 zf(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&$a(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function qt(t){return nt(t).getComputedStyle(t)}function wM(t){return["table","td","th"].indexOf(Bt(t))>=0}function pn(t){return((Rn(t)?t.ownerDocument:t.document)||window.document).documentElement}function $o(t){return Bt(t)==="html"?t:t.assignedSlot||t.parentNode||($a(t)?t.host:null)||pn(t)}function Ff(t){return!dt(t)||qt(t).position==="fixed"?null:t.offsetParent}function SM(t){var e=/firefox/i.test(Na()),n=/Trident/i.test(Na());if(n&&dt(t)){var r=qt(t);if(r.position==="fixed")return null}var i=$o(t);for($a(i)&&(i=i.host);dt(i)&&["html","body"].indexOf(Bt(i))<0;){var o=qt(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 gi(t){for(var e=nt(t),n=Ff(t);n&&wM(n)&&qt(n).position==="static";)n=Ff(n);return n&&(Bt(n)==="html"||Bt(n)==="body"&&qt(n).position==="static")?e:n||SM(t)||e}function Aa(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function yi(t,e,n){return Ln(t,To(e,n))}function CM(t,e,n){var r=yi(t,e,n);return r>n?n:r}function jf(){return{top:0,right:0,bottom:0,left:0}}function Hf(t){return Object.assign({},jf(),t)}function Wf(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var OM=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,Hf(typeof e!="number"?e:Wf(e,hi))};function EM(t){var e,n=t.state,r=t.name,i=t.options,o=n.elements.arrow,s=n.modifiersData.popperOffsets,a=At(n.placement),c=Aa(a),d=[Ze,ct].indexOf(a)>=0,u=d?"height":"width";if(!(!o||!s)){var f=OM(i.padding,n),h=Ba(o),p=c==="y"?Ge:Ze,m=c==="y"?lt:ct,y=n.rects.reference[u]+n.rects.reference[c]-s[c]-n.rects.popper[u],g=s[c]-n.rects.reference[c],k=gi(o),C=k?c==="y"?k.clientHeight||0:k.clientWidth||0:0,N=y/2-g/2,b=f[p],S=C-h[u]-f[m],x=C/2-h[u]/2+N,$=yi(b,x,S),D=c;n.modifiersData[r]=(e={},e[D]=$,e.centerOffset=$-x,e)}}function MM(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)||zf(e.elements.popper,i)&&(e.elements.arrow=i))}const TM={name:"arrow",enabled:!0,phase:"main",fn:EM,effect:MM,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Cr(t){return t.split("-")[1]}var $M={top:"auto",right:"auto",bottom:"auto",left:"auto"};function NM(t,e){var n=t.x,r=t.y,i=e.devicePixelRatio||1;return{x:wr(n*i)/i||0,y:wr(r*i)/i||0}}function qf(t){var e,n=t.popper,r=t.popperRect,i=t.placement,o=t.variation,s=t.offsets,a=t.position,c=t.gpuAcceleration,d=t.adaptive,u=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 u=="function"?u({x:p,y}):{x:p,y};p=g.x,y=g.y;var k=s.hasOwnProperty("x"),C=s.hasOwnProperty("y"),N=Ze,b=Ge,S=window;if(d){var x=gi(n),$="clientHeight",D="clientWidth";if(x===nt(n)&&(x=pn(n),qt(x).position!=="static"&&a==="absolute"&&($="scrollHeight",D="scrollWidth")),x=x,i===Ge||(i===Ze||i===ct)&&o===pi){b=lt;var A=f&&x===S&&S.visualViewport?S.visualViewport.height:x[$];y-=A-r.height,y*=c?1:-1}if(i===Ze||(i===Ge||i===lt)&&o===pi){N=ct;var B=f&&x===S&&S.visualViewport?S.visualViewport.width:x[D];p-=B-r.width,p*=c?1:-1}}var P=Object.assign({position:a},d&&$M),F=u===!0?NM({x:p,y},nt(n)):{x:p,y};if(p=F.x,y=F.y,c){var G;return Object.assign({},P,(G={},G[b]=C?"0":"",G[N]=k?"0":"",G.transform=(S.devicePixelRatio||1)<=1?"translate("+p+"px, "+y+"px)":"translate3d("+p+"px, "+y+"px, 0)",G))}return Object.assign({},P,(e={},e[b]=C?y+"px":"",e[N]=k?p+"px":"",e.transform="",e))}function BM(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,a=n.roundOffsets,c=a===void 0?!0:a,d={placement:At(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,qf(Object.assign({},d,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:c})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,qf(Object.assign({},d,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const AM={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:BM,data:{}};var No={passive:!0};function DM(t){var e=t.state,n=t.instance,r=t.options,i=r.scroll,o=i===void 0?!0:i,s=r.resize,a=s===void 0?!0:s,c=nt(e.elements.popper),d=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&d.forEach(function(u){u.addEventListener("scroll",n.update,No)}),a&&c.addEventListener("resize",n.update,No),function(){o&&d.forEach(function(u){u.removeEventListener("scroll",n.update,No)}),a&&c.removeEventListener("resize",n.update,No)}}const VM={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:DM,data:{}};var IM={left:"right",right:"left",bottom:"top",top:"bottom"};function Bo(t){return t.replace(/left|right|bottom|top/g,function(e){return IM[e]})}var PM={start:"end",end:"start"};function Uf(t){return t.replace(/start|end/g,function(e){return PM[e]})}function Da(t){var e=nt(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Va(t){return Sr(pn(t)).left+Da(t).scrollLeft}function _M(t,e){var n=nt(t),r=pn(t),i=n.visualViewport,o=r.clientWidth,s=r.clientHeight,a=0,c=0;if(i){o=i.width,s=i.height;var d=Lf();(d||!d&&e==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:o,height:s,x:a+Va(t),y:c}}function RM(t){var e,n=pn(t),r=Da(t),i=(e=t.ownerDocument)==null?void 0:e.body,o=Ln(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=Ln(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-r.scrollLeft+Va(t),c=-r.scrollTop;return qt(i||n).direction==="rtl"&&(a+=Ln(n.clientWidth,i?i.clientWidth:0)-o),{width:o,height:s,x:a,y:c}}function Ia(t){var e=qt(t),n=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function Kf(t){return["html","body","#document"].indexOf(Bt(t))>=0?t.ownerDocument.body:dt(t)&&Ia(t)?t:Kf($o(t))}function bi(t,e){var n;e===void 0&&(e=[]);var r=Kf(t),i=r===((n=t.ownerDocument)==null?void 0:n.body),o=nt(r),s=i?[o].concat(o.visualViewport||[],Ia(r)?r:[]):r,a=e.concat(s);return i?a:a.concat(bi($o(s)))}function Pa(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function LM(t,e){var n=Sr(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 Yf(t,e,n){return e===If?Pa(_M(t,n)):Rn(e)?LM(e,n):Pa(RM(pn(t)))}function zM(t){var e=bi($o(t)),n=["absolute","fixed"].indexOf(qt(t).position)>=0,r=n&&dt(t)?gi(t):t;return Rn(r)?e.filter(function(i){return Rn(i)&&zf(i,r)&&Bt(i)!=="body"}):[]}function FM(t,e,n,r){var i=e==="clippingParents"?zM(t):[].concat(e),o=[].concat(i,[n]),s=o[0],a=o.reduce(function(c,d){var u=Yf(t,d,r);return c.top=Ln(u.top,c.top),c.right=To(u.right,c.right),c.bottom=To(u.bottom,c.bottom),c.left=Ln(u.left,c.left),c},Yf(t,s,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Jf(t){var e=t.reference,n=t.element,r=t.placement,i=r?At(r):null,o=r?Cr(r):null,s=e.x+e.width/2-n.width/2,a=e.y+e.height/2-n.height/2,c;switch(i){case Ge:c={x:s,y:e.y-n.height};break;case lt:c={x:s,y:e.y+e.height};break;case ct:c={x:e.x+e.width,y:a};break;case Ze:c={x:e.x-n.width,y:a};break;default:c={x:e.x,y:e.y}}var d=i?Aa(i):null;if(d!=null){var u=d==="y"?"height":"width";switch(o){case vr:c[d]=c[d]-(e[u]/2-n[u]/2);break;case pi:c[d]=c[d]+(e[u]/2-n[u]/2);break}}return c}function ki(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,a=n.boundary,c=a===void 0?lM:a,d=n.rootBoundary,u=d===void 0?If:d,f=n.elementContext,h=f===void 0?mi:f,p=n.altBoundary,m=p===void 0?!1:p,y=n.padding,g=y===void 0?0:y,k=Hf(typeof g!="number"?g:Wf(g,hi)),C=h===mi?cM:mi,N=t.rects.popper,b=t.elements[m?C:h],S=FM(Rn(b)?b:b.contextElement||pn(t.elements.popper),c,u,s),x=Sr(t.elements.reference),$=Jf({reference:x,element:N,placement:i}),D=Pa(Object.assign({},N,$)),A=h===mi?D:x,B={top:S.top-A.top+k.top,bottom:A.bottom-S.bottom+k.bottom,left:S.left-A.left+k.left,right:A.right-S.right+k.right},P=t.modifiersData.offset;if(h===mi&&P){var F=P[i];Object.keys(B).forEach(function(G){var L=[ct,lt].indexOf(G)>=0?1:-1,I=[Ge,lt].indexOf(G)>=0?"y":"x";B[G]+=F[I]*L})}return B}function jM(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=n.boundary,o=n.rootBoundary,s=n.padding,a=n.flipVariations,c=n.allowedAutoPlacements,d=c===void 0?_f:c,u=Cr(r),f=u?a?Pf:Pf.filter(function(m){return Cr(m)===u}):hi,h=f.filter(function(m){return d.indexOf(m)>=0});h.length===0&&(h=f);var p=h.reduce(function(m,y){return m[y]=ki(t,{placement:y,boundary:i,rootBoundary:o,padding:s})[At(y)],m},{});return Object.keys(p).sort(function(m,y){return p[m]-p[y]})}function HM(t){if(At(t)===Ta)return[];var e=Bo(t);return[Uf(t),e,Uf(e)]}function WM(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,a=s===void 0?!0:s,c=n.fallbackPlacements,d=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=At(g),C=k===g,N=c||(C||!m?[Bo(g)]:HM(g)),b=[g].concat(N).reduce(function(se,ye){return se.concat(At(ye)===Ta?jM(e,{placement:ye,boundary:u,rootBoundary:f,padding:d,flipVariations:m,allowedAutoPlacements:y}):ye)},[]),S=e.rects.reference,x=e.rects.popper,$=new Map,D=!0,A=b[0],B=0;B<b.length;B++){var P=b[B],F=At(P),G=Cr(P)===vr,L=[Ge,lt].indexOf(F)>=0,I=L?"width":"height",T=ki(e,{placement:P,boundary:u,rootBoundary:f,altBoundary:h,padding:d}),v=L?G?ct:Ze:G?lt:Ge;S[I]>x[I]&&(v=Bo(v));var M=Bo(v),V=[];if(o&&V.push(T[F]<=0),a&&V.push(T[v]<=0,T[M]<=0),V.every(function(se){return se})){A=P,D=!1;break}$.set(P,V)}if(D)for(var U=m?3:1,j=function(ye){var W=b.find(function(X){var fe=$.get(X);if(fe)return fe.slice(0,ye).every(function(oe){return oe})});if(W)return A=W,"break"},Q=U;Q>0;Q--){var de=j(Q);if(de==="break")break}e.placement!==A&&(e.modifiersData[r]._skip=!0,e.placement=A,e.reset=!0)}}const qM={name:"flip",enabled:!0,phase:"main",fn:WM,requiresIfExists:["offset"],data:{_skip:!1}};function Gf(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 Zf(t){return[Ge,ct,lt,Ze].some(function(e){return t[e]>=0})}function UM(t){var e=t.state,n=t.name,r=e.rects.reference,i=e.rects.popper,o=e.modifiersData.preventOverflow,s=ki(e,{elementContext:"reference"}),a=ki(e,{altBoundary:!0}),c=Gf(s,r),d=Gf(a,i,o),u=Zf(c),f=Zf(d);e.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:d,isReferenceHidden:u,hasPopperEscaped:f},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":f})}const KM={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:UM};function YM(t,e,n){var r=At(t),i=[Ze,Ge].indexOf(r)>=0?-1:1,o=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,s=o[0],a=o[1];return s=s||0,a=(a||0)*i,[Ze,ct].indexOf(r)>=0?{x:a,y:s}:{x:s,y:a}}function JM(t){var e=t.state,n=t.options,r=t.name,i=n.offset,o=i===void 0?[0,0]:i,s=_f.reduce(function(u,f){return u[f]=YM(f,e.rects,o),u},{}),a=s[e.placement],c=a.x,d=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=c,e.modifiersData.popperOffsets.y+=d),e.modifiersData[r]=s}const GM={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:JM};function ZM(t){var e=t.state,n=t.name;e.modifiersData[n]=Jf({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const XM={name:"popperOffsets",enabled:!0,phase:"read",fn:ZM,data:{}};function QM(t){return t==="x"?"y":"x"}function eT(t){var e=t.state,n=t.options,r=t.name,i=n.mainAxis,o=i===void 0?!0:i,s=n.altAxis,a=s===void 0?!1:s,c=n.boundary,d=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=ki(e,{boundary:c,rootBoundary:d,padding:f,altBoundary:u}),k=At(e.placement),C=Cr(e.placement),N=!C,b=Aa(k),S=QM(b),x=e.modifiersData.popperOffsets,$=e.rects.reference,D=e.rects.popper,A=typeof y=="function"?y(Object.assign({},e.rects,{placement:e.placement})):y,B=typeof A=="number"?{mainAxis:A,altAxis:A}:Object.assign({mainAxis:0,altAxis:0},A),P=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,F={x:0,y:0};if(x){if(o){var G,L=b==="y"?Ge:Ze,I=b==="y"?lt:ct,T=b==="y"?"height":"width",v=x[b],M=v+g[L],V=v-g[I],U=p?-D[T]/2:0,j=C===vr?$[T]:D[T],Q=C===vr?-D[T]:-$[T],de=e.elements.arrow,se=p&&de?Ba(de):{width:0,height:0},ye=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:jf(),W=ye[L],X=ye[I],fe=yi(0,$[T],se[T]),oe=N?$[T]/2-U-fe-W-B.mainAxis:j-fe-W-B.mainAxis,he=N?-$[T]/2+U+fe+X+B.mainAxis:Q+fe+X+B.mainAxis,be=e.elements.arrow&&gi(e.elements.arrow),Oe=be?b==="y"?be.clientTop||0:be.clientLeft||0:0,ut=(G=P==null?void 0:P[b])!=null?G:0,Tr=v+oe-ut-Oe,gn=v+he-ut,yn=yi(p?To(M,Tr):M,v,p?Ln(V,gn):V);x[b]=yn,F[b]=yn-v}if(a){var Kt,vt=b==="x"?Ge:Ze,ft=b==="x"?lt:ct,ht=x[S],It=S==="y"?"height":"width",Yt=ht+g[vt],Pt=ht-g[ft],jn=[Ge,Ze].indexOf(k)!==-1,bn=(Kt=P==null?void 0:P[S])!=null?Kt:0,$r=jn?Yt:ht-$[It]-D[It]-bn+B.altAxis,Nr=jn?ht+$[It]+D[It]-bn-B.altAxis:Pt,Br=p&&jn?CM($r,ht,Nr):yi(p?$r:Yt,ht,p?Nr:Pt);x[S]=Br,F[S]=Br-ht}e.modifiersData[r]=F}}const tT={name:"preventOverflow",enabled:!0,phase:"main",fn:eT,requiresIfExists:["offset"]};function nT(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function rT(t){return t===nt(t)||!dt(t)?Da(t):nT(t)}function iT(t){var e=t.getBoundingClientRect(),n=wr(e.width)/t.offsetWidth||1,r=wr(e.height)/t.offsetHeight||1;return n!==1||r!==1}function oT(t,e,n){n===void 0&&(n=!1);var r=dt(e),i=dt(e)&&iT(e),o=pn(e),s=Sr(t,i,n),a={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!n)&&((Bt(e)!=="body"||Ia(o))&&(a=rT(e)),dt(e)?(c=Sr(e,!0),c.x+=e.clientLeft,c.y+=e.clientTop):o&&(c.x=Va(o))),{x:s.left+a.scrollLeft-c.x,y:s.top+a.scrollTop-c.y,width:s.width,height:s.height}}function sT(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(a){if(!n.has(a)){var c=e.get(a);c&&i(c)}}),r.push(o)}return t.forEach(function(o){n.has(o.name)||i(o)}),r}function aT(t){var e=sT(t);return kM.reduce(function(n,r){return n.concat(e.filter(function(i){return i.phase===r}))},[])}function lT(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function cT(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 Xf={placement:"bottom",modifiers:[],strategy:"absolute"};function Qf(){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 dT(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,i=e.defaultOptions,o=i===void 0?Xf:i;return function(a,c,d){d===void 0&&(d=o);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},Xf,o),modifiersData:{},elements:{reference:a,popper:c},attributes:{},styles:{}},f=[],h=!1,p={state:u,setOptions:function(k){var C=typeof k=="function"?k(u.options):k;y(),u.options=Object.assign({},o,u.options,C),u.scrollParents={reference:Rn(a)?bi(a):a.contextElement?bi(a.contextElement):[],popper:bi(c)};var N=aT(cT([].concat(r,u.options.modifiers)));return u.orderedModifiers=N.filter(function(b){return b.enabled}),m(),p.update()},forceUpdate:function(){if(!h){var k=u.elements,C=k.reference,N=k.popper;if(Qf(C,N)){u.rects={reference:oT(C,gi(N),u.options.strategy==="fixed"),popper:Ba(N)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(B){return u.modifiersData[B.name]=Object.assign({},B.data)});for(var b=0;b<u.orderedModifiers.length;b++){if(u.reset===!0){u.reset=!1,b=-1;continue}var S=u.orderedModifiers[b],x=S.fn,$=S.options,D=$===void 0?{}:$,A=S.name;typeof x=="function"&&(u=x({state:u,options:D,name:A,instance:p})||u)}}}},update:lT(function(){return new Promise(function(g){p.forceUpdate(),g(u)})}),destroy:function(){y(),h=!0}};if(!Qf(a,c))return p;p.setOptions(d).then(function(g){!h&&d.onFirstUpdate&&d.onFirstUpdate(g)});function m(){u.orderedModifiers.forEach(function(g){var k=g.name,C=g.options,N=C===void 0?{}:C,b=g.effect;if(typeof b=="function"){var S=b({state:u,name:k,instance:p,options:N}),x=function(){};f.push(S||x)}})}function y(){f.forEach(function(g){return g()}),f=[]}return p}}var uT=[VM,XM,AM,Rf,GM,qM,tT,TM,KM],fT=dT({defaultModifiers:uT}),hT="tippy-box",eh="tippy-content",pT="tippy-backdrop",th="tippy-arrow",nh="tippy-svg-arrow",zn={passive:!0,capture:!0},rh=function(){return document.body};function mT(t,e){return{}.hasOwnProperty.call(t,e)}function _a(t,e,n){if(Array.isArray(t)){var r=t[e];return r??(Array.isArray(n)?n[e]:n)}return t}function Ra(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function ih(t,e){return typeof t=="function"?t.apply(void 0,e):t}function oh(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function gT(t,e){var n=Object.assign({},t);return e.forEach(function(r){delete n[r]}),n}function yT(t){return t.split(/\s+/).filter(Boolean)}function Or(t){return[].concat(t)}function sh(t,e){t.indexOf(e)===-1&&t.push(e)}function bT(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function kT(t){return t.split("-")[0]}function Ao(t){return[].slice.call(t)}function ah(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function xi(){return document.createElement("div")}function vi(t){return["Element","Fragment"].some(function(e){return Ra(t,e)})}function xT(t){return Ra(t,"NodeList")}function vT(t){return Ra(t,"MouseEvent")}function wT(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function ST(t){return vi(t)?[t]:xT(t)?Ao(t):Array.isArray(t)?t:Ao(document.querySelectorAll(t))}function La(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function lh(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function CT(t){var e,n=Or(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function OT(t,e){var n=e.clientX,r=e.clientY;return t.every(function(i){var o=i.popperRect,s=i.popperState,a=i.props,c=a.interactiveBorder,d=kT(s.placement),u=s.modifiersData.offset;if(!u)return!0;var f=d==="bottom"?u.top.y:0,h=d==="top"?u.bottom.y:0,p=d==="right"?u.left.x:0,m=d==="left"?u.right.x:0,y=o.top-r+f>c,g=r-o.bottom-h>c,k=o.left-n+p>c,C=n-o.right-m>c;return y||g||k||C})}function za(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){t[r](i,n)})}function ch(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 Dt={isTouch:!1},dh=0;function ET(){Dt.isTouch||(Dt.isTouch=!0,window.performance&&document.addEventListener("mousemove",uh))}function uh(){var t=performance.now();t-dh<20&&(Dt.isTouch=!1,document.removeEventListener("mousemove",uh)),dh=t}function MT(){var t=document.activeElement;if(wT(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function TT(){document.addEventListener("touchstart",ET,zn),window.addEventListener("blur",MT)}var $T=typeof window<"u"&&typeof document<"u",NT=$T?!!window.msCrypto:!1;function Er(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 fh(t){var e=/[ \t]{2,}/g,n=/^[ \t]*/gm;return t.replace(e," ").replace(n,"").trim()}function BT(t){return fh(`
94
94
  %ctippy.js
95
95
 
96
- %c`+dh(t)+`
96
+ %c`+fh(t)+`
97
97
 
98
98
  %c👷‍ This is a development-only message. It will be removed in production.
99
- `)}function uh(t){return[$T(t),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var wi;process.env.NODE_ENV!=="production"&&NT();function NT(){wi=new Set}function Ut(t,e){if(t&&!wi.has(e)){var n;wi.add(e),(n=console).warn.apply(n,uh(e))}}function Fa(t,e){if(t&&!wi.has(e)){var n;wi.add(e),(n=console).error.apply(n,uh(e))}}function BT(t){var e=!t,n=Object.prototype.toString.call(t)==="[object Object]"&&!t.addEventListener;Fa(e,["tippy() was passed","`"+String(t)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),Fa(n,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var fh={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},AT={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},rt=Object.assign({appendTo:th,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},fh,AT),DT=Object.keys(rt),VT=function(e){process.env.NODE_ENV!=="production"&&mh(e,[]);var n=Object.keys(e);n.forEach(function(r){rt[r]=e[r]})};function hh(t){var e=t.plugins||[],n=e.reduce(function(r,i){var o=i.name,s=i.defaultValue;if(o){var a;r[o]=t[o]!==void 0?t[o]:(a=rt[o])!=null?a:s}return r},{});return Object.assign({},t,n)}function IT(t,e){var n=e?Object.keys(hh(Object.assign({},rt,{plugins:e}))):DT,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 ph(t,e){var n=Object.assign({},e,{content:nh(e.content,[t])},e.ignoreAttributes?{}:IT(t,e.plugins));return n.aria=Object.assign({},rt.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 mh(t,e){t===void 0&&(t={}),e===void 0&&(e=[]);var n=Object.keys(t);n.forEach(function(r){var i=pT(rt,Object.keys(fh)),o=!hT(i,r);o&&(o=e.filter(function(s){return s.name===r}).length===0),Ut(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 hh(t){return[BT(t),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var wi;process.env.NODE_ENV!=="production"&&AT();function AT(){wi=new Set}function Ut(t,e){if(t&&!wi.has(e)){var n;wi.add(e),(n=console).warn.apply(n,hh(e))}}function Fa(t,e){if(t&&!wi.has(e)){var n;wi.add(e),(n=console).error.apply(n,hh(e))}}function DT(t){var e=!t,n=Object.prototype.toString.call(t)==="[object Object]"&&!t.addEventListener;Fa(e,["tippy() was passed","`"+String(t)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),Fa(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},VT={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},rt=Object.assign({appendTo:rh,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,VT),IT=Object.keys(rt),PT=function(e){process.env.NODE_ENV!=="production"&&yh(e,[]);var n=Object.keys(e);n.forEach(function(r){rt[r]=e[r]})};function mh(t){var e=t.plugins||[],n=e.reduce(function(r,i){var o=i.name,s=i.defaultValue;if(o){var a;r[o]=t[o]!==void 0?t[o]:(a=rt[o])!=null?a:s}return r},{});return Object.assign({},t,n)}function _T(t,e){var n=e?Object.keys(mh(Object.assign({},rt,{plugins:e}))):IT,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 gh(t,e){var n=Object.assign({},e,{content:ih(e.content,[t])},e.ignoreAttributes?{}:_T(t,e.plugins));return n.aria=Object.assign({},rt.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 yh(t,e){t===void 0&&(t={}),e===void 0&&(e=[]);var n=Object.keys(t);n.forEach(function(r){var i=gT(rt,Object.keys(ph)),o=!mT(i,r);o&&(o=e.filter(function(s){return s.name===r}).length===0),Ut(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.",`
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 PT=function(){return"innerHTML"};function ja(t,e){t[PT()]=e}function gh(t){var e=vi();return t===!0?e.className=Qf:(e.className=eh,xi(t)?e.appendChild(t):ja(e,t)),e}function yh(t,e){xi(e.content)?(ja(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?ja(t,e.content):t.textContent=e.content)}function Ha(t){var e=t.firstElementChild,n=Ao(e.children);return{box:e,content:n.find(function(r){return r.classList.contains(Xf)}),arrow:n.find(function(r){return r.classList.contains(Qf)||r.classList.contains(eh)}),backdrop:n.find(function(r){return r.classList.contains(fT)})}}function bh(t){var e=vi(),n=vi();n.className=uT,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=vi();r.className=Xf,r.setAttribute("data-state","hidden"),yh(r,t.props),e.appendChild(n),n.appendChild(r),i(t.props,t.props);function i(o,s){var a=Ha(e),c=a.box,d=a.content,u=a.arrow;s.theme?c.setAttribute("data-theme",s.theme):c.removeAttribute("data-theme"),typeof s.animation=="string"?c.setAttribute("data-animation",s.animation):c.removeAttribute("data-animation"),s.inertia?c.setAttribute("data-inertia",""):c.removeAttribute("data-inertia"),c.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?c.setAttribute("role",s.role):c.removeAttribute("role"),(o.content!==s.content||o.allowHTML!==s.allowHTML)&&yh(d,t.props),s.arrow?u?o.arrow!==s.arrow&&(c.removeChild(u),c.appendChild(gh(s.arrow))):c.appendChild(gh(s.arrow)):u&&c.removeChild(u)}return{popper:e,onUpdate:i}}bh.$$tippy=!0;var _T=1,Do=[],Wa=[];function RT(t,e){var n=ph(t,Object.assign({},rt,hh(oh(e)))),r,i,o,s=!1,a=!1,c=!1,d=!1,u,f,h,p=[],m=rh(Mr,n.interactiveDebounce),g,y=_T++,k=null,C=gT(n.plugins),N={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},b={id:y,reference:t,popper:vi(),popperInstance:k,props:n,state:N,plugins:C,clearDelayTimeouts:Tr,setProps:$r,setContent:Nr,show:E,hide:O,hideWithInteractivity:_,enable:jn,disable:bn,unmount:K,destroy:ee};if(!n.render)return process.env.NODE_ENV!=="production"&&Fa(!0,"render() function has not been supplied."),b;var S=n.render(b),v=S.popper,$=S.onUpdate;v.setAttribute("data-tippy-root",""),v.id="tippy-"+b.id,b.popper=v,t._tippy=b,v._tippy=b;var D=C.map(function(w){return w.fn(b)}),A=t.hasAttribute("aria-expanded");return be(),U(),x(),M("onCreate",[b]),n.showOnCreate&&Yt(),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&&L().addEventListener("mousemove",m)}),b;function B(){var w=b.props.touch;return Array.isArray(w)?w:[w,0]}function P(){return B()[0]==="hold"}function F(){var w;return!!((w=b.props.render)!=null&&w.$$tippy)}function G(){return g||t}function L(){var w=G().parentNode;return w?wT(w):document}function I(){return Ha(v)}function T(w){return b.state.isMounted&&!b.state.isVisible||Dt.isTouch||u&&u.type==="focus"?0:_a(b.props.delay,w?0:1,rt.delay)}function x(w){w===void 0&&(w=!1),v.style.pointerEvents=b.props.interactive&&!w?"":"none",v.style.zIndex=""+b.props.zIndex}function M(w,z,Y){if(Y===void 0&&(Y=!0),D.forEach(function(te){te[w]&&te[w].apply(te,z)}),Y){var Q;(Q=b.props)[w].apply(Q,z)}}function V(){var w=b.props.aria;if(w.content){var z="aria-"+w.content,Y=v.id,Q=Cr(b.props.triggerTarget||t);Q.forEach(function(te){var ae=te.getAttribute(z);if(b.state.isVisible)te.setAttribute(z,ae?ae+" "+Y:Y);else{var pe=ae&&ae.replace(Y,"").trim();pe?te.setAttribute(z,pe):te.removeAttribute(z)}})}}function U(){if(!(A||!b.props.aria.expanded)){var w=Cr(b.props.triggerTarget||t);w.forEach(function(z){b.props.interactive?z.setAttribute("aria-expanded",b.state.isVisible&&z===G()?"true":"false"):z.removeAttribute("aria-expanded")})}}function W(){L().removeEventListener("mousemove",m),Do=Do.filter(function(w){return w!==m})}function re(w){if(!(Dt.isTouch&&(c||w.type==="mousedown"))){var z=w.composedPath&&w.composedPath()[0]||w.target;if(!(b.props.interactive&&ah(v,z))){if(Cr(b.props.triggerTarget||t).some(function(Y){return ah(Y,z)})){if(Dt.isTouch||b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else M("onClickOutside",[b,w]);b.props.hideOnClick===!0&&(b.clearDelayTimeouts(),b.hide(),a=!0,setTimeout(function(){a=!1}),b.state.isMounted||H())}}}function de(){c=!0}function se(){c=!1}function ye(){var w=L();w.addEventListener("mousedown",re,!0),w.addEventListener("touchend",re,zn),w.addEventListener("touchstart",se,zn),w.addEventListener("touchmove",de,zn)}function H(){var w=L();w.removeEventListener("mousedown",re,!0),w.removeEventListener("touchend",re,zn),w.removeEventListener("touchstart",se,zn),w.removeEventListener("touchmove",de,zn)}function X(w,z){oe(w,function(){!b.state.isVisible&&v.parentNode&&v.parentNode.contains(v)&&z()})}function fe(w,z){oe(w,z)}function oe(w,z){var Y=I().box;function Q(te){te.target===Y&&(za(Y,"remove",Q),z())}if(w===0)return z();za(Y,"remove",f),za(Y,"add",Q),f=Q}function he(w,z,Y){Y===void 0&&(Y=!1);var Q=Cr(b.props.triggerTarget||t);Q.forEach(function(te){te.addEventListener(w,z,Y),p.push({node:te,eventType:w,handler:z,options:Y})})}function be(){P()&&(he("touchstart",ut,{passive:!0}),he("touchend",gn,{passive:!0})),mT(b.props.trigger).forEach(function(w){if(w!=="manual")switch(he(w,ut),w){case"mouseenter":he("mouseleave",gn);break;case"focus":he(TT?"focusout":"blur",yn);break;case"focusin":he("focusout",yn);break}})}function Oe(){p.forEach(function(w){var z=w.node,Y=w.eventType,Q=w.handler,te=w.options;z.removeEventListener(Y,Q,te)}),p=[]}function ut(w){var z,Y=!1;if(!(!b.state.isEnabled||Kt(w)||a)){var Q=((z=u)==null?void 0:z.type)==="focus";u=w,g=w.currentTarget,U(),!b.state.isVisible&&kT(w)&&Do.forEach(function(te){return te(w)}),w.type==="click"&&(b.props.trigger.indexOf("mouseenter")<0||s)&&b.props.hideOnClick!==!1&&b.state.isVisible?Y=!0:Yt(w),w.type==="click"&&(s=!Y),Y&&!Q&&Pt(w)}}function Mr(w){var z=w.target,Y=G().contains(z)||v.contains(z);if(!(w.type==="mousemove"&&Y)){var Q=It().concat(v).map(function(te){var ae,pe=te._tippy,xe=(ae=pe.popperInstance)==null?void 0:ae.state;return xe?{popperRect:te.getBoundingClientRect(),popperState:xe,props:n}:null}).filter(Boolean);ST(Q,w)&&(W(),Pt(w))}}function gn(w){var z=Kt(w)||b.props.trigger.indexOf("click")>=0&&s;if(!z){if(b.props.interactive){b.hideWithInteractivity(w);return}Pt(w)}}function yn(w){b.props.trigger.indexOf("focusin")<0&&w.target!==G()||b.props.interactive&&w.relatedTarget&&v.contains(w.relatedTarget)||Pt(w)}function Kt(w){return Dt.isTouch?P()!==w.type.indexOf("touch")>=0:!1}function xt(){ft();var w=b.props,z=w.popperOptions,Y=w.placement,Q=w.offset,te=w.getReferenceClientRect,ae=w.moveTransition,pe=F()?Ha(v).arrow:null,xe=te?{getBoundingClientRect:te,contextElement:te.contextElement||G()}:t,qe={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(kn){var _t=kn.state;if(F()){var Si=I(),el=Si.box;["placement","reference-hidden","escaped"].forEach(function(_o){_o==="placement"?el.setAttribute("data-placement",_t.placement):_t.attributes.popper["data-popper-"+_o]?el.setAttribute("data-"+_o,""):el.removeAttribute("data-"+_o)}),_t.attributes.popper={}}}},it=[{name:"offset",options:{offset:Q}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!ae}},qe];F()&&pe&&it.push({name:"arrow",options:{element:pe,padding:3}}),it.push.apply(it,(z==null?void 0:z.modifiers)||[]),b.popperInstance=dT(xe,v,Object.assign({},z,{placement:Y,onFirstUpdate:h,modifiers:it}))}function ft(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function ht(){var w=b.props.appendTo,z,Y=G();b.props.interactive&&w===th||w==="parent"?z=Y.parentNode:z=nh(w,[Y]),z.contains(v)||z.appendChild(v),b.state.isMounted=!0,xt(),process.env.NODE_ENV!=="production"&&Ut(b.props.interactive&&w===rt.appendTo&&Y.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.",`
102
+ `,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var RT=function(){return"innerHTML"};function ja(t,e){t[RT()]=e}function bh(t){var e=xi();return t===!0?e.className=th:(e.className=nh,vi(t)?e.appendChild(t):ja(e,t)),e}function kh(t,e){vi(e.content)?(ja(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?ja(t,e.content):t.textContent=e.content)}function Ha(t){var e=t.firstElementChild,n=Ao(e.children);return{box:e,content:n.find(function(r){return r.classList.contains(eh)}),arrow:n.find(function(r){return r.classList.contains(th)||r.classList.contains(nh)}),backdrop:n.find(function(r){return r.classList.contains(pT)})}}function xh(t){var e=xi(),n=xi();n.className=hT,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=xi();r.className=eh,r.setAttribute("data-state","hidden"),kh(r,t.props),e.appendChild(n),n.appendChild(r),i(t.props,t.props);function i(o,s){var a=Ha(e),c=a.box,d=a.content,u=a.arrow;s.theme?c.setAttribute("data-theme",s.theme):c.removeAttribute("data-theme"),typeof s.animation=="string"?c.setAttribute("data-animation",s.animation):c.removeAttribute("data-animation"),s.inertia?c.setAttribute("data-inertia",""):c.removeAttribute("data-inertia"),c.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?c.setAttribute("role",s.role):c.removeAttribute("role"),(o.content!==s.content||o.allowHTML!==s.allowHTML)&&kh(d,t.props),s.arrow?u?o.arrow!==s.arrow&&(c.removeChild(u),c.appendChild(bh(s.arrow))):c.appendChild(bh(s.arrow)):u&&c.removeChild(u)}return{popper:e,onUpdate:i}}xh.$$tippy=!0;var LT=1,Do=[],Wa=[];function zT(t,e){var n=gh(t,Object.assign({},rt,mh(ah(e)))),r,i,o,s=!1,a=!1,c=!1,d=!1,u,f,h,p=[],m=oh(Tr,n.interactiveDebounce),y,g=LT++,k=null,C=bT(n.plugins),N={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},b={id:g,reference:t,popper:xi(),popperInstance:k,props:n,state:N,plugins:C,clearDelayTimeouts:$r,setProps:Nr,setContent:Br,show:E,hide:O,hideWithInteractivity:_,enable:jn,disable:bn,unmount:K,destroy:te};if(!n.render)return process.env.NODE_ENV!=="production"&&Fa(!0,"render() function has not been supplied."),b;var S=n.render(b),x=S.popper,$=S.onUpdate;x.setAttribute("data-tippy-root",""),x.id="tippy-"+b.id,b.popper=x,t._tippy=b,x._tippy=b;var D=C.map(function(w){return w.fn(b)}),A=t.hasAttribute("aria-expanded");return be(),U(),v(),M("onCreate",[b]),n.showOnCreate&&Yt(),x.addEventListener("mouseenter",function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()}),x.addEventListener("mouseleave",function(){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&L().addEventListener("mousemove",m)}),b;function B(){var w=b.props.touch;return Array.isArray(w)?w:[w,0]}function P(){return B()[0]==="hold"}function F(){var w;return!!((w=b.props.render)!=null&&w.$$tippy)}function G(){return y||t}function L(){var w=G().parentNode;return w?CT(w):document}function I(){return Ha(x)}function T(w){return b.state.isMounted&&!b.state.isVisible||Dt.isTouch||u&&u.type==="focus"?0:_a(b.props.delay,w?0:1,rt.delay)}function v(w){w===void 0&&(w=!1),x.style.pointerEvents=b.props.interactive&&!w?"":"none",x.style.zIndex=""+b.props.zIndex}function M(w,z,Y){if(Y===void 0&&(Y=!0),D.forEach(function(ne){ne[w]&&ne[w].apply(ne,z)}),Y){var ee;(ee=b.props)[w].apply(ee,z)}}function V(){var w=b.props.aria;if(w.content){var z="aria-"+w.content,Y=x.id,ee=Or(b.props.triggerTarget||t);ee.forEach(function(ne){var ae=ne.getAttribute(z);if(b.state.isVisible)ne.setAttribute(z,ae?ae+" "+Y:Y);else{var pe=ae&&ae.replace(Y,"").trim();pe?ne.setAttribute(z,pe):ne.removeAttribute(z)}})}}function U(){if(!(A||!b.props.aria.expanded)){var w=Or(b.props.triggerTarget||t);w.forEach(function(z){b.props.interactive?z.setAttribute("aria-expanded",b.state.isVisible&&z===G()?"true":"false"):z.removeAttribute("aria-expanded")})}}function j(){L().removeEventListener("mousemove",m),Do=Do.filter(function(w){return w!==m})}function Q(w){if(!(Dt.isTouch&&(c||w.type==="mousedown"))){var z=w.composedPath&&w.composedPath()[0]||w.target;if(!(b.props.interactive&&ch(x,z))){if(Or(b.props.triggerTarget||t).some(function(Y){return ch(Y,z)})){if(Dt.isTouch||b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else M("onClickOutside",[b,w]);b.props.hideOnClick===!0&&(b.clearDelayTimeouts(),b.hide(),a=!0,setTimeout(function(){a=!1}),b.state.isMounted||W())}}}function de(){c=!0}function se(){c=!1}function ye(){var w=L();w.addEventListener("mousedown",Q,!0),w.addEventListener("touchend",Q,zn),w.addEventListener("touchstart",se,zn),w.addEventListener("touchmove",de,zn)}function W(){var w=L();w.removeEventListener("mousedown",Q,!0),w.removeEventListener("touchend",Q,zn),w.removeEventListener("touchstart",se,zn),w.removeEventListener("touchmove",de,zn)}function X(w,z){oe(w,function(){!b.state.isVisible&&x.parentNode&&x.parentNode.contains(x)&&z()})}function fe(w,z){oe(w,z)}function oe(w,z){var Y=I().box;function ee(ne){ne.target===Y&&(za(Y,"remove",ee),z())}if(w===0)return z();za(Y,"remove",f),za(Y,"add",ee),f=ee}function he(w,z,Y){Y===void 0&&(Y=!1);var ee=Or(b.props.triggerTarget||t);ee.forEach(function(ne){ne.addEventListener(w,z,Y),p.push({node:ne,eventType:w,handler:z,options:Y})})}function be(){P()&&(he("touchstart",ut,{passive:!0}),he("touchend",gn,{passive:!0})),yT(b.props.trigger).forEach(function(w){if(w!=="manual")switch(he(w,ut),w){case"mouseenter":he("mouseleave",gn);break;case"focus":he(NT?"focusout":"blur",yn);break;case"focusin":he("focusout",yn);break}})}function Oe(){p.forEach(function(w){var z=w.node,Y=w.eventType,ee=w.handler,ne=w.options;z.removeEventListener(Y,ee,ne)}),p=[]}function ut(w){var z,Y=!1;if(!(!b.state.isEnabled||Kt(w)||a)){var ee=((z=u)==null?void 0:z.type)==="focus";u=w,y=w.currentTarget,U(),!b.state.isVisible&&vT(w)&&Do.forEach(function(ne){return ne(w)}),w.type==="click"&&(b.props.trigger.indexOf("mouseenter")<0||s)&&b.props.hideOnClick!==!1&&b.state.isVisible?Y=!0:Yt(w),w.type==="click"&&(s=!Y),Y&&!ee&&Pt(w)}}function Tr(w){var z=w.target,Y=G().contains(z)||x.contains(z);if(!(w.type==="mousemove"&&Y)){var ee=It().concat(x).map(function(ne){var ae,pe=ne._tippy,ve=(ae=pe.popperInstance)==null?void 0:ae.state;return ve?{popperRect:ne.getBoundingClientRect(),popperState:ve,props:n}:null}).filter(Boolean);OT(ee,w)&&(j(),Pt(w))}}function gn(w){var z=Kt(w)||b.props.trigger.indexOf("click")>=0&&s;if(!z){if(b.props.interactive){b.hideWithInteractivity(w);return}Pt(w)}}function yn(w){b.props.trigger.indexOf("focusin")<0&&w.target!==G()||b.props.interactive&&w.relatedTarget&&x.contains(w.relatedTarget)||Pt(w)}function Kt(w){return Dt.isTouch?P()!==w.type.indexOf("touch")>=0:!1}function vt(){ft();var w=b.props,z=w.popperOptions,Y=w.placement,ee=w.offset,ne=w.getReferenceClientRect,ae=w.moveTransition,pe=F()?Ha(x).arrow:null,ve=ne?{getBoundingClientRect:ne,contextElement:ne.contextElement||G()}:t,qe={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(kn){var _t=kn.state;if(F()){var Si=I(),tl=Si.box;["placement","reference-hidden","escaped"].forEach(function(_o){_o==="placement"?tl.setAttribute("data-placement",_t.placement):_t.attributes.popper["data-popper-"+_o]?tl.setAttribute("data-"+_o,""):tl.removeAttribute("data-"+_o)}),_t.attributes.popper={}}}},it=[{name:"offset",options:{offset:ee}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!ae}},qe];F()&&pe&&it.push({name:"arrow",options:{element:pe,padding:3}}),it.push.apply(it,(z==null?void 0:z.modifiers)||[]),b.popperInstance=fT(ve,x,Object.assign({},z,{placement:Y,onFirstUpdate:h,modifiers:it}))}function ft(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function ht(){var w=b.props.appendTo,z,Y=G();b.props.interactive&&w===rh||w==="parent"?z=Y.parentNode:z=ih(w,[Y]),z.contains(x)||z.appendChild(x),b.state.isMounted=!0,vt(),process.env.NODE_ENV!=="production"&&Ut(b.props.interactive&&w===rt.appendTo&&Y.nextElementSibling!==x,["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 It(){return Ao(v.querySelectorAll("[data-tippy-root]"))}function Yt(w){b.clearDelayTimeouts(),w&&M("onTrigger",[b,w]),ye();var z=T(!0),Y=B(),Q=Y[0],te=Y[1];Dt.isTouch&&Q==="hold"&&te&&(z=te),z?r=setTimeout(function(){b.show()},z):b.show()}function Pt(w){if(b.clearDelayTimeouts(),M("onUntrigger",[b,w]),!b.state.isVisible){H();return}if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(w.type)>=0&&s)){var z=T(!1);z?i=setTimeout(function(){b.state.isVisible&&b.hide()},z):o=requestAnimationFrame(function(){b.hide()})}}function jn(){b.state.isEnabled=!0}function bn(){b.hide(),b.state.isEnabled=!1}function Tr(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(o)}function $r(w){if(process.env.NODE_ENV!=="production"&&Ut(b.state.isDestroyed,Or("setProps")),!b.state.isDestroyed){M("onBeforeUpdate",[b,w]),Oe();var z=b.props,Y=ph(t,Object.assign({},z,oh(w),{ignoreAttributes:!0}));b.props=Y,be(),z.interactiveDebounce!==Y.interactiveDebounce&&(W(),m=rh(Mr,Y.interactiveDebounce)),z.triggerTarget&&!Y.triggerTarget?Cr(z.triggerTarget).forEach(function(Q){Q.removeAttribute("aria-expanded")}):Y.triggerTarget&&t.removeAttribute("aria-expanded"),U(),x(),$&&$(z,Y),b.popperInstance&&(xt(),It().forEach(function(Q){requestAnimationFrame(Q._tippy.popperInstance.forceUpdate)})),M("onAfterUpdate",[b,w])}}function Nr(w){b.setProps({content:w})}function E(){process.env.NODE_ENV!=="production"&&Ut(b.state.isDestroyed,Or("show"));var w=b.state.isVisible,z=b.state.isDestroyed,Y=!b.state.isEnabled,Q=Dt.isTouch&&!b.props.touch,te=_a(b.props.duration,0,rt.duration);if(!(w||z||Y||Q)&&!G().hasAttribute("disabled")&&(M("onShow",[b],!1),b.props.onShow(b)!==!1)){if(b.state.isVisible=!0,F()&&(v.style.visibility="visible"),x(),ye(),b.state.isMounted||(v.style.transition="none"),F()){var ae=I(),pe=ae.box,xe=ae.content;La([pe,xe],0)}h=function(){var it;if(!(!b.state.isVisible||d)){if(d=!0,v.offsetHeight,v.style.transition=b.props.moveTransition,F()&&b.props.animation){var Hn=I(),kn=Hn.box,_t=Hn.content;La([kn,_t],te),sh([kn,_t],"visible")}V(),U(),ih(Wa,b),(it=b.popperInstance)==null||it.forceUpdate(),M("onMount",[b]),b.props.animation&&F()&&fe(te,function(){b.state.isShown=!0,M("onShown",[b])})}},ht()}}function O(){process.env.NODE_ENV!=="production"&&Ut(b.state.isDestroyed,Or("hide"));var w=!b.state.isVisible,z=b.state.isDestroyed,Y=!b.state.isEnabled,Q=_a(b.props.duration,1,rt.duration);if(!(w||z||Y)&&(M("onHide",[b],!1),b.props.onHide(b)!==!1)){if(b.state.isVisible=!1,b.state.isShown=!1,d=!1,s=!1,F()&&(v.style.visibility="hidden"),W(),H(),x(!0),F()){var te=I(),ae=te.box,pe=te.content;b.props.animation&&(La([ae,pe],Q),sh([ae,pe],"hidden"))}V(),U(),b.props.animation?F()&&X(Q,b.unmount):b.unmount()}}function _(w){process.env.NODE_ENV!=="production"&&Ut(b.state.isDestroyed,Or("hideWithInteractivity")),L().addEventListener("mousemove",m),ih(Do,m),m(w)}function K(){process.env.NODE_ENV!=="production"&&Ut(b.state.isDestroyed,Or("unmount")),b.state.isVisible&&b.hide(),b.state.isMounted&&(ft(),It().forEach(function(w){w._tippy.unmount()}),v.parentNode&&v.parentNode.removeChild(v),Wa=Wa.filter(function(w){return w!==b}),b.state.isMounted=!1,M("onHidden",[b]))}function ee(){process.env.NODE_ENV!=="production"&&Ut(b.state.isDestroyed,Or("destroy")),!b.state.isDestroyed&&(b.clearDelayTimeouts(),b.unmount(),Oe(),delete t._tippy,b.state.isDestroyed=!0,M("onDestroy",[b]))}}function Er(t,e){e===void 0&&(e={});var n=rt.plugins.concat(e.plugins||[]);process.env.NODE_ENV!=="production"&&(BT(t),mh(e,n)),ET();var r=Object.assign({},e,{plugins:n}),i=xT(t);if(process.env.NODE_ENV!=="production"){var o=xi(r.content),s=i.length>1;Ut(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 It(){return Ao(x.querySelectorAll("[data-tippy-root]"))}function Yt(w){b.clearDelayTimeouts(),w&&M("onTrigger",[b,w]),ye();var z=T(!0),Y=B(),ee=Y[0],ne=Y[1];Dt.isTouch&&ee==="hold"&&ne&&(z=ne),z?r=setTimeout(function(){b.show()},z):b.show()}function Pt(w){if(b.clearDelayTimeouts(),M("onUntrigger",[b,w]),!b.state.isVisible){W();return}if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(w.type)>=0&&s)){var z=T(!1);z?i=setTimeout(function(){b.state.isVisible&&b.hide()},z):o=requestAnimationFrame(function(){b.hide()})}}function jn(){b.state.isEnabled=!0}function bn(){b.hide(),b.state.isEnabled=!1}function $r(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(o)}function Nr(w){if(process.env.NODE_ENV!=="production"&&Ut(b.state.isDestroyed,Er("setProps")),!b.state.isDestroyed){M("onBeforeUpdate",[b,w]),Oe();var z=b.props,Y=gh(t,Object.assign({},z,ah(w),{ignoreAttributes:!0}));b.props=Y,be(),z.interactiveDebounce!==Y.interactiveDebounce&&(j(),m=oh(Tr,Y.interactiveDebounce)),z.triggerTarget&&!Y.triggerTarget?Or(z.triggerTarget).forEach(function(ee){ee.removeAttribute("aria-expanded")}):Y.triggerTarget&&t.removeAttribute("aria-expanded"),U(),v(),$&&$(z,Y),b.popperInstance&&(vt(),It().forEach(function(ee){requestAnimationFrame(ee._tippy.popperInstance.forceUpdate)})),M("onAfterUpdate",[b,w])}}function Br(w){b.setProps({content:w})}function E(){process.env.NODE_ENV!=="production"&&Ut(b.state.isDestroyed,Er("show"));var w=b.state.isVisible,z=b.state.isDestroyed,Y=!b.state.isEnabled,ee=Dt.isTouch&&!b.props.touch,ne=_a(b.props.duration,0,rt.duration);if(!(w||z||Y||ee)&&!G().hasAttribute("disabled")&&(M("onShow",[b],!1),b.props.onShow(b)!==!1)){if(b.state.isVisible=!0,F()&&(x.style.visibility="visible"),v(),ye(),b.state.isMounted||(x.style.transition="none"),F()){var ae=I(),pe=ae.box,ve=ae.content;La([pe,ve],0)}h=function(){var it;if(!(!b.state.isVisible||d)){if(d=!0,x.offsetHeight,x.style.transition=b.props.moveTransition,F()&&b.props.animation){var Hn=I(),kn=Hn.box,_t=Hn.content;La([kn,_t],ne),lh([kn,_t],"visible")}V(),U(),sh(Wa,b),(it=b.popperInstance)==null||it.forceUpdate(),M("onMount",[b]),b.props.animation&&F()&&fe(ne,function(){b.state.isShown=!0,M("onShown",[b])})}},ht()}}function O(){process.env.NODE_ENV!=="production"&&Ut(b.state.isDestroyed,Er("hide"));var w=!b.state.isVisible,z=b.state.isDestroyed,Y=!b.state.isEnabled,ee=_a(b.props.duration,1,rt.duration);if(!(w||z||Y)&&(M("onHide",[b],!1),b.props.onHide(b)!==!1)){if(b.state.isVisible=!1,b.state.isShown=!1,d=!1,s=!1,F()&&(x.style.visibility="hidden"),j(),W(),v(!0),F()){var ne=I(),ae=ne.box,pe=ne.content;b.props.animation&&(La([ae,pe],ee),lh([ae,pe],"hidden"))}V(),U(),b.props.animation?F()&&X(ee,b.unmount):b.unmount()}}function _(w){process.env.NODE_ENV!=="production"&&Ut(b.state.isDestroyed,Er("hideWithInteractivity")),L().addEventListener("mousemove",m),sh(Do,m),m(w)}function K(){process.env.NODE_ENV!=="production"&&Ut(b.state.isDestroyed,Er("unmount")),b.state.isVisible&&b.hide(),b.state.isMounted&&(ft(),It().forEach(function(w){w._tippy.unmount()}),x.parentNode&&x.parentNode.removeChild(x),Wa=Wa.filter(function(w){return w!==b}),b.state.isMounted=!1,M("onHidden",[b]))}function te(){process.env.NODE_ENV!=="production"&&Ut(b.state.isDestroyed,Er("destroy")),!b.state.isDestroyed&&(b.clearDelayTimeouts(),b.unmount(),Oe(),delete t._tippy,b.state.isDestroyed=!0,M("onDestroy",[b]))}}function Mr(t,e){e===void 0&&(e={});var n=rt.plugins.concat(e.plugins||[]);process.env.NODE_ENV!=="production"&&(DT(t),yh(e,n)),TT();var r=Object.assign({},e,{plugins:n}),i=ST(t);if(process.env.NODE_ENV!=="production"){var o=vi(r.content),s=i.length>1;Ut(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.",`
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 a=i.reduce(function(c,d){var u=d&&RT(d,r);return u&&c.push(u),c},[]);return xi(t)?a[0]:a}Er.defaultProps=rt,Er.setDefaultProps=VT,Er.currentInput=Dt,Object.assign({},Pf,{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)}}),Er.setDefaultProps({render:bh});class LT{constructor({editor:e,element:n,view:r,tippyOptions:i={},updateDelay:o=250,shouldShow:s}){this.preventHide=!1,this.shouldShow=({view:a,state:c,from:d,to:u})=>{const{doc:f,selection:h}=c,{empty:p}=h,m=!f.textBetween(d,u).length&&xa(c.selection),g=this.element.contains(document.activeElement);return!(!(a.hasFocus()||g)||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 c;if(this.preventHide){this.preventHide=!1;return}a!=null&&a.relatedTarget&&(!((c=this.element.parentNode)===null||c===void 0)&&c.contains(a.relatedTarget))||this.hide()},this.tippyBlurHandler=a=>{this.blurHandler({event:a})},this.handleDebouncedUpdate=(a,c)=>{const d=!(c!=null&&c.selection.eq(a.state.selection)),u=!(c!=null&&c.doc.eq(a.state.doc));!d&&!u||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(a,d,u,c)},this.updateDelay))},this.updateHandler=(a,c,d,u)=>{var f,h,p;const{state:m,composing:g}=a,{selection:y}=m;if(g||!c&&!d)return;this.createTooltip();const{ranges:C}=y,N=Math.min(...C.map(v=>v.$from.pos)),b=Math.max(...C.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:N,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(zM(m.selection)){let v=a.nodeDOM(N);const $=v.dataset.nodeViewWrapper?v:v.querySelector("[data-node-view-wrapper]");if($&&(v=$.firstChild),v)return v.getBoundingClientRect()}return Bf(a,N,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=Er(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 kh=t=>new ze({key:typeof t.pluginKey=="string"?new yt(t.pluginKey):t.pluginKey,view:e=>new LT({view:e,...t})});Re.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[kh({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});class zT{constructor({editor:e,element:n,view:r,tippyOptions:i={},shouldShow:o}){this.preventHide=!1,this.shouldShow=({view:s,state:a})=>{const{selection:c}=a,{$anchor:d,empty:u}=c,f=d.depth===1,h=d.parent.isTextblock&&!d.parent.type.spec.code&&!d.parent.textContent;return!(!s.hasFocus()||!u||!f||!h||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:s})=>{var a;if(this.preventHide){this.preventHide=!1;return}s!=null&&s.relatedTarget&&(!((a=this.element.parentNode)===null||a===void 0)&&a.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=Er(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:a,selection:c}=s,{from:d,to:u}=c;if(n&&n.doc.eq(a)&&n.selection.eq(c))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)||(()=>Bf(e,d,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 vh=t=>new ze({key:typeof t.pluginKey=="string"?new yt(t.pluginKey):t.pluginKey,view:e=>new zT({view:e,...t})});Re.create({name:"floatingMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[vh({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}}),l.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=l.ref(null);return l.onMounted(()=>{const{updateDelay:r,editor:i,pluginKey:o,shouldShow:s,tippyOptions:a}=t;i.registerPlugin(kh({updateDelay:r,editor:i,element:n.value,pluginKey:o,shouldShow:s,tippyOptions:a}))}),l.onBeforeUnmount(()=>{const{pluginKey:r,editor:i}=t;i.unregisterPlugin(r)}),()=>{var r;return l.h("div",{ref:n},(r=e.default)===null||r===void 0?void 0:r.call(e))}}});function xh(t){return l.customRef((e,n)=>({get(){return e(),t},set(r){t=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}class FT extends i2{constructor(e={}){return super(e),this.vueRenderers=l.reactive(new Map),this.contentComponent=null,this.reactiveState=xh(this.view.state),this.reactiveExtensionStorage=xh(this.extensionStorage),this.on("transaction",()=>{this.reactiveState.value=this.view.state,this.reactiveExtensionStorage.value=this.extensionStorage}),l.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 jT=l.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(t){const e=l.ref(),n=l.getCurrentInstance();return l.watchEffect(()=>{const r=t.editor;r&&r.options.element&&e.value&&l.nextTick(()=>{if(!e.value||!r.options.element.firstChild)return;const i=l.unref(e.value);e.value.append(...r.options.element.childNodes),r.contentComponent=n.ctx._,r.setOptions({element:i}),r.createNodeViews()})}),l.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=l.h(l.Teleport,{to:e.teleportElement,key:e.id},l.h(e.component,{ref:e.id,...e.props}));t.push(n)}),l.h("div",{ref:e=>{this.rootEl=e}},...t)}});l.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=l.ref(null);return l.onMounted(()=>{const{pluginKey:r,editor:i,tippyOptions:o,shouldShow:s}=t;i.registerPlugin(vh({pluginKey:r,editor:i,element:n.value,tippyOptions:o,shouldShow:s}))}),l.onBeforeUnmount(()=>{const{pluginKey:r,editor:i}=t;i.unregisterPlugin(r)}),()=>{var r;return l.h("div",{ref:n},(r=e.default)===null||r===void 0?void 0:r.call(e))}}}),l.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return l.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),l.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var t,e;return l.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 HT=(t={})=>{const e=l.shallowRef();return l.onMounted(()=>{e.value=new FT(t)}),l.onBeforeUnmount(()=>{var n;(n=e.value)===null||n===void 0||n.destroy()}),e},WT=/^\s*>\s$/,qT=tt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",Ee(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[fi({find:WT,type:this.type})]}}),UT=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,KT=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,YT=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,JT=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,GT=Nt.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",Ee(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[br({find:UT,type:this.type}),br({find:YT,type:this.type})]},addPasteRules(){return[kr({find:KT,type:this.type}),kr({find:JT,type:this.type})]}}),ZT=tt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ee(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)}}}),wh=Nt.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",Ee(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const n=Eo(t,this.type);return Object.entries(n).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),Sh=/^\s*([-+*])\s$/,XT=tt.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",Ee(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(ZT.name,this.editor.getAttributes(wh.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=fi({find:Sh,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=fi({find:Sh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(wh.name),editor:this.editor})),[t]}}),QT=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/,e$=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g,t$=Nt.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Ee(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[br({find:QT,type:this.type})]},addPasteRules(){return[kr({find:e$,type:this.type})]}}),n$=/^```([a-z]+)?[\s\n]$/,r$=/^~~~([a-z]+)?[\s\n]$/,i$=tt.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",Ee(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(c,d){var u=d&&zT(d,r);return u&&c.push(u),c},[]);return vi(t)?a[0]:a}Mr.defaultProps=rt,Mr.setDefaultProps=PT,Mr.currentInput=Dt,Object.assign({},Rf,{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)}}),Mr.setDefaultProps({render:xh});class FT{constructor({editor:e,element:n,view:r,tippyOptions:i={},updateDelay:o=250,shouldShow:s}){this.preventHide=!1,this.shouldShow=({view:a,state:c,from:d,to:u})=>{const{doc:f,selection:h}=c,{empty:p}=h,m=!f.textBetween(d,u).length&&va(c.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 c;if(this.preventHide){this.preventHide=!1;return}a!=null&&a.relatedTarget&&(!((c=this.element.parentNode)===null||c===void 0)&&c.contains(a.relatedTarget))||this.hide()},this.tippyBlurHandler=a=>{this.blurHandler({event:a})},this.handleDebouncedUpdate=(a,c)=>{const d=!(c!=null&&c.selection.eq(a.state.selection)),u=!(c!=null&&c.doc.eq(a.state.doc));!d&&!u||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(a,d,u,c)},this.updateDelay))},this.updateHandler=(a,c,d,u)=>{var f,h,p;const{state:m,composing:y}=a,{selection:g}=m;if(y||!c&&!d)return;this.createTooltip();const{ranges:C}=g,N=Math.min(...C.map(x=>x.$from.pos)),b=Math.max(...C.map(x=>x.$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:N,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(j2(m.selection)){let x=a.nodeDOM(N);const $=x.dataset.nodeViewWrapper?x:x.querySelector("[data-node-view-wrapper]");if($&&(x=$.firstChild),x)return x.getBoundingClientRect()}return Df(a,N,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=Mr(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 vh=t=>new ze({key:typeof t.pluginKey=="string"?new yt(t.pluginKey):t.pluginKey,view:e=>new FT({view:e,...t})});Re.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[vh({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});class jT{constructor({editor:e,element:n,view:r,tippyOptions:i={},shouldShow:o}){this.preventHide=!1,this.shouldShow=({view:s,state:a})=>{const{selection:c}=a,{$anchor:d,empty:u}=c,f=d.depth===1,h=d.parent.isTextblock&&!d.parent.type.spec.code&&!d.parent.textContent;return!(!s.hasFocus()||!u||!f||!h||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:s})=>{var a;if(this.preventHide){this.preventHide=!1;return}s!=null&&s.relatedTarget&&(!((a=this.element.parentNode)===null||a===void 0)&&a.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=Mr(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:a,selection:c}=s,{from:d,to:u}=c;if(n&&n.doc.eq(a)&&n.selection.eq(c))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)||(()=>Df(e,d,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 ze({key:typeof t.pluginKey=="string"?new yt(t.pluginKey):t.pluginKey,view:e=>new jT({view:e,...t})});Re.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})]:[]}}),l.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=l.ref(null);return l.onMounted(()=>{const{updateDelay:r,editor:i,pluginKey:o,shouldShow:s,tippyOptions:a}=t;i.registerPlugin(vh({updateDelay:r,editor:i,element:n.value,pluginKey:o,shouldShow:s,tippyOptions:a}))}),l.onBeforeUnmount(()=>{const{pluginKey:r,editor:i}=t;i.unregisterPlugin(r)}),()=>{var r;return l.h("div",{ref:n},(r=e.default)===null||r===void 0?void 0:r.call(e))}}});function Sh(t){return l.customRef((e,n)=>({get(){return e(),t},set(r){t=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}class HT extends sM{constructor(e={}){return super(e),this.vueRenderers=l.reactive(new Map),this.contentComponent=null,this.reactiveState=Sh(this.view.state),this.reactiveExtensionStorage=Sh(this.extensionStorage),this.on("transaction",()=>{this.reactiveState.value=this.view.state,this.reactiveExtensionStorage.value=this.extensionStorage}),l.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 WT=l.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(t){const e=l.ref(),n=l.getCurrentInstance();return l.watchEffect(()=>{const r=t.editor;r&&r.options.element&&e.value&&l.nextTick(()=>{if(!e.value||!r.options.element.firstChild)return;const i=l.unref(e.value);e.value.append(...r.options.element.childNodes),r.contentComponent=n.ctx._,r.setOptions({element:i}),r.createNodeViews()})}),l.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=l.h(l.Teleport,{to:e.teleportElement,key:e.id},l.h(e.component,{ref:e.id,...e.props}));t.push(n)}),l.h("div",{ref:e=>{this.rootEl=e}},...t)}});l.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=l.ref(null);return l.onMounted(()=>{const{pluginKey:r,editor:i,tippyOptions:o,shouldShow:s}=t;i.registerPlugin(wh({pluginKey:r,editor:i,element:n.value,tippyOptions:o,shouldShow:s}))}),l.onBeforeUnmount(()=>{const{pluginKey:r,editor:i}=t;i.unregisterPlugin(r)}),()=>{var r;return l.h("div",{ref:n},(r=e.default)===null||r===void 0?void 0:r.call(e))}}}),l.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return l.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),l.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var t,e;return l.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 qT=(t={})=>{const e=l.shallowRef();return l.onMounted(()=>{e.value=new HT(t)}),l.onBeforeUnmount(()=>{var n;(n=e.value)===null||n===void 0||n.destroy()}),e},UT=/^\s*>\s$/,KT=tt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",Ee(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[fi({find:UT,type:this.type})]}}),YT=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,JT=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,GT=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,ZT=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,XT=Nt.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",Ee(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[kr({find:YT,type:this.type}),kr({find:GT,type:this.type})]},addPasteRules(){return[xr({find:JT,type:this.type}),xr({find:ZT,type:this.type})]}}),QT=tt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ee(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)}}}),Ch=Nt.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",Ee(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const n=Eo(t,this.type);return Object.entries(n).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),Oh=/^\s*([-+*])\s$/,e$=tt.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",Ee(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(QT.name,this.editor.getAttributes(Ch.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=fi({find:Oh,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=fi({find:Oh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Ch.name),editor:this.editor})),[t]}}),t$=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/,n$=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g,r$=Nt.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Ee(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[kr({find:t$,type:this.type})]},addPasteRules(){return[xr({find:n$,type:this.type})]}}),i$=/^```([a-z]+)?[\s\n]$/,o$=/^~~~([a-z]+)?[\s\n]$/,s$=tt.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",Ee(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(`
114
114
 
115
- `);return!o||!s?!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:o}=n;if(!o||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[Ma({find:n$,type:this.type,getAttributes:t=>({language:t[1]})}),Ma({find:r$,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new ze({key:new yt("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(ie.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}}})]}}),o$=tt.create({name:"doc",topNode:!0,content:"block+"});function s$(t={}){return new ze({view(e){return new a$(e,t)}})}class a${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 a=e.nodeBefore,c=e.nodeAfter;if(a||c){let d=this.editorView.nodeDOM(this.cursorPos-(a?a.nodeSize:0));if(d){let u=d.getBoundingClientRect(),f=a?u.bottom:u.top;a&&c&&(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 o,s;if(!i||i==document.body&&getComputedStyle(i).position=="static")o=-pageXOffset,s=-pageYOffset;else{let a=i.getBoundingClientRect();o=a.left-i.scrollLeft,s=a.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 a=$d(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const l$=Re.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[s$(this.options)]}});class ve extends le{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return ve.valid(r)?new ve(r):le.near(r)}content(){return q.empty}eq(e){return e instanceof ve&&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 ve(e.resolve(n.pos))}getBookmark(){return new qa(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!c$(e)||!d$(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&&ve.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let a=e.node(s);if(n>0?e.indexAfter(s)<a.childCount:e.index(s)>0){o=a.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=n;let c=e.doc.resolve(i);if(ve.valid(c))return c}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 a=e.doc.resolve(i);if(ve.valid(a))return a}return null}}}ve.prototype.visible=!1,ve.findFrom=ve.findGapCursorFrom,le.jsonID("gapcursor",ve);class qa{constructor(e){this.pos=e}map(e){return new qa(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ve.valid(n)?new ve(n):le.near(n)}}function c$(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 d$(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 u$(){return new ze({props:{decorations:m$,createSelectionBetween(t,e,n){return e.pos==n.pos&&ve.valid(n)?new ve(n):null},handleClick:h$,handleKeyDown:f$,handleDOMEvents:{beforeinput:p$}}})}const f$=tf({ArrowLeft:Vo("horiz",-1),ArrowRight:Vo("horiz",1),ArrowUp:Vo("vert",-1),ArrowDown:Vo("vert",1)});function Vo(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,a=e>0?s.$to:s.$from,c=s.empty;if(s instanceof ie){if(!o.endOfTextblock(n)||a.depth==0)return!1;c=!1,a=r.doc.resolve(e>0?a.after():a.before())}let d=ve.findGapCursorFrom(a,e,c);return d?(i&&i(r.tr.setSelection(new ve(d))),!0):!1}}function h$(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!ve.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 ve(r))),!0)}function p$(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ve))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=R.empty;for(let s=r.length-1;s>=0;s--)i=R.from(r[s].createAndFill(null,i));let o=t.state.tr.replace(n.pos,n.pos,new q(i,0,0));return o.setSelection(ie.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function m$(t){if(!(t.selection instanceof ve))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Ce.create(t.doc,[et.widget(t.selection.head,e,{key:"gapcursor"})])}const g$=Re.create({name:"gapCursor",addProseMirrorPlugins(){return[u$()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=ce(J(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),y$=tt.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Ee(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:a}=r.extensionManager,c=o||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:u})=>{if(u&&c&&s){const f=c.filter(h=>a.includes(h.type.name));d.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),b$=tt.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]}`,Ee(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=>Ma({find:new RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Io=200,Be=function(){};Be.prototype.append=function(e){return e.length?(e=Be.from(e),!this.length&&e||e.length<Io&&this.leafAppend(e)||this.length<Io&&e.leafPrepend(this)||this.appendInner(e)):this},Be.prototype.prepend=function(e){return e.length?Be.from(e).append(this):this},Be.prototype.appendInner=function(e){return new k$(this,e)},Be.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Be.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))},Be.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Be.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)},Be.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},Be.from=function(e){return e instanceof Be?e:e&&e.length?new Ch(e):Be.empty};var Ch=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,a){for(var c=o;c<s;c++)if(i(this.values[c],a+c)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,a){for(var c=o-1;c>=s;c--)if(i(this.values[c],a+c)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Io)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Io)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}(Be);Be.empty=new Ch([]);var k$=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 a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(o,a),s)===!1||o>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,o)-a,s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(o,a)-a,s+a)===!1||o<a&&this.left.forEachInvertedInner(r,Math.min(i,a),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}(Be);const v$=500;class vt{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,a,c,d=[],u=[];return this.items.forEach((f,h)=>{if(!f.step){i||(i=this.remapping(r,h+1),o=i.maps.length),o--,u.push(f);return}if(i){u.push(new Vt(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],d.push(new Vt(m,void 0,void 0,d.length+u.length))),o--,m&&i.appendMap(m,o)}else s.maybeStep(f.step);if(f.selection)return a=i?f.selection.map(i.slice(o)):f.selection,c=new vt(this.items.slice(0,r).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:s,selection:a}}addTransform(e,n,r,i){let o=[],s=this.eventCount,a=this.items,c=!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 Vt(e.mapping.maps[u],f,n),p;(p=c&&c.merge(h))&&(h=p,u?o.pop():a=a.slice(0,a.length-1)),o.push(h),n&&(s++,n=void 0),i||(c=h)}let d=s-r.depth;return d>w$&&(a=x$(a,d),s-=d),new vt(a.append(o),s)}remapping(e,n){let r=new ir;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 vt(this.items.append(e.map(n=>new Vt(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,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let c=n;this.items.forEach(h=>{let p=o.getMirror(--c);if(p==null)return;s=Math.min(s,p);let m=o.maps[p];if(h.step){let g=e.steps[p].invert(e.docs[p]),y=h.selection&&h.selection.map(o.slice(c+1,p));y&&a++,r.push(new Vt(m,g,y))}else r.push(new Vt(m))},i);let d=[];for(let h=n;h<s;h++)d.push(new Vt(o.maps[h]));let u=this.items.slice(0,i).append(d).append(r),f=new vt(u,a);return f.emptyItemCount()>v$&&(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,a)=>{if(a>=e)i.push(s),s.selection&&o++;else if(s.step){let c=s.step.map(n.slice(r)),d=c&&c.getMap();if(r--,d&&n.appendMap(d,r),c){let u=s.selection&&s.selection.map(n.slice(r));u&&o++;let f=new Vt(d.invert(),c,u),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 vt(Be.from(i.reverse()),o)}}vt.empty=new vt(Be.empty,0);function x$(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class Vt{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 Vt(n.getMap().invert(),n,this.selection)}}}class mn{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const w$=20;function S$(t,e,n,r){let i=n.getMeta(Fn),o;if(i)return i.historyState;n.getMeta(E$)&&(t=new mn(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(Fn))return s.getMeta(Fn).redo?new mn(t.done.addTransform(n,void 0,r,Po(e)),t.undone,Oh(n.mapping.maps[n.steps.length-1]),t.prevTime,t.prevComposition):new mn(t.done,t.undone.addTransform(n,void 0,r,Po(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),c=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!C$(n,t.prevRanges)),d=s?Ua(t.prevRanges,n.mapping):Oh(n.mapping.maps[n.steps.length-1]);return new mn(t.done.addTransform(n,c?e.selection.getBookmark():void 0,r,Po(e)),vt.empty,d,n.time,a??t.prevComposition)}else return(o=n.getMeta("rebased"))?new mn(t.done.rebased(n,o),t.undone.rebased(n,o),Ua(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new mn(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Ua(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function C$(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 Oh(t){let e=[];return t.forEach((n,r,i,o)=>e.push(i,o)),e}function Ua(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 O$(t,e,n){let r=Po(e),i=Fn.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),a=(n?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),c=new mn(n?a:o.remaining,n?o.remaining:a,null,0,-1);return o.transform.setSelection(s).setMeta(Fn,{redo:n,historyState:c})}let Ka=!1,Eh=null;function Po(t){let e=t.plugins;if(Eh!=e){Ka=!1,Eh=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Ka=!0;break}}return Ka}const Fn=new yt("history"),E$=new yt("closeHistory");function M$(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new ze({key:Fn,state:{init(){return new mn(vt.empty,vt.empty,null,0,-1)},apply(e,n,r){return S$(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?Th:r=="historyRedo"?$h:null;return i?(n.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function Mh(t,e){return(n,r)=>{let i=Fn.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let o=O$(i,n,t);o&&r(e?o.scrollIntoView():o)}return!0}}const Th=Mh(!1,!0),$h=Mh(!0,!0),T$=Re.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Th(t,e),redo:()=>({state:t,dispatch:e})=>$h(t,e)}},addProseMirrorPlugins(){return[M$(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()}}}),$$=tt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Ee(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:a}=i.selection,c=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?i.setSelection(ie.create(i.doc,a.pos+1)):a.nodeAfter.isBlock?i.setSelection(Z.create(i.doc,a.pos)):i.setSelection(ie.create(i.doc,a.pos));else{const d=(s=a.parent.type.contentMatch.defaultType)===null||s===void 0?void 0:s.create();d&&(i.insert(c,d),i.setSelection(ie.create(i.doc,c+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[o2({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),N$=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,B$=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,A$=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,D$=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,V$=Nt.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",Ee(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[br({find:N$,type:this.type}),br({find:A$,type:this.type})]},addPasteRules(){return[kr({find:B$,type:this.type}),kr({find:D$,type:this.type})]}}),I$=tt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ee(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)}}}),P$=tt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ee(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)}}}),Nh=Nt.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",Ee(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const n=Eo(t,this.type);return Object.entries(n).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),Bh=/^(\d+)\.\s$/,_$=tt.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",Ee(this.options.HTMLAttributes,n),0]:["ol",Ee(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(P$.name,this.editor.getAttributes(Nh.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=fi({find:Bh,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=fi({find:Bh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Nh.name)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),R$=tt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Ee(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),L$=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,z$=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,F$=Nt.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",Ee(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[br({find:L$,type:this.type})]},addPasteRules(){return[kr({find:z$,type:this.type})]}}),j$=tt.create({name:"text",group:"inline"}),H$=Re.create({name:"starterKit",addExtensions(){var t,e,n,r,i,o,s,a,c,d,u,f,h,p,m,g,y,k;const C=[];return this.options.blockquote!==!1&&C.push(qT.configure((t=this.options)===null||t===void 0?void 0:t.blockquote)),this.options.bold!==!1&&C.push(GT.configure((e=this.options)===null||e===void 0?void 0:e.bold)),this.options.bulletList!==!1&&C.push(XT.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&C.push(t$.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&C.push(i$.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&C.push(o$.configure((o=this.options)===null||o===void 0?void 0:o.document)),this.options.dropcursor!==!1&&C.push(l$.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&C.push(g$.configure((a=this.options)===null||a===void 0?void 0:a.gapcursor)),this.options.hardBreak!==!1&&C.push(y$.configure((c=this.options)===null||c===void 0?void 0:c.hardBreak)),this.options.heading!==!1&&C.push(b$.configure((d=this.options)===null||d===void 0?void 0:d.heading)),this.options.history!==!1&&C.push(T$.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&C.push($$.configure((f=this.options)===null||f===void 0?void 0:f.horizontalRule)),this.options.italic!==!1&&C.push(V$.configure((h=this.options)===null||h===void 0?void 0:h.italic)),this.options.listItem!==!1&&C.push(I$.configure((p=this.options)===null||p===void 0?void 0:p.listItem)),this.options.orderedList!==!1&&C.push(_$.configure((m=this.options)===null||m===void 0?void 0:m.orderedList)),this.options.paragraph!==!1&&C.push(R$.configure((g=this.options)===null||g===void 0?void 0:g.paragraph)),this.options.strike!==!1&&C.push(F$.configure((y=this.options)===null||y===void 0?void 0:y.strike)),this.options.text!==!1&&C.push(j$.configure((k=this.options)===null||k===void 0?void 0:k.text)),C}}),W$=Re.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 ze({key:new yt("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,a=s&&s.type.isLeaf,c=s&&s.isAtom,d=this.options.considerAnyAsEmpty?!0:s&&s.type.name===((n=t.type.contentMatch.defaultType)===null||n===void 0?void 0:n.name),u=t.content.childCount<=1&&s&&d&&s.nodeSize<=2&&(!a||!c);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 g=[this.options.emptyNodeClass];u&&g.push(this.options.emptyEditorClass);const y=et.node(h,h+f.nodeSize,{class:g.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(y)}return this.options.includeChildren}),Ce.create(t,o)}}})]}}),q$={},U$={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},K$=[l.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 Y$(t,e){return l.openBlock(),l.createElementBlock("svg",U$,K$)}const J$=ue(q$,[["render",Y$]]),G$={},Z$={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},X$=[l.createElementVNode("path",{d:"M2.995 1a.625.625 0 1 0 0 1.25h.38v2.125a.625.625 0 1 0 1.25 0v-2.75A.625.625 0 0 0 4 1H2.995ZM3.208 7.385a2.37 2.37 0 0 1 1.027-.124L2.573 8.923a.625.625 0 0 0 .439 1.067l1.987.011a.625.625 0 0 0 .006-1.25l-.49-.003.777-.776c.215-.215.335-.506.335-.809 0-.465-.297-.957-.842-1.078a3.636 3.636 0 0 0-1.993.121.625.625 0 1 0 .416 1.179ZM2.625 11a.625.625 0 1 0 0 1.25H4.25a.125.125 0 0 1 0 .25H3.5a.625.625 0 1 0 0 1.25h.75a.125.125 0 0 1 0 .25H2.625a.625.625 0 1 0 0 1.25H4.25a1.375 1.375 0 0 0 1.153-2.125A1.375 1.375 0 0 0 4.25 11H2.625ZM7.25 2a.75.75 0 0 0 0 1.5h6a.75.75 0 0 0 0-1.5h-6ZM7.25 7.25a.75.75 0 0 0 0 1.5h6a.75.75 0 0 0 0-1.5h-6ZM6.5 13.25a.75.75 0 0 1 .75-.75h6a.75.75 0 0 1 0 1.5h-6a.75.75 0 0 1-.75-.75Z"},null,-1)];function Q$(t,e){return l.openBlock(),l.createElementBlock("svg",Z$,X$)}const eN=ue(G$,[["render",Q$]]),tN={},nN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},rN=[l.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 iN(t,e){return l.openBlock(),l.createElementBlock("svg",nN,rN)}const oN=ue(tN,[["render",iN]]),sN={},aN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},lN=[l.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 cN(t,e){return l.openBlock(),l.createElementBlock("svg",aN,lN)}const dN=ue(sN,[["render",cN]]),uN={},fN={fill:"#000000",width:"800px",height:"800px",viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},hN=[l.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 pN(t,e){return l.openBlock(),l.createElementBlock("svg",fN,hN)}const mN=ue(uN,[["render",pN]]),gN={},yN={fill:"#000000",viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},bN=[l.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 kN(t,e){return l.openBlock(),l.createElementBlock("svg",yN,bN)}const vN=ue(gN,[["render",kN]]),xN={},wN={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"},SN=[l.createElementVNode("g",null,[l.createElementVNode("g",null,[l.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!o||!s?!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:o}=n;if(!o||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[Ma({find:i$,type:this.type,getAttributes:t=>({language:t[1]})}),Ma({find:o$,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new ze({key:new yt("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(ie.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}}})]}}),a$=tt.create({name:"doc",topNode:!0,content:"block+"});function l$(t={}){return new ze({view(e){return new c$(e,t)}})}class c${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 a=e.nodeBefore,c=e.nodeAfter;if(a||c){let d=this.editorView.nodeDOM(this.cursorPos-(a?a.nodeSize:0));if(d){let u=d.getBoundingClientRect(),f=a?u.bottom:u.top;a&&c&&(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 o,s;if(!i||i==document.body&&getComputedStyle(i).position=="static")o=-pageXOffset,s=-pageYOffset;else{let a=i.getBoundingClientRect();o=a.left-i.scrollLeft,s=a.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 a=Bd(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const d$=Re.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[l$(this.options)]}});class xe extends le{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return xe.valid(r)?new xe(r):le.near(r)}content(){return q.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 qa(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!u$(e)||!f$(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,o=null;for(let s=e.depth;;s--){let a=e.node(s);if(n>0?e.indexAfter(s)<a.childCount:e.index(s)>0){o=a.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=n;let c=e.doc.resolve(i);if(xe.valid(c))return c}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 a=e.doc.resolve(i);if(xe.valid(a))return a}return null}}}xe.prototype.visible=!1,xe.findFrom=xe.findGapCursorFrom,le.jsonID("gapcursor",xe);class qa{constructor(e){this.pos=e}map(e){return new qa(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return xe.valid(n)?new xe(n):le.near(n)}}function u$(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 f$(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 h$(){return new ze({props:{decorations:y$,createSelectionBetween(t,e,n){return e.pos==n.pos&&xe.valid(n)?new xe(n):null},handleClick:m$,handleKeyDown:p$,handleDOMEvents:{beforeinput:g$}}})}const p$=rf({ArrowLeft:Vo("horiz",-1),ArrowRight:Vo("horiz",1),ArrowUp:Vo("vert",-1),ArrowDown:Vo("vert",1)});function Vo(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,a=e>0?s.$to:s.$from,c=s.empty;if(s instanceof ie){if(!o.endOfTextblock(n)||a.depth==0)return!1;c=!1,a=r.doc.resolve(e>0?a.after():a.before())}let d=xe.findGapCursorFrom(a,e,c);return d?(i&&i(r.tr.setSelection(new xe(d))),!0):!1}}function m$(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&&Z.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new xe(r))),!0)}function g$(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=R.empty;for(let s=r.length-1;s>=0;s--)i=R.from(r[s].createAndFill(null,i));let o=t.state.tr.replace(n.pos,n.pos,new q(i,0,0));return o.setSelection(ie.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function y$(t){if(!(t.selection instanceof xe))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Ce.create(t.doc,[et.widget(t.selection.head,e,{key:"gapcursor"})])}const b$=Re.create({name:"gapCursor",addProseMirrorPlugins(){return[h$()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=ce(J(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),k$=tt.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Ee(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:a}=r.extensionManager,c=o||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:u})=>{if(u&&c&&s){const f=c.filter(h=>a.includes(h.type.name));d.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),x$=tt.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]}`,Ee(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=>Ma({find:new RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Io=200,Be=function(){};Be.prototype.append=function(e){return e.length?(e=Be.from(e),!this.length&&e||e.length<Io&&this.leafAppend(e)||this.length<Io&&e.leafPrepend(this)||this.appendInner(e)):this},Be.prototype.prepend=function(e){return e.length?Be.from(e).append(this):this},Be.prototype.appendInner=function(e){return new v$(this,e)},Be.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Be.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))},Be.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Be.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)},Be.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},Be.from=function(e){return e instanceof Be?e:e&&e.length?new Eh(e):Be.empty};var Eh=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,a){for(var c=o;c<s;c++)if(i(this.values[c],a+c)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,a){for(var c=o-1;c>=s;c--)if(i(this.values[c],a+c)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Io)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Io)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}(Be);Be.empty=new Eh([]);var v$=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 a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(o,a),s)===!1||o>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,o)-a,s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(o,a)-a,s+a)===!1||o<a&&this.left.forEachInvertedInner(r,Math.min(i,a),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}(Be);const w$=500;class xt{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,a,c,d=[],u=[];return this.items.forEach((f,h)=>{if(!f.step){i||(i=this.remapping(r,h+1),o=i.maps.length),o--,u.push(f);return}if(i){u.push(new Vt(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],d.push(new Vt(m,void 0,void 0,d.length+u.length))),o--,m&&i.appendMap(m,o)}else s.maybeStep(f.step);if(f.selection)return a=i?f.selection.map(i.slice(o)):f.selection,c=new xt(this.items.slice(0,r).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:s,selection:a}}addTransform(e,n,r,i){let o=[],s=this.eventCount,a=this.items,c=!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 Vt(e.mapping.maps[u],f,n),p;(p=c&&c.merge(h))&&(h=p,u?o.pop():a=a.slice(0,a.length-1)),o.push(h),n&&(s++,n=void 0),i||(c=h)}let d=s-r.depth;return d>C$&&(a=S$(a,d),s-=d),new xt(a.append(o),s)}remapping(e,n){let r=new or;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 xt(this.items.append(e.map(n=>new Vt(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,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let c=n;this.items.forEach(h=>{let p=o.getMirror(--c);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(c+1,p));g&&a++,r.push(new Vt(m,y,g))}else r.push(new Vt(m))},i);let d=[];for(let h=n;h<s;h++)d.push(new Vt(o.maps[h]));let u=this.items.slice(0,i).append(d).append(r),f=new xt(u,a);return f.emptyItemCount()>w$&&(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,a)=>{if(a>=e)i.push(s),s.selection&&o++;else if(s.step){let c=s.step.map(n.slice(r)),d=c&&c.getMap();if(r--,d&&n.appendMap(d,r),c){let u=s.selection&&s.selection.map(n.slice(r));u&&o++;let f=new Vt(d.invert(),c,u),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 xt(Be.from(i.reverse()),o)}}xt.empty=new xt(Be.empty,0);function S$(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class Vt{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 Vt(n.getMap().invert(),n,this.selection)}}}class mn{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const C$=20;function O$(t,e,n,r){let i=n.getMeta(Fn),o;if(i)return i.historyState;n.getMeta(T$)&&(t=new mn(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(Fn))return s.getMeta(Fn).redo?new mn(t.done.addTransform(n,void 0,r,Po(e)),t.undone,Mh(n.mapping.maps[n.steps.length-1]),t.prevTime,t.prevComposition):new mn(t.done,t.undone.addTransform(n,void 0,r,Po(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),c=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!E$(n,t.prevRanges)),d=s?Ua(t.prevRanges,n.mapping):Mh(n.mapping.maps[n.steps.length-1]);return new mn(t.done.addTransform(n,c?e.selection.getBookmark():void 0,r,Po(e)),xt.empty,d,n.time,a??t.prevComposition)}else return(o=n.getMeta("rebased"))?new mn(t.done.rebased(n,o),t.undone.rebased(n,o),Ua(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new mn(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Ua(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function E$(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 Mh(t){let e=[];return t.forEach((n,r,i,o)=>e.push(i,o)),e}function Ua(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 M$(t,e,n){let r=Po(e),i=Fn.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),a=(n?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),c=new mn(n?a:o.remaining,n?o.remaining:a,null,0,-1);return o.transform.setSelection(s).setMeta(Fn,{redo:n,historyState:c})}let Ka=!1,Th=null;function Po(t){let e=t.plugins;if(Th!=e){Ka=!1,Th=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Ka=!0;break}}return Ka}const Fn=new yt("history"),T$=new yt("closeHistory");function $$(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new ze({key:Fn,state:{init(){return new mn(xt.empty,xt.empty,null,0,-1)},apply(e,n,r){return O$(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?Nh:r=="historyRedo"?Bh:null;return i?(n.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function $h(t,e){return(n,r)=>{let i=Fn.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let o=M$(i,n,t);o&&r(e?o.scrollIntoView():o)}return!0}}const Nh=$h(!1,!0),Bh=$h(!0,!0),N$=Re.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Nh(t,e),redo:()=>({state:t,dispatch:e})=>Bh(t,e)}},addProseMirrorPlugins(){return[$$(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()}}}),B$=tt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Ee(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:a}=i.selection,c=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?i.setSelection(ie.create(i.doc,a.pos+1)):a.nodeAfter.isBlock?i.setSelection(Z.create(i.doc,a.pos)):i.setSelection(ie.create(i.doc,a.pos));else{const d=(s=a.parent.type.contentMatch.defaultType)===null||s===void 0?void 0:s.create();d&&(i.insert(c,d),i.setSelection(ie.create(i.doc,c+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[aM({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),A$=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,D$=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,V$=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,I$=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,P$=Nt.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",Ee(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[kr({find:A$,type:this.type}),kr({find:V$,type:this.type})]},addPasteRules(){return[xr({find:D$,type:this.type}),xr({find:I$,type:this.type})]}}),_$=tt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ee(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)}}}),R$=tt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ee(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)}}}),Ah=Nt.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",Ee(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const n=Eo(t,this.type);return Object.entries(n).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),Dh=/^(\d+)\.\s$/,L$=tt.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",Ee(this.options.HTMLAttributes,n),0]:["ol",Ee(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(R$.name,this.editor.getAttributes(Ah.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=fi({find:Dh,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=fi({find:Dh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Ah.name)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),z$=tt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Ee(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),F$=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,j$=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,H$=Nt.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",Ee(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[kr({find:F$,type:this.type})]},addPasteRules(){return[xr({find:j$,type:this.type})]}}),W$=tt.create({name:"text",group:"inline"}),q$=Re.create({name:"starterKit",addExtensions(){var t,e,n,r,i,o,s,a,c,d,u,f,h,p,m,y,g,k;const C=[];return this.options.blockquote!==!1&&C.push(KT.configure((t=this.options)===null||t===void 0?void 0:t.blockquote)),this.options.bold!==!1&&C.push(XT.configure((e=this.options)===null||e===void 0?void 0:e.bold)),this.options.bulletList!==!1&&C.push(e$.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&C.push(r$.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&C.push(s$.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&C.push(a$.configure((o=this.options)===null||o===void 0?void 0:o.document)),this.options.dropcursor!==!1&&C.push(d$.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&C.push(b$.configure((a=this.options)===null||a===void 0?void 0:a.gapcursor)),this.options.hardBreak!==!1&&C.push(k$.configure((c=this.options)===null||c===void 0?void 0:c.hardBreak)),this.options.heading!==!1&&C.push(x$.configure((d=this.options)===null||d===void 0?void 0:d.heading)),this.options.history!==!1&&C.push(N$.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&C.push(B$.configure((f=this.options)===null||f===void 0?void 0:f.horizontalRule)),this.options.italic!==!1&&C.push(P$.configure((h=this.options)===null||h===void 0?void 0:h.italic)),this.options.listItem!==!1&&C.push(_$.configure((p=this.options)===null||p===void 0?void 0:p.listItem)),this.options.orderedList!==!1&&C.push(L$.configure((m=this.options)===null||m===void 0?void 0:m.orderedList)),this.options.paragraph!==!1&&C.push(z$.configure((y=this.options)===null||y===void 0?void 0:y.paragraph)),this.options.strike!==!1&&C.push(H$.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&C.push(W$.configure((k=this.options)===null||k===void 0?void 0:k.text)),C}}),U$=Re.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 ze({key:new yt("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,a=s&&s.type.isLeaf,c=s&&s.isAtom,d=this.options.considerAnyAsEmpty?!0:s&&s.type.name===((n=t.type.contentMatch.defaultType)===null||n===void 0?void 0:n.name),u=t.content.childCount<=1&&s&&d&&s.nodeSize<=2&&(!a||!c);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=et.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}),Ce.create(t,o)}}})]}}),K$={},Y$={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},J$=[l.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 G$(t,e){return l.openBlock(),l.createElementBlock("svg",Y$,J$)}const Z$=ue(K$,[["render",G$]]),X$={},Q$={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},eN=[l.createElementVNode("path",{d:"M2.995 1a.625.625 0 1 0 0 1.25h.38v2.125a.625.625 0 1 0 1.25 0v-2.75A.625.625 0 0 0 4 1H2.995ZM3.208 7.385a2.37 2.37 0 0 1 1.027-.124L2.573 8.923a.625.625 0 0 0 .439 1.067l1.987.011a.625.625 0 0 0 .006-1.25l-.49-.003.777-.776c.215-.215.335-.506.335-.809 0-.465-.297-.957-.842-1.078a3.636 3.636 0 0 0-1.993.121.625.625 0 1 0 .416 1.179ZM2.625 11a.625.625 0 1 0 0 1.25H4.25a.125.125 0 0 1 0 .25H3.5a.625.625 0 1 0 0 1.25h.75a.125.125 0 0 1 0 .25H2.625a.625.625 0 1 0 0 1.25H4.25a1.375 1.375 0 0 0 1.153-2.125A1.375 1.375 0 0 0 4.25 11H2.625ZM7.25 2a.75.75 0 0 0 0 1.5h6a.75.75 0 0 0 0-1.5h-6ZM7.25 7.25a.75.75 0 0 0 0 1.5h6a.75.75 0 0 0 0-1.5h-6ZM6.5 13.25a.75.75 0 0 1 .75-.75h6a.75.75 0 0 1 0 1.5h-6a.75.75 0 0 1-.75-.75Z"},null,-1)];function tN(t,e){return l.openBlock(),l.createElementBlock("svg",Q$,eN)}const nN=ue(X$,[["render",tN]]),rN={},iN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},oN=[l.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 sN(t,e){return l.openBlock(),l.createElementBlock("svg",iN,oN)}const aN=ue(rN,[["render",sN]]),lN={},cN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},dN=[l.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 uN(t,e){return l.openBlock(),l.createElementBlock("svg",cN,dN)}const fN=ue(lN,[["render",uN]]),hN={},pN={fill:"#000000",width:"800px",height:"800px",viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},mN=[l.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 gN(t,e){return l.openBlock(),l.createElementBlock("svg",pN,mN)}const yN=ue(hN,[["render",gN]]),bN={},kN={fill:"#000000",viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},xN=[l.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 vN(t,e){return l.openBlock(),l.createElementBlock("svg",kN,xN)}const wN=ue(bN,[["render",vN]]),SN={},CN={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"},ON=[l.createElementVNode("g",null,[l.createElementVNode("g",null,[l.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 CN(t,e){return l.openBlock(),l.createElementBlock("svg",wN,SN)}const ON=ue(xN,[["render",CN]]),EN={},MN={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},TN=[l.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 $N(t,e){return l.openBlock(),l.createElementBlock("svg",MN,TN)}const NN=ue(EN,[["render",$N]]),BN={class:"py-1 px-1 border-b"},AN={class:"flex gap-px"},DN=["onClick"],VN={key:1,class:"text-sm"},IN={class:"max-h-72 w-full overflow-auto px-4 py-3"},PN=Object.assign({name:"WpicTextEditor"},{props:{modelValue:{type:String,default:""}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r={pmi:"shadow-inner border-zinc-400 dark:border-zinc-700/50 focus-within:border-zinc-500 focus-within:outline focus-within:outline-2 focus-within:outline-offset-3 dark:text-zinc-300 bg-zinc-100 dark:bg-zinc-700/25","wpic-tools":"bg-white border border-gray-300"},i=[{method:"toggleBold",type:"chain",label:"bold",icon:vN,smallIcon:!0,disableCheck:!0},{method:"toggleItalic",type:"chain",label:"italic",icon:mN,smallIcon:!0,disableCheck:!0},{method:"setParagraph",type:"chain",label:"paragraph",icon:ON,smallIcon:!0,disableCheck:!1},{method:"toggleBulletList",type:"chain",label:"bullet list",icon:J$,disableCheck:!1},{method:"toggleOrderedList",type:"chain",label:"ordered list",icon:eN,disableCheck:!1},{method:"undo",type:"chain",label:"undo",icon:oN,disableCheck:!0},{method:"redo",type:"chain",label:"redo",icon:dN,disableCheck:!0},{method:"redo",type:"chain",label:"redo",icon:NN,disableCheck:!0}],o=e,s=HT({content:n.modelValue,extensions:[H$,W$.configure({placeholder:"..."})],onUpdate:()=>{o("update:modelValue",s.value.getHTML())}});l.onBeforeUnmount(()=>{s.value.destroy()}),l.watch(()=>n.modelValue,d=>{d!==s.value.getHTML()&&s.value.commands.setContent(d,!1)});function a(d,u,f){u==="chain"?f?s.value.chain().focus()[d](f).run():s.value.chain().focus()[d]().run():this.editor[d]()()}function c(d,u,f,h){return h?u==="chain"?f?!s.value.can().chain().focus()[d](f).run():!s.value.can().chain().focus()[d]().run():!s.value.can()[d]().run():!1}return(d,u)=>l.unref(s)?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["pt-px relative flex flex-col rounded-sm border",r[l.unref(ne).theme]])},[l.createElementVNode("div",BN,[l.createElementVNode("div",AN,[(l.openBlock(),l.createElementBlock(l.Fragment,null,l.renderList(i,f=>l.createElementVNode("div",{key:f.method,class:l.normalizeClass(["w-8 h-8 flex items-center justify-center text-xs rounded-sm",{"cursor-pointer":!c(f.method,f.type,f.params,f.disableCheck),"is-active text-white bg-zinc-200!":l.unref(s).isActive(f.label)}]),onClick:h=>a(f.method,f.type,f.params)},[f.icon?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(f.icon),{key:0,class:l.normalizeClass(["",{"w-3 h-3":f.smallIcon,"w-4 h-4":!f.smallIcon}])},null,8,["class"])):(l.openBlock(),l.createElementBlock("span",VN,l.toDisplayString(l.unref(lg).capitalize(f.label)),1))],10,DN)),64))])]),l.createElementVNode("div",IN,[l.createVNode(l.unref(jT),{editor:l.unref(s)},null,8,["editor"])])],2)):l.createCommentVNode("",!0)}}),_N={},RN={viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},LN=[l.createElementVNode("rect",{x:"2",y:"2",width:"20",height:"20",rx:"7",fill:"currentColor","stroke-width":"2.5"},null,-1)];function zN(t,e){return l.openBlock(),l.createElementBlock("svg",RN,LN)}const FN=ue(_N,[["render",zN]]),jN={},HN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"none"},WN=[l.createElementVNode("rect",{x:"2",y:"2",width:"20",height:"20",rx:"7",fill:"none",stroke:"currentColor","stroke-width":"3"},null,-1)];function qN(t,e){return l.openBlock(),l.createElementBlock("svg",HN,WN)}const UN=ue(jN,[["render",qN]]),KN={},YN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none"},JN=[l.createElementVNode("rect",{x:"2",y:"2",width:"20",height:"20",rx:"7",fill:"none",stroke:"currentColor","stroke-width":"3"},null,-1),l.createElementVNode("line",{x1:"7.5",y1:"2",x2:"22",y2:"16",stroke:"currentColor",class:"opacity-75","stroke-width":"2.5"},null,-1),l.createElementVNode("line",{x1:"2",y1:"7.5",x2:"16",y2:"22",stroke:"currentColor",class:"opacity-75","stroke-width":"2.5"},null,-1)];function GN(t,e){return l.openBlock(),l.createElementBlock("svg",YN,JN)}const ZN=ue(KN,[["render",GN]]),XN=Object.assign({name:"WpicBadge"},{props:{success:Boolean,warning:Boolean,error:Boolean,complete:Boolean,incomplete:Boolean,partially:Boolean},setup(t){return(e,n)=>(l.openBlock(),l.createElementBlock("span",{class:l.normalizeClass(["inline-flex items-center justify-center border-0 font-normal rounded-md min-h-6 gap-1 leading-none text-sm px-2",{"bg-green-100 border-green-200 text-green-700 dark:border-green-600/30 dark:bg-green-800/15 dark:text-green-500/85":t.success,"bg-yellow-100 border-yellow-200 text-yellow-700 dark:border-yellow-600/30 dark:bg-yellow-800/15 dark:text-yellow-500/85":t.warning,"bg-red-100 border-red-200 text-red-700 dark:border-red-600/30 dark:bg-red-800/15 dark:text-red-500/85":t.error,"bg-gray-100 border-gray-200 text-gray-700 dark:border-gray-600/30 dark:bg-white/5 dark:text-gray-400/85":!t.success&&!t.warning&&!t.error}])},[t.complete?(l.openBlock(),l.createBlock(FN,{key:0,class:"w-2.5 h-2.5"})):l.createCommentVNode("",!0),t.incomplete?(l.openBlock(),l.createBlock(UN,{key:1,class:"w-2.5 h-2.5 opacity-80"})):l.createCommentVNode("",!0),t.partially?(l.openBlock(),l.createBlock(ZN,{key:2,class:"w-2.5 h-2.5 opacity-80"})):l.createCommentVNode("",!0),l.renderSlot(e.$slots,"default")],2))}}),QN={__name:"DayItem",props:{day:{},today:Boolean,selected:Boolean,between:Boolean,firstDay:Boolean,lastDay:Boolean,off:Boolean,disabled:Boolean,highlight:Boolean},setup(t){const e={pmi:"","wpic-tools":"hover:text-lime-500 group-[.is-off]:text-gray-400 dark:group-[.is-off]:text-gray-700 group-[.is-today]:text-lime-500 group-[.is-today]:font-medium group-[.is-selected]:bg-lime-500 dark:group-[.is-selected]:bg-lime-600 group-[.is-selected]:!text-white rounded-full"},n={pmi:"","wpic-tools":"group-[.is-highlight]:bg-gray-200"},r={pmi:"","wpic-tools":"bg-gray-100 dark:bg-gray-800"},i={pmi:"","wpic-tools":"bg-gray-100 dark:bg-gray-800 rounded-l-0"},o={pmi:"","wpic-tools":"bg-gray-100 dark:bg-gray-800 rounded-r-0"},s={pmi:"","wpic-tools":"bg-gray-200"};return(a,c)=>(l.openBlock(),l.createElementBlock("div",{class:l.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,"is-highlight":t.highlight,"cursor-pointer":!t.disabled}])},[l.createElementVNode("div",{class:l.normalizeClass(["h-8 w-full flex justify-center items-center",{[`${r[l.unref(ne).theme]}`]:t.between,[`${i[l.unref(ne).theme]}`]:t.firstDay,[`${o[l.unref(ne).theme]}`]:t.lastDay,[`${s[l.unref(ne).theme]}`]:t.highlight}]),style:l.normalizeStyle({marginLeft:t.firstDay?"50%":void 0,marginRight:t.lastDay?"50%":void 0})},[l.createElementVNode("span",{class:l.normalizeClass(["absolute w-8 h-8 flex items-center justify-center dark:text-gray-400",{[`${e[l.unref(ne).theme]}`]:!0,[`${n[l.unref(ne).theme]}`]:t.highlight&&(t.firstDay||t.lastDay)}]),style:{left:"50%",transform:"translateX(-50%)"}},[l.renderSlot(a.$slots,"default",{},()=>[l.createTextVNode(l.toDisplayString(t.day),1)])],2)],6)],2))}};var Ah={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(Cn,function(){var n=1e3,r=6e4,i=36e5,o="millisecond",s="second",a="minute",c="hour",d="day",u="week",f="month",h="quarter",p="year",m="date",g="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,k=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(L){var I=["th","st","nd","rd"],T=L%100;return"["+L+(I[(T-20)%10]||I[T]||I[0])+"]"}},N=function(L,I,T){var x=String(L);return!x||x.length>=I?L:""+Array(I+1-x.length).join(T)+L},b={s:N,z:function(L){var I=-L.utcOffset(),T=Math.abs(I),x=Math.floor(T/60),M=T%60;return(I<=0?"+":"-")+N(x,2,"0")+":"+N(M,2,"0")},m:function L(I,T){if(I.date()<T.date())return-L(T,I);var x=12*(T.year()-I.year())+(T.month()-I.month()),M=I.clone().add(x,f),V=T-M<0,U=I.clone().add(x+(V?-1:1),f);return+(-(x+(T-M)/(V?M-U:U-M))||0)},a:function(L){return L<0?Math.ceil(L)||0:Math.floor(L)},p:function(L){return{M:f,y:p,w:u,d,D:m,h:c,m:a,s,ms:o,Q:h}[L]||String(L||"").toLowerCase().replace(/s$/,"")},u:function(L){return L===void 0}},S="en",v={};v[S]=C;var $="$isDayjsObject",D=function(L){return L instanceof F||!(!L||!L[$])},A=function L(I,T,x){var M;if(!I)return S;if(typeof I=="string"){var V=I.toLowerCase();v[V]&&(M=V),T&&(v[V]=T,M=V);var U=I.split("-");if(!M&&U.length>1)return L(U[0])}else{var W=I.name;v[W]=I,M=W}return!x&&M&&(S=M),M||!x&&S},B=function(L,I){if(D(L))return L.clone();var T=typeof I=="object"?I:{};return T.date=L,T.args=arguments,new F(T)},P=b;P.l=A,P.i=D,P.w=function(L,I){return B(L,{locale:I.$L,utc:I.$u,x:I.$x,$offset:I.$offset})};var F=function(){function L(T){this.$L=A(T.locale,null,!0),this.parse(T),this.$x=this.$x||T.x||{},this[$]=!0}var I=L.prototype;return I.parse=function(T){this.$d=function(x){var M=x.date,V=x.utc;if(M===null)return new Date(NaN);if(P.u(M))return new Date;if(M instanceof Date)return new Date(M);if(typeof M=="string"&&!/Z$/i.test(M)){var U=M.match(y);if(U){var W=U[2]-1||0,re=(U[7]||"0").substring(0,3);return V?new Date(Date.UTC(U[1],W,U[3]||1,U[4]||0,U[5]||0,U[6]||0,re)):new Date(U[1],W,U[3]||1,U[4]||0,U[5]||0,U[6]||0,re)}}return new Date(M)}(T),this.init()},I.init=function(){var T=this.$d;this.$y=T.getFullYear(),this.$M=T.getMonth(),this.$D=T.getDate(),this.$W=T.getDay(),this.$H=T.getHours(),this.$m=T.getMinutes(),this.$s=T.getSeconds(),this.$ms=T.getMilliseconds()},I.$utils=function(){return P},I.isValid=function(){return this.$d.toString()!==g},I.isSame=function(T,x){var M=B(T);return this.startOf(x)<=M&&M<=this.endOf(x)},I.isAfter=function(T,x){return B(T)<this.startOf(x)},I.isBefore=function(T,x){return this.endOf(x)<B(T)},I.$g=function(T,x,M){return P.u(T)?this[x]:this.set(M,T)},I.unix=function(){return Math.floor(this.valueOf()/1e3)},I.valueOf=function(){return this.$d.getTime()},I.startOf=function(T,x){var M=this,V=!!P.u(x)||x,U=P.p(T),W=function(oe,he){var be=P.w(M.$u?Date.UTC(M.$y,he,oe):new Date(M.$y,he,oe),M);return V?be:be.endOf(d)},re=function(oe,he){return P.w(M.toDate()[oe].apply(M.toDate("s"),(V?[0,0,0,0]:[23,59,59,999]).slice(he)),M)},de=this.$W,se=this.$M,ye=this.$D,H="set"+(this.$u?"UTC":"");switch(U){case p:return V?W(1,0):W(31,11);case f:return V?W(1,se):W(0,se+1);case u:var X=this.$locale().weekStart||0,fe=(de<X?de+7:de)-X;return W(V?ye-fe:ye+(6-fe),se);case d:case m:return re(H+"Hours",0);case c:return re(H+"Minutes",1);case a:return re(H+"Seconds",2);case s:return re(H+"Milliseconds",3);default:return this.clone()}},I.endOf=function(T){return this.startOf(T,!1)},I.$set=function(T,x){var M,V=P.p(T),U="set"+(this.$u?"UTC":""),W=(M={},M[d]=U+"Date",M[m]=U+"Date",M[f]=U+"Month",M[p]=U+"FullYear",M[c]=U+"Hours",M[a]=U+"Minutes",M[s]=U+"Seconds",M[o]=U+"Milliseconds",M)[V],re=V===d?this.$D+(x-this.$W):x;if(V===f||V===p){var de=this.clone().set(m,1);de.$d[W](re),de.init(),this.$d=de.set(m,Math.min(this.$D,de.daysInMonth())).$d}else W&&this.$d[W](re);return this.init(),this},I.set=function(T,x){return this.clone().$set(T,x)},I.get=function(T){return this[P.p(T)]()},I.add=function(T,x){var M,V=this;T=Number(T);var U=P.p(x),W=function(se){var ye=B(V);return P.w(ye.date(ye.date()+Math.round(se*T)),V)};if(U===f)return this.set(f,this.$M+T);if(U===p)return this.set(p,this.$y+T);if(U===d)return W(1);if(U===u)return W(7);var re=(M={},M[a]=r,M[c]=i,M[s]=n,M)[U]||1,de=this.$d.getTime()+T*re;return P.w(de,this)},I.subtract=function(T,x){return this.add(-1*T,x)},I.format=function(T){var x=this,M=this.$locale();if(!this.isValid())return M.invalidDate||g;var V=T||"YYYY-MM-DDTHH:mm:ssZ",U=P.z(this),W=this.$H,re=this.$m,de=this.$M,se=M.weekdays,ye=M.months,H=M.meridiem,X=function(he,be,Oe,ut){return he&&(he[be]||he(x,V))||Oe[be].slice(0,ut)},fe=function(he){return P.s(W%12||12,he,"0")},oe=H||function(he,be,Oe){var ut=he<12?"AM":"PM";return Oe?ut.toLowerCase():ut};return V.replace(k,function(he,be){return be||function(Oe){switch(Oe){case"YY":return String(x.$y).slice(-2);case"YYYY":return P.s(x.$y,4,"0");case"M":return de+1;case"MM":return P.s(de+1,2,"0");case"MMM":return X(M.monthsShort,de,ye,3);case"MMMM":return X(ye,de);case"D":return x.$D;case"DD":return P.s(x.$D,2,"0");case"d":return String(x.$W);case"dd":return X(M.weekdaysMin,x.$W,se,2);case"ddd":return X(M.weekdaysShort,x.$W,se,3);case"dddd":return se[x.$W];case"H":return String(W);case"HH":return P.s(W,2,"0");case"h":return fe(1);case"hh":return fe(2);case"a":return oe(W,re,!0);case"A":return oe(W,re,!1);case"m":return String(re);case"mm":return P.s(re,2,"0");case"s":return String(x.$s);case"ss":return P.s(x.$s,2,"0");case"SSS":return P.s(x.$ms,3,"0");case"Z":return U}return null}(he)||U.replace(":","")})},I.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},I.diff=function(T,x,M){var V,U=this,W=P.p(x),re=B(T),de=(re.utcOffset()-this.utcOffset())*r,se=this-re,ye=function(){return P.m(U,re)};switch(W){case p:V=ye()/12;break;case f:V=ye();break;case h:V=ye()/3;break;case u:V=(se-de)/6048e5;break;case d:V=(se-de)/864e5;break;case c:V=se/i;break;case a:V=se/r;break;case s:V=se/n;break;default:V=se}return M?V:P.a(V)},I.daysInMonth=function(){return this.endOf(f).$D},I.$locale=function(){return v[this.$L]},I.locale=function(T,x){if(!T)return this.$L;var M=this.clone(),V=A(T,x,!0);return V&&(M.$L=V),M},I.clone=function(){return P.w(this.$d,this)},I.toDate=function(){return new Date(this.valueOf())},I.toJSON=function(){return this.isValid()?this.toISOString():null},I.toISOString=function(){return this.$d.toISOString()},I.toString=function(){return this.$d.toUTCString()},L}(),G=F.prototype;return B.prototype=G,[["$ms",o],["$s",s],["$m",a],["$H",c],["$W",d],["$M",f],["$y",p],["$D",m]].forEach(function(L){G[L[1]]=function(I){return this.$g(I,L[0],L[1])}}),B.extend=function(L,I){return L.$i||(L(I,F,B),L.$i=!0),B},B.locale=A,B.isDayjs=D,B.unix=function(L){return B(1e3*L)},B.en=v[S],B.Ls=v,B.p={},B})})(Ah);var eB=Ah.exports;const j=Wr(eB);var Dh={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(Cn,function(){var n="week",r="year";return function(i,o,s){var a=o.prototype;a.week=function(c){if(c===void 0&&(c=null),c!==null)return this.add(7*(c-this.week()),"day");var d=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var u=s(this).startOf(r).add(1,r).date(d),f=s(this).endOf(n);if(u.isBefore(f))return 1}var h=s(this).startOf(r).date(d).startOf(n).subtract(1,"millisecond"),p=this.diff(h,n,!0);return p<0?s(this).startOf("week").week():Math.ceil(p)},a.weeks=function(c){return c===void 0&&(c=null),this.week(c)}}})})(Dh);var tB=Dh.exports;const nB=Wr(tB);var Vh={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(Cn,function(){return function(n,r,i){r.prototype.isBetween=function(o,s,a,c){var d=i(o),u=i(s),f=(c=c||"()")[0]==="(",h=c[1]===")";return(f?this.isAfter(d,a):!this.isBefore(d,a))&&(h?this.isBefore(u,a):!this.isAfter(u,a))||(f?this.isBefore(d,a):!this.isAfter(d,a))&&(h?this.isAfter(u,a):!this.isBefore(u,a))}}})})(Vh);var rB=Vh.exports;const iB=Wr(rB),oB={class:"w-full dark:text-gray-400"},sB={class:"flex justify-between items-center mb-3"},aB={class:"flex"},lB={class:"font-medium"},cB={class:"flex"},dB={class:"grid grid-cols-7 border-b dark:border-gray-800 mb-2 pb-2"},uB={class:"flex justify-center text-sm"},Ya=Object.assign({name:"WpicCalendar"},{props:{modelValue:{},range:Boolean,doubleMonths:Boolean,displayYearStart:Number,displayMonthStart:Number,displayYearEnd:Number,displayMonthEnd:Number,maxDate:{},minDate:{},week:Boolean,initDates:{}},emits:["update:modelValue"],setup(t,{emit:e}){j.extend(iB),j.extend(nB);const n=t,r=l.ref([j(new Date).subtract(1,"month"),j(new Date)]);l.watch(()=>n.initDates,()=>{var x;if(!n.range&&n.initDates)r.value[0]=j(n.initDates);else if(!n.range&&!n.initDates)r.value[0]=j(new Date);else if(n.range&&((x=n.initDates)==null?void 0:x.length)===2){let M=j(n.initDates[0]),V=j(n.initDates[1]);V.isBefore(M,"month")&&(V=M.add(1,"month")),M.isSame(V,"month")&&(V=M.add(1,"month")),r.value=[M,V]}},{immediate:!0,once:!0}),l.watch(()=>[n.displayYearStart,n.displayMonthStart],([x,M])=>{x&&M&&(r.value[0]=j().year(Number(x)).month(Number(M)).startOf("month"),r.value[1]=j().year(Number(x)).month(Number(M)).startOf("month").add(1,"month"))},{immediate:!0}),l.watch(()=>[n.displayYearEnd,n.displayMonthEnd],([x,M])=>{if(console.log(x,M),x&&M){console.log("newYear and newMonth");const V=r.value[0],U=j().year(Number(x)).month(Number(M)).startOf("month");U.isAfter(V,"month")&&(r.value[1]=U)}},{immediate:!0});const i=e,o=l.computed(()=>n.doubleMonths||n.range?[0,1]:[0]);function s(x){if(n.week)i("update:modelValue",[j(x).startOf("week"),j(x).endOf("week")]);else if(n.range){const M=n.modelValue.filter(V=>V).length;if(console.log("length",M),M==0)i("update:modelValue",[x]);else if(M==2)i("update:modelValue",[x]);else if(M==1){let V=[j(n.modelValue[0]),j(x)];V=V.sort((U,W)=>U-W),i("update:modelValue",V)}}else i("update:modelValue",j(x))}function a(x){const M=j(x).daysInMonth(),V=[],U=j(x).startOf("month");for(let W=1;W<=M;W++){let re=U.clone().date(W);V.push(re)}return V}function c(x){return j(x).startOf("month").day()}function d(x,M){const V=j(`${x}-${M}-01`,"YYYY-MM-DD"),W=V.day(),re=[];for(let de=0;de<W;de++)re.push(V.clone().subtract(W-de,"days"));return re}function u(x,M){const V=j(`${x}-${M}`,"YYYY-MM").endOf("month"),W=6-V.day(),re=[];for(let de=1;de<=W;de++)re.push(V.clone().add(de,"days"));return re}function f(x){const M=j();return j(x).isSame(M,"day")}function h(x){var M,V;if(n.range){if(((M=n.modelValue)==null?void 0:M.length)==1)return j(x).isSame(j(n.modelValue[0]),"day");if(((V=n.modelValue)==null?void 0:V.length)==2)return j(x).isSame(j(n.modelValue[0]),"day")||j(x).isSame(j(n.modelValue[1]),"day")}else if(n.modelValue)return j(x).isSame(j(n.modelValue),"day")}function p(x){var M;if(n.range&&((M=n.modelValue)==null?void 0:M.length)==2)return j(x).isBetween(j(n.modelValue[0]),j(n.modelValue[1]))}function m(x){var M;if(n.range&&((M=n.modelValue)==null?void 0:M.length)==2)return j(x).isSame(j(n.modelValue[0]),"day")}function g(x){var M;if(n.range&&((M=n.modelValue)==null?void 0:M.length)==2)return j(x).isSame(j(n.modelValue[1]),"day")}function y(x){try{return n.minDate?j(x).isBefore(j(n.minDate)):!1}catch(M){return console.log(M),!1}}function k(x){try{return n.maxDate?j(x).isAfter(j(n.maxDate)):!1}catch(M){return console.log(M),!1}}function C(x){B(x,r.value[x].subtract(1,"month"))}function N(x){B(x,r.value[x].add(1,"month"))}function b(x){B(x,r.value[x].subtract(1,"year"))}function S(x){B(x,r.value[x].add(1,"year"))}const v=x=>x===0?!0:r.value[x].subtract(1,"month").isAfter(r.value[0],"month"),$=x=>x===1?!0:r.value[x].add(1,"month").isBefore(r.value[1],"month"),D=x=>x===0?!0:r.value[x].subtract(1,"year").isAfter(r.value[0],"year"),A=x=>x===1?!0:r.value[x].add(1,"year").isBefore(r.value[1],"year");function B(x,M){if(x===0){if(!M.isBefore(r.value[1],"month"))return;r.value=[M,r.value[1]]}else{if(!M.isAfter(r.value[0],"month"))return;(M.isBefore(r.value[0],"month")||M.isSame(r.value[0],"month"))&&(M=r.value[0].add(1,"month")),r.value=[r.value[0],M]}}const P=l.ref();function F(x){n.week&&(P.value=j(x).week())}function G(x){return j(x).week()===P.value}function L(x){return j(x).week()===P.value?j(x).format("YYYY-MM-DD")===j().week(P.value).startOf("week").format("YYYY-MM-DD"):!1}function I(x){return j(x).week()===P.value?j(x).format("YYYY-MM-DD")===j().week(P.value).endOf("week").format("YYYY-MM-DD"):!1}function T(){P.value=null}return(x,M)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["shrink-0 flex gap-6",{"min-w-96":o.value.length===1,"min-w-192":o.value.length===2}])},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(o.value,V=>{var U;return l.openBlock(),l.createElementBlock("div",oB,[l.createElementVNode("div",sB,[l.createElementVNode("div",aB,[l.createVNode(qc,{class:l.normalizeClass(["w-5 h-5 cursor-pointer select-none",{"opacity-25 cursor-not-allowed":!D(V),"hover:opacity-100":D(V)}]),onClick:W=>D(V)?b(V):null},null,8,["class","onClick"]),l.createVNode(Uc,{class:l.normalizeClass(["w-5 h-5 cursor-pointer select-none",{"opacity-25 cursor-not-allowed":!v(V),"hover:opacity-100":v(V)}]),onClick:W=>v(V)?C(V):null},null,8,["class","onClick"])]),l.createElementVNode("div",lB,l.toDisplayString(r.value[V].format("YYYY MMMM")),1),l.createElementVNode("div",cB,[l.createVNode(Yc,{class:l.normalizeClass(["w-5 h-5 cursor-pointer select-none",{"opacity-25 cursor-not-allowed":!$(V),"hover:opacity-100":$(V)}]),onClick:W=>$(V)?N(V):null},null,8,["class","onClick"]),l.createVNode(Kc,{class:l.normalizeClass(["w-5 h-5 cursor-pointer select-none",{"opacity-25 cursor-not-allowed":!A(V),"hover:opacity-100":A(V)}]),onClick:W=>A(V)?S(V):null},null,8,["class","onClick"])])]),l.createElementVNode("div",dB,[(l.openBlock(),l.createElementBlock(l.Fragment,null,l.renderList(7,W=>{var re;return l.createElementVNode("div",uB,l.toDisplayString((re=r.value[V])==null?void 0:re.clone().startOf("week").subtract(1,"days").add(W,"days").format("ddd")),1)}),64))]),l.createElementVNode("div",{class:"grid grid-cols-7",onMouseout:T},[c(r.value[V])>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(d(l.unref(j)(r.value[V]).year(),l.unref(j)(r.value[V]).month()+1),W=>(l.openBlock(),l.createElementBlock("div"))),256)):l.createCommentVNode("",!0),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(a(r.value[V].clone()),W=>(l.openBlock(),l.createBlock(QN,{onMouseover:re=>F(W),onClick:re=>!k(W)&&!y(W)?s(W):null,today:f(W),selected:h(W),firstDay:m(W)||L(W),lastDay:g(W)||I(W),between:p(W),disabled:k(W)||y(W),off:k(W)||y(W),highlight:G(W)},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(j)(W).format("D")),1)]),_:2},1032,["onMouseover","onClick","today","selected","firstDay","lastDay","between","disabled","off","highlight"]))),256)),((U=u(l.unref(j)(r.value[V]).year(),l.unref(j)(r.value[V]).month()+1))==null?void 0:U.length)>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:1},l.renderList(u(l.unref(j)(r.value[V]).year(),l.unref(j)(r.value[V]).month()+1),W=>(l.openBlock(),l.createElementBlock("div"))),256)):l.createCommentVNode("",!0)],32)])}),256))],2))}}),fB={},hB={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},pB=[l.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 mB(t,e){return l.openBlock(),l.createElementBlock("svg",hB,pB)}const Ih=ue(fB,[["render",mB]]),gB={},yB={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},bB=[l.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 kB(t,e){return l.openBlock(),l.createElementBlock("svg",yB,bB)}const Ph=ue(gB,[["render",kB]]),vB={class:"flex gap-3"},xB={key:0,class:"w-32 py-2 border-r dark:border-gray-800 flex flex-col gap-3 shrink-0"},wB=["onClick"],SB=Object.assign({name:"WpicDateField"},{props:{modelValue:{},label:String,placeholder:{type:String,default:"Select date"},week:Boolean,range:Boolean,disabled:Boolean,large:Boolean,info:String,doubleMonths:Boolean,clearable:Boolean,minDate:{},maxDate:{},initDates:{},shortcuts:Boolean,slim:Boolean,required:Boolean,hideRequired:Boolean},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e;function i(a){r("update:modelValue",a)}const o=l.computed(()=>{var a;if(n.range)return(a=n.modelValue)==null?void 0:a.map(c=>j(c).format("YYYY-MM-DD")).join(" to ");if(n.modelValue)return j(n.modelValue).format("YYYY-MM-DD")}),s=l.reactive([{text:"Month to Date",onClick(a){const c=j().subtract(1,"day"),d=j().startOf("month");r("update:modelValue",[d,c])}},{text:"Last Month",onClick(a){const c=j().startOf("month").subtract(1,"month"),d=j(c).endOf("month");r("update:modelValue",[c,d])}},{text:"Year to Date",onClick(a){const c=j().subtract(1,"day"),d=j().startOf("year");r("update:modelValue",[d,c])}}]);return(a,c)=>(l.openBlock(),l.createBlock(Sn,{disabled:t.disabled,maxWidth:"1280px"},{content:l.withCtx(()=>[l.createElementVNode("div",vB,[t.shortcuts?(l.openBlock(),l.createElementBlock("div",xB,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(s,d=>(l.openBlock(),l.createElementBlock("div",{class:"opacity-50 hover:opacity-100 dark:text-gray-300 cursor-pointer",onClick:u=>d.onClick()},l.toDisplayString(d.text),9,wB))),256))])):l.createCommentVNode("",!0),l.createVNode(Ya,{shortcuts:"",doubleMonths:t.doubleMonths,initDates:t.initDates,week:t.week,"min-date":t.minDate,"max-date":t.maxDate,modelValue:t.modelValue,"onUpdate:modelValue":i,range:t.range},null,8,["doubleMonths","initDates","week","min-date","max-date","modelValue","range"])])]),default:l.withCtx(()=>{var d;return[l.createVNode(_i,{label:t.label,required:t.required,hideRequired:t.hideRequired,slim:t.slim,disabled:t.disabled,large:t.large,info:t.info,clearable:!!(t.clearable&&((d=o.value)!=null&&d.length)),onOnClear:c[0]||(c[0]=u=>i(null))},{prepend:l.withCtx(()=>[t.range?(l.openBlock(),l.createBlock(Ih,{key:0,class:"dark:text-gray-400"})):(l.openBlock(),l.createBlock(Ph,{key:1,class:"dark:text-gray-400"}))]),default:l.withCtx(()=>[l.createTextVNode(" "+l.toDisplayString(o.value||t.placeholder),1)]),_:1},8,["label","required","hideRequired","slim","disabled","large","info","clearable"])]}),_:1},8,["disabled"]))}}),CB={class:"relative inline-block tabular-nums"},OB=["value","placeholder","maxlength"],Ja={__name:"DateSegment",props:{modelValue:String,placeholder:String,segment:{type:String,default:"monthOrDay"},disabled:Boolean},emits:["update:modelValue","blur"],setup(t,{emit:e}){const n=t,r=e,i=l.ref(null),o=l.computed(()=>n.segment==="year"?4:2);function s(c){const d=c.target.value.replace(/\D/g,"");r("update:modelValue",d.slice(0,o.value)),d.length>=o.value&&n.nextRef&&l.nextTick(()=>{n.nextRef.focus()})}function a(){r("blur")}return(c,d)=>(l.openBlock(),l.createElementBlock("div",CB,[l.createElementVNode("input",{ref_key:"inputRef",ref:i,type:"text",value:t.modelValue,onInput:s,onKeydown:d[0]||(d[0]=(...u)=>c.onKeydown&&c.onKeydown(...u)),onBlur:a,placeholder:t.placeholder,class:l.normalizeClass(["date-segment bg-transparent text-gray-900 dark:text-gray-400 focus:outline-none border-b border-transparent focus:border-gray-800 dark:focus:border-gray-300 transition-all duration-200 ease-in-out hover:bg-gray-50 dark:hover:bg-gray-800 focus:bg-white dark:focus:bg-gray-900 placeholder:opacity-25 placeholder:tracking-wider placeholder:pl-1",{"w-[4ch]":o.value===4,"w-[2ch]":o.value===2}]),inputmode:"numeric",pattern:"\\d*",maxlength:o.value},null,42,OB)]))}},EB={class:"flex items-center gap-0"},MB=l.createElementVNode("span",{class:"px-px"},"/",-1),TB=l.createElementVNode("span",{class:"px-px"},"/",-1),Ga={__name:"DateInput",props:{modelValue:String,disabled:Boolean},emits:["update:modelValue","update:initDates","update:displayYear","update:displayMonth"],setup(t,{emit:e}){const n=t,r=e,i=l.ref(""),o=l.ref(""),s=l.ref(""),a=l.ref(null),c=l.ref(null),d=l.ref(null);l.watch(()=>n.modelValue,k=>{n.range?Array.isArray(k)&&k.length===2?(yearStart.value=k[0]?j(k[0]).format("YYYY"):"",monthStart.value=k[0]?j(k[0]).format("MM"):"",dayStart.value=k[0]?j(k[0]).format("DD"):"",yearEnd.value=k[1]?j(k[1]).format("YYYY"):"",monthEnd.value=k[1]?j(k[1]).format("MM"):"",dayEnd.value=k[1]?j(k[1]).format("DD"):""):(yearStart.value=monthStart.value=dayStart.value="",yearEnd.value=monthEnd.value=dayEnd.value=""):k?(i.value=j(k).format("YYYY"),o.value=j(k).format("MM"),s.value=j(k).format("DD")):i.value=o.value=s.value=""},{immediate:!0});function u(){i.value.length===4&&o.value.length===2&&s.value.length===2&&r("update:modelValue",`${i.value}-${o.value}-${s.value}`)}function f(k){k.length===4&&r("update:displayYear",Number(k)),u()}function h(k){k.length===2&&r("update:displayMonth",Number(k)-1),u()}function p(k){s.value=k,u()}function m(){i.value||(i.value=j().format("YYYY")),u()}function g(){o.value||(o.value=j().format("MM")),u()}function y(){s.value||(s.value=j().format("DD")),u()}return(k,C)=>(l.openBlock(),l.createElementBlock("div",EB,[l.createVNode(Ja,{modelValue:i.value,"onUpdate:modelValue":[C[0]||(C[0]=N=>i.value=N),f],segment:"year",disabled:t.disabled,placeholder:"••••",onBlur:m,ref_key:"yearRef",ref:a},null,8,["modelValue","disabled"]),MB,l.createVNode(Ja,{modelValue:o.value,"onUpdate:modelValue":[C[1]||(C[1]=N=>o.value=N),h],segment:"monthOrDay",disabled:t.disabled,placeholder:"••",onBlur:g,ref_key:"monthRef",ref:c},null,8,["modelValue","disabled"]),TB,l.createVNode(Ja,{modelValue:s.value,"onUpdate:modelValue":[C[2]||(C[2]=N=>s.value=N),p],segment:"monthOrDay",disabled:t.disabled,placeholder:"••",onBlur:y,ref_key:"dayRef",ref:d},null,8,["modelValue","disabled"])]))}},$B={class:"tabular-nums"},NB={key:1,class:"flex items-center"},BB=l.createElementVNode("span",{class:"px-1"},"➞",-1),AB={class:"p-4"},DB={__name:"AdvancedDateField",props:{modelValue:{},label:String,placeholder:{type:String,default:"Select date"},week:Boolean,range:Boolean,disabled:Boolean,large:Boolean,info:String,doubleMonths:Boolean,clearable:Boolean,minDate:{},maxDate:{},initDates:{},shortcuts:Boolean,slim:Boolean,required:Boolean,hideRequired:Boolean},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e;l.ref(!1);function i(){console.log("click")}const o=l.ref(j().year()),s=l.ref(j().month()),a=l.ref(null),c=l.ref(null);function d(){r("update:modelValue",null)}const u=l.ref(n.range?[]:"");l.watch(()=>n.modelValue,h=>{if(n.range){const p=h!=null&&h[0]?j(h[0]).format("YYYY-MM-DD"):"",m=h!=null&&h[1]?j(h[1]).format("YYYY-MM-DD"):"";(u.value[0]!==p||u.value[1]!==m)&&(u.value=[p,m])}else{const p=h?j(h).format("YYYY-MM-DD"):"";u.value!==p&&(u.value=p)}},{immediate:!0}),l.watch(u,h=>{var p,m;if(n.range){const g=h[0]&&h[0].length===10?j(h[0]).toDate():null,y=h[1]&&h[1].length===10?j(h[1]).toDate():null;(!((p=n.modelValue)!=null&&p[0])||n.modelValue[0]!==g||!((m=n.modelValue)!=null&&m[1])||n.modelValue[1]!==y)&&r("update:modelValue",[g,y])}else if(h&&h.length===10){const g=j(h,"YYYY-MM-DD",!0);g.isValid()&&n.modelValue!==g.toDate()&&r("update:modelValue",g.toDate())}});function f(h){r("update:modelValue",h)}return(h,p)=>(l.openBlock(),l.createBlock(Sn,{disabled:t.disabled,maxWidth:"1280px",noCloseClasses:["date-segment"]},{content:l.withCtx(()=>[l.createElementVNode("div",AB,[l.createVNode(Ya,{doubleMonths:t.doubleMonths,displayYearStart:o.value,displayMonthStart:s.value,displayYearEnd:a.value,displayMonthEnd:c.value,initDates:t.initDates,week:t.week,"min-date":t.minDate,"max-date":t.maxDate,modelValue:n.range?[...u.value]:u.value,"onUpdate:modelValue":f,range:t.range},null,8,["doubleMonths","displayYearStart","displayMonthStart","displayYearEnd","displayMonthEnd","initDates","week","min-date","max-date","modelValue","range"])])]),default:l.withCtx(()=>[l.createVNode(_i,{label:t.label,required:t.required,hideRequired:t.hideRequired,slim:t.slim,disabled:t.disabled,large:t.large,info:t.info,clearable:t.clearable&&!!t.modelValue,onOnClear:d,onClick:i},{prepend:l.withCtx(()=>[t.range?(l.openBlock(),l.createBlock(Ih,{key:0,class:"dark:text-gray-400"})):(l.openBlock(),l.createBlock(Ph,{key:1,class:"dark:text-gray-400"}))]),default:l.withCtx(()=>[l.createElementVNode("div",$B,[t.range?t.range?(l.openBlock(),l.createElementBlock("div",NB,[l.createVNode(Ga,{modelValue:u.value[0],"onUpdate:modelValue":p[3]||(p[3]=m=>u.value[0]=m),disabled:!0,"onUpdate:displayYear":p[4]||(p[4]=m=>o.value=m),"onUpdate:displayMonth":p[5]||(p[5]=m=>s.value=m)},null,8,["modelValue"]),BB,l.createVNode(Ga,{modelValue:u.value[1],"onUpdate:modelValue":p[6]||(p[6]=m=>u.value[1]=m),disabled:!0,"onUpdate:displayYear":p[7]||(p[7]=m=>{a.value=m}),"onUpdate:displayMonth":p[8]||(p[8]=m=>{c.value=m})},null,8,["modelValue"])])):(l.openBlock(),l.createElementBlock(l.Fragment,{key:2},[l.createTextVNode(l.toDisplayString(t.placeholder),1)],64)):(l.openBlock(),l.createBlock(Ga,{key:0,modelValue:u.value,"onUpdate:modelValue":p[0]||(p[0]=m=>u.value=m),disabled:!0,"onUpdate:displayYear":p[1]||(p[1]=m=>o.value=m),"onUpdate:displayMonth":p[2]||(p[2]=m=>s.value=m)},null,8,["modelValue"]))])]),_:1},8,["label","required","hideRequired","slim","disabled","large","info","clearable"])]),_:1},8,["disabled"]))}},VB=Object.assign({name:"WpicSlidePanel"},{props:{visible:{type:Boolean,default:!1},backgroundColor:{type:String,default:"bg-white"},options:{type:Object,default:()=>({width:"w-96",mr:"mr-0",zIndex:"z-15"})},expand:Boolean,island:Boolean},emits:["close"],setup(t,{expose:e,emit:n}){const r={pmi:"dark:bg-zinc-800","wpic-tools":"dark:bg-gray-940"},i=n;function o(){i("close")}e({goBottom:c,goTop:a});const s=l.ref(null);function a(){s.value.scrollTop=0}function c(){s.value.scrollTop=s.value.scrollHeight}return(d,u)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["fixed inset-0 h-full flex justify-end bg-black/50 backdrop-blur-xs transition-opacity",{"p-4":t.island,"opacity-0 pointer-events-none":!t.visible,"opacity-100":t.visible,[t.options.mr]:!0,[t.options.zIndex]:!0}]),onClick:l.withModifiers(o,["self"])},[l.createElementVNode("div",{class:l.normalizeClass(["h-full transform-gpu transition-transform",{"rounded-lg":t.island,"translate-x-0":t.visible,"translate-x-full":!t.visible,[t.backgroundColor]:!0,[t.options.width]:!0,[r[l.unref(ne).theme]]:!0}])},[l.createElementVNode("div",{ref_key:"panel",ref:s,class:l.normalizeClass(["h-full overflow-y-auto",{"p-6":!t.expand}])},[l.renderSlot(d.$slots,"default")],2)],2)],2))}}),IB={class:"absolute inset-0 flex items-center justify-center py-12"},PB={class:"text-lg font-medium dark:text-gray-300"},_B={key:0,class:"flex justify-end px-6 pb-4"},RB=Object.assign({name:"WpicDialog"},{props:{title:String,visible:Boolean,large:Boolean,extraLarge:Boolean,smooth:Boolean,expand:Boolean,border:Boolean,high:Boolean,overflow:Boolean},emits:["close"],setup(t,{expose:e,emit:n}){const r=t,i=n;function o(){i("close")}const s=l.ref(null),a=l.ref(!1);function c(){s.value.scrollTop=0}function d(){s.value.scrollTop=s.value.scrollHeight}function u(){s.value&&r.visible&&(a.value=s.value.scrollTop+s.value.clientHeight>=s.value.scrollHeight-20)}return l.onMounted(async()=>{s.value&&(s.value.addEventListener("scroll",u),u())}),l.onBeforeUnmount(()=>{s.value&&s.value.removeEventListener("scroll",u)}),e({goBottom:d,goTop:c,isScrolledToBottom:a}),(f,h)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["",{flex:t.visible,hidden:!t.visible}])},[l.createElementVNode("div",IB,[l.createElementVNode("div",{class:"absolute inset-0 bg-black/10 dark:bg-black/75 z-10",onClick:o}),l.createElementVNode("div",{class:l.normalizeClass(["relative flex flex-col justify-between bg-white dark:border dark:border-gray-900 dark:bg-gray-940 rounded-lg z-20 max-h-full",{"w-3/5":t.large,"w-4/5":t.extraLarge,"w-192":!t.large&&!t.extraLarge,"h-full":t.high,"overflow-hidden":!t.overflow}])},[l.createElementVNode("div",{class:l.normalizeClass(["px-6 pt-4 pb-4 flex items-center justify-between",{"border-b pb-3 dark:border-gray-900":t.border}])},[l.createElementVNode("span",PB,l.toDisplayString(t.title),1),l.createElementVNode("span",{class:"cursor-pointer",onClick:o},[l.createVNode(Hr,{class:"w-6 h-6"})])],2),l.createElementVNode("div",{ref_key:"panel",ref:s,class:l.normalizeClass(["flex-1 overflow-y-auto",{"p-6":!t.expand,"scroll-smooth":t.smooth}])},[l.renderSlot(f.$slots,"default")],2),f.$slots.buttons?(l.openBlock(),l.createElementBlock("div",_B,[l.renderSlot(f.$slots,"buttons")])):l.createCommentVNode("",!0)],2)])],2))}}),LB={class:"wpic-tabs flex border-b-2 dark:border-gray-930 overflow-x-auto overflow-y-hidden"},zB=["onClick"],FB=Object.assign({name:"WpicTabs"},{props:{modelValue:{type:String,required:!0},nowrap:Boolean},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=l.ref([]),o=c=>{r("update:modelValue",c)},s=c=>{i.value.push(c)},a=l.computed(()=>n.modelValue);return l.provide("addTab",s),l.provide("modelValue",a),(c,d)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("div",LB,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(i.value,u=>(l.openBlock(),l.createElementBlock("div",{key:u.name,class:l.normalizeClass(["border-b items-center flex leading-snug cursor-pointer py-3 px-6 -mb-[2px] font-medium",{"dark:border-gray-930":u.name!=t.modelValue,"border-b-2 text-lime-500 border-b-lime-500 dark:text-lime-600 dark:border-b-lime-600":u.name===t.modelValue,"text-gray-500 dark:text-gray-500":!u.disabled,"text-gray-300 dark:text-gray-700":u.disabled}]),onClick:f=>u.disabled?null:o(u.name)},[l.renderSlot(c.$slots,"label",{},()=>[l.createElementVNode("span",{class:l.normalizeClass({"whitespace-nowrap text-ellipsis overflow-hidden":t.nowrap})},l.toDisplayString(u.label),3)])],10,zB))),128))]),l.createElementVNode("div",null,[l.renderSlot(c.$slots,"default")])],64))}}),jB=Object.assign({name:"WpicTabPane"},{props:{label:{type:String,required:!0},name:{type:String,required:!0},noStyle:Boolean,disabled:Boolean},setup(t){const e=t,n=l.ref(!1),r=l.inject("addTab"),i=l.inject("modelValue");return l.onMounted(()=>{r({label:e.label,name:e.name,disabled:e.disabled})}),l.watch(()=>i.value,o=>{n.value=o===e.name},{immediate:!0,deep:!0}),(o,s)=>n.value?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["wpic-tab-pane",{"py-3 px-6":!t.noStyle}])},[l.renderSlot(o.$slots,"default")],2)):l.createCommentVNode("",!0)}}),HB={},WB={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},qB=[l.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"},null,-1)];function UB(t,e){return l.openBlock(),l.createElementBlock("svg",WB,qB)}const KB=ue(HB,[["render",UB]]),YB={},JB={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},GB=[l.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"},null,-1)];function ZB(t,e){return l.openBlock(),l.createElementBlock("svg",JB,GB)}const XB=ue(YB,[["render",ZB]]),QB={},eA={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},tA=[l.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"},null,-1)];function nA(t,e){return l.openBlock(),l.createElementBlock("svg",eA,tA)}const rA=ue(QB,[["render",nA]]),iA={},oA={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},sA=[l.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"},null,-1)];function aA(t,e){return l.openBlock(),l.createElementBlock("svg",oA,sA)}const lA=ue(iA,[["render",aA]]),cA={class:"w-6"},dA={class:"flex-1"},uA={key:0,class:"mb-2"},fA=Object.assign({name:"WpicAlert"},{props:{title:String,text:String,warning:Boolean,success:Boolean,error:Boolean,info:Boolean},setup(t){return(e,n)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["px-4 py-3 rounded-sm text-base flex gap-4",{"bg-gray-50 text-gray-900 dark:text-gray-200 dark:bg-gray-950 text-opacity-75":!t.warning&&!t.info&&!t.error&&!t.success,"bg-amber-50 text-yellow-950 dark:text-yellow-100 dark:bg-yellow-950 text-opacity-75":t.warning,"bg-blue-50 text-blue-950 dark:text-blue-200 dark:bg-blue-950 text-opacity-75":t.info,"bg-red-100 text-red-950 dark:text-red-200 dark:bg-red-950 text-opacity-75":t.error,"bg-green-50 text-green-950 dark:text-green-200 dark:bg-green-950 text-opacity-75":t.success}])},[l.createElementVNode("div",cA,[t.warning?(l.openBlock(),l.createBlock(KB,{key:0,class:"w-full aspect-square"})):t.info?(l.openBlock(),l.createBlock(XB,{key:1,class:"w-full aspect-square"})):t.success?(l.openBlock(),l.createBlock(rA,{key:2,class:"w-full aspect-square"})):t.error?(l.openBlock(),l.createBlock(lA,{key:3,class:"w-full aspect-square"})):l.createCommentVNode("",!0)]),l.createElementVNode("div",dA,[t.title?(l.openBlock(),l.createElementBlock("div",uA,l.toDisplayString(t.title),1)):l.createCommentVNode("",!0),l.createElementVNode("span",{class:l.normalizeClass(["",{"text-gray-950 dark:text-gray-200 text-opacity-75":!t.warning&&!t.info&&!t.error&&!t.success,"text-yellow-950 dark:text-yellow-100 text-opacity-75":t.warning,"text-blue-950 dark:text-blue-200 text-opacity-75":t.info,"text-red-950 dark:text-red-200 text-opacity-75":t.error,"text-green-950 dark:text-green-200 text-opacity-75":t.success}])},[l.renderSlot(e.$slots,"default",{},()=>[l.createTextVNode(l.toDisplayString(t.text),1)])],2)])],2))}}),Za=l.ref(!1),_h=l.ref(""),Rh=l.ref(""),Lh=l.ref(!1),zh=l.ref(!1);let Fh=()=>{},jh=()=>{};function Xa(){const t=({title:i,text:o,positive:s=!1,negative:a=!1,onConfirm:c,onCancel:d})=>{_h.value=i,Rh.value=o,Lh.value=s,zh.value=a,Fh=c||(()=>{}),jh=d||(()=>{}),Za.value=!0},e=()=>{Za.value=!1};return{visible:Za,title:_h,text:Rh,positive:Lh,negative:zh,show:t,onConfirm:()=>{Fh(),e()},onCancel:()=>{jh(),e()}}}const hA={key:0,class:"confirm-modal-overlay z-40"},pA={class:"bg-white dark:border dark:border-gray-900 dark:bg-gray-940 p-6 rounded-lg w-128 flex flex-col"},mA={class:"text-lg font-semibold mb-6"},gA={class:"mb-12"},yA={class:"flex justify-end"},Qa={WpicAlert:fA,WpicAdvDateField:DB,WpicCalendar:Ya,WpicTextarea:jc,WpicDialog:RB,WpicSlidePanel:VB,WpicDateField:SB,WpicFormInput:_i,WpicButton:Ni,WpicBadge:XN,WpicTextEditor:PN,WpicInputGroup:km,WpicButtonGroup:mm,WpicForm:vm,WpicFormField:Hc,WpicSpinner:Kn,WpicTooltip:Wc,WpicPopover:Sn,WpicChoiceList:Fc,WpicCard:bw,WpicCardSection:xw,WpicProgressBar:Cw,WpicTag:Ew,WpicTagGroup:Mw,WpicPagination:Qw,WpicLoadingPanel:Bw,WpicTable:wS,WpicTableColumn:SS,WpicTabs:FB,WpicTabPane:jB,WpicConfirm:ue(Object.assign({name:"WpicConfirm"},{setup(t){const{visible:e,title:n,text:r,positive:i,negative:o,onConfirm:s,onCancel:a}=Xa();return(c,d)=>l.unref(e)?(l.openBlock(),l.createElementBlock("div",hA,[l.createElementVNode("div",pA,[l.createElementVNode("div",mA,l.toDisplayString(l.unref(n)),1),l.createElementVNode("div",gA,l.toDisplayString(l.unref(r)),1),l.createElementVNode("div",yA,[l.createVNode(Ni,{onClick:l.unref(a)},{default:l.withCtx(()=>[l.createTextVNode("Cancel")]),_:1},8,["onClick"]),l.createVNode(Ni,{primary:l.unref(i),destructive:l.unref(o),onClick:l.unref(s)},{default:l.withCtx(()=>[l.createTextVNode("Confirm")]),_:1},8,["primary","destructive","onClick"])])])])):l.createCommentVNode("",!0)}}),[["__scopeId","data-v-613542ab"]])};function Hh(t,e){for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(typeof e[n]=="object"&&t[n]?Hh(t[n],e[n]):t[n]=e[n])}const bA={useConfirm:Xa};function kA(t,e){Hh(ne,e);for(const n in Qa)if(Qa.hasOwnProperty(n)){const r=Qa[n];t.component(r.name,r)}}const vA={install:kA,composables:bA,options:ne};Jt.default=vA,Jt.useConfirm=Xa,Object.defineProperties(Jt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
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 EN(t,e){return l.openBlock(),l.createElementBlock("svg",CN,ON)}const MN=ue(SN,[["render",EN]]),TN={},$N={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},NN=[l.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 BN(t,e){return l.openBlock(),l.createElementBlock("svg",$N,NN)}const AN=ue(TN,[["render",BN]]),DN={class:"py-1 px-1 border-b"},VN={class:"flex gap-px"},IN=["onClick"],PN={key:1,class:"text-sm"},_N={class:"max-h-72 w-full overflow-auto px-4 py-3"},RN=Object.assign({name:"WpicTextEditor"},{props:{modelValue:{type:String,default:""}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r={pmi:"shadow-inner border-zinc-400 dark:border-zinc-700/50 focus-within:border-zinc-500 focus-within:outline focus-within:outline-2 focus-within:outline-offset-3 dark:text-zinc-300 bg-zinc-100 dark:bg-zinc-700/25","wpic-tools":"bg-white border border-gray-300"},i=[{method:"toggleBold",type:"chain",label:"bold",icon:wN,smallIcon:!0,disableCheck:!0},{method:"toggleItalic",type:"chain",label:"italic",icon:yN,smallIcon:!0,disableCheck:!0},{method:"setParagraph",type:"chain",label:"paragraph",icon:MN,smallIcon:!0,disableCheck:!1},{method:"toggleBulletList",type:"chain",label:"bullet list",icon:Z$,disableCheck:!1},{method:"toggleOrderedList",type:"chain",label:"ordered list",icon:nN,disableCheck:!1},{method:"undo",type:"chain",label:"undo",icon:aN,disableCheck:!0},{method:"redo",type:"chain",label:"redo",icon:fN,disableCheck:!0},{method:"redo",type:"chain",label:"redo",icon:AN,disableCheck:!0}],o=e,s=qT({content:n.modelValue,extensions:[q$,U$.configure({placeholder:"..."})],onUpdate:()=>{o("update:modelValue",s.value.getHTML())}});l.onBeforeUnmount(()=>{s.value.destroy()}),l.watch(()=>n.modelValue,d=>{d!==s.value.getHTML()&&s.value.commands.setContent(d,!1)});function a(d,u,f){u==="chain"?f?s.value.chain().focus()[d](f).run():s.value.chain().focus()[d]().run():this.editor[d]()()}function c(d,u,f,h){return h?u==="chain"?f?!s.value.can().chain().focus()[d](f).run():!s.value.can().chain().focus()[d]().run():!s.value.can()[d]().run():!1}return(d,u)=>l.unref(s)?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["pt-px relative flex flex-col rounded-sm border",r[l.unref(re).theme]])},[l.createElementVNode("div",DN,[l.createElementVNode("div",VN,[(l.openBlock(),l.createElementBlock(l.Fragment,null,l.renderList(i,f=>l.createElementVNode("div",{key:f.method,class:l.normalizeClass(["w-8 h-8 flex items-center justify-center text-xs rounded-sm",{"cursor-pointer":!c(f.method,f.type,f.params,f.disableCheck),"is-active text-white bg-zinc-200!":l.unref(s).isActive(f.label)}]),onClick:h=>a(f.method,f.type,f.params)},[f.icon?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(f.icon),{key:0,class:l.normalizeClass(["",{"w-3 h-3":f.smallIcon,"w-4 h-4":!f.smallIcon}])},null,8,["class"])):(l.openBlock(),l.createElementBlock("span",PN,l.toDisplayString(l.unref(dg).capitalize(f.label)),1))],10,IN)),64))])]),l.createElementVNode("div",_N,[l.createVNode(l.unref(WT),{editor:l.unref(s)},null,8,["editor"])])],2)):l.createCommentVNode("",!0)}}),LN={},zN={viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},FN=[l.createElementVNode("rect",{x:"2",y:"2",width:"20",height:"20",rx:"7",fill:"currentColor","stroke-width":"2.5"},null,-1)];function jN(t,e){return l.openBlock(),l.createElementBlock("svg",zN,FN)}const HN=ue(LN,[["render",jN]]),WN={},qN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"none"},UN=[l.createElementVNode("rect",{x:"2",y:"2",width:"20",height:"20",rx:"7",fill:"none",stroke:"currentColor","stroke-width":"3"},null,-1)];function KN(t,e){return l.openBlock(),l.createElementBlock("svg",qN,UN)}const YN=ue(WN,[["render",KN]]),JN={},GN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none"},ZN=[l.createElementVNode("rect",{x:"2",y:"2",width:"20",height:"20",rx:"7",fill:"none",stroke:"currentColor","stroke-width":"3"},null,-1),l.createElementVNode("line",{x1:"7.5",y1:"2",x2:"22",y2:"16",stroke:"currentColor",class:"opacity-75","stroke-width":"2.5"},null,-1),l.createElementVNode("line",{x1:"2",y1:"7.5",x2:"16",y2:"22",stroke:"currentColor",class:"opacity-75","stroke-width":"2.5"},null,-1)];function XN(t,e){return l.openBlock(),l.createElementBlock("svg",GN,ZN)}const QN=ue(JN,[["render",XN]]),eB=Object.assign({name:"WpicBadge"},{props:{success:Boolean,warning:Boolean,error:Boolean,complete:Boolean,incomplete:Boolean,partially:Boolean},setup(t){return(e,n)=>(l.openBlock(),l.createElementBlock("span",{class:l.normalizeClass(["inline-flex items-center justify-center border-0 font-normal rounded-md min-h-6 gap-1 leading-none text-sm px-2",{"bg-green-100 border-green-200 text-green-700 dark:border-green-600/30 dark:bg-green-800/15 dark:text-green-500/85":t.success,"bg-yellow-100 border-yellow-200 text-yellow-700 dark:border-yellow-600/30 dark:bg-yellow-800/15 dark:text-yellow-500/85":t.warning,"bg-red-100 border-red-200 text-red-700 dark:border-red-600/30 dark:bg-red-800/15 dark:text-red-500/85":t.error,"bg-gray-100 border-gray-200 text-gray-700 dark:border-gray-600/30 dark:bg-white/5 dark:text-gray-400/85":!t.success&&!t.warning&&!t.error}])},[t.complete?(l.openBlock(),l.createBlock(HN,{key:0,class:"w-2.5 h-2.5"})):l.createCommentVNode("",!0),t.incomplete?(l.openBlock(),l.createBlock(YN,{key:1,class:"w-2.5 h-2.5 opacity-80"})):l.createCommentVNode("",!0),t.partially?(l.openBlock(),l.createBlock(QN,{key:2,class:"w-2.5 h-2.5 opacity-80"})):l.createCommentVNode("",!0),l.renderSlot(e.$slots,"default")],2))}}),Ya={__name:"DayItem",props:{day:{},today:Boolean,selected:Boolean,between:Boolean,firstDay:Boolean,lastDay:Boolean,off:Boolean,disabled:Boolean,highlight:Boolean},setup(t){const e={pmi:"","wpic-tools":`
121
+ hover:text-lime-500
122
+ rounded-full
123
+
124
+ group-[.is-today]:text-lime-500
125
+ group-[.is-today]:font-medium
126
+ group-[.is-selected]:bg-lime-500
127
+ group-[.is-selected]:!text-white
128
+ dark:group-[.is-selected]:bg-lime-600
129
+
130
+ group-[.is-off]:text-gray-300
131
+ dark:group-[.is-off]:text-gray-800
132
+
133
+ `},n={pmi:"","wpic-tools":"group-[.is-highlight]:bg-gray-200"},r={pmi:"","wpic-tools":"bg-gray-100 dark:bg-gray-800"},i={pmi:"","wpic-tools":"bg-gray-100 dark:bg-gray-800 rounded-l-0"},o={pmi:"","wpic-tools":"bg-gray-100 dark:bg-gray-800 rounded-r-0"},s={pmi:"","wpic-tools":"bg-gray-200"};return(a,c)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["relative flex items-center justify-center text-sm py-2 group",{"is-today":t.today&&!t.selected,"is-selected":t.selected&&!t.off,"is-off":t.off,"is-highlight":t.highlight,"cursor-pointer":!t.disabled}])},[l.createElementVNode("div",{class:l.normalizeClass(["h-8 w-full flex justify-center items-center",{[`${r[l.unref(re).theme]}`]:t.between,[`${i[l.unref(re).theme]}`]:t.firstDay,[`${o[l.unref(re).theme]}`]:t.lastDay,[`${s[l.unref(re).theme]}`]:t.highlight}]),style:l.normalizeStyle({marginLeft:t.firstDay?"50%":void 0,marginRight:t.lastDay?"50%":void 0})},[l.createElementVNode("span",{class:l.normalizeClass(["absolute w-8 h-8 flex items-center justify-center dark:text-gray-400",{[`${e[l.unref(re).theme]}`]:!0,[`${n[l.unref(re).theme]}`]:t.highlight&&(t.firstDay||t.lastDay)}]),style:{left:"50%",transform:"translateX(-50%)"}},[l.renderSlot(a.$slots,"default",{},()=>[l.createTextVNode(l.toDisplayString(t.day),1)])],2)],6)],2))}};var Vh={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(Cn,function(){var n=1e3,r=6e4,i=36e5,o="millisecond",s="second",a="minute",c="hour",d="day",u="week",f="month",h="quarter",p="year",m="date",y="Invalid Date",g=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,k=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(L){var I=["th","st","nd","rd"],T=L%100;return"["+L+(I[(T-20)%10]||I[T]||I[0])+"]"}},N=function(L,I,T){var v=String(L);return!v||v.length>=I?L:""+Array(I+1-v.length).join(T)+L},b={s:N,z:function(L){var I=-L.utcOffset(),T=Math.abs(I),v=Math.floor(T/60),M=T%60;return(I<=0?"+":"-")+N(v,2,"0")+":"+N(M,2,"0")},m:function L(I,T){if(I.date()<T.date())return-L(T,I);var v=12*(T.year()-I.year())+(T.month()-I.month()),M=I.clone().add(v,f),V=T-M<0,U=I.clone().add(v+(V?-1:1),f);return+(-(v+(T-M)/(V?M-U:U-M))||0)},a:function(L){return L<0?Math.ceil(L)||0:Math.floor(L)},p:function(L){return{M:f,y:p,w:u,d,D:m,h:c,m:a,s,ms:o,Q:h}[L]||String(L||"").toLowerCase().replace(/s$/,"")},u:function(L){return L===void 0}},S="en",x={};x[S]=C;var $="$isDayjsObject",D=function(L){return L instanceof F||!(!L||!L[$])},A=function L(I,T,v){var M;if(!I)return S;if(typeof I=="string"){var V=I.toLowerCase();x[V]&&(M=V),T&&(x[V]=T,M=V);var U=I.split("-");if(!M&&U.length>1)return L(U[0])}else{var j=I.name;x[j]=I,M=j}return!v&&M&&(S=M),M||!v&&S},B=function(L,I){if(D(L))return L.clone();var T=typeof I=="object"?I:{};return T.date=L,T.args=arguments,new F(T)},P=b;P.l=A,P.i=D,P.w=function(L,I){return B(L,{locale:I.$L,utc:I.$u,x:I.$x,$offset:I.$offset})};var F=function(){function L(T){this.$L=A(T.locale,null,!0),this.parse(T),this.$x=this.$x||T.x||{},this[$]=!0}var I=L.prototype;return I.parse=function(T){this.$d=function(v){var M=v.date,V=v.utc;if(M===null)return new Date(NaN);if(P.u(M))return new Date;if(M instanceof Date)return new Date(M);if(typeof M=="string"&&!/Z$/i.test(M)){var U=M.match(g);if(U){var j=U[2]-1||0,Q=(U[7]||"0").substring(0,3);return V?new Date(Date.UTC(U[1],j,U[3]||1,U[4]||0,U[5]||0,U[6]||0,Q)):new Date(U[1],j,U[3]||1,U[4]||0,U[5]||0,U[6]||0,Q)}}return new Date(M)}(T),this.init()},I.init=function(){var T=this.$d;this.$y=T.getFullYear(),this.$M=T.getMonth(),this.$D=T.getDate(),this.$W=T.getDay(),this.$H=T.getHours(),this.$m=T.getMinutes(),this.$s=T.getSeconds(),this.$ms=T.getMilliseconds()},I.$utils=function(){return P},I.isValid=function(){return this.$d.toString()!==y},I.isSame=function(T,v){var M=B(T);return this.startOf(v)<=M&&M<=this.endOf(v)},I.isAfter=function(T,v){return B(T)<this.startOf(v)},I.isBefore=function(T,v){return this.endOf(v)<B(T)},I.$g=function(T,v,M){return P.u(T)?this[v]:this.set(M,T)},I.unix=function(){return Math.floor(this.valueOf()/1e3)},I.valueOf=function(){return this.$d.getTime()},I.startOf=function(T,v){var M=this,V=!!P.u(v)||v,U=P.p(T),j=function(oe,he){var be=P.w(M.$u?Date.UTC(M.$y,he,oe):new Date(M.$y,he,oe),M);return V?be:be.endOf(d)},Q=function(oe,he){return P.w(M.toDate()[oe].apply(M.toDate("s"),(V?[0,0,0,0]:[23,59,59,999]).slice(he)),M)},de=this.$W,se=this.$M,ye=this.$D,W="set"+(this.$u?"UTC":"");switch(U){case p:return V?j(1,0):j(31,11);case f:return V?j(1,se):j(0,se+1);case u:var X=this.$locale().weekStart||0,fe=(de<X?de+7:de)-X;return j(V?ye-fe:ye+(6-fe),se);case d:case m:return Q(W+"Hours",0);case c:return Q(W+"Minutes",1);case a:return Q(W+"Seconds",2);case s:return Q(W+"Milliseconds",3);default:return this.clone()}},I.endOf=function(T){return this.startOf(T,!1)},I.$set=function(T,v){var M,V=P.p(T),U="set"+(this.$u?"UTC":""),j=(M={},M[d]=U+"Date",M[m]=U+"Date",M[f]=U+"Month",M[p]=U+"FullYear",M[c]=U+"Hours",M[a]=U+"Minutes",M[s]=U+"Seconds",M[o]=U+"Milliseconds",M)[V],Q=V===d?this.$D+(v-this.$W):v;if(V===f||V===p){var de=this.clone().set(m,1);de.$d[j](Q),de.init(),this.$d=de.set(m,Math.min(this.$D,de.daysInMonth())).$d}else j&&this.$d[j](Q);return this.init(),this},I.set=function(T,v){return this.clone().$set(T,v)},I.get=function(T){return this[P.p(T)]()},I.add=function(T,v){var M,V=this;T=Number(T);var U=P.p(v),j=function(se){var ye=B(V);return P.w(ye.date(ye.date()+Math.round(se*T)),V)};if(U===f)return this.set(f,this.$M+T);if(U===p)return this.set(p,this.$y+T);if(U===d)return j(1);if(U===u)return j(7);var Q=(M={},M[a]=r,M[c]=i,M[s]=n,M)[U]||1,de=this.$d.getTime()+T*Q;return P.w(de,this)},I.subtract=function(T,v){return this.add(-1*T,v)},I.format=function(T){var v=this,M=this.$locale();if(!this.isValid())return M.invalidDate||y;var V=T||"YYYY-MM-DDTHH:mm:ssZ",U=P.z(this),j=this.$H,Q=this.$m,de=this.$M,se=M.weekdays,ye=M.months,W=M.meridiem,X=function(he,be,Oe,ut){return he&&(he[be]||he(v,V))||Oe[be].slice(0,ut)},fe=function(he){return P.s(j%12||12,he,"0")},oe=W||function(he,be,Oe){var ut=he<12?"AM":"PM";return Oe?ut.toLowerCase():ut};return V.replace(k,function(he,be){return be||function(Oe){switch(Oe){case"YY":return String(v.$y).slice(-2);case"YYYY":return P.s(v.$y,4,"0");case"M":return de+1;case"MM":return P.s(de+1,2,"0");case"MMM":return X(M.monthsShort,de,ye,3);case"MMMM":return X(ye,de);case"D":return v.$D;case"DD":return P.s(v.$D,2,"0");case"d":return String(v.$W);case"dd":return X(M.weekdaysMin,v.$W,se,2);case"ddd":return X(M.weekdaysShort,v.$W,se,3);case"dddd":return se[v.$W];case"H":return String(j);case"HH":return P.s(j,2,"0");case"h":return fe(1);case"hh":return fe(2);case"a":return oe(j,Q,!0);case"A":return oe(j,Q,!1);case"m":return String(Q);case"mm":return P.s(Q,2,"0");case"s":return String(v.$s);case"ss":return P.s(v.$s,2,"0");case"SSS":return P.s(v.$ms,3,"0");case"Z":return U}return null}(he)||U.replace(":","")})},I.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},I.diff=function(T,v,M){var V,U=this,j=P.p(v),Q=B(T),de=(Q.utcOffset()-this.utcOffset())*r,se=this-Q,ye=function(){return P.m(U,Q)};switch(j){case p:V=ye()/12;break;case f:V=ye();break;case h:V=ye()/3;break;case u:V=(se-de)/6048e5;break;case d:V=(se-de)/864e5;break;case c:V=se/i;break;case a:V=se/r;break;case s:V=se/n;break;default:V=se}return M?V:P.a(V)},I.daysInMonth=function(){return this.endOf(f).$D},I.$locale=function(){return x[this.$L]},I.locale=function(T,v){if(!T)return this.$L;var M=this.clone(),V=A(T,v,!0);return V&&(M.$L=V),M},I.clone=function(){return P.w(this.$d,this)},I.toDate=function(){return new Date(this.valueOf())},I.toJSON=function(){return this.isValid()?this.toISOString():null},I.toISOString=function(){return this.$d.toISOString()},I.toString=function(){return this.$d.toUTCString()},L}(),G=F.prototype;return B.prototype=G,[["$ms",o],["$s",s],["$m",a],["$H",c],["$W",d],["$M",f],["$y",p],["$D",m]].forEach(function(L){G[L[1]]=function(I){return this.$g(I,L[0],L[1])}}),B.extend=function(L,I){return L.$i||(L(I,F,B),L.$i=!0),B},B.locale=A,B.isDayjs=D,B.unix=function(L){return B(1e3*L)},B.en=x[S],B.Ls=x,B.p={},B})})(Vh);var tB=Vh.exports;const H=Wr(tB);var Ih={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(Cn,function(){var n="week",r="year";return function(i,o,s){var a=o.prototype;a.week=function(c){if(c===void 0&&(c=null),c!==null)return this.add(7*(c-this.week()),"day");var d=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var u=s(this).startOf(r).add(1,r).date(d),f=s(this).endOf(n);if(u.isBefore(f))return 1}var h=s(this).startOf(r).date(d).startOf(n).subtract(1,"millisecond"),p=this.diff(h,n,!0);return p<0?s(this).startOf("week").week():Math.ceil(p)},a.weeks=function(c){return c===void 0&&(c=null),this.week(c)}}})})(Ih);var nB=Ih.exports;const rB=Wr(nB);var Ph={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(Cn,function(){return function(n,r,i){r.prototype.isBetween=function(o,s,a,c){var d=i(o),u=i(s),f=(c=c||"()")[0]==="(",h=c[1]===")";return(f?this.isAfter(d,a):!this.isBefore(d,a))&&(h?this.isBefore(u,a):!this.isAfter(u,a))||(f?this.isBefore(d,a):!this.isAfter(d,a))&&(h?this.isAfter(u,a):!this.isBefore(u,a))}}})})(Ph);var iB=Ph.exports;const oB=Wr(iB),sB={class:"w-full dark:text-gray-400"},aB={class:"flex justify-between items-center mb-3"},lB={class:"flex"},cB={class:"font-medium"},dB={class:"flex"},uB={class:"grid grid-cols-7 border-b dark:border-gray-800 mb-2 pb-2"},fB={class:"flex justify-center text-sm"},Ja=Object.assign({name:"WpicCalendar"},{props:{modelValue:{},range:Boolean,doubleMonths:Boolean,displayYearStart:Number,displayMonthStart:Number,displayYearEnd:Number,displayMonthEnd:Number,maxDate:{},minDate:{},week:Boolean,initDates:{}},emits:["update:modelValue"],setup(t,{emit:e}){H.extend(oB),H.extend(rB);const n=t,r=l.ref([H(new Date).subtract(1,"month"),H(new Date)]);l.watch(()=>n.initDates,()=>{var v;if(!n.range&&n.initDates)r.value[0]=H(n.initDates);else if(!n.range&&!n.initDates)r.value[0]=H(new Date);else if(n.range&&((v=n.initDates)==null?void 0:v.length)===2){let M=H(n.initDates[0]),V=H(n.initDates[1]);V.isBefore(M,"month")&&(V=M.add(1,"month")),M.isSame(V,"month")&&(V=M.add(1,"month")),r.value=[M,V]}},{immediate:!0,once:!0}),l.watch(()=>[n.displayYearStart,n.displayMonthStart],([v,M])=>{v&&M&&(r.value[0]=H().year(Number(v)).month(Number(M)).startOf("month"),r.value[1]=H().year(Number(v)).month(Number(M)).startOf("month").add(1,"month"))},{immediate:!0}),l.watch(()=>[n.displayYearEnd,n.displayMonthEnd],([v,M])=>{if(v&&M){const V=r.value[0],U=H().year(Number(v)).month(Number(M)).startOf("month");U.isAfter(V,"month")&&(r.value[1]=U)}},{immediate:!0});const i=e,o=l.computed(()=>n.doubleMonths||n.range?[0,1]:[0]);function s(v){if(n.week)i("update:modelValue",[H(v).startOf("week"),H(v).endOf("week")]);else if(n.range){const M=n.modelValue.filter(V=>V).length;if(M==0)i("update:modelValue",[v]);else if(M==2)i("update:modelValue",[v]);else if(M==1){let V=[H(n.modelValue[0]),H(v)];V=V.sort((U,j)=>U-j),i("update:modelValue",V)}}else i("update:modelValue",H(v))}function a(v){const M=H(v).daysInMonth(),V=[],U=H(v).startOf("month");for(let j=1;j<=M;j++){let Q=U.clone().date(j);V.push(Q)}return V}function c(v){return H(v).startOf("month").day()}function d(v,M){const V=H(`${v}-${M}-01`,"YYYY-MM-DD"),j=V.day(),Q=[];for(let de=0;de<j;de++)Q.push(V.clone().subtract(j-de,"days"));return Q}function u(v,M){const V=H(`${v}-${M}`,"YYYY-MM").endOf("month"),j=6-V.day(),Q=[];for(let de=1;de<=j;de++)Q.push(V.clone().add(de,"days"));return Q}function f(v){const M=H();return H(v).isSame(M,"day")}function h(v){var M,V;if(n.range){if(((M=n.modelValue)==null?void 0:M.length)==1)return H(v).isSame(H(n.modelValue[0]),"day");if(((V=n.modelValue)==null?void 0:V.length)==2)return H(v).isSame(H(n.modelValue[0]),"day")||H(v).isSame(H(n.modelValue[1]),"day")}else if(n.modelValue)return H(v).isSame(H(n.modelValue),"day")}function p(v){var M;if(n.range&&((M=n.modelValue)==null?void 0:M.length)==2)return H(v).isBetween(H(n.modelValue[0]),H(n.modelValue[1]))}function m(v){var M;if(n.range&&((M=n.modelValue)==null?void 0:M.length)==2)return H(v).isSame(H(n.modelValue[0]),"day")}function y(v){var M;if(n.range&&((M=n.modelValue)==null?void 0:M.length)==2)return H(v).isSame(H(n.modelValue[1]),"day")}function g(v){try{return n.minDate?H(v).isBefore(H(n.minDate)):!1}catch(M){return console.log(M),!1}}function k(v){try{return n.maxDate?H(v).isAfter(H(n.maxDate)):!1}catch(M){return console.log(M),!1}}function C(v){B(v,r.value[v].subtract(1,"month"))}function N(v){B(v,r.value[v].add(1,"month"))}function b(v){B(v,r.value[v].subtract(1,"year"))}function S(v){B(v,r.value[v].add(1,"year"))}const x=v=>v===0?!0:r.value[v].subtract(1,"month").isAfter(r.value[0],"month"),$=v=>v===1?!0:r.value[v].add(1,"month").isBefore(r.value[1],"month"),D=v=>v===0?!0:r.value[v].subtract(1,"year").isAfter(r.value[0],"year"),A=v=>v===1?!0:r.value[v].add(1,"year").isBefore(r.value[1],"year");function B(v,M){if(v===0){if(!M.isBefore(r.value[1],"month"))return;r.value=[M,r.value[1]]}else{if(!M.isAfter(r.value[0],"month"))return;(M.isBefore(r.value[0],"month")||M.isSame(r.value[0],"month"))&&(M=r.value[0].add(1,"month")),r.value=[r.value[0],M]}}const P=l.ref();function F(v){n.week&&(P.value=H(v).week())}function G(v){return H(v).week()===P.value}function L(v){return H(v).week()===P.value?H(v).format("YYYY-MM-DD")===H().week(P.value).startOf("week").format("YYYY-MM-DD"):!1}function I(v){return H(v).week()===P.value?H(v).format("YYYY-MM-DD")===H().week(P.value).endOf("week").format("YYYY-MM-DD"):!1}function T(){P.value=null}return(v,M)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["shrink-0 flex gap-6",{"min-w-96":o.value.length===1,"min-w-192":o.value.length===2}])},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(o.value,V=>{var U;return l.openBlock(),l.createElementBlock("div",sB,[l.createElementVNode("div",aB,[l.createElementVNode("div",lB,[l.createVNode(Kc,{class:l.normalizeClass(["w-5 h-5 cursor-pointer select-none",{"opacity-25 cursor-not-allowed":!D(V),"hover:opacity-100":D(V)}]),onClick:j=>D(V)?b(V):null},null,8,["class","onClick"]),l.createVNode(Yc,{class:l.normalizeClass(["w-5 h-5 cursor-pointer select-none",{"opacity-25 cursor-not-allowed":!x(V),"hover:opacity-100":x(V)}]),onClick:j=>x(V)?C(V):null},null,8,["class","onClick"])]),l.createElementVNode("div",cB,l.toDisplayString(r.value[V].format("YYYY MMMM")),1),l.createElementVNode("div",dB,[l.createVNode(Gc,{class:l.normalizeClass(["w-5 h-5 cursor-pointer select-none",{"opacity-25 cursor-not-allowed":!$(V),"hover:opacity-100":$(V)}]),onClick:j=>$(V)?N(V):null},null,8,["class","onClick"]),l.createVNode(Jc,{class:l.normalizeClass(["w-5 h-5 cursor-pointer select-none",{"opacity-25 cursor-not-allowed":!A(V),"hover:opacity-100":A(V)}]),onClick:j=>A(V)?S(V):null},null,8,["class","onClick"])])]),l.createElementVNode("div",uB,[(l.openBlock(),l.createElementBlock(l.Fragment,null,l.renderList(7,j=>{var Q;return l.createElementVNode("div",fB,l.toDisplayString((Q=r.value[V])==null?void 0:Q.clone().startOf("week").subtract(1,"days").add(j,"days").format("ddd")),1)}),64))]),l.createElementVNode("div",{class:"grid grid-cols-7",onMouseout:T},[c(r.value[V])>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(d(l.unref(H)(r.value[V]).year(),l.unref(H)(r.value[V]).month()+1),j=>(l.openBlock(),l.createBlock(Ya,{onClick:Q=>!k(j)&&!g(j)?s(j):null,off:""},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(H)(j).format("D")),1)]),_:2},1032,["onClick"]))),256)):l.createCommentVNode("",!0),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(a(r.value[V].clone()),j=>(l.openBlock(),l.createBlock(Ya,{onMouseover:Q=>F(j),onClick:Q=>!k(j)&&!g(j)?s(j):null,today:f(j),selected:h(j),firstDay:m(j)||L(j),lastDay:y(j)||I(j),between:p(j),disabled:k(j)||g(j),off:k(j)||g(j),highlight:G(j)},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(H)(j).format("D")),1)]),_:2},1032,["onMouseover","onClick","today","selected","firstDay","lastDay","between","disabled","off","highlight"]))),256)),((U=u(l.unref(H)(r.value[V]).year(),l.unref(H)(r.value[V]).month()+1))==null?void 0:U.length)>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:1},l.renderList(u(l.unref(H)(r.value[V]).year(),l.unref(H)(r.value[V]).month()+1),j=>(l.openBlock(),l.createBlock(Ya,{onClick:Q=>!k(j)&&!g(j)?s(j):null,off:""},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(H)(j).format("D")),1)]),_:2},1032,["onClick"]))),256)):l.createCommentVNode("",!0)],32)])}),256))],2))}}),hB={},pB={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},mB=[l.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 gB(t,e){return l.openBlock(),l.createElementBlock("svg",pB,mB)}const _h=ue(hB,[["render",gB]]),yB={},bB={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},kB=[l.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 xB(t,e){return l.openBlock(),l.createElementBlock("svg",bB,kB)}const Rh=ue(yB,[["render",xB]]),vB={class:"flex gap-3"},wB={key:0,class:"w-32 py-2 border-r dark:border-gray-800 flex flex-col gap-3 shrink-0"},SB=["onClick"],CB=Object.assign({name:"WpicDateField"},{props:{modelValue:{},label:String,placeholder:{type:String,default:"Select date"},week:Boolean,range:Boolean,disabled:Boolean,large:Boolean,info:String,doubleMonths:Boolean,clearable:Boolean,minDate:{},maxDate:{},initDates:{},shortcuts:Boolean,slim:Boolean,required:Boolean,hideRequired:Boolean},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e;function i(a){r("update:modelValue",a)}const o=l.computed(()=>{var a;if(n.range)return(a=n.modelValue)==null?void 0:a.map(c=>H(c).format("YYYY-MM-DD")).join(" to ");if(n.modelValue)return H(n.modelValue).format("YYYY-MM-DD")}),s=l.reactive([{text:"Month to Date",onClick(a){const c=H().subtract(1,"day"),d=H().startOf("month");r("update:modelValue",[d,c])}},{text:"Last Month",onClick(a){const c=H().startOf("month").subtract(1,"month"),d=H(c).endOf("month");r("update:modelValue",[c,d])}},{text:"Year to Date",onClick(a){const c=H().subtract(1,"day"),d=H().startOf("year");r("update:modelValue",[d,c])}}]);return(a,c)=>(l.openBlock(),l.createBlock(Sn,{disabled:t.disabled,maxWidth:"1280px"},{content:l.withCtx(()=>[l.createElementVNode("div",vB,[t.shortcuts?(l.openBlock(),l.createElementBlock("div",wB,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(s,d=>(l.openBlock(),l.createElementBlock("div",{class:"opacity-50 hover:opacity-100 dark:text-gray-300 cursor-pointer",onClick:u=>d.onClick()},l.toDisplayString(d.text),9,SB))),256))])):l.createCommentVNode("",!0),l.createVNode(Ja,{shortcuts:"",doubleMonths:t.doubleMonths,initDates:t.initDates,week:t.week,"min-date":t.minDate,"max-date":t.maxDate,modelValue:t.modelValue,"onUpdate:modelValue":i,range:t.range},null,8,["doubleMonths","initDates","week","min-date","max-date","modelValue","range"])])]),default:l.withCtx(()=>{var d;return[l.createVNode(_i,{label:t.label,required:t.required,hideRequired:t.hideRequired,slim:t.slim,disabled:t.disabled,large:t.large,info:t.info,clearable:!!(t.clearable&&((d=o.value)!=null&&d.length)),onOnClear:c[0]||(c[0]=u=>i(null))},{prepend:l.withCtx(()=>[t.range?(l.openBlock(),l.createBlock(_h,{key:0,class:"dark:text-gray-400"})):(l.openBlock(),l.createBlock(Rh,{key:1,class:"dark:text-gray-400"}))]),default:l.withCtx(()=>[l.createTextVNode(" "+l.toDisplayString(o.value||t.placeholder),1)]),_:1},8,["label","required","hideRequired","slim","disabled","large","info","clearable"])]}),_:1},8,["disabled"]))}}),OB={class:"relative inline-block tabular-nums"},EB=["value","placeholder","maxlength"],Ga={__name:"DateSegment",props:{modelValue:String,placeholder:String,segment:{type:String,default:"monthOrDay"},disabled:Boolean},emits:["update:modelValue","blur"],setup(t,{emit:e}){const n=t,r=e,i=l.ref(null),o=l.computed(()=>n.segment==="year"?4:2);function s(c){const d=c.target.value.replace(/\D/g,"");r("update:modelValue",d.slice(0,o.value)),d.length>=o.value&&n.nextRef&&l.nextTick(()=>{n.nextRef.focus()})}function a(){r("blur")}return(c,d)=>(l.openBlock(),l.createElementBlock("div",OB,[l.createElementVNode("input",{ref_key:"inputRef",ref:i,type:"text",value:t.modelValue,onInput:s,onKeydown:d[0]||(d[0]=(...u)=>c.onKeydown&&c.onKeydown(...u)),onBlur:a,placeholder:t.placeholder,class:l.normalizeClass(["date-segment bg-transparent text-gray-900 dark:text-gray-400 focus:outline-none border-b border-transparent focus:border-gray-800 dark:focus:border-gray-300 transition-all duration-200 ease-in-out hover:bg-gray-50 dark:hover:bg-gray-800 focus:bg-white dark:focus:bg-gray-900 placeholder:opacity-25 placeholder:tracking-wider placeholder:pl-1",{"w-[4ch]":o.value===4,"w-[2ch]":o.value===2}]),inputmode:"numeric",pattern:"\\d*",maxlength:o.value},null,42,EB)]))}},MB={class:"flex items-center gap-0"},TB=l.createElementVNode("span",{class:"px-px text-gray-400 dark:text-gray-700"},"/",-1),$B=l.createElementVNode("span",{class:"px-px text-gray-400 dark:text-gray-600"},"/",-1),Za={__name:"DateInput",props:{modelValue:String,disabled:Boolean},emits:["update:modelValue","update:initDates","update:displayYear","update:displayMonth"],setup(t,{emit:e}){const n=t,r=e,i=l.ref(""),o=l.ref(""),s=l.ref(""),a=l.ref(null),c=l.ref(null),d=l.ref(null);l.watch(()=>n.modelValue,k=>{n.range?Array.isArray(k)&&k.length===2?(yearStart.value=k[0]?H(k[0]).format("YYYY"):"",monthStart.value=k[0]?H(k[0]).format("MM"):"",dayStart.value=k[0]?H(k[0]).format("DD"):"",yearEnd.value=k[1]?H(k[1]).format("YYYY"):"",monthEnd.value=k[1]?H(k[1]).format("MM"):"",dayEnd.value=k[1]?H(k[1]).format("DD"):""):(yearStart.value=monthStart.value=dayStart.value="",yearEnd.value=monthEnd.value=dayEnd.value=""):k?(i.value=H(k).format("YYYY"),o.value=H(k).format("MM"),s.value=H(k).format("DD")):i.value=o.value=s.value=""},{immediate:!0});function u(){i.value.length===4&&o.value.length===2&&s.value.length===2&&r("update:modelValue",`${i.value}-${o.value}-${s.value}`)}function f(k){k.length===4&&r("update:displayYear",Number(k)),u()}function h(k){k.length===2&&r("update:displayMonth",Number(k)-1),u()}function p(k){s.value=k,u()}function m(){i.value||(i.value=H().format("YYYY")),u()}function y(){o.value||(o.value=H().format("MM")),u()}function g(){s.value||(s.value=H().format("DD")),u()}return(k,C)=>(l.openBlock(),l.createElementBlock("div",MB,[l.createVNode(Ga,{modelValue:i.value,"onUpdate:modelValue":[C[0]||(C[0]=N=>i.value=N),f],segment:"year",disabled:t.disabled,placeholder:"••••",onBlur:m,ref_key:"yearRef",ref:a},null,8,["modelValue","disabled"]),TB,l.createVNode(Ga,{modelValue:o.value,"onUpdate:modelValue":[C[1]||(C[1]=N=>o.value=N),h],segment:"monthOrDay",disabled:t.disabled,placeholder:"••",onBlur:y,ref_key:"monthRef",ref:c},null,8,["modelValue","disabled"]),$B,l.createVNode(Ga,{modelValue:s.value,"onUpdate:modelValue":[C[2]||(C[2]=N=>s.value=N),p],segment:"monthOrDay",disabled:t.disabled,placeholder:"••",onBlur:g,ref_key:"dayRef",ref:d},null,8,["modelValue","disabled"])]))}},NB={class:"tabular-nums"},BB={key:1,class:"flex items-center"},AB=l.createElementVNode("span",{class:"px-1 text-gray-400 dark:text-gray-600"},"➞",-1),DB={class:""},VB={__name:"AdvancedDateField",props:{modelValue:{},label:String,placeholder:{type:String,default:"Select date"},week:Boolean,range:Boolean,disabled:Boolean,large:Boolean,info:String,doubleMonths:Boolean,clearable:Boolean,minDate:{},maxDate:{},initDates:{},shortcuts:Boolean,slim:Boolean,required:Boolean,hideRequired:Boolean},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e;l.ref(!1);const i=l.ref(H().year()),o=l.ref(H().month()),s=l.ref(null),a=l.ref(null);function c(){r("update:modelValue",null)}const d=l.ref(n.range?[]:"");l.watch(()=>n.modelValue,f=>{if(n.range){const h=f!=null&&f[0]?H(f[0]).format("YYYY-MM-DD"):"",p=f!=null&&f[1]?H(f[1]).format("YYYY-MM-DD"):"";(d.value[0]!==h||d.value[1]!==p)&&(d.value=[h,p])}else{const h=f?H(f).format("YYYY-MM-DD"):"";d.value!==h&&(d.value=h)}},{immediate:!0}),l.watch(d,f=>{var h,p;if(n.range){const m=f[0]&&f[0].length===10?H(f[0]).toDate():null,y=f[1]&&f[1].length===10?H(f[1]).toDate():null;(!((h=n.modelValue)!=null&&h[0])||n.modelValue[0]!==m||!((p=n.modelValue)!=null&&p[1])||n.modelValue[1]!==y)&&r("update:modelValue",[m,y])}else if(f&&f.length===10){const m=H(f,"YYYY-MM-DD",!0);m.isValid()&&n.modelValue!==m.toDate()&&r("update:modelValue",m.toDate())}});function u(f){r("update:modelValue",f)}return(f,h)=>(l.openBlock(),l.createBlock(Sn,{disabled:t.disabled,maxWidth:"1280px",noCloseClasses:["date-segment"]},{content:l.withCtx(()=>[l.createElementVNode("div",DB,[l.createVNode(Ja,{doubleMonths:t.doubleMonths,displayYearStart:i.value,displayMonthStart:o.value,displayYearEnd:s.value,displayMonthEnd:a.value,initDates:t.initDates,week:t.week,"min-date":t.minDate,"max-date":t.maxDate,modelValue:n.range?[...d.value]:d.value,"onUpdate:modelValue":u,range:t.range},null,8,["doubleMonths","displayYearStart","displayMonthStart","displayYearEnd","displayMonthEnd","initDates","week","min-date","max-date","modelValue","range"])])]),default:l.withCtx(()=>[l.createVNode(_i,{label:t.label,required:t.required,hideRequired:t.hideRequired,slim:t.slim,disabled:t.disabled,large:t.large,info:t.info,clearable:t.clearable&&!!t.modelValue,onOnClear:c},{prepend:l.withCtx(()=>[t.range?(l.openBlock(),l.createBlock(_h,{key:0,class:"dark:text-gray-400"})):(l.openBlock(),l.createBlock(Rh,{key:1,class:"dark:text-gray-400"}))]),default:l.withCtx(()=>[l.createElementVNode("div",NB,[t.range?t.range?(l.openBlock(),l.createElementBlock("div",BB,[l.createVNode(Za,{modelValue:d.value[0],"onUpdate:modelValue":h[3]||(h[3]=p=>d.value[0]=p),disabled:!0,"onUpdate:displayYear":h[4]||(h[4]=p=>i.value=p),"onUpdate:displayMonth":h[5]||(h[5]=p=>o.value=p)},null,8,["modelValue"]),AB,l.createVNode(Za,{modelValue:d.value[1],"onUpdate:modelValue":h[6]||(h[6]=p=>d.value[1]=p),disabled:!0,"onUpdate:displayYear":h[7]||(h[7]=p=>{s.value=p}),"onUpdate:displayMonth":h[8]||(h[8]=p=>{a.value=p})},null,8,["modelValue"])])):(l.openBlock(),l.createElementBlock(l.Fragment,{key:2},[l.createTextVNode(l.toDisplayString(t.placeholder),1)],64)):(l.openBlock(),l.createBlock(Za,{key:0,modelValue:d.value,"onUpdate:modelValue":h[0]||(h[0]=p=>d.value=p),disabled:!0,"onUpdate:displayYear":h[1]||(h[1]=p=>i.value=p),"onUpdate:displayMonth":h[2]||(h[2]=p=>o.value=p)},null,8,["modelValue"]))])]),_:1},8,["label","required","hideRequired","slim","disabled","large","info","clearable"])]),_:1},8,["disabled"]))}},IB=Object.assign({name:"WpicSlidePanel"},{props:{visible:{type:Boolean,default:!1},backgroundColor:{type:String,default:"bg-white"},options:{type:Object,default:()=>({width:"w-96",mr:"mr-0",zIndex:"z-15"})},expand:Boolean,island:Boolean},emits:["close"],setup(t,{expose:e,emit:n}){const r={pmi:"dark:bg-zinc-800","wpic-tools":"dark:bg-gray-940"},i=n;function o(){i("close")}e({goBottom:c,goTop:a});const s=l.ref(null);function a(){s.value.scrollTop=0}function c(){s.value.scrollTop=s.value.scrollHeight}return(d,u)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["fixed inset-0 h-full flex justify-end bg-black/50 backdrop-blur-xs transition-opacity",{"p-4":t.island,"opacity-0 pointer-events-none":!t.visible,"opacity-100":t.visible,[t.options.mr]:!0,[t.options.zIndex]:!0}]),onClick:l.withModifiers(o,["self"])},[l.createElementVNode("div",{class:l.normalizeClass(["h-full transform-gpu transition-transform",{"rounded-lg":t.island,"translate-x-0":t.visible,"translate-x-full":!t.visible,[t.backgroundColor]:!0,[t.options.width]:!0,[r[l.unref(re).theme]]:!0}])},[l.createElementVNode("div",{ref_key:"panel",ref:s,class:l.normalizeClass(["h-full overflow-y-auto",{"p-6":!t.expand}])},[l.renderSlot(d.$slots,"default")],2)],2)],2))}}),PB={class:"absolute inset-0 flex items-center justify-center py-12"},_B={class:"text-lg font-medium dark:text-gray-300"},RB={key:0,class:"flex justify-end px-6 pb-4"},LB=Object.assign({name:"WpicDialog"},{props:{title:String,visible:Boolean,large:Boolean,extraLarge:Boolean,smooth:Boolean,expand:Boolean,border:Boolean,high:Boolean,overflow:Boolean},emits:["close"],setup(t,{expose:e,emit:n}){const r=t,i=n;function o(){i("close")}const s=l.ref(null),a=l.ref(!1);function c(){s.value.scrollTop=0}function d(){s.value.scrollTop=s.value.scrollHeight}function u(){s.value&&r.visible&&(a.value=s.value.scrollTop+s.value.clientHeight>=s.value.scrollHeight-20)}return l.onMounted(async()=>{s.value&&(s.value.addEventListener("scroll",u),u())}),l.onBeforeUnmount(()=>{s.value&&s.value.removeEventListener("scroll",u)}),e({goBottom:d,goTop:c,isScrolledToBottom:a}),(f,h)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["",{flex:t.visible,hidden:!t.visible}])},[l.createElementVNode("div",PB,[l.createElementVNode("div",{class:"absolute inset-0 bg-black/10 dark:bg-black/75 z-10",onClick:o}),l.createElementVNode("div",{class:l.normalizeClass(["relative flex flex-col justify-between bg-white dark:border dark:border-gray-900 dark:bg-gray-940 rounded-lg z-20 max-h-full",{"w-3/5":t.large,"w-4/5":t.extraLarge,"w-192":!t.large&&!t.extraLarge,"h-full":t.high,"overflow-hidden":!t.overflow}])},[l.createElementVNode("div",{class:l.normalizeClass(["px-6 pt-4 pb-4 flex items-center justify-between",{"border-b pb-3 dark:border-gray-900":t.border}])},[l.createElementVNode("span",_B,l.toDisplayString(t.title),1),l.createElementVNode("span",{class:"cursor-pointer",onClick:o},[l.createVNode(Hr,{class:"w-6 h-6"})])],2),l.createElementVNode("div",{ref_key:"panel",ref:s,class:l.normalizeClass(["flex-1 overflow-y-auto",{"p-6":!t.expand,"scroll-smooth":t.smooth}])},[l.renderSlot(f.$slots,"default")],2),f.$slots.buttons?(l.openBlock(),l.createElementBlock("div",RB,[l.renderSlot(f.$slots,"buttons")])):l.createCommentVNode("",!0)],2)])],2))}}),zB={class:"wpic-tabs flex border-b-2 dark:border-gray-930 overflow-x-auto overflow-y-hidden"},FB=["onClick"],jB=Object.assign({name:"WpicTabs"},{props:{modelValue:{type:String,required:!0},nowrap:Boolean},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=l.ref([]),o=c=>{r("update:modelValue",c)},s=c=>{i.value.push(c)},a=l.computed(()=>n.modelValue);return l.provide("addTab",s),l.provide("modelValue",a),(c,d)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("div",zB,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(i.value,u=>(l.openBlock(),l.createElementBlock("div",{key:u.name,class:l.normalizeClass(["border-b items-center flex leading-snug cursor-pointer py-3 px-6 -mb-[2px] font-medium",{"dark:border-gray-930":u.name!=t.modelValue,"border-b-2 text-lime-500 border-b-lime-500 dark:text-lime-600 dark:border-b-lime-600":u.name===t.modelValue,"text-gray-500 dark:text-gray-500":!u.disabled,"text-gray-300 dark:text-gray-700":u.disabled}]),onClick:f=>u.disabled?null:o(u.name)},[l.renderSlot(c.$slots,"label",{},()=>[l.createElementVNode("span",{class:l.normalizeClass({"whitespace-nowrap text-ellipsis overflow-hidden":t.nowrap})},l.toDisplayString(u.label),3)])],10,FB))),128))]),l.createElementVNode("div",null,[l.renderSlot(c.$slots,"default")])],64))}}),HB=Object.assign({name:"WpicTabPane"},{props:{label:{type:String,required:!0},name:{type:String,required:!0},noStyle:Boolean,disabled:Boolean},setup(t){const e=t,n=l.ref(!1),r=l.inject("addTab"),i=l.inject("modelValue");return l.onMounted(()=>{r({label:e.label,name:e.name,disabled:e.disabled})}),l.watch(()=>i.value,o=>{n.value=o===e.name},{immediate:!0,deep:!0}),(o,s)=>n.value?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["wpic-tab-pane",{"py-3 px-6":!t.noStyle}])},[l.renderSlot(o.$slots,"default")],2)):l.createCommentVNode("",!0)}}),WB={},qB={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},UB=[l.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"},null,-1)];function KB(t,e){return l.openBlock(),l.createElementBlock("svg",qB,UB)}const YB=ue(WB,[["render",KB]]),JB={},GB={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},ZB=[l.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"},null,-1)];function XB(t,e){return l.openBlock(),l.createElementBlock("svg",GB,ZB)}const QB=ue(JB,[["render",XB]]),eA={},tA={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},nA=[l.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"},null,-1)];function rA(t,e){return l.openBlock(),l.createElementBlock("svg",tA,nA)}const iA=ue(eA,[["render",rA]]),oA={},sA={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},aA=[l.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"},null,-1)];function lA(t,e){return l.openBlock(),l.createElementBlock("svg",sA,aA)}const cA=ue(oA,[["render",lA]]),dA={class:"w-6"},uA={class:"flex-1"},fA={key:0,class:"mb-2"},hA=Object.assign({name:"WpicAlert"},{props:{title:String,text:String,warning:Boolean,success:Boolean,error:Boolean,info:Boolean},setup(t){return(e,n)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["px-4 py-3 rounded-sm text-base flex gap-4",{"bg-gray-50 text-gray-900 dark:text-gray-200 dark:bg-gray-950 text-opacity-75":!t.warning&&!t.info&&!t.error&&!t.success,"bg-amber-50 text-yellow-950 dark:text-yellow-100 dark:bg-yellow-950 text-opacity-75":t.warning,"bg-blue-50 text-blue-950 dark:text-blue-200 dark:bg-blue-950 text-opacity-75":t.info,"bg-red-100 text-red-950 dark:text-red-200 dark:bg-red-950 text-opacity-75":t.error,"bg-green-50 text-green-950 dark:text-green-200 dark:bg-green-950 text-opacity-75":t.success}])},[l.createElementVNode("div",dA,[t.warning?(l.openBlock(),l.createBlock(YB,{key:0,class:"w-full aspect-square"})):t.info?(l.openBlock(),l.createBlock(QB,{key:1,class:"w-full aspect-square"})):t.success?(l.openBlock(),l.createBlock(iA,{key:2,class:"w-full aspect-square"})):t.error?(l.openBlock(),l.createBlock(cA,{key:3,class:"w-full aspect-square"})):l.createCommentVNode("",!0)]),l.createElementVNode("div",uA,[t.title?(l.openBlock(),l.createElementBlock("div",fA,l.toDisplayString(t.title),1)):l.createCommentVNode("",!0),l.createElementVNode("span",{class:l.normalizeClass(["",{"text-gray-950 dark:text-gray-200 text-opacity-75":!t.warning&&!t.info&&!t.error&&!t.success,"text-yellow-950 dark:text-yellow-100 text-opacity-75":t.warning,"text-blue-950 dark:text-blue-200 text-opacity-75":t.info,"text-red-950 dark:text-red-200 text-opacity-75":t.error,"text-green-950 dark:text-green-200 text-opacity-75":t.success}])},[l.renderSlot(e.$slots,"default",{},()=>[l.createTextVNode(l.toDisplayString(t.text),1)])],2)])],2))}}),Xa=l.ref(!1),Lh=l.ref(""),zh=l.ref(""),Fh=l.ref(!1),jh=l.ref(!1);let Hh=()=>{},Wh=()=>{};function Qa(){const t=({title:i,text:o,positive:s=!1,negative:a=!1,onConfirm:c,onCancel:d})=>{Lh.value=i,zh.value=o,Fh.value=s,jh.value=a,Hh=c||(()=>{}),Wh=d||(()=>{}),Xa.value=!0},e=()=>{Xa.value=!1};return{visible:Xa,title:Lh,text:zh,positive:Fh,negative:jh,show:t,onConfirm:()=>{Hh(),e()},onCancel:()=>{Wh(),e()}}}const pA={key:0,class:"confirm-modal-overlay z-40"},mA={class:"bg-white dark:border dark:border-gray-900 dark:bg-gray-940 p-6 rounded-lg w-128 flex flex-col"},gA={class:"text-lg font-semibold mb-6"},yA={class:"mb-12"},bA={class:"flex justify-end"},el={WpicAlert:hA,WpicToggleSwitch:Hc,WpicAdvDateField:VB,WpicCalendar:Ja,WpicTextarea:Wc,WpicDialog:LB,WpicSlidePanel:IB,WpicDateField:CB,WpicFormInput:_i,WpicButton:Ni,WpicBadge:eB,WpicTextEditor:RN,WpicInputGroup:vm,WpicButtonGroup:ym,WpicForm:wm,WpicFormField:qc,WpicSpinner:Yn,WpicTooltip:Uc,WpicPopover:Sn,WpicChoiceList:jc,WpicCard:xw,WpicCardSection:Sw,WpicProgressBar:Ew,WpicTag:Tw,WpicTagGroup:$w,WpicPagination:tS,WpicLoadingPanel:Dw,WpicTable:CS,WpicTableColumn:OS,WpicTabs:jB,WpicTabPane:HB,WpicConfirm:ue(Object.assign({name:"WpicConfirm"},{setup(t){const{visible:e,title:n,text:r,positive:i,negative:o,onConfirm:s,onCancel:a}=Qa();return(c,d)=>l.unref(e)?(l.openBlock(),l.createElementBlock("div",pA,[l.createElementVNode("div",mA,[l.createElementVNode("div",gA,l.toDisplayString(l.unref(n)),1),l.createElementVNode("div",yA,l.toDisplayString(l.unref(r)),1),l.createElementVNode("div",bA,[l.createVNode(Ni,{onClick:l.unref(a)},{default:l.withCtx(()=>[l.createTextVNode("Cancel")]),_:1},8,["onClick"]),l.createVNode(Ni,{primary:l.unref(i),destructive:l.unref(o),onClick:l.unref(s)},{default:l.withCtx(()=>[l.createTextVNode("Confirm")]),_:1},8,["primary","destructive","onClick"])])])])):l.createCommentVNode("",!0)}}),[["__scopeId","data-v-613542ab"]])};function qh(t,e){for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(typeof e[n]=="object"&&t[n]?qh(t[n],e[n]):t[n]=e[n])}const kA={useConfirm:Qa};function xA(t,e){qh(re,e);for(const n in el)if(el.hasOwnProperty(n)){const r=el[n];t.component(r.name,r)}}const vA={install:xA,composables:kA,options:re};Jt.default=vA,Jt.useConfirm=Qa,Object.defineProperties(Jt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});