@romainbx/wpic-components 0.0.13 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/date/Calendar.vue.d.ts +2 -0
- package/dist/components/date/DateField.vue.d.ts +2 -0
- package/dist/components/form/ChoiceList.vue.d.ts +3 -0
- package/dist/components/form/FormField.vue.d.ts +2 -0
- package/dist/style.css +1 -1
- package/dist/wpic-components.js +623 -609
- package/dist/wpic-components.umd.cjs +12 -12
- package/package.json +1 -1
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
* vee-validate v4.12.8
|
|
3
3
|
* (c) 2024 Abdelrahman Awad
|
|
4
4
|
* @license MIT
|
|
5
|
-
*/function Ae(t){return typeof t=="function"}function Sc(t){return t==null}const Dn=t=>t!==null&&!!t&&typeof t=="object"&&!Array.isArray(t);function Ko(t){return Number(t)>=0}function mm(t){const e=parseFloat(t);return isNaN(e)?t:e}function gm(t){return typeof t=="object"&&t!==null}function ym(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}function Mc(t){if(!gm(t)||ym(t)!=="[object Object]")return!1;if(Object.getPrototypeOf(t)===null)return!0;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function bi(t,e){return Object.keys(e).forEach(n=>{if(Mc(e[n])&&Mc(t[n])){t[n]||(t[n]={}),bi(t[n],e[n]);return}t[n]=e[n]}),t}function ki(t){const e=t.split(".");if(!e.length)return"";let n=String(e[0]);for(let r=1;r<e.length;r++){if(Ko(e[r])){n+=`[${e[r]}]`;continue}n+=`.${e[r]}`}return n}const Oc={};function _t(t,e){km(t,e),Oc[t]=e}function bm(t){return Oc[t]}function km(t,e){if(!Ae(e))throw new Error(`Extension Error: The validator '${t}' must be a function.`)}function Cc(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,s=Object.prototype.toString.call(t);if(s==="[object Object]"?i=Object.create(t.__proto__||null):s==="[object Array]"?i=Array(t.length):s==="[object Set]"?(i=new Set,t.forEach(function(o){i.add(me(o))})):s==="[object Map]"?(i=new Map,t.forEach(function(o,a){i.set(me(a),me(o))})):s==="[object Date]"?i=new Date(+t):s==="[object RegExp]"?i=new RegExp(t.source,t.flags):s==="[object DataView]"?i=new t.constructor(me(t.buffer)):s==="[object ArrayBuffer]"?i=t.slice(0):s.slice(-6)==="Array]"&&(i=new t.constructor(t)),i){for(r=Object.getOwnPropertySymbols(t);e<r.length;e++)Cc(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]||Cc(i,n,Object.getOwnPropertyDescriptor(t,n))}return i||t}const wi=Symbol("vee-validate-form"),Tc=Symbol("vee-validate-field-instance"),bs=Symbol("Default empty value"),wm=typeof window<"u";function Jo(t){return Ae(t)&&!!t.__locatorRef}function At(t){return!!t&&Ae(t.parse)&&t.__type==="VVTypedSchema"}function ks(t){return!!t&&Ae(t.validate)}function vi(t){return t==="checkbox"||t==="radio"}function vm(t){return Dn(t)||Array.isArray(t)}function xm(t){return Array.isArray(t)?t.length===0:Dn(t)&&Object.keys(t).length===0}function ws(t){return/^\[.+\]$/i.test(t)}function Sm(t){return Ec(t)&&t.multiple}function Ec(t){return t.tagName==="SELECT"}function Mm(t,e){const n=![!1,null,void 0,0].includes(e.multiple)&&!Number.isNaN(e.multiple);return t==="select"&&"multiple"in e&&n}function Om(t,e){return!Mm(t,e)&&e.type!=="file"&&!vi(e.type)}function Dc(t){return Go(t)&&t.target&&"submit"in t.target}function Go(t){return t?!!(typeof Event<"u"&&Ae(Event)&&t instanceof Event||t&&t.srcElement):!1}function Nc(t,e){return e in t&&t[e]!==bs}function qe(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var n,r,i;if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!qe(t[r],e[r]))return!1;return!0}if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(r of t.entries())if(!e.has(r[0]))return!1;for(r of t.entries())if(!qe(r[1],e.get(r[0])))return!1;return!0}if(_c(t)&&_c(e))return!(t.size!==e.size||t.name!==e.name||t.lastModified!==e.lastModified||t.type!==e.type);if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(r of t.entries())if(!e.has(r[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(t[r]!==e[r])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();for(i=Object.keys(t),n=i.length,r=n;r--!==0;){var s=i[r];if(!qe(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function _c(t){return wm?t instanceof File:!1}function Zo(t){return ws(t)?t.replace(/\[|\]/gi,""):t}function nt(t,e,n){return t?ws(e)?t[Zo(e)]:(e||"").split(/\.|\[(\d+)\]/).filter(Boolean).reduce((i,s)=>vm(i)&&s in i?i[s]:n,t):n}function dn(t,e,n){if(ws(e)){t[Zo(e)]=n;return}const r=e.split(/\.|\[(\d+)\]/).filter(Boolean);let i=t;for(let s=0;s<r.length;s++){if(s===r.length-1){i[r[s]]=n;return}(!(r[s]in i)||Sc(i[r[s]]))&&(i[r[s]]=Ko(r[s+1])?[]:{}),i=i[r[s]]}}function Xo(t,e){if(Array.isArray(t)&&Ko(e)){t.splice(Number(e),1);return}Dn(t)&&delete t[e]}function Ac(t,e){if(ws(e)){delete t[Zo(e)];return}const n=e.split(/\.|\[(\d+)\]/).filter(Boolean);let r=t;for(let s=0;s<n.length;s++){if(s===n.length-1){Xo(r,n[s]);break}if(!(n[s]in r)||Sc(r[n[s]]))break;r=r[n[s]]}const i=n.map((s,o)=>nt(t,n.slice(0,o).join(".")));for(let s=i.length-1;s>=0;s--)if(xm(i[s])){if(s===0){Xo(t,n[0]);continue}Xo(i[s-1],n[s-1])}}function rt(t){return Object.keys(t)}function Qo(t,e=void 0){const n=d.getCurrentInstance();return(n==null?void 0:n.provides[t])||d.inject(t,e)}function Vc(t,e,n){if(Array.isArray(t)){const r=[...t],i=r.findIndex(s=>qe(s,e));return i>=0?r.splice(i,1):r.push(e),r}return qe(t,e)?n:e}function Cm(t,e){let n,r;return function(...i){const s=this;return n||(n=!0,setTimeout(()=>n=!1,e),r=t.apply(s,i)),r}}function Bc(t,e=0){let n=null,r=[];return function(...i){return n&&clearTimeout(n),n=setTimeout(()=>{const s=t(...i);r.forEach(o=>o(s)),r=[]},e),new Promise(s=>r.push(s))}}function Tm(t,e){return Dn(e)&&e.number?mm(t):t}function ea(t,e){let n;return async function(...i){const s=t(...i);n=s;const o=await s;return s!==n?o:(n=void 0,e(o,i))}}function ta(t){return Array.isArray(t)?t:t?[t]:[]}function vs(t,e){const n={};for(const r in t)e.includes(r)||(n[r]=t[r]);return n}function Em(t){let e=null,n=[];return function(...r){const i=d.nextTick(()=>{if(e!==i)return;const s=t(...r);n.forEach(o=>o(s)),n=[],e=null});return e=i,new Promise(s=>n.push(s))}}function na(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 ra(t){if(Pc(t))return t._value}function Pc(t){return"_value"in t}function Dm(t){return t.type==="number"||t.type==="range"?Number.isNaN(t.valueAsNumber)?t.value:t.valueAsNumber:t.value}function xs(t){if(!Go(t))return t;const e=t.target;if(vi(e.type)&&Pc(e))return ra(e);if(e.type==="file"&&e.files){const n=Array.from(e.files);return e.multiple?n:n[0]}if(Sm(e))return Array.from(e.options).filter(n=>n.selected&&!n.disabled).map(ra);if(Ec(e)){const n=Array.from(e.options).find(r=>r.selected);return n?ra(n):e.value}return Dm(e)}function Ic(t){const e={};return Object.defineProperty(e,"_$$isNormalized",{value:!0,writable:!1,enumerable:!1,configurable:!1}),t?Dn(t)&&t._$$isNormalized?t:Dn(t)?Object.keys(t).reduce((n,r)=>{const i=Nm(t[r]);return t[r]!==!1&&(n[r]=Rc(i)),n},e):typeof t!="string"?e:t.split("|").reduce((n,r)=>{const i=_m(r);return i.name&&(n[i.name]=Rc(i.params)),n},e):e}function Nm(t){return t===!0?[]:Array.isArray(t)||Dn(t)?t:[t]}function Rc(t){const e=n=>typeof n=="string"&&n[0]==="@"?Am(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 _m=t=>{let e=[];const n=t.split(":")[0];return t.includes(":")&&(e=t.split(":").slice(1).join(":").split(",")),{name:n,params:e}};function Am(t){const e=n=>nt(n,t)||n[t];return e.__locatorRef=t,e}function Vm(t){return Array.isArray(t)?t.filter(Jo):rt(t).filter(e=>Jo(t[e])).map(e=>t[e])}let Bm=Object.assign({},{generateMessage:({field:t})=>`${t} is not valid.`,bails:!0,validateOnBlur:!0,validateOnChange:!0,validateOnInput:!1,validateOnModelUpdate:!0});const tr=()=>Bm;async function $c(t,e,n={}){const r=n==null?void 0:n.bails,i={name:(n==null?void 0:n.name)||"{field}",rules:e,label:n==null?void 0:n.label,bails:r??!0,formData:(n==null?void 0:n.values)||{}},o=(await Pm(i,t)).errors;return{errors:o,valid:!o.length}}async function Pm(t,e){if(At(t.rules)||ks(t.rules))return Rm(e,t.rules);if(Ae(t.rules)||Array.isArray(t.rules)){const o={field:t.label||t.name,name:t.name,label:t.label,form:t.formData,value:e},a=Array.isArray(t.rules)?t.rules:[t.rules],l=a.length,c=[];for(let u=0;u<l;u++){const f=a[u],h=await f(e,o);if(!(typeof h!="string"&&!Array.isArray(h)&&h)){if(Array.isArray(h))c.push(...h);else{const m=typeof h=="string"?h:Fc(o);c.push(m)}if(t.bails)return{errors:c}}}return{errors:c}}const n=Object.assign(Object.assign({},t),{rules:Ic(t.rules)}),r=[],i=Object.keys(n.rules),s=i.length;for(let o=0;o<s;o++){const a=i[o],l=await $m(n,e,{name:a,params:n.rules[a]});if(l.error&&(r.push(l.error),t.bails))return{errors:r}}return{errors:r}}function Im(t){return!!t&&t.name==="ValidationError"}function Lc(t){return{__type:"VVTypedSchema",async parse(n){var r;try{return{output:await t.validate(n,{abortEarly:!1}),errors:[]}}catch(i){if(!Im(i))throw i;if(!(!((r=i.inner)===null||r===void 0)&&r.length)&&i.errors.length)return{errors:[{path:i.path,errors:i.errors}]};const s=i.inner.reduce((o,a)=>{const l=a.path||"";return o[l]||(o[l]={errors:[],path:l}),o[l].errors.push(...a.errors),o},{});return{errors:Object.values(s)}}}}}async function Rm(t,e){const r=await(At(e)?e:Lc(e)).parse(t),i=[];for(const s of r.errors)s.errors.length&&i.push(...s.errors);return{errors:i}}async function $m(t,e,n){const r=bm(n.name);if(!r)throw new Error(`No such validator '${n.name}' exists.`);const i=Lm(n.params,t.formData),s={field:t.label||t.name,name:t.name,label:t.label,value:e,form:t.formData,rule:Object.assign(Object.assign({},n),{params:i})},o=await r(e,i,s);return typeof o=="string"?{error:o}:{error:o?void 0:Fc(s)}}function Fc(t){const e=tr().generateMessage;return e?e(t):"Field is invalid"}function Lm(t,e){const n=r=>Jo(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 Fm(t,e){const r=await(At(t)?t:Lc(t)).parse(me(e)),i={},s={};for(const o of r.errors){const a=o.errors,l=(o.path||"").replace(/\["(\d+)"\]/g,(c,u)=>`[${u}]`);i[l]={valid:!a.length,errors:a},a.length&&(s[l]=a[0])}return{valid:!r.errors.length,results:i,errors:s,values:r.value}}async function zm(t,e,n){const i=rt(t).map(async c=>{var u,f,h;const p=(u=n==null?void 0:n.names)===null||u===void 0?void 0:u[c],m=await $c(nt(e,c),t[c],{name:(p==null?void 0:p.name)||c,label:p==null?void 0:p.label,values:e,bails:(h=(f=n==null?void 0:n.bailsMap)===null||f===void 0?void 0:f[c])!==null&&h!==void 0?h:!0});return Object.assign(Object.assign({},m),{path:c})});let s=!0;const o=await Promise.all(i),a={},l={};for(const c of o)a[c.path]={valid:c.valid,errors:c.errors},c.valid||(s=!1,l[c.path]=c.errors[0]);return{valid:s,results:a,errors:l}}let zc=0;function jm(t,e){const{value:n,initialValue:r,setInitialValue:i}=Wm(t,e.modelValue,e.form);if(!e.form){let h=function(p){var m;"value"in p&&(n.value=p.value),"errors"in p&&c(p.errors),"touched"in p&&(f.touched=(m=p.touched)!==null&&m!==void 0?m:f.touched),"initialValue"in p&&i(p.initialValue)};const{errors:l,setErrors:c}=Um(),u=zc>=Number.MAX_SAFE_INTEGER?0:++zc,f=Ym(n,r,l,e.schema);return{id:u,path:t,value:n,initialValue:r,meta:f,flags:{pendingUnmount:{[u]:!1},pendingReset:!1},errors:l,setState:h}}const s=e.form.createPathState(t,{bails:e.bails,label:e.label,type:e.type,validate:e.validate,schema:e.schema}),o=d.computed(()=>s.errors);function a(l){var c,u,f;"value"in l&&(n.value=l.value),"errors"in l&&((c=e.form)===null||c===void 0||c.setFieldError(d.unref(t),l.errors)),"touched"in l&&((u=e.form)===null||u===void 0||u.setFieldTouched(d.unref(t),(f=l.touched)!==null&&f!==void 0?f:!1)),"initialValue"in l&&i(l.initialValue)}return{id:Array.isArray(s.id)?s.id[s.id.length-1]:s.id,path:t,value:n,errors:o,meta:s,initialValue:r,flags:s.__flags,setState:a}}function Wm(t,e,n){const r=d.ref(d.unref(e));function i(){return n?nt(n.initialValues.value,d.unref(t),d.unref(r)):d.unref(r)}function s(c){if(!n){r.value=c;return}n.setFieldInitialValue(d.unref(t),c,!0)}const o=d.computed(i);if(!n)return{value:d.ref(i()),initialValue:o,setInitialValue:s};const a=Hm(e,n,o,t);return n.stageInitialValue(d.unref(t),a,!0),{value:d.computed({get(){return nt(n.values,d.unref(t))},set(c){n.setFieldValue(d.unref(t),c,!1)}}),initialValue:o,setInitialValue:s}}function Hm(t,e,n,r){return d.isRef(t)?d.unref(t):t!==void 0?t:nt(e.values,d.unref(r),d.unref(n))}function Ym(t,e,n,r){const i=d.computed(()=>{var o,a,l;return(l=(a=(o=d.toValue(r))===null||o===void 0?void 0:o.describe)===null||a===void 0?void 0:a.call(o).required)!==null&&l!==void 0?l:!1}),s=d.reactive({touched:!1,pending:!1,valid:!0,required:i,validated:!!d.unref(n).length,initialValue:d.computed(()=>d.unref(e)),dirty:d.computed(()=>!qe(d.unref(t),d.unref(e)))});return d.watch(n,o=>{s.valid=!o.length},{immediate:!0,flush:"sync"}),s}function Um(){const t=d.ref([]);return{errors:t,setErrors:e=>{t.value=ta(e)}}}function jc(t){process.env.NODE_ENV!=="production"&&pm({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"},Jm)}const xi={},Si={};let un;const Tr=Cm(()=>{setTimeout(async()=>{await d.nextTick(),un==null||un.sendInspectorState(Er),un==null||un.sendInspectorTree(Er)},100)},100);function qm(t){const e=d.getCurrentInstance();if(!un){const n=e==null?void 0:e.appContext.app;if(!n)return;jc(n)}xi[t.formId]=Object.assign({},t),xi[t.formId]._vm=e,d.onUnmounted(()=>{delete xi[t.formId],Tr()}),Tr()}function Km(t){const e=d.getCurrentInstance();if(!un){const n=e==null?void 0:e.appContext.app;if(!n)return;jc(n)}Si[t.id]=Object.assign({},t),Si[t.id]._vm=e,d.onUnmounted(()=>{delete Si[t.id],Tr()}),Tr()}const Er="vee-validate-inspector",it={error:12405579,success:448379,unknown:5522283,white:16777215,black:0,blue:218007,purple:12157168,orange:16099682,gray:12304330};let Ce=null;function Jm(t){un=t,t.addInspector({id:Er,icon:"rule",label:"vee-validate",noSelectionText:"Select a vee-validate node to inspect",actions:[{icon:"done_outline",tooltip:"Validate selected item",action:async()=>{if(!Ce){console.error("There is not a valid selected vee-validate node or component");return}if(Ce.type==="field"){await Ce.field.validate();return}if(Ce.type==="form"){await Ce.form.validate();return}Ce.type==="pathState"&&await Ce.form.validateField(Ce.state.path)}},{icon:"delete_sweep",tooltip:"Clear validation state of the selected item",action:()=>{if(!Ce){console.error("There is not a valid selected vee-validate node or component");return}if(Ce.type==="field"){Ce.field.resetField();return}Ce.type==="form"&&Ce.form.resetForm(),Ce.type==="pathState"&&Ce.form.resetField(Ce.state.path)}}]}),t.on.getInspectorTree(e=>{if(e.inspectorId!==Er)return;const n=Object.values(xi),r=Object.values(Si);e.rootNodes=[...n.map(Gm),...r.map(i=>Xm(i))]}),t.on.getInspectorState((e,n)=>{if(e.inspectorId!==Er||n.currentTab!==`custom-inspector:${Er}`)return;const{form:r,field:i,state:s,type:o}=Qm(e.nodeId);if(r&&o==="form"){e.state=eg(r),Ce={type:"form",form:r};return}if(s&&o==="pathState"&&r){e.state=Hc(s),Ce={type:"pathState",state:s,form:r};return}if(i&&o==="field"){e.state=Hc({errors:i.errors.value,dirty:i.meta.dirty,valid:i.meta.valid,touched:i.meta.touched,value:i.value.value,initialValue:i.meta.initialValue}),Ce={field:i,type:"field"};return}Ce=null})}function Gm(t){const{textColor:e,bgColor:n}=Yc(t.meta.value.valid),r={};Object.values(t.getAllPathStates()).forEach(o=>{dn(r,d.unref(o.path),Zm(o,t))});function i(o,a=[]){const l=[...a].pop();return"id"in o?Object.assign(Object.assign({},o),{label:l||o.label}):Dn(o)?{id:`${a.join(".")}`,label:l||"",children:Object.keys(o).map(c=>i(o[c],[...a,c]))}:Array.isArray(o)?{id:`${a.join(".")}`,label:`${l}[]`,children:o.map((c,u)=>i(c,[...a,String(u)]))}:{id:"",label:"",children:[]}}const{children:s}=i(r);return{id:ia(t),label:"Form",children:s,tags:[{label:"Form",textColor:e,backgroundColor:n},{label:`${t.getAllPathStates().length} fields`,textColor:it.white,backgroundColor:it.unknown}]}}function Zm(t,e){return{id:ia(e,t),label:d.unref(t.path),tags:Wc(t.multiple,t.fieldsCount,t.type,t.valid,e)}}function Xm(t,e){return{id:ia(e,t),label:d.unref(t.name),tags:Wc(!1,1,t.type,t.meta.valid,e)}}function Wc(t,e,n,r,i){const{textColor:s,bgColor:o}=Yc(r);return[t?void 0:{label:"Field",textColor:s,backgroundColor:o},i?void 0:{label:"Standalone",textColor:it.black,backgroundColor:it.gray},n==="checkbox"?{label:"Checkbox",textColor:it.white,backgroundColor:it.blue}:void 0,n==="radio"?{label:"Radio",textColor:it.white,backgroundColor:it.purple}:void 0,t?{label:"Multiple",textColor:it.black,backgroundColor:it.orange}:void 0].filter(Boolean)}function ia(t,e){const n=e?"path"in e?"pathState":"field":"form",r=e?"path"in e?e==null?void 0:e.path:d.unref(e==null?void 0:e.name):"",i={f:t==null?void 0:t.formId,ff:r,type:n};return btoa(encodeURIComponent(JSON.stringify(i)))}function Qm(t){try{const e=JSON.parse(decodeURIComponent(atob(t))),n=xi[e.f];if(!n&&e.ff){const i=Si[e.ff];return i?{type:e.type,field:i}:{}}if(!n)return{};const r=n.getPathState(e.ff);return{type:e.type,form:n,state:r}}catch{}return{}}function Hc(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 eg(t){const{errorBag:e,meta:n,values:r,isSubmitting:i,isValidating:s,submitCount:o}=t;return{"Form state":[{key:"submitCount",value:o.value},{key:"isSubmitting",value:i.value},{key:"isValidating",value:s.value},{key:"touched",value:n.value.touched},{key:"dirty",value:n.value.dirty},{key:"valid",value:n.value.valid},{key:"initialValues",value:n.value.initialValues},{key:"currentValues",value:r},{key:"errors",value:rt(e.value).reduce((a,l)=>{var c;const u=(c=e.value[l])===null||c===void 0?void 0:c[0];return u&&(a[l]=u),a},{})}]}}function Yc(t){return{bgColor:t?it.success:it.error,textColor:t?it.black:it.white}}function tg(t,e,n){return vi(n==null?void 0:n.type)?rg(t,e,n):Uc(t,e,n)}function Uc(t,e,n){const{initialValue:r,validateOnMount:i,bails:s,type:o,checkedValue:a,label:l,validateOnValueUpdate:c,uncheckedValue:u,controlled:f,keepValueOnUnmount:h,syncVModel:p,form:m}=ng(n),y=f?Qo(wi):void 0,g=m||y,k=d.computed(()=>ki(d.toValue(t))),x=d.computed(()=>{if(d.toValue(g==null?void 0:g.schema))return;const Q=d.unref(e);return ks(Q)||At(Q)||Ae(Q)||Array.isArray(Q)?Q:Ic(Q)}),C=!Ae(x.value)&&At(d.toValue(e)),{id:b,value:E,initialValue:w,meta:_,setState:R,errors:P,flags:z}=jm(k,{modelValue:r,form:g,bails:s,label:l,type:o,validate:x.value?T:void 0,schema:C?e:void 0}),te=d.computed(()=>P.value[0]);p&&ig({value:E,prop:p,handleChange:q,shouldValidate:()=>c&&!z.pendingReset});const D=(I,Q=!1)=>{_.touched=!0,Q&&H()};async function L(I){var Q,he;if(g!=null&&g.validateSchema){const{results:le}=await g.validateSchema(I);return(Q=le[d.toValue(k)])!==null&&Q!==void 0?Q:{valid:!0,errors:[]}}return x.value?$c(E.value,x.value,{name:d.toValue(k),label:d.toValue(l),values:(he=g==null?void 0:g.values)!==null&&he!==void 0?he:{},bails:s}):{valid:!0,errors:[]}}const H=ea(async()=>(_.pending=!0,_.validated=!0,L("validated-only")),I=>(z.pendingUnmount[ve.id]||(R({errors:I.errors}),_.pending=!1,_.valid=I.valid),I)),J=ea(async()=>L("silent"),I=>(_.valid=I.valid,I));function T(I){return(I==null?void 0:I.mode)==="silent"?J():H()}function q(I,Q=!0){const he=xs(I);ct(he,Q)}d.onMounted(()=>{if(i)return H();(!g||!g.validateSchema)&&J()});function re(I){_.touched=I}function De(I){var Q;const he=I&&"value"in I?I.value:w.value;R({value:me(he),initialValue:me(he),touched:(Q=I==null?void 0:I.touched)!==null&&Q!==void 0?Q:!1,errors:(I==null?void 0:I.errors)||[]}),_.pending=!1,_.validated=!1,J()}const Qe=d.getCurrentInstance();function ct(I,Q=!0){E.value=Qe&&p?Tm(I,Qe.props.modelModifiers):I,(Q?H:J)()}function bt(I){R({errors:Array.isArray(I)?I:[I]})}const kt=d.computed({get(){return E.value},set(I){ct(I,c)}}),ve={id:b,name:k,label:l,value:kt,meta:_,errors:P,errorMessage:te,type:o,checkedValue:a,uncheckedValue:u,bails:s,keepValueOnUnmount:h,resetField:De,handleReset:()=>De(),validate:T,handleChange:q,handleBlur:D,setState:R,setTouched:re,setErrors:bt,setValue:ct};if(d.provide(Tc,ve),d.isRef(e)&&typeof d.unref(e)!="function"&&d.watch(e,(I,Q)=>{qe(I,Q)||(_.validated?H():J())},{deep:!0}),process.env.NODE_ENV!=="production"&&(ve._vm=d.getCurrentInstance(),d.watch(()=>Object.assign(Object.assign({errors:P.value},_),{value:E.value}),Tr,{deep:!0}),g||Km(ve)),!g)return ve;const et=d.computed(()=>{const I=x.value;return!I||Ae(I)||ks(I)||At(I)||Array.isArray(I)?{}:Object.keys(I).reduce((Q,he)=>{const le=Vm(I[he]).map(Re=>Re.__locatorRef).reduce((Re,$e)=>{const dt=nt(g.values,$e)||g.values[$e];return dt!==void 0&&(Re[$e]=dt),Re},{});return Object.assign(Q,le),Q},{})});return d.watch(et,(I,Q)=>{if(!Object.keys(I).length)return;!qe(I,Q)&&(_.validated?H():J())}),d.onBeforeUnmount(()=>{var I;const Q=(I=d.toValue(ve.keepValueOnUnmount))!==null&&I!==void 0?I:d.toValue(g.keepValuesOnUnmount),he=d.toValue(k);if(Q||!g||z.pendingUnmount[ve.id]){g==null||g.removePathState(he,b);return}z.pendingUnmount[ve.id]=!0;const le=g.getPathState(he);if(Array.isArray(le==null?void 0:le.id)&&(le!=null&&le.multiple)?le!=null&&le.id.includes(ve.id):(le==null?void 0:le.id)===ve.id){if(le!=null&&le.multiple&&Array.isArray(le.value)){const $e=le.value.findIndex(dt=>qe(dt,d.toValue(ve.checkedValue)));if($e>-1){const dt=[...le.value];dt.splice($e,1),g.setFieldValue(he,dt)}Array.isArray(le.id)&&le.id.splice(le.id.indexOf(ve.id),1)}else g.unsetPathValue(d.toValue(k));g.removePathState(he,b)}}),ve}function ng(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||{}))?sa(d.getCurrentInstance(),r):t==null?void 0:t.initialValue;if(!t)return Object.assign(Object.assign({},e()),{initialValue:i});const s="valueProp"in t?t.valueProp:t.checkedValue,o="standalone"in t?!t.standalone:t.controlled,a=(t==null?void 0:t.modelPropName)||(t==null?void 0:t.syncVModel)||!1;return Object.assign(Object.assign(Object.assign({},e()),t||{}),{initialValue:i,controlled:o??!0,checkedValue:s,syncVModel:a})}function rg(t,e,n){const r=n!=null&&n.standalone?void 0:Qo(wi),i=n==null?void 0:n.checkedValue,s=n==null?void 0:n.uncheckedValue;function o(a){const l=a.handleChange,c=d.computed(()=>{const f=d.toValue(a.value),h=d.toValue(i);return Array.isArray(f)?f.findIndex(p=>qe(p,h))>=0:qe(h,f)});function u(f,h=!0){var p,m;if(c.value===((p=f==null?void 0:f.target)===null||p===void 0?void 0:p.checked)){h&&a.validate();return}const y=d.toValue(t),g=r==null?void 0:r.getPathState(y),k=xs(f);let x=(m=d.toValue(i))!==null&&m!==void 0?m:k;r&&(g!=null&&g.multiple)&&g.type==="checkbox"?x=Vc(nt(r.values,y)||[],x,void 0):(n==null?void 0:n.type)==="checkbox"&&(x=Vc(d.toValue(a.value),x,d.toValue(s))),l(x,h)}return Object.assign(Object.assign({},a),{checked:c,checkedValue:i,uncheckedValue:s,handleChange:u})}return o(Uc(t,e,n))}function ig({prop:t,value:e,handleChange:n,shouldValidate:r}){const i=d.getCurrentInstance();if(!i||!t){process.env.NODE_ENV!=="production"&&console.warn("Failed to setup model events because `useField` was not called in setup.");return}const s=typeof t=="string"?t:"modelValue",o=`update:${s}`;s in i.props&&(d.watch(e,a=>{qe(a,sa(i,s))||i.emit(o,a)}),d.watch(()=>sa(i,s),a=>{if(a===bs&&e.value===void 0)return;const l=a===bs?void 0:a;qe(l,e.value)||n(l,r())}))}function sa(t,e){if(t)return t.props[e]}const sg=d.defineComponent({name:"Field",inheritAttrs:!1,props:{as:{type:[String,Object],default:void 0},name:{type:String,required:!0},rules:{type:[Object,String,Function],default:void 0},validateOnMount:{type:Boolean,default:!1},validateOnBlur:{type:Boolean,default:void 0},validateOnChange:{type:Boolean,default:void 0},validateOnInput:{type:Boolean,default:void 0},validateOnModelUpdate:{type:Boolean,default:void 0},bails:{type:Boolean,default:()=>tr().bails},label:{type:String,default:void 0},uncheckedValue:{type:null,default:void 0},modelValue:{type:null,default:bs},modelModifiers:{type:null,default:()=>({})},"onUpdate:modelValue":{type:null,default:void 0},standalone:{type:Boolean,default:!1},keepValue:{type:Boolean,default:void 0}},setup(t,e){const n=d.toRef(t,"rules"),r=d.toRef(t,"name"),i=d.toRef(t,"label"),s=d.toRef(t,"uncheckedValue"),o=d.toRef(t,"keepValue"),{errors:a,value:l,errorMessage:c,validate:u,handleChange:f,handleBlur:h,setTouched:p,resetField:m,handleReset:y,meta:g,checked:k,setErrors:x}=tg(r,n,{validateOnMount:t.validateOnMount,bails:t.bails,standalone:t.standalone,type:e.attrs.type,initialValue:ag(t,e),checkedValue:e.attrs.value,uncheckedValue:s,label:i,validateOnValueUpdate:t.validateOnModelUpdate,keepValueOnUnmount:o,syncVModel:!0}),C=function(P,z=!0){f(P,z)},b=d.computed(()=>{const{validateOnInput:R,validateOnChange:P,validateOnBlur:z,validateOnModelUpdate:te}=og(t);function D(T){h(T,z),Ae(e.attrs.onBlur)&&e.attrs.onBlur(T)}function L(T){C(T,R),Ae(e.attrs.onInput)&&e.attrs.onInput(T)}function H(T){C(T,P),Ae(e.attrs.onChange)&&e.attrs.onChange(T)}const J={name:t.name,onBlur:D,onInput:L,onChange:H};return J["onUpdate:modelValue"]=T=>C(T,te),J}),E=d.computed(()=>{const R=Object.assign({},b.value);vi(e.attrs.type)&&k&&(R.checked=k.value);const P=qc(t,e);return Om(P,e.attrs)&&(R.value=l.value),R}),w=d.computed(()=>Object.assign(Object.assign({},b.value),{modelValue:l.value}));function _(){return{field:E.value,componentField:w.value,value:l.value,meta:g,errors:a.value,errorMessage:c.value,validate:u,resetField:m,handleChange:C,handleInput:R=>C(R,!1),handleReset:y,handleBlur:b.value.onBlur,setTouched:p,setErrors:x}}return e.expose({value:l,meta:g,errors:a,errorMessage:c,setErrors:x,setTouched:p,reset:m,validate:u,handleChange:f}),()=>{const R=d.resolveDynamicComponent(qc(t,e)),P=na(R,e,_);return R?d.h(R,Object.assign(Object.assign({},e.attrs),E.value),P):P}}});function qc(t,e){let n=t.as||"";return!t.as&&!e.slots.default&&(n="input"),n}function og(t){var e,n,r,i;const{validateOnInput:s,validateOnChange:o,validateOnBlur:a,validateOnModelUpdate:l}=tr();return{validateOnInput:(e=t.validateOnInput)!==null&&e!==void 0?e:s,validateOnChange:(n=t.validateOnChange)!==null&&n!==void 0?n:o,validateOnBlur:(r=t.validateOnBlur)!==null&&r!==void 0?r:a,validateOnModelUpdate:(i=t.validateOnModelUpdate)!==null&&i!==void 0?i:l}}function ag(t,e){return vi(e.attrs.type)?Nc(t,"modelValue")?t.modelValue:void 0:Nc(t,"modelValue")?t.modelValue:e.attrs.value}const Ss=sg;let lg=0;const Ms=["bails","fieldsCount","id","multiple","type","validate"];function Kc(t){const e=(t==null?void 0:t.initialValues)||{},n=Object.assign({},d.toValue(e)),r=d.unref(t==null?void 0:t.validationSchema);return r&&At(r)&&Ae(r.cast)?me(r.cast(n)||{}):me(n)}function cg(t){var e;const n=lg++;let r=0;const i=d.ref(!1),s=d.ref(!1),o=d.ref(0),a=[],l=d.reactive(Kc(t)),c=d.ref([]),u=d.ref({}),f=d.ref({}),h=Em(()=>{f.value=c.value.reduce((M,S)=>(M[ki(d.toValue(S.path))]=S,M),{})});function p(M,S){const N=T(M);if(!N){typeof M=="string"&&(u.value[ki(M)]=ta(S));return}if(typeof M=="string"){const F=ki(M);u.value[F]&&delete u.value[F]}N.errors=ta(S),N.valid=!N.errors.length}function m(M){rt(M).forEach(S=>{p(S,M[S])})}t!=null&&t.initialErrors&&m(t.initialErrors);const y=d.computed(()=>{const M=c.value.reduce((S,N)=>(N.errors.length&&(S[N.path]=N.errors),S),{});return Object.assign(Object.assign({},u.value),M)}),g=d.computed(()=>rt(y.value).reduce((M,S)=>{const N=y.value[S];return N!=null&&N.length&&(M[S]=N[0]),M},{})),k=d.computed(()=>c.value.reduce((M,S)=>(M[S.path]={name:S.path||"",label:S.label||""},M),{})),x=d.computed(()=>c.value.reduce((M,S)=>{var N;return M[S.path]=(N=S.bails)!==null&&N!==void 0?N:!0,M},{})),C=Object.assign({},(t==null?void 0:t.initialErrors)||{}),b=(e=t==null?void 0:t.keepValuesOnUnmount)!==null&&e!==void 0?e:!1,{initialValues:E,originalInitialValues:w,setInitialValues:_}=ug(c,l,t),R=dg(c,l,w,g),P=d.computed(()=>c.value.reduce((M,S)=>{const N=nt(l,S.path);return dn(M,S.path,N),M},{})),z=t==null?void 0:t.validationSchema;function te(M,S){var N,F;const Z=d.computed(()=>nt(E.value,d.toValue(M))),v=f.value[d.toValue(M)],V=(S==null?void 0:S.type)==="checkbox"||(S==null?void 0:S.type)==="radio";if(v&&V){v.multiple=!0;const tt=r++;return Array.isArray(v.id)?v.id.push(tt):v.id=[v.id,tt],v.fieldsCount++,v.__flags.pendingUnmount[tt]=!1,v}const j=d.computed(()=>nt(l,d.toValue(M))),G=d.toValue(M),X=re.findIndex(tt=>tt===G);X!==-1&&re.splice(X,1);const ie=d.computed(()=>{var tt,wt,Or,er;const cn=d.toValue(z);if(At(cn))return(wt=(tt=cn.describe)===null||tt===void 0?void 0:tt.call(cn,d.toValue(M)).required)!==null&&wt!==void 0?wt:!1;const ys=d.toValue(S==null?void 0:S.schema);return At(ys)&&(er=(Or=ys.describe)===null||Or===void 0?void 0:Or.call(ys).required)!==null&&er!==void 0?er:!1}),pe=r++,Oe=d.reactive({id:pe,path:M,touched:!1,pending:!1,valid:!0,validated:!!(!((N=C[G])===null||N===void 0)&&N.length),required:ie,initialValue:Z,errors:d.shallowRef([]),bails:(F=S==null?void 0:S.bails)!==null&&F!==void 0?F:!1,label:S==null?void 0:S.label,type:(S==null?void 0:S.type)||"default",value:j,multiple:!1,__flags:{pendingUnmount:{[pe]:!1},pendingReset:!1},fieldsCount:1,validate:S==null?void 0:S.validate,dirty:d.computed(()=>!qe(d.unref(j),d.unref(Z)))});return c.value.push(Oe),f.value[G]=Oe,h(),g.value[G]&&!C[G]&&d.nextTick(()=>{Dt(G,{mode:"silent"})}),d.isRef(M)&&d.watch(M,tt=>{h();const wt=me(j.value);f.value[tt]=Oe,d.nextTick(()=>{dn(l,tt,wt)})}),Oe}const D=Bc(ln,5),L=Bc(ln,5),H=ea(async M=>await(M==="silent"?D():L()),(M,[S])=>{const N=rt(I.errorBag.value),Z=[...new Set([...rt(M.results),...c.value.map(v=>v.path),...N])].sort().reduce((v,V)=>{var j;const G=V,X=T(G)||q(G),ie=((j=M.results[G])===null||j===void 0?void 0:j.errors)||[],pe=d.toValue(X==null?void 0:X.path)||G,Oe=fg({errors:ie,valid:!ie.length},v.results[pe]);return v.results[pe]=Oe,Oe.valid||(v.errors[pe]=Oe.errors[0]),X&&u.value[pe]&&delete u.value[pe],X?(X.valid=Oe.valid,S==="silent"||S==="validated-only"&&!X.validated||p(X,Oe.errors),v):(p(pe,ie),v)},{valid:M.valid,results:{},errors:{}});return M.values&&(Z.values=M.values),rt(Z.results).forEach(v=>{var V;const j=T(v);j&&S!=="silent"&&(S==="validated-only"&&!j.validated||p(j,(V=Z.results[v])===null||V===void 0?void 0:V.errors))}),Z});function J(M){c.value.forEach(M)}function T(M){const S=typeof M=="string"?ki(M):M;return typeof S=="string"?f.value[S]:S}function q(M){return c.value.filter(N=>M.startsWith(N.path)).reduce((N,F)=>N?F.path.length>N.path.length?F:N:F,void 0)}let re=[],De;function Qe(M){return re.push(M),De||(De=d.nextTick(()=>{[...re].sort().reverse().forEach(N=>{Ac(l,N)}),re=[],De=null})),De}function ct(M){return function(N,F){return function(v){return v instanceof Event&&(v.preventDefault(),v.stopPropagation()),J(V=>V.touched=!0),i.value=!0,o.value++,Wt().then(V=>{const j=me(l);if(V.valid&&typeof N=="function"){const G=me(P.value);let X=M?G:j;return V.values&&(X=V.values),N(X,{evt:v,controlledValues:G,setErrors:m,setFieldError:p,setTouched:Zn,setFieldTouched:$e,setValues:le,setFieldValue:Q,resetForm:Tn,resetField:Xn})}!V.valid&&typeof F=="function"&&F({values:j,evt:v,errors:V.errors,results:V.results})}).then(V=>(i.value=!1,V),V=>{throw i.value=!1,V})}}}const kt=ct(!1);kt.withControlled=ct(!0);function ve(M,S){const N=c.value.findIndex(Z=>Z.path===M&&(Array.isArray(Z.id)?Z.id.includes(S):Z.id===S)),F=c.value[N];if(!(N===-1||!F)){if(d.nextTick(()=>{Dt(M,{mode:"silent",warn:!1})}),F.multiple&&F.fieldsCount&&F.fieldsCount--,Array.isArray(F.id)){const Z=F.id.indexOf(S);Z>=0&&F.id.splice(Z,1),delete F.__flags.pendingUnmount[S]}(!F.multiple||F.fieldsCount<=0)&&(c.value.splice(N,1),Nt(M),h(),delete f.value[M])}}function et(M){rt(f.value).forEach(S=>{S.startsWith(M)&&delete f.value[S]}),c.value=c.value.filter(S=>!S.path.startsWith(M)),d.nextTick(()=>{h()})}const I={formId:n,values:l,controlledValues:P,errorBag:y,errors:g,schema:z,submitCount:o,meta:R,isSubmitting:i,isValidating:s,fieldArrays:a,keepValuesOnUnmount:b,validateSchema:d.unref(z)?H:void 0,validate:Wt,setFieldError:p,validateField:Dt,setFieldValue:Q,setValues:le,setErrors:m,setFieldTouched:$e,setTouched:Zn,resetForm:Tn,resetField:Xn,handleSubmit:kt,useFieldModel:pi,defineInputBinds:mi,defineComponentBinds:gi,defineField:Qn,stageInitialValue:an,unsetInitialValue:Nt,setFieldInitialValue:En,createPathState:te,getPathState:T,unsetPathValue:Qe,removePathState:ve,initialValues:E,getAllPathStates:()=>c.value,destroyPath:et,isFieldTouched:dt,isFieldDirty:Sr,isFieldValid:hi};function Q(M,S,N=!0){const F=me(S),Z=typeof M=="string"?M:M.path;T(Z)||te(Z),dn(l,Z,F),N&&Dt(Z)}function he(M,S=!0){rt(l).forEach(N=>{delete l[N]}),rt(M).forEach(N=>{Q(N,M[N],!1)}),S&&Wt()}function le(M,S=!0){bi(l,M),a.forEach(N=>N&&N.reset()),S&&Wt()}function Re(M,S){const N=T(d.toValue(M))||te(M);return d.computed({get(){return N.value},set(F){var Z;const v=d.toValue(M);Q(v,F,(Z=d.toValue(S))!==null&&Z!==void 0?Z:!1)}})}function $e(M,S){const N=T(M);N&&(N.touched=S)}function dt(M){const S=T(M);return S?S.touched:c.value.filter(N=>N.path.startsWith(M)).some(N=>N.touched)}function Sr(M){const S=T(M);return S?S.dirty:c.value.filter(N=>N.path.startsWith(M)).some(N=>N.dirty)}function hi(M){const S=T(M);return S?S.valid:c.value.filter(N=>N.path.startsWith(M)).every(N=>N.valid)}function Zn(M){if(typeof M=="boolean"){J(S=>{S.touched=M});return}rt(M).forEach(S=>{$e(S,!!M[S])})}function Xn(M,S){var N;const F=S&&"value"in S?S.value:nt(E.value,M),Z=T(M);Z&&(Z.__flags.pendingReset=!0),En(M,me(F),!0),Q(M,F,!1),$e(M,(N=S==null?void 0:S.touched)!==null&&N!==void 0?N:!1),p(M,(S==null?void 0:S.errors)||[]),d.nextTick(()=>{Z&&(Z.__flags.pendingReset=!1)})}function Tn(M,S){let N=me(M!=null&&M.values?M.values:w.value);N=S!=null&&S.force?N:bi(w.value,N),N=At(z)&&Ae(z.cast)?z.cast(N):N,_(N),J(F=>{var Z;F.__flags.pendingReset=!0,F.validated=!1,F.touched=((Z=M==null?void 0:M.touched)===null||Z===void 0?void 0:Z[F.path])||!1,Q(F.path,nt(N,F.path),!1),p(F.path,void 0)}),S!=null&&S.force?he(N,!1):le(N,!1),m((M==null?void 0:M.errors)||{}),o.value=(M==null?void 0:M.submitCount)||0,d.nextTick(()=>{Wt({mode:"silent"}),J(F=>{F.__flags.pendingReset=!1})})}async function Wt(M){const S=(M==null?void 0:M.mode)||"force";if(S==="force"&&J(v=>v.validated=!0),I.validateSchema)return I.validateSchema(S);s.value=!0;const N=await Promise.all(c.value.map(v=>v.validate?v.validate(M).then(V=>({key:v.path,valid:V.valid,errors:V.errors})):Promise.resolve({key:v.path,valid:!0,errors:[]})));s.value=!1;const F={},Z={};for(const v of N)F[v.key]={valid:v.valid,errors:v.errors},v.errors.length&&(Z[v.key]=v.errors[0]);return{valid:N.every(v=>v.valid),results:F,errors:Z}}async function Dt(M,S){var N;const F=T(M);if(F&&(S==null?void 0:S.mode)!=="silent"&&(F.validated=!0),z){const{results:v}=await H((S==null?void 0:S.mode)||"validated-only");return v[M]||{errors:[],valid:!0}}return F!=null&&F.validate?F.validate(S):(!F&&((N=S==null?void 0:S.warn)!==null&&N!==void 0?N:!0)&&process.env.NODE_ENV!=="production"&&d.warn(`field with path ${M} was not found`),Promise.resolve({errors:[],valid:!0}))}function Nt(M){Ac(E.value,M)}function an(M,S,N=!1){En(M,S),dn(l,M,S),N&&!(t!=null&&t.initialValues)&&dn(w.value,M,me(S))}function En(M,S,N=!1){dn(E.value,M,me(S)),N&&dn(w.value,M,me(S))}async function ln(){const M=d.unref(z);if(!M)return{valid:!0,results:{},errors:{}};s.value=!0;const S=ks(M)||At(M)?await Fm(M,l):await zm(M,l,{names:k.value,bailsMap:x.value});return s.value=!1,S}const Mr=kt((M,{evt:S})=>{Dc(S)&&S.target.submit()});d.onMounted(()=>{if(t!=null&&t.initialErrors&&m(t.initialErrors),t!=null&&t.initialTouched&&Zn(t.initialTouched),t!=null&&t.validateOnMount){Wt();return}I.validateSchema&&I.validateSchema("silent")}),d.isRef(z)&&d.watch(z,()=>{var M;(M=I.validateSchema)===null||M===void 0||M.call(I,"validated-only")}),d.provide(wi,I),process.env.NODE_ENV!=="production"&&(qm(I),d.watch(()=>Object.assign(Object.assign({errors:y.value},R.value),{values:l,isSubmitting:i.value,isValidating:s.value,submitCount:o.value}),Tr,{deep:!0}));function Qn(M,S){const N=Ae(S)||S==null?void 0:S.label,F=T(d.toValue(M))||te(M,{label:N}),Z=()=>Ae(S)?S(vs(F,Ms)):S||{};function v(){var ie;F.touched=!0,((ie=Z().validateOnBlur)!==null&&ie!==void 0?ie:tr().validateOnBlur)&&Dt(F.path)}function V(){var ie;((ie=Z().validateOnInput)!==null&&ie!==void 0?ie:tr().validateOnInput)&&d.nextTick(()=>{Dt(F.path)})}function j(){var ie;((ie=Z().validateOnChange)!==null&&ie!==void 0?ie:tr().validateOnChange)&&d.nextTick(()=>{Dt(F.path)})}const G=d.computed(()=>{const ie={onChange:j,onInput:V,onBlur:v};return Ae(S)?Object.assign(Object.assign({},ie),S(vs(F,Ms)).props||{}):S!=null&&S.props?Object.assign(Object.assign({},ie),S.props(vs(F,Ms))):ie});return[Re(M,()=>{var ie,pe,Oe;return(Oe=(ie=Z().validateOnModelUpdate)!==null&&ie!==void 0?ie:(pe=tr())===null||pe===void 0?void 0:pe.validateOnModelUpdate)!==null&&Oe!==void 0?Oe:!0}),G]}function pi(M){return Array.isArray(M)?M.map(S=>Re(S,!0)):Re(M)}function mi(M,S){const[N,F]=Qn(M,S);function Z(){F.value.onBlur()}function v(j){const G=xs(j);Q(d.toValue(M),G,!1),F.value.onInput()}function V(j){const G=xs(j);Q(d.toValue(M),G,!1),F.value.onChange()}return d.computed(()=>Object.assign(Object.assign({},F.value),{onBlur:Z,onInput:v,onChange:V,value:N.value}))}function gi(M,S){const[N,F]=Qn(M,S),Z=T(d.toValue(M));function v(V){N.value=V}return d.computed(()=>{const V=Ae(S)?S(vs(Z,Ms)):S||{};return Object.assign({[V.model||"modelValue"]:N.value,[`onUpdate:${V.model||"modelValue"}`]:v},F.value)})}return Object.assign(Object.assign({},I),{values:d.readonly(l),handleReset:()=>Tn(),submitForm:Mr})}function dg(t,e,n,r){const i={touched:"some",pending:"some",valid:"every"},s=d.computed(()=>!qe(e,d.unref(n)));function o(){const l=t.value;return rt(i).reduce((c,u)=>{const f=i[u];return c[u]=l[f](h=>h[u]),c},{})}const a=d.reactive(o());return d.watchEffect(()=>{const l=o();a.touched=l.touched,a.valid=l.valid,a.pending=l.pending}),d.computed(()=>Object.assign(Object.assign({initialValues:d.unref(n)},a),{valid:a.valid&&!rt(r.value).length,dirty:s.value}))}function ug(t,e,n){const r=Kc(n),i=d.ref(r),s=d.ref(me(r));function o(a,l=!1){i.value=bi(me(i.value)||{},me(a)),s.value=bi(me(s.value)||{},me(a)),l&&t.value.forEach(c=>{if(c.touched)return;const f=nt(i.value,c.path);dn(e,c.path,me(f))})}return{initialValues:i,originalInitialValues:s,setInitialValues:o}}function fg(t,e){return e?{valid:t.valid&&e.valid,errors:[...t.errors,...e.errors]}:t}const hg=d.defineComponent({name:"Form",inheritAttrs:!1,props:{as:{type:null,default:"form"},validationSchema:{type:Object,default:void 0},initialValues:{type:Object,default:void 0},initialErrors:{type:Object,default:void 0},initialTouched:{type:Object,default:void 0},validateOnMount:{type:Boolean,default:!1},onSubmit:{type:Function,default:void 0},onInvalidSubmit:{type:Function,default:void 0},keepValues:{type:Boolean,default:!1}},setup(t,e){const n=d.toRef(t,"validationSchema"),r=d.toRef(t,"keepValues"),{errors:i,errorBag:s,values:o,meta:a,isSubmitting:l,isValidating:c,submitCount:u,controlledValues:f,validate:h,validateField:p,handleReset:m,resetForm:y,handleSubmit:g,setErrors:k,setFieldError:x,setFieldValue:C,setValues:b,setFieldTouched:E,setTouched:w,resetField:_}=cg({validationSchema:n.value?n:void 0,initialValues:t.initialValues,initialErrors:t.initialErrors,initialTouched:t.initialTouched,validateOnMount:t.validateOnMount,keepValuesOnUnmount:r}),R=g((T,{evt:q})=>{Dc(q)&&q.target.submit()},t.onInvalidSubmit),P=t.onSubmit?g(t.onSubmit,t.onInvalidSubmit):R;function z(T){Go(T)&&T.preventDefault(),m(),typeof e.attrs.onReset=="function"&&e.attrs.onReset()}function te(T,q){return g(typeof T=="function"&&!q?T:q,t.onInvalidSubmit)(T)}function D(){return me(o)}function L(){return me(a.value)}function H(){return me(i.value)}function J(){return{meta:a.value,errors:i.value,errorBag:s.value,values:o,isSubmitting:l.value,isValidating:c.value,submitCount:u.value,controlledValues:f.value,validate:h,validateField:p,handleSubmit:te,handleReset:m,submitForm:R,setErrors:k,setFieldError:x,setFieldValue:C,setValues:b,setFieldTouched:E,setTouched:w,resetForm:y,resetField:_,getValues:D,getMeta:L,getErrors:H}}return e.expose({setFieldError:x,setErrors:k,setFieldValue:C,setValues:b,setFieldTouched:E,setTouched:w,resetForm:y,validate:h,validateField:p,resetField:_,getValues:D,getMeta:L,getErrors:H,values:o,meta:a,errors:i}),function(){const q=t.as==="form"?t.as:t.as?d.resolveDynamicComponent(t.as):null,re=na(q,e,J);if(!q)return re;const De=q==="form"?{novalidate:!0}:{};return d.h(q,Object.assign(Object.assign(Object.assign({},De),e.attrs),{onSubmit:P,onReset:z}),re)}}}),pg=d.defineComponent({name:"ErrorMessage",props:{as:{type:String,default:void 0},name:{type:String,required:!0}},setup(t,e){const n=d.inject(wi,void 0),r=d.computed(()=>n==null?void 0:n.errors.value[t.name]);function i(){return{message:r.value}}return()=>{if(!r.value)return;const s=t.as?d.resolveDynamicComponent(t.as):t.as,o=na(s,e,i),a=Object.assign({role:"alert"},e.attrs);return!s&&(Array.isArray(o)||!o)&&(o!=null&&o.length)?o:(Array.isArray(o)||!o)&&!(o!=null&&o.length)?d.h(s||"span",a,r.value):d.h(s,a,o)}}});function mg(t){const e=Qo(wi),n=t?void 0:d.inject(Tc);return d.computed(()=>t?e==null?void 0:e.errors.value[d.toValue(t)]:n==null?void 0:n.errorMessage.value)}_t("required",t=>typeof t=="object"&&t!=null||typeof t=="boolean"&&t===!0?!0:!t||!t.length?"This field is required":!0),_t("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"}),_t("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"),_t("no_space",t=>(t==null?void 0:t.indexOf(" "))>-1?"This field shouldn't contain space":!0),_t("minLength",(t,[e])=>!t||!t.length?!0:t.length<e?`This field must be at least ${e} characters`:!0),_t("hasUppercaseLetter",t=>/[A-Z]/.test(t)?!0:"This field must have at least one uppercase character"),_t("hasLowercaseLetter",t=>/[a-z]/.test(t)?!0:"This field must have at least one lowercase character"),_t("hasNumber",t=>/\d/.test(t)?!0:"This field must have at least one number"),_t("hasSpecialCharacter",t=>/[!@$%^&*(),.?":{}|]/.test(t)?!0:"This field must have at least one special character"),_t("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"}),_t("number",t=>parseFloat(t)?!0:"This field must be a number");const be=(t,e)=>{const n=t.__vccOpts||t;for(const[r,i]of e)n[r]=i;return n},gg={},yg={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",fill:"currentColor"},bg=[d.createElementVNode("path",{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200z"},null,-1)];function kg(t,e){return d.openBlock(),d.createElementBlock("svg",yg,bg)}const wg=be(gg,[["render",kg]]),vg={},xg={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",fill:"currentColor"},Sg=[d.createElementVNode("path",{d:"M460.116 373.846l-20.823-12.022c-5.541-3.199-7.54-10.159-4.663-15.874 30.137-59.886 28.343-131.652-5.386-189.946-33.641-58.394-94.896-95.833-161.827-99.676C261.028 55.961 256 50.751 256 44.352V20.309c0-6.904 5.808-12.337 12.703-11.982 83.556 4.306 160.163 50.864 202.11 123.677 42.063 72.696 44.079 162.316 6.031 236.832-3.14 6.148-10.75 8.461-16.728 5.01z"},null,-1)];function Mg(t,e){return d.openBlock(),d.createElementBlock("svg",xg,Sg)}const Og=be(vg,[["render",Mg]]),Cg={class:"relative"},Mi=Object.assign({name:"WpicSpinner"},{props:{color:{type:String,default:""}},setup(t){return(e,n)=>(d.openBlock(),d.createElementBlock("div",Cg,[d.createVNode(wg,{class:"absolute opacity-25"}),d.createVNode(Og,{class:d.normalizeClass(["animate-spin",{[`${t.color}`]:!0}])},null,8,["class"])]))}});let de={theme:"pmi"};const Tg={key:0,class:"absolute inset-0 flex justify-center items-center"},Eg=Object.assign({name:"WpicButton"},{props:{label:String,primary:Boolean,type:{type:String,default:"button"},secondary:Boolean,inverse:Boolean,disabled:Boolean,full:Boolean,loading:Boolean,outline:{type:Boolean,default:!0},medium:Boolean,small:Boolean,mini:Boolean,plain:Boolean,outlining:Boolean,square:Boolean,to:[String,Object]},setup(t){const e=t,n=d.computed(()=>e.to?"router-link":"button"),r={pmi:"bg-violet-800 border border-violet-800 focus:bg-violet-800 text-white disabled:bg-zinc-100 disabled:text-zinc-400 disabled:border-zinc-100 enabled:hover:bg-violet-900 enabled:hover:border-violet-900 active:scale-95 enabled:transform","wpic-tools":"text-white bg-lime-500 border-lime-500 enabled:hover:bg-lime-400 enabled:hover:border-lime-400 enabled:active:bg-lime-500 enabled:active:border-lime-500 enabled:active:shadow-inner disabled:bg-lime-600/25 disabled:text-white disabled:border-0"},i={pmi:"bg-white text-violet-800 border-zinc-400 dark:border-zinc-700 dark:text-zinc-200 dark:bg-zinc-700 dark:hover:bg-zinc-600 dark:hover:border-zinc-600 disabled:text-zinc-400 active:scale-95 enabled:transform","wpic-tools":"text-slate-700 bg-slate-100 border-slate-300 enabled:hover:bg-lime-50 enabled:hover:border-lime-300 enabled:hover:text-lime-600 enabled:active:shadow-inner disabled:border-slate-200 disabled:text-zinc-400 disabled:bg-slate-50/50"},s={pmi:"border-zinc-300 dark:border-zinc-700 dark:text-zinc-300","wpic-tools":"border-slate-200 bg-slate-200 enabled:hover:bg-slate-300 enabled:hover:border-slate-300 enabled:active:bg-slate-200 enabled:active:border-slate-200 enabled:active:shadow-inner disabled:bg-slate-100 disabled:text-zinc-400 disabled:border-0"},o={pmi:"text-violet-800 hover:underline","wpic-tools":"text-lime-800 hover:underline"},a={pmi:"hover:text-violet-800","wpic-tools":"hover:text-lime-800"};return(l,c)=>(d.openBlock(),d.createBlock(d.resolveDynamicComponent(n.value),{to:t.to,type:t.type,disabled:t.disabled,class:d.normalizeClass([{"cursor-pointer":!t.disabled&&!t.loading,"active:outline active:outline-2 active:outline-offset-4":!t.disabled&&!t.loading&&t.outlining,"cursor-not-allowed":t.disabled,border:t.outline&&!t.plain,[`${r[d.unref(de).theme]}`]:t.primary&&!t.plain&&!t.inverse,[`${i[d.unref(de).theme]}`]:t.secondary,[`${s[d.unref(de).theme]}`]:!t.primary&&!t.secondary&&!t.plain,[`${o[d.unref(de).theme]}`]:t.primary&&t.plain,[`${a[d.unref(de).theme]}`]:!t.primary&&t.plain,"bg-zinc-50 border-violet-800 text-violet-800":t.primary&&t.inverse,"hover:bg-white":t.primary&&t.inverse&&!t.disabled&&!t.loading,"w-full":t.full,"text-opacity-50":t.disabled,"text-sm":t.small,"px-4 py-1 rounded h-8":t.small&&!t.plain,"px-5 py-1 rounded h-10":t.medium&&!t.plain,"px-5 py-1 rounded h-12":!t.small&&!t.medium&&!t.plain,"px-0 aspect-square":t.square},"wpic-button leading-none font-medium no-underline appearance-none outline-zinc-600 focus:outline-none relative inline-flex justify-center items-center"])},{default:d.withCtx(()=>[t.loading?(d.openBlock(),d.createElementBlock("div",Tg,[d.createVNode(Mi,{class:"w-6 h-6"})])):d.createCommentVNode("",!0),d.createElementVNode("span",{class:d.normalizeClass(["flex items-center select-none whitespace-nowrap",{"opacity-0":t.loading}])},[d.renderSlot(l.$slots,"default",{},()=>[d.createTextVNode(d.toDisplayString(t.label),1)])],2)]),_:3},8,["to","type","disabled","class"]))}}),Dg=Object.assign({name:"WpicButtonGroup"},{setup(t){const e={pmi:"border","wpic-tools":"border border-slate-300 rounded-md"};return(n,r)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["wpic-button-group flex flex-wrap",[e[d.unref(de).theme]]])},[d.renderSlot(n.$slots,"default")],2))}}),Ng={name:"WpicInputGroup"},_g={class:"wpic-input-group flex w-full"};function Ag(t,e,n,r,i,s){return d.openBlock(),d.createElementBlock("div",_g,[d.renderSlot(t.$slots,"default")])}const Vg=be(Ng,[["render",Ag]]),Bg=Object.assign({name:"WpicForm"},{setup(t){return(e,n)=>(d.openBlock(),d.createBlock(d.unref(hg),null,{default:d.withCtx(({values:r,meta:i,errors:s})=>[d.renderSlot(e.$slots,"default")]),_:3}))}}),oa=Math.min,Dr=Math.max,Os=Math.round,Nn=t=>({x:t,y:t}),Pg={left:"right",right:"left",bottom:"top",top:"bottom"},Ig={start:"end",end:"start"};function Jc(t,e,n){return Dr(t,oa(e,n))}function Cs(t,e){return typeof t=="function"?t(e):t}function nr(t){return t.split("-")[0]}function Ts(t){return t.split("-")[1]}function Gc(t){return t==="x"?"y":"x"}function Zc(t){return t==="y"?"height":"width"}function Es(t){return["top","bottom"].includes(nr(t))?"y":"x"}function Xc(t){return Gc(Es(t))}function Rg(t,e,n){n===void 0&&(n=!1);const r=Ts(t),i=Xc(t),s=Zc(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=Ds(o)),[o,Ds(o)]}function $g(t){const e=Ds(t);return[aa(t),e,aa(e)]}function aa(t){return t.replace(/start|end/g,e=>Ig[e])}function Lg(t,e,n){const r=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:r:e?r:i;case"left":case"right":return e?s:o;default:return[]}}function Fg(t,e,n,r){const i=Ts(t);let s=Lg(nr(t),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(aa)))),s}function Ds(t){return t.replace(/left|right|bottom|top/g,e=>Pg[e])}function zg(t){return{top:0,right:0,bottom:0,left:0,...t}}function jg(t){return typeof t!="number"?zg(t):{top:t,right:t,bottom:t,left:t}}function Ns(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 Qc(t,e,n){let{reference:r,floating:i}=t;const s=Es(e),o=Xc(e),a=Zc(o),l=nr(e),c=s==="y",u=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let p;switch(l){case"top":p={x:u,y:r.y-i.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-i.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Ts(e)){case"start":p[o]-=h*(n&&c?-1:1);break;case"end":p[o]+=h*(n&&c?-1:1);break}return p}const Wg=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:f}=Qc(c,r,l),h=r,p={},m=0;for(let y=0;y<a.length;y++){const{name:g,fn:k}=a[y],{x,y:C,data:b,reset:E}=await k({x:u,y:f,initialPlacement:r,placement:h,strategy:i,middlewareData:p,rects:c,platform:o,elements:{reference:t,floating:e}});u=x??u,f=C??f,p={...p,[g]:{...p[g],...b}},E&&m<=50&&(m++,typeof E=="object"&&(E.placement&&(h=E.placement),E.rects&&(c=E.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):E.rects),{x:u,y:f}=Qc(c,h,l)),y=-1)}return{x:u,y:f,placement:h,strategy:i,middlewareData:p}};async function ed(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=Cs(e,t),m=jg(p),g=a[h?f==="floating"?"reference":"floating":f],k=Ns(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(g)))==null||n?g:g.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),x=f==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),b=await(s.isElement==null?void 0:s.isElement(C))?await(s.getScale==null?void 0:s.getScale(C))||{x:1,y:1}:{x:1,y:1},E=Ns(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:C,strategy:l}):x);return{top:(k.top-E.top+m.top)/b.y,bottom:(E.bottom-k.bottom+m.bottom)/b.y,left:(k.left-E.left+m.left)/b.x,right:(E.right-k.right+m.right)/b.x}}const Hg=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...g}=Cs(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const k=nr(i),x=nr(a)===a,C=await(l.isRTL==null?void 0:l.isRTL(c.floating)),b=h||(x||!y?[Ds(a)]:$g(a));!h&&m!=="none"&&b.push(...Fg(a,y,m,C));const E=[a,...b],w=await ed(e,g),_=[];let R=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&_.push(w[k]),f){const D=Rg(i,o,C);_.push(w[D[0]],w[D[1]])}if(R=[...R,{placement:i,overflows:_}],!_.every(D=>D<=0)){var P,z;const D=(((P=s.flip)==null?void 0:P.index)||0)+1,L=E[D];if(L)return{data:{index:D,overflows:R},reset:{placement:L}};let H=(z=R.filter(J=>J.overflows[0]<=0).sort((J,T)=>J.overflows[1]-T.overflows[1])[0])==null?void 0:z.placement;if(!H)switch(p){case"bestFit":{var te;const J=(te=R.map(T=>[T.placement,T.overflows.filter(q=>q>0).reduce((q,re)=>q+re,0)]).sort((T,q)=>T[1]-q[1])[0])==null?void 0:te[0];J&&(H=J);break}case"initialPlacement":H=a;break}if(i!==H)return{reset:{placement:H}}}return{}}}};async function Yg(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=nr(n),a=Ts(n),l=Es(n)==="y",c=["left","top"].includes(o)?-1:1,u=s&&l?-1:1,f=Cs(e,t);let{mainAxis:h,crossAxis:p,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return a&&typeof m=="number"&&(p=a==="end"?m*-1:m),l?{x:p*u,y:h*c}:{x:h*c,y:p*u}}const Ug=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=e,l=await Yg(e,t);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},qg=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:g=>{let{x:k,y:x}=g;return{x:k,y:x}}},...l}=Cs(t,e),c={x:n,y:r},u=await ed(e,l),f=Es(nr(i)),h=Gc(f);let p=c[h],m=c[f];if(s){const g=h==="y"?"top":"left",k=h==="y"?"bottom":"right",x=p+u[g],C=p-u[k];p=Jc(x,p,C)}if(o){const g=f==="y"?"top":"left",k=f==="y"?"bottom":"right",x=m+u[g],C=m-u[k];m=Jc(x,m,C)}const y=a.fn({...e,[h]:p,[f]:m});return{...y,data:{x:y.x-n,y:y.y-r}}}}};function Nr(t){return td(t)?(t.nodeName||"").toLowerCase():"#document"}function ut(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function _n(t){var e;return(e=(td(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function td(t){return t instanceof Node||t instanceof ut(t).Node}function Ht(t){return t instanceof Element||t instanceof ut(t).Element}function Yt(t){return t instanceof HTMLElement||t instanceof ut(t).HTMLElement}function nd(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof ut(t).ShadowRoot}function Oi(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=Vt(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function Kg(t){return["table","td","th"].includes(Nr(t))}function la(t){const e=ca(),n=Vt(t);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function Jg(t){let e=An(t);for(;Yt(e)&&!_r(e);){if(la(e))return e;e=An(e)}return null}function ca(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function _r(t){return["html","body","#document"].includes(Nr(t))}function Vt(t){return ut(t).getComputedStyle(t)}function _s(t){return Ht(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function An(t){if(Nr(t)==="html")return t;const e=t.assignedSlot||t.parentNode||nd(t)&&t.host||_n(t);return nd(e)?e.host:e}function rd(t){const e=An(t);return _r(e)?t.ownerDocument?t.ownerDocument.body:t.body:Yt(e)&&Oi(e)?e:rd(e)}function da(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=rd(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),o=ut(i);return s?e.concat(o,o.visualViewport||[],Oi(i)?i:[],o.frameElement&&n?da(o.frameElement):[]):e.concat(i,da(i,[],n))}function id(t){const e=Vt(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Yt(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r,a=Os(n)!==s||Os(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function sd(t){return Ht(t)?t:t.contextElement}function Ar(t){const e=sd(t);if(!Yt(e))return Nn(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=id(e);let o=(s?Os(n.width):n.width)/r,a=(s?Os(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const Gg=Nn(0);function od(t){const e=ut(t);return!ca()||!e.visualViewport?Gg:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Zg(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==ut(t)?!1:e}function Ci(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=sd(t);let o=Nn(1);e&&(r?Ht(r)&&(o=Ar(r)):o=Ar(t));const a=Zg(s,n,r)?od(s):Nn(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,f=i.height/o.y;if(s){const h=ut(s),p=r&&Ht(r)?ut(r):r;let m=h,y=m.frameElement;for(;y&&r&&p!==m;){const g=Ar(y),k=y.getBoundingClientRect(),x=Vt(y),C=k.left+(y.clientLeft+parseFloat(x.paddingLeft))*g.x,b=k.top+(y.clientTop+parseFloat(x.paddingTop))*g.y;l*=g.x,c*=g.y,u*=g.x,f*=g.y,l+=C,c+=b,m=ut(y),y=m.frameElement}}return Ns({width:u,height:f,x:l,y:c})}const Xg=[":popover-open",":modal"];function ua(t){return Xg.some(e=>{try{return t.matches(e)}catch{return!1}})}function Qg(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",o=_n(r),a=e?ua(e.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=Nn(1);const u=Nn(0),f=Yt(r);if((f||!f&&!s)&&((Nr(r)!=="body"||Oi(o))&&(l=_s(r)),Yt(r))){const h=Ci(r);c=Ar(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x,y:n.y*c.y-l.scrollTop*c.y+u.y}}function e0(t){return Array.from(t.getClientRects())}function ad(t){return Ci(_n(t)).left+_s(t).scrollLeft}function t0(t){const e=_n(t),n=_s(t),r=t.ownerDocument.body,i=Dr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=Dr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+ad(t);const a=-n.scrollTop;return Vt(r).direction==="rtl"&&(o+=Dr(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}function n0(t,e){const n=ut(t),r=_n(t),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const c=ca();(!c||c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a,y:l}}function r0(t,e){const n=Ci(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=Yt(t)?Ar(t):Nn(1),o=t.clientWidth*s.x,a=t.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:o,height:a,x:l,y:c}}function ld(t,e,n){let r;if(e==="viewport")r=n0(t,n);else if(e==="document")r=t0(_n(t));else if(Ht(e))r=r0(e,n);else{const i=od(t);r={...e,x:e.x-i.x,y:e.y-i.y}}return Ns(r)}function cd(t,e){const n=An(t);return n===e||!Ht(n)||_r(n)?!1:Vt(n).position==="fixed"||cd(n,e)}function i0(t,e){const n=e.get(t);if(n)return n;let r=da(t,[],!1).filter(a=>Ht(a)&&Nr(a)!=="body"),i=null;const s=Vt(t).position==="fixed";let o=s?An(t):t;for(;Ht(o)&&!_r(o);){const a=Vt(o),l=la(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Oi(o)&&!l&&cd(t,o))?r=r.filter(u=>u!==o):i=a,o=An(o)}return e.set(t,r),r}function s0(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?ua(e)?[]:i0(e,this._c):[].concat(n),r],a=o[0],l=o.reduce((c,u)=>{const f=ld(e,u,i);return c.top=Dr(f.top,c.top),c.right=oa(f.right,c.right),c.bottom=oa(f.bottom,c.bottom),c.left=Dr(f.left,c.left),c},ld(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function o0(t){const{width:e,height:n}=id(t);return{width:e,height:n}}function a0(t,e,n){const r=Yt(e),i=_n(e),s=n==="fixed",o=Ci(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=Nn(0);if(r||!r&&!s)if((Nr(e)!=="body"||Oi(i))&&(a=_s(e)),r){const f=Ci(e,!0,s,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}else i&&(l.x=ad(i));const c=o.left+a.scrollLeft-l.x,u=o.top+a.scrollTop-l.y;return{x:c,y:u,width:o.width,height:o.height}}function fa(t){return Vt(t).position==="static"}function dd(t,e){return!Yt(t)||Vt(t).position==="fixed"?null:e?e(t):t.offsetParent}function ud(t,e){const n=ut(t);if(ua(t))return n;if(!Yt(t)){let i=An(t);for(;i&&!_r(i);){if(Ht(i)&&!fa(i))return i;i=An(i)}return n}let r=dd(t,e);for(;r&&Kg(r)&&fa(r);)r=dd(r,e);return r&&_r(r)&&fa(r)&&!la(r)?n:r||Jg(t)||n}const l0=async function(t){const e=this.getOffsetParent||ud,n=this.getDimensions,r=await n(t.floating);return{reference:a0(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function c0(t){return Vt(t).direction==="rtl"}const d0={convertOffsetParentRelativeRectToViewportRelativeRect:Qg,getDocumentElement:_n,getClippingRect:s0,getOffsetParent:ud,getElementRects:l0,getClientRects:e0,getDimensions:o0,getScale:Ar,isElement:Ht,isRTL:c0},u0=Ug,f0=qg,h0=Hg,p0=(t,e,n)=>{const r=new Map,i={platform:d0,...n},s={...i.platform,_c:r};return Wg(t,e,{...i,platform:s})};function m0(t,e,n){if(!t)throw new Error("A target component has to be provided.");if(!e)throw new Error("A callback has to be provided.");const r=i=>{i.target===t.value||i.composedPath().includes(t.value)||i.target===n.value||i.composedPath().includes(n.value)||typeof e=="function"&&e()};d.onMounted(()=>{window.addEventListener("click",r)}),d.onBeforeUnmount(()=>{window.removeEventListener("click",r)})}const g0={},y0={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},b0=[d.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"},null,-1)];function k0(t,e){return d.openBlock(),d.createElementBlock("svg",y0,b0)}const As=be(g0,[["render",k0]]);let Vs;const w0=new Uint8Array(16);function v0(){if(!Vs&&(Vs=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Vs))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Vs(w0)}const Le=[];for(let t=0;t<256;++t)Le.push((t+256).toString(16).slice(1));function x0(t,e=0){return Le[t[e+0]]+Le[t[e+1]]+Le[t[e+2]]+Le[t[e+3]]+"-"+Le[t[e+4]]+Le[t[e+5]]+"-"+Le[t[e+6]]+Le[t[e+7]]+"-"+Le[t[e+8]]+Le[t[e+9]]+"-"+Le[t[e+10]]+Le[t[e+11]]+Le[t[e+12]]+Le[t[e+13]]+Le[t[e+14]]+Le[t[e+15]]}const fd={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function hd(t,e,n){if(fd.randomUUID&&!e&&!t)return fd.randomUUID();t=t||{};const r=t.random||(t.rng||v0)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,x0(r)}let ha={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 S0={class:"bg-white rounded-t-lg w-full"},M0={class:"flex justify-between items-center border-b px-4 py-3"},Ti=Object.assign({name:"WpicPopover"},{props:{placement:{type:String,default:"bottom-start"},label:String,hover:Boolean,custom:Boolean,disabled:Boolean,offset:{type:Number,default:0},customWidth:{}},setup(t,{expose:e}){const n=hd(),r=t,i={pmi:"lg:absolute shadow-[0_5px_30px_0px_rgba(0,0,0,0.25)]","wpic-tools":"mt-2 md:absolute border border-slate-300 shadow-md"},s={pmi:"lg:hidden","wpic-tools":"md:hidden"},o=d.ref(null),a=d.ref(null),l=d.ref(!0);ha.isMobile()||m0(a,()=>{u()},o);function c(){ha.isMobile()&&(document.documentElement.style.overflow="hidden",document.querySelector("#app").style.overflow="hidden"),r.disabled||(l.value=!1,f())}function u(){document.documentElement.style.overflow=null,document.querySelector("#app").style.overflow=null,l.value=!0}async function f(){const m=await p0(o.value,a.value,{placement:r.placement,middleware:[h0(),f0(),u0(r.offset)]});a.value.style.left=`${m.x}px`,a.value.style.top=`${m.y}px`}function h(){r.hover&&c()}function p(){r.hover&&u()}return e({hide:u}),(m,y)=>(d.openBlock(),d.createElementBlock(d.Fragment,null,[(d.openBlock(),d.createElementBlock("div",{class:"flex-1",key:`reference_${d.unref(n)}`,ref_key:"reference",ref:o,onMouseenter:h,onMouseleave:p,onClick:y[0]||(y[0]=g=>l.value?c():u())},[d.renderSlot(m.$slots,"default",{isHidden:l.value})],32)),(d.openBlock(),d.createBlock(d.Teleport,{to:"body"},[(d.openBlock(),d.createElementBlock("div",{key:`floating_${d.unref(n)}`,ref_key:"floating",ref:a,class:d.normalizeClass(["z-10 bg-white rounded-md overflow-hidden",{[`${t.customWidth}`]:!0,hidden:l.value,[`${i[d.unref(de).theme]}`]:!l.value,"bg-white px-3 py-2 rounded-md":!t.custom}])},[d.renderSlot(m.$slots,"content")],2)),d.createElementVNode("div",{onClick:y[1]||(y[1]=g=>u()),class:d.normalizeClass(["fixed z-20 flex items-end w-screen h-screen top-0 bg-black/20",{hidden:l.value,[`${s[d.unref(de).theme]}`]:!0}])},[d.createElementVNode("div",S0,[d.createElementVNode("div",M0,[d.createElementVNode("span",null,d.toDisplayString(t.label),1),d.createVNode(As,{onClick:u,class:"w-4 h-4"})]),d.renderSlot(m.$slots,"content")])],2)]))],64))}}),O0={},C0={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},T0=[d.createElementVNode("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"},null,-1),d.createElementVNode("path",{"fill-rule":"evenodd",d:"M1.323 11.447C2.811 6.976 7.028 3.75 12.001 3.75c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113-1.487 4.471-5.705 7.697-10.677 7.697-4.97 0-9.186-3.223-10.675-7.69a1.762 1.762 0 0 1 0-1.113ZM17.25 12a5.25 5.25 0 1 1-10.5 0 5.25 5.25 0 0 1 10.5 0Z","clip-rule":"evenodd"},null,-1)];function E0(t,e){return d.openBlock(),d.createElementBlock("svg",C0,T0)}const D0=be(O0,[["render",E0]]),N0={},_0={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},A0=[d.createElementVNode("path",{d:"M3.53 2.47a.75.75 0 0 0-1.06 1.06l18 18a.75.75 0 1 0 1.06-1.06l-18-18ZM22.676 12.553a11.249 11.249 0 0 1-2.631 4.31l-3.099-3.099a5.25 5.25 0 0 0-6.71-6.71L7.759 4.577a11.217 11.217 0 0 1 4.242-.827c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113Z"},null,-1),d.createElementVNode("path",{d:"M15.75 12c0 .18-.013.357-.037.53l-4.244-4.243A3.75 3.75 0 0 1 15.75 12ZM12.53 15.713l-4.243-4.244a3.75 3.75 0 0 0 4.244 4.243Z"},null,-1),d.createElementVNode("path",{d:"M6.75 12c0-.619.107-1.213.304-1.764l-3.1-3.1a11.25 11.25 0 0 0-2.63 4.31c-.12.362-.12.752 0 1.114 1.489 4.467 5.704 7.69 10.675 7.69 1.5 0 2.933-.294 4.242-.827l-2.477-2.477A5.25 5.25 0 0 1 6.75 12Z"},null,-1)];function V0(t,e){return d.openBlock(),d.createElementBlock("svg",_0,A0)}const B0=be(N0,[["render",V0]]),P0={},I0={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},R0=[d.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4.5 12.75l6 6 9-13.5"},null,-1)];function $0(t,e){return d.openBlock(),d.createElementBlock("svg",I0,R0)}const pd=be(P0,[["render",$0]]),L0={},F0={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},z0=[d.createElementVNode("path",{"fill-rule":"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm8.706-1.442c1.146-.573 2.437.463 2.126 1.706l-.709 2.836.042-.02a.75.75 0 0 1 .67 1.34l-.04.022c-1.147.573-2.438-.463-2.127-1.706l.71-2.836-.042.02a.75.75 0 1 1-.671-1.34l.041-.022ZM12 9a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z","clip-rule":"evenodd"},null,-1)];function j0(t,e){return d.openBlock(),d.createElementBlock("svg",F0,z0)}const md=be(L0,[["render",j0]]);var Bs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function W0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function H0(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var gd=H0,Y0=typeof Bs=="object"&&Bs&&Bs.Object===Object&&Bs,U0=Y0,q0=U0,K0=typeof self=="object"&&self&&self.Object===Object&&self,J0=q0||K0||Function("return this")(),yd=J0,G0=yd,Z0=function(){return G0.Date.now()},X0=Z0,Q0=/\s/;function ey(t){for(var e=t.length;e--&&Q0.test(t.charAt(e)););return e}var ty=ey,ny=ty,ry=/^\s+/;function iy(t){return t&&t.slice(0,ny(t)+1).replace(ry,"")}var sy=iy,oy=yd,ay=oy.Symbol,bd=ay,kd=bd,wd=Object.prototype,ly=wd.hasOwnProperty,cy=wd.toString,Ei=kd?kd.toStringTag:void 0;function dy(t){var e=ly.call(t,Ei),n=t[Ei];try{t[Ei]=void 0;var r=!0}catch{}var i=cy.call(t);return r&&(e?t[Ei]=n:delete t[Ei]),i}var uy=dy,fy=Object.prototype,hy=fy.toString;function py(t){return hy.call(t)}var my=py,vd=bd,gy=uy,yy=my,by="[object Null]",ky="[object Undefined]",xd=vd?vd.toStringTag:void 0;function wy(t){return t==null?t===void 0?ky:by:xd&&xd in Object(t)?gy(t):yy(t)}var vy=wy;function xy(t){return t!=null&&typeof t=="object"}var Sy=xy,My=vy,Oy=Sy,Cy="[object Symbol]";function Ty(t){return typeof t=="symbol"||Oy(t)&&My(t)==Cy}var Ey=Ty,Dy=sy,Sd=gd,Ny=Ey,Md=NaN,_y=/^[-+]0x[0-9a-f]+$/i,Ay=/^0b[01]+$/i,Vy=/^0o[0-7]+$/i,By=parseInt;function Py(t){if(typeof t=="number")return t;if(Ny(t))return Md;if(Sd(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Sd(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=Dy(t);var n=Ay.test(t);return n||Vy.test(t)?By(t.slice(2),n?2:8):_y.test(t)?Md:+t}var Iy=Py,Ry=gd,pa=X0,Od=Iy,$y="Expected a function",Ly=Math.max,Fy=Math.min;function zy(t,e,n){var r,i,s,o,a,l,c=0,u=!1,f=!1,h=!0;if(typeof t!="function")throw new TypeError($y);e=Od(e)||0,Ry(n)&&(u=!!n.leading,f="maxWait"in n,s=f?Ly(Od(n.maxWait)||0,e):s,h="trailing"in n?!!n.trailing:h);function p(w){var _=r,R=i;return r=i=void 0,c=w,o=t.apply(R,_),o}function m(w){return c=w,a=setTimeout(k,e),u?p(w):o}function y(w){var _=w-l,R=w-c,P=e-_;return f?Fy(P,s-R):P}function g(w){var _=w-l,R=w-c;return l===void 0||_>=e||_<0||f&&R>=s}function k(){var w=pa();if(g(w))return x(w);a=setTimeout(k,y(w))}function x(w){return a=void 0,h&&r?p(w):(r=i=void 0,o)}function C(){a!==void 0&&clearTimeout(a),c=0,r=l=i=a=void 0}function b(){return a===void 0?o:x(pa())}function E(){var w=pa(),_=g(w);if(r=arguments,i=this,l=w,_){if(a===void 0)return m(l);if(f)return clearTimeout(a),a=setTimeout(k,e),p(l)}return a===void 0&&(a=setTimeout(k,e)),o}return E.cancel=C,E.flush=b,E}var jy=zy;const Wy=W0(jy),Hy={key:0,class:"mb-2 gap-2 wpic-form-label text-base text-zinc-600 dark:text-zinc-300 flex items-center"},Yy={class:""},Uy=["name","value","checked"],qy={key:0,class:"absolute left-0 ml-3 h-full flex items-center justify-center text-center"},Ky={class:"opacity-50 w-4 h-4 leading-tight"},Jy={key:3,class:"absolute z-10 right-0 mr-3 h-full flex items-center"},Gy={class:"min-w-5 h-5 leading-tight cursor-pointer"},Zy={key:5,class:"text-red-700 mt-1 text-base"},Xy=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},emits:["onChange","update:modelValue","onClear"],setup(t,{expose:e,emit:n}){const r={pmi:"shadow-inner border-zinc-400 focus-within:border-zinc-500 focus-within:outline focus-within:outline-2 focus-within:outline-offset-3 bg-zinc-100 dark:bg-zinc-700/25 dark:border-zinc-700/50 dark:text-zinc-300","wpic-tools":"border-slate-300 bg-white focus-within:border-blue-400 outline-blue-200 focus-within:outline focus-within:outline-[3px]"},i=t,s=d.computed(()=>i.name?i.name:hd()),o=mg(s.value),a=d.computed(()=>{if(i.label)return i.label;if(i.name&&i.labelName)return`${i.name}#${i.labelName}`}),l=d.ref(!0),c=d.computed(()=>(i.type=="password"||i.password)&&l.value?"password":i.type);function u(){l.value=!l.value}const f=d.computed(()=>{if(i.rules&&typeof i.rules=="string"){let w=i.rules.split("|");return i.required&&w.push("required"),i.email&&w.push("email"),w.join("|")}else if(!i.rules){let w=[];return i.required&&w.push("required"),i.email&&w.push("email"),w.join("|")}return"required"});function h(w){let _=w&&w.target?w.target.value:w;k(_)}const p=n;function m(w){w===!0||w===!1?p("update:modelValue",!w):p("update:modelValue",w)}function y(w){let _=w&&w.target?w.target.value:w;p("update:modelValue",_),p("onChange",_)}function g(){p("update:modelValue",null),p("onChange",null),p("onClear")}const k=Wy(function(w){p("update:modelValue",w),p("onChange",w)},i.debounce),x=d.ref(null),C=d.ref(!1);d.watch(()=>i.modelValue,w=>{i.tag=="textarea"&&(x.value.$el.style.height="auto",d.nextTick(()=>{i.minHeight&&(x.value.$el.style.height=`${x.value.$el.scrollHeight<i.minHeight?i.minHeight:x.value.$el.scrollHeight}px`),i.maxHeight&&(x.value.$el.scrollHeight>i.maxHeight?(x.value.$el.style.height=`${i.maxHeight}px`,C.value=!0):C.value=!1)}))},{deep:!0});function b(){var w;i.tag=="textarea"?x.value.$el.focus():(w=x.value)==null||w.$el.focus()}function E(){return x.value.meta.valid}return e({focus:b,isValid:E}),(w,_)=>{const R=d.resolveComponent("wpic-choice-list");return d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["wpic-form-field",{"mb-6":!t.slim}])},[a.value&&!t.checkbox&&!t.radio?(d.openBlock(),d.createElementBlock("div",Hy,[d.createTextVNode(d.toDisplayString(a.value)+" ",1),d.createElementVNode("div",Yy,[t.info?(d.openBlock(),d.createBlock(Ti,{key:0,hover:""},{content:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(t.info),1)]),default:d.withCtx(()=>[d.createVNode(md,{class:"w-4 h-4 text-zinc-600"})]),_:1})):d.createCommentVNode("",!0)])])):d.createCommentVNode("",!0),t.checkbox?(d.openBlock(),d.createBlock(d.unref(Ss),{key:1,ref_key:"myInput",ref:x,name:s.value,rules:f.value,value:t.checkboxValue,"unchecked-value":t.uncheckedValue,modelValue:t.modelValue},{default:d.withCtx(({field:P})=>[d.createElementVNode("div",{class:"inline-flex items-center gap-2",onClick:_[0]||(_[0]=z=>t.disabled?void 0:m(t.modelValue))},[d.createElementVNode("div",{class:d.normalizeClass(["w-4 h-4 border rounded-sm cursor-pointer",{"border-zinc-400":!t.disabled&&!t.modelValue,"bg-violet-800 border-violet-800 text-white":t.modelValue===!0,"bg-opacity-50 border-opacity-50 text-opacity-75":t.disabled}])},[t.modelValue===!0?(d.openBlock(),d.createBlock(pd,{key:0})):d.createCommentVNode("",!0)],2),d.createElementVNode("span",{class:d.normalizeClass(["text-base cursor-pointer select-none",{"opacity-50":t.disabled}])},[d.renderSlot(w.$slots,"default",{},()=>[d.createTextVNode(d.toDisplayString(a.value),1)])],2)])]),_:3},8,["name","rules","value","unchecked-value","modelValue"])):t.radio?(d.openBlock(),d.createBlock(d.unref(Ss),{key:2,ref_key:"myInput",ref:x,name:s.value,value:t.radioValue,modelValue:t.modelValue},{default:d.withCtx(({field:P})=>[d.createElementVNode("div",{onClick:_[2]||(_[2]=()=>{t.disabled||y(t.radioValue)}),class:d.normalizeClass([{"cursor-pointer":!t.disabled},"inline-flex items-center gap-2 select-none"])},[d.createElementVNode("span",{class:d.normalizeClass(["h-4 w-4 border border-zinc-400 rounded-full p-[2px]",{"border-opacity-50":t.disabled}])},[t.radioValue==t.modelValue?(d.openBlock(),d.createElementBlock("span",{key:0,class:d.normalizeClass(["flex rounded-full h-full w-full bg-violet-800",{"bg-opacity-50":t.disabled}])},null,2)):d.createCommentVNode("",!0)],2),d.createElementVNode("input",{class:"hidden",type:"radio",name:t.name,value:t.radioValue,onChange:_[1]||(_[1]=(...z)=>w.onChange&&w.onChange(...z)),checked:t.radioValue==t.modelValue},null,40,Uy),a.value?(d.openBlock(),d.createElementBlock("span",{key:0,class:d.normalizeClass(["text-base",{"opacity-50":t.disabled}])},d.toDisplayString(a.value),3)):d.createCommentVNode("",!0)],2)]),_:1},8,["name","value","modelValue"])):t.select?(d.openBlock(),d.createBlock(d.unref(Ss),{key:3,ref_key:"myInput",ref:x,modelValue:t.modelValue,rules:f.value,name:s.value},{default:d.withCtx(({field:P})=>{var z;return[d.createVNode(R,{modelValue:t.modelValue,"onUpdate:modelValue":y,disabled:t.disabled,options:t.options,small:t.small,hideSelect:t.hideSelect,multiple:t.multiple,isInvalid:!!(t.error&&d.unref(o)),required:t.required||((z=f.value)==null?void 0:z.indexOf("required"))>=0,label:a.value,placeholder:"Select..."},null,8,["modelValue","disabled","options","small","hideSelect","multiple","isInvalid","required","label"])]}),_:1},8,["modelValue","rules","name"])):(d.openBlock(),d.createElementBlock("div",{key:4,class:d.normalizeClass(["wpic-input rounded flex relative border",{[`${r[d.unref(de).theme]}`]:!0,"h-10":!t.textarea&&!t.large,"h-12":!t.textarea&&t.large,"border-opacity-50 border-zinc-300 text-zinc-400":t.disabled,"!border-red-600 focus-within:outline-red-600":d.unref(o)}])},[w.$slots.prepend?(d.openBlock(),d.createElementBlock("div",qy,[d.createElementVNode("div",Ky,[d.renderSlot(w.$slots,"prepend")])])):d.createCommentVNode("",!0),d.createVNode(d.unref(Ss),{ref_key:"myInput",ref:x,as:t.textarea?"textarea":void 0,autocomplete:"off",style:{"z-index":"1"},class:d.normalizeClass(["flex w-full h-full rounded pr-4 bg-transparent outline-none appearance-none",{"pl-4":!w.$slots.prepend,"pl-12":w.$slots.prepend,"py-2":t.textarea,"cursor-not-allowed":t.disabled}]),type:c.value,min:t.min,max:t.max,rows:t.rows,name:s.value,disabled:t.disabled,modelValue:t.modelValue,onInput:h,placeholder:t.placeholder,validateOnInput:!!d.unref(o),rules:f.value},null,8,["as","class","type","min","max","rows","name","disabled","modelValue","placeholder","validateOnInput","rules"]),t.loading?(d.openBlock(),d.createElementBlock("div",{key:1,onClick:g,class:"absolute right-0 mr-3 h-full flex items-center cursor-pointer opacity-75 hover:opacity-100"},[d.createVNode(Mi,{class:"w-6 h-6 opacity-50"})])):t.clearable&&t.modelValue?(d.openBlock(),d.createElementBlock("div",{key:2,onClick:d.withModifiers(g,["stop"]),style:{"z-index":"2"},class:"absolute right-0 mr-3 h-full flex items-center cursor-pointer opacity-75 hover:opacity-100"},[d.createVNode(As,{class:"w-5 h-5 opacity-50"})])):d.createCommentVNode("",!0),w.$slots.append||t.password||t.type=="password"?(d.openBlock(),d.createElementBlock("div",Jy,[d.createElementVNode("div",Gy,[d.renderSlot(w.$slots,"append",{},()=>[d.withDirectives(d.createVNode(D0,{class:"text-zinc-600 select-none",onClick:u},null,512),[[d.vShow,l.value]]),d.withDirectives(d.createVNode(B0,{class:"text-zinc-600 select-none",onClick:u},null,512),[[d.vShow,!l.value]])])])])):d.createCommentVNode("",!0)],2)),t.error&&d.unref(o)?(d.openBlock(),d.createElementBlock("div",Zy,[d.createVNode(d.unref(pg),{name:s.value},{default:d.withCtx(P=>[d.createTextVNode(d.toDisplayString(P.message),1)]),_:1},8,["name"])])):d.createCommentVNode("",!0),w.$slots.help||t.help?(d.openBlock(),d.createElementBlock("div",{key:6,class:d.normalizeClass(["text-base mt-1",{"ml-7":t.type=="checkbox","opacity-50":t.disabled}])},[d.renderSlot(w.$slots,"help",{},()=>[d.createTextVNode(d.toDisplayString(t.help),1)])],2)):d.createCommentVNode("",!0)],2)}}}),Qy={key:0,class:"mb-2 gap-2 wpic-form-label text-base text-zinc-600 dark:text-zinc-300 flex items-center"},eb={class:""},tb={key:0,class:"absolute left-0 ml-3 h-full flex items-center justify-center text-center"},nb={class:"opacity-50 w-4 h-4 leading-tight"},Cd=Object.assign({name:"WpicFormInput"},{props:{label:String,info:String,disabled:Boolean,large:Boolean,clearable:Boolean,loading:Boolean},emits:["onClear"],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":"border-slate-300 bg-white focus-within:border-blue-400 outline-blue-200 focus-within:outline focus-within:outline-[3px]"},r={pmi:"border-opacity-50 border-zinc-300 text-zinc-400","wpic-tools":"border-slate-200 text-slate-400"},i=e;function s(){i("onClear")}return(o,a)=>{const l=d.resolveComponent("wpic-spinner");return d.openBlock(),d.createElementBlock(d.Fragment,null,[t.label?(d.openBlock(),d.createElementBlock("div",Qy,[d.createTextVNode(d.toDisplayString(t.label)+" ",1),d.createElementVNode("div",eb,[t.info?(d.openBlock(),d.createBlock(Ti,{key:0,hover:""},{content:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(t.info),1)]),default:d.withCtx(()=>[d.createVNode(md,{class:"w-4 h-4 text-zinc-600"})]),_:1})):d.createCommentVNode("",!0)])])):d.createCommentVNode("",!0),d.createElementVNode("div",{class:d.normalizeClass(["wpic-input rounded flex relative border pr-4 items-center",{"pl-4":!o.$slots.prepend,"pl-10":o.$slots.prepend,[`${n[d.unref(de).theme]}`]:!0,"h-10":!t.large,"h-12":t.large,[`${r[d.unref(de).theme]}`]:t.disabled,"cursor-pointer":!t.disabled}])},[o.$slots.prepend?(d.openBlock(),d.createElementBlock("div",tb,[d.createElementVNode("div",nb,[d.renderSlot(o.$slots,"prepend")])])):d.createCommentVNode("",!0),d.renderSlot(o.$slots,"default"),t.loading?(d.openBlock(),d.createElementBlock("div",{key:1,onClick:s,class:"absolute right-0 mr-3 h-full flex items-center cursor-pointer opacity-75 hover:opacity-100"},[d.createVNode(l,{class:"w-6 h-6 opacity-50"})])):t.clearable?(d.openBlock(),d.createElementBlock("div",{key:2,onClick:d.withModifiers(s,["stop"]),style:{"z-index":"2"},class:"absolute right-0 mr-3 h-full flex items-center cursor-pointer opacity-75 hover:opacity-100"},[d.createVNode(As,{class:"w-5 h-5 opacity-50"})])):d.createCommentVNode("",!0)],2)],64)}}}),rb={},ib={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},sb=[d.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"},null,-1)];function ob(t,e){return d.openBlock(),d.createElementBlock("svg",ib,sb)}const ab=be(rb,[["render",ob]]),lb=["disabled"],cb={key:0,class:"leading-none"},db={key:0},ub={key:1,class:"flex flex-col max-h-80 overflow-y-auto"},fb={key:0,class:"px-4 py-2 flex items-center justify-between text-sm gap-6"},hb=["onClick"],pb={class:"select-none flex w-full items-center justify-between"},mb=Object.assign({name:"WpicChoiceList"},{props:{modelValue:{},value:{},name:String,small:Boolean,hideSelect:Boolean,label:String,placeholder:String,options:Array,multiple:Boolean,required:Boolean,disabled:Boolean,isInvalid:Boolean,maxDisplay:{type:Number},batchSelect:{type:Boolean,default:!0}},emits:["blur","input","change","update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=d.ref();function s(h){if(n.multiple){if(h){let p=n.modelValue||[];p.indexOf(h)>=0?p.splice(p.indexOf(h),1):p.push(h),r("update:modelValue",p)}}else r("update:modelValue",h),i.value.hide()}function o(h){r("update:modelValue",h)}const a=d.computed(()=>{var h,p,m,y;if(n.multiple)if(n.maxDisplay){let g=(p=n.options)==null?void 0:p.filter(x=>{var C;return((C=n.modelValue)==null?void 0:C.indexOf(x.value))>=0}).map(x=>x.label),k=g==null?void 0:g.slice(0,n.maxDisplay);return g.length-k.length>0?(k==null?void 0:k.join(", "))+` (+${g.length-k.length})`:k==null?void 0:k.join(", ")}else return(h=n.options)==null?void 0:h.filter(g=>{var k;return((k=n.modelValue)==null?void 0:k.indexOf(g.value))>=0}).map(g=>g.label).join(", ");else return((y=(m=n.options)==null?void 0:m.find(g=>g.value===n.modelValue))==null?void 0:y.label)||n.modelValue}),l=d.computed(()=>{if(n.required)return n.options;{let h=n.options;return h==null||h.unshift({label:n.placeholder||"-",value:null}),h}});function c(h){var p;return n.multiple?n.modelValue!==null&&((p=n.modelValue)==null?void 0:p.indexOf(h))>=0:n.modelValue!==null&&h===n.modelValue}const u={pmi:"text-zinc-800 dark:text-zinc-300 disabled:bg-zinc-50 disabled:border-zinc-300 disabled:text-zinc-400 enabled:bg-zinc-100 enabled:border-zinc-400 enabled:text-zinc-500 enabled:dark:bg-zinc-700/25 enabled:dark:border-zinc-700/50 enabled:dark:text-zinc-300","wpic-tools":"text-slate-800 disabled:text-slate-400 disabled:border-slate-200 bg-white border-slate-300 focus-within:border-lime-400 disabled:bg-slate-50"},f={pmi:"group-[.is-selected]:bg-violet-50 group-[.is-selected]:hover:bg-violet-100","wpic-tools":"hover:bg-slate-50 group-[.is-selected]:text-lime-500 group-[.is-selected]:font-medium text-slate-600"};return(h,p)=>(d.openBlock(),d.createBlock(Ti,{custom:"",ref_key:"myPopover",ref:i,label:t.label,disabled:t.disabled},{default:d.withCtx(({isHidden:m})=>{var y;return[d.createElementVNode("button",{class:d.normalizeClass(["flex appearance-none w-full items-center gap-2 px-3 lg:text-base rounded border overflow-hidden leading-none",{"h-10":!t.small,"h-8":t.small,"cursor-pointer":!t.disabled,"!border-red-600 focus-within:outline-red-600":t.isInvalid,[`${u[d.unref(de).theme]}`]:!0}]),disabled:t.disabled},[d.createElementVNode("span",{class:d.normalizeClass(["select-none w-full text-left flex-1",{"whitespace-pre":!t.multiple}])},[t.modelValue&&((y=t.modelValue)==null?void 0:y.length)>0&&!t.hideSelect?(d.openBlock(),d.createElementBlock("span",cb,d.toDisplayString(a.value),1)):d.renderSlot(h.$slots,"default",{key:1},()=>[d.createTextVNode(d.toDisplayString(t.placeholder),1)])],2),d.createVNode(ab,{class:d.normalizeClass(["h-4 w-4 transition-all transform",{"rotate-180":!m}])},null,8,["class"])],10,lb)]}),content:d.withCtx(()=>{var m;return[!t.options&&((m=t.options)==null?void 0:m.length)==0?(d.openBlock(),d.createElementBlock("span",db,"No data.")):(d.openBlock(),d.createElementBlock("div",ub,[t.multiple&&t.batchSelect?(d.openBlock(),d.createElementBlock("div",fb,[d.createElementVNode("span",{class:"cursor-pointer opacity-50 hover:opacity-100",onClick:p[0]||(p[0]=y=>{var g;return o((g=t.options)==null?void 0:g.filter(k=>k.value).map(k=>k.value))})},"Select all"),d.createElementVNode("span",{class:"cursor-pointer opacity-50 hover:opacity-100",onClick:p[1]||(p[1]=y=>o([]))},"Select none")])):d.createCommentVNode("",!0),(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(l.value,y=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["group",{"is-selected":!!c(y.value)}])},[d.createElementVNode("div",{class:d.normalizeClass(["flex items-center py-2 px-4 min-w-64 text-base",{"cursor-pointer":!t.multiple||y.value,[`${f[d.unref(de).theme]}`]:!0}]),onClick:g=>y.disabled?null:s(y.value)},[d.createElementVNode("div",pb,[d.createElementVNode("span",{class:d.normalizeClass(["",{"opacity-25":y.disabled}])},d.toDisplayString(y.label||y.value),3),c(y.value)?(d.openBlock(),d.createBlock(pd,{key:0,class:"w-4 h-4"})):d.createCommentVNode("",!0)])],10,hb)],2))),256))]))]}),_:3},8,["label","disabled"]))}}),gb={key:0,class:"flex justify-between items-baseline pt-6 px-6"},yb={key:0,class:"text-xl font-bold"},bb={class:""},kb={key:1,class:"flex items-center justify-end py-4 px-6"},wb=Object.assign({name:"WpicCard"},{props:{title:String},setup(t){const e={pmi:"shadow-[0_4px_16px_0px_rgba(0,0,0,0.1)]","wpic-tools":"border border-slate-300"};return(n,r)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["bg-white dark:bg-zinc-800/50 rounded-lg wpic-card",[e[d.unref(de).theme]]])},[t.title||n.$slots.actions?(d.openBlock(),d.createElementBlock("div",gb,[t.title?(d.openBlock(),d.createElementBlock("div",yb,d.toDisplayString(t.title),1)):d.createCommentVNode("",!0),d.createElementVNode("div",bb,[d.renderSlot(n.$slots,"actions")])])):d.createCommentVNode("",!0),d.renderSlot(n.$slots,"default"),n.$slots.buttons?(d.openBlock(),d.createElementBlock("div",kb,[d.renderSlot(n.$slots,"buttons")])):d.createCommentVNode("",!0)],2))}}),vb={name:"WpicCardSection"},xb={class:"py-6 border-b last:border-0 mx-6"};function Sb(t,e,n,r,i,s){return d.openBlock(),d.createElementBlock("div",xb,[d.renderSlot(t.$slots,"default")])}const Mb=be(vb,[["render",Sb]]),Ob={class:"flex h-2 rounded-full w-full ring-1 ring-zinc-400"},Cb=Object.assign({name:"WpicProgressBar"},{props:{value:Number},setup(t){return(e,n)=>(d.openBlock(),d.createElementBlock("div",Ob,[t.value>0?(d.openBlock(),d.createElementBlock("div",{key:0,style:d.normalizeStyle({width:`${t.value}%`}),class:"flex h-full bg-cyan-400 ring-1 ring-cyan-400 rounded-full"},null,4)):d.createCommentVNode("",!0)]))}}),Tb={class:"text-base leading-none"},Eb=Object.assign({name:"WpicTag"},{props:{clearable:Boolean},emits:["clear"],setup(t,{emit:e}){const n={pmi:"border-cyan-500 bg-cyan-50 text-cyan-600","wpic-tools":"border-slate-300 bg-slate-200 text-slate-800"},r=e;function i(){r("clear")}return(s,o)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["wpic-tag select-none border inline-flex rounded h-8 items-center justify-center pl-3 py-1",{"pr-3":!t.clearable,"pr-2":t.clearable,[n[d.unref(de).theme]]:!0}])},[d.createElementVNode("span",Tb,[d.renderSlot(s.$slots,"default")]),t.clearable?(d.openBlock(),d.createElementBlock("span",{key:0,onClick:i,class:"ml-1 cursor-pointer opacity-75 hover:opacity-100"},[d.createVNode(As,{class:"w-4 h-4"})])):d.createCommentVNode("",!0)],2))}}),Db=Object.assign({name:"WpicTagGroup"},{props:{full:Boolean},setup(t){return(e,n)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass({"w-full":t.full})},[d.createElementVNode("div",{class:d.normalizeClass(["ui-tag-group flex flex-wrap gap-2",{"w-full":t.full}])},[d.renderSlot(e.$slots,"default")],2)],2))}}),Nb={class:"w-full h-full flex items-center justify-center"},_b=Object.assign({name:"WpicLoadingPanel"},{props:{color:{type:String,default:""}},setup(t){return(e,n)=>(d.openBlock(),d.createElementBlock("div",Nb,[d.createVNode(Mi,{color:t.color,class:"w-10 h-10"},null,8,["color"])]))}}),Ab={class:"text-base font-medium"},Di=Object.assign({name:"WpicPaginationItem"},{props:{active: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":"hover:text-lime-600"},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"};return(r,i)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["border rounded flex items-center justify-center w-10 h-10 cursor-pointer",{[e[d.unref(de).theme]]:!t.active,[n[d.unref(de).theme]]:t.active}])},[d.createElementVNode("span",Ab,[d.renderSlot(r.$slots,"default")])],2))}}),Vb={},Bb={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},Pb=[d.createElementVNode("path",{"fill-rule":"evenodd",d:"M4.72 9.47a.75.75 0 0 0 0 1.06l4.25 4.25a.75.75 0 1 0 1.06-1.06L6.31 10l3.72-3.72a.75.75 0 1 0-1.06-1.06L4.72 9.47Zm9.25-4.25L9.72 9.47a.75.75 0 0 0 0 1.06l4.25 4.25a.75.75 0 1 0 1.06-1.06L11.31 10l3.72-3.72a.75.75 0 0 0-1.06-1.06Z","clip-rule":"evenodd"},null,-1)];function Ib(t,e){return d.openBlock(),d.createElementBlock("svg",Bb,Pb)}const Td=be(Vb,[["render",Ib]]),Rb={},$b={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},Lb=[d.createElementVNode("path",{"fill-rule":"evenodd",d:"M11.78 5.22a.75.75 0 0 1 0 1.06L8.06 10l3.72 3.72a.75.75 0 1 1-1.06 1.06l-4.25-4.25a.75.75 0 0 1 0-1.06l4.25-4.25a.75.75 0 0 1 1.06 0Z","clip-rule":"evenodd"},null,-1)];function Fb(t,e){return d.openBlock(),d.createElementBlock("svg",$b,Lb)}const Ed=be(Rb,[["render",Fb]]),zb={},jb={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},Wb=[d.createElementVNode("path",{"fill-rule":"evenodd",d:"M15.28 9.47a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 1 1-1.06-1.06L13.69 10 9.97 6.28a.75.75 0 0 1 1.06-1.06l4.25 4.25ZM6.03 5.22l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L8.69 10 4.97 6.28a.75.75 0 0 1 1.06-1.06Z","clip-rule":"evenodd"},null,-1)];function Hb(t,e){return d.openBlock(),d.createElementBlock("svg",jb,Wb)}const Dd=be(zb,[["render",Hb]]),Yb={},Ub={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},qb=[d.createElementVNode("path",{"fill-rule":"evenodd",d:"M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z","clip-rule":"evenodd"},null,-1)];function Kb(t,e){return d.openBlock(),d.createElementBlock("svg",Ub,qb)}const Nd=be(Yb,[["render",Kb]]),Jb={class:"wpic-pagination flex justify-between"},Gb={key:0,class:"flex items-center"},Zb={key:1,class:"flex flex-wrap gap-2"},Xb=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:Number},emits:["update:perPage","update:currentPage"],setup(t,{expose:e,emit:n}){const r=t,i=n,s=d.computed(()=>Math.ceil(r.total/r.perPage)),o=d.computed(()=>{const u=s.value,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<=s.value&&i("update:currentPage",u)}function l(){return r.perPage*(r.currentPage-1)+1}function c(){return r.perPage*r.currentPage>r.total?r.total:r.perPage*r.currentPage}return e({getStart:l,getEnd:c}),(u,f)=>(d.openBlock(),d.createElementBlock("div",Jb,[t.info?(d.openBlock(),d.createElementBlock("div",Gb,d.toDisplayString(l())+" - "+d.toDisplayString(c())+" / "+d.toDisplayString(t.total),1)):d.createCommentVNode("",!0),t.pages?(d.openBlock(),d.createElementBlock("div",Zb,[d.createVNode(Di,{onClick:f[0]||(f[0]=h=>a(1)),disabled:t.currentPage===1},{default:d.withCtx(()=>[d.createVNode(Td,{class:"w-5 h-5 select-none opacity-50 hover:opacity-100"})]),_:1},8,["disabled"]),d.createVNode(Di,{onClick:f[1]||(f[1]=h=>a(t.currentPage-1)),disabled:t.currentPage===1},{default:d.withCtx(()=>[d.createVNode(Ed,{class:"w-5 h-5 select-none opacity-50 hover:opacity-100"})]),_:1},8,["disabled"]),(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(o.value,h=>(d.openBlock(),d.createBlock(Di,{key:h,onClick:p=>a(h),active:h===t.currentPage},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(h),1)]),_:2},1032,["onClick","active"]))),128)),d.createVNode(Di,{onClick:f[2]||(f[2]=h=>a(t.currentPage+1)),disabled:t.currentPage===s.value},{default:d.withCtx(()=>[d.createVNode(Nd,{class:"w-5 h-5 select-none opacity-50 hover:opacity-100"})]),_:1},8,["disabled"]),d.createVNode(Di,{onClick:f[3]||(f[3]=h=>a(s.value)),disabled:t.currentPage===s.value},{default:d.withCtx(()=>[d.createVNode(Dd,{class:"w-5 h-5 select-none opacity-50 hover:opacity-100"})]),_:1},8,["disabled"])])):d.createCommentVNode("",!0),d.createCommentVNode("",!0)]))}}),_d=(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 d.h("td",e.attrs,[d.h("div",{class:""},n)])};_d.props=["column","item","rowIndex"];const Ad=_d,Qb={},e1={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},t1=[d.createElementVNode("path",{"fill-rule":"evenodd",d:"M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z","clip-rule":"evenodd"},null,-1)];function n1(t,e){return d.openBlock(),d.createElementBlock("svg",e1,t1)}const r1=be(Qb,[["render",n1]]),i1={class:"font-semibold"},Vd={__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-slate-50 border-slate-200 dark:border-slate-900 dark:bg-slate-800"};return(n,r)=>(d.openBlock(),d.createElementBlock("tr",i1,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(t.columns,(i,s)=>(d.openBlock(),d.createBlock(Ad,{class:d.normalizeClass(["py-3 first:pl-6 pr-6 border-t",{[`${e[d.unref(de).theme]}`]:!0,"sticky left-0":s===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_${s}`,column:i,item:t.totalItem,key:`tr_total_${s}`},null,8,["class","id","column","item"]))),128))]))}},s1={class:"overflow-auto"},o1={class:"w-full rounded-lg"},a1=["width","max-width"],l1={key:0,class:"rounded-t-lg"},c1=["onClick"],d1={class:"rounded-b-lg"},u1={key:1},f1=Object.assign({name:"WpicTable"},{props:{data:{type:Array,default:()=>[]},loading:Boolean,hideHeaders:Boolean,sortOptions:{},border:Boolean,noXPadding:Boolean,totalItem:{},totalOnBottom:Boolean,totalOnTop:Boolean},emits:["changeSort"],setup(t,{expose:e,emit:n}){const r=t,i={pmi:"","wpic-tools":"border-slate-300"},s={pmi:"bg-zinc-50 dark:bg-zinc-800/60 text-zinc-500 dark:text-zinc-400 dark:border-zinc-900","wpic-tools":"bg-slate-100 dark:bg-slate-800/60 text-slate-400 dark:text-slate-400 border-slate-200 dark:border-slate-900"},o={pmi:"bg-white dark:text-zinc-300 dark:border-zinc-900 dark:bg-zinc-800","wpic-tools":"bg-white border-slate-200 dark:border-slate-900 dark:bg-slate-800"},a={pmi:"bg-zinc-900/10","wpic-tools":"bg-slate-900/10"},l=n;d.onMounted(()=>{h()});const c=d.getCurrentInstance();d.provide("wtable",c==null?void 0:c.proxy);const u=d.useSlots(),f=d.ref([]);function h(){const m=(k,x)=>{let C={};for(let b in k){if(typeof k[b].default=="boolean"&&x[b]!==void 0){C[b]=x[b]!==!1;continue}if(x[b]!==void 0){C[b]=x[b];continue}if(typeof k[b].default=="function"){C[b]=k[b].default();continue}C[b]=k[b].default}return C};let y=[];(u.default&&u.default()||[]).forEach(k=>{var x,C;((x=k.type)==null?void 0:x.name)==="WpicTableColumn"?y.push(k):(C=k.children)!=null&&C.length&&k.children.forEach(b=>{var E;((E=b.type)==null?void 0:E.name)==="WpicTableColumn"&&y.push(b)})}),f.value=y.map(k=>{let x=k.children,C=k.props||{},{field:b,label:E,help:w,width:_,minWidth:R,maxWidth:P,sortable:z,selectable:te,render:D,type:L,align:H,visible:J}=m(k.type.props,C);return{label:E,help:w,width:_,minWidth:R,maxWidth:P,type:L,align:H,sortable:z,selectable:te,field:b,render:D,children:x,visible:J}}).filter(k=>k.visible||k.selectable)}function p(m){var g,k;let y=(g=r.sortOptions)==null?void 0:g.sortDirection;((k=r.sortOptions)==null?void 0:k.sortBy)===m&&(y=y==="asc"?"desc":"asc"),l("changeSort",{sortDirection:y,sortBy:m})}return d.watch(()=>u.default,m=>{console.log("watch slots.default",m),h()},{deep:!0}),e({buildColumns:h}),(m,y)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["relative w-full rounded-lg overflow-hidden",{border:t.border,[`${i[d.unref(de).theme]}`]:!0}])},[t.loading?(d.openBlock(),d.createElementBlock("div",{key:0,class:d.normalizeClass(["inset-0 z-10 absolute flex items-center justify-center",[a[d.unref(de).theme]]])},[d.createVNode(Mi,{class:"w-6 h-6"})],2)):d.createCommentVNode("",!0),d.createElementVNode("div",s1,[d.createElementVNode("table",o1,[d.createElementVNode("colgroup",null,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(f.value,(g,k)=>(d.openBlock(),d.createElementBlock("col",{style:d.normalizeStyle({minWidth:`${g.minWidth}px`}),width:g.width,"max-width":g.maxWidth,key:k},null,12,a1))),128))]),t.hideHeaders?d.createCommentVNode("",!0):(d.openBlock(),d.createElementBlock("thead",l1,[d.createElementVNode("tr",null,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(f.value,(g,k)=>{var x,C;return d.openBlock(),d.createElementBlock("th",{class:d.normalizeClass(["first:rounded-tl-lg last:rounded-tr-lg py-0border-b first:pl-6 pr-6",{[`${s[d.unref(de).theme]}`]:!0,"sticky left-0":k===0}])},[d.createElementVNode("div",{onClick:()=>{g.sortable&&p(g.field)},class:d.normalizeClass(["flex items-center py-3 lg:text-base rounded-lg",{"cursor-pointer":g.sortable&&g.field,"justify-center":g.align=="center","justify-end":g.align=="right"}])},[d.createElementVNode("span",{class:d.normalizeClass(["select-none font-medium",{"text-right":g.align=="right"}])},d.toDisplayString(g.label),3),g.sortable&&g.field?(d.openBlock(),d.createElementBlock("span",{key:0,class:d.normalizeClass(["ml-1",{"opacity-25":g.field!=((x=t.sortOptions)==null?void 0:x.sortBy)}])},[d.createVNode(r1,{class:d.normalizeClass(["w-4 h-4",{"rotate-180":((C=t.sortOptions)==null?void 0:C.sortDirection)==="asc"}])},null,8,["class"])],2)):d.createCommentVNode("",!0)],10,c1)],2)}),256))])])),d.createElementVNode("tbody",d1,[t.totalItem&&t.totalOnTop?(d.openBlock(),d.createBlock(Vd,{key:0,position:"header",columns:f.value,noXPadding:t.noXPadding,totalItem:t.totalItem},null,8,["columns","noXPadding","totalItem"])):d.createCommentVNode("",!0),(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(t.data,(g,k)=>(d.openBlock(),d.createElementBlock("tr",{class:"tr border-b last:border-b-0 overflow-hidden",key:`tr_${k}`},[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(f.value,(x,C)=>{var b,E;return d.openBlock(),d.createBlock(Ad,{class:d.normalizeClass(["py-3 first:pl-6 pr-6 lg:text-base",{"sticky left-0 shadow":C===0,[`${o[d.unref(de).theme]}`]:!0,"first:pl-0 last:pr-0":t.noXPadding,"last:rounded-br-lg":k===((b=t.data)==null?void 0:b.length)-1&&!t.totalItem,"first:rounded-bl-lg":k===((E=t.data)==null?void 0:E.length)-1&&!t.totalItem,"text-center":x.align=="center","text-right":x.align=="right"}]),id:`${k}_${C}`,column:x,item:g,rowIndex:k,key:C},null,8,["class","id","column","item","rowIndex"])}),128))]))),128))]),t.totalItem&&t.totalOnBottom?(d.openBlock(),d.createElementBlock("tfoot",u1,[d.createVNode(Vd,{position:"footer",columns:f.value,noXPadding:t.noXPadding,totalItem:t.totalItem},null,8,["columns","noXPadding","totalItem"])])):d.createCommentVNode("",!0)])])],2))}}),h1={name:"WpicTableColumn",props:{label:{type:String},help:{type:String},field:{type:String,default:""},selectable:{type:Boolean,default:!0},sortable:{type:Boolean,default:!1},type:{type:String,default:"default"},width:{type:[String,Number],default:null},minWidth:{type:[String,Number],default:null},maxWidth:{type:[String,Number],default:null},align:{type:String,default:"left"},visible:{type:Boolean,default:!0}},setup(t){const e=inject("wtable",null);return onMounted(()=>{e&&e.buildColumns&&e.buildColumns()}),onBeforeUnmount(()=>{e&&e.buildColumns&&e.buildColumns()}),()=>null}};function Fe(t){this.content=t}Fe.prototype={constructor:Fe,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new Fe(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Fe(n)},addToStart:function(t,e){return new Fe([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Fe(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new Fe(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Fe.from(t),t.size?new Fe(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Fe.from(t),t.size?new Fe(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Fe.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}},Fe.from=function(t){if(t instanceof Fe)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Fe(e)};function Bd(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)n++;return n}if(i.content.size||s.content.size){let o=Bd(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function Pd(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){n-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let c=0,u=Math.min(o.text.length,a.text.length);for(;c<u&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(o.content.size||a.content.size){let c=Pd(o.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class A{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let o=0,a=0;a<n;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,i+a,s||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new A(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,o=0;o<n;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),i+=a.nodeSize),o=l}return new A(r,i)}cutByIndex(e,n){return e==n?A.empty:e==0&&n==this.content.length?this:new A(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new A(i,s)}addToStart(e){return new A([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new A(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 Bd(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Pd(this,e,n,r)}findIndex(e,n=-1){if(e==0)return Ps(0,e);if(e==this.size)return Ps(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let s=this.child(r),o=i+s.nodeSize;if(o>=e)return o==e||n>0?Ps(r+1,o):Ps(r,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return A.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new A(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return A.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new A(n||e,r)}static from(e){if(!e)return A.empty;if(e instanceof A)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new A([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}A.empty=new A([],0);const ma={index:0,offset:0};function Ps(t,e){return ma.index=t,ma.offset=e,ma}function Is(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(!Is(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Is(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let ge=class kc{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Is(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 kc.none;if(e instanceof kc)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};ge.none=[];class Rs extends Error{}class ${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=Rd(this.content,e+this.openStart,n);return r&&new $(r,this.openStart,this.openEnd)}removeBetween(e,n){return new $(Id(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 $.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 $(A.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new $(e,r,i)}}$.empty=new $(A.empty,0,0);function Id(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(i==e||s.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(Id(s.content,e-i-1,n-i-1)))}function Rd(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),o=t.maybeChild(i);if(s==e||o.isText)return t.cut(0,e).append(n).append(t.cut(e));let a=Rd(o.content,e-s-1,n);return a&&t.replaceChild(i,o.copy(a))}function p1(t,e,n){if(n.openStart>t.depth)throw new Rs("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Rs("Inconsistent open depths");return $d(t,e,n,0)}function $d(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let o=$d(t,e,n,r+1);return s.copy(s.content.replaceChild(i,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,a=o.content;return ir(o,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=m1(n,t);return ir(s,Fd(t,o,a,e,r))}else return ir(s,$s(t,e,r))}function Ld(t,e){if(!e.type.compatibleContent(t.type))throw new Rs("Cannot join "+e.type.name+" onto "+t.type.name)}function ga(t,e,n){let r=t.node(n);return Ld(r,e.node(n)),r}function rr(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Ni(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(rr(t.nodeAfter,r),s++));for(let a=s;a<o;a++)rr(i.child(a),r);e&&e.depth==n&&e.textOffset&&rr(e.nodeBefore,r)}function ir(t,e){return t.type.checkContent(e),t.copy(e)}function Fd(t,e,n,r,i){let s=t.depth>i&&ga(t,e,i+1),o=r.depth>i&&ga(n,r,i+1),a=[];return Ni(null,t,i,a),s&&o&&e.index(i)==n.index(i)?(Ld(s,o),rr(ir(s,Fd(t,e,n,r,i+1)),a)):(s&&rr(ir(s,$s(t,e,i+1)),a),Ni(e,n,i,a),o&&rr(ir(o,$s(n,r,i+1)),a)),Ni(r,null,i,a),new A(a)}function $s(t,e,n){let r=[];if(Ni(null,t,n,r),t.depth>n){let i=ga(t,e,n+1);rr(ir(i,$s(t,e,n+1)),r)}return Ni(e,null,n,r),new A(r)}function m1(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(A.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class _i{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return 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 s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Ls(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),c=s-l;if(r.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;s=c-1,i+=l+1}return new _i(n,r,s)}static resolveCached(e,n){for(let i=0;i<ya.length;i++){let s=ya[i];if(s.pos==n&&s.doc==e)return s}let r=ya[ba]=_i.resolve(e,n);return ba=(ba+1)%g1,r}}let ya=[],ba=0,g1=12;class Ls{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 y1=Object.create(null);let sr=class wc{constructor(e,n,r,i=ge.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||A.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&&Is(this.attrs,n||e.defaultAttrs||y1)&&ge.sameSet(this.marks,r||ge.none)}copy(e=null){return e==this.content?this:new wc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new wc(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 $.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),a=i.start(o),c=i.node(o).content.cut(i.pos-a,s.pos-a);return new $(c,i.depth-o,s.depth-o)}replace(e,n,r){return p1(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return _i.resolveCached(this,e)}resolveNoCache(e){return _i.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),zd(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=A.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content);let e=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=A.fromJSON(e,n.content);return e.nodeType(n.type).create(n.attrs,i,r)}};sr.prototype.text=void 0;class Fs extends sr{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):zd(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 Fs(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Fs(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 zd(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class or{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new b1(e,n);if(r.next==null)return or.empty;let i=jd(r);r.next&&r.err("Unexpected trailing text");let s=O1(M1(i));return C1(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(o,a){let l=o.matchFragment(e,r);if(l&&(!n||l.validEnd))return A.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:f}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let h=s(f,a.concat(u));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
|
|
5
|
+
*/function Ae(t){return typeof t=="function"}function Sc(t){return t==null}const Dn=t=>t!==null&&!!t&&typeof t=="object"&&!Array.isArray(t);function Ko(t){return Number(t)>=0}function mm(t){const e=parseFloat(t);return isNaN(e)?t:e}function gm(t){return typeof t=="object"&&t!==null}function ym(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}function Mc(t){if(!gm(t)||ym(t)!=="[object Object]")return!1;if(Object.getPrototypeOf(t)===null)return!0;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function bi(t,e){return Object.keys(e).forEach(n=>{if(Mc(e[n])&&Mc(t[n])){t[n]||(t[n]={}),bi(t[n],e[n]);return}t[n]=e[n]}),t}function ki(t){const e=t.split(".");if(!e.length)return"";let n=String(e[0]);for(let r=1;r<e.length;r++){if(Ko(e[r])){n+=`[${e[r]}]`;continue}n+=`.${e[r]}`}return n}const Oc={};function _t(t,e){km(t,e),Oc[t]=e}function bm(t){return Oc[t]}function km(t,e){if(!Ae(e))throw new Error(`Extension Error: The validator '${t}' must be a function.`)}function Cc(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,s=Object.prototype.toString.call(t);if(s==="[object Object]"?i=Object.create(t.__proto__||null):s==="[object Array]"?i=Array(t.length):s==="[object Set]"?(i=new Set,t.forEach(function(o){i.add(me(o))})):s==="[object Map]"?(i=new Map,t.forEach(function(o,a){i.set(me(a),me(o))})):s==="[object Date]"?i=new Date(+t):s==="[object RegExp]"?i=new RegExp(t.source,t.flags):s==="[object DataView]"?i=new t.constructor(me(t.buffer)):s==="[object ArrayBuffer]"?i=t.slice(0):s.slice(-6)==="Array]"&&(i=new t.constructor(t)),i){for(r=Object.getOwnPropertySymbols(t);e<r.length;e++)Cc(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]||Cc(i,n,Object.getOwnPropertyDescriptor(t,n))}return i||t}const wi=Symbol("vee-validate-form"),Tc=Symbol("vee-validate-field-instance"),bs=Symbol("Default empty value"),wm=typeof window<"u";function Jo(t){return Ae(t)&&!!t.__locatorRef}function At(t){return!!t&&Ae(t.parse)&&t.__type==="VVTypedSchema"}function ks(t){return!!t&&Ae(t.validate)}function vi(t){return t==="checkbox"||t==="radio"}function vm(t){return Dn(t)||Array.isArray(t)}function xm(t){return Array.isArray(t)?t.length===0:Dn(t)&&Object.keys(t).length===0}function ws(t){return/^\[.+\]$/i.test(t)}function Sm(t){return Ec(t)&&t.multiple}function Ec(t){return t.tagName==="SELECT"}function Mm(t,e){const n=![!1,null,void 0,0].includes(e.multiple)&&!Number.isNaN(e.multiple);return t==="select"&&"multiple"in e&&n}function Om(t,e){return!Mm(t,e)&&e.type!=="file"&&!vi(e.type)}function Dc(t){return Go(t)&&t.target&&"submit"in t.target}function Go(t){return t?!!(typeof Event<"u"&&Ae(Event)&&t instanceof Event||t&&t.srcElement):!1}function Nc(t,e){return e in t&&t[e]!==bs}function qe(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var n,r,i;if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!qe(t[r],e[r]))return!1;return!0}if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(r of t.entries())if(!e.has(r[0]))return!1;for(r of t.entries())if(!qe(r[1],e.get(r[0])))return!1;return!0}if(_c(t)&&_c(e))return!(t.size!==e.size||t.name!==e.name||t.lastModified!==e.lastModified||t.type!==e.type);if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(r of t.entries())if(!e.has(r[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(t[r]!==e[r])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();for(i=Object.keys(t),n=i.length,r=n;r--!==0;){var s=i[r];if(!qe(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function _c(t){return wm?t instanceof File:!1}function Zo(t){return ws(t)?t.replace(/\[|\]/gi,""):t}function nt(t,e,n){return t?ws(e)?t[Zo(e)]:(e||"").split(/\.|\[(\d+)\]/).filter(Boolean).reduce((i,s)=>vm(i)&&s in i?i[s]:n,t):n}function dn(t,e,n){if(ws(e)){t[Zo(e)]=n;return}const r=e.split(/\.|\[(\d+)\]/).filter(Boolean);let i=t;for(let s=0;s<r.length;s++){if(s===r.length-1){i[r[s]]=n;return}(!(r[s]in i)||Sc(i[r[s]]))&&(i[r[s]]=Ko(r[s+1])?[]:{}),i=i[r[s]]}}function Xo(t,e){if(Array.isArray(t)&&Ko(e)){t.splice(Number(e),1);return}Dn(t)&&delete t[e]}function Ac(t,e){if(ws(e)){delete t[Zo(e)];return}const n=e.split(/\.|\[(\d+)\]/).filter(Boolean);let r=t;for(let s=0;s<n.length;s++){if(s===n.length-1){Xo(r,n[s]);break}if(!(n[s]in r)||Sc(r[n[s]]))break;r=r[n[s]]}const i=n.map((s,o)=>nt(t,n.slice(0,o).join(".")));for(let s=i.length-1;s>=0;s--)if(xm(i[s])){if(s===0){Xo(t,n[0]);continue}Xo(i[s-1],n[s-1])}}function rt(t){return Object.keys(t)}function Qo(t,e=void 0){const n=d.getCurrentInstance();return(n==null?void 0:n.provides[t])||d.inject(t,e)}function Vc(t,e,n){if(Array.isArray(t)){const r=[...t],i=r.findIndex(s=>qe(s,e));return i>=0?r.splice(i,1):r.push(e),r}return qe(t,e)?n:e}function Cm(t,e){let n,r;return function(...i){const s=this;return n||(n=!0,setTimeout(()=>n=!1,e),r=t.apply(s,i)),r}}function Bc(t,e=0){let n=null,r=[];return function(...i){return n&&clearTimeout(n),n=setTimeout(()=>{const s=t(...i);r.forEach(o=>o(s)),r=[]},e),new Promise(s=>r.push(s))}}function Tm(t,e){return Dn(e)&&e.number?mm(t):t}function ea(t,e){let n;return async function(...i){const s=t(...i);n=s;const o=await s;return s!==n?o:(n=void 0,e(o,i))}}function ta(t){return Array.isArray(t)?t:t?[t]:[]}function vs(t,e){const n={};for(const r in t)e.includes(r)||(n[r]=t[r]);return n}function Em(t){let e=null,n=[];return function(...r){const i=d.nextTick(()=>{if(e!==i)return;const s=t(...r);n.forEach(o=>o(s)),n=[],e=null});return e=i,new Promise(s=>n.push(s))}}function na(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 ra(t){if(Pc(t))return t._value}function Pc(t){return"_value"in t}function Dm(t){return t.type==="number"||t.type==="range"?Number.isNaN(t.valueAsNumber)?t.value:t.valueAsNumber:t.value}function xs(t){if(!Go(t))return t;const e=t.target;if(vi(e.type)&&Pc(e))return ra(e);if(e.type==="file"&&e.files){const n=Array.from(e.files);return e.multiple?n:n[0]}if(Sm(e))return Array.from(e.options).filter(n=>n.selected&&!n.disabled).map(ra);if(Ec(e)){const n=Array.from(e.options).find(r=>r.selected);return n?ra(n):e.value}return Dm(e)}function Ic(t){const e={};return Object.defineProperty(e,"_$$isNormalized",{value:!0,writable:!1,enumerable:!1,configurable:!1}),t?Dn(t)&&t._$$isNormalized?t:Dn(t)?Object.keys(t).reduce((n,r)=>{const i=Nm(t[r]);return t[r]!==!1&&(n[r]=Rc(i)),n},e):typeof t!="string"?e:t.split("|").reduce((n,r)=>{const i=_m(r);return i.name&&(n[i.name]=Rc(i.params)),n},e):e}function Nm(t){return t===!0?[]:Array.isArray(t)||Dn(t)?t:[t]}function Rc(t){const e=n=>typeof n=="string"&&n[0]==="@"?Am(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 _m=t=>{let e=[];const n=t.split(":")[0];return t.includes(":")&&(e=t.split(":").slice(1).join(":").split(",")),{name:n,params:e}};function Am(t){const e=n=>nt(n,t)||n[t];return e.__locatorRef=t,e}function Vm(t){return Array.isArray(t)?t.filter(Jo):rt(t).filter(e=>Jo(t[e])).map(e=>t[e])}let Bm=Object.assign({},{generateMessage:({field:t})=>`${t} is not valid.`,bails:!0,validateOnBlur:!0,validateOnChange:!0,validateOnInput:!1,validateOnModelUpdate:!0});const tr=()=>Bm;async function $c(t,e,n={}){const r=n==null?void 0:n.bails,i={name:(n==null?void 0:n.name)||"{field}",rules:e,label:n==null?void 0:n.label,bails:r??!0,formData:(n==null?void 0:n.values)||{}},o=(await Pm(i,t)).errors;return{errors:o,valid:!o.length}}async function Pm(t,e){if(At(t.rules)||ks(t.rules))return Rm(e,t.rules);if(Ae(t.rules)||Array.isArray(t.rules)){const o={field:t.label||t.name,name:t.name,label:t.label,form:t.formData,value:e},a=Array.isArray(t.rules)?t.rules:[t.rules],l=a.length,c=[];for(let u=0;u<l;u++){const f=a[u],h=await f(e,o);if(!(typeof h!="string"&&!Array.isArray(h)&&h)){if(Array.isArray(h))c.push(...h);else{const m=typeof h=="string"?h:Fc(o);c.push(m)}if(t.bails)return{errors:c}}}return{errors:c}}const n=Object.assign(Object.assign({},t),{rules:Ic(t.rules)}),r=[],i=Object.keys(n.rules),s=i.length;for(let o=0;o<s;o++){const a=i[o],l=await $m(n,e,{name:a,params:n.rules[a]});if(l.error&&(r.push(l.error),t.bails))return{errors:r}}return{errors:r}}function Im(t){return!!t&&t.name==="ValidationError"}function Lc(t){return{__type:"VVTypedSchema",async parse(n){var r;try{return{output:await t.validate(n,{abortEarly:!1}),errors:[]}}catch(i){if(!Im(i))throw i;if(!(!((r=i.inner)===null||r===void 0)&&r.length)&&i.errors.length)return{errors:[{path:i.path,errors:i.errors}]};const s=i.inner.reduce((o,a)=>{const l=a.path||"";return o[l]||(o[l]={errors:[],path:l}),o[l].errors.push(...a.errors),o},{});return{errors:Object.values(s)}}}}}async function Rm(t,e){const r=await(At(e)?e:Lc(e)).parse(t),i=[];for(const s of r.errors)s.errors.length&&i.push(...s.errors);return{errors:i}}async function $m(t,e,n){const r=bm(n.name);if(!r)throw new Error(`No such validator '${n.name}' exists.`);const i=Lm(n.params,t.formData),s={field:t.label||t.name,name:t.name,label:t.label,value:e,form:t.formData,rule:Object.assign(Object.assign({},n),{params:i})},o=await r(e,i,s);return typeof o=="string"?{error:o}:{error:o?void 0:Fc(s)}}function Fc(t){const e=tr().generateMessage;return e?e(t):"Field is invalid"}function Lm(t,e){const n=r=>Jo(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 Fm(t,e){const r=await(At(t)?t:Lc(t)).parse(me(e)),i={},s={};for(const o of r.errors){const a=o.errors,l=(o.path||"").replace(/\["(\d+)"\]/g,(c,u)=>`[${u}]`);i[l]={valid:!a.length,errors:a},a.length&&(s[l]=a[0])}return{valid:!r.errors.length,results:i,errors:s,values:r.value}}async function zm(t,e,n){const i=rt(t).map(async c=>{var u,f,h;const p=(u=n==null?void 0:n.names)===null||u===void 0?void 0:u[c],m=await $c(nt(e,c),t[c],{name:(p==null?void 0:p.name)||c,label:p==null?void 0:p.label,values:e,bails:(h=(f=n==null?void 0:n.bailsMap)===null||f===void 0?void 0:f[c])!==null&&h!==void 0?h:!0});return Object.assign(Object.assign({},m),{path:c})});let s=!0;const o=await Promise.all(i),a={},l={};for(const c of o)a[c.path]={valid:c.valid,errors:c.errors},c.valid||(s=!1,l[c.path]=c.errors[0]);return{valid:s,results:a,errors:l}}let zc=0;function jm(t,e){const{value:n,initialValue:r,setInitialValue:i}=Wm(t,e.modelValue,e.form);if(!e.form){let h=function(p){var m;"value"in p&&(n.value=p.value),"errors"in p&&c(p.errors),"touched"in p&&(f.touched=(m=p.touched)!==null&&m!==void 0?m:f.touched),"initialValue"in p&&i(p.initialValue)};const{errors:l,setErrors:c}=Um(),u=zc>=Number.MAX_SAFE_INTEGER?0:++zc,f=Ym(n,r,l,e.schema);return{id:u,path:t,value:n,initialValue:r,meta:f,flags:{pendingUnmount:{[u]:!1},pendingReset:!1},errors:l,setState:h}}const s=e.form.createPathState(t,{bails:e.bails,label:e.label,type:e.type,validate:e.validate,schema:e.schema}),o=d.computed(()=>s.errors);function a(l){var c,u,f;"value"in l&&(n.value=l.value),"errors"in l&&((c=e.form)===null||c===void 0||c.setFieldError(d.unref(t),l.errors)),"touched"in l&&((u=e.form)===null||u===void 0||u.setFieldTouched(d.unref(t),(f=l.touched)!==null&&f!==void 0?f:!1)),"initialValue"in l&&i(l.initialValue)}return{id:Array.isArray(s.id)?s.id[s.id.length-1]:s.id,path:t,value:n,errors:o,meta:s,initialValue:r,flags:s.__flags,setState:a}}function Wm(t,e,n){const r=d.ref(d.unref(e));function i(){return n?nt(n.initialValues.value,d.unref(t),d.unref(r)):d.unref(r)}function s(c){if(!n){r.value=c;return}n.setFieldInitialValue(d.unref(t),c,!0)}const o=d.computed(i);if(!n)return{value:d.ref(i()),initialValue:o,setInitialValue:s};const a=Hm(e,n,o,t);return n.stageInitialValue(d.unref(t),a,!0),{value:d.computed({get(){return nt(n.values,d.unref(t))},set(c){n.setFieldValue(d.unref(t),c,!1)}}),initialValue:o,setInitialValue:s}}function Hm(t,e,n,r){return d.isRef(t)?d.unref(t):t!==void 0?t:nt(e.values,d.unref(r),d.unref(n))}function Ym(t,e,n,r){const i=d.computed(()=>{var o,a,l;return(l=(a=(o=d.toValue(r))===null||o===void 0?void 0:o.describe)===null||a===void 0?void 0:a.call(o).required)!==null&&l!==void 0?l:!1}),s=d.reactive({touched:!1,pending:!1,valid:!0,required:i,validated:!!d.unref(n).length,initialValue:d.computed(()=>d.unref(e)),dirty:d.computed(()=>!qe(d.unref(t),d.unref(e)))});return d.watch(n,o=>{s.valid=!o.length},{immediate:!0,flush:"sync"}),s}function Um(){const t=d.ref([]);return{errors:t,setErrors:e=>{t.value=ta(e)}}}function jc(t){process.env.NODE_ENV!=="production"&&pm({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"},Jm)}const xi={},Si={};let un;const Tr=Cm(()=>{setTimeout(async()=>{await d.nextTick(),un==null||un.sendInspectorState(Er),un==null||un.sendInspectorTree(Er)},100)},100);function qm(t){const e=d.getCurrentInstance();if(!un){const n=e==null?void 0:e.appContext.app;if(!n)return;jc(n)}xi[t.formId]=Object.assign({},t),xi[t.formId]._vm=e,d.onUnmounted(()=>{delete xi[t.formId],Tr()}),Tr()}function Km(t){const e=d.getCurrentInstance();if(!un){const n=e==null?void 0:e.appContext.app;if(!n)return;jc(n)}Si[t.id]=Object.assign({},t),Si[t.id]._vm=e,d.onUnmounted(()=>{delete Si[t.id],Tr()}),Tr()}const Er="vee-validate-inspector",it={error:12405579,success:448379,unknown:5522283,white:16777215,black:0,blue:218007,purple:12157168,orange:16099682,gray:12304330};let Ce=null;function Jm(t){un=t,t.addInspector({id:Er,icon:"rule",label:"vee-validate",noSelectionText:"Select a vee-validate node to inspect",actions:[{icon:"done_outline",tooltip:"Validate selected item",action:async()=>{if(!Ce){console.error("There is not a valid selected vee-validate node or component");return}if(Ce.type==="field"){await Ce.field.validate();return}if(Ce.type==="form"){await Ce.form.validate();return}Ce.type==="pathState"&&await Ce.form.validateField(Ce.state.path)}},{icon:"delete_sweep",tooltip:"Clear validation state of the selected item",action:()=>{if(!Ce){console.error("There is not a valid selected vee-validate node or component");return}if(Ce.type==="field"){Ce.field.resetField();return}Ce.type==="form"&&Ce.form.resetForm(),Ce.type==="pathState"&&Ce.form.resetField(Ce.state.path)}}]}),t.on.getInspectorTree(e=>{if(e.inspectorId!==Er)return;const n=Object.values(xi),r=Object.values(Si);e.rootNodes=[...n.map(Gm),...r.map(i=>Xm(i))]}),t.on.getInspectorState((e,n)=>{if(e.inspectorId!==Er||n.currentTab!==`custom-inspector:${Er}`)return;const{form:r,field:i,state:s,type:o}=Qm(e.nodeId);if(r&&o==="form"){e.state=eg(r),Ce={type:"form",form:r};return}if(s&&o==="pathState"&&r){e.state=Hc(s),Ce={type:"pathState",state:s,form:r};return}if(i&&o==="field"){e.state=Hc({errors:i.errors.value,dirty:i.meta.dirty,valid:i.meta.valid,touched:i.meta.touched,value:i.value.value,initialValue:i.meta.initialValue}),Ce={field:i,type:"field"};return}Ce=null})}function Gm(t){const{textColor:e,bgColor:n}=Yc(t.meta.value.valid),r={};Object.values(t.getAllPathStates()).forEach(o=>{dn(r,d.unref(o.path),Zm(o,t))});function i(o,a=[]){const l=[...a].pop();return"id"in o?Object.assign(Object.assign({},o),{label:l||o.label}):Dn(o)?{id:`${a.join(".")}`,label:l||"",children:Object.keys(o).map(c=>i(o[c],[...a,c]))}:Array.isArray(o)?{id:`${a.join(".")}`,label:`${l}[]`,children:o.map((c,u)=>i(c,[...a,String(u)]))}:{id:"",label:"",children:[]}}const{children:s}=i(r);return{id:ia(t),label:"Form",children:s,tags:[{label:"Form",textColor:e,backgroundColor:n},{label:`${t.getAllPathStates().length} fields`,textColor:it.white,backgroundColor:it.unknown}]}}function Zm(t,e){return{id:ia(e,t),label:d.unref(t.path),tags:Wc(t.multiple,t.fieldsCount,t.type,t.valid,e)}}function Xm(t,e){return{id:ia(e,t),label:d.unref(t.name),tags:Wc(!1,1,t.type,t.meta.valid,e)}}function Wc(t,e,n,r,i){const{textColor:s,bgColor:o}=Yc(r);return[t?void 0:{label:"Field",textColor:s,backgroundColor:o},i?void 0:{label:"Standalone",textColor:it.black,backgroundColor:it.gray},n==="checkbox"?{label:"Checkbox",textColor:it.white,backgroundColor:it.blue}:void 0,n==="radio"?{label:"Radio",textColor:it.white,backgroundColor:it.purple}:void 0,t?{label:"Multiple",textColor:it.black,backgroundColor:it.orange}:void 0].filter(Boolean)}function ia(t,e){const n=e?"path"in e?"pathState":"field":"form",r=e?"path"in e?e==null?void 0:e.path:d.unref(e==null?void 0:e.name):"",i={f:t==null?void 0:t.formId,ff:r,type:n};return btoa(encodeURIComponent(JSON.stringify(i)))}function Qm(t){try{const e=JSON.parse(decodeURIComponent(atob(t))),n=xi[e.f];if(!n&&e.ff){const i=Si[e.ff];return i?{type:e.type,field:i}:{}}if(!n)return{};const r=n.getPathState(e.ff);return{type:e.type,form:n,state:r}}catch{}return{}}function Hc(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 eg(t){const{errorBag:e,meta:n,values:r,isSubmitting:i,isValidating:s,submitCount:o}=t;return{"Form state":[{key:"submitCount",value:o.value},{key:"isSubmitting",value:i.value},{key:"isValidating",value:s.value},{key:"touched",value:n.value.touched},{key:"dirty",value:n.value.dirty},{key:"valid",value:n.value.valid},{key:"initialValues",value:n.value.initialValues},{key:"currentValues",value:r},{key:"errors",value:rt(e.value).reduce((a,l)=>{var c;const u=(c=e.value[l])===null||c===void 0?void 0:c[0];return u&&(a[l]=u),a},{})}]}}function Yc(t){return{bgColor:t?it.success:it.error,textColor:t?it.black:it.white}}function tg(t,e,n){return vi(n==null?void 0:n.type)?rg(t,e,n):Uc(t,e,n)}function Uc(t,e,n){const{initialValue:r,validateOnMount:i,bails:s,type:o,checkedValue:a,label:l,validateOnValueUpdate:c,uncheckedValue:u,controlled:f,keepValueOnUnmount:h,syncVModel:p,form:m}=ng(n),y=f?Qo(wi):void 0,g=m||y,k=d.computed(()=>ki(d.toValue(t))),v=d.computed(()=>{if(d.toValue(g==null?void 0:g.schema))return;const Q=d.unref(e);return ks(Q)||At(Q)||Ae(Q)||Array.isArray(Q)?Q:Ic(Q)}),C=!Ae(v.value)&&At(d.toValue(e)),{id:b,value:E,initialValue:w,meta:_,setState:R,errors:P,flags:z}=jm(k,{modelValue:r,form:g,bails:s,label:l,type:o,validate:v.value?T:void 0,schema:C?e:void 0}),te=d.computed(()=>P.value[0]);p&&ig({value:E,prop:p,handleChange:q,shouldValidate:()=>c&&!z.pendingReset});const D=(I,Q=!1)=>{_.touched=!0,Q&&H()};async function L(I){var Q,he;if(g!=null&&g.validateSchema){const{results:le}=await g.validateSchema(I);return(Q=le[d.toValue(k)])!==null&&Q!==void 0?Q:{valid:!0,errors:[]}}return v.value?$c(E.value,v.value,{name:d.toValue(k),label:d.toValue(l),values:(he=g==null?void 0:g.values)!==null&&he!==void 0?he:{},bails:s}):{valid:!0,errors:[]}}const H=ea(async()=>(_.pending=!0,_.validated=!0,L("validated-only")),I=>(z.pendingUnmount[ve.id]||(R({errors:I.errors}),_.pending=!1,_.valid=I.valid),I)),J=ea(async()=>L("silent"),I=>(_.valid=I.valid,I));function T(I){return(I==null?void 0:I.mode)==="silent"?J():H()}function q(I,Q=!0){const he=xs(I);ct(he,Q)}d.onMounted(()=>{if(i)return H();(!g||!g.validateSchema)&&J()});function re(I){_.touched=I}function De(I){var Q;const he=I&&"value"in I?I.value:w.value;R({value:me(he),initialValue:me(he),touched:(Q=I==null?void 0:I.touched)!==null&&Q!==void 0?Q:!1,errors:(I==null?void 0:I.errors)||[]}),_.pending=!1,_.validated=!1,J()}const Qe=d.getCurrentInstance();function ct(I,Q=!0){E.value=Qe&&p?Tm(I,Qe.props.modelModifiers):I,(Q?H:J)()}function bt(I){R({errors:Array.isArray(I)?I:[I]})}const kt=d.computed({get(){return E.value},set(I){ct(I,c)}}),ve={id:b,name:k,label:l,value:kt,meta:_,errors:P,errorMessage:te,type:o,checkedValue:a,uncheckedValue:u,bails:s,keepValueOnUnmount:h,resetField:De,handleReset:()=>De(),validate:T,handleChange:q,handleBlur:D,setState:R,setTouched:re,setErrors:bt,setValue:ct};if(d.provide(Tc,ve),d.isRef(e)&&typeof d.unref(e)!="function"&&d.watch(e,(I,Q)=>{qe(I,Q)||(_.validated?H():J())},{deep:!0}),process.env.NODE_ENV!=="production"&&(ve._vm=d.getCurrentInstance(),d.watch(()=>Object.assign(Object.assign({errors:P.value},_),{value:E.value}),Tr,{deep:!0}),g||Km(ve)),!g)return ve;const et=d.computed(()=>{const I=v.value;return!I||Ae(I)||ks(I)||At(I)||Array.isArray(I)?{}:Object.keys(I).reduce((Q,he)=>{const le=Vm(I[he]).map(Re=>Re.__locatorRef).reduce((Re,$e)=>{const dt=nt(g.values,$e)||g.values[$e];return dt!==void 0&&(Re[$e]=dt),Re},{});return Object.assign(Q,le),Q},{})});return d.watch(et,(I,Q)=>{if(!Object.keys(I).length)return;!qe(I,Q)&&(_.validated?H():J())}),d.onBeforeUnmount(()=>{var I;const Q=(I=d.toValue(ve.keepValueOnUnmount))!==null&&I!==void 0?I:d.toValue(g.keepValuesOnUnmount),he=d.toValue(k);if(Q||!g||z.pendingUnmount[ve.id]){g==null||g.removePathState(he,b);return}z.pendingUnmount[ve.id]=!0;const le=g.getPathState(he);if(Array.isArray(le==null?void 0:le.id)&&(le!=null&&le.multiple)?le!=null&&le.id.includes(ve.id):(le==null?void 0:le.id)===ve.id){if(le!=null&&le.multiple&&Array.isArray(le.value)){const $e=le.value.findIndex(dt=>qe(dt,d.toValue(ve.checkedValue)));if($e>-1){const dt=[...le.value];dt.splice($e,1),g.setFieldValue(he,dt)}Array.isArray(le.id)&&le.id.splice(le.id.indexOf(ve.id),1)}else g.unsetPathValue(d.toValue(k));g.removePathState(he,b)}}),ve}function ng(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||{}))?sa(d.getCurrentInstance(),r):t==null?void 0:t.initialValue;if(!t)return Object.assign(Object.assign({},e()),{initialValue:i});const s="valueProp"in t?t.valueProp:t.checkedValue,o="standalone"in t?!t.standalone:t.controlled,a=(t==null?void 0:t.modelPropName)||(t==null?void 0:t.syncVModel)||!1;return Object.assign(Object.assign(Object.assign({},e()),t||{}),{initialValue:i,controlled:o??!0,checkedValue:s,syncVModel:a})}function rg(t,e,n){const r=n!=null&&n.standalone?void 0:Qo(wi),i=n==null?void 0:n.checkedValue,s=n==null?void 0:n.uncheckedValue;function o(a){const l=a.handleChange,c=d.computed(()=>{const f=d.toValue(a.value),h=d.toValue(i);return Array.isArray(f)?f.findIndex(p=>qe(p,h))>=0:qe(h,f)});function u(f,h=!0){var p,m;if(c.value===((p=f==null?void 0:f.target)===null||p===void 0?void 0:p.checked)){h&&a.validate();return}const y=d.toValue(t),g=r==null?void 0:r.getPathState(y),k=xs(f);let v=(m=d.toValue(i))!==null&&m!==void 0?m:k;r&&(g!=null&&g.multiple)&&g.type==="checkbox"?v=Vc(nt(r.values,y)||[],v,void 0):(n==null?void 0:n.type)==="checkbox"&&(v=Vc(d.toValue(a.value),v,d.toValue(s))),l(v,h)}return Object.assign(Object.assign({},a),{checked:c,checkedValue:i,uncheckedValue:s,handleChange:u})}return o(Uc(t,e,n))}function ig({prop:t,value:e,handleChange:n,shouldValidate:r}){const i=d.getCurrentInstance();if(!i||!t){process.env.NODE_ENV!=="production"&&console.warn("Failed to setup model events because `useField` was not called in setup.");return}const s=typeof t=="string"?t:"modelValue",o=`update:${s}`;s in i.props&&(d.watch(e,a=>{qe(a,sa(i,s))||i.emit(o,a)}),d.watch(()=>sa(i,s),a=>{if(a===bs&&e.value===void 0)return;const l=a===bs?void 0:a;qe(l,e.value)||n(l,r())}))}function sa(t,e){if(t)return t.props[e]}const sg=d.defineComponent({name:"Field",inheritAttrs:!1,props:{as:{type:[String,Object],default:void 0},name:{type:String,required:!0},rules:{type:[Object,String,Function],default:void 0},validateOnMount:{type:Boolean,default:!1},validateOnBlur:{type:Boolean,default:void 0},validateOnChange:{type:Boolean,default:void 0},validateOnInput:{type:Boolean,default:void 0},validateOnModelUpdate:{type:Boolean,default:void 0},bails:{type:Boolean,default:()=>tr().bails},label:{type:String,default:void 0},uncheckedValue:{type:null,default:void 0},modelValue:{type:null,default:bs},modelModifiers:{type:null,default:()=>({})},"onUpdate:modelValue":{type:null,default:void 0},standalone:{type:Boolean,default:!1},keepValue:{type:Boolean,default:void 0}},setup(t,e){const n=d.toRef(t,"rules"),r=d.toRef(t,"name"),i=d.toRef(t,"label"),s=d.toRef(t,"uncheckedValue"),o=d.toRef(t,"keepValue"),{errors:a,value:l,errorMessage:c,validate:u,handleChange:f,handleBlur:h,setTouched:p,resetField:m,handleReset:y,meta:g,checked:k,setErrors:v}=tg(r,n,{validateOnMount:t.validateOnMount,bails:t.bails,standalone:t.standalone,type:e.attrs.type,initialValue:ag(t,e),checkedValue:e.attrs.value,uncheckedValue:s,label:i,validateOnValueUpdate:t.validateOnModelUpdate,keepValueOnUnmount:o,syncVModel:!0}),C=function(P,z=!0){f(P,z)},b=d.computed(()=>{const{validateOnInput:R,validateOnChange:P,validateOnBlur:z,validateOnModelUpdate:te}=og(t);function D(T){h(T,z),Ae(e.attrs.onBlur)&&e.attrs.onBlur(T)}function L(T){C(T,R),Ae(e.attrs.onInput)&&e.attrs.onInput(T)}function H(T){C(T,P),Ae(e.attrs.onChange)&&e.attrs.onChange(T)}const J={name:t.name,onBlur:D,onInput:L,onChange:H};return J["onUpdate:modelValue"]=T=>C(T,te),J}),E=d.computed(()=>{const R=Object.assign({},b.value);vi(e.attrs.type)&&k&&(R.checked=k.value);const P=qc(t,e);return Om(P,e.attrs)&&(R.value=l.value),R}),w=d.computed(()=>Object.assign(Object.assign({},b.value),{modelValue:l.value}));function _(){return{field:E.value,componentField:w.value,value:l.value,meta:g,errors:a.value,errorMessage:c.value,validate:u,resetField:m,handleChange:C,handleInput:R=>C(R,!1),handleReset:y,handleBlur:b.value.onBlur,setTouched:p,setErrors:v}}return e.expose({value:l,meta:g,errors:a,errorMessage:c,setErrors:v,setTouched:p,reset:m,validate:u,handleChange:f}),()=>{const R=d.resolveDynamicComponent(qc(t,e)),P=na(R,e,_);return R?d.h(R,Object.assign(Object.assign({},e.attrs),E.value),P):P}}});function qc(t,e){let n=t.as||"";return!t.as&&!e.slots.default&&(n="input"),n}function og(t){var e,n,r,i;const{validateOnInput:s,validateOnChange:o,validateOnBlur:a,validateOnModelUpdate:l}=tr();return{validateOnInput:(e=t.validateOnInput)!==null&&e!==void 0?e:s,validateOnChange:(n=t.validateOnChange)!==null&&n!==void 0?n:o,validateOnBlur:(r=t.validateOnBlur)!==null&&r!==void 0?r:a,validateOnModelUpdate:(i=t.validateOnModelUpdate)!==null&&i!==void 0?i:l}}function ag(t,e){return vi(e.attrs.type)?Nc(t,"modelValue")?t.modelValue:void 0:Nc(t,"modelValue")?t.modelValue:e.attrs.value}const Ss=sg;let lg=0;const Ms=["bails","fieldsCount","id","multiple","type","validate"];function Kc(t){const e=(t==null?void 0:t.initialValues)||{},n=Object.assign({},d.toValue(e)),r=d.unref(t==null?void 0:t.validationSchema);return r&&At(r)&&Ae(r.cast)?me(r.cast(n)||{}):me(n)}function cg(t){var e;const n=lg++;let r=0;const i=d.ref(!1),s=d.ref(!1),o=d.ref(0),a=[],l=d.reactive(Kc(t)),c=d.ref([]),u=d.ref({}),f=d.ref({}),h=Em(()=>{f.value=c.value.reduce((M,S)=>(M[ki(d.toValue(S.path))]=S,M),{})});function p(M,S){const N=T(M);if(!N){typeof M=="string"&&(u.value[ki(M)]=ta(S));return}if(typeof M=="string"){const F=ki(M);u.value[F]&&delete u.value[F]}N.errors=ta(S),N.valid=!N.errors.length}function m(M){rt(M).forEach(S=>{p(S,M[S])})}t!=null&&t.initialErrors&&m(t.initialErrors);const y=d.computed(()=>{const M=c.value.reduce((S,N)=>(N.errors.length&&(S[N.path]=N.errors),S),{});return Object.assign(Object.assign({},u.value),M)}),g=d.computed(()=>rt(y.value).reduce((M,S)=>{const N=y.value[S];return N!=null&&N.length&&(M[S]=N[0]),M},{})),k=d.computed(()=>c.value.reduce((M,S)=>(M[S.path]={name:S.path||"",label:S.label||""},M),{})),v=d.computed(()=>c.value.reduce((M,S)=>{var N;return M[S.path]=(N=S.bails)!==null&&N!==void 0?N:!0,M},{})),C=Object.assign({},(t==null?void 0:t.initialErrors)||{}),b=(e=t==null?void 0:t.keepValuesOnUnmount)!==null&&e!==void 0?e:!1,{initialValues:E,originalInitialValues:w,setInitialValues:_}=ug(c,l,t),R=dg(c,l,w,g),P=d.computed(()=>c.value.reduce((M,S)=>{const N=nt(l,S.path);return dn(M,S.path,N),M},{})),z=t==null?void 0:t.validationSchema;function te(M,S){var N,F;const Z=d.computed(()=>nt(E.value,d.toValue(M))),x=f.value[d.toValue(M)],V=(S==null?void 0:S.type)==="checkbox"||(S==null?void 0:S.type)==="radio";if(x&&V){x.multiple=!0;const tt=r++;return Array.isArray(x.id)?x.id.push(tt):x.id=[x.id,tt],x.fieldsCount++,x.__flags.pendingUnmount[tt]=!1,x}const j=d.computed(()=>nt(l,d.toValue(M))),G=d.toValue(M),X=re.findIndex(tt=>tt===G);X!==-1&&re.splice(X,1);const ie=d.computed(()=>{var tt,wt,Or,er;const cn=d.toValue(z);if(At(cn))return(wt=(tt=cn.describe)===null||tt===void 0?void 0:tt.call(cn,d.toValue(M)).required)!==null&&wt!==void 0?wt:!1;const ys=d.toValue(S==null?void 0:S.schema);return At(ys)&&(er=(Or=ys.describe)===null||Or===void 0?void 0:Or.call(ys).required)!==null&&er!==void 0?er:!1}),pe=r++,Oe=d.reactive({id:pe,path:M,touched:!1,pending:!1,valid:!0,validated:!!(!((N=C[G])===null||N===void 0)&&N.length),required:ie,initialValue:Z,errors:d.shallowRef([]),bails:(F=S==null?void 0:S.bails)!==null&&F!==void 0?F:!1,label:S==null?void 0:S.label,type:(S==null?void 0:S.type)||"default",value:j,multiple:!1,__flags:{pendingUnmount:{[pe]:!1},pendingReset:!1},fieldsCount:1,validate:S==null?void 0:S.validate,dirty:d.computed(()=>!qe(d.unref(j),d.unref(Z)))});return c.value.push(Oe),f.value[G]=Oe,h(),g.value[G]&&!C[G]&&d.nextTick(()=>{Dt(G,{mode:"silent"})}),d.isRef(M)&&d.watch(M,tt=>{h();const wt=me(j.value);f.value[tt]=Oe,d.nextTick(()=>{dn(l,tt,wt)})}),Oe}const D=Bc(ln,5),L=Bc(ln,5),H=ea(async M=>await(M==="silent"?D():L()),(M,[S])=>{const N=rt(I.errorBag.value),Z=[...new Set([...rt(M.results),...c.value.map(x=>x.path),...N])].sort().reduce((x,V)=>{var j;const G=V,X=T(G)||q(G),ie=((j=M.results[G])===null||j===void 0?void 0:j.errors)||[],pe=d.toValue(X==null?void 0:X.path)||G,Oe=fg({errors:ie,valid:!ie.length},x.results[pe]);return x.results[pe]=Oe,Oe.valid||(x.errors[pe]=Oe.errors[0]),X&&u.value[pe]&&delete u.value[pe],X?(X.valid=Oe.valid,S==="silent"||S==="validated-only"&&!X.validated||p(X,Oe.errors),x):(p(pe,ie),x)},{valid:M.valid,results:{},errors:{}});return M.values&&(Z.values=M.values),rt(Z.results).forEach(x=>{var V;const j=T(x);j&&S!=="silent"&&(S==="validated-only"&&!j.validated||p(j,(V=Z.results[x])===null||V===void 0?void 0:V.errors))}),Z});function J(M){c.value.forEach(M)}function T(M){const S=typeof M=="string"?ki(M):M;return typeof S=="string"?f.value[S]:S}function q(M){return c.value.filter(N=>M.startsWith(N.path)).reduce((N,F)=>N?F.path.length>N.path.length?F:N:F,void 0)}let re=[],De;function Qe(M){return re.push(M),De||(De=d.nextTick(()=>{[...re].sort().reverse().forEach(N=>{Ac(l,N)}),re=[],De=null})),De}function ct(M){return function(N,F){return function(x){return x instanceof Event&&(x.preventDefault(),x.stopPropagation()),J(V=>V.touched=!0),i.value=!0,o.value++,Wt().then(V=>{const j=me(l);if(V.valid&&typeof N=="function"){const G=me(P.value);let X=M?G:j;return V.values&&(X=V.values),N(X,{evt:x,controlledValues:G,setErrors:m,setFieldError:p,setTouched:Zn,setFieldTouched:$e,setValues:le,setFieldValue:Q,resetForm:Tn,resetField:Xn})}!V.valid&&typeof F=="function"&&F({values:j,evt:x,errors:V.errors,results:V.results})}).then(V=>(i.value=!1,V),V=>{throw i.value=!1,V})}}}const kt=ct(!1);kt.withControlled=ct(!0);function ve(M,S){const N=c.value.findIndex(Z=>Z.path===M&&(Array.isArray(Z.id)?Z.id.includes(S):Z.id===S)),F=c.value[N];if(!(N===-1||!F)){if(d.nextTick(()=>{Dt(M,{mode:"silent",warn:!1})}),F.multiple&&F.fieldsCount&&F.fieldsCount--,Array.isArray(F.id)){const Z=F.id.indexOf(S);Z>=0&&F.id.splice(Z,1),delete F.__flags.pendingUnmount[S]}(!F.multiple||F.fieldsCount<=0)&&(c.value.splice(N,1),Nt(M),h(),delete f.value[M])}}function et(M){rt(f.value).forEach(S=>{S.startsWith(M)&&delete f.value[S]}),c.value=c.value.filter(S=>!S.path.startsWith(M)),d.nextTick(()=>{h()})}const I={formId:n,values:l,controlledValues:P,errorBag:y,errors:g,schema:z,submitCount:o,meta:R,isSubmitting:i,isValidating:s,fieldArrays:a,keepValuesOnUnmount:b,validateSchema:d.unref(z)?H:void 0,validate:Wt,setFieldError:p,validateField:Dt,setFieldValue:Q,setValues:le,setErrors:m,setFieldTouched:$e,setTouched:Zn,resetForm:Tn,resetField:Xn,handleSubmit:kt,useFieldModel:pi,defineInputBinds:mi,defineComponentBinds:gi,defineField:Qn,stageInitialValue:an,unsetInitialValue:Nt,setFieldInitialValue:En,createPathState:te,getPathState:T,unsetPathValue:Qe,removePathState:ve,initialValues:E,getAllPathStates:()=>c.value,destroyPath:et,isFieldTouched:dt,isFieldDirty:Sr,isFieldValid:hi};function Q(M,S,N=!0){const F=me(S),Z=typeof M=="string"?M:M.path;T(Z)||te(Z),dn(l,Z,F),N&&Dt(Z)}function he(M,S=!0){rt(l).forEach(N=>{delete l[N]}),rt(M).forEach(N=>{Q(N,M[N],!1)}),S&&Wt()}function le(M,S=!0){bi(l,M),a.forEach(N=>N&&N.reset()),S&&Wt()}function Re(M,S){const N=T(d.toValue(M))||te(M);return d.computed({get(){return N.value},set(F){var Z;const x=d.toValue(M);Q(x,F,(Z=d.toValue(S))!==null&&Z!==void 0?Z:!1)}})}function $e(M,S){const N=T(M);N&&(N.touched=S)}function dt(M){const S=T(M);return S?S.touched:c.value.filter(N=>N.path.startsWith(M)).some(N=>N.touched)}function Sr(M){const S=T(M);return S?S.dirty:c.value.filter(N=>N.path.startsWith(M)).some(N=>N.dirty)}function hi(M){const S=T(M);return S?S.valid:c.value.filter(N=>N.path.startsWith(M)).every(N=>N.valid)}function Zn(M){if(typeof M=="boolean"){J(S=>{S.touched=M});return}rt(M).forEach(S=>{$e(S,!!M[S])})}function Xn(M,S){var N;const F=S&&"value"in S?S.value:nt(E.value,M),Z=T(M);Z&&(Z.__flags.pendingReset=!0),En(M,me(F),!0),Q(M,F,!1),$e(M,(N=S==null?void 0:S.touched)!==null&&N!==void 0?N:!1),p(M,(S==null?void 0:S.errors)||[]),d.nextTick(()=>{Z&&(Z.__flags.pendingReset=!1)})}function Tn(M,S){let N=me(M!=null&&M.values?M.values:w.value);N=S!=null&&S.force?N:bi(w.value,N),N=At(z)&&Ae(z.cast)?z.cast(N):N,_(N),J(F=>{var Z;F.__flags.pendingReset=!0,F.validated=!1,F.touched=((Z=M==null?void 0:M.touched)===null||Z===void 0?void 0:Z[F.path])||!1,Q(F.path,nt(N,F.path),!1),p(F.path,void 0)}),S!=null&&S.force?he(N,!1):le(N,!1),m((M==null?void 0:M.errors)||{}),o.value=(M==null?void 0:M.submitCount)||0,d.nextTick(()=>{Wt({mode:"silent"}),J(F=>{F.__flags.pendingReset=!1})})}async function Wt(M){const S=(M==null?void 0:M.mode)||"force";if(S==="force"&&J(x=>x.validated=!0),I.validateSchema)return I.validateSchema(S);s.value=!0;const N=await Promise.all(c.value.map(x=>x.validate?x.validate(M).then(V=>({key:x.path,valid:V.valid,errors:V.errors})):Promise.resolve({key:x.path,valid:!0,errors:[]})));s.value=!1;const F={},Z={};for(const x of N)F[x.key]={valid:x.valid,errors:x.errors},x.errors.length&&(Z[x.key]=x.errors[0]);return{valid:N.every(x=>x.valid),results:F,errors:Z}}async function Dt(M,S){var N;const F=T(M);if(F&&(S==null?void 0:S.mode)!=="silent"&&(F.validated=!0),z){const{results:x}=await H((S==null?void 0:S.mode)||"validated-only");return x[M]||{errors:[],valid:!0}}return F!=null&&F.validate?F.validate(S):(!F&&((N=S==null?void 0:S.warn)!==null&&N!==void 0?N:!0)&&process.env.NODE_ENV!=="production"&&d.warn(`field with path ${M} was not found`),Promise.resolve({errors:[],valid:!0}))}function Nt(M){Ac(E.value,M)}function an(M,S,N=!1){En(M,S),dn(l,M,S),N&&!(t!=null&&t.initialValues)&&dn(w.value,M,me(S))}function En(M,S,N=!1){dn(E.value,M,me(S)),N&&dn(w.value,M,me(S))}async function ln(){const M=d.unref(z);if(!M)return{valid:!0,results:{},errors:{}};s.value=!0;const S=ks(M)||At(M)?await Fm(M,l):await zm(M,l,{names:k.value,bailsMap:v.value});return s.value=!1,S}const Mr=kt((M,{evt:S})=>{Dc(S)&&S.target.submit()});d.onMounted(()=>{if(t!=null&&t.initialErrors&&m(t.initialErrors),t!=null&&t.initialTouched&&Zn(t.initialTouched),t!=null&&t.validateOnMount){Wt();return}I.validateSchema&&I.validateSchema("silent")}),d.isRef(z)&&d.watch(z,()=>{var M;(M=I.validateSchema)===null||M===void 0||M.call(I,"validated-only")}),d.provide(wi,I),process.env.NODE_ENV!=="production"&&(qm(I),d.watch(()=>Object.assign(Object.assign({errors:y.value},R.value),{values:l,isSubmitting:i.value,isValidating:s.value,submitCount:o.value}),Tr,{deep:!0}));function Qn(M,S){const N=Ae(S)||S==null?void 0:S.label,F=T(d.toValue(M))||te(M,{label:N}),Z=()=>Ae(S)?S(vs(F,Ms)):S||{};function x(){var ie;F.touched=!0,((ie=Z().validateOnBlur)!==null&&ie!==void 0?ie:tr().validateOnBlur)&&Dt(F.path)}function V(){var ie;((ie=Z().validateOnInput)!==null&&ie!==void 0?ie:tr().validateOnInput)&&d.nextTick(()=>{Dt(F.path)})}function j(){var ie;((ie=Z().validateOnChange)!==null&&ie!==void 0?ie:tr().validateOnChange)&&d.nextTick(()=>{Dt(F.path)})}const G=d.computed(()=>{const ie={onChange:j,onInput:V,onBlur:x};return Ae(S)?Object.assign(Object.assign({},ie),S(vs(F,Ms)).props||{}):S!=null&&S.props?Object.assign(Object.assign({},ie),S.props(vs(F,Ms))):ie});return[Re(M,()=>{var ie,pe,Oe;return(Oe=(ie=Z().validateOnModelUpdate)!==null&&ie!==void 0?ie:(pe=tr())===null||pe===void 0?void 0:pe.validateOnModelUpdate)!==null&&Oe!==void 0?Oe:!0}),G]}function pi(M){return Array.isArray(M)?M.map(S=>Re(S,!0)):Re(M)}function mi(M,S){const[N,F]=Qn(M,S);function Z(){F.value.onBlur()}function x(j){const G=xs(j);Q(d.toValue(M),G,!1),F.value.onInput()}function V(j){const G=xs(j);Q(d.toValue(M),G,!1),F.value.onChange()}return d.computed(()=>Object.assign(Object.assign({},F.value),{onBlur:Z,onInput:x,onChange:V,value:N.value}))}function gi(M,S){const[N,F]=Qn(M,S),Z=T(d.toValue(M));function x(V){N.value=V}return d.computed(()=>{const V=Ae(S)?S(vs(Z,Ms)):S||{};return Object.assign({[V.model||"modelValue"]:N.value,[`onUpdate:${V.model||"modelValue"}`]:x},F.value)})}return Object.assign(Object.assign({},I),{values:d.readonly(l),handleReset:()=>Tn(),submitForm:Mr})}function dg(t,e,n,r){const i={touched:"some",pending:"some",valid:"every"},s=d.computed(()=>!qe(e,d.unref(n)));function o(){const l=t.value;return rt(i).reduce((c,u)=>{const f=i[u];return c[u]=l[f](h=>h[u]),c},{})}const a=d.reactive(o());return d.watchEffect(()=>{const l=o();a.touched=l.touched,a.valid=l.valid,a.pending=l.pending}),d.computed(()=>Object.assign(Object.assign({initialValues:d.unref(n)},a),{valid:a.valid&&!rt(r.value).length,dirty:s.value}))}function ug(t,e,n){const r=Kc(n),i=d.ref(r),s=d.ref(me(r));function o(a,l=!1){i.value=bi(me(i.value)||{},me(a)),s.value=bi(me(s.value)||{},me(a)),l&&t.value.forEach(c=>{if(c.touched)return;const f=nt(i.value,c.path);dn(e,c.path,me(f))})}return{initialValues:i,originalInitialValues:s,setInitialValues:o}}function fg(t,e){return e?{valid:t.valid&&e.valid,errors:[...t.errors,...e.errors]}:t}const hg=d.defineComponent({name:"Form",inheritAttrs:!1,props:{as:{type:null,default:"form"},validationSchema:{type:Object,default:void 0},initialValues:{type:Object,default:void 0},initialErrors:{type:Object,default:void 0},initialTouched:{type:Object,default:void 0},validateOnMount:{type:Boolean,default:!1},onSubmit:{type:Function,default:void 0},onInvalidSubmit:{type:Function,default:void 0},keepValues:{type:Boolean,default:!1}},setup(t,e){const n=d.toRef(t,"validationSchema"),r=d.toRef(t,"keepValues"),{errors:i,errorBag:s,values:o,meta:a,isSubmitting:l,isValidating:c,submitCount:u,controlledValues:f,validate:h,validateField:p,handleReset:m,resetForm:y,handleSubmit:g,setErrors:k,setFieldError:v,setFieldValue:C,setValues:b,setFieldTouched:E,setTouched:w,resetField:_}=cg({validationSchema:n.value?n:void 0,initialValues:t.initialValues,initialErrors:t.initialErrors,initialTouched:t.initialTouched,validateOnMount:t.validateOnMount,keepValuesOnUnmount:r}),R=g((T,{evt:q})=>{Dc(q)&&q.target.submit()},t.onInvalidSubmit),P=t.onSubmit?g(t.onSubmit,t.onInvalidSubmit):R;function z(T){Go(T)&&T.preventDefault(),m(),typeof e.attrs.onReset=="function"&&e.attrs.onReset()}function te(T,q){return g(typeof T=="function"&&!q?T:q,t.onInvalidSubmit)(T)}function D(){return me(o)}function L(){return me(a.value)}function H(){return me(i.value)}function J(){return{meta:a.value,errors:i.value,errorBag:s.value,values:o,isSubmitting:l.value,isValidating:c.value,submitCount:u.value,controlledValues:f.value,validate:h,validateField:p,handleSubmit:te,handleReset:m,submitForm:R,setErrors:k,setFieldError:v,setFieldValue:C,setValues:b,setFieldTouched:E,setTouched:w,resetForm:y,resetField:_,getValues:D,getMeta:L,getErrors:H}}return e.expose({setFieldError:v,setErrors:k,setFieldValue:C,setValues:b,setFieldTouched:E,setTouched:w,resetForm:y,validate:h,validateField:p,resetField:_,getValues:D,getMeta:L,getErrors:H,values:o,meta:a,errors:i}),function(){const q=t.as==="form"?t.as:t.as?d.resolveDynamicComponent(t.as):null,re=na(q,e,J);if(!q)return re;const De=q==="form"?{novalidate:!0}:{};return d.h(q,Object.assign(Object.assign(Object.assign({},De),e.attrs),{onSubmit:P,onReset:z}),re)}}}),pg=d.defineComponent({name:"ErrorMessage",props:{as:{type:String,default:void 0},name:{type:String,required:!0}},setup(t,e){const n=d.inject(wi,void 0),r=d.computed(()=>n==null?void 0:n.errors.value[t.name]);function i(){return{message:r.value}}return()=>{if(!r.value)return;const s=t.as?d.resolveDynamicComponent(t.as):t.as,o=na(s,e,i),a=Object.assign({role:"alert"},e.attrs);return!s&&(Array.isArray(o)||!o)&&(o!=null&&o.length)?o:(Array.isArray(o)||!o)&&!(o!=null&&o.length)?d.h(s||"span",a,r.value):d.h(s,a,o)}}});function mg(t){const e=Qo(wi),n=t?void 0:d.inject(Tc);return d.computed(()=>t?e==null?void 0:e.errors.value[d.toValue(t)]:n==null?void 0:n.errorMessage.value)}_t("required",t=>typeof t=="object"&&t!=null||typeof t=="boolean"&&t===!0?!0:!t||!t.length?"This field is required":!0),_t("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"}),_t("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"),_t("no_space",t=>(t==null?void 0:t.indexOf(" "))>-1?"This field shouldn't contain space":!0),_t("minLength",(t,[e])=>!t||!t.length?!0:t.length<e?`This field must be at least ${e} characters`:!0),_t("hasUppercaseLetter",t=>/[A-Z]/.test(t)?!0:"This field must have at least one uppercase character"),_t("hasLowercaseLetter",t=>/[a-z]/.test(t)?!0:"This field must have at least one lowercase character"),_t("hasNumber",t=>/\d/.test(t)?!0:"This field must have at least one number"),_t("hasSpecialCharacter",t=>/[!@$%^&*(),.?":{}|]/.test(t)?!0:"This field must have at least one special character"),_t("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"}),_t("number",t=>parseFloat(t)?!0:"This field must be a number");const be=(t,e)=>{const n=t.__vccOpts||t;for(const[r,i]of e)n[r]=i;return n},gg={},yg={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",fill:"currentColor"},bg=[d.createElementVNode("path",{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200z"},null,-1)];function kg(t,e){return d.openBlock(),d.createElementBlock("svg",yg,bg)}const wg=be(gg,[["render",kg]]),vg={},xg={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",fill:"currentColor"},Sg=[d.createElementVNode("path",{d:"M460.116 373.846l-20.823-12.022c-5.541-3.199-7.54-10.159-4.663-15.874 30.137-59.886 28.343-131.652-5.386-189.946-33.641-58.394-94.896-95.833-161.827-99.676C261.028 55.961 256 50.751 256 44.352V20.309c0-6.904 5.808-12.337 12.703-11.982 83.556 4.306 160.163 50.864 202.11 123.677 42.063 72.696 44.079 162.316 6.031 236.832-3.14 6.148-10.75 8.461-16.728 5.01z"},null,-1)];function Mg(t,e){return d.openBlock(),d.createElementBlock("svg",xg,Sg)}const Og=be(vg,[["render",Mg]]),Cg={class:"relative"},Mi=Object.assign({name:"WpicSpinner"},{props:{color:{type:String,default:""}},setup(t){return(e,n)=>(d.openBlock(),d.createElementBlock("div",Cg,[d.createVNode(wg,{class:"absolute opacity-25"}),d.createVNode(Og,{class:d.normalizeClass(["animate-spin",{[`${t.color}`]:!0}])},null,8,["class"])]))}});let de={theme:"pmi"};const Tg={key:0,class:"absolute inset-0 flex justify-center items-center"},Eg=Object.assign({name:"WpicButton"},{props:{label:String,primary:Boolean,type:{type:String,default:"button"},secondary:Boolean,inverse:Boolean,disabled:Boolean,full:Boolean,loading:Boolean,outline:{type:Boolean,default:!0},medium:Boolean,small:Boolean,mini:Boolean,plain:Boolean,outlining:Boolean,square:Boolean,to:[String,Object]},setup(t){const e=t,n=d.computed(()=>e.to?"router-link":"button"),r={pmi:"bg-violet-800 border border-violet-800 focus:bg-violet-800 text-white disabled:bg-zinc-100 disabled:text-zinc-400 disabled:border-zinc-100 enabled:hover:bg-violet-900 enabled:hover:border-violet-900 active:scale-95 enabled:transform","wpic-tools":"text-white bg-lime-500 border-lime-500 enabled:hover:bg-lime-400 enabled:hover:border-lime-400 enabled:active:bg-lime-500 enabled:active:border-lime-500 enabled:active:shadow-inner disabled:bg-lime-600/25 disabled:text-white disabled:border-0"},i={pmi:"bg-white text-violet-800 border-zinc-400 dark:border-zinc-700 dark:text-zinc-200 dark:bg-zinc-700 dark:hover:bg-zinc-600 dark:hover:border-zinc-600 disabled:text-zinc-400 active:scale-95 enabled:transform","wpic-tools":"text-slate-700 bg-slate-100 border-slate-300 enabled:hover:bg-lime-50 enabled:hover:border-lime-300 enabled:hover:text-lime-600 enabled:active:shadow-inner disabled:border-slate-200 disabled:text-zinc-400 disabled:bg-slate-50/50"},s={pmi:"border-zinc-300 dark:border-zinc-700 dark:text-zinc-300","wpic-tools":"border-slate-200 bg-slate-200 enabled:hover:bg-slate-300 enabled:hover:border-slate-300 enabled:active:bg-slate-200 enabled:active:border-slate-200 enabled:active:shadow-inner disabled:bg-slate-100 disabled:text-zinc-400 disabled:border-0"},o={pmi:"text-violet-800 hover:underline","wpic-tools":"text-lime-800 hover:underline"},a={pmi:"hover:text-violet-800","wpic-tools":"hover:text-lime-800"};return(l,c)=>(d.openBlock(),d.createBlock(d.resolveDynamicComponent(n.value),{to:t.to,type:t.type,disabled:t.disabled,class:d.normalizeClass([{"cursor-pointer":!t.disabled&&!t.loading,"active:outline active:outline-2 active:outline-offset-4":!t.disabled&&!t.loading&&t.outlining,"cursor-not-allowed":t.disabled,border:t.outline&&!t.plain,[`${r[d.unref(de).theme]}`]:t.primary&&!t.plain&&!t.inverse,[`${i[d.unref(de).theme]}`]:t.secondary,[`${s[d.unref(de).theme]}`]:!t.primary&&!t.secondary&&!t.plain,[`${o[d.unref(de).theme]}`]:t.primary&&t.plain,[`${a[d.unref(de).theme]}`]:!t.primary&&t.plain,"bg-zinc-50 border-violet-800 text-violet-800":t.primary&&t.inverse,"hover:bg-white":t.primary&&t.inverse&&!t.disabled&&!t.loading,"w-full":t.full,"text-opacity-50":t.disabled,"text-sm":t.small,"px-4 py-1 rounded h-8":t.small&&!t.plain,"px-5 py-1 rounded h-10":t.medium&&!t.plain,"px-5 py-1 rounded h-12":!t.small&&!t.medium&&!t.plain,"px-0 aspect-square":t.square},"wpic-button leading-none font-medium no-underline appearance-none outline-zinc-600 focus:outline-none relative inline-flex justify-center items-center"])},{default:d.withCtx(()=>[t.loading?(d.openBlock(),d.createElementBlock("div",Tg,[d.createVNode(Mi,{class:"w-6 h-6"})])):d.createCommentVNode("",!0),d.createElementVNode("span",{class:d.normalizeClass(["flex items-center select-none whitespace-nowrap",{"opacity-0":t.loading}])},[d.renderSlot(l.$slots,"default",{},()=>[d.createTextVNode(d.toDisplayString(t.label),1)])],2)]),_:3},8,["to","type","disabled","class"]))}}),Dg=Object.assign({name:"WpicButtonGroup"},{setup(t){const e={pmi:"border","wpic-tools":"border-slate-300"};return(n,r)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["wpic-button-group flex flex-wrap h-10",[e[d.unref(de).theme]]])},[d.renderSlot(n.$slots,"default")],2))}}),Ng={name:"WpicInputGroup"},_g={class:"wpic-input-group flex w-full"};function Ag(t,e,n,r,i,s){return d.openBlock(),d.createElementBlock("div",_g,[d.renderSlot(t.$slots,"default")])}const Vg=be(Ng,[["render",Ag]]),Bg=Object.assign({name:"WpicForm"},{setup(t){return(e,n)=>(d.openBlock(),d.createBlock(d.unref(hg),null,{default:d.withCtx(({values:r,meta:i,errors:s})=>[d.renderSlot(e.$slots,"default")]),_:3}))}}),oa=Math.min,Dr=Math.max,Os=Math.round,Nn=t=>({x:t,y:t}),Pg={left:"right",right:"left",bottom:"top",top:"bottom"},Ig={start:"end",end:"start"};function Jc(t,e,n){return Dr(t,oa(e,n))}function Cs(t,e){return typeof t=="function"?t(e):t}function nr(t){return t.split("-")[0]}function Ts(t){return t.split("-")[1]}function Gc(t){return t==="x"?"y":"x"}function Zc(t){return t==="y"?"height":"width"}function Es(t){return["top","bottom"].includes(nr(t))?"y":"x"}function Xc(t){return Gc(Es(t))}function Rg(t,e,n){n===void 0&&(n=!1);const r=Ts(t),i=Xc(t),s=Zc(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=Ds(o)),[o,Ds(o)]}function $g(t){const e=Ds(t);return[aa(t),e,aa(e)]}function aa(t){return t.replace(/start|end/g,e=>Ig[e])}function Lg(t,e,n){const r=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:r:e?r:i;case"left":case"right":return e?s:o;default:return[]}}function Fg(t,e,n,r){const i=Ts(t);let s=Lg(nr(t),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(aa)))),s}function Ds(t){return t.replace(/left|right|bottom|top/g,e=>Pg[e])}function zg(t){return{top:0,right:0,bottom:0,left:0,...t}}function jg(t){return typeof t!="number"?zg(t):{top:t,right:t,bottom:t,left:t}}function Ns(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 Qc(t,e,n){let{reference:r,floating:i}=t;const s=Es(e),o=Xc(e),a=Zc(o),l=nr(e),c=s==="y",u=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let p;switch(l){case"top":p={x:u,y:r.y-i.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-i.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Ts(e)){case"start":p[o]-=h*(n&&c?-1:1);break;case"end":p[o]+=h*(n&&c?-1:1);break}return p}const Wg=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:f}=Qc(c,r,l),h=r,p={},m=0;for(let y=0;y<a.length;y++){const{name:g,fn:k}=a[y],{x:v,y:C,data:b,reset:E}=await k({x:u,y:f,initialPlacement:r,placement:h,strategy:i,middlewareData:p,rects:c,platform:o,elements:{reference:t,floating:e}});u=v??u,f=C??f,p={...p,[g]:{...p[g],...b}},E&&m<=50&&(m++,typeof E=="object"&&(E.placement&&(h=E.placement),E.rects&&(c=E.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):E.rects),{x:u,y:f}=Qc(c,h,l)),y=-1)}return{x:u,y:f,placement:h,strategy:i,middlewareData:p}};async function ed(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=Cs(e,t),m=jg(p),g=a[h?f==="floating"?"reference":"floating":f],k=Ns(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(g)))==null||n?g:g.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),v=f==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),b=await(s.isElement==null?void 0:s.isElement(C))?await(s.getScale==null?void 0:s.getScale(C))||{x:1,y:1}:{x:1,y:1},E=Ns(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:C,strategy:l}):v);return{top:(k.top-E.top+m.top)/b.y,bottom:(E.bottom-k.bottom+m.bottom)/b.y,left:(k.left-E.left+m.left)/b.x,right:(E.right-k.right+m.right)/b.x}}const Hg=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...g}=Cs(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const k=nr(i),v=nr(a)===a,C=await(l.isRTL==null?void 0:l.isRTL(c.floating)),b=h||(v||!y?[Ds(a)]:$g(a));!h&&m!=="none"&&b.push(...Fg(a,y,m,C));const E=[a,...b],w=await ed(e,g),_=[];let R=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&_.push(w[k]),f){const D=Rg(i,o,C);_.push(w[D[0]],w[D[1]])}if(R=[...R,{placement:i,overflows:_}],!_.every(D=>D<=0)){var P,z;const D=(((P=s.flip)==null?void 0:P.index)||0)+1,L=E[D];if(L)return{data:{index:D,overflows:R},reset:{placement:L}};let H=(z=R.filter(J=>J.overflows[0]<=0).sort((J,T)=>J.overflows[1]-T.overflows[1])[0])==null?void 0:z.placement;if(!H)switch(p){case"bestFit":{var te;const J=(te=R.map(T=>[T.placement,T.overflows.filter(q=>q>0).reduce((q,re)=>q+re,0)]).sort((T,q)=>T[1]-q[1])[0])==null?void 0:te[0];J&&(H=J);break}case"initialPlacement":H=a;break}if(i!==H)return{reset:{placement:H}}}return{}}}};async function Yg(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=nr(n),a=Ts(n),l=Es(n)==="y",c=["left","top"].includes(o)?-1:1,u=s&&l?-1:1,f=Cs(e,t);let{mainAxis:h,crossAxis:p,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return a&&typeof m=="number"&&(p=a==="end"?m*-1:m),l?{x:p*u,y:h*c}:{x:h*c,y:p*u}}const Ug=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=e,l=await Yg(e,t);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},qg=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:g=>{let{x:k,y:v}=g;return{x:k,y:v}}},...l}=Cs(t,e),c={x:n,y:r},u=await ed(e,l),f=Es(nr(i)),h=Gc(f);let p=c[h],m=c[f];if(s){const g=h==="y"?"top":"left",k=h==="y"?"bottom":"right",v=p+u[g],C=p-u[k];p=Jc(v,p,C)}if(o){const g=f==="y"?"top":"left",k=f==="y"?"bottom":"right",v=m+u[g],C=m-u[k];m=Jc(v,m,C)}const y=a.fn({...e,[h]:p,[f]:m});return{...y,data:{x:y.x-n,y:y.y-r}}}}};function Nr(t){return td(t)?(t.nodeName||"").toLowerCase():"#document"}function ut(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function _n(t){var e;return(e=(td(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function td(t){return t instanceof Node||t instanceof ut(t).Node}function Ht(t){return t instanceof Element||t instanceof ut(t).Element}function Yt(t){return t instanceof HTMLElement||t instanceof ut(t).HTMLElement}function nd(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof ut(t).ShadowRoot}function Oi(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=Vt(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function Kg(t){return["table","td","th"].includes(Nr(t))}function la(t){const e=ca(),n=Vt(t);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function Jg(t){let e=An(t);for(;Yt(e)&&!_r(e);){if(la(e))return e;e=An(e)}return null}function ca(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function _r(t){return["html","body","#document"].includes(Nr(t))}function Vt(t){return ut(t).getComputedStyle(t)}function _s(t){return Ht(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function An(t){if(Nr(t)==="html")return t;const e=t.assignedSlot||t.parentNode||nd(t)&&t.host||_n(t);return nd(e)?e.host:e}function rd(t){const e=An(t);return _r(e)?t.ownerDocument?t.ownerDocument.body:t.body:Yt(e)&&Oi(e)?e:rd(e)}function da(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=rd(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),o=ut(i);return s?e.concat(o,o.visualViewport||[],Oi(i)?i:[],o.frameElement&&n?da(o.frameElement):[]):e.concat(i,da(i,[],n))}function id(t){const e=Vt(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Yt(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r,a=Os(n)!==s||Os(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function sd(t){return Ht(t)?t:t.contextElement}function Ar(t){const e=sd(t);if(!Yt(e))return Nn(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=id(e);let o=(s?Os(n.width):n.width)/r,a=(s?Os(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const Gg=Nn(0);function od(t){const e=ut(t);return!ca()||!e.visualViewport?Gg:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Zg(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==ut(t)?!1:e}function Ci(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=sd(t);let o=Nn(1);e&&(r?Ht(r)&&(o=Ar(r)):o=Ar(t));const a=Zg(s,n,r)?od(s):Nn(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,f=i.height/o.y;if(s){const h=ut(s),p=r&&Ht(r)?ut(r):r;let m=h,y=m.frameElement;for(;y&&r&&p!==m;){const g=Ar(y),k=y.getBoundingClientRect(),v=Vt(y),C=k.left+(y.clientLeft+parseFloat(v.paddingLeft))*g.x,b=k.top+(y.clientTop+parseFloat(v.paddingTop))*g.y;l*=g.x,c*=g.y,u*=g.x,f*=g.y,l+=C,c+=b,m=ut(y),y=m.frameElement}}return Ns({width:u,height:f,x:l,y:c})}const Xg=[":popover-open",":modal"];function ua(t){return Xg.some(e=>{try{return t.matches(e)}catch{return!1}})}function Qg(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",o=_n(r),a=e?ua(e.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=Nn(1);const u=Nn(0),f=Yt(r);if((f||!f&&!s)&&((Nr(r)!=="body"||Oi(o))&&(l=_s(r)),Yt(r))){const h=Ci(r);c=Ar(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x,y:n.y*c.y-l.scrollTop*c.y+u.y}}function e0(t){return Array.from(t.getClientRects())}function ad(t){return Ci(_n(t)).left+_s(t).scrollLeft}function t0(t){const e=_n(t),n=_s(t),r=t.ownerDocument.body,i=Dr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=Dr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+ad(t);const a=-n.scrollTop;return Vt(r).direction==="rtl"&&(o+=Dr(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}function n0(t,e){const n=ut(t),r=_n(t),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const c=ca();(!c||c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a,y:l}}function r0(t,e){const n=Ci(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=Yt(t)?Ar(t):Nn(1),o=t.clientWidth*s.x,a=t.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:o,height:a,x:l,y:c}}function ld(t,e,n){let r;if(e==="viewport")r=n0(t,n);else if(e==="document")r=t0(_n(t));else if(Ht(e))r=r0(e,n);else{const i=od(t);r={...e,x:e.x-i.x,y:e.y-i.y}}return Ns(r)}function cd(t,e){const n=An(t);return n===e||!Ht(n)||_r(n)?!1:Vt(n).position==="fixed"||cd(n,e)}function i0(t,e){const n=e.get(t);if(n)return n;let r=da(t,[],!1).filter(a=>Ht(a)&&Nr(a)!=="body"),i=null;const s=Vt(t).position==="fixed";let o=s?An(t):t;for(;Ht(o)&&!_r(o);){const a=Vt(o),l=la(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Oi(o)&&!l&&cd(t,o))?r=r.filter(u=>u!==o):i=a,o=An(o)}return e.set(t,r),r}function s0(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?ua(e)?[]:i0(e,this._c):[].concat(n),r],a=o[0],l=o.reduce((c,u)=>{const f=ld(e,u,i);return c.top=Dr(f.top,c.top),c.right=oa(f.right,c.right),c.bottom=oa(f.bottom,c.bottom),c.left=Dr(f.left,c.left),c},ld(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function o0(t){const{width:e,height:n}=id(t);return{width:e,height:n}}function a0(t,e,n){const r=Yt(e),i=_n(e),s=n==="fixed",o=Ci(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=Nn(0);if(r||!r&&!s)if((Nr(e)!=="body"||Oi(i))&&(a=_s(e)),r){const f=Ci(e,!0,s,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}else i&&(l.x=ad(i));const c=o.left+a.scrollLeft-l.x,u=o.top+a.scrollTop-l.y;return{x:c,y:u,width:o.width,height:o.height}}function fa(t){return Vt(t).position==="static"}function dd(t,e){return!Yt(t)||Vt(t).position==="fixed"?null:e?e(t):t.offsetParent}function ud(t,e){const n=ut(t);if(ua(t))return n;if(!Yt(t)){let i=An(t);for(;i&&!_r(i);){if(Ht(i)&&!fa(i))return i;i=An(i)}return n}let r=dd(t,e);for(;r&&Kg(r)&&fa(r);)r=dd(r,e);return r&&_r(r)&&fa(r)&&!la(r)?n:r||Jg(t)||n}const l0=async function(t){const e=this.getOffsetParent||ud,n=this.getDimensions,r=await n(t.floating);return{reference:a0(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function c0(t){return Vt(t).direction==="rtl"}const d0={convertOffsetParentRelativeRectToViewportRelativeRect:Qg,getDocumentElement:_n,getClippingRect:s0,getOffsetParent:ud,getElementRects:l0,getClientRects:e0,getDimensions:o0,getScale:Ar,isElement:Ht,isRTL:c0},u0=Ug,f0=qg,h0=Hg,p0=(t,e,n)=>{const r=new Map,i={platform:d0,...n},s={...i.platform,_c:r};return Wg(t,e,{...i,platform:s})};function m0(t,e,n){if(!t)throw new Error("A target component has to be provided.");if(!e)throw new Error("A callback has to be provided.");const r=i=>{i.target===t.value||i.composedPath().includes(t.value)||i.target===n.value||i.composedPath().includes(n.value)||typeof e=="function"&&e()};d.onMounted(()=>{window.addEventListener("click",r)}),d.onBeforeUnmount(()=>{window.removeEventListener("click",r)})}const g0={},y0={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},b0=[d.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"},null,-1)];function k0(t,e){return d.openBlock(),d.createElementBlock("svg",y0,b0)}const As=be(g0,[["render",k0]]);let Vs;const w0=new Uint8Array(16);function v0(){if(!Vs&&(Vs=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Vs))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Vs(w0)}const Le=[];for(let t=0;t<256;++t)Le.push((t+256).toString(16).slice(1));function x0(t,e=0){return Le[t[e+0]]+Le[t[e+1]]+Le[t[e+2]]+Le[t[e+3]]+"-"+Le[t[e+4]]+Le[t[e+5]]+"-"+Le[t[e+6]]+Le[t[e+7]]+"-"+Le[t[e+8]]+Le[t[e+9]]+"-"+Le[t[e+10]]+Le[t[e+11]]+Le[t[e+12]]+Le[t[e+13]]+Le[t[e+14]]+Le[t[e+15]]}const fd={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function hd(t,e,n){if(fd.randomUUID&&!e&&!t)return fd.randomUUID();t=t||{};const r=t.random||(t.rng||v0)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,x0(r)}let ha={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 S0={class:"bg-white rounded-t-lg w-full"},M0={class:"flex justify-between items-center border-b px-4 py-3"},Ti=Object.assign({name:"WpicPopover"},{props:{placement:{type:String,default:"bottom-start"},label:String,hover:Boolean,custom:Boolean,disabled:Boolean,offset:{type:Number,default:0},customWidth:{}},setup(t,{expose:e}){const n=hd(),r=t,i={pmi:"lg:absolute shadow-[0_5px_30px_0px_rgba(0,0,0,0.25)]","wpic-tools":"mt-2 md:absolute border border-slate-300 shadow-md"},s={pmi:"lg:hidden","wpic-tools":"md:hidden"},o=d.ref(null),a=d.ref(null),l=d.ref(!0);ha.isMobile()||m0(a,()=>{u()},o);function c(){ha.isMobile()&&(document.documentElement.style.overflow="hidden",document.querySelector("#app").style.overflow="hidden"),r.disabled||(l.value=!1,f())}function u(){document.documentElement.style.overflow=null,document.querySelector("#app").style.overflow=null,l.value=!0}async function f(){const m=await p0(o.value,a.value,{placement:r.placement,middleware:[h0(),f0(),u0(r.offset)]});a.value.style.left=`${m.x}px`,a.value.style.top=`${m.y}px`}function h(){r.hover&&c()}function p(){r.hover&&u()}return e({hide:u}),(m,y)=>(d.openBlock(),d.createElementBlock(d.Fragment,null,[(d.openBlock(),d.createElementBlock("div",{class:"flex-1",key:`reference_${d.unref(n)}`,ref_key:"reference",ref:o,onMouseenter:h,onMouseleave:p,onClick:y[0]||(y[0]=g=>l.value?c():u())},[d.renderSlot(m.$slots,"default",{isHidden:l.value})],32)),(d.openBlock(),d.createBlock(d.Teleport,{to:"body"},[(d.openBlock(),d.createElementBlock("div",{key:`floating_${d.unref(n)}`,ref_key:"floating",ref:a,class:d.normalizeClass(["z-10 bg-white rounded-md overflow-hidden",{[`${t.customWidth}`]:!0,hidden:l.value,[`${i[d.unref(de).theme]}`]:!l.value,"bg-white px-3 py-2 rounded-md":!t.custom}])},[d.renderSlot(m.$slots,"content")],2)),d.createElementVNode("div",{onClick:y[1]||(y[1]=g=>u()),class:d.normalizeClass(["fixed z-20 flex items-end w-screen h-screen top-0 bg-black/20",{hidden:l.value,[`${s[d.unref(de).theme]}`]:!0}])},[d.createElementVNode("div",S0,[d.createElementVNode("div",M0,[d.createElementVNode("span",null,d.toDisplayString(t.label),1),d.createVNode(As,{onClick:u,class:"w-4 h-4"})]),d.renderSlot(m.$slots,"content")])],2)]))],64))}}),O0={},C0={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},T0=[d.createElementVNode("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"},null,-1),d.createElementVNode("path",{"fill-rule":"evenodd",d:"M1.323 11.447C2.811 6.976 7.028 3.75 12.001 3.75c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113-1.487 4.471-5.705 7.697-10.677 7.697-4.97 0-9.186-3.223-10.675-7.69a1.762 1.762 0 0 1 0-1.113ZM17.25 12a5.25 5.25 0 1 1-10.5 0 5.25 5.25 0 0 1 10.5 0Z","clip-rule":"evenodd"},null,-1)];function E0(t,e){return d.openBlock(),d.createElementBlock("svg",C0,T0)}const D0=be(O0,[["render",E0]]),N0={},_0={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},A0=[d.createElementVNode("path",{d:"M3.53 2.47a.75.75 0 0 0-1.06 1.06l18 18a.75.75 0 1 0 1.06-1.06l-18-18ZM22.676 12.553a11.249 11.249 0 0 1-2.631 4.31l-3.099-3.099a5.25 5.25 0 0 0-6.71-6.71L7.759 4.577a11.217 11.217 0 0 1 4.242-.827c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113Z"},null,-1),d.createElementVNode("path",{d:"M15.75 12c0 .18-.013.357-.037.53l-4.244-4.243A3.75 3.75 0 0 1 15.75 12ZM12.53 15.713l-4.243-4.244a3.75 3.75 0 0 0 4.244 4.243Z"},null,-1),d.createElementVNode("path",{d:"M6.75 12c0-.619.107-1.213.304-1.764l-3.1-3.1a11.25 11.25 0 0 0-2.63 4.31c-.12.362-.12.752 0 1.114 1.489 4.467 5.704 7.69 10.675 7.69 1.5 0 2.933-.294 4.242-.827l-2.477-2.477A5.25 5.25 0 0 1 6.75 12Z"},null,-1)];function V0(t,e){return d.openBlock(),d.createElementBlock("svg",_0,A0)}const B0=be(N0,[["render",V0]]),P0={},I0={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},R0=[d.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4.5 12.75l6 6 9-13.5"},null,-1)];function $0(t,e){return d.openBlock(),d.createElementBlock("svg",I0,R0)}const pd=be(P0,[["render",$0]]),L0={},F0={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},z0=[d.createElementVNode("path",{"fill-rule":"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm8.706-1.442c1.146-.573 2.437.463 2.126 1.706l-.709 2.836.042-.02a.75.75 0 0 1 .67 1.34l-.04.022c-1.147.573-2.438-.463-2.127-1.706l.71-2.836-.042.02a.75.75 0 1 1-.671-1.34l.041-.022ZM12 9a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z","clip-rule":"evenodd"},null,-1)];function j0(t,e){return d.openBlock(),d.createElementBlock("svg",F0,z0)}const md=be(L0,[["render",j0]]);var Bs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function W0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function H0(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var gd=H0,Y0=typeof Bs=="object"&&Bs&&Bs.Object===Object&&Bs,U0=Y0,q0=U0,K0=typeof self=="object"&&self&&self.Object===Object&&self,J0=q0||K0||Function("return this")(),yd=J0,G0=yd,Z0=function(){return G0.Date.now()},X0=Z0,Q0=/\s/;function ey(t){for(var e=t.length;e--&&Q0.test(t.charAt(e)););return e}var ty=ey,ny=ty,ry=/^\s+/;function iy(t){return t&&t.slice(0,ny(t)+1).replace(ry,"")}var sy=iy,oy=yd,ay=oy.Symbol,bd=ay,kd=bd,wd=Object.prototype,ly=wd.hasOwnProperty,cy=wd.toString,Ei=kd?kd.toStringTag:void 0;function dy(t){var e=ly.call(t,Ei),n=t[Ei];try{t[Ei]=void 0;var r=!0}catch{}var i=cy.call(t);return r&&(e?t[Ei]=n:delete t[Ei]),i}var uy=dy,fy=Object.prototype,hy=fy.toString;function py(t){return hy.call(t)}var my=py,vd=bd,gy=uy,yy=my,by="[object Null]",ky="[object Undefined]",xd=vd?vd.toStringTag:void 0;function wy(t){return t==null?t===void 0?ky:by:xd&&xd in Object(t)?gy(t):yy(t)}var vy=wy;function xy(t){return t!=null&&typeof t=="object"}var Sy=xy,My=vy,Oy=Sy,Cy="[object Symbol]";function Ty(t){return typeof t=="symbol"||Oy(t)&&My(t)==Cy}var Ey=Ty,Dy=sy,Sd=gd,Ny=Ey,Md=NaN,_y=/^[-+]0x[0-9a-f]+$/i,Ay=/^0b[01]+$/i,Vy=/^0o[0-7]+$/i,By=parseInt;function Py(t){if(typeof t=="number")return t;if(Ny(t))return Md;if(Sd(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Sd(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=Dy(t);var n=Ay.test(t);return n||Vy.test(t)?By(t.slice(2),n?2:8):_y.test(t)?Md:+t}var Iy=Py,Ry=gd,pa=X0,Od=Iy,$y="Expected a function",Ly=Math.max,Fy=Math.min;function zy(t,e,n){var r,i,s,o,a,l,c=0,u=!1,f=!1,h=!0;if(typeof t!="function")throw new TypeError($y);e=Od(e)||0,Ry(n)&&(u=!!n.leading,f="maxWait"in n,s=f?Ly(Od(n.maxWait)||0,e):s,h="trailing"in n?!!n.trailing:h);function p(w){var _=r,R=i;return r=i=void 0,c=w,o=t.apply(R,_),o}function m(w){return c=w,a=setTimeout(k,e),u?p(w):o}function y(w){var _=w-l,R=w-c,P=e-_;return f?Fy(P,s-R):P}function g(w){var _=w-l,R=w-c;return l===void 0||_>=e||_<0||f&&R>=s}function k(){var w=pa();if(g(w))return v(w);a=setTimeout(k,y(w))}function v(w){return a=void 0,h&&r?p(w):(r=i=void 0,o)}function C(){a!==void 0&&clearTimeout(a),c=0,r=l=i=a=void 0}function b(){return a===void 0?o:v(pa())}function E(){var w=pa(),_=g(w);if(r=arguments,i=this,l=w,_){if(a===void 0)return m(l);if(f)return clearTimeout(a),a=setTimeout(k,e),p(l)}return a===void 0&&(a=setTimeout(k,e)),o}return E.cancel=C,E.flush=b,E}var jy=zy;const Wy=W0(jy),Hy={key:0,class:"mb-2 gap-2 wpic-form-label text-base text-zinc-600 dark:text-zinc-300 flex items-center"},Yy={class:""},Uy=["name","value","checked"],qy={key:0,class:"absolute left-0 ml-3 h-full flex items-center justify-center text-center"},Ky={class:"opacity-50 w-4 h-4 leading-tight"},Jy={key:3,class:"absolute z-10 right-0 mr-3 h-full flex items-center"},Gy={class:"min-w-5 h-5 leading-tight cursor-pointer"},Zy={key:5,class:"text-red-700 mt-1 text-base"},Xy=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}},emits:["onChange","update:modelValue","onClear"],setup(t,{expose:e,emit:n}){const r={pmi:"shadow-inner border-zinc-400 focus-within:border-zinc-500 focus-within:outline focus-within:outline-2 focus-within:outline-offset-3 bg-zinc-100 dark:bg-zinc-700/25 dark:border-zinc-700/50 dark:text-zinc-300","wpic-tools":"border-slate-300 bg-white focus-within:border-blue-400 outline-blue-200 focus-within:outline focus-within:outline-[3px]"},i=t,s=d.computed(()=>i.name?i.name:hd()),o=mg(s.value),a=d.computed(()=>{if(i.label)return i.label;if(i.name&&i.labelName)return`${i.name}#${i.labelName}`}),l=d.ref(!0),c=d.computed(()=>(i.type=="password"||i.password)&&l.value?"password":i.type);function u(){l.value=!l.value}const f=d.computed(()=>{if(i.rules&&typeof i.rules=="string"){let w=i.rules.split("|");return i.required&&w.push("required"),i.email&&w.push("email"),w.join("|")}else if(!i.rules){let w=[];return i.required&&w.push("required"),i.email&&w.push("email"),w.join("|")}return"required"});function h(w){let _=w&&w.target?w.target.value:w;k(_)}const p=n;function m(w){w===!0||w===!1?p("update:modelValue",!w):p("update:modelValue",w)}function y(w){let _=w&&w.target?w.target.value:w;p("update:modelValue",_),p("onChange",_)}function g(){p("update:modelValue",null),p("onChange",null),p("onClear")}const k=Wy(function(w){p("update:modelValue",w),p("onChange",w)},i.debounce),v=d.ref(null),C=d.ref(!1);d.watch(()=>i.modelValue,w=>{i.tag=="textarea"&&(v.value.$el.style.height="auto",d.nextTick(()=>{i.minHeight&&(v.value.$el.style.height=`${v.value.$el.scrollHeight<i.minHeight?i.minHeight:v.value.$el.scrollHeight}px`),i.maxHeight&&(v.value.$el.scrollHeight>i.maxHeight?(v.value.$el.style.height=`${i.maxHeight}px`,C.value=!0):C.value=!1)}))},{deep:!0});function b(){var w;i.tag=="textarea"?v.value.$el.focus():(w=v.value)==null||w.$el.focus()}function E(){return v.value.meta.valid}return e({focus:b,isValid:E}),(w,_)=>{const R=d.resolveComponent("wpic-choice-list");return d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["wpic-form-field",{"mb-6":!t.slim}])},[a.value&&!t.checkbox&&!t.radio?(d.openBlock(),d.createElementBlock("div",Hy,[d.createTextVNode(d.toDisplayString(a.value)+" ",1),d.createElementVNode("div",Yy,[t.info?(d.openBlock(),d.createBlock(Ti,{key:0,hover:""},{content:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(t.info),1)]),default:d.withCtx(()=>[d.createVNode(md,{class:"w-4 h-4 text-zinc-600"})]),_:1})):d.createCommentVNode("",!0)])])):d.createCommentVNode("",!0),t.checkbox?(d.openBlock(),d.createBlock(d.unref(Ss),{key:1,ref_key:"myInput",ref:v,name:s.value,rules:f.value,value:t.checkboxValue,"unchecked-value":t.uncheckedValue,modelValue:t.modelValue},{default:d.withCtx(({field:P})=>[d.createElementVNode("div",{class:"inline-flex items-center gap-2",onClick:_[0]||(_[0]=z=>t.disabled?void 0:m(t.modelValue))},[d.createElementVNode("div",{class:d.normalizeClass(["w-4 h-4 border rounded-sm cursor-pointer",{"border-zinc-400":!t.disabled&&!t.modelValue,"bg-violet-800 border-violet-800 text-white":t.modelValue===!0,"bg-opacity-50 border-opacity-50 text-opacity-75":t.disabled}])},[t.modelValue===!0?(d.openBlock(),d.createBlock(pd,{key:0})):d.createCommentVNode("",!0)],2),d.createElementVNode("span",{class:d.normalizeClass(["text-base cursor-pointer select-none",{"opacity-50":t.disabled}])},[d.renderSlot(w.$slots,"default",{},()=>[d.createTextVNode(d.toDisplayString(a.value),1)])],2)])]),_:3},8,["name","rules","value","unchecked-value","modelValue"])):t.radio?(d.openBlock(),d.createBlock(d.unref(Ss),{key:2,ref_key:"myInput",ref:v,name:s.value,value:t.radioValue,modelValue:t.modelValue},{default:d.withCtx(({field:P})=>[d.createElementVNode("div",{onClick:_[2]||(_[2]=()=>{t.disabled||y(t.radioValue)}),class:d.normalizeClass([{"cursor-pointer":!t.disabled},"inline-flex items-center gap-2 select-none"])},[d.createElementVNode("span",{class:d.normalizeClass(["h-4 w-4 border border-zinc-400 rounded-full p-[2px]",{"border-opacity-50":t.disabled}])},[t.radioValue==t.modelValue?(d.openBlock(),d.createElementBlock("span",{key:0,class:d.normalizeClass(["flex rounded-full h-full w-full bg-violet-800",{"bg-opacity-50":t.disabled}])},null,2)):d.createCommentVNode("",!0)],2),d.createElementVNode("input",{class:"hidden",type:"radio",name:t.name,value:t.radioValue,onChange:_[1]||(_[1]=(...z)=>w.onChange&&w.onChange(...z)),checked:t.radioValue==t.modelValue},null,40,Uy),a.value?(d.openBlock(),d.createElementBlock("span",{key:0,class:d.normalizeClass(["text-base",{"opacity-50":t.disabled}])},d.toDisplayString(a.value),3)):d.createCommentVNode("",!0)],2)]),_:1},8,["name","value","modelValue"])):t.select?(d.openBlock(),d.createBlock(d.unref(Ss),{key:3,ref_key:"myInput",ref:v,modelValue:t.modelValue,rules:f.value,name:s.value},{default:d.withCtx(({field:P})=>{var z;return[d.createVNode(R,{modelValue:t.modelValue,"onUpdate:modelValue":y,disabled:t.disabled,options:t.options,small:t.small,hideSelect:t.hideSelect,multiple:t.multiple,maxDisplay:t.maxDisplay,isInvalid:!!(t.error&&d.unref(o)),required:t.required||((z=f.value)==null?void 0:z.indexOf("required"))>=0,label:a.value,placeholder:"Select..."},null,8,["modelValue","disabled","options","small","hideSelect","multiple","maxDisplay","isInvalid","required","label"])]}),_:1},8,["modelValue","rules","name"])):(d.openBlock(),d.createElementBlock("div",{key:4,class:d.normalizeClass(["wpic-input rounded flex relative border",{[`${r[d.unref(de).theme]}`]:!0,"h-10":!t.textarea&&!t.large,"h-12":!t.textarea&&t.large,"border-opacity-50 border-zinc-300 text-zinc-400":t.disabled,"!border-red-600 focus-within:outline-red-600":d.unref(o)}])},[w.$slots.prepend?(d.openBlock(),d.createElementBlock("div",qy,[d.createElementVNode("div",Ky,[d.renderSlot(w.$slots,"prepend")])])):d.createCommentVNode("",!0),d.createVNode(d.unref(Ss),{ref_key:"myInput",ref:v,as:t.textarea?"textarea":void 0,autocomplete:"off",style:{"z-index":"1"},class:d.normalizeClass(["flex w-full h-full rounded pr-4 bg-transparent outline-none appearance-none",{"pl-4":!w.$slots.prepend,"pl-12":w.$slots.prepend,"py-2":t.textarea,"cursor-not-allowed":t.disabled}]),type:c.value,min:t.min,max:t.max,rows:t.rows,name:s.value,disabled:t.disabled,modelValue:t.modelValue,onInput:h,placeholder:t.placeholder,validateOnInput:!!d.unref(o),rules:f.value},null,8,["as","class","type","min","max","rows","name","disabled","modelValue","placeholder","validateOnInput","rules"]),t.loading?(d.openBlock(),d.createElementBlock("div",{key:1,onClick:g,class:"absolute right-0 mr-3 h-full flex items-center cursor-pointer opacity-75 hover:opacity-100"},[d.createVNode(Mi,{class:"w-6 h-6 opacity-50"})])):t.clearable&&t.modelValue?(d.openBlock(),d.createElementBlock("div",{key:2,onClick:d.withModifiers(g,["stop"]),style:{"z-index":"2"},class:"absolute right-0 mr-3 h-full flex items-center cursor-pointer opacity-75 hover:opacity-100"},[d.createVNode(As,{class:"w-5 h-5 opacity-50"})])):d.createCommentVNode("",!0),w.$slots.append||t.password||t.type=="password"?(d.openBlock(),d.createElementBlock("div",Jy,[d.createElementVNode("div",Gy,[d.renderSlot(w.$slots,"append",{},()=>[d.withDirectives(d.createVNode(D0,{class:"text-zinc-600 select-none",onClick:u},null,512),[[d.vShow,l.value]]),d.withDirectives(d.createVNode(B0,{class:"text-zinc-600 select-none",onClick:u},null,512),[[d.vShow,!l.value]])])])])):d.createCommentVNode("",!0)],2)),t.error&&d.unref(o)?(d.openBlock(),d.createElementBlock("div",Zy,[d.createVNode(d.unref(pg),{name:s.value},{default:d.withCtx(P=>[d.createTextVNode(d.toDisplayString(P.message),1)]),_:1},8,["name"])])):d.createCommentVNode("",!0),w.$slots.help||t.help?(d.openBlock(),d.createElementBlock("div",{key:6,class:d.normalizeClass(["text-base mt-1",{"ml-7":t.type=="checkbox","opacity-50":t.disabled}])},[d.renderSlot(w.$slots,"help",{},()=>[d.createTextVNode(d.toDisplayString(t.help),1)])],2)):d.createCommentVNode("",!0)],2)}}}),Qy={key:0,class:"mb-2 gap-2 wpic-form-label text-base text-zinc-600 dark:text-zinc-300 flex items-center"},eb={class:""},tb={key:0,class:"absolute left-0 ml-3 h-full flex items-center justify-center text-center"},nb={class:"opacity-50 w-4 h-4 leading-tight"},Cd=Object.assign({name:"WpicFormInput"},{props:{label:String,info:String,disabled:Boolean,large:Boolean,clearable:Boolean,loading:Boolean},emits:["onClear"],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":"border-slate-300 bg-white focus-within:border-blue-400 outline-blue-200 focus-within:outline focus-within:outline-[3px]"},r={pmi:"border-opacity-50 border-zinc-300 text-zinc-400","wpic-tools":"border-slate-200 text-slate-400"},i=e;function s(){i("onClear")}return(o,a)=>{const l=d.resolveComponent("wpic-spinner");return d.openBlock(),d.createElementBlock(d.Fragment,null,[t.label?(d.openBlock(),d.createElementBlock("div",Qy,[d.createTextVNode(d.toDisplayString(t.label)+" ",1),d.createElementVNode("div",eb,[t.info?(d.openBlock(),d.createBlock(Ti,{key:0,hover:""},{content:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(t.info),1)]),default:d.withCtx(()=>[d.createVNode(md,{class:"w-4 h-4 text-zinc-600"})]),_:1})):d.createCommentVNode("",!0)])])):d.createCommentVNode("",!0),d.createElementVNode("div",{class:d.normalizeClass(["wpic-input rounded flex relative border pr-4 items-center",{"pl-4":!o.$slots.prepend,"pl-10":o.$slots.prepend,[`${n[d.unref(de).theme]}`]:!0,"h-10":!t.large,"h-12":t.large,[`${r[d.unref(de).theme]}`]:t.disabled,"cursor-pointer":!t.disabled}])},[o.$slots.prepend?(d.openBlock(),d.createElementBlock("div",tb,[d.createElementVNode("div",nb,[d.renderSlot(o.$slots,"prepend")])])):d.createCommentVNode("",!0),d.renderSlot(o.$slots,"default"),t.loading?(d.openBlock(),d.createElementBlock("div",{key:1,onClick:s,class:"absolute right-0 mr-3 h-full flex items-center cursor-pointer opacity-75 hover:opacity-100"},[d.createVNode(l,{class:"w-6 h-6 opacity-50"})])):t.clearable?(d.openBlock(),d.createElementBlock("div",{key:2,onClick:d.withModifiers(s,["stop"]),style:{"z-index":"2"},class:"absolute right-0 mr-3 h-full flex items-center cursor-pointer opacity-75 hover:opacity-100"},[d.createVNode(As,{class:"w-5 h-5 opacity-50"})])):d.createCommentVNode("",!0)],2)],64)}}}),rb={},ib={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},sb=[d.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"},null,-1)];function ob(t,e){return d.openBlock(),d.createElementBlock("svg",ib,sb)}const ab=be(rb,[["render",ob]]),lb=["disabled"],cb={key:0,class:"leading-none"},db={key:0},ub={key:1,class:"flex flex-col max-h-80 overflow-y-auto"},fb={key:0,class:"px-4 py-2 flex items-center justify-between text-sm gap-6"},hb=["onClick"],pb={class:"select-none flex w-full items-center justify-between"},mb=Object.assign({name:"WpicChoiceList"},{props:{modelValue:{},value:{},name:String,small:Boolean,hideSelect:Boolean,label:String,placeholder:String,options:Array,multiple:Boolean,required:Boolean,disabled:Boolean,isInvalid:Boolean,maxDisplay:{type:Number},batchSelect:{type:Boolean,default:!1},allSelectedText:String},emits:["blur","input","change","update:modelValue"],setup(t,{expose:e,emit:n}){const r=t,i=n,s=d.ref();function o(p){if(r.multiple){if(p){let m=r.modelValue||[];m.indexOf(p)>=0?m.splice(m.indexOf(p),1):m.push(p),i("update:modelValue",m)}}else i("update:modelValue",p),s.value.hide()}function a(p){i("update:modelValue",p)}const l=d.computed(()=>{var p,m,y,g;if(r.multiple)if(r.maxDisplay){let k=(m=r.options)==null?void 0:m.filter(C=>{var b;return((b=r.modelValue)==null?void 0:b.indexOf(C.value))>=0}).map(C=>C.label),v=k==null?void 0:k.slice(0,r.maxDisplay);return k.length-v.length>0?(v==null?void 0:v.join(", "))+` (+${k.length-v.length})`:v==null?void 0:v.join(", ")}else return(p=r.options)==null?void 0:p.filter(k=>{var v;return((v=r.modelValue)==null?void 0:v.indexOf(k.value))>=0}).map(k=>k.label).join(", ");else return((g=(y=r.options)==null?void 0:y.find(k=>k.value===r.modelValue))==null?void 0:g.label)||r.modelValue});d.computed(()=>(r.required,r.options));function c(p){var m;return r.multiple?r.modelValue!==null&&((m=r.modelValue)==null?void 0:m.indexOf(p))>=0:r.modelValue!==null&&p===r.modelValue}const u={pmi:"text-zinc-800 dark:text-zinc-300 disabled:bg-zinc-50 disabled:border-zinc-300 disabled:text-zinc-400 enabled:bg-zinc-100 enabled:border-zinc-400 enabled:text-zinc-500 enabled:dark:bg-zinc-700/25 enabled:dark:border-zinc-700/50 enabled:dark:text-zinc-300","wpic-tools":"text-slate-800 disabled:text-slate-400 disabled:border-slate-200 bg-white border-slate-300 focus-within:border-lime-400 disabled:bg-slate-50"},f={pmi:"group-[.is-selected]:bg-violet-50 group-[.is-selected]:hover:bg-violet-100","wpic-tools":"hover:bg-slate-50 group-[.is-selected]:text-lime-500 group-[.is-selected]:font-medium text-slate-600"},h=d.computed(()=>{var p,m;return((p=r.modelValue)==null?void 0:p.length)===((m=r.options)==null?void 0:m.length)});return e({isAllSelected:h}),(p,m)=>(d.openBlock(),d.createBlock(Ti,{custom:"",ref_key:"myPopover",ref:s,label:t.label,disabled:t.disabled},{default:d.withCtx(({isHidden:y})=>{var g,k;return[d.createElementVNode("button",{class:d.normalizeClass(["flex appearance-none w-full items-center gap-2 px-3 lg:text-base rounded border overflow-hidden leading-none",{"h-10":!t.small,"h-8":t.small,"cursor-pointer":!t.disabled,"!border-red-600 focus-within:outline-red-600":t.isInvalid,[`${u[d.unref(de).theme]}`]:!0}]),disabled:t.disabled},[d.createElementVNode("span",{class:d.normalizeClass(["select-none w-full text-left flex-1",{"whitespace-pre":!t.multiple}])},[t.modelValue&&((g=t.modelValue)==null?void 0:g.length)>0&&!t.hideSelect?(d.openBlock(),d.createElementBlock("span",cb,[h.value&&((k=t.allSelectedText)!=null&&k.length)?(d.openBlock(),d.createElementBlock(d.Fragment,{key:0},[d.createTextVNode(d.toDisplayString(t.allSelectedText),1)],64)):(d.openBlock(),d.createElementBlock(d.Fragment,{key:1},[d.createTextVNode(d.toDisplayString(l.value),1)],64))])):d.renderSlot(p.$slots,"default",{key:1},()=>[d.createTextVNode(d.toDisplayString(t.placeholder),1)])],2),d.createVNode(ab,{class:d.normalizeClass(["h-4 w-4 transition-all transform",{"rotate-180":!y}])},null,8,["class"])],10,lb)]}),content:d.withCtx(()=>{var y;return[!t.options&&((y=t.options)==null?void 0:y.length)==0?(d.openBlock(),d.createElementBlock("span",db,"No data.")):(d.openBlock(),d.createElementBlock("div",ub,[t.multiple&&t.batchSelect?(d.openBlock(),d.createElementBlock("div",fb,[d.createElementVNode("span",{class:"cursor-pointer opacity-50 hover:opacity-100",onClick:m[0]||(m[0]=g=>{var k;return a((k=t.options)==null?void 0:k.filter(v=>v.value).map(v=>v.value))})},"Select all"),d.createElementVNode("span",{class:"cursor-pointer opacity-50 hover:opacity-100",onClick:m[1]||(m[1]=g=>a([]))},"Select none")])):d.createCommentVNode("",!0),(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(r.options,g=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["group",{"is-selected":!!c(g.value)}])},[d.createElementVNode("div",{class:d.normalizeClass(["flex items-center py-2 px-4 min-w-64 text-base",{"cursor-pointer":!t.multiple||g.value,[`${f[d.unref(de).theme]}`]:!0}]),onClick:k=>g.disabled?null:o(g.value)},[d.createElementVNode("div",pb,[d.createElementVNode("span",{class:d.normalizeClass(["",{"opacity-25":g.disabled}])},d.toDisplayString(g.label||g.value),3),c(g.value)?(d.openBlock(),d.createBlock(pd,{key:0,class:"w-4 h-4"})):d.createCommentVNode("",!0)])],10,hb)],2))),256))]))]}),_:3},8,["label","disabled"]))}}),gb={key:0,class:"flex justify-between items-baseline pt-6 px-6"},yb={key:0,class:"text-xl font-bold"},bb={class:""},kb={key:1,class:"flex items-center justify-end py-4 px-6"},wb=Object.assign({name:"WpicCard"},{props:{title:String},setup(t){const e={pmi:"shadow-[0_4px_16px_0px_rgba(0,0,0,0.1)]","wpic-tools":"border border-slate-300"};return(n,r)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["bg-white dark:bg-zinc-800/50 rounded-lg wpic-card",[e[d.unref(de).theme]]])},[t.title||n.$slots.actions?(d.openBlock(),d.createElementBlock("div",gb,[t.title?(d.openBlock(),d.createElementBlock("div",yb,d.toDisplayString(t.title),1)):d.createCommentVNode("",!0),d.createElementVNode("div",bb,[d.renderSlot(n.$slots,"actions")])])):d.createCommentVNode("",!0),d.renderSlot(n.$slots,"default"),n.$slots.buttons?(d.openBlock(),d.createElementBlock("div",kb,[d.renderSlot(n.$slots,"buttons")])):d.createCommentVNode("",!0)],2))}}),vb={name:"WpicCardSection"},xb={class:"py-6 border-b last:border-0 mx-6"};function Sb(t,e,n,r,i,s){return d.openBlock(),d.createElementBlock("div",xb,[d.renderSlot(t.$slots,"default")])}const Mb=be(vb,[["render",Sb]]),Ob={class:"flex h-2 rounded-full w-full ring-1 ring-zinc-400"},Cb=Object.assign({name:"WpicProgressBar"},{props:{value:Number},setup(t){return(e,n)=>(d.openBlock(),d.createElementBlock("div",Ob,[t.value>0?(d.openBlock(),d.createElementBlock("div",{key:0,style:d.normalizeStyle({width:`${t.value}%`}),class:"flex h-full bg-cyan-400 ring-1 ring-cyan-400 rounded-full"},null,4)):d.createCommentVNode("",!0)]))}}),Tb={class:"text-base leading-none"},Eb=Object.assign({name:"WpicTag"},{props:{clearable:Boolean},emits:["clear"],setup(t,{emit:e}){const n={pmi:"border-cyan-500 bg-cyan-50 text-cyan-600","wpic-tools":"border-slate-300 bg-slate-200 text-slate-800"},r=e;function i(){r("clear")}return(s,o)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["wpic-tag select-none border inline-flex rounded h-8 items-center justify-center pl-3 py-1",{"pr-3":!t.clearable,"pr-2":t.clearable,[n[d.unref(de).theme]]:!0}])},[d.createElementVNode("span",Tb,[d.renderSlot(s.$slots,"default")]),t.clearable?(d.openBlock(),d.createElementBlock("span",{key:0,onClick:i,class:"ml-1 cursor-pointer opacity-75 hover:opacity-100"},[d.createVNode(As,{class:"w-4 h-4"})])):d.createCommentVNode("",!0)],2))}}),Db=Object.assign({name:"WpicTagGroup"},{props:{full:Boolean},setup(t){return(e,n)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass({"w-full":t.full})},[d.createElementVNode("div",{class:d.normalizeClass(["ui-tag-group flex flex-wrap gap-2",{"w-full":t.full}])},[d.renderSlot(e.$slots,"default")],2)],2))}}),Nb={class:"w-full h-full flex items-center justify-center"},_b=Object.assign({name:"WpicLoadingPanel"},{props:{color:{type:String,default:""}},setup(t){return(e,n)=>(d.openBlock(),d.createElementBlock("div",Nb,[d.createVNode(Mi,{color:t.color,class:"w-10 h-10"},null,8,["color"])]))}}),Ab={class:"text-base font-medium"},Di=Object.assign({name:"WpicPaginationItem"},{props:{active: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":"hover:text-lime-600"},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"};return(r,i)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["border rounded flex items-center justify-center w-10 h-10 cursor-pointer",{[e[d.unref(de).theme]]:!t.active,[n[d.unref(de).theme]]:t.active}])},[d.createElementVNode("span",Ab,[d.renderSlot(r.$slots,"default")])],2))}}),Vb={},Bb={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},Pb=[d.createElementVNode("path",{"fill-rule":"evenodd",d:"M4.72 9.47a.75.75 0 0 0 0 1.06l4.25 4.25a.75.75 0 1 0 1.06-1.06L6.31 10l3.72-3.72a.75.75 0 1 0-1.06-1.06L4.72 9.47Zm9.25-4.25L9.72 9.47a.75.75 0 0 0 0 1.06l4.25 4.25a.75.75 0 1 0 1.06-1.06L11.31 10l3.72-3.72a.75.75 0 0 0-1.06-1.06Z","clip-rule":"evenodd"},null,-1)];function Ib(t,e){return d.openBlock(),d.createElementBlock("svg",Bb,Pb)}const Td=be(Vb,[["render",Ib]]),Rb={},$b={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},Lb=[d.createElementVNode("path",{"fill-rule":"evenodd",d:"M11.78 5.22a.75.75 0 0 1 0 1.06L8.06 10l3.72 3.72a.75.75 0 1 1-1.06 1.06l-4.25-4.25a.75.75 0 0 1 0-1.06l4.25-4.25a.75.75 0 0 1 1.06 0Z","clip-rule":"evenodd"},null,-1)];function Fb(t,e){return d.openBlock(),d.createElementBlock("svg",$b,Lb)}const Ed=be(Rb,[["render",Fb]]),zb={},jb={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},Wb=[d.createElementVNode("path",{"fill-rule":"evenodd",d:"M15.28 9.47a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 1 1-1.06-1.06L13.69 10 9.97 6.28a.75.75 0 0 1 1.06-1.06l4.25 4.25ZM6.03 5.22l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L8.69 10 4.97 6.28a.75.75 0 0 1 1.06-1.06Z","clip-rule":"evenodd"},null,-1)];function Hb(t,e){return d.openBlock(),d.createElementBlock("svg",jb,Wb)}const Dd=be(zb,[["render",Hb]]),Yb={},Ub={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},qb=[d.createElementVNode("path",{"fill-rule":"evenodd",d:"M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z","clip-rule":"evenodd"},null,-1)];function Kb(t,e){return d.openBlock(),d.createElementBlock("svg",Ub,qb)}const Nd=be(Yb,[["render",Kb]]),Jb={class:"wpic-pagination flex justify-between"},Gb={key:0,class:"flex items-center"},Zb={key:1,class:"flex flex-wrap gap-2"},Xb=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:Number},emits:["update:perPage","update:currentPage"],setup(t,{expose:e,emit:n}){const r=t,i=n,s=d.computed(()=>Math.ceil(r.total/r.perPage)),o=d.computed(()=>{const u=s.value,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<=s.value&&i("update:currentPage",u)}function l(){return r.perPage*(r.currentPage-1)+1}function c(){return r.perPage*r.currentPage>r.total?r.total:r.perPage*r.currentPage}return e({getStart:l,getEnd:c}),(u,f)=>(d.openBlock(),d.createElementBlock("div",Jb,[t.info?(d.openBlock(),d.createElementBlock("div",Gb,d.toDisplayString(l())+" - "+d.toDisplayString(c())+" / "+d.toDisplayString(t.total),1)):d.createCommentVNode("",!0),t.pages?(d.openBlock(),d.createElementBlock("div",Zb,[d.createVNode(Di,{onClick:f[0]||(f[0]=h=>a(1)),disabled:t.currentPage===1},{default:d.withCtx(()=>[d.createVNode(Td,{class:"w-5 h-5 select-none opacity-50 hover:opacity-100"})]),_:1},8,["disabled"]),d.createVNode(Di,{onClick:f[1]||(f[1]=h=>a(t.currentPage-1)),disabled:t.currentPage===1},{default:d.withCtx(()=>[d.createVNode(Ed,{class:"w-5 h-5 select-none opacity-50 hover:opacity-100"})]),_:1},8,["disabled"]),(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(o.value,h=>(d.openBlock(),d.createBlock(Di,{key:h,onClick:p=>a(h),active:h===t.currentPage},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(h),1)]),_:2},1032,["onClick","active"]))),128)),d.createVNode(Di,{onClick:f[2]||(f[2]=h=>a(t.currentPage+1)),disabled:t.currentPage===s.value},{default:d.withCtx(()=>[d.createVNode(Nd,{class:"w-5 h-5 select-none opacity-50 hover:opacity-100"})]),_:1},8,["disabled"]),d.createVNode(Di,{onClick:f[3]||(f[3]=h=>a(s.value)),disabled:t.currentPage===s.value},{default:d.withCtx(()=>[d.createVNode(Dd,{class:"w-5 h-5 select-none opacity-50 hover:opacity-100"})]),_:1},8,["disabled"])])):d.createCommentVNode("",!0),d.createCommentVNode("",!0)]))}}),_d=(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 d.h("td",e.attrs,[d.h("div",{class:""},n)])};_d.props=["column","item","rowIndex"];const Ad=_d,Qb={},e1={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},t1=[d.createElementVNode("path",{"fill-rule":"evenodd",d:"M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z","clip-rule":"evenodd"},null,-1)];function n1(t,e){return d.openBlock(),d.createElementBlock("svg",e1,t1)}const r1=be(Qb,[["render",n1]]),i1={class:"font-semibold"},Vd={__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-slate-50 border-slate-200 dark:border-slate-900 dark:bg-slate-800"};return(n,r)=>(d.openBlock(),d.createElementBlock("tr",i1,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(t.columns,(i,s)=>(d.openBlock(),d.createBlock(Ad,{class:d.normalizeClass(["py-3 first:pl-6 pr-6 border-t",{[`${e[d.unref(de).theme]}`]:!0,"sticky left-0":s===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_${s}`,column:i,item:t.totalItem,key:`tr_total_${s}`},null,8,["class","id","column","item"]))),128))]))}},s1={class:"overflow-auto"},o1={class:"w-full rounded-lg"},a1=["width","max-width"],l1={key:0,class:"rounded-t-lg"},c1=["onClick"],d1={class:"rounded-b-lg"},u1={key:1},f1=Object.assign({name:"WpicTable"},{props:{data:{type:Array,default:()=>[]},loading:Boolean,hideHeaders:Boolean,sortOptions:{},border:Boolean,noXPadding:Boolean,totalItem:{},totalOnBottom:Boolean,totalOnTop:Boolean},emits:["changeSort"],setup(t,{expose:e,emit:n}){const r=t,i={pmi:"","wpic-tools":"border-slate-300"},s={pmi:"bg-zinc-50 dark:bg-zinc-800/60 text-zinc-500 dark:text-zinc-400 dark:border-zinc-900","wpic-tools":"bg-slate-100 dark:bg-slate-800/60 text-slate-400 dark:text-slate-400 border-slate-200 dark:border-slate-900"},o={pmi:"bg-white dark:text-zinc-300 dark:border-zinc-900 dark:bg-zinc-800","wpic-tools":"bg-white border-slate-200 dark:border-slate-900 dark:bg-slate-800"},a={pmi:"bg-zinc-900/10","wpic-tools":"bg-slate-900/10"},l=n;d.onMounted(()=>{h()});const c=d.getCurrentInstance();d.provide("wtable",c==null?void 0:c.proxy);const u=d.useSlots(),f=d.ref([]);function h(){const m=(k,v)=>{let C={};for(let b in k){if(typeof k[b].default=="boolean"&&v[b]!==void 0){C[b]=v[b]!==!1;continue}if(v[b]!==void 0){C[b]=v[b];continue}if(typeof k[b].default=="function"){C[b]=k[b].default();continue}C[b]=k[b].default}return C};let y=[];(u.default&&u.default()||[]).forEach(k=>{var v,C;((v=k.type)==null?void 0:v.name)==="WpicTableColumn"?y.push(k):(C=k.children)!=null&&C.length&&k.children.forEach(b=>{var E;((E=b.type)==null?void 0:E.name)==="WpicTableColumn"&&y.push(b)})}),f.value=y.map(k=>{let v=k.children,C=k.props||{},{field:b,label:E,help:w,width:_,minWidth:R,maxWidth:P,sortable:z,selectable:te,render:D,type:L,align:H,visible:J}=m(k.type.props,C);return{label:E,help:w,width:_,minWidth:R,maxWidth:P,type:L,align:H,sortable:z,selectable:te,field:b,render:D,children:v,visible:J}}).filter(k=>k.visible||k.selectable)}function p(m){var g,k;let y=(g=r.sortOptions)==null?void 0:g.sortDirection;((k=r.sortOptions)==null?void 0:k.sortBy)===m&&(y=y==="asc"?"desc":"asc"),l("changeSort",{sortDirection:y,sortBy:m})}return d.watch(()=>u.default,m=>{console.log("watch slots.default",m),h()},{deep:!0}),e({buildColumns:h}),(m,y)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["relative w-full rounded-lg overflow-hidden",{border:t.border,[`${i[d.unref(de).theme]}`]:!0}])},[t.loading?(d.openBlock(),d.createElementBlock("div",{key:0,class:d.normalizeClass(["inset-0 z-10 absolute flex items-center justify-center",[a[d.unref(de).theme]]])},[d.createVNode(Mi,{class:"w-6 h-6"})],2)):d.createCommentVNode("",!0),d.createElementVNode("div",s1,[d.createElementVNode("table",o1,[d.createElementVNode("colgroup",null,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(f.value,(g,k)=>(d.openBlock(),d.createElementBlock("col",{style:d.normalizeStyle({minWidth:`${g.minWidth}px`}),width:g.width,"max-width":g.maxWidth,key:k},null,12,a1))),128))]),t.hideHeaders?d.createCommentVNode("",!0):(d.openBlock(),d.createElementBlock("thead",l1,[d.createElementVNode("tr",null,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(f.value,(g,k)=>{var v,C;return d.openBlock(),d.createElementBlock("th",{class:d.normalizeClass(["first:rounded-tl-lg last:rounded-tr-lg py-0border-b first:pl-6 pr-6",{[`${s[d.unref(de).theme]}`]:!0,"sticky left-0":k===0}])},[d.createElementVNode("div",{onClick:()=>{g.sortable&&p(g.field)},class:d.normalizeClass(["flex items-center py-3 lg:text-base rounded-lg",{"cursor-pointer":g.sortable&&g.field,"justify-center":g.align=="center","justify-end":g.align=="right"}])},[d.createElementVNode("span",{class:d.normalizeClass(["select-none font-medium",{"text-right":g.align=="right"}])},d.toDisplayString(g.label),3),g.sortable&&g.field?(d.openBlock(),d.createElementBlock("span",{key:0,class:d.normalizeClass(["ml-1",{"opacity-25":g.field!=((v=t.sortOptions)==null?void 0:v.sortBy)}])},[d.createVNode(r1,{class:d.normalizeClass(["w-4 h-4",{"rotate-180":((C=t.sortOptions)==null?void 0:C.sortDirection)==="asc"}])},null,8,["class"])],2)):d.createCommentVNode("",!0)],10,c1)],2)}),256))])])),d.createElementVNode("tbody",d1,[t.totalItem&&t.totalOnTop?(d.openBlock(),d.createBlock(Vd,{key:0,position:"header",columns:f.value,noXPadding:t.noXPadding,totalItem:t.totalItem},null,8,["columns","noXPadding","totalItem"])):d.createCommentVNode("",!0),(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(t.data,(g,k)=>(d.openBlock(),d.createElementBlock("tr",{class:"tr border-b last:border-b-0 overflow-hidden",key:`tr_${k}`},[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(f.value,(v,C)=>{var b,E;return d.openBlock(),d.createBlock(Ad,{class:d.normalizeClass(["py-3 first:pl-6 pr-6 lg:text-base",{"sticky left-0 shadow":C===0,[`${o[d.unref(de).theme]}`]:!0,"first:pl-0 last:pr-0":t.noXPadding,"last:rounded-br-lg":k===((b=t.data)==null?void 0:b.length)-1&&!t.totalItem,"first:rounded-bl-lg":k===((E=t.data)==null?void 0:E.length)-1&&!t.totalItem,"text-center":v.align=="center","text-right":v.align=="right"}]),id:`${k}_${C}`,column:v,item:g,rowIndex:k,key:C},null,8,["class","id","column","item","rowIndex"])}),128))]))),128))]),t.totalItem&&t.totalOnBottom?(d.openBlock(),d.createElementBlock("tfoot",u1,[d.createVNode(Vd,{position:"footer",columns:f.value,noXPadding:t.noXPadding,totalItem:t.totalItem},null,8,["columns","noXPadding","totalItem"])])):d.createCommentVNode("",!0)])])],2))}}),h1={name:"WpicTableColumn",props:{label:{type:String},help:{type:String},field:{type:String,default:""},selectable:{type:Boolean,default:!0},sortable:{type:Boolean,default:!1},type:{type:String,default:"default"},width:{type:[String,Number],default:null},minWidth:{type:[String,Number],default:null},maxWidth:{type:[String,Number],default:null},align:{type:String,default:"left"},visible:{type:Boolean,default:!0}},setup(t){const e=inject("wtable",null);return onMounted(()=>{e&&e.buildColumns&&e.buildColumns()}),onBeforeUnmount(()=>{e&&e.buildColumns&&e.buildColumns()}),()=>null}};function Fe(t){this.content=t}Fe.prototype={constructor:Fe,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new Fe(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Fe(n)},addToStart:function(t,e){return new Fe([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Fe(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new Fe(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Fe.from(t),t.size?new Fe(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Fe.from(t),t.size?new Fe(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Fe.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}},Fe.from=function(t){if(t instanceof Fe)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Fe(e)};function Bd(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)n++;return n}if(i.content.size||s.content.size){let o=Bd(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function Pd(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){n-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let c=0,u=Math.min(o.text.length,a.text.length);for(;c<u&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(o.content.size||a.content.size){let c=Pd(o.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class A{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let o=0,a=0;a<n;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,i+a,s||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new A(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,o=0;o<n;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),i+=a.nodeSize),o=l}return new A(r,i)}cutByIndex(e,n){return e==n?A.empty:e==0&&n==this.content.length?this:new A(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new A(i,s)}addToStart(e){return new A([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new A(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 Bd(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Pd(this,e,n,r)}findIndex(e,n=-1){if(e==0)return Ps(0,e);if(e==this.size)return Ps(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let s=this.child(r),o=i+s.nodeSize;if(o>=e)return o==e||n>0?Ps(r+1,o):Ps(r,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return A.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new A(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return A.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new A(n||e,r)}static from(e){if(!e)return A.empty;if(e instanceof A)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new A([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}A.empty=new A([],0);const ma={index:0,offset:0};function Ps(t,e){return ma.index=t,ma.offset=e,ma}function Is(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(!Is(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Is(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let ge=class kc{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Is(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 kc.none;if(e instanceof kc)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};ge.none=[];class Rs extends Error{}class ${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=Rd(this.content,e+this.openStart,n);return r&&new $(r,this.openStart,this.openEnd)}removeBetween(e,n){return new $(Id(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 $.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 $(A.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new $(e,r,i)}}$.empty=new $(A.empty,0,0);function Id(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(i==e||s.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(Id(s.content,e-i-1,n-i-1)))}function Rd(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),o=t.maybeChild(i);if(s==e||o.isText)return t.cut(0,e).append(n).append(t.cut(e));let a=Rd(o.content,e-s-1,n);return a&&t.replaceChild(i,o.copy(a))}function p1(t,e,n){if(n.openStart>t.depth)throw new Rs("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Rs("Inconsistent open depths");return $d(t,e,n,0)}function $d(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let o=$d(t,e,n,r+1);return s.copy(s.content.replaceChild(i,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,a=o.content;return ir(o,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=m1(n,t);return ir(s,Fd(t,o,a,e,r))}else return ir(s,$s(t,e,r))}function Ld(t,e){if(!e.type.compatibleContent(t.type))throw new Rs("Cannot join "+e.type.name+" onto "+t.type.name)}function ga(t,e,n){let r=t.node(n);return Ld(r,e.node(n)),r}function rr(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Ni(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(rr(t.nodeAfter,r),s++));for(let a=s;a<o;a++)rr(i.child(a),r);e&&e.depth==n&&e.textOffset&&rr(e.nodeBefore,r)}function ir(t,e){return t.type.checkContent(e),t.copy(e)}function Fd(t,e,n,r,i){let s=t.depth>i&&ga(t,e,i+1),o=r.depth>i&&ga(n,r,i+1),a=[];return Ni(null,t,i,a),s&&o&&e.index(i)==n.index(i)?(Ld(s,o),rr(ir(s,Fd(t,e,n,r,i+1)),a)):(s&&rr(ir(s,$s(t,e,i+1)),a),Ni(e,n,i,a),o&&rr(ir(o,$s(n,r,i+1)),a)),Ni(r,null,i,a),new A(a)}function $s(t,e,n){let r=[];if(Ni(null,t,n,r),t.depth>n){let i=ga(t,e,n+1);rr(ir(i,$s(t,e,n+1)),r)}return Ni(e,null,n,r),new A(r)}function m1(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(A.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class _i{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return 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 s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Ls(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),c=s-l;if(r.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;s=c-1,i+=l+1}return new _i(n,r,s)}static resolveCached(e,n){for(let i=0;i<ya.length;i++){let s=ya[i];if(s.pos==n&&s.doc==e)return s}let r=ya[ba]=_i.resolve(e,n);return ba=(ba+1)%g1,r}}let ya=[],ba=0,g1=12;class Ls{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 y1=Object.create(null);let sr=class wc{constructor(e,n,r,i=ge.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||A.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&&Is(this.attrs,n||e.defaultAttrs||y1)&&ge.sameSet(this.marks,r||ge.none)}copy(e=null){return e==this.content?this:new wc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new wc(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 $.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),a=i.start(o),c=i.node(o).content.cut(i.pos-a,s.pos-a);return new $(c,i.depth-o,s.depth-o)}replace(e,n,r){return p1(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return _i.resolveCached(this,e)}resolveNoCache(e){return _i.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),zd(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=A.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content);let e=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=A.fromJSON(e,n.content);return e.nodeType(n.type).create(n.attrs,i,r)}};sr.prototype.text=void 0;class Fs extends sr{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):zd(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 Fs(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Fs(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 zd(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class or{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new b1(e,n);if(r.next==null)return or.empty;let i=jd(r);r.next&&r.err("Unexpected trailing text");let s=O1(M1(i));return C1(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(o,a){let l=o.matchFragment(e,r);if(l&&(!n||l.validEnd))return A.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:f}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let h=s(f,a.concat(u));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
|
|
6
6
|
`)}}or.empty=new or(!0);class b1{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 jd(t){let e=[];do e.push(k1(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function k1(t){let e=[];do e.push(w1(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function w1(t){let e=S1(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=v1(t,e);else break;return e}function Wd(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function v1(t,e){let n=Wd(t),r=n;return t.eat(",")&&(t.next!="}"?r=Wd(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function x1(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let o=n[s];o.groups.indexOf(e)>-1&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function S1(t){if(t.eat("(")){let e=jd(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=x1(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 M1(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(s(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=s(o.exprs[l],a);if(l==o.exprs.length-1)return c;i(c,a=n())}else if(o.type=="star"){let l=n();return r(a,l),i(s(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=n();return i(s(o.expr,a),l),i(s(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let u=n();i(s(o.expr,l),u),l=u}if(o.max==-1)i(s(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let u=n();r(l,u),i(s(o.expr,l),u),l=u}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Hd(t,e){return e-t}function Yd(t,e){let n=[];return r(e),n.sort(Hd);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&n.indexOf(l)==-1&&r(l)}}}function O1(t){let e=Object.create(null);return n(Yd(t,0));function n(r){let i=[];r.forEach(o=>{t[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<i.length;u++)i[u][0]==a&&(c=i[u][1]);Yd(t,l).forEach(u=>{c||i.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new or(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(Hd);s.next.push({type:i[o][0],next:e[a.join(",")]||n(a)})}return s}}function C1(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function 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 qd(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function Kd(t){let e=Object.create(null);if(t)for(let n in t)e[n]=new T1(t[n]);return e}let Jd=class am{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=Kd(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==or.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:qd(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new sr(this,this.computeAttrs(e),A.from(n),ge.setFrom(r))}createChecked(e=null,n,r){return n=A.from(n),this.checkContent(n),new sr(this,this.computeAttrs(e),n,ge.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=A.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(A.empty,!0);return s?new sr(this,e,n.append(s),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((s,o)=>r[s]=new am(s,n,o));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class T1{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class zs{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=Kd(i.attrs),this.excluded=null;let s=Ud(this.attrs);this.instance=s?new ge(this,s):null}create(e=null){return!e&&this.instance?this.instance:new ge(this,qd(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new zs(s,i++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}excludes(e){return this.excluded.indexOf(e)>-1}}class E1{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Fe.from(e.nodes),n.marks=Fe.from(e.marks||{}),this.nodes=Jd.compile(this.spec.nodes,this),this.marks=zs.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=or.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?Gd(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:Gd(this,o.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Jd){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new Fs(r,r.defaultAttrs,e,ge.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return sr.fromJSON(this,e)}markFromJSON(e){return ge.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Gd(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let a in t.marks){let l=t.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function D1(t){return t.tag!=null}function N1(t){return t.style!=null}class Vr{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[],n.forEach(r=>{D1(r)?this.tags.push(r):N1(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 eu(this,n,!1);return r.addAll(e,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new eu(this,n,!0);return r.addAll(e,n.from,n.to),$.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(V1(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(o.getAttrs){let l=o.getAttrs(n);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<n.length;o++){let a=n[o];if((a.priority==null?50:a.priority)<s)break}n.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=tu(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=tu(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Vr(e,Vr.schemaRules(e)))}}const Zd={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},_1={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Xd={ol:!0,ul:!0},js=1,Ws=2,Ai=4;function Qd(t,e,n){return e!=null?(e?js:0)|(e==="full"?Ws:0):t&&t.whitespace=="pre"?js|Ws:n&~Ai}class Hs{constructor(e,n,r,i,s,o,a){this.type=e,this.attrs=n,this.marks=r,this.pendingMarks=i,this.solid=s,this.options=a,this.content=[],this.activeMarks=ge.none,this.stashMarks=[],this.match=o||(a&Ai?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(A.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&js)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let n=A.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(A.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):B1(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&&!Zd.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class eu{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0;let i=n.topNode,s,o=Qd(null,n.preserveWhitespace,0)|(r?Ai:0);i?s=new Hs(i.type,i.attrs,ge.none,ge.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new Hs(null,null,ge.none,ge.none,!0,null,o):s=new Hs(e.schema.topNodeType,null,ge.none,ge.none,!0,null,o),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){e.nodeType==3?this.addTextNode(e):e.nodeType==1&&this.addElement(e)}withStyleRules(e,n){let r=e.style;if(!r||!r.length)return n();let i=this.readStyles(e.style);if(!i)return;let[s,o]=i,a=this.top;for(let l=0;l<o.length;l++)this.removePendingMark(o[l],a);for(let l=0;l<s.length;l++)this.addPendingMark(s[l]);n();for(let l=0;l<s.length;l++)this.removePendingMark(s[l],a);for(let l=0;l<o.length;l++)this.addPendingMark(o[l])}addTextNode(e){let n=e.nodeValue,r=this.top;if(r.options&Ws||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(r.options&js)r.options&Ws?n=n.replace(/\r\n?/g,`
|
|
7
7
|
`):n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let i=r.content[r.content.length-1],s=e.previousSibling;(!i||s&&s.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(n=n.slice(1))}n&&this.insertNode(this.parser.schema.text(n)),this.findInText(e)}else this.findInside(e)}addElement(e,n){let r=e.nodeName.toLowerCase(),i;Xd.hasOwnProperty(r)&&this.parser.normalizeLists&&A1(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,n));if(s?s.ignore:_1.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let o,a=this.top,l=this.needsBlock;if(Zd.hasOwnProperty(r))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),o=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e);return}s&&s.skip?this.addAll(e):this.withStyleRules(e,()=>this.addAll(e)),o&&this.sync(a),this.needsBlock=l}else this.withStyleRules(e,()=>{this.addElementByRule(e,s,s.consuming===!1?i:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
8
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,s=e.length;i<s;i++){let o=e.item(i);for(let a=void 0;;){let l=this.parser.matchStyle(o,e.getPropertyValue(o),this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach(c=>{l.clearMark(c)&&(r=c.addToSet(r))}):n=this.parser.schema.marks[l.mark].create(l.attrs).addToSet(n),l.consuming===!1)a=l;else break}}return[n,r]}addElementByRule(e,n,r){let i,s,o;n.node?(s=this.parser.schema.nodes[n.node],s.isLeaf?this.insertNode(s.create(n.attrs))||this.leafFallback(e):i=this.enter(s,n.attrs||null,n.preserveWhitespace)):(o=this.parser.schema.marks[n.mark].create(n.attrs),this.addPendingMark(o));let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l)}i&&this.sync(a)&&this.open--,o&&this.removePendingMark(o,a)}addAll(e,n,r){let i=n||0;for(let s=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];s!=o;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s);this.findAtPoint(e,i)}findPlace(e){let n,r;for(let i=this.open;i>=0;i--){let s=this.nodes[i],o=s.findWrapping(e);if(o&&(!n||n.length>o.length)&&(n=o,r=s,!o.length)||s.solid)break}if(!n)return!1;this.sync(r);for(let i=0;i<n.length;i++)this.enterInner(n[i],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let n=this.textblockFromContext();n&&this.enterInner(n)}if(this.findPlace(e)){this.closeExtra();let n=this.top;n.applyPending(e.type),n.match&&(n.match=n.match.matchType(e.type));let r=n.activeMarks;for(let i=0;i<e.marks.length;i++)(!n.type||n.type.allowsMarkType(e.marks[i].type))&&(r=e.marks[i].addToSet(r));return n.content.push(e.mark(r)),!0}return!1}enter(e,n,r){let i=this.findPlace(e.create(n));return i&&this.enterInner(e,n,!0,r),i}enterInner(e,n=null,r=!1,i){this.closeExtra();let s=this.top;s.applyPending(e),s.match=s.match&&s.match.matchType(e);let o=Qd(e,i,s.options);s.options&Ai&&s.content.length==0&&(o|=Ai),this.nodes.push(new Hs(e,n,s.activeMarks,s.pendingMarks,r,null,o)),this.open++}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let n=this.open;n>=0;n--)if(this.nodes[n]==e)return this.open=n,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let u=l>0||l==0&&i?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!u||u.name!=c&&u.groups.indexOf(c)==-1)return!1;l--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let n=P1(e,this.top.pendingMarks);n&&this.top.stashMarks.push(n),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,n){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(e)>-1)i.pendingMarks=e.removeFromSet(i.pendingMarks);else{i.activeMarks=e.removeFromSet(i.activeMarks);let o=i.popFromStashMark(e);o&&i.type&&i.type.allowsMarkType(o.type)&&(i.activeMarks=o.addToSet(i.activeMarks))}if(i==n)break}}}function A1(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Xd.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function V1(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function tu(t){let e={};for(let n in t)e[n]=t[n];return e}function B1(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||s.indexOf(u)<0&&o(u))return!0}};if(o(i.contentMatch))return!0}}function P1(t,e){for(let n=0;n<e.length;n++)if(t.eq(e[n]))return e[n]}class Ut{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=ka(n).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(s[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],u=this.serializeMark(c,o.isInline,n);u&&(s.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=Ut.renderSpec(ka(n),this.nodes[e.type.name](e));if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Ut.renderSpec(ka(r),i(e,n))}static renderSpec(e,n,r=null){if(typeof n=="string")return{dom:e.createTextNode(n)};if(n.nodeType!=null)return{dom:n};if(n.dom&&n.dom.nodeType!=null)return n;let i=n[0],s=i.indexOf(" ");s>0&&(r=i.slice(0,s),i=i.slice(s+1));let o,a=r?e.createElementNS(r,i):e.createElement(i),l=n[1],c=1;if(l&&typeof l=="object"&&l.nodeType==null&&!Array.isArray(l)){c=2;for(let u in l)if(l[u]!=null){let f=u.indexOf(" ");f>0?a.setAttributeNS(u.slice(0,f),u.slice(f+1),l[u]):a.setAttribute(u,l[u])}}for(let u=c;u<n.length;u++){let f=n[u];if(f===0){if(u<n.length-1||u>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=Ut.renderSpec(e,f,r);if(a.appendChild(h),p){if(o)throw new RangeError("Multiple content holes");o=p}}}return{dom:a,contentDOM:o}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ut(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=nu(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return nu(e.marks)}}function nu(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function ka(t){return t.document||window.document}const ru=65535,iu=Math.pow(2,16);function I1(t,e){return t+e*iu}function su(t){return t&ru}function R1(t){return(t-(t&ru))/iu}const ou=1,au=2,Ys=4,lu=8;class wa{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&lu)>0}get deletedBefore(){return(this.delInfo&(ou|Ys))>0}get deletedAfter(){return(this.delInfo&(au|Ys))>0}get deletedAcross(){return(this.delInfo&Ys)>0}}class ft{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&ft.empty)return ft.empty}recover(e){let n=0,r=su(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+R1(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+s],u=this.ranges[a+o],f=l+c;if(e<=f){let h=c?e==l?-1:e==f?1:n:n,p=l+i+(h<0?0:u);if(r)return p;let m=e==(n<0?l:f)?null:I1(a/3,e-l),y=e==l?au:e==f?ou:Ys;return(n<0?e!=l:e!=f)&&(y|=lu),new wa(p,y,m)}i+=u-c}return r?e+i:new wa(e+i,0,null)}touches(e,n){let r=0,i=su(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+s],u=l+c;if(e<=u&&a==i*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),c=this.ranges[i+n],u=this.ranges[i+r];e(a,a+c,l,l+u),s+=u-c}}invert(){return new ft(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?ft.empty:new ft(e<0?[0,-e,0]:[0,0,e])}}ft.empty=new ft([]);class Br{constructor(e=[],n,r=0,i=e.length){this.maps=e,this.mirror=n,this.from=r,this.to=i}slice(e=0,n=this.maps.length){return new Br(this.maps,this.mirror,e,n)}copy(){return new Br(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,n){this.to=this.maps.push(e),n!=null&&this.setMirror(this.maps.length-1,n)}appendMapping(e){for(let n=0,r=this.maps.length;n<e.maps.length;n++){let i=e.getMirror(n);this.appendMap(e.maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this.maps.length+e.maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e.maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Br;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this.maps[s],a=o.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this.maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new wa(e,i,null)}}const va=Object.create(null);class We{getMap(){return ft.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=va[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 va)throw new RangeError("Duplicate use of step JSON ID "+e);return va[e]=n,n.prototype.jsonID=e,n}}class Te{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Te(e,null)}static fail(e){return new Te(null,e)}static fromReplace(e,n,r,i){try{return Te.ok(e.replace(n,r,i))}catch(s){if(s instanceof Rs)return Te.fail(s.message);throw s}}}function xa(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(xa(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return A.fromArray(r)}class Vn extends We{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new $(xa(n.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return Te.fromReplace(e,this.from,this.to,s)}invert(){return new qt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Vn(n.pos,r.pos,this.mark)}merge(e){return e instanceof Vn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Vn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Vn(n.from,n.to,e.markFromJSON(n.mark))}}We.jsonID("addMark",Vn);class qt extends We{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new $(xa(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Te.fromReplace(e,this.from,this.to,r)}invert(){return new Vn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new qt(n.pos,r.pos,this.mark)}merge(e){return e instanceof qt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new qt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new qt(n.from,n.to,e.markFromJSON(n.mark))}}We.jsonID("removeMark",qt);class Bn extends We{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Te.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Te.fromReplace(e,this.pos,this.pos+1,new $(A.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Bn(this.pos,n.marks[i]);return new Bn(this.pos,this.mark)}}return new Pr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Bn(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Bn(n.pos,e.markFromJSON(n.mark))}}We.jsonID("addNodeMark",Bn);class Pr extends We{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Te.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Te.fromReplace(e,this.pos,this.pos+1,new $(A.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Bn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Pr(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Pr(n.pos,e.markFromJSON(n.mark))}}We.jsonID("removeNodeMark",Pr);class Ve extends We{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Sa(e,this.from,this.to)?Te.fail("Structure replace would overwrite content"):Te.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ft([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ve(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Ve(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(e){if(!(e instanceof Ve)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?$.empty:new $(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ve(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?$.empty:new $(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ve(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ve(n.from,n.to,$.fromJSON(e,n.slice),!!n.structure)}}We.jsonID("replace",Ve);class Be extends We{constructor(e,n,r,i,s,o,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(Sa(e,this.from,this.gapFrom)||Sa(e,this.gapTo,this.to)))return Te.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Te.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Te.fromReplace(e,this.from,this.to,r):Te.fail("Content does not fit in gap")}getMap(){return new ft([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Be(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new Be(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Be(n.from,n.to,n.gapFrom,n.gapTo,$.fromJSON(e,n.slice),n.insert,!!n.structure)}}We.jsonID("replaceAround",Be);function Sa(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function $1(t,e,n,r){let i=[],s=[],o,a;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let f=l.marks;if(!r.isInSet(f)&&u.type.allowsMarkType(r.type)){let h=Math.max(c,e),p=Math.min(c+l.nodeSize,n),m=r.addToSet(f);for(let y=0;y<f.length;y++)f[y].isInSet(m)||(o&&o.to==h&&o.mark.eq(f[y])?o.to=p:i.push(o=new qt(h,p,f[y])));a&&a.to==h?a.to=p:s.push(a=new Vn(h,p,r))}}),i.forEach(l=>t.step(l)),s.forEach(l=>t.step(l))}function L1(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(r instanceof zs){let c=o.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,n);for(let u=0;u<l.length;u++){let f=l[u],h;for(let p=0;p<i.length;p++){let m=i[p];m.step==s-1&&f.eq(i[p].style)&&(h=m)}h?(h.to=c,h.step=s):i.push({style:f,from:Math.max(a,e),to:c,step:s})}}}),i.forEach(o=>t.step(new qt(o.from,o.to,o.style)))}function cu(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let c=s.child(l),u=a+c.nodeSize,f=r.matchType(c.type);if(!f)o.push(new Ve(a,u,$.empty));else{r=f;for(let h=0;h<c.marks.length;h++)n.allowsMarkType(c.marks[h].type)||t.step(new qt(a,u,c.marks[h]));if(i&&c.isText&&n.whitespace!="pre"){let h,p=/\r?\n|\r/g,m;for(;h=p.exec(c.text);)m||(m=new $(A.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),o.push(new Ve(a+h.index,a+h.index+h[0].length,m))}}a=u}if(!r.validEnd){let l=r.fillBefore(A.empty,!0);t.replace(a,a,new $(l,0,0))}for(let l=o.length-1;l>=0;l--)t.step(o[l])}function F1(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Ir(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let i=t.$from.node(r),s=t.$from.index(r),o=t.$to.indexAfter(r);if(r<t.depth&&i.canReplace(s,o,n))return r;if(r==0||i.type.spec.isolating||!F1(i,s,o))break}return null}function z1(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),a=i.after(s+1),l=o,c=a,u=A.empty,f=0;for(let m=s,y=!1;m>n;m--)y||r.index(m)>0?(y=!0,u=A.from(r.node(m).copy(u)),f++):l--;let h=A.empty,p=0;for(let m=s,y=!1;m>n;m--)y||i.after(m+1)<i.end(m)?(y=!0,h=A.from(i.node(m).copy(h)),p++):c++;t.step(new Be(l,c,o,a,new $(u.append(h),f,p),u.size-f,!0))}function Ma(t,e,n=null,r=t){let i=j1(t,e),s=i&&W1(r,e);return s?i.map(du).concat({type:e,attrs:n}).concat(s.map(du)):null}function du(t){return{type:t,attrs:null}}function j1(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function W1(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;l&&c<i;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:o}function H1(t,e,n){let r=A.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let a=n[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=A.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new Be(i,s,i,s,new $(r,0,0),n.length,!0))}function Y1(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{if(o.isTextblock&&!o.hasMarkup(r,i)&&K1(t.doc,t.mapping.slice(s).map(a),r)){let l=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?l=!1:!h&&p&&(l=!0)}l===!1&&q1(t,o,a,s),cu(t,t.mapping.slice(s).map(a,1),r,void 0,l===null);let c=t.mapping.slice(s),u=c.map(a,1),f=c.map(a+o.nodeSize,1);return t.step(new Be(u,f,u+1,f-1,new $(A.from(r.create(i,null,o.marks)),0,0),1,!0)),l===!0&&U1(t,o,a,s),!1}})}function U1(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function q1(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
|
|
9
|
-
`))}})}function K1(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function J1(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Be(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new $(A.from(o),0,0),1,!0))}function Rr(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=n-2;c>s;c--,u--){let f=i.node(c),h=i.index(c);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(h,f.childCount),m=r&&r[u+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let y=r&&r[u]||f;if(!f.canReplace(h+1,f.childCount)||!y.type.validContent(p))return!1}let a=i.indexAfter(s),l=r&&r[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function G1(t,e,n=1,r){let i=t.doc.resolve(e),s=A.empty,o=A.empty;for(let a=i.depth,l=i.depth-n,c=n-1;a>l;a--,c--){s=A.from(i.node(a).copy(s));let u=r&&r[c];o=A.from(u?u.type.create(u.attrs,o):i.node(a).copy(o))}t.step(new Ve(e,e,new $(s.append(o),n,n),!0))}function Pn(t,e){let n=t.resolve(e),r=n.index();return uu(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function uu(t,e){return!!(t&&e&&!t.isLeaf&&t.canAppend(e))}function Us(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,o,a=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):n>0?(s=r.node(i+1),a++,o=r.node(i).maybeChild(a)):(s=r.node(i).maybeChild(a-1),o=r.node(i+1)),s&&!s.isTextblock&&uu(s,o)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function Z1(t,e,n){let r=new Ve(e-n,e+n,$.empty,!0);t.step(r)}function X1(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function fu(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),c=r.node(o),u=!1;if(s==1)u=c.canReplace(l,l,i);else{let f=c.contentMatchAt(l).findWrapping(i.firstChild.type);u=f&&c.canReplaceWith(l,l,f[0])}if(u)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function qs(t,e,n=e,r=$.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return hu(i,s,r)?new Ve(e,n,r):new Q1(i,s,r).fit()}function hu(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Q1{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=A.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=A.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new $(s,o,a);return e>-1?new Be(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Ve(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Oa(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,f=null;if(n==1&&(o?c.matchType(o.type)||(f=c.fillBefore(A.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:f};if(n==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Oa(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new $(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=Oa(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new $(Vi(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new $(Vi(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let y=0;y<s.length;y++)this.openFrontierNode(s[y]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,c=0,u=[],{match:f,type:h}=this.frontier[n];if(i){for(let y=0;y<i.childCount;y++)u.push(i.child(y));f=f.matchFragment(i)}let p=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let y=a.child(c),g=f.matchType(y.type);if(!g)break;c++,(c>1||l==0||y.content.size)&&(f=g,u.push(pu(y.mark(h.allowedMarks(y.marks)),c==1?l:0,c==a.childCount?p:-1)))}let m=c==a.childCount;m||(p=-1),this.placed=Bi(this.placed,n,A.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?$.empty:new $(Vi(o.content,e-1,1),e-1,p<0?o.openEnd:e-1):new $(Vi(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Ca(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=Ca(e,n,i,r,s);if(o){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=Ca(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Bi(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Bi(this.placed,this.depth,A.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(A.empty,!0);n.childCount&&(this.placed=Bi(this.placed,this.frontier.length,n))}}function Vi(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Vi(t.firstChild.content,e-1,n)))}function Bi(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Bi(t.lastChild.content,e-1,n)))}function Oa(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function pu(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,pu(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(A.empty,!0)))),t.copy(r)}function Ca(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!ek(n,s.content,o)?a:null}function ek(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function tk(t){return t.spec.defining||t.spec.definingForContent}function nk(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(hu(i,s,r))return t.step(new Ve(e,n,r));let o=gu(i,t.doc.resolve(n));o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let h=i.depth,p=i.pos-1;h>0;h--,p--){let m=i.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(h)>-1?a=h:i.before(h)==p&&o.splice(1,0,-h)}let l=o.indexOf(a),c=[],u=r.openStart;for(let h=r.content,p=0;;p++){let m=h.firstChild;if(c.push(m),p==r.openStart)break;h=m.content}for(let h=u-1;h>=0;h--){let p=c[h],m=tk(p.type);if(m&&!p.sameMarkup(i.node(Math.abs(a)-1)))u=h;else if(m||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+u+1)%(r.openStart+1),m=c[p];if(m)for(let y=0;y<o.length;y++){let g=o[(y+l)%o.length],k=!0;g<0&&(k=!1,g=-g);let x=i.node(g-1),C=i.index(g-1);if(x.canReplaceWith(C,C,m.type,m.marks))return t.replace(i.before(g),k?s.after(g):n,new $(mu(r.content,0,r.openStart,p),p,r.openEnd))}}let f=t.steps.length;for(let h=o.length-1;h>=0&&(t.replace(e,n,r),!(t.steps.length>f));h--){let p=o[h];p<0||(e=i.before(p),n=s.after(p))}}function mu(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(mu(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(A.empty,!0))}return t}function rk(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=X1(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new $(A.from(r),0,0))}function ik(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),s=gu(r,i);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.delete(r.before(a),i.after(a))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o)return t.delete(r.before(o),n);t.delete(e,n)}function gu(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}class $r extends We{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Te.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Te.fromReplace(e,this.pos,this.pos+1,new $(A.from(i),0,n.isLeaf?0:1))}getMap(){return ft.empty}invert(e){return new $r(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new $r(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new $r(n.pos,n.attr,n.value)}}We.jsonID("attr",$r);class Pi extends We{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Te.ok(r)}getMap(){return ft.empty}invert(e){return new Pi(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 Pi(n.attr,n.value)}}We.jsonID("docAttr",Pi);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 sk{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Br}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Lr(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=$.empty){let i=qs(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new $(A.from(r),0,0))}delete(e,n){return this.replace(e,n,$.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return nk(this,e,n,r),this}replaceRangeWith(e,n,r){return rk(this,e,n,r),this}deleteRange(e,n){return ik(this,e,n),this}lift(e,n){return z1(this,e,n),this}join(e,n=1){return Z1(this,e,n),this}wrap(e,n){return H1(this,e,n),this}setBlockType(e,n=e,r,i=null){return Y1(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return J1(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new $r(e,n,r)),this}setDocAttribute(e,n){return this.step(new Pi(e,n)),this}addNodeMark(e,n){return this.step(new Bn(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 Pr(e,n)),this}split(e,n=1,r){return G1(this,e,n,r),this}addMark(e,n,r){return $1(this,e,n,r),this}removeMark(e,n,r){return L1(this,e,n,r),this}clearIncompatible(e,n,r){return cu(this,e,n,r),this}}const Ta=Object.create(null);class se{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new ok(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=$.empty){let r=n.content.lastChild,i=null;for(let a=0;a<n.openEnd;a++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],u=e.mapping.slice(s);e.replaceRange(u.map(l.pos),u.map(c.pos),a?$.empty:n),a==0&&ku(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],l=e.mapping.slice(r),c=l.map(o.pos),u=l.map(a.pos);s?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),ku(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new ee(e):Fr(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=n<0?Fr(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):Fr(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Bt(e.node(0))}static atStart(e){return Fr(e,e,0,0,1)||new Bt(e)}static atEnd(e){return Fr(e,e,e.content.size,e.childCount,-1)||new Bt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ta[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 Ta)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ta[e]=n,n.prototype.jsonID=e,n}getBookmark(){return ee.between(this.$anchor,this.$head).getBookmark()}}se.prototype.visible=!0;class ok{constructor(e,n){this.$from=e,this.$to=n}}let yu=!1;function bu(t){!yu&&!t.parent.inlineContent&&(yu=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class ee extends se{constructor(e,n=e){bu(e),bu(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 se.near(r);let i=e.resolve(n.map(this.anchor));return new ee(i.parent.inlineContent?i:r,r)}replace(e,n=$.empty){if(super.replace(e,n),n==$.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ee&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ks(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 ee(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=se.findFrom(n,r,!0)||se.findFrom(n,-r,!0);if(s)n=s.$head;else return se.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(se.findFrom(e,-r,!0)||se.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new ee(e,n)}}se.jsonID("text",ee);class Ks{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Ks(e.map(this.anchor),e.map(this.head))}resolve(e){return ee.between(e.resolve(this.anchor),e.resolve(this.head))}}class K extends se{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?se.near(s):new K(s)}content(){return new $(A.from(this.node),0,0)}eq(e){return e instanceof K&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Ea(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new K(e.resolve(n.anchor))}static create(e,n){return new K(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}K.prototype.visible=!1,se.jsonID("node",K);class Ea{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Ks(r,r):new Ea(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&K.isSelectable(r)?new K(n):se.near(n)}}class Bt extends se{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=$.empty){if(n==$.empty){e.delete(0,e.doc.content.size);let r=se.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Bt(e)}map(e){return new Bt(e)}eq(e){return e instanceof Bt}getBookmark(){return ak}}se.jsonID("all",Bt);const ak={map(){return this},resolve(t){return new Bt(t)}};function Fr(t,e,n,r,i,s=!1){if(e.inlineContent)return ee.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&K.isSelectable(a))return K.create(t,n-(i<0?a.nodeSize:0))}else{let l=Fr(t,a,n+i,i<0?a.childCount:0,i,s);if(l)return l}n+=a.nodeSize*i}return null}function ku(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof Ve||i instanceof Be))return;let s=t.mapping.maps[r],o;s.forEach((a,l,c,u)=>{o==null&&(o=u)}),t.setSelection(se.near(t.doc.resolve(o),n))}const wu=1,Js=2,vu=4;class lk extends sk{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|wu)&~Js,this.storedMarks=null,this}get selectionSet(){return(this.updated&wu)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Js,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&Js)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Js,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 s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),this.selection.empty||this.setSelection(se.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|=vu,this}get scrolledIntoView(){return(this.updated&vu)>0}}function xu(t,e){return!e||!t?t:t.bind(e)}class Ii{constructor(e,n,r){this.name=e,this.init=xu(n.init,r),this.apply=xu(n.apply,r)}}const ck=[new Ii("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Ii("selection",{init(t,e){return t.selection||se.atStart(e.doc)},apply(t){return t.selection}}),new Ii("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Ii("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Da{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=ck.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 Ii(r.key,r.spec.state,r))})}}class zr{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=i?i[o].n:0,c=i?i[o].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let f=0;f<this.config.plugins.length;f++)i.push(f<o?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),s=!0}i&&(i[o]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new zr(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new lk(this)}static create(e){let n=new Da(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new zr(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new Da(this.schema,e.plugins),r=n.fields,i=new zr(n);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Da(e.schema,e.plugins),s=new zr(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=sr.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=se.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){s[o.name]=c.fromJSON.call(l,e,n[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function Su(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Su(i,e,{})),n[r]=i}return n}class Ke{constructor(e){this.spec=e,this.props={},e.props&&Su(e.props,this,this.props),this.key=e.key?e.key.key:Mu("plugin")}getState(e){return e[this.key]}}const Na=Object.create(null);function Mu(t){return t in Na?t+"$"+ ++Na[t]:(Na[t]=0,t+"$")}class Pt{constructor(e="key"){this.key=Mu(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const ze=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Ri=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let _a=null;const fn=function(t,e,n){let r=_a||(_a=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},dk=function(){_a=null},ar=function(t,e,n,r){return n&&(Ou(t,e,n,r,-1)||Ou(t,e,n,r,1))},uk=/^(img|br|input|textarea|hr)$/i;function Ou(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Kt(t))){let s=t.parentNode;if(!s||s.nodeType!=1||$i(t)||uk.test(t.nodeName)||t.contentEditable=="false")return!1;e=ze(t)+(i<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.contentEditable=="false")return!1;e=i<0?Kt(t):0}else return!1}}function Kt(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function fk(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Kt(t)}else if(t.parentNode&&!$i(t))e=ze(t),t=t.parentNode;else return null}}function hk(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&&!$i(t))e=ze(t)+1,t=t.parentNode;else return null}}function pk(t,e,n){for(let r=e==0,i=e==Kt(t);r||i;){if(t==n)return!0;let s=ze(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Kt(t)}}function $i(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 Gs=function(t){return t.focusNode&&ar(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function lr(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function mk(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function gk(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:r.startOffset}}}const Jt=typeof navigator<"u"?navigator:null,Cu=typeof document<"u"?document:null,In=Jt&&Jt.userAgent||"",Aa=/Edge\/(\d+)/.exec(In),Tu=/MSIE \d/.exec(In),Va=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(In),st=!!(Tu||Va||Aa),Rn=Tu?document.documentMode:Va?+Va[1]:Aa?+Aa[1]:0,It=!st&&/gecko\/(\d+)/i.test(In);It&&+(/Firefox\/(\d+)/.exec(In)||[0,0])[1];const Ba=!st&&/Chrome\/(\d+)/.exec(In),Je=!!Ba,yk=Ba?+Ba[1]:0,Ge=!st&&!!Jt&&/Apple Computer/.test(Jt.vendor),jr=Ge&&(/Mobile\/\w+/.test(In)||!!Jt&&Jt.maxTouchPoints>2),vt=jr||(Jt?/Mac/.test(Jt.platform):!1),bk=Jt?/Win/.test(Jt.platform):!1,Rt=/Android \d/.test(In),Li=!!Cu&&"webkitFontSmoothing"in Cu.documentElement.style,kk=Li?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function wk(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function hn(t,e){return typeof t=="number"?t:t[e]}function vk(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 Eu(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;o=Ri(o)){if(o.nodeType!=1)continue;let a=o,l=a==s.body,c=l?wk(s):vk(a),u=0,f=0;if(e.top<c.top+hn(r,"top")?f=-(c.top-e.top+hn(i,"top")):e.bottom>c.bottom-hn(r,"bottom")&&(f=e.bottom-e.top>c.bottom-c.top?e.top+hn(i,"top")-c.top:e.bottom-c.bottom+hn(i,"bottom")),e.left<c.left+hn(r,"left")?u=-(c.left-e.left+hn(i,"left")):e.right>c.right-hn(r,"right")&&(u=e.right-c.right+hn(i,"right")),u||f)if(l)s.defaultView.scrollBy(u,f);else{let h=a.scrollLeft,p=a.scrollTop;f&&(a.scrollTop+=f),u&&(a.scrollLeft+=u);let m=a.scrollLeft-h,y=a.scrollTop-p;e={left:e.left-m,top:e.top-y,right:e.right-m,bottom:e.bottom-y}}if(l||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function xk(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=t.root.elementFromPoint(s,o);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:Du(t.dom)}}function Du(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Ri(r));return e}function Sk({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Nu(n,r==0?0:r-e)}function Nu(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Wr=null;function Mk(t){if(t.setActive)return t.setActive();if(Wr)return t.focus(Wr);let e=Du(t);t.focus(Wr==null?{get preventScroll(){return Wr={preventScroll:!0},!0}}:void 0),Wr||(Wr=!1,Nu(e,0))}function _u(t,e){let n,r=2e8,i,s=0,o=e.top,a=e.top,l,c;for(let u=t.firstChild,f=0;u;u=u.nextSibling,f++){let h;if(u.nodeType==1)h=u.getClientRects();else if(u.nodeType==3)h=fn(u).getClientRects();else continue;for(let p=0;p<h.length;p++){let m=h[p];if(m.top<=o&&m.bottom>=a){o=Math.max(m.bottom,o),a=Math.min(m.top,a);let y=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(y<r){n=u,r=y,i=y&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&y&&(s=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!l&&m.left<=e.left&&m.right>=e.left&&(l=u,c={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!n&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(s=f+1)}}return!n&&l&&(n=l,i=c,r=0),n&&n.nodeType==3?Ok(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:_u(n,i)}function Ok(t,e){let n=t.nodeValue.length,r=document.createRange();for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let s=$n(r,1);if(s.top!=s.bottom&&Pa(e,s))return{node:t,offset:i+(e.left>=(s.left+s.right)/2?1:0)}}return{node:t,offset:0}}function Pa(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Ck(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Tk(t,e,n){let{node:r,offset:i}=_u(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function Ek(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let a=t.docView.nearestDesc(s,!0);if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)){let l=a.dom.getBoundingClientRect();if(a.node.isBlock&&a.parent&&(!o&&l.left>r.left||l.top>r.top?i=a.posBefore:(!o&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText)return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter}s=a.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function Au(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let o=t.childNodes[s];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(Pa(e,c))return Au(o,e,c)}}if((s=(s+1)%r)==i)break}return t}function Dk(t,e){let n=t.dom.ownerDocument,r,i=0,s=gk(n,e.left,e.top);s&&({node:r,offset:i}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=t.dom.getBoundingClientRect();if(!Pa(e,c)||(o=Au(t.dom,e,c),!o))return null}if(Ge)for(let c=o;r&&c;c=Ri(c))c.draggable&&(r=void 0);if(o=Ck(o,e),r){if(It&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],f;u.nodeName=="IMG"&&(f=u.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}let c;Li&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=Ek(t,r,i,e))}a==null&&(a=Tk(t,o,e));let l=t.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Vu(t){return t.top<t.bottom||t.left<t.right}function $n(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Vu(r))return r}return Array.prototype.find.call(n,Vu)||t.getBoundingClientRect()}const Nk=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Bu(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=Li||It;if(r.nodeType==3)if(o&&(Nk.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let l=$n(fn(r,i,i),n);if(It&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=$n(fn(r,i-1,i-1),-1);if(c.top==l.top){let u=$n(fn(r,i,i+1),-1);if(u.top!=l.top)return Fi(u,u.left<c.left)}}return l}else{let l=i,c=i,u=n<0?1:-1;return n<0&&!i?(c++,u=-1):n>=0&&i==r.nodeValue.length?(l--,u=1):n<0?l--:c++,Fi($n(fn(r,l,c),u),u<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==Kt(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return Ia(l.getBoundingClientRect(),!1)}if(s==null&&i<Kt(r)){let l=r.childNodes[i];if(l.nodeType==1)return Ia(l.getBoundingClientRect(),!0)}return Ia(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==Kt(r))){let l=r.childNodes[i-1],c=l.nodeType==3?fn(l,Kt(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return Fi($n(c,1),!1)}if(s==null&&i<Kt(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?fn(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return Fi($n(c,-1),!0)}return Fi($n(r.nodeType==3?fn(r):r,-n),n>=0)}function Fi(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 Ia(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 Pu(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 _k(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return Pu(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=Bu(t,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=fn(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(n=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const Ak=/[\u0590-\u08ac]/;function Vk(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=t.domSelection();return!Ak.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?s:o:Pu(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:f}=t.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:m,focusOffset:y}=t.domSelectionRange(),g=m&&!p.contains(m.nodeType==1?m:m.parentNode)||l==m&&c==y;try{a.collapse(u,f),l&&(l!=u||c!=f)&&a.extend&&a.extend(l,c)}catch{}return h!=null&&(a.caretBidiLevel=h),g})}let Iu=null,Ru=null,$u=!1;function Bk(t,e,n){return Iu==e&&Ru==n?$u:(Iu=e,Ru=n,$u=n=="up"||n=="down"?_k(t,e,n):Vk(t,e,n))}const xt=0,Lu=1,cr=2,Gt=3;class zi{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=xt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>ze(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!n||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)i=i.children[0];return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],a=s+o.size;if(a>e||o instanceof ju){i=e-s;break}s=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof Fu&&s.side>=0;r--);if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?ze(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?ze(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,a=0;;a++){let l=this.children[a],c=o+l.size;if(i==-1&&e<=c){let u=o+l.border;if(e>=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,u);e=o;for(let f=a;f>0;f--){let h=this.children[f-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=ze(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(c>n||a==this.children.length-1)){n=c;for(let u=a+1;u<this.children.length;u++){let f=this.children[u];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){s=ze(f.dom);break}n+=f.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),o=Math.max(e,n);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],y=p+m.size;if(s>p&&o<y)return m.setSelection(e-p-m.border,n-p-m.border,r,i);p=y}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),c=r.getSelection(),u=!1;if((It||Ge)&&e==n){let{node:h,offset:p}=a;if(h.nodeType==3){if(u=!!(p&&h.nodeValue[p-1]==`
|
|
9
|
+
`))}})}function K1(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function J1(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Be(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new $(A.from(o),0,0),1,!0))}function Rr(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=n-2;c>s;c--,u--){let f=i.node(c),h=i.index(c);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(h,f.childCount),m=r&&r[u+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let y=r&&r[u]||f;if(!f.canReplace(h+1,f.childCount)||!y.type.validContent(p))return!1}let a=i.indexAfter(s),l=r&&r[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function G1(t,e,n=1,r){let i=t.doc.resolve(e),s=A.empty,o=A.empty;for(let a=i.depth,l=i.depth-n,c=n-1;a>l;a--,c--){s=A.from(i.node(a).copy(s));let u=r&&r[c];o=A.from(u?u.type.create(u.attrs,o):i.node(a).copy(o))}t.step(new Ve(e,e,new $(s.append(o),n,n),!0))}function Pn(t,e){let n=t.resolve(e),r=n.index();return uu(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function uu(t,e){return!!(t&&e&&!t.isLeaf&&t.canAppend(e))}function Us(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,o,a=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):n>0?(s=r.node(i+1),a++,o=r.node(i).maybeChild(a)):(s=r.node(i).maybeChild(a-1),o=r.node(i+1)),s&&!s.isTextblock&&uu(s,o)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function Z1(t,e,n){let r=new Ve(e-n,e+n,$.empty,!0);t.step(r)}function X1(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function fu(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),c=r.node(o),u=!1;if(s==1)u=c.canReplace(l,l,i);else{let f=c.contentMatchAt(l).findWrapping(i.firstChild.type);u=f&&c.canReplaceWith(l,l,f[0])}if(u)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function qs(t,e,n=e,r=$.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return hu(i,s,r)?new Ve(e,n,r):new Q1(i,s,r).fit()}function hu(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Q1{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=A.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=A.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new $(s,o,a);return e>-1?new Be(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Ve(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Oa(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,f=null;if(n==1&&(o?c.matchType(o.type)||(f=c.fillBefore(A.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:f};if(n==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Oa(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new $(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=Oa(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new $(Vi(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new $(Vi(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let y=0;y<s.length;y++)this.openFrontierNode(s[y]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,c=0,u=[],{match:f,type:h}=this.frontier[n];if(i){for(let y=0;y<i.childCount;y++)u.push(i.child(y));f=f.matchFragment(i)}let p=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let y=a.child(c),g=f.matchType(y.type);if(!g)break;c++,(c>1||l==0||y.content.size)&&(f=g,u.push(pu(y.mark(h.allowedMarks(y.marks)),c==1?l:0,c==a.childCount?p:-1)))}let m=c==a.childCount;m||(p=-1),this.placed=Bi(this.placed,n,A.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?$.empty:new $(Vi(o.content,e-1,1),e-1,p<0?o.openEnd:e-1):new $(Vi(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Ca(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=Ca(e,n,i,r,s);if(o){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=Ca(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Bi(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Bi(this.placed,this.depth,A.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(A.empty,!0);n.childCount&&(this.placed=Bi(this.placed,this.frontier.length,n))}}function Vi(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Vi(t.firstChild.content,e-1,n)))}function Bi(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Bi(t.lastChild.content,e-1,n)))}function Oa(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function pu(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,pu(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(A.empty,!0)))),t.copy(r)}function Ca(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!ek(n,s.content,o)?a:null}function ek(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function tk(t){return t.spec.defining||t.spec.definingForContent}function nk(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(hu(i,s,r))return t.step(new Ve(e,n,r));let o=gu(i,t.doc.resolve(n));o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let h=i.depth,p=i.pos-1;h>0;h--,p--){let m=i.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(h)>-1?a=h:i.before(h)==p&&o.splice(1,0,-h)}let l=o.indexOf(a),c=[],u=r.openStart;for(let h=r.content,p=0;;p++){let m=h.firstChild;if(c.push(m),p==r.openStart)break;h=m.content}for(let h=u-1;h>=0;h--){let p=c[h],m=tk(p.type);if(m&&!p.sameMarkup(i.node(Math.abs(a)-1)))u=h;else if(m||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+u+1)%(r.openStart+1),m=c[p];if(m)for(let y=0;y<o.length;y++){let g=o[(y+l)%o.length],k=!0;g<0&&(k=!1,g=-g);let v=i.node(g-1),C=i.index(g-1);if(v.canReplaceWith(C,C,m.type,m.marks))return t.replace(i.before(g),k?s.after(g):n,new $(mu(r.content,0,r.openStart,p),p,r.openEnd))}}let f=t.steps.length;for(let h=o.length-1;h>=0&&(t.replace(e,n,r),!(t.steps.length>f));h--){let p=o[h];p<0||(e=i.before(p),n=s.after(p))}}function mu(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(mu(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(A.empty,!0))}return t}function rk(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=X1(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new $(A.from(r),0,0))}function ik(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),s=gu(r,i);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.delete(r.before(a),i.after(a))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o)return t.delete(r.before(o),n);t.delete(e,n)}function gu(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}class $r extends We{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Te.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Te.fromReplace(e,this.pos,this.pos+1,new $(A.from(i),0,n.isLeaf?0:1))}getMap(){return ft.empty}invert(e){return new $r(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new $r(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new $r(n.pos,n.attr,n.value)}}We.jsonID("attr",$r);class Pi extends We{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Te.ok(r)}getMap(){return ft.empty}invert(e){return new Pi(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 Pi(n.attr,n.value)}}We.jsonID("docAttr",Pi);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 sk{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Br}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Lr(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=$.empty){let i=qs(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new $(A.from(r),0,0))}delete(e,n){return this.replace(e,n,$.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return nk(this,e,n,r),this}replaceRangeWith(e,n,r){return rk(this,e,n,r),this}deleteRange(e,n){return ik(this,e,n),this}lift(e,n){return z1(this,e,n),this}join(e,n=1){return Z1(this,e,n),this}wrap(e,n){return H1(this,e,n),this}setBlockType(e,n=e,r,i=null){return Y1(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return J1(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new $r(e,n,r)),this}setDocAttribute(e,n){return this.step(new Pi(e,n)),this}addNodeMark(e,n){return this.step(new Bn(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 Pr(e,n)),this}split(e,n=1,r){return G1(this,e,n,r),this}addMark(e,n,r){return $1(this,e,n,r),this}removeMark(e,n,r){return L1(this,e,n,r),this}clearIncompatible(e,n,r){return cu(this,e,n,r),this}}const Ta=Object.create(null);class se{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new ok(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=$.empty){let r=n.content.lastChild,i=null;for(let a=0;a<n.openEnd;a++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],u=e.mapping.slice(s);e.replaceRange(u.map(l.pos),u.map(c.pos),a?$.empty:n),a==0&&ku(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],l=e.mapping.slice(r),c=l.map(o.pos),u=l.map(a.pos);s?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),ku(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new ee(e):Fr(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=n<0?Fr(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):Fr(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Bt(e.node(0))}static atStart(e){return Fr(e,e,0,0,1)||new Bt(e)}static atEnd(e){return Fr(e,e,e.content.size,e.childCount,-1)||new Bt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ta[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 Ta)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ta[e]=n,n.prototype.jsonID=e,n}getBookmark(){return ee.between(this.$anchor,this.$head).getBookmark()}}se.prototype.visible=!0;class ok{constructor(e,n){this.$from=e,this.$to=n}}let yu=!1;function bu(t){!yu&&!t.parent.inlineContent&&(yu=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class ee extends se{constructor(e,n=e){bu(e),bu(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 se.near(r);let i=e.resolve(n.map(this.anchor));return new ee(i.parent.inlineContent?i:r,r)}replace(e,n=$.empty){if(super.replace(e,n),n==$.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ee&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ks(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 ee(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=se.findFrom(n,r,!0)||se.findFrom(n,-r,!0);if(s)n=s.$head;else return se.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(se.findFrom(e,-r,!0)||se.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new ee(e,n)}}se.jsonID("text",ee);class Ks{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Ks(e.map(this.anchor),e.map(this.head))}resolve(e){return ee.between(e.resolve(this.anchor),e.resolve(this.head))}}class K extends se{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?se.near(s):new K(s)}content(){return new $(A.from(this.node),0,0)}eq(e){return e instanceof K&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Ea(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new K(e.resolve(n.anchor))}static create(e,n){return new K(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}K.prototype.visible=!1,se.jsonID("node",K);class Ea{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Ks(r,r):new Ea(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&K.isSelectable(r)?new K(n):se.near(n)}}class Bt extends se{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=$.empty){if(n==$.empty){e.delete(0,e.doc.content.size);let r=se.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Bt(e)}map(e){return new Bt(e)}eq(e){return e instanceof Bt}getBookmark(){return ak}}se.jsonID("all",Bt);const ak={map(){return this},resolve(t){return new Bt(t)}};function Fr(t,e,n,r,i,s=!1){if(e.inlineContent)return ee.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&K.isSelectable(a))return K.create(t,n-(i<0?a.nodeSize:0))}else{let l=Fr(t,a,n+i,i<0?a.childCount:0,i,s);if(l)return l}n+=a.nodeSize*i}return null}function ku(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof Ve||i instanceof Be))return;let s=t.mapping.maps[r],o;s.forEach((a,l,c,u)=>{o==null&&(o=u)}),t.setSelection(se.near(t.doc.resolve(o),n))}const wu=1,Js=2,vu=4;class lk extends sk{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|wu)&~Js,this.storedMarks=null,this}get selectionSet(){return(this.updated&wu)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Js,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&Js)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Js,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 s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),this.selection.empty||this.setSelection(se.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|=vu,this}get scrolledIntoView(){return(this.updated&vu)>0}}function xu(t,e){return!e||!t?t:t.bind(e)}class Ii{constructor(e,n,r){this.name=e,this.init=xu(n.init,r),this.apply=xu(n.apply,r)}}const ck=[new Ii("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Ii("selection",{init(t,e){return t.selection||se.atStart(e.doc)},apply(t){return t.selection}}),new Ii("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Ii("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Da{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=ck.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 Ii(r.key,r.spec.state,r))})}}class zr{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=i?i[o].n:0,c=i?i[o].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let f=0;f<this.config.plugins.length;f++)i.push(f<o?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),s=!0}i&&(i[o]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new zr(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new lk(this)}static create(e){let n=new Da(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new zr(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new Da(this.schema,e.plugins),r=n.fields,i=new zr(n);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Da(e.schema,e.plugins),s=new zr(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=sr.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=se.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){s[o.name]=c.fromJSON.call(l,e,n[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function Su(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Su(i,e,{})),n[r]=i}return n}class Ke{constructor(e){this.spec=e,this.props={},e.props&&Su(e.props,this,this.props),this.key=e.key?e.key.key:Mu("plugin")}getState(e){return e[this.key]}}const Na=Object.create(null);function Mu(t){return t in Na?t+"$"+ ++Na[t]:(Na[t]=0,t+"$")}class Pt{constructor(e="key"){this.key=Mu(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const ze=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Ri=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let _a=null;const fn=function(t,e,n){let r=_a||(_a=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},dk=function(){_a=null},ar=function(t,e,n,r){return n&&(Ou(t,e,n,r,-1)||Ou(t,e,n,r,1))},uk=/^(img|br|input|textarea|hr)$/i;function Ou(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Kt(t))){let s=t.parentNode;if(!s||s.nodeType!=1||$i(t)||uk.test(t.nodeName)||t.contentEditable=="false")return!1;e=ze(t)+(i<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.contentEditable=="false")return!1;e=i<0?Kt(t):0}else return!1}}function Kt(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function fk(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Kt(t)}else if(t.parentNode&&!$i(t))e=ze(t),t=t.parentNode;else return null}}function hk(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&&!$i(t))e=ze(t)+1,t=t.parentNode;else return null}}function pk(t,e,n){for(let r=e==0,i=e==Kt(t);r||i;){if(t==n)return!0;let s=ze(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Kt(t)}}function $i(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 Gs=function(t){return t.focusNode&&ar(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function lr(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function mk(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function gk(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:r.startOffset}}}const Jt=typeof navigator<"u"?navigator:null,Cu=typeof document<"u"?document:null,In=Jt&&Jt.userAgent||"",Aa=/Edge\/(\d+)/.exec(In),Tu=/MSIE \d/.exec(In),Va=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(In),st=!!(Tu||Va||Aa),Rn=Tu?document.documentMode:Va?+Va[1]:Aa?+Aa[1]:0,It=!st&&/gecko\/(\d+)/i.test(In);It&&+(/Firefox\/(\d+)/.exec(In)||[0,0])[1];const Ba=!st&&/Chrome\/(\d+)/.exec(In),Je=!!Ba,yk=Ba?+Ba[1]:0,Ge=!st&&!!Jt&&/Apple Computer/.test(Jt.vendor),jr=Ge&&(/Mobile\/\w+/.test(In)||!!Jt&&Jt.maxTouchPoints>2),vt=jr||(Jt?/Mac/.test(Jt.platform):!1),bk=Jt?/Win/.test(Jt.platform):!1,Rt=/Android \d/.test(In),Li=!!Cu&&"webkitFontSmoothing"in Cu.documentElement.style,kk=Li?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function wk(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function hn(t,e){return typeof t=="number"?t:t[e]}function vk(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 Eu(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;o=Ri(o)){if(o.nodeType!=1)continue;let a=o,l=a==s.body,c=l?wk(s):vk(a),u=0,f=0;if(e.top<c.top+hn(r,"top")?f=-(c.top-e.top+hn(i,"top")):e.bottom>c.bottom-hn(r,"bottom")&&(f=e.bottom-e.top>c.bottom-c.top?e.top+hn(i,"top")-c.top:e.bottom-c.bottom+hn(i,"bottom")),e.left<c.left+hn(r,"left")?u=-(c.left-e.left+hn(i,"left")):e.right>c.right-hn(r,"right")&&(u=e.right-c.right+hn(i,"right")),u||f)if(l)s.defaultView.scrollBy(u,f);else{let h=a.scrollLeft,p=a.scrollTop;f&&(a.scrollTop+=f),u&&(a.scrollLeft+=u);let m=a.scrollLeft-h,y=a.scrollTop-p;e={left:e.left-m,top:e.top-y,right:e.right-m,bottom:e.bottom-y}}if(l||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function xk(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=t.root.elementFromPoint(s,o);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:Du(t.dom)}}function Du(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Ri(r));return e}function Sk({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Nu(n,r==0?0:r-e)}function Nu(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Wr=null;function Mk(t){if(t.setActive)return t.setActive();if(Wr)return t.focus(Wr);let e=Du(t);t.focus(Wr==null?{get preventScroll(){return Wr={preventScroll:!0},!0}}:void 0),Wr||(Wr=!1,Nu(e,0))}function _u(t,e){let n,r=2e8,i,s=0,o=e.top,a=e.top,l,c;for(let u=t.firstChild,f=0;u;u=u.nextSibling,f++){let h;if(u.nodeType==1)h=u.getClientRects();else if(u.nodeType==3)h=fn(u).getClientRects();else continue;for(let p=0;p<h.length;p++){let m=h[p];if(m.top<=o&&m.bottom>=a){o=Math.max(m.bottom,o),a=Math.min(m.top,a);let y=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(y<r){n=u,r=y,i=y&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&y&&(s=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!l&&m.left<=e.left&&m.right>=e.left&&(l=u,c={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!n&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(s=f+1)}}return!n&&l&&(n=l,i=c,r=0),n&&n.nodeType==3?Ok(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:_u(n,i)}function Ok(t,e){let n=t.nodeValue.length,r=document.createRange();for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let s=$n(r,1);if(s.top!=s.bottom&&Pa(e,s))return{node:t,offset:i+(e.left>=(s.left+s.right)/2?1:0)}}return{node:t,offset:0}}function Pa(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Ck(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Tk(t,e,n){let{node:r,offset:i}=_u(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function Ek(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let a=t.docView.nearestDesc(s,!0);if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)){let l=a.dom.getBoundingClientRect();if(a.node.isBlock&&a.parent&&(!o&&l.left>r.left||l.top>r.top?i=a.posBefore:(!o&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText)return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter}s=a.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function Au(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let o=t.childNodes[s];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(Pa(e,c))return Au(o,e,c)}}if((s=(s+1)%r)==i)break}return t}function Dk(t,e){let n=t.dom.ownerDocument,r,i=0,s=gk(n,e.left,e.top);s&&({node:r,offset:i}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=t.dom.getBoundingClientRect();if(!Pa(e,c)||(o=Au(t.dom,e,c),!o))return null}if(Ge)for(let c=o;r&&c;c=Ri(c))c.draggable&&(r=void 0);if(o=Ck(o,e),r){if(It&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],f;u.nodeName=="IMG"&&(f=u.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}let c;Li&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=Ek(t,r,i,e))}a==null&&(a=Tk(t,o,e));let l=t.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Vu(t){return t.top<t.bottom||t.left<t.right}function $n(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Vu(r))return r}return Array.prototype.find.call(n,Vu)||t.getBoundingClientRect()}const Nk=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Bu(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=Li||It;if(r.nodeType==3)if(o&&(Nk.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let l=$n(fn(r,i,i),n);if(It&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=$n(fn(r,i-1,i-1),-1);if(c.top==l.top){let u=$n(fn(r,i,i+1),-1);if(u.top!=l.top)return Fi(u,u.left<c.left)}}return l}else{let l=i,c=i,u=n<0?1:-1;return n<0&&!i?(c++,u=-1):n>=0&&i==r.nodeValue.length?(l--,u=1):n<0?l--:c++,Fi($n(fn(r,l,c),u),u<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==Kt(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return Ia(l.getBoundingClientRect(),!1)}if(s==null&&i<Kt(r)){let l=r.childNodes[i];if(l.nodeType==1)return Ia(l.getBoundingClientRect(),!0)}return Ia(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==Kt(r))){let l=r.childNodes[i-1],c=l.nodeType==3?fn(l,Kt(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return Fi($n(c,1),!1)}if(s==null&&i<Kt(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?fn(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return Fi($n(c,-1),!0)}return Fi($n(r.nodeType==3?fn(r):r,-n),n>=0)}function Fi(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 Ia(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 Pu(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 _k(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return Pu(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=Bu(t,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=fn(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(n=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const Ak=/[\u0590-\u08ac]/;function Vk(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=t.domSelection();return!Ak.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?s:o:Pu(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:f}=t.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:m,focusOffset:y}=t.domSelectionRange(),g=m&&!p.contains(m.nodeType==1?m:m.parentNode)||l==m&&c==y;try{a.collapse(u,f),l&&(l!=u||c!=f)&&a.extend&&a.extend(l,c)}catch{}return h!=null&&(a.caretBidiLevel=h),g})}let Iu=null,Ru=null,$u=!1;function Bk(t,e,n){return Iu==e&&Ru==n?$u:(Iu=e,Ru=n,$u=n=="up"||n=="down"?_k(t,e,n):Vk(t,e,n))}const xt=0,Lu=1,cr=2,Gt=3;class zi{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=xt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>ze(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!n||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)i=i.children[0];return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],a=s+o.size;if(a>e||o instanceof ju){i=e-s;break}s=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof Fu&&s.side>=0;r--);if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?ze(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?ze(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,a=0;;a++){let l=this.children[a],c=o+l.size;if(i==-1&&e<=c){let u=o+l.border;if(e>=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,u);e=o;for(let f=a;f>0;f--){let h=this.children[f-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=ze(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(c>n||a==this.children.length-1)){n=c;for(let u=a+1;u<this.children.length;u++){let f=this.children[u];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){s=ze(f.dom);break}n+=f.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),o=Math.max(e,n);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],y=p+m.size;if(s>p&&o<y)return m.setSelection(e-p-m.border,n-p-m.border,r,i);p=y}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),c=r.getSelection(),u=!1;if((It||Ge)&&e==n){let{node:h,offset:p}=a;if(h.nodeType==3){if(u=!!(p&&h.nodeValue[p-1]==`
|
|
10
10
|
`),u&&p==h.nodeValue.length)for(let m=h,y;m;m=m.parentNode){if(y=m.nextSibling){y.nodeName=="BR"&&(a=l={node:y.parentNode,offset:ze(y)+1});break}let g=m.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let m=h.childNodes[p-1];u=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(It&&c.focusNode&&c.focusNode!=l.node&&c.focusNode.nodeType==1){let h=c.focusNode.childNodes[c.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||u&&Ge)&&ar(a.node,a.offset,c.anchorNode,c.anchorOffset)&&ar(l.node,l.offset,c.focusNode,c.focusOffset))return;let f=!1;if((c.extend||e==n)&&!u){c.collapse(a.node,a.offset);try{e!=n&&c.extend(l.node,l.offset),f=!0}catch{}}if(!f){if(e>n){let p=a;a=l,l=p}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let a=r+s.border,l=o-s.border;if(e>=a&&n<=l){this.dirty=e==r||n==o?cr:Lu,e==a&&n==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Gt:s.markDirty(e-a,n-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?cr:Gt}r=o}this.dirty=cr}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?cr:Lu;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class Fu extends zi{constructor(e,n,r,i){let s,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==xt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class Pk extends zi{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class dr extends zi{constructor(e,n,r,i){super(e,[],r,i),this.mark=n}static create(e,n,r,i){let s=i.nodeViews[n.type.name],o=s&&s(n,i,r);return(!o||!o.dom)&&(o=Ut.renderSpec(document,n.type.spec.toDOM(n,r))),new dr(e,n,o.dom,o.contentDOM||o.dom)}parseRule(){return this.dirty&Gt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Gt&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=xt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=xt}}slice(e,n,r){let i=dr.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=La(s,n,o,r)),e>0&&(s=La(s,0,e,r));for(let a=0;a<s.length;a++)s[a].parent=i;return i.children=s,i}}class Ln extends zi{constructor(e,n,r,i,s,o,a,l,c){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,n,r,i,s,o){let a=s.nodeViews[n.type.name],l,c=a&&a(n,s,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,i),u=c&&c.dom,f=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:f}=Ut.renderSpec(document,n.type.spec.toDOM(n)));!f&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let h=u;return u=Yu(u,r,n),c?l=new Ik(e,n,r,i,u,f||null,h,c,s,o+1):n.isText?new Zs(e,n,r,i,u,h,s):new Ln(e,n,r,i,u,f||null,h,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>A.empty)}return e}matchesNode(e,n,r){return this.dirty==xt&&e.eq(this.node)&&$a(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new $k(this,o&&o.node,e);zk(this.node,this.innerDeco,(c,u,f)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!f&&l.syncToMarks(u==this.node.childCount?ge.none:this.node.child(u).marks,r,e),l.placeWidget(c,e,i)},(c,u,f,h)=>{l.syncToMarks(c.marks,r,e);let p;l.findNodeMatch(c,u,f,h)||a&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(p=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(c,u,f,p,e)||l.updateNextNode(c,u,f,e,h,i)||l.addNode(c,u,f,e,i),i+=c.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==cr)&&(o&&this.protectLocalComposition(e,o),Wu(this.contentDOM,this.children,e),jr&&jk(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof ee)||r<n||i>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,a=Wk(this.node.content,o,r-n,i-n);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new Pk(this,s,n,i);e.input.compositionNodes.push(o),this.children=La(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==Gt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=xt}updateOuterDeco(e){if($a(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Hu(this.dom,this.nodeDOM,Ra(this.outerDeco,this.node,n),Ra(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 zu(t,e,n,r,i){Yu(r,e,t);let s=new Ln(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Zs extends Ln{constructor(e,n,r,i,s,o,a){super(e,n,r,i,s,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==Gt||this.dirty!=xt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=xt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=xt,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new Zs(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Gt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class ju extends zi{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==xt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Ik extends Ln{constructor(e,n,r,i,s,o,a,l,c,u){super(e,n,r,i,s,o,a,c,u),this.spec=l}update(e,n,r,i){if(this.dirty==Gt)return!1;if(this.spec.update){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Wu(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],a=o.dom;if(a.parentNode==t){for(;a!=r;)r=Uu(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(a,r);if(o instanceof dr){let l=r?r.previousSibling:t.lastChild;Wu(o.contentDOM,o.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=Uu(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const ji=function(t){t&&(this.nodeName=t)};ji.prototype=Object.create(null);const ur=[new ji];function Ra(t,e,n){if(t.length==0)return ur;let r=n?ur[0]:new ji,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new ji(o.nodeName));for(let a in o){let l=o[a];l!=null&&(n&&i.length==1&&i.push(r=new ji(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function Hu(t,e,n,r){if(n==ur&&r==ur)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],a=n[s];if(s){let l;a&&a.nodeName==o.nodeName&&i!=t&&(l=i.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=ur[0]),i=l}Rk(i,a||ur[0],o)}return i}function Rk(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&t.classList.add(i[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function Yu(t,e,n){return Hu(t,t,ur,Ra(e,n,t.nodeType!=1))}function $a(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 Uu(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class $k{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Lk(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r){let i=0,s=this.stack.length>>1,o=Math.min(s,e.length);for(;i<o&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=xt,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let c=this.top.children[l];if(c.matchesMark(e[s])&&!this.isLocked(c.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=dr.create(this.top,e[s],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let o=this.top.children[i];return o.dirty==Gt&&o.dom==o.contentDOM&&(o.dirty=cr),o.update(e,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Ln){let c=this.preMatch.matched.get(l);if(c!=null&&c!=s)return!1;let u=l.dom,f,h=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Gt&&$a(n,l.outerDeco));if(!h&&l.update(e,n,r,i))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!h&&(f=this.recreateWrapper(l,e,n,r,i,o)))return this.top.children[this.index]=f,f.contentDOM&&(f.dirty=cr,f.updateChildren(i,o+1),f.dirty=xt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content))return null;let a=Ln.create(this.top,n,r,i,s,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,i,s){let o=Ln.create(this.top,e,n,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new Fu(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof dr;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Zs)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ge||Je)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new ju(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 Lk(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof dr)n=c,r=c.children.length;else{a=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function Fk(t,e){return t.type.side-e.type.side}function zk(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,i,e.forChild(s,u),c),s+=u.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let u,f;for(;o<i.length&&i[o].to==s;){let g=i[o++];g.widget&&(u?(f||(f=[u])).push(g):u=g)}if(u)if(f){f.sort(Fk);for(let g=0;g<f.length;g++)n(f[g],c,!!l)}else n(u,c,!!l);let h,p;if(l)p=-1,h=l,l=null;else if(c<t.childCount)p=c,h=t.child(c++);else break;for(let g=0;g<a.length;g++)a[g].to<=s&&a.splice(g--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let m=s+h.nodeSize;if(h.isText){let g=m;o<i.length&&i[o].from<g&&(g=i[o].from);for(let k=0;k<a.length;k++)a[k].to<g&&(g=a[k].to);g<m&&(l=h.cut(g-s),h=h.cut(0,g-s),m=g,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let y=h.isInline&&!h.isLeaf?a.filter(g=>!g.inline):a.slice();r(h,y,e.forChild(s,h),p),s=m}}function jk(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 Wk(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<t.childCount;){let c=t.child(i++);if(s+=c.nodeSize,!c.isText)break;l+=c.text}if(s>=n){if(s>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=n)return a+c;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function La(t,e,n,r,i){let s=[];for(let o=0,a=0;o<t.length;o++){let l=t[o],c=a,u=a+=l.size;c>=n||u<=e?s.push(l):(c<e&&s.push(l.slice(0,e-c,r)),i&&(s.push(i),i=void 0),u>n&&s.push(l.slice(n-c,l.size,r)))}return s}function Fa(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,c;if(Gs(n)){for(l=a;i&&!i.node;)i=i.parent;let u=i.node;if(i&&u.isAtom&&K.isSelectable(u)&&i.parent&&!(u.isInline&&pk(n.focusNode,n.focusOffset,i.dom))){let f=i.posBefore;c=new K(o==f?a:r.resolve(f))}}else{let u=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(u<0)return null;l=r.resolve(u)}if(!c){let u=e=="pointer"||t.state.selection.head<a.pos&&!s?1:-1;c=ja(t,l,a,u)}return c}function qu(t){return t.editable?t.hasFocus():ef(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function pn(t,e=!1){let n=t.state.selection;if(Zu(t,n),!!qu(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Je){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&ar(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Yk(t);else{let{anchor:r,head:i}=n,s,o;Ku&&!(n instanceof ee)&&(n.$from.parent.inlineContent||(s=Ju(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=Ju(t,n.to))),t.docView.setSelection(r,i,t.root,e),Ku&&(s&&Gu(s),o&&Gu(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Hk(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Ku=Ge||Je&&yk<63;function Ju(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(Ge&&i&&i.contentEditable=="false")return za(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return za(i);if(s)return za(s)}}function za(t){return t.contentEditable="true",Ge&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Gu(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Hk(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(()=>{(!qu(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Yk(t){let e=t.domSelection(),n=document.createRange(),r=t.cursorWrapper.dom,i=r.nodeName=="IMG";i?n.setEnd(r.parentNode,ze(r)+1):n.setEnd(r,0),n.collapse(!1),e.removeAllRanges(),e.addRange(n),!i&&!t.state.selection.visible&&st&&Rn<=11&&(r.disabled=!0,r.disabled=!1)}function Zu(t,e){if(e instanceof K){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Xu(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Xu(t)}function Xu(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function ja(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||ee.between(e,n,r)}function Qu(t){return t.editable&&!t.hasFocus()?!1:ef(t)}function ef(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 Uk(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return ar(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Wa(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&se.findFrom(s,e)}function Fn(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function tf(t,e,n){let r=t.state.selection;if(r instanceof ee)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Fn(t,new ee(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Wa(t.state,e);return i&&i instanceof K?Fn(t,i):!1}else if(!(vt&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(a))&&!o.contentDOM?K.isSelectable(s)?Fn(t,new K(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):Li?Fn(t,new ee(t.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof K&&r.node.isInline)return Fn(t,new ee(e>0?r.$to:r.$from));{let i=Wa(t.state,e);return i?Fn(t,i):!1}}}function Xs(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Wi(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?qk(t):Kk(t)}function qk(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(It&&n.nodeType==1&&r<Xs(n)&&Wi(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Wi(a,-1))i=n,s=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(nf(n))break;{let a=n.previousSibling;for(;a&&Wi(a,-1);)i=n.parentNode,s=ze(a),a=a.previousSibling;if(a)n=a,r=Xs(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Ha(t,n,r):i&&Ha(t,i,s)}function Kk(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Xs(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Wi(a,1))s=n,o=++r;else break}else{if(nf(n))break;{let a=n.nextSibling;for(;a&&Wi(a,1);)s=a.parentNode,o=ze(a)+1,a=a.nextSibling;if(a)n=a,r=0,i=Xs(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&Ha(t,s,o)}function nf(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Jk(t,e){for(;t&&e==t.childNodes.length&&!$i(t);)e=ze(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Gk(t,e){for(;t&&!e&&!$i(t);)e=ze(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Ha(t,e,n){if(e.nodeType!=3){let s,o;(o=Jk(e,n))?(e=o,n=0):(s=Gk(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(Gs(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&pn(t)},50)}function rf(t,e){let n=t.state.doc.resolve(e);if(!(Je||bk)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function sf(t,e,n){let r=t.state.selection;if(r instanceof ee&&!r.empty||n.indexOf("s")>-1||vt&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Wa(t.state,e);if(o&&o instanceof K)return Fn(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=r instanceof Bt?se.near(o,e):se.findFrom(o,e);return a?Fn(t,a):!1}return!1}function of(t,e){if(!(t.state.selection instanceof ee))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function af(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Zk(t){if(!Ge||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;af(t,r,"true"),setTimeout(()=>af(t,r,"false"),20)}return!1}function Xk(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Qk(t,e){let n=e.keyCode,r=Xk(e);if(n==8||vt&&n==72&&r=="c")return of(t,-1)||Hr(t,-1);if(n==46&&!e.shiftKey||vt&&n==68&&r=="c")return of(t,1)||Hr(t,1);if(n==13||n==27)return!0;if(n==37||vt&&n==66&&r=="c"){let i=n==37?rf(t,t.state.selection.from)=="ltr"?-1:1:-1;return tf(t,i,r)||Hr(t,i)}else if(n==39||vt&&n==70&&r=="c"){let i=n==39?rf(t,t.state.selection.from)=="ltr"?1:-1:1;return tf(t,i,r)||Hr(t,i)}else{if(n==38||vt&&n==80&&r=="c")return sf(t,-1,r)||Hr(t,-1);if(n==40||vt&&n==78&&r=="c")return Zk(t)||sf(t,1,r)||Hr(t,1);if(r==(vt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function lf(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let o=t.someProp("clipboardSerializer")||Ut.fromSchema(t.state.schema),a=gf(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let c=l.firstChild,u,f=0;for(;c&&c.nodeType==1&&(u=pf[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let m=a.createElement(u[p]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),f++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${f?` -${f}`:""} ${JSON.stringify(n)}`);let h=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,`
|
|
11
11
|
|
|
12
12
|
`);return{dom:l,text:h,slice:e}}function cf(t,e,n,r,i){let s=i.parent.type.spec.code,o,a;if(!n&&!e)return null;let l=e&&(r||s||!n);if(l){if(t.someProp("transformPastedText",h=>{e=h(e,s||r,t)}),s)return e?new $(A.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
13
|
-
`))),0,0):$.empty;let f=t.someProp("clipboardTextParser",h=>h(e,i,r,t));if(f)a=f;else{let h=i.marks(),{schema:p}=t.state,m=Ut.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(y=>{let g=o.appendChild(document.createElement("p"));y&&g.appendChild(m.serializeNode(p.text(y,h)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),o=nw(n),Li&&rw(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||Vr.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||u),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!ew.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)a=iw(hf(a,+u[1],+u[2]),u[4]);else if(a=$.maxOpen(tw(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=hf(a,f,h)}return t.someProp("transformPasted",f=>{a=f(a,t)}),a}const ew=/^(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 tw(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&s.length&&uf(l,s,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=ff(o[o.length-1],s.length));let u=df(a,l);o.push(u),i=i.matchType(u.type),s=l}}),o)return A.from(o)}return t}function df(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,A.from(t));return t}function uf(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=uf(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(A.from(df(n,t,i+1))))}}function ff(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,ff(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(A.empty,!0);return t.copy(n.append(r))}function Ya(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,a=o.content;return t.childCount>1&&(s=0),i<r-1&&(a=Ya(a,e,n,r,i+1,s)),i>=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(A.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function hf(t,e,n){return e<t.openStart&&(t=new $(Ya(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new $(Ya(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const pf={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 mf=null;function gf(){return mf||(mf=document.implementation.createHTMLDocument("title"))}function nw(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=gf().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&pf[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=t,i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function rw(t){let e=t.querySelectorAll(Je?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function iw(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=A.from(l.create(r[a+1],i)),s++,o++}return new $(i,s,o)}const Ze={},Xe={},sw={touchstart:!0,touchmove:!0};class ow{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 aw(t){for(let e in Ze){let n=Ze[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{cw(t,r)&&!qa(t,r)&&(t.editable||!(r.type in Xe))&&n(t,r)},sw[e]?{passive:!0}:void 0)}Ge&&t.dom.addEventListener("input",()=>null),Ua(t)}function zn(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function lw(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 Ua(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>qa(t,r))})}function qa(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function cw(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 dw(t,e){!qa(t,e)&&Ze[e.type]&&(t.editable||!(e.type in Xe))&&Ze[e.type](t,e)}Xe.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!bf(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Rt&&Je&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),jr&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,lr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||Qk(t,n)?n.preventDefault():zn(t,"key")},Xe.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)},Xe.keypress=(t,e)=>{let n=e;if(bf(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||vt&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof ee)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode);!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,i))&&t.dispatch(t.state.tr.insertText(i).scrollIntoView()),n.preventDefault()}};function Qs(t){return{left:t.clientX,top:t.clientY}}function uw(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Ka(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,a=>o>s.depth?a(t,n,s.nodeAfter,s.before(o),i,!0):a(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function Yr(t,e,n){t.focused||t.focus();let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function fw(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&K.isSelectable(r)?(Yr(t,new K(n)),!0):!1}function hw(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof K&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(K.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(Yr(t,K.create(t.state.doc,i)),!0):!1}function pw(t,e,n,r,i){return Ka(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?hw(t,n):fw(t,n))}function mw(t,e,n,r){return Ka(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function gw(t,e,n,r){return Ka(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||yw(t,n,r)}function yw(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Yr(t,ee.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)Yr(t,ee.create(r,a+1,a+1+o.content.size));else if(K.isSelectable(o))Yr(t,K.create(r,a));else continue;return!0}}function Ja(t){return eo(t)}const yf=vt?"metaKey":"ctrlKey";Ze.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Ja(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&uw(n,t.input.lastClick)&&!n[yf]&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s};let o=t.posAtCoords(Qs(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new bw(t,o,n,!!r)):(s=="doubleClick"?mw:gw)(t,o.pos,o.inside,n)?n.preventDefault():zn(t,"pointer"))};class bw{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[yf],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let u=e.state.doc.resolve(n.pos);s=u.parent,o=u.depth?u.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.dom.nodeType==1?l.dom:null;let{selection:c}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof K&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&It&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),zn(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>pn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Qs(e))),this.updateAllowDefault(e),this.allowDefault||!n?zn(this.view,"pointer"):pw(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ge&&this.mightDrag&&!this.mightDrag.node.isAtom||Je&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Yr(this.view,se.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):zn(this.view,"pointer")}move(e){this.updateAllowDefault(e),zn(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Ze.touchstart=t=>{t.input.lastTouch=Date.now(),Ja(t),zn(t,"pointer")},Ze.touchmove=t=>{t.input.lastTouch=Date.now(),zn(t,"pointer")},Ze.contextmenu=t=>Ja(t);function bf(t,e){return t.composing?!0:Ge&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const kw=Rt?5e3:-1;Xe.compositionstart=Xe.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),eo(t,!0),t.markCursor=null;else if(eo(t),It&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){t.domSelection().collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}kf(t,kw)},Xe.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,kf(t,20))};function kf(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>eo(t),e))}function wf(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=vw());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function ww(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=fk(e.focusNode,e.focusOffset),r=hk(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function vw(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function eo(t,e=!1){if(!(Rt&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),wf(t),e||t.docView&&t.docView.dirty){let n=Fa(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):t.updateState(t.state),!0}return!1}}function xw(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 Hi=st&&Rn<15||jr&&kk<604;Ze.copy=Xe.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=Hi?null:n.clipboardData,o=r.content(),{dom:a,text:l}=lf(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):xw(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Sw(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Mw(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?Yi(t,r.value,null,i,e):Yi(t,r.textContent,r.innerHTML,i,e)},50)}function Yi(t,e,n,r,i){let s=cf(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,s||$.empty)))return!0;if(!s)return!1;let o=Sw(s),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function vf(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Xe.paste=(t,e)=>{let n=e;if(t.composing&&!Rt)return;let r=Hi?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Yi(t,vf(r),r.getData("text/html"),i,n)?n.preventDefault():Mw(t,n)};class xf{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const Sf=vt?"altKey":"ctrlKey";Ze.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(Qs(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof K?i.to-1:i.to))){if(r&&r.mightDrag)o=K.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(o=K.create(t.state.doc,f.posBefore))}}let a=(o||t.state.selection).content(),{dom:l,text:c,slice:u}=lf(t,a);n.dataTransfer.clearData(),n.dataTransfer.setData(Hi?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Hi||n.dataTransfer.setData("text/plain",c),t.dragging=new xf(u,!n[Sf],o)},Ze.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)},Xe.dragover=Xe.dragenter=(t,e)=>e.preventDefault(),Xe.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let i=t.posAtCoords(Qs(n));if(!i)return;let s=t.state.doc.resolve(i.pos),o=r&&r.slice;o?t.someProp("transformPasted",m=>{o=m(o,t)}):o=cf(t,vf(n.dataTransfer),Hi?null:n.dataTransfer.getData("text/html"),!1,s);let a=!!(r&&!n[Sf]);if(t.someProp("handleDrop",m=>m(t,n,o||$.empty,a))){n.preventDefault();return}if(!o)return;n.preventDefault();let l=o?fu(t.state.doc,s.pos,o):s.pos;l==null&&(l=s.pos);let c=t.state.tr;if(a){let{node:m}=r;m?m.replace(c):c.deleteSelection()}let u=c.mapping.map(l),f=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,h=c.doc;if(f?c.replaceRangeWith(u,u,o.content.firstChild):c.replaceRange(u,u,o),c.doc.eq(h))return;let p=c.doc.resolve(u);if(f&&K.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new K(p));else{let m=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((y,g,k,x)=>m=x),c.setSelection(ja(t,p,c.doc.resolve(m)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))},Ze.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&pn(t)},20))},Ze.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},Ze.beforeinput=(t,e)=>{if(Je&&Rt&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,lr(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Xe)Ze[t]=Xe[t];function Ui(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 to{constructor(e,n){this.toDOM=e,this.spec=n||fr,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new ht(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof to&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ui(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class jn{constructor(e,n){this.attrs=e,this.spec=n||fr}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new ht(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof jn&&Ui(this.attrs,e.attrs)&&Ui(this.spec,e.spec)}static is(e){return e.type instanceof jn}destroy(){}}class Ga{constructor(e,n){this.attrs=e,this.spec=n||fr}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new ht(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof Ga&&Ui(this.attrs,e.attrs)&&Ui(this.spec,e.spec)}destroy(){}}class ht{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new ht(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new ht(e,e,new to(n,r))}static inline(e,n,r,i){return new ht(e,n,new jn(r,i))}static node(e,n,r,i){return new ht(e,n,new Ga(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof jn}get widget(){return this.type instanceof to}}const Ur=[],fr={};class Ee{constructor(e,n){this.local=e.length?e:Ur,this.children=n.length?n:Ur}static create(e,n){return n.length?no(n,e,0,fr):He}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=n&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,i+a,s)}}map(e,n,r){return this==He||e.maps.length==0?this:this.mapInner(e,n,0,0,r||fr)}mapInner(e,n,r,i,s){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(n,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?Ow(this.children,o||[],e,n,r,i,s):o?new Ee(o.sort(hr),Ur):He}add(e,n){return n.length?this==He?Ee.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((a,l)=>{let c=l+r,u;if(u=Of(n,a,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<l;)s+=3;i[s]==l?i[s+2]=i[s+2].addInner(a,u,c+1):i.splice(s,0,l,l+a.nodeSize,no(u,a,c+1,fr)),s+=3}});let o=Mf(s?Cf(n):n,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new Ee(o.length?this.local.concat(o).sort(hr):this.local,i||this.children)}remove(e){return e.length==0||this==He?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,a=r[s]+n,l=r[s+1]+n;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>a&&f.to<l&&(e[u]=null,(o||(o=[])).push(f));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(o,a+1);c!=He?r[s+2]=c:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Ee(i,r):He}forChild(e,n){if(this==He)return this;if(n.isLeaf)return Ee.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,o=s+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>s&&l.type instanceof jn){let c=Math.max(s,l.from)-s,u=Math.min(o,l.to)-s;c<u&&(i||(i=[])).push(l.copy(c,u))}}if(i){let a=new Ee(i.sort(hr),Ur);return r?new Wn([a,r]):a}return r||He}eq(e){if(this==e)return!0;if(!(e instanceof Ee)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Za(this.localsInner(e))}localsInner(e){if(this==He)return Ur;if(e.inlineContent||!this.local.some(jn.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof jn||n.push(this.local[r]);return n}}Ee.empty=new Ee([],[]),Ee.removeOverlap=Za;const He=Ee.empty;class Wn{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,fr));return Wn.from(r)}forChild(e,n){if(n.isLeaf)return Ee.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=He&&(s instanceof Wn?r=r.concat(s.members):r.push(s))}return Wn.from(r)}eq(e){if(!(e instanceof Wn)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?Za(r?n:n.sort(hr)):Ur}static from(e){switch(e.length){case 0:return He;case 1:return e[0];default:return new Wn(e.every(n=>n instanceof Ee)?e:e.reduce((n,r)=>n.concat(r instanceof Ee?r:r.members),[]))}}}function Ow(t,e,n,r,i,s,o){let a=t.slice();for(let c=0,u=s;c<n.maps.length;c++){let f=0;n.maps[c].forEach((h,p,m,y)=>{let g=y-m-(p-h);for(let k=0;k<a.length;k+=3){let x=a[k+1];if(x<0||h>x+u-f)continue;let C=a[k]+u-f;p>=C?a[k+1]=h<=C?-2:-1:h>=u&&g&&(a[k]+=g,a[k+1]+=g)}f+=g}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=n.map(t[c]+s),f=u-i;if(f<0||f>=r.content.size){l=!0;continue}let h=n.map(t[c+1]+s,-1),p=h-i,{index:m,offset:y}=r.content.findIndex(f),g=r.maybeChild(m);if(g&&y==f&&y+g.nodeSize==p){let k=a[c+2].mapInner(n,g,u+1,t[c]+s+1,o);k!=He?(a[c]=f,a[c+1]=p,a[c+2]=k):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=Cw(a,t,e,n,i,s,o),u=no(c,r,0,o);e=u.local;for(let f=0;f<a.length;f+=3)a[f+1]<0&&(a.splice(f,3),f-=3);for(let f=0,h=0;f<u.children.length;f+=3){let p=u.children[f];for(;h<a.length&&a[h]<p;)h+=3;a.splice(h,0,u.children[f],u.children[f+1],u.children[f+2])}}return new Ee(e.sort(hr),a)}function Mf(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new ht(i.from+e,i.to+e,i.type))}return n}function Cw(t,e,n,r,i,s,o){function a(l,c){for(let u=0;u<l.local.length;u++){let f=l.local[u].map(r,i,c);f?n.push(f):o.onRemove&&o.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+s+1);return n}function Of(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function Cf(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function no(t,e,n,r){let i=[],s=!1;e.forEach((a,l)=>{let c=Of(t,a,l+n);if(c){s=!0;let u=no(c,a,n+l+1,r);u!=He&&i.push(l,l+a.nodeSize,u)}});let o=Mf(s?Cf(t):t,-n).sort(hr);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new Ee(o,i):He}function hr(t,e){return t.from-e.from||t.to-e.to}function Za(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),Tf(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),Tf(e,i,r.copy(s.from,r.to)));break}}}return e}function Tf(t,e,n){for(;e<t.length&&hr(n,t[e])>0;)e++;t.splice(e,0,n)}function Xa(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=He&&e.push(r)}),t.cursorWrapper&&e.push(Ee.create(t.state.doc,[t.cursorWrapper.deco])),Wn.from(e)}const Tw={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Ew=st&&Rn<=11;class Dw{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 Nw{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Dw,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);st&&Rn<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Ew&&(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,Tw)),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(Qu(this.view)){if(this.suppressingSelectionUpdates)return pn(this.view);if(st&&Rn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ar(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let s=e.focusNode;s;s=Ri(s))n.add(s);for(let s=e.anchorNode;s;s=Ri(s))if(n.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Qu(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let u=0;u<n.length;u++){let f=this.registerMutation(n[u],l);f&&(s=s<0?f.from:Math.min(f.from,s),o=o<0?f.to:Math.max(f.to,o),f.typeOver&&(a=!0))}if(It&&l.length){let u=l.filter(f=>f.nodeName=="BR");if(u.length==2){let[f,h]=u;f.parentNode&&f.parentNode.parentNode==h.parentNode?h.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let h of u){let p=h.parentNode;p&&p.nodeName=="LI"&&(!f||Vw(e,f)!=p)&&h.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Gs(r)&&(c=Fa(e))&&c.eq(se.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,pn(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),_w(e)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||pn(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let f=e.addedNodes[u];n.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(st&&Rn<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:f,nextSibling:h}=e.addedNodes[u];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(s=h)}let o=i&&i.parentNode==e.target?ze(i)+1:0,a=r.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?ze(s):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Ef=new WeakMap,Df=!1;function _w(t){if(!Ef.has(t)&&(Ef.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=It,Df)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."),Df=!0}}function Nf(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return ar(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function Aw(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Nf(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?Nf(t,n):null}function Vw(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 Bw(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:o,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),c,u=l.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],Gs(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Je&&t.input.lastKeyCode===8)for(let g=s;g>i;g--){let k=r.childNodes[g-1],x=k.pmViewDesc;if(k.nodeName=="BR"&&!x){s=g;break}if(!x||x.size)break}let f=t.state.doc,h=t.someProp("domParser")||Vr.fromSchema(t.state.schema),p=f.resolve(o),m=null,y=h.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:s,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Pw,context:p});if(c&&c[0].pos!=null){let g=c[0].pos,k=c[1]&&c[1].pos;k==null&&(k=g),m={anchor:g+o,head:k+o}}return{doc:y,sel:m,from:o,to:a}}function Pw(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Ge&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Ge&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Iw=/^(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 Rw(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let P=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,z=Fa(t,P);if(z&&!t.state.selection.eq(z)){if(Je&&Rt&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",D=>D(t,lr(13,"Enter"))))return;let te=t.state.tr.setSelection(z);P=="pointer"?te.setMeta("pointer",!0):P=="key"&&te.scrollIntoView(),s&&te.setMeta("composition",s),t.dispatch(te)}return}let o=t.state.doc.resolve(e),a=o.sharedDepth(n);e=o.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,c=Bw(t,e,n),u=t.state.doc,f=u.slice(c.from,c.to),h,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(h=t.state.selection.to,p="end"):(h=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let m=Fw(f.content,c.doc.content,c.from,h,p);if((jr&&t.input.lastIOSEnter>Date.now()-225||Rt)&&i.some(P=>P.nodeType==1&&!Iw.test(P.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",P=>P(t,lr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof ee&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let P=_f(t,t.state.doc,c.sel);if(P&&!P.eq(t.state.selection)){let z=t.state.tr.setSelection(P);s&&z.setMeta("composition",s),t.dispatch(z)}}return}t.input.domChangeCount++,t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof ee&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),st&&Rn<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>c.from&&c.doc.textBetween(m.start-c.from-1,m.start-c.from+1)==" "&&(m.start--,m.endA--,m.endB--);let y=c.doc.resolveNoCache(m.start-c.from),g=c.doc.resolveNoCache(m.endB-c.from),k=u.resolve(m.start),x=y.sameParent(g)&&y.parent.inlineContent&&k.end()>=m.endA,C;if((jr&&t.input.lastIOSEnter>Date.now()-225&&(!x||i.some(P=>P.nodeName=="DIV"||P.nodeName=="P"))||!x&&y.pos<c.doc.content.size&&!y.sameParent(g)&&(C=se.findFrom(c.doc.resolve(y.pos+1),1,!0))&&C.head==g.pos)&&t.someProp("handleKeyDown",P=>P(t,lr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&Lw(u,m.start,m.endA,y,g)&&t.someProp("handleKeyDown",P=>P(t,lr(8,"Backspace")))){Rt&&Je&&t.domObserver.suppressSelectionUpdates();return}Je&&Rt&&m.endB==m.start&&(t.input.lastAndroidDelete=Date.now()),Rt&&!x&&y.start()!=g.start()&&g.parentOffset==0&&y.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,g=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(P){return P(t,lr(13,"Enter"))})},20));let b=m.start,E=m.endA,w,_,R;if(x){if(y.pos==g.pos)st&&Rn<=11&&y.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>pn(t),20)),w=t.state.tr.delete(b,E),_=u.resolve(m.start).marksAcross(u.resolve(m.endA));else if(m.endA==m.endB&&(R=$w(y.parent.content.cut(y.parentOffset,g.parentOffset),k.parent.content.cut(k.parentOffset,m.endA-k.start()))))w=t.state.tr,R.type=="add"?w.addMark(b,E,R.mark):w.removeMark(b,E,R.mark);else if(y.parent.child(y.index()).isText&&y.index()==g.index()-(g.textOffset?0:1)){let P=y.parent.textBetween(y.parentOffset,g.parentOffset);if(t.someProp("handleTextInput",z=>z(t,b,E,P)))return;w=t.state.tr.insertText(P,b,E)}}if(w||(w=t.state.tr.replace(b,E,c.doc.slice(m.start-c.from,m.endB-c.from))),c.sel){let P=_f(t,w.doc,c.sel);P&&!(Je&&Rt&&t.composing&&P.empty&&(m.start!=m.endB||t.input.lastAndroidDelete<Date.now()-100)&&(P.head==b||P.head==w.mapping.map(E)-1)||st&&P.empty&&P.head==b)&&w.setSelection(P)}_&&w.ensureMarks(_),s&&w.setMeta("composition",s),t.dispatch(w.scrollIntoView())}function _f(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:ja(t,e.resolve(n.anchor),e.resolve(n.head))}function $w(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,a,l;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<n.length;u++)s=n[u].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",l=u=>u.mark(a.addToSet(u.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(A.from(c).eq(t))return{mark:a,type:o}}function Lw(t,e,n,r,i){if(n-e<=i.pos-r.pos||Qa(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&n==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(Qa(s,!0,!0));return!o.parent.isTextblock||o.pos>n||Qa(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Qa(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function Fw(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:o,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let l=Math.max(0,s-Math.min(o,a));r-=o+l-s}if(o<s&&t.size<e.size){let l=r<=s&&r>=o?s-r:0;s-=l,s&&s<e.size&&Af(e.textBetween(s-1,s+1))&&(s+=l?1:-1),a=s+(a-o),o=s}else if(a<s){let l=r<=s&&r>=a?s-r:0;s-=l,s&&s<t.size&&Af(t.textBetween(s-1,s+1))&&(s+=l?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}function Af(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 zw{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 ow,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Rf),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=Pf(this),Bf(this),this.nodeViews=If(this),this.docView=zu(this.state.doc,Vf(this),Xa(this),this.dom,this),this.domObserver=new Nw(this,(r,i,s,o)=>Rw(this,r,i,s,o)),this.domObserver.start(),aw(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&&Ua(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Rf),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(wf(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=If(this);Ww(p,this.nodeViews)&&(this.nodeViews=p,s=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Ua(this),this.editable=Pf(this),Bf(this);let l=Xa(this),c=Vf(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=s||!this.docView.matchesNode(e.doc,c,l);(f||!e.selection.eq(i.selection))&&(o=!0);let h=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&xk(this);if(o){this.domObserver.stop();let p=f&&(st||Je)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&jw(i.selection,e.selection);if(f){let m=Je?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=ww(this)),(s||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=zu(e.doc,c,l,this.dom,this)),m&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Uk(this))?pn(this,p):(Zu(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&&Sk(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof K){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Eu(this,n.getBoundingClientRect(),e)}else Eu(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new xf(e.slice,e.move,i<0?void 0:K.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=n?n(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=n?n(a):a))return i}}hasFocus(){if(st){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Mk(this.dom),pn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Dk(this,e)}coordsAtPos(e,n=1){return Bu(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 Bk(this,n||this.state,e)}pasteHTML(e,n){return Yi(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Yi(this,e,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(lw(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Xa(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,dk())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return dw(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return Ge&&this.root.nodeType===11&&mk(this.dom.ownerDocument)==this.dom&&Aw(this,e)||e}domSelection(){return this.root.getSelection()}}function Vf(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[ht.node(0,t.state.doc.content.size,e)]}function Bf(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:ht.widget(t.state.selection.head,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Pf(t){return!t.someProp("editable",e=>e(t.state)===!1)}function jw(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 If(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 Ww(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 Rf(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var Hn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ro={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Hw=typeof navigator<"u"&&/Mac/.test(navigator.platform),Yw=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),je=0;je<10;je++)Hn[48+je]=Hn[96+je]=String(je);for(var je=1;je<=24;je++)Hn[je+111]="F"+je;for(var je=65;je<=90;je++)Hn[je]=String.fromCharCode(je+32),ro[je]=String.fromCharCode(je);for(var el in Hn)ro.hasOwnProperty(el)||(ro[el]=Hn[el]);function Uw(t){var e=Hw&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Yw&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?ro:Hn)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const qw=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Kw(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))qw?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function Jw(t){let e=Object.create(null);for(let n in t)e[Kw(n)]=t[n];return e}function tl(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 Gw(t){return new Ke({props:{handleKeyDown:$f(t)}})}function $f(t){let e=Jw(t);return function(n,r){let i=Uw(r),s,o=e[tl(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[tl(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(s=Hn[r.keyCode])&&s!=i){let a=e[tl(s,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}const Zw=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Lf(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Xw=(t,e,n)=>{let r=Lf(t,n);if(!r)return!1;let i=nl(r);if(!i){let o=r.blockRange(),a=o&&Ir(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(!s.type.spec.isolating&&Wf(t,i,e))return!0;if(r.parent.content.size==0&&(qr(s,"end")||K.isSelectable(s))){let o=qs(t.doc,r.before(),r.after(),$.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(qr(s,"end")?se.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):K.create(a.doc,i.pos-s.nodeSize)),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},Qw=(t,e,n)=>{let r=Lf(t,n);if(!r)return!1;let i=nl(r);return i?Ff(t,i,e):!1},ev=(t,e,n)=>{let r=zf(t,n);if(!r)return!1;let i=rl(r);return i?Ff(t,i,e):!1};function Ff(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=qs(t.doc,s,l,$.empty);if(!c||c.from!=s||c instanceof Ve&&c.slice.size>=l-s)return!1;if(n){let u=t.tr.step(c);u.setSelection(ee.create(u.doc,s)),n(u.scrollIntoView())}return!0}function qr(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const tv=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=nl(r)}let o=s&&s.nodeBefore;return!o||!K.isSelectable(o)?!1:(e&&e(t.tr.setSelection(K.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function nl(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 zf(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const nv=(t,e,n)=>{let r=zf(t,n);if(!r)return!1;let i=rl(r);if(!i)return!1;let s=i.nodeAfter;if(Wf(t,i,e))return!0;if(r.parent.content.size==0&&(qr(s,"start")||K.isSelectable(s))){let o=qs(t.doc,r.before(),r.after(),$.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(qr(s,"start")?se.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):K.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},rv=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=rl(r)}let o=s&&s.nodeAfter;return!o||!K.isSelectable(o)?!1:(e&&e(t.tr.setSelection(K.create(t.doc,s.pos)).scrollIntoView()),!0)};function rl(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 iv=(t,e)=>{let n=t.selection,r=n instanceof K,i;if(r){if(n.node.isTextblock||!Pn(t.doc,n.from))return!1;i=n.from}else if(i=Us(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(K.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},sv=(t,e)=>{let n=t.selection,r;if(n instanceof K){if(n.node.isTextblock||!Pn(t.doc,n.to))return!1;r=n.to}else if(r=Us(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},ov=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&Ir(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},av=(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 jf(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 lv=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=jf(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,o.createAndFill());l.setSelection(se.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},cv=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Bt||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=jf(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=t.tr.insert(o,s.createAndFill());a.setSelection(ee.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},dv=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(Rr(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Ir(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)},uv=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(K.create(t.doc,i))),!0)};function fv(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Pn(t.doc,e.pos))?!1:(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function Wf(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s,o;if(r.type.spec.isolating||i.type.spec.isolating)return!1;if(fv(t,e,n))return!0;let a=e.parent.canReplace(e.index(),e.index()+1);if(a&&(s=(o=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&o.matchType(s[0]||i.type).validEnd){if(n){let f=e.pos+i.nodeSize,h=A.empty;for(let y=s.length-1;y>=0;y--)h=A.from(s[y].create(null,h));h=A.from(r.copy(h));let p=t.tr.step(new Be(e.pos-1,f,e.pos,f,new $(h,1,0),s.length,!0)),m=f+2*s.length;Pn(p.doc,m)&&p.join(m),n(p.scrollIntoView())}return!0}let l=se.findFrom(e,1),c=l&&l.$from.blockRange(l.$to),u=c&&Ir(c);if(u!=null&&u>=e.depth)return n&&n(t.tr.lift(c,u).scrollIntoView()),!0;if(a&&qr(i,"start",!0)&&qr(r,"end")){let f=r,h=[];for(;h.push(f),!f.isTextblock;)f=f.lastChild;let p=i,m=1;for(;!p.isTextblock;p=p.firstChild)m++;if(f.canReplace(f.childCount,f.childCount,p.content)){if(n){let y=A.empty;for(let k=h.length-1;k>=0;k--)y=A.from(h[k].copy(y));let g=t.tr.step(new Be(e.pos-h.length,e.pos+i.nodeSize,e.pos+m,e.pos+i.nodeSize-m,new $(y,h.length,0),0,!0));n(g.scrollIntoView())}return!0}}return!1}function Hf(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(ee.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const hv=Hf(-1),pv=Hf(1);function mv(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),a=o&&Ma(o,t,e);return a?(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0):!1}}function Yf(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=n.selection.ranges[s];n.doc.nodesBetween(o,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)i=!0;else{let u=n.doc.resolve(c),f=u.index();i=u.parent.canReplaceWith(f,f+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[o];s.setBlockType(a,l,t,e)}r(s.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function gv(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),a=!1,l=o;if(!o)return!1;if(o.depth>=2&&i.node(o.depth-1).type.compatibleContent(t)&&o.startIndex==0){if(i.index(o.depth-1)==0)return!1;let u=n.doc.resolve(o.start-2);l=new Ls(u,u,o.depth),o.endIndex<o.parent.childCount&&(o=new Ls(i,n.doc.resolve(s.end(o.depth)),o.depth)),a=!0}let c=Ma(l,t,e,o);return c?(r&&r(yv(n.tr,o,c,a,t).scrollIntoView()),!0):!1}}function yv(t,e,n,r,i){let s=A.empty;for(let u=n.length-1;u>=0;u--)s=A.from(n[u].type.create(n[u].attrs,s));t.step(new Be(e.start-(r?2:0),e.end,e.start,e.end,new $(s,0,0),n.length,!0));let o=0;for(let u=0;u<n.length;u++)n[u].type==i&&(o=u+1);let a=n.length-o,l=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,f=e.endIndex,h=!0;u<f;u++,h=!1)!h&&Rr(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function bv(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?kv(e,n,t,s):wv(e,n,s):!0:!1}}function kv(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new Be(s-1,o,s,o,new $(A.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Ls(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const a=Ir(r);if(a==null)return!1;i.lift(r,a);let l=i.mapping.map(s,-1)-1;return Pn(i.doc,l)&&i.join(l),e(i.scrollIntoView()),!0}function wv(t,e,n){let r=t.tr,i=n.parent;for(let p=n.end,m=n.endIndex-1,y=n.startIndex;m>y;m--)p-=i.child(m).nodeSize,r.delete(p-1,p+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==i.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(a?0:1),u+1,o.content.append(l?A.empty:A.from(i))))return!1;let f=s.pos,h=f+o.nodeSize;return r.step(new Be(f-(a?1:0),h+(l?1:0),f+1,h-1,new $((a?A.empty:A.from(i.copy(A.empty))).append(l?A.empty:A.from(i.copy(A.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function vv(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=t)return!1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,u=A.from(c?t.create():null),f=new $(A.from(t.create(null,A.from(a.type.create(null,u)))),c?3:1,0),h=s.start,p=s.end;n(e.tr.step(new Be(h-(c?3:1),p,h,p,f,1,!0)).scrollIntoView())}return!0}}function io(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,s=n.storedMarks,n}}}class so{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...u)=>{const f=l(...u)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a=[],l=!!e,c=e||s.tr,u=()=>(!l&&n&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(c),a.every(h=>h===!0)),f={...Object.fromEntries(Object.entries(r).map(([h,p])=>[h,(...y)=>{const g=this.buildProps(c,n),k=p(...y)(g);return a.push(k),f}])),run:u};return f}createCan(e){const{rawCommands:n,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(n).map(([l,c])=>[l,(...u)=>c(...u)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a={tr:e,editor:i,view:o,state:io({state:s,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([l,c])=>[l,(...u)=>c(...u)(a)]))}};return a}}class xv{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 Y(t,e,n){return t.config[e]===void 0&&t.parent?Y(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?Y(t.parent,e,n):null}):t.config[e]}function oo(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 Uf(t){const e=[],{nodeExtensions:n,markExtensions:r}=oo(t),i=[...n,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=Y(o,"addGlobalAttributes",a);if(!l)return;l().forEach(u=>{u.types.forEach(f=>{Object.entries(u.attributes).forEach(([h,p])=>{e.push({type:f,name:h,attribute:{...s,...p}})})})})}),i.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=Y(o,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([u,f])=>{const h={...s,...f};typeof(h==null?void 0:h.default)=="function"&&(h.default=h.default()),h!=null&&h.isRequired&&(h==null?void 0:h.default)===void 0&&delete h.default,e.push({type:o.name,name:u,attribute:h})})}),e}function Pe(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function Ne(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const a=s?s.split(" "):[],l=r[i]?r[i].split(" "):[],c=a.filter(u=>!l.includes(u));r[i]=[...l,...c].join(" ")}else i==="style"?r[i]=[r[i],s].join("; "):r[i]=s}),r},{})}function il(t,e){return e.filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Ne(n,r),{})}function qf(t){return typeof t=="function"}function oe(t,e=void 0,...n){return qf(t)?e?t.bind(e)(...n):t(...n):t}function Sv(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Mv(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Kf(t,e){return t.style?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(n):Mv(n.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...r,...i}}}}function Jf(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&Sv(n)?!1:n!=null))}function Ov(t,e){var n;const r=Uf(t),{nodeExtensions:i,markExtensions:s}=oo(t),o=(n=i.find(c=>Y(c,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(i.map(c=>{const u=r.filter(k=>k.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((k,x)=>{const C=Y(x,"extendNodeSchema",f);return{...k,...C?C(c):{}}},{}),p=Jf({...h,content:oe(Y(c,"content",f)),marks:oe(Y(c,"marks",f)),group:oe(Y(c,"group",f)),inline:oe(Y(c,"inline",f)),atom:oe(Y(c,"atom",f)),selectable:oe(Y(c,"selectable",f)),draggable:oe(Y(c,"draggable",f)),code:oe(Y(c,"code",f)),defining:oe(Y(c,"defining",f)),isolating:oe(Y(c,"isolating",f)),attrs:Object.fromEntries(u.map(k=>{var x;return[k.name,{default:(x=k==null?void 0:k.attribute)===null||x===void 0?void 0:x.default}]}))}),m=oe(Y(c,"parseHTML",f));m&&(p.parseDOM=m.map(k=>Kf(k,u)));const y=Y(c,"renderHTML",f);y&&(p.toDOM=k=>y({node:k,HTMLAttributes:il(k,u)}));const g=Y(c,"renderText",f);return g&&(p.toText=g),[c.name,p]})),l=Object.fromEntries(s.map(c=>{const u=r.filter(g=>g.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((g,k)=>{const x=Y(k,"extendMarkSchema",f);return{...g,...x?x(c):{}}},{}),p=Jf({...h,inclusive:oe(Y(c,"inclusive",f)),excludes:oe(Y(c,"excludes",f)),group:oe(Y(c,"group",f)),spanning:oe(Y(c,"spanning",f)),code:oe(Y(c,"code",f)),attrs:Object.fromEntries(u.map(g=>{var k;return[g.name,{default:(k=g==null?void 0:g.attribute)===null||k===void 0?void 0:k.default}]}))}),m=oe(Y(c,"parseHTML",f));m&&(p.parseDOM=m.map(g=>Kf(g,u)));const y=Y(c,"renderHTML",f);return y&&(p.toDOM=g=>y({mark:g,HTMLAttributes:il(g,u)})),[c.name,p]}));return new E1({topNode:o,nodes:a,marks:l})}function sl(t,e){return e.nodes[t]||e.marks[t]||null}function Gf(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}const Cv=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,a)=>{var l,c;const u=((c=(l=i.type.spec).toText)===null||c===void 0?void 0:c.call(l,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";n+=u.slice(0,Math.max(0,r-s))}),n};function ol(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class ao{constructor(e){this.find=e.find,this.handler=e.handler}}const Tv=(t,e)=>{if(ol(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 lo(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(h=>h.type.spec.code))return!1;let u=!1;const f=Cv(c)+s;return o.forEach(h=>{if(u)return;const p=Tv(f,h.find);if(!p)return;const m=l.state.tr,y=io({state:l.state,transaction:m}),g={from:r-(p[0].length-s.length),to:i},{commands:k,chain:x,can:C}=new so({editor:n,state:y});h.handler({state:y,range:g,match:p,commands:k,chain:x,can:C})===null||!m.steps.length||(m.setMeta(a,{transform:m,from:r,to:i,text:s}),l.dispatch(m),u=!0)}),u}function Ev(t){const{editor:e,rules:n}=t,r=new Ke({state:{init(){return null},apply(i,s){const o=i.getMeta(r);if(o)return o;const a=i.getMeta("applyInputRules");return!!a&&setTimeout(()=>{const{from:c,text:u}=a,f=c+u.length;lo({editor:e,from:c,to:f,text:u,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return lo({editor:e,from:s,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&lo({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?lo({editor:e,from:o.pos,to:o.pos,text:`
|
|
15
|
-
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function Dv(t){return typeof t=="number"}class Nv{constructor(e){this.find=e.find,this.handler=e.handler}}const _v=(t,e,n)=>{if(ol(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=t,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function Av(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:a}=t,{commands:l,chain:c,can:u}=new so({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,"");_v(k,s.find,o).forEach(C=>{if(C.index===void 0)return;const b=y+C.index+1,E=b+C[0].length,w={from:n.tr.mapping.map(b),to:n.tr.mapping.map(E)},_=s.handler({state:n,range:w,match:C,commands:l,chain:c,can:u,pasteEvent:o,dropEvent:a});f.push(_)})}),f.every(p=>p!==null)}const Vv=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 Bv(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a=typeof DragEvent<"u"?new DragEvent("drop"):null;const l=({state:u,from:f,to:h,rule:p,pasteEvt:m})=>{const y=u.tr,g=io({state:u,transaction:y});if(!(!Av({editor:e,state:g,from:Math.max(f-1,0),to:h.b-1,rule:p,pasteEvent:m,dropEvent:a})||!y.steps.length))return a=typeof DragEvent<"u"?new DragEvent("drop"):null,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,y};return n.map(u=>new Ke({view(f){const h=p=>{var m;r=!((m=f.dom.parentElement)===null||m===void 0)&&m.contains(p.target)?f.dom.parentElement:null};return window.addEventListener("dragstart",h),{destroy(){window.removeEventListener("dragstart",h)}}},props:{handleDOMEvents:{drop:(f,h)=>(s=r===f.dom.parentElement,a=h,!1),paste:(f,h)=>{var p;const m=(p=h.clipboardData)===null||p===void 0?void 0:p.getData("text/html");return o=h,i=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(f,h,p)=>{const m=f[0],y=m.getMeta("uiEvent")==="paste"&&!i,g=m.getMeta("uiEvent")==="drop"&&!s,k=m.getMeta("applyPasteRules"),
|
|
13
|
+
`))),0,0):$.empty;let f=t.someProp("clipboardTextParser",h=>h(e,i,r,t));if(f)a=f;else{let h=i.marks(),{schema:p}=t.state,m=Ut.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(y=>{let g=o.appendChild(document.createElement("p"));y&&g.appendChild(m.serializeNode(p.text(y,h)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),o=nw(n),Li&&rw(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||Vr.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||u),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!ew.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)a=iw(hf(a,+u[1],+u[2]),u[4]);else if(a=$.maxOpen(tw(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=hf(a,f,h)}return t.someProp("transformPasted",f=>{a=f(a,t)}),a}const ew=/^(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 tw(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&s.length&&uf(l,s,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=ff(o[o.length-1],s.length));let u=df(a,l);o.push(u),i=i.matchType(u.type),s=l}}),o)return A.from(o)}return t}function df(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,A.from(t));return t}function uf(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=uf(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(A.from(df(n,t,i+1))))}}function ff(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,ff(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(A.empty,!0);return t.copy(n.append(r))}function Ya(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,a=o.content;return t.childCount>1&&(s=0),i<r-1&&(a=Ya(a,e,n,r,i+1,s)),i>=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(A.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function hf(t,e,n){return e<t.openStart&&(t=new $(Ya(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new $(Ya(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const pf={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 mf=null;function gf(){return mf||(mf=document.implementation.createHTMLDocument("title"))}function nw(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=gf().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&pf[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=t,i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function rw(t){let e=t.querySelectorAll(Je?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function iw(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=A.from(l.create(r[a+1],i)),s++,o++}return new $(i,s,o)}const Ze={},Xe={},sw={touchstart:!0,touchmove:!0};class ow{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 aw(t){for(let e in Ze){let n=Ze[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{cw(t,r)&&!qa(t,r)&&(t.editable||!(r.type in Xe))&&n(t,r)},sw[e]?{passive:!0}:void 0)}Ge&&t.dom.addEventListener("input",()=>null),Ua(t)}function zn(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function lw(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 Ua(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>qa(t,r))})}function qa(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function cw(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 dw(t,e){!qa(t,e)&&Ze[e.type]&&(t.editable||!(e.type in Xe))&&Ze[e.type](t,e)}Xe.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!bf(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Rt&&Je&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),jr&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,lr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||Qk(t,n)?n.preventDefault():zn(t,"key")},Xe.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)},Xe.keypress=(t,e)=>{let n=e;if(bf(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||vt&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof ee)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode);!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,i))&&t.dispatch(t.state.tr.insertText(i).scrollIntoView()),n.preventDefault()}};function Qs(t){return{left:t.clientX,top:t.clientY}}function uw(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Ka(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,a=>o>s.depth?a(t,n,s.nodeAfter,s.before(o),i,!0):a(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function Yr(t,e,n){t.focused||t.focus();let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function fw(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&K.isSelectable(r)?(Yr(t,new K(n)),!0):!1}function hw(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof K&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(K.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(Yr(t,K.create(t.state.doc,i)),!0):!1}function pw(t,e,n,r,i){return Ka(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?hw(t,n):fw(t,n))}function mw(t,e,n,r){return Ka(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function gw(t,e,n,r){return Ka(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||yw(t,n,r)}function yw(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Yr(t,ee.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)Yr(t,ee.create(r,a+1,a+1+o.content.size));else if(K.isSelectable(o))Yr(t,K.create(r,a));else continue;return!0}}function Ja(t){return eo(t)}const yf=vt?"metaKey":"ctrlKey";Ze.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Ja(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&uw(n,t.input.lastClick)&&!n[yf]&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s};let o=t.posAtCoords(Qs(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new bw(t,o,n,!!r)):(s=="doubleClick"?mw:gw)(t,o.pos,o.inside,n)?n.preventDefault():zn(t,"pointer"))};class bw{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[yf],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let u=e.state.doc.resolve(n.pos);s=u.parent,o=u.depth?u.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.dom.nodeType==1?l.dom:null;let{selection:c}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof K&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&It&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),zn(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>pn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Qs(e))),this.updateAllowDefault(e),this.allowDefault||!n?zn(this.view,"pointer"):pw(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ge&&this.mightDrag&&!this.mightDrag.node.isAtom||Je&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Yr(this.view,se.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):zn(this.view,"pointer")}move(e){this.updateAllowDefault(e),zn(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Ze.touchstart=t=>{t.input.lastTouch=Date.now(),Ja(t),zn(t,"pointer")},Ze.touchmove=t=>{t.input.lastTouch=Date.now(),zn(t,"pointer")},Ze.contextmenu=t=>Ja(t);function bf(t,e){return t.composing?!0:Ge&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const kw=Rt?5e3:-1;Xe.compositionstart=Xe.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),eo(t,!0),t.markCursor=null;else if(eo(t),It&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){t.domSelection().collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}kf(t,kw)},Xe.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,kf(t,20))};function kf(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>eo(t),e))}function wf(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=vw());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function ww(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=fk(e.focusNode,e.focusOffset),r=hk(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function vw(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function eo(t,e=!1){if(!(Rt&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),wf(t),e||t.docView&&t.docView.dirty){let n=Fa(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):t.updateState(t.state),!0}return!1}}function xw(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 Hi=st&&Rn<15||jr&&kk<604;Ze.copy=Xe.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=Hi?null:n.clipboardData,o=r.content(),{dom:a,text:l}=lf(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):xw(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Sw(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Mw(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?Yi(t,r.value,null,i,e):Yi(t,r.textContent,r.innerHTML,i,e)},50)}function Yi(t,e,n,r,i){let s=cf(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,s||$.empty)))return!0;if(!s)return!1;let o=Sw(s),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function vf(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Xe.paste=(t,e)=>{let n=e;if(t.composing&&!Rt)return;let r=Hi?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Yi(t,vf(r),r.getData("text/html"),i,n)?n.preventDefault():Mw(t,n)};class xf{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const Sf=vt?"altKey":"ctrlKey";Ze.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(Qs(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof K?i.to-1:i.to))){if(r&&r.mightDrag)o=K.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(o=K.create(t.state.doc,f.posBefore))}}let a=(o||t.state.selection).content(),{dom:l,text:c,slice:u}=lf(t,a);n.dataTransfer.clearData(),n.dataTransfer.setData(Hi?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Hi||n.dataTransfer.setData("text/plain",c),t.dragging=new xf(u,!n[Sf],o)},Ze.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)},Xe.dragover=Xe.dragenter=(t,e)=>e.preventDefault(),Xe.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let i=t.posAtCoords(Qs(n));if(!i)return;let s=t.state.doc.resolve(i.pos),o=r&&r.slice;o?t.someProp("transformPasted",m=>{o=m(o,t)}):o=cf(t,vf(n.dataTransfer),Hi?null:n.dataTransfer.getData("text/html"),!1,s);let a=!!(r&&!n[Sf]);if(t.someProp("handleDrop",m=>m(t,n,o||$.empty,a))){n.preventDefault();return}if(!o)return;n.preventDefault();let l=o?fu(t.state.doc,s.pos,o):s.pos;l==null&&(l=s.pos);let c=t.state.tr;if(a){let{node:m}=r;m?m.replace(c):c.deleteSelection()}let u=c.mapping.map(l),f=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,h=c.doc;if(f?c.replaceRangeWith(u,u,o.content.firstChild):c.replaceRange(u,u,o),c.doc.eq(h))return;let p=c.doc.resolve(u);if(f&&K.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new K(p));else{let m=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((y,g,k,v)=>m=v),c.setSelection(ja(t,p,c.doc.resolve(m)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))},Ze.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&pn(t)},20))},Ze.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},Ze.beforeinput=(t,e)=>{if(Je&&Rt&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,lr(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Xe)Ze[t]=Xe[t];function Ui(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 to{constructor(e,n){this.toDOM=e,this.spec=n||fr,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new ht(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof to&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ui(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class jn{constructor(e,n){this.attrs=e,this.spec=n||fr}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new ht(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof jn&&Ui(this.attrs,e.attrs)&&Ui(this.spec,e.spec)}static is(e){return e.type instanceof jn}destroy(){}}class Ga{constructor(e,n){this.attrs=e,this.spec=n||fr}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new ht(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof Ga&&Ui(this.attrs,e.attrs)&&Ui(this.spec,e.spec)}destroy(){}}class ht{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new ht(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new ht(e,e,new to(n,r))}static inline(e,n,r,i){return new ht(e,n,new jn(r,i))}static node(e,n,r,i){return new ht(e,n,new Ga(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof jn}get widget(){return this.type instanceof to}}const Ur=[],fr={};class Ee{constructor(e,n){this.local=e.length?e:Ur,this.children=n.length?n:Ur}static create(e,n){return n.length?no(n,e,0,fr):He}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=n&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,i+a,s)}}map(e,n,r){return this==He||e.maps.length==0?this:this.mapInner(e,n,0,0,r||fr)}mapInner(e,n,r,i,s){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(n,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?Ow(this.children,o||[],e,n,r,i,s):o?new Ee(o.sort(hr),Ur):He}add(e,n){return n.length?this==He?Ee.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((a,l)=>{let c=l+r,u;if(u=Of(n,a,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<l;)s+=3;i[s]==l?i[s+2]=i[s+2].addInner(a,u,c+1):i.splice(s,0,l,l+a.nodeSize,no(u,a,c+1,fr)),s+=3}});let o=Mf(s?Cf(n):n,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new Ee(o.length?this.local.concat(o).sort(hr):this.local,i||this.children)}remove(e){return e.length==0||this==He?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,a=r[s]+n,l=r[s+1]+n;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>a&&f.to<l&&(e[u]=null,(o||(o=[])).push(f));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(o,a+1);c!=He?r[s+2]=c:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Ee(i,r):He}forChild(e,n){if(this==He)return this;if(n.isLeaf)return Ee.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,o=s+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>s&&l.type instanceof jn){let c=Math.max(s,l.from)-s,u=Math.min(o,l.to)-s;c<u&&(i||(i=[])).push(l.copy(c,u))}}if(i){let a=new Ee(i.sort(hr),Ur);return r?new Wn([a,r]):a}return r||He}eq(e){if(this==e)return!0;if(!(e instanceof Ee)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Za(this.localsInner(e))}localsInner(e){if(this==He)return Ur;if(e.inlineContent||!this.local.some(jn.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof jn||n.push(this.local[r]);return n}}Ee.empty=new Ee([],[]),Ee.removeOverlap=Za;const He=Ee.empty;class Wn{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,fr));return Wn.from(r)}forChild(e,n){if(n.isLeaf)return Ee.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=He&&(s instanceof Wn?r=r.concat(s.members):r.push(s))}return Wn.from(r)}eq(e){if(!(e instanceof Wn)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?Za(r?n:n.sort(hr)):Ur}static from(e){switch(e.length){case 0:return He;case 1:return e[0];default:return new Wn(e.every(n=>n instanceof Ee)?e:e.reduce((n,r)=>n.concat(r instanceof Ee?r:r.members),[]))}}}function Ow(t,e,n,r,i,s,o){let a=t.slice();for(let c=0,u=s;c<n.maps.length;c++){let f=0;n.maps[c].forEach((h,p,m,y)=>{let g=y-m-(p-h);for(let k=0;k<a.length;k+=3){let v=a[k+1];if(v<0||h>v+u-f)continue;let C=a[k]+u-f;p>=C?a[k+1]=h<=C?-2:-1:h>=u&&g&&(a[k]+=g,a[k+1]+=g)}f+=g}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=n.map(t[c]+s),f=u-i;if(f<0||f>=r.content.size){l=!0;continue}let h=n.map(t[c+1]+s,-1),p=h-i,{index:m,offset:y}=r.content.findIndex(f),g=r.maybeChild(m);if(g&&y==f&&y+g.nodeSize==p){let k=a[c+2].mapInner(n,g,u+1,t[c]+s+1,o);k!=He?(a[c]=f,a[c+1]=p,a[c+2]=k):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=Cw(a,t,e,n,i,s,o),u=no(c,r,0,o);e=u.local;for(let f=0;f<a.length;f+=3)a[f+1]<0&&(a.splice(f,3),f-=3);for(let f=0,h=0;f<u.children.length;f+=3){let p=u.children[f];for(;h<a.length&&a[h]<p;)h+=3;a.splice(h,0,u.children[f],u.children[f+1],u.children[f+2])}}return new Ee(e.sort(hr),a)}function Mf(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new ht(i.from+e,i.to+e,i.type))}return n}function Cw(t,e,n,r,i,s,o){function a(l,c){for(let u=0;u<l.local.length;u++){let f=l.local[u].map(r,i,c);f?n.push(f):o.onRemove&&o.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+s+1);return n}function Of(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function Cf(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function no(t,e,n,r){let i=[],s=!1;e.forEach((a,l)=>{let c=Of(t,a,l+n);if(c){s=!0;let u=no(c,a,n+l+1,r);u!=He&&i.push(l,l+a.nodeSize,u)}});let o=Mf(s?Cf(t):t,-n).sort(hr);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new Ee(o,i):He}function hr(t,e){return t.from-e.from||t.to-e.to}function Za(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),Tf(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),Tf(e,i,r.copy(s.from,r.to)));break}}}return e}function Tf(t,e,n){for(;e<t.length&&hr(n,t[e])>0;)e++;t.splice(e,0,n)}function Xa(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=He&&e.push(r)}),t.cursorWrapper&&e.push(Ee.create(t.state.doc,[t.cursorWrapper.deco])),Wn.from(e)}const Tw={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Ew=st&&Rn<=11;class Dw{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 Nw{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Dw,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);st&&Rn<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Ew&&(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,Tw)),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(Qu(this.view)){if(this.suppressingSelectionUpdates)return pn(this.view);if(st&&Rn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ar(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let s=e.focusNode;s;s=Ri(s))n.add(s);for(let s=e.anchorNode;s;s=Ri(s))if(n.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Qu(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let u=0;u<n.length;u++){let f=this.registerMutation(n[u],l);f&&(s=s<0?f.from:Math.min(f.from,s),o=o<0?f.to:Math.max(f.to,o),f.typeOver&&(a=!0))}if(It&&l.length){let u=l.filter(f=>f.nodeName=="BR");if(u.length==2){let[f,h]=u;f.parentNode&&f.parentNode.parentNode==h.parentNode?h.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let h of u){let p=h.parentNode;p&&p.nodeName=="LI"&&(!f||Vw(e,f)!=p)&&h.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Gs(r)&&(c=Fa(e))&&c.eq(se.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,pn(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),_w(e)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||pn(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let f=e.addedNodes[u];n.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(st&&Rn<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:f,nextSibling:h}=e.addedNodes[u];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(s=h)}let o=i&&i.parentNode==e.target?ze(i)+1:0,a=r.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?ze(s):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Ef=new WeakMap,Df=!1;function _w(t){if(!Ef.has(t)&&(Ef.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=It,Df)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."),Df=!0}}function Nf(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return ar(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function Aw(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Nf(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?Nf(t,n):null}function Vw(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 Bw(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:o,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),c,u=l.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],Gs(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Je&&t.input.lastKeyCode===8)for(let g=s;g>i;g--){let k=r.childNodes[g-1],v=k.pmViewDesc;if(k.nodeName=="BR"&&!v){s=g;break}if(!v||v.size)break}let f=t.state.doc,h=t.someProp("domParser")||Vr.fromSchema(t.state.schema),p=f.resolve(o),m=null,y=h.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:s,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Pw,context:p});if(c&&c[0].pos!=null){let g=c[0].pos,k=c[1]&&c[1].pos;k==null&&(k=g),m={anchor:g+o,head:k+o}}return{doc:y,sel:m,from:o,to:a}}function Pw(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Ge&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Ge&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Iw=/^(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 Rw(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let P=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,z=Fa(t,P);if(z&&!t.state.selection.eq(z)){if(Je&&Rt&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",D=>D(t,lr(13,"Enter"))))return;let te=t.state.tr.setSelection(z);P=="pointer"?te.setMeta("pointer",!0):P=="key"&&te.scrollIntoView(),s&&te.setMeta("composition",s),t.dispatch(te)}return}let o=t.state.doc.resolve(e),a=o.sharedDepth(n);e=o.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,c=Bw(t,e,n),u=t.state.doc,f=u.slice(c.from,c.to),h,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(h=t.state.selection.to,p="end"):(h=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let m=Fw(f.content,c.doc.content,c.from,h,p);if((jr&&t.input.lastIOSEnter>Date.now()-225||Rt)&&i.some(P=>P.nodeType==1&&!Iw.test(P.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",P=>P(t,lr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof ee&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let P=_f(t,t.state.doc,c.sel);if(P&&!P.eq(t.state.selection)){let z=t.state.tr.setSelection(P);s&&z.setMeta("composition",s),t.dispatch(z)}}return}t.input.domChangeCount++,t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof ee&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),st&&Rn<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>c.from&&c.doc.textBetween(m.start-c.from-1,m.start-c.from+1)==" "&&(m.start--,m.endA--,m.endB--);let y=c.doc.resolveNoCache(m.start-c.from),g=c.doc.resolveNoCache(m.endB-c.from),k=u.resolve(m.start),v=y.sameParent(g)&&y.parent.inlineContent&&k.end()>=m.endA,C;if((jr&&t.input.lastIOSEnter>Date.now()-225&&(!v||i.some(P=>P.nodeName=="DIV"||P.nodeName=="P"))||!v&&y.pos<c.doc.content.size&&!y.sameParent(g)&&(C=se.findFrom(c.doc.resolve(y.pos+1),1,!0))&&C.head==g.pos)&&t.someProp("handleKeyDown",P=>P(t,lr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&Lw(u,m.start,m.endA,y,g)&&t.someProp("handleKeyDown",P=>P(t,lr(8,"Backspace")))){Rt&&Je&&t.domObserver.suppressSelectionUpdates();return}Je&&Rt&&m.endB==m.start&&(t.input.lastAndroidDelete=Date.now()),Rt&&!v&&y.start()!=g.start()&&g.parentOffset==0&&y.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,g=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(P){return P(t,lr(13,"Enter"))})},20));let b=m.start,E=m.endA,w,_,R;if(v){if(y.pos==g.pos)st&&Rn<=11&&y.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>pn(t),20)),w=t.state.tr.delete(b,E),_=u.resolve(m.start).marksAcross(u.resolve(m.endA));else if(m.endA==m.endB&&(R=$w(y.parent.content.cut(y.parentOffset,g.parentOffset),k.parent.content.cut(k.parentOffset,m.endA-k.start()))))w=t.state.tr,R.type=="add"?w.addMark(b,E,R.mark):w.removeMark(b,E,R.mark);else if(y.parent.child(y.index()).isText&&y.index()==g.index()-(g.textOffset?0:1)){let P=y.parent.textBetween(y.parentOffset,g.parentOffset);if(t.someProp("handleTextInput",z=>z(t,b,E,P)))return;w=t.state.tr.insertText(P,b,E)}}if(w||(w=t.state.tr.replace(b,E,c.doc.slice(m.start-c.from,m.endB-c.from))),c.sel){let P=_f(t,w.doc,c.sel);P&&!(Je&&Rt&&t.composing&&P.empty&&(m.start!=m.endB||t.input.lastAndroidDelete<Date.now()-100)&&(P.head==b||P.head==w.mapping.map(E)-1)||st&&P.empty&&P.head==b)&&w.setSelection(P)}_&&w.ensureMarks(_),s&&w.setMeta("composition",s),t.dispatch(w.scrollIntoView())}function _f(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:ja(t,e.resolve(n.anchor),e.resolve(n.head))}function $w(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,a,l;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<n.length;u++)s=n[u].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",l=u=>u.mark(a.addToSet(u.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(A.from(c).eq(t))return{mark:a,type:o}}function Lw(t,e,n,r,i){if(n-e<=i.pos-r.pos||Qa(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&n==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(Qa(s,!0,!0));return!o.parent.isTextblock||o.pos>n||Qa(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Qa(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function Fw(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:o,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let l=Math.max(0,s-Math.min(o,a));r-=o+l-s}if(o<s&&t.size<e.size){let l=r<=s&&r>=o?s-r:0;s-=l,s&&s<e.size&&Af(e.textBetween(s-1,s+1))&&(s+=l?1:-1),a=s+(a-o),o=s}else if(a<s){let l=r<=s&&r>=a?s-r:0;s-=l,s&&s<t.size&&Af(t.textBetween(s-1,s+1))&&(s+=l?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}function Af(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 zw{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 ow,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Rf),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=Pf(this),Bf(this),this.nodeViews=If(this),this.docView=zu(this.state.doc,Vf(this),Xa(this),this.dom,this),this.domObserver=new Nw(this,(r,i,s,o)=>Rw(this,r,i,s,o)),this.domObserver.start(),aw(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&&Ua(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Rf),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(wf(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=If(this);Ww(p,this.nodeViews)&&(this.nodeViews=p,s=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Ua(this),this.editable=Pf(this),Bf(this);let l=Xa(this),c=Vf(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=s||!this.docView.matchesNode(e.doc,c,l);(f||!e.selection.eq(i.selection))&&(o=!0);let h=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&xk(this);if(o){this.domObserver.stop();let p=f&&(st||Je)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&jw(i.selection,e.selection);if(f){let m=Je?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=ww(this)),(s||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=zu(e.doc,c,l,this.dom,this)),m&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Uk(this))?pn(this,p):(Zu(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&&Sk(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof K){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Eu(this,n.getBoundingClientRect(),e)}else Eu(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new xf(e.slice,e.move,i<0?void 0:K.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=n?n(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=n?n(a):a))return i}}hasFocus(){if(st){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Mk(this.dom),pn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Dk(this,e)}coordsAtPos(e,n=1){return Bu(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 Bk(this,n||this.state,e)}pasteHTML(e,n){return Yi(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Yi(this,e,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(lw(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Xa(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,dk())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return dw(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return Ge&&this.root.nodeType===11&&mk(this.dom.ownerDocument)==this.dom&&Aw(this,e)||e}domSelection(){return this.root.getSelection()}}function Vf(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[ht.node(0,t.state.doc.content.size,e)]}function Bf(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:ht.widget(t.state.selection.head,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Pf(t){return!t.someProp("editable",e=>e(t.state)===!1)}function jw(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 If(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 Ww(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 Rf(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var Hn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ro={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Hw=typeof navigator<"u"&&/Mac/.test(navigator.platform),Yw=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),je=0;je<10;je++)Hn[48+je]=Hn[96+je]=String(je);for(var je=1;je<=24;je++)Hn[je+111]="F"+je;for(var je=65;je<=90;je++)Hn[je]=String.fromCharCode(je+32),ro[je]=String.fromCharCode(je);for(var el in Hn)ro.hasOwnProperty(el)||(ro[el]=Hn[el]);function Uw(t){var e=Hw&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Yw&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?ro:Hn)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const qw=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Kw(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))qw?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function Jw(t){let e=Object.create(null);for(let n in t)e[Kw(n)]=t[n];return e}function tl(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 Gw(t){return new Ke({props:{handleKeyDown:$f(t)}})}function $f(t){let e=Jw(t);return function(n,r){let i=Uw(r),s,o=e[tl(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[tl(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(s=Hn[r.keyCode])&&s!=i){let a=e[tl(s,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}const Zw=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Lf(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Xw=(t,e,n)=>{let r=Lf(t,n);if(!r)return!1;let i=nl(r);if(!i){let o=r.blockRange(),a=o&&Ir(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(!s.type.spec.isolating&&Wf(t,i,e))return!0;if(r.parent.content.size==0&&(qr(s,"end")||K.isSelectable(s))){let o=qs(t.doc,r.before(),r.after(),$.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(qr(s,"end")?se.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):K.create(a.doc,i.pos-s.nodeSize)),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},Qw=(t,e,n)=>{let r=Lf(t,n);if(!r)return!1;let i=nl(r);return i?Ff(t,i,e):!1},ev=(t,e,n)=>{let r=zf(t,n);if(!r)return!1;let i=rl(r);return i?Ff(t,i,e):!1};function Ff(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=qs(t.doc,s,l,$.empty);if(!c||c.from!=s||c instanceof Ve&&c.slice.size>=l-s)return!1;if(n){let u=t.tr.step(c);u.setSelection(ee.create(u.doc,s)),n(u.scrollIntoView())}return!0}function qr(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const tv=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=nl(r)}let o=s&&s.nodeBefore;return!o||!K.isSelectable(o)?!1:(e&&e(t.tr.setSelection(K.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function nl(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 zf(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const nv=(t,e,n)=>{let r=zf(t,n);if(!r)return!1;let i=rl(r);if(!i)return!1;let s=i.nodeAfter;if(Wf(t,i,e))return!0;if(r.parent.content.size==0&&(qr(s,"start")||K.isSelectable(s))){let o=qs(t.doc,r.before(),r.after(),$.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(qr(s,"start")?se.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):K.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},rv=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=rl(r)}let o=s&&s.nodeAfter;return!o||!K.isSelectable(o)?!1:(e&&e(t.tr.setSelection(K.create(t.doc,s.pos)).scrollIntoView()),!0)};function rl(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 iv=(t,e)=>{let n=t.selection,r=n instanceof K,i;if(r){if(n.node.isTextblock||!Pn(t.doc,n.from))return!1;i=n.from}else if(i=Us(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(K.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},sv=(t,e)=>{let n=t.selection,r;if(n instanceof K){if(n.node.isTextblock||!Pn(t.doc,n.to))return!1;r=n.to}else if(r=Us(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},ov=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&Ir(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},av=(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 jf(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 lv=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=jf(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,o.createAndFill());l.setSelection(se.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},cv=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Bt||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=jf(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=t.tr.insert(o,s.createAndFill());a.setSelection(ee.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},dv=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(Rr(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Ir(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)},uv=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(K.create(t.doc,i))),!0)};function fv(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Pn(t.doc,e.pos))?!1:(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function Wf(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s,o;if(r.type.spec.isolating||i.type.spec.isolating)return!1;if(fv(t,e,n))return!0;let a=e.parent.canReplace(e.index(),e.index()+1);if(a&&(s=(o=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&o.matchType(s[0]||i.type).validEnd){if(n){let f=e.pos+i.nodeSize,h=A.empty;for(let y=s.length-1;y>=0;y--)h=A.from(s[y].create(null,h));h=A.from(r.copy(h));let p=t.tr.step(new Be(e.pos-1,f,e.pos,f,new $(h,1,0),s.length,!0)),m=f+2*s.length;Pn(p.doc,m)&&p.join(m),n(p.scrollIntoView())}return!0}let l=se.findFrom(e,1),c=l&&l.$from.blockRange(l.$to),u=c&&Ir(c);if(u!=null&&u>=e.depth)return n&&n(t.tr.lift(c,u).scrollIntoView()),!0;if(a&&qr(i,"start",!0)&&qr(r,"end")){let f=r,h=[];for(;h.push(f),!f.isTextblock;)f=f.lastChild;let p=i,m=1;for(;!p.isTextblock;p=p.firstChild)m++;if(f.canReplace(f.childCount,f.childCount,p.content)){if(n){let y=A.empty;for(let k=h.length-1;k>=0;k--)y=A.from(h[k].copy(y));let g=t.tr.step(new Be(e.pos-h.length,e.pos+i.nodeSize,e.pos+m,e.pos+i.nodeSize-m,new $(y,h.length,0),0,!0));n(g.scrollIntoView())}return!0}}return!1}function Hf(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(ee.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const hv=Hf(-1),pv=Hf(1);function mv(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),a=o&&Ma(o,t,e);return a?(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0):!1}}function Yf(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=n.selection.ranges[s];n.doc.nodesBetween(o,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)i=!0;else{let u=n.doc.resolve(c),f=u.index();i=u.parent.canReplaceWith(f,f+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[o];s.setBlockType(a,l,t,e)}r(s.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function gv(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),a=!1,l=o;if(!o)return!1;if(o.depth>=2&&i.node(o.depth-1).type.compatibleContent(t)&&o.startIndex==0){if(i.index(o.depth-1)==0)return!1;let u=n.doc.resolve(o.start-2);l=new Ls(u,u,o.depth),o.endIndex<o.parent.childCount&&(o=new Ls(i,n.doc.resolve(s.end(o.depth)),o.depth)),a=!0}let c=Ma(l,t,e,o);return c?(r&&r(yv(n.tr,o,c,a,t).scrollIntoView()),!0):!1}}function yv(t,e,n,r,i){let s=A.empty;for(let u=n.length-1;u>=0;u--)s=A.from(n[u].type.create(n[u].attrs,s));t.step(new Be(e.start-(r?2:0),e.end,e.start,e.end,new $(s,0,0),n.length,!0));let o=0;for(let u=0;u<n.length;u++)n[u].type==i&&(o=u+1);let a=n.length-o,l=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,f=e.endIndex,h=!0;u<f;u++,h=!1)!h&&Rr(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function bv(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?kv(e,n,t,s):wv(e,n,s):!0:!1}}function kv(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new Be(s-1,o,s,o,new $(A.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Ls(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const a=Ir(r);if(a==null)return!1;i.lift(r,a);let l=i.mapping.map(s,-1)-1;return Pn(i.doc,l)&&i.join(l),e(i.scrollIntoView()),!0}function wv(t,e,n){let r=t.tr,i=n.parent;for(let p=n.end,m=n.endIndex-1,y=n.startIndex;m>y;m--)p-=i.child(m).nodeSize,r.delete(p-1,p+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==i.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(a?0:1),u+1,o.content.append(l?A.empty:A.from(i))))return!1;let f=s.pos,h=f+o.nodeSize;return r.step(new Be(f-(a?1:0),h+(l?1:0),f+1,h-1,new $((a?A.empty:A.from(i.copy(A.empty))).append(l?A.empty:A.from(i.copy(A.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function vv(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=t)return!1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,u=A.from(c?t.create():null),f=new $(A.from(t.create(null,A.from(a.type.create(null,u)))),c?3:1,0),h=s.start,p=s.end;n(e.tr.step(new Be(h-(c?3:1),p,h,p,f,1,!0)).scrollIntoView())}return!0}}function io(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,s=n.storedMarks,n}}}class so{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...u)=>{const f=l(...u)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a=[],l=!!e,c=e||s.tr,u=()=>(!l&&n&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(c),a.every(h=>h===!0)),f={...Object.fromEntries(Object.entries(r).map(([h,p])=>[h,(...y)=>{const g=this.buildProps(c,n),k=p(...y)(g);return a.push(k),f}])),run:u};return f}createCan(e){const{rawCommands:n,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(n).map(([l,c])=>[l,(...u)=>c(...u)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a={tr:e,editor:i,view:o,state:io({state:s,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([l,c])=>[l,(...u)=>c(...u)(a)]))}};return a}}class xv{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 Y(t,e,n){return t.config[e]===void 0&&t.parent?Y(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?Y(t.parent,e,n):null}):t.config[e]}function oo(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 Uf(t){const e=[],{nodeExtensions:n,markExtensions:r}=oo(t),i=[...n,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=Y(o,"addGlobalAttributes",a);if(!l)return;l().forEach(u=>{u.types.forEach(f=>{Object.entries(u.attributes).forEach(([h,p])=>{e.push({type:f,name:h,attribute:{...s,...p}})})})})}),i.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=Y(o,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([u,f])=>{const h={...s,...f};typeof(h==null?void 0:h.default)=="function"&&(h.default=h.default()),h!=null&&h.isRequired&&(h==null?void 0:h.default)===void 0&&delete h.default,e.push({type:o.name,name:u,attribute:h})})}),e}function Pe(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function Ne(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const a=s?s.split(" "):[],l=r[i]?r[i].split(" "):[],c=a.filter(u=>!l.includes(u));r[i]=[...l,...c].join(" ")}else i==="style"?r[i]=[r[i],s].join("; "):r[i]=s}),r},{})}function il(t,e){return e.filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Ne(n,r),{})}function qf(t){return typeof t=="function"}function oe(t,e=void 0,...n){return qf(t)?e?t.bind(e)(...n):t(...n):t}function Sv(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Mv(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Kf(t,e){return t.style?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(n):Mv(n.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...r,...i}}}}function Jf(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&Sv(n)?!1:n!=null))}function Ov(t,e){var n;const r=Uf(t),{nodeExtensions:i,markExtensions:s}=oo(t),o=(n=i.find(c=>Y(c,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(i.map(c=>{const u=r.filter(k=>k.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((k,v)=>{const C=Y(v,"extendNodeSchema",f);return{...k,...C?C(c):{}}},{}),p=Jf({...h,content:oe(Y(c,"content",f)),marks:oe(Y(c,"marks",f)),group:oe(Y(c,"group",f)),inline:oe(Y(c,"inline",f)),atom:oe(Y(c,"atom",f)),selectable:oe(Y(c,"selectable",f)),draggable:oe(Y(c,"draggable",f)),code:oe(Y(c,"code",f)),defining:oe(Y(c,"defining",f)),isolating:oe(Y(c,"isolating",f)),attrs:Object.fromEntries(u.map(k=>{var v;return[k.name,{default:(v=k==null?void 0:k.attribute)===null||v===void 0?void 0:v.default}]}))}),m=oe(Y(c,"parseHTML",f));m&&(p.parseDOM=m.map(k=>Kf(k,u)));const y=Y(c,"renderHTML",f);y&&(p.toDOM=k=>y({node:k,HTMLAttributes:il(k,u)}));const g=Y(c,"renderText",f);return g&&(p.toText=g),[c.name,p]})),l=Object.fromEntries(s.map(c=>{const u=r.filter(g=>g.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((g,k)=>{const v=Y(k,"extendMarkSchema",f);return{...g,...v?v(c):{}}},{}),p=Jf({...h,inclusive:oe(Y(c,"inclusive",f)),excludes:oe(Y(c,"excludes",f)),group:oe(Y(c,"group",f)),spanning:oe(Y(c,"spanning",f)),code:oe(Y(c,"code",f)),attrs:Object.fromEntries(u.map(g=>{var k;return[g.name,{default:(k=g==null?void 0:g.attribute)===null||k===void 0?void 0:k.default}]}))}),m=oe(Y(c,"parseHTML",f));m&&(p.parseDOM=m.map(g=>Kf(g,u)));const y=Y(c,"renderHTML",f);return y&&(p.toDOM=g=>y({mark:g,HTMLAttributes:il(g,u)})),[c.name,p]}));return new E1({topNode:o,nodes:a,marks:l})}function sl(t,e){return e.nodes[t]||e.marks[t]||null}function Gf(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}const Cv=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,a)=>{var l,c;const u=((c=(l=i.type.spec).toText)===null||c===void 0?void 0:c.call(l,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";n+=u.slice(0,Math.max(0,r-s))}),n};function ol(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class ao{constructor(e){this.find=e.find,this.handler=e.handler}}const Tv=(t,e)=>{if(ol(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 lo(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(h=>h.type.spec.code))return!1;let u=!1;const f=Cv(c)+s;return o.forEach(h=>{if(u)return;const p=Tv(f,h.find);if(!p)return;const m=l.state.tr,y=io({state:l.state,transaction:m}),g={from:r-(p[0].length-s.length),to:i},{commands:k,chain:v,can:C}=new so({editor:n,state:y});h.handler({state:y,range:g,match:p,commands:k,chain:v,can:C})===null||!m.steps.length||(m.setMeta(a,{transform:m,from:r,to:i,text:s}),l.dispatch(m),u=!0)}),u}function Ev(t){const{editor:e,rules:n}=t,r=new Ke({state:{init(){return null},apply(i,s){const o=i.getMeta(r);if(o)return o;const a=i.getMeta("applyInputRules");return!!a&&setTimeout(()=>{const{from:c,text:u}=a,f=c+u.length;lo({editor:e,from:c,to:f,text:u,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return lo({editor:e,from:s,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&lo({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?lo({editor:e,from:o.pos,to:o.pos,text:`
|
|
15
|
+
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function Dv(t){return typeof t=="number"}class Nv{constructor(e){this.find=e.find,this.handler=e.handler}}const _v=(t,e,n)=>{if(ol(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=t,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function Av(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:a}=t,{commands:l,chain:c,can:u}=new so({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,"");_v(k,s.find,o).forEach(C=>{if(C.index===void 0)return;const b=y+C.index+1,E=b+C[0].length,w={from:n.tr.mapping.map(b),to:n.tr.mapping.map(E)},_=s.handler({state:n,range:w,match:C,commands:l,chain:c,can:u,pasteEvent:o,dropEvent:a});f.push(_)})}),f.every(p=>p!==null)}const Vv=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 Bv(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a=typeof DragEvent<"u"?new DragEvent("drop"):null;const l=({state:u,from:f,to:h,rule:p,pasteEvt:m})=>{const y=u.tr,g=io({state:u,transaction:y});if(!(!Av({editor:e,state:g,from:Math.max(f-1,0),to:h.b-1,rule:p,pasteEvent:m,dropEvent:a})||!y.steps.length))return a=typeof DragEvent<"u"?new DragEvent("drop"):null,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,y};return n.map(u=>new Ke({view(f){const h=p=>{var m;r=!((m=f.dom.parentElement)===null||m===void 0)&&m.contains(p.target)?f.dom.parentElement:null};return window.addEventListener("dragstart",h),{destroy(){window.removeEventListener("dragstart",h)}}},props:{handleDOMEvents:{drop:(f,h)=>(s=r===f.dom.parentElement,a=h,!1),paste:(f,h)=>{var p;const m=(p=h.clipboardData)===null||p===void 0?void 0:p.getData("text/html");return o=h,i=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(f,h,p)=>{const m=f[0],y=m.getMeta("uiEvent")==="paste"&&!i,g=m.getMeta("uiEvent")==="drop"&&!s,k=m.getMeta("applyPasteRules"),v=!!k;if(!y&&!g&&!v)return;if(v){const{from:E,text:w}=k,_=E+w.length,R=Vv(w);return l({rule:u,state:p,from:E,to:{b:_},pasteEvt:R})}const C=h.doc.content.findDiffStart(p.doc.content),b=h.doc.content.findDiffEnd(p.doc.content);if(!(!Dv(C)||!b||C===b.b))return l({rule:u,state:p,from:C,to:b,pasteEvt:o})}}))}function Pv(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return[...new Set(e)]}class Kr{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=Kr.resolve(e),this.schema=Ov(this.extensions,n),this.setupExtensions()}static resolve(e){const n=Kr.sort(Kr.flatten(e)),r=Pv(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=Y(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{const s=Y(r,"priority")||100,o=Y(i,"priority")||100;return s>o?-1:s<o?1:0})}get commands(){return this.extensions.reduce((e,n)=>{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:sl(n.name,this.schema)},i=Y(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=Kr.sort([...this.extensions].reverse()),r=[],i=[],s=n.map(o=>{const a={name:o.name,options:o.options,storage:o.storage,editor:e,type:sl(o.name,this.schema)},l=[],c=Y(o,"addKeyboardShortcuts",a);let u={};if(o.type==="mark"&&o.config.exitable&&(u.ArrowRight=()=>Zt.handleExit({editor:e,mark:o})),c){const y=Object.fromEntries(Object.entries(c()).map(([g,k])=>[g,()=>k({editor:e})]));u={...u,...y}}const f=Gw(u);l.push(f);const h=Y(o,"addInputRules",a);Gf(o,e.options.enableInputRules)&&h&&r.push(...h());const p=Y(o,"addPasteRules",a);Gf(o,e.options.enablePasteRules)&&p&&i.push(...p());const m=Y(o,"addProseMirrorPlugins",a);if(m){const y=m();l.push(...y)}return l}).flat();return[Ev({editor:e,rules:r}),...Bv({editor:e,rules:i}),...s]}get attributes(){return Uf(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=oo(this.extensions);return Object.fromEntries(n.filter(r=>!!Y(r,"addNodeView")).map(r=>{const i=this.attributes.filter(l=>l.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:Pe(r.name,this.schema)},o=Y(r,"addNodeView",s);if(!o)return[];const a=(l,c,u,f)=>{const h=il(l,i);return o()({editor:e,node:l,getPos:u,decorations:f,HTMLAttributes:h,extension:r})};return[r.name,a]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:sl(e.name,this.schema)};e.type==="mark"&&(!((n=oe(Y(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=Y(e,"onBeforeCreate",r),s=Y(e,"onCreate",r),o=Y(e,"onUpdate",r),a=Y(e,"onSelectionUpdate",r),l=Y(e,"onTransaction",r),c=Y(e,"onFocus",r),u=Y(e,"onBlur",r),f=Y(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),f&&this.editor.on("destroy",f)})}}function Iv(t){return Object.prototype.toString.call(t).slice(8,-1)}function al(t){return Iv(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function co(t,e){const n={...t};return al(t)&&al(e)&&Object.keys(e).forEach(r=>{al(e[r])?r in t?n[r]=co(t[r],e[r]):Object.assign(n,{[r]:e[r]}):Object.assign(n,{[r]:e[r]})}),n}class Ye{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=oe(Y(this,"addOptions",{name:this.name}))),this.storage=oe(Y(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ye(e)}configure(e={}){const n=this.extend();return n.parent=this.parent,n.options=co(this.options,e),n.storage=oe(Y(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){const n=new Ye({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=oe(Y(n,"addOptions",{name:n.name})),n.storage=oe(Y(n,"addStorage",{name:n.name,options:n.options})),n}}function Zf(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
|
|
16
16
|
|
|
17
|
-
`,textSerializers:o={}}=n||{};let a="";return t.nodesBetween(r,i,(l,c,u,f)=>{var h;l.isBlock&&c>r&&(a+=s);const p=o==null?void 0:o[l.type.name];if(p)return u&&(a+=p({node:l,pos:c,parent:u,index:f,range:e})),!1;l.isText&&(a+=(h=l==null?void 0:l.text)===null||h===void 0?void 0:h.slice(Math.max(r,c)-c,i-c))}),a}function Xf(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const Rv=Ye.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ke({key:new Pt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(u=>u.$from.pos)),a=Math.max(...s.map(u=>u.$to.pos)),l=Xf(n);return Zf(r,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),$v=()=>({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),Lv=(t=!1)=>({commands:e})=>e.setContent("",t),Fv=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:o})=>{t.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,f=c.resolve(u.map(l)),h=c.resolve(u.map(l+a.nodeSize)),p=f.blockRange(h);if(!p)return;const m=Ir(p);if(a.type.isTextblock){const{defaultType:y}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(p.start,y)}(m||m===0)&&e.lift(p,m)})}),!0},zv=t=>e=>t(e),jv=()=>({state:t,dispatch:e})=>cv(t,e),Wv=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new ee(r.doc.resolve(o-1))),!0},Hv=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const a=i.before(s),l=i.after(s);t.delete(a,l).scrollIntoView()}return!0}return!1},Yv=t=>({tr:e,state:n,dispatch:r})=>{const i=Pe(t,n.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const l=s.before(o),c=s.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1},Uv=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},qv=()=>({state:t,dispatch:e})=>Zw(t,e),Kv=()=>({commands:t})=>t.keyboardShortcut("Enter"),Jv=()=>({state:t,dispatch:e})=>lv(t,e);function uo(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:ol(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function ll(t,e,n={}){return t.find(r=>r.type===e&&uo(r.attrs,n))}function Gv(t,e,n={}){return!!ll(t,e,n)}function cl(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=ll([...r.node.marks],e,n);if(!i)return;let s=r.index,o=t.start()+r.offset,a=s+1,l=o+r.node.nodeSize;for(ll([...r.node.marks],e,n);s>0&&i.isInSet(t.parent.child(s-1).marks);)s-=1,o-=t.parent.child(s).nodeSize;for(;a<t.parent.childCount&&Gv([...t.parent.child(a).marks],e,n);)l+=t.parent.child(a).nodeSize,a+=1;return{from:o,to:l}}function Yn(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const Zv=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const s=Yn(t,r.schema),{doc:o,selection:a}=n,{$from:l,from:c,to:u}=a;if(i){const f=cl(l,s,e);if(f&&f.from<=c&&f.to>=u){const h=ee.create(o,f.from,f.to);n.setSelection(h)}}return!0},Xv=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 dl(t){return t instanceof ee}function mn(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Qf(t,e=null){if(!e)return null;const n=se.atStart(t),r=se.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?ee.create(t,mn(0,i,s),mn(t.content.size,i,s)):ee.create(t,mn(e,i,s),mn(e,i,s))}function ul(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const Qv=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{ul()&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!dl(n.state.selection))return o(),!0;const a=Qf(i.doc,t)||n.state.selection,l=n.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},ex=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),tx=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),eh=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&&eh(r)}return t};function th(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return eh(n)}function fo(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?A.fromArray(t.map(o=>e.nodeFromJSON(o))):e.nodeFromJSON(t)}catch(s){return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),fo("",e,n)}if(i){const s=Vr.fromSchema(e);return n.slice?s.parseSlice(th(t),n.parseOptions).content:s.parse(th(t),n.parseOptions)}return fo("",e,n)}function nx(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof Ve||i instanceof Be))return;const s=t.mapping.maps[r];let o=0;s.forEach((a,l,c,u)=>{o===0&&(o=u)}),t.setSelection(se.near(t.doc.resolve(o),n))}const rx=t=>t.toString().startsWith("<"),ix=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{if(i){n={parseOptions:{},updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};const o=fo(e,s.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions}});if(o.toString()==="<>")return!0;let{from:a,to:l}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},c=!0,u=!0;if((rx(o)?o:[o]).forEach(p=>{p.check(),c=c?p.isText&&p.marks.length===0:!1,u=u?p.isBlock:!1}),a===l&&u){const{parent:p}=r.doc.resolve(a);p.isTextblock&&!p.type.spec.code&&!p.childCount&&(a-=1,l+=1)}let h;c?(Array.isArray(e)?h=e.map(p=>p.text||"").join(""):typeof e=="object"&&e&&e.text?h=e.text:h=e,r.insertText(h,a,l)):(h=o,r.replaceWith(a,l,h)),n.updateSelection&&nx(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},sx=()=>({state:t,dispatch:e})=>iv(t,e),ox=()=>({state:t,dispatch:e})=>sv(t,e),ax=()=>({state:t,dispatch:e})=>Xw(t,e),lx=()=>({state:t,dispatch:e})=>nv(t,e),cx=()=>({tr:t,state:e,dispatch:n})=>{try{const r=Us(e.doc,e.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),n&&n(t),!0)}catch{return!1}},dx=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Us(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},ux=()=>({state:t,dispatch:e})=>Qw(t,e),fx=()=>({state:t,dispatch:e})=>ev(t,e);function nh(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function hx(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))ul()||nh()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const px=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=hx(t).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,a))});return l==null||l.steps.forEach(c=>{const u=c.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function qi(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?Pe(e,t.schema):null,a=[];t.doc.nodesBetween(r,i,(f,h)=>{if(f.isText)return;const p=Math.max(r,h),m=Math.min(i,h+f.nodeSize);a.push({node:f,from:p,to:m})});const l=i-r,c=a.filter(f=>o?o.name===f.node.type.name:!0).filter(f=>uo(f.node.attrs,n,{strict:!1}));return s?!!c.length:c.reduce((f,h)=>f+h.to-h.from,0)>=l}const mx=(t,e={})=>({state:n,dispatch:r})=>{const i=Pe(t,n.schema);return qi(n,i,e)?ov(n,r):!1},gx=()=>({state:t,dispatch:e})=>dv(t,e),yx=t=>({state:e,dispatch:n})=>{const r=Pe(t,e.schema);return bv(r)(e,n)},bx=()=>({state:t,dispatch:e})=>av(t,e);function ho(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function rh(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 kx=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=ho(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(s=Pe(t,r.schema)),a==="mark"&&(o=Yn(t,r.schema)),i&&n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,u)=>{s&&s===c.type&&n.setNodeMarkup(u,void 0,rh(c.attrs,e)),o&&c.marks.length&&c.marks.forEach(f=>{o===f.type&&n.addMark(u,u+c.nodeSize,o.create(rh(f.attrs,e)))})})}),!0):!1},wx=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),vx=()=>({tr:t,commands:e})=>e.setTextSelection({from:0,to:t.doc.content.size}),xx=()=>({state:t,dispatch:e})=>tv(t,e),Sx=()=>({state:t,dispatch:e})=>rv(t,e),Mx=()=>({state:t,dispatch:e})=>uv(t,e),Ox=()=>({state:t,dispatch:e})=>pv(t,e),Cx=()=>({state:t,dispatch:e})=>hv(t,e);function ih(t,e,n={}){return fo(t,e,{slice:!1,parseOptions:n})}const Tx=(t,e=!1,n={})=>({tr:r,editor:i,dispatch:s})=>{const{doc:o}=r,a=ih(t,i.schema,n);return s&&r.replaceWith(0,o.content.size,a).setMeta("preventUpdate",!e),!0};function po(t,e){const n=Yn(e,t.schema),{from:r,to:i,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function Ex(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 Dx(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 fl(t){return e=>Dx(e.$from,t)}function Nx(t,e){const n=Ut.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function _x(t,e){const n={from:0,to:t.content.size};return Zf(t,n,e)}function Ax(t,e){const n=Pe(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===n.name);return o?{...o.attrs}:{}}function Vx(t,e){const n=ho(typeof e=="string"?e:e.name,t.schema);return n==="node"?Ax(t,e):n==="mark"?po(t,e):{}}function sh(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t-1),o=cl(s,i.type);o&&r.push({mark:i,...o})}):n.nodesBetween(t,e,(i,s)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}function mo(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}function hl(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?Yn(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>s?s.name===f.type.name:!0).find(f=>uo(f.attrs,n,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:f,$to:h})=>{const p=f.pos,m=h.pos;t.doc.nodesBetween(p,m,(y,g)=>{if(!y.isText&&!y.marks.length)return;const k=Math.max(p,g),x=Math.min(m,g+y.nodeSize),C=x-k;o+=C,a.push(...y.marks.map(b=>({mark:b,from:k,to:x})))})}),o===0)return!1;const l=a.filter(f=>s?s.name===f.mark.type.name:!0).filter(f=>uo(f.mark.attrs,n,{strict:!1})).reduce((f,h)=>f+h.to-h.from,0),c=a.filter(f=>s?f.mark.type!==s&&f.mark.type.excludes(s):!0).reduce((f,h)=>f+h.to-h.from,0);return(l>0?l+c:l)>=o}function Bx(t,e,n={}){if(!e)return qi(t,null,n)||hl(t,null,n);const r=ho(e,t.schema);return r==="node"?qi(t,e,n):r==="mark"?hl(t,e,n):!1}function oh(t,e){const{nodeExtensions:n}=oo(e),r=n.find(o=>o.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=oe(Y(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function Px(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 Ix(t){return t instanceof K}function ah(t,e,n){const i=t.state.doc.content.size,s=mn(e,0,i),o=mn(n,0,i),a=t.coordsAtPos(s),l=t.coordsAtPos(o,-1),c=Math.min(a.top,l.top),u=Math.max(a.bottom,l.bottom),f=Math.min(a.left,l.left),h=Math.max(a.right,l.right),p=h-f,m=u-c,k={top:c,bottom:u,left:f,right:h,width:p,height:m,x:f,y:c};return{...k,toJSON:()=>k}}function Rx(t,e,n){var r;const{selection:i}=e;let s=null;if(dl(i)&&(s=i.$cursor),s){const a=(r=t.storedMarks)!==null&&r!==void 0?r:s.marks();return!!n.isInSet(a)||!a.some(l=>l.type.excludes(n))}const{ranges:o}=i;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(u,f,h)=>{if(c)return!1;if(u.isInline){const p=!h||h.type.allowsMarkType(n),m=!!n.isInSet(u.marks)||!u.marks.some(y=>y.type.excludes(n));c=p&&m}return!c}),c})}const $x=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:a}=s,l=Yn(t,r.schema);if(i)if(o){const c=po(r,l);n.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,f=c.$to.pos;r.doc.nodesBetween(u,f,(h,p)=>{const m=Math.max(p,u),y=Math.min(p+h.nodeSize,f);h.marks.find(k=>k.type===l)?h.marks.forEach(k=>{l===k.type&&n.addMark(m,y,l.create({...k.attrs,...e}))}):n.addMark(m,y,l.create(e))})});return Rx(r,n,l)},Lx=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),Fx=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=Pe(t,n.schema);return s.isTextblock?i().command(({commands:o})=>Yf(s,e)(n)?!0:o.clearNodes()).command(({state:o})=>Yf(s,e)(o,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},zx=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=mn(t,0,r.content.size),s=K.create(r,i);e.setSelection(s)}return!0},jx=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,o=ee.atStart(r).from,a=ee.atEnd(r).to,l=mn(i,o,a),c=mn(s,o,a),u=ee.create(r,l,c);e.setSelection(u)}return!0},Wx=t=>({state:e,dispatch:n})=>{const r=Pe(t,e.schema);return vv(r)(e,n)};function lh(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 Hx=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,c=i.extensionManager.attributes,u=mo(c,a.node().type.name,a.node().attrs);if(s instanceof K&&s.node.isBlock)return!a.parentOffset||!Rr(o,a.pos)?!1:(r&&(t&&lh(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;if(r){const f=l.parentOffset===l.parent.content.size;s instanceof ee&&e.deleteSelection();const h=a.depth===0?void 0:Ex(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=f&&h?[{type:h,attrs:u}]:void 0,m=Rr(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!m&&Rr(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(m=!0,p=h?[{type:h,attrs:u}]:void 0),m&&(e.split(e.mapping.map(a.pos),1,p),h&&!f&&!a.parentOffset&&a.parent.type!==h)){const y=e.mapping.map(a.before()),g=e.doc.resolve(y);a.node(-1).canReplaceWith(g.index(),g.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}t&&lh(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return!0},Yx=t=>({tr:e,state:n,dispatch:r,editor:i})=>{var s;const o=Pe(t,n.schema),{$from:a,$to:l}=n.selection,c=n.selection.node;if(c&&c.isBlock||a.depth<2||!a.sameParent(l))return!1;const u=a.node(-1);if(u.type!==o)return!1;const f=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==o||a.index(-2)!==a.node(-2).childCount-1)return!1;if(r){let g=A.empty;const k=a.index(-1)?1:a.index(-2)?2:3;for(let _=a.depth-k;_>=a.depth-3;_-=1)g=A.from(a.node(_).copy(g));const x=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,C=mo(f,a.node().type.name,a.node().attrs),b=((s=o.contentMatch.defaultType)===null||s===void 0?void 0:s.createAndFill(C))||void 0;g=g.append(A.from(o.createAndFill(null,b)||void 0));const E=a.before(a.depth-(k-1));e.replace(E,a.after(-x),new $(g,4-k,0));let w=-1;e.doc.nodesBetween(E,e.doc.content.size,(_,R)=>{if(w>-1)return!1;_.isTextblock&&_.content.size===0&&(w=R+1)}),w>-1&&e.setSelection(ee.near(e.doc.resolve(w))),e.scrollIntoView()}return!0}const h=l.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,l.pos);const y=h?[{type:o,attrs:p},{type:h,attrs:m}]:[{type:o,attrs:p}];if(!Rr(e.doc,a.pos,2))return!1;if(r){const{selection:g,storedMarks:k}=n,{splittableMarks:x}=i.extensionManager,C=k||g.$to.parentOffset&&g.$from.marks();if(e.split(a.pos,2,y).scrollIntoView(),!C||!r)return!0;const b=C.filter(E=>x.includes(E.type.name));e.ensureMarks(b)}return!0},pl=(t,e)=>{const n=fl(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Pn(t.doc,n.pos)&&t.join(n.pos),!0},ml=(t,e)=>{const n=fl(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Pn(t.doc,r)&&t.join(r),!0};var Ux=Object.freeze({__proto__:null,blur:$v,clearContent:Lv,clearNodes:Fv,command:zv,createParagraphNear:jv,cut:Wv,deleteCurrentNode:Hv,deleteNode:Yv,deleteRange:Uv,deleteSelection:qv,enter:Kv,exitCode:Jv,extendMarkRange:Zv,first:Xv,focus:Qv,forEach:ex,insertContent:tx,insertContentAt:ix,joinUp:sx,joinDown:ox,joinBackward:ax,joinForward:lx,joinItemBackward:cx,joinItemForward:dx,joinTextblockBackward:ux,joinTextblockForward:fx,keyboardShortcut:px,lift:mx,liftEmptyBlock:gx,liftListItem:yx,newlineInCode:bx,resetAttributes:kx,scrollIntoView:wx,selectAll:vx,selectNodeBackward:xx,selectNodeForward:Sx,selectParentNode:Mx,selectTextblockEnd:Ox,selectTextblockStart:Cx,setContent:Tx,setMark:$x,setMeta:Lx,setNode:Fx,setNodeSelection:zx,setTextSelection:jx,sinkListItem:Wx,splitBlock:Hx,splitListItem:Yx,toggleList:(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:f,splittableMarks:h}=i.extensionManager,p=Pe(t,o.schema),m=Pe(e,o.schema),{selection:y,storedMarks:g}=o,{$from:k,$to:x}=y,C=k.blockRange(x),b=g||y.$to.parentOffset&&y.$from.marks();if(!C)return!1;const E=fl(w=>oh(w.type.name,f))(y);if(C.depth>=1&&E&&C.depth-E.depth<=1){if(E.node.type===p)return c.liftListItem(m);if(oh(E.node.type.name,f)&&p.validContent(E.node.content)&&a)return l().command(()=>(s.setNodeMarkup(E.pos,p),!0)).command(()=>pl(s,p)).command(()=>ml(s,p)).run()}return!n||!b||!a?l().command(()=>u().wrapInList(p,r)?!0:c.clearNodes()).wrapInList(p,r).command(()=>pl(s,p)).command(()=>ml(s,p)).run():l().command(()=>{const w=u().wrapInList(p,r),_=b.filter(R=>h.includes(R.type.name));return s.ensureMarks(_),w?!0:c.clearNodes()}).wrapInList(p,r).command(()=>pl(s,p)).command(()=>ml(s,p)).run()},toggleMark:(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=Yn(t,r.schema);return hl(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},toggleNode:(t,e,n={})=>({state:r,commands:i})=>{const s=Pe(t,r.schema),o=Pe(e,r.schema);return qi(r,s,n)?i.setNode(o):i.setNode(s,n)},toggleWrap:(t,e={})=>({state:n,commands:r})=>{const i=Pe(t,n.schema);return qi(n,i,e)?r.lift(i):r.wrapIn(i,e)},undoInputRule:()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const o=t.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},unsetAllMarks:()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},unsetMark:(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=n,l=Yn(t,r.schema),{$from:c,empty:u,ranges:f}=a;if(!i)return!0;if(u&&o){let{from:h,to:p}=a;const m=(s=c.marks().find(g=>g.type===l))===null||s===void 0?void 0:s.attrs,y=cl(c,l,m);y&&(h=y.from,p=y.to),n.removeMark(h,p,l)}else f.forEach(h=>{n.removeMark(h.$from.pos,h.$to.pos,l)});return n.removeStoredMark(l),!0},updateAttributes:(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=ho(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(s=Pe(t,r.schema)),a==="mark"&&(o=Yn(t,r.schema)),i&&n.selection.ranges.forEach(l=>{const c=l.$from.pos,u=l.$to.pos;r.doc.nodesBetween(c,u,(f,h)=>{s&&s===f.type&&n.setNodeMarkup(h,void 0,{...f.attrs,...e}),o&&f.marks.length&&f.marks.forEach(p=>{if(o===p.type){const m=Math.max(h,c),y=Math.min(h+f.nodeSize,u);n.addMark(m,y,o.create({...p.attrs,...e}))}})})}),!0):!1},wrapIn:(t,e={})=>({state:n,dispatch:r})=>{const i=Pe(t,n.schema);return mv(i,e)(n,r)},wrapInList:(t,e={})=>({state:n,dispatch:r})=>{const i=Pe(t,n.schema);return gv(i,e)(n,r)}});const qx=Ye.create({name:"commands",addCommands(){return{...Ux}}}),Kx=Ye.create({name:"editable",addProseMirrorPlugins(){return[new Ke({key:new Pt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Jx=Ye.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ke({key:new Pt("focusEvents"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Gx=Ye.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:f}=l,{pos:h,parent:p}=f,m=f.parent.isTextblock&&h>0?a.doc.resolve(h-1):f,y=m.parent.type.spec.isolating,g=f.pos-f.parentOffset,k=y&&m.parent.childCount===1?g===f.pos:se.atStart(c).from===h;return!u||!p.type.isTextblock||p.textContent.length||!k||k&&f.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ul()||nh()?s:i},addProseMirrorPlugins(){return[new Ke({key:new Pt("clearDocument"),appendTransaction:(t,e,n)=>{if(!(t.some(m=>m.docChanged)&&!e.doc.eq(n.doc)))return;const{empty:i,from:s,to:o}=e.selection,a=se.atStart(e.doc).from,l=se.atEnd(e.doc).to;if(i||!(s===a&&o===l)||!(n.doc.textBetween(0,n.doc.content.size," "," ").length===0))return;const f=n.tr,h=io({state:n,transaction:f}),{commands:p}=new so({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),Zx=Ye.create({name:"tabindex",addProseMirrorPlugins(){return[new Ke({key:new Pt("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}});class pr{constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new pr(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new pr(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new pr(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=this.pos+r+1,o=this.resolvedPos.doc.resolve(s);if(!i&&o.depth<=this.depth)return;const a=new pr(o,this.editor,i,i?n:null);i&&(a.actualDepth=this.depth+1),e.push(new pr(o,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,o=Object.keys(n);for(let a=0;a<o.length;a+=1){const l=o[a];if(s[l]!==n[l])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(l=>n[l]===o.node.attrs[l])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,n,r))))}),i}setAttribute(e){const n=this.editor.state.selection;this.editor.chain().setTextSelection(this.from).updateAttributes(this.node.type.name,e).setTextSelection(n.from).run()}}const Xx=`.ProseMirror {
|
|
17
|
+
`,textSerializers:o={}}=n||{};let a="";return t.nodesBetween(r,i,(l,c,u,f)=>{var h;l.isBlock&&c>r&&(a+=s);const p=o==null?void 0:o[l.type.name];if(p)return u&&(a+=p({node:l,pos:c,parent:u,index:f,range:e})),!1;l.isText&&(a+=(h=l==null?void 0:l.text)===null||h===void 0?void 0:h.slice(Math.max(r,c)-c,i-c))}),a}function Xf(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const Rv=Ye.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ke({key:new Pt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(u=>u.$from.pos)),a=Math.max(...s.map(u=>u.$to.pos)),l=Xf(n);return Zf(r,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),$v=()=>({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),Lv=(t=!1)=>({commands:e})=>e.setContent("",t),Fv=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:o})=>{t.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,f=c.resolve(u.map(l)),h=c.resolve(u.map(l+a.nodeSize)),p=f.blockRange(h);if(!p)return;const m=Ir(p);if(a.type.isTextblock){const{defaultType:y}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(p.start,y)}(m||m===0)&&e.lift(p,m)})}),!0},zv=t=>e=>t(e),jv=()=>({state:t,dispatch:e})=>cv(t,e),Wv=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new ee(r.doc.resolve(o-1))),!0},Hv=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const a=i.before(s),l=i.after(s);t.delete(a,l).scrollIntoView()}return!0}return!1},Yv=t=>({tr:e,state:n,dispatch:r})=>{const i=Pe(t,n.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const l=s.before(o),c=s.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1},Uv=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},qv=()=>({state:t,dispatch:e})=>Zw(t,e),Kv=()=>({commands:t})=>t.keyboardShortcut("Enter"),Jv=()=>({state:t,dispatch:e})=>lv(t,e);function uo(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:ol(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function ll(t,e,n={}){return t.find(r=>r.type===e&&uo(r.attrs,n))}function Gv(t,e,n={}){return!!ll(t,e,n)}function cl(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=ll([...r.node.marks],e,n);if(!i)return;let s=r.index,o=t.start()+r.offset,a=s+1,l=o+r.node.nodeSize;for(ll([...r.node.marks],e,n);s>0&&i.isInSet(t.parent.child(s-1).marks);)s-=1,o-=t.parent.child(s).nodeSize;for(;a<t.parent.childCount&&Gv([...t.parent.child(a).marks],e,n);)l+=t.parent.child(a).nodeSize,a+=1;return{from:o,to:l}}function Yn(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const Zv=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const s=Yn(t,r.schema),{doc:o,selection:a}=n,{$from:l,from:c,to:u}=a;if(i){const f=cl(l,s,e);if(f&&f.from<=c&&f.to>=u){const h=ee.create(o,f.from,f.to);n.setSelection(h)}}return!0},Xv=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 dl(t){return t instanceof ee}function mn(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Qf(t,e=null){if(!e)return null;const n=se.atStart(t),r=se.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?ee.create(t,mn(0,i,s),mn(t.content.size,i,s)):ee.create(t,mn(e,i,s),mn(e,i,s))}function ul(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const Qv=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{ul()&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!dl(n.state.selection))return o(),!0;const a=Qf(i.doc,t)||n.state.selection,l=n.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},ex=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),tx=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),eh=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&&eh(r)}return t};function th(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return eh(n)}function fo(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?A.fromArray(t.map(o=>e.nodeFromJSON(o))):e.nodeFromJSON(t)}catch(s){return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),fo("",e,n)}if(i){const s=Vr.fromSchema(e);return n.slice?s.parseSlice(th(t),n.parseOptions).content:s.parse(th(t),n.parseOptions)}return fo("",e,n)}function nx(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof Ve||i instanceof Be))return;const s=t.mapping.maps[r];let o=0;s.forEach((a,l,c,u)=>{o===0&&(o=u)}),t.setSelection(se.near(t.doc.resolve(o),n))}const rx=t=>t.toString().startsWith("<"),ix=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{if(i){n={parseOptions:{},updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};const o=fo(e,s.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions}});if(o.toString()==="<>")return!0;let{from:a,to:l}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},c=!0,u=!0;if((rx(o)?o:[o]).forEach(p=>{p.check(),c=c?p.isText&&p.marks.length===0:!1,u=u?p.isBlock:!1}),a===l&&u){const{parent:p}=r.doc.resolve(a);p.isTextblock&&!p.type.spec.code&&!p.childCount&&(a-=1,l+=1)}let h;c?(Array.isArray(e)?h=e.map(p=>p.text||"").join(""):typeof e=="object"&&e&&e.text?h=e.text:h=e,r.insertText(h,a,l)):(h=o,r.replaceWith(a,l,h)),n.updateSelection&&nx(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},sx=()=>({state:t,dispatch:e})=>iv(t,e),ox=()=>({state:t,dispatch:e})=>sv(t,e),ax=()=>({state:t,dispatch:e})=>Xw(t,e),lx=()=>({state:t,dispatch:e})=>nv(t,e),cx=()=>({tr:t,state:e,dispatch:n})=>{try{const r=Us(e.doc,e.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),n&&n(t),!0)}catch{return!1}},dx=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Us(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},ux=()=>({state:t,dispatch:e})=>Qw(t,e),fx=()=>({state:t,dispatch:e})=>ev(t,e);function nh(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function hx(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))ul()||nh()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const px=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=hx(t).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,a))});return l==null||l.steps.forEach(c=>{const u=c.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function qi(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?Pe(e,t.schema):null,a=[];t.doc.nodesBetween(r,i,(f,h)=>{if(f.isText)return;const p=Math.max(r,h),m=Math.min(i,h+f.nodeSize);a.push({node:f,from:p,to:m})});const l=i-r,c=a.filter(f=>o?o.name===f.node.type.name:!0).filter(f=>uo(f.node.attrs,n,{strict:!1}));return s?!!c.length:c.reduce((f,h)=>f+h.to-h.from,0)>=l}const mx=(t,e={})=>({state:n,dispatch:r})=>{const i=Pe(t,n.schema);return qi(n,i,e)?ov(n,r):!1},gx=()=>({state:t,dispatch:e})=>dv(t,e),yx=t=>({state:e,dispatch:n})=>{const r=Pe(t,e.schema);return bv(r)(e,n)},bx=()=>({state:t,dispatch:e})=>av(t,e);function ho(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function rh(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 kx=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=ho(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(s=Pe(t,r.schema)),a==="mark"&&(o=Yn(t,r.schema)),i&&n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,u)=>{s&&s===c.type&&n.setNodeMarkup(u,void 0,rh(c.attrs,e)),o&&c.marks.length&&c.marks.forEach(f=>{o===f.type&&n.addMark(u,u+c.nodeSize,o.create(rh(f.attrs,e)))})})}),!0):!1},wx=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),vx=()=>({tr:t,commands:e})=>e.setTextSelection({from:0,to:t.doc.content.size}),xx=()=>({state:t,dispatch:e})=>tv(t,e),Sx=()=>({state:t,dispatch:e})=>rv(t,e),Mx=()=>({state:t,dispatch:e})=>uv(t,e),Ox=()=>({state:t,dispatch:e})=>pv(t,e),Cx=()=>({state:t,dispatch:e})=>hv(t,e);function ih(t,e,n={}){return fo(t,e,{slice:!1,parseOptions:n})}const Tx=(t,e=!1,n={})=>({tr:r,editor:i,dispatch:s})=>{const{doc:o}=r,a=ih(t,i.schema,n);return s&&r.replaceWith(0,o.content.size,a).setMeta("preventUpdate",!e),!0};function po(t,e){const n=Yn(e,t.schema),{from:r,to:i,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function Ex(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 Dx(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 fl(t){return e=>Dx(e.$from,t)}function Nx(t,e){const n=Ut.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function _x(t,e){const n={from:0,to:t.content.size};return Zf(t,n,e)}function Ax(t,e){const n=Pe(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===n.name);return o?{...o.attrs}:{}}function Vx(t,e){const n=ho(typeof e=="string"?e:e.name,t.schema);return n==="node"?Ax(t,e):n==="mark"?po(t,e):{}}function sh(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t-1),o=cl(s,i.type);o&&r.push({mark:i,...o})}):n.nodesBetween(t,e,(i,s)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}function mo(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}function hl(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?Yn(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>s?s.name===f.type.name:!0).find(f=>uo(f.attrs,n,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:f,$to:h})=>{const p=f.pos,m=h.pos;t.doc.nodesBetween(p,m,(y,g)=>{if(!y.isText&&!y.marks.length)return;const k=Math.max(p,g),v=Math.min(m,g+y.nodeSize),C=v-k;o+=C,a.push(...y.marks.map(b=>({mark:b,from:k,to:v})))})}),o===0)return!1;const l=a.filter(f=>s?s.name===f.mark.type.name:!0).filter(f=>uo(f.mark.attrs,n,{strict:!1})).reduce((f,h)=>f+h.to-h.from,0),c=a.filter(f=>s?f.mark.type!==s&&f.mark.type.excludes(s):!0).reduce((f,h)=>f+h.to-h.from,0);return(l>0?l+c:l)>=o}function Bx(t,e,n={}){if(!e)return qi(t,null,n)||hl(t,null,n);const r=ho(e,t.schema);return r==="node"?qi(t,e,n):r==="mark"?hl(t,e,n):!1}function oh(t,e){const{nodeExtensions:n}=oo(e),r=n.find(o=>o.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=oe(Y(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function Px(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 Ix(t){return t instanceof K}function ah(t,e,n){const i=t.state.doc.content.size,s=mn(e,0,i),o=mn(n,0,i),a=t.coordsAtPos(s),l=t.coordsAtPos(o,-1),c=Math.min(a.top,l.top),u=Math.max(a.bottom,l.bottom),f=Math.min(a.left,l.left),h=Math.max(a.right,l.right),p=h-f,m=u-c,k={top:c,bottom:u,left:f,right:h,width:p,height:m,x:f,y:c};return{...k,toJSON:()=>k}}function Rx(t,e,n){var r;const{selection:i}=e;let s=null;if(dl(i)&&(s=i.$cursor),s){const a=(r=t.storedMarks)!==null&&r!==void 0?r:s.marks();return!!n.isInSet(a)||!a.some(l=>l.type.excludes(n))}const{ranges:o}=i;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(u,f,h)=>{if(c)return!1;if(u.isInline){const p=!h||h.type.allowsMarkType(n),m=!!n.isInSet(u.marks)||!u.marks.some(y=>y.type.excludes(n));c=p&&m}return!c}),c})}const $x=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:a}=s,l=Yn(t,r.schema);if(i)if(o){const c=po(r,l);n.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,f=c.$to.pos;r.doc.nodesBetween(u,f,(h,p)=>{const m=Math.max(p,u),y=Math.min(p+h.nodeSize,f);h.marks.find(k=>k.type===l)?h.marks.forEach(k=>{l===k.type&&n.addMark(m,y,l.create({...k.attrs,...e}))}):n.addMark(m,y,l.create(e))})});return Rx(r,n,l)},Lx=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),Fx=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=Pe(t,n.schema);return s.isTextblock?i().command(({commands:o})=>Yf(s,e)(n)?!0:o.clearNodes()).command(({state:o})=>Yf(s,e)(o,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},zx=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=mn(t,0,r.content.size),s=K.create(r,i);e.setSelection(s)}return!0},jx=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,o=ee.atStart(r).from,a=ee.atEnd(r).to,l=mn(i,o,a),c=mn(s,o,a),u=ee.create(r,l,c);e.setSelection(u)}return!0},Wx=t=>({state:e,dispatch:n})=>{const r=Pe(t,e.schema);return vv(r)(e,n)};function lh(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 Hx=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,c=i.extensionManager.attributes,u=mo(c,a.node().type.name,a.node().attrs);if(s instanceof K&&s.node.isBlock)return!a.parentOffset||!Rr(o,a.pos)?!1:(r&&(t&&lh(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;if(r){const f=l.parentOffset===l.parent.content.size;s instanceof ee&&e.deleteSelection();const h=a.depth===0?void 0:Ex(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=f&&h?[{type:h,attrs:u}]:void 0,m=Rr(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!m&&Rr(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(m=!0,p=h?[{type:h,attrs:u}]:void 0),m&&(e.split(e.mapping.map(a.pos),1,p),h&&!f&&!a.parentOffset&&a.parent.type!==h)){const y=e.mapping.map(a.before()),g=e.doc.resolve(y);a.node(-1).canReplaceWith(g.index(),g.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}t&&lh(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return!0},Yx=t=>({tr:e,state:n,dispatch:r,editor:i})=>{var s;const o=Pe(t,n.schema),{$from:a,$to:l}=n.selection,c=n.selection.node;if(c&&c.isBlock||a.depth<2||!a.sameParent(l))return!1;const u=a.node(-1);if(u.type!==o)return!1;const f=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==o||a.index(-2)!==a.node(-2).childCount-1)return!1;if(r){let g=A.empty;const k=a.index(-1)?1:a.index(-2)?2:3;for(let _=a.depth-k;_>=a.depth-3;_-=1)g=A.from(a.node(_).copy(g));const v=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,C=mo(f,a.node().type.name,a.node().attrs),b=((s=o.contentMatch.defaultType)===null||s===void 0?void 0:s.createAndFill(C))||void 0;g=g.append(A.from(o.createAndFill(null,b)||void 0));const E=a.before(a.depth-(k-1));e.replace(E,a.after(-v),new $(g,4-k,0));let w=-1;e.doc.nodesBetween(E,e.doc.content.size,(_,R)=>{if(w>-1)return!1;_.isTextblock&&_.content.size===0&&(w=R+1)}),w>-1&&e.setSelection(ee.near(e.doc.resolve(w))),e.scrollIntoView()}return!0}const h=l.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,l.pos);const y=h?[{type:o,attrs:p},{type:h,attrs:m}]:[{type:o,attrs:p}];if(!Rr(e.doc,a.pos,2))return!1;if(r){const{selection:g,storedMarks:k}=n,{splittableMarks:v}=i.extensionManager,C=k||g.$to.parentOffset&&g.$from.marks();if(e.split(a.pos,2,y).scrollIntoView(),!C||!r)return!0;const b=C.filter(E=>v.includes(E.type.name));e.ensureMarks(b)}return!0},pl=(t,e)=>{const n=fl(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Pn(t.doc,n.pos)&&t.join(n.pos),!0},ml=(t,e)=>{const n=fl(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Pn(t.doc,r)&&t.join(r),!0};var Ux=Object.freeze({__proto__:null,blur:$v,clearContent:Lv,clearNodes:Fv,command:zv,createParagraphNear:jv,cut:Wv,deleteCurrentNode:Hv,deleteNode:Yv,deleteRange:Uv,deleteSelection:qv,enter:Kv,exitCode:Jv,extendMarkRange:Zv,first:Xv,focus:Qv,forEach:ex,insertContent:tx,insertContentAt:ix,joinUp:sx,joinDown:ox,joinBackward:ax,joinForward:lx,joinItemBackward:cx,joinItemForward:dx,joinTextblockBackward:ux,joinTextblockForward:fx,keyboardShortcut:px,lift:mx,liftEmptyBlock:gx,liftListItem:yx,newlineInCode:bx,resetAttributes:kx,scrollIntoView:wx,selectAll:vx,selectNodeBackward:xx,selectNodeForward:Sx,selectParentNode:Mx,selectTextblockEnd:Ox,selectTextblockStart:Cx,setContent:Tx,setMark:$x,setMeta:Lx,setNode:Fx,setNodeSelection:zx,setTextSelection:jx,sinkListItem:Wx,splitBlock:Hx,splitListItem:Yx,toggleList:(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:f,splittableMarks:h}=i.extensionManager,p=Pe(t,o.schema),m=Pe(e,o.schema),{selection:y,storedMarks:g}=o,{$from:k,$to:v}=y,C=k.blockRange(v),b=g||y.$to.parentOffset&&y.$from.marks();if(!C)return!1;const E=fl(w=>oh(w.type.name,f))(y);if(C.depth>=1&&E&&C.depth-E.depth<=1){if(E.node.type===p)return c.liftListItem(m);if(oh(E.node.type.name,f)&&p.validContent(E.node.content)&&a)return l().command(()=>(s.setNodeMarkup(E.pos,p),!0)).command(()=>pl(s,p)).command(()=>ml(s,p)).run()}return!n||!b||!a?l().command(()=>u().wrapInList(p,r)?!0:c.clearNodes()).wrapInList(p,r).command(()=>pl(s,p)).command(()=>ml(s,p)).run():l().command(()=>{const w=u().wrapInList(p,r),_=b.filter(R=>h.includes(R.type.name));return s.ensureMarks(_),w?!0:c.clearNodes()}).wrapInList(p,r).command(()=>pl(s,p)).command(()=>ml(s,p)).run()},toggleMark:(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=Yn(t,r.schema);return hl(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},toggleNode:(t,e,n={})=>({state:r,commands:i})=>{const s=Pe(t,r.schema),o=Pe(e,r.schema);return qi(r,s,n)?i.setNode(o):i.setNode(s,n)},toggleWrap:(t,e={})=>({state:n,commands:r})=>{const i=Pe(t,n.schema);return qi(n,i,e)?r.lift(i):r.wrapIn(i,e)},undoInputRule:()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const o=t.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},unsetAllMarks:()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},unsetMark:(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=n,l=Yn(t,r.schema),{$from:c,empty:u,ranges:f}=a;if(!i)return!0;if(u&&o){let{from:h,to:p}=a;const m=(s=c.marks().find(g=>g.type===l))===null||s===void 0?void 0:s.attrs,y=cl(c,l,m);y&&(h=y.from,p=y.to),n.removeMark(h,p,l)}else f.forEach(h=>{n.removeMark(h.$from.pos,h.$to.pos,l)});return n.removeStoredMark(l),!0},updateAttributes:(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=ho(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(s=Pe(t,r.schema)),a==="mark"&&(o=Yn(t,r.schema)),i&&n.selection.ranges.forEach(l=>{const c=l.$from.pos,u=l.$to.pos;r.doc.nodesBetween(c,u,(f,h)=>{s&&s===f.type&&n.setNodeMarkup(h,void 0,{...f.attrs,...e}),o&&f.marks.length&&f.marks.forEach(p=>{if(o===p.type){const m=Math.max(h,c),y=Math.min(h+f.nodeSize,u);n.addMark(m,y,o.create({...p.attrs,...e}))}})})}),!0):!1},wrapIn:(t,e={})=>({state:n,dispatch:r})=>{const i=Pe(t,n.schema);return mv(i,e)(n,r)},wrapInList:(t,e={})=>({state:n,dispatch:r})=>{const i=Pe(t,n.schema);return gv(i,e)(n,r)}});const qx=Ye.create({name:"commands",addCommands(){return{...Ux}}}),Kx=Ye.create({name:"editable",addProseMirrorPlugins(){return[new Ke({key:new Pt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Jx=Ye.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ke({key:new Pt("focusEvents"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Gx=Ye.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:f}=l,{pos:h,parent:p}=f,m=f.parent.isTextblock&&h>0?a.doc.resolve(h-1):f,y=m.parent.type.spec.isolating,g=f.pos-f.parentOffset,k=y&&m.parent.childCount===1?g===f.pos:se.atStart(c).from===h;return!u||!p.type.isTextblock||p.textContent.length||!k||k&&f.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ul()||nh()?s:i},addProseMirrorPlugins(){return[new Ke({key:new Pt("clearDocument"),appendTransaction:(t,e,n)=>{if(!(t.some(m=>m.docChanged)&&!e.doc.eq(n.doc)))return;const{empty:i,from:s,to:o}=e.selection,a=se.atStart(e.doc).from,l=se.atEnd(e.doc).to;if(i||!(s===a&&o===l)||!(n.doc.textBetween(0,n.doc.content.size," "," ").length===0))return;const f=n.tr,h=io({state:n,transaction:f}),{commands:p}=new so({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),Zx=Ye.create({name:"tabindex",addProseMirrorPlugins(){return[new Ke({key:new Pt("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}});class pr{constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new pr(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new pr(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new pr(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=this.pos+r+1,o=this.resolvedPos.doc.resolve(s);if(!i&&o.depth<=this.depth)return;const a=new pr(o,this.editor,i,i?n:null);i&&(a.actualDepth=this.depth+1),e.push(new pr(o,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,o=Object.keys(n);for(let a=0;a<o.length;a+=1){const l=o[a];if(s[l]!==n[l])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(l=>n[l]===o.node.attrs[l])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,n,r))))}),i}setAttribute(e){const n=this.editor.state.selection;this.editor.chain().setTextSelection(this.from).updateAttributes(this.node.type.name,e).setTextSelection(n.from).run()}}const Xx=`.ProseMirror {
|
|
18
18
|
position: relative;
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -90,7 +90,7 @@ img.ProseMirror-separator {
|
|
|
90
90
|
opacity: 0
|
|
91
91
|
}`;function Qx(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 eS=class extends xv{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=Qx(Xx,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=qf(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?[Kx,Rv.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),qx,Jx,Gx,Zx]:[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s==null?void 0:s.type));this.extensionManager=new Kr(i,this)}createCommandManager(){this.commandManager=new so({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){const e=ih(this.options.content,this.schema,this.options.parseOptions),n=Qf(e,this.options.autofocus);this.view=new zw(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:zr.create({doc:e,selection:n||void 0})});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews(),this.prependClass();const i=this.view.dom;i.editor=this}createNodeViews(){this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(o=>{var a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.step(o)});return}const n=this.state.apply(e),r=!this.state.selection.eq(n.selection);this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),s=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),s&&this.emit("blur",{editor:this,event:s.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return Vx(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return Bx(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Nx(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
|
|
92
92
|
|
|
93
|
-
`,textSerializers:r={}}=e||{};return _x(this.state.doc,{blockSeparator:n,textSerializers:{...Xf(this.schema),...r}})}get isEmpty(){return Px(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,n))||null}$nodes(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new pr(n,this)}get $doc(){return this.$pos(0)}};function Jr(t){return new ao({find:t.find,handler:({state:e,range:n,match:r})=>{const i=oe(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),c=n.from+a.indexOf(o),u=c+o.length;if(sh(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(y=>y===t.type&&y!==p.mark.type)).filter(p=>p.to>c).length)return null;u<n.to&&s.delete(u,n.to),c>n.from&&s.delete(n.from+l,c);const h=n.from+l+o.length;s.addMark(n.from+l,h,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}function tS(t){return new ao({find:t.find,handler:({state:e,range:n,match:r})=>{const i=oe(t.getAttributes,void 0,r)||{},{tr:s}=e,o=n.from;let a=n.to;const l=t.type.create(i);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=o+c;u>a?u=a:a=u+r[1].length;const f=r[0][r[0].length-1];s.insertText(f,o+r[0].length-1),s.replaceWith(u,a,l)}else r[0]&&s.insert(o-1,t.type.create(i)).delete(s.mapping.map(o),s.mapping.map(a));s.scrollIntoView()}})}function gl(t){return new ao({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=oe(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)}})}function Ki(t){return new ao({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=oe(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),l=o.doc.resolve(n.from).blockRange(),c=l&&Ma(l,t.type,s);if(!c)return null;if(o.wrap(l,c),t.keepMarks&&t.editor){const{selection:f,storedMarks:h}=e,{splittableMarks:p}=t.editor.extensionManager,m=h||f.$to.parentOffset&&f.$from.marks();if(m){const y=m.filter(g=>p.includes(g.type.name));o.ensureMarks(y)}}if(t.keepAttributes){const f=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(f,s).run()}const u=o.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&Pn(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&o.join(n.from-1)}})}class Zt{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=oe(Y(this,"addOptions",{name:this.name}))),this.storage=oe(Y(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Zt(e)}configure(e={}){const n=this.extend();return n.options=co(this.options,e),n.storage=oe(Y(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){const n=new Zt({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=oe(Y(n,"addOptions",{name:n.name})),n.storage=oe(Y(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(c=>(c==null?void 0:c.type.name)===n.name))return!1;const l=o.find(c=>(c==null?void 0:c.type.name)===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}let pt=class vc{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=oe(Y(this,"addOptions",{name:this.name}))),this.storage=oe(Y(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new vc(e)}configure(e={}){const n=this.extend();return n.options=co(this.options,e),n.storage=oe(Y(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){const n=new vc({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=oe(Y(n,"addOptions",{name:n.name})),n.storage=oe(Y(n,"addStorage",{name:n.name,options:n.options})),n}};function Gr(t){return new Nv({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=oe(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let c=n.to;if(a){const u=l.search(/\S/),f=n.from+l.indexOf(a),h=f+a.length;if(sh(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(g=>g===t.type&&g!==m.mark.type)).filter(m=>m.to>f).length)return null;h<n.to&&o.delete(h,n.to),f>n.from&&o.delete(n.from+u,f),c=n.from+u+a.length,o.addMark(n.from+u,c,t.type.create(s||{})),o.removeStoredMark(t.type)}}})}var ot="top",St="bottom",Mt="right",at="left",yl="auto",Ji=[ot,St,Mt,at],Zr="start",Gi="end",nS="clippingParents",ch="viewport",Zi="popper",rS="reference",dh=Ji.reduce(function(t,e){return t.concat([e+"-"+Zr,e+"-"+Gi])},[]),uh=[].concat(Ji,[yl]).reduce(function(t,e){return t.concat([e,e+"-"+Zr,e+"-"+Gi])},[]),iS="beforeRead",sS="read",oS="afterRead",aS="beforeMain",lS="main",cS="afterMain",dS="beforeWrite",uS="write",fS="afterWrite",hS=[iS,sS,oS,aS,lS,cS,dS,uS,fS];function Xt(t){return t?(t.nodeName||"").toLowerCase():null}function mt(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function mr(t){var e=mt(t).Element;return t instanceof e||t instanceof Element}function Ot(t){var e=mt(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function bl(t){if(typeof ShadowRoot>"u")return!1;var e=mt(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function pS(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},i=e.attributes[n]||{},s=e.elements[n];!Ot(s)||!Xt(s)||(Object.assign(s.style,r),Object.keys(i).forEach(function(o){var a=i[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function mS(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var i=e.elements[r],s=e.attributes[r]||{},o=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),a=o.reduce(function(l,c){return l[c]="",l},{});!Ot(i)||!Xt(i)||(Object.assign(i.style,a),Object.keys(s).forEach(function(l){i.removeAttribute(l)}))})}}const fh={name:"applyStyles",enabled:!0,phase:"write",fn:pS,effect:mS,requires:["computeStyles"]};function Qt(t){return t.split("-")[0]}var gr=Math.max,go=Math.min,Xr=Math.round;function kl(){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 hh(){return!/^((?!chrome|android).)*safari/i.test(kl())}function Qr(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),i=1,s=1;e&&Ot(t)&&(i=t.offsetWidth>0&&Xr(r.width)/t.offsetWidth||1,s=t.offsetHeight>0&&Xr(r.height)/t.offsetHeight||1);var o=mr(t)?mt(t):window,a=o.visualViewport,l=!hh()&&n,c=(r.left+(l&&a?a.offsetLeft:0))/i,u=(r.top+(l&&a?a.offsetTop:0))/s,f=r.width/i,h=r.height/s;return{width:f,height:h,top:u,right:c+f,bottom:u+h,left:c,x:c,y:u}}function wl(t){var e=Qr(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function ph(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&bl(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function gn(t){return mt(t).getComputedStyle(t)}function gS(t){return["table","td","th"].indexOf(Xt(t))>=0}function Un(t){return((mr(t)?t.ownerDocument:t.document)||window.document).documentElement}function yo(t){return Xt(t)==="html"?t:t.assignedSlot||t.parentNode||(bl(t)?t.host:null)||Un(t)}function mh(t){return!Ot(t)||gn(t).position==="fixed"?null:t.offsetParent}function yS(t){var e=/firefox/i.test(kl()),n=/Trident/i.test(kl());if(n&&Ot(t)){var r=gn(t);if(r.position==="fixed")return null}var i=yo(t);for(bl(i)&&(i=i.host);Ot(i)&&["html","body"].indexOf(Xt(i))<0;){var s=gn(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function Xi(t){for(var e=mt(t),n=mh(t);n&&gS(n)&&gn(n).position==="static";)n=mh(n);return n&&(Xt(n)==="html"||Xt(n)==="body"&&gn(n).position==="static")?e:n||yS(t)||e}function vl(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Qi(t,e,n){return gr(t,go(e,n))}function bS(t,e,n){var r=Qi(t,e,n);return r>n?n:r}function gh(){return{top:0,right:0,bottom:0,left:0}}function yh(t){return Object.assign({},gh(),t)}function bh(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var kS=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,yh(typeof e!="number"?e:bh(e,Ji))};function wS(t){var e,n=t.state,r=t.name,i=t.options,s=n.elements.arrow,o=n.modifiersData.popperOffsets,a=Qt(n.placement),l=vl(a),c=[at,Mt].indexOf(a)>=0,u=c?"height":"width";if(!(!s||!o)){var f=kS(i.padding,n),h=wl(s),p=l==="y"?ot:at,m=l==="y"?St:Mt,y=n.rects.reference[u]+n.rects.reference[l]-o[l]-n.rects.popper[u],g=o[l]-n.rects.reference[l],k=Xi(s),x=k?l==="y"?k.clientHeight||0:k.clientWidth||0:0,C=y/2-g/2,b=f[p],E=x-h[u]-f[m],w=x/2-h[u]/2+C,_=Qi(b,w,E),R=l;n.modifiersData[r]=(e={},e[R]=_,e.centerOffset=_-w,e)}}function vS(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)||ph(e.elements.popper,i)&&(e.elements.arrow=i))}const xS={name:"arrow",enabled:!0,phase:"main",fn:wS,effect:vS,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ei(t){return t.split("-")[1]}var SS={top:"auto",right:"auto",bottom:"auto",left:"auto"};function MS(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 kh(t){var e,n=t.popper,r=t.popperRect,i=t.placement,s=t.variation,o=t.offsets,a=t.position,l=t.gpuAcceleration,c=t.adaptive,u=t.roundOffsets,f=t.isFixed,h=o.x,p=h===void 0?0:h,m=o.y,y=m===void 0?0:m,g=typeof u=="function"?u({x:p,y}):{x:p,y};p=g.x,y=g.y;var k=o.hasOwnProperty("x"),x=o.hasOwnProperty("y"),C=at,b=ot,E=window;if(c){var w=Xi(n),_="clientHeight",R="clientWidth";if(w===mt(n)&&(w=Un(n),gn(w).position!=="static"&&a==="absolute"&&(_="scrollHeight",R="scrollWidth")),w=w,i===ot||(i===at||i===Mt)&&s===Gi){b=St;var P=f&&w===E&&E.visualViewport?E.visualViewport.height:w[_];y-=P-r.height,y*=l?1:-1}if(i===at||(i===ot||i===St)&&s===Gi){C=Mt;var z=f&&w===E&&E.visualViewport?E.visualViewport.width:w[R];p-=z-r.width,p*=l?1:-1}}var te=Object.assign({position:a},c&&SS),D=u===!0?MS({x:p,y},mt(n)):{x:p,y};if(p=D.x,y=D.y,l){var L;return Object.assign({},te,(L={},L[b]=x?"0":"",L[C]=k?"0":"",L.transform=(E.devicePixelRatio||1)<=1?"translate("+p+"px, "+y+"px)":"translate3d("+p+"px, "+y+"px, 0)",L))}return Object.assign({},te,(e={},e[b]=x?y+"px":"",e[C]=k?p+"px":"",e.transform="",e))}function OS(t){var e=t.state,n=t.options,r=n.gpuAcceleration,i=r===void 0?!0:r,s=n.adaptive,o=s===void 0?!0:s,a=n.roundOffsets,l=a===void 0?!0:a,c={placement:Qt(e.placement),variation:ei(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,kh(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,kh(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const CS={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:OS,data:{}};var bo={passive:!0};function TS(t){var e=t.state,n=t.instance,r=t.options,i=r.scroll,s=i===void 0?!0:i,o=r.resize,a=o===void 0?!0:o,l=mt(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&c.forEach(function(u){u.addEventListener("scroll",n.update,bo)}),a&&l.addEventListener("resize",n.update,bo),function(){s&&c.forEach(function(u){u.removeEventListener("scroll",n.update,bo)}),a&&l.removeEventListener("resize",n.update,bo)}}const ES={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:TS,data:{}};var DS={left:"right",right:"left",bottom:"top",top:"bottom"};function ko(t){return t.replace(/left|right|bottom|top/g,function(e){return DS[e]})}var NS={start:"end",end:"start"};function wh(t){return t.replace(/start|end/g,function(e){return NS[e]})}function xl(t){var e=mt(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Sl(t){return Qr(Un(t)).left+xl(t).scrollLeft}function _S(t,e){var n=mt(t),r=Un(t),i=n.visualViewport,s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;var c=hh();(c||!c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a+Sl(t),y:l}}function AS(t){var e,n=Un(t),r=xl(t),i=(e=t.ownerDocument)==null?void 0:e.body,s=gr(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=gr(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-r.scrollLeft+Sl(t),l=-r.scrollTop;return gn(i||n).direction==="rtl"&&(a+=gr(n.clientWidth,i?i.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}function Ml(t){var e=gn(t),n=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function vh(t){return["html","body","#document"].indexOf(Xt(t))>=0?t.ownerDocument.body:Ot(t)&&Ml(t)?t:vh(yo(t))}function es(t,e){var n;e===void 0&&(e=[]);var r=vh(t),i=r===((n=t.ownerDocument)==null?void 0:n.body),s=mt(r),o=i?[s].concat(s.visualViewport||[],Ml(r)?r:[]):r,a=e.concat(o);return i?a:a.concat(es(yo(o)))}function Ol(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function VS(t,e){var n=Qr(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function xh(t,e,n){return e===ch?Ol(_S(t,n)):mr(e)?VS(e,n):Ol(AS(Un(t)))}function BS(t){var e=es(yo(t)),n=["absolute","fixed"].indexOf(gn(t).position)>=0,r=n&&Ot(t)?Xi(t):t;return mr(r)?e.filter(function(i){return mr(i)&&ph(i,r)&&Xt(i)!=="body"}):[]}function PS(t,e,n,r){var i=e==="clippingParents"?BS(t):[].concat(e),s=[].concat(i,[n]),o=s[0],a=s.reduce(function(l,c){var u=xh(t,c,r);return l.top=gr(u.top,l.top),l.right=go(u.right,l.right),l.bottom=go(u.bottom,l.bottom),l.left=gr(u.left,l.left),l},xh(t,o,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Sh(t){var e=t.reference,n=t.element,r=t.placement,i=r?Qt(r):null,s=r?ei(r):null,o=e.x+e.width/2-n.width/2,a=e.y+e.height/2-n.height/2,l;switch(i){case ot:l={x:o,y:e.y-n.height};break;case St:l={x:o,y:e.y+e.height};break;case Mt:l={x:e.x+e.width,y:a};break;case at:l={x:e.x-n.width,y:a};break;default:l={x:e.x,y:e.y}}var c=i?vl(i):null;if(c!=null){var u=c==="y"?"height":"width";switch(s){case Zr:l[c]=l[c]-(e[u]/2-n[u]/2);break;case Gi:l[c]=l[c]+(e[u]/2-n[u]/2);break}}return l}function ts(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=r===void 0?t.placement:r,s=n.strategy,o=s===void 0?t.strategy:s,a=n.boundary,l=a===void 0?nS:a,c=n.rootBoundary,u=c===void 0?ch:c,f=n.elementContext,h=f===void 0?Zi:f,p=n.altBoundary,m=p===void 0?!1:p,y=n.padding,g=y===void 0?0:y,k=yh(typeof g!="number"?g:bh(g,Ji)),x=h===Zi?rS:Zi,C=t.rects.popper,b=t.elements[m?x:h],E=PS(mr(b)?b:b.contextElement||Un(t.elements.popper),l,u,o),w=Qr(t.elements.reference),_=Sh({reference:w,element:C,strategy:"absolute",placement:i}),R=Ol(Object.assign({},C,_)),P=h===Zi?R:w,z={top:E.top-P.top+k.top,bottom:P.bottom-E.bottom+k.bottom,left:E.left-P.left+k.left,right:P.right-E.right+k.right},te=t.modifiersData.offset;if(h===Zi&&te){var D=te[i];Object.keys(z).forEach(function(L){var H=[Mt,St].indexOf(L)>=0?1:-1,J=[ot,St].indexOf(L)>=0?"y":"x";z[L]+=D[J]*H})}return z}function IS(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=n.boundary,s=n.rootBoundary,o=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,c=l===void 0?uh:l,u=ei(r),f=u?a?dh:dh.filter(function(m){return ei(m)===u}):Ji,h=f.filter(function(m){return c.indexOf(m)>=0});h.length===0&&(h=f);var p=h.reduce(function(m,y){return m[y]=ts(t,{placement:y,boundary:i,rootBoundary:s,padding:o})[Qt(y)],m},{});return Object.keys(p).sort(function(m,y){return p[m]-p[y]})}function RS(t){if(Qt(t)===yl)return[];var e=ko(t);return[wh(t),e,wh(e)]}function $S(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var i=n.mainAxis,s=i===void 0?!0:i,o=n.altAxis,a=o===void 0?!0:o,l=n.fallbackPlacements,c=n.padding,u=n.boundary,f=n.rootBoundary,h=n.altBoundary,p=n.flipVariations,m=p===void 0?!0:p,y=n.allowedAutoPlacements,g=e.options.placement,k=Qt(g),x=k===g,C=l||(x||!m?[ko(g)]:RS(g)),b=[g].concat(C).reduce(function(ve,et){return ve.concat(Qt(et)===yl?IS(e,{placement:et,boundary:u,rootBoundary:f,padding:c,flipVariations:m,allowedAutoPlacements:y}):et)},[]),E=e.rects.reference,w=e.rects.popper,_=new Map,R=!0,P=b[0],z=0;z<b.length;z++){var te=b[z],D=Qt(te),L=ei(te)===Zr,H=[ot,St].indexOf(D)>=0,J=H?"width":"height",T=ts(e,{placement:te,boundary:u,rootBoundary:f,altBoundary:h,padding:c}),q=H?L?Mt:at:L?St:ot;E[J]>w[J]&&(q=ko(q));var re=ko(q),De=[];if(s&&De.push(T[D]<=0),a&&De.push(T[q]<=0,T[re]<=0),De.every(function(ve){return ve})){P=te,R=!1;break}_.set(te,De)}if(R)for(var Qe=m?3:1,ct=function(et){var I=b.find(function(Q){var he=_.get(Q);if(he)return he.slice(0,et).every(function(le){return le})});if(I)return P=I,"break"},bt=Qe;bt>0;bt--){var kt=ct(bt);if(kt==="break")break}e.placement!==P&&(e.modifiersData[r]._skip=!0,e.placement=P,e.reset=!0)}}const LS={name:"flip",enabled:!0,phase:"main",fn:$S,requiresIfExists:["offset"],data:{_skip:!1}};function Mh(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 Oh(t){return[ot,Mt,St,at].some(function(e){return t[e]>=0})}function FS(t){var e=t.state,n=t.name,r=e.rects.reference,i=e.rects.popper,s=e.modifiersData.preventOverflow,o=ts(e,{elementContext:"reference"}),a=ts(e,{altBoundary:!0}),l=Mh(o,r),c=Mh(a,i,s),u=Oh(l),f=Oh(c);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:f},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":f})}const zS={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:FS};function jS(t,e,n){var r=Qt(t),i=[at,ot].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,o=s[0],a=s[1];return o=o||0,a=(a||0)*i,[at,Mt].indexOf(r)>=0?{x:a,y:o}:{x:o,y:a}}function WS(t){var e=t.state,n=t.options,r=t.name,i=n.offset,s=i===void 0?[0,0]:i,o=uh.reduce(function(u,f){return u[f]=jS(f,e.rects,s),u},{}),a=o[e.placement],l=a.x,c=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=o}const HS={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:WS};function YS(t){var e=t.state,n=t.name;e.modifiersData[n]=Sh({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const US={name:"popperOffsets",enabled:!0,phase:"read",fn:YS,data:{}};function qS(t){return t==="x"?"y":"x"}function KS(t){var e=t.state,n=t.options,r=t.name,i=n.mainAxis,s=i===void 0?!0:i,o=n.altAxis,a=o===void 0?!1:o,l=n.boundary,c=n.rootBoundary,u=n.altBoundary,f=n.padding,h=n.tether,p=h===void 0?!0:h,m=n.tetherOffset,y=m===void 0?0:m,g=ts(e,{boundary:l,rootBoundary:c,padding:f,altBoundary:u}),k=Qt(e.placement),x=ei(e.placement),C=!x,b=vl(k),E=qS(b),w=e.modifiersData.popperOffsets,_=e.rects.reference,R=e.rects.popper,P=typeof y=="function"?y(Object.assign({},e.rects,{placement:e.placement})):y,z=typeof P=="number"?{mainAxis:P,altAxis:P}:Object.assign({mainAxis:0,altAxis:0},P),te=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,D={x:0,y:0};if(w){if(s){var L,H=b==="y"?ot:at,J=b==="y"?St:Mt,T=b==="y"?"height":"width",q=w[b],re=q+g[H],De=q-g[J],Qe=p?-R[T]/2:0,ct=x===Zr?_[T]:R[T],bt=x===Zr?-R[T]:-_[T],kt=e.elements.arrow,ve=p&&kt?wl(kt):{width:0,height:0},et=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:gh(),I=et[H],Q=et[J],he=Qi(0,_[T],ve[T]),le=C?_[T]/2-Qe-he-I-z.mainAxis:ct-he-I-z.mainAxis,Re=C?-_[T]/2+Qe+he+Q+z.mainAxis:bt+he+Q+z.mainAxis,$e=e.elements.arrow&&Xi(e.elements.arrow),dt=$e?b==="y"?$e.clientTop||0:$e.clientLeft||0:0,Sr=(L=te==null?void 0:te[b])!=null?L:0,hi=q+le-Sr-dt,Zn=q+Re-Sr,Xn=Qi(p?go(re,hi):re,q,p?gr(De,Zn):De);w[b]=Xn,D[b]=Xn-q}if(a){var Tn,Wt=b==="x"?ot:at,Dt=b==="x"?St:Mt,Nt=w[E],an=E==="y"?"height":"width",En=Nt+g[Wt],ln=Nt-g[Dt],Mr=[ot,at].indexOf(k)!==-1,Qn=(Tn=te==null?void 0:te[E])!=null?Tn:0,pi=Mr?En:Nt-_[an]-R[an]-Qn+z.altAxis,mi=Mr?Nt+_[an]+R[an]-Qn-z.altAxis:ln,gi=p&&Mr?bS(pi,Nt,mi):Qi(p?pi:En,Nt,p?mi:ln);w[E]=gi,D[E]=gi-Nt}e.modifiersData[r]=D}}const JS={name:"preventOverflow",enabled:!0,phase:"main",fn:KS,requiresIfExists:["offset"]};function GS(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function ZS(t){return t===mt(t)||!Ot(t)?xl(t):GS(t)}function XS(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 QS(t,e,n){n===void 0&&(n=!1);var r=Ot(e),i=Ot(e)&&XS(e),s=Un(e),o=Qr(t,i,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((Xt(e)!=="body"||Ml(s))&&(a=ZS(e)),Ot(e)?(l=Qr(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=Sl(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function eM(t){var e=new Map,n=new Set,r=[];t.forEach(function(s){e.set(s.name,s)});function i(s){n.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(a){if(!n.has(a)){var l=e.get(a);l&&i(l)}}),r.push(s)}return t.forEach(function(s){n.has(s.name)||i(s)}),r}function tM(t){var e=eM(t);return hS.reduce(function(n,r){return n.concat(e.filter(function(i){return i.phase===r}))},[])}function nM(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function rM(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 Ch={placement:"bottom",modifiers:[],strategy:"absolute"};function Th(){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 iM(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,i=e.defaultOptions,s=i===void 0?Ch:i;return function(a,l,c){c===void 0&&(c=s);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},Ch,s),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},f=[],h=!1,p={state:u,setOptions:function(k){var x=typeof k=="function"?k(u.options):k;y(),u.options=Object.assign({},s,u.options,x),u.scrollParents={reference:mr(a)?es(a):a.contextElement?es(a.contextElement):[],popper:es(l)};var C=tM(rM([].concat(r,u.options.modifiers)));return u.orderedModifiers=C.filter(function(b){return b.enabled}),m(),p.update()},forceUpdate:function(){if(!h){var k=u.elements,x=k.reference,C=k.popper;if(Th(x,C)){u.rects={reference:QS(x,Xi(C),u.options.strategy==="fixed"),popper:wl(C)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(z){return u.modifiersData[z.name]=Object.assign({},z.data)});for(var b=0;b<u.orderedModifiers.length;b++){if(u.reset===!0){u.reset=!1,b=-1;continue}var E=u.orderedModifiers[b],w=E.fn,_=E.options,R=_===void 0?{}:_,P=E.name;typeof w=="function"&&(u=w({state:u,options:R,name:P,instance:p})||u)}}}},update:nM(function(){return new Promise(function(g){p.forceUpdate(),g(u)})}),destroy:function(){y(),h=!0}};if(!Th(a,l))return p;p.setOptions(c).then(function(g){!h&&c.onFirstUpdate&&c.onFirstUpdate(g)});function m(){u.orderedModifiers.forEach(function(g){var k=g.name,x=g.options,C=x===void 0?{}:x,b=g.effect;if(typeof b=="function"){var E=b({state:u,name:k,instance:p,options:C}),w=function(){};f.push(E||w)}})}function y(){f.forEach(function(g){return g()}),f=[]}return p}}var sM=[ES,US,CS,fh,HS,LS,JS,xS,zS],oM=iM({defaultModifiers:sM}),aM="tippy-box",Eh="tippy-content",lM="tippy-backdrop",Dh="tippy-arrow",Nh="tippy-svg-arrow",yr={passive:!0,capture:!0},_h=function(){return document.body};function cM(t,e){return{}.hasOwnProperty.call(t,e)}function Cl(t,e,n){if(Array.isArray(t)){var r=t[e];return r??(Array.isArray(n)?n[e]:n)}return t}function Tl(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function Ah(t,e){return typeof t=="function"?t.apply(void 0,e):t}function Vh(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function dM(t,e){var n=Object.assign({},t);return e.forEach(function(r){delete n[r]}),n}function uM(t){return t.split(/\s+/).filter(Boolean)}function ti(t){return[].concat(t)}function Bh(t,e){t.indexOf(e)===-1&&t.push(e)}function fM(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function hM(t){return t.split("-")[0]}function wo(t){return[].slice.call(t)}function Ph(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function ns(){return document.createElement("div")}function rs(t){return["Element","Fragment"].some(function(e){return Tl(t,e)})}function pM(t){return Tl(t,"NodeList")}function mM(t){return Tl(t,"MouseEvent")}function gM(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function yM(t){return rs(t)?[t]:pM(t)?wo(t):Array.isArray(t)?t:wo(document.querySelectorAll(t))}function El(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function Ih(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function bM(t){var e,n=ti(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function kM(t,e){var n=e.clientX,r=e.clientY;return t.every(function(i){var s=i.popperRect,o=i.popperState,a=i.props,l=a.interactiveBorder,c=hM(o.placement),u=o.modifiersData.offset;if(!u)return!0;var f=c==="bottom"?u.top.y:0,h=c==="top"?u.bottom.y:0,p=c==="right"?u.left.x:0,m=c==="left"?u.right.x:0,y=s.top-r+f>l,g=r-s.bottom-h>l,k=s.left-n+p>l,x=n-s.right-m>l;return y||g||k||x})}function Dl(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){t[r](i,n)})}function Rh(t,e){for(var n=e;n;){var r;if(t.contains(n))return!0;n=n.getRootNode==null||(r=n.getRootNode())==null?void 0:r.host}return!1}var en={isTouch:!1},$h=0;function wM(){en.isTouch||(en.isTouch=!0,window.performance&&document.addEventListener("mousemove",Lh))}function Lh(){var t=performance.now();t-$h<20&&(en.isTouch=!1,document.removeEventListener("mousemove",Lh)),$h=t}function vM(){var t=document.activeElement;if(gM(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function xM(){document.addEventListener("touchstart",wM,yr),window.addEventListener("blur",vM)}var SM=typeof window<"u"&&typeof document<"u",MM=SM?!!window.msCrypto:!1;function ni(t){var e=t==="destroy"?"n already-":" ";return[t+"() was called on a"+e+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function Fh(t){var e=/[ \t]{2,}/g,n=/^[ \t]*/gm;return t.replace(e," ").replace(n,"").trim()}function OM(t){return Fh(`
|
|
93
|
+
`,textSerializers:r={}}=e||{};return _x(this.state.doc,{blockSeparator:n,textSerializers:{...Xf(this.schema),...r}})}get isEmpty(){return Px(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,n))||null}$nodes(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new pr(n,this)}get $doc(){return this.$pos(0)}};function Jr(t){return new ao({find:t.find,handler:({state:e,range:n,match:r})=>{const i=oe(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),c=n.from+a.indexOf(o),u=c+o.length;if(sh(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(y=>y===t.type&&y!==p.mark.type)).filter(p=>p.to>c).length)return null;u<n.to&&s.delete(u,n.to),c>n.from&&s.delete(n.from+l,c);const h=n.from+l+o.length;s.addMark(n.from+l,h,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}function tS(t){return new ao({find:t.find,handler:({state:e,range:n,match:r})=>{const i=oe(t.getAttributes,void 0,r)||{},{tr:s}=e,o=n.from;let a=n.to;const l=t.type.create(i);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=o+c;u>a?u=a:a=u+r[1].length;const f=r[0][r[0].length-1];s.insertText(f,o+r[0].length-1),s.replaceWith(u,a,l)}else r[0]&&s.insert(o-1,t.type.create(i)).delete(s.mapping.map(o),s.mapping.map(a));s.scrollIntoView()}})}function gl(t){return new ao({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=oe(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)}})}function Ki(t){return new ao({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=oe(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),l=o.doc.resolve(n.from).blockRange(),c=l&&Ma(l,t.type,s);if(!c)return null;if(o.wrap(l,c),t.keepMarks&&t.editor){const{selection:f,storedMarks:h}=e,{splittableMarks:p}=t.editor.extensionManager,m=h||f.$to.parentOffset&&f.$from.marks();if(m){const y=m.filter(g=>p.includes(g.type.name));o.ensureMarks(y)}}if(t.keepAttributes){const f=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(f,s).run()}const u=o.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&Pn(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&o.join(n.from-1)}})}class Zt{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=oe(Y(this,"addOptions",{name:this.name}))),this.storage=oe(Y(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Zt(e)}configure(e={}){const n=this.extend();return n.options=co(this.options,e),n.storage=oe(Y(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){const n=new Zt({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=oe(Y(n,"addOptions",{name:n.name})),n.storage=oe(Y(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(c=>(c==null?void 0:c.type.name)===n.name))return!1;const l=o.find(c=>(c==null?void 0:c.type.name)===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}let pt=class vc{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=oe(Y(this,"addOptions",{name:this.name}))),this.storage=oe(Y(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new vc(e)}configure(e={}){const n=this.extend();return n.options=co(this.options,e),n.storage=oe(Y(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){const n=new vc({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=oe(Y(n,"addOptions",{name:n.name})),n.storage=oe(Y(n,"addStorage",{name:n.name,options:n.options})),n}};function Gr(t){return new Nv({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=oe(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let c=n.to;if(a){const u=l.search(/\S/),f=n.from+l.indexOf(a),h=f+a.length;if(sh(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(g=>g===t.type&&g!==m.mark.type)).filter(m=>m.to>f).length)return null;h<n.to&&o.delete(h,n.to),f>n.from&&o.delete(n.from+u,f),c=n.from+u+a.length,o.addMark(n.from+u,c,t.type.create(s||{})),o.removeStoredMark(t.type)}}})}var ot="top",St="bottom",Mt="right",at="left",yl="auto",Ji=[ot,St,Mt,at],Zr="start",Gi="end",nS="clippingParents",ch="viewport",Zi="popper",rS="reference",dh=Ji.reduce(function(t,e){return t.concat([e+"-"+Zr,e+"-"+Gi])},[]),uh=[].concat(Ji,[yl]).reduce(function(t,e){return t.concat([e,e+"-"+Zr,e+"-"+Gi])},[]),iS="beforeRead",sS="read",oS="afterRead",aS="beforeMain",lS="main",cS="afterMain",dS="beforeWrite",uS="write",fS="afterWrite",hS=[iS,sS,oS,aS,lS,cS,dS,uS,fS];function Xt(t){return t?(t.nodeName||"").toLowerCase():null}function mt(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function mr(t){var e=mt(t).Element;return t instanceof e||t instanceof Element}function Ot(t){var e=mt(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function bl(t){if(typeof ShadowRoot>"u")return!1;var e=mt(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function pS(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},i=e.attributes[n]||{},s=e.elements[n];!Ot(s)||!Xt(s)||(Object.assign(s.style,r),Object.keys(i).forEach(function(o){var a=i[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function mS(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var i=e.elements[r],s=e.attributes[r]||{},o=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),a=o.reduce(function(l,c){return l[c]="",l},{});!Ot(i)||!Xt(i)||(Object.assign(i.style,a),Object.keys(s).forEach(function(l){i.removeAttribute(l)}))})}}const fh={name:"applyStyles",enabled:!0,phase:"write",fn:pS,effect:mS,requires:["computeStyles"]};function Qt(t){return t.split("-")[0]}var gr=Math.max,go=Math.min,Xr=Math.round;function kl(){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 hh(){return!/^((?!chrome|android).)*safari/i.test(kl())}function Qr(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),i=1,s=1;e&&Ot(t)&&(i=t.offsetWidth>0&&Xr(r.width)/t.offsetWidth||1,s=t.offsetHeight>0&&Xr(r.height)/t.offsetHeight||1);var o=mr(t)?mt(t):window,a=o.visualViewport,l=!hh()&&n,c=(r.left+(l&&a?a.offsetLeft:0))/i,u=(r.top+(l&&a?a.offsetTop:0))/s,f=r.width/i,h=r.height/s;return{width:f,height:h,top:u,right:c+f,bottom:u+h,left:c,x:c,y:u}}function wl(t){var e=Qr(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function ph(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&bl(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function gn(t){return mt(t).getComputedStyle(t)}function gS(t){return["table","td","th"].indexOf(Xt(t))>=0}function Un(t){return((mr(t)?t.ownerDocument:t.document)||window.document).documentElement}function yo(t){return Xt(t)==="html"?t:t.assignedSlot||t.parentNode||(bl(t)?t.host:null)||Un(t)}function mh(t){return!Ot(t)||gn(t).position==="fixed"?null:t.offsetParent}function yS(t){var e=/firefox/i.test(kl()),n=/Trident/i.test(kl());if(n&&Ot(t)){var r=gn(t);if(r.position==="fixed")return null}var i=yo(t);for(bl(i)&&(i=i.host);Ot(i)&&["html","body"].indexOf(Xt(i))<0;){var s=gn(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function Xi(t){for(var e=mt(t),n=mh(t);n&&gS(n)&&gn(n).position==="static";)n=mh(n);return n&&(Xt(n)==="html"||Xt(n)==="body"&&gn(n).position==="static")?e:n||yS(t)||e}function vl(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Qi(t,e,n){return gr(t,go(e,n))}function bS(t,e,n){var r=Qi(t,e,n);return r>n?n:r}function gh(){return{top:0,right:0,bottom:0,left:0}}function yh(t){return Object.assign({},gh(),t)}function bh(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var kS=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,yh(typeof e!="number"?e:bh(e,Ji))};function wS(t){var e,n=t.state,r=t.name,i=t.options,s=n.elements.arrow,o=n.modifiersData.popperOffsets,a=Qt(n.placement),l=vl(a),c=[at,Mt].indexOf(a)>=0,u=c?"height":"width";if(!(!s||!o)){var f=kS(i.padding,n),h=wl(s),p=l==="y"?ot:at,m=l==="y"?St:Mt,y=n.rects.reference[u]+n.rects.reference[l]-o[l]-n.rects.popper[u],g=o[l]-n.rects.reference[l],k=Xi(s),v=k?l==="y"?k.clientHeight||0:k.clientWidth||0:0,C=y/2-g/2,b=f[p],E=v-h[u]-f[m],w=v/2-h[u]/2+C,_=Qi(b,w,E),R=l;n.modifiersData[r]=(e={},e[R]=_,e.centerOffset=_-w,e)}}function vS(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)||ph(e.elements.popper,i)&&(e.elements.arrow=i))}const xS={name:"arrow",enabled:!0,phase:"main",fn:wS,effect:vS,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ei(t){return t.split("-")[1]}var SS={top:"auto",right:"auto",bottom:"auto",left:"auto"};function MS(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 kh(t){var e,n=t.popper,r=t.popperRect,i=t.placement,s=t.variation,o=t.offsets,a=t.position,l=t.gpuAcceleration,c=t.adaptive,u=t.roundOffsets,f=t.isFixed,h=o.x,p=h===void 0?0:h,m=o.y,y=m===void 0?0:m,g=typeof u=="function"?u({x:p,y}):{x:p,y};p=g.x,y=g.y;var k=o.hasOwnProperty("x"),v=o.hasOwnProperty("y"),C=at,b=ot,E=window;if(c){var w=Xi(n),_="clientHeight",R="clientWidth";if(w===mt(n)&&(w=Un(n),gn(w).position!=="static"&&a==="absolute"&&(_="scrollHeight",R="scrollWidth")),w=w,i===ot||(i===at||i===Mt)&&s===Gi){b=St;var P=f&&w===E&&E.visualViewport?E.visualViewport.height:w[_];y-=P-r.height,y*=l?1:-1}if(i===at||(i===ot||i===St)&&s===Gi){C=Mt;var z=f&&w===E&&E.visualViewport?E.visualViewport.width:w[R];p-=z-r.width,p*=l?1:-1}}var te=Object.assign({position:a},c&&SS),D=u===!0?MS({x:p,y},mt(n)):{x:p,y};if(p=D.x,y=D.y,l){var L;return Object.assign({},te,(L={},L[b]=v?"0":"",L[C]=k?"0":"",L.transform=(E.devicePixelRatio||1)<=1?"translate("+p+"px, "+y+"px)":"translate3d("+p+"px, "+y+"px, 0)",L))}return Object.assign({},te,(e={},e[b]=v?y+"px":"",e[C]=k?p+"px":"",e.transform="",e))}function OS(t){var e=t.state,n=t.options,r=n.gpuAcceleration,i=r===void 0?!0:r,s=n.adaptive,o=s===void 0?!0:s,a=n.roundOffsets,l=a===void 0?!0:a,c={placement:Qt(e.placement),variation:ei(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,kh(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,kh(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const CS={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:OS,data:{}};var bo={passive:!0};function TS(t){var e=t.state,n=t.instance,r=t.options,i=r.scroll,s=i===void 0?!0:i,o=r.resize,a=o===void 0?!0:o,l=mt(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&c.forEach(function(u){u.addEventListener("scroll",n.update,bo)}),a&&l.addEventListener("resize",n.update,bo),function(){s&&c.forEach(function(u){u.removeEventListener("scroll",n.update,bo)}),a&&l.removeEventListener("resize",n.update,bo)}}const ES={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:TS,data:{}};var DS={left:"right",right:"left",bottom:"top",top:"bottom"};function ko(t){return t.replace(/left|right|bottom|top/g,function(e){return DS[e]})}var NS={start:"end",end:"start"};function wh(t){return t.replace(/start|end/g,function(e){return NS[e]})}function xl(t){var e=mt(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Sl(t){return Qr(Un(t)).left+xl(t).scrollLeft}function _S(t,e){var n=mt(t),r=Un(t),i=n.visualViewport,s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;var c=hh();(c||!c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a+Sl(t),y:l}}function AS(t){var e,n=Un(t),r=xl(t),i=(e=t.ownerDocument)==null?void 0:e.body,s=gr(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=gr(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-r.scrollLeft+Sl(t),l=-r.scrollTop;return gn(i||n).direction==="rtl"&&(a+=gr(n.clientWidth,i?i.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}function Ml(t){var e=gn(t),n=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function vh(t){return["html","body","#document"].indexOf(Xt(t))>=0?t.ownerDocument.body:Ot(t)&&Ml(t)?t:vh(yo(t))}function es(t,e){var n;e===void 0&&(e=[]);var r=vh(t),i=r===((n=t.ownerDocument)==null?void 0:n.body),s=mt(r),o=i?[s].concat(s.visualViewport||[],Ml(r)?r:[]):r,a=e.concat(o);return i?a:a.concat(es(yo(o)))}function Ol(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function VS(t,e){var n=Qr(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function xh(t,e,n){return e===ch?Ol(_S(t,n)):mr(e)?VS(e,n):Ol(AS(Un(t)))}function BS(t){var e=es(yo(t)),n=["absolute","fixed"].indexOf(gn(t).position)>=0,r=n&&Ot(t)?Xi(t):t;return mr(r)?e.filter(function(i){return mr(i)&&ph(i,r)&&Xt(i)!=="body"}):[]}function PS(t,e,n,r){var i=e==="clippingParents"?BS(t):[].concat(e),s=[].concat(i,[n]),o=s[0],a=s.reduce(function(l,c){var u=xh(t,c,r);return l.top=gr(u.top,l.top),l.right=go(u.right,l.right),l.bottom=go(u.bottom,l.bottom),l.left=gr(u.left,l.left),l},xh(t,o,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Sh(t){var e=t.reference,n=t.element,r=t.placement,i=r?Qt(r):null,s=r?ei(r):null,o=e.x+e.width/2-n.width/2,a=e.y+e.height/2-n.height/2,l;switch(i){case ot:l={x:o,y:e.y-n.height};break;case St:l={x:o,y:e.y+e.height};break;case Mt:l={x:e.x+e.width,y:a};break;case at:l={x:e.x-n.width,y:a};break;default:l={x:e.x,y:e.y}}var c=i?vl(i):null;if(c!=null){var u=c==="y"?"height":"width";switch(s){case Zr:l[c]=l[c]-(e[u]/2-n[u]/2);break;case Gi:l[c]=l[c]+(e[u]/2-n[u]/2);break}}return l}function ts(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=r===void 0?t.placement:r,s=n.strategy,o=s===void 0?t.strategy:s,a=n.boundary,l=a===void 0?nS:a,c=n.rootBoundary,u=c===void 0?ch:c,f=n.elementContext,h=f===void 0?Zi:f,p=n.altBoundary,m=p===void 0?!1:p,y=n.padding,g=y===void 0?0:y,k=yh(typeof g!="number"?g:bh(g,Ji)),v=h===Zi?rS:Zi,C=t.rects.popper,b=t.elements[m?v:h],E=PS(mr(b)?b:b.contextElement||Un(t.elements.popper),l,u,o),w=Qr(t.elements.reference),_=Sh({reference:w,element:C,strategy:"absolute",placement:i}),R=Ol(Object.assign({},C,_)),P=h===Zi?R:w,z={top:E.top-P.top+k.top,bottom:P.bottom-E.bottom+k.bottom,left:E.left-P.left+k.left,right:P.right-E.right+k.right},te=t.modifiersData.offset;if(h===Zi&&te){var D=te[i];Object.keys(z).forEach(function(L){var H=[Mt,St].indexOf(L)>=0?1:-1,J=[ot,St].indexOf(L)>=0?"y":"x";z[L]+=D[J]*H})}return z}function IS(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=n.boundary,s=n.rootBoundary,o=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,c=l===void 0?uh:l,u=ei(r),f=u?a?dh:dh.filter(function(m){return ei(m)===u}):Ji,h=f.filter(function(m){return c.indexOf(m)>=0});h.length===0&&(h=f);var p=h.reduce(function(m,y){return m[y]=ts(t,{placement:y,boundary:i,rootBoundary:s,padding:o})[Qt(y)],m},{});return Object.keys(p).sort(function(m,y){return p[m]-p[y]})}function RS(t){if(Qt(t)===yl)return[];var e=ko(t);return[wh(t),e,wh(e)]}function $S(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var i=n.mainAxis,s=i===void 0?!0:i,o=n.altAxis,a=o===void 0?!0:o,l=n.fallbackPlacements,c=n.padding,u=n.boundary,f=n.rootBoundary,h=n.altBoundary,p=n.flipVariations,m=p===void 0?!0:p,y=n.allowedAutoPlacements,g=e.options.placement,k=Qt(g),v=k===g,C=l||(v||!m?[ko(g)]:RS(g)),b=[g].concat(C).reduce(function(ve,et){return ve.concat(Qt(et)===yl?IS(e,{placement:et,boundary:u,rootBoundary:f,padding:c,flipVariations:m,allowedAutoPlacements:y}):et)},[]),E=e.rects.reference,w=e.rects.popper,_=new Map,R=!0,P=b[0],z=0;z<b.length;z++){var te=b[z],D=Qt(te),L=ei(te)===Zr,H=[ot,St].indexOf(D)>=0,J=H?"width":"height",T=ts(e,{placement:te,boundary:u,rootBoundary:f,altBoundary:h,padding:c}),q=H?L?Mt:at:L?St:ot;E[J]>w[J]&&(q=ko(q));var re=ko(q),De=[];if(s&&De.push(T[D]<=0),a&&De.push(T[q]<=0,T[re]<=0),De.every(function(ve){return ve})){P=te,R=!1;break}_.set(te,De)}if(R)for(var Qe=m?3:1,ct=function(et){var I=b.find(function(Q){var he=_.get(Q);if(he)return he.slice(0,et).every(function(le){return le})});if(I)return P=I,"break"},bt=Qe;bt>0;bt--){var kt=ct(bt);if(kt==="break")break}e.placement!==P&&(e.modifiersData[r]._skip=!0,e.placement=P,e.reset=!0)}}const LS={name:"flip",enabled:!0,phase:"main",fn:$S,requiresIfExists:["offset"],data:{_skip:!1}};function Mh(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 Oh(t){return[ot,Mt,St,at].some(function(e){return t[e]>=0})}function FS(t){var e=t.state,n=t.name,r=e.rects.reference,i=e.rects.popper,s=e.modifiersData.preventOverflow,o=ts(e,{elementContext:"reference"}),a=ts(e,{altBoundary:!0}),l=Mh(o,r),c=Mh(a,i,s),u=Oh(l),f=Oh(c);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:f},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":f})}const zS={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:FS};function jS(t,e,n){var r=Qt(t),i=[at,ot].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,o=s[0],a=s[1];return o=o||0,a=(a||0)*i,[at,Mt].indexOf(r)>=0?{x:a,y:o}:{x:o,y:a}}function WS(t){var e=t.state,n=t.options,r=t.name,i=n.offset,s=i===void 0?[0,0]:i,o=uh.reduce(function(u,f){return u[f]=jS(f,e.rects,s),u},{}),a=o[e.placement],l=a.x,c=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=o}const HS={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:WS};function YS(t){var e=t.state,n=t.name;e.modifiersData[n]=Sh({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const US={name:"popperOffsets",enabled:!0,phase:"read",fn:YS,data:{}};function qS(t){return t==="x"?"y":"x"}function KS(t){var e=t.state,n=t.options,r=t.name,i=n.mainAxis,s=i===void 0?!0:i,o=n.altAxis,a=o===void 0?!1:o,l=n.boundary,c=n.rootBoundary,u=n.altBoundary,f=n.padding,h=n.tether,p=h===void 0?!0:h,m=n.tetherOffset,y=m===void 0?0:m,g=ts(e,{boundary:l,rootBoundary:c,padding:f,altBoundary:u}),k=Qt(e.placement),v=ei(e.placement),C=!v,b=vl(k),E=qS(b),w=e.modifiersData.popperOffsets,_=e.rects.reference,R=e.rects.popper,P=typeof y=="function"?y(Object.assign({},e.rects,{placement:e.placement})):y,z=typeof P=="number"?{mainAxis:P,altAxis:P}:Object.assign({mainAxis:0,altAxis:0},P),te=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,D={x:0,y:0};if(w){if(s){var L,H=b==="y"?ot:at,J=b==="y"?St:Mt,T=b==="y"?"height":"width",q=w[b],re=q+g[H],De=q-g[J],Qe=p?-R[T]/2:0,ct=v===Zr?_[T]:R[T],bt=v===Zr?-R[T]:-_[T],kt=e.elements.arrow,ve=p&&kt?wl(kt):{width:0,height:0},et=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:gh(),I=et[H],Q=et[J],he=Qi(0,_[T],ve[T]),le=C?_[T]/2-Qe-he-I-z.mainAxis:ct-he-I-z.mainAxis,Re=C?-_[T]/2+Qe+he+Q+z.mainAxis:bt+he+Q+z.mainAxis,$e=e.elements.arrow&&Xi(e.elements.arrow),dt=$e?b==="y"?$e.clientTop||0:$e.clientLeft||0:0,Sr=(L=te==null?void 0:te[b])!=null?L:0,hi=q+le-Sr-dt,Zn=q+Re-Sr,Xn=Qi(p?go(re,hi):re,q,p?gr(De,Zn):De);w[b]=Xn,D[b]=Xn-q}if(a){var Tn,Wt=b==="x"?ot:at,Dt=b==="x"?St:Mt,Nt=w[E],an=E==="y"?"height":"width",En=Nt+g[Wt],ln=Nt-g[Dt],Mr=[ot,at].indexOf(k)!==-1,Qn=(Tn=te==null?void 0:te[E])!=null?Tn:0,pi=Mr?En:Nt-_[an]-R[an]-Qn+z.altAxis,mi=Mr?Nt+_[an]+R[an]-Qn-z.altAxis:ln,gi=p&&Mr?bS(pi,Nt,mi):Qi(p?pi:En,Nt,p?mi:ln);w[E]=gi,D[E]=gi-Nt}e.modifiersData[r]=D}}const JS={name:"preventOverflow",enabled:!0,phase:"main",fn:KS,requiresIfExists:["offset"]};function GS(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function ZS(t){return t===mt(t)||!Ot(t)?xl(t):GS(t)}function XS(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 QS(t,e,n){n===void 0&&(n=!1);var r=Ot(e),i=Ot(e)&&XS(e),s=Un(e),o=Qr(t,i,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((Xt(e)!=="body"||Ml(s))&&(a=ZS(e)),Ot(e)?(l=Qr(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=Sl(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function eM(t){var e=new Map,n=new Set,r=[];t.forEach(function(s){e.set(s.name,s)});function i(s){n.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(a){if(!n.has(a)){var l=e.get(a);l&&i(l)}}),r.push(s)}return t.forEach(function(s){n.has(s.name)||i(s)}),r}function tM(t){var e=eM(t);return hS.reduce(function(n,r){return n.concat(e.filter(function(i){return i.phase===r}))},[])}function nM(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function rM(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 Ch={placement:"bottom",modifiers:[],strategy:"absolute"};function Th(){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 iM(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,i=e.defaultOptions,s=i===void 0?Ch:i;return function(a,l,c){c===void 0&&(c=s);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},Ch,s),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},f=[],h=!1,p={state:u,setOptions:function(k){var v=typeof k=="function"?k(u.options):k;y(),u.options=Object.assign({},s,u.options,v),u.scrollParents={reference:mr(a)?es(a):a.contextElement?es(a.contextElement):[],popper:es(l)};var C=tM(rM([].concat(r,u.options.modifiers)));return u.orderedModifiers=C.filter(function(b){return b.enabled}),m(),p.update()},forceUpdate:function(){if(!h){var k=u.elements,v=k.reference,C=k.popper;if(Th(v,C)){u.rects={reference:QS(v,Xi(C),u.options.strategy==="fixed"),popper:wl(C)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(z){return u.modifiersData[z.name]=Object.assign({},z.data)});for(var b=0;b<u.orderedModifiers.length;b++){if(u.reset===!0){u.reset=!1,b=-1;continue}var E=u.orderedModifiers[b],w=E.fn,_=E.options,R=_===void 0?{}:_,P=E.name;typeof w=="function"&&(u=w({state:u,options:R,name:P,instance:p})||u)}}}},update:nM(function(){return new Promise(function(g){p.forceUpdate(),g(u)})}),destroy:function(){y(),h=!0}};if(!Th(a,l))return p;p.setOptions(c).then(function(g){!h&&c.onFirstUpdate&&c.onFirstUpdate(g)});function m(){u.orderedModifiers.forEach(function(g){var k=g.name,v=g.options,C=v===void 0?{}:v,b=g.effect;if(typeof b=="function"){var E=b({state:u,name:k,instance:p,options:C}),w=function(){};f.push(E||w)}})}function y(){f.forEach(function(g){return g()}),f=[]}return p}}var sM=[ES,US,CS,fh,HS,LS,JS,xS,zS],oM=iM({defaultModifiers:sM}),aM="tippy-box",Eh="tippy-content",lM="tippy-backdrop",Dh="tippy-arrow",Nh="tippy-svg-arrow",yr={passive:!0,capture:!0},_h=function(){return document.body};function cM(t,e){return{}.hasOwnProperty.call(t,e)}function Cl(t,e,n){if(Array.isArray(t)){var r=t[e];return r??(Array.isArray(n)?n[e]:n)}return t}function Tl(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function Ah(t,e){return typeof t=="function"?t.apply(void 0,e):t}function Vh(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function dM(t,e){var n=Object.assign({},t);return e.forEach(function(r){delete n[r]}),n}function uM(t){return t.split(/\s+/).filter(Boolean)}function ti(t){return[].concat(t)}function Bh(t,e){t.indexOf(e)===-1&&t.push(e)}function fM(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function hM(t){return t.split("-")[0]}function wo(t){return[].slice.call(t)}function Ph(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function ns(){return document.createElement("div")}function rs(t){return["Element","Fragment"].some(function(e){return Tl(t,e)})}function pM(t){return Tl(t,"NodeList")}function mM(t){return Tl(t,"MouseEvent")}function gM(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function yM(t){return rs(t)?[t]:pM(t)?wo(t):Array.isArray(t)?t:wo(document.querySelectorAll(t))}function El(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function Ih(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function bM(t){var e,n=ti(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function kM(t,e){var n=e.clientX,r=e.clientY;return t.every(function(i){var s=i.popperRect,o=i.popperState,a=i.props,l=a.interactiveBorder,c=hM(o.placement),u=o.modifiersData.offset;if(!u)return!0;var f=c==="bottom"?u.top.y:0,h=c==="top"?u.bottom.y:0,p=c==="right"?u.left.x:0,m=c==="left"?u.right.x:0,y=s.top-r+f>l,g=r-s.bottom-h>l,k=s.left-n+p>l,v=n-s.right-m>l;return y||g||k||v})}function Dl(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){t[r](i,n)})}function Rh(t,e){for(var n=e;n;){var r;if(t.contains(n))return!0;n=n.getRootNode==null||(r=n.getRootNode())==null?void 0:r.host}return!1}var en={isTouch:!1},$h=0;function wM(){en.isTouch||(en.isTouch=!0,window.performance&&document.addEventListener("mousemove",Lh))}function Lh(){var t=performance.now();t-$h<20&&(en.isTouch=!1,document.removeEventListener("mousemove",Lh)),$h=t}function vM(){var t=document.activeElement;if(gM(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function xM(){document.addEventListener("touchstart",wM,yr),window.addEventListener("blur",vM)}var SM=typeof window<"u"&&typeof document<"u",MM=SM?!!window.msCrypto:!1;function ni(t){var e=t==="destroy"?"n already-":" ";return[t+"() was called on a"+e+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function Fh(t){var e=/[ \t]{2,}/g,n=/^[ \t]*/gm;return t.replace(e," ").replace(n,"").trim()}function OM(t){return Fh(`
|
|
94
94
|
%ctippy.js
|
|
95
95
|
|
|
96
96
|
%c`+Fh(t)+`
|
|
@@ -99,22 +99,22 @@ img.ProseMirror-separator {
|
|
|
99
99
|
`)}function zh(t){return[OM(t),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var is;process.env.NODE_ENV!=="production"&&CM();function CM(){is=new Set}function yn(t,e){if(t&&!is.has(e)){var n;is.add(e),(n=console).warn.apply(n,zh(e))}}function Nl(t,e){if(t&&!is.has(e)){var n;is.add(e),(n=console).error.apply(n,zh(e))}}function TM(t){var e=!t,n=Object.prototype.toString.call(t)==="[object Object]"&&!t.addEventListener;Nl(e,["tippy() was passed","`"+String(t)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),Nl(n,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var jh={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},EM={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},gt=Object.assign({appendTo:_h,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},jh,EM),DM=Object.keys(gt),NM=function(e){process.env.NODE_ENV!=="production"&&Yh(e,[]);var n=Object.keys(e);n.forEach(function(r){gt[r]=e[r]})};function Wh(t){var e=t.plugins||[],n=e.reduce(function(r,i){var s=i.name,o=i.defaultValue;if(s){var a;r[s]=t[s]!==void 0?t[s]:(a=gt[s])!=null?a:o}return r},{});return Object.assign({},t,n)}function _M(t,e){var n=e?Object.keys(Wh(Object.assign({},gt,{plugins:e}))):DM,r=n.reduce(function(i,s){var o=(t.getAttribute("data-tippy-"+s)||"").trim();if(!o)return i;if(s==="content")i[s]=o;else try{i[s]=JSON.parse(o)}catch{i[s]=o}return i},{});return r}function Hh(t,e){var n=Object.assign({},e,{content:Ah(e.content,[t])},e.ignoreAttributes?{}:_M(t,e.plugins));return n.aria=Object.assign({},gt.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?e.interactive:n.aria.expanded,content:n.aria.content==="auto"?e.interactive?null:"describedby":n.aria.content},n}function Yh(t,e){t===void 0&&(t={}),e===void 0&&(e=[]);var n=Object.keys(t);n.forEach(function(r){var i=dM(gt,Object.keys(jh)),s=!cM(i,r);s&&(s=e.filter(function(o){return o.name===r}).length===0),yn(s,["`"+r+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.",`
|
|
100
100
|
|
|
101
101
|
`,`All props: https://atomiks.github.io/tippyjs/v6/all-props/
|
|
102
|
-
`,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var AM=function(){return"innerHTML"};function _l(t,e){t[AM()]=e}function Uh(t){var e=ns();return t===!0?e.className=Dh:(e.className=Nh,rs(t)?e.appendChild(t):_l(e,t)),e}function qh(t,e){rs(e.content)?(_l(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?_l(t,e.content):t.textContent=e.content)}function Al(t){var e=t.firstElementChild,n=wo(e.children);return{box:e,content:n.find(function(r){return r.classList.contains(Eh)}),arrow:n.find(function(r){return r.classList.contains(Dh)||r.classList.contains(Nh)}),backdrop:n.find(function(r){return r.classList.contains(lM)})}}function Kh(t){var e=ns(),n=ns();n.className=aM,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=ns();r.className=Eh,r.setAttribute("data-state","hidden"),qh(r,t.props),e.appendChild(n),n.appendChild(r),i(t.props,t.props);function i(s,o){var a=Al(e),l=a.box,c=a.content,u=a.arrow;o.theme?l.setAttribute("data-theme",o.theme):l.removeAttribute("data-theme"),typeof o.animation=="string"?l.setAttribute("data-animation",o.animation):l.removeAttribute("data-animation"),o.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?l.setAttribute("role",o.role):l.removeAttribute("role"),(s.content!==o.content||s.allowHTML!==o.allowHTML)&&qh(c,t.props),o.arrow?u?s.arrow!==o.arrow&&(l.removeChild(u),l.appendChild(Uh(o.arrow))):l.appendChild(Uh(o.arrow)):u&&l.removeChild(u)}return{popper:e,onUpdate:i}}Kh.$$tippy=!0;var VM=1,vo=[],Vl=[];function BM(t,e){var n=Hh(t,Object.assign({},gt,Wh(Ph(e)))),r,i,s,o=!1,a=!1,l=!1,c=!1,u,f,h,p=[],m=Vh(hi,n.interactiveDebounce),y,g=VM++,k=null,
|
|
102
|
+
`,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var AM=function(){return"innerHTML"};function _l(t,e){t[AM()]=e}function Uh(t){var e=ns();return t===!0?e.className=Dh:(e.className=Nh,rs(t)?e.appendChild(t):_l(e,t)),e}function qh(t,e){rs(e.content)?(_l(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?_l(t,e.content):t.textContent=e.content)}function Al(t){var e=t.firstElementChild,n=wo(e.children);return{box:e,content:n.find(function(r){return r.classList.contains(Eh)}),arrow:n.find(function(r){return r.classList.contains(Dh)||r.classList.contains(Nh)}),backdrop:n.find(function(r){return r.classList.contains(lM)})}}function Kh(t){var e=ns(),n=ns();n.className=aM,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=ns();r.className=Eh,r.setAttribute("data-state","hidden"),qh(r,t.props),e.appendChild(n),n.appendChild(r),i(t.props,t.props);function i(s,o){var a=Al(e),l=a.box,c=a.content,u=a.arrow;o.theme?l.setAttribute("data-theme",o.theme):l.removeAttribute("data-theme"),typeof o.animation=="string"?l.setAttribute("data-animation",o.animation):l.removeAttribute("data-animation"),o.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?l.setAttribute("role",o.role):l.removeAttribute("role"),(s.content!==o.content||s.allowHTML!==o.allowHTML)&&qh(c,t.props),o.arrow?u?s.arrow!==o.arrow&&(l.removeChild(u),l.appendChild(Uh(o.arrow))):l.appendChild(Uh(o.arrow)):u&&l.removeChild(u)}return{popper:e,onUpdate:i}}Kh.$$tippy=!0;var VM=1,vo=[],Vl=[];function BM(t,e){var n=Hh(t,Object.assign({},gt,Wh(Ph(e)))),r,i,s,o=!1,a=!1,l=!1,c=!1,u,f,h,p=[],m=Vh(hi,n.interactiveDebounce),y,g=VM++,k=null,v=fM(n.plugins),C={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},b={id:g,reference:t,popper:ns(),popperInstance:k,props:n,state:C,plugins:v,clearDelayTimeouts:pi,setProps:mi,setContent:gi,show:M,hide:S,hideWithInteractivity:N,enable:Mr,disable:Qn,unmount:F,destroy:Z};if(!n.render)return process.env.NODE_ENV!=="production"&&Nl(!0,"render() function has not been supplied."),b;var E=n.render(b),w=E.popper,_=E.onUpdate;w.setAttribute("data-tippy-root",""),w.id="tippy-"+b.id,b.popper=w,t._tippy=b,w._tippy=b;var R=v.map(function(x){return x.fn(b)}),P=t.hasAttribute("aria-expanded");return $e(),Qe(),q(),re("onCreate",[b]),n.showOnCreate&&En(),w.addEventListener("mouseenter",function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()}),w.addEventListener("mouseleave",function(){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&H().addEventListener("mousemove",m)}),b;function z(){var x=b.props.touch;return Array.isArray(x)?x:[x,0]}function te(){return z()[0]==="hold"}function D(){var x;return!!((x=b.props.render)!=null&&x.$$tippy)}function L(){return y||t}function H(){var x=L().parentNode;return x?bM(x):document}function J(){return Al(w)}function T(x){return b.state.isMounted&&!b.state.isVisible||en.isTouch||u&&u.type==="focus"?0:Cl(b.props.delay,x?0:1,gt.delay)}function q(x){x===void 0&&(x=!1),w.style.pointerEvents=b.props.interactive&&!x?"":"none",w.style.zIndex=""+b.props.zIndex}function re(x,V,j){if(j===void 0&&(j=!0),R.forEach(function(X){X[x]&&X[x].apply(X,V)}),j){var G;(G=b.props)[x].apply(G,V)}}function De(){var x=b.props.aria;if(x.content){var V="aria-"+x.content,j=w.id,G=ti(b.props.triggerTarget||t);G.forEach(function(X){var ie=X.getAttribute(V);if(b.state.isVisible)X.setAttribute(V,ie?ie+" "+j:j);else{var pe=ie&&ie.replace(j,"").trim();pe?X.setAttribute(V,pe):X.removeAttribute(V)}})}}function Qe(){if(!(P||!b.props.aria.expanded)){var x=ti(b.props.triggerTarget||t);x.forEach(function(V){b.props.interactive?V.setAttribute("aria-expanded",b.state.isVisible&&V===L()?"true":"false"):V.removeAttribute("aria-expanded")})}}function ct(){H().removeEventListener("mousemove",m),vo=vo.filter(function(x){return x!==m})}function bt(x){if(!(en.isTouch&&(l||x.type==="mousedown"))){var V=x.composedPath&&x.composedPath()[0]||x.target;if(!(b.props.interactive&&Rh(w,V))){if(ti(b.props.triggerTarget||t).some(function(j){return Rh(j,V)})){if(en.isTouch||b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else re("onClickOutside",[b,x]);b.props.hideOnClick===!0&&(b.clearDelayTimeouts(),b.hide(),a=!0,setTimeout(function(){a=!1}),b.state.isMounted||I())}}}function kt(){l=!0}function ve(){l=!1}function et(){var x=H();x.addEventListener("mousedown",bt,!0),x.addEventListener("touchend",bt,yr),x.addEventListener("touchstart",ve,yr),x.addEventListener("touchmove",kt,yr)}function I(){var x=H();x.removeEventListener("mousedown",bt,!0),x.removeEventListener("touchend",bt,yr),x.removeEventListener("touchstart",ve,yr),x.removeEventListener("touchmove",kt,yr)}function Q(x,V){le(x,function(){!b.state.isVisible&&w.parentNode&&w.parentNode.contains(w)&&V()})}function he(x,V){le(x,V)}function le(x,V){var j=J().box;function G(X){X.target===j&&(Dl(j,"remove",G),V())}if(x===0)return V();Dl(j,"remove",f),Dl(j,"add",G),f=G}function Re(x,V,j){j===void 0&&(j=!1);var G=ti(b.props.triggerTarget||t);G.forEach(function(X){X.addEventListener(x,V,j),p.push({node:X,eventType:x,handler:V,options:j})})}function $e(){te()&&(Re("touchstart",Sr,{passive:!0}),Re("touchend",Zn,{passive:!0})),uM(b.props.trigger).forEach(function(x){if(x!=="manual")switch(Re(x,Sr),x){case"mouseenter":Re("mouseleave",Zn);break;case"focus":Re(MM?"focusout":"blur",Xn);break;case"focusin":Re("focusout",Xn);break}})}function dt(){p.forEach(function(x){var V=x.node,j=x.eventType,G=x.handler,X=x.options;V.removeEventListener(j,G,X)}),p=[]}function Sr(x){var V,j=!1;if(!(!b.state.isEnabled||Tn(x)||a)){var G=((V=u)==null?void 0:V.type)==="focus";u=x,y=x.currentTarget,Qe(),!b.state.isVisible&&mM(x)&&vo.forEach(function(X){return X(x)}),x.type==="click"&&(b.props.trigger.indexOf("mouseenter")<0||o)&&b.props.hideOnClick!==!1&&b.state.isVisible?j=!0:En(x),x.type==="click"&&(o=!j),j&&!G&&ln(x)}}function hi(x){var V=x.target,j=L().contains(V)||w.contains(V);if(!(x.type==="mousemove"&&j)){var G=an().concat(w).map(function(X){var ie,pe=X._tippy,Oe=(ie=pe.popperInstance)==null?void 0:ie.state;return Oe?{popperRect:X.getBoundingClientRect(),popperState:Oe,props:n}:null}).filter(Boolean);kM(G,x)&&(ct(),ln(x))}}function Zn(x){var V=Tn(x)||b.props.trigger.indexOf("click")>=0&&o;if(!V){if(b.props.interactive){b.hideWithInteractivity(x);return}ln(x)}}function Xn(x){b.props.trigger.indexOf("focusin")<0&&x.target!==L()||b.props.interactive&&x.relatedTarget&&w.contains(x.relatedTarget)||ln(x)}function Tn(x){return en.isTouch?te()!==x.type.indexOf("touch")>=0:!1}function Wt(){Dt();var x=b.props,V=x.popperOptions,j=x.placement,G=x.offset,X=x.getReferenceClientRect,ie=x.moveTransition,pe=D()?Al(w).arrow:null,Oe=X?{getBoundingClientRect:X,contextElement:X.contextElement||L()}:t,tt={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(er){var cn=er.state;if(D()){var ys=J(),bc=ys.box;["placement","reference-hidden","escaped"].forEach(function(Uo){Uo==="placement"?bc.setAttribute("data-placement",cn.placement):cn.attributes.popper["data-popper-"+Uo]?bc.setAttribute("data-"+Uo,""):bc.removeAttribute("data-"+Uo)}),cn.attributes.popper={}}}},wt=[{name:"offset",options:{offset:G}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!ie}},tt];D()&&pe&&wt.push({name:"arrow",options:{element:pe,padding:3}}),wt.push.apply(wt,(V==null?void 0:V.modifiers)||[]),b.popperInstance=oM(Oe,w,Object.assign({},V,{placement:j,onFirstUpdate:h,modifiers:wt}))}function Dt(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function Nt(){var x=b.props.appendTo,V,j=L();b.props.interactive&&x===_h||x==="parent"?V=j.parentNode:V=Ah(x,[j]),V.contains(w)||V.appendChild(w),b.state.isMounted=!0,Wt(),process.env.NODE_ENV!=="production"&&yn(b.props.interactive&&x===gt.appendTo&&j.nextElementSibling!==w,["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 an(){return wo(w.querySelectorAll("[data-tippy-root]"))}function En(
|
|
108
|
+
`,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function an(){return wo(w.querySelectorAll("[data-tippy-root]"))}function En(x){b.clearDelayTimeouts(),x&&re("onTrigger",[b,x]),et();var V=T(!0),j=z(),G=j[0],X=j[1];en.isTouch&&G==="hold"&&X&&(V=X),V?r=setTimeout(function(){b.show()},V):b.show()}function ln(x){if(b.clearDelayTimeouts(),re("onUntrigger",[b,x]),!b.state.isVisible){I();return}if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(x.type)>=0&&o)){var V=T(!1);V?i=setTimeout(function(){b.state.isVisible&&b.hide()},V):s=requestAnimationFrame(function(){b.hide()})}}function Mr(){b.state.isEnabled=!0}function Qn(){b.hide(),b.state.isEnabled=!1}function pi(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(s)}function mi(x){if(process.env.NODE_ENV!=="production"&&yn(b.state.isDestroyed,ni("setProps")),!b.state.isDestroyed){re("onBeforeUpdate",[b,x]),dt();var V=b.props,j=Hh(t,Object.assign({},V,Ph(x),{ignoreAttributes:!0}));b.props=j,$e(),V.interactiveDebounce!==j.interactiveDebounce&&(ct(),m=Vh(hi,j.interactiveDebounce)),V.triggerTarget&&!j.triggerTarget?ti(V.triggerTarget).forEach(function(G){G.removeAttribute("aria-expanded")}):j.triggerTarget&&t.removeAttribute("aria-expanded"),Qe(),q(),_&&_(V,j),b.popperInstance&&(Wt(),an().forEach(function(G){requestAnimationFrame(G._tippy.popperInstance.forceUpdate)})),re("onAfterUpdate",[b,x])}}function gi(x){b.setProps({content:x})}function M(){process.env.NODE_ENV!=="production"&&yn(b.state.isDestroyed,ni("show"));var x=b.state.isVisible,V=b.state.isDestroyed,j=!b.state.isEnabled,G=en.isTouch&&!b.props.touch,X=Cl(b.props.duration,0,gt.duration);if(!(x||V||j||G)&&!L().hasAttribute("disabled")&&(re("onShow",[b],!1),b.props.onShow(b)!==!1)){if(b.state.isVisible=!0,D()&&(w.style.visibility="visible"),q(),et(),b.state.isMounted||(w.style.transition="none"),D()){var ie=J(),pe=ie.box,Oe=ie.content;El([pe,Oe],0)}h=function(){var wt;if(!(!b.state.isVisible||c)){if(c=!0,w.offsetHeight,w.style.transition=b.props.moveTransition,D()&&b.props.animation){var Or=J(),er=Or.box,cn=Or.content;El([er,cn],X),Ih([er,cn],"visible")}De(),Qe(),Bh(Vl,b),(wt=b.popperInstance)==null||wt.forceUpdate(),re("onMount",[b]),b.props.animation&&D()&&he(X,function(){b.state.isShown=!0,re("onShown",[b])})}},Nt()}}function S(){process.env.NODE_ENV!=="production"&&yn(b.state.isDestroyed,ni("hide"));var x=!b.state.isVisible,V=b.state.isDestroyed,j=!b.state.isEnabled,G=Cl(b.props.duration,1,gt.duration);if(!(x||V||j)&&(re("onHide",[b],!1),b.props.onHide(b)!==!1)){if(b.state.isVisible=!1,b.state.isShown=!1,c=!1,o=!1,D()&&(w.style.visibility="hidden"),ct(),I(),q(!0),D()){var X=J(),ie=X.box,pe=X.content;b.props.animation&&(El([ie,pe],G),Ih([ie,pe],"hidden"))}De(),Qe(),b.props.animation?D()&&Q(G,b.unmount):b.unmount()}}function N(x){process.env.NODE_ENV!=="production"&&yn(b.state.isDestroyed,ni("hideWithInteractivity")),H().addEventListener("mousemove",m),Bh(vo,m),m(x)}function F(){process.env.NODE_ENV!=="production"&&yn(b.state.isDestroyed,ni("unmount")),b.state.isVisible&&b.hide(),b.state.isMounted&&(Dt(),an().forEach(function(x){x._tippy.unmount()}),w.parentNode&&w.parentNode.removeChild(w),Vl=Vl.filter(function(x){return x!==b}),b.state.isMounted=!1,re("onHidden",[b]))}function Z(){process.env.NODE_ENV!=="production"&&yn(b.state.isDestroyed,ni("destroy")),!b.state.isDestroyed&&(b.clearDelayTimeouts(),b.unmount(),dt(),delete t._tippy,b.state.isDestroyed=!0,re("onDestroy",[b]))}}function ri(t,e){e===void 0&&(e={});var n=gt.plugins.concat(e.plugins||[]);process.env.NODE_ENV!=="production"&&(TM(t),Yh(e,n)),xM();var r=Object.assign({},e,{plugins:n}),i=yM(t);if(process.env.NODE_ENV!=="production"){var s=rs(r.content),o=i.length>1;yn(s&&o,["tippy() was passed an Element as the `content` prop, but more than","one tippy instance was created by this invocation. This means the","content element will only be appended to the last tippy instance.",`
|
|
109
109
|
|
|
110
110
|
`,"Instead, pass the .innerHTML of the element, or use a function that","returns a cloned version of the element instead.",`
|
|
111
111
|
|
|
112
112
|
`,`1) content: element.innerHTML
|
|
113
|
-
`,"2) content: () => element.cloneNode(true)"].join(" "))}var a=i.reduce(function(l,c){var u=c&&BM(c,r);return u&&l.push(u),l},[]);return rs(t)?a[0]:a}ri.defaultProps=gt,ri.setDefaultProps=NM,ri.currentInput=en,Object.assign({},fh,{effect:function(e){var n=e.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}}),ri.setDefaultProps({render:Kh});class PM{constructor({editor:e,element:n,view:r,tippyOptions:i={},updateDelay:s=250,shouldShow:o}){this.preventHide=!1,this.shouldShow=({view:a,state:l,from:c,to:u})=>{const{doc:f,selection:h}=l,{empty:p}=h,m=!f.textBetween(c,u).length&&dl(l.selection),y=this.element.contains(document.activeElement);return!(!(a.hasFocus()||y)||p||m||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:a})=>{var l;if(this.preventHide){this.preventHide=!1;return}a!=null&&a.relatedTarget&&(!((l=this.element.parentNode)===null||l===void 0)&&l.contains(a.relatedTarget))||this.hide()},this.tippyBlurHandler=a=>{this.blurHandler({event:a})},this.handleDebouncedUpdate=(a,l)=>{const c=!(l!=null&&l.selection.eq(a.state.selection)),u=!(l!=null&&l.doc.eq(a.state.doc));!c&&!u||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(a,c,u,l)},this.updateDelay))},this.updateHandler=(a,l,c,u)=>{var f,h,p;const{state:m,composing:y}=a,{selection:g}=m;if(y||!l&&!c)return;this.createTooltip();const{ranges:x}=g,C=Math.min(...x.map(w=>w.$from.pos)),b=Math.max(...x.map(w=>w.$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:C,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(Ix(m.selection)){let w=a.nodeDOM(C);const _=w.dataset.nodeViewWrapper?w:w.querySelector("[data-node-view-wrapper]");if(_&&(w=_.firstChild),w)return w.getBoundingClientRect()}return ah(a,C,b)})}),this.show()},this.editor=e,this.element=n,this.view=r,this.updateDelay=s,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=ri(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){const{state:r}=e,i=r.selection.$from.pos!==r.selection.$to.pos;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(e,n);return}const s=!(n!=null&&n.selection.eq(e.state.selection)),o=!(n!=null&&n.doc.eq(e.state.doc));this.updateHandler(e,s,o,n)}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const Jh=t=>new Ke({key:typeof t.pluginKey=="string"?new Pt(t.pluginKey):t.pluginKey,view:e=>new PM({view:e,...t})});Ye.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Jh({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});class IM{constructor({editor:e,element:n,view:r,tippyOptions:i={},shouldShow:s}){this.preventHide=!1,this.shouldShow=({view:o,state:a})=>{const{selection:l}=a,{$anchor:c,empty:u}=l,f=c.depth===1,h=c.parent.isTextblock&&!c.parent.type.spec.code&&!c.parent.textContent;return!(!o.hasFocus()||!u||!f||!h||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:o})=>{var a;if(this.preventHide){this.preventHide=!1;return}o!=null&&o.relatedTarget&&(!((a=this.element.parentNode)===null||a===void 0)&&a.contains(o.relatedTarget))||this.hide()},this.tippyBlurHandler=o=>{this.blurHandler({event:o})},this.editor=e,this.element=n,this.view=r,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=ri(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"right",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){var r,i,s;const{state:o}=e,{doc:a,selection:l}=o,{from:c,to:u}=l;if(n&&n.doc.eq(a)&&n.selection.eq(l))return;if(this.createTooltip(),!((r=this.shouldShow)===null||r===void 0?void 0:r.call(this,{editor:this.editor,view:e,state:o,oldState:n}))){this.hide();return}(i=this.tippy)===null||i===void 0||i.setProps({getReferenceClientRect:((s=this.tippyOptions)===null||s===void 0?void 0:s.getReferenceClientRect)||(()=>ah(e,c,u))}),this.show()}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const Gh=t=>new Ke({key:typeof t.pluginKey=="string"?new Pt(t.pluginKey):t.pluginKey,view:e=>new IM({view:e,...t})});Ye.create({name:"floatingMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Gh({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}}),d.defineComponent({name:"BubbleMenu",props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(t,{slots:e}){const n=d.ref(null);return d.onMounted(()=>{const{updateDelay:r,editor:i,pluginKey:s,shouldShow:o,tippyOptions:a}=t;i.registerPlugin(Jh({updateDelay:r,editor:i,element:n.value,pluginKey:s,shouldShow:o,tippyOptions:a}))}),d.onBeforeUnmount(()=>{const{pluginKey:r,editor:i}=t;i.unregisterPlugin(r)}),()=>{var r;return d.h("div",{ref:n},(r=e.default)===null||r===void 0?void 0:r.call(e))}}});function Zh(t){return d.customRef((e,n)=>({get(){return e(),t},set(r){t=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}class RM extends eS{constructor(e={}){return super(e),this.vueRenderers=d.reactive(new Map),this.contentComponent=null,this.reactiveState=Zh(this.view.state),this.reactiveExtensionStorage=Zh(this.extensionStorage),this.on("transaction",()=>{this.reactiveState.value=this.view.state,this.reactiveExtensionStorage.value=this.extensionStorage}),d.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,n){super.registerPlugin(e,n),this.reactiveState.value=this.view.state}unregisterPlugin(e){super.unregisterPlugin(e),this.reactiveState.value=this.view.state}}const $M=d.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(t){const e=d.ref(),n=d.getCurrentInstance();return d.watchEffect(()=>{const r=t.editor;r&&r.options.element&&e.value&&d.nextTick(()=>{if(!e.value||!r.options.element.firstChild)return;const i=d.unref(e.value);e.value.append(...r.options.element.childNodes),r.contentComponent=n.ctx._,r.setOptions({element:i}),r.createNodeViews()})}),d.onBeforeUnmount(()=>{const r=t.editor;if(!r||(r.isDestroyed||r.view.setProps({nodeViews:{}}),r.contentComponent=null,!r.options.element.firstChild))return;const i=document.createElement("div");i.append(...r.options.element.childNodes),r.setOptions({element:i})}),{rootEl:e}},render(){const t=[];return this.editor&&this.editor.vueRenderers.forEach(e=>{const n=d.h(d.Teleport,{to:e.teleportElement,key:e.id},d.h(e.component,{ref:e.id,...e.props}));t.push(n)}),d.h("div",{ref:e=>{this.rootEl=e}},...t)}});d.defineComponent({name:"FloatingMenu",props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(t,{slots:e}){const n=d.ref(null);return d.onMounted(()=>{const{pluginKey:r,editor:i,tippyOptions:s,shouldShow:o}=t;i.registerPlugin(Gh({pluginKey:r,editor:i,element:n.value,tippyOptions:s,shouldShow:o}))}),d.onBeforeUnmount(()=>{const{pluginKey:r,editor:i}=t;i.unregisterPlugin(r)}),()=>{var r;return d.h("div",{ref:n},(r=e.default)===null||r===void 0?void 0:r.call(e))}}}),d.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return d.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),d.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var t,e;return d.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(t=this.$slots).default)===null||e===void 0?void 0:e.call(t))}});const LM=(t={})=>{const e=d.shallowRef();return d.onMounted(()=>{e.value=new RM(t)}),d.onBeforeUnmount(()=>{var n;(n=e.value)===null||n===void 0||n.destroy()}),e},FM=/^\s*>\s$/,zM=pt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Ki({find:FM,type:this.type})]}}),jM=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,WM=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,HM=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,YM=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,UM=Zt.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Jr({find:jM,type:this.type}),Jr({find:HM,type:this.type})]},addPasteRules(){return[Gr({find:WM,type:this.type}),Gr({find:YM,type:this.type})]}}),qM=pt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ne(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Xh=Zt.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const n=po(t,this.type);return Object.entries(n).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),Qh=/^\s*([-+*])\s$/,KM=pt.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(qM.name,this.editor.getAttributes(Xh.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Ki({find:Qh,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ki({find:Qh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Xh.name),editor:this.editor})),[t]}}),JM=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/,GM=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g,ZM=Zt.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Jr({find:JM,type:this.type})]},addPasteRules(){return[Gr({find:GM,type:this.type})]}}),XM=/^```([a-z]+)?[\s\n]$/,QM=/^~~~([a-z]+)?[\s\n]$/,eO=pt.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:null,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options,s=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Ne(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
|
|
113
|
+
`,"2) content: () => element.cloneNode(true)"].join(" "))}var a=i.reduce(function(l,c){var u=c&&BM(c,r);return u&&l.push(u),l},[]);return rs(t)?a[0]:a}ri.defaultProps=gt,ri.setDefaultProps=NM,ri.currentInput=en,Object.assign({},fh,{effect:function(e){var n=e.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}}),ri.setDefaultProps({render:Kh});class PM{constructor({editor:e,element:n,view:r,tippyOptions:i={},updateDelay:s=250,shouldShow:o}){this.preventHide=!1,this.shouldShow=({view:a,state:l,from:c,to:u})=>{const{doc:f,selection:h}=l,{empty:p}=h,m=!f.textBetween(c,u).length&&dl(l.selection),y=this.element.contains(document.activeElement);return!(!(a.hasFocus()||y)||p||m||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:a})=>{var l;if(this.preventHide){this.preventHide=!1;return}a!=null&&a.relatedTarget&&(!((l=this.element.parentNode)===null||l===void 0)&&l.contains(a.relatedTarget))||this.hide()},this.tippyBlurHandler=a=>{this.blurHandler({event:a})},this.handleDebouncedUpdate=(a,l)=>{const c=!(l!=null&&l.selection.eq(a.state.selection)),u=!(l!=null&&l.doc.eq(a.state.doc));!c&&!u||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(a,c,u,l)},this.updateDelay))},this.updateHandler=(a,l,c,u)=>{var f,h,p;const{state:m,composing:y}=a,{selection:g}=m;if(y||!l&&!c)return;this.createTooltip();const{ranges:v}=g,C=Math.min(...v.map(w=>w.$from.pos)),b=Math.max(...v.map(w=>w.$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:C,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(Ix(m.selection)){let w=a.nodeDOM(C);const _=w.dataset.nodeViewWrapper?w:w.querySelector("[data-node-view-wrapper]");if(_&&(w=_.firstChild),w)return w.getBoundingClientRect()}return ah(a,C,b)})}),this.show()},this.editor=e,this.element=n,this.view=r,this.updateDelay=s,o&&(this.shouldShow=o),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=ri(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){const{state:r}=e,i=r.selection.$from.pos!==r.selection.$to.pos;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(e,n);return}const s=!(n!=null&&n.selection.eq(e.state.selection)),o=!(n!=null&&n.doc.eq(e.state.doc));this.updateHandler(e,s,o,n)}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const Jh=t=>new Ke({key:typeof t.pluginKey=="string"?new Pt(t.pluginKey):t.pluginKey,view:e=>new PM({view:e,...t})});Ye.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Jh({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});class IM{constructor({editor:e,element:n,view:r,tippyOptions:i={},shouldShow:s}){this.preventHide=!1,this.shouldShow=({view:o,state:a})=>{const{selection:l}=a,{$anchor:c,empty:u}=l,f=c.depth===1,h=c.parent.isTextblock&&!c.parent.type.spec.code&&!c.parent.textContent;return!(!o.hasFocus()||!u||!f||!h||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:o})=>{var a;if(this.preventHide){this.preventHide=!1;return}o!=null&&o.relatedTarget&&(!((a=this.element.parentNode)===null||a===void 0)&&a.contains(o.relatedTarget))||this.hide()},this.tippyBlurHandler=o=>{this.blurHandler({event:o})},this.editor=e,this.element=n,this.view=r,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=ri(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"right",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){var r,i,s;const{state:o}=e,{doc:a,selection:l}=o,{from:c,to:u}=l;if(n&&n.doc.eq(a)&&n.selection.eq(l))return;if(this.createTooltip(),!((r=this.shouldShow)===null||r===void 0?void 0:r.call(this,{editor:this.editor,view:e,state:o,oldState:n}))){this.hide();return}(i=this.tippy)===null||i===void 0||i.setProps({getReferenceClientRect:((s=this.tippyOptions)===null||s===void 0?void 0:s.getReferenceClientRect)||(()=>ah(e,c,u))}),this.show()}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const Gh=t=>new Ke({key:typeof t.pluginKey=="string"?new Pt(t.pluginKey):t.pluginKey,view:e=>new IM({view:e,...t})});Ye.create({name:"floatingMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Gh({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}}),d.defineComponent({name:"BubbleMenu",props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(t,{slots:e}){const n=d.ref(null);return d.onMounted(()=>{const{updateDelay:r,editor:i,pluginKey:s,shouldShow:o,tippyOptions:a}=t;i.registerPlugin(Jh({updateDelay:r,editor:i,element:n.value,pluginKey:s,shouldShow:o,tippyOptions:a}))}),d.onBeforeUnmount(()=>{const{pluginKey:r,editor:i}=t;i.unregisterPlugin(r)}),()=>{var r;return d.h("div",{ref:n},(r=e.default)===null||r===void 0?void 0:r.call(e))}}});function Zh(t){return d.customRef((e,n)=>({get(){return e(),t},set(r){t=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}class RM extends eS{constructor(e={}){return super(e),this.vueRenderers=d.reactive(new Map),this.contentComponent=null,this.reactiveState=Zh(this.view.state),this.reactiveExtensionStorage=Zh(this.extensionStorage),this.on("transaction",()=>{this.reactiveState.value=this.view.state,this.reactiveExtensionStorage.value=this.extensionStorage}),d.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,n){super.registerPlugin(e,n),this.reactiveState.value=this.view.state}unregisterPlugin(e){super.unregisterPlugin(e),this.reactiveState.value=this.view.state}}const $M=d.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(t){const e=d.ref(),n=d.getCurrentInstance();return d.watchEffect(()=>{const r=t.editor;r&&r.options.element&&e.value&&d.nextTick(()=>{if(!e.value||!r.options.element.firstChild)return;const i=d.unref(e.value);e.value.append(...r.options.element.childNodes),r.contentComponent=n.ctx._,r.setOptions({element:i}),r.createNodeViews()})}),d.onBeforeUnmount(()=>{const r=t.editor;if(!r||(r.isDestroyed||r.view.setProps({nodeViews:{}}),r.contentComponent=null,!r.options.element.firstChild))return;const i=document.createElement("div");i.append(...r.options.element.childNodes),r.setOptions({element:i})}),{rootEl:e}},render(){const t=[];return this.editor&&this.editor.vueRenderers.forEach(e=>{const n=d.h(d.Teleport,{to:e.teleportElement,key:e.id},d.h(e.component,{ref:e.id,...e.props}));t.push(n)}),d.h("div",{ref:e=>{this.rootEl=e}},...t)}});d.defineComponent({name:"FloatingMenu",props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(t,{slots:e}){const n=d.ref(null);return d.onMounted(()=>{const{pluginKey:r,editor:i,tippyOptions:s,shouldShow:o}=t;i.registerPlugin(Gh({pluginKey:r,editor:i,element:n.value,tippyOptions:s,shouldShow:o}))}),d.onBeforeUnmount(()=>{const{pluginKey:r,editor:i}=t;i.unregisterPlugin(r)}),()=>{var r;return d.h("div",{ref:n},(r=e.default)===null||r===void 0?void 0:r.call(e))}}}),d.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return d.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),d.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var t,e;return d.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(t=this.$slots).default)===null||e===void 0?void 0:e.call(t))}});const LM=(t={})=>{const e=d.shallowRef();return d.onMounted(()=>{e.value=new RM(t)}),d.onBeforeUnmount(()=>{var n;(n=e.value)===null||n===void 0||n.destroy()}),e},FM=/^\s*>\s$/,zM=pt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Ki({find:FM,type:this.type})]}}),jM=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,WM=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,HM=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,YM=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,UM=Zt.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Jr({find:jM,type:this.type}),Jr({find:HM,type:this.type})]},addPasteRules(){return[Gr({find:WM,type:this.type}),Gr({find:YM,type:this.type})]}}),qM=pt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ne(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Xh=Zt.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const n=po(t,this.type);return Object.entries(n).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),Qh=/^\s*([-+*])\s$/,KM=pt.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(qM.name,this.editor.getAttributes(Xh.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Ki({find:Qh,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ki({find:Qh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Xh.name),editor:this.editor})),[t]}}),JM=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/,GM=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g,ZM=Zt.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Jr({find:JM,type:this.type})]},addPasteRules(){return[Gr({find:GM,type:this.type})]}}),XM=/^```([a-z]+)?[\s\n]$/,QM=/^~~~([a-z]+)?[\s\n]$/,eO=pt.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:null,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options,s=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Ne(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
|
|
114
114
|
|
|
115
115
|
`);return!s||!o?!1:t.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const a=i.after();return a===void 0||r.nodeAt(a)?!1:t.commands.exitCode()}}},addInputRules(){return[gl({find:XM,type:this.type,getAttributes:t=>({language:t[1]})}),gl({find:QM,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Ke({key:new Pt("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i==null?void 0:i.mode;if(!n||!s)return!1;const{tr:o}=t.state;return t.state.selection.from===t.state.doc.nodeSize-(1+t.state.selection.$to.depth*2)?o.insert(t.state.selection.from-1,this.type.create({language:s})):o.replaceSelectionWith(this.type.create({language:s})),o.setSelection(ee.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.insertText(n.replace(/\r\n?/g,`
|
|
116
116
|
`)),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),tO=pt.create({name:"doc",topNode:!0,content:"block+"});function nO(t={}){return new Ke({view(e){return new rO(e,t)}})}class rO{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r;if(n){let a=e.nodeBefore,l=e.nodeAfter;if(a||l){let c=this.editorView.nodeDOM(this.cursorPos-(a?a.nodeSize:0));if(c){let u=c.getBoundingClientRect(),f=a?u.bottom:u.top;a&&l&&(f=(f+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:u.left,right:u.right,top:f-this.width/2,bottom:f+this.width/2}}}}if(!r){let a=this.editorView.coordsAtPos(this.cursorPos);r={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let i=this.editorView.dom.offsetParent;this.element||(this.element=i.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let s,o;if(!i||i==document.body&&getComputedStyle(i).position=="static")s=-pageXOffset,o=-pageYOffset;else{let a=i.getBoundingClientRect();s=a.left-i.scrollLeft,o=a.top-i.scrollTop}this.element.style.left=r.left-s+"px",this.element.style.top=r.top-o+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!s){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=fu(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const iO=Ye.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[nO(this.options)]}});class Se extends se{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Se.valid(r)?new Se(r):se.near(r)}content(){return $.empty}eq(e){return e instanceof Se&&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 Se(e.resolve(n.pos))}getBookmark(){return new Bl(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!sO(e)||!oO(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&&Se.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let a=e.node(o);if(n>0?e.indexAfter(o)<a.childCount:e.index(o)>0){s=a.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=n;let l=e.doc.resolve(i);if(Se.valid(l))return l}for(;;){let o=n>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!K.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=o,i+=n;let a=e.doc.resolve(i);if(Se.valid(a))return a}return null}}}Se.prototype.visible=!1,Se.findFrom=Se.findGapCursorFrom,se.jsonID("gapcursor",Se);class Bl{constructor(e){this.pos=e}map(e){return new Bl(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Se.valid(n)?new Se(n):se.near(n)}}function sO(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 oO(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 aO(){return new Ke({props:{decorations:uO,createSelectionBetween(t,e,n){return e.pos==n.pos&&Se.valid(n)?new Se(n):null},handleClick:cO,handleKeyDown:lO,handleDOMEvents:{beforeinput:dO}}})}const lO=$f({ArrowLeft:xo("horiz",-1),ArrowRight:xo("horiz",1),ArrowUp:xo("vert",-1),ArrowDown:xo("vert",1)});function xo(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof ee){if(!s.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=Se.findGapCursorFrom(a,e,l);return c?(i&&i(r.tr.setSelection(new Se(c))),!0):!1}}function cO(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Se.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&K.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Se(r))),!0)}function dO(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Se))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=A.empty;for(let o=r.length-1;o>=0;o--)i=A.from(r[o].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new $(i,0,0));return s.setSelection(ee.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function uO(t){if(!(t.selection instanceof Se))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Ee.create(t.doc,[ht.widget(t.selection.head,e,{key:"gapcursor"})])}const fO=Ye.create({name:"gapCursor",addProseMirrorPlugins(){return[aO()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=oe(Y(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),hO=pt.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Ne(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
117
|
-
`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:s}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,l=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&o){const f=l.filter(h=>a.includes(h.type.name));c.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),pO=pt.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Ne(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>gl({find:new RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var So=200,Ie=function(){};Ie.prototype.append=function(e){return e.length?(e=Ie.from(e),!this.length&&e||e.length<So&&this.leafAppend(e)||this.length<So&&e.leafPrepend(this)||this.appendInner(e)):this},Ie.prototype.prepend=function(e){return e.length?Ie.from(e).append(this):this},Ie.prototype.appendInner=function(e){return new mO(this,e)},Ie.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Ie.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))},Ie.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Ie.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)},Ie.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},n,r),i},Ie.from=function(e){return e instanceof Ie?e:e&&e.length?new ep(e):Ie.empty};var ep=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l<o;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var l=s-1;l>=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=So)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=So)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Ie);Ie.empty=new ep([]);var mO=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(Ie);const gO=500;class $t{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,a,l,c=[],u=[];return this.items.forEach((f,h)=>{if(!f.step){i||(i=this.remapping(r,h+1),s=i.maps.length),s--,u.push(f);return}if(i){u.push(new tn(f.map));let p=f.step.map(i.slice(s)),m;p&&o.maybeStep(p).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],c.push(new tn(m,void 0,void 0,c.length+u.length))),s--,m&&i.appendMap(m,s)}else o.maybeStep(f.step);if(f.selection)return a=i?f.selection.map(i.slice(s)):f.selection,l=new $t(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,n,r,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let f=e.steps[u].invert(e.docs[u]),h=new tn(e.mapping.maps[u],f,n),p;(p=l&&l.merge(h))&&(h=p,u?s.pop():a=a.slice(0,a.length-1)),s.push(h),n&&(o++,n=void 0),i||(l=h)}let c=o-r.depth;return c>bO&&(a=yO(a,c),o-=c),new $t(a.append(s),o)}remapping(e,n){let r=new Br;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new $t(this.items.append(e.map(n=>new tn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let l=n;this.items.forEach(h=>{let p=s.getMirror(--l);if(p==null)return;o=Math.min(o,p);let m=s.maps[p];if(h.step){let y=e.steps[p].invert(e.docs[p]),g=h.selection&&h.selection.map(s.slice(l+1,p));g&&a++,r.push(new tn(m,y,g))}else r.push(new tn(m))},i);let c=[];for(let h=n;h<o;h++)c.push(new tn(s.maps[h]));let u=this.items.slice(0,i).append(c).append(r),f=new $t(u,a);return f.emptyItemCount()>gO&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=o.selection&&o.selection.map(n.slice(r));u&&s++;let f=new tn(c.invert(),l,u),h,p=i.length-1;(h=i.length&&i[p].merge(f))?i[p]=h:i.push(f)}}else o.map&&r--},this.items.length,0),new $t(Ie.from(i.reverse()),s)}}$t.empty=new $t(Ie.empty,0);function yO(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class tn{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new tn(n.getMap().invert(),n,this.selection)}}}class qn{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const bO=20;function kO(t,e,n,r){let i=n.getMeta(br),s;if(i)return i.historyState;n.getMeta(xO)&&(t=new qn(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(br))return o.getMeta(br).redo?new qn(t.done.addTransform(n,void 0,r,Mo(e)),t.undone,tp(n.mapping.maps[n.steps.length-1]),t.prevTime,t.prevComposition):new qn(t.done,t.undone.addTransform(n,void 0,r,Mo(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!o&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!wO(n,t.prevRanges)),c=o?Pl(t.prevRanges,n.mapping):tp(n.mapping.maps[n.steps.length-1]);return new qn(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Mo(e)),$t.empty,c,n.time,a??t.prevComposition)}else return(s=n.getMeta("rebased"))?new qn(t.done.rebased(n,s),t.undone.rebased(n,s),Pl(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new qn(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Pl(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function wO(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function tp(t){let e=[];return t.forEach((n,r,i,s)=>e.push(i,s)),e}function Pl(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function vO(t,e,n){let r=Mo(e),i=br.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),l=new qn(n?a:s.remaining,n?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(br,{redo:n,historyState:l})}let Il=!1,np=null;function Mo(t){let e=t.plugins;if(np!=e){Il=!1,np=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Il=!0;break}}return Il}const br=new Pt("history"),xO=new Pt("closeHistory");function SO(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ke({key:br,state:{init(){return new qn($t.empty,$t.empty,null,0,-1)},apply(e,n,r){return kO(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?ip:r=="historyRedo"?sp:null;return i?(n.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function rp(t,e){return(n,r)=>{let i=br.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=vO(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const ip=rp(!1,!0),sp=rp(!0,!0),MO=Ye.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>ip(t,e),redo:()=>({state:t,dispatch:e})=>sp(t,e)}},addProseMirrorPlugins(){return[SO(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),OO=pt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Ne(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{const{$to:n}=e.selection,r=t();return n.parentOffset===0?r.insertContentAt(Math.max(n.pos-2,0),{type:this.name}):r.insertContent({type:this.name}),r.command(({tr:i,dispatch:s})=>{var o;if(s){const{$to:a}=i.selection,l=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?i.setSelection(ee.create(i.doc,a.pos+1)):a.nodeAfter.isBlock?i.setSelection(K.create(i.doc,a.pos)):i.setSelection(ee.create(i.doc,a.pos));else{const c=(o=a.parent.type.contentMatch.defaultType)===null||o===void 0?void 0:o.create();c&&(i.insert(l,c),i.setSelection(ee.create(i.doc,l+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[tS({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),CO=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,TO=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,EO=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,DO=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,NO=Zt.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Jr({find:CO,type:this.type}),Jr({find:EO,type:this.type})]},addPasteRules(){return[Gr({find:TO,type:this.type}),Gr({find:DO,type:this.type})]}}),_O=pt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ne(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),AO=pt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ne(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),op=Zt.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const n=po(t,this.type);return Object.entries(n).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),ap=/^(\d+)\.\s$/,VO=pt.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Ne(this.options.HTMLAttributes,n),0]:["ol",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(AO.name,this.editor.getAttributes(op.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Ki({find:ap,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=Ki({find:ap,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(op.name)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),BO=pt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),PO=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,IO=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,RO=Zt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Jr({find:PO,type:this.type})]},addPasteRules(){return[Gr({find:IO,type:this.type})]}}),$O=pt.create({name:"text",group:"inline"}),LO=Ye.create({name:"starterKit",addExtensions(){var t,e,n,r,i,s,o,a,l,c,u,f,h,p,m,y,g,k;const x=[];return this.options.blockquote!==!1&&x.push(zM.configure((t=this.options)===null||t===void 0?void 0:t.blockquote)),this.options.bold!==!1&&x.push(UM.configure((e=this.options)===null||e===void 0?void 0:e.bold)),this.options.bulletList!==!1&&x.push(KM.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&x.push(ZM.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&x.push(eO.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&x.push(tO.configure((s=this.options)===null||s===void 0?void 0:s.document)),this.options.dropcursor!==!1&&x.push(iO.configure((o=this.options)===null||o===void 0?void 0:o.dropcursor)),this.options.gapcursor!==!1&&x.push(fO.configure((a=this.options)===null||a===void 0?void 0:a.gapcursor)),this.options.hardBreak!==!1&&x.push(hO.configure((l=this.options)===null||l===void 0?void 0:l.hardBreak)),this.options.heading!==!1&&x.push(pO.configure((c=this.options)===null||c===void 0?void 0:c.heading)),this.options.history!==!1&&x.push(MO.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&x.push(OO.configure((f=this.options)===null||f===void 0?void 0:f.horizontalRule)),this.options.italic!==!1&&x.push(NO.configure((h=this.options)===null||h===void 0?void 0:h.italic)),this.options.listItem!==!1&&x.push(_O.configure((p=this.options)===null||p===void 0?void 0:p.listItem)),this.options.orderedList!==!1&&x.push(VO.configure((m=this.options)===null||m===void 0?void 0:m.orderedList)),this.options.paragraph!==!1&&x.push(BO.configure((y=this.options)===null||y===void 0?void 0:y.paragraph)),this.options.strike!==!1&&x.push(RO.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&x.push($O.configure((k=this.options)===null||k===void 0?void 0:k.text)),x}}),FO=Ye.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,considerAnyAsEmpty:!1,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Ke({key:new Pt("placeholder"),props:{decorations:({doc:t,selection:e})=>{var n;const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=e,s=[];if(!r)return null;const{firstChild:o}=t.content,a=o&&o.type.isLeaf,l=o&&o.isAtom,c=this.options.considerAnyAsEmpty?!0:o&&o.type.name===((n=t.type.contentMatch.defaultType)===null||n===void 0?void 0:n.name),u=t.content.childCount<=1&&o&&c&&o.nodeSize<=2&&(!a||!l);return t.descendants((f,h)=>{const p=i>=h&&i<=h+f.nodeSize,m=!f.isLeaf&&!f.childCount;if((p||!this.options.showOnlyCurrent)&&m){const y=[this.options.emptyNodeClass];u&&y.push(this.options.emptyEditorClass);const g=ht.node(h,h+f.nodeSize,{class:y.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:f,pos:h,hasAnchor:p}):this.options.placeholder});s.push(g)}return this.options.includeChildren}),Ee.create(t,s)}}})]}}),zO={},jO={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},WO=[d.createElementVNode("path",{d:"M3 4.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM6.25 3a.75.75 0 0 0 0 1.5h7a.75.75 0 0 0 0-1.5h-7ZM6.25 7.25a.75.75 0 0 0 0 1.5h7a.75.75 0 0 0 0-1.5h-7ZM6.25 11.5a.75.75 0 0 0 0 1.5h7a.75.75 0 0 0 0-1.5h-7ZM4 12.25a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM3 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"},null,-1)];function HO(t,e){return d.openBlock(),d.createElementBlock("svg",jO,WO)}const YO=be(zO,[["render",HO]]),UO={},qO={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},KO=[d.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 JO(t,e){return d.openBlock(),d.createElementBlock("svg",qO,KO)}const GO=be(UO,[["render",JO]]),ZO={},XO={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},QO=[d.createElementVNode("path",{"fill-rule":"evenodd",d:"M12.5 9.75A2.75 2.75 0 0 0 9.75 7H4.56l2.22 2.22a.75.75 0 1 1-1.06 1.06l-3.5-3.5a.75.75 0 0 1 0-1.06l3.5-3.5a.75.75 0 0 1 1.06 1.06L4.56 5.5h5.19a4.25 4.25 0 0 1 0 8.5h-1a.75.75 0 0 1 0-1.5h1a2.75 2.75 0 0 0 2.75-2.75Z","clip-rule":"evenodd"},null,-1)];function eC(t,e){return d.openBlock(),d.createElementBlock("svg",XO,QO)}const tC=be(ZO,[["render",eC]]),nC={},rC={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},iC=[d.createElementVNode("path",{"fill-rule":"evenodd",d:"M3.5 9.75A2.75 2.75 0 0 1 6.25 7h5.19L9.22 9.22a.75.75 0 1 0 1.06 1.06l3.5-3.5a.75.75 0 0 0 0-1.06l-3.5-3.5a.75.75 0 1 0-1.06 1.06l2.22 2.22H6.25a4.25 4.25 0 0 0 0 8.5h1a.75.75 0 0 0 0-1.5h-1A2.75 2.75 0 0 1 3.5 9.75Z","clip-rule":"evenodd"},null,-1)];function sC(t,e){return d.openBlock(),d.createElementBlock("svg",rC,iC)}const oC=be(nC,[["render",sC]]),aC={},lC={fill:"#000000",width:"800px",height:"800px",viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},cC=[d.createElementVNode("path",{d:"M754.429 0v274.423h235.885L647.457 1645.85H343V1920h822.994v-274.149H930.11l342.857-1371.428h304.32V0z","fill-rule":"evenodd"},null,-1)];function dC(t,e){return d.openBlock(),d.createElementBlock("svg",lC,cC)}const uC=be(aC,[["render",dC]]),fC={},hC={fill:"#000000",viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},pC=[d.createElementVNode("path",{d:"M480.286 822.857h548.571c151.269 0 274.286-123.017 274.286-274.286 0-151.268-123.017-274.285-274.286-274.285H480.286v548.571Zm0 822.857H1166c151.269 0 274.286-123.017 274.286-274.285 0-151.269-123.017-274.286-274.286-274.286H480.286v548.571ZM1166 1920H206V0h822.857c302.537 0 548.572 246.034 548.572 548.571 0 134.263-48.549 257.418-128.778 352.732 159.223 96.137 265.92 270.994 265.92 470.126 0 302.537-246.034 548.571-548.571 548.571Z","fill-rule":"evenodd"},null,-1)];function mC(t,e){return d.openBlock(),d.createElementBlock("svg",hC,pC)}const gC=be(fC,[["render",mC]]),yC={},bC={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"},kC=[d.createElementVNode("g",null,[d.createElementVNode("g",null,[d.createElementVNode("path",{d:`M95.263,12.29V2.277C95.263,1.019,94.245,0,92.987,0H36.921C25.539,0,17.05,2.442,10.969,7.47\r
|
|
117
|
+
`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:s}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,l=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&o){const f=l.filter(h=>a.includes(h.type.name));c.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),pO=pt.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Ne(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>gl({find:new RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var So=200,Ie=function(){};Ie.prototype.append=function(e){return e.length?(e=Ie.from(e),!this.length&&e||e.length<So&&this.leafAppend(e)||this.length<So&&e.leafPrepend(this)||this.appendInner(e)):this},Ie.prototype.prepend=function(e){return e.length?Ie.from(e).append(this):this},Ie.prototype.appendInner=function(e){return new mO(this,e)},Ie.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Ie.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))},Ie.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Ie.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)},Ie.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},n,r),i},Ie.from=function(e){return e instanceof Ie?e:e&&e.length?new ep(e):Ie.empty};var ep=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l<o;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var l=s-1;l>=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=So)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=So)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Ie);Ie.empty=new ep([]);var mO=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(Ie);const gO=500;class $t{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,a,l,c=[],u=[];return this.items.forEach((f,h)=>{if(!f.step){i||(i=this.remapping(r,h+1),s=i.maps.length),s--,u.push(f);return}if(i){u.push(new tn(f.map));let p=f.step.map(i.slice(s)),m;p&&o.maybeStep(p).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],c.push(new tn(m,void 0,void 0,c.length+u.length))),s--,m&&i.appendMap(m,s)}else o.maybeStep(f.step);if(f.selection)return a=i?f.selection.map(i.slice(s)):f.selection,l=new $t(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,n,r,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let f=e.steps[u].invert(e.docs[u]),h=new tn(e.mapping.maps[u],f,n),p;(p=l&&l.merge(h))&&(h=p,u?s.pop():a=a.slice(0,a.length-1)),s.push(h),n&&(o++,n=void 0),i||(l=h)}let c=o-r.depth;return c>bO&&(a=yO(a,c),o-=c),new $t(a.append(s),o)}remapping(e,n){let r=new Br;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new $t(this.items.append(e.map(n=>new tn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let l=n;this.items.forEach(h=>{let p=s.getMirror(--l);if(p==null)return;o=Math.min(o,p);let m=s.maps[p];if(h.step){let y=e.steps[p].invert(e.docs[p]),g=h.selection&&h.selection.map(s.slice(l+1,p));g&&a++,r.push(new tn(m,y,g))}else r.push(new tn(m))},i);let c=[];for(let h=n;h<o;h++)c.push(new tn(s.maps[h]));let u=this.items.slice(0,i).append(c).append(r),f=new $t(u,a);return f.emptyItemCount()>gO&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=o.selection&&o.selection.map(n.slice(r));u&&s++;let f=new tn(c.invert(),l,u),h,p=i.length-1;(h=i.length&&i[p].merge(f))?i[p]=h:i.push(f)}}else o.map&&r--},this.items.length,0),new $t(Ie.from(i.reverse()),s)}}$t.empty=new $t(Ie.empty,0);function yO(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class tn{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new tn(n.getMap().invert(),n,this.selection)}}}class qn{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const bO=20;function kO(t,e,n,r){let i=n.getMeta(br),s;if(i)return i.historyState;n.getMeta(xO)&&(t=new qn(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(br))return o.getMeta(br).redo?new qn(t.done.addTransform(n,void 0,r,Mo(e)),t.undone,tp(n.mapping.maps[n.steps.length-1]),t.prevTime,t.prevComposition):new qn(t.done,t.undone.addTransform(n,void 0,r,Mo(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!o&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!wO(n,t.prevRanges)),c=o?Pl(t.prevRanges,n.mapping):tp(n.mapping.maps[n.steps.length-1]);return new qn(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Mo(e)),$t.empty,c,n.time,a??t.prevComposition)}else return(s=n.getMeta("rebased"))?new qn(t.done.rebased(n,s),t.undone.rebased(n,s),Pl(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new qn(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Pl(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function wO(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function tp(t){let e=[];return t.forEach((n,r,i,s)=>e.push(i,s)),e}function Pl(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function vO(t,e,n){let r=Mo(e),i=br.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),l=new qn(n?a:s.remaining,n?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(br,{redo:n,historyState:l})}let Il=!1,np=null;function Mo(t){let e=t.plugins;if(np!=e){Il=!1,np=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Il=!0;break}}return Il}const br=new Pt("history"),xO=new Pt("closeHistory");function SO(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ke({key:br,state:{init(){return new qn($t.empty,$t.empty,null,0,-1)},apply(e,n,r){return kO(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?ip:r=="historyRedo"?sp:null;return i?(n.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function rp(t,e){return(n,r)=>{let i=br.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=vO(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const ip=rp(!1,!0),sp=rp(!0,!0),MO=Ye.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>ip(t,e),redo:()=>({state:t,dispatch:e})=>sp(t,e)}},addProseMirrorPlugins(){return[SO(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),OO=pt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Ne(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{const{$to:n}=e.selection,r=t();return n.parentOffset===0?r.insertContentAt(Math.max(n.pos-2,0),{type:this.name}):r.insertContent({type:this.name}),r.command(({tr:i,dispatch:s})=>{var o;if(s){const{$to:a}=i.selection,l=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?i.setSelection(ee.create(i.doc,a.pos+1)):a.nodeAfter.isBlock?i.setSelection(K.create(i.doc,a.pos)):i.setSelection(ee.create(i.doc,a.pos));else{const c=(o=a.parent.type.contentMatch.defaultType)===null||o===void 0?void 0:o.create();c&&(i.insert(l,c),i.setSelection(ee.create(i.doc,l+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[tS({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),CO=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,TO=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,EO=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,DO=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,NO=Zt.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Jr({find:CO,type:this.type}),Jr({find:EO,type:this.type})]},addPasteRules(){return[Gr({find:TO,type:this.type}),Gr({find:DO,type:this.type})]}}),_O=pt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ne(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),AO=pt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ne(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),op=Zt.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const n=po(t,this.type);return Object.entries(n).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),ap=/^(\d+)\.\s$/,VO=pt.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Ne(this.options.HTMLAttributes,n),0]:["ol",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(AO.name,this.editor.getAttributes(op.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Ki({find:ap,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=Ki({find:ap,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(op.name)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),BO=pt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),PO=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,IO=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,RO=Zt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Ne(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Jr({find:PO,type:this.type})]},addPasteRules(){return[Gr({find:IO,type:this.type})]}}),$O=pt.create({name:"text",group:"inline"}),LO=Ye.create({name:"starterKit",addExtensions(){var t,e,n,r,i,s,o,a,l,c,u,f,h,p,m,y,g,k;const v=[];return this.options.blockquote!==!1&&v.push(zM.configure((t=this.options)===null||t===void 0?void 0:t.blockquote)),this.options.bold!==!1&&v.push(UM.configure((e=this.options)===null||e===void 0?void 0:e.bold)),this.options.bulletList!==!1&&v.push(KM.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&v.push(ZM.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&v.push(eO.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&v.push(tO.configure((s=this.options)===null||s===void 0?void 0:s.document)),this.options.dropcursor!==!1&&v.push(iO.configure((o=this.options)===null||o===void 0?void 0:o.dropcursor)),this.options.gapcursor!==!1&&v.push(fO.configure((a=this.options)===null||a===void 0?void 0:a.gapcursor)),this.options.hardBreak!==!1&&v.push(hO.configure((l=this.options)===null||l===void 0?void 0:l.hardBreak)),this.options.heading!==!1&&v.push(pO.configure((c=this.options)===null||c===void 0?void 0:c.heading)),this.options.history!==!1&&v.push(MO.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&v.push(OO.configure((f=this.options)===null||f===void 0?void 0:f.horizontalRule)),this.options.italic!==!1&&v.push(NO.configure((h=this.options)===null||h===void 0?void 0:h.italic)),this.options.listItem!==!1&&v.push(_O.configure((p=this.options)===null||p===void 0?void 0:p.listItem)),this.options.orderedList!==!1&&v.push(VO.configure((m=this.options)===null||m===void 0?void 0:m.orderedList)),this.options.paragraph!==!1&&v.push(BO.configure((y=this.options)===null||y===void 0?void 0:y.paragraph)),this.options.strike!==!1&&v.push(RO.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&v.push($O.configure((k=this.options)===null||k===void 0?void 0:k.text)),v}}),FO=Ye.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,considerAnyAsEmpty:!1,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Ke({key:new Pt("placeholder"),props:{decorations:({doc:t,selection:e})=>{var n;const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=e,s=[];if(!r)return null;const{firstChild:o}=t.content,a=o&&o.type.isLeaf,l=o&&o.isAtom,c=this.options.considerAnyAsEmpty?!0:o&&o.type.name===((n=t.type.contentMatch.defaultType)===null||n===void 0?void 0:n.name),u=t.content.childCount<=1&&o&&c&&o.nodeSize<=2&&(!a||!l);return t.descendants((f,h)=>{const p=i>=h&&i<=h+f.nodeSize,m=!f.isLeaf&&!f.childCount;if((p||!this.options.showOnlyCurrent)&&m){const y=[this.options.emptyNodeClass];u&&y.push(this.options.emptyEditorClass);const g=ht.node(h,h+f.nodeSize,{class:y.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:f,pos:h,hasAnchor:p}):this.options.placeholder});s.push(g)}return this.options.includeChildren}),Ee.create(t,s)}}})]}}),zO={},jO={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},WO=[d.createElementVNode("path",{d:"M3 4.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM6.25 3a.75.75 0 0 0 0 1.5h7a.75.75 0 0 0 0-1.5h-7ZM6.25 7.25a.75.75 0 0 0 0 1.5h7a.75.75 0 0 0 0-1.5h-7ZM6.25 11.5a.75.75 0 0 0 0 1.5h7a.75.75 0 0 0 0-1.5h-7ZM4 12.25a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM3 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"},null,-1)];function HO(t,e){return d.openBlock(),d.createElementBlock("svg",jO,WO)}const YO=be(zO,[["render",HO]]),UO={},qO={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},KO=[d.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 JO(t,e){return d.openBlock(),d.createElementBlock("svg",qO,KO)}const GO=be(UO,[["render",JO]]),ZO={},XO={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},QO=[d.createElementVNode("path",{"fill-rule":"evenodd",d:"M12.5 9.75A2.75 2.75 0 0 0 9.75 7H4.56l2.22 2.22a.75.75 0 1 1-1.06 1.06l-3.5-3.5a.75.75 0 0 1 0-1.06l3.5-3.5a.75.75 0 0 1 1.06 1.06L4.56 5.5h5.19a4.25 4.25 0 0 1 0 8.5h-1a.75.75 0 0 1 0-1.5h1a2.75 2.75 0 0 0 2.75-2.75Z","clip-rule":"evenodd"},null,-1)];function eC(t,e){return d.openBlock(),d.createElementBlock("svg",XO,QO)}const tC=be(ZO,[["render",eC]]),nC={},rC={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor"},iC=[d.createElementVNode("path",{"fill-rule":"evenodd",d:"M3.5 9.75A2.75 2.75 0 0 1 6.25 7h5.19L9.22 9.22a.75.75 0 1 0 1.06 1.06l3.5-3.5a.75.75 0 0 0 0-1.06l-3.5-3.5a.75.75 0 1 0-1.06 1.06l2.22 2.22H6.25a4.25 4.25 0 0 0 0 8.5h1a.75.75 0 0 0 0-1.5h-1A2.75 2.75 0 0 1 3.5 9.75Z","clip-rule":"evenodd"},null,-1)];function sC(t,e){return d.openBlock(),d.createElementBlock("svg",rC,iC)}const oC=be(nC,[["render",sC]]),aC={},lC={fill:"#000000",width:"800px",height:"800px",viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},cC=[d.createElementVNode("path",{d:"M754.429 0v274.423h235.885L647.457 1645.85H343V1920h822.994v-274.149H930.11l342.857-1371.428h304.32V0z","fill-rule":"evenodd"},null,-1)];function dC(t,e){return d.openBlock(),d.createElementBlock("svg",lC,cC)}const uC=be(aC,[["render",dC]]),fC={},hC={fill:"#000000",viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},pC=[d.createElementVNode("path",{d:"M480.286 822.857h548.571c151.269 0 274.286-123.017 274.286-274.286 0-151.268-123.017-274.285-274.286-274.285H480.286v548.571Zm0 822.857H1166c151.269 0 274.286-123.017 274.286-274.285 0-151.269-123.017-274.286-274.286-274.286H480.286v548.571ZM1166 1920H206V0h822.857c302.537 0 548.572 246.034 548.572 548.571 0 134.263-48.549 257.418-128.778 352.732 159.223 96.137 265.92 270.994 265.92 470.126 0 302.537-246.034 548.571-548.571 548.571Z","fill-rule":"evenodd"},null,-1)];function mC(t,e){return d.openBlock(),d.createElementBlock("svg",hC,pC)}const gC=be(fC,[["render",mC]]),yC={},bC={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"},kC=[d.createElementVNode("g",null,[d.createElementVNode("g",null,[d.createElementVNode("path",{d:`M95.263,12.29V2.277C95.263,1.019,94.245,0,92.987,0H36.921C25.539,0,17.05,2.442,10.969,7.47\r
|
|
118
118
|
c-6.364,5.265-9.594,12.724-9.594,22.167c0,10.367,3.124,18.054,9.547,23.499c6.399,5.423,15.696,8.175,27.63,8.175h10.38v33.051\r
|
|
119
119
|
c0,1.258,1.02,2.277,2.278,2.277h7.096c1.257,0,2.276-1.02,2.276-2.277V14.566h9.146v79.795c0,1.258,1.021,2.276,2.277,2.276\r
|
|
120
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 wC(t,e){return d.openBlock(),d.createElementBlock("svg",bC,kC)}const vC=be(yC,[["render",wC]]),xC={},SC={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},MC=[d.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M17.25 6.75 22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3-4.5 16.5"},null,-1)];function OC(t,e){return d.openBlock(),d.createElementBlock("svg",SC,MC)}const CC=be(xC,[["render",OC]]),TC={class:"py-1 px-1 border-b"},EC={class:"flex gap-px"},DC=["onClick"],NC={key:1,class:"text-sm"},_C={class:"max-h-72 w-full overflow-auto px-4 py-3"},AC=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-slate-300"},i=[{method:"toggleBold",type:"chain",label:"bold",icon:gC,smallIcon:!0,disableCheck:!0},{method:"toggleItalic",type:"chain",label:"italic",icon:uC,smallIcon:!0,disableCheck:!0},{method:"setParagraph",type:"chain",label:"paragraph",icon:vC,smallIcon:!0,disableCheck:!1},{method:"toggleBulletList",type:"chain",label:"bullet list",icon:YO,disableCheck:!1},{method:"toggleOrderedList",type:"chain",label:"ordered list",icon:GO,disableCheck:!1},{method:"undo",type:"chain",label:"undo",icon:tC,disableCheck:!0},{method:"redo",type:"chain",label:"redo",icon:oC,disableCheck:!0},{method:"redo",type:"chain",label:"redo",icon:CC,disableCheck:!0}],s=e,o=LM({content:n.modelValue,extensions:[LO,FO.configure({placeholder:"..."})],onUpdate:()=>{s("update:modelValue",o.value.getHTML())}});d.onBeforeUnmount(()=>{o.value.destroy()}),d.watch(()=>n.modelValue,c=>{c!==o.value.getHTML()&&o.value.commands.setContent(c,!1)});function a(c,u,f){u==="chain"?f?o.value.chain().focus()[c](f).run():o.value.chain().focus()[c]().run():this.editor[c]()()}function l(c,u,f,h){return h?u==="chain"?f?!o.value.can().chain().focus()[c](f).run():!o.value.can().chain().focus()[c]().run():!o.value.can()[c]().run():!1}return(c,u)=>d.unref(o)?(d.openBlock(),d.createElementBlock("div",{key:0,class:d.normalizeClass(["pt-px relative flex flex-col rounded border",r[d.unref(de).theme]])},[d.createElementVNode("div",TC,[d.createElementVNode("div",EC,[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(i,f=>d.createElementVNode("div",{key:f.method,class:d.normalizeClass(["w-8 h-8 flex items-center justify-center text-xs rounded",{"cursor-pointer":!l(f.method,f.type,f.params,f.disableCheck),"is-active text-white !bg-zinc-200":d.unref(o).isActive(f.label)}]),onClick:h=>a(f.method,f.type,f.params)},[f.icon?(d.openBlock(),d.createBlock(d.resolveDynamicComponent(f.icon),{key:0,class:d.normalizeClass(["",{"w-3 h-3":f.smallIcon,"w-4 h-4":!f.smallIcon}])},null,8,["class"])):(d.openBlock(),d.createElementBlock("span",NC,d.toDisplayString(d.unref(ha).capitalize(f.label)),1))],10,DC)),64))])]),d.createElementVNode("div",_C,[d.createVNode(d.unref($M),{editor:d.unref(o)},null,8,["editor"])])],2)):d.createCommentVNode("",!0)}}),VC=Object.assign({name:"WpicBadge"},{props:{success:Boolean,warning:Boolean,error:Boolean},setup(t){return(e,n)=>(d.openBlock(),d.createElementBlock("span",{class:d.normalizeClass(["inline-flex items-center justify-center border font-medium rounded-md h-6 text-xs px-2",{"bg-green-50 border-green-200 text-green-700 dark:border-green-600/30 dark:bg-green-800 dark:bg-opacity-20 dark:text-opacity-85 dark:text-green-500":t.success,"bg-yellow-50 border-yellow-200 text-yellow-700 dark:border-yellow-600/30 dark:bg-yellow-800 dark:bg-opacity-10 dark:text-opacity-85 dark:text-yellow-500":t.warning,"bg-red-50 border-red-200 text-red-700 dark:border-red-600/30 dark:bg-red-800 dark:bg-opacity-10 dark:text-opacity-85 dark:text-red-500":t.error,"bg-zinc-50 border-zinc-200 text-zinc-700 dark:border-zinc-600/30 dark:bg-zinc-800 dark:bg-opacity-5 dark:text-opacity-85 dark:text-zinc-400":!t.success&&!t.warning&&!t.error}])},[d.renderSlot(e.$slots,"default")],2))}});//! moment.js
|
|
@@ -126,4 +126,4 @@ var lp;function O(){return lp.apply(null,arguments)}function BC(t){lp=t}function
|
|
|
126
126
|
[`+s+"] ";for(o in arguments[0])ue(arguments[0],o)&&(i+=o+": "+arguments[0][o]+", ");i=i.slice(0,-2)}else i=arguments[s];r.push(i)}up(t+`
|
|
127
127
|
Arguments: `+Array.prototype.slice.call(r).join("")+`
|
|
128
128
|
`+new Error().stack),n=!1}return e.apply(this,arguments)},e)}var fp={};function hp(t,e){O.deprecationHandler!=null&&O.deprecationHandler(t,e),fp[t]||(up(e),fp[t]=!0)}O.suppressDeprecationWarnings=!1,O.deprecationHandler=null;function rn(t){return typeof Function<"u"&&t instanceof Function||Object.prototype.toString.call(t)==="[object Function]"}function IC(t){var e,n;for(n in t)ue(t,n)&&(e=t[n],rn(e)?this[n]=e:this["_"+n]=e);this._config=t,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function jl(t,e){var n=Kn({},t),r;for(r in e)ue(e,r)&&(kr(t[r])&&kr(e[r])?(n[r]={},Kn(n[r],t[r]),Kn(n[r],e[r])):e[r]!=null?n[r]=e[r]:delete n[r]);for(r in t)ue(t,r)&&!ue(e,r)&&kr(t[r])&&(n[r]=Kn({},n[r]));return n}function Wl(t){t!=null&&this.set(t)}var Hl;Object.keys?Hl=Object.keys:Hl=function(t){var e,n=[];for(e in t)ue(t,e)&&n.push(e);return n};var RC={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function $C(t,e,n){var r=this._calendar[t]||this._calendar.sameElse;return rn(r)?r.call(e,n):r}function sn(t,e,n){var r=""+Math.abs(t),i=e-r.length,s=t>=0;return(s?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+r}var Yl=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Co=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Ul={},ii={};function U(t,e,n,r){var i=r;typeof r=="string"&&(i=function(){return this[r]()}),t&&(ii[t]=i),e&&(ii[e[0]]=function(){return sn(i.apply(this,arguments),e[1],e[2])}),n&&(ii[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),t)})}function LC(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function FC(t){var e=t.match(Yl),n,r;for(n=0,r=e.length;n<r;n++)ii[e[n]]?e[n]=ii[e[n]]:e[n]=LC(e[n]);return function(i){var s="",o;for(o=0;o<r;o++)s+=rn(e[o])?e[o].call(i,t):e[o];return s}}function To(t,e){return t.isValid()?(e=pp(e,t.localeData()),Ul[e]=Ul[e]||FC(e),Ul[e](t)):t.localeData().invalidDate()}function pp(t,e){var n=5;function r(i){return e.longDateFormat(i)||i}for(Co.lastIndex=0;n>=0&&Co.test(t);)t=t.replace(Co,r),Co.lastIndex=0,n-=1;return t}var zC={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function jC(t){var e=this._longDateFormat[t],n=this._longDateFormat[t.toUpperCase()];return e||!n?e:(this._longDateFormat[t]=n.match(Yl).map(function(r){return r==="MMMM"||r==="MM"||r==="DD"||r==="dddd"?r.slice(1):r}).join(""),this._longDateFormat[t])}var WC="Invalid date";function HC(){return this._invalidDate}var YC="%d",UC=/\d{1,2}/;function qC(t){return this._ordinal.replace("%d",t)}var KC={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function JC(t,e,n,r){var i=this._relativeTime[n];return rn(i)?i(t,e,n,r):i.replace(/%d/i,t)}function GC(t,e){var n=this._relativeTime[t>0?"future":"past"];return rn(n)?n(e):n.replace(/%s/i,e)}var mp={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function Tt(t){return typeof t=="string"?mp[t]||mp[t.toLowerCase()]:void 0}function ql(t){var e={},n,r;for(r in t)ue(t,r)&&(n=Tt(r),n&&(e[n]=t[r]));return e}var ZC={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function XC(t){var e=[],n;for(n in t)ue(t,n)&&e.push({unit:n,priority:ZC[n]});return e.sort(function(r,i){return r.priority-i.priority}),e}var gp=/\d/,yt=/\d\d/,yp=/\d{3}/,Kl=/\d{4}/,Eo=/[+-]?\d{6}/,ke=/\d\d?/,bp=/\d\d\d\d?/,kp=/\d\d\d\d\d\d?/,Do=/\d{1,3}/,Jl=/\d{1,4}/,No=/[+-]?\d{1,6}/,si=/\d+/,_o=/[+-]?\d+/,QC=/Z|[+-]\d\d:?\d\d/gi,Ao=/Z|[+-]\d\d(?::?\d\d)?/gi,eT=/[+-]?\d+(\.\d{1,3})?/,ls=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,oi=/^[1-9]\d?/,Gl=/^([1-9]\d|\d)/,Vo;Vo={};function W(t,e,n){Vo[t]=rn(e)?e:function(r,i){return r&&n?n:e}}function tT(t,e){return ue(Vo,t)?Vo[t](e._strict,e._locale):new RegExp(nT(t))}function nT(t){return kn(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,n,r,i,s){return n||r||i||s}))}function kn(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Et(t){return t<0?Math.ceil(t)||0:Math.floor(t)}function ae(t){var e=+t,n=0;return e!==0&&isFinite(e)&&(n=Et(e)),n}var Zl={};function ye(t,e){var n,r=e,i;for(typeof t=="string"&&(t=[t]),bn(e)&&(r=function(s,o){o[e]=ae(s)}),i=t.length,n=0;n<i;n++)Zl[t[n]]=r}function cs(t,e){ye(t,function(n,r,i,s){i._w=i._w||{},e(n,i._w,i,s)})}function rT(t,e,n){e!=null&&ue(Zl,t)&&Zl[t](e,n._a,n,t)}function Bo(t){return t%4===0&&t%100!==0||t%400===0}var Ue=0,wn=1,on=2,_e=3,zt=4,vn=5,wr=6,iT=7,sT=8;U("Y",0,0,function(){var t=this.year();return t<=9999?sn(t,4):"+"+t}),U(0,["YY",2],0,function(){return this.year()%100}),U(0,["YYYY",4],0,"year"),U(0,["YYYYY",5],0,"year"),U(0,["YYYYYY",6,!0],0,"year"),W("Y",_o),W("YY",ke,yt),W("YYYY",Jl,Kl),W("YYYYY",No,Eo),W("YYYYYY",No,Eo),ye(["YYYYY","YYYYYY"],Ue),ye("YYYY",function(t,e){e[Ue]=t.length===2?O.parseTwoDigitYear(t):ae(t)}),ye("YY",function(t,e){e[Ue]=O.parseTwoDigitYear(t)}),ye("Y",function(t,e){e[Ue]=parseInt(t,10)});function ds(t){return Bo(t)?366:365}O.parseTwoDigitYear=function(t){return ae(t)+(ae(t)>68?1900:2e3)};var wp=ai("FullYear",!0);function oT(){return Bo(this.year())}function ai(t,e){return function(n){return n!=null?(vp(this,t,n),O.updateOffset(this,e),this):us(this,t)}}function us(t,e){if(!t.isValid())return NaN;var n=t._d,r=t._isUTC;switch(e){case"Milliseconds":return r?n.getUTCMilliseconds():n.getMilliseconds();case"Seconds":return r?n.getUTCSeconds():n.getSeconds();case"Minutes":return r?n.getUTCMinutes():n.getMinutes();case"Hours":return r?n.getUTCHours():n.getHours();case"Date":return r?n.getUTCDate():n.getDate();case"Day":return r?n.getUTCDay():n.getDay();case"Month":return r?n.getUTCMonth():n.getMonth();case"FullYear":return r?n.getUTCFullYear():n.getFullYear();default:return NaN}}function vp(t,e,n){var r,i,s,o,a;if(!(!t.isValid()||isNaN(n))){switch(r=t._d,i=t._isUTC,e){case"Milliseconds":return void(i?r.setUTCMilliseconds(n):r.setMilliseconds(n));case"Seconds":return void(i?r.setUTCSeconds(n):r.setSeconds(n));case"Minutes":return void(i?r.setUTCMinutes(n):r.setMinutes(n));case"Hours":return void(i?r.setUTCHours(n):r.setHours(n));case"Date":return void(i?r.setUTCDate(n):r.setDate(n));case"FullYear":break;default:return}s=n,o=t.month(),a=t.date(),a=a===29&&o===1&&!Bo(s)?28:a,i?r.setUTCFullYear(s,o,a):r.setFullYear(s,o,a)}}function aT(t){return t=Tt(t),rn(this[t])?this[t]():this}function lT(t,e){if(typeof t=="object"){t=ql(t);var n=XC(t),r,i=n.length;for(r=0;r<i;r++)this[n[r].unit](t[n[r].unit])}else if(t=Tt(t),rn(this[t]))return this[t](e);return this}function cT(t,e){return(t%e+e)%e}var Me;Array.prototype.indexOf?Me=Array.prototype.indexOf:Me=function(t){var e;for(e=0;e<this.length;++e)if(this[e]===t)return e;return-1};function Xl(t,e){if(isNaN(t)||isNaN(e))return NaN;var n=cT(e,12);return t+=(e-n)/12,n===1?Bo(t)?29:28:31-n%7%2}U("M",["MM",2],"Mo",function(){return this.month()+1}),U("MMM",0,0,function(t){return this.localeData().monthsShort(this,t)}),U("MMMM",0,0,function(t){return this.localeData().months(this,t)}),W("M",ke,oi),W("MM",ke,yt),W("MMM",function(t,e){return e.monthsShortRegex(t)}),W("MMMM",function(t,e){return e.monthsRegex(t)}),ye(["M","MM"],function(t,e){e[wn]=ae(t)-1}),ye(["MMM","MMMM"],function(t,e,n,r){var i=n._locale.monthsParse(t,r,n._strict);i!=null?e[wn]=i:ne(n).invalidMonth=t});var dT="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),xp="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Sp=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,uT=ls,fT=ls;function hT(t,e){return t?Lt(this._months)?this._months[t.month()]:this._months[(this._months.isFormat||Sp).test(e)?"format":"standalone"][t.month()]:Lt(this._months)?this._months:this._months.standalone}function pT(t,e){return t?Lt(this._monthsShort)?this._monthsShort[t.month()]:this._monthsShort[Sp.test(e)?"format":"standalone"][t.month()]:Lt(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function mT(t,e,n){var r,i,s,o=t.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],r=0;r<12;++r)s=nn([2e3,r]),this._shortMonthsParse[r]=this.monthsShort(s,"").toLocaleLowerCase(),this._longMonthsParse[r]=this.months(s,"").toLocaleLowerCase();return n?e==="MMM"?(i=Me.call(this._shortMonthsParse,o),i!==-1?i:null):(i=Me.call(this._longMonthsParse,o),i!==-1?i:null):e==="MMM"?(i=Me.call(this._shortMonthsParse,o),i!==-1?i:(i=Me.call(this._longMonthsParse,o),i!==-1?i:null)):(i=Me.call(this._longMonthsParse,o),i!==-1?i:(i=Me.call(this._shortMonthsParse,o),i!==-1?i:null))}function gT(t,e,n){var r,i,s;if(this._monthsParseExact)return mT.call(this,t,e,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),r=0;r<12;r++){if(i=nn([2e3,r]),n&&!this._longMonthsParse[r]&&(this._longMonthsParse[r]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[r]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),!n&&!this._monthsParse[r]&&(s="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[r]=new RegExp(s.replace(".",""),"i")),n&&e==="MMMM"&&this._longMonthsParse[r].test(t))return r;if(n&&e==="MMM"&&this._shortMonthsParse[r].test(t))return r;if(!n&&this._monthsParse[r].test(t))return r}}function Mp(t,e){if(!t.isValid())return t;if(typeof e=="string"){if(/^\d+$/.test(e))e=ae(e);else if(e=t.localeData().monthsParse(e),!bn(e))return t}var n=e,r=t.date();return r=r<29?r:Math.min(r,Xl(t.year(),n)),t._isUTC?t._d.setUTCMonth(n,r):t._d.setMonth(n,r),t}function Op(t){return t!=null?(Mp(this,t),O.updateOffset(this,!0),this):us(this,"Month")}function yT(){return Xl(this.year(),this.month())}function bT(t){return this._monthsParseExact?(ue(this,"_monthsRegex")||Cp.call(this),t?this._monthsShortStrictRegex:this._monthsShortRegex):(ue(this,"_monthsShortRegex")||(this._monthsShortRegex=uT),this._monthsShortStrictRegex&&t?this._monthsShortStrictRegex:this._monthsShortRegex)}function kT(t){return this._monthsParseExact?(ue(this,"_monthsRegex")||Cp.call(this),t?this._monthsStrictRegex:this._monthsRegex):(ue(this,"_monthsRegex")||(this._monthsRegex=fT),this._monthsStrictRegex&&t?this._monthsStrictRegex:this._monthsRegex)}function Cp(){function t(l,c){return c.length-l.length}var e=[],n=[],r=[],i,s,o,a;for(i=0;i<12;i++)s=nn([2e3,i]),o=kn(this.monthsShort(s,"")),a=kn(this.months(s,"")),e.push(o),n.push(a),r.push(a),r.push(o);e.sort(t),n.sort(t),r.sort(t),this._monthsRegex=new RegExp("^("+r.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+e.join("|")+")","i")}function wT(t,e,n,r,i,s,o){var a;return t<100&&t>=0?(a=new Date(t+400,e,n,r,i,s,o),isFinite(a.getFullYear())&&a.setFullYear(t)):a=new Date(t,e,n,r,i,s,o),a}function fs(t){var e,n;return t<100&&t>=0?(n=Array.prototype.slice.call(arguments),n[0]=t+400,e=new Date(Date.UTC.apply(null,n)),isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t)):e=new Date(Date.UTC.apply(null,arguments)),e}function Po(t,e,n){var r=7+e-n,i=(7+fs(t,0,r).getUTCDay()-e)%7;return-i+r-1}function Tp(t,e,n,r,i){var s=(7+n-r)%7,o=Po(t,r,i),a=1+7*(e-1)+s+o,l,c;return a<=0?(l=t-1,c=ds(l)+a):a>ds(t)?(l=t+1,c=a-ds(t)):(l=t,c=a),{year:l,dayOfYear:c}}function hs(t,e,n){var r=Po(t.year(),e,n),i=Math.floor((t.dayOfYear()-r-1)/7)+1,s,o;return i<1?(o=t.year()-1,s=i+xn(o,e,n)):i>xn(t.year(),e,n)?(s=i-xn(t.year(),e,n),o=t.year()+1):(o=t.year(),s=i),{week:s,year:o}}function xn(t,e,n){var r=Po(t,e,n),i=Po(t+1,e,n);return(ds(t)-r+i)/7}U("w",["ww",2],"wo","week"),U("W",["WW",2],"Wo","isoWeek"),W("w",ke,oi),W("ww",ke,yt),W("W",ke,oi),W("WW",ke,yt),cs(["w","ww","W","WW"],function(t,e,n,r){e[r.substr(0,1)]=ae(t)});function vT(t){return hs(t,this._week.dow,this._week.doy).week}var xT={dow:0,doy:6};function ST(){return this._week.dow}function MT(){return this._week.doy}function OT(t){var e=this.localeData().week(this);return t==null?e:this.add((t-e)*7,"d")}function CT(t){var e=hs(this,1,4).week;return t==null?e:this.add((t-e)*7,"d")}U("d",0,"do","day"),U("dd",0,0,function(t){return this.localeData().weekdaysMin(this,t)}),U("ddd",0,0,function(t){return this.localeData().weekdaysShort(this,t)}),U("dddd",0,0,function(t){return this.localeData().weekdays(this,t)}),U("e",0,0,"weekday"),U("E",0,0,"isoWeekday"),W("d",ke),W("e",ke),W("E",ke),W("dd",function(t,e){return e.weekdaysMinRegex(t)}),W("ddd",function(t,e){return e.weekdaysShortRegex(t)}),W("dddd",function(t,e){return e.weekdaysRegex(t)}),cs(["dd","ddd","dddd"],function(t,e,n,r){var i=n._locale.weekdaysParse(t,r,n._strict);i!=null?e.d=i:ne(n).invalidWeekday=t}),cs(["d","e","E"],function(t,e,n,r){e[r]=ae(t)});function TT(t,e){return typeof t!="string"?t:isNaN(t)?(t=e.weekdaysParse(t),typeof t=="number"?t:null):parseInt(t,10)}function ET(t,e){return typeof t=="string"?e.weekdaysParse(t)%7||7:isNaN(t)?null:t}function Ql(t,e){return t.slice(e,7).concat(t.slice(0,e))}var DT="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Ep="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),NT="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),_T=ls,AT=ls,VT=ls;function BT(t,e){var n=Lt(this._weekdays)?this._weekdays:this._weekdays[t&&t!==!0&&this._weekdays.isFormat.test(e)?"format":"standalone"];return t===!0?Ql(n,this._week.dow):t?n[t.day()]:n}function PT(t){return t===!0?Ql(this._weekdaysShort,this._week.dow):t?this._weekdaysShort[t.day()]:this._weekdaysShort}function IT(t){return t===!0?Ql(this._weekdaysMin,this._week.dow):t?this._weekdaysMin[t.day()]:this._weekdaysMin}function RT(t,e,n){var r,i,s,o=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],r=0;r<7;++r)s=nn([2e3,1]).day(r),this._minWeekdaysParse[r]=this.weekdaysMin(s,"").toLocaleLowerCase(),this._shortWeekdaysParse[r]=this.weekdaysShort(s,"").toLocaleLowerCase(),this._weekdaysParse[r]=this.weekdays(s,"").toLocaleLowerCase();return n?e==="dddd"?(i=Me.call(this._weekdaysParse,o),i!==-1?i:null):e==="ddd"?(i=Me.call(this._shortWeekdaysParse,o),i!==-1?i:null):(i=Me.call(this._minWeekdaysParse,o),i!==-1?i:null):e==="dddd"?(i=Me.call(this._weekdaysParse,o),i!==-1||(i=Me.call(this._shortWeekdaysParse,o),i!==-1)?i:(i=Me.call(this._minWeekdaysParse,o),i!==-1?i:null)):e==="ddd"?(i=Me.call(this._shortWeekdaysParse,o),i!==-1||(i=Me.call(this._weekdaysParse,o),i!==-1)?i:(i=Me.call(this._minWeekdaysParse,o),i!==-1?i:null)):(i=Me.call(this._minWeekdaysParse,o),i!==-1||(i=Me.call(this._weekdaysParse,o),i!==-1)?i:(i=Me.call(this._shortWeekdaysParse,o),i!==-1?i:null))}function $T(t,e,n){var r,i,s;if(this._weekdaysParseExact)return RT.call(this,t,e,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;r<7;r++){if(i=nn([2e3,1]).day(r),n&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[r]||(s="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[r]=new RegExp(s.replace(".",""),"i")),n&&e==="dddd"&&this._fullWeekdaysParse[r].test(t))return r;if(n&&e==="ddd"&&this._shortWeekdaysParse[r].test(t))return r;if(n&&e==="dd"&&this._minWeekdaysParse[r].test(t))return r;if(!n&&this._weekdaysParse[r].test(t))return r}}function LT(t){if(!this.isValid())return t!=null?this:NaN;var e=us(this,"Day");return t!=null?(t=TT(t,this.localeData()),this.add(t-e,"d")):e}function FT(t){if(!this.isValid())return t!=null?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return t==null?e:this.add(t-e,"d")}function zT(t){if(!this.isValid())return t!=null?this:NaN;if(t!=null){var e=ET(t,this.localeData());return this.day(this.day()%7?e:e-7)}else return this.day()||7}function jT(t){return this._weekdaysParseExact?(ue(this,"_weekdaysRegex")||ec.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(ue(this,"_weekdaysRegex")||(this._weekdaysRegex=_T),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)}function WT(t){return this._weekdaysParseExact?(ue(this,"_weekdaysRegex")||ec.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(ue(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=AT),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function HT(t){return this._weekdaysParseExact?(ue(this,"_weekdaysRegex")||ec.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(ue(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=VT),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function ec(){function t(u,f){return f.length-u.length}var e=[],n=[],r=[],i=[],s,o,a,l,c;for(s=0;s<7;s++)o=nn([2e3,1]).day(s),a=kn(this.weekdaysMin(o,"")),l=kn(this.weekdaysShort(o,"")),c=kn(this.weekdays(o,"")),e.push(a),n.push(l),r.push(c),i.push(a),i.push(l),i.push(c);e.sort(t),n.sort(t),r.sort(t),i.sort(t),this._weekdaysRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+e.join("|")+")","i")}function tc(){return this.hours()%12||12}function YT(){return this.hours()||24}U("H",["HH",2],0,"hour"),U("h",["hh",2],0,tc),U("k",["kk",2],0,YT),U("hmm",0,0,function(){return""+tc.apply(this)+sn(this.minutes(),2)}),U("hmmss",0,0,function(){return""+tc.apply(this)+sn(this.minutes(),2)+sn(this.seconds(),2)}),U("Hmm",0,0,function(){return""+this.hours()+sn(this.minutes(),2)}),U("Hmmss",0,0,function(){return""+this.hours()+sn(this.minutes(),2)+sn(this.seconds(),2)});function Dp(t,e){U(t,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}Dp("a",!0),Dp("A",!1);function Np(t,e){return e._meridiemParse}W("a",Np),W("A",Np),W("H",ke,Gl),W("h",ke,oi),W("k",ke,oi),W("HH",ke,yt),W("hh",ke,yt),W("kk",ke,yt),W("hmm",bp),W("hmmss",kp),W("Hmm",bp),W("Hmmss",kp),ye(["H","HH"],_e),ye(["k","kk"],function(t,e,n){var r=ae(t);e[_e]=r===24?0:r}),ye(["a","A"],function(t,e,n){n._isPm=n._locale.isPM(t),n._meridiem=t}),ye(["h","hh"],function(t,e,n){e[_e]=ae(t),ne(n).bigHour=!0}),ye("hmm",function(t,e,n){var r=t.length-2;e[_e]=ae(t.substr(0,r)),e[zt]=ae(t.substr(r)),ne(n).bigHour=!0}),ye("hmmss",function(t,e,n){var r=t.length-4,i=t.length-2;e[_e]=ae(t.substr(0,r)),e[zt]=ae(t.substr(r,2)),e[vn]=ae(t.substr(i)),ne(n).bigHour=!0}),ye("Hmm",function(t,e,n){var r=t.length-2;e[_e]=ae(t.substr(0,r)),e[zt]=ae(t.substr(r))}),ye("Hmmss",function(t,e,n){var r=t.length-4,i=t.length-2;e[_e]=ae(t.substr(0,r)),e[zt]=ae(t.substr(r,2)),e[vn]=ae(t.substr(i))});function UT(t){return(t+"").toLowerCase().charAt(0)==="p"}var qT=/[ap]\.?m?\.?/i,KT=ai("Hours",!0);function JT(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"}var _p={calendar:RC,longDateFormat:zC,invalidDate:WC,ordinal:YC,dayOfMonthOrdinalParse:UC,relativeTime:KC,months:dT,monthsShort:xp,week:xT,weekdays:DT,weekdaysMin:NT,weekdaysShort:Ep,meridiemParse:qT},xe={},ps={},ms;function GT(t,e){var n,r=Math.min(t.length,e.length);for(n=0;n<r;n+=1)if(t[n]!==e[n])return n;return r}function Ap(t){return t&&t.toLowerCase().replace("_","-")}function ZT(t){for(var e=0,n,r,i,s;e<t.length;){for(s=Ap(t[e]).split("-"),n=s.length,r=Ap(t[e+1]),r=r?r.split("-"):null;n>0;){if(i=Io(s.slice(0,n).join("-")),i)return i;if(r&&r.length>=n&>(s,r)>=n-1)break;n--}e++}return ms}function XT(t){return!!(t&&t.match("^[^/\\\\]*$"))}function Io(t){var e=null,n;if(xe[t]===void 0&&typeof module<"u"&&module&&module.exports&&XT(t))try{e=ms._abbr,n=require,n("./locale/"+t),Jn(e)}catch{xe[t]=null}return xe[t]}function Jn(t,e){var n;return t&&(lt(e)?n=Sn(t):n=nc(t,e),n?ms=n:typeof console<"u"&&console.warn&&console.warn("Locale "+t+" not found. Did you forget to load it?")),ms._abbr}function nc(t,e){if(e!==null){var n,r=_p;if(e.abbr=t,xe[t]!=null)hp("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),r=xe[t]._config;else if(e.parentLocale!=null)if(xe[e.parentLocale]!=null)r=xe[e.parentLocale]._config;else if(n=Io(e.parentLocale),n!=null)r=n._config;else return ps[e.parentLocale]||(ps[e.parentLocale]=[]),ps[e.parentLocale].push({name:t,config:e}),null;return xe[t]=new Wl(jl(r,e)),ps[t]&&ps[t].forEach(function(i){nc(i.name,i.config)}),Jn(t),xe[t]}else return delete xe[t],null}function QT(t,e){if(e!=null){var n,r,i=_p;xe[t]!=null&&xe[t].parentLocale!=null?xe[t].set(jl(xe[t]._config,e)):(r=Io(t),r!=null&&(i=r._config),e=jl(i,e),r==null&&(e.abbr=t),n=new Wl(e),n.parentLocale=xe[t],xe[t]=n),Jn(t)}else xe[t]!=null&&(xe[t].parentLocale!=null?(xe[t]=xe[t].parentLocale,t===Jn()&&Jn(t)):xe[t]!=null&&delete xe[t]);return xe[t]}function Sn(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return ms;if(!Lt(t)){if(e=Io(t),e)return e;t=[t]}return ZT(t)}function eE(){return Hl(xe)}function rc(t){var e,n=t._a;return n&&ne(t).overflow===-2&&(e=n[wn]<0||n[wn]>11?wn:n[on]<1||n[on]>Xl(n[Ue],n[wn])?on:n[_e]<0||n[_e]>24||n[_e]===24&&(n[zt]!==0||n[vn]!==0||n[wr]!==0)?_e:n[zt]<0||n[zt]>59?zt:n[vn]<0||n[vn]>59?vn:n[wr]<0||n[wr]>999?wr:-1,ne(t)._overflowDayOfYear&&(e<Ue||e>on)&&(e=on),ne(t)._overflowWeeks&&e===-1&&(e=iT),ne(t)._overflowWeekday&&e===-1&&(e=sT),ne(t).overflow=e),t}var tE=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,nE=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,rE=/Z|[+-]\d\d(?::?\d\d)?/,Ro=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],ic=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],iE=/^\/?Date\((-?\d+)/i,sE=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,oE={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Vp(t){var e,n,r=t._i,i=tE.exec(r)||nE.exec(r),s,o,a,l,c=Ro.length,u=ic.length;if(i){for(ne(t).iso=!0,e=0,n=c;e<n;e++)if(Ro[e][1].exec(i[1])){o=Ro[e][0],s=Ro[e][2]!==!1;break}if(o==null){t._isValid=!1;return}if(i[3]){for(e=0,n=u;e<n;e++)if(ic[e][1].exec(i[3])){a=(i[2]||" ")+ic[e][0];break}if(a==null){t._isValid=!1;return}}if(!s&&a!=null){t._isValid=!1;return}if(i[4])if(rE.exec(i[4]))l="Z";else{t._isValid=!1;return}t._f=o+(a||"")+(l||""),oc(t)}else t._isValid=!1}function aE(t,e,n,r,i,s){var o=[lE(t),xp.indexOf(e),parseInt(n,10),parseInt(r,10),parseInt(i,10)];return s&&o.push(parseInt(s,10)),o}function lE(t){var e=parseInt(t,10);return e<=49?2e3+e:e<=999?1900+e:e}function cE(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function dE(t,e,n){if(t){var r=Ep.indexOf(t),i=new Date(e[0],e[1],e[2]).getDay();if(r!==i)return ne(n).weekdayMismatch=!0,n._isValid=!1,!1}return!0}function uE(t,e,n){if(t)return oE[t];if(e)return 0;var r=parseInt(n,10),i=r%100,s=(r-i)/100;return s*60+i}function Bp(t){var e=sE.exec(cE(t._i)),n;if(e){if(n=aE(e[4],e[3],e[2],e[5],e[6],e[7]),!dE(e[1],n,t))return;t._a=n,t._tzm=uE(e[8],e[9],e[10]),t._d=fs.apply(null,t._a),t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),ne(t).rfc2822=!0}else t._isValid=!1}function fE(t){var e=iE.exec(t._i);if(e!==null){t._d=new Date(+e[1]);return}if(Vp(t),t._isValid===!1)delete t._isValid;else return;if(Bp(t),t._isValid===!1)delete t._isValid;else return;t._strict?t._isValid=!1:O.createFromInputFallback(t)}O.createFromInputFallback=Ct("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(t){t._d=new Date(t._i+(t._useUTC?" UTC":""))});function li(t,e,n){return t??e??n}function hE(t){var e=new Date(O.now());return t._useUTC?[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()]:[e.getFullYear(),e.getMonth(),e.getDate()]}function sc(t){var e,n,r=[],i,s,o;if(!t._d){for(i=hE(t),t._w&&t._a[on]==null&&t._a[wn]==null&&pE(t),t._dayOfYear!=null&&(o=li(t._a[Ue],i[Ue]),(t._dayOfYear>ds(o)||t._dayOfYear===0)&&(ne(t)._overflowDayOfYear=!0),n=fs(o,0,t._dayOfYear),t._a[wn]=n.getUTCMonth(),t._a[on]=n.getUTCDate()),e=0;e<3&&t._a[e]==null;++e)t._a[e]=r[e]=i[e];for(;e<7;e++)t._a[e]=r[e]=t._a[e]==null?e===2?1:0:t._a[e];t._a[_e]===24&&t._a[zt]===0&&t._a[vn]===0&&t._a[wr]===0&&(t._nextDay=!0,t._a[_e]=0),t._d=(t._useUTC?fs:wT).apply(null,r),s=t._useUTC?t._d.getUTCDay():t._d.getDay(),t._tzm!=null&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[_e]=24),t._w&&typeof t._w.d<"u"&&t._w.d!==s&&(ne(t).weekdayMismatch=!0)}}function pE(t){var e,n,r,i,s,o,a,l,c;e=t._w,e.GG!=null||e.W!=null||e.E!=null?(s=1,o=4,n=li(e.GG,t._a[Ue],hs(we(),1,4).year),r=li(e.W,1),i=li(e.E,1),(i<1||i>7)&&(l=!0)):(s=t._locale._week.dow,o=t._locale._week.doy,c=hs(we(),s,o),n=li(e.gg,t._a[Ue],c.year),r=li(e.w,c.week),e.d!=null?(i=e.d,(i<0||i>6)&&(l=!0)):e.e!=null?(i=e.e+s,(e.e<0||e.e>6)&&(l=!0)):i=s),r<1||r>xn(n,s,o)?ne(t)._overflowWeeks=!0:l!=null?ne(t)._overflowWeekday=!0:(a=Tp(n,r,i,s,o),t._a[Ue]=a.year,t._dayOfYear=a.dayOfYear)}O.ISO_8601=function(){},O.RFC_2822=function(){};function oc(t){if(t._f===O.ISO_8601){Vp(t);return}if(t._f===O.RFC_2822){Bp(t);return}t._a=[],ne(t).empty=!0;var e=""+t._i,n,r,i,s,o,a=e.length,l=0,c,u;for(i=pp(t._f,t._locale).match(Yl)||[],u=i.length,n=0;n<u;n++)s=i[n],r=(e.match(tT(s,t))||[])[0],r&&(o=e.substr(0,e.indexOf(r)),o.length>0&&ne(t).unusedInput.push(o),e=e.slice(e.indexOf(r)+r.length),l+=r.length),ii[s]?(r?ne(t).empty=!1:ne(t).unusedTokens.push(s),rT(s,r,t)):t._strict&&!r&&ne(t).unusedTokens.push(s);ne(t).charsLeftOver=a-l,e.length>0&&ne(t).unusedInput.push(e),t._a[_e]<=12&&ne(t).bigHour===!0&&t._a[_e]>0&&(ne(t).bigHour=void 0),ne(t).parsedDateParts=t._a.slice(0),ne(t).meridiem=t._meridiem,t._a[_e]=mE(t._locale,t._a[_e],t._meridiem),c=ne(t).era,c!==null&&(t._a[Ue]=t._locale.erasConvertYear(c,t._a[Ue])),sc(t),rc(t)}function mE(t,e,n){var r;return n==null?e:t.meridiemHour!=null?t.meridiemHour(e,n):(t.isPM!=null&&(r=t.isPM(n),r&&e<12&&(e+=12),!r&&e===12&&(e=0)),e)}function gE(t){var e,n,r,i,s,o,a=!1,l=t._f.length;if(l===0){ne(t).invalidFormat=!0,t._d=new Date(NaN);return}for(i=0;i<l;i++)s=0,o=!1,e=zl({},t),t._useUTC!=null&&(e._useUTC=t._useUTC),e._f=t._f[i],oc(e),Ll(e)&&(o=!0),s+=ne(e).charsLeftOver,s+=ne(e).unusedTokens.length*10,ne(e).score=s,a?s<r&&(r=s,n=e):(r==null||s<r||o)&&(r=s,n=e,o&&(a=!0));Kn(t,n||e)}function yE(t){if(!t._d){var e=ql(t._i),n=e.day===void 0?e.date:e.day;t._a=cp([e.year,e.month,n,e.hour,e.minute,e.second,e.millisecond],function(r){return r&&parseInt(r,10)}),sc(t)}}function bE(t){var e=new as(rc(Pp(t)));return e._nextDay&&(e.add(1,"d"),e._nextDay=void 0),e}function Pp(t){var e=t._i,n=t._f;return t._locale=t._locale||Sn(t._l),e===null||n===void 0&&e===""?Oo({nullInput:!0}):(typeof e=="string"&&(t._i=e=t._locale.preparse(e)),Ft(e)?new as(rc(e)):(ss(e)?t._d=e:Lt(n)?gE(t):n?oc(t):kE(t),Ll(t)||(t._d=null),t))}function kE(t){var e=t._i;lt(e)?t._d=new Date(O.now()):ss(e)?t._d=new Date(e.valueOf()):typeof e=="string"?fE(t):Lt(e)?(t._a=cp(e.slice(0),function(n){return parseInt(n,10)}),sc(t)):kr(e)?yE(t):bn(e)?t._d=new Date(e):O.createFromInputFallback(t)}function Ip(t,e,n,r,i){var s={};return(e===!0||e===!1)&&(r=e,e=void 0),(n===!0||n===!1)&&(r=n,n=void 0),(kr(t)&&Rl(t)||Lt(t)&&t.length===0)&&(t=void 0),s._isAMomentObject=!0,s._useUTC=s._isUTC=i,s._l=n,s._i=t,s._f=e,s._strict=r,bE(s)}function we(t,e,n,r){return Ip(t,e,n,r,!1)}var wE=Ct("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var t=we.apply(null,arguments);return this.isValid()&&t.isValid()?t<this?this:t:Oo()}),vE=Ct("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var t=we.apply(null,arguments);return this.isValid()&&t.isValid()?t>this?this:t:Oo()});function Rp(t,e){var n,r;if(e.length===1&&Lt(e[0])&&(e=e[0]),!e.length)return we();for(n=e[0],r=1;r<e.length;++r)(!e[r].isValid()||e[r][t](n))&&(n=e[r]);return n}function xE(){var t=[].slice.call(arguments,0);return Rp("isBefore",t)}function SE(){var t=[].slice.call(arguments,0);return Rp("isAfter",t)}var ME=function(){return Date.now?Date.now():+new Date},gs=["year","quarter","month","week","day","hour","minute","second","millisecond"];function OE(t){var e,n=!1,r,i=gs.length;for(e in t)if(ue(t,e)&&!(Me.call(gs,e)!==-1&&(t[e]==null||!isNaN(t[e]))))return!1;for(r=0;r<i;++r)if(t[gs[r]]){if(n)return!1;parseFloat(t[gs[r]])!==ae(t[gs[r]])&&(n=!0)}return!0}function CE(){return this._isValid}function TE(){return jt(NaN)}function $o(t){var e=ql(t),n=e.year||0,r=e.quarter||0,i=e.month||0,s=e.week||e.isoWeek||0,o=e.day||0,a=e.hour||0,l=e.minute||0,c=e.second||0,u=e.millisecond||0;this._isValid=OE(e),this._milliseconds=+u+c*1e3+l*6e4+a*1e3*60*60,this._days=+o+s*7,this._months=+i+r*3+n*12,this._data={},this._locale=Sn(),this._bubble()}function Lo(t){return t instanceof $o}function ac(t){return t<0?Math.round(-1*t)*-1:Math.round(t)}function EE(t,e,n){var r=Math.min(t.length,e.length),i=Math.abs(t.length-e.length),s=0,o;for(o=0;o<r;o++)ae(t[o])!==ae(e[o])&&s++;return s+i}function $p(t,e){U(t,0,0,function(){var n=this.utcOffset(),r="+";return n<0&&(n=-n,r="-"),r+sn(~~(n/60),2)+e+sn(~~n%60,2)})}$p("Z",":"),$p("ZZ",""),W("Z",Ao),W("ZZ",Ao),ye(["Z","ZZ"],function(t,e,n){n._useUTC=!0,n._tzm=lc(Ao,t)});var DE=/([\+\-]|\d\d)/gi;function lc(t,e){var n=(e||"").match(t),r,i,s;return n===null?null:(r=n[n.length-1]||[],i=(r+"").match(DE)||["-",0,0],s=+(i[1]*60)+ae(i[2]),s===0?0:i[0]==="+"?s:-s)}function cc(t,e){var n,r;return e._isUTC?(n=e.clone(),r=(Ft(t)||ss(t)?t.valueOf():we(t).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+r),O.updateOffset(n,!1),n):we(t).local()}function dc(t){return-Math.round(t._d.getTimezoneOffset())}O.updateOffset=function(){};function NE(t,e,n){var r=this._offset||0,i;if(!this.isValid())return t!=null?this:NaN;if(t!=null){if(typeof t=="string"){if(t=lc(Ao,t),t===null)return this}else Math.abs(t)<16&&!n&&(t=t*60);return!this._isUTC&&e&&(i=dc(this)),this._offset=t,this._isUTC=!0,i!=null&&this.add(i,"m"),r!==t&&(!e||this._changeInProgress?jp(this,jt(t-r,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,O.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?r:dc(this)}function _E(t,e){return t!=null?(typeof t!="string"&&(t=-t),this.utcOffset(t,e),this):-this.utcOffset()}function AE(t){return this.utcOffset(0,t)}function VE(t){return this._isUTC&&(this.utcOffset(0,t),this._isUTC=!1,t&&this.subtract(dc(this),"m")),this}function BE(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var t=lc(QC,this._i);t!=null?this.utcOffset(t):this.utcOffset(0,!0)}return this}function PE(t){return this.isValid()?(t=t?we(t).utcOffset():0,(this.utcOffset()-t)%60===0):!1}function IE(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function RE(){if(!lt(this._isDSTShifted))return this._isDSTShifted;var t={},e;return zl(t,this),t=Pp(t),t._a?(e=t._isUTC?nn(t._a):we(t._a),this._isDSTShifted=this.isValid()&&EE(t._a,e.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function $E(){return this.isValid()?!this._isUTC:!1}function LE(){return this.isValid()?this._isUTC:!1}function Lp(){return this.isValid()?this._isUTC&&this._offset===0:!1}var FE=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,zE=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function jt(t,e){var n=t,r=null,i,s,o;return Lo(t)?n={ms:t._milliseconds,d:t._days,M:t._months}:bn(t)||!isNaN(+t)?(n={},e?n[e]=+t:n.milliseconds=+t):(r=FE.exec(t))?(i=r[1]==="-"?-1:1,n={y:0,d:ae(r[on])*i,h:ae(r[_e])*i,m:ae(r[zt])*i,s:ae(r[vn])*i,ms:ae(ac(r[wr]*1e3))*i}):(r=zE.exec(t))?(i=r[1]==="-"?-1:1,n={y:vr(r[2],i),M:vr(r[3],i),w:vr(r[4],i),d:vr(r[5],i),h:vr(r[6],i),m:vr(r[7],i),s:vr(r[8],i)}):n==null?n={}:typeof n=="object"&&("from"in n||"to"in n)&&(o=jE(we(n.from),we(n.to)),n={},n.ms=o.milliseconds,n.M=o.months),s=new $o(n),Lo(t)&&ue(t,"_locale")&&(s._locale=t._locale),Lo(t)&&ue(t,"_isValid")&&(s._isValid=t._isValid),s}jt.fn=$o.prototype,jt.invalid=TE;function vr(t,e){var n=t&&parseFloat(t.replace(",","."));return(isNaN(n)?0:n)*e}function Fp(t,e){var n={};return n.months=e.month()-t.month()+(e.year()-t.year())*12,t.clone().add(n.months,"M").isAfter(e)&&--n.months,n.milliseconds=+e-+t.clone().add(n.months,"M"),n}function jE(t,e){var n;return t.isValid()&&e.isValid()?(e=cc(e,t),t.isBefore(e)?n=Fp(t,e):(n=Fp(e,t),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function zp(t,e){return function(n,r){var i,s;return r!==null&&!isNaN(+r)&&(hp(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),s=n,n=r,r=s),i=jt(n,r),jp(this,i,t),this}}function jp(t,e,n,r){var i=e._milliseconds,s=ac(e._days),o=ac(e._months);t.isValid()&&(r=r??!0,o&&Mp(t,us(t,"Month")+o*n),s&&vp(t,"Date",us(t,"Date")+s*n),i&&t._d.setTime(t._d.valueOf()+i*n),r&&O.updateOffset(t,s||o))}var WE=zp(1,"add"),HE=zp(-1,"subtract");function Wp(t){return typeof t=="string"||t instanceof String}function YE(t){return Ft(t)||ss(t)||Wp(t)||bn(t)||qE(t)||UE(t)||t===null||t===void 0}function UE(t){var e=kr(t)&&!Rl(t),n=!1,r=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],i,s,o=r.length;for(i=0;i<o;i+=1)s=r[i],n=n||ue(t,s);return e&&n}function qE(t){var e=Lt(t),n=!1;return e&&(n=t.filter(function(r){return!bn(r)&&Wp(t)}).length===0),e&&n}function KE(t){var e=kr(t)&&!Rl(t),n=!1,r=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],i,s;for(i=0;i<r.length;i+=1)s=r[i],n=n||ue(t,s);return e&&n}function JE(t,e){var n=t.diff(e,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"}function GE(t,e){arguments.length===1&&(arguments[0]?YE(arguments[0])?(t=arguments[0],e=void 0):KE(arguments[0])&&(e=arguments[0],t=void 0):(t=void 0,e=void 0));var n=t||we(),r=cc(n,this).startOf("day"),i=O.calendarFormat(this,r)||"sameElse",s=e&&(rn(e[i])?e[i].call(this,n):e[i]);return this.format(s||this.localeData().calendar(i,this,we(n)))}function ZE(){return new as(this)}function XE(t,e){var n=Ft(t)?t:we(t);return this.isValid()&&n.isValid()?(e=Tt(e)||"millisecond",e==="millisecond"?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(e).valueOf()):!1}function QE(t,e){var n=Ft(t)?t:we(t);return this.isValid()&&n.isValid()?(e=Tt(e)||"millisecond",e==="millisecond"?this.valueOf()<n.valueOf():this.clone().endOf(e).valueOf()<n.valueOf()):!1}function e2(t,e,n,r){var i=Ft(t)?t:we(t),s=Ft(e)?e:we(e);return this.isValid()&&i.isValid()&&s.isValid()?(r=r||"()",(r[0]==="("?this.isAfter(i,n):!this.isBefore(i,n))&&(r[1]===")"?this.isBefore(s,n):!this.isAfter(s,n))):!1}function t2(t,e){var n=Ft(t)?t:we(t),r;return this.isValid()&&n.isValid()?(e=Tt(e)||"millisecond",e==="millisecond"?this.valueOf()===n.valueOf():(r=n.valueOf(),this.clone().startOf(e).valueOf()<=r&&r<=this.clone().endOf(e).valueOf())):!1}function n2(t,e){return this.isSame(t,e)||this.isAfter(t,e)}function r2(t,e){return this.isSame(t,e)||this.isBefore(t,e)}function i2(t,e,n){var r,i,s;if(!this.isValid())return NaN;if(r=cc(t,this),!r.isValid())return NaN;switch(i=(r.utcOffset()-this.utcOffset())*6e4,e=Tt(e),e){case"year":s=Fo(this,r)/12;break;case"month":s=Fo(this,r);break;case"quarter":s=Fo(this,r)/3;break;case"second":s=(this-r)/1e3;break;case"minute":s=(this-r)/6e4;break;case"hour":s=(this-r)/36e5;break;case"day":s=(this-r-i)/864e5;break;case"week":s=(this-r-i)/6048e5;break;default:s=this-r}return n?s:Et(s)}function Fo(t,e){if(t.date()<e.date())return-Fo(e,t);var n=(e.year()-t.year())*12+(e.month()-t.month()),r=t.clone().add(n,"months"),i,s;return e-r<0?(i=t.clone().add(n-1,"months"),s=(e-r)/(r-i)):(i=t.clone().add(n+1,"months"),s=(e-r)/(i-r)),-(n+s)||0}O.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",O.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function s2(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function o2(t){if(!this.isValid())return null;var e=t!==!0,n=e?this.clone().utc():this;return n.year()<0||n.year()>9999?To(n,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):rn(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",To(n,"Z")):To(n,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function a2(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var t="moment",e="",n,r,i,s;return this.isLocal()||(t=this.utcOffset()===0?"moment.utc":"moment.parseZone",e="Z"),n="["+t+'("]',r=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i="-MM-DD[T]HH:mm:ss.SSS",s=e+'[")]',this.format(n+r+i+s)}function l2(t){t||(t=this.isUtc()?O.defaultFormatUtc:O.defaultFormat);var e=To(this,t);return this.localeData().postformat(e)}function c2(t,e){return this.isValid()&&(Ft(t)&&t.isValid()||we(t).isValid())?jt({to:this,from:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function d2(t){return this.from(we(),t)}function u2(t,e){return this.isValid()&&(Ft(t)&&t.isValid()||we(t).isValid())?jt({from:this,to:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function f2(t){return this.to(we(),t)}function Hp(t){var e;return t===void 0?this._locale._abbr:(e=Sn(t),e!=null&&(this._locale=e),this)}var Yp=Ct("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return t===void 0?this.localeData():this.locale(t)});function Up(){return this._locale}var zo=1e3,ci=60*zo,jo=60*ci,qp=(365*400+97)*24*jo;function di(t,e){return(t%e+e)%e}function Kp(t,e,n){return t<100&&t>=0?new Date(t+400,e,n)-qp:new Date(t,e,n).valueOf()}function Jp(t,e,n){return t<100&&t>=0?Date.UTC(t+400,e,n)-qp:Date.UTC(t,e,n)}function h2(t){var e,n;if(t=Tt(t),t===void 0||t==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?Jp:Kp,t){case"year":e=n(this.year(),0,1);break;case"quarter":e=n(this.year(),this.month()-this.month()%3,1);break;case"month":e=n(this.year(),this.month(),1);break;case"week":e=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":e=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":e=n(this.year(),this.month(),this.date());break;case"hour":e=this._d.valueOf(),e-=di(e+(this._isUTC?0:this.utcOffset()*ci),jo);break;case"minute":e=this._d.valueOf(),e-=di(e,ci);break;case"second":e=this._d.valueOf(),e-=di(e,zo);break}return this._d.setTime(e),O.updateOffset(this,!0),this}function p2(t){var e,n;if(t=Tt(t),t===void 0||t==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?Jp:Kp,t){case"year":e=n(this.year()+1,0,1)-1;break;case"quarter":e=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":e=n(this.year(),this.month()+1,1)-1;break;case"week":e=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":e=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":e=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":e=this._d.valueOf(),e+=jo-di(e+(this._isUTC?0:this.utcOffset()*ci),jo)-1;break;case"minute":e=this._d.valueOf(),e+=ci-di(e,ci)-1;break;case"second":e=this._d.valueOf(),e+=zo-di(e,zo)-1;break}return this._d.setTime(e),O.updateOffset(this,!0),this}function m2(){return this._d.valueOf()-(this._offset||0)*6e4}function g2(){return Math.floor(this.valueOf()/1e3)}function y2(){return new Date(this.valueOf())}function b2(){var t=this;return[t.year(),t.month(),t.date(),t.hour(),t.minute(),t.second(),t.millisecond()]}function k2(){var t=this;return{years:t.year(),months:t.month(),date:t.date(),hours:t.hours(),minutes:t.minutes(),seconds:t.seconds(),milliseconds:t.milliseconds()}}function w2(){return this.isValid()?this.toISOString():null}function v2(){return Ll(this)}function x2(){return Kn({},ne(this))}function S2(){return ne(this).overflow}function M2(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}U("N",0,0,"eraAbbr"),U("NN",0,0,"eraAbbr"),U("NNN",0,0,"eraAbbr"),U("NNNN",0,0,"eraName"),U("NNNNN",0,0,"eraNarrow"),U("y",["y",1],"yo","eraYear"),U("y",["yy",2],0,"eraYear"),U("y",["yyy",3],0,"eraYear"),U("y",["yyyy",4],0,"eraYear"),W("N",uc),W("NN",uc),W("NNN",uc),W("NNNN",P2),W("NNNNN",I2),ye(["N","NN","NNN","NNNN","NNNNN"],function(t,e,n,r){var i=n._locale.erasParse(t,r,n._strict);i?ne(n).era=i:ne(n).invalidEra=t}),W("y",si),W("yy",si),W("yyy",si),W("yyyy",si),W("yo",R2),ye(["y","yy","yyy","yyyy"],Ue),ye(["yo"],function(t,e,n,r){var i;n._locale._eraYearOrdinalRegex&&(i=t.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?e[Ue]=n._locale.eraYearOrdinalParse(t,i):e[Ue]=parseInt(t,10)});function O2(t,e){var n,r,i,s=this._eras||Sn("en")._eras;for(n=0,r=s.length;n<r;++n){switch(typeof s[n].since){case"string":i=O(s[n].since).startOf("day"),s[n].since=i.valueOf();break}switch(typeof s[n].until){case"undefined":s[n].until=1/0;break;case"string":i=O(s[n].until).startOf("day").valueOf(),s[n].until=i.valueOf();break}}return s}function C2(t,e,n){var r,i,s=this.eras(),o,a,l;for(t=t.toUpperCase(),r=0,i=s.length;r<i;++r)if(o=s[r].name.toUpperCase(),a=s[r].abbr.toUpperCase(),l=s[r].narrow.toUpperCase(),n)switch(e){case"N":case"NN":case"NNN":if(a===t)return s[r];break;case"NNNN":if(o===t)return s[r];break;case"NNNNN":if(l===t)return s[r];break}else if([o,a,l].indexOf(t)>=0)return s[r]}function T2(t,e){var n=t.since<=t.until?1:-1;return e===void 0?O(t.since).year():O(t.since).year()+(e-t.offset)*n}function E2(){var t,e,n,r=this.localeData().eras();for(t=0,e=r.length;t<e;++t)if(n=this.clone().startOf("day").valueOf(),r[t].since<=n&&n<=r[t].until||r[t].until<=n&&n<=r[t].since)return r[t].name;return""}function D2(){var t,e,n,r=this.localeData().eras();for(t=0,e=r.length;t<e;++t)if(n=this.clone().startOf("day").valueOf(),r[t].since<=n&&n<=r[t].until||r[t].until<=n&&n<=r[t].since)return r[t].narrow;return""}function N2(){var t,e,n,r=this.localeData().eras();for(t=0,e=r.length;t<e;++t)if(n=this.clone().startOf("day").valueOf(),r[t].since<=n&&n<=r[t].until||r[t].until<=n&&n<=r[t].since)return r[t].abbr;return""}function _2(){var t,e,n,r,i=this.localeData().eras();for(t=0,e=i.length;t<e;++t)if(n=i[t].since<=i[t].until?1:-1,r=this.clone().startOf("day").valueOf(),i[t].since<=r&&r<=i[t].until||i[t].until<=r&&r<=i[t].since)return(this.year()-O(i[t].since).year())*n+i[t].offset;return this.year()}function A2(t){return ue(this,"_erasNameRegex")||fc.call(this),t?this._erasNameRegex:this._erasRegex}function V2(t){return ue(this,"_erasAbbrRegex")||fc.call(this),t?this._erasAbbrRegex:this._erasRegex}function B2(t){return ue(this,"_erasNarrowRegex")||fc.call(this),t?this._erasNarrowRegex:this._erasRegex}function uc(t,e){return e.erasAbbrRegex(t)}function P2(t,e){return e.erasNameRegex(t)}function I2(t,e){return e.erasNarrowRegex(t)}function R2(t,e){return e._eraYearOrdinalRegex||si}function fc(){var t=[],e=[],n=[],r=[],i,s,o,a,l,c=this.eras();for(i=0,s=c.length;i<s;++i)o=kn(c[i].name),a=kn(c[i].abbr),l=kn(c[i].narrow),e.push(o),t.push(a),n.push(l),r.push(o),r.push(a),r.push(l);this._erasRegex=new RegExp("^("+r.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+e.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+t.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+n.join("|")+")","i")}U(0,["gg",2],0,function(){return this.weekYear()%100}),U(0,["GG",2],0,function(){return this.isoWeekYear()%100});function Wo(t,e){U(0,[t,t.length],0,e)}Wo("gggg","weekYear"),Wo("ggggg","weekYear"),Wo("GGGG","isoWeekYear"),Wo("GGGGG","isoWeekYear"),W("G",_o),W("g",_o),W("GG",ke,yt),W("gg",ke,yt),W("GGGG",Jl,Kl),W("gggg",Jl,Kl),W("GGGGG",No,Eo),W("ggggg",No,Eo),cs(["gggg","ggggg","GGGG","GGGGG"],function(t,e,n,r){e[r.substr(0,2)]=ae(t)}),cs(["gg","GG"],function(t,e,n,r){e[r]=O.parseTwoDigitYear(t)});function $2(t){return Gp.call(this,t,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function L2(t){return Gp.call(this,t,this.isoWeek(),this.isoWeekday(),1,4)}function F2(){return xn(this.year(),1,4)}function z2(){return xn(this.isoWeekYear(),1,4)}function j2(){var t=this.localeData()._week;return xn(this.year(),t.dow,t.doy)}function W2(){var t=this.localeData()._week;return xn(this.weekYear(),t.dow,t.doy)}function Gp(t,e,n,r,i){var s;return t==null?hs(this,r,i).year:(s=xn(t,r,i),e>s&&(e=s),H2.call(this,t,e,n,r,i))}function H2(t,e,n,r,i){var s=Tp(t,e,n,r,i),o=fs(s.year,0,s.dayOfYear);return this.year(o.getUTCFullYear()),this.month(o.getUTCMonth()),this.date(o.getUTCDate()),this}U("Q",0,"Qo","quarter"),W("Q",gp),ye("Q",function(t,e){e[wn]=(ae(t)-1)*3});function Y2(t){return t==null?Math.ceil((this.month()+1)/3):this.month((t-1)*3+this.month()%3)}U("D",["DD",2],"Do","date"),W("D",ke,oi),W("DD",ke,yt),W("Do",function(t,e){return t?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient}),ye(["D","DD"],on),ye("Do",function(t,e){e[on]=ae(t.match(ke)[0])});var Zp=ai("Date",!0);U("DDD",["DDDD",3],"DDDo","dayOfYear"),W("DDD",Do),W("DDDD",yp),ye(["DDD","DDDD"],function(t,e,n){n._dayOfYear=ae(t)});function U2(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return t==null?e:this.add(t-e,"d")}U("m",["mm",2],0,"minute"),W("m",ke,Gl),W("mm",ke,yt),ye(["m","mm"],zt);var q2=ai("Minutes",!1);U("s",["ss",2],0,"second"),W("s",ke,Gl),W("ss",ke,yt),ye(["s","ss"],vn);var K2=ai("Seconds",!1);U("S",0,0,function(){return~~(this.millisecond()/100)}),U(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),U(0,["SSS",3],0,"millisecond"),U(0,["SSSS",4],0,function(){return this.millisecond()*10}),U(0,["SSSSS",5],0,function(){return this.millisecond()*100}),U(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),U(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),U(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),U(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),W("S",Do,gp),W("SS",Do,yt),W("SSS",Do,yp);var Gn,Xp;for(Gn="SSSS";Gn.length<=9;Gn+="S")W(Gn,si);function J2(t,e){e[wr]=ae(("0."+t)*1e3)}for(Gn="S";Gn.length<=9;Gn+="S")ye(Gn,J2);Xp=ai("Milliseconds",!1),U("z",0,0,"zoneAbbr"),U("zz",0,0,"zoneName");function G2(){return this._isUTC?"UTC":""}function Z2(){return this._isUTC?"Coordinated Universal Time":""}var B=as.prototype;B.add=WE,B.calendar=GE,B.clone=ZE,B.diff=i2,B.endOf=p2,B.format=l2,B.from=c2,B.fromNow=d2,B.to=u2,B.toNow=f2,B.get=aT,B.invalidAt=S2,B.isAfter=XE,B.isBefore=QE,B.isBetween=e2,B.isSame=t2,B.isSameOrAfter=n2,B.isSameOrBefore=r2,B.isValid=v2,B.lang=Yp,B.locale=Hp,B.localeData=Up,B.max=vE,B.min=wE,B.parsingFlags=x2,B.set=lT,B.startOf=h2,B.subtract=HE,B.toArray=b2,B.toObject=k2,B.toDate=y2,B.toISOString=o2,B.inspect=a2,typeof Symbol<"u"&&Symbol.for!=null&&(B[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),B.toJSON=w2,B.toString=s2,B.unix=g2,B.valueOf=m2,B.creationData=M2,B.eraName=E2,B.eraNarrow=D2,B.eraAbbr=N2,B.eraYear=_2,B.year=wp,B.isLeapYear=oT,B.weekYear=$2,B.isoWeekYear=L2,B.quarter=B.quarters=Y2,B.month=Op,B.daysInMonth=yT,B.week=B.weeks=OT,B.isoWeek=B.isoWeeks=CT,B.weeksInYear=j2,B.weeksInWeekYear=W2,B.isoWeeksInYear=F2,B.isoWeeksInISOWeekYear=z2,B.date=Zp,B.day=B.days=LT,B.weekday=FT,B.isoWeekday=zT,B.dayOfYear=U2,B.hour=B.hours=KT,B.minute=B.minutes=q2,B.second=B.seconds=K2,B.millisecond=B.milliseconds=Xp,B.utcOffset=NE,B.utc=AE,B.local=VE,B.parseZone=BE,B.hasAlignedHourOffset=PE,B.isDST=IE,B.isLocal=$E,B.isUtcOffset=LE,B.isUtc=Lp,B.isUTC=Lp,B.zoneAbbr=G2,B.zoneName=Z2,B.dates=Ct("dates accessor is deprecated. Use date instead.",Zp),B.months=Ct("months accessor is deprecated. Use month instead",Op),B.years=Ct("years accessor is deprecated. Use year instead",wp),B.zone=Ct("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",_E),B.isDSTShifted=Ct("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",RE);function X2(t){return we(t*1e3)}function Q2(){return we.apply(null,arguments).parseZone()}function Qp(t){return t}var fe=Wl.prototype;fe.calendar=$C,fe.longDateFormat=jC,fe.invalidDate=HC,fe.ordinal=qC,fe.preparse=Qp,fe.postformat=Qp,fe.relativeTime=JC,fe.pastFuture=GC,fe.set=IC,fe.eras=O2,fe.erasParse=C2,fe.erasConvertYear=T2,fe.erasAbbrRegex=V2,fe.erasNameRegex=A2,fe.erasNarrowRegex=B2,fe.months=hT,fe.monthsShort=pT,fe.monthsParse=gT,fe.monthsRegex=kT,fe.monthsShortRegex=bT,fe.week=vT,fe.firstDayOfYear=MT,fe.firstDayOfWeek=ST,fe.weekdays=BT,fe.weekdaysMin=IT,fe.weekdaysShort=PT,fe.weekdaysParse=$T,fe.weekdaysRegex=jT,fe.weekdaysShortRegex=WT,fe.weekdaysMinRegex=HT,fe.isPM=UT,fe.meridiem=JT;function Ho(t,e,n,r){var i=Sn(),s=nn().set(r,e);return i[n](s,t)}function em(t,e,n){if(bn(t)&&(e=t,t=void 0),t=t||"",e!=null)return Ho(t,e,n,"month");var r,i=[];for(r=0;r<12;r++)i[r]=Ho(t,r,n,"month");return i}function hc(t,e,n,r){typeof t=="boolean"?(bn(e)&&(n=e,e=void 0),e=e||""):(e=t,n=e,t=!1,bn(e)&&(n=e,e=void 0),e=e||"");var i=Sn(),s=t?i._week.dow:0,o,a=[];if(n!=null)return Ho(e,(n+s)%7,r,"day");for(o=0;o<7;o++)a[o]=Ho(e,(o+s)%7,r,"day");return a}function eD(t,e){return em(t,e,"months")}function tD(t,e){return em(t,e,"monthsShort")}function nD(t,e,n){return hc(t,e,n,"weekdays")}function rD(t,e,n){return hc(t,e,n,"weekdaysShort")}function iD(t,e,n){return hc(t,e,n,"weekdaysMin")}Jn("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10,n=ae(t%100/10)===1?"th":e===1?"st":e===2?"nd":e===3?"rd":"th";return t+n}}),O.lang=Ct("moment.lang is deprecated. Use moment.locale instead.",Jn),O.langData=Ct("moment.langData is deprecated. Use moment.localeData instead.",Sn);var Mn=Math.abs;function sD(){var t=this._data;return this._milliseconds=Mn(this._milliseconds),this._days=Mn(this._days),this._months=Mn(this._months),t.milliseconds=Mn(t.milliseconds),t.seconds=Mn(t.seconds),t.minutes=Mn(t.minutes),t.hours=Mn(t.hours),t.months=Mn(t.months),t.years=Mn(t.years),this}function tm(t,e,n,r){var i=jt(e,n);return t._milliseconds+=r*i._milliseconds,t._days+=r*i._days,t._months+=r*i._months,t._bubble()}function oD(t,e){return tm(this,t,e,1)}function aD(t,e){return tm(this,t,e,-1)}function nm(t){return t<0?Math.floor(t):Math.ceil(t)}function lD(){var t=this._milliseconds,e=this._days,n=this._months,r=this._data,i,s,o,a,l;return t>=0&&e>=0&&n>=0||t<=0&&e<=0&&n<=0||(t+=nm(pc(n)+e)*864e5,e=0,n=0),r.milliseconds=t%1e3,i=Et(t/1e3),r.seconds=i%60,s=Et(i/60),r.minutes=s%60,o=Et(s/60),r.hours=o%24,e+=Et(o/24),l=Et(rm(e)),n+=l,e-=nm(pc(l)),a=Et(n/12),n%=12,r.days=e,r.months=n,r.years=a,this}function rm(t){return t*4800/146097}function pc(t){return t*146097/4800}function cD(t){if(!this.isValid())return NaN;var e,n,r=this._milliseconds;if(t=Tt(t),t==="month"||t==="quarter"||t==="year")switch(e=this._days+r/864e5,n=this._months+rm(e),t){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(e=this._days+Math.round(pc(this._months)),t){case"week":return e/7+r/6048e5;case"day":return e+r/864e5;case"hour":return e*24+r/36e5;case"minute":return e*1440+r/6e4;case"second":return e*86400+r/1e3;case"millisecond":return Math.floor(e*864e5)+r;default:throw new Error("Unknown unit "+t)}}function On(t){return function(){return this.as(t)}}var im=On("ms"),dD=On("s"),uD=On("m"),fD=On("h"),hD=On("d"),pD=On("w"),mD=On("M"),gD=On("Q"),yD=On("y"),bD=im;function kD(){return jt(this)}function wD(t){return t=Tt(t),this.isValid()?this[t+"s"]():NaN}function xr(t){return function(){return this.isValid()?this._data[t]:NaN}}var vD=xr("milliseconds"),xD=xr("seconds"),SD=xr("minutes"),MD=xr("hours"),OD=xr("days"),CD=xr("months"),TD=xr("years");function ED(){return Et(this.days()/7)}var Cn=Math.round,ui={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function DD(t,e,n,r,i){return i.relativeTime(e||1,!!n,t,r)}function ND(t,e,n,r){var i=jt(t).abs(),s=Cn(i.as("s")),o=Cn(i.as("m")),a=Cn(i.as("h")),l=Cn(i.as("d")),c=Cn(i.as("M")),u=Cn(i.as("w")),f=Cn(i.as("y")),h=s<=n.ss&&["s",s]||s<n.s&&["ss",s]||o<=1&&["m"]||o<n.m&&["mm",o]||a<=1&&["h"]||a<n.h&&["hh",a]||l<=1&&["d"]||l<n.d&&["dd",l];return n.w!=null&&(h=h||u<=1&&["w"]||u<n.w&&["ww",u]),h=h||c<=1&&["M"]||c<n.M&&["MM",c]||f<=1&&["y"]||["yy",f],h[2]=e,h[3]=+t>0,h[4]=r,DD.apply(null,h)}function _D(t){return t===void 0?Cn:typeof t=="function"?(Cn=t,!0):!1}function AD(t,e){return ui[t]===void 0?!1:e===void 0?ui[t]:(ui[t]=e,t==="s"&&(ui.ss=e-1),!0)}function VD(t,e){if(!this.isValid())return this.localeData().invalidDate();var n=!1,r=ui,i,s;return typeof t=="object"&&(e=t,t=!1),typeof t=="boolean"&&(n=t),typeof e=="object"&&(r=Object.assign({},ui,e),e.s!=null&&e.ss==null&&(r.ss=e.s-1)),i=this.localeData(),s=ND(this,!n,r,i),n&&(s=i.pastFuture(+this,s)),i.postformat(s)}var mc=Math.abs;function fi(t){return(t>0)-(t<0)||+t}function Yo(){if(!this.isValid())return this.localeData().invalidDate();var t=mc(this._milliseconds)/1e3,e=mc(this._days),n=mc(this._months),r,i,s,o,a=this.asSeconds(),l,c,u,f;return a?(r=Et(t/60),i=Et(r/60),t%=60,r%=60,s=Et(n/12),n%=12,o=t?t.toFixed(3).replace(/\.?0+$/,""):"",l=a<0?"-":"",c=fi(this._months)!==fi(a)?"-":"",u=fi(this._days)!==fi(a)?"-":"",f=fi(this._milliseconds)!==fi(a)?"-":"",l+"P"+(s?c+s+"Y":"")+(n?c+n+"M":"")+(e?u+e+"D":"")+(i||r||t?"T":"")+(i?f+i+"H":"")+(r?f+r+"M":"")+(t?f+o+"S":"")):"P0D"}var ce=$o.prototype;ce.isValid=CE,ce.abs=sD,ce.add=oD,ce.subtract=aD,ce.as=cD,ce.asMilliseconds=im,ce.asSeconds=dD,ce.asMinutes=uD,ce.asHours=fD,ce.asDays=hD,ce.asWeeks=pD,ce.asMonths=mD,ce.asQuarters=gD,ce.asYears=yD,ce.valueOf=bD,ce._bubble=lD,ce.clone=kD,ce.get=wD,ce.milliseconds=vD,ce.seconds=xD,ce.minutes=SD,ce.hours=MD,ce.days=OD,ce.weeks=ED,ce.months=CD,ce.years=TD,ce.humanize=VD,ce.toISOString=Yo,ce.toString=Yo,ce.toJSON=Yo,ce.locale=Hp,ce.localeData=Up,ce.toIsoString=Ct("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Yo),ce.lang=Yp,U("X",0,0,"unix"),U("x",0,0,"valueOf"),W("x",_o),W("X",eT),ye("X",function(t,e,n){n._d=new Date(parseFloat(t)*1e3)}),ye("x",function(t,e,n){n._d=new Date(ae(t))});//! moment.js
|
|
129
|
-
O.version="2.30.1",BC(we),O.fn=B,O.min=xE,O.max=SE,O.now=ME,O.utc=nn,O.unix=X2,O.months=eD,O.isDate=ss,O.locale=Jn,O.invalid=Oo,O.duration=jt,O.isMoment=Ft,O.weekdays=nD,O.parseZone=Q2,O.localeData=Sn,O.isDuration=Lo,O.monthsShort=tD,O.weekdaysMin=iD,O.defineLocale=nc,O.updateLocale=QT,O.locales=eE,O.weekdaysShort=rD,O.normalizeUnits=Tt,O.relativeTimeRounding=_D,O.relativeTimeThreshold=AD,O.calendarFormat=JE,O.prototype=B,O.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const gc={__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-slate-400 group-[.is-today]:text-lime-500 group-[.is-today]:font-medium group-[.is-selected]:bg-lime-500 group-[.is-selected]:text-white rounded-full"},n={pmi:"","wpic-tools":"group-[.is-highlight]:bg-slate-200"},r={pmi:"","wpic-tools":"bg-slate-100"},i={pmi:"","wpic-tools":"bg-slate-100 rounded-l-0"},s={pmi:"","wpic-tools":"bg-slate-100 rounded-r-0"},o={pmi:"","wpic-tools":"bg-slate-200"};return(a,l)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["relative flex items-center justify-center text-sm py-2 group",{"is-today":t.today&&!t.selected,"is-selected":t.selected,"is-off":t.off,"is-highlight":t.highlight,"cursor-pointer":!t.disabled}])},[d.createElementVNode("div",{class:d.normalizeClass(["h-8 w-full flex justify-center items-center",{[`${r[d.unref(de).theme]}`]:t.between,[`${i[d.unref(de).theme]}`]:t.firstDay,[`${s[d.unref(de).theme]}`]:t.lastDay,[`${o[d.unref(de).theme]}`]:t.highlight}]),style:d.normalizeStyle({marginLeft:t.firstDay?"50%":void 0,marginRight:t.lastDay?"50%":void 0})},[d.createElementVNode("span",{class:d.normalizeClass(["absolute w-8 h-8 flex items-center justify-center",{[`${e[d.unref(de).theme]}`]:!0,[`${n[d.unref(de).theme]}`]:t.highlight&&(t.firstDay||t.lastDay)}]),style:{left:"50%",transform:"translateX(-50%)"}},[d.renderSlot(a.$slots,"default",{},()=>[d.createTextVNode(d.toDisplayString(t.day),1)])],2)],6)],2))}},BD={class:"w-full"},PD={class:"flex justify-between items-center mb-3"},ID={class:"flex"},RD={class:"font-medium"},$D={class:"flex"},LD={class:"grid grid-cols-7 border-b mb-2 pb-2"},FD={class:"flex justify-center text-sm"},sm=Object.assign({name:"WpicCalendar"},{props:{modelValue:{},range:Boolean,doubleMonths:Boolean,maxDate:{},week:Boolean},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=d.ref([O(new Date).subtract(1,"month"),O(new Date)]);d.watch(()=>n.modelValue,()=>{var D;!n.range&&n.modelValue?r.value[0]=O(n.modelValue):n.range&&((D=n.modelValue)==null?void 0:D.length)==2&&(r.value[0]=O(n.modelValue[0]),r.value[1]=O(n.modelValue[1]))},{immediate:!0});const i=e,s=d.computed(()=>n.doubleMonths?[0,1]:[0]);function o(D){var L,H,J;if(n.week)i("update:modelValue",[O(D).startOf("week"),O(D).endOf("week")]);else if(n.range){if(((L=n.modelValue)==null?void 0:L.length)==0)i("update:modelValue",[D]);else if(((H=n.modelValue)==null?void 0:H.length)==2)i("update:modelValue",[D]);else if(((J=n.modelValue)==null?void 0:J.length)==1){let T=[O(n.modelValue[0]),O(D)];T=T.sort((q,re)=>q-re),i("update:modelValue",T)}}else i("update:modelValue",O(D))}function a(D){const L=O(D).daysInMonth(),H=[];for(let J=1;J<=L;J++){let T=O().date(J).month(O(D).month()).year(O(D).year());H.push(T)}return H}function l(D){return O(D).startOf("month").day()}function c(D,L){const H=O(`${D}-${L}-01`,"YYYY-MM-DD"),T=H.day(),q=[];for(let re=0;re<T;re++)q.push(H.clone().subtract(T-re,"days"));return q}function u(D,L){const H=O(`${D}-${L}`,"YYYY-MM").endOf("month"),T=6-H.day(),q=[];for(let re=1;re<=T;re++)q.push(H.clone().add(re,"days"));return q}function f(D){const L=O();return O(D).isSame(L,"day")}function h(D){var L,H;if(n.range){if(((L=n.modelValue)==null?void 0:L.length)==1)return O(D).isSame(O(n.modelValue[0]),"day");if(((H=n.modelValue)==null?void 0:H.length)==2)return O(D).isSame(O(n.modelValue[0]),"day")||O(D).isSame(O(n.modelValue[1]),"day")}else if(n.modelValue)return O(D).isSame(O(n.modelValue),"day")}function p(D){var L;if(n.range&&((L=n.modelValue)==null?void 0:L.length)==2)return O(D).isBetween(O(n.modelValue[0]),O(n.modelValue[1]))}function m(D){var L;if(n.range&&((L=n.modelValue)==null?void 0:L.length)==2)return O(D).isSame(O(n.modelValue[0]),"day")}function y(D){var L;if(n.range&&((L=n.modelValue)==null?void 0:L.length)==2)return O(D).isSame(O(n.modelValue[1]),"day")}function g(D){try{return n.maxDate?O(D).isAfter(O(n.maxDate)):!1}catch(L){return console.log(L),!1}}function k(D){E(D,r.value[D].subtract(1,"month"))}function x(D){E(D,r.value[D].add(1,"month"))}function C(D){E(D,r.value[D].subtract(1,"year"))}function b(D){E(D,r.value[D].add(1,"year"))}function E(D,L){D==0?r.value=[L,r.value[1]]:r.value=[r.value[0],L]}const w=d.ref();function _(D){n.week&&(w.value=O(D).week())}function R(D){return O(D).week()===w.value}function P(D){return O(D).week()===w.value?O(D).format("YYYY-MM-DD")===O().week(w.value).startOf("week").format("YYYY-MM-DD"):!1}function z(D){return O(D).week()===w.value?O(D).format("YYYY-MM-DD")===O().week(w.value).endOf("week").format("YYYY-MM-DD"):!1}function te(){w.value=null}return(D,L)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["flex-shrink-0 flex gap-6",{"min-w-96":s.value.length===1,"min-w-192":s.value.length===2}])},[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(s.value,H=>{var J;return d.openBlock(),d.createElementBlock("div",BD,[d.createElementVNode("div",PD,[d.createElementVNode("div",ID,[d.createVNode(Td,{class:"w-5 h-5 cursor-pointer select-none opacity-50 hover:opacity-100",onClick:T=>C(H)},null,8,["onClick"]),d.createVNode(Ed,{class:"w-5 h-5 cursor-pointer select-none opacity-50 hover:opacity-100",onClick:T=>k(H)},null,8,["onClick"])]),d.createElementVNode("div",RD,d.toDisplayString(r.value[H].format("YYYY MMMM")),1),d.createElementVNode("div",$D,[d.createVNode(Nd,{class:"w-5 h-5 cursor-pointer select-none opacity-50 hover:opacity-100",onClick:T=>x(H)},null,8,["onClick"]),d.createVNode(Dd,{class:"w-5 h-5 cursor-pointer select-none opacity-50 hover:opacity-100",onClick:T=>b(H)},null,8,["onClick"])])]),d.createElementVNode("div",LD,[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(7,T=>{var q;return d.createElementVNode("div",FD,d.toDisplayString((q=r.value[H])==null?void 0:q.clone().startOf("week").subtract(1,"days").add(T,"days").format("ddd")),1)}),64))]),d.createElementVNode("div",{class:"grid grid-cols-7",onMouseout:te},[l(r.value[H])>0?(d.openBlock(!0),d.createElementBlock(d.Fragment,{key:0},d.renderList(c(d.unref(O)(r.value[H]).year(),d.unref(O)(r.value[H]).month()+1),T=>(d.openBlock(),d.createBlock(gc,{onClick:q=>g(T)?null:o(T),onMouseover:q=>_(T),today:f(T),selected:h(T),firstDay:m(T)||P(T),lastDay:y(T)||z(T),between:p(T),highlight:R(T),off:""},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(d.unref(O)(T).format("D")),1)]),_:2},1032,["onClick","onMouseover","today","selected","firstDay","lastDay","between","highlight"]))),256)):d.createCommentVNode("",!0),(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(a(r.value[H].clone()),T=>(d.openBlock(),d.createBlock(gc,{onMouseover:q=>_(T),onClick:q=>g(T)?null:o(T),today:f(T),selected:h(T),firstDay:m(T)||P(T),lastDay:y(T)||z(T),between:p(T),disabled:g(T),off:g(T),highlight:R(T)},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(d.unref(O)(T).format("D")),1)]),_:2},1032,["onMouseover","onClick","today","selected","firstDay","lastDay","between","disabled","off","highlight"]))),256)),((J=u(d.unref(O)(r.value[H]).year(),d.unref(O)(r.value[H]).month()+1))==null?void 0:J.length)>0?(d.openBlock(!0),d.createElementBlock(d.Fragment,{key:1},d.renderList(u(d.unref(O)(r.value[H]).year(),d.unref(O)(r.value[H]).month()+1),T=>(d.openBlock(),d.createBlock(gc,{onClick:q=>g(T)?null:o(T),onMouseover:q=>_(T),today:f(T),selected:h(T),firstDay:m(T)||P(T),lastDay:y(T)||z(T),between:p(T),highlight:R(T),off:""},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(d.unref(O)(T).format("D")),1)]),_:2},1032,["onClick","onMouseover","today","selected","firstDay","lastDay","between","highlight"]))),256)):d.createCommentVNode("",!0)],32)])}),256))],2))}}),zD={},jD={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},WD=[d.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6.75 2.994v2.25m10.5-2.25v2.25m-14.252 13.5V7.491a2.25 2.25 0 0 1 2.25-2.25h13.5a2.25 2.25 0 0 1 2.25 2.25v11.251m-18 0a2.25 2.25 0 0 0 2.25 2.25h13.5a2.25 2.25 0 0 0 2.25-2.25m-18 0v-7.5a2.25 2.25 0 0 1 2.25-2.25h13.5a2.25 2.25 0 0 1 2.25 2.25v7.5m-6.75-6h2.25m-9 2.25h4.5m.002-2.25h.005v.006H12v-.006Zm-.001 4.5h.006v.006h-.006v-.005Zm-2.25.001h.005v.006H9.75v-.006Zm-2.25 0h.005v.005h-.006v-.005Zm6.75-2.247h.005v.005h-.005v-.005Zm0 2.247h.006v.006h-.006v-.006Zm2.25-2.248h.006V15H16.5v-.005Z"},null,-1)];function HD(t,e){return d.openBlock(),d.createElementBlock("svg",jD,WD)}const YD=be(zD,[["render",HD]]),UD={},qD={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},KD=[d.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5m-9-6h.008v.008H12v-.008ZM12 15h.008v.008H12V15Zm0 2.25h.008v.008H12v-.008ZM9.75 15h.008v.008H9.75V15Zm0 2.25h.008v.008H9.75v-.008ZM7.5 15h.008v.008H7.5V15Zm0 2.25h.008v.008H7.5v-.008Zm6.75-4.5h.008v.008h-.008v-.008Zm0 2.25h.008v.008h-.008V15Zm0 2.25h.008v.008h-.008v-.008Zm2.25-4.5h.008v.008H16.5v-.008Zm0 2.25h.008v.008H16.5V15Z"},null,-1)];function JD(t,e){return d.openBlock(),d.createElementBlock("svg",qD,KD)}const GD=be(UD,[["render",JD]]),yc={WpicCalendar:sm,WpicSlidePanel:Object.assign({name:"WpicSlidePanel"},{props:{visible:{type:Boolean,default:!1},withBackground:Boolean,options:{type:Object,default:()=>({width:"w-96",mr:"mr-0",zIndex:"z-10"})},expand:Boolean,island:Boolean},emits:["close"],setup(t,{expose:e,emit:n}){const r={pmi:"dark:bg-zinc-800","wpic-tools":"dark:bg-slate-800"},i=n;function s(){i("close")}e({goBottom:l,goTop:a});const o=d.ref(null);function a(){o.value.scrollTop=0}function l(){o.value.scrollTop=o.value.scrollHeight}return(c,u)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["fixed inset-0 h-full flex justify-end bg-black/50 backdrop-blur-sm 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:d.withModifiers(s,["self"])},[d.createElementVNode("div",{class:d.normalizeClass(["h-full bg-white transform-gpu transition-transform",{"rounded-lg":t.island,"translate-x-0":t.visible,"translate-x-full":!t.visible,[t.options.width]:!0,[r[d.unref(de).theme]]:!0}])},[d.createElementVNode("div",{ref_key:"panel",ref:o,class:d.normalizeClass(["h-full overflow-y-auto",{"p-6":!t.expand}])},[d.renderSlot(c.$slots,"default")],2)],2)],2))}}),WpicDateField: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,maxDate:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e;function i(o){r("update:modelValue",o)}const s=d.computed(()=>{var o;if(n.range)return(o=n.modelValue)==null?void 0:o.map(a=>O(a).format("YYYY-MM-DD")).join(" to ");if(n.modelValue)return O(n.modelValue).format("YYYY-MM-DD")});return(o,a)=>(d.openBlock(),d.createBlock(Ti,{disabled:t.disabled},{content:d.withCtx(()=>[d.createVNode(sm,{doubleMonths:t.doubleMonths,week:t.week,"max-date":t.maxDate,modelValue:t.modelValue,"onUpdate:modelValue":i,range:t.range},null,8,["doubleMonths","week","max-date","modelValue","range"])]),default:d.withCtx(()=>{var l;return[d.createVNode(Cd,{label:t.label,disabled:t.disabled,large:t.large,info:t.info,clearable:!!(t.clearable&&((l=t.modelValue)!=null&&l.length)),onOnClear:a[0]||(a[0]=c=>i(null))},{prepend:d.withCtx(()=>[t.range?(d.openBlock(),d.createBlock(YD,{key:0})):(d.openBlock(),d.createBlock(GD,{key:1}))]),default:d.withCtx(()=>[d.createTextVNode(" "+d.toDisplayString(s.value||t.placeholder),1)]),_:1},8,["label","disabled","large","info","clearable"])]}),_:1},8,["disabled"]))}}),WpicFormInput:Cd,WpicButton:Eg,WpicBadge:VC,WpicTextEditor:AC,WpicInputGroup:Vg,WpicButtonGroup:Dg,WpicForm:Bg,WpicFormField:Xy,WpicSpinner:Mi,WpicPopover:Ti,WpicChoiceList:mb,WpicCard:wb,WpicCardSection:Mb,WpicProgressBar:Cb,WpicTag:Eb,WpicTagGroup:Db,WpicPagination:Xb,WpicLoadingPanel:_b,WpicTable:f1,WpicTableColumn:h1};function om(t,e){for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(typeof e[n]=="object"&&t[n]?om(t[n],e[n]):t[n]=e[n])}function ZD(t,e){om(de,e);for(const n in yc)if(yc.hasOwnProperty(n)){const r=yc[n];t.component(r.name,r)}}return{install:ZD,options:de}});
|
|
129
|
+
O.version="2.30.1",BC(we),O.fn=B,O.min=xE,O.max=SE,O.now=ME,O.utc=nn,O.unix=X2,O.months=eD,O.isDate=ss,O.locale=Jn,O.invalid=Oo,O.duration=jt,O.isMoment=Ft,O.weekdays=nD,O.parseZone=Q2,O.localeData=Sn,O.isDuration=Lo,O.monthsShort=tD,O.weekdaysMin=iD,O.defineLocale=nc,O.updateLocale=QT,O.locales=eE,O.weekdaysShort=rD,O.normalizeUnits=Tt,O.relativeTimeRounding=_D,O.relativeTimeThreshold=AD,O.calendarFormat=JE,O.prototype=B,O.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const gc={__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-slate-400 group-[.is-today]:text-lime-500 group-[.is-today]:font-medium group-[.is-selected]:bg-lime-500 group-[.is-selected]:text-white rounded-full"},n={pmi:"","wpic-tools":"group-[.is-highlight]:bg-slate-200"},r={pmi:"","wpic-tools":"bg-slate-100"},i={pmi:"","wpic-tools":"bg-slate-100 rounded-l-0"},s={pmi:"","wpic-tools":"bg-slate-100 rounded-r-0"},o={pmi:"","wpic-tools":"bg-slate-200"};return(a,l)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["relative flex items-center justify-center text-sm py-2 group",{"is-today":t.today&&!t.selected,"is-selected":t.selected,"is-off":t.off,"is-highlight":t.highlight,"cursor-pointer":!t.disabled}])},[d.createElementVNode("div",{class:d.normalizeClass(["h-8 w-full flex justify-center items-center",{[`${r[d.unref(de).theme]}`]:t.between,[`${i[d.unref(de).theme]}`]:t.firstDay,[`${s[d.unref(de).theme]}`]:t.lastDay,[`${o[d.unref(de).theme]}`]:t.highlight}]),style:d.normalizeStyle({marginLeft:t.firstDay?"50%":void 0,marginRight:t.lastDay?"50%":void 0})},[d.createElementVNode("span",{class:d.normalizeClass(["absolute w-8 h-8 flex items-center justify-center",{[`${e[d.unref(de).theme]}`]:!0,[`${n[d.unref(de).theme]}`]:t.highlight&&(t.firstDay||t.lastDay)}]),style:{left:"50%",transform:"translateX(-50%)"}},[d.renderSlot(a.$slots,"default",{},()=>[d.createTextVNode(d.toDisplayString(t.day),1)])],2)],6)],2))}},BD={class:"w-full"},PD={class:"flex justify-between items-center mb-3"},ID={class:"flex"},RD={class:"font-medium"},$D={class:"flex"},LD={class:"grid grid-cols-7 border-b mb-2 pb-2"},FD={class:"flex justify-center text-sm"},sm=Object.assign({name:"WpicCalendar"},{props:{modelValue:{},range:Boolean,doubleMonths:Boolean,maxDate:{},week:Boolean,initDates:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=d.ref([O(new Date).subtract(1,"month"),O(new Date)]);d.watch(()=>n.initDates,()=>{var D;!n.range&&n.initDates?r.value[0]=O(n.initDates):n.range&&((D=n.initDates)==null?void 0:D.length)==2&&(r.value[0]=O(n.initDates[0]),r.value[1]=O(n.initDates[1]))},{immediate:!0,once:!0});const i=e,s=d.computed(()=>n.doubleMonths?[0,1]:[0]);function o(D){var L,H,J;if(n.week)i("update:modelValue",[O(D).startOf("week"),O(D).endOf("week")]);else if(n.range){if(((L=n.modelValue)==null?void 0:L.length)==0)i("update:modelValue",[D]);else if(((H=n.modelValue)==null?void 0:H.length)==2)i("update:modelValue",[D]);else if(((J=n.modelValue)==null?void 0:J.length)==1){let T=[O(n.modelValue[0]),O(D)];T=T.sort((q,re)=>q-re),i("update:modelValue",T)}}else i("update:modelValue",O(D))}function a(D){const L=O(D).daysInMonth(),H=[];for(let J=1;J<=L;J++){let T=O().date(J).month(O(D).month()).year(O(D).year());H.push(T)}return H}function l(D){return O(D).startOf("month").day()}function c(D,L){const H=O(`${D}-${L}-01`,"YYYY-MM-DD"),T=H.day(),q=[];for(let re=0;re<T;re++)q.push(H.clone().subtract(T-re,"days"));return q}function u(D,L){const H=O(`${D}-${L}`,"YYYY-MM").endOf("month"),T=6-H.day(),q=[];for(let re=1;re<=T;re++)q.push(H.clone().add(re,"days"));return q}function f(D){const L=O();return O(D).isSame(L,"day")}function h(D){var L,H;if(n.range){if(((L=n.modelValue)==null?void 0:L.length)==1)return O(D).isSame(O(n.modelValue[0]),"day");if(((H=n.modelValue)==null?void 0:H.length)==2)return O(D).isSame(O(n.modelValue[0]),"day")||O(D).isSame(O(n.modelValue[1]),"day")}else if(n.modelValue)return O(D).isSame(O(n.modelValue),"day")}function p(D){var L;if(n.range&&((L=n.modelValue)==null?void 0:L.length)==2)return O(D).isBetween(O(n.modelValue[0]),O(n.modelValue[1]))}function m(D){var L;if(n.range&&((L=n.modelValue)==null?void 0:L.length)==2)return O(D).isSame(O(n.modelValue[0]),"day")}function y(D){var L;if(n.range&&((L=n.modelValue)==null?void 0:L.length)==2)return O(D).isSame(O(n.modelValue[1]),"day")}function g(D){try{return n.maxDate?O(D).isAfter(O(n.maxDate)):!1}catch(L){return console.log(L),!1}}function k(D){E(D,r.value[D].subtract(1,"month"))}function v(D){E(D,r.value[D].add(1,"month"))}function C(D){E(D,r.value[D].subtract(1,"year"))}function b(D){E(D,r.value[D].add(1,"year"))}function E(D,L){D==0?r.value=[L,r.value[1]]:r.value=[r.value[0],L]}const w=d.ref();function _(D){n.week&&(w.value=O(D).week())}function R(D){return O(D).week()===w.value}function P(D){return O(D).week()===w.value?O(D).format("YYYY-MM-DD")===O().week(w.value).startOf("week").format("YYYY-MM-DD"):!1}function z(D){return O(D).week()===w.value?O(D).format("YYYY-MM-DD")===O().week(w.value).endOf("week").format("YYYY-MM-DD"):!1}function te(){w.value=null}return(D,L)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["flex-shrink-0 flex gap-6",{"min-w-96":s.value.length===1,"min-w-192":s.value.length===2}])},[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(s.value,H=>{var J;return d.openBlock(),d.createElementBlock("div",BD,[d.createElementVNode("div",PD,[d.createElementVNode("div",ID,[d.createVNode(Td,{class:"w-5 h-5 cursor-pointer select-none opacity-50 hover:opacity-100",onClick:T=>C(H)},null,8,["onClick"]),d.createVNode(Ed,{class:"w-5 h-5 cursor-pointer select-none opacity-50 hover:opacity-100",onClick:T=>k(H)},null,8,["onClick"])]),d.createElementVNode("div",RD,d.toDisplayString(r.value[H].format("YYYY MMMM")),1),d.createElementVNode("div",$D,[d.createVNode(Nd,{class:"w-5 h-5 cursor-pointer select-none opacity-50 hover:opacity-100",onClick:T=>v(H)},null,8,["onClick"]),d.createVNode(Dd,{class:"w-5 h-5 cursor-pointer select-none opacity-50 hover:opacity-100",onClick:T=>b(H)},null,8,["onClick"])])]),d.createElementVNode("div",LD,[(d.openBlock(),d.createElementBlock(d.Fragment,null,d.renderList(7,T=>{var q;return d.createElementVNode("div",FD,d.toDisplayString((q=r.value[H])==null?void 0:q.clone().startOf("week").subtract(1,"days").add(T,"days").format("ddd")),1)}),64))]),d.createElementVNode("div",{class:"grid grid-cols-7",onMouseout:te},[l(r.value[H])>0?(d.openBlock(!0),d.createElementBlock(d.Fragment,{key:0},d.renderList(c(d.unref(O)(r.value[H]).year(),d.unref(O)(r.value[H]).month()+1),T=>(d.openBlock(),d.createBlock(gc,{onClick:q=>g(T)?null:o(T),onMouseover:q=>_(T),today:f(T),selected:h(T),firstDay:m(T)||P(T),lastDay:y(T)||z(T),between:p(T),highlight:R(T),off:""},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(d.unref(O)(T).format("D")),1)]),_:2},1032,["onClick","onMouseover","today","selected","firstDay","lastDay","between","highlight"]))),256)):d.createCommentVNode("",!0),(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(a(r.value[H].clone()),T=>(d.openBlock(),d.createBlock(gc,{onMouseover:q=>_(T),onClick:q=>g(T)?null:o(T),today:f(T),selected:h(T),firstDay:m(T)||P(T),lastDay:y(T)||z(T),between:p(T),disabled:g(T),off:g(T),highlight:R(T)},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(d.unref(O)(T).format("D")),1)]),_:2},1032,["onMouseover","onClick","today","selected","firstDay","lastDay","between","disabled","off","highlight"]))),256)),((J=u(d.unref(O)(r.value[H]).year(),d.unref(O)(r.value[H]).month()+1))==null?void 0:J.length)>0?(d.openBlock(!0),d.createElementBlock(d.Fragment,{key:1},d.renderList(u(d.unref(O)(r.value[H]).year(),d.unref(O)(r.value[H]).month()+1),T=>(d.openBlock(),d.createBlock(gc,{onClick:q=>g(T)?null:o(T),onMouseover:q=>_(T),today:f(T),selected:h(T),firstDay:m(T)||P(T),lastDay:y(T)||z(T),between:p(T),highlight:R(T),off:""},{default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(d.unref(O)(T).format("D")),1)]),_:2},1032,["onClick","onMouseover","today","selected","firstDay","lastDay","between","highlight"]))),256)):d.createCommentVNode("",!0)],32)])}),256))],2))}}),zD={},jD={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},WD=[d.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6.75 2.994v2.25m10.5-2.25v2.25m-14.252 13.5V7.491a2.25 2.25 0 0 1 2.25-2.25h13.5a2.25 2.25 0 0 1 2.25 2.25v11.251m-18 0a2.25 2.25 0 0 0 2.25 2.25h13.5a2.25 2.25 0 0 0 2.25-2.25m-18 0v-7.5a2.25 2.25 0 0 1 2.25-2.25h13.5a2.25 2.25 0 0 1 2.25 2.25v7.5m-6.75-6h2.25m-9 2.25h4.5m.002-2.25h.005v.006H12v-.006Zm-.001 4.5h.006v.006h-.006v-.005Zm-2.25.001h.005v.006H9.75v-.006Zm-2.25 0h.005v.005h-.006v-.005Zm6.75-2.247h.005v.005h-.005v-.005Zm0 2.247h.006v.006h-.006v-.006Zm2.25-2.248h.006V15H16.5v-.005Z"},null,-1)];function HD(t,e){return d.openBlock(),d.createElementBlock("svg",jD,WD)}const YD=be(zD,[["render",HD]]),UD={},qD={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},KD=[d.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5m-9-6h.008v.008H12v-.008ZM12 15h.008v.008H12V15Zm0 2.25h.008v.008H12v-.008ZM9.75 15h.008v.008H9.75V15Zm0 2.25h.008v.008H9.75v-.008ZM7.5 15h.008v.008H7.5V15Zm0 2.25h.008v.008H7.5v-.008Zm6.75-4.5h.008v.008h-.008v-.008Zm0 2.25h.008v.008h-.008V15Zm0 2.25h.008v.008h-.008v-.008Zm2.25-4.5h.008v.008H16.5v-.008Zm0 2.25h.008v.008H16.5V15Z"},null,-1)];function JD(t,e){return d.openBlock(),d.createElementBlock("svg",qD,KD)}const GD=be(UD,[["render",JD]]),yc={WpicCalendar:sm,WpicSlidePanel:Object.assign({name:"WpicSlidePanel"},{props:{visible:{type:Boolean,default:!1},withBackground:Boolean,options:{type:Object,default:()=>({width:"w-96",mr:"mr-0",zIndex:"z-10"})},expand:Boolean,island:Boolean},emits:["close"],setup(t,{expose:e,emit:n}){const r={pmi:"dark:bg-zinc-800","wpic-tools":"dark:bg-slate-800"},i=n;function s(){i("close")}e({goBottom:l,goTop:a});const o=d.ref(null);function a(){o.value.scrollTop=0}function l(){o.value.scrollTop=o.value.scrollHeight}return(c,u)=>(d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["fixed inset-0 h-full flex justify-end bg-black/50 backdrop-blur-sm 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:d.withModifiers(s,["self"])},[d.createElementVNode("div",{class:d.normalizeClass(["h-full bg-white transform-gpu transition-transform",{"rounded-lg":t.island,"translate-x-0":t.visible,"translate-x-full":!t.visible,[t.options.width]:!0,[r[d.unref(de).theme]]:!0}])},[d.createElementVNode("div",{ref_key:"panel",ref:o,class:d.normalizeClass(["h-full overflow-y-auto",{"p-6":!t.expand}])},[d.renderSlot(c.$slots,"default")],2)],2)],2))}}),WpicDateField: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,maxDate:{},initDates:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e;function i(o){r("update:modelValue",o)}const s=d.computed(()=>{var o;if(n.range)return(o=n.modelValue)==null?void 0:o.map(a=>O(a).format("YYYY-MM-DD")).join(" to ");if(n.modelValue)return O(n.modelValue).format("YYYY-MM-DD")});return(o,a)=>(d.openBlock(),d.createBlock(Ti,{disabled:t.disabled},{content:d.withCtx(()=>[d.createVNode(sm,{doubleMonths:t.doubleMonths,initDates:t.initDates,week:t.week,"max-date":t.maxDate,modelValue:t.modelValue,"onUpdate:modelValue":i,range:t.range},null,8,["doubleMonths","initDates","week","max-date","modelValue","range"])]),default:d.withCtx(()=>{var l;return[d.createVNode(Cd,{label:t.label,disabled:t.disabled,large:t.large,info:t.info,clearable:!!(t.clearable&&((l=t.modelValue)!=null&&l.length)),onOnClear:a[0]||(a[0]=c=>i(null))},{prepend:d.withCtx(()=>[t.range?(d.openBlock(),d.createBlock(YD,{key:0})):(d.openBlock(),d.createBlock(GD,{key:1}))]),default:d.withCtx(()=>[d.createTextVNode(" "+d.toDisplayString(s.value||t.placeholder),1)]),_:1},8,["label","disabled","large","info","clearable"])]}),_:1},8,["disabled"]))}}),WpicFormInput:Cd,WpicButton:Eg,WpicBadge:VC,WpicTextEditor:AC,WpicInputGroup:Vg,WpicButtonGroup:Dg,WpicForm:Bg,WpicFormField:Xy,WpicSpinner:Mi,WpicPopover:Ti,WpicChoiceList:mb,WpicCard:wb,WpicCardSection:Mb,WpicProgressBar:Cb,WpicTag:Eb,WpicTagGroup:Db,WpicPagination:Xb,WpicLoadingPanel:_b,WpicTable:f1,WpicTableColumn:h1};function om(t,e){for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(typeof e[n]=="object"&&t[n]?om(t[n],e[n]):t[n]=e[n])}function ZD(t,e){om(de,e);for(const n in yc)if(yc.hasOwnProperty(n)){const r=yc[n];t.component(r.name,r)}}return{install:ZD,options:de}});
|